code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public void marshall(Code code, ProtocolMarshaller protocolMarshaller) { if (code == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(code.getSource(), SOURCE_BINDING); protocolMarshaller.marshall(code.getDestination(), DESTINATION_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(Code code, ProtocolMarshaller protocolMarshaller) { if (code == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(code.getSource(), SOURCE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(code.getDestination(), DESTINATION_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 void marshall(StopReplicationTaskRequest stopReplicationTaskRequest, ProtocolMarshaller protocolMarshaller) { if (stopReplicationTaskRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(stopReplicationTaskRequest.getReplicationTaskArn(), REPLICATIONTASKARN_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(StopReplicationTaskRequest stopReplicationTaskRequest, ProtocolMarshaller protocolMarshaller) { if (stopReplicationTaskRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(stopReplicationTaskRequest.getReplicationTaskArn(), REPLICATIONTASKARN_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 void increaseValue(String goldValue, String observedValue, int times) { allGoldLabels.add(goldValue); allPredictedLabels.add(observedValue); for (int i = 0; i < times; i++) { labelSeries.add(observedValue); } if (!map.containsKey(goldValue)) { map.put(goldValue, new TreeMap<String, Integer>()); } if (!map.get(goldValue).containsKey(observedValue)) { map.get(goldValue).put(observedValue, 0); } int currentValue = this.map.get(goldValue).get(observedValue); this.map.get(goldValue).put(observedValue, currentValue + times); total += times; if (goldValue.equals(observedValue)) { correct += times; } } }
public class class_name { public void increaseValue(String goldValue, String observedValue, int times) { allGoldLabels.add(goldValue); allPredictedLabels.add(observedValue); for (int i = 0; i < times; i++) { labelSeries.add(observedValue); // depends on control dependency: [for], data = [none] } if (!map.containsKey(goldValue)) { map.put(goldValue, new TreeMap<String, Integer>()); // depends on control dependency: [if], data = [none] } if (!map.get(goldValue).containsKey(observedValue)) { map.get(goldValue).put(observedValue, 0); // depends on control dependency: [if], data = [none] } int currentValue = this.map.get(goldValue).get(observedValue); this.map.get(goldValue).put(observedValue, currentValue + times); total += times; if (goldValue.equals(observedValue)) { correct += times; // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public int compare(BugInstance lhs, BugInstance rhs) { // Attributes of BugInstance. // Compare abbreviation // Compare class and method annotations (ignoring line numbers). // Compare field annotations. int cmp; BugPattern lhsPattern = lhs.getBugPattern(); BugPattern rhsPattern = rhs.getBugPattern(); // Compare by abbrev instead of type. The specific bug type can // change // (e.g., "definitely null" to "null on simple path"). Also, we // often // change bug pattern types from one version of FindBugs to the // next. // // Source line and field name are still matched precisely, so this // shouldn't // cause loss of precision. if ((cmp = lhsPattern.getAbbrev().compareTo(rhsPattern.getAbbrev())) != 0) { return cmp; } if (isExactBugPatternMatch() && (cmp = lhsPattern.getType().compareTo(rhsPattern.getType())) != 0) { return cmp; } if (comparePriorities) { cmp = lhs.getPriority() - rhs.getPriority(); if (cmp != 0) { return cmp; } } Iterator<BugAnnotation> lhsIter = new FilteringAnnotationIterator(lhs.annotationIterator()); Iterator<BugAnnotation> rhsIter = new FilteringAnnotationIterator(rhs.annotationIterator()); while (lhsIter.hasNext() && rhsIter.hasNext()) { BugAnnotation lhsAnnotation = lhsIter.next(); BugAnnotation rhsAnnotation = rhsIter.next(); Class<? extends BugAnnotation> lhsClass; while (true) { // Different annotation types obviously cannot be equal, // so just compare by class name. lhsClass = lhsAnnotation.getClass(); Class<? extends BugAnnotation> rhsClass = rhsAnnotation.getClass(); if (lhsClass == rhsClass) { break; } if (lhsClass == LocalVariableAnnotation.class && !((LocalVariableAnnotation) lhsAnnotation).isSignificant() && lhsIter.hasNext()) { lhsAnnotation = lhsIter.next(); } else if (rhsClass == LocalVariableAnnotation.class && !((LocalVariableAnnotation) rhsAnnotation).isSignificant() && rhsIter.hasNext()) { rhsAnnotation = rhsIter.next(); } else { return lhsClass.getName().compareTo(rhsClass.getName()); } } if (lhsClass == ClassAnnotation.class) { // ClassAnnotations should have their class names rewritten to // handle moved and renamed classes. String lhsClassName = classNameRewriter.rewriteClassName(((ClassAnnotation) lhsAnnotation).getClassName()); String rhsClassName = classNameRewriter.rewriteClassName(((ClassAnnotation) rhsAnnotation).getClassName()); cmp = lhsClassName.compareTo(rhsClassName); } else if (lhsClass == MethodAnnotation.class) { // Rewrite class names in MethodAnnotations MethodAnnotation lhsMethod = ClassNameRewriterUtil.convertMethodAnnotation(classNameRewriter, (MethodAnnotation) lhsAnnotation); MethodAnnotation rhsMethod = ClassNameRewriterUtil.convertMethodAnnotation(classNameRewriter, (MethodAnnotation) rhsAnnotation); cmp = lhsMethod.compareTo(rhsMethod); } else if (lhsClass == FieldAnnotation.class) { // Rewrite class names in FieldAnnotations FieldAnnotation lhsField = ClassNameRewriterUtil.convertFieldAnnotation(classNameRewriter, (FieldAnnotation) lhsAnnotation); FieldAnnotation rhsField = ClassNameRewriterUtil.convertFieldAnnotation(classNameRewriter, (FieldAnnotation) rhsAnnotation); cmp = lhsField.compareTo(rhsField); } else if (lhsClass == StringAnnotation.class) { String lhsString = ((StringAnnotation) lhsAnnotation).getValue(); String rhsString = ((StringAnnotation) rhsAnnotation).getValue(); cmp = lhsString.compareTo(rhsString); } else if (lhsClass == LocalVariableAnnotation.class) { String lhsName = ((LocalVariableAnnotation) lhsAnnotation).getName(); String rhsName = ((LocalVariableAnnotation) rhsAnnotation).getName(); if ("?".equals(lhsName) || "?".equals(rhsName)) { continue; } cmp = lhsName.compareTo(rhsName); } else if (lhsClass == TypeAnnotation.class) { String lhsType = ((TypeAnnotation) lhsAnnotation).getTypeDescriptor(); String rhsType = ((TypeAnnotation) rhsAnnotation).getTypeDescriptor(); lhsType = ClassNameRewriterUtil.rewriteSignature(classNameRewriter, lhsType); rhsType = ClassNameRewriterUtil.rewriteSignature(classNameRewriter, rhsType); cmp = lhsType.compareTo(rhsType); } else if (lhsClass == IntAnnotation.class) { int lhsValue = ((IntAnnotation) lhsAnnotation).getValue(); int rhsValue = ((IntAnnotation) rhsAnnotation).getValue(); cmp = lhsValue - rhsValue; } else if (isBoring(lhsAnnotation)) { throw new IllegalStateException("Impossible"); } else { throw new IllegalStateException("Unknown annotation type: " + lhsClass.getName()); } if (cmp != 0) { return cmp; } } if (interestingNext(rhsIter)) { return -1; } else if (interestingNext(lhsIter)) { return 1; } else { return 0; } } }
public class class_name { @Override public int compare(BugInstance lhs, BugInstance rhs) { // Attributes of BugInstance. // Compare abbreviation // Compare class and method annotations (ignoring line numbers). // Compare field annotations. int cmp; BugPattern lhsPattern = lhs.getBugPattern(); BugPattern rhsPattern = rhs.getBugPattern(); // Compare by abbrev instead of type. The specific bug type can // change // (e.g., "definitely null" to "null on simple path"). Also, we // often // change bug pattern types from one version of FindBugs to the // next. // // Source line and field name are still matched precisely, so this // shouldn't // cause loss of precision. if ((cmp = lhsPattern.getAbbrev().compareTo(rhsPattern.getAbbrev())) != 0) { return cmp; // depends on control dependency: [if], data = [none] } if (isExactBugPatternMatch() && (cmp = lhsPattern.getType().compareTo(rhsPattern.getType())) != 0) { return cmp; // depends on control dependency: [if], data = [none] } if (comparePriorities) { cmp = lhs.getPriority() - rhs.getPriority(); // depends on control dependency: [if], data = [none] if (cmp != 0) { return cmp; // depends on control dependency: [if], data = [none] } } Iterator<BugAnnotation> lhsIter = new FilteringAnnotationIterator(lhs.annotationIterator()); Iterator<BugAnnotation> rhsIter = new FilteringAnnotationIterator(rhs.annotationIterator()); while (lhsIter.hasNext() && rhsIter.hasNext()) { BugAnnotation lhsAnnotation = lhsIter.next(); BugAnnotation rhsAnnotation = rhsIter.next(); Class<? extends BugAnnotation> lhsClass; while (true) { // Different annotation types obviously cannot be equal, // so just compare by class name. lhsClass = lhsAnnotation.getClass(); // depends on control dependency: [while], data = [none] Class<? extends BugAnnotation> rhsClass = rhsAnnotation.getClass(); if (lhsClass == rhsClass) { break; } if (lhsClass == LocalVariableAnnotation.class && !((LocalVariableAnnotation) lhsAnnotation).isSignificant() && lhsIter.hasNext()) { lhsAnnotation = lhsIter.next(); // depends on control dependency: [if], data = [none] } else if (rhsClass == LocalVariableAnnotation.class && !((LocalVariableAnnotation) rhsAnnotation).isSignificant() && rhsIter.hasNext()) { rhsAnnotation = rhsIter.next(); // depends on control dependency: [if], data = [none] } else { return lhsClass.getName().compareTo(rhsClass.getName()); // depends on control dependency: [if], data = [(rhsClass] } } if (lhsClass == ClassAnnotation.class) { // ClassAnnotations should have their class names rewritten to // handle moved and renamed classes. String lhsClassName = classNameRewriter.rewriteClassName(((ClassAnnotation) lhsAnnotation).getClassName()); String rhsClassName = classNameRewriter.rewriteClassName(((ClassAnnotation) rhsAnnotation).getClassName()); cmp = lhsClassName.compareTo(rhsClassName); // depends on control dependency: [if], data = [none] } else if (lhsClass == MethodAnnotation.class) { // Rewrite class names in MethodAnnotations MethodAnnotation lhsMethod = ClassNameRewriterUtil.convertMethodAnnotation(classNameRewriter, (MethodAnnotation) lhsAnnotation); MethodAnnotation rhsMethod = ClassNameRewriterUtil.convertMethodAnnotation(classNameRewriter, (MethodAnnotation) rhsAnnotation); cmp = lhsMethod.compareTo(rhsMethod); // depends on control dependency: [if], data = [none] } else if (lhsClass == FieldAnnotation.class) { // Rewrite class names in FieldAnnotations FieldAnnotation lhsField = ClassNameRewriterUtil.convertFieldAnnotation(classNameRewriter, (FieldAnnotation) lhsAnnotation); FieldAnnotation rhsField = ClassNameRewriterUtil.convertFieldAnnotation(classNameRewriter, (FieldAnnotation) rhsAnnotation); cmp = lhsField.compareTo(rhsField); // depends on control dependency: [if], data = [none] } else if (lhsClass == StringAnnotation.class) { String lhsString = ((StringAnnotation) lhsAnnotation).getValue(); String rhsString = ((StringAnnotation) rhsAnnotation).getValue(); cmp = lhsString.compareTo(rhsString); // depends on control dependency: [if], data = [none] } else if (lhsClass == LocalVariableAnnotation.class) { String lhsName = ((LocalVariableAnnotation) lhsAnnotation).getName(); String rhsName = ((LocalVariableAnnotation) rhsAnnotation).getName(); if ("?".equals(lhsName) || "?".equals(rhsName)) { continue; } cmp = lhsName.compareTo(rhsName); // depends on control dependency: [if], data = [none] } else if (lhsClass == TypeAnnotation.class) { String lhsType = ((TypeAnnotation) lhsAnnotation).getTypeDescriptor(); String rhsType = ((TypeAnnotation) rhsAnnotation).getTypeDescriptor(); lhsType = ClassNameRewriterUtil.rewriteSignature(classNameRewriter, lhsType); // depends on control dependency: [if], data = [none] rhsType = ClassNameRewriterUtil.rewriteSignature(classNameRewriter, rhsType); // depends on control dependency: [if], data = [none] cmp = lhsType.compareTo(rhsType); // depends on control dependency: [if], data = [none] } else if (lhsClass == IntAnnotation.class) { int lhsValue = ((IntAnnotation) lhsAnnotation).getValue(); int rhsValue = ((IntAnnotation) rhsAnnotation).getValue(); cmp = lhsValue - rhsValue; // depends on control dependency: [if], data = [none] } else if (isBoring(lhsAnnotation)) { throw new IllegalStateException("Impossible"); } else { throw new IllegalStateException("Unknown annotation type: " + lhsClass.getName()); } if (cmp != 0) { return cmp; // depends on control dependency: [if], data = [none] } } if (interestingNext(rhsIter)) { return -1; // depends on control dependency: [if], data = [none] } else if (interestingNext(lhsIter)) { return 1; // depends on control dependency: [if], data = [none] } else { return 0; // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public StringBuilder appendToBuffer(StringBuilder buf) { String processedString = Integer.toString(getProcessed()); int percentage = (int) (getProcessed() * 100.0 / total); buf.append(getTask()); buf.append(": "); for(int i = 0; i < totalLength - processedString.length(); i++) { buf.append(' '); } buf.append(getProcessed()); buf.append(" ["); if(percentage < 100) { buf.append(' '); } if(percentage < 10) { buf.append(' '); } buf.append(percentage); buf.append("%]"); if(ratems > 0. && getProcessed() < total) { buf.append(' '); int secs = (int) Math.round((total - getProcessed()) / ratems / 1000. + .2); if(secs > 300) { buf.append(secs / 60); buf.append(" min remaining"); } else { buf.append(secs); buf.append(" sec remaining"); } } return buf; } }
public class class_name { @Override public StringBuilder appendToBuffer(StringBuilder buf) { String processedString = Integer.toString(getProcessed()); int percentage = (int) (getProcessed() * 100.0 / total); buf.append(getTask()); buf.append(": "); for(int i = 0; i < totalLength - processedString.length(); i++) { buf.append(' '); // depends on control dependency: [for], data = [none] } buf.append(getProcessed()); buf.append(" ["); if(percentage < 100) { buf.append(' '); // depends on control dependency: [if], data = [none] } if(percentage < 10) { buf.append(' '); // depends on control dependency: [if], data = [none] } buf.append(percentage); buf.append("%]"); if(ratems > 0. && getProcessed() < total) { buf.append(' '); // depends on control dependency: [if], data = [none] int secs = (int) Math.round((total - getProcessed()) / ratems / 1000. + .2); if(secs > 300) { buf.append(secs / 60); // depends on control dependency: [if], data = [(secs] buf.append(" min remaining"); // depends on control dependency: [if], data = [none] } else { buf.append(secs); // depends on control dependency: [if], data = [(secs] buf.append(" sec remaining"); // depends on control dependency: [if], data = [none] } } return buf; } }
public class class_name { private void createSingleListener(final SibRaMessagingEngineConnection connection) throws ResourceException { final String methodName = "createSingleListener"; if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.entry(this, TRACE, methodName, connection); } final SIDestinationAddress destination = _endpointConfiguration.getDestination(); if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) { SibTr.debug(TRACE, "Creating a consumer to consume from destination " + destination + " on ME " + connection.getConnection().getMeName()); } try { connection.createListener(destination, _messageEndpointFactory); SibTr.info(TRACE, "CONNECTED_CWSIV0777", new Object[] { connection.getConnection().getMeName(), _endpointConfiguration.getDestination() .getDestinationName(), _endpointConfiguration.getBusName() }); } catch (final IllegalStateException exception) { // No FFDC code needed if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) { SibTr.debug(TRACE, "Failed to create a session - blowing away the connection - rethrow the exception"); } _connections.remove(connection.getConnection().getMeUuid()); connection.close(); if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.exit(this, TRACE, methodName); } throw exception; } catch (final ResourceException exception) { // No FFDC code needed // Failed to create a consumer so blow away the connection and try // again if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) { SibTr.debug(TRACE, "Failed to create a session - blowing away the connection - a retry should occur"); SibTr.debug(TRACE, "Exception cause was " + exception.getCause()); } _connections.remove(connection.getConnection().getMeUuid()); connection.close(); throw exception; } if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.exit(this, TRACE, methodName); } } }
public class class_name { private void createSingleListener(final SibRaMessagingEngineConnection connection) throws ResourceException { final String methodName = "createSingleListener"; if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.entry(this, TRACE, methodName, connection); } final SIDestinationAddress destination = _endpointConfiguration.getDestination(); if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) { SibTr.debug(TRACE, "Creating a consumer to consume from destination " + destination + " on ME " + connection.getConnection().getMeName()); } try { connection.createListener(destination, _messageEndpointFactory); SibTr.info(TRACE, "CONNECTED_CWSIV0777", new Object[] { connection.getConnection().getMeName(), _endpointConfiguration.getDestination() .getDestinationName(), _endpointConfiguration.getBusName() }); } catch (final IllegalStateException exception) { // No FFDC code needed if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) { SibTr.debug(TRACE, "Failed to create a session - blowing away the connection - rethrow the exception"); // depends on control dependency: [if], data = [none] } _connections.remove(connection.getConnection().getMeUuid()); connection.close(); if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.exit(this, TRACE, methodName); // depends on control dependency: [if], data = [none] } throw exception; } catch (final ResourceException exception) { // No FFDC code needed // Failed to create a consumer so blow away the connection and try // again if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) { SibTr.debug(TRACE, "Failed to create a session - blowing away the connection - a retry should occur"); // depends on control dependency: [if], data = [none] SibTr.debug(TRACE, "Exception cause was " + exception.getCause()); // depends on control dependency: [if], data = [none] } _connections.remove(connection.getConnection().getMeUuid()); connection.close(); throw exception; } if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.exit(this, TRACE, methodName); } } }
public class class_name { public static SelectInput build(String name, String keys[], String values[]) { SelectInput si = SelectInput.build(name); if (keys.length != values.length) { throw new IllegalArgumentException("Key / Values with unequal length"); } List<SelectInputEntry> entries = new ArrayList<>(); for (int i = 0; i < keys.length; i++) { entries.add(si.generateEntry(keys[i], values[i])); } si.setEntries(entries); return si; } }
public class class_name { public static SelectInput build(String name, String keys[], String values[]) { SelectInput si = SelectInput.build(name); if (keys.length != values.length) { throw new IllegalArgumentException("Key / Values with unequal length"); } List<SelectInputEntry> entries = new ArrayList<>(); for (int i = 0; i < keys.length; i++) { entries.add(si.generateEntry(keys[i], values[i])); // depends on control dependency: [for], data = [i] } si.setEntries(entries); return si; } }
public class class_name { public static void putAt(List self, EmptyRange range, Object value) { RangeInfo info = subListBorders(self.size(), range); List sublist = self.subList(info.from, info.to); sublist.clear(); if (value instanceof Collection) { Collection col = (Collection) value; if (col.isEmpty()) return; sublist.addAll(col); } else { sublist.add(value); } } }
public class class_name { public static void putAt(List self, EmptyRange range, Object value) { RangeInfo info = subListBorders(self.size(), range); List sublist = self.subList(info.from, info.to); sublist.clear(); if (value instanceof Collection) { Collection col = (Collection) value; if (col.isEmpty()) return; sublist.addAll(col); // depends on control dependency: [if], data = [none] } else { sublist.add(value); // depends on control dependency: [if], data = [none] } } }
public class class_name { private List<String> getKeyListFromGroup(CmsEditableGroup group) { List<String> res = new ArrayList<String>(); for (I_CmsEditableGroupRow row : group.getRows()) { res.add(((TextField)(((HorizontalLayout)row.getComponent()).getComponent(0))).getValue()); } return res; } }
public class class_name { private List<String> getKeyListFromGroup(CmsEditableGroup group) { List<String> res = new ArrayList<String>(); for (I_CmsEditableGroupRow row : group.getRows()) { res.add(((TextField)(((HorizontalLayout)row.getComponent()).getComponent(0))).getValue()); // depends on control dependency: [for], data = [row] } return res; } }
public class class_name { public static void swapRows(Matrix matrix, long row1, long row2) { double temp = 0; long cols = matrix.getColumnCount(); for (long col = 0; col < cols; col++) { temp = matrix.getAsDouble(row1, col); matrix.setAsDouble(matrix.getAsDouble(row2, col), row1, col); matrix.setAsDouble(temp, row2, col); } } }
public class class_name { public static void swapRows(Matrix matrix, long row1, long row2) { double temp = 0; long cols = matrix.getColumnCount(); for (long col = 0; col < cols; col++) { temp = matrix.getAsDouble(row1, col); // depends on control dependency: [for], data = [col] matrix.setAsDouble(matrix.getAsDouble(row2, col), row1, col); // depends on control dependency: [for], data = [col] matrix.setAsDouble(temp, row2, col); // depends on control dependency: [for], data = [col] } } }
public class class_name { public void makeDir(String dir, String data) { try { boolean deafult_path_exist = store.exists(dir); if (!deafult_path_exist) { LOGGER.info("create: " + dir); this.writePersistentUrl(dir, data); } else { } } catch (KeeperException e) { LOGGER.error("cannot create path: " + dir, e); } catch (Exception e) { LOGGER.error("cannot create path: " + dir, e); } } }
public class class_name { public void makeDir(String dir, String data) { try { boolean deafult_path_exist = store.exists(dir); if (!deafult_path_exist) { LOGGER.info("create: " + dir); // depends on control dependency: [if], data = [none] this.writePersistentUrl(dir, data); // depends on control dependency: [if], data = [none] } else { } } catch (KeeperException e) { LOGGER.error("cannot create path: " + dir, e); } catch (Exception e) { // depends on control dependency: [catch], data = [none] LOGGER.error("cannot create path: " + dir, e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public ActivityInstance getActivityInstance(Long pActivityInstId) throws ProcessException, DataAccessException { TransactionWrapper transaction=null; try { transaction = startTransaction(); return engineImpl.getDataAccess().getActivityInstance(pActivityInstId); } catch (DataAccessException e) { if (canRetryTransaction(e)) { transaction = (TransactionWrapper)initTransactionRetry(transaction); return ((ProcessExecutor)getTransactionRetrier()).getActivityInstance(pActivityInstId); } else throw e; } catch (SQLException e) { if (canRetryTransaction(e)) { transaction = (TransactionWrapper)initTransactionRetry(transaction); return ((ProcessExecutor)getTransactionRetrier()).getActivityInstance(pActivityInstId); } else throw new ProcessException(0, "Failed to get activity instance", e); } finally { stopTransaction(transaction); } } }
public class class_name { public ActivityInstance getActivityInstance(Long pActivityInstId) throws ProcessException, DataAccessException { TransactionWrapper transaction=null; try { transaction = startTransaction(); return engineImpl.getDataAccess().getActivityInstance(pActivityInstId); } catch (DataAccessException e) { if (canRetryTransaction(e)) { transaction = (TransactionWrapper)initTransactionRetry(transaction); // depends on control dependency: [if], data = [none] return ((ProcessExecutor)getTransactionRetrier()).getActivityInstance(pActivityInstId); // depends on control dependency: [if], data = [none] } else throw e; } catch (SQLException e) { if (canRetryTransaction(e)) { transaction = (TransactionWrapper)initTransactionRetry(transaction); // depends on control dependency: [if], data = [none] return ((ProcessExecutor)getTransactionRetrier()).getActivityInstance(pActivityInstId); // depends on control dependency: [if], data = [none] } else throw new ProcessException(0, "Failed to get activity instance", e); } finally { stopTransaction(transaction); } } }
public class class_name { private void startTask(ApplicationDefinition appDef, Task task, TaskRecord taskRecord) { try { task.setParams(m_localHost, taskRecord); m_executor.execute(task); } catch (Exception e) { m_logger.error("Failed to start task '" + task.getTaskID() + "'", e); } } }
public class class_name { private void startTask(ApplicationDefinition appDef, Task task, TaskRecord taskRecord) { try { task.setParams(m_localHost, taskRecord); // depends on control dependency: [try], data = [none] m_executor.execute(task); // depends on control dependency: [try], data = [none] } catch (Exception e) { m_logger.error("Failed to start task '" + task.getTaskID() + "'", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public IdentityDescription withLogins(String... logins) { if (this.logins == null) { setLogins(new java.util.ArrayList<String>(logins.length)); } for (String ele : logins) { this.logins.add(ele); } return this; } }
public class class_name { public IdentityDescription withLogins(String... logins) { if (this.logins == null) { setLogins(new java.util.ArrayList<String>(logins.length)); // depends on control dependency: [if], data = [none] } for (String ele : logins) { this.logins.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public final int setPartitionColumnName(String partitionColumnName) { if (partitionColumnName == null || partitionColumnName.trim().isEmpty()) { return PARTITION_ID_INDEX; } int idx = -1; for (String name : m_source.columnNames) { if (name.equalsIgnoreCase(partitionColumnName)) { idx = m_source.columnNames.indexOf(name); break; } } if (idx == -1) { m_partitionColumnIndex = PARTITION_ID_INDEX; m_logger.error("Export configuration error: specified " + m_source.tableName + "." + partitionColumnName + " does not exist. A default partition or routing key will be used."); } else { m_partitionColumnIndex = idx; } return m_partitionColumnIndex; } }
public class class_name { public final int setPartitionColumnName(String partitionColumnName) { if (partitionColumnName == null || partitionColumnName.trim().isEmpty()) { return PARTITION_ID_INDEX; // depends on control dependency: [if], data = [none] } int idx = -1; for (String name : m_source.columnNames) { if (name.equalsIgnoreCase(partitionColumnName)) { idx = m_source.columnNames.indexOf(name); // depends on control dependency: [if], data = [none] break; } } if (idx == -1) { m_partitionColumnIndex = PARTITION_ID_INDEX; // depends on control dependency: [if], data = [none] m_logger.error("Export configuration error: specified " + m_source.tableName + "." + partitionColumnName + " does not exist. A default partition or routing key will be used."); // depends on control dependency: [if], data = [none] } else { m_partitionColumnIndex = idx; // depends on control dependency: [if], data = [none] } return m_partitionColumnIndex; } }
public class class_name { synchronized void putValueGuts(String pName, Object pValue) { if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_WAS.entering(methodClassName, methodNames[PUT_VALUE_GUTS], "pName = " + pName); } if (pName == null || pValue == null) { return; } // If in Servlet 2.2 mode and Distributable Web App and data in not serializable // then throw an exception boolean distributableWebApp = getIStore().isDistributable(); boolean swappable = true; Object convObj = replaceObjectForSerialization(pValue); if (convObj == null) { swappable = false; convObj = pValue; } if (!swappable) { //105962 (tWAS 745384) update the trace message logic to be more specific if (distributableWebApp) { if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[PUT_VALUE_GUTS], "IllegalArgumentException"); } throw new IllegalArgumentException("Attribute with name " + pName + " is not java.io.Serializable. All attributes stored in session must be Serializable when web module is marked as distributable"); } else if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[PUT_VALUE_GUTS], "Attribute with name " + pName + " is not Serializable. This may cause a problem on a failover."); } } if (appDataChanges == null) { if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[PUT_VALUE_GUTS], "init appDataChanges"); } appDataChanges = new Hashtable(); } if (swappable) { // Still want to update lists since whole session may not get written at first EOS includeInAppDataChanges(pName, _smc.writeGetAndSetAttributes() ? pValue : convObj, PUT_VALUE_GUTS); boolean listenerFlagSetInMethod = false; //a check for instanceof was moved into the individual instancof blocks ... still only want to get getListenerFlag() once. if (pValue instanceof HttpSessionBindingListener) { if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[PUT_VALUE_GUTS], "Property is a binding listener: " + pName); } if (!isNew()) { // listenerFlag should be up-to-date for new session //Read from the database only once listenerFlag = getListenerFlag(); listenerFlagSetInMethod = true; } switch (listenerFlag) { case HTTP_SESSION_NO_LISTENER: listenerFlag = HTTP_SESSION_BINDING_LISTENER; listenCntHit = true; break; case HTTP_SESSION_ACTIVATION_LISTENER: listenerFlag = HTTP_SESSION_BINDING_AND_ACTIVATION_LISTENER; listenCntHit = true; break; default: break; } } if (pValue instanceof HttpSessionActivationListener) { if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[PUT_VALUE_GUTS], "Property is an Activation listener: " + pName); } if (!isNew() && !listenerFlagSetInMethod) { // listenerFlag should be up-to-date for new session //Read from the database only once listenerFlag = getListenerFlag(); } switch (listenerFlag) { case HTTP_SESSION_NO_LISTENER: listenerFlag = HTTP_SESSION_ACTIVATION_LISTENER; listenCntHit = true; break; case HTTP_SESSION_BINDING_LISTENER: listenerFlag = HTTP_SESSION_BINDING_AND_ACTIVATION_LISTENER; listenCntHit = true; break; default: break; } } //if value is removed and then put back, remove it from removalList // long term, we may want to check all the threads // We need to remove it from the removals even if new since removals are updated when new if (appDataRemovals != null) { if (appDataTablesPerThread) { Thread t = Thread.currentThread(); Hashtable sht2 = (Hashtable) appDataRemovals.get(t); if (sht2 != null) { sht2.remove(pName); if (sht2.isEmpty()) { appDataRemovals.remove(t); } } } else { // appDataTablesPerSession appDataRemovals.remove(pName); } } } //end if (swappable) block if (swappable) { if (mNonswappableData != null) { // don't call getNonswappable if null // don't want to allocate unless needed getNonswappableData().remove(pName); // make sure it doesn't exist in nonswappable } getSwappableData().put(pName, convObj); } else { getSwappableData().remove(pName);// ensure it doesn't exist in swappable // this probably won't work for multi-row getNonswappableData().put(pName, convObj); } } }
public class class_name { synchronized void putValueGuts(String pName, Object pValue) { if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_WAS.entering(methodClassName, methodNames[PUT_VALUE_GUTS], "pName = " + pName); // depends on control dependency: [if], data = [none] } if (pName == null || pValue == null) { return; // depends on control dependency: [if], data = [none] } // If in Servlet 2.2 mode and Distributable Web App and data in not serializable // then throw an exception boolean distributableWebApp = getIStore().isDistributable(); boolean swappable = true; Object convObj = replaceObjectForSerialization(pValue); if (convObj == null) { swappable = false; // depends on control dependency: [if], data = [none] convObj = pValue; // depends on control dependency: [if], data = [none] } if (!swappable) { //105962 (tWAS 745384) update the trace message logic to be more specific if (distributableWebApp) { if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[PUT_VALUE_GUTS], "IllegalArgumentException"); // depends on control dependency: [if], data = [none] } throw new IllegalArgumentException("Attribute with name " + pName + " is not java.io.Serializable. All attributes stored in session must be Serializable when web module is marked as distributable"); } else if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[PUT_VALUE_GUTS], "Attribute with name " + pName + " is not Serializable. This may cause a problem on a failover."); // depends on control dependency: [if], data = [none] } } if (appDataChanges == null) { if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[PUT_VALUE_GUTS], "init appDataChanges"); // depends on control dependency: [if], data = [none] } appDataChanges = new Hashtable(); // depends on control dependency: [if], data = [none] } if (swappable) { // Still want to update lists since whole session may not get written at first EOS includeInAppDataChanges(pName, _smc.writeGetAndSetAttributes() ? pValue : convObj, PUT_VALUE_GUTS); // depends on control dependency: [if], data = [none] boolean listenerFlagSetInMethod = false; //a check for instanceof was moved into the individual instancof blocks ... still only want to get getListenerFlag() once. if (pValue instanceof HttpSessionBindingListener) { if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[PUT_VALUE_GUTS], "Property is a binding listener: " + pName); // depends on control dependency: [if], data = [none] } if (!isNew()) { // listenerFlag should be up-to-date for new session //Read from the database only once listenerFlag = getListenerFlag(); // depends on control dependency: [if], data = [none] listenerFlagSetInMethod = true; // depends on control dependency: [if], data = [none] } switch (listenerFlag) { case HTTP_SESSION_NO_LISTENER: listenerFlag = HTTP_SESSION_BINDING_LISTENER; listenCntHit = true; break; case HTTP_SESSION_ACTIVATION_LISTENER: listenerFlag = HTTP_SESSION_BINDING_AND_ACTIVATION_LISTENER; listenCntHit = true; break; default: break; } } if (pValue instanceof HttpSessionActivationListener) { if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[PUT_VALUE_GUTS], "Property is an Activation listener: " + pName); // depends on control dependency: [if], data = [none] } if (!isNew() && !listenerFlagSetInMethod) { // listenerFlag should be up-to-date for new session //Read from the database only once listenerFlag = getListenerFlag(); // depends on control dependency: [if], data = [none] } switch (listenerFlag) { case HTTP_SESSION_NO_LISTENER: listenerFlag = HTTP_SESSION_ACTIVATION_LISTENER; listenCntHit = true; break; case HTTP_SESSION_BINDING_LISTENER: listenerFlag = HTTP_SESSION_BINDING_AND_ACTIVATION_LISTENER; listenCntHit = true; break; default: break; } } //if value is removed and then put back, remove it from removalList // long term, we may want to check all the threads // We need to remove it from the removals even if new since removals are updated when new if (appDataRemovals != null) { if (appDataTablesPerThread) { Thread t = Thread.currentThread(); Hashtable sht2 = (Hashtable) appDataRemovals.get(t); if (sht2 != null) { sht2.remove(pName); // depends on control dependency: [if], data = [none] if (sht2.isEmpty()) { appDataRemovals.remove(t); // depends on control dependency: [if], data = [none] } } } else { // appDataTablesPerSession appDataRemovals.remove(pName); // depends on control dependency: [if], data = [none] } } } //end if (swappable) block if (swappable) { if (mNonswappableData != null) { // don't call getNonswappable if null // don't want to allocate unless needed getNonswappableData().remove(pName); // make sure it doesn't exist in nonswappable // depends on control dependency: [if], data = [none] } getSwappableData().put(pName, convObj); // depends on control dependency: [if], data = [none] } else { getSwappableData().remove(pName);// ensure it doesn't exist in swappable // depends on control dependency: [if], data = [none] // this probably won't work for multi-row getNonswappableData().put(pName, convObj); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void unhide(Object group) { if (isAttached()) { Element element = helper.getGroup(group); if (element != null) { Dom.setElementAttribute(element, "display", "inline"); } } } }
public class class_name { public void unhide(Object group) { if (isAttached()) { Element element = helper.getGroup(group); if (element != null) { Dom.setElementAttribute(element, "display", "inline"); // depends on control dependency: [if], data = [(element] } } } }
public class class_name { public TypeDescription getType() { if (mType == null) { mType = getTeaToolsUtils().createTypeDescription( getPropertyDescriptor().getPropertyType()); } return mType; } }
public class class_name { public TypeDescription getType() { if (mType == null) { mType = getTeaToolsUtils().createTypeDescription( getPropertyDescriptor().getPropertyType()); // depends on control dependency: [if], data = [none] } return mType; } }
public class class_name { public static boolean isAllEmpty(final CharSequence... css) { if (ArrayUtils.isEmpty(css)) { return true; } for (final CharSequence cs : css) { if (isNotEmpty(cs)) { return false; } } return true; } }
public class class_name { public static boolean isAllEmpty(final CharSequence... css) { if (ArrayUtils.isEmpty(css)) { return true; // depends on control dependency: [if], data = [none] } for (final CharSequence cs : css) { if (isNotEmpty(cs)) { return false; // depends on control dependency: [if], data = [none] } } return true; } }
public class class_name { public GetCheckerIpRangesResult withCheckerIpRanges(String... checkerIpRanges) { if (this.checkerIpRanges == null) { setCheckerIpRanges(new com.amazonaws.internal.SdkInternalList<String>(checkerIpRanges.length)); } for (String ele : checkerIpRanges) { this.checkerIpRanges.add(ele); } return this; } }
public class class_name { public GetCheckerIpRangesResult withCheckerIpRanges(String... checkerIpRanges) { if (this.checkerIpRanges == null) { setCheckerIpRanges(new com.amazonaws.internal.SdkInternalList<String>(checkerIpRanges.length)); // depends on control dependency: [if], data = [none] } for (String ele : checkerIpRanges) { this.checkerIpRanges.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public TransportApiResult<List<Agency>> getAgencies(AgencyQueryOptions options) { if (options == null) { options = AgencyQueryOptions.defaultQueryOptions(); } return TransportApiClientCalls.getAgencies(tokenComponent, settings, options, null, null, null); } }
public class class_name { public TransportApiResult<List<Agency>> getAgencies(AgencyQueryOptions options) { if (options == null) { options = AgencyQueryOptions.defaultQueryOptions(); // depends on control dependency: [if], data = [none] } return TransportApiClientCalls.getAgencies(tokenComponent, settings, options, null, null, null); } }
public class class_name { public PhaseIdType[] getRestrictedPhaseIds(Method restrictAtViewMethod, Annotation annotation) { PhaseIdType[] phaseIds; try { phaseIds = (PhaseIdType[]) restrictAtViewMethod.invoke(annotation); } catch (IllegalAccessException ex) { throw new IllegalArgumentException("restrictAtView method must be accessible", ex); } catch (InvocationTargetException ex) { throw new RuntimeException(ex); } return phaseIds; } }
public class class_name { public PhaseIdType[] getRestrictedPhaseIds(Method restrictAtViewMethod, Annotation annotation) { PhaseIdType[] phaseIds; try { phaseIds = (PhaseIdType[]) restrictAtViewMethod.invoke(annotation); // depends on control dependency: [try], data = [none] } catch (IllegalAccessException ex) { throw new IllegalArgumentException("restrictAtView method must be accessible", ex); } catch (InvocationTargetException ex) { // depends on control dependency: [catch], data = [none] throw new RuntimeException(ex); } // depends on control dependency: [catch], data = [none] return phaseIds; } }
public class class_name { public void checkRequest(BasicCheckInfo basicCheckInfo, Object bodyObj) { String key = basicCheckInfo.getUniqueKey(); List<ValidationData> checkData = this.validationStore.getValidationDatas(basicCheckInfo.getParamType(), key); if (checkData == null || checkData.isEmpty()) { return; } checkData.stream().forEach(data -> { this.checkDataInnerRules(data, bodyObj); }); } }
public class class_name { public void checkRequest(BasicCheckInfo basicCheckInfo, Object bodyObj) { String key = basicCheckInfo.getUniqueKey(); List<ValidationData> checkData = this.validationStore.getValidationDatas(basicCheckInfo.getParamType(), key); if (checkData == null || checkData.isEmpty()) { return; // depends on control dependency: [if], data = [none] } checkData.stream().forEach(data -> { this.checkDataInnerRules(data, bodyObj); }); } }
public class class_name { public void updateCapacityBytes(Map<String, Long> capacityBytesOnTiers) { mCapacityBytes = 0; mTotalBytesOnTiers = capacityBytesOnTiers; for (long t : mTotalBytesOnTiers.values()) { mCapacityBytes += t; } } }
public class class_name { public void updateCapacityBytes(Map<String, Long> capacityBytesOnTiers) { mCapacityBytes = 0; mTotalBytesOnTiers = capacityBytesOnTiers; for (long t : mTotalBytesOnTiers.values()) { mCapacityBytes += t; // depends on control dependency: [for], data = [t] } } }
public class class_name { private <T> T populateBean(final T resultBean, final String[] nameMapping) { // map each column to its associated field on the bean for( int i = 0; i < nameMapping.length; i++ ) { final Object fieldValue = processedColumns.get(i); // don't call a set-method in the bean if there is no name mapping for the column or no result to store if( nameMapping[i] == null || fieldValue == null ) { continue; } // invoke the setter on the bean Method setMethod = cache.getSetMethod(resultBean, nameMapping[i], fieldValue.getClass()); invokeSetter(resultBean, setMethod, fieldValue); } return resultBean; } }
public class class_name { private <T> T populateBean(final T resultBean, final String[] nameMapping) { // map each column to its associated field on the bean for( int i = 0; i < nameMapping.length; i++ ) { final Object fieldValue = processedColumns.get(i); // don't call a set-method in the bean if there is no name mapping for the column or no result to store if( nameMapping[i] == null || fieldValue == null ) { continue; } // invoke the setter on the bean Method setMethod = cache.getSetMethod(resultBean, nameMapping[i], fieldValue.getClass()); invokeSetter(resultBean, setMethod, fieldValue); // depends on control dependency: [for], data = [none] } return resultBean; } }
public class class_name { public static void setInitFilePath(String filePath) { filePath=getPropertiesFilePath(filePath); if (staticFileProperties == null) { staticFileProperties=new FileProperties(filePath); } else { staticFileProperties.setInitFilePath(filePath); } } }
public class class_name { public static void setInitFilePath(String filePath) { filePath=getPropertiesFilePath(filePath); if (staticFileProperties == null) { staticFileProperties=new FileProperties(filePath); // depends on control dependency: [if], data = [none] } else { staticFileProperties.setInitFilePath(filePath); // depends on control dependency: [if], data = [none] } } }
public class class_name { private static int[] getMode2PrimaryCodewords(String postcode, int country, int service) { for (int i = 0; i < postcode.length(); i++) { if (postcode.charAt(i) < '0' || postcode.charAt(i) > '9') { postcode = postcode.substring(0, i); break; } } int postcodeNum = Integer.parseInt(postcode); int[] primary = new int[10]; primary[0] = ((postcodeNum & 0x03) << 4) | 2; primary[1] = ((postcodeNum & 0xfc) >> 2); primary[2] = ((postcodeNum & 0x3f00) >> 8); primary[3] = ((postcodeNum & 0xfc000) >> 14); primary[4] = ((postcodeNum & 0x3f00000) >> 20); primary[5] = ((postcodeNum & 0x3c000000) >> 26) | ((postcode.length() & 0x3) << 4); primary[6] = ((postcode.length() & 0x3c) >> 2) | ((country & 0x3) << 4); primary[7] = (country & 0xfc) >> 2; primary[8] = ((country & 0x300) >> 8) | ((service & 0xf) << 2); primary[9] = ((service & 0x3f0) >> 4); return primary; } }
public class class_name { private static int[] getMode2PrimaryCodewords(String postcode, int country, int service) { for (int i = 0; i < postcode.length(); i++) { if (postcode.charAt(i) < '0' || postcode.charAt(i) > '9') { postcode = postcode.substring(0, i); // depends on control dependency: [if], data = [none] break; } } int postcodeNum = Integer.parseInt(postcode); int[] primary = new int[10]; primary[0] = ((postcodeNum & 0x03) << 4) | 2; primary[1] = ((postcodeNum & 0xfc) >> 2); primary[2] = ((postcodeNum & 0x3f00) >> 8); primary[3] = ((postcodeNum & 0xfc000) >> 14); primary[4] = ((postcodeNum & 0x3f00000) >> 20); primary[5] = ((postcodeNum & 0x3c000000) >> 26) | ((postcode.length() & 0x3) << 4); primary[6] = ((postcode.length() & 0x3c) >> 2) | ((country & 0x3) << 4); primary[7] = (country & 0xfc) >> 2; primary[8] = ((country & 0x300) >> 8) | ((service & 0xf) << 2); primary[9] = ((service & 0x3f0) >> 4); return primary; } }
public class class_name { private void doUninstall(final Message<JsonObject> message) { String moduleName = message.body().getString("module"); if (moduleName == null) { message.reply(new JsonObject().putString("status", "error").putString("message", "No module specified.")); return; } platform.uninstallModule(moduleName, new Handler<AsyncResult<Void>>() { @Override public void handle(AsyncResult<Void> result) { if (result.failed()) { message.reply(new JsonObject().putString("status", "error").putString("message", result.cause().getMessage())); } else { message.reply(new JsonObject().putString("status", "ok")); } } }); } }
public class class_name { private void doUninstall(final Message<JsonObject> message) { String moduleName = message.body().getString("module"); if (moduleName == null) { message.reply(new JsonObject().putString("status", "error").putString("message", "No module specified.")); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } platform.uninstallModule(moduleName, new Handler<AsyncResult<Void>>() { @Override public void handle(AsyncResult<Void> result) { if (result.failed()) { message.reply(new JsonObject().putString("status", "error").putString("message", result.cause().getMessage())); // depends on control dependency: [if], data = [none] } else { message.reply(new JsonObject().putString("status", "ok")); // depends on control dependency: [if], data = [none] } } }); } }
public class class_name { private I_CmsSearchIndex getIndex() { I_CmsSearchIndex index = null; // get the configured index or the selected index if (isInitialCall()) { // the search form is in the initial state // get the configured index index = OpenCms.getSearchManager().getIndex(getSettings().getUserSettings().getWorkplaceSearchIndexName()); } else { // the search form is not in the inital state, the submit button was used already or the // search index was changed already // get the selected index in the search dialog index = OpenCms.getSearchManager().getIndex(getJsp().getRequest().getParameter("indexName.0")); } return index; } }
public class class_name { private I_CmsSearchIndex getIndex() { I_CmsSearchIndex index = null; // get the configured index or the selected index if (isInitialCall()) { // the search form is in the initial state // get the configured index index = OpenCms.getSearchManager().getIndex(getSettings().getUserSettings().getWorkplaceSearchIndexName()); // depends on control dependency: [if], data = [none] } else { // the search form is not in the inital state, the submit button was used already or the // search index was changed already // get the selected index in the search dialog index = OpenCms.getSearchManager().getIndex(getJsp().getRequest().getParameter("indexName.0")); // depends on control dependency: [if], data = [none] } return index; } }
public class class_name { public Object getAttributeValue(String attributeName) { Attribute attribute = getAllAttributes().get(attributeName); if (attribute != null) { return attribute.getValue(); } return null; } }
public class class_name { public Object getAttributeValue(String attributeName) { Attribute attribute = getAllAttributes().get(attributeName); if (attribute != null) { return attribute.getValue(); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public static SimpleDateFormat getDisplayDateFormat() { if (displayDateFormat == null) { // NOPMD String pattern = getDateFormat().toPattern(); // si le pattern contient seulement 2 chiffres pour l'année on en met 4 // parce que c'est plus clair à l'affichage // mais en saisie on peut toujours n'en mettre que deux qui seront alors interprétés (avec le siècle) if (pattern.indexOf("yy") != -1 && pattern.indexOf("yyyy") == -1) { pattern = new StringBuilder(pattern).insert(pattern.indexOf("yy"), "yy").toString(); } displayDateFormat = new SimpleDateFormat(pattern, Locale.getDefault()); // NOPMD } return displayDateFormat; // NOPMD } }
public class class_name { public static SimpleDateFormat getDisplayDateFormat() { if (displayDateFormat == null) { // NOPMD String pattern = getDateFormat().toPattern(); // si le pattern contient seulement 2 chiffres pour l'année on en met 4 // parce que c'est plus clair à l'affichage // mais en saisie on peut toujours n'en mettre que deux qui seront alors interprétés (avec le siècle) if (pattern.indexOf("yy") != -1 && pattern.indexOf("yyyy") == -1) { pattern = new StringBuilder(pattern).insert(pattern.indexOf("yy"), "yy").toString(); // depends on control dependency: [if], data = [none] } displayDateFormat = new SimpleDateFormat(pattern, Locale.getDefault()); // NOPMD // depends on control dependency: [if], data = [none] } return displayDateFormat; // NOPMD } }
public class class_name { @Override public void handle(final ZoomEvent zoomEvent) { final EventType<?> type = zoomEvent.getEventType(); if (ZoomEvent.ZOOM_STARTED == type) { adapter().zoomStarted(zoomEvent); } else if (ZoomEvent.ZOOM == type) { adapter().zoom(zoomEvent); } else if (ZoomEvent.ZOOM_FINISHED == type) { adapter().zoomFinished(zoomEvent); } else { adapter().anyZoom(zoomEvent); } } }
public class class_name { @Override public void handle(final ZoomEvent zoomEvent) { final EventType<?> type = zoomEvent.getEventType(); if (ZoomEvent.ZOOM_STARTED == type) { adapter().zoomStarted(zoomEvent); // depends on control dependency: [if], data = [none] } else if (ZoomEvent.ZOOM == type) { adapter().zoom(zoomEvent); // depends on control dependency: [if], data = [none] } else if (ZoomEvent.ZOOM_FINISHED == type) { adapter().zoomFinished(zoomEvent); // depends on control dependency: [if], data = [none] } else { adapter().anyZoom(zoomEvent); // depends on control dependency: [if], data = [none] } } }
public class class_name { public Biomorph generateRandomCandidate(Random rng) { int[] genes = new int[Biomorph.GENE_COUNT]; for (int i = 0; i < Biomorph.GENE_COUNT - 1; i++) { // First 8 genes have values between -5 and 5. genes[i] = rng.nextInt(11) - 5; } // Last genes ha a value between 1 and 7. genes[Biomorph.LENGTH_GENE_INDEX] = rng.nextInt(Biomorph.LENGTH_GENE_MAX) + 1; return new Biomorph(genes); } }
public class class_name { public Biomorph generateRandomCandidate(Random rng) { int[] genes = new int[Biomorph.GENE_COUNT]; for (int i = 0; i < Biomorph.GENE_COUNT - 1; i++) { // First 8 genes have values between -5 and 5. genes[i] = rng.nextInt(11) - 5; // depends on control dependency: [for], data = [i] } // Last genes ha a value between 1 and 7. genes[Biomorph.LENGTH_GENE_INDEX] = rng.nextInt(Biomorph.LENGTH_GENE_MAX) + 1; return new Biomorph(genes); } }
public class class_name { public void marshall(DeleteClusterRequest deleteClusterRequest, ProtocolMarshaller protocolMarshaller) { if (deleteClusterRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteClusterRequest.getCluster(), CLUSTER_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DeleteClusterRequest deleteClusterRequest, ProtocolMarshaller protocolMarshaller) { if (deleteClusterRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteClusterRequest.getCluster(), CLUSTER_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 String format(GeometryIndex index) { if (index.hasChild()) { return "geometry" + index.getValue() + "." + format(index.getChild()); } switch (index.getType()) { case TYPE_VERTEX: return "vertex" + index.getValue(); case TYPE_EDGE: return "edge" + index.getValue(); default: return "geometry" + index.getValue(); } } }
public class class_name { public String format(GeometryIndex index) { if (index.hasChild()) { return "geometry" + index.getValue() + "." + format(index.getChild()); // depends on control dependency: [if], data = [none] } switch (index.getType()) { case TYPE_VERTEX: return "vertex" + index.getValue(); case TYPE_EDGE: return "edge" + index.getValue(); default: return "geometry" + index.getValue(); } } }
public class class_name { public java.util.List<String> getCacheSecurityGroupNames() { if (cacheSecurityGroupNames == null) { cacheSecurityGroupNames = new com.amazonaws.internal.SdkInternalList<String>(); } return cacheSecurityGroupNames; } }
public class class_name { public java.util.List<String> getCacheSecurityGroupNames() { if (cacheSecurityGroupNames == null) { cacheSecurityGroupNames = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none] } return cacheSecurityGroupNames; } }
public class class_name { @SuppressWarnings("unchecked") @Override protected InvocationCallback<Object> checkAsyncCallback(OperationResourceInfo ori, Map<String, Object> reqContext, Message outMessage) { InvocationCallback<Object> callback = outMessage.getContent(InvocationCallback.class); if (callback == null && CompletionStage.class.equals(ori.getMethodToInvoke().getReturnType())) { callback = NO_OP_CALLBACK; outMessage.setContent(InvocationCallback.class, callback); } return callback; } }
public class class_name { @SuppressWarnings("unchecked") @Override protected InvocationCallback<Object> checkAsyncCallback(OperationResourceInfo ori, Map<String, Object> reqContext, Message outMessage) { InvocationCallback<Object> callback = outMessage.getContent(InvocationCallback.class); if (callback == null && CompletionStage.class.equals(ori.getMethodToInvoke().getReturnType())) { callback = NO_OP_CALLBACK; // depends on control dependency: [if], data = [none] outMessage.setContent(InvocationCallback.class, callback); // depends on control dependency: [if], data = [none] } return callback; } }
public class class_name { private T getCurrent(T item) { for( String key: order ) { ConcurrentCache<Object,T> cache = caches.get(key); Object val = getValue(key, item); T tmp; if( val instanceof BigDecimal ) { val = ((BigDecimal)val).longValue(); } tmp = cache.get(val); if( tmp != null ) { if( tmp instanceof CachedItem ) { if( ((CachedItem)tmp).isValidForCache() ) { return tmp; } } else { return tmp; } } } return item; } }
public class class_name { private T getCurrent(T item) { for( String key: order ) { ConcurrentCache<Object,T> cache = caches.get(key); Object val = getValue(key, item); T tmp; if( val instanceof BigDecimal ) { val = ((BigDecimal)val).longValue(); // depends on control dependency: [if], data = [none] } tmp = cache.get(val); // depends on control dependency: [for], data = [none] if( tmp != null ) { if( tmp instanceof CachedItem ) { if( ((CachedItem)tmp).isValidForCache() ) { return tmp; // depends on control dependency: [if], data = [none] } } else { return tmp; // depends on control dependency: [if], data = [none] } } } return item; } }
public class class_name { public static String byteArrayToSQLBitString(byte[] bytes, int bitCount) { char[] s = new char[bitCount + 3]; s[0] = 'B'; s[1] = '\''; int pos = 2; for (int j = 0; j < bitCount; j++) { byte b = bytes[j / 8]; s[pos++] = BitMap.isSet(b, j % 8) ? '1' : '0'; } s[pos] = '\''; return new String(s); } }
public class class_name { public static String byteArrayToSQLBitString(byte[] bytes, int bitCount) { char[] s = new char[bitCount + 3]; s[0] = 'B'; s[1] = '\''; int pos = 2; for (int j = 0; j < bitCount; j++) { byte b = bytes[j / 8]; s[pos++] = BitMap.isSet(b, j % 8) ? '1' : '0'; // depends on control dependency: [for], data = [j] } s[pos] = '\''; return new String(s); } }
public class class_name { public int findColumn(final String columnLabel) throws SQLException { if (this.queryResult.getResultSetType() == ResultSetType.SELECT) { try { return ((SelectQueryResult) queryResult).getColumnId(columnLabel) + 1; } catch (NoSuchColumnException e) { throw SQLExceptionMapper.getSQLException("No such column: " + columnLabel, e); } } throw SQLExceptionMapper.getSQLException("Cannot get column id of update result sets"); } }
public class class_name { public int findColumn(final String columnLabel) throws SQLException { if (this.queryResult.getResultSetType() == ResultSetType.SELECT) { try { return ((SelectQueryResult) queryResult).getColumnId(columnLabel) + 1; // depends on control dependency: [try], data = [none] } catch (NoSuchColumnException e) { throw SQLExceptionMapper.getSQLException("No such column: " + columnLabel, e); } // depends on control dependency: [catch], data = [none] } throw SQLExceptionMapper.getSQLException("Cannot get column id of update result sets"); } }
public class class_name { public void marshall(PutMailboxPermissionsRequest putMailboxPermissionsRequest, ProtocolMarshaller protocolMarshaller) { if (putMailboxPermissionsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(putMailboxPermissionsRequest.getOrganizationId(), ORGANIZATIONID_BINDING); protocolMarshaller.marshall(putMailboxPermissionsRequest.getEntityId(), ENTITYID_BINDING); protocolMarshaller.marshall(putMailboxPermissionsRequest.getGranteeId(), GRANTEEID_BINDING); protocolMarshaller.marshall(putMailboxPermissionsRequest.getPermissionValues(), PERMISSIONVALUES_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(PutMailboxPermissionsRequest putMailboxPermissionsRequest, ProtocolMarshaller protocolMarshaller) { if (putMailboxPermissionsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(putMailboxPermissionsRequest.getOrganizationId(), ORGANIZATIONID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(putMailboxPermissionsRequest.getEntityId(), ENTITYID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(putMailboxPermissionsRequest.getGranteeId(), GRANTEEID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(putMailboxPermissionsRequest.getPermissionValues(), PERMISSIONVALUES_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 TldExtensionType<FunctionType<T>> getOrCreateFunctionExtension() { List<Node> nodeList = childNode.get("function-extension"); if (nodeList != null && nodeList.size() > 0) { return new TldExtensionTypeImpl<FunctionType<T>>(this, "function-extension", childNode, nodeList.get(0)); } return createFunctionExtension(); } }
public class class_name { public TldExtensionType<FunctionType<T>> getOrCreateFunctionExtension() { List<Node> nodeList = childNode.get("function-extension"); if (nodeList != null && nodeList.size() > 0) { return new TldExtensionTypeImpl<FunctionType<T>>(this, "function-extension", childNode, nodeList.get(0)); // depends on control dependency: [if], data = [none] } return createFunctionExtension(); } }
public class class_name { public CreateFleetResult withErrors(CreateFleetError... errors) { if (this.errors == null) { setErrors(new com.amazonaws.internal.SdkInternalList<CreateFleetError>(errors.length)); } for (CreateFleetError ele : errors) { this.errors.add(ele); } return this; } }
public class class_name { public CreateFleetResult withErrors(CreateFleetError... errors) { if (this.errors == null) { setErrors(new com.amazonaws.internal.SdkInternalList<CreateFleetError>(errors.length)); // depends on control dependency: [if], data = [none] } for (CreateFleetError ele : errors) { this.errors.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { @Override public <T> T executeSelectOne(IRowMapper<T> rowMapper, String sql, Object... bindValues) { Connection conn = getConnection(); try { return executeSelectOne(rowMapper, conn, sql, bindValues); } finally { try { conn.close(); } catch (SQLException e) { throw translateSQLException(conn, e); } } } }
public class class_name { @Override public <T> T executeSelectOne(IRowMapper<T> rowMapper, String sql, Object... bindValues) { Connection conn = getConnection(); try { return executeSelectOne(rowMapper, conn, sql, bindValues); // depends on control dependency: [try], data = [none] } finally { try { conn.close(); // depends on control dependency: [try], data = [none] } catch (SQLException e) { throw translateSQLException(conn, e); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public void marshall(MonitoringConfigurationUpdate monitoringConfigurationUpdate, ProtocolMarshaller protocolMarshaller) { if (monitoringConfigurationUpdate == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(monitoringConfigurationUpdate.getConfigurationTypeUpdate(), CONFIGURATIONTYPEUPDATE_BINDING); protocolMarshaller.marshall(monitoringConfigurationUpdate.getMetricsLevelUpdate(), METRICSLEVELUPDATE_BINDING); protocolMarshaller.marshall(monitoringConfigurationUpdate.getLogLevelUpdate(), LOGLEVELUPDATE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(MonitoringConfigurationUpdate monitoringConfigurationUpdate, ProtocolMarshaller protocolMarshaller) { if (monitoringConfigurationUpdate == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(monitoringConfigurationUpdate.getConfigurationTypeUpdate(), CONFIGURATIONTYPEUPDATE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(monitoringConfigurationUpdate.getMetricsLevelUpdate(), METRICSLEVELUPDATE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(monitoringConfigurationUpdate.getLogLevelUpdate(), LOGLEVELUPDATE_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 { protected Supplier<Stream<Original>> supplierForSegments(ConsistentHash ch, IntSet targetSegments, Set<Object> excludedKeys, boolean usePrimary) { if (!ch.getMembers().contains(localAddress)) { return Stream::empty; } IntSet segments; if (usePrimary) { if (targetSegments != null) { segments = IntSets.mutableCopyFrom(ch.getPrimarySegmentsForOwner(localAddress)); segments.retainAll(targetSegments); } else { segments = IntSets.from(ch.getPrimarySegmentsForOwner(localAddress)); } } else { segments = targetSegments; } return () -> { if (segments != null && segments.isEmpty()) { return Stream.empty(); } CacheStream<Original> stream = supplier.get().filterKeySegments(segments); if (keysToFilter != null) { stream = stream.filterKeys(keysToFilter); } if (excludedKeys != null && !excludedKeys.isEmpty()) { return stream.filter(e -> !excludedKeys.contains(toKeyFunction == null ? e : toKeyFunction.apply(e))); } // Make sure the stream is set to be parallel or not return parallel ? stream.parallel() : stream.sequential(); }; } }
public class class_name { protected Supplier<Stream<Original>> supplierForSegments(ConsistentHash ch, IntSet targetSegments, Set<Object> excludedKeys, boolean usePrimary) { if (!ch.getMembers().contains(localAddress)) { return Stream::empty; // depends on control dependency: [if], data = [none] } IntSet segments; if (usePrimary) { if (targetSegments != null) { segments = IntSets.mutableCopyFrom(ch.getPrimarySegmentsForOwner(localAddress)); // depends on control dependency: [if], data = [none] segments.retainAll(targetSegments); // depends on control dependency: [if], data = [(targetSegments] } else { segments = IntSets.from(ch.getPrimarySegmentsForOwner(localAddress)); // depends on control dependency: [if], data = [none] } } else { segments = targetSegments; // depends on control dependency: [if], data = [none] } return () -> { if (segments != null && segments.isEmpty()) { return Stream.empty(); } CacheStream<Original> stream = supplier.get().filterKeySegments(segments); if (keysToFilter != null) { stream = stream.filterKeys(keysToFilter); } if (excludedKeys != null && !excludedKeys.isEmpty()) { return stream.filter(e -> !excludedKeys.contains(toKeyFunction == null ? e : toKeyFunction.apply(e))); } // Make sure the stream is set to be parallel or not return parallel ? stream.parallel() : stream.sequential(); }; } }
public class class_name { final void init() throws DiagnosticModuleRegistrationFailureException { if (initialized) { return; } initialized = true; Method[] methods = getClass().getMethods(); for (Method method : methods) { String name = method.getName().toLowerCase(); if (name.startsWith(FFDC_DUMP_PREFIX)) { Class<?>[] params = method.getParameterTypes(); if (params.length == FFDC_DUMP_PARAMS.length) { // Possible candidate method, so check the types boolean allOK = true; for (int i = 0; (i < params.length) && (allOK); i++) { allOK = (params[i] == FFDC_DUMP_PARAMS[i]); } if (allOK) { _directives.add(method.getName()); if (name.startsWith(FFDC_DUMP_DEFAULT_PREFIX)) _dumpDefaultMethods.add(method); else _dumpMethods.add(method); } else if (makeNoise()) { throw new DiagnosticModuleRegistrationFailureException("Error: " + method + " starts with " + FFDC_DUMP_DEFAULT_PREFIX + " but does not conform to the signature. Method skipped!"); } } else if (makeNoise()) { throw new DiagnosticModuleRegistrationFailureException("Error: " + method + " starts with " + FFDC_DUMP_DEFAULT_PREFIX + " but does not conform to the signature. Method skipped!"); } } } } }
public class class_name { final void init() throws DiagnosticModuleRegistrationFailureException { if (initialized) { return; } initialized = true; Method[] methods = getClass().getMethods(); for (Method method : methods) { String name = method.getName().toLowerCase(); if (name.startsWith(FFDC_DUMP_PREFIX)) { Class<?>[] params = method.getParameterTypes(); if (params.length == FFDC_DUMP_PARAMS.length) { // Possible candidate method, so check the types boolean allOK = true; for (int i = 0; (i < params.length) && (allOK); i++) { allOK = (params[i] == FFDC_DUMP_PARAMS[i]); // depends on control dependency: [for], data = [i] } if (allOK) { _directives.add(method.getName()); // depends on control dependency: [if], data = [none] if (name.startsWith(FFDC_DUMP_DEFAULT_PREFIX)) _dumpDefaultMethods.add(method); else _dumpMethods.add(method); } else if (makeNoise()) { throw new DiagnosticModuleRegistrationFailureException("Error: " + method + " starts with " + FFDC_DUMP_DEFAULT_PREFIX + " but does not conform to the signature. Method skipped!"); } } else if (makeNoise()) { throw new DiagnosticModuleRegistrationFailureException("Error: " + method + " starts with " + FFDC_DUMP_DEFAULT_PREFIX + " but does not conform to the signature. Method skipped!"); } } } } }
public class class_name { public DenseMatrix getR() { int n = qr.ncols(); DenseMatrix R = Matrix.zeros(n, n); for (int i = 0; i < n; i++) { R.set(i, i, tau[i]); for (int j = i+1; j < n; j++) { R.set(i, j, qr.get(i, j)); } } return R; } }
public class class_name { public DenseMatrix getR() { int n = qr.ncols(); DenseMatrix R = Matrix.zeros(n, n); for (int i = 0; i < n; i++) { R.set(i, i, tau[i]); // depends on control dependency: [for], data = [i] for (int j = i+1; j < n; j++) { R.set(i, j, qr.get(i, j)); // depends on control dependency: [for], data = [j] } } return R; } }
public class class_name { @Override public int checkBounds (long logicalBlockAddress, int transferLengthInBlocks) { // Checking if the logical block address is out of bounds if (logicalBlockAddress < 0 || logicalBlockAddress >= getSizeInBlocks()) { return 1; } else // if the logical block address is in bounds but the transferlength // either exceeds // the device size or is faulty return 2 if (transferLengthInBlocks < 0 || logicalBlockAddress + transferLengthInBlocks > getSizeInBlocks()) { return 2; } else { return 0; } } }
public class class_name { @Override public int checkBounds (long logicalBlockAddress, int transferLengthInBlocks) { // Checking if the logical block address is out of bounds if (logicalBlockAddress < 0 || logicalBlockAddress >= getSizeInBlocks()) { return 1; // depends on control dependency: [if], data = [none] } else // if the logical block address is in bounds but the transferlength // either exceeds // the device size or is faulty return 2 if (transferLengthInBlocks < 0 || logicalBlockAddress + transferLengthInBlocks > getSizeInBlocks()) { return 2; // depends on control dependency: [if], data = [none] } else { return 0; // depends on control dependency: [if], data = [none] } } }
public class class_name { static boolean isMixedExpression(String expression) { if (null == expression) { return false; } // if it doesn't start and end with delimiters return (!(expression.startsWith("#{") && expression.endsWith("}"))) && isExpression(expression); } }
public class class_name { static boolean isMixedExpression(String expression) { if (null == expression) { return false; // depends on control dependency: [if], data = [none] } // if it doesn't start and end with delimiters return (!(expression.startsWith("#{") && expression.endsWith("}"))) && isExpression(expression); } }
public class class_name { public void enableAnimation(boolean animated) { if (animated) { addStyleName(I_CmsLayoutBundle.INSTANCE.highlightCss().animated()); } else { removeStyleName(I_CmsLayoutBundle.INSTANCE.highlightCss().animated()); } } }
public class class_name { public void enableAnimation(boolean animated) { if (animated) { addStyleName(I_CmsLayoutBundle.INSTANCE.highlightCss().animated()); // depends on control dependency: [if], data = [none] } else { removeStyleName(I_CmsLayoutBundle.INSTANCE.highlightCss().animated()); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void setValidProcessorFeatures(java.util.Collection<AvailableProcessorFeature> validProcessorFeatures) { if (validProcessorFeatures == null) { this.validProcessorFeatures = null; return; } this.validProcessorFeatures = new com.amazonaws.internal.SdkInternalList<AvailableProcessorFeature>(validProcessorFeatures); } }
public class class_name { public void setValidProcessorFeatures(java.util.Collection<AvailableProcessorFeature> validProcessorFeatures) { if (validProcessorFeatures == null) { this.validProcessorFeatures = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.validProcessorFeatures = new com.amazonaws.internal.SdkInternalList<AvailableProcessorFeature>(validProcessorFeatures); } }
public class class_name { private static Scope openScope(Object name, boolean shouldCheckMultipleRootScopes) { if (name == null) { throw new IllegalArgumentException("null scope names are not allowed."); } Scope scope = MAP_KEY_TO_SCOPE.get(name); if (scope != null) { return scope; } scope = new ScopeImpl(name); Scope previous = MAP_KEY_TO_SCOPE.putIfAbsent(name, scope); if (previous != null) { //if there was already a scope by this name, we return it scope = previous; } else if (shouldCheckMultipleRootScopes) { ConfigurationHolder.configuration.checkMultipleRootScopes(scope); } return scope; } }
public class class_name { private static Scope openScope(Object name, boolean shouldCheckMultipleRootScopes) { if (name == null) { throw new IllegalArgumentException("null scope names are not allowed."); } Scope scope = MAP_KEY_TO_SCOPE.get(name); if (scope != null) { return scope; // depends on control dependency: [if], data = [none] } scope = new ScopeImpl(name); Scope previous = MAP_KEY_TO_SCOPE.putIfAbsent(name, scope); if (previous != null) { //if there was already a scope by this name, we return it scope = previous; // depends on control dependency: [if], data = [none] } else if (shouldCheckMultipleRootScopes) { ConfigurationHolder.configuration.checkMultipleRootScopes(scope); // depends on control dependency: [if], data = [none] } return scope; } }
public class class_name { private void reduceResults(final List<AnalysisResultFuture> results, final Map<ComponentJob, AnalyzerResult> resultMap, final List<AnalysisResultReductionException> reductionErrors) { if (_hasRun.get()) { // already reduced return; } _hasRun.set(true); for (AnalysisResultFuture result : results) { if (result.isErrornous()) { logger.error("Encountered errorneous slave result. Result reduction will stop. Result={}", result); final List<Throwable> errors = result.getErrors(); if (!errors.isEmpty()) { final Throwable firstError = errors.get(0); logger.error( "Encountered error before reducing results (showing stack trace of invoking the reducer): " + firstError.getMessage(), new Throwable()); _analysisListener.errorUknown(_masterJob, firstError); } // error occurred! return; } } final Collection<AnalyzerJob> analyzerJobs = _masterJob.getAnalyzerJobs(); for (AnalyzerJob masterAnalyzerJob : analyzerJobs) { final Collection<AnalyzerResult> slaveResults = new ArrayList<AnalyzerResult>(); logger.info("Reducing {} slave results for component: {}", results.size(), masterAnalyzerJob); for (AnalysisResultFuture result : results) { final Map<ComponentJob, AnalyzerResult> slaveResultMap = result.getResultMap(); final List<AnalyzerJob> slaveAnalyzerJobs = CollectionUtils2.filterOnClass(slaveResultMap.keySet(), AnalyzerJob.class); final AnalyzerJobHelper analyzerJobHelper = new AnalyzerJobHelper(slaveAnalyzerJobs); final AnalyzerJob slaveAnalyzerJob = analyzerJobHelper.getAnalyzerJob(masterAnalyzerJob); if (slaveAnalyzerJob == null) { throw new IllegalStateException("Could not resolve slave component matching [" + masterAnalyzerJob + "] in slave result: " + result); } final AnalyzerResult analyzerResult = result.getResult(slaveAnalyzerJob); slaveResults.add(analyzerResult); } reduce(masterAnalyzerJob, slaveResults, resultMap, reductionErrors); } } }
public class class_name { private void reduceResults(final List<AnalysisResultFuture> results, final Map<ComponentJob, AnalyzerResult> resultMap, final List<AnalysisResultReductionException> reductionErrors) { if (_hasRun.get()) { // already reduced return; // depends on control dependency: [if], data = [none] } _hasRun.set(true); for (AnalysisResultFuture result : results) { if (result.isErrornous()) { logger.error("Encountered errorneous slave result. Result reduction will stop. Result={}", result); // depends on control dependency: [if], data = [none] final List<Throwable> errors = result.getErrors(); if (!errors.isEmpty()) { final Throwable firstError = errors.get(0); logger.error( "Encountered error before reducing results (showing stack trace of invoking the reducer): " + firstError.getMessage(), new Throwable()); // depends on control dependency: [if], data = [none] _analysisListener.errorUknown(_masterJob, firstError); // depends on control dependency: [if], data = [none] } // error occurred! return; // depends on control dependency: [if], data = [none] } } final Collection<AnalyzerJob> analyzerJobs = _masterJob.getAnalyzerJobs(); for (AnalyzerJob masterAnalyzerJob : analyzerJobs) { final Collection<AnalyzerResult> slaveResults = new ArrayList<AnalyzerResult>(); logger.info("Reducing {} slave results for component: {}", results.size(), masterAnalyzerJob); for (AnalysisResultFuture result : results) { final Map<ComponentJob, AnalyzerResult> slaveResultMap = result.getResultMap(); final List<AnalyzerJob> slaveAnalyzerJobs = CollectionUtils2.filterOnClass(slaveResultMap.keySet(), AnalyzerJob.class); final AnalyzerJobHelper analyzerJobHelper = new AnalyzerJobHelper(slaveAnalyzerJobs); final AnalyzerJob slaveAnalyzerJob = analyzerJobHelper.getAnalyzerJob(masterAnalyzerJob); if (slaveAnalyzerJob == null) { throw new IllegalStateException("Could not resolve slave component matching [" + masterAnalyzerJob + "] in slave result: " + result); } final AnalyzerResult analyzerResult = result.getResult(slaveAnalyzerJob); slaveResults.add(analyzerResult); } reduce(masterAnalyzerJob, slaveResults, resultMap, reductionErrors); } } }
public class class_name { public <T> T invokeAPI(String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames, GenericType<T> returnType) throws ApiException { updateParamsForAuth(new String[]{"token", "apiKey"}/*authNames*/, queryParams, headerParams); // Not using `.target(this.basePath).path(path)` below, // to support (constant) query string in `path`, e.g. "/posts?draft=1" WebTarget target = httpClient.target(this.basePath + path); if (queryParams != null) { for (Pair queryParam : queryParams) { if (queryParam.getValue() != null) { target = target.queryParam(queryParam.getName(), queryParam.getValue()); } } } Invocation.Builder invocationBuilder = target.request().accept(accept); for (String key : headerParams.keySet()) { String value = headerParams.get(key); if (value != null) { invocationBuilder = invocationBuilder.header(key, value); } } for (String key : defaultHeaderMap.keySet()) { if (!headerParams.containsKey(key)) { String value = defaultHeaderMap.get(key); if (value != null) { invocationBuilder = invocationBuilder.header(key, value); } } } Entity<?> entity = serialize(body, formParams, contentType); Response response = null; if ("GET".equals(method)) { response = invocationBuilder.get(); } else if ("POST".equals(method)) { response = invocationBuilder.post(entity); } else if ("PUT".equals(method)) { response = invocationBuilder.put(entity); } else if ("DELETE".equals(method)) { response = invocationBuilder.delete(); } else { throw new ApiException(500, "unknown method type " + method); } statusCode = response.getStatusInfo().getStatusCode(); responseHeaders = buildResponseHeaders(response); if (response.getStatus() == Status.NO_CONTENT.getStatusCode()) { return null; } else if (response.getStatusInfo().getFamily().equals(Status.Family.SUCCESSFUL)) { if (returnType == null) return null; else return deserialize(response, returnType); } else { String message = "error"; String respBody = null; if (response.hasEntity()) { try { respBody = String.valueOf(response.readEntity(String.class)); message = respBody; } catch (RuntimeException e) { // e.printStackTrace(); } } throw new ApiException( response.getStatus(), message, buildResponseHeaders(response), respBody); } } }
public class class_name { public <T> T invokeAPI(String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames, GenericType<T> returnType) throws ApiException { updateParamsForAuth(new String[]{"token", "apiKey"}/*authNames*/, queryParams, headerParams); // Not using `.target(this.basePath).path(path)` below, // to support (constant) query string in `path`, e.g. "/posts?draft=1" WebTarget target = httpClient.target(this.basePath + path); if (queryParams != null) { for (Pair queryParam : queryParams) { if (queryParam.getValue() != null) { target = target.queryParam(queryParam.getName(), queryParam.getValue()); // depends on control dependency: [if], data = [none] } } } Invocation.Builder invocationBuilder = target.request().accept(accept); for (String key : headerParams.keySet()) { String value = headerParams.get(key); if (value != null) { invocationBuilder = invocationBuilder.header(key, value); } } for (String key : defaultHeaderMap.keySet()) { if (!headerParams.containsKey(key)) { String value = defaultHeaderMap.get(key); if (value != null) { invocationBuilder = invocationBuilder.header(key, value); } } } Entity<?> entity = serialize(body, formParams, contentType); Response response = null; if ("GET".equals(method)) { response = invocationBuilder.get(); } else if ("POST".equals(method)) { response = invocationBuilder.post(entity); } else if ("PUT".equals(method)) { response = invocationBuilder.put(entity); } else if ("DELETE".equals(method)) { response = invocationBuilder.delete(); } else { throw new ApiException(500, "unknown method type " + method); } statusCode = response.getStatusInfo().getStatusCode(); responseHeaders = buildResponseHeaders(response); if (response.getStatus() == Status.NO_CONTENT.getStatusCode()) { return null; } else if (response.getStatusInfo().getFamily().equals(Status.Family.SUCCESSFUL)) { if (returnType == null) return null; else return deserialize(response, returnType); } else { String message = "error"; String respBody = null; if (response.hasEntity()) { try { respBody = String.valueOf(response.readEntity(String.class)); message = respBody; } catch (RuntimeException e) { // e.printStackTrace(); } } throw new ApiException( response.getStatus(), message, buildResponseHeaders(response), respBody); } } }
public class class_name { @SuppressWarnings("unchecked") public PkiMessage<?> decode(final CMSSignedData pkiMessage) throws MessageDecodingException { LOGGER.debug("Decoding pkiMessage"); validate(pkiMessage); // The signed content is always an octet string CMSProcessable signedContent = pkiMessage.getSignedContent(); SignerInformationStore signerStore = pkiMessage.getSignerInfos(); SignerInformation signerInfo = signerStore.get(new JcaSignerId(signer)); if (signerInfo == null) { throw new MessageDecodingException("Could not for signerInfo for " + signer.getSubjectDN()); } LOGGER.debug("pkiMessage digest algorithm: {}", signerInfo .getDigestAlgorithmID().getAlgorithm()); LOGGER.debug("pkiMessage encryption algorithm: {}", signerInfo.getEncryptionAlgOID()); Store store = pkiMessage.getCertificates(); Collection<?> certColl; try { certColl = store.getMatches(signerInfo.getSID()); } catch (StoreException e) { throw new MessageDecodingException(e); } if (certColl.size() > 0) { X509CertificateHolder cert = (X509CertificateHolder) certColl .iterator().next(); LOGGER.debug( "Verifying pkiMessage using key belonging to [dn={}; serial={}]", cert.getSubject(), cert.getSerialNumber()); SignerInformationVerifier verifier; try { verifier = new JcaSimpleSignerInfoVerifierBuilder().build(cert); if(signerInfo.verify(verifier) == false) { final String msg = "pkiMessage verification failed."; LOGGER.warn(msg); throw new MessageDecodingException(msg); } LOGGER.debug("pkiMessage verified."); } catch (CMSException e) { throw new MessageDecodingException(e); } catch (OperatorCreationException e) { throw new MessageDecodingException(e); } catch (CertificateException e) { throw new MessageDecodingException(e); } } else { LOGGER.warn("Unable to verify message because the signedData contained no certificates."); } Hashtable<ASN1ObjectIdentifier, Attribute> attrTable = signerInfo .getSignedAttributes().toHashtable(); if (LOGGER.isDebugEnabled()) { LOGGER.debug("pkiMessage has {} signed attributes:", signerInfo .getSignedAttributes().size()); for (Entry<ASN1ObjectIdentifier, Attribute> entry : attrTable .entrySet()) { LOGGER.debug(" {}: {}", entry.getKey().getId(), entry .getValue().getAttrValues()); } } MessageType messageType = toMessageType(attrTable .get(toOid(MESSAGE_TYPE))); Nonce senderNonce = toNonce(attrTable.get(toOid(SENDER_NONCE))); TransactionId transId = toTransactionId(attrTable.get(toOid(TRANS_ID))); if (messageType == MessageType.CERT_REP) { PkiStatus pkiStatus = toPkiStatus(attrTable.get(toOid(PKI_STATUS))); Nonce recipientNonce = toNonce(attrTable .get(toOid(RECIPIENT_NONCE))); if (pkiStatus == PkiStatus.FAILURE) { FailInfo failInfo = toFailInfo(attrTable.get(toOid(FAIL_INFO))); LOGGER.debug("Finished decoding pkiMessage"); return new CertRep(transId, senderNonce, recipientNonce, failInfo); } else if (pkiStatus == PkiStatus.PENDING) { LOGGER.debug("Finished decoding pkiMessage"); return new CertRep(transId, senderNonce, recipientNonce); } else { final CMSEnvelopedData ed = getEnvelopedData(signedContent .getContent()); final byte[] envelopedContent = decoder.decode(ed); CMSSignedData messageData; try { messageData = new CMSSignedData(envelopedContent); } catch (CMSException e) { throw new MessageDecodingException(e); } LOGGER.debug("Finished decoding pkiMessage"); return new CertRep(transId, senderNonce, recipientNonce, messageData); } } else { CMSEnvelopedData ed = getEnvelopedData(signedContent.getContent()); byte[] decoded = decoder.decode(ed); if (messageType == MessageType.GET_CERT) { IssuerAndSerialNumber messageData = IssuerAndSerialNumber .getInstance(decoded); LOGGER.debug("Finished decoding pkiMessage"); return new GetCert(transId, senderNonce, messageData); } else if (messageType == MessageType.GET_CERT_INITIAL) { IssuerAndSubject messageData = new IssuerAndSubject(decoded); LOGGER.debug("Finished decoding pkiMessage"); return new GetCertInitial(transId, senderNonce, messageData); } else if (messageType == MessageType.GET_CRL) { IssuerAndSerialNumber messageData = IssuerAndSerialNumber .getInstance(decoded); LOGGER.debug("Finished decoding pkiMessage"); return new GetCrl(transId, senderNonce, messageData); } else { PKCS10CertificationRequest messageData; try { messageData = new PKCS10CertificationRequest(decoded); } catch (IOException e) { throw new MessageDecodingException(e); } LOGGER.debug("Finished decoding pkiMessage"); return new PkcsReq(transId, senderNonce, messageData); } } } }
public class class_name { @SuppressWarnings("unchecked") public PkiMessage<?> decode(final CMSSignedData pkiMessage) throws MessageDecodingException { LOGGER.debug("Decoding pkiMessage"); validate(pkiMessage); // The signed content is always an octet string CMSProcessable signedContent = pkiMessage.getSignedContent(); SignerInformationStore signerStore = pkiMessage.getSignerInfos(); SignerInformation signerInfo = signerStore.get(new JcaSignerId(signer)); if (signerInfo == null) { throw new MessageDecodingException("Could not for signerInfo for " + signer.getSubjectDN()); } LOGGER.debug("pkiMessage digest algorithm: {}", signerInfo .getDigestAlgorithmID().getAlgorithm()); LOGGER.debug("pkiMessage encryption algorithm: {}", signerInfo.getEncryptionAlgOID()); Store store = pkiMessage.getCertificates(); Collection<?> certColl; try { certColl = store.getMatches(signerInfo.getSID()); } catch (StoreException e) { throw new MessageDecodingException(e); } if (certColl.size() > 0) { X509CertificateHolder cert = (X509CertificateHolder) certColl .iterator().next(); LOGGER.debug( "Verifying pkiMessage using key belonging to [dn={}; serial={}]", cert.getSubject(), cert.getSerialNumber()); SignerInformationVerifier verifier; try { verifier = new JcaSimpleSignerInfoVerifierBuilder().build(cert); if(signerInfo.verify(verifier) == false) { final String msg = "pkiMessage verification failed."; LOGGER.warn(msg); // depends on control dependency: [if], data = [none] throw new MessageDecodingException(msg); } LOGGER.debug("pkiMessage verified."); } catch (CMSException e) { throw new MessageDecodingException(e); } catch (OperatorCreationException e) { throw new MessageDecodingException(e); } catch (CertificateException e) { throw new MessageDecodingException(e); } } else { LOGGER.warn("Unable to verify message because the signedData contained no certificates."); } Hashtable<ASN1ObjectIdentifier, Attribute> attrTable = signerInfo .getSignedAttributes().toHashtable(); if (LOGGER.isDebugEnabled()) { LOGGER.debug("pkiMessage has {} signed attributes:", signerInfo .getSignedAttributes().size()); for (Entry<ASN1ObjectIdentifier, Attribute> entry : attrTable .entrySet()) { LOGGER.debug(" {}: {}", entry.getKey().getId(), entry .getValue().getAttrValues()); } } MessageType messageType = toMessageType(attrTable .get(toOid(MESSAGE_TYPE))); Nonce senderNonce = toNonce(attrTable.get(toOid(SENDER_NONCE))); TransactionId transId = toTransactionId(attrTable.get(toOid(TRANS_ID))); if (messageType == MessageType.CERT_REP) { PkiStatus pkiStatus = toPkiStatus(attrTable.get(toOid(PKI_STATUS))); Nonce recipientNonce = toNonce(attrTable .get(toOid(RECIPIENT_NONCE))); if (pkiStatus == PkiStatus.FAILURE) { FailInfo failInfo = toFailInfo(attrTable.get(toOid(FAIL_INFO))); LOGGER.debug("Finished decoding pkiMessage"); return new CertRep(transId, senderNonce, recipientNonce, failInfo); } else if (pkiStatus == PkiStatus.PENDING) { LOGGER.debug("Finished decoding pkiMessage"); return new CertRep(transId, senderNonce, recipientNonce); } else { final CMSEnvelopedData ed = getEnvelopedData(signedContent .getContent()); final byte[] envelopedContent = decoder.decode(ed); CMSSignedData messageData; try { messageData = new CMSSignedData(envelopedContent); } catch (CMSException e) { throw new MessageDecodingException(e); } LOGGER.debug("Finished decoding pkiMessage"); return new CertRep(transId, senderNonce, recipientNonce, messageData); } } else { CMSEnvelopedData ed = getEnvelopedData(signedContent.getContent()); byte[] decoded = decoder.decode(ed); if (messageType == MessageType.GET_CERT) { IssuerAndSerialNumber messageData = IssuerAndSerialNumber .getInstance(decoded); LOGGER.debug("Finished decoding pkiMessage"); return new GetCert(transId, senderNonce, messageData); } else if (messageType == MessageType.GET_CERT_INITIAL) { IssuerAndSubject messageData = new IssuerAndSubject(decoded); LOGGER.debug("Finished decoding pkiMessage"); return new GetCertInitial(transId, senderNonce, messageData); } else if (messageType == MessageType.GET_CRL) { IssuerAndSerialNumber messageData = IssuerAndSerialNumber .getInstance(decoded); LOGGER.debug("Finished decoding pkiMessage"); return new GetCrl(transId, senderNonce, messageData); } else { PKCS10CertificationRequest messageData; try { messageData = new PKCS10CertificationRequest(decoded); } catch (IOException e) { throw new MessageDecodingException(e); } LOGGER.debug("Finished decoding pkiMessage"); return new PkcsReq(transId, senderNonce, messageData); } } } }
public class class_name { private String encodeIllegalCharacters(String relativeURI) { try { return new URI(null, null, relativeURI, null).toString(); } catch (URISyntaxException e) { throw new LocationException(e); } } }
public class class_name { private String encodeIllegalCharacters(String relativeURI) { try { return new URI(null, null, relativeURI, null).toString(); // depends on control dependency: [try], data = [none] } catch (URISyntaxException e) { throw new LocationException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public AdvancedModelWrapper loadReferencedModel(Field field, ModelRegistry modelRegistry, EngineeringDatabaseService edbService, EDBConverter edbConverter) { try { ModelDescription description = getModelDescriptionFromField(field); String modelKey = (String) FieldUtils.readField(field, model, true); if (modelKey == null) { return null; } modelKey = appendContextId(modelKey); Class<?> sourceClass = modelRegistry.loadModel(description); Object model = edbConverter.convertEDBObjectToModel(sourceClass, edbService.getObject(modelKey)); return new AdvancedModelWrapper((OpenEngSBModel) model); } catch (SecurityException e) { throw new EKBException(generateErrorMessage(field), e); } catch (IllegalArgumentException e) { throw new EKBException(generateErrorMessage(field), e); } catch (IllegalAccessException e) { throw new EKBException(generateErrorMessage(field), e); } catch (ClassNotFoundException e) { throw new EKBException(generateErrorMessage(field), e); } } }
public class class_name { public AdvancedModelWrapper loadReferencedModel(Field field, ModelRegistry modelRegistry, EngineeringDatabaseService edbService, EDBConverter edbConverter) { try { ModelDescription description = getModelDescriptionFromField(field); String modelKey = (String) FieldUtils.readField(field, model, true); if (modelKey == null) { return null; // depends on control dependency: [if], data = [none] } modelKey = appendContextId(modelKey); // depends on control dependency: [try], data = [none] Class<?> sourceClass = modelRegistry.loadModel(description); Object model = edbConverter.convertEDBObjectToModel(sourceClass, edbService.getObject(modelKey)); return new AdvancedModelWrapper((OpenEngSBModel) model); // depends on control dependency: [try], data = [none] } catch (SecurityException e) { throw new EKBException(generateErrorMessage(field), e); } catch (IllegalArgumentException e) { // depends on control dependency: [catch], data = [none] throw new EKBException(generateErrorMessage(field), e); } catch (IllegalAccessException e) { // depends on control dependency: [catch], data = [none] throw new EKBException(generateErrorMessage(field), e); } catch (ClassNotFoundException e) { // depends on control dependency: [catch], data = [none] throw new EKBException(generateErrorMessage(field), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public Object proceed() throws Exception { Object returnValue = null; try { if (ivNextIndex < ivNumberOfInterceptors) { // There is atleast 1 more interceptor method in the // chain to invoke. Determine if method signature is // one that is passed the InvocationContext. InterceptorProxy w = ivInterceptorProxies[ivNextIndex]; if (w.ivRequiresInvocationContext) { // Method signature is <METHOD>(InvocationContext). // Therefore, only call this method it will call // InvocationContext.proceed() to continue with // the next method in the chain. ++ivNextIndex; returnValue = w.invokeInterceptor(ivBean, this, ivInterceptors); } else { // Method signature is <METHOD>(), which means it must be // a lifecycle callback method of the bean class or // one of its superclasses. As required by EJB 3 spec, // call all remaining lifecycle methods in the chain. while (w != null) { ++ivNextIndex; returnValue = w.invokeInterceptor(ivBean, this, ivInterceptors); w = (ivNextIndex < ivNumberOfInterceptors) ? ivInterceptorProxies[ivNextIndex] : null; } } } else if (ivMethod != null) { // The last around invoke in the chain has called proceed, // so now we must invoke the business method. returnValue = ivContainer.invokeProceed(ivEJSDeployedSupport, ivMethod, ivBean, ivParameters, ivParametersModified); //LIDB3294-41 } else if (ivIsAroundConstruct) { try { ivBean = ivConstructCallback.proceed(ivParameters, getContextData()); } catch (Exception ex) { ivAroundConstructException = ex; throw ex; } return null; } } catch (UndeclaredThrowableException ude) { throwUndeclaredExceptionCause(ude); } catch (InvocationTargetException ite) { throwUndeclaredExceptionCause(ite); } // Per the interceptor 1.2 spec, "If a lifecycle callback interceptor // method returns a value, it is ignored by the container." return ivMethod == null ? null : returnValue; } }
public class class_name { @Override public Object proceed() throws Exception { Object returnValue = null; try { if (ivNextIndex < ivNumberOfInterceptors) { // There is atleast 1 more interceptor method in the // chain to invoke. Determine if method signature is // one that is passed the InvocationContext. InterceptorProxy w = ivInterceptorProxies[ivNextIndex]; if (w.ivRequiresInvocationContext) { // Method signature is <METHOD>(InvocationContext). // Therefore, only call this method it will call // InvocationContext.proceed() to continue with // the next method in the chain. ++ivNextIndex; // depends on control dependency: [if], data = [none] returnValue = w.invokeInterceptor(ivBean, this, ivInterceptors); // depends on control dependency: [if], data = [none] } else { // Method signature is <METHOD>(), which means it must be // a lifecycle callback method of the bean class or // one of its superclasses. As required by EJB 3 spec, // call all remaining lifecycle methods in the chain. while (w != null) { ++ivNextIndex; // depends on control dependency: [while], data = [none] returnValue = w.invokeInterceptor(ivBean, this, ivInterceptors); // depends on control dependency: [while], data = [none] w = (ivNextIndex < ivNumberOfInterceptors) ? ivInterceptorProxies[ivNextIndex] : null; // depends on control dependency: [while], data = [none] } } } else if (ivMethod != null) { // The last around invoke in the chain has called proceed, // so now we must invoke the business method. returnValue = ivContainer.invokeProceed(ivEJSDeployedSupport, ivMethod, ivBean, ivParameters, ivParametersModified); //LIDB3294-41 // depends on control dependency: [if], data = [none] } else if (ivIsAroundConstruct) { try { ivBean = ivConstructCallback.proceed(ivParameters, getContextData()); // depends on control dependency: [try], data = [none] } catch (Exception ex) { ivAroundConstructException = ex; throw ex; } // depends on control dependency: [catch], data = [none] return null; // depends on control dependency: [if], data = [none] } } catch (UndeclaredThrowableException ude) { throwUndeclaredExceptionCause(ude); } catch (InvocationTargetException ite) { throwUndeclaredExceptionCause(ite); } // Per the interceptor 1.2 spec, "If a lifecycle callback interceptor // method returns a value, it is ignored by the container." return ivMethod == null ? null : returnValue; } }
public class class_name { public Map getMap(String attribute) { NameOpValue nv = rslTree.getParam(attribute); if (nv == null || nv.getOperator() != NameOpValue.EQ) return null; List values = nv.getValues(); Map map = new HashMap(); Iterator iter = values.iterator(); Object obj; while( iter.hasNext() ) { obj = iter.next(); if (obj instanceof List) { String key, value; List list = (List)obj; if (list.size() != 2) continue; // must have 2 values! obj = list.get(0); if (obj instanceof Value) { key = ((Value)obj).getCompleteValue(); } else { continue; } obj = list.get(1); if (obj instanceof Value) { value = ((Value)obj).getCompleteValue(); } else { continue; } map.put(key, value); } } return map; } }
public class class_name { public Map getMap(String attribute) { NameOpValue nv = rslTree.getParam(attribute); if (nv == null || nv.getOperator() != NameOpValue.EQ) return null; List values = nv.getValues(); Map map = new HashMap(); Iterator iter = values.iterator(); Object obj; while( iter.hasNext() ) { obj = iter.next(); // depends on control dependency: [while], data = [none] if (obj instanceof List) { String key, value; List list = (List)obj; if (list.size() != 2) continue; // must have 2 values! obj = list.get(0); // depends on control dependency: [if], data = [none] if (obj instanceof Value) { key = ((Value)obj).getCompleteValue(); // depends on control dependency: [if], data = [none] } else { continue; } obj = list.get(1); // depends on control dependency: [if], data = [none] if (obj instanceof Value) { value = ((Value)obj).getCompleteValue(); // depends on control dependency: [if], data = [none] } else { continue; } map.put(key, value); // depends on control dependency: [if], data = [none] } } return map; } }
public class class_name { private JsonClassWriterBase getCustomWriter(Class c) { JsonClassWriterBase writer = writerCache.get(c); if (writer == null) { writer = forceGetCustomWriter(c); writerCache.put(c, writer); } return writer == nullWriter ? null : writer; } }
public class class_name { private JsonClassWriterBase getCustomWriter(Class c) { JsonClassWriterBase writer = writerCache.get(c); if (writer == null) { writer = forceGetCustomWriter(c); // depends on control dependency: [if], data = [none] writerCache.put(c, writer); // depends on control dependency: [if], data = [none] } return writer == nullWriter ? null : writer; } }
public class class_name { public static String format(String format, int value) { prec = 0; point = false; df = null; analyse_format(format); StringBuilder out = new StringBuilder(); if (df != null) out.append(df.format(value)); else out.append(value); if (pos) { if (value > 0) out.insert(0, "+"); pos = false; } return out.toString(); } }
public class class_name { public static String format(String format, int value) { prec = 0; point = false; df = null; analyse_format(format); StringBuilder out = new StringBuilder(); if (df != null) out.append(df.format(value)); else out.append(value); if (pos) { if (value > 0) out.insert(0, "+"); pos = false; // depends on control dependency: [if], data = [none] } return out.toString(); } }
public class class_name { protected DoubleDataStore computeIDs(DBIDs ids, KNNQuery<O> knnQ) { WritableDoubleDataStore intDims = DataStoreUtil.makeDoubleStorage(ids, DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_TEMP); FiniteProgress prog = LOG.isVerbose() ? new FiniteProgress("Intrinsic dimensionality", ids.size(), LOG) : null; for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) { double id = 0.; try { id = estimator.estimate(knnQ, iter, k_c + 1); } catch(ArithmeticException e) { id = 0; // Too many duplicates, etc. } intDims.putDouble(iter, id); LOG.incrementProcessed(prog); } LOG.ensureCompleted(prog); return intDims; } }
public class class_name { protected DoubleDataStore computeIDs(DBIDs ids, KNNQuery<O> knnQ) { WritableDoubleDataStore intDims = DataStoreUtil.makeDoubleStorage(ids, DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_TEMP); FiniteProgress prog = LOG.isVerbose() ? new FiniteProgress("Intrinsic dimensionality", ids.size(), LOG) : null; for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) { double id = 0.; try { id = estimator.estimate(knnQ, iter, k_c + 1); // depends on control dependency: [try], data = [none] } catch(ArithmeticException e) { id = 0; // Too many duplicates, etc. } // depends on control dependency: [catch], data = [none] intDims.putDouble(iter, id); // depends on control dependency: [for], data = [iter] LOG.incrementProcessed(prog); // depends on control dependency: [for], data = [none] } LOG.ensureCompleted(prog); return intDims; } }
public class class_name { public void collectDbStats(ArrayList<com.couchbase.lite.internal.database.sqlite.SQLiteDebug.DbStats> dbStatsList) { synchronized (mLock) { if (mAvailablePrimaryConnection != null) { mAvailablePrimaryConnection.collectDbStats(dbStatsList); } for (SQLiteConnection connection : mAvailableNonPrimaryConnections) { connection.collectDbStats(dbStatsList); } for (SQLiteConnection connection : mAcquiredConnections.keySet()) { connection.collectDbStatsUnsafe(dbStatsList); } } } }
public class class_name { public void collectDbStats(ArrayList<com.couchbase.lite.internal.database.sqlite.SQLiteDebug.DbStats> dbStatsList) { synchronized (mLock) { if (mAvailablePrimaryConnection != null) { mAvailablePrimaryConnection.collectDbStats(dbStatsList); // depends on control dependency: [if], data = [none] } for (SQLiteConnection connection : mAvailableNonPrimaryConnections) { connection.collectDbStats(dbStatsList); // depends on control dependency: [for], data = [connection] } for (SQLiteConnection connection : mAcquiredConnections.keySet()) { connection.collectDbStatsUnsafe(dbStatsList); // depends on control dependency: [for], data = [connection] } } } }
public class class_name { public void marshall(SigningJob signingJob, ProtocolMarshaller protocolMarshaller) { if (signingJob == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(signingJob.getJobId(), JOBID_BINDING); protocolMarshaller.marshall(signingJob.getSource(), SOURCE_BINDING); protocolMarshaller.marshall(signingJob.getSignedObject(), SIGNEDOBJECT_BINDING); protocolMarshaller.marshall(signingJob.getSigningMaterial(), SIGNINGMATERIAL_BINDING); protocolMarshaller.marshall(signingJob.getCreatedAt(), CREATEDAT_BINDING); protocolMarshaller.marshall(signingJob.getStatus(), STATUS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(SigningJob signingJob, ProtocolMarshaller protocolMarshaller) { if (signingJob == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(signingJob.getJobId(), JOBID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(signingJob.getSource(), SOURCE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(signingJob.getSignedObject(), SIGNEDOBJECT_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(signingJob.getSigningMaterial(), SIGNINGMATERIAL_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(signingJob.getCreatedAt(), CREATEDAT_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(signingJob.getStatus(), STATUS_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 List<PremiseElement.PremiseName> getPremiseName() { if (premiseName == null) { premiseName = new ArrayList<PremiseElement.PremiseName>(); } return this.premiseName; } }
public class class_name { public List<PremiseElement.PremiseName> getPremiseName() { if (premiseName == null) { premiseName = new ArrayList<PremiseElement.PremiseName>(); // depends on control dependency: [if], data = [none] } return this.premiseName; } }
public class class_name { private boolean validateKeyTypeIsHashable(TypeInformation<?> type) { try { return (type instanceof PojoTypeInfo) ? !type.getTypeClass().getMethod("hashCode").getDeclaringClass().equals(Object.class) : !(type instanceof PrimitiveArrayTypeInfo || type instanceof BasicArrayTypeInfo || type instanceof ObjectArrayTypeInfo); } catch (NoSuchMethodException ignored) { // this should never happen as we are just searching for the hashCode() method. } return false; } }
public class class_name { private boolean validateKeyTypeIsHashable(TypeInformation<?> type) { try { return (type instanceof PojoTypeInfo) ? !type.getTypeClass().getMethod("hashCode").getDeclaringClass().equals(Object.class) : !(type instanceof PrimitiveArrayTypeInfo || type instanceof BasicArrayTypeInfo || type instanceof ObjectArrayTypeInfo); // depends on control dependency: [try], data = [none] } catch (NoSuchMethodException ignored) { // this should never happen as we are just searching for the hashCode() method. } // depends on control dependency: [catch], data = [none] return false; } }
public class class_name { private List<String> getPaths(String[] files) { final List<String> antStylePaths = new ArrayList<>(); for (String file : files) { final String antPath = ensureCanonicalPath(file); antStylePaths.add(antPath); } return antStylePaths; } }
public class class_name { private List<String> getPaths(String[] files) { final List<String> antStylePaths = new ArrayList<>(); for (String file : files) { final String antPath = ensureCanonicalPath(file); antStylePaths.add(antPath); // depends on control dependency: [for], data = [none] } return antStylePaths; } }
public class class_name { public String getTabStyle() { String tabStyle = TieConstants.TAB_STYLE_VISIBLE; int sheetId = webFormTabView.getActiveIndex(); if ((sheetId >= 0) && (sheetId < tabs.size())) { tabStyle = TieConstants.TAB_STYLE_INVISIBLE; } return tabStyle; } }
public class class_name { public String getTabStyle() { String tabStyle = TieConstants.TAB_STYLE_VISIBLE; int sheetId = webFormTabView.getActiveIndex(); if ((sheetId >= 0) && (sheetId < tabs.size())) { tabStyle = TieConstants.TAB_STYLE_INVISIBLE; // depends on control dependency: [if], data = [none] } return tabStyle; } }
public class class_name { public void process(T gray, GrayU8 binary ) { configureContourDetector(gray); recycleData(); positionPatterns.reset(); interpolate.setImage(gray); // detect squares squareDetector.process(gray,binary); long time0 = System.nanoTime(); squaresToPositionList(); long time1 = System.nanoTime(); // Create graph of neighboring squares createPositionPatternGraph(); // long time2 = System.nanoTime(); // doesn't take very long double milli = (time1-time0)*1e-6; milliGraph.update(milli); if( profiler ) { DetectPolygonFromContour<T> detectorPoly = squareDetector.getDetector(); System.out.printf(" contour %5.1f shapes %5.1f adjust_bias %5.2f PosPat %6.2f", detectorPoly.getMilliContour(), detectorPoly.getMilliShapes(), squareDetector.getMilliAdjustBias(), milliGraph.getAverage()); } } }
public class class_name { public void process(T gray, GrayU8 binary ) { configureContourDetector(gray); recycleData(); positionPatterns.reset(); interpolate.setImage(gray); // detect squares squareDetector.process(gray,binary); long time0 = System.nanoTime(); squaresToPositionList(); long time1 = System.nanoTime(); // Create graph of neighboring squares createPositionPatternGraph(); // long time2 = System.nanoTime(); // doesn't take very long double milli = (time1-time0)*1e-6; milliGraph.update(milli); if( profiler ) { DetectPolygonFromContour<T> detectorPoly = squareDetector.getDetector(); System.out.printf(" contour %5.1f shapes %5.1f adjust_bias %5.2f PosPat %6.2f", detectorPoly.getMilliContour(), detectorPoly.getMilliShapes(), squareDetector.getMilliAdjustBias(), milliGraph.getAverage()); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void refreshSchemataCache() { try { final List<GoodwillSchema> schemata = delegate.getSchemata().get(); // If Goodwill is down - keep the old cache around if (schemata == null) { return; } final Map<String,GoodwillSchema> newSchemataCache = new ConcurrentHashMap<String, GoodwillSchema>(); for (final GoodwillSchema schema : schemata) { newSchemataCache.put(schema.getName(), schema); } synchronized (cacheMonitor) { knownSchemata.clear(); knownSchemata.putAll(newSchemataCache); } } catch (InterruptedException e) { log.warn("Interrupted while refreshing the cache"); Thread.currentThread().interrupt(); } catch (ExecutionException e) { log.warn("Unable to refresh schemata cache: {}", e.getLocalizedMessage()); } } }
public class class_name { public void refreshSchemataCache() { try { final List<GoodwillSchema> schemata = delegate.getSchemata().get(); // If Goodwill is down - keep the old cache around if (schemata == null) { return; // depends on control dependency: [if], data = [none] } final Map<String,GoodwillSchema> newSchemataCache = new ConcurrentHashMap<String, GoodwillSchema>(); for (final GoodwillSchema schema : schemata) { newSchemataCache.put(schema.getName(), schema); // depends on control dependency: [for], data = [schema] } synchronized (cacheMonitor) { // depends on control dependency: [try], data = [none] knownSchemata.clear(); knownSchemata.putAll(newSchemataCache); } } catch (InterruptedException e) { log.warn("Interrupted while refreshing the cache"); Thread.currentThread().interrupt(); } // depends on control dependency: [catch], data = [none] catch (ExecutionException e) { log.warn("Unable to refresh schemata cache: {}", e.getLocalizedMessage()); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void delete(Query query) { Log.debug("Deleting by query %s", query); try { indexWriter.deleteDocuments(query); } catch (IOException e) { Log.error(e, "Error while deleting by query %s", query); throw new RuntimeException(e); } } }
public class class_name { public void delete(Query query) { Log.debug("Deleting by query %s", query); try { indexWriter.deleteDocuments(query); // depends on control dependency: [try], data = [none] } catch (IOException e) { Log.error(e, "Error while deleting by query %s", query); throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public Map getInfoByBizIdService(String bizId,String tableName,String bizCol){ //add 20170831 ninghao Map filterViewRet=filterView4Select(tableName,new HashMap(),bizId,bizCol,TYPE_SELECT_BIZID); if(filterViewRet!=null ){ return filterViewRet; } Map retMap=getInnerDao().queryObjJoinByBizId(tableName, bizId,bizCol); if(retMap==null){ return null; } CheckModelTypeUtil.addMetaCols(retMap); CheckModelTypeUtil.changeNoStrCols(retMap); return retMap; } }
public class class_name { public Map getInfoByBizIdService(String bizId,String tableName,String bizCol){ //add 20170831 ninghao Map filterViewRet=filterView4Select(tableName,new HashMap(),bizId,bizCol,TYPE_SELECT_BIZID); if(filterViewRet!=null ){ return filterViewRet; // depends on control dependency: [if], data = [none] } Map retMap=getInnerDao().queryObjJoinByBizId(tableName, bizId,bizCol); if(retMap==null){ return null; // depends on control dependency: [if], data = [none] } CheckModelTypeUtil.addMetaCols(retMap); CheckModelTypeUtil.changeNoStrCols(retMap); return retMap; } }
public class class_name { public static List<CmsResource> getGalleries(int galleryTypeId, CmsObject cms) { List<CmsResource> galleries = new ArrayList<CmsResource>(); try { // get the galleries of the current site galleries = cms.readResources("/", CmsResourceFilter.ONLY_VISIBLE_NO_DELETED.addRequireType(galleryTypeId)); } catch (CmsException e) { // error reading resources with filter LOG.error(e.getLocalizedMessage(), e); } // if the current site is NOT the root site - add all other galleries from the system path if (!cms.getRequestContext().getSiteRoot().equals("")) { List<CmsResource> systemGalleries = null; try { // get the galleries in the /system/ folder systemGalleries = cms.readResources( CmsWorkplace.VFS_PATH_SYSTEM, CmsResourceFilter.ONLY_VISIBLE_NO_DELETED.addRequireType(galleryTypeId)); } catch (CmsException e) { // error reading resources with filter LOG.error(e.getLocalizedMessage(), e); } if ((systemGalleries != null) && (systemGalleries.size() > 0)) { // add the found system galleries to the result galleries.addAll(systemGalleries); } } // return the found galleries return galleries; } }
public class class_name { public static List<CmsResource> getGalleries(int galleryTypeId, CmsObject cms) { List<CmsResource> galleries = new ArrayList<CmsResource>(); try { // get the galleries of the current site galleries = cms.readResources("/", CmsResourceFilter.ONLY_VISIBLE_NO_DELETED.addRequireType(galleryTypeId)); // depends on control dependency: [try], data = [none] } catch (CmsException e) { // error reading resources with filter LOG.error(e.getLocalizedMessage(), e); } // depends on control dependency: [catch], data = [none] // if the current site is NOT the root site - add all other galleries from the system path if (!cms.getRequestContext().getSiteRoot().equals("")) { List<CmsResource> systemGalleries = null; try { // get the galleries in the /system/ folder systemGalleries = cms.readResources( CmsWorkplace.VFS_PATH_SYSTEM, CmsResourceFilter.ONLY_VISIBLE_NO_DELETED.addRequireType(galleryTypeId)); // depends on control dependency: [try], data = [none] } catch (CmsException e) { // error reading resources with filter LOG.error(e.getLocalizedMessage(), e); } // depends on control dependency: [catch], data = [none] if ((systemGalleries != null) && (systemGalleries.size() > 0)) { // add the found system galleries to the result galleries.addAll(systemGalleries); // depends on control dependency: [if], data = [none] } } // return the found galleries return galleries; } }
public class class_name { protected List<String> getPages() { if (m_pages == null) { m_pages = Arrays.asList(getPageArray()); } return m_pages; } }
public class class_name { protected List<String> getPages() { if (m_pages == null) { m_pages = Arrays.asList(getPageArray()); // depends on control dependency: [if], data = [none] } return m_pages; } }
public class class_name { public void release() { for(String name : all) { allColumnFamilyMetrics.get(name).remove(Metrics.defaultRegistry().allMetrics().get(factory.createMetricName(name))); Metrics.defaultRegistry().removeMetric(factory.createMetricName(name)); } readLatency.release(); writeLatency.release(); rangeLatency.release(); Metrics.defaultRegistry().removeMetric(factory.createMetricName("EstimatedRowSizeHistogram")); Metrics.defaultRegistry().removeMetric(factory.createMetricName("EstimatedColumnCountHistogram")); Metrics.defaultRegistry().removeMetric(factory.createMetricName("KeyCacheHitRate")); Metrics.defaultRegistry().removeMetric(factory.createMetricName("CoordinatorReadLatency")); Metrics.defaultRegistry().removeMetric(factory.createMetricName("CoordinatorScanLatency")); Metrics.defaultRegistry().removeMetric(factory.createMetricName("WaitingOnFreeMemtableSpace")); } }
public class class_name { public void release() { for(String name : all) { allColumnFamilyMetrics.get(name).remove(Metrics.defaultRegistry().allMetrics().get(factory.createMetricName(name))); // depends on control dependency: [for], data = [name] Metrics.defaultRegistry().removeMetric(factory.createMetricName(name)); // depends on control dependency: [for], data = [name] } readLatency.release(); writeLatency.release(); rangeLatency.release(); Metrics.defaultRegistry().removeMetric(factory.createMetricName("EstimatedRowSizeHistogram")); Metrics.defaultRegistry().removeMetric(factory.createMetricName("EstimatedColumnCountHistogram")); Metrics.defaultRegistry().removeMetric(factory.createMetricName("KeyCacheHitRate")); Metrics.defaultRegistry().removeMetric(factory.createMetricName("CoordinatorReadLatency")); Metrics.defaultRegistry().removeMetric(factory.createMetricName("CoordinatorScanLatency")); Metrics.defaultRegistry().removeMetric(factory.createMetricName("WaitingOnFreeMemtableSpace")); } }
public class class_name { private AnnotationType getAnnotationType(final KAMStore kAMStore, final Kam kam, final String name) throws KAMStoreException { AnnotationType annoType = null; List<BelDocumentInfo> belDocs = kAMStore.getBelDocumentInfos(kam.getKamInfo()); //loop through all BEL documents used for this KAM for (BelDocumentInfo doc : belDocs) { //check annotation type on each document List<AnnotationType> annoTypes = doc.getAnnotationTypes(); for (AnnotationType a : annoTypes) { if (a.getName().equals(name)) { annoType = a; break; } } if (annoType != null) { break; } } return annoType; } }
public class class_name { private AnnotationType getAnnotationType(final KAMStore kAMStore, final Kam kam, final String name) throws KAMStoreException { AnnotationType annoType = null; List<BelDocumentInfo> belDocs = kAMStore.getBelDocumentInfos(kam.getKamInfo()); //loop through all BEL documents used for this KAM for (BelDocumentInfo doc : belDocs) { //check annotation type on each document List<AnnotationType> annoTypes = doc.getAnnotationTypes(); for (AnnotationType a : annoTypes) { if (a.getName().equals(name)) { annoType = a; // depends on control dependency: [if], data = [none] break; } } if (annoType != null) { break; } } return annoType; } }
public class class_name { public void marshall(ContinueAsNewWorkflowExecutionFailedEventAttributes continueAsNewWorkflowExecutionFailedEventAttributes, ProtocolMarshaller protocolMarshaller) { if (continueAsNewWorkflowExecutionFailedEventAttributes == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(continueAsNewWorkflowExecutionFailedEventAttributes.getCause(), CAUSE_BINDING); protocolMarshaller.marshall(continueAsNewWorkflowExecutionFailedEventAttributes.getDecisionTaskCompletedEventId(), DECISIONTASKCOMPLETEDEVENTID_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ContinueAsNewWorkflowExecutionFailedEventAttributes continueAsNewWorkflowExecutionFailedEventAttributes, ProtocolMarshaller protocolMarshaller) { if (continueAsNewWorkflowExecutionFailedEventAttributes == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(continueAsNewWorkflowExecutionFailedEventAttributes.getCause(), CAUSE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(continueAsNewWorkflowExecutionFailedEventAttributes.getDecisionTaskCompletedEventId(), DECISIONTASKCOMPLETEDEVENTID_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 { @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) @Override public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int width, int height) { Log.d(TAG, "onSurfaceTextureAvailable - state: " + this.currentState); Surface surface = new Surface(surfaceTexture); if (this.mediaPlayer != null) { this.mediaPlayer.setSurface(surface); // If is not prepared yet - tryToPrepare() if (!this.surfaceIsReady) { this.surfaceIsReady = true; if (this.currentState == State.INITIALIZED || this.currentState == State.PREPARING) tryToPrepare(); } } } }
public class class_name { @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) @Override public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int width, int height) { Log.d(TAG, "onSurfaceTextureAvailable - state: " + this.currentState); Surface surface = new Surface(surfaceTexture); if (this.mediaPlayer != null) { this.mediaPlayer.setSurface(surface); // depends on control dependency: [if], data = [none] // If is not prepared yet - tryToPrepare() if (!this.surfaceIsReady) { this.surfaceIsReady = true; // depends on control dependency: [if], data = [none] if (this.currentState == State.INITIALIZED || this.currentState == State.PREPARING) tryToPrepare(); } } } }
public class class_name { public int deleteByBaseId(long id, GeometryType geometryType) { String geometryTypeName = null; if (geometryType != null) { geometryTypeName = geometryType.getName(); } StringBuilder where = new StringBuilder(); where.append(buildWhere(StyleMappingTable.COLUMN_BASE_ID, id)); where.append(" AND "); where.append(buildWhere(StyleMappingTable.COLUMN_GEOMETRY_TYPE_NAME, geometryTypeName)); List<Object> whereArguments = new ArrayList<>(); whereArguments.add(id); if (geometryTypeName != null) { whereArguments.add(geometryTypeName); } String[] whereArgs = buildWhereArgs(whereArguments); int deleted = delete(where.toString(), whereArgs); return deleted; } }
public class class_name { public int deleteByBaseId(long id, GeometryType geometryType) { String geometryTypeName = null; if (geometryType != null) { geometryTypeName = geometryType.getName(); // depends on control dependency: [if], data = [none] } StringBuilder where = new StringBuilder(); where.append(buildWhere(StyleMappingTable.COLUMN_BASE_ID, id)); where.append(" AND "); where.append(buildWhere(StyleMappingTable.COLUMN_GEOMETRY_TYPE_NAME, geometryTypeName)); List<Object> whereArguments = new ArrayList<>(); whereArguments.add(id); if (geometryTypeName != null) { whereArguments.add(geometryTypeName); // depends on control dependency: [if], data = [(geometryTypeName] } String[] whereArgs = buildWhereArgs(whereArguments); int deleted = delete(where.toString(), whereArgs); return deleted; } }
public class class_name { private int getNumBlocks(R delta) { ByteBuffer content = getValue(delta); int numBlocks = 0; // build numBlocks by adding together each hex digit for (int i = 0; i < _prefixLength; i++) { byte b = content.get(i); numBlocks = numBlocks << 4 | (b <= '9' ? b - '0' : b - 'A' + 10); } return numBlocks; } }
public class class_name { private int getNumBlocks(R delta) { ByteBuffer content = getValue(delta); int numBlocks = 0; // build numBlocks by adding together each hex digit for (int i = 0; i < _prefixLength; i++) { byte b = content.get(i); numBlocks = numBlocks << 4 | (b <= '9' ? b - '0' : b - 'A' + 10); // depends on control dependency: [for], data = [none] } return numBlocks; } }
public class class_name { public synchronized SiteNode findClosestParent(HttpMessage msg) { if (msg == null) { return null; } return this.findClosestParent(msg.getRequestHeader().getURI()); } }
public class class_name { public synchronized SiteNode findClosestParent(HttpMessage msg) { if (msg == null) { return null; // depends on control dependency: [if], data = [none] } return this.findClosestParent(msg.getRequestHeader().getURI()); } }
public class class_name { private static void checkBehindCamera(SceneStructureMetric structure, SceneObservations observations, BundleAdjustment<SceneStructureMetric> bundleAdjustment) { int totalBehind = 0; Point3D_F64 X = new Point3D_F64(); for (int i = 0; i < structure.points.length; i++) { structure.points[i].get(X); if( X.z < 0 ) totalBehind++; } structure.views[1].worldToView.T.print(); if( totalBehind > structure.points.length/2 ) { System.out.println("Flipping because it's reversed. score = "+bundleAdjustment.getFitScore()); for (int i = 1; i < structure.views.length; i++) { Se3_F64 w2v = structure.views[i].worldToView; w2v.set(w2v.invert(null)); } triangulatePoints(structure,observations); bundleAdjustment.setParameters(structure,observations); bundleAdjustment.optimize(structure); System.out.println(" after = "+bundleAdjustment.getFitScore()); } else { System.out.println("Points not behind camera. "+totalBehind+" / "+structure.points.length); } } }
public class class_name { private static void checkBehindCamera(SceneStructureMetric structure, SceneObservations observations, BundleAdjustment<SceneStructureMetric> bundleAdjustment) { int totalBehind = 0; Point3D_F64 X = new Point3D_F64(); for (int i = 0; i < structure.points.length; i++) { structure.points[i].get(X); // depends on control dependency: [for], data = [i] if( X.z < 0 ) totalBehind++; } structure.views[1].worldToView.T.print(); if( totalBehind > structure.points.length/2 ) { System.out.println("Flipping because it's reversed. score = "+bundleAdjustment.getFitScore()); for (int i = 1; i < structure.views.length; i++) { Se3_F64 w2v = structure.views[i].worldToView; w2v.set(w2v.invert(null)); } triangulatePoints(structure,observations); bundleAdjustment.setParameters(structure,observations); bundleAdjustment.optimize(structure); System.out.println(" after = "+bundleAdjustment.getFitScore()); } else { System.out.println("Points not behind camera. "+totalBehind+" / "+structure.points.length); } } }
public class class_name { public void setSummaryItems(java.util.Collection<InventoryDeletionSummaryItem> summaryItems) { if (summaryItems == null) { this.summaryItems = null; return; } this.summaryItems = new com.amazonaws.internal.SdkInternalList<InventoryDeletionSummaryItem>(summaryItems); } }
public class class_name { public void setSummaryItems(java.util.Collection<InventoryDeletionSummaryItem> summaryItems) { if (summaryItems == null) { this.summaryItems = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.summaryItems = new com.amazonaws.internal.SdkInternalList<InventoryDeletionSummaryItem>(summaryItems); } }
public class class_name { public String stripUnnecessaryComments(String javaContent, AntlrOptions options) { if (!options.isOptimizeCodeQuality()) { return javaContent; } javaContent = stripMachineDependentPaths(javaContent); if (options.isStripAllComments()) { javaContent = stripAllComments(javaContent); } return javaContent; } }
public class class_name { public String stripUnnecessaryComments(String javaContent, AntlrOptions options) { if (!options.isOptimizeCodeQuality()) { return javaContent; // depends on control dependency: [if], data = [none] } javaContent = stripMachineDependentPaths(javaContent); if (options.isStripAllComments()) { javaContent = stripAllComments(javaContent); // depends on control dependency: [if], data = [none] } return javaContent; } }
public class class_name { public TransitionableState getTransitionableState(final Flow flow, final String stateId) { if (containsFlowState(flow, stateId)) { return (TransitionableState) flow.getTransitionableState(stateId); } return null; } }
public class class_name { public TransitionableState getTransitionableState(final Flow flow, final String stateId) { if (containsFlowState(flow, stateId)) { return (TransitionableState) flow.getTransitionableState(stateId); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { private Expr parseBracketedOrCastExpression(EnclosingScope scope, boolean terminated) { int start = index; match(LeftBrace); // At this point, we must begin to disambiguate casts from general // bracketed expressions. In the case that what follows the left brace // is something which can only be a type, then clearly we have a cast. // However, in the other case, we may still have a cast since many types // cannot be clearly distinguished from expressions at this stage (e.g. // "(nat,nat)" could either be a tuple type (if "nat" is a type) or a // tuple expression (if "nat" is a variable or constant). if (skipType(scope) && tryAndMatch(true, RightBrace) != null) { // must be a cast expression index = start; // backtrack return parseCastExpression(scope, terminated); } else { index = start; // backtrack return parseBracketedExpression(scope, terminated); } } }
public class class_name { private Expr parseBracketedOrCastExpression(EnclosingScope scope, boolean terminated) { int start = index; match(LeftBrace); // At this point, we must begin to disambiguate casts from general // bracketed expressions. In the case that what follows the left brace // is something which can only be a type, then clearly we have a cast. // However, in the other case, we may still have a cast since many types // cannot be clearly distinguished from expressions at this stage (e.g. // "(nat,nat)" could either be a tuple type (if "nat" is a type) or a // tuple expression (if "nat" is a variable or constant). if (skipType(scope) && tryAndMatch(true, RightBrace) != null) { // must be a cast expression index = start; // backtrack // depends on control dependency: [if], data = [none] return parseCastExpression(scope, terminated); // depends on control dependency: [if], data = [none] } else { index = start; // backtrack // depends on control dependency: [if], data = [none] return parseBracketedExpression(scope, terminated); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void formatAndThrowJSLintError(BundleProcessingStatus status, byte[] bundleBytes, JSMinException e) { StringBuilder errorMsg = new StringBuilder( "JSMin failed to minify the bundle with id: '" + status.getCurrentBundle().getId() + "'.\n"); errorMsg.append("The exception thrown is of type:").append(e.getClass().getName()).append("'.\n"); int currentByte = e.getByteIndex(); int startPoint; if (currentByte < 100) startPoint = 0; else startPoint = currentByte - 100; int totalSize = currentByte - startPoint; byte[] lastData = new byte[totalSize]; for (int x = 0; x < totalSize; x++) { lastData[x] = bundleBytes[startPoint]; startPoint++; } errorMsg.append("The error happened at this point in your javascript (line ").append(e.getLine()) .append("; col. ").append(e.getColumn()).append(") : \n"); errorMsg.append("_______________________________________________\n..."); try { String data = byteArrayToString(status.getJawrConfig().getResourceCharset(), lastData).toString(); errorMsg.append(data).append("\n\n"); } catch (IOException e1) { // Ignored, we have enaugh problems by this point. } errorMsg.append("_______________________________________________"); errorMsg.append( "\nIf you can't find the error, try to check the scripts using JSLint (http://www.jslint.com/) to find the conflicting part of the code. "); throw new BundlingProcessException(errorMsg.toString(), e); } }
public class class_name { private void formatAndThrowJSLintError(BundleProcessingStatus status, byte[] bundleBytes, JSMinException e) { StringBuilder errorMsg = new StringBuilder( "JSMin failed to minify the bundle with id: '" + status.getCurrentBundle().getId() + "'.\n"); errorMsg.append("The exception thrown is of type:").append(e.getClass().getName()).append("'.\n"); int currentByte = e.getByteIndex(); int startPoint; if (currentByte < 100) startPoint = 0; else startPoint = currentByte - 100; int totalSize = currentByte - startPoint; byte[] lastData = new byte[totalSize]; for (int x = 0; x < totalSize; x++) { lastData[x] = bundleBytes[startPoint]; // depends on control dependency: [for], data = [x] startPoint++; // depends on control dependency: [for], data = [none] } errorMsg.append("The error happened at this point in your javascript (line ").append(e.getLine()) .append("; col. ").append(e.getColumn()).append(") : \n"); errorMsg.append("_______________________________________________\n..."); try { String data = byteArrayToString(status.getJawrConfig().getResourceCharset(), lastData).toString(); errorMsg.append(data).append("\n\n"); // depends on control dependency: [try], data = [none] } catch (IOException e1) { // Ignored, we have enaugh problems by this point. } // depends on control dependency: [catch], data = [none] errorMsg.append("_______________________________________________"); errorMsg.append( "\nIf you can't find the error, try to check the scripts using JSLint (http://www.jslint.com/) to find the conflicting part of the code. "); throw new BundlingProcessException(errorMsg.toString(), e); } }
public class class_name { public void setCacheable(String cacheable) { if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(cacheable)) { m_cacheable = Boolean.valueOf(cacheable).booleanValue(); } } }
public class class_name { public void setCacheable(String cacheable) { if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(cacheable)) { m_cacheable = Boolean.valueOf(cacheable).booleanValue(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public Frame cloneCropped() { if (cropNeeded()) { return cropped(); } else { Frame clone = createFrame(this); clone.copyFrom(this); return clone; } } }
public class class_name { public Frame cloneCropped() { if (cropNeeded()) { return cropped(); // depends on control dependency: [if], data = [none] } else { Frame clone = createFrame(this); clone.copyFrom(this); // depends on control dependency: [if], data = [none] return clone; // depends on control dependency: [if], data = [none] } } }
public class class_name { private double calcNiceNumber(final double RANGE, final boolean ROUND) { final double EXPONENT = Math.floor(Math.log10(RANGE)); // exponent of range final double FRACTION = RANGE / Math.pow(10, EXPONENT); // fractional part of range // nice, rounded fraction final double NICE_FRACTION; if (ROUND) { if (FRACTION < 1.5) { NICE_FRACTION = 1; } else if (FRACTION < 3) { NICE_FRACTION = 2; } else if (FRACTION < 7) { NICE_FRACTION = 5; } else { NICE_FRACTION = 10; } } else { if (FRACTION <= 1) { NICE_FRACTION = 1; } else if (FRACTION <= 2) { NICE_FRACTION = 2; } else if (FRACTION <= 5) { NICE_FRACTION = 5; } else { NICE_FRACTION = 10; } } return NICE_FRACTION * Math.pow(10, EXPONENT); } }
public class class_name { private double calcNiceNumber(final double RANGE, final boolean ROUND) { final double EXPONENT = Math.floor(Math.log10(RANGE)); // exponent of range final double FRACTION = RANGE / Math.pow(10, EXPONENT); // fractional part of range // nice, rounded fraction final double NICE_FRACTION; if (ROUND) { if (FRACTION < 1.5) { NICE_FRACTION = 1; // depends on control dependency: [if], data = [none] } else if (FRACTION < 3) { NICE_FRACTION = 2; // depends on control dependency: [if], data = [none] } else if (FRACTION < 7) { NICE_FRACTION = 5; // depends on control dependency: [if], data = [none] } else { NICE_FRACTION = 10; // depends on control dependency: [if], data = [none] } } else { if (FRACTION <= 1) { NICE_FRACTION = 1; // depends on control dependency: [if], data = [none] } else if (FRACTION <= 2) { NICE_FRACTION = 2; // depends on control dependency: [if], data = [none] } else if (FRACTION <= 5) { NICE_FRACTION = 5; // depends on control dependency: [if], data = [none] } else { NICE_FRACTION = 10; // depends on control dependency: [if], data = [none] } } return NICE_FRACTION * Math.pow(10, EXPONENT); } }
public class class_name { public static String generateAes128KeyWithSeed(String seed) { String returnKey = null; try { SecureRandom rand = SecureRandom.getInstance("SHA1PRNG"); byte[] salt = new byte[16]; rand.nextBytes(salt); PBEKeySpec password = new PBEKeySpec(seed.toCharArray(), salt, 1000, 128); SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1"); PBEKey key = (PBEKey) factory.generateSecret(password); SecretKey secretKey = new SecretKeySpec(key.getEncoded(), "AES"); StringBuffer keyBuffer = new StringBuffer(); for (byte b : secretKey.getEncoded()) { int i = Integer.parseInt(String.format("%d", b)); int j = (Math.abs(i) % 54) + 40; // A chunk of the ASCII table. // Clean up a few characters that could be problematic in JSON // or a query parameter. Others should be URL encoded by the user. switch (j) { case 47: // Replace '/' with '!'. j = 33; break; case 61: // Replace '=' with 'z'. j = 122; case 92: // Replace '\' with '#'. j = 35; break; } keyBuffer.append((char) j); } returnKey = keyBuffer.toString(); } catch (InvalidKeySpecException e) { log.error("Could not find desired key specificatio."); log.debug(e.toString()); } catch (NoSuchAlgorithmException e) { log.error("Could not find encryption algorithm."); log.debug(e.toString()); } return returnKey; } }
public class class_name { public static String generateAes128KeyWithSeed(String seed) { String returnKey = null; try { SecureRandom rand = SecureRandom.getInstance("SHA1PRNG"); byte[] salt = new byte[16]; rand.nextBytes(salt); // depends on control dependency: [try], data = [none] PBEKeySpec password = new PBEKeySpec(seed.toCharArray(), salt, 1000, 128); SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1"); PBEKey key = (PBEKey) factory.generateSecret(password); SecretKey secretKey = new SecretKeySpec(key.getEncoded(), "AES"); StringBuffer keyBuffer = new StringBuffer(); for (byte b : secretKey.getEncoded()) { int i = Integer.parseInt(String.format("%d", b)); int j = (Math.abs(i) % 54) + 40; // A chunk of the ASCII table. // Clean up a few characters that could be problematic in JSON // or a query parameter. Others should be URL encoded by the user. switch (j) { case 47: // Replace '/' with '!'. j = 33; break; case 61: // Replace '=' with 'z'. j = 122; case 92: // Replace '\' with '#'. j = 35; break; } keyBuffer.append((char) j); // depends on control dependency: [for], data = [none] } returnKey = keyBuffer.toString(); // depends on control dependency: [try], data = [none] } catch (InvalidKeySpecException e) { log.error("Could not find desired key specificatio."); log.debug(e.toString()); } catch (NoSuchAlgorithmException e) { // depends on control dependency: [catch], data = [none] log.error("Could not find encryption algorithm."); log.debug(e.toString()); } // depends on control dependency: [catch], data = [none] return returnKey; } }
public class class_name { public void setServerRole(final String iServerName, final ROLES role) { synchronized (configuration) { ODocument servers = configuration.field(SERVERS); if (servers == null) { servers = new ODocument(); configuration.field(SERVERS, servers, OType.EMBEDDED); } servers.field(iServerName, role); incrementVersion(); } } }
public class class_name { public void setServerRole(final String iServerName, final ROLES role) { synchronized (configuration) { ODocument servers = configuration.field(SERVERS); if (servers == null) { servers = new ODocument(); // depends on control dependency: [if], data = [none] configuration.field(SERVERS, servers, OType.EMBEDDED); // depends on control dependency: [if], data = [none] } servers.field(iServerName, role); incrementVersion(); } } }
public class class_name { @Override public Object getAttribute( final String name ) { if (filterAttribute(name)) { _attributesAccessed = true; } return super.getAttribute( name ); } }
public class class_name { @Override public Object getAttribute( final String name ) { if (filterAttribute(name)) { _attributesAccessed = true; // depends on control dependency: [if], data = [none] } return super.getAttribute( name ); } }
public class class_name { @Override public String toNormalizedString() { String result; if(hasNoStringCache() || (result = getStringCache().normalizedString) == null) { getStringCache().normalizedString = result = toNormalizedString(IPv6StringCache.normalizedParams); } return result; } }
public class class_name { @Override public String toNormalizedString() { String result; if(hasNoStringCache() || (result = getStringCache().normalizedString) == null) { getStringCache().normalizedString = result = toNormalizedString(IPv6StringCache.normalizedParams); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { public synchronized void stopThread() { if (isRunning()) { if (log.isInfoEnabled()) log.info("[Daemon] {stopThread} Requesting termination of thread " + thisThread.getName()); this.running = false; synchronized (this) { this.notifyAll(); } } else { throw new IllegalThreadStateException("Daemon must be started before it may be stopped."); } } }
public class class_name { public synchronized void stopThread() { if (isRunning()) { if (log.isInfoEnabled()) log.info("[Daemon] {stopThread} Requesting termination of thread " + thisThread.getName()); this.running = false; // depends on control dependency: [if], data = [none] synchronized (this) // depends on control dependency: [if], data = [none] { this.notifyAll(); } } else { throw new IllegalThreadStateException("Daemon must be started before it may be stopped."); } } }
public class class_name { protected Bitmap checkIfDrawn(Bitmap bitmap) { if (isTransparent(bitmap)) { bitmap.recycle(); bitmap = null; } return bitmap; } }
public class class_name { protected Bitmap checkIfDrawn(Bitmap bitmap) { if (isTransparent(bitmap)) { bitmap.recycle(); // depends on control dependency: [if], data = [none] bitmap = null; // depends on control dependency: [if], data = [none] } return bitmap; } }
public class class_name { @Override public boolean before(final MethodCall methodCall) { final Optional<HttpRequest> httpRequest = findHttpRequest(methodCall); if (httpRequest.isPresent()) { extractRequestInfoAndPutItIntoMappedDiagnosticContext(httpRequest.get()); } return true; } }
public class class_name { @Override public boolean before(final MethodCall methodCall) { final Optional<HttpRequest> httpRequest = findHttpRequest(methodCall); if (httpRequest.isPresent()) { extractRequestInfoAndPutItIntoMappedDiagnosticContext(httpRequest.get()); // depends on control dependency: [if], data = [none] } return true; } }
public class class_name { private CompletableFuture<MetadataResponse> getMetadata() { CompletableFuture<MetadataResponse> future = new CompletableFuture<>(); connection.metadata(MetadataRequest.builder().build()).whenComplete((response, error) -> { if (error == null) { if (response.status() == RaftResponse.Status.OK) { future.complete(response); } else { future.completeExceptionally(response.error().createException()); } } else { future.completeExceptionally(error); } }); return future; } }
public class class_name { private CompletableFuture<MetadataResponse> getMetadata() { CompletableFuture<MetadataResponse> future = new CompletableFuture<>(); connection.metadata(MetadataRequest.builder().build()).whenComplete((response, error) -> { if (error == null) { if (response.status() == RaftResponse.Status.OK) { future.complete(response); // depends on control dependency: [if], data = [none] } else { future.completeExceptionally(response.error().createException()); // depends on control dependency: [if], data = [none] } } else { future.completeExceptionally(error); // depends on control dependency: [if], data = [(error] } }); return future; } }
public class class_name { public Object sendMessageAndGetReply() throws RemoteException { URL url = null; try { url = this.getProxyURL(); } catch (MalformedURLException ex) { ex.printStackTrace(); return null; } ServletMessage servlet = new ServletMessage(url); while (true) { // to allow for retry on timeout long time = 0; try { time = System.currentTimeMillis(); InputStream in = servlet.sendMessage(m_properties); InputStreamReader reader = new InputStreamReader(in); BufferedReader buffReader = new BufferedReader(reader); String string = Constants.BLANK; while (true) { String str = buffReader.readLine(); if ((str == null) || (str.length() == 0)) break; if (string.length() > 0) string += "\n"; string += str; } return string; } catch (IOException ex) { if (System.currentTimeMillis() > time + MAX_WAIT_TIME) continue; // Server timeout, try again throw new RemoteException(ex.getMessage() + ' ' + url, ex.getCause()); } } } }
public class class_name { public Object sendMessageAndGetReply() throws RemoteException { URL url = null; try { url = this.getProxyURL(); } catch (MalformedURLException ex) { ex.printStackTrace(); return null; } ServletMessage servlet = new ServletMessage(url); while (true) { // to allow for retry on timeout long time = 0; try { time = System.currentTimeMillis(); // depends on control dependency: [try], data = [none] InputStream in = servlet.sendMessage(m_properties); InputStreamReader reader = new InputStreamReader(in); BufferedReader buffReader = new BufferedReader(reader); String string = Constants.BLANK; while (true) { String str = buffReader.readLine(); if ((str == null) || (str.length() == 0)) break; if (string.length() > 0) string += "\n"; string += str; // depends on control dependency: [while], data = [none] } return string; // depends on control dependency: [try], data = [none] } catch (IOException ex) { if (System.currentTimeMillis() > time + MAX_WAIT_TIME) continue; // Server timeout, try again throw new RemoteException(ex.getMessage() + ' ' + url, ex.getCause()); } // depends on control dependency: [catch], data = [none] } } }