code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public void setBackends(java.util.Collection<Backend> backends) { if (backends == null) { this.backends = null; return; } this.backends = new java.util.ArrayList<Backend>(backends); } }
public class class_name { public void setBackends(java.util.Collection<Backend> backends) { if (backends == null) { this.backends = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.backends = new java.util.ArrayList<Backend>(backends); } }
public class class_name { private void reportSyntaxError(JCDiagnostic.DiagnosticPosition diagPos, String key, Object... args) { int pos = diagPos.getPreferredPosition(); if (pos > S.errPos() || pos == Position.NOPOS) { if (token.kind == EOF) { error(diagPos, "premature.eof"); } else { error(diagPos, key, args); } } S.errPos(pos); if (token.pos == errorPos) nextToken(); // guarantee progress errorPos = token.pos; } }
public class class_name { private void reportSyntaxError(JCDiagnostic.DiagnosticPosition diagPos, String key, Object... args) { int pos = diagPos.getPreferredPosition(); if (pos > S.errPos() || pos == Position.NOPOS) { if (token.kind == EOF) { error(diagPos, "premature.eof"); // depends on control dependency: [if], data = [none] } else { error(diagPos, key, args); // depends on control dependency: [if], data = [none] } } S.errPos(pos); if (token.pos == errorPos) nextToken(); // guarantee progress errorPos = token.pos; } }
public class class_name { String rrToString() { StringBuffer sb = new StringBuffer(); sb.append(alg); sb.append(" "); if (Options.check("multiline")) sb.append("(\n\t"); sb.append (timeSigned.getTime() / 1000); sb.append (" "); sb.append (fudge); sb.append (" "); sb.append (signature.length); if (Options.check("multiline")) { sb.append ("\n"); sb.append (base64.formatString(signature, 64, "\t", false)); } else { sb.append (" "); sb.append (base64.toString(signature)); } sb.append (" "); sb.append (Rcode.TSIGstring(error)); sb.append (" "); if (other == null) sb.append (0); else { sb.append (other.length); if (Options.check("multiline")) sb.append("\n\n\n\t"); else sb.append(" "); if (error == Rcode.BADTIME) { if (other.length != 6) { sb.append("<invalid BADTIME other data>"); } else { long time = ((long)(other[0] & 0xFF) << 40) + ((long)(other[1] & 0xFF) << 32) + ((other[2] & 0xFF) << 24) + ((other[3] & 0xFF) << 16) + ((other[4] & 0xFF) << 8) + ((other[5] & 0xFF) ); sb.append("<server time: "); sb.append(new Date(time * 1000)); sb.append(">"); } } else { sb.append("<"); sb.append(base64.toString(other)); sb.append(">"); } } if (Options.check("multiline")) sb.append(" )"); return sb.toString(); } }
public class class_name { String rrToString() { StringBuffer sb = new StringBuffer(); sb.append(alg); sb.append(" "); if (Options.check("multiline")) sb.append("(\n\t"); sb.append (timeSigned.getTime() / 1000); sb.append (" "); sb.append (fudge); sb.append (" "); sb.append (signature.length); if (Options.check("multiline")) { sb.append ("\n"); // depends on control dependency: [if], data = [none] sb.append (base64.formatString(signature, 64, "\t", false)); // depends on control dependency: [if], data = [none] } else { sb.append (" "); // depends on control dependency: [if], data = [none] sb.append (base64.toString(signature)); // depends on control dependency: [if], data = [none] } sb.append (" "); sb.append (Rcode.TSIGstring(error)); sb.append (" "); if (other == null) sb.append (0); else { sb.append (other.length); // depends on control dependency: [if], data = [(other] if (Options.check("multiline")) sb.append("\n\n\n\t"); else sb.append(" "); if (error == Rcode.BADTIME) { if (other.length != 6) { sb.append("<invalid BADTIME other data>"); // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] } else { long time = ((long)(other[0] & 0xFF) << 40) + ((long)(other[1] & 0xFF) << 32) + ((other[2] & 0xFF) << 24) + ((other[3] & 0xFF) << 16) + ((other[4] & 0xFF) << 8) + ((other[5] & 0xFF) ); sb.append("<server time: "); // depends on control dependency: [if], data = [none] sb.append(new Date(time * 1000)); // depends on control dependency: [if], data = [none] sb.append(">"); // depends on control dependency: [if], data = [none] } } else { sb.append("<"); // depends on control dependency: [if], data = [none] sb.append(base64.toString(other)); // depends on control dependency: [if], data = [none] sb.append(">"); // depends on control dependency: [if], data = [none] } } if (Options.check("multiline")) sb.append(" )"); return sb.toString(); } }
public class class_name { private static String clearPath(String path) { try { ExpressionBaseState state = new ExpressionBaseState("EXPR", true, false); if (Util.isWindows()) { // to not require escaping FS name separator state.setDefaultHandler(WordCharacterHandler.IGNORE_LB_ESCAPE_OFF); } else { state.setDefaultHandler(WordCharacterHandler.IGNORE_LB_ESCAPE_ON); } // Remove escaping characters path = ArgumentWithValue.resolveValue(path, state); } catch (CommandFormatException ex) { // XXX OK, continue translation } // Remove quote to retrieve candidates. if (path.startsWith("\"")) { path = path.substring(1); } // Could be an escaped " character. We don't take into account this corner case. // concider it the end of the quoted part. if (path.endsWith("\"")) { path = path.substring(0, path.length() - 1); } return path; } }
public class class_name { private static String clearPath(String path) { try { ExpressionBaseState state = new ExpressionBaseState("EXPR", true, false); if (Util.isWindows()) { // to not require escaping FS name separator state.setDefaultHandler(WordCharacterHandler.IGNORE_LB_ESCAPE_OFF); // depends on control dependency: [if], data = [none] } else { state.setDefaultHandler(WordCharacterHandler.IGNORE_LB_ESCAPE_ON); // depends on control dependency: [if], data = [none] } // Remove escaping characters path = ArgumentWithValue.resolveValue(path, state); // depends on control dependency: [try], data = [none] } catch (CommandFormatException ex) { // XXX OK, continue translation } // depends on control dependency: [catch], data = [none] // Remove quote to retrieve candidates. if (path.startsWith("\"")) { path = path.substring(1); // depends on control dependency: [if], data = [none] } // Could be an escaped " character. We don't take into account this corner case. // concider it the end of the quoted part. if (path.endsWith("\"")) { path = path.substring(0, path.length() - 1); // depends on control dependency: [if], data = [none] } return path; } }
public class class_name { @Override public GeocodingResult[] geocode(final String placeName) { logger.debug("Querying Google APIs for place: " + placeName); final GeoApiContext context = new GeoApiContext.Builder().apiKey(key).build(); GeocodingResult[] results; try { results = GeocodingApi.geocode(context, placeName).await(); } catch (Exception e) { logger.error("Problem querying the place: " + placeName, e); results = new GeocodingResult[0]; } return results; } }
public class class_name { @Override public GeocodingResult[] geocode(final String placeName) { logger.debug("Querying Google APIs for place: " + placeName); final GeoApiContext context = new GeoApiContext.Builder().apiKey(key).build(); GeocodingResult[] results; try { results = GeocodingApi.geocode(context, placeName).await(); // depends on control dependency: [try], data = [none] } catch (Exception e) { logger.error("Problem querying the place: " + placeName, e); results = new GeocodingResult[0]; } // depends on control dependency: [catch], data = [none] return results; } }
public class class_name { public boolean proofStep(ResolutionState state) { Clause query = state.getCurrentClause(); // The query goals are placed onto the goal stack backwards so that their insertion order is reversed for an // intuitive left-to-right evaluation order. for (int i = query.getBody().length - 1; i >= 0; i--) { BuiltInFunctor newGoal = state.getBuiltInTransform().apply(query.getBody()[i]); state.getGoalStack().offer(newGoal); } return true; } }
public class class_name { public boolean proofStep(ResolutionState state) { Clause query = state.getCurrentClause(); // The query goals are placed onto the goal stack backwards so that their insertion order is reversed for an // intuitive left-to-right evaluation order. for (int i = query.getBody().length - 1; i >= 0; i--) { BuiltInFunctor newGoal = state.getBuiltInTransform().apply(query.getBody()[i]); state.getGoalStack().offer(newGoal); // depends on control dependency: [for], data = [none] } return true; } }
public class class_name { public ListScriptsResult withScripts(Script... scripts) { if (this.scripts == null) { setScripts(new java.util.ArrayList<Script>(scripts.length)); } for (Script ele : scripts) { this.scripts.add(ele); } return this; } }
public class class_name { public ListScriptsResult withScripts(Script... scripts) { if (this.scripts == null) { setScripts(new java.util.ArrayList<Script>(scripts.length)); // depends on control dependency: [if], data = [none] } for (Script ele : scripts) { this.scripts.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { static Node parse(String expr, JobConf job) throws IOException { if (null == expr) { throw new IOException("Expression is null"); } Class<? extends WritableComparator> cmpcl = job.getClass("mapred.join.keycomparator", null, WritableComparator.class); Lexer lex = new Lexer(expr); Stack<Token> st = new Stack<Token>(); Token tok; while ((tok = lex.next()) != null) { if (TType.RPAREN.equals(tok.getType())) { st.push(reduce(st, job)); } else { st.push(tok); } } if (st.size() == 1 && TType.CIF.equals(st.peek().getType())) { Node ret = st.pop().getNode(); if (cmpcl != null) { ret.setKeyComparator(cmpcl); } return ret; } throw new IOException("Missing ')'"); } }
public class class_name { static Node parse(String expr, JobConf job) throws IOException { if (null == expr) { throw new IOException("Expression is null"); } Class<? extends WritableComparator> cmpcl = job.getClass("mapred.join.keycomparator", null, WritableComparator.class); Lexer lex = new Lexer(expr); Stack<Token> st = new Stack<Token>(); Token tok; while ((tok = lex.next()) != null) { if (TType.RPAREN.equals(tok.getType())) { st.push(reduce(st, job)); } else { st.push(tok); } } if (st.size() == 1 && TType.CIF.equals(st.peek().getType())) { Node ret = st.pop().getNode(); if (cmpcl != null) { ret.setKeyComparator(cmpcl); // depends on control dependency: [if], data = [(cmpcl] } return ret; } throw new IOException("Missing ')'"); } }
public class class_name { public static void main(final String[] args) { // init of the connection to the plugin int viewPort = 0; final List<String> classList = new ArrayList<String>(); for (int i = 0; i < args.length; i++) { if (args[i].equals("-Port")) { if (args[i + 1] != null) { viewPort = Integer.parseInt(args[i + 1]); } break; } else { classList.add(args[i]); } } try { final IUpdater updater = new SocketViewProgressUpdater(null, viewPort); final SocketAdapter adapter = new SocketAdapter(updater, classList.toArray(new String[classList.size()])); adapter.registerClasses(classList.toArray(new String[classList .size()])); adapter.runBenchmark(); } catch (final SocketViewException | ClassNotFoundException | InstantiationException | IllegalAccessException e) { throw new IllegalStateException(e); } } }
public class class_name { public static void main(final String[] args) { // init of the connection to the plugin int viewPort = 0; final List<String> classList = new ArrayList<String>(); for (int i = 0; i < args.length; i++) { if (args[i].equals("-Port")) { if (args[i + 1] != null) { viewPort = Integer.parseInt(args[i + 1]); // depends on control dependency: [if], data = [(args[i + 1]] } break; } else { classList.add(args[i]); // depends on control dependency: [if], data = [none] } } try { final IUpdater updater = new SocketViewProgressUpdater(null, viewPort); final SocketAdapter adapter = new SocketAdapter(updater, classList.toArray(new String[classList.size()])); adapter.registerClasses(classList.toArray(new String[classList .size()])); // depends on control dependency: [try], data = [none] adapter.runBenchmark(); // depends on control dependency: [try], data = [none] } catch (final SocketViewException | ClassNotFoundException | InstantiationException | IllegalAccessException e) { throw new IllegalStateException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public void execute(Runnable task) { Executor executor = getScheduledExecutor(); try { executor.execute(errorHandlingTask(task, false)); } catch (RejectedExecutionException ex) { throw new TaskRejectedException("Executor [" + executor + "] did not accept task: " + task, ex); } } }
public class class_name { @Override public void execute(Runnable task) { Executor executor = getScheduledExecutor(); try { executor.execute(errorHandlingTask(task, false)); // depends on control dependency: [try], data = [none] } catch (RejectedExecutionException ex) { throw new TaskRejectedException("Executor [" + executor + "] did not accept task: " + task, ex); } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected Node doClone(Node parent) { Node clone; try { clone = (Node) super.clone(); } catch (CloneNotSupportedException e) { throw new RuntimeException(e); } clone.parentNode = parent; // can be null, to create an orphan split clone.siblingIndex = parent == null ? 0 : siblingIndex; return clone; } }
public class class_name { protected Node doClone(Node parent) { Node clone; try { clone = (Node) super.clone(); // depends on control dependency: [try], data = [none] } catch (CloneNotSupportedException e) { throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] clone.parentNode = parent; // can be null, to create an orphan split clone.siblingIndex = parent == null ? 0 : siblingIndex; return clone; } }
public class class_name { public void setStripSpaces(WhiteSpaceInfo wsi) { if (null == m_whitespaceStrippingElements) { m_whitespaceStrippingElements = new Vector(); } m_whitespaceStrippingElements.addElement(wsi); } }
public class class_name { public void setStripSpaces(WhiteSpaceInfo wsi) { if (null == m_whitespaceStrippingElements) { m_whitespaceStrippingElements = new Vector(); // depends on control dependency: [if], data = [none] } m_whitespaceStrippingElements.addElement(wsi); } }
public class class_name { public static Schema.Field[] flatSchema(Schema s) { List<Schema.Field> fields = s.getFields(); Schema.Field[] flatSchema = new Schema.Field[fields.size()]; int cnt = 0; for (Schema.Field f : fields) { if (isSupportedSchema(f.schema())) { flatSchema[cnt] = f; cnt++; } } // Return resized array return cnt != flatSchema.length ? Arrays.copyOf(flatSchema, cnt) : flatSchema; } }
public class class_name { public static Schema.Field[] flatSchema(Schema s) { List<Schema.Field> fields = s.getFields(); Schema.Field[] flatSchema = new Schema.Field[fields.size()]; int cnt = 0; for (Schema.Field f : fields) { if (isSupportedSchema(f.schema())) { flatSchema[cnt] = f; // depends on control dependency: [if], data = [none] cnt++; // depends on control dependency: [if], data = [none] } } // Return resized array return cnt != flatSchema.length ? Arrays.copyOf(flatSchema, cnt) : flatSchema; } }
public class class_name { public boolean userHasLock(String username) { Objects.requireNonNull(username, Required.USERNAME.toString()); boolean lock = false; Config config = Application.getInstance(Config.class); Cache cache = Application.getInstance(CacheProvider.class).getCache(CacheName.AUTH); AtomicInteger counter = cache.getCounter(username); if (counter != null && counter.get() > config.getAuthenticationLock()) { lock = true; } return lock; } }
public class class_name { public boolean userHasLock(String username) { Objects.requireNonNull(username, Required.USERNAME.toString()); boolean lock = false; Config config = Application.getInstance(Config.class); Cache cache = Application.getInstance(CacheProvider.class).getCache(CacheName.AUTH); AtomicInteger counter = cache.getCounter(username); if (counter != null && counter.get() > config.getAuthenticationLock()) { lock = true; // depends on control dependency: [if], data = [none] } return lock; } }
public class class_name { public final void sendBroadCastVariables(Configuration config) throws IOException { try { int broadcastCount = config.getInteger(PLANBINDER_CONFIG_BCVAR_COUNT, 0); String[] names = new String[broadcastCount]; for (int x = 0; x < names.length; x++) { names[x] = config.getString(PLANBINDER_CONFIG_BCVAR_NAME_PREFIX + x, null); } out.write(new IntSerializer().serializeWithoutTypeInfo(broadcastCount)); StringSerializer stringSerializer = new StringSerializer(); for (String name : names) { Iterator<byte[]> bcv = function.getRuntimeContext().<byte[]>getBroadcastVariable(name).iterator(); out.write(stringSerializer.serializeWithoutTypeInfo(name)); while (bcv.hasNext()) { out.writeByte(1); out.write(bcv.next()); } out.writeByte(0); } } catch (SocketTimeoutException ignored) { throw new RuntimeException("External process for task " + function.getRuntimeContext().getTaskName() + " stopped responding." + msg); } } }
public class class_name { public final void sendBroadCastVariables(Configuration config) throws IOException { try { int broadcastCount = config.getInteger(PLANBINDER_CONFIG_BCVAR_COUNT, 0); String[] names = new String[broadcastCount]; for (int x = 0; x < names.length; x++) { names[x] = config.getString(PLANBINDER_CONFIG_BCVAR_NAME_PREFIX + x, null); } out.write(new IntSerializer().serializeWithoutTypeInfo(broadcastCount)); StringSerializer stringSerializer = new StringSerializer(); for (String name : names) { Iterator<byte[]> bcv = function.getRuntimeContext().<byte[]>getBroadcastVariable(name).iterator(); out.write(stringSerializer.serializeWithoutTypeInfo(name)); while (bcv.hasNext()) { out.writeByte(1); // depends on control dependency: [while], data = [none] out.write(bcv.next()); // depends on control dependency: [while], data = [none] } out.writeByte(0); } } catch (SocketTimeoutException ignored) { throw new RuntimeException("External process for task " + function.getRuntimeContext().getTaskName() + " stopped responding." + msg); } } }
public class class_name { private List<Type> pruneInterfaces(Type t) { ListBuffer<Type> result = new ListBuffer<>(); for (Type t1 : types.interfaces(t)) { boolean shouldAdd = true; for (Type t2 : types.directSupertypes(t)) { if (t1 != t2 && types.isSubtypeNoCapture(t2, t1)) { shouldAdd = false; } } if (shouldAdd) { result.append(t1); } } return result.toList(); } }
public class class_name { private List<Type> pruneInterfaces(Type t) { ListBuffer<Type> result = new ListBuffer<>(); for (Type t1 : types.interfaces(t)) { boolean shouldAdd = true; for (Type t2 : types.directSupertypes(t)) { if (t1 != t2 && types.isSubtypeNoCapture(t2, t1)) { shouldAdd = false; // depends on control dependency: [if], data = [none] } } if (shouldAdd) { result.append(t1); // depends on control dependency: [if], data = [none] } } return result.toList(); } }
public class class_name { private static MethodHandles.Lookup lookupIn(final Class<?> declaringClass) { try { final Constructor<MethodHandles.Lookup> constructor = MethodHandles.Lookup.class.getDeclaredConstructor( Class.class, int.class); constructor.setAccessible(true); return constructor.newInstance(declaringClass, MethodHandles.Lookup.PRIVATE); } catch (NoSuchMethodException | InvocationTargetException | InstantiationException | IllegalAccessException e) { throw new RuntimeException(e); } } }
public class class_name { private static MethodHandles.Lookup lookupIn(final Class<?> declaringClass) { try { final Constructor<MethodHandles.Lookup> constructor = MethodHandles.Lookup.class.getDeclaredConstructor( Class.class, int.class); constructor.setAccessible(true); // depends on control dependency: [try], data = [none] return constructor.newInstance(declaringClass, MethodHandles.Lookup.PRIVATE); // depends on control dependency: [try], data = [none] } catch (NoSuchMethodException | InvocationTargetException | InstantiationException | IllegalAccessException e) { throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void modify(final DataMatrix matrix) { Assert.assertNotNull(matrix); transactionTemplate.execute(new TransactionCallbackWithoutResult() { protected void doInTransactionWithoutResult(TransactionStatus status) { try { DataMatrixDO matrixDo = modelToDo(matrix); if (dataMatrixDao.checkUnique(matrixDo)) { dataMatrixDao.update(matrixDo); } else { String exceptionCause = "exist the same repeat matrix in the database."; logger.warn("WARN ## " + exceptionCause); throw new RepeatConfigureException(exceptionCause); } } catch (RepeatConfigureException rce) { throw rce; } catch (Exception e) { logger.error("ERROR ## modify canal(" + matrix.getId() + ") has an exception!"); throw new ManagerException(e); } } }); } }
public class class_name { public void modify(final DataMatrix matrix) { Assert.assertNotNull(matrix); transactionTemplate.execute(new TransactionCallbackWithoutResult() { protected void doInTransactionWithoutResult(TransactionStatus status) { try { DataMatrixDO matrixDo = modelToDo(matrix); if (dataMatrixDao.checkUnique(matrixDo)) { dataMatrixDao.update(matrixDo); // depends on control dependency: [if], data = [none] } else { String exceptionCause = "exist the same repeat matrix in the database."; // depends on control dependency: [if], data = [none] logger.warn("WARN ## " + exceptionCause); // depends on control dependency: [if], data = [none] throw new RepeatConfigureException(exceptionCause); } } catch (RepeatConfigureException rce) { throw rce; } catch (Exception e) { // depends on control dependency: [catch], data = [none] logger.error("ERROR ## modify canal(" + matrix.getId() + ") has an exception!"); throw new ManagerException(e); } } }); } } // depends on control dependency: [catch], data = [none]
public class class_name { private String removeEscapeChar(final String str, final char escapeChar) { if(str == null || str.isEmpty()) { return str; } final String escapeStr = String.valueOf(escapeChar); StringBuilder sb = new StringBuilder(); final LinkedList<String> stack = new LinkedList<>(); final int length = str.length(); for(int i=0; i < length; i++) { final char c = str.charAt(i); if(StackUtils.equalsTopElement(stack, escapeStr)) { // スタックの一番上がエスケープ文字の場合 StackUtils.popup(stack); sb.append(c); } else if(c == escapeChar) { // スタックに積む stack.push(String.valueOf(c)); } else { sb.append(c); } } if(!stack.isEmpty()) { sb.append(StackUtils.popupAndConcat(stack)); } return sb.toString(); } }
public class class_name { private String removeEscapeChar(final String str, final char escapeChar) { if(str == null || str.isEmpty()) { return str; // depends on control dependency: [if], data = [none] } final String escapeStr = String.valueOf(escapeChar); StringBuilder sb = new StringBuilder(); final LinkedList<String> stack = new LinkedList<>(); final int length = str.length(); for(int i=0; i < length; i++) { final char c = str.charAt(i); if(StackUtils.equalsTopElement(stack, escapeStr)) { // スタックの一番上がエスケープ文字の場合 StackUtils.popup(stack); // depends on control dependency: [if], data = [none] sb.append(c); // depends on control dependency: [if], data = [none] } else if(c == escapeChar) { // スタックに積む stack.push(String.valueOf(c)); // depends on control dependency: [if], data = [(c] } else { sb.append(c); // depends on control dependency: [if], data = [(c] } } if(!stack.isEmpty()) { sb.append(StackUtils.popupAndConcat(stack)); // depends on control dependency: [if], data = [none] } return sb.toString(); } }
public class class_name { public static TrmMessageFactory getInstance() { if (_instance == null) { synchronized(TrmMessageFactory.class) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createFactoryInstance"); try { Class cls = Class.forName(TRM_MESSAGE_FACTORY_CLASS); _instance = (TrmMessageFactory) cls.newInstance(); } catch (Exception e) { FFDCFilter.processException(e, "com.ibm.ws.sib.mfp.TrmMessageFactory.createFactoryInstance", "112"); SibTr.error(tc,"UNABLE_TO_CREATE_TRMFACTORY_CWSIF0021",e); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createFactoryInstance",_instance); } } return _instance; } }
public class class_name { public static TrmMessageFactory getInstance() { if (_instance == null) { synchronized(TrmMessageFactory.class) { // depends on control dependency: [if], data = [none] if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createFactoryInstance"); try { Class cls = Class.forName(TRM_MESSAGE_FACTORY_CLASS); _instance = (TrmMessageFactory) cls.newInstance(); } catch (Exception e) { FFDCFilter.processException(e, "com.ibm.ws.sib.mfp.TrmMessageFactory.createFactoryInstance", "112"); SibTr.error(tc,"UNABLE_TO_CREATE_TRMFACTORY_CWSIF0021",e); } // depends on control dependency: [catch], data = [none] if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createFactoryInstance",_instance); } } return _instance; } }
public class class_name { void findHistogramPeaks() { // reset data structures peaks.reset(); angles.reset(); peakAngle = 0; // identify peaks and find the highest peak double largest = 0; int largestIndex = -1; double before = histogramMag[ histogramMag.length-2 ]; double current = histogramMag[ histogramMag.length-1 ]; for(int i = 0; i < histogramMag.length; i++ ) { double after = histogramMag[ i ]; if( current > before && current > after ) { int currentIndex = CircularIndex.addOffset(i,-1,histogramMag.length); peaks.push(currentIndex); if( current > largest ) { largest = current; largestIndex = currentIndex; } } before = current; current = after; } if( largestIndex < 0 ) return; // see if any of the other peaks are within 80% of the max peak double threshold = largest*0.8; for( int i = 0; i < peaks.size; i++ ) { int index = peaks.data[i]; current = histogramMag[index]; if( current >= threshold) { double angle = computeAngle(index); angles.push( angle ); if( index == largestIndex ) peakAngle = angle; } } } }
public class class_name { void findHistogramPeaks() { // reset data structures peaks.reset(); angles.reset(); peakAngle = 0; // identify peaks and find the highest peak double largest = 0; int largestIndex = -1; double before = histogramMag[ histogramMag.length-2 ]; double current = histogramMag[ histogramMag.length-1 ]; for(int i = 0; i < histogramMag.length; i++ ) { double after = histogramMag[ i ]; if( current > before && current > after ) { int currentIndex = CircularIndex.addOffset(i,-1,histogramMag.length); peaks.push(currentIndex); // depends on control dependency: [if], data = [none] if( current > largest ) { largest = current; // depends on control dependency: [if], data = [none] largestIndex = currentIndex; // depends on control dependency: [if], data = [none] } } before = current; // depends on control dependency: [for], data = [none] current = after; // depends on control dependency: [for], data = [none] } if( largestIndex < 0 ) return; // see if any of the other peaks are within 80% of the max peak double threshold = largest*0.8; for( int i = 0; i < peaks.size; i++ ) { int index = peaks.data[i]; current = histogramMag[index]; // depends on control dependency: [for], data = [none] if( current >= threshold) { double angle = computeAngle(index); angles.push( angle ); // depends on control dependency: [if], data = [none] if( index == largestIndex ) peakAngle = angle; } } } }
public class class_name { private static boolean hasBreakpointAtCurrentPosition(VdmThread thread) { try { thread.updateStack(); if (thread.hasStackFrames()) { final IStackFrame top = thread.getTopStackFrame(); if (top instanceof IVdmStackFrame && top.getLineNumber() > 0) { final IVdmStackFrame frame = (IVdmStackFrame) top; if (frame.getSourceURI() != null) { final String location = frame.getSourceURI().getPath(); final IDbgpBreakpoint[] breakpoints = thread.getDbgpSession().getCoreCommands().getBreakpoints(); for (int i = 0; i < breakpoints.length; ++i) { if (breakpoints[i] instanceof IDbgpLineBreakpoint) { final IDbgpLineBreakpoint bp = (IDbgpLineBreakpoint) breakpoints[i]; if (frame.getLineNumber() == bp.getLineNumber()) { try { if (new URI(bp.getFilename()).getPath().equals(location)) { return true; } } catch (URISyntaxException e) { if (VdmDebugPlugin.DEBUG) { e.printStackTrace(); } } } } } } } } } catch (DebugException e) { if (VdmDebugPlugin.DEBUG) { e.printStackTrace(); } } catch (DbgpException e) { if (VdmDebugPlugin.DEBUG) { e.printStackTrace(); } } return false; } }
public class class_name { private static boolean hasBreakpointAtCurrentPosition(VdmThread thread) { try { thread.updateStack(); // depends on control dependency: [try], data = [none] if (thread.hasStackFrames()) { final IStackFrame top = thread.getTopStackFrame(); if (top instanceof IVdmStackFrame && top.getLineNumber() > 0) { final IVdmStackFrame frame = (IVdmStackFrame) top; if (frame.getSourceURI() != null) { final String location = frame.getSourceURI().getPath(); final IDbgpBreakpoint[] breakpoints = thread.getDbgpSession().getCoreCommands().getBreakpoints(); for (int i = 0; i < breakpoints.length; ++i) { if (breakpoints[i] instanceof IDbgpLineBreakpoint) { final IDbgpLineBreakpoint bp = (IDbgpLineBreakpoint) breakpoints[i]; if (frame.getLineNumber() == bp.getLineNumber()) { try { if (new URI(bp.getFilename()).getPath().equals(location)) { return true; // depends on control dependency: [if], data = [none] } } catch (URISyntaxException e) { if (VdmDebugPlugin.DEBUG) { e.printStackTrace(); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } } } } } } } catch (DebugException e) { if (VdmDebugPlugin.DEBUG) { e.printStackTrace(); // depends on control dependency: [if], data = [none] } } catch (DbgpException e) // depends on control dependency: [catch], data = [none] { if (VdmDebugPlugin.DEBUG) { e.printStackTrace(); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] return false; } }
public class class_name { long getOsTotalFreeMemorySize() { if (!Files.isRegularFile(Paths.get(MEM_INFO_FILE))) { // Mac doesn't support /proc/meminfo for example. return 0; } final List<String> lines; // The file /proc/meminfo is assumed to contain only ASCII characters. // The assumption is that the file is not too big. So it is simpler to read the whole file // into memory. try { lines = Files.readAllLines(Paths.get(MEM_INFO_FILE), StandardCharsets.UTF_8); } catch (final IOException e) { final String errMsg = "Failed to open mem info file: " + MEM_INFO_FILE; logger.error(errMsg, e); return 0; } return getOsTotalFreeMemorySizeFromStrings(lines); } }
public class class_name { long getOsTotalFreeMemorySize() { if (!Files.isRegularFile(Paths.get(MEM_INFO_FILE))) { // Mac doesn't support /proc/meminfo for example. return 0; // depends on control dependency: [if], data = [none] } final List<String> lines; // The file /proc/meminfo is assumed to contain only ASCII characters. // The assumption is that the file is not too big. So it is simpler to read the whole file // into memory. try { lines = Files.readAllLines(Paths.get(MEM_INFO_FILE), StandardCharsets.UTF_8); // depends on control dependency: [try], data = [none] } catch (final IOException e) { final String errMsg = "Failed to open mem info file: " + MEM_INFO_FILE; logger.error(errMsg, e); return 0; } // depends on control dependency: [catch], data = [none] return getOsTotalFreeMemorySizeFromStrings(lines); } }
public class class_name { @Override public void set(long timestampMs, long value) { long key = toTimeSeriesPoint(timestampMs); counter.put(key, value); if (counter.size() > maxNumBlocks) { reduce(); } } }
public class class_name { @Override public void set(long timestampMs, long value) { long key = toTimeSeriesPoint(timestampMs); counter.put(key, value); if (counter.size() > maxNumBlocks) { reduce(); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public ChannelsModel getChannels() { if (_channels == null) { _channels = (ChannelsModel)getFirstChildModel(CHANNELS); } return _channels; } }
public class class_name { @Override public ChannelsModel getChannels() { if (_channels == null) { _channels = (ChannelsModel)getFirstChildModel(CHANNELS); // depends on control dependency: [if], data = [none] } return _channels; } }
public class class_name { protected void loadOptionalExecutor(final String executorBinder) { try { final Method bindExecutor = RepositoryModule.class.getDeclaredMethod("bindExecutor", Class.class); bindExecutor.setAccessible(true); try { Class.forName(executorBinder) .getConstructor(RepositoryModule.class, Method.class) .newInstance(this, bindExecutor); } finally { bindExecutor.setAccessible(false); } } catch (Exception ignore) { if (logger.isTraceEnabled()) { logger.trace("Failed to process executor loader " + executorBinder, ignore); } } } }
public class class_name { protected void loadOptionalExecutor(final String executorBinder) { try { final Method bindExecutor = RepositoryModule.class.getDeclaredMethod("bindExecutor", Class.class); bindExecutor.setAccessible(true); // depends on control dependency: [try], data = [none] try { Class.forName(executorBinder) .getConstructor(RepositoryModule.class, Method.class) .newInstance(this, bindExecutor); } finally { bindExecutor.setAccessible(false); } } catch (Exception ignore) { if (logger.isTraceEnabled()) { logger.trace("Failed to process executor loader " + executorBinder, ignore); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } }
public class class_name { @SuppressWarnings("unchecked") @Override public List<T> multiGet(List<List<Object>> keys) { try { List<T> values = new ArrayList<T>(); for (List<Object> rowKey : keys) { Statement statement = mapper.retrieve(rowKey); ResultSet results = session.execute(statement); // TODO: Better way to check for empty results besides accessing entire results list Iterator<Row> rowIter = results.iterator(); Row row; if (results != null && rowIter.hasNext() && (row = rowIter.next()) != null) { if (rowIter.hasNext()) { LOG.error("Found non-unique value for key [{}]", rowKey); } else { values.add((T) mapper.getValue(row)); } } else { values.add(null); } } _mreads.incrBy(values.size()); LOG.debug("Retrieving the following keys: {} with values: {}", keys, values); return values; } catch (Exception e) { checkCassandraException(e); throw new IllegalStateException("Impossible to reach this code"); } } }
public class class_name { @SuppressWarnings("unchecked") @Override public List<T> multiGet(List<List<Object>> keys) { try { List<T> values = new ArrayList<T>(); for (List<Object> rowKey : keys) { Statement statement = mapper.retrieve(rowKey); ResultSet results = session.execute(statement); // TODO: Better way to check for empty results besides accessing entire results list Iterator<Row> rowIter = results.iterator(); Row row; if (results != null && rowIter.hasNext() && (row = rowIter.next()) != null) { if (rowIter.hasNext()) { LOG.error("Found non-unique value for key [{}]", rowKey); } else { values.add((T) mapper.getValue(row)); // depends on control dependency: [if], data = [none] } } else { values.add(null); // depends on control dependency: [if], data = [none] } } _mreads.incrBy(values.size()); // depends on control dependency: [try], data = [none] LOG.debug("Retrieving the following keys: {} with values: {}", keys, values); // depends on control dependency: [try], data = [none] return values; // depends on control dependency: [try], data = [none] } catch (Exception e) { checkCassandraException(e); throw new IllegalStateException("Impossible to reach this code"); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public ObjectBank<List<IN>> makeObjectBankFromReader(BufferedReader in, DocumentReaderAndWriter<IN> readerAndWriter) { if (flags.announceObjectBankEntries) { System.err.println("Reading data using " + readerAndWriter.getClass()); } // TODO get rid of objectbankwrapper // return new ObjectBank<List<IN>>(new ResettableReaderIteratorFactory(in), // readerAndWriter); return new ObjectBankWrapper<IN>(flags, new ObjectBank<List<IN>>(new ResettableReaderIteratorFactory(in), readerAndWriter), knownLCWords); } }
public class class_name { public ObjectBank<List<IN>> makeObjectBankFromReader(BufferedReader in, DocumentReaderAndWriter<IN> readerAndWriter) { if (flags.announceObjectBankEntries) { System.err.println("Reading data using " + readerAndWriter.getClass()); // depends on control dependency: [if], data = [none] } // TODO get rid of objectbankwrapper // return new ObjectBank<List<IN>>(new ResettableReaderIteratorFactory(in), // readerAndWriter); return new ObjectBankWrapper<IN>(flags, new ObjectBank<List<IN>>(new ResettableReaderIteratorFactory(in), readerAndWriter), knownLCWords); } }
public class class_name { public synchronized boolean fail(ServiceException ex) { if (completed) { return false; } this.completed = true; this.ex = ex; notifyAll(); return true; } }
public class class_name { public synchronized boolean fail(ServiceException ex) { if (completed) { return false; // depends on control dependency: [if], data = [none] } this.completed = true; this.ex = ex; notifyAll(); return true; } }
public class class_name { @Override public Iterator<String> getEnclosingValidatorIds() { if (_enclosingValidatorIdsStack != null && !_enclosingValidatorIdsStack.isEmpty()) { return new KeyEntryIterator<String, EditableValueHolderAttachedObjectHandler> (_enclosingValidatorIdsStack.iterator()); } return null; } }
public class class_name { @Override public Iterator<String> getEnclosingValidatorIds() { if (_enclosingValidatorIdsStack != null && !_enclosingValidatorIdsStack.isEmpty()) { return new KeyEntryIterator<String, EditableValueHolderAttachedObjectHandler> (_enclosingValidatorIdsStack.iterator()); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public static void closeEL(Writer w) { try { if (w != null) w.close(); } // catch (AlwaysThrow at) {throw at;} catch (Throwable e) { ExceptionUtil.rethrowIfNecessary(e); } } }
public class class_name { public static void closeEL(Writer w) { try { if (w != null) w.close(); } // catch (AlwaysThrow at) {throw at;} catch (Throwable e) { ExceptionUtil.rethrowIfNecessary(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static final Set<String> fromCommaSeparatedValues(String csv) { if (csv == null || csv.isEmpty()) { return Collections.EMPTY_SET; } String[] tokens = csv.split(","); return new HashSet<String>(Arrays.asList(tokens)); } }
public class class_name { public static final Set<String> fromCommaSeparatedValues(String csv) { if (csv == null || csv.isEmpty()) { return Collections.EMPTY_SET; // depends on control dependency: [if], data = [none] } String[] tokens = csv.split(","); return new HashSet<String>(Arrays.asList(tokens)); } }
public class class_name { public byte[] toASN1() { try { byte[] privKeyBytes = getPrivKeyBytes(); ByteArrayOutputStream baos = new ByteArrayOutputStream(400); // ASN1_SEQUENCE(EC_PRIVATEKEY) = { // ASN1_SIMPLE(EC_PRIVATEKEY, version, LONG), // ASN1_SIMPLE(EC_PRIVATEKEY, privateKey, ASN1_OCTET_STRING), // ASN1_EXP_OPT(EC_PRIVATEKEY, parameters, ECPKPARAMETERS, 0), // ASN1_EXP_OPT(EC_PRIVATEKEY, publicKey, ASN1_BIT_STRING, 1) // } ASN1_SEQUENCE_END(EC_PRIVATEKEY) DERSequenceGenerator seq = new DERSequenceGenerator(baos); seq.addObject(new ASN1Integer(1)); // version seq.addObject(new DEROctetString(privKeyBytes)); seq.addObject(new DERTaggedObject(0, CURVE_PARAMS.toASN1Primitive())); seq.addObject(new DERTaggedObject(1, new DERBitString(getPubKey()))); seq.close(); return baos.toByteArray(); } catch (IOException e) { throw new RuntimeException(e); // Cannot happen, writing to memory stream. } } }
public class class_name { public byte[] toASN1() { try { byte[] privKeyBytes = getPrivKeyBytes(); ByteArrayOutputStream baos = new ByteArrayOutputStream(400); // ASN1_SEQUENCE(EC_PRIVATEKEY) = { // ASN1_SIMPLE(EC_PRIVATEKEY, version, LONG), // ASN1_SIMPLE(EC_PRIVATEKEY, privateKey, ASN1_OCTET_STRING), // ASN1_EXP_OPT(EC_PRIVATEKEY, parameters, ECPKPARAMETERS, 0), // ASN1_EXP_OPT(EC_PRIVATEKEY, publicKey, ASN1_BIT_STRING, 1) // } ASN1_SEQUENCE_END(EC_PRIVATEKEY) DERSequenceGenerator seq = new DERSequenceGenerator(baos); seq.addObject(new ASN1Integer(1)); // version // depends on control dependency: [try], data = [none] seq.addObject(new DEROctetString(privKeyBytes)); // depends on control dependency: [try], data = [none] seq.addObject(new DERTaggedObject(0, CURVE_PARAMS.toASN1Primitive())); // depends on control dependency: [try], data = [none] seq.addObject(new DERTaggedObject(1, new DERBitString(getPubKey()))); // depends on control dependency: [try], data = [none] seq.close(); // depends on control dependency: [try], data = [none] return baos.toByteArray(); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new RuntimeException(e); // Cannot happen, writing to memory stream. } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public ModelService getModelService(String serviceName){ ModelServiceClientCache cache = getCache().get(serviceName); ModelService lookup; if (cache == null) { // cache has not never been created, initialize an new one. if (LOGGER.isDebugEnabled()) { LOGGER.debug("service has not been cached, try to cache the service {} ", serviceName); } lookup = super.getModelService(serviceName); if (lookup!=null) { getCache().putIfAbsent(serviceName, new ModelServiceClientCache(lookup)); cache = getCache().get(serviceName); addInstanceChangeListener(serviceName, cache); } } else { // service cached has been removed if (cache.getData() == null) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("cached service={} is obsoleted, try to get service from server", serviceName); } lookup = super.getModelService(serviceName); if (lookup != null) { // replace old cached service by new one if (LOGGER.isDebugEnabled()) { LOGGER.debug("try to replace the obsoleted cached service={} by service from server {}", serviceName,lookup.getServiceInstances()); } removeInstanceChangeListener(serviceName, cache); boolean replaced = getCache().replace(serviceName, cache, new ModelServiceClientCache(lookup)); if (replaced) { addInstanceChangeListener(serviceName, getCache().get(serviceName)); } else { LOGGER.error("fail to replace the obsoleted cached service={}", serviceName); } }else{ LOGGER.error("fail to lookup service={} from server",serviceName); } } // use the use cached service else { if (LOGGER.isDebugEnabled()) { LOGGER.debug("service={} has been cached, get service from cache. {}", serviceName,cache.getData().getServiceInstances()); } lookup = cache.getData(); } } return lookup; } }
public class class_name { @Override public ModelService getModelService(String serviceName){ ModelServiceClientCache cache = getCache().get(serviceName); ModelService lookup; if (cache == null) { // cache has not never been created, initialize an new one. if (LOGGER.isDebugEnabled()) { LOGGER.debug("service has not been cached, try to cache the service {} ", serviceName); // depends on control dependency: [if], data = [none] } lookup = super.getModelService(serviceName); // depends on control dependency: [if], data = [none] if (lookup!=null) { getCache().putIfAbsent(serviceName, new ModelServiceClientCache(lookup)); // depends on control dependency: [if], data = [(lookup] cache = getCache().get(serviceName); // depends on control dependency: [if], data = [none] addInstanceChangeListener(serviceName, cache); // depends on control dependency: [if], data = [none] } } else { // service cached has been removed if (cache.getData() == null) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("cached service={} is obsoleted, try to get service from server", serviceName); // depends on control dependency: [if], data = [none] } lookup = super.getModelService(serviceName); // depends on control dependency: [if], data = [none] if (lookup != null) { // replace old cached service by new one if (LOGGER.isDebugEnabled()) { LOGGER.debug("try to replace the obsoleted cached service={} by service from server {}", serviceName,lookup.getServiceInstances()); // depends on control dependency: [if], data = [none] } removeInstanceChangeListener(serviceName, cache); // depends on control dependency: [if], data = [none] boolean replaced = getCache().replace(serviceName, cache, new ModelServiceClientCache(lookup)); if (replaced) { addInstanceChangeListener(serviceName, getCache().get(serviceName)); // depends on control dependency: [if], data = [none] } else { LOGGER.error("fail to replace the obsoleted cached service={}", serviceName); // depends on control dependency: [if], data = [none] } }else{ LOGGER.error("fail to lookup service={} from server",serviceName); // depends on control dependency: [if], data = [none] } } // use the use cached service else { if (LOGGER.isDebugEnabled()) { LOGGER.debug("service={} has been cached, get service from cache. {}", serviceName,cache.getData().getServiceInstances()); // depends on control dependency: [if], data = [none] } lookup = cache.getData(); // depends on control dependency: [if], data = [none] } } return lookup; } }
public class class_name { public void marshall(CreateBackupSelectionRequest createBackupSelectionRequest, ProtocolMarshaller protocolMarshaller) { if (createBackupSelectionRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(createBackupSelectionRequest.getBackupPlanId(), BACKUPPLANID_BINDING); protocolMarshaller.marshall(createBackupSelectionRequest.getBackupSelection(), BACKUPSELECTION_BINDING); protocolMarshaller.marshall(createBackupSelectionRequest.getCreatorRequestId(), CREATORREQUESTID_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(CreateBackupSelectionRequest createBackupSelectionRequest, ProtocolMarshaller protocolMarshaller) { if (createBackupSelectionRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(createBackupSelectionRequest.getBackupPlanId(), BACKUPPLANID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createBackupSelectionRequest.getBackupSelection(), BACKUPSELECTION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createBackupSelectionRequest.getCreatorRequestId(), CREATORREQUESTID_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public long stop(long time) { m_nesting--; // not started and stopped if (m_nesting < 0){ m_nesting = 0; } if (m_nesting == 0){ long elapsedTime = time - m_startTime; m_elapsedTime += elapsedTime; return elapsedTime; } return 0; } }
public class class_name { public long stop(long time) { m_nesting--; // not started and stopped if (m_nesting < 0){ m_nesting = 0; // depends on control dependency: [if], data = [none] } if (m_nesting == 0){ long elapsedTime = time - m_startTime; m_elapsedTime += elapsedTime; // depends on control dependency: [if], data = [none] return elapsedTime; // depends on control dependency: [if], data = [none] } return 0; } }
public class class_name { @Override public Pair<Gradient, Double> gradientAndScore() { if (!logGradient) { OneTimeLogger.info(log, "Gradients for the frozen layer are not set and will therefore will not be updated.Warning will be issued only once per instance"); logGradient = true; } return new Pair<>(zeroGradient, underlying.score()); } }
public class class_name { @Override public Pair<Gradient, Double> gradientAndScore() { if (!logGradient) { OneTimeLogger.info(log, "Gradients for the frozen layer are not set and will therefore will not be updated.Warning will be issued only once per instance"); // depends on control dependency: [if], data = [none] logGradient = true; // depends on control dependency: [if], data = [none] } return new Pair<>(zeroGradient, underlying.score()); } }
public class class_name { public void applyAndJournal(Supplier<JournalContext> context, UpdateInodeDirectoryEntry entry) { try { applyUpdateInodeDirectory(entry); context.get().append(JournalEntry.newBuilder().setUpdateInodeDirectory(entry).build()); } catch (Throwable t) { ProcessUtils.fatalError(LOG, t, "Failed to apply %s", entry); throw t; // fatalError will usually system.exit } } }
public class class_name { public void applyAndJournal(Supplier<JournalContext> context, UpdateInodeDirectoryEntry entry) { try { applyUpdateInodeDirectory(entry); // depends on control dependency: [try], data = [none] context.get().append(JournalEntry.newBuilder().setUpdateInodeDirectory(entry).build()); // depends on control dependency: [try], data = [none] } catch (Throwable t) { ProcessUtils.fatalError(LOG, t, "Failed to apply %s", entry); throw t; // fatalError will usually system.exit } // depends on control dependency: [catch], data = [none] } }
public class class_name { public final void renameCluster(final String oldName, final String newName) { try { clusterMap.put(newName.toLowerCase(configuration.getLocaleInstance()), clusterMap.remove(oldName.toLowerCase(configuration.getLocaleInstance()))); } catch (final RuntimeException ee) { throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee); } catch (final Throwable t) { throw logAndPrepareForRethrow(t); } } }
public class class_name { public final void renameCluster(final String oldName, final String newName) { try { clusterMap.put(newName.toLowerCase(configuration.getLocaleInstance()), clusterMap.remove(oldName.toLowerCase(configuration.getLocaleInstance()))); // depends on control dependency: [try], data = [none] } catch (final RuntimeException ee) { throw logAndPrepareForRethrow(ee); } catch (final Error ee) { // depends on control dependency: [catch], data = [none] throw logAndPrepareForRethrow(ee); } catch (final Throwable t) { // depends on control dependency: [catch], data = [none] throw logAndPrepareForRethrow(t); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public boolean actionCheckSiblings() { List<String> resourceList = getResourceList(); String resourcePath; Iterator<String> itResourcePaths = resourceList.iterator(); boolean foundSibling = false; while (itResourcePaths.hasNext()) { resourcePath = itResourcePaths.next(); try { foundSibling = recursiveCheckSiblings(resourcePath); if (foundSibling) { break; // shortcut } } catch (CmsException e) { LOG.error(Messages.get().getBundle(getLocale()).key( Messages.ERR_UNDO_CHANGES_1, new String[] {resourcePath})); } } return foundSibling; } }
public class class_name { public boolean actionCheckSiblings() { List<String> resourceList = getResourceList(); String resourcePath; Iterator<String> itResourcePaths = resourceList.iterator(); boolean foundSibling = false; while (itResourcePaths.hasNext()) { resourcePath = itResourcePaths.next(); // depends on control dependency: [while], data = [none] try { foundSibling = recursiveCheckSiblings(resourcePath); // depends on control dependency: [try], data = [none] if (foundSibling) { break; // shortcut } } catch (CmsException e) { LOG.error(Messages.get().getBundle(getLocale()).key( Messages.ERR_UNDO_CHANGES_1, new String[] {resourcePath})); } // depends on control dependency: [catch], data = [none] } return foundSibling; } }
public class class_name { public static Map<String, String> processArchiveManifest(final File file) throws Throwable { Map<String, String> manifestAttrs = null; if (file != null && file.isFile() && ArchiveFileType.JAR.isType(file.getPath())) { JarFile jarFile = null; try { jarFile = new JarFile(file); manifestAttrs = processArchiveManifest(jarFile); } finally { if (jarFile != null) { InstallUtils.close(jarFile); } } } return manifestAttrs; } }
public class class_name { public static Map<String, String> processArchiveManifest(final File file) throws Throwable { Map<String, String> manifestAttrs = null; if (file != null && file.isFile() && ArchiveFileType.JAR.isType(file.getPath())) { JarFile jarFile = null; try { jarFile = new JarFile(file); // depends on control dependency: [try], data = [none] manifestAttrs = processArchiveManifest(jarFile); // depends on control dependency: [try], data = [none] } finally { if (jarFile != null) { InstallUtils.close(jarFile); // depends on control dependency: [if], data = [(jarFile] } } } return manifestAttrs; } }
public class class_name { public synchronized void connected(ISOBUSSocket engSocket, ISOBUSSocket impSocket, ISOBUSSocket bufEngSocket, ISOBUSSocket bufImpSocket, ISOBlueDevice device) { // Cancel the thread that completed the connection if (mConnectThread != null) { mConnectThread.cancel(); mConnectThread = null; } // Cancel any thread currently running a connection if (mEngConnectedThread != null) { mEngConnectedThread.cancel(); mEngConnectedThread = null; } if (mImpConnectedThread != null) { mImpConnectedThread.cancel(); mImpConnectedThread = null; } // Start the thread to manage the connection and perform transmissions mEngConnectedThread = new ConnectedThread(engSocket, ISOBlueDemo.MESSAGE_ARG1_NEW); mEngConnectedThread.start(); mImpConnectedThread = new ConnectedThread(impSocket, ISOBlueDemo.MESSAGE_ARG1_NEW); mImpConnectedThread.start(); if (mPast) { mBufEngConnectedThread = new ConnectedThread(bufEngSocket, ISOBlueDemo.MESSAGE_ARG1_BUF); mBufEngConnectedThread.start(); mBufImpConnectedThread = new ConnectedThread(bufImpSocket, ISOBlueDemo.MESSAGE_ARG1_BUF); mBufImpConnectedThread.start(); } // Send the name of the connected device back to the UI Activity Message msg = mHandler.obtainMessage(ISOBlueDemo.MESSAGE_DEVICE_NAME); Bundle bundle = new Bundle(); bundle.putString(ISOBlueDemo.DEVICE_NAME, device.getDevice().getName()); msg.setData(bundle); mHandler.sendMessage(msg); setState(STATE_CONNECTED); } }
public class class_name { public synchronized void connected(ISOBUSSocket engSocket, ISOBUSSocket impSocket, ISOBUSSocket bufEngSocket, ISOBUSSocket bufImpSocket, ISOBlueDevice device) { // Cancel the thread that completed the connection if (mConnectThread != null) { mConnectThread.cancel(); // depends on control dependency: [if], data = [none] mConnectThread = null; // depends on control dependency: [if], data = [none] } // Cancel any thread currently running a connection if (mEngConnectedThread != null) { mEngConnectedThread.cancel(); // depends on control dependency: [if], data = [none] mEngConnectedThread = null; // depends on control dependency: [if], data = [none] } if (mImpConnectedThread != null) { mImpConnectedThread.cancel(); // depends on control dependency: [if], data = [none] mImpConnectedThread = null; // depends on control dependency: [if], data = [none] } // Start the thread to manage the connection and perform transmissions mEngConnectedThread = new ConnectedThread(engSocket, ISOBlueDemo.MESSAGE_ARG1_NEW); mEngConnectedThread.start(); mImpConnectedThread = new ConnectedThread(impSocket, ISOBlueDemo.MESSAGE_ARG1_NEW); mImpConnectedThread.start(); if (mPast) { mBufEngConnectedThread = new ConnectedThread(bufEngSocket, ISOBlueDemo.MESSAGE_ARG1_BUF); // depends on control dependency: [if], data = [none] mBufEngConnectedThread.start(); // depends on control dependency: [if], data = [none] mBufImpConnectedThread = new ConnectedThread(bufImpSocket, ISOBlueDemo.MESSAGE_ARG1_BUF); // depends on control dependency: [if], data = [none] mBufImpConnectedThread.start(); // depends on control dependency: [if], data = [none] } // Send the name of the connected device back to the UI Activity Message msg = mHandler.obtainMessage(ISOBlueDemo.MESSAGE_DEVICE_NAME); Bundle bundle = new Bundle(); bundle.putString(ISOBlueDemo.DEVICE_NAME, device.getDevice().getName()); msg.setData(bundle); mHandler.sendMessage(msg); setState(STATE_CONNECTED); } }
public class class_name { public static int compare(String one, String two) { if (one == null && two == null) { return 0; } if (one == null) { return -1; } if (two == null) { return 1; } return one.compareTo(two); } }
public class class_name { public static int compare(String one, String two) { if (one == null && two == null) { return 0; // depends on control dependency: [if], data = [none] } if (one == null) { return -1; // depends on control dependency: [if], data = [none] } if (two == null) { return 1; // depends on control dependency: [if], data = [none] } return one.compareTo(two); } }
public class class_name { public void removeWorst(List<S> solutionSet) { // Find the worst; double worst = (double) solutionFitness.getAttribute(solutionSet.get(0)); int worstIndex = 0; double kappa = 0.05; for (int i = 1; i < solutionSet.size(); i++) { if ((double) solutionFitness.getAttribute(solutionSet.get(i)) > worst) { worst = (double) solutionFitness.getAttribute(solutionSet.get(i)); worstIndex = i; } } // Update the population for (int i = 0; i < solutionSet.size(); i++) { if (i != worstIndex) { double fitness = (double) solutionFitness.getAttribute(solutionSet.get(i)); fitness -= Math.exp((-indicatorValues.get(worstIndex).get(i) / maxIndicatorValue) / kappa); solutionFitness.setAttribute(solutionSet.get(i), fitness); } } // remove worst from the indicatorValues list indicatorValues.remove(worstIndex); for (List<Double> anIndicatorValues_ : indicatorValues) { anIndicatorValues_.remove(worstIndex); } solutionSet.remove(worstIndex); } }
public class class_name { public void removeWorst(List<S> solutionSet) { // Find the worst; double worst = (double) solutionFitness.getAttribute(solutionSet.get(0)); int worstIndex = 0; double kappa = 0.05; for (int i = 1; i < solutionSet.size(); i++) { if ((double) solutionFitness.getAttribute(solutionSet.get(i)) > worst) { worst = (double) solutionFitness.getAttribute(solutionSet.get(i)); // depends on control dependency: [if], data = [none] worstIndex = i; // depends on control dependency: [if], data = [none] } } // Update the population for (int i = 0; i < solutionSet.size(); i++) { if (i != worstIndex) { double fitness = (double) solutionFitness.getAttribute(solutionSet.get(i)); fitness -= Math.exp((-indicatorValues.get(worstIndex).get(i) / maxIndicatorValue) / kappa); // depends on control dependency: [if], data = [(i] solutionFitness.setAttribute(solutionSet.get(i), fitness); // depends on control dependency: [if], data = [(i] } } // remove worst from the indicatorValues list indicatorValues.remove(worstIndex); for (List<Double> anIndicatorValues_ : indicatorValues) { anIndicatorValues_.remove(worstIndex); // depends on control dependency: [for], data = [anIndicatorValues_] } solutionSet.remove(worstIndex); } }
public class class_name { private void initParameters() { int idx = requestPath.indexOf("?"); if(idx != -1){ String strParams = null; try { strParams = URLDecoder.decode(requestPath.substring(idx+1), "UTF-8"); } catch (UnsupportedEncodingException neverHappens) { /*URLEncoder:how not to use checked exceptions...*/ throw new RuntimeException("Something went unexpectedly wrong while decoding a URL for a generator. ", neverHappens); } String[] params = strParams.split("&"); for (int i = 0; i < params.length; i++) { String[] param = params[i].split("="); parameters.put(param[0], param[1]); } }else{ // No parameters parameters.clear(); } } }
public class class_name { private void initParameters() { int idx = requestPath.indexOf("?"); if(idx != -1){ String strParams = null; try { strParams = URLDecoder.decode(requestPath.substring(idx+1), "UTF-8"); // depends on control dependency: [try], data = [none] } catch (UnsupportedEncodingException neverHappens) { /*URLEncoder:how not to use checked exceptions...*/ throw new RuntimeException("Something went unexpectedly wrong while decoding a URL for a generator. ", neverHappens); } // depends on control dependency: [catch], data = [none] String[] params = strParams.split("&"); for (int i = 0; i < params.length; i++) { String[] param = params[i].split("="); parameters.put(param[0], param[1]); // depends on control dependency: [for], data = [none] } }else{ // No parameters parameters.clear(); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void layoutAcyclicParts() throws CDKException { logger.debug("Start of handleAliphatics"); int safetyCounter = 0; IAtomContainer unplacedAtoms = null; IAtomContainer placedAtoms = null; IAtomContainer longestUnplacedChain = null; IAtom atom = null; Vector2d direction = null; Vector2d startVector = null; boolean done; do { safetyCounter++; done = false; atom = getNextAtomWithAliphaticUnplacedNeigbors(); if (atom != null) { unplacedAtoms = getUnplacedAtoms(atom); placedAtoms = getPlacedAtoms(atom); longestUnplacedChain = atomPlacer.getLongestUnplacedChain(molecule, atom); logger.debug("---start of longest unplaced chain---"); try { logger.debug("Start at atom no. " + (molecule.indexOf(atom) + 1)); logger.debug(AtomPlacer.listNumbers(molecule, longestUnplacedChain)); } catch (Exception exc) { logger.debug(exc); } logger.debug("---end of longest unplaced chain---"); if (longestUnplacedChain.getAtomCount() > 1) { if (placedAtoms.getAtomCount() > 1) { logger.debug("More than one atoms placed already"); logger.debug("trying to place neighbors of atom " + (molecule.indexOf(atom) + 1)); atomPlacer.distributePartners(atom, placedAtoms, GeometryUtil.get2DCenter(placedAtoms), unplacedAtoms, bondLength); direction = new Vector2d(longestUnplacedChain.getAtom(1).getPoint2d()); startVector = new Vector2d(atom.getPoint2d()); direction.sub(startVector); logger.debug("Done placing neighbors of atom " + (molecule.indexOf(atom) + 1)); } else { logger.debug("Less than or equal one atoms placed already"); logger.debug("Trying to get next bond vector."); direction = atomPlacer.getNextBondVector(atom, placedAtoms.getAtom(0), GeometryUtil.get2DCenter(molecule), true); } for (int f = 1; f < longestUnplacedChain.getAtomCount(); f++) { longestUnplacedChain.getAtom(f).setFlag(CDKConstants.ISPLACED, false); } atomPlacer.placeLinearChain(longestUnplacedChain, direction, bondLength); } else { done = true; } } else { done = true; } } while (!done && safetyCounter <= molecule.getAtomCount()); logger.debug("End of handleAliphatics"); } }
public class class_name { private void layoutAcyclicParts() throws CDKException { logger.debug("Start of handleAliphatics"); int safetyCounter = 0; IAtomContainer unplacedAtoms = null; IAtomContainer placedAtoms = null; IAtomContainer longestUnplacedChain = null; IAtom atom = null; Vector2d direction = null; Vector2d startVector = null; boolean done; do { safetyCounter++; done = false; atom = getNextAtomWithAliphaticUnplacedNeigbors(); if (atom != null) { unplacedAtoms = getUnplacedAtoms(atom); // depends on control dependency: [if], data = [(atom] placedAtoms = getPlacedAtoms(atom); // depends on control dependency: [if], data = [(atom] longestUnplacedChain = atomPlacer.getLongestUnplacedChain(molecule, atom); // depends on control dependency: [if], data = [none] logger.debug("---start of longest unplaced chain---"); // depends on control dependency: [if], data = [none] try { logger.debug("Start at atom no. " + (molecule.indexOf(atom) + 1)); // depends on control dependency: [try], data = [none] logger.debug(AtomPlacer.listNumbers(molecule, longestUnplacedChain)); // depends on control dependency: [try], data = [none] } catch (Exception exc) { logger.debug(exc); } // depends on control dependency: [catch], data = [none] logger.debug("---end of longest unplaced chain---"); // depends on control dependency: [if], data = [none] if (longestUnplacedChain.getAtomCount() > 1) { if (placedAtoms.getAtomCount() > 1) { logger.debug("More than one atoms placed already"); // depends on control dependency: [if], data = [none] logger.debug("trying to place neighbors of atom " + (molecule.indexOf(atom) + 1)); // depends on control dependency: [if], data = [1)] atomPlacer.distributePartners(atom, placedAtoms, GeometryUtil.get2DCenter(placedAtoms), unplacedAtoms, bondLength); // depends on control dependency: [if], data = [none] direction = new Vector2d(longestUnplacedChain.getAtom(1).getPoint2d()); // depends on control dependency: [if], data = [1)] startVector = new Vector2d(atom.getPoint2d()); // depends on control dependency: [if], data = [none] direction.sub(startVector); // depends on control dependency: [if], data = [none] logger.debug("Done placing neighbors of atom " + (molecule.indexOf(atom) + 1)); // depends on control dependency: [if], data = [1)] } else { logger.debug("Less than or equal one atoms placed already"); // depends on control dependency: [if], data = [none] logger.debug("Trying to get next bond vector."); // depends on control dependency: [if], data = [none] direction = atomPlacer.getNextBondVector(atom, placedAtoms.getAtom(0), GeometryUtil.get2DCenter(molecule), true); // depends on control dependency: [if], data = [none] } for (int f = 1; f < longestUnplacedChain.getAtomCount(); f++) { longestUnplacedChain.getAtom(f).setFlag(CDKConstants.ISPLACED, false); // depends on control dependency: [for], data = [f] } atomPlacer.placeLinearChain(longestUnplacedChain, direction, bondLength); // depends on control dependency: [if], data = [none] } else { done = true; // depends on control dependency: [if], data = [none] } } else { done = true; // depends on control dependency: [if], data = [none] } } while (!done && safetyCounter <= molecule.getAtomCount()); logger.debug("End of handleAliphatics"); } }
public class class_name { @Reference(title = "Fast and accurate computation of binomial probabilities", // authors = "C. Loader", booktitle = "", // url = "http://projects.scipy.org/scipy/raw-attachment/ticket/620/loader2000Fast.pdf", // bibkey = "web/Loader00") private static double stirlingError(int n) { // Try to use a table value: if(n < 16) { return STIRLING_EXACT_ERROR[n << 1]; } final double nn = n * n; // Use the appropriate number of terms if(n > 500) { return (S0 - S1 / nn) / n; } if(n > 80) { return ((S0 - (S1 - S2 / nn)) / nn) / n; } if(n > 35) { return ((S0 - (S1 - (S2 - S3 / nn) / nn) / nn) / n); } return ((S0 - (S1 - (S2 - (S3 - S4 / nn) / nn) / nn) / nn) / n); } }
public class class_name { @Reference(title = "Fast and accurate computation of binomial probabilities", // authors = "C. Loader", booktitle = "", // url = "http://projects.scipy.org/scipy/raw-attachment/ticket/620/loader2000Fast.pdf", // bibkey = "web/Loader00") private static double stirlingError(int n) { // Try to use a table value: if(n < 16) { return STIRLING_EXACT_ERROR[n << 1]; // depends on control dependency: [if], data = [none] } final double nn = n * n; // Use the appropriate number of terms if(n > 500) { return (S0 - S1 / nn) / n; // depends on control dependency: [if], data = [none] } if(n > 80) { return ((S0 - (S1 - S2 / nn)) / nn) / n; // depends on control dependency: [if], data = [none] } if(n > 35) { return ((S0 - (S1 - (S2 - S3 / nn) / nn) / nn) / n); // depends on control dependency: [if], data = [none] } return ((S0 - (S1 - (S2 - (S3 - S4 / nn) / nn) / nn) / nn) / n); } }
public class class_name { public String getTitle() { String title = getPropertyValue(CmsClientProperty.PROPERTY_NAVTEXT); if (CmsStringUtil.isEmptyOrWhitespaceOnly(title)) { title = getPropertyValue(CmsClientProperty.PROPERTY_TITLE); } if (CmsStringUtil.isEmptyOrWhitespaceOnly(title)) { title = m_name; } return title; } }
public class class_name { public String getTitle() { String title = getPropertyValue(CmsClientProperty.PROPERTY_NAVTEXT); if (CmsStringUtil.isEmptyOrWhitespaceOnly(title)) { title = getPropertyValue(CmsClientProperty.PROPERTY_TITLE); // depends on control dependency: [if], data = [none] } if (CmsStringUtil.isEmptyOrWhitespaceOnly(title)) { title = m_name; // depends on control dependency: [if], data = [none] } return title; } }
public class class_name { @SuppressWarnings("unchecked") public Declaration getDeclaration(final String identifier) { if ( this.dirty || (this.declarations == null) ) { this.declarations = this.getExtendedLhs( this, null ).getOuterDeclarations(); this.dirty = false; } return this.declarations.get( identifier ); } }
public class class_name { @SuppressWarnings("unchecked") public Declaration getDeclaration(final String identifier) { if ( this.dirty || (this.declarations == null) ) { this.declarations = this.getExtendedLhs( this, null ).getOuterDeclarations(); // depends on control dependency: [if], data = [none] this.dirty = false; // depends on control dependency: [if], data = [none] } return this.declarations.get( identifier ); } }
public class class_name { public void addPositionUpdateListener(@NonNull PositionUpdateListener listener) { listeners.add(listener); if (isReady()) { getToView().getPositionAnimator().addPositionUpdateListener(listener); } } }
public class class_name { public void addPositionUpdateListener(@NonNull PositionUpdateListener listener) { listeners.add(listener); if (isReady()) { getToView().getPositionAnimator().addPositionUpdateListener(listener); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void invokeEventHandler(EventContext sleeEvent, ActivityContext ac, EventContext eventContextImpl) throws Exception { // get event handler method final SbbComponent sbbComponent = getSbbComponent(); final EventHandlerMethod eventHandlerMethod = sbbComponent .getEventHandlerMethods().get(sleeEvent.getEventTypeId()); // build aci ActivityContextInterface aci = asSbbActivityContextInterface(ac.getActivityContextInterface()); // now build the param array final Object[] parameters ; if (eventHandlerMethod.getHasEventContextParam()) { parameters = new Object[] { sleeEvent.getEvent(), aci, eventContextImpl }; } else { parameters = new Object[] { sleeEvent.getEvent(), aci }; } // store some info about the invocation in the tx context final EventRoutingTransactionData data = new EventRoutingTransactionDataImpl( sleeEvent, aci); final TransactionContext txContext = sleeContainer.getTransactionManager().getTransactionContext(); txContext.setEventRoutingTransactionData(data); // track sbb entity invocations if reentrant Set<SbbEntityID> invokedSbbentities = null; if (!isReentrant()) { invokedSbbentities = txContext.getInvokedNonReentrantSbbEntities(); invokedSbbentities.add(sbbeId); } final JndiManagement jndiManagement = sleeContainer.getJndiManagement(); jndiManagement.pushJndiContext(sbbComponent); // invoke method try { //This is required. Since domain chain may indicate RA for instance, or SLEE deployer. If we dont do that test: tests/runtime/security/Test1112012Test.xml and second one, w //will fail because domain of SLEE tck ra is too restrictive (or we have bad desgin taht allows this to happen?) if(System.getSecurityManager()!=null) { AccessController.doPrivileged(new PrivilegedExceptionAction<Object>(){ public Object run() throws IllegalAccessException, InvocationTargetException{ eventHandlerMethod.getEventHandlerMethod().invoke( sbbObject.getSbbConcrete(), parameters); return null; }}); } else { eventHandlerMethod.getEventHandlerMethod().invoke( sbbObject.getSbbConcrete(), parameters); } } catch(PrivilegedActionException pae) { Throwable cause = pae.getException(); if(cause instanceof IllegalAccessException) { throw new RuntimeException(cause); } else if(cause instanceof InvocationTargetException ) { // Remember the actual exception is hidden inside the // InvocationTarget exception when you use reflection! Throwable realException = cause.getCause(); if (realException instanceof RuntimeException) { throw (RuntimeException) realException; } else if (realException instanceof Error) { throw (Error) realException; } else if (realException instanceof Exception) { throw (Exception) realException; } }else { pae.printStackTrace(); } } catch(IllegalAccessException iae) { throw new RuntimeException(iae); } catch(InvocationTargetException ite) { Throwable realException = ite.getCause(); if (realException instanceof RuntimeException) { throw (RuntimeException) realException; } else if (realException instanceof Error) { throw (Error) realException; } else if (realException instanceof Exception) { throw (Exception) realException; } } catch(Exception e) { log.error(e.getMessage(),e); } finally { jndiManagement.popJndiContext(); if(invokedSbbentities != null) { invokedSbbentities.remove(sbbeId); } } // remove data from tx context txContext.setEventRoutingTransactionData(null); } }
public class class_name { public void invokeEventHandler(EventContext sleeEvent, ActivityContext ac, EventContext eventContextImpl) throws Exception { // get event handler method final SbbComponent sbbComponent = getSbbComponent(); final EventHandlerMethod eventHandlerMethod = sbbComponent .getEventHandlerMethods().get(sleeEvent.getEventTypeId()); // build aci ActivityContextInterface aci = asSbbActivityContextInterface(ac.getActivityContextInterface()); // now build the param array final Object[] parameters ; if (eventHandlerMethod.getHasEventContextParam()) { parameters = new Object[] { sleeEvent.getEvent(), aci, eventContextImpl }; } else { parameters = new Object[] { sleeEvent.getEvent(), aci }; } // store some info about the invocation in the tx context final EventRoutingTransactionData data = new EventRoutingTransactionDataImpl( sleeEvent, aci); final TransactionContext txContext = sleeContainer.getTransactionManager().getTransactionContext(); txContext.setEventRoutingTransactionData(data); // track sbb entity invocations if reentrant Set<SbbEntityID> invokedSbbentities = null; if (!isReentrant()) { invokedSbbentities = txContext.getInvokedNonReentrantSbbEntities(); invokedSbbentities.add(sbbeId); } final JndiManagement jndiManagement = sleeContainer.getJndiManagement(); jndiManagement.pushJndiContext(sbbComponent); // invoke method try { //This is required. Since domain chain may indicate RA for instance, or SLEE deployer. If we dont do that test: tests/runtime/security/Test1112012Test.xml and second one, w //will fail because domain of SLEE tck ra is too restrictive (or we have bad desgin taht allows this to happen?) if(System.getSecurityManager()!=null) { AccessController.doPrivileged(new PrivilegedExceptionAction<Object>(){ public Object run() throws IllegalAccessException, InvocationTargetException{ eventHandlerMethod.getEventHandlerMethod().invoke( sbbObject.getSbbConcrete(), parameters); return null; }}); // depends on control dependency: [if], data = [none] } else { eventHandlerMethod.getEventHandlerMethod().invoke( sbbObject.getSbbConcrete(), parameters); // depends on control dependency: [if], data = [none] } } catch(PrivilegedActionException pae) { Throwable cause = pae.getException(); if(cause instanceof IllegalAccessException) { throw new RuntimeException(cause); } else if(cause instanceof InvocationTargetException ) { // Remember the actual exception is hidden inside the // InvocationTarget exception when you use reflection! Throwable realException = cause.getCause(); if (realException instanceof RuntimeException) { throw (RuntimeException) realException; } else if (realException instanceof Error) { throw (Error) realException; } else if (realException instanceof Exception) { throw (Exception) realException; } }else { pae.printStackTrace(); // depends on control dependency: [if], data = [none] } } catch(IllegalAccessException iae) { throw new RuntimeException(iae); } catch(InvocationTargetException ite) { Throwable realException = ite.getCause(); if (realException instanceof RuntimeException) { throw (RuntimeException) realException; } else if (realException instanceof Error) { throw (Error) realException; } else if (realException instanceof Exception) { throw (Exception) realException; } } catch(Exception e) { log.error(e.getMessage(),e); } finally { jndiManagement.popJndiContext(); if(invokedSbbentities != null) { invokedSbbentities.remove(sbbeId); // depends on control dependency: [if], data = [none] } } // remove data from tx context txContext.setEventRoutingTransactionData(null); } }
public class class_name { public void queueFile (File file, boolean loop) { try { queueURL(file.toURI().toURL(), loop); } catch (MalformedURLException e) { log.warning("Invalid file url.", "file", file, e); } } }
public class class_name { public void queueFile (File file, boolean loop) { try { queueURL(file.toURI().toURL(), loop); // depends on control dependency: [try], data = [none] } catch (MalformedURLException e) { log.warning("Invalid file url.", "file", file, e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Pure public static URL readResourceURL(Element node, XMLResources resources, String... path) { final String stringValue = getAttributeValue(node, path); if (XMLResources.isStringIdentifier(stringValue)) { try { final long id = XMLResources.getNumericalIdentifier(stringValue); return resources.getResourceURL(id); } catch (Throwable exception) { // } } return null; } }
public class class_name { @Pure public static URL readResourceURL(Element node, XMLResources resources, String... path) { final String stringValue = getAttributeValue(node, path); if (XMLResources.isStringIdentifier(stringValue)) { try { final long id = XMLResources.getNumericalIdentifier(stringValue); return resources.getResourceURL(id); // depends on control dependency: [try], data = [none] } catch (Throwable exception) { // } // depends on control dependency: [catch], data = [none] } return null; } }
public class class_name { public static void positive( TupleDesc_F64 input , TupleDesc_U8 output ) { double max = 0; for( int i = 0; i < input.size(); i++ ) { double v = input.value[i]; if( v > max ) max = v; } if( max == 0 ) max = 1.0; for( int i = 0; i < input.size(); i++ ) { output.value[i] = (byte)(255.0*input.value[i]/max); } } }
public class class_name { public static void positive( TupleDesc_F64 input , TupleDesc_U8 output ) { double max = 0; for( int i = 0; i < input.size(); i++ ) { double v = input.value[i]; if( v > max ) max = v; } if( max == 0 ) max = 1.0; for( int i = 0; i < input.size(); i++ ) { output.value[i] = (byte)(255.0*input.value[i]/max); // depends on control dependency: [for], data = [i] } } }
public class class_name { private static long getMaxBidId(Client client) { long currentMaxBidId = 0; try { VoltTable vt = client.callProcedure("@AdHoc", "select max(id) from bids").getResults()[0]; vt.advanceRow(); currentMaxBidId = vt.getLong(0); if (vt.wasNull()) { currentMaxBidId = 0; } } catch (IOException | ProcCallException e) { e.printStackTrace(); } return currentMaxBidId; } }
public class class_name { private static long getMaxBidId(Client client) { long currentMaxBidId = 0; try { VoltTable vt = client.callProcedure("@AdHoc", "select max(id) from bids").getResults()[0]; vt.advanceRow(); // depends on control dependency: [try], data = [none] currentMaxBidId = vt.getLong(0); // depends on control dependency: [try], data = [none] if (vt.wasNull()) { currentMaxBidId = 0; // depends on control dependency: [if], data = [none] } } catch (IOException | ProcCallException e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none] return currentMaxBidId; } }
public class class_name { public static byte[] add(byte[]... b) { int nLen = 0; for (int i = 0; i < b.length; i ++) { nLen += b[i].length; } byte[] lp = new byte[nLen]; nLen = 0; for (int i = 0; i < b.length; i ++) { byte[] lpi = b[i]; System.arraycopy(lpi, 0, lp, nLen, lpi.length); nLen += lpi.length; } return lp; } }
public class class_name { public static byte[] add(byte[]... b) { int nLen = 0; for (int i = 0; i < b.length; i ++) { nLen += b[i].length; // depends on control dependency: [for], data = [i] } byte[] lp = new byte[nLen]; nLen = 0; for (int i = 0; i < b.length; i ++) { byte[] lpi = b[i]; System.arraycopy(lpi, 0, lp, nLen, lpi.length); // depends on control dependency: [for], data = [none] nLen += lpi.length; // depends on control dependency: [for], data = [none] } return lp; } }
public class class_name { private void initPathsInternal() { synchronized (LOCK) { if (_incomingPathsInternal == null) { AMap<N, AList<AEdgePath<N, E>>> incomingPaths = AHashMap.empty (); //noinspection unchecked incomingPaths = incomingPaths.withDefaultValue (AList.nil); AMap<N, AList<AEdgePath<N, E>>> outgoingPaths = AHashMap.empty (); //noinspection unchecked outgoingPaths = outgoingPaths.withDefaultValue (AList.nil); AList<AEdgePath<N, E>> cycles = AList.nil (); for (N curNode : nodes ()) { // iterate over nodes, treat 'curNode' as a target final Iterable<E> curIncoming = incomingEdges (curNode); List<AEdgePath<N, E>> unfinishedBusiness = new ArrayList<> (); for (E incomingEdge : curIncoming) { unfinishedBusiness.add (AEdgePath.create (incomingEdge)); } AList<AEdgePath<N, E>> nonCycles = AList.nil (); while (unfinishedBusiness.size () > 0) { final List<AEdgePath<N, E>> curBusiness = unfinishedBusiness; for (AEdgePath<N, E> p : unfinishedBusiness) { if (!p.hasCycle () || p.isMinimalCycle ()) nonCycles = nonCycles.cons (p); if (p.isMinimalCycle ()) cycles = cycles.cons (p); } unfinishedBusiness = new ArrayList<> (); for (AEdgePath<N, E> curPath : curBusiness) { final Iterable<E> l = incomingEdges (curPath.getFrom ()); for (E newEdge : l) { final AEdgePath<N, E> pathCandidate = curPath.prepend (newEdge); if (!pathCandidate.hasNonMinimalCycle ()) { unfinishedBusiness.add (pathCandidate); } } } } incomingPaths = incomingPaths.updated (curNode, nonCycles); for (AEdgePath<N, E> p : nonCycles) { outgoingPaths = outgoingPaths.updated (p.getFrom (), outgoingPaths.getRequired (p.getFrom ()).cons (p)); } } _incomingPathsInternal = incomingPaths; _outgoingPathsInternal = outgoingPaths; _cyclesInternal = cycles; } } } }
public class class_name { private void initPathsInternal() { synchronized (LOCK) { if (_incomingPathsInternal == null) { AMap<N, AList<AEdgePath<N, E>>> incomingPaths = AHashMap.empty (); //noinspection unchecked incomingPaths = incomingPaths.withDefaultValue (AList.nil); // depends on control dependency: [if], data = [none] AMap<N, AList<AEdgePath<N, E>>> outgoingPaths = AHashMap.empty (); //noinspection unchecked outgoingPaths = outgoingPaths.withDefaultValue (AList.nil); // depends on control dependency: [if], data = [none] AList<AEdgePath<N, E>> cycles = AList.nil (); for (N curNode : nodes ()) { // iterate over nodes, treat 'curNode' as a target final Iterable<E> curIncoming = incomingEdges (curNode); List<AEdgePath<N, E>> unfinishedBusiness = new ArrayList<> (); for (E incomingEdge : curIncoming) { unfinishedBusiness.add (AEdgePath.create (incomingEdge)); // depends on control dependency: [for], data = [incomingEdge] } AList<AEdgePath<N, E>> nonCycles = AList.nil (); while (unfinishedBusiness.size () > 0) { final List<AEdgePath<N, E>> curBusiness = unfinishedBusiness; for (AEdgePath<N, E> p : unfinishedBusiness) { if (!p.hasCycle () || p.isMinimalCycle ()) nonCycles = nonCycles.cons (p); if (p.isMinimalCycle ()) cycles = cycles.cons (p); } unfinishedBusiness = new ArrayList<> (); // depends on control dependency: [while], data = [none] for (AEdgePath<N, E> curPath : curBusiness) { final Iterable<E> l = incomingEdges (curPath.getFrom ()); for (E newEdge : l) { final AEdgePath<N, E> pathCandidate = curPath.prepend (newEdge); if (!pathCandidate.hasNonMinimalCycle ()) { unfinishedBusiness.add (pathCandidate); // depends on control dependency: [if], data = [none] } } } } incomingPaths = incomingPaths.updated (curNode, nonCycles); // depends on control dependency: [for], data = [curNode] for (AEdgePath<N, E> p : nonCycles) { outgoingPaths = outgoingPaths.updated (p.getFrom (), outgoingPaths.getRequired (p.getFrom ()).cons (p)); // depends on control dependency: [for], data = [p] } } _incomingPathsInternal = incomingPaths; // depends on control dependency: [if], data = [none] _outgoingPathsInternal = outgoingPaths; // depends on control dependency: [if], data = [none] _cyclesInternal = cycles; // depends on control dependency: [if], data = [none] } } } }
public class class_name { public GeometryCollection fromTransferObject(GeometryCollectionTo input, CrsId crsId) { if (input == null) { return null; } crsId = getCrsId(input, crsId); isValid(input); Geometry[] geoms = new Geometry[input.getGeometries().length]; for (int i = 0; i < geoms.length; i++) { geoms[i] = fromTransferObject(input.getGeometries()[i], crsId); } return new GeometryCollection(geoms); } }
public class class_name { public GeometryCollection fromTransferObject(GeometryCollectionTo input, CrsId crsId) { if (input == null) { return null; } // depends on control dependency: [if], data = [none] crsId = getCrsId(input, crsId); isValid(input); Geometry[] geoms = new Geometry[input.getGeometries().length]; for (int i = 0; i < geoms.length; i++) { geoms[i] = fromTransferObject(input.getGeometries()[i], crsId); // depends on control dependency: [for], data = [i] } return new GeometryCollection(geoms); } }
public class class_name { private byte[] unifyLData(final CEMI ldata, final boolean emptySrc, final List<Integer> types) { final byte[] data; if (ldata instanceof CEMILDataEx) { final CEMILDataEx ext = ((CEMILDataEx) ldata); final List<AddInfo> additionalInfo = ext.additionalInfo(); synchronized (additionalInfo) { for (final Iterator<AddInfo> i = additionalInfo.iterator(); i.hasNext();) { final AddInfo info = i.next(); if (!types.contains(info.getType())) { logger.warn("remove L-Data additional info {}", info); i.remove(); } } } } data = ldata.toByteArray(); // set msg code field 0 data[0] = 0; // set ctrl1 field 0 data[1 + data[1] + 1] = 0; // conditionally set source address 0 if (emptySrc) { data[1 + data[1] + 3] = 0; data[1 + data[1] + 4] = 0; } return data; } }
public class class_name { private byte[] unifyLData(final CEMI ldata, final boolean emptySrc, final List<Integer> types) { final byte[] data; if (ldata instanceof CEMILDataEx) { final CEMILDataEx ext = ((CEMILDataEx) ldata); final List<AddInfo> additionalInfo = ext.additionalInfo(); synchronized (additionalInfo) { // depends on control dependency: [if], data = [none] for (final Iterator<AddInfo> i = additionalInfo.iterator(); i.hasNext();) { final AddInfo info = i.next(); if (!types.contains(info.getType())) { logger.warn("remove L-Data additional info {}", info); // depends on control dependency: [if], data = [none] i.remove(); // depends on control dependency: [if], data = [none] } } } } data = ldata.toByteArray(); // set msg code field 0 data[0] = 0; // set ctrl1 field 0 data[1 + data[1] + 1] = 0; // conditionally set source address 0 if (emptySrc) { data[1 + data[1] + 3] = 0; // depends on control dependency: [if], data = [none] data[1 + data[1] + 4] = 0; // depends on control dependency: [if], data = [none] } return data; } }
public class class_name { public void doRandomReads(int readCnt) { Random rand = new Random(); for (int i = 0; i < readCnt; i++) { int keyId = rand.nextInt(_initialCapacity); String str = "key." + keyId; byte[] key = str.getBytes(); byte[] value = _store.get(key); System.out.printf("Key=%s\tValue=%s%n", str, new String(value)); } } }
public class class_name { public void doRandomReads(int readCnt) { Random rand = new Random(); for (int i = 0; i < readCnt; i++) { int keyId = rand.nextInt(_initialCapacity); String str = "key." + keyId; byte[] key = str.getBytes(); byte[] value = _store.get(key); System.out.printf("Key=%s\tValue=%s%n", str, new String(value)); // depends on control dependency: [for], data = [none] } } }
public class class_name { public final DirContext processContextAfterCreation(DirContext ctx, String userDn, String password) throws NamingException { if (ctx instanceof LdapContext) { final LdapContext ldapCtx = (LdapContext) ctx; final StartTlsResponse tlsResponse = (StartTlsResponse) ldapCtx.extendedOperation(new StartTlsRequest()); try { if (hostnameVerifier != null) { tlsResponse.setHostnameVerifier(hostnameVerifier); } tlsResponse.negotiate(sslSocketFactory); // If null, the default SSL socket factory is used applyAuthentication(ldapCtx, userDn, password); if (shutdownTlsGracefully) { // Wrap the target context in a proxy to intercept any calls // to 'close', so that we can shut down the TLS connection // gracefully first. return (DirContext) Proxy.newProxyInstance(DirContextProxy.class.getClassLoader(), new Class<?>[] { LdapContext.class, DirContextProxy.class }, new TlsAwareDirContextProxy(ldapCtx, tlsResponse)); } else { return ctx; } } catch (IOException e) { LdapUtils.closeContext(ctx); throw new UncategorizedLdapException("Failed to negotiate TLS session", e); } } else { throw new IllegalArgumentException( "Processed Context must be an LDAPv3 context, i.e. an LdapContext implementation"); } } }
public class class_name { public final DirContext processContextAfterCreation(DirContext ctx, String userDn, String password) throws NamingException { if (ctx instanceof LdapContext) { final LdapContext ldapCtx = (LdapContext) ctx; final StartTlsResponse tlsResponse = (StartTlsResponse) ldapCtx.extendedOperation(new StartTlsRequest()); try { if (hostnameVerifier != null) { tlsResponse.setHostnameVerifier(hostnameVerifier); // depends on control dependency: [if], data = [(hostnameVerifier] } tlsResponse.negotiate(sslSocketFactory); // If null, the default SSL socket factory is used // depends on control dependency: [try], data = [none] applyAuthentication(ldapCtx, userDn, password); // depends on control dependency: [try], data = [none] if (shutdownTlsGracefully) { // Wrap the target context in a proxy to intercept any calls // to 'close', so that we can shut down the TLS connection // gracefully first. return (DirContext) Proxy.newProxyInstance(DirContextProxy.class.getClassLoader(), new Class<?>[] { LdapContext.class, DirContextProxy.class }, new TlsAwareDirContextProxy(ldapCtx, tlsResponse)); // depends on control dependency: [if], data = [none] } else { return ctx; // depends on control dependency: [if], data = [none] } } catch (IOException e) { LdapUtils.closeContext(ctx); throw new UncategorizedLdapException("Failed to negotiate TLS session", e); } // depends on control dependency: [catch], data = [none] } else { throw new IllegalArgumentException( "Processed Context must be an LDAPv3 context, i.e. an LdapContext implementation"); } } }
public class class_name { public static void setTo(Configured from, Object... targets){ for(Object target:targets){ if(target instanceof Configured){ Configured configuredTarget = (Configured) target; configuredTarget.setConf(from.getConf()); } } } }
public class class_name { public static void setTo(Configured from, Object... targets){ for(Object target:targets){ if(target instanceof Configured){ Configured configuredTarget = (Configured) target; configuredTarget.setConf(from.getConf()); // depends on control dependency: [if], data = [none] } } } }
public class class_name { @Override public void servletEvent(final ServletEvent event) { if (LOG.isDebugEnabled()) { LOG.debug("Sending web event " + event + " for bundle " + event.getBundleName()); } synchronized (listeners) { callListeners(event); Map<String, ServletEvent> events = states.get(event.getBundleId()); if (events == null) { events = new LinkedHashMap<>(); states.put(event.getBundleId(), events); } events.put(event.getAlias(), event); } } }
public class class_name { @Override public void servletEvent(final ServletEvent event) { if (LOG.isDebugEnabled()) { LOG.debug("Sending web event " + event + " for bundle " + event.getBundleName()); // depends on control dependency: [if], data = [none] } synchronized (listeners) { callListeners(event); Map<String, ServletEvent> events = states.get(event.getBundleId()); if (events == null) { events = new LinkedHashMap<>(); // depends on control dependency: [if], data = [none] states.put(event.getBundleId(), events); // depends on control dependency: [if], data = [none] } events.put(event.getAlias(), event); } } }
public class class_name { protected Link addEntry(Token token, Transaction transaction, long sequenceNumber, ConcurrentLinkedList parentList) throws ObjectManagerException { final String methodName = "addEntry"; if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.entry(this, cclass, methodName, new Object[] { token, transaction, new Long(sequenceNumber), parentList}); Link newLink; synchronized (this) { // Prevent other transactions using the list until its creation is commited. if (!(state == stateReady) && !((state == stateAdded) && lockedBy(transaction))) { if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass, methodName, new Object[] { new Integer(state), stateNames[state] }); throw new InvalidStateException(this, state, stateNames[state]); } // All optimistic replace updates to links in the list must be made // together, so we construct a single log record for all of them. managedObjectsToAdd.clear(); managedObjectsToReplace.clear(); reservedSpaceInStore = storeSpaceForAdd(); owningToken.objectStore.reserve((int) reservedSpaceInStore, false); // TODO Do not need to do the following now that we hold the // tailSequenceNumberLock while we do the add. // Move backward through the list until we find an element that has a // sequence number // less than the one we want to add. Token previousToken = tail; Link previousLink = null; searchBackward: while (previousToken != null) { previousLink = (Link) previousToken.getManagedObject(); if (previousLink.sequenceNumber <= sequenceNumber) break searchBackward; previousToken = previousLink.previous; } // While (previousLink != null). Token nextToken = null; if (previousToken == null) // We are to go at the head of the list. nextToken = head; // May be null after us if the list is empty. else // Chain the remainder of the list after us. nextToken = previousLink.next; // Create the new link and add it to its object store. newLink = new Link(this, // Create the Link for the new object. token, // Object referenced by the link. previousToken, nextToken, transaction, // Transaction controling the addition. sequenceNumber); managedObjectsToAdd.add(newLink); // Chain the new Link in the list. If the transaction backs // out we will rewrite the links to remove the new one. if (previousToken == null) { // First element in the list? head = newLink.getToken(); availableHead = head; } else { // Not the head of the list. previousLink.next = newLink.getToken(); managedObjectsToReplace.add(previousLink); // See if we should move the availableHead up the list ( towards the head ). if (availableHead == null) // All of the list ahead of us is to be // deleted. availableHead = newLink.getToken(); else if (((Link) availableHead.getManagedObject()).sequenceNumber > sequenceNumber) availableHead = newLink.getToken(); } // if (previousLink == null). if (nextToken == null) { // Anything after the insertPoint? tail = newLink.getToken(); // Last element in the list. } else { // Not the tail of the list. Link nextLink = (Link) nextToken.getManagedObject(); nextLink.previous = newLink.getToken(); managedObjectsToReplace.add(nextLink); } // if (nextToken == null). // clone(Transaction transaction, ObjectStore objectStore) does not lock the cloned list. if ( parentList.tailSequenceNumberLock.isHeldByCurrentThread()) parentList.tailSequenceNumberLock.unlock(); incrementSize(); // Adjust list length assuming we will commit. managedObjectsToReplace.add(this); // The anchor for the list. // Harden the updates. If the update fails, because the log is full, // we have affected the structure of the list so we will have to // reverse the changes. Reserve enough space to reverse the update if the // transaction backs out. try { transaction.optimisticReplace(managedObjectsToAdd, managedObjectsToReplace, null, // No tokens to delete. null, // No tokens to notify. logSpaceForDelete()); // Give up reserved space, but keep back enough to remove the entry if we have to. owningToken.objectStore.reserve((int) (storeSpaceForRemove() - reservedSpaceInStore), false); } catch (InvalidStateException exception) { // No FFDC Code Needed, user error. // Remove the link we just added. undoAdd(newLink); if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass, methodName, exception); throw exception; } catch (LogFileFullException exception) { // No FFDC Code Needed, InternalTransaction has already done this. // Remove the link we just added. undoAdd(newLink); if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass, methodName, exception); throw exception; // We should not see ObjectStoreFullException because we have preReserved // the ObjectStore space. // } catch (ObjectStoreFullException exception) { // // No FFDC Code Needed, InternalTransaction has already done this. // // Remove the link we just added. // undoAdd(newLink); // if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) // trace.exit(this, cclass, methodName, exception); // throw exception; } // try. } // synchronized (this). if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass, methodName, new Object[] { newLink }); return newLink; } }
public class class_name { protected Link addEntry(Token token, Transaction transaction, long sequenceNumber, ConcurrentLinkedList parentList) throws ObjectManagerException { final String methodName = "addEntry"; if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.entry(this, cclass, methodName, new Object[] { token, transaction, new Long(sequenceNumber), parentList}); Link newLink; synchronized (this) { // Prevent other transactions using the list until its creation is commited. if (!(state == stateReady) && !((state == stateAdded) && lockedBy(transaction))) { if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass, methodName, new Object[] { new Integer(state), stateNames[state] }); throw new InvalidStateException(this, state, stateNames[state]); } // All optimistic replace updates to links in the list must be made // together, so we construct a single log record for all of them. managedObjectsToAdd.clear(); managedObjectsToReplace.clear(); reservedSpaceInStore = storeSpaceForAdd(); owningToken.objectStore.reserve((int) reservedSpaceInStore, false); // TODO Do not need to do the following now that we hold the // tailSequenceNumberLock while we do the add. // Move backward through the list until we find an element that has a // sequence number // less than the one we want to add. Token previousToken = tail; Link previousLink = null; searchBackward: while (previousToken != null) { previousLink = (Link) previousToken.getManagedObject(); // depends on control dependency: [while], data = [none] if (previousLink.sequenceNumber <= sequenceNumber) break searchBackward; previousToken = previousLink.previous; // depends on control dependency: [while], data = [none] } // While (previousLink != null). Token nextToken = null; if (previousToken == null) // We are to go at the head of the list. nextToken = head; // May be null after us if the list is empty. else // Chain the remainder of the list after us. nextToken = previousLink.next; // Create the new link and add it to its object store. newLink = new Link(this, // Create the Link for the new object. token, // Object referenced by the link. previousToken, nextToken, transaction, // Transaction controling the addition. sequenceNumber); managedObjectsToAdd.add(newLink); // Chain the new Link in the list. If the transaction backs // out we will rewrite the links to remove the new one. if (previousToken == null) { // First element in the list? head = newLink.getToken(); // depends on control dependency: [if], data = [none] availableHead = head; // depends on control dependency: [if], data = [none] } else { // Not the head of the list. previousLink.next = newLink.getToken(); // depends on control dependency: [if], data = [none] managedObjectsToReplace.add(previousLink); // depends on control dependency: [if], data = [none] // See if we should move the availableHead up the list ( towards the head ). if (availableHead == null) // All of the list ahead of us is to be // deleted. availableHead = newLink.getToken(); else if (((Link) availableHead.getManagedObject()).sequenceNumber > sequenceNumber) availableHead = newLink.getToken(); } // if (previousLink == null). if (nextToken == null) { // Anything after the insertPoint? tail = newLink.getToken(); // Last element in the list. // depends on control dependency: [if], data = [none] } else { // Not the tail of the list. Link nextLink = (Link) nextToken.getManagedObject(); nextLink.previous = newLink.getToken(); // depends on control dependency: [if], data = [none] managedObjectsToReplace.add(nextLink); // depends on control dependency: [if], data = [none] } // if (nextToken == null). // clone(Transaction transaction, ObjectStore objectStore) does not lock the cloned list. if ( parentList.tailSequenceNumberLock.isHeldByCurrentThread()) parentList.tailSequenceNumberLock.unlock(); incrementSize(); // Adjust list length assuming we will commit. managedObjectsToReplace.add(this); // The anchor for the list. // Harden the updates. If the update fails, because the log is full, // we have affected the structure of the list so we will have to // reverse the changes. Reserve enough space to reverse the update if the // transaction backs out. try { transaction.optimisticReplace(managedObjectsToAdd, managedObjectsToReplace, null, // No tokens to delete. null, // No tokens to notify. logSpaceForDelete()); // depends on control dependency: [try], data = [none] // Give up reserved space, but keep back enough to remove the entry if we have to. owningToken.objectStore.reserve((int) (storeSpaceForRemove() - reservedSpaceInStore), false); // depends on control dependency: [try], data = [none] } catch (InvalidStateException exception) { // No FFDC Code Needed, user error. // Remove the link we just added. undoAdd(newLink); if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass, methodName, exception); throw exception; } catch (LogFileFullException exception) { // depends on control dependency: [catch], data = [none] // No FFDC Code Needed, InternalTransaction has already done this. // Remove the link we just added. undoAdd(newLink); if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass, methodName, exception); throw exception; // We should not see ObjectStoreFullException because we have preReserved // the ObjectStore space. // } catch (ObjectStoreFullException exception) { // // No FFDC Code Needed, InternalTransaction has already done this. // // Remove the link we just added. // undoAdd(newLink); // if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) // trace.exit(this, cclass, methodName, exception); // throw exception; } // try. // depends on control dependency: [catch], data = [none] } // synchronized (this). if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass, methodName, new Object[] { newLink }); return newLink; } }
public class class_name { public void filter(String name, EsAbstractConditionQuery.OperatorCall<BsFileConfigCQ> queryLambda, ConditionOptionCall<FilterAggregationBuilder> opLambda, OperatorCall<BsFileConfigCA> aggsLambda) { FileConfigCQ cq = new FileConfigCQ(); if (queryLambda != null) { queryLambda.callback(cq); } FilterAggregationBuilder builder = regFilterA(name, cq.getQuery()); if (opLambda != null) { opLambda.callback(builder); } if (aggsLambda != null) { FileConfigCA ca = new FileConfigCA(); aggsLambda.callback(ca); ca.getAggregationBuilderList().forEach(builder::subAggregation); } } }
public class class_name { public void filter(String name, EsAbstractConditionQuery.OperatorCall<BsFileConfigCQ> queryLambda, ConditionOptionCall<FilterAggregationBuilder> opLambda, OperatorCall<BsFileConfigCA> aggsLambda) { FileConfigCQ cq = new FileConfigCQ(); if (queryLambda != null) { queryLambda.callback(cq); // depends on control dependency: [if], data = [none] } FilterAggregationBuilder builder = regFilterA(name, cq.getQuery()); if (opLambda != null) { opLambda.callback(builder); // depends on control dependency: [if], data = [none] } if (aggsLambda != null) { FileConfigCA ca = new FileConfigCA(); aggsLambda.callback(ca); // depends on control dependency: [if], data = [none] ca.getAggregationBuilderList().forEach(builder::subAggregation); // depends on control dependency: [if], data = [none] } } }
public class class_name { private Map<String, Monomer> deserializeMonomerStore(JsonParser parser, Map<String, Attachment> attachmentDB) throws JsonParseException, IOException, EncoderException { Map<String, Monomer> monomers = new TreeMap<String, Monomer>(String.CASE_INSENSITIVE_ORDER); Monomer currentMonomer = null; parser.nextToken(); while (parser.hasCurrentToken()) { String fieldName = parser.getCurrentName(); JsonToken token = parser.getCurrentToken(); if (JsonToken.START_OBJECT.equals(token)) { currentMonomer = new Monomer(); } else if (JsonToken.END_OBJECT.equals(token)) { monomers.put(currentMonomer.getAlternateId(), currentMonomer); } if (fieldName != null) { switch (fieldName) { // id is first field case "id": parser.nextToken(); currentMonomer.setId(Integer.parseInt(parser.getText())); break; case "alternateId": parser.nextToken(); currentMonomer.setAlternateId(parser.getText()); break; case "symbol": parser.nextToken(); currentMonomer.setAlternateId(parser.getText()); break; case "naturalAnalog": parser.nextToken(); currentMonomer.setNaturalAnalog(parser.getText()); break; case "name": parser.nextToken(); currentMonomer.setName(parser.getText()); break; case "canSMILES": parser.nextToken(); currentMonomer.setCanSMILES(parser.getText()); break; case "smiles": parser.nextToken(); currentMonomer.setCanSMILES(parser.getText()); break; case "molfile": parser.nextToken(); try { currentMonomer.setMolfile(MolfileEncoder.decode(parser.getText())); } catch (EncoderException e) { LOG.info("Monomer file was not in the Base64-Format"); currentMonomer.setMolfile(parser.getText()); } break; case "monomerType": parser.nextToken(); currentMonomer.setMonomerType(parser.getText()); break; case "polymerType": parser.nextToken(); currentMonomer.setPolymerType(parser.getText()); break; case "attachmentList": currentMonomer.setAttachmentList(deserializeAttachmentList(parser, attachmentDB)); break; case "rgroups": currentMonomer.setAttachmentList(deserializeAttachmentList(parser, attachmentDB)); break; case "newMonomer": parser.nextToken(); currentMonomer.setNewMonomer(Boolean.parseBoolean(parser.getText())); break; case "adHocMonomer": parser.nextToken(); currentMonomer.setAdHocMonomer(Boolean.parseBoolean(parser.getText())); break; default: break; } } parser.nextToken(); } return monomers; } }
public class class_name { private Map<String, Monomer> deserializeMonomerStore(JsonParser parser, Map<String, Attachment> attachmentDB) throws JsonParseException, IOException, EncoderException { Map<String, Monomer> monomers = new TreeMap<String, Monomer>(String.CASE_INSENSITIVE_ORDER); Monomer currentMonomer = null; parser.nextToken(); while (parser.hasCurrentToken()) { String fieldName = parser.getCurrentName(); JsonToken token = parser.getCurrentToken(); if (JsonToken.START_OBJECT.equals(token)) { currentMonomer = new Monomer(); } else if (JsonToken.END_OBJECT.equals(token)) { monomers.put(currentMonomer.getAlternateId(), currentMonomer); } if (fieldName != null) { switch (fieldName) { // id is first field case "id": parser.nextToken(); currentMonomer.setId(Integer.parseInt(parser.getText())); break; case "alternateId": parser.nextToken(); currentMonomer.setAlternateId(parser.getText()); break; case "symbol": parser.nextToken(); currentMonomer.setAlternateId(parser.getText()); break; case "naturalAnalog": parser.nextToken(); currentMonomer.setNaturalAnalog(parser.getText()); break; case "name": parser.nextToken(); currentMonomer.setName(parser.getText()); break; case "canSMILES": parser.nextToken(); currentMonomer.setCanSMILES(parser.getText()); break; case "smiles": parser.nextToken(); currentMonomer.setCanSMILES(parser.getText()); break; case "molfile": parser.nextToken(); try { currentMonomer.setMolfile(MolfileEncoder.decode(parser.getText())); // depends on control dependency: [try], data = [none] } catch (EncoderException e) { LOG.info("Monomer file was not in the Base64-Format"); currentMonomer.setMolfile(parser.getText()); } // depends on control dependency: [catch], data = [none] break; case "monomerType": parser.nextToken(); currentMonomer.setMonomerType(parser.getText()); break; case "polymerType": parser.nextToken(); currentMonomer.setPolymerType(parser.getText()); break; case "attachmentList": currentMonomer.setAttachmentList(deserializeAttachmentList(parser, attachmentDB)); break; case "rgroups": currentMonomer.setAttachmentList(deserializeAttachmentList(parser, attachmentDB)); break; case "newMonomer": parser.nextToken(); currentMonomer.setNewMonomer(Boolean.parseBoolean(parser.getText())); break; case "adHocMonomer": parser.nextToken(); currentMonomer.setAdHocMonomer(Boolean.parseBoolean(parser.getText())); break; default: break; } } parser.nextToken(); } return monomers; } }
public class class_name { public Map<String, Map<String, String>> getReadProperties() { if (m_properties == null) { // create lazy map only on demand m_properties = CmsCollectionsGenericWrapper.createLazyMap(new CmsResourcePropertyLoaderTransformer(false)); } return m_properties; } }
public class class_name { public Map<String, Map<String, String>> getReadProperties() { if (m_properties == null) { // create lazy map only on demand m_properties = CmsCollectionsGenericWrapper.createLazyMap(new CmsResourcePropertyLoaderTransformer(false)); // depends on control dependency: [if], data = [none] } return m_properties; } }
public class class_name { public void createEnablement() { GlobalEnablementBuilder builder = beanManager.getServices().get(GlobalEnablementBuilder.class); ModuleEnablement enablement = builder.createModuleEnablement(this); beanManager.setEnabled(enablement); if (BootstrapLogger.LOG.isDebugEnabled()) { BootstrapLogger.LOG.enabledAlternatives(this.beanManager, WeldCollections.toMultiRowString(enablement.getAllAlternatives())); BootstrapLogger.LOG.enabledDecorators(this.beanManager, WeldCollections.toMultiRowString(enablement.getDecorators())); BootstrapLogger.LOG.enabledInterceptors(this.beanManager, WeldCollections.toMultiRowString(enablement.getInterceptors())); } } }
public class class_name { public void createEnablement() { GlobalEnablementBuilder builder = beanManager.getServices().get(GlobalEnablementBuilder.class); ModuleEnablement enablement = builder.createModuleEnablement(this); beanManager.setEnabled(enablement); if (BootstrapLogger.LOG.isDebugEnabled()) { BootstrapLogger.LOG.enabledAlternatives(this.beanManager, WeldCollections.toMultiRowString(enablement.getAllAlternatives())); // depends on control dependency: [if], data = [none] BootstrapLogger.LOG.enabledDecorators(this.beanManager, WeldCollections.toMultiRowString(enablement.getDecorators())); // depends on control dependency: [if], data = [none] BootstrapLogger.LOG.enabledInterceptors(this.beanManager, WeldCollections.toMultiRowString(enablement.getInterceptors())); // depends on control dependency: [if], data = [none] } } }
public class class_name { public EEnum getIfcAirToAirHeatRecoveryTypeEnum() { if (ifcAirToAirHeatRecoveryTypeEnumEEnum == null) { ifcAirToAirHeatRecoveryTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE .getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(777); } return ifcAirToAirHeatRecoveryTypeEnumEEnum; } }
public class class_name { public EEnum getIfcAirToAirHeatRecoveryTypeEnum() { if (ifcAirToAirHeatRecoveryTypeEnumEEnum == null) { ifcAirToAirHeatRecoveryTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE .getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(777); // depends on control dependency: [if], data = [none] } return ifcAirToAirHeatRecoveryTypeEnumEEnum; } }
public class class_name { public void setItems(java.util.Collection<DocumentationPart> items) { if (items == null) { this.items = null; return; } this.items = new java.util.ArrayList<DocumentationPart>(items); } }
public class class_name { public void setItems(java.util.Collection<DocumentationPart> items) { if (items == null) { this.items = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.items = new java.util.ArrayList<DocumentationPart>(items); } }
public class class_name { private Response call(Method method, String endpoint, Request params, File inputFile) { StringBuilder action = new StringBuilder(); action.append("Making <i>"); action.append(method.toString()); action.append("</i> call to <i>"); action.append(http.getServiceBaseUrl()).append(endpoint).append(http.getRequestParams(params)); action.append("</i>"); action.append("<div class='indent'>"); action.append(Reporter.getCredentialStringOutput(http)); action.append(Reporter.getRequestHeadersOutput(http)); action.append(Reporter.getRequestPayloadOutput(params, inputFile)); action.append("</div>"); String expected = "<i>" + method + "</i> call was performed"; Response response = null; try { switch (method) { case GET: response = http.get(endpoint, params); break; case POST: response = http.post(endpoint, params, inputFile); break; case PUT: response = http.put(endpoint, params, inputFile); break; case DELETE: response = http.delete(endpoint, params, inputFile); break; } String actual = expected; actual += "<div class='indent'>"; actual += Reporter.getResponseHeadersOutput(response); actual += Reporter.getResponseCodeOutput(response); actual += Reporter.getResponseOutput(response); actual += "</div>"; reporter.pass(action.toString(), expected, actual); } catch (Exception e) { reporter.fail(action.toString(), expected, "<i>" + method + "</i> call failed. " + e.getMessage()); } return response; } }
public class class_name { private Response call(Method method, String endpoint, Request params, File inputFile) { StringBuilder action = new StringBuilder(); action.append("Making <i>"); action.append(method.toString()); action.append("</i> call to <i>"); action.append(http.getServiceBaseUrl()).append(endpoint).append(http.getRequestParams(params)); action.append("</i>"); action.append("<div class='indent'>"); action.append(Reporter.getCredentialStringOutput(http)); action.append(Reporter.getRequestHeadersOutput(http)); action.append(Reporter.getRequestPayloadOutput(params, inputFile)); action.append("</div>"); String expected = "<i>" + method + "</i> call was performed"; Response response = null; try { switch (method) { case GET: response = http.get(endpoint, params); break; case POST: response = http.post(endpoint, params, inputFile); break; case PUT: response = http.put(endpoint, params, inputFile); break; case DELETE: response = http.delete(endpoint, params, inputFile); break; } String actual = expected; actual += "<div class='indent'>"; actual += Reporter.getResponseHeadersOutput(response); // depends on control dependency: [try], data = [none] actual += Reporter.getResponseCodeOutput(response); // depends on control dependency: [try], data = [none] actual += Reporter.getResponseOutput(response); // depends on control dependency: [try], data = [none] actual += "</div>"; reporter.pass(action.toString(), expected, actual); // depends on control dependency: [try], data = [none] } catch (Exception e) { reporter.fail(action.toString(), expected, "<i>" + method + "</i> call failed. " + e.getMessage()); } // depends on control dependency: [catch], data = [none] return response; } }
public class class_name { @Action(name = "Get AWS Cloud Formation Stack Details", outputs = { @Output(Outputs.RETURN_CODE), @Output(Outputs.RETURN_RESULT), @Output(Outputs.STACK_NAME_RESULT), @Output(Outputs.STACK_ID_RESULT), @Output(Outputs.STACK_STATUS_RESULT), @Output(Outputs.STACK_STATUS_RESULT_REASON), @Output(Outputs.STACK_CREATION_TIME_RESULT), @Output(Outputs.STACK_DESCRIPTION_RESULT), @Output(Outputs.STACK_OUTPUTS_RESULT), @Output(Outputs.STACK_RESOURCES_RESULT), @Output(Outputs.EXCEPTION) }, responses = { @Response(text = Outputs.SUCCESS, field = Outputs.RETURN_CODE, value = Outputs.SUCCESS_RETURN_CODE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED), @Response(text = Outputs.FAILURE, field = Outputs.RETURN_CODE, value = Outputs.FAILURE_RETURN_CODE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR) } ) public Map<String, String> execute( @Param(value = IDENTITY, required = true) String identity, @Param(value = CREDENTIAL, required = true, encrypted = true) String credential, @Param(value = REGION, required = true) String region, @Param(value = PROXY_HOST) String proxyHost, @Param(value = PROXY_PORT) String proxyPort, @Param(value = PROXY_USERNAME) String proxyUsername, @Param(value = PROXY_PASSWORD, encrypted = true) String proxyPassword, @Param(value = CONNECT_TIMEOUT) String connectTimeoutMs, @Param(value = EXECUTION_TIMEOUT) String execTimeoutMs, @Param(value = STACK_NAME, required = true) String stackName) { proxyPort = defaultIfEmpty(proxyPort, DefaultValues.PROXY_PORT); connectTimeoutMs = defaultIfEmpty(connectTimeoutMs, DefaultValues.CONNECT_TIMEOUT); execTimeoutMs = defaultIfEmpty(execTimeoutMs, DefaultValues.EXEC_TIMEOUT); AmazonCloudFormation stackBuilder = CloudFormationClientBuilder.getCloudFormationClient(identity, credential, proxyHost, proxyPort, proxyUsername, proxyPassword, connectTimeoutMs, execTimeoutMs, region); final Map<String, String> results = new HashMap(); try { final DescribeStacksRequest describeStacksRequest = new DescribeStacksRequest(); describeStacksRequest.withStackName(stackName); final DescribeStackResourcesRequest stackResourceRequest = new DescribeStackResourcesRequest(); for (Stack stack : stackBuilder.describeStacks(describeStacksRequest).getStacks()) { results.put(Outputs.RETURN_RESULT, stack.getStackName() + "[" + stack.getStackStatus() + "]" ); results.put(Outputs.STACK_NAME_RESULT, stack.getStackName()); results.put(Outputs.STACK_ID_RESULT,stack.getStackId()); results.put(Outputs.STACK_STATUS_RESULT,stack.getStackStatus()); results.put(Outputs.STACK_STATUS_RESULT_REASON,stack.getStackStatusReason()); results.put(Outputs.STACK_CREATION_TIME_RESULT,stack.getCreationTime().toString()); results.put(Outputs.STACK_DESCRIPTION_RESULT,stack.getDescription()); results.put(Outputs.STACK_OUTPUTS_RESULT,stack.getOutputs().toString()); stackResourceRequest.setStackName(stack.getStackName()); results.put(Outputs.STACK_RESOURCES_RESULT,stackBuilder.describeStackResources(stackResourceRequest).getStackResources().toString()); results.put(Outputs.RETURN_CODE, Outputs.SUCCESS_RETURN_CODE); results.put(Outputs.EXCEPTION, StringUtils.EMPTY); } } catch (Exception e) { results.put(Outputs.RETURN_RESULT, e.getMessage()); results.put(Outputs.STACK_ID_RESULT, StringUtils.EMPTY); results.put(Outputs.STACK_STATUS_RESULT,StringUtils.EMPTY); results.put(Outputs.STACK_STATUS_RESULT_REASON,StringUtils.EMPTY); results.put(Outputs.STACK_CREATION_TIME_RESULT,StringUtils.EMPTY); results.put(Outputs.STACK_DESCRIPTION_RESULT,StringUtils.EMPTY); results.put(Outputs.STACK_OUTPUTS_RESULT,StringUtils.EMPTY); results.put(Outputs.STACK_RESOURCES_RESULT,StringUtils.EMPTY); results.put(Outputs.RETURN_CODE, Outputs.FAILURE_RETURN_CODE); results.put(Outputs.EXCEPTION, e.getStackTrace().toString()); } return results; } }
public class class_name { @Action(name = "Get AWS Cloud Formation Stack Details", outputs = { @Output(Outputs.RETURN_CODE), @Output(Outputs.RETURN_RESULT), @Output(Outputs.STACK_NAME_RESULT), @Output(Outputs.STACK_ID_RESULT), @Output(Outputs.STACK_STATUS_RESULT), @Output(Outputs.STACK_STATUS_RESULT_REASON), @Output(Outputs.STACK_CREATION_TIME_RESULT), @Output(Outputs.STACK_DESCRIPTION_RESULT), @Output(Outputs.STACK_OUTPUTS_RESULT), @Output(Outputs.STACK_RESOURCES_RESULT), @Output(Outputs.EXCEPTION) }, responses = { @Response(text = Outputs.SUCCESS, field = Outputs.RETURN_CODE, value = Outputs.SUCCESS_RETURN_CODE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED), @Response(text = Outputs.FAILURE, field = Outputs.RETURN_CODE, value = Outputs.FAILURE_RETURN_CODE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR) } ) public Map<String, String> execute( @Param(value = IDENTITY, required = true) String identity, @Param(value = CREDENTIAL, required = true, encrypted = true) String credential, @Param(value = REGION, required = true) String region, @Param(value = PROXY_HOST) String proxyHost, @Param(value = PROXY_PORT) String proxyPort, @Param(value = PROXY_USERNAME) String proxyUsername, @Param(value = PROXY_PASSWORD, encrypted = true) String proxyPassword, @Param(value = CONNECT_TIMEOUT) String connectTimeoutMs, @Param(value = EXECUTION_TIMEOUT) String execTimeoutMs, @Param(value = STACK_NAME, required = true) String stackName) { proxyPort = defaultIfEmpty(proxyPort, DefaultValues.PROXY_PORT); connectTimeoutMs = defaultIfEmpty(connectTimeoutMs, DefaultValues.CONNECT_TIMEOUT); execTimeoutMs = defaultIfEmpty(execTimeoutMs, DefaultValues.EXEC_TIMEOUT); AmazonCloudFormation stackBuilder = CloudFormationClientBuilder.getCloudFormationClient(identity, credential, proxyHost, proxyPort, proxyUsername, proxyPassword, connectTimeoutMs, execTimeoutMs, region); final Map<String, String> results = new HashMap(); try { final DescribeStacksRequest describeStacksRequest = new DescribeStacksRequest(); describeStacksRequest.withStackName(stackName); // depends on control dependency: [try], data = [none] final DescribeStackResourcesRequest stackResourceRequest = new DescribeStackResourcesRequest(); for (Stack stack : stackBuilder.describeStacks(describeStacksRequest).getStacks()) { results.put(Outputs.RETURN_RESULT, stack.getStackName() + "[" + stack.getStackStatus() + "]" ); // depends on control dependency: [for], data = [stack] results.put(Outputs.STACK_NAME_RESULT, stack.getStackName()); // depends on control dependency: [for], data = [stack] results.put(Outputs.STACK_ID_RESULT,stack.getStackId()); // depends on control dependency: [for], data = [stack] results.put(Outputs.STACK_STATUS_RESULT,stack.getStackStatus()); // depends on control dependency: [for], data = [stack] results.put(Outputs.STACK_STATUS_RESULT_REASON,stack.getStackStatusReason()); // depends on control dependency: [for], data = [stack] results.put(Outputs.STACK_CREATION_TIME_RESULT,stack.getCreationTime().toString()); // depends on control dependency: [for], data = [stack] results.put(Outputs.STACK_DESCRIPTION_RESULT,stack.getDescription()); // depends on control dependency: [for], data = [stack] results.put(Outputs.STACK_OUTPUTS_RESULT,stack.getOutputs().toString()); // depends on control dependency: [for], data = [stack] stackResourceRequest.setStackName(stack.getStackName()); // depends on control dependency: [for], data = [stack] results.put(Outputs.STACK_RESOURCES_RESULT,stackBuilder.describeStackResources(stackResourceRequest).getStackResources().toString()); // depends on control dependency: [for], data = [stack] results.put(Outputs.RETURN_CODE, Outputs.SUCCESS_RETURN_CODE); // depends on control dependency: [for], data = [none] results.put(Outputs.EXCEPTION, StringUtils.EMPTY); // depends on control dependency: [for], data = [none] } } catch (Exception e) { results.put(Outputs.RETURN_RESULT, e.getMessage()); results.put(Outputs.STACK_ID_RESULT, StringUtils.EMPTY); results.put(Outputs.STACK_STATUS_RESULT,StringUtils.EMPTY); results.put(Outputs.STACK_STATUS_RESULT_REASON,StringUtils.EMPTY); results.put(Outputs.STACK_CREATION_TIME_RESULT,StringUtils.EMPTY); results.put(Outputs.STACK_DESCRIPTION_RESULT,StringUtils.EMPTY); results.put(Outputs.STACK_OUTPUTS_RESULT,StringUtils.EMPTY); results.put(Outputs.STACK_RESOURCES_RESULT,StringUtils.EMPTY); results.put(Outputs.RETURN_CODE, Outputs.FAILURE_RETURN_CODE); results.put(Outputs.EXCEPTION, e.getStackTrace().toString()); } // depends on control dependency: [catch], data = [none] return results; } }
public class class_name { private void setTorsion() throws Exception { List data = null; st.nextToken(); String scode = st.nextToken(); // String scode String sid1 = st.nextToken(); String sid2 = st.nextToken(); String sid3 = st.nextToken(); String sid4 = st.nextToken(); String value1 = st.nextToken(); String value2 = st.nextToken(); String value3 = st.nextToken(); String value4 = st.nextToken(); String value5 = st.nextToken(); try { double va1 = new Double(value1).doubleValue(); double va2 = new Double(value2).doubleValue(); double va3 = new Double(value3).doubleValue(); double va4 = new Double(value4).doubleValue(); double va5 = new Double(value5).doubleValue(); key = "torsion" + scode + ";" + sid1 + ";" + sid2 + ";" + sid3 + ";" + sid4; LOG.debug("key = " + key); if (parameterSet.containsKey(key)) { data = (Vector) parameterSet.get(key); data.add(new Double(va1)); data.add(new Double(va2)); data.add(new Double(va3)); data.add(new Double(va4)); data.add(new Double(va5)); LOG.debug("data = " + data); } else { data = new Vector(); data.add(new Double(va1)); data.add(new Double(va2)); data.add(new Double(va3)); data.add(new Double(va4)); data.add(new Double(va5)); LOG.debug("data = " + data); } parameterSet.put(key, data); } catch (NumberFormatException nfe) { throw new IOException("setTorsion: Malformed Number due to:" + nfe); } } }
public class class_name { private void setTorsion() throws Exception { List data = null; st.nextToken(); String scode = st.nextToken(); // String scode String sid1 = st.nextToken(); String sid2 = st.nextToken(); String sid3 = st.nextToken(); String sid4 = st.nextToken(); String value1 = st.nextToken(); String value2 = st.nextToken(); String value3 = st.nextToken(); String value4 = st.nextToken(); String value5 = st.nextToken(); try { double va1 = new Double(value1).doubleValue(); double va2 = new Double(value2).doubleValue(); double va3 = new Double(value3).doubleValue(); double va4 = new Double(value4).doubleValue(); double va5 = new Double(value5).doubleValue(); key = "torsion" + scode + ";" + sid1 + ";" + sid2 + ";" + sid3 + ";" + sid4; LOG.debug("key = " + key); if (parameterSet.containsKey(key)) { data = (Vector) parameterSet.get(key); // depends on control dependency: [if], data = [none] data.add(new Double(va1)); // depends on control dependency: [if], data = [none] data.add(new Double(va2)); // depends on control dependency: [if], data = [none] data.add(new Double(va3)); // depends on control dependency: [if], data = [none] data.add(new Double(va4)); // depends on control dependency: [if], data = [none] data.add(new Double(va5)); // depends on control dependency: [if], data = [none] LOG.debug("data = " + data); // depends on control dependency: [if], data = [none] } else { data = new Vector(); // depends on control dependency: [if], data = [none] data.add(new Double(va1)); // depends on control dependency: [if], data = [none] data.add(new Double(va2)); // depends on control dependency: [if], data = [none] data.add(new Double(va3)); // depends on control dependency: [if], data = [none] data.add(new Double(va4)); // depends on control dependency: [if], data = [none] data.add(new Double(va5)); // depends on control dependency: [if], data = [none] LOG.debug("data = " + data); // depends on control dependency: [if], data = [none] } parameterSet.put(key, data); } catch (NumberFormatException nfe) { throw new IOException("setTorsion: Malformed Number due to:" + nfe); } } }
public class class_name { private I_CmsXmlSchemaType getSchemaTypeRecusive(String elementPath) { String path = CmsXmlUtils.getFirstXpathElement(elementPath); I_CmsXmlSchemaType type = m_types.get(path); if (type == null) { // no node with the given path defined in schema return null; } // check if recursion is required to get value from a nested schema if (type.isSimpleType() || !CmsXmlUtils.isDeepXpath(elementPath)) { // no recursion required return type; } // recursion required since the path is an xpath and the type must be a nested content definition CmsXmlNestedContentDefinition nestedDefinition = (CmsXmlNestedContentDefinition)type; path = CmsXmlUtils.removeFirstXpathElement(elementPath); return nestedDefinition.getNestedContentDefinition().getSchemaType(path); } }
public class class_name { private I_CmsXmlSchemaType getSchemaTypeRecusive(String elementPath) { String path = CmsXmlUtils.getFirstXpathElement(elementPath); I_CmsXmlSchemaType type = m_types.get(path); if (type == null) { // no node with the given path defined in schema return null; // depends on control dependency: [if], data = [none] } // check if recursion is required to get value from a nested schema if (type.isSimpleType() || !CmsXmlUtils.isDeepXpath(elementPath)) { // no recursion required return type; // depends on control dependency: [if], data = [none] } // recursion required since the path is an xpath and the type must be a nested content definition CmsXmlNestedContentDefinition nestedDefinition = (CmsXmlNestedContentDefinition)type; path = CmsXmlUtils.removeFirstXpathElement(elementPath); return nestedDefinition.getNestedContentDefinition().getSchemaType(path); } }
public class class_name { public FileDefinition read() { // Parse blocks try { fillIn(); mergeContiguousRegions( this.definitionFile.getBlocks()); } catch( IOException e ) { addModelError( ErrorCode.P_IO_ERROR, this.currentLineNumber, exception( e )); } // Determine file type boolean hasFacets = false, hasComponents = false, hasInstances = false, hasImports = false; int ignorableBlocksCount = 0; for( AbstractBlock block : this.definitionFile.getBlocks()) { if( block.getInstructionType() == AbstractBlock.COMPONENT ) hasComponents = true; else if( block.getInstructionType() == AbstractBlock.FACET ) hasFacets = true; else if( block.getInstructionType() == AbstractBlock.INSTANCEOF ) hasInstances = true; else if( block.getInstructionType() == AbstractBlock.IMPORT ) hasImports = true; else if( block instanceof AbstractIgnorableInstruction ) ignorableBlocksCount ++; } if( hasInstances ) { if( ! hasFacets && ! hasComponents ) this.definitionFile.setFileType( FileDefinition.INSTANCE ); else addModelError( ErrorCode.P_INVALID_FILE_TYPE, 1 ); } else if( hasFacets || hasComponents ) { this.definitionFile.setFileType( FileDefinition.GRAPH ); } else if( hasImports ) { this.definitionFile.setFileType( FileDefinition.AGGREGATOR ); } else if( ignorableBlocksCount == this.definitionFile.getBlocks().size()) { addModelError( ErrorCode.P_EMPTY_FILE, 1 ); this.definitionFile.setFileType( FileDefinition.EMPTY ); } return this.definitionFile; } }
public class class_name { public FileDefinition read() { // Parse blocks try { fillIn(); // depends on control dependency: [try], data = [none] mergeContiguousRegions( this.definitionFile.getBlocks()); // depends on control dependency: [try], data = [none] } catch( IOException e ) { addModelError( ErrorCode.P_IO_ERROR, this.currentLineNumber, exception( e )); } // depends on control dependency: [catch], data = [none] // Determine file type boolean hasFacets = false, hasComponents = false, hasInstances = false, hasImports = false; int ignorableBlocksCount = 0; for( AbstractBlock block : this.definitionFile.getBlocks()) { if( block.getInstructionType() == AbstractBlock.COMPONENT ) hasComponents = true; else if( block.getInstructionType() == AbstractBlock.FACET ) hasFacets = true; else if( block.getInstructionType() == AbstractBlock.INSTANCEOF ) hasInstances = true; else if( block.getInstructionType() == AbstractBlock.IMPORT ) hasImports = true; else if( block instanceof AbstractIgnorableInstruction ) ignorableBlocksCount ++; } if( hasInstances ) { if( ! hasFacets && ! hasComponents ) this.definitionFile.setFileType( FileDefinition.INSTANCE ); else addModelError( ErrorCode.P_INVALID_FILE_TYPE, 1 ); } else if( hasFacets || hasComponents ) { this.definitionFile.setFileType( FileDefinition.GRAPH ); // depends on control dependency: [if], data = [none] } else if( hasImports ) { this.definitionFile.setFileType( FileDefinition.AGGREGATOR ); // depends on control dependency: [if], data = [none] } else if( ignorableBlocksCount == this.definitionFile.getBlocks().size()) { addModelError( ErrorCode.P_EMPTY_FILE, 1 ); // depends on control dependency: [if], data = [none] this.definitionFile.setFileType( FileDefinition.EMPTY ); // depends on control dependency: [if], data = [none] } return this.definitionFile; } }
public class class_name { public ISynchronizationPoint<IOException> decode(ByteBuffer buffer) { SynchronizationPoint<IOException> result = new SynchronizationPoint<>(); new Task.Cpu<Void, NoException>("Decoding base 64", output.getPriority()) { @Override public Void run() { if (nbPrev > 0) { while (nbPrev < 4 && buffer.hasRemaining()) previous[nbPrev++] = buffer.get(); if (nbPrev < 4) { result.unblock(); return null; } byte[] out = new byte[3]; try { Base64.decode4BytesBase64(previous, out); } catch (IOException e) { result.error(e); return null; } nbPrev = 0; if (!buffer.hasRemaining()) { write(out, result); return null; } write(out, null); } byte[] out; try { out = Base64.decode(buffer); } catch (IOException e) { result.error(e); return null; } while (buffer.hasRemaining()) previous[nbPrev++] = buffer.get(); write(out, result); return null; } }.start(); return result; } }
public class class_name { public ISynchronizationPoint<IOException> decode(ByteBuffer buffer) { SynchronizationPoint<IOException> result = new SynchronizationPoint<>(); new Task.Cpu<Void, NoException>("Decoding base 64", output.getPriority()) { @Override public Void run() { if (nbPrev > 0) { while (nbPrev < 4 && buffer.hasRemaining()) previous[nbPrev++] = buffer.get(); if (nbPrev < 4) { result.unblock(); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } byte[] out = new byte[3]; try { Base64.decode4BytesBase64(previous, out); } // depends on control dependency: [try], data = [none] catch (IOException e) { result.error(e); return null; } // depends on control dependency: [catch], data = [none] nbPrev = 0; // depends on control dependency: [if], data = [none] if (!buffer.hasRemaining()) { write(out, result); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } write(out, null); // depends on control dependency: [if], data = [none] } byte[] out; try { out = Base64.decode(buffer); } // depends on control dependency: [try], data = [none] catch (IOException e) { result.error(e); return null; } // depends on control dependency: [catch], data = [none] while (buffer.hasRemaining()) previous[nbPrev++] = buffer.get(); write(out, result); return null; } }.start(); return result; } }
public class class_name { public void merge(ProtoNetwork protoNetwork1, ProtoNetwork protoNetwork2) { if (protoNetwork1 == null) { throw new InvalidArgument("protoNetwork1", protoNetwork1); } if (protoNetwork2 == null) { throw new InvalidArgument("protoNetwork2", protoNetwork2); } DocumentTable dt = protoNetwork2.getDocumentTable(); for (DocumentHeader dh : dt.getDocumentHeaders()) { // add new document header int did = protoNetwork1.getDocumentTable().addDocumentHeader(dh); // union namespaces NamespaceTable nt = protoNetwork2.getNamespaceTable(); for (TableNamespace ns : nt.getNamespaces()) { protoNetwork1.getNamespaceTable().addNamespace(ns, did); } // union annotation definition values Map<Integer, Integer> adremap = new HashMap<Integer, Integer>(); AnnotationDefinitionTable adt = protoNetwork2.getAnnotationDefinitionTable(); for (TableAnnotationDefinition ad : adt.getAnnotationDefinitions()) { Integer oldDefinitionId = adt.getDefinitionIndex().get(ad); Integer newDefinitionId = protoNetwork1 .getAnnotationDefinitionTable() .addAnnotationDefinition(ad, did); adremap.put(oldDefinitionId, newDefinitionId); } // union annotation values AnnotationValueTable avt = protoNetwork2.getAnnotationValueTable(); for (TableAnnotationValue av : avt.getAnnotationValues()) { Integer newDefinitionId = adremap.get(av.getAnnotationDefinitionId()); protoNetwork1.getAnnotationValueTable().addAnnotationValue( newDefinitionId, av.getAnnotationValue()); } // union statements StatementTable statementTable = protoNetwork2.getStatementTable(); List<TableStatement> statements = statementTable.getStatements(); List<String> terms = protoNetwork2.getTermTable().getTermValues(); Map<Integer, Integer> termMap = new HashMap<Integer, Integer>( terms.size()); for (int j = 0; j < statements.size(); j++) { mergeStatement(j, statements.get(j), protoNetwork1, protoNetwork2, did, termMap); } } } }
public class class_name { public void merge(ProtoNetwork protoNetwork1, ProtoNetwork protoNetwork2) { if (protoNetwork1 == null) { throw new InvalidArgument("protoNetwork1", protoNetwork1); } if (protoNetwork2 == null) { throw new InvalidArgument("protoNetwork2", protoNetwork2); } DocumentTable dt = protoNetwork2.getDocumentTable(); for (DocumentHeader dh : dt.getDocumentHeaders()) { // add new document header int did = protoNetwork1.getDocumentTable().addDocumentHeader(dh); // union namespaces NamespaceTable nt = protoNetwork2.getNamespaceTable(); for (TableNamespace ns : nt.getNamespaces()) { protoNetwork1.getNamespaceTable().addNamespace(ns, did); // depends on control dependency: [for], data = [ns] } // union annotation definition values Map<Integer, Integer> adremap = new HashMap<Integer, Integer>(); AnnotationDefinitionTable adt = protoNetwork2.getAnnotationDefinitionTable(); for (TableAnnotationDefinition ad : adt.getAnnotationDefinitions()) { Integer oldDefinitionId = adt.getDefinitionIndex().get(ad); Integer newDefinitionId = protoNetwork1 .getAnnotationDefinitionTable() .addAnnotationDefinition(ad, did); adremap.put(oldDefinitionId, newDefinitionId); // depends on control dependency: [for], data = [ad] } // union annotation values AnnotationValueTable avt = protoNetwork2.getAnnotationValueTable(); for (TableAnnotationValue av : avt.getAnnotationValues()) { Integer newDefinitionId = adremap.get(av.getAnnotationDefinitionId()); protoNetwork1.getAnnotationValueTable().addAnnotationValue( newDefinitionId, av.getAnnotationValue()); // depends on control dependency: [for], data = [none] } // union statements StatementTable statementTable = protoNetwork2.getStatementTable(); List<TableStatement> statements = statementTable.getStatements(); List<String> terms = protoNetwork2.getTermTable().getTermValues(); Map<Integer, Integer> termMap = new HashMap<Integer, Integer>( terms.size()); for (int j = 0; j < statements.size(); j++) { mergeStatement(j, statements.get(j), protoNetwork1, protoNetwork2, did, termMap); // depends on control dependency: [for], data = [j] } } } }
public class class_name { private static @Nullable Throwable tryClose(Object o, @Nullable Throwable outer) { if (o instanceof Closeable) { try { ((Closeable) o).close(); } catch (Throwable t) { if (outer == null) { return t; } outer.addSuppressed(t); return outer; } } return null; } }
public class class_name { private static @Nullable Throwable tryClose(Object o, @Nullable Throwable outer) { if (o instanceof Closeable) { try { ((Closeable) o).close(); // depends on control dependency: [try], data = [none] } catch (Throwable t) { if (outer == null) { return t; // depends on control dependency: [if], data = [none] } outer.addSuppressed(t); return outer; } // depends on control dependency: [catch], data = [none] } return null; } }
public class class_name { @Override public void engineLoad(InputStream inputStream, char[] chars) throws IOException, NoSuchAlgorithmException, CertificateException { try { Properties properties = new Properties(); if(inputStream != null){ properties.load(inputStream); if (properties.size() == 0) { throw new CertificateException( "Properties file for configuration was empty?"); } }else{ if(chars == null){ // keyStore.load(null,null) -> in memory only keystore inMemoryOnly = true; } } String defaultDirectoryString = properties .getProperty(DEFAULT_DIRECTORY_KEY); String directoryListString = properties .getProperty(DIRECTORY_LIST_KEY); String proxyFilename = properties.getProperty(PROXY_FILENAME); String certFilename = properties.getProperty(CERTIFICATE_FILENAME); String keyFilename = properties.getProperty(KEY_FILENAME); initialize(defaultDirectoryString, directoryListString, proxyFilename, certFilename, keyFilename); } finally { if(inputStream != null){ try { inputStream.close(); } catch (IOException e) { logger.info("Error closing inputStream", e); } } } } }
public class class_name { @Override public void engineLoad(InputStream inputStream, char[] chars) throws IOException, NoSuchAlgorithmException, CertificateException { try { Properties properties = new Properties(); if(inputStream != null){ properties.load(inputStream); if (properties.size() == 0) { throw new CertificateException( "Properties file for configuration was empty?"); } }else{ if(chars == null){ // keyStore.load(null,null) -> in memory only keystore inMemoryOnly = true; // depends on control dependency: [if], data = [none] } } String defaultDirectoryString = properties .getProperty(DEFAULT_DIRECTORY_KEY); String directoryListString = properties .getProperty(DIRECTORY_LIST_KEY); String proxyFilename = properties.getProperty(PROXY_FILENAME); String certFilename = properties.getProperty(CERTIFICATE_FILENAME); String keyFilename = properties.getProperty(KEY_FILENAME); initialize(defaultDirectoryString, directoryListString, proxyFilename, certFilename, keyFilename); } finally { if(inputStream != null){ try { inputStream.close(); // depends on control dependency: [try], data = [none] } catch (IOException e) { logger.info("Error closing inputStream", e); } // depends on control dependency: [catch], data = [none] } } } }
public class class_name { @Override public void configure() { log.debug("Loading Entity Metadata..."); ApplicationMetadata appMetadata = kunderaMetadata.getApplicationMetadata(); for (String persistenceUnit : persistenceUnits) { if (appMetadata.getMetamodelMap().get(persistenceUnit.trim()) != null) { if (log.isDebugEnabled()) { log.debug("Metadata already exists for the Persistence Unit " + persistenceUnit + ". Nothing to do"); } } else { loadEntityMetadata(persistenceUnit); } } } }
public class class_name { @Override public void configure() { log.debug("Loading Entity Metadata..."); ApplicationMetadata appMetadata = kunderaMetadata.getApplicationMetadata(); for (String persistenceUnit : persistenceUnits) { if (appMetadata.getMetamodelMap().get(persistenceUnit.trim()) != null) { if (log.isDebugEnabled()) { log.debug("Metadata already exists for the Persistence Unit " + persistenceUnit + ". Nothing to do"); // depends on control dependency: [if], data = [none] } } else { loadEntityMetadata(persistenceUnit); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private boolean isExceptionHandled(String ex) { try { JavaClass thrownEx = Repository.lookupClass(ex); // First look at the throws clause ExceptionTable et = getMethod().getExceptionTable(); if (et != null) { String[] throwClauseExNames = et.getExceptionNames(); for (String throwClauseExName : throwClauseExNames) { JavaClass throwClauseEx = Repository.lookupClass(throwClauseExName); if (thrownEx.instanceOf(throwClauseEx)) { return true; } } } // Next look at the try catch blocks CodeException[] catchExs = getCode().getExceptionTable(); if (catchExs != null) { int pc = getPC(); for (CodeException catchEx : catchExs) { if ((pc >= catchEx.getStartPC()) && (pc <= catchEx.getEndPC())) { int type = catchEx.getCatchType(); if (type != 0) { String catchExName = getConstantPool().getConstantString(type, Const.CONSTANT_Class); JavaClass catchException = Repository.lookupClass(catchExName); if (thrownEx.instanceOf(catchException)) { return true; } } } } } } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); } return false; } }
public class class_name { private boolean isExceptionHandled(String ex) { try { JavaClass thrownEx = Repository.lookupClass(ex); // First look at the throws clause ExceptionTable et = getMethod().getExceptionTable(); if (et != null) { String[] throwClauseExNames = et.getExceptionNames(); for (String throwClauseExName : throwClauseExNames) { JavaClass throwClauseEx = Repository.lookupClass(throwClauseExName); if (thrownEx.instanceOf(throwClauseEx)) { return true; // depends on control dependency: [if], data = [none] } } } // Next look at the try catch blocks CodeException[] catchExs = getCode().getExceptionTable(); if (catchExs != null) { int pc = getPC(); for (CodeException catchEx : catchExs) { if ((pc >= catchEx.getStartPC()) && (pc <= catchEx.getEndPC())) { int type = catchEx.getCatchType(); if (type != 0) { String catchExName = getConstantPool().getConstantString(type, Const.CONSTANT_Class); JavaClass catchException = Repository.lookupClass(catchExName); if (thrownEx.instanceOf(catchException)) { return true; // depends on control dependency: [if], data = [none] } } } } } } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); } // depends on control dependency: [catch], data = [none] return false; } }
public class class_name { public static BufferedImage resizeScreenshotIfNeeded(WebDriver driver, BufferedImage screenshotImage) { Double devicePixelRatio = 1.0; try { devicePixelRatio = ((Number) ((JavascriptExecutor) driver).executeScript(JS_RETRIEVE_DEVICE_PIXEL_RATIO)).doubleValue(); } catch (Exception ex) { ex.printStackTrace(); } if (devicePixelRatio > 1.0 && screenshotImage.getWidth() > 0) { Long screenSize = ((Number) ((JavascriptExecutor) driver).executeScript("return Math.max(" + "document.body.scrollWidth, document.documentElement.scrollWidth," + "document.body.offsetWidth, document.documentElement.offsetWidth," + "document.body.clientWidth, document.documentElement.clientWidth);" )).longValue(); Double estimatedPixelRatio = ((double)screenshotImage.getWidth()) / ((double)screenSize); if (estimatedPixelRatio > 1.0) { int newWidth = (int) (screenshotImage.getWidth() / estimatedPixelRatio); int newHeight = (int) (screenshotImage.getHeight() / estimatedPixelRatio); Image tmp = screenshotImage.getScaledInstance(newWidth, newHeight, Image.SCALE_SMOOTH); BufferedImage scaledImage = new BufferedImage(newWidth, newHeight, BufferedImage.TYPE_INT_RGB); Graphics2D g2d = scaledImage.createGraphics(); g2d.drawImage(tmp, 0, 0, null); g2d.dispose(); return scaledImage; } else return screenshotImage; } else return screenshotImage; } }
public class class_name { public static BufferedImage resizeScreenshotIfNeeded(WebDriver driver, BufferedImage screenshotImage) { Double devicePixelRatio = 1.0; try { devicePixelRatio = ((Number) ((JavascriptExecutor) driver).executeScript(JS_RETRIEVE_DEVICE_PIXEL_RATIO)).doubleValue(); // depends on control dependency: [try], data = [none] } catch (Exception ex) { ex.printStackTrace(); } // depends on control dependency: [catch], data = [none] if (devicePixelRatio > 1.0 && screenshotImage.getWidth() > 0) { Long screenSize = ((Number) ((JavascriptExecutor) driver).executeScript("return Math.max(" + "document.body.scrollWidth, document.documentElement.scrollWidth," + "document.body.offsetWidth, document.documentElement.offsetWidth," + "document.body.clientWidth, document.documentElement.clientWidth);" )).longValue(); Double estimatedPixelRatio = ((double)screenshotImage.getWidth()) / ((double)screenSize); if (estimatedPixelRatio > 1.0) { int newWidth = (int) (screenshotImage.getWidth() / estimatedPixelRatio); int newHeight = (int) (screenshotImage.getHeight() / estimatedPixelRatio); Image tmp = screenshotImage.getScaledInstance(newWidth, newHeight, Image.SCALE_SMOOTH); BufferedImage scaledImage = new BufferedImage(newWidth, newHeight, BufferedImage.TYPE_INT_RGB); Graphics2D g2d = scaledImage.createGraphics(); g2d.drawImage(tmp, 0, 0, null); // depends on control dependency: [if], data = [none] g2d.dispose(); // depends on control dependency: [if], data = [none] return scaledImage; // depends on control dependency: [if], data = [none] } else return screenshotImage; } else return screenshotImage; } }
public class class_name { public boolean isNodeType(final InternalQName testTypeName, final InternalQName primaryType, final InternalQName[] mixinTypes) { if (this.nodeTypeRepository.isNodeType(testTypeName, primaryType)) { return true; } if (this.nodeTypeRepository.isNodeType(testTypeName, mixinTypes)) { return true; } return false; } }
public class class_name { public boolean isNodeType(final InternalQName testTypeName, final InternalQName primaryType, final InternalQName[] mixinTypes) { if (this.nodeTypeRepository.isNodeType(testTypeName, primaryType)) { return true; // depends on control dependency: [if], data = [none] } if (this.nodeTypeRepository.isNodeType(testTypeName, mixinTypes)) { return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public void onMouseMove(MouseMoveEvent event) { if (isMeasuring() && distanceLine.getOriginalLocation() != null) { updateMeasure(event, false); dispatchState(State.MOVE); } } }
public class class_name { public void onMouseMove(MouseMoveEvent event) { if (isMeasuring() && distanceLine.getOriginalLocation() != null) { updateMeasure(event, false); // depends on control dependency: [if], data = [none] dispatchState(State.MOVE); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static <V extends NumberVector> double logLikelihoodZhao(Relation<V> relation, Clustering<? extends MeanModel> clustering, NumberVectorDistanceFunction<? super V> distanceFunction) { List<? extends Cluster<? extends MeanModel>> clusters = clustering.getAllClusters(); // number of clusters final int m = clusters.size(); // number of objects in the clustering int n = 0; // cluster sizes int[] n_i = new int[m]; // variances double[] d_i = new double[m]; // Iterate over clusters: Iterator<? extends Cluster<? extends MeanModel>> it = clusters.iterator(); for(int i = 0; it.hasNext(); ++i) { Cluster<? extends MeanModel> cluster = it.next(); n += n_i[i] = cluster.size(); // Note: the paper used 1/(n-m) but that is probably a typo // as it will cause divisions by zero. d_i[i] = varianceOfCluster(cluster, distanceFunction, relation) / (double) n_i[i]; } final int dim = RelationUtil.dimensionality(relation); // log likelihood of this clustering double logLikelihood = 0.; // Aggregate for(int i = 0; i < m; i++) { logLikelihood += n_i[i] * FastMath.log(n_i[i] / (double) n) // ni log ni/n - n_i[i] * dim * .5 * MathUtil.LOGTWOPI // ni*d/2 log2pi - n_i[i] * .5 * FastMath.log(d_i[i]) // ni/2 log sigma_i - (n_i[i] - m) * .5; // (ni-m)/2 } return logLikelihood; } }
public class class_name { public static <V extends NumberVector> double logLikelihoodZhao(Relation<V> relation, Clustering<? extends MeanModel> clustering, NumberVectorDistanceFunction<? super V> distanceFunction) { List<? extends Cluster<? extends MeanModel>> clusters = clustering.getAllClusters(); // number of clusters final int m = clusters.size(); // number of objects in the clustering int n = 0; // cluster sizes int[] n_i = new int[m]; // variances double[] d_i = new double[m]; // Iterate over clusters: Iterator<? extends Cluster<? extends MeanModel>> it = clusters.iterator(); for(int i = 0; it.hasNext(); ++i) { Cluster<? extends MeanModel> cluster = it.next(); // depends on control dependency: [for], data = [none] n += n_i[i] = cluster.size(); // depends on control dependency: [for], data = [i] // Note: the paper used 1/(n-m) but that is probably a typo // as it will cause divisions by zero. d_i[i] = varianceOfCluster(cluster, distanceFunction, relation) / (double) n_i[i]; // depends on control dependency: [for], data = [i] } final int dim = RelationUtil.dimensionality(relation); // log likelihood of this clustering double logLikelihood = 0.; // Aggregate for(int i = 0; i < m; i++) { logLikelihood += n_i[i] * FastMath.log(n_i[i] / (double) n) // ni log ni/n - n_i[i] * dim * .5 * MathUtil.LOGTWOPI // ni*d/2 log2pi - n_i[i] * .5 * FastMath.log(d_i[i]) // ni/2 log sigma_i - (n_i[i] - m) * .5; // (ni-m)/2 // depends on control dependency: [for], data = [i] } return logLikelihood; } }
public class class_name { public void setDefaultGroups(String[] value) { if (value != null) { defaultGroups = Arrays.copyOf(value, value.length); } else { defaultGroups = null; } } }
public class class_name { public void setDefaultGroups(String[] value) { if (value != null) { defaultGroups = Arrays.copyOf(value, value.length); // depends on control dependency: [if], data = [(value] } else { defaultGroups = null; // depends on control dependency: [if], data = [none] } } }
public class class_name { private IPv6AddressRange findFreeRangeAfter(IPv6Network network) { for (IPv6AddressRange freeRange : freeRanges) { if (freeRange.getFirst().subtract(1).equals(network.getLast())) { return freeRange; } } // not found return null; } }
public class class_name { private IPv6AddressRange findFreeRangeAfter(IPv6Network network) { for (IPv6AddressRange freeRange : freeRanges) { if (freeRange.getFirst().subtract(1).equals(network.getLast())) { return freeRange; // depends on control dependency: [if], data = [none] } } // not found return null; } }
public class class_name { boolean validateCertificate(byte[] certPEM) { if (certPEM == null) { return false; } try { X509Certificate certificate = getX509Certificate(certPEM); if (null == certificate) { throw new Exception("Certificate transformation returned null"); } return validateCertificate(certificate); } catch (Exception e) { logger.error("Cannot validate certificate. Error is: " + e.getMessage() + "\r\nCertificate (PEM, hex): " + DatatypeConverter.printHexBinary(certPEM)); return false; } } }
public class class_name { boolean validateCertificate(byte[] certPEM) { if (certPEM == null) { return false; // depends on control dependency: [if], data = [none] } try { X509Certificate certificate = getX509Certificate(certPEM); if (null == certificate) { throw new Exception("Certificate transformation returned null"); } return validateCertificate(certificate); // depends on control dependency: [try], data = [none] } catch (Exception e) { logger.error("Cannot validate certificate. Error is: " + e.getMessage() + "\r\nCertificate (PEM, hex): " + DatatypeConverter.printHexBinary(certPEM)); return false; } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public void addPixels(int[] pixels, int offset, int count) { for (int i = 0; i < count; i++) { insertColor(pixels[i + offset]); if (colors > reduceColors) reduceTree(reduceColors); } } }
public class class_name { @Override public void addPixels(int[] pixels, int offset, int count) { for (int i = 0; i < count; i++) { insertColor(pixels[i + offset]); // depends on control dependency: [for], data = [i] if (colors > reduceColors) reduceTree(reduceColors); } } }
public class class_name { static void throwIfUnrecognizedParamName(final Enumeration initParamNames) { final Set<String> recognizedParameterNames = new HashSet<String>(); recognizedParameterNames.add(INIT_PARAM_ENABLE_CACHE_CONTROL); recognizedParameterNames.add(INIT_PARAM_ENABLE_XCONTENT_OPTIONS); recognizedParameterNames.add(INIT_PARAM_ENABLE_STRICT_TRANSPORT_SECURITY); recognizedParameterNames.add(INIT_PARAM_ENABLE_STRICT_XFRAME_OPTIONS); recognizedParameterNames.add(INIT_PARAM_STRICT_XFRAME_OPTIONS); recognizedParameterNames.add(INIT_PARAM_CONTENT_SECURITY_POLICY); recognizedParameterNames.add(LOGGER_HANDLER_CLASS_NAME); recognizedParameterNames.add(INIT_PARAM_ENABLE_XSS_PROTECTION); recognizedParameterNames.add(INIT_PARAM_XSS_PROTECTION); while (initParamNames.hasMoreElements()) { final String initParamName = (String) initParamNames.nextElement(); if (!recognizedParameterNames.contains(initParamName)) { FilterUtils.logException(LOGGER, new ServletException("Unrecognized init parameter [" + initParamName + "]. Failing safe. Typo" + " in the web.xml configuration? " + " Misunderstanding about the configuration " + RequestParameterPolicyEnforcementFilter.class.getSimpleName() + " expects?")); } } } }
public class class_name { static void throwIfUnrecognizedParamName(final Enumeration initParamNames) { final Set<String> recognizedParameterNames = new HashSet<String>(); recognizedParameterNames.add(INIT_PARAM_ENABLE_CACHE_CONTROL); recognizedParameterNames.add(INIT_PARAM_ENABLE_XCONTENT_OPTIONS); recognizedParameterNames.add(INIT_PARAM_ENABLE_STRICT_TRANSPORT_SECURITY); recognizedParameterNames.add(INIT_PARAM_ENABLE_STRICT_XFRAME_OPTIONS); recognizedParameterNames.add(INIT_PARAM_STRICT_XFRAME_OPTIONS); recognizedParameterNames.add(INIT_PARAM_CONTENT_SECURITY_POLICY); recognizedParameterNames.add(LOGGER_HANDLER_CLASS_NAME); recognizedParameterNames.add(INIT_PARAM_ENABLE_XSS_PROTECTION); recognizedParameterNames.add(INIT_PARAM_XSS_PROTECTION); while (initParamNames.hasMoreElements()) { final String initParamName = (String) initParamNames.nextElement(); if (!recognizedParameterNames.contains(initParamName)) { FilterUtils.logException(LOGGER, new ServletException("Unrecognized init parameter [" + initParamName + "]. Failing safe. Typo" + " in the web.xml configuration? " + " Misunderstanding about the configuration " + RequestParameterPolicyEnforcementFilter.class.getSimpleName() + " expects?")); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public Lint augment(Symbol sym) { Lint l = augmentor.augment(this, sym.getDeclarationAttributes()); if (sym.isDeprecated()) { if (l == this) l = new Lint(this); l.values.remove(LintCategory.DEPRECATION); l.suppressedValues.add(LintCategory.DEPRECATION); } return l; } }
public class class_name { public Lint augment(Symbol sym) { Lint l = augmentor.augment(this, sym.getDeclarationAttributes()); if (sym.isDeprecated()) { if (l == this) l = new Lint(this); l.values.remove(LintCategory.DEPRECATION); // depends on control dependency: [if], data = [none] l.suppressedValues.add(LintCategory.DEPRECATION); // depends on control dependency: [if], data = [none] } return l; } }
public class class_name { public boolean checkTimeframeArg(String timeframe) { if (Pattern.compile("\\d*(d|h)", Pattern.CASE_INSENSITIVE).matcher(timeframe).matches()) { return true; } else { return false; } } }
public class class_name { public boolean checkTimeframeArg(String timeframe) { if (Pattern.compile("\\d*(d|h)", Pattern.CASE_INSENSITIVE).matcher(timeframe).matches()) { return true; // depends on control dependency: [if], data = [none] } else { return false; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static URL getCorrectHostnamePort(String hostPort) { try { URL u = new URL("http://" + hostPort); if (u.getHost() == null) { throw new IllegalArgumentException("The given host:port ('" + hostPort + "') doesn't contain a valid host"); } if (u.getPort() == -1) { throw new IllegalArgumentException("The given host:port ('" + hostPort + "') doesn't contain a valid port"); } return u; } catch (MalformedURLException e) { throw new IllegalArgumentException("The given host:port ('" + hostPort + "') is invalid", e); } } }
public class class_name { public static URL getCorrectHostnamePort(String hostPort) { try { URL u = new URL("http://" + hostPort); if (u.getHost() == null) { throw new IllegalArgumentException("The given host:port ('" + hostPort + "') doesn't contain a valid host"); } if (u.getPort() == -1) { throw new IllegalArgumentException("The given host:port ('" + hostPort + "') doesn't contain a valid port"); } return u; // depends on control dependency: [try], data = [none] } catch (MalformedURLException e) { throw new IllegalArgumentException("The given host:port ('" + hostPort + "') is invalid", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private static List<String> split(String str, char delim) { List<String> result = Lists.newArrayList(); int currPartStart = 0; while (true) { int currPartEnd = str.indexOf(delim, currPartStart); if (currPartEnd == -1) { result.add(str.substring(currPartStart)); break; } else { result.add(str.substring(currPartStart, currPartEnd)); currPartStart = currPartEnd + 1; } } return result; } }
public class class_name { private static List<String> split(String str, char delim) { List<String> result = Lists.newArrayList(); int currPartStart = 0; while (true) { int currPartEnd = str.indexOf(delim, currPartStart); if (currPartEnd == -1) { result.add(str.substring(currPartStart)); // depends on control dependency: [if], data = [none] break; } else { result.add(str.substring(currPartStart, currPartEnd)); // depends on control dependency: [if], data = [none] currPartStart = currPartEnd + 1; // depends on control dependency: [if], data = [none] } } return result; } }
public class class_name { @SuppressWarnings("nls") private double[] nsewStringsToNumbers( String north, String south, String east, String west ) { double no = -1.0; double so = -1.0; double ea = -1.0; double we = -1.0; if (north.indexOf("N") != -1 || north.indexOf("n") != -1) { north = north.substring(0, north.length() - 1); no = degreeToNumber(north); } else if (north.indexOf("S") != -1 || north.indexOf("s") != -1) { north = north.substring(0, north.length() - 1); no = -degreeToNumber(north); } else { no = Double.parseDouble(north); } if (south.indexOf("N") != -1 || south.indexOf("n") != -1) { south = south.substring(0, south.length() - 1); so = degreeToNumber(south); } else if (south.indexOf("S") != -1 || south.indexOf("s") != -1) { south = south.substring(0, south.length() - 1); so = -degreeToNumber(south); } else { so = Double.parseDouble(south); } if (west.indexOf("E") != -1 || west.indexOf("e") != -1) { west = west.substring(0, west.length() - 1); we = degreeToNumber(west); } else if (west.indexOf("W") != -1 || west.indexOf("w") != -1) { west = west.substring(0, west.length() - 1); we = -degreeToNumber(west); } else { we = Double.parseDouble(west); } if (east.indexOf("E") != -1 || east.indexOf("e") != -1) { east = east.substring(0, east.length() - 1); ea = degreeToNumber(east); } else if (east.indexOf("W") != -1 || east.indexOf("w") != -1) { east = east.substring(0, east.length() - 1); ea = -degreeToNumber(east); } else { ea = Double.parseDouble(east); } return new double[]{no, so, ea, we}; } }
public class class_name { @SuppressWarnings("nls") private double[] nsewStringsToNumbers( String north, String south, String east, String west ) { double no = -1.0; double so = -1.0; double ea = -1.0; double we = -1.0; if (north.indexOf("N") != -1 || north.indexOf("n") != -1) { north = north.substring(0, north.length() - 1); // depends on control dependency: [if], data = [none] no = degreeToNumber(north); // depends on control dependency: [if], data = [none] } else if (north.indexOf("S") != -1 || north.indexOf("s") != -1) { north = north.substring(0, north.length() - 1); // depends on control dependency: [if], data = [none] no = -degreeToNumber(north); // depends on control dependency: [if], data = [none] } else { no = Double.parseDouble(north); // depends on control dependency: [if], data = [none] } if (south.indexOf("N") != -1 || south.indexOf("n") != -1) { south = south.substring(0, south.length() - 1); // depends on control dependency: [if], data = [none] so = degreeToNumber(south); // depends on control dependency: [if], data = [none] } else if (south.indexOf("S") != -1 || south.indexOf("s") != -1) { south = south.substring(0, south.length() - 1); // depends on control dependency: [if], data = [none] so = -degreeToNumber(south); // depends on control dependency: [if], data = [none] } else { so = Double.parseDouble(south); // depends on control dependency: [if], data = [none] } if (west.indexOf("E") != -1 || west.indexOf("e") != -1) { west = west.substring(0, west.length() - 1); // depends on control dependency: [if], data = [none] we = degreeToNumber(west); // depends on control dependency: [if], data = [none] } else if (west.indexOf("W") != -1 || west.indexOf("w") != -1) { west = west.substring(0, west.length() - 1); // depends on control dependency: [if], data = [none] we = -degreeToNumber(west); // depends on control dependency: [if], data = [none] } else { we = Double.parseDouble(west); // depends on control dependency: [if], data = [none] } if (east.indexOf("E") != -1 || east.indexOf("e") != -1) { east = east.substring(0, east.length() - 1); // depends on control dependency: [if], data = [none] ea = degreeToNumber(east); // depends on control dependency: [if], data = [none] } else if (east.indexOf("W") != -1 || east.indexOf("w") != -1) { east = east.substring(0, east.length() - 1); // depends on control dependency: [if], data = [none] ea = -degreeToNumber(east); // depends on control dependency: [if], data = [none] } else { ea = Double.parseDouble(east); // depends on control dependency: [if], data = [none] } return new double[]{no, so, ea, we}; } }
public class class_name { public static GrailsApplication findApplication(ServletContext servletContext) { ApplicationContext wac = findApplicationContext(servletContext); if(wac != null) { return (GrailsApplication)wac.getBean(GrailsApplication.APPLICATION_ID); } return null; } }
public class class_name { public static GrailsApplication findApplication(ServletContext servletContext) { ApplicationContext wac = findApplicationContext(servletContext); if(wac != null) { return (GrailsApplication)wac.getBean(GrailsApplication.APPLICATION_ID); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public Duration getBaselineDuration() { Object result = getCachedValue(TaskField.BASELINE_DURATION); if (result == null) { result = getCachedValue(TaskField.BASELINE_ESTIMATED_DURATION); } if (!(result instanceof Duration)) { result = null; } return (Duration) result; } }
public class class_name { public Duration getBaselineDuration() { Object result = getCachedValue(TaskField.BASELINE_DURATION); if (result == null) { result = getCachedValue(TaskField.BASELINE_ESTIMATED_DURATION); // depends on control dependency: [if], data = [none] } if (!(result instanceof Duration)) { result = null; // depends on control dependency: [if], data = [none] } return (Duration) result; } }
public class class_name { public void start() throws Exception { /* * SJ uses this barrier if this node becomes the leader to know when ZooKeeper * has been finished bootstrapping. */ CountDownLatch zkInitBarrier = new CountDownLatch(1); /* * If start returns true then this node is the leader, it bound to the coordinator address * It needs to bootstrap its agreement site so that other nodes can join */ if(m_joiner.start(zkInitBarrier)) { m_network.start(); /* * m_localHostId is 0 of course. */ long agreementHSId = getHSIdForLocalSite(AGREEMENT_SITE_ID); /* * A set containing just the leader (this node) */ HashSet<Long> agreementSites = new HashSet<Long>(); agreementSites.add(agreementHSId); /* * A basic site mailbox for the agreement site */ SiteMailbox sm = new SiteMailbox(this, agreementHSId); createMailbox(agreementHSId, sm); /* * Construct the site with just this node */ m_agreementSite = new AgreementSite( agreementHSId, agreementSites, 0, sm, new InetSocketAddress( m_config.zkInterface.split(":")[0], Integer.parseInt(m_config.zkInterface.split(":")[1])), m_config.backwardsTimeForgivenessWindow, m_failedHostsCallback); m_agreementSite.start(); m_agreementSite.waitForRecovery(); m_zk = org.voltcore.zk.ZKUtil.getClient( m_config.zkInterface, 60 * 1000, VERBOTEN_THREADS); if (m_zk == null) { throw new Exception("Timed out trying to connect local ZooKeeper instance"); } CoreZK.createHierarchy(m_zk); /* * This creates the ephemeral sequential node with host id 0 which * this node already used for itself. Just recording that fact. */ final int selectedHostId = selectNewHostId(m_config.coordinatorIp.toString()); if (selectedHostId != 0) { org.voltdb.VoltDB.crashLocalVoltDB("Selected host id for coordinator was not 0, " + selectedHostId, false, null); } /* * seed the leader host criteria ad leader is always host id 0 */ m_acceptor.accrue(selectedHostId, m_acceptor.decorate(new JSONObject(), Optional.empty())); // Store the components of the instance ID in ZK JSONObject instance_id = new JSONObject(); instance_id.put("coord", ByteBuffer.wrap(m_config.coordinatorIp.getAddress().getAddress()).getInt()); instance_id.put("timestamp", System.currentTimeMillis()); hostLog.debug("Cluster will have instance ID:\n" + instance_id.toString(4)); byte[] payload = instance_id.toString(4).getBytes("UTF-8"); m_zk.create(CoreZK.instance_id, payload, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); /* * Store all the hosts and host ids here so that waitForGroupJoin * knows the size of the mesh. This part only registers this host */ final HostInfo hostInfo = new HostInfo(m_config.coordinatorIp.toString(), m_config.group, m_config.localSitesCount, m_config.recoveredPartitions); m_zk.create(CoreZK.hosts_host + selectedHostId, hostInfo.toBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL); } zkInitBarrier.countDown(); } }
public class class_name { public void start() throws Exception { /* * SJ uses this barrier if this node becomes the leader to know when ZooKeeper * has been finished bootstrapping. */ CountDownLatch zkInitBarrier = new CountDownLatch(1); /* * If start returns true then this node is the leader, it bound to the coordinator address * It needs to bootstrap its agreement site so that other nodes can join */ if(m_joiner.start(zkInitBarrier)) { m_network.start(); /* * m_localHostId is 0 of course. */ long agreementHSId = getHSIdForLocalSite(AGREEMENT_SITE_ID); /* * A set containing just the leader (this node) */ HashSet<Long> agreementSites = new HashSet<Long>(); agreementSites.add(agreementHSId); /* * A basic site mailbox for the agreement site */ SiteMailbox sm = new SiteMailbox(this, agreementHSId); createMailbox(agreementHSId, sm); /* * Construct the site with just this node */ m_agreementSite = new AgreementSite( agreementHSId, agreementSites, 0, sm, new InetSocketAddress( m_config.zkInterface.split(":")[0], Integer.parseInt(m_config.zkInterface.split(":")[1])), m_config.backwardsTimeForgivenessWindow, m_failedHostsCallback); m_agreementSite.start(); m_agreementSite.waitForRecovery(); m_zk = org.voltcore.zk.ZKUtil.getClient( m_config.zkInterface, 60 * 1000, VERBOTEN_THREADS); if (m_zk == null) { throw new Exception("Timed out trying to connect local ZooKeeper instance"); } CoreZK.createHierarchy(m_zk); /* * This creates the ephemeral sequential node with host id 0 which * this node already used for itself. Just recording that fact. */ final int selectedHostId = selectNewHostId(m_config.coordinatorIp.toString()); if (selectedHostId != 0) { org.voltdb.VoltDB.crashLocalVoltDB("Selected host id for coordinator was not 0, " + selectedHostId, false, null); // depends on control dependency: [if], data = [none] } /* * seed the leader host criteria ad leader is always host id 0 */ m_acceptor.accrue(selectedHostId, m_acceptor.decorate(new JSONObject(), Optional.empty())); // Store the components of the instance ID in ZK JSONObject instance_id = new JSONObject(); instance_id.put("coord", ByteBuffer.wrap(m_config.coordinatorIp.getAddress().getAddress()).getInt()); instance_id.put("timestamp", System.currentTimeMillis()); hostLog.debug("Cluster will have instance ID:\n" + instance_id.toString(4)); byte[] payload = instance_id.toString(4).getBytes("UTF-8"); m_zk.create(CoreZK.instance_id, payload, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); /* * Store all the hosts and host ids here so that waitForGroupJoin * knows the size of the mesh. This part only registers this host */ final HostInfo hostInfo = new HostInfo(m_config.coordinatorIp.toString(), m_config.group, m_config.localSitesCount, m_config.recoveredPartitions); m_zk.create(CoreZK.hosts_host + selectedHostId, hostInfo.toBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL); } zkInitBarrier.countDown(); } }
public class class_name { @VisibleForTesting static <V> List<Router<V>> routers(Iterable<V> values, Function<V, PathMapping> pathMappingResolver, BiConsumer<PathMapping, PathMapping> rejectionHandler) { rejectDuplicateMapping(values, pathMappingResolver, rejectionHandler); final ImmutableList.Builder<Router<V>> builder = ImmutableList.builder(); final List<V> group = new ArrayList<>(); boolean addingTrie = true; for (V value : values) { final PathMapping mapping = pathMappingResolver.apply(value); final boolean triePathPresent = mapping.triePath().isPresent(); if (addingTrie && triePathPresent || !addingTrie && !triePathPresent) { // We are adding the same type of PathMapping to 'group'. group.add(value); continue; } // Changed the router type. if (!group.isEmpty()) { builder.add(router(addingTrie, group, pathMappingResolver)); } addingTrie = !addingTrie; group.add(value); } if (!group.isEmpty()) { builder.add(router(addingTrie, group, pathMappingResolver)); } return builder.build(); } }
public class class_name { @VisibleForTesting static <V> List<Router<V>> routers(Iterable<V> values, Function<V, PathMapping> pathMappingResolver, BiConsumer<PathMapping, PathMapping> rejectionHandler) { rejectDuplicateMapping(values, pathMappingResolver, rejectionHandler); final ImmutableList.Builder<Router<V>> builder = ImmutableList.builder(); final List<V> group = new ArrayList<>(); boolean addingTrie = true; for (V value : values) { final PathMapping mapping = pathMappingResolver.apply(value); final boolean triePathPresent = mapping.triePath().isPresent(); if (addingTrie && triePathPresent || !addingTrie && !triePathPresent) { // We are adding the same type of PathMapping to 'group'. group.add(value); // depends on control dependency: [if], data = [none] continue; } // Changed the router type. if (!group.isEmpty()) { builder.add(router(addingTrie, group, pathMappingResolver)); // depends on control dependency: [if], data = [none] } addingTrie = !addingTrie; // depends on control dependency: [for], data = [none] group.add(value); // depends on control dependency: [for], data = [value] } if (!group.isEmpty()) { builder.add(router(addingTrie, group, pathMappingResolver)); // depends on control dependency: [if], data = [none] } return builder.build(); } }
public class class_name { private ImmutableList<ByteRange> parseRangeHeader(final String rangeHeader, final int resourceLength) { final ImmutableList.Builder<ByteRange> builder = ImmutableList.builder(); if (rangeHeader.contains("=")) { final String[] parts = rangeHeader.split("="); if (parts.length > 1) { final List<String> ranges = Splitter.on(",").trimResults().splitToList(parts[1]); for (final String range : ranges) { builder.add(ByteRange.parse(range, resourceLength)); } } } return builder.build(); } }
public class class_name { private ImmutableList<ByteRange> parseRangeHeader(final String rangeHeader, final int resourceLength) { final ImmutableList.Builder<ByteRange> builder = ImmutableList.builder(); if (rangeHeader.contains("=")) { final String[] parts = rangeHeader.split("="); if (parts.length > 1) { final List<String> ranges = Splitter.on(",").trimResults().splitToList(parts[1]); for (final String range : ranges) { builder.add(ByteRange.parse(range, resourceLength)); // depends on control dependency: [for], data = [range] } } } return builder.build(); } }