code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public final void setContext(Kind c) { //NOTE: Put context specific link code here. switch (c) { case ALL_CLASSES_FRAME: case PACKAGE_FRAME: case IMPLEMENTED_CLASSES: case SUBCLASSES: case METHOD_DOC_COPY: case FIELD_DOC_COPY: case PROPERTY_DOC_COPY: case CLASS_USE_HEADER: includeTypeInClassLinkLabel = false; break; case ANNOTATION: excludeTypeParameterLinks = true; excludeTypeBounds = true; break; case IMPLEMENTED_INTERFACES: case SUPER_INTERFACES: case SUBINTERFACES: case CLASS_TREE_PARENT: case TREE: case CLASS_SIGNATURE_PARENT_NAME: excludeTypeParameterLinks = true; excludeTypeBounds = true; includeTypeInClassLinkLabel = false; includeTypeAsSepLink = true; break; case PACKAGE: case CLASS_USE: case CLASS_HEADER: case CLASS_SIGNATURE: excludeTypeParameterLinks = true; includeTypeAsSepLink = true; includeTypeInClassLinkLabel = false; break; case MEMBER_TYPE_PARAMS: includeTypeAsSepLink = true; includeTypeInClassLinkLabel = false; break; case RETURN_TYPE: case SUMMARY_RETURN_TYPE: excludeTypeBounds = true; break; case EXECUTABLE_MEMBER_PARAM: excludeTypeBounds = true; break; } context = c; if (type != null && type.asTypeVariable()!= null && type.asTypeVariable().owner() instanceof ExecutableMemberDoc) { excludeTypeParameterLinks = true; } } }
public class class_name { public final void setContext(Kind c) { //NOTE: Put context specific link code here. switch (c) { case ALL_CLASSES_FRAME: case PACKAGE_FRAME: case IMPLEMENTED_CLASSES: case SUBCLASSES: case METHOD_DOC_COPY: case FIELD_DOC_COPY: case PROPERTY_DOC_COPY: case CLASS_USE_HEADER: includeTypeInClassLinkLabel = false; break; case ANNOTATION: excludeTypeParameterLinks = true; excludeTypeBounds = true; break; case IMPLEMENTED_INTERFACES: case SUPER_INTERFACES: case SUBINTERFACES: case CLASS_TREE_PARENT: case TREE: case CLASS_SIGNATURE_PARENT_NAME: excludeTypeParameterLinks = true; excludeTypeBounds = true; includeTypeInClassLinkLabel = false; includeTypeAsSepLink = true; break; case PACKAGE: case CLASS_USE: case CLASS_HEADER: case CLASS_SIGNATURE: excludeTypeParameterLinks = true; includeTypeAsSepLink = true; includeTypeInClassLinkLabel = false; break; case MEMBER_TYPE_PARAMS: includeTypeAsSepLink = true; includeTypeInClassLinkLabel = false; break; case RETURN_TYPE: case SUMMARY_RETURN_TYPE: excludeTypeBounds = true; break; case EXECUTABLE_MEMBER_PARAM: excludeTypeBounds = true; break; } context = c; if (type != null && type.asTypeVariable()!= null && type.asTypeVariable().owner() instanceof ExecutableMemberDoc) { excludeTypeParameterLinks = true; // depends on control dependency: [if], data = [none] } } }
public class class_name { private static String generateAliasRoot(String description) { String result = truncate(unqualifyEntityName(description), ALIAS_TRUNCATE_LENGTH) // Important to use Locale.ENGLISH. See HHH-8579. #toLowerCase() uses the default Locale. Certain DBs // do not like non-ascii characters in aliases, etc., so ensure consistency/portability here. .toLowerCase(Locale.ENGLISH) .replace('/', '_') // entityNames may now include slashes for the representations .replace('$', '_'); //classname may be an inner class result = cleanAlias(result); if (Character.isDigit(result.charAt(result.length() - 1))) { return result + "x"; //ick! } else { return result; } } }
public class class_name { private static String generateAliasRoot(String description) { String result = truncate(unqualifyEntityName(description), ALIAS_TRUNCATE_LENGTH) // Important to use Locale.ENGLISH. See HHH-8579. #toLowerCase() uses the default Locale. Certain DBs // do not like non-ascii characters in aliases, etc., so ensure consistency/portability here. .toLowerCase(Locale.ENGLISH) .replace('/', '_') // entityNames may now include slashes for the representations .replace('$', '_'); //classname may be an inner class result = cleanAlias(result); if (Character.isDigit(result.charAt(result.length() - 1))) { return result + "x"; //ick! // depends on control dependency: [if], data = [none] } else { return result; // depends on control dependency: [if], data = [none] } } }
public class class_name { protected synchronized void invoke() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "invoke"); try { listener.errorOccurred(exception, segmentType, requestNumber, priority, conversation); } catch(Throwable t) { FFDCFilter.processException (t, "com.ibm.ws.sib.jfapchannel.impl.rldispatcher.ConversationReceiveListenerErrorOccurredInvocation", JFapChannelConstants.CRLERROROCCURREDINVOKE_INVOKE_01); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "exception thrown by conversation receive listener"); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.exception(this, tc, t); connection.invalidate(true, t, "exception thrown in errorOccurred method - "+t.getMessage()); // D224570 } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "invoke"); } }
public class class_name { protected synchronized void invoke() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "invoke"); try { listener.errorOccurred(exception, segmentType, requestNumber, priority, conversation); // depends on control dependency: [try], data = [exception] } catch(Throwable t) { FFDCFilter.processException (t, "com.ibm.ws.sib.jfapchannel.impl.rldispatcher.ConversationReceiveListenerErrorOccurredInvocation", JFapChannelConstants.CRLERROROCCURREDINVOKE_INVOKE_01); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "exception thrown by conversation receive listener"); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.exception(this, tc, t); connection.invalidate(true, t, "exception thrown in errorOccurred method - "+t.getMessage()); // D224570 } // depends on control dependency: [catch], data = [none] if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "invoke"); } }
public class class_name { public void productPay(ProductPayRequest requ, final ProductPayHandler handler) { HMSAgentLog.i("productPay:requ=" + StrUtils.objDesc(requ) + " handler=" + StrUtils.objDesc(handler)); if (payReq != null) { HMSAgentLog.e("productPay:has already a pay to dispose"); if (handler != null) { new Handler(Looper.getMainLooper()).post(new CallbackResultRunnable<ProductPayResultInfo>(handler, HMSAgent.AgentResultCode.REQUEST_REPEATED, null)); } return; } this.payReq = requ; this.handler = handler; retryTimes = MAX_RETRY_TIMES; connect(); } }
public class class_name { public void productPay(ProductPayRequest requ, final ProductPayHandler handler) { HMSAgentLog.i("productPay:requ=" + StrUtils.objDesc(requ) + " handler=" + StrUtils.objDesc(handler)); if (payReq != null) { HMSAgentLog.e("productPay:has already a pay to dispose"); // depends on control dependency: [if], data = [none] if (handler != null) { new Handler(Looper.getMainLooper()).post(new CallbackResultRunnable<ProductPayResultInfo>(handler, HMSAgent.AgentResultCode.REQUEST_REPEATED, null)); // depends on control dependency: [if], data = [(handler] } return; // depends on control dependency: [if], data = [none] } this.payReq = requ; this.handler = handler; retryTimes = MAX_RETRY_TIMES; connect(); } }
public class class_name { @SuppressWarnings("unchecked") public static void onSaveState(Bundle bundle) { final ArrayList<Style> styleList = new ArrayList(); // Create a list of every Style used by a SuperToast in the queue for (SuperToast superToast : Toaster.getInstance().getQueue()) { if (superToast instanceof SuperActivityToast) { superToast.getStyle().isSuperActivityToast = true; } styleList.add(superToast.getStyle()); } bundle.putParcelableArrayList(BUNDLE_KEY, styleList); // Let's avoid any erratic behavior and cancel any showing/pending SuperActivityToasts manually Toaster.getInstance().cancelAllSuperToasts(); } }
public class class_name { @SuppressWarnings("unchecked") public static void onSaveState(Bundle bundle) { final ArrayList<Style> styleList = new ArrayList(); // Create a list of every Style used by a SuperToast in the queue for (SuperToast superToast : Toaster.getInstance().getQueue()) { if (superToast instanceof SuperActivityToast) { superToast.getStyle().isSuperActivityToast = true; // depends on control dependency: [if], data = [none] } styleList.add(superToast.getStyle()); // depends on control dependency: [for], data = [superToast] } bundle.putParcelableArrayList(BUNDLE_KEY, styleList); // Let's avoid any erratic behavior and cancel any showing/pending SuperActivityToasts manually Toaster.getInstance().cancelAllSuperToasts(); } }
public class class_name { public EncryptionConfiguration withS3Encryption(S3Encryption... s3Encryption) { if (this.s3Encryption == null) { setS3Encryption(new java.util.ArrayList<S3Encryption>(s3Encryption.length)); } for (S3Encryption ele : s3Encryption) { this.s3Encryption.add(ele); } return this; } }
public class class_name { public EncryptionConfiguration withS3Encryption(S3Encryption... s3Encryption) { if (this.s3Encryption == null) { setS3Encryption(new java.util.ArrayList<S3Encryption>(s3Encryption.length)); // depends on control dependency: [if], data = [none] } for (S3Encryption ele : s3Encryption) { this.s3Encryption.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public OutlierResult run(Relation<V> relation) { final DBIDs ids = relation.getDBIDs(); KNNQuery<V> knnQuery = QueryUtil.getKNNQuery(relation, getDistanceFunction(), k + 1); final int dim = RelationUtil.dimensionality(relation); if(k <= dim + 1) { LOG.warning("PCA is underspecified with a too low k! k should be at much larger than " + dim); } WritableDoubleDataStore cop_score = DataStoreUtil.makeDoubleStorage(ids, DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_STATIC); WritableDataStore<double[]> cop_err_v = models ? DataStoreUtil.makeStorage(ids, DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_STATIC, double[].class) : null; WritableIntegerDataStore cop_dim = models ? DataStoreUtil.makeIntegerStorage(ids, DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_STATIC, -1) : null; // compute neighbors of each db object FiniteProgress prog = LOG.isVerbose() ? new FiniteProgress("Correlation Outlier Probabilities", relation.size(), LOG) : null; double[] centroid = new double[dim]; double[] scores = new double[dim]; ModifiableDBIDs nids = DBIDUtil.newHashSet(k + 10); for(DBIDIter id = ids.iter(); id.valid(); id.advance()) { nids.clear(); nids.addDBIDs(knnQuery.getKNNForDBID(id, k + 1)); nids.remove(id); // Do not use query object computeCentroid(centroid, relation, nids); PCAResult pcares = pca.processIds(nids, relation); double[][] tevecs = pcares.getEigenvectors(); double[] evs = pcares.getEigenvalues(); double[] projected = times(tevecs, minusEquals(relation.get(id).toArray(), centroid)); if(dist == DistanceDist.CHISQUARED) { double sqdevs = 0; for(int d = 0; d < dim; d++) { double dev = projected[d]; // Scale with variance and accumulate sqdevs += dev * dev / evs[d]; scores[d] = 1 - ChiSquaredDistribution.cdf(sqdevs, d + 1); } } else { assert (dist == DistanceDist.GAMMA); double[][] dists = new double[dim][nids.size()]; int j = 0; double[] srel = new double[dim]; for(DBIDIter s = nids.iter(); s.valid() && j < nids.size(); s.advance(), j++) { V vec = relation.get(s); for(int d = 0; d < dim; d++) { srel[d] = vec.doubleValue(d) - centroid[d]; } double sqdist = 0.0; for(int d = 0; d < dim; d++) { double serrd = transposeTimes(tevecs[d], srel); dists[d][j] = (sqdist += serrd * serrd / evs[d]); } } double sqdevs = 0; for(int d = 0; d < dim; d++) { // Scale with Stddev final double dev = projected[d]; // Accumulate sqdevs += dev * dev / evs[d]; // Sort, so we can trim the top 15% below. Arrays.sort(dists[d]); // Evaluate scores[d] = 1 - GammaChoiWetteEstimator.STATIC.estimate(dists[d], SHORTENED_ARRAY).cdf(sqdevs); } } // Find best score double min = Double.POSITIVE_INFINITY; int vdim = dim - 1; for(int d = 0; d < dim; d++) { double v = scores[d]; if(v < min) { min = v; vdim = d; } } // Normalize the value final double prob = expect * (1 - min) / (expect + min); cop_score.putDouble(id, prob); if(models) { // Construct the error vector: Arrays.fill(projected, vdim + 1, dim, 0.); cop_err_v.put(id, timesEquals(transposeTimes(tevecs, projected), -prob)); cop_dim.putInt(id, dim - vdim); } LOG.incrementProcessed(prog); } LOG.ensureCompleted(prog); // combine results. DoubleRelation scoreResult = new MaterializedDoubleRelation("Correlation Outlier Probabilities", COP_SCORES, cop_score, ids); OutlierScoreMeta scoreMeta = new ProbabilisticOutlierScore(); OutlierResult result = new OutlierResult(scoreMeta, scoreResult); if(models) { result.addChildResult(new MaterializedRelation<>("Local Dimensionality", COP_DIM, TypeUtil.INTEGER, cop_dim, ids)); result.addChildResult(new MaterializedRelation<>("Error vectors", COP_ERRORVEC, TypeUtil.DOUBLE_ARRAY, cop_err_v, ids)); } return result; } }
public class class_name { public OutlierResult run(Relation<V> relation) { final DBIDs ids = relation.getDBIDs(); KNNQuery<V> knnQuery = QueryUtil.getKNNQuery(relation, getDistanceFunction(), k + 1); final int dim = RelationUtil.dimensionality(relation); if(k <= dim + 1) { LOG.warning("PCA is underspecified with a too low k! k should be at much larger than " + dim); // depends on control dependency: [if], data = [none] } WritableDoubleDataStore cop_score = DataStoreUtil.makeDoubleStorage(ids, DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_STATIC); WritableDataStore<double[]> cop_err_v = models ? DataStoreUtil.makeStorage(ids, DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_STATIC, double[].class) : null; WritableIntegerDataStore cop_dim = models ? DataStoreUtil.makeIntegerStorage(ids, DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_STATIC, -1) : null; // compute neighbors of each db object FiniteProgress prog = LOG.isVerbose() ? new FiniteProgress("Correlation Outlier Probabilities", relation.size(), LOG) : null; double[] centroid = new double[dim]; double[] scores = new double[dim]; ModifiableDBIDs nids = DBIDUtil.newHashSet(k + 10); for(DBIDIter id = ids.iter(); id.valid(); id.advance()) { nids.clear(); // depends on control dependency: [for], data = [none] nids.addDBIDs(knnQuery.getKNNForDBID(id, k + 1)); // depends on control dependency: [for], data = [id] nids.remove(id); // Do not use query object // depends on control dependency: [for], data = [id] computeCentroid(centroid, relation, nids); // depends on control dependency: [for], data = [none] PCAResult pcares = pca.processIds(nids, relation); double[][] tevecs = pcares.getEigenvectors(); double[] evs = pcares.getEigenvalues(); double[] projected = times(tevecs, minusEquals(relation.get(id).toArray(), centroid)); if(dist == DistanceDist.CHISQUARED) { double sqdevs = 0; for(int d = 0; d < dim; d++) { double dev = projected[d]; // Scale with variance and accumulate sqdevs += dev * dev / evs[d]; // depends on control dependency: [for], data = [d] scores[d] = 1 - ChiSquaredDistribution.cdf(sqdevs, d + 1); // depends on control dependency: [for], data = [d] } } else { assert (dist == DistanceDist.GAMMA); // depends on control dependency: [if], data = [(dist] double[][] dists = new double[dim][nids.size()]; int j = 0; double[] srel = new double[dim]; for(DBIDIter s = nids.iter(); s.valid() && j < nids.size(); s.advance(), j++) { V vec = relation.get(s); for(int d = 0; d < dim; d++) { srel[d] = vec.doubleValue(d) - centroid[d]; // depends on control dependency: [for], data = [d] } double sqdist = 0.0; for(int d = 0; d < dim; d++) { double serrd = transposeTimes(tevecs[d], srel); dists[d][j] = (sqdist += serrd * serrd / evs[d]); // depends on control dependency: [for], data = [d] } } double sqdevs = 0; for(int d = 0; d < dim; d++) { // Scale with Stddev final double dev = projected[d]; // Accumulate sqdevs += dev * dev / evs[d]; // depends on control dependency: [for], data = [d] // Sort, so we can trim the top 15% below. Arrays.sort(dists[d]); // depends on control dependency: [for], data = [d] // Evaluate scores[d] = 1 - GammaChoiWetteEstimator.STATIC.estimate(dists[d], SHORTENED_ARRAY).cdf(sqdevs); // depends on control dependency: [for], data = [d] } } // Find best score double min = Double.POSITIVE_INFINITY; int vdim = dim - 1; for(int d = 0; d < dim; d++) { double v = scores[d]; if(v < min) { min = v; // depends on control dependency: [if], data = [none] vdim = d; // depends on control dependency: [if], data = [none] } } // Normalize the value final double prob = expect * (1 - min) / (expect + min); cop_score.putDouble(id, prob); // depends on control dependency: [for], data = [id] if(models) { // Construct the error vector: Arrays.fill(projected, vdim + 1, dim, 0.); // depends on control dependency: [if], data = [none] cop_err_v.put(id, timesEquals(transposeTimes(tevecs, projected), -prob)); // depends on control dependency: [if], data = [none] cop_dim.putInt(id, dim - vdim); // depends on control dependency: [if], data = [none] } LOG.incrementProcessed(prog); // depends on control dependency: [for], data = [none] } LOG.ensureCompleted(prog); // combine results. DoubleRelation scoreResult = new MaterializedDoubleRelation("Correlation Outlier Probabilities", COP_SCORES, cop_score, ids); OutlierScoreMeta scoreMeta = new ProbabilisticOutlierScore(); OutlierResult result = new OutlierResult(scoreMeta, scoreResult); if(models) { result.addChildResult(new MaterializedRelation<>("Local Dimensionality", COP_DIM, TypeUtil.INTEGER, cop_dim, ids)); // depends on control dependency: [if], data = [none] result.addChildResult(new MaterializedRelation<>("Error vectors", COP_ERRORVEC, TypeUtil.DOUBLE_ARRAY, cop_err_v, ids)); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { public void setStringListValues(java.util.Collection<String> stringListValues) { if (stringListValues == null) { this.stringListValues = null; return; } this.stringListValues = new com.amazonaws.internal.SdkInternalList<String>(stringListValues); } }
public class class_name { public void setStringListValues(java.util.Collection<String> stringListValues) { if (stringListValues == null) { this.stringListValues = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.stringListValues = new com.amazonaws.internal.SdkInternalList<String>(stringListValues); } }
public class class_name { public void setCACertificatePath(Path caCertificatePath) { try { _caCertificatePath = caCertificatePath.toRealPath().toString(); } catch (IOException e) { throw new RuntimeException(e); } } }
public class class_name { public void setCACertificatePath(Path caCertificatePath) { try { _caCertificatePath = caCertificatePath.toRealPath().toString(); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void addPut(Object key, boolean remote) { if (!isEnabled()) { return; } syncOffer(remote ? Stat.REMOTE_PUT : Stat.LOCAL_PUT, key); } }
public class class_name { public void addPut(Object key, boolean remote) { if (!isEnabled()) { return; // depends on control dependency: [if], data = [none] } syncOffer(remote ? Stat.REMOTE_PUT : Stat.LOCAL_PUT, key); } }
public class class_name { public void disable() { if (disabled.compareAndSet(false, true)) { LOG.info("Locking mechanism has been disabled in {}", webcam); if (updater != null) { updater.interrupt(); } } } }
public class class_name { public void disable() { if (disabled.compareAndSet(false, true)) { LOG.info("Locking mechanism has been disabled in {}", webcam); // depends on control dependency: [if], data = [none] if (updater != null) { updater.interrupt(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private String getElementURI() { String uri = null; // At this point in processing we have received all the // namespace mappings // As we still don't know the elements namespace, // we now figure it out. String prefix = getPrefixPart(m_elemContext.m_elementName); if (prefix == null) { // no prefix so lookup the URI of the default namespace uri = m_prefixMap.lookupNamespace(""); } else { uri = m_prefixMap.lookupNamespace(prefix); } if (uri == null) { // We didn't find the namespace for the // prefix ... ouch, that shouldn't happen. // This is a hack, we really don't know // the namespace uri = EMPTYSTRING; } return uri; } }
public class class_name { private String getElementURI() { String uri = null; // At this point in processing we have received all the // namespace mappings // As we still don't know the elements namespace, // we now figure it out. String prefix = getPrefixPart(m_elemContext.m_elementName); if (prefix == null) { // no prefix so lookup the URI of the default namespace uri = m_prefixMap.lookupNamespace(""); // depends on control dependency: [if], data = [none] } else { uri = m_prefixMap.lookupNamespace(prefix); // depends on control dependency: [if], data = [(prefix] } if (uri == null) { // We didn't find the namespace for the // prefix ... ouch, that shouldn't happen. // This is a hack, we really don't know // the namespace uri = EMPTYSTRING; // depends on control dependency: [if], data = [none] } return uri; } }
public class class_name { public void removeRelationshipsWithMappingTable(String mappingTable) { try { if (extendedRelationsDao.isTableExists()) { List<ExtendedRelation> extendedRelations = getRelations(null, null, mappingTable); for (ExtendedRelation extendedRelation : extendedRelations) { removeRelationship(extendedRelation); } } } catch (SQLException e) { throw new GeoPackageException( "Failed to remove relationships for mapping table: " + mappingTable, e); } } }
public class class_name { public void removeRelationshipsWithMappingTable(String mappingTable) { try { if (extendedRelationsDao.isTableExists()) { List<ExtendedRelation> extendedRelations = getRelations(null, null, mappingTable); for (ExtendedRelation extendedRelation : extendedRelations) { removeRelationship(extendedRelation); // depends on control dependency: [for], data = [extendedRelation] } } } catch (SQLException e) { throw new GeoPackageException( "Failed to remove relationships for mapping table: " + mappingTable, e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void reportServiceException(UniformInterfaceException ex, boolean showNotification) { QueryPanel qp = searchView.getControlPanel().getQueryPanel(); String caption = null; String description = null; if(!AnnisBaseUI.handleCommonError(ex, "execute query")) { switch (ex.getResponse().getStatus()) { case 400: List<AqlParseError> errors = ex.getResponse().getEntity( new GenericType<List<AqlParseError>>() { }); caption = "Parsing error"; description = Joiner.on("\n").join(errors); qp.setStatus(description); qp.setErrors(errors); break; case 504: caption = "Timeout"; description = "Query execution took too long."; qp.setStatus(caption + ": " + description); break; case 403: if(Helper.getUser() == null) { // not logged in qp.setStatus("You don't have the access rights to query this corpus. " + "You might want to login to access more corpora."); searchView.getMainToolbar().showLoginWindow(true); } else { // logged in but wrong user caption = "You don't have the access rights to query this corpus. " + "You might want to login as another user to access more corpora."; qp.setStatus(caption); } break; default: log.error( "Exception when communicating with service", ex); qp.setStatus("Unexpected exception: " + ex.getMessage()); ExceptionDialog.show(ex, "Exception when communicating with service."); break; } if (showNotification && caption != null) { Notification.show(caption, description, Notification.Type.WARNING_MESSAGE); } } } }
public class class_name { public void reportServiceException(UniformInterfaceException ex, boolean showNotification) { QueryPanel qp = searchView.getControlPanel().getQueryPanel(); String caption = null; String description = null; if(!AnnisBaseUI.handleCommonError(ex, "execute query")) { switch (ex.getResponse().getStatus()) { case 400: List<AqlParseError> errors = ex.getResponse().getEntity( new GenericType<List<AqlParseError>>() { }); caption = "Parsing error"; description = Joiner.on("\n").join(errors); qp.setStatus(description); qp.setErrors(errors); break; case 504: caption = "Timeout"; description = "Query execution took too long."; qp.setStatus(caption + ": " + description); break; case 403: if(Helper.getUser() == null) { // not logged in qp.setStatus("You don't have the access rights to query this corpus. " + "You might want to login to access more corpora."); searchView.getMainToolbar().showLoginWindow(true); } else { // logged in but wrong user caption = "You don't have the access rights to query this corpus. " + "You might want to login as another user to access more corpora."; qp.setStatus(caption); } break; default: log.error( "Exception when communicating with service", ex); // depends on control dependency: [if], data = [none] qp.setStatus("Unexpected exception: " + ex.getMessage()); // depends on control dependency: [if], data = [none] ExceptionDialog.show(ex, "Exception when communicating with service."); // depends on control dependency: [if], data = [none] break; } if (showNotification && caption != null) { Notification.show(caption, description, Notification.Type.WARNING_MESSAGE); // depends on control dependency: [if], data = [none] } } } }
public class class_name { static String hexStrToStr(String s) { StringBuilder ret = new StringBuilder(); for (int i = 0; i < s.length(); i += 2) { ret.append((char) Integer.parseInt(s.substring(i, i + 2), 16)); } return ret.toString(); } }
public class class_name { static String hexStrToStr(String s) { StringBuilder ret = new StringBuilder(); for (int i = 0; i < s.length(); i += 2) { ret.append((char) Integer.parseInt(s.substring(i, i + 2), 16)); // depends on control dependency: [for], data = [i] } return ret.toString(); } }
public class class_name { @NotNull public OptionalDouble findSingle() { if (!iterator.hasNext()) { return OptionalDouble.empty(); } final double singleCandidate = iterator.nextDouble(); if (iterator.hasNext()) { throw new IllegalStateException("DoubleStream contains more than one element"); } return OptionalDouble.of(singleCandidate); } }
public class class_name { @NotNull public OptionalDouble findSingle() { if (!iterator.hasNext()) { return OptionalDouble.empty(); // depends on control dependency: [if], data = [none] } final double singleCandidate = iterator.nextDouble(); if (iterator.hasNext()) { throw new IllegalStateException("DoubleStream contains more than one element"); } return OptionalDouble.of(singleCandidate); } }
public class class_name { @Override public void unbindView() { RecyclerView contentView = getContentView(); if (contentView != null && mSwipeItemTouchListener != null) { contentView.removeOnItemTouchListener(mSwipeItemTouchListener); mSwipeItemTouchListener = null; contentView.removeCallbacks(updateRunnable); } super.unbindView(); } }
public class class_name { @Override public void unbindView() { RecyclerView contentView = getContentView(); if (contentView != null && mSwipeItemTouchListener != null) { contentView.removeOnItemTouchListener(mSwipeItemTouchListener); // depends on control dependency: [if], data = [none] mSwipeItemTouchListener = null; // depends on control dependency: [if], data = [none] contentView.removeCallbacks(updateRunnable); // depends on control dependency: [if], data = [none] } super.unbindView(); } }
public class class_name { public Subscription findSubscriptionByAuthorizationToken(String authorizationToken) { EntityManager entityManager = getEntityManager(); try { return entityManager .createQuery( "SELECT subscription FROM Subscription AS subscription WHERE authorizationToken = :authorizationToken", Subscription.class) .setParameter("authorizationToken", authorizationToken).setMaxResults(1) .getSingleResult(); } catch (NoResultException e) { return null; } finally { entityManager.close(); } } }
public class class_name { public Subscription findSubscriptionByAuthorizationToken(String authorizationToken) { EntityManager entityManager = getEntityManager(); try { return entityManager .createQuery( "SELECT subscription FROM Subscription AS subscription WHERE authorizationToken = :authorizationToken", Subscription.class) .setParameter("authorizationToken", authorizationToken).setMaxResults(1) .getSingleResult(); // depends on control dependency: [try], data = [none] } catch (NoResultException e) { return null; } finally { // depends on control dependency: [catch], data = [none] entityManager.close(); } } }
public class class_name { @Override public EClass getIfcBurnerType() { if (ifcBurnerTypeEClass == null) { ifcBurnerTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers() .get(67); } return ifcBurnerTypeEClass; } }
public class class_name { @Override public EClass getIfcBurnerType() { if (ifcBurnerTypeEClass == null) { ifcBurnerTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers() .get(67); // depends on control dependency: [if], data = [none] } return ifcBurnerTypeEClass; } }
public class class_name { public static void registerSpecialInverse(String target, String inverseTarget, boolean bidirectional) { SPECIAL_INVERSES.put(new CaseInsensitiveString(target), inverseTarget); if (bidirectional && !target.equalsIgnoreCase(inverseTarget)) { SPECIAL_INVERSES.put(new CaseInsensitiveString(inverseTarget), target); } } }
public class class_name { public static void registerSpecialInverse(String target, String inverseTarget, boolean bidirectional) { SPECIAL_INVERSES.put(new CaseInsensitiveString(target), inverseTarget); if (bidirectional && !target.equalsIgnoreCase(inverseTarget)) { SPECIAL_INVERSES.put(new CaseInsensitiveString(inverseTarget), target); // depends on control dependency: [if], data = [none] } } }
public class class_name { private String getFullPath(String filename) { String file; String ddfPath = getDDFPath(); if (filename.startsWith("^")) { file = filename.replace("^", ""); file = ddfPath + file; } else { File f = new File(filename); if (!f.isAbsolute()) { file = ddfPath + filename; } else { file = filename; } } return file; } }
public class class_name { private String getFullPath(String filename) { String file; String ddfPath = getDDFPath(); if (filename.startsWith("^")) { file = filename.replace("^", ""); // depends on control dependency: [if], data = [none] file = ddfPath + file; // depends on control dependency: [if], data = [none] } else { File f = new File(filename); if (!f.isAbsolute()) { file = ddfPath + filename; // depends on control dependency: [if], data = [none] } else { file = filename; // depends on control dependency: [if], data = [none] } } return file; } }
public class class_name { public SimpleListHolder<T> getFlatDown() { if (flatDown == null) { flatDown = newSimpleListHolder(down_to_leave, getSortProperty()); } return flatDown; } }
public class class_name { public SimpleListHolder<T> getFlatDown() { if (flatDown == null) { flatDown = newSimpleListHolder(down_to_leave, getSortProperty()); // depends on control dependency: [if], data = [none] } return flatDown; } }
public class class_name { public String getString(String key, String defaultValue) { String ret = properties.getProperty(key); if (ret == null) { if(defaultValue == null) { logger.info("No value for key '" + key + "'"); } else { logger.debug("No value for key \"" + key + "\", using default \"" + defaultValue + "\"."); properties.put(key, defaultValue); } ret = defaultValue; } return ret; } }
public class class_name { public String getString(String key, String defaultValue) { String ret = properties.getProperty(key); if (ret == null) { if(defaultValue == null) { logger.info("No value for key '" + key + "'"); // depends on control dependency: [if], data = [none] } else { logger.debug("No value for key \"" + key + "\", using default \"" + defaultValue + "\"."); // depends on control dependency: [if], data = [none] properties.put(key, defaultValue); // depends on control dependency: [if], data = [none] } ret = defaultValue; // depends on control dependency: [if], data = [none] } return ret; } }
public class class_name { public void add(final Object obj) { final Class<?> clazz = obj.getClass(); if (this.clazzes.contains(clazz)) { throw new IllegalArgumentException( "Only one class-instance per benchmark allowed"); } else { this.clazzes.add(clazz); this.objects.add(obj); } } }
public class class_name { public void add(final Object obj) { final Class<?> clazz = obj.getClass(); if (this.clazzes.contains(clazz)) { throw new IllegalArgumentException( "Only one class-instance per benchmark allowed"); } else { this.clazzes.add(clazz); // depends on control dependency: [if], data = [none] this.objects.add(obj); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static int getNumber(CharSequence string) { int number = 0; if (!isEmptyString(string)) { if (TextUtils.isDigitsOnly(string)) { number = Integer.parseInt(string.toString()); } } return number; } }
public class class_name { public static int getNumber(CharSequence string) { int number = 0; if (!isEmptyString(string)) { if (TextUtils.isDigitsOnly(string)) { number = Integer.parseInt(string.toString()); // depends on control dependency: [if], data = [none] } } return number; } }
public class class_name { @Override public ListIterator<E> listIterator(int index) { if (this.lists.size() > 1 || this.lists.isEmpty()) { this.flattenLists(); } return super.listIterator(index); } }
public class class_name { @Override public ListIterator<E> listIterator(int index) { if (this.lists.size() > 1 || this.lists.isEmpty()) { this.flattenLists(); // depends on control dependency: [if], data = [none] } return super.listIterator(index); } }
public class class_name { public void marshall(AWSSessionCredentials aWSSessionCredentials, ProtocolMarshaller protocolMarshaller) { if (aWSSessionCredentials == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(aWSSessionCredentials.getAccessKeyId(), ACCESSKEYID_BINDING); protocolMarshaller.marshall(aWSSessionCredentials.getSecretAccessKey(), SECRETACCESSKEY_BINDING); protocolMarshaller.marshall(aWSSessionCredentials.getSessionToken(), SESSIONTOKEN_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(AWSSessionCredentials aWSSessionCredentials, ProtocolMarshaller protocolMarshaller) { if (aWSSessionCredentials == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(aWSSessionCredentials.getAccessKeyId(), ACCESSKEYID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(aWSSessionCredentials.getSecretAccessKey(), SECRETACCESSKEY_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(aWSSessionCredentials.getSessionToken(), SESSIONTOKEN_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 FacesConfigFactoryType<WebFacesConfigDescriptor> getOrCreateFactory() { List<Node> nodeList = model.get("factory"); if (nodeList != null && nodeList.size() > 0) { return new FacesConfigFactoryTypeImpl<WebFacesConfigDescriptor>(this, "factory", model, nodeList.get(0)); } return createFactory(); } }
public class class_name { public FacesConfigFactoryType<WebFacesConfigDescriptor> getOrCreateFactory() { List<Node> nodeList = model.get("factory"); if (nodeList != null && nodeList.size() > 0) { return new FacesConfigFactoryTypeImpl<WebFacesConfigDescriptor>(this, "factory", model, nodeList.get(0)); // depends on control dependency: [if], data = [none] } return createFactory(); } }
public class class_name { public void deleteEntities(Collection<AtlasVertex> instanceVertices) throws AtlasBaseException { RequestContextV1 requestContext = RequestContextV1.get(); Set<AtlasVertex> deletionCandidateVertices = new HashSet<>(); for (AtlasVertex instanceVertex : instanceVertices) { String guid = AtlasGraphUtilsV1.getIdFromVertex(instanceVertex); AtlasEntity.Status state = AtlasGraphUtilsV1.getState(instanceVertex); if (state == AtlasEntity.Status.DELETED) { LOG.debug("Skipping deletion of {} as it is already deleted", guid); continue; } String typeName = AtlasGraphUtilsV1.getTypeName(instanceVertex); AtlasObjectId objId = new AtlasObjectId(guid, typeName); if (requestContext.getDeletedEntityIds().contains(objId)) { LOG.debug("Skipping deletion of {} as it is already deleted", guid); continue; } // Get GUIDs and vertices for all deletion candidates. Set<GraphHelper.VertexInfo> compositeVertices = getOwnedVertices(instanceVertex); // Record all deletion candidate GUIDs in RequestContext // and gather deletion candidate vertices. for (GraphHelper.VertexInfo vertexInfo : compositeVertices) { requestContext.recordEntityDelete(new AtlasObjectId(vertexInfo.getGuid(), vertexInfo.getTypeName())); deletionCandidateVertices.add(vertexInfo.getVertex()); } } // Delete traits and vertices. for (AtlasVertex deletionCandidateVertex : deletionCandidateVertices) { deleteAllTraits(deletionCandidateVertex); deleteTypeVertex(deletionCandidateVertex, false); } } }
public class class_name { public void deleteEntities(Collection<AtlasVertex> instanceVertices) throws AtlasBaseException { RequestContextV1 requestContext = RequestContextV1.get(); Set<AtlasVertex> deletionCandidateVertices = new HashSet<>(); for (AtlasVertex instanceVertex : instanceVertices) { String guid = AtlasGraphUtilsV1.getIdFromVertex(instanceVertex); AtlasEntity.Status state = AtlasGraphUtilsV1.getState(instanceVertex); if (state == AtlasEntity.Status.DELETED) { LOG.debug("Skipping deletion of {} as it is already deleted", guid); // depends on control dependency: [if], data = [none] continue; } String typeName = AtlasGraphUtilsV1.getTypeName(instanceVertex); AtlasObjectId objId = new AtlasObjectId(guid, typeName); if (requestContext.getDeletedEntityIds().contains(objId)) { LOG.debug("Skipping deletion of {} as it is already deleted", guid); // depends on control dependency: [if], data = [none] continue; } // Get GUIDs and vertices for all deletion candidates. Set<GraphHelper.VertexInfo> compositeVertices = getOwnedVertices(instanceVertex); // Record all deletion candidate GUIDs in RequestContext // and gather deletion candidate vertices. for (GraphHelper.VertexInfo vertexInfo : compositeVertices) { requestContext.recordEntityDelete(new AtlasObjectId(vertexInfo.getGuid(), vertexInfo.getTypeName())); // depends on control dependency: [for], data = [vertexInfo] deletionCandidateVertices.add(vertexInfo.getVertex()); // depends on control dependency: [for], data = [vertexInfo] } } // Delete traits and vertices. for (AtlasVertex deletionCandidateVertex : deletionCandidateVertices) { deleteAllTraits(deletionCandidateVertex); deleteTypeVertex(deletionCandidateVertex, false); } } }
public class class_name { public List<String> getAttributesNames() { SimpleFeatureType featureType = feature.getFeatureType(); List<AttributeDescriptor> attributeDescriptors = featureType.getAttributeDescriptors(); List<String> attributeNames = new ArrayList<String>(); for( AttributeDescriptor attributeDescriptor : attributeDescriptors ) { String name = attributeDescriptor.getLocalName(); attributeNames.add(name); } return attributeNames; } }
public class class_name { public List<String> getAttributesNames() { SimpleFeatureType featureType = feature.getFeatureType(); List<AttributeDescriptor> attributeDescriptors = featureType.getAttributeDescriptors(); List<String> attributeNames = new ArrayList<String>(); for( AttributeDescriptor attributeDescriptor : attributeDescriptors ) { String name = attributeDescriptor.getLocalName(); attributeNames.add(name); // depends on control dependency: [for], data = [none] } return attributeNames; } }
public class class_name { @Override public long rankLong(int x) { long size = 0; short xhigh = highbits(x); for (int i = 0; i < this.highLowContainer.size(); i++) { short key = this.highLowContainer.getKeyAtIndex(i); int comparison = Util.compareUnsigned(key, xhigh); if (comparison < 0) { size += this.highLowContainer.getCardinality(i); } else if(comparison == 0) { return size + this.highLowContainer.getContainerAtIndex(i).rank(lowbits(x)); } } return size; } }
public class class_name { @Override public long rankLong(int x) { long size = 0; short xhigh = highbits(x); for (int i = 0; i < this.highLowContainer.size(); i++) { short key = this.highLowContainer.getKeyAtIndex(i); int comparison = Util.compareUnsigned(key, xhigh); if (comparison < 0) { size += this.highLowContainer.getCardinality(i); // depends on control dependency: [if], data = [none] } else if(comparison == 0) { return size + this.highLowContainer.getContainerAtIndex(i).rank(lowbits(x)); // depends on control dependency: [if], data = [none] } } return size; } }
public class class_name { private String getDriverClassName(String url) { String driverClassName = null; if (url.startsWith(CONNECTION_URL_SUFFIX)) { url = url.substring(CONNECTION_URL_SUFFIX.length()); driverClassName = url.substring(0, url.indexOf(":")); if (driverClassName.length() > 0) { return driverClassName; } url = url.substring(url.indexOf(":") + 1); } if (url.startsWith("jdbc:oracle:thin:")) { driverClassName = "oracle.jdbc.driver.OracleDriver"; } else if (url.startsWith("jdbc:mysql:")) { driverClassName = "com.mysql.jdbc.Driver"; } else if (url.startsWith("jdbc:jtds:")) { // SQL Server or SyBase driverClassName = "net.sourceforge.jtds.jdbc.Driver"; } else if (url.startsWith("jdbc:db2:")) { driverClassName = "com.ibm.db2.jdbc.net.DB2Driver"; } else if (url.startsWith("jdbc:microsoft:sqlserver:")) { // SQL Server 7.0/2000 driverClassName = "com.microsoft.jdbc.sqlserver.SQLServerDriver"; } else if (url.startsWith("jdbc:sqlserver:")) { // SQL Server 2005 driverClassName = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; } else if (url.startsWith("jdbc:postgresql:")) { driverClassName = "org.postgresql.Driver"; } else if (url.startsWith("jdbc:hsqldb:")) { driverClassName = "org.hsqldb.jdbcDriver"; } else if (url.startsWith("jdbc:derby://")) { driverClassName = "org.apache.derby.jdbc.ClientDriver"; } else if (url.startsWith("jdbc:derby:")) { driverClassName = "org.apache.derby.jdbc.EmbeddedDriver"; } else if (url.startsWith("jdbc:sybase:Tds:")) { driverClassName = "com.sybase.jdbc.SybDriver"; } else if (url.startsWith("jdbc:informix-sqli:")) { driverClassName = "com.informix.jdbc.IfxDriver"; } else if (url.startsWith("jdbc:odbc:")) { driverClassName = "sun.jdbc.odbc.JdbcOdbcDriver"; } else if (url.startsWith("jdbc:timesten:client:")) { driverClassName = "com.timesten.jdbc.TimesTenDriver"; } else if (url.startsWith("jdbc:as400:")) { driverClassName = "com.ibm.as400.access.AS400JDBCDriver"; } else if (url.startsWith("jdbc:sapdb:")) { driverClassName = "com.sap.dbtech.jdbc.DriverSapDB"; } else if (url.startsWith("jdbc:interbase:")) { driverClassName = "interbase.interclient.Driver"; } return driverClassName; } }
public class class_name { private String getDriverClassName(String url) { String driverClassName = null; if (url.startsWith(CONNECTION_URL_SUFFIX)) { url = url.substring(CONNECTION_URL_SUFFIX.length()); // depends on control dependency: [if], data = [none] driverClassName = url.substring(0, url.indexOf(":")); // depends on control dependency: [if], data = [none] if (driverClassName.length() > 0) { return driverClassName; // depends on control dependency: [if], data = [none] } url = url.substring(url.indexOf(":") + 1); // depends on control dependency: [if], data = [none] } if (url.startsWith("jdbc:oracle:thin:")) { driverClassName = "oracle.jdbc.driver.OracleDriver"; // depends on control dependency: [if], data = [none] } else if (url.startsWith("jdbc:mysql:")) { driverClassName = "com.mysql.jdbc.Driver"; // depends on control dependency: [if], data = [none] } else if (url.startsWith("jdbc:jtds:")) { // SQL Server or SyBase driverClassName = "net.sourceforge.jtds.jdbc.Driver"; // depends on control dependency: [if], data = [none] } else if (url.startsWith("jdbc:db2:")) { driverClassName = "com.ibm.db2.jdbc.net.DB2Driver"; // depends on control dependency: [if], data = [none] } else if (url.startsWith("jdbc:microsoft:sqlserver:")) { // SQL Server 7.0/2000 driverClassName = "com.microsoft.jdbc.sqlserver.SQLServerDriver"; // depends on control dependency: [if], data = [none] } else if (url.startsWith("jdbc:sqlserver:")) { // SQL Server 2005 driverClassName = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; // depends on control dependency: [if], data = [none] } else if (url.startsWith("jdbc:postgresql:")) { driverClassName = "org.postgresql.Driver"; // depends on control dependency: [if], data = [none] } else if (url.startsWith("jdbc:hsqldb:")) { driverClassName = "org.hsqldb.jdbcDriver"; // depends on control dependency: [if], data = [none] } else if (url.startsWith("jdbc:derby://")) { driverClassName = "org.apache.derby.jdbc.ClientDriver"; } else if (url.startsWith("jdbc:derby:")) { driverClassName = "org.apache.derby.jdbc.EmbeddedDriver"; } else if (url.startsWith("jdbc:sybase:Tds:")) { driverClassName = "com.sybase.jdbc.SybDriver"; } else if (url.startsWith("jdbc:informix-sqli:")) { driverClassName = "com.informix.jdbc.IfxDriver"; } else if (url.startsWith("jdbc:odbc:")) { driverClassName = "sun.jdbc.odbc.JdbcOdbcDriver"; } else if (url.startsWith("jdbc:timesten:client:")) { driverClassName = "com.timesten.jdbc.TimesTenDriver"; } else if (url.startsWith("jdbc:as400:")) { driverClassName = "com.ibm.as400.access.AS400JDBCDriver"; } else if (url.startsWith("jdbc:sapdb:")) { driverClassName = "com.sap.dbtech.jdbc.DriverSapDB"; } else if (url.startsWith("jdbc:interbase:")) { driverClassName = "interbase.interclient.Driver"; } return driverClassName; } }
public class class_name { public NioClient write(ByteBuffer... datas) { try { this.channel.write(datas); } catch (IOException e) { throw new IORuntimeException(e); } return this; } }
public class class_name { public NioClient write(ByteBuffer... datas) { try { this.channel.write(datas); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new IORuntimeException(e); } // depends on control dependency: [catch], data = [none] return this; } }
public class class_name { public GeneralEmail bcc(String bcc) { if (bcc != null && bcc.length() > 0) { return bcc(bcc.split(";")); } else { return addParameter("bcc", null); } } }
public class class_name { public GeneralEmail bcc(String bcc) { if (bcc != null && bcc.length() > 0) { return bcc(bcc.split(";")); // depends on control dependency: [if], data = [(bcc] } else { return addParameter("bcc", null); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static final void start(int[] block, int dc) { dc <<= DC_SHIFT; for (int i = 0; i < 64; i += 4) { block[i + 0] = dc; block[i + 1] = dc; block[i + 2] = dc; block[i + 3] = dc; } } }
public class class_name { public static final void start(int[] block, int dc) { dc <<= DC_SHIFT; for (int i = 0; i < 64; i += 4) { block[i + 0] = dc; // depends on control dependency: [for], data = [i] block[i + 1] = dc; // depends on control dependency: [for], data = [i] block[i + 2] = dc; // depends on control dependency: [for], data = [i] block[i + 3] = dc; // depends on control dependency: [for], data = [i] } } }
public class class_name { public String dequote(String in) { String result = in.trim(); if (result.charAt(0) == '"' && result.charAt(result.length()-1) == '"') { return result.substring(1, result.length()-1); } if (result.charAt(0) == '\'' && result.charAt(result.length()-1) == '\'') { return result.substring(1, result.length()-1); } return result; } }
public class class_name { public String dequote(String in) { String result = in.trim(); if (result.charAt(0) == '"' && result.charAt(result.length()-1) == '"') { return result.substring(1, result.length()-1); // depends on control dependency: [if], data = [none] } if (result.charAt(0) == '\'' && result.charAt(result.length()-1) == '\'') { return result.substring(1, result.length()-1); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { public int addPoller(PollItem pollItem, IZLoopHandler handler, Object arg) { if (pollItem.getRawSocket() == null && pollItem.getSocket() == null) { return -1; } SPoller poller = new SPoller(pollItem, handler, arg); pollers.add(poller); dirty = true; if (verbose) { System.out.printf( "I: zloop: register %s poller (%s, %s)\n", pollItem.getSocket() != null ? pollItem.getSocket().getType() : "RAW", pollItem.getSocket(), pollItem.getRawSocket()); } return 0; } }
public class class_name { public int addPoller(PollItem pollItem, IZLoopHandler handler, Object arg) { if (pollItem.getRawSocket() == null && pollItem.getSocket() == null) { return -1; // depends on control dependency: [if], data = [none] } SPoller poller = new SPoller(pollItem, handler, arg); pollers.add(poller); dirty = true; if (verbose) { System.out.printf( "I: zloop: register %s poller (%s, %s)\n", pollItem.getSocket() != null ? pollItem.getSocket().getType() : "RAW", pollItem.getSocket(), pollItem.getRawSocket()); // depends on control dependency: [if], data = [none] } return 0; } }
public class class_name { @Override public CaseFoldCodeItem[]caseFoldCodesByString(int flag, byte[]bytes, int p, int end) { int b = bytes[p] & 0xff; if (0x41 <= b && b <= 0x5a) { CaseFoldCodeItem item0 = CaseFoldCodeItem.create(1, b + 0x20); if (b == 0x53 && end > p + 1 && (bytes[p+1] == (byte)0x53 || bytes[p+1] == (byte)0x73)) { /* ss */ CaseFoldCodeItem item1 = CaseFoldCodeItem.create(2, SHARP_s); return new CaseFoldCodeItem[]{item0, item1}; } else { return new CaseFoldCodeItem[]{item0}; } } else if (0x61 <= b && b <= 0x7a) { CaseFoldCodeItem item0 = CaseFoldCodeItem.create(1, b - 0x20); if (b == 0x73 && end > p + 1 && (bytes[p+1] == (byte)0x73 || bytes[p+1] == (byte)0x53)) { /* ss */ CaseFoldCodeItem item1 = CaseFoldCodeItem.create(2, SHARP_s); return new CaseFoldCodeItem[]{item0, item1}; } else { return new CaseFoldCodeItem[]{item0}; } } else if (0xc0 <= b && b <= 0xcf) { return new CaseFoldCodeItem[]{CaseFoldCodeItem.create(1, b + 0x20)}; } else if (0xd0 <= b && b <= SHARP_s) { if (b == SHARP_s) { CaseFoldCodeItem item0 = CaseFoldCodeItem.create(1, 's', 's'); CaseFoldCodeItem item1 = CaseFoldCodeItem.create(1, 'S', 'S'); CaseFoldCodeItem item2 = CaseFoldCodeItem.create(1, 's', 'S'); CaseFoldCodeItem item3 = CaseFoldCodeItem.create(1, 'S', 's'); return new CaseFoldCodeItem[]{item0, item1, item2, item3}; } else if (b != 0xd7) { return new CaseFoldCodeItem[]{CaseFoldCodeItem.create(1, b + 0x20)}; } } else if (0xe0 <= b && b <= 0xef) { return new CaseFoldCodeItem[]{CaseFoldCodeItem.create(1, b - 0x20)}; } else if (0xf0 <= b && b <= 0xfe) { if (b != 0xf7) { return new CaseFoldCodeItem[]{CaseFoldCodeItem.create(1, b - 0x20)}; } } return CaseFoldCodeItem.EMPTY_FOLD_CODES; } }
public class class_name { @Override public CaseFoldCodeItem[]caseFoldCodesByString(int flag, byte[]bytes, int p, int end) { int b = bytes[p] & 0xff; if (0x41 <= b && b <= 0x5a) { CaseFoldCodeItem item0 = CaseFoldCodeItem.create(1, b + 0x20); if (b == 0x53 && end > p + 1 && (bytes[p+1] == (byte)0x53 || bytes[p+1] == (byte)0x73)) { /* ss */ CaseFoldCodeItem item1 = CaseFoldCodeItem.create(2, SHARP_s); return new CaseFoldCodeItem[]{item0, item1}; // depends on control dependency: [if], data = [none] } else { return new CaseFoldCodeItem[]{item0}; // depends on control dependency: [if], data = [none] } } else if (0x61 <= b && b <= 0x7a) { CaseFoldCodeItem item0 = CaseFoldCodeItem.create(1, b - 0x20); if (b == 0x73 && end > p + 1 && (bytes[p+1] == (byte)0x73 || bytes[p+1] == (byte)0x53)) { /* ss */ CaseFoldCodeItem item1 = CaseFoldCodeItem.create(2, SHARP_s); return new CaseFoldCodeItem[]{item0, item1}; // depends on control dependency: [if], data = [none] } else { return new CaseFoldCodeItem[]{item0}; // depends on control dependency: [if], data = [none] } } else if (0xc0 <= b && b <= 0xcf) { return new CaseFoldCodeItem[]{CaseFoldCodeItem.create(1, b + 0x20)}; // depends on control dependency: [if], data = [none] } else if (0xd0 <= b && b <= SHARP_s) { if (b == SHARP_s) { CaseFoldCodeItem item0 = CaseFoldCodeItem.create(1, 's', 's'); CaseFoldCodeItem item1 = CaseFoldCodeItem.create(1, 'S', 'S'); CaseFoldCodeItem item2 = CaseFoldCodeItem.create(1, 's', 'S'); CaseFoldCodeItem item3 = CaseFoldCodeItem.create(1, 'S', 's'); return new CaseFoldCodeItem[]{item0, item1, item2, item3}; // depends on control dependency: [if], data = [none] } else if (b != 0xd7) { return new CaseFoldCodeItem[]{CaseFoldCodeItem.create(1, b + 0x20)}; // depends on control dependency: [if], data = [none] } } else if (0xe0 <= b && b <= 0xef) { return new CaseFoldCodeItem[]{CaseFoldCodeItem.create(1, b - 0x20)}; // depends on control dependency: [if], data = [none] } else if (0xf0 <= b && b <= 0xfe) { if (b != 0xf7) { return new CaseFoldCodeItem[]{CaseFoldCodeItem.create(1, b - 0x20)}; // depends on control dependency: [if], data = [none] } } return CaseFoldCodeItem.EMPTY_FOLD_CODES; } }
public class class_name { private SuppressionInfo updateSuppressions(Tree tree, VisitorState state) { SuppressionInfo prevSuppressionInfo = currentSuppressions; if (tree instanceof CompilationUnitTree) { currentSuppressions = currentSuppressions.forCompilationUnit((CompilationUnitTree) tree, state); } else { Symbol sym = ASTHelpers.getDeclaredSymbol(tree); if (sym != null) { currentSuppressions = currentSuppressions.withExtendedSuppressions( sym, state, getCustomSuppressionAnnotations()); } } return prevSuppressionInfo; } }
public class class_name { private SuppressionInfo updateSuppressions(Tree tree, VisitorState state) { SuppressionInfo prevSuppressionInfo = currentSuppressions; if (tree instanceof CompilationUnitTree) { currentSuppressions = currentSuppressions.forCompilationUnit((CompilationUnitTree) tree, state); // depends on control dependency: [if], data = [none] } else { Symbol sym = ASTHelpers.getDeclaredSymbol(tree); if (sym != null) { currentSuppressions = currentSuppressions.withExtendedSuppressions( sym, state, getCustomSuppressionAnnotations()); // depends on control dependency: [if], data = [none] } } return prevSuppressionInfo; } }
public class class_name { public Response mkCol(Session session, String path, String nodeType, List<String> mixinTypes, List<String> tokens) { Node node; try { nullResourceLocks.checkLock(session, path, tokens); node = session.getRootNode().addNode(TextUtil.relativizePath(path), nodeType); // We set the new path path = node.getPath(); if (mixinTypes != null) { addMixins(node, mixinTypes); } session.save(); } catch (ItemExistsException exc) { return Response.status(HTTPStatus.METHOD_NOT_ALLOWED).entity(exc.getMessage()).build(); } catch (PathNotFoundException exc) { return Response.status(HTTPStatus.CONFLICT).entity(exc.getMessage()).build(); } catch (AccessDeniedException exc) { return Response.status(HTTPStatus.FORBIDDEN).entity(exc.getMessage()).build(); } catch (LockException exc) { return Response.status(HTTPStatus.LOCKED).entity(exc.getMessage()).build(); } catch (RepositoryException exc) { log.error(exc.getMessage(), exc); return Response.serverError().entity(exc.getMessage()).build(); } if (uriBuilder != null) { return Response.created(uriBuilder.path(session.getWorkspace().getName()).path(path).build()).build(); } // to save compatibility if uriBuilder is not provided return Response.status(HTTPStatus.CREATED).build(); } }
public class class_name { public Response mkCol(Session session, String path, String nodeType, List<String> mixinTypes, List<String> tokens) { Node node; try { nullResourceLocks.checkLock(session, path, tokens); // depends on control dependency: [try], data = [none] node = session.getRootNode().addNode(TextUtil.relativizePath(path), nodeType); // depends on control dependency: [try], data = [none] // We set the new path path = node.getPath(); // depends on control dependency: [try], data = [none] if (mixinTypes != null) { addMixins(node, mixinTypes); // depends on control dependency: [if], data = [none] } session.save(); // depends on control dependency: [try], data = [none] } catch (ItemExistsException exc) { return Response.status(HTTPStatus.METHOD_NOT_ALLOWED).entity(exc.getMessage()).build(); } // depends on control dependency: [catch], data = [none] catch (PathNotFoundException exc) { return Response.status(HTTPStatus.CONFLICT).entity(exc.getMessage()).build(); } // depends on control dependency: [catch], data = [none] catch (AccessDeniedException exc) { return Response.status(HTTPStatus.FORBIDDEN).entity(exc.getMessage()).build(); } // depends on control dependency: [catch], data = [none] catch (LockException exc) { return Response.status(HTTPStatus.LOCKED).entity(exc.getMessage()).build(); } // depends on control dependency: [catch], data = [none] catch (RepositoryException exc) { log.error(exc.getMessage(), exc); return Response.serverError().entity(exc.getMessage()).build(); } // depends on control dependency: [catch], data = [none] if (uriBuilder != null) { return Response.created(uriBuilder.path(session.getWorkspace().getName()).path(path).build()).build(); // depends on control dependency: [if], data = [(uriBuilder] } // to save compatibility if uriBuilder is not provided return Response.status(HTTPStatus.CREATED).build(); } }
public class class_name { @Override public Result clearTokenIfInvalid(Context context, String msg) { Result error = handler.onError(context, msg); final String cookieName = getCookieName(); if (cookieName != null) { Cookie cookie = context.cookie(cookieName); if (cookie != null) { return error.without(cookieName); } } else { context.session().remove(getTokenName()); } return error; } }
public class class_name { @Override public Result clearTokenIfInvalid(Context context, String msg) { Result error = handler.onError(context, msg); final String cookieName = getCookieName(); if (cookieName != null) { Cookie cookie = context.cookie(cookieName); if (cookie != null) { return error.without(cookieName); // depends on control dependency: [if], data = [(cookie] } } else { context.session().remove(getTokenName()); // depends on control dependency: [if], data = [none] } return error; } }
public class class_name { protected void onReceiveValidationResults(Map<String, CmsValidationResult> results) { try { for (Map.Entry<String, CmsValidationResult> resultEntry : results.entrySet()) { String fieldName = resultEntry.getKey(); CmsValidationResult result = resultEntry.getValue(); provideValidationResult(fieldName, result); } m_handler.onValidationFinished(m_validationOk); } finally { CmsValidationScheduler.get().executeNext(); } } }
public class class_name { protected void onReceiveValidationResults(Map<String, CmsValidationResult> results) { try { for (Map.Entry<String, CmsValidationResult> resultEntry : results.entrySet()) { String fieldName = resultEntry.getKey(); CmsValidationResult result = resultEntry.getValue(); provideValidationResult(fieldName, result); // depends on control dependency: [for], data = [none] } m_handler.onValidationFinished(m_validationOk); // depends on control dependency: [try], data = [none] } finally { CmsValidationScheduler.get().executeNext(); } } }
public class class_name { public void setContextCenter(Pattern pattern) { // build up the classgraph printing the relations for all of the // classes that make up the "center" of this context this.pattern = pattern; matched = new ArrayList<ClassDoc>(); for (ClassDoc cd : root.classes()) { if (pattern.matcher(cd.toString()).matches()) { matched.add(cd); addToGraph(cd); } } } }
public class class_name { public void setContextCenter(Pattern pattern) { // build up the classgraph printing the relations for all of the // classes that make up the "center" of this context this.pattern = pattern; matched = new ArrayList<ClassDoc>(); for (ClassDoc cd : root.classes()) { if (pattern.matcher(cd.toString()).matches()) { matched.add(cd); // depends on control dependency: [if], data = [none] addToGraph(cd); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static PeriodType yearDayTime() { PeriodType type = cYDTime; if (type == null) { type = new PeriodType( "YearDayTime", new DurationFieldType[] { DurationFieldType.years(), DurationFieldType.days(), DurationFieldType.hours(), DurationFieldType.minutes(), DurationFieldType.seconds(), DurationFieldType.millis(), }, new int[] { 0, -1, -1, 1, 2, 3, 4, 5, } ); cYDTime = type; } return type; } }
public class class_name { public static PeriodType yearDayTime() { PeriodType type = cYDTime; if (type == null) { type = new PeriodType( "YearDayTime", new DurationFieldType[] { DurationFieldType.years(), DurationFieldType.days(), DurationFieldType.hours(), DurationFieldType.minutes(), DurationFieldType.seconds(), DurationFieldType.millis(), }, new int[] { 0, -1, -1, 1, 2, 3, 4, 5, } ); // depends on control dependency: [if], data = [none] cYDTime = type; // depends on control dependency: [if], data = [none] } return type; } }
public class class_name { public List<String> receiveTextMessages(int maxSize) { List<String> messages = new ArrayList<>(); try { while (messages.size() <= maxSize){ TextMessage message = (TextMessage) consumer.receive(timeout); if (message == null) { return messages; }else { messages.add(message.getText()); } } } catch (JMSException e) { throw new AsyncException(e); } return messages; } }
public class class_name { public List<String> receiveTextMessages(int maxSize) { List<String> messages = new ArrayList<>(); try { while (messages.size() <= maxSize){ TextMessage message = (TextMessage) consumer.receive(timeout); if (message == null) { return messages; // depends on control dependency: [if], data = [none] }else { messages.add(message.getText()); // depends on control dependency: [if], data = [(message] } } } catch (JMSException e) { throw new AsyncException(e); } // depends on control dependency: [catch], data = [none] return messages; } }
public class class_name { public com.google.cloud.datalabeling.v1beta1.LabelImageSegmentationOperationMetadataOrBuilder getImageSegmentationDetailsOrBuilder() { if (detailsCase_ == 15) { return (com.google.cloud.datalabeling.v1beta1.LabelImageSegmentationOperationMetadata) details_; } return com.google.cloud.datalabeling.v1beta1.LabelImageSegmentationOperationMetadata .getDefaultInstance(); } }
public class class_name { public com.google.cloud.datalabeling.v1beta1.LabelImageSegmentationOperationMetadataOrBuilder getImageSegmentationDetailsOrBuilder() { if (detailsCase_ == 15) { return (com.google.cloud.datalabeling.v1beta1.LabelImageSegmentationOperationMetadata) details_; // depends on control dependency: [if], data = [none] } return com.google.cloud.datalabeling.v1beta1.LabelImageSegmentationOperationMetadata .getDefaultInstance(); } }
public class class_name { public FormFieldListing getFieldsByFormTypeIdAndLoggedInUser( Long formTypeIdParam, boolean editOnlyFieldsParam) { Form form = new Form(); form.setFormTypeId(formTypeIdParam); if(this.serviceTicket != null) { form.setServiceTicket(this.serviceTicket); } return new FormFieldListing(this.postJson( form, WS.Path.FormField.Version1.getByFormDefinitionAndLoggedInUser( editOnlyFieldsParam))); } }
public class class_name { public FormFieldListing getFieldsByFormTypeIdAndLoggedInUser( Long formTypeIdParam, boolean editOnlyFieldsParam) { Form form = new Form(); form.setFormTypeId(formTypeIdParam); if(this.serviceTicket != null) { form.setServiceTicket(this.serviceTicket); // depends on control dependency: [if], data = [(this.serviceTicket] } return new FormFieldListing(this.postJson( form, WS.Path.FormField.Version1.getByFormDefinitionAndLoggedInUser( editOnlyFieldsParam))); } }
public class class_name { private List<String> copyResources(File targetDirectory, List<FileSet> fileSets) throws MojoExecutionException { ArrayList<String> addedFiles = new ArrayList<String>(); for (FileSet fileSet : fileSets) { // Get the absolute base directory for the FileSet File sourceDirectory = new File(fileSet.getDirectory()); if (!sourceDirectory.isAbsolute()) { sourceDirectory = new File(project.getBasedir(), sourceDirectory.getPath()); } if (!sourceDirectory.exists()) { // If the requested directory does not exist, log it and carry on getLog().warn("Specified source directory " + sourceDirectory.getPath() + " does not exist."); continue; } List<String> includedFiles = scanFileSet(sourceDirectory, fileSet); addedFiles.addAll(includedFiles); getLog().info("Copying " + includedFiles.size() + " additional resource" + (includedFiles.size() > 1 ? "s" : "")); for (String destination : includedFiles) { File source = new File(sourceDirectory, destination); File destinationFile = new File(targetDirectory, destination); // Make sure that the directory we are copying into exists destinationFile.getParentFile().mkdirs(); try { FileUtils.copyFile(source, destinationFile); destinationFile.setExecutable(fileSet.isExecutable(),false); } catch (IOException e) { throw new MojoExecutionException("Error copying additional resource " + source, e); } } } return addedFiles; } }
public class class_name { private List<String> copyResources(File targetDirectory, List<FileSet> fileSets) throws MojoExecutionException { ArrayList<String> addedFiles = new ArrayList<String>(); for (FileSet fileSet : fileSets) { // Get the absolute base directory for the FileSet File sourceDirectory = new File(fileSet.getDirectory()); if (!sourceDirectory.isAbsolute()) { sourceDirectory = new File(project.getBasedir(), sourceDirectory.getPath()); // depends on control dependency: [if], data = [none] } if (!sourceDirectory.exists()) { // If the requested directory does not exist, log it and carry on getLog().warn("Specified source directory " + sourceDirectory.getPath() + " does not exist."); // depends on control dependency: [if], data = [none] continue; } List<String> includedFiles = scanFileSet(sourceDirectory, fileSet); addedFiles.addAll(includedFiles); getLog().info("Copying " + includedFiles.size() + " additional resource" + (includedFiles.size() > 1 ? "s" : "")); for (String destination : includedFiles) { File source = new File(sourceDirectory, destination); File destinationFile = new File(targetDirectory, destination); // Make sure that the directory we are copying into exists destinationFile.getParentFile().mkdirs(); // depends on control dependency: [for], data = [destination] try { FileUtils.copyFile(source, destinationFile); // depends on control dependency: [try], data = [none] destinationFile.setExecutable(fileSet.isExecutable(),false); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new MojoExecutionException("Error copying additional resource " + source, e); } // depends on control dependency: [catch], data = [none] } } return addedFiles; } }
public class class_name { void batchReady(String batch) { if (log.isDebugEnabled()) { log.debug(String.format("%s - Batch ready: Batch[batch=%s]", this, batch)); } eventBus.send(outAddress, new JsonObject().putString("action", "batch").putString("batch", batch)); } }
public class class_name { void batchReady(String batch) { if (log.isDebugEnabled()) { log.debug(String.format("%s - Batch ready: Batch[batch=%s]", this, batch)); // depends on control dependency: [if], data = [none] } eventBus.send(outAddress, new JsonObject().putString("action", "batch").putString("batch", batch)); } }
public class class_name { public Sha256Hash getWTxId() { if (cachedWTxId == null) { if (!hasWitnesses() && cachedTxId != null) { cachedWTxId = cachedTxId; } else { ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { bitcoinSerializeToStream(baos, hasWitnesses()); } catch (IOException e) { throw new RuntimeException(e); // cannot happen } cachedWTxId = Sha256Hash.wrapReversed(Sha256Hash.hashTwice(baos.toByteArray())); } } return cachedWTxId; } }
public class class_name { public Sha256Hash getWTxId() { if (cachedWTxId == null) { if (!hasWitnesses() && cachedTxId != null) { cachedWTxId = cachedTxId; // depends on control dependency: [if], data = [none] } else { ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { bitcoinSerializeToStream(baos, hasWitnesses()); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new RuntimeException(e); // cannot happen } // depends on control dependency: [catch], data = [none] cachedWTxId = Sha256Hash.wrapReversed(Sha256Hash.hashTwice(baos.toByteArray())); // depends on control dependency: [if], data = [none] } } return cachedWTxId; } }
public class class_name { public TransferSpecs getTransferSpec(FASPConnectionInfo faspConnectionInfo, String localFileName, String remoteFileName, String direction) throws SdkClientException, AmazonServiceException { log.trace("AsperaTransferManager.getTransferSpec >> start " + System.nanoTime()); TransferSpecs transferSpecs = null; URL ats_url = null; try { ats_url = new URL(faspConnectionInfo.getAtsEndpoint()); } catch (MalformedURLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } URI ats_uri = null; try { ats_uri = ats_url.toURI(); } catch (URISyntaxException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } log.trace("AsperaTransferManager.getTransferSpec >> retrieve delegate token " + System.nanoTime()); Token token = new Token().withDelegate_token(tokenManager.getToken()); log.trace("AsperaTransferManager.getTransferSpec << retrieve delegate token " + System.nanoTime()); log.trace("AsperaTransferManager.getTransferSpec >> prepare transfer request " + System.nanoTime()); StorageCredentials storageCredentials = new StorageCredentials().withType("token") .withToken(token); Node node = new Node().withStorage_credentials(storageCredentials); Aspera aspera = new Aspera().withNode(node); Tags tags = new Tags().withAspera(aspera); List<Path> paths = new ArrayList<Path>(); Path path = new Path().withSource(localFileName) .withDestination(remoteFileName); paths.add(path); List<TransferRequest> transferRequests = new ArrayList<TransferRequest>(); TransferRequest transferRequest = new TransferRequest().withPaths(paths).withDestination_root("") .withTags(tags).withRemote_host(ats_uri.getHost()); transferRequests.add(transferRequest); AsperaTransferSpecRequest transferSpecRequest = new AsperaTransferSpecRequest() .withTransfer_requests(transferRequests); ObjectMapper mapper = new ObjectMapper(); String jsonTransferRequest = null; try { jsonTransferRequest = mapper.writeValueAsString(transferSpecRequest); } catch (JsonGenerationException e) { e.printStackTrace(); } catch (JsonMappingException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } log.trace("AsperaTransferManager.getTransferSpec << prepare transfer request " + System.nanoTime()); // Post transfer spec request // TODO need to manage retries. try { log.trace("AsperaTransferManager.getTransferSpec >> prepare post request " + System.nanoTime()); SSLContext sslContext; /* * If SSL cert checking for endpoints has been explicitly disabled, register a * new scheme for HTTPS that won't cause self-signed certs to error out. */ if (SDKGlobalConfiguration.isCertCheckingDisabled()) { if (log.isWarnEnabled()) { log.warn("SSL Certificate checking for endpoints has been " + "explicitly disabled."); } sslContext = SSLContext.getInstance("TLS"); sslContext.init(null, new TrustManager[] { new TrustingX509TrustManager() }, null); } else { sslContext = SSLContexts.createDefault(); } SSLConnectionSocketFactory sslsf = new SdkTLSSocketFactory(sslContext, new DefaultHostnameVerifier()); HttpClient client = HttpClientBuilder.create().setSSLSocketFactory(sslsf).build(); HttpPost post = new HttpPost(faspConnectionInfo.getAtsEndpoint() + "/files/" + direction + "_setup"); post.setHeader("Content-Type", "application/x-www-form-urlencoded"); String authStr = faspConnectionInfo.getAccessKeyId() + ":" + faspConnectionInfo.getAccessKeySecret(); post.setHeader("Authorization", "Basic " + DatatypeConverter.printBase64Binary(authStr.getBytes("UTF-8"))); post.setHeader("Accept", "application/json"); post.setHeader("X-Aspera-Storage-Credentials", "{\"type\": \"token\", \"token\" : {\"delegated_refresh_token\":\"" + tokenManager.getToken() + "\"}}"); StringEntity transferParams = new StringEntity(jsonTransferRequest); transferParams.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); post.setEntity(transferParams); log.trace("AsperaTransferManager.getTransferSpec << prepare post request " + System.nanoTime()); log.trace("AsperaTransferManager.getTransferSpec >> post request " + System.nanoTime()); final HttpResponse response = client.execute(post); log.trace("AsperaTransferManager.getTransferSpec << post request " + System.nanoTime()); if (response.getStatusLine().getStatusCode() != 200) { log.info("Response code= " + response.getStatusLine().getStatusCode() + ", Reason= " + response.getStatusLine().getReasonPhrase() + ".Throwing AsperaTransferException"); AsperaTransferException exception = new AsperaTransferException("Failed to get Aspera Transfer Spec"); exception.setStatusCode(response.getStatusLine().getStatusCode()); exception.setStatusMessage(response.getStatusLine().getReasonPhrase()); throw exception; } final HttpEntity entity = response.getEntity(); final String resultStr = EntityUtils.toString(entity); log.trace("AsperaTransferManager.getTransferSpec >> mapping transfer spec " + System.nanoTime()); transferSpecs = mapper.readValue(resultStr, TransferSpecs.class); log.trace("AsperaTransferManager.getTransferSpec << mapping transfer spec " + System.nanoTime()); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (KeyManagementException e) { e.printStackTrace(); } log.trace("AsperaTransferManager.getTransferSpec << end " + System.nanoTime()); return transferSpecs; } }
public class class_name { public TransferSpecs getTransferSpec(FASPConnectionInfo faspConnectionInfo, String localFileName, String remoteFileName, String direction) throws SdkClientException, AmazonServiceException { log.trace("AsperaTransferManager.getTransferSpec >> start " + System.nanoTime()); TransferSpecs transferSpecs = null; URL ats_url = null; try { ats_url = new URL(faspConnectionInfo.getAtsEndpoint()); } catch (MalformedURLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } URI ats_uri = null; try { ats_uri = ats_url.toURI(); } catch (URISyntaxException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } log.trace("AsperaTransferManager.getTransferSpec >> retrieve delegate token " + System.nanoTime()); Token token = new Token().withDelegate_token(tokenManager.getToken()); log.trace("AsperaTransferManager.getTransferSpec << retrieve delegate token " + System.nanoTime()); log.trace("AsperaTransferManager.getTransferSpec >> prepare transfer request " + System.nanoTime()); StorageCredentials storageCredentials = new StorageCredentials().withType("token") .withToken(token); Node node = new Node().withStorage_credentials(storageCredentials); Aspera aspera = new Aspera().withNode(node); Tags tags = new Tags().withAspera(aspera); List<Path> paths = new ArrayList<Path>(); Path path = new Path().withSource(localFileName) .withDestination(remoteFileName); paths.add(path); List<TransferRequest> transferRequests = new ArrayList<TransferRequest>(); TransferRequest transferRequest = new TransferRequest().withPaths(paths).withDestination_root("") .withTags(tags).withRemote_host(ats_uri.getHost()); transferRequests.add(transferRequest); AsperaTransferSpecRequest transferSpecRequest = new AsperaTransferSpecRequest() .withTransfer_requests(transferRequests); ObjectMapper mapper = new ObjectMapper(); String jsonTransferRequest = null; try { jsonTransferRequest = mapper.writeValueAsString(transferSpecRequest); } catch (JsonGenerationException e) { e.printStackTrace(); } catch (JsonMappingException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } log.trace("AsperaTransferManager.getTransferSpec << prepare transfer request " + System.nanoTime()); // Post transfer spec request // TODO need to manage retries. try { log.trace("AsperaTransferManager.getTransferSpec >> prepare post request " + System.nanoTime()); SSLContext sslContext; /* * If SSL cert checking for endpoints has been explicitly disabled, register a * new scheme for HTTPS that won't cause self-signed certs to error out. */ if (SDKGlobalConfiguration.isCertCheckingDisabled()) { if (log.isWarnEnabled()) { log.warn("SSL Certificate checking for endpoints has been " + "explicitly disabled."); // depends on control dependency: [if], data = [none] } sslContext = SSLContext.getInstance("TLS"); // depends on control dependency: [if], data = [none] sslContext.init(null, new TrustManager[] { new TrustingX509TrustManager() }, null); // depends on control dependency: [if], data = [none] } else { sslContext = SSLContexts.createDefault(); // depends on control dependency: [if], data = [none] } SSLConnectionSocketFactory sslsf = new SdkTLSSocketFactory(sslContext, new DefaultHostnameVerifier()); HttpClient client = HttpClientBuilder.create().setSSLSocketFactory(sslsf).build(); HttpPost post = new HttpPost(faspConnectionInfo.getAtsEndpoint() + "/files/" + direction + "_setup"); post.setHeader("Content-Type", "application/x-www-form-urlencoded"); String authStr = faspConnectionInfo.getAccessKeyId() + ":" + faspConnectionInfo.getAccessKeySecret(); post.setHeader("Authorization", "Basic " + DatatypeConverter.printBase64Binary(authStr.getBytes("UTF-8"))); post.setHeader("Accept", "application/json"); post.setHeader("X-Aspera-Storage-Credentials", "{\"type\": \"token\", \"token\" : {\"delegated_refresh_token\":\"" + tokenManager.getToken() + "\"}}"); StringEntity transferParams = new StringEntity(jsonTransferRequest); transferParams.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); post.setEntity(transferParams); log.trace("AsperaTransferManager.getTransferSpec << prepare post request " + System.nanoTime()); log.trace("AsperaTransferManager.getTransferSpec >> post request " + System.nanoTime()); final HttpResponse response = client.execute(post); log.trace("AsperaTransferManager.getTransferSpec << post request " + System.nanoTime()); if (response.getStatusLine().getStatusCode() != 200) { log.info("Response code= " + response.getStatusLine().getStatusCode() + ", Reason= " + response.getStatusLine().getReasonPhrase() + ".Throwing AsperaTransferException"); // depends on control dependency: [if], data = [none] AsperaTransferException exception = new AsperaTransferException("Failed to get Aspera Transfer Spec"); exception.setStatusCode(response.getStatusLine().getStatusCode()); // depends on control dependency: [if], data = [(response.getStatusLine().getStatusCode()] exception.setStatusMessage(response.getStatusLine().getReasonPhrase()); // depends on control dependency: [if], data = [none] throw exception; } final HttpEntity entity = response.getEntity(); final String resultStr = EntityUtils.toString(entity); log.trace("AsperaTransferManager.getTransferSpec >> mapping transfer spec " + System.nanoTime()); transferSpecs = mapper.readValue(resultStr, TransferSpecs.class); log.trace("AsperaTransferManager.getTransferSpec << mapping transfer spec " + System.nanoTime()); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (KeyManagementException e) { e.printStackTrace(); } log.trace("AsperaTransferManager.getTransferSpec << end " + System.nanoTime()); return transferSpecs; } }
public class class_name { public Activity getCurrentActivity() { if(config.commandLogging){ Log.d(config.commandLoggingTag, "getCurrentActivity()"); } return activityUtils.getCurrentActivity(false); } }
public class class_name { public Activity getCurrentActivity() { if(config.commandLogging){ Log.d(config.commandLoggingTag, "getCurrentActivity()"); // depends on control dependency: [if], data = [none] } return activityUtils.getCurrentActivity(false); } }
public class class_name { private String parseLevelOfTheory(String line) { StringBuffer summary = new StringBuffer(); summary.append(line); try { do { line = input.readLine().trim(); summary.append(line); } while (!(line.indexOf('@') >= 0)); } catch (Exception exc) { logger.debug("syntax problem while parsing summary of g98 section: "); logger.debug(exc); } logger.debug("parseLoT(): " + summary.toString()); StringTokenizer st1 = new StringTokenizer(summary.toString(), "\\"); // Must contain at least 6 tokens if (st1.countTokens() < 6) { return null; } // Skip first four tokens for (int i = 0; i < 4; ++i) { st1.nextToken(); } return st1.nextToken() + "/" + st1.nextToken(); } }
public class class_name { private String parseLevelOfTheory(String line) { StringBuffer summary = new StringBuffer(); summary.append(line); try { do { line = input.readLine().trim(); summary.append(line); } while (!(line.indexOf('@') >= 0)); } catch (Exception exc) { logger.debug("syntax problem while parsing summary of g98 section: "); logger.debug(exc); } // depends on control dependency: [catch], data = [none] logger.debug("parseLoT(): " + summary.toString()); StringTokenizer st1 = new StringTokenizer(summary.toString(), "\\"); // Must contain at least 6 tokens if (st1.countTokens() < 6) { return null; // depends on control dependency: [if], data = [none] } // Skip first four tokens for (int i = 0; i < 4; ++i) { st1.nextToken(); // depends on control dependency: [for], data = [none] } return st1.nextToken() + "/" + st1.nextToken(); } }
public class class_name { public SparseIntArray getExpanded() { SparseIntArray expandedItems = new SparseIntArray(); Item item; for (int i = 0, size = mFastAdapter.getItemCount(); i < size; i++) { item = mFastAdapter.getItem(i); if (item instanceof IExpandable && ((IExpandable) item).isExpanded()) { expandedItems.put(i, ((IExpandable) item).getSubItems().size()); } } return expandedItems; } }
public class class_name { public SparseIntArray getExpanded() { SparseIntArray expandedItems = new SparseIntArray(); Item item; for (int i = 0, size = mFastAdapter.getItemCount(); i < size; i++) { item = mFastAdapter.getItem(i); // depends on control dependency: [for], data = [i] if (item instanceof IExpandable && ((IExpandable) item).isExpanded()) { expandedItems.put(i, ((IExpandable) item).getSubItems().size()); // depends on control dependency: [if], data = [none] } } return expandedItems; } }
public class class_name { public Boolean waitForResponse() { if (responseReceived != null) { return responseReceived; } synchronized (lock) { try { lock.wait(RESPONSE_WAIT_TIME); } catch (InterruptedException e) { log.warn("Interrupted waiting for synchronous response."); } } if (responseReceived == null) { log.warn("Timed out waiting for synchronous response."); responseReceived = false; } return responseReceived; } }
public class class_name { public Boolean waitForResponse() { if (responseReceived != null) { return responseReceived; // depends on control dependency: [if], data = [none] } synchronized (lock) { try { lock.wait(RESPONSE_WAIT_TIME); // depends on control dependency: [try], data = [none] } catch (InterruptedException e) { log.warn("Interrupted waiting for synchronous response."); } // depends on control dependency: [catch], data = [none] } if (responseReceived == null) { log.warn("Timed out waiting for synchronous response."); // depends on control dependency: [if], data = [none] responseReceived = false; // depends on control dependency: [if], data = [none] } return responseReceived; } }
public class class_name { public Principal getAuthenticationPrincipal(final String ticketGrantingTicketId) { try { val ticketGrantingTicket = this.centralAuthenticationService.getTicket(ticketGrantingTicketId, TicketGrantingTicket.class); return ticketGrantingTicket.getAuthentication().getPrincipal(); } catch (final InvalidTicketException e) { LOGGER.warn("Ticket-granting ticket [{}] cannot be found in the ticket registry.", e.getMessage()); LOGGER.debug(e.getMessage(), e); } LOGGER.warn("In the absence of valid ticket-granting ticket, the authentication principal cannot be determined. Returning [{}]", NullPrincipal.class.getSimpleName()); return NullPrincipal.getInstance(); } }
public class class_name { public Principal getAuthenticationPrincipal(final String ticketGrantingTicketId) { try { val ticketGrantingTicket = this.centralAuthenticationService.getTicket(ticketGrantingTicketId, TicketGrantingTicket.class); return ticketGrantingTicket.getAuthentication().getPrincipal(); // depends on control dependency: [try], data = [none] } catch (final InvalidTicketException e) { LOGGER.warn("Ticket-granting ticket [{}] cannot be found in the ticket registry.", e.getMessage()); LOGGER.debug(e.getMessage(), e); } // depends on control dependency: [catch], data = [none] LOGGER.warn("In the absence of valid ticket-granting ticket, the authentication principal cannot be determined. Returning [{}]", NullPrincipal.class.getSimpleName()); return NullPrincipal.getInstance(); } }
public class class_name { public void parse (char[] data, int offset, int length) { int cs, p = offset, pe = length, eof = pe; int s = 0; int indent = 0; int taskIndex = -1; boolean isGuard = false; boolean isSubtreeRef = false; String statementName = null; boolean taskProcessed = false; boolean needsUnescape = false; boolean stringIsUnquoted = false; RuntimeException parseRuntimeEx = null; String attrName = null; lineNumber = 1; try { // line 147 "BehaviorTreeReader.java" { cs = btree_start; } // line 151 "BehaviorTreeReader.java" { int _klen; int _trans = 0; int _acts; int _nacts; int _keys; int _goto_targ = 0; _goto: while (true) { switch ( _goto_targ ) { case 0: if ( p == pe ) { _goto_targ = 4; continue _goto; } if ( cs == 0 ) { _goto_targ = 5; continue _goto; } case 1: _match: do { _keys = _btree_key_offsets[cs]; _trans = _btree_index_offsets[cs]; _klen = _btree_single_lengths[cs]; if ( _klen > 0 ) { int _lower = _keys; int _mid; int _upper = _keys + _klen - 1; while (true) { if ( _upper < _lower ) break; _mid = _lower + ((_upper-_lower) >> 1); if ( data[p] < _btree_trans_keys[_mid] ) _upper = _mid - 1; else if ( data[p] > _btree_trans_keys[_mid] ) _lower = _mid + 1; else { _trans += (_mid - _keys); break _match; } } _keys += _klen; _trans += _klen; } _klen = _btree_range_lengths[cs]; if ( _klen > 0 ) { int _lower = _keys; int _mid; int _upper = _keys + (_klen<<1) - 2; while (true) { if ( _upper < _lower ) break; _mid = _lower + (((_upper-_lower) >> 1) & ~1); if ( data[p] < _btree_trans_keys[_mid] ) _upper = _mid - 2; else if ( data[p] > _btree_trans_keys[_mid+1] ) _lower = _mid + 2; else { _trans += ((_mid - _keys)>>1); break _match; } } _trans += _klen; } } while (false); _trans = _btree_indicies[_trans]; cs = _btree_trans_targs[_trans]; if ( _btree_trans_actions[_trans] != 0 ) { _acts = _btree_trans_actions[_trans]; _nacts = (int) _btree_actions[_acts++]; while ( _nacts-- > 0 ) { switch ( _btree_actions[_acts++] ) { case 0: // line 148 "BehaviorTreeReader.rl" { String value = new String(data, s, p - s); s = p; if (needsUnescape) value = unescape(value); outer: if (stringIsUnquoted) { if (debug) GdxAI.getLogger().info(LOG_TAG, "string: " + attrName + "=" + value); if (value.equals("true")) { if (debug) GdxAI.getLogger().info(LOG_TAG, "boolean: " + attrName + "=true"); attribute(attrName, Boolean.TRUE); break outer; } else if (value.equals("false")) { if (debug) GdxAI.getLogger().info(LOG_TAG, "boolean: " + attrName + "=false"); attribute(attrName, Boolean.FALSE); break outer; } else if (value.equals("null")) { attribute(attrName, null); break outer; } else { // number try { if (containsFloatingPointCharacters(value)) { if (debug) GdxAI.getLogger().info(LOG_TAG, "double: " + attrName + "=" + Double.parseDouble(value)); attribute(attrName, new Double(value)); break outer; } else { if (debug) GdxAI.getLogger().info(LOG_TAG, "double: " + attrName + "=" + Double.parseDouble(value)); attribute(attrName, new Long(value)); break outer; } } catch (NumberFormatException nfe) { throw new GdxRuntimeException("Attribute value must be a number, a boolean, a string or null"); } } } else { if (debug) GdxAI.getLogger().info(LOG_TAG, "string: " + attrName + "=\"" + value + "\""); attribute(attrName, value); } stringIsUnquoted = false; } break; case 1: // line 188 "BehaviorTreeReader.rl" { if (debug) GdxAI.getLogger().info(LOG_TAG, "unquotedChars"); s = p; needsUnescape = false; stringIsUnquoted = true; outer: while (true) { switch (data[p]) { case '\\': needsUnescape = true; break; case ')': case '(': case ' ': case '\r': case '\n': case '\t': break outer; } // if (debug) GdxAI.getLogger().info(LOG_TAG, "unquotedChar (value): '" + data[p] + "'"); p++; if (p == eof) break; } p--; } break; case 2: // line 213 "BehaviorTreeReader.rl" { if (debug) GdxAI.getLogger().info(LOG_TAG, "quotedChars"); s = ++p; needsUnescape = false; outer: while (true) { switch (data[p]) { case '\\': needsUnescape = true; p++; break; case '"': break outer; } // if (debug) GdxAI.getLogger().info(LOG_TAG, "quotedChar: '" + data[p] + "'"); p++; if (p == eof) break; } p--; } break; case 3: // line 233 "BehaviorTreeReader.rl" { indent = 0; taskIndex = -1; isGuard = false; isSubtreeRef = false; statementName = null; taskProcessed = false; lineNumber++; if (debug) GdxAI.getLogger().info(LOG_TAG, "****NEWLINE**** "+lineNumber); } break; case 4: // line 243 "BehaviorTreeReader.rl" { indent++; } break; case 5: // line 246 "BehaviorTreeReader.rl" { if (taskIndex >= 0) { endStatement(); // Close the last task of the line } taskProcessed = true; if (statementName != null) endLine(); if (debug) GdxAI.getLogger().info(LOG_TAG, "endLine: indent: " + indent + " taskName: " + statementName + " data[" + p + "] = " + (p >= eof ? "EOF" : "\"" + data[p] + "\"")); } break; case 6: // line 255 "BehaviorTreeReader.rl" { s = p; } break; case 7: // line 258 "BehaviorTreeReader.rl" { if (reportsComments) { comment(new String(data, s, p - s)); } else { if (debug) GdxAI.getLogger().info(LOG_TAG, "# Comment"); } } break; case 8: // line 265 "BehaviorTreeReader.rl" { if (taskIndex++ < 0) { startLine(indent); // First task/guard of the line } else { endStatement(); // Close previous task/guard in line } statementName = new String(data, s, p - s); startStatement(statementName, isSubtreeRef, isGuard); // Start this task/guard isGuard = false; } break; case 9: // line 276 "BehaviorTreeReader.rl" { attrName = new String(data, s, p - s); } break; case 10: // line 290 "BehaviorTreeReader.rl" {isSubtreeRef = false;} break; case 11: // line 291 "BehaviorTreeReader.rl" {isSubtreeRef = true;} break; case 12: // line 293 "BehaviorTreeReader.rl" {isGuard = true;} break; case 13: // line 293 "BehaviorTreeReader.rl" {isGuard = false;} break; // line 408 "BehaviorTreeReader.java" } } } case 2: if ( cs == 0 ) { _goto_targ = 5; continue _goto; } if ( ++p != pe ) { _goto_targ = 1; continue _goto; } case 4: if ( p == eof ) { int __acts = _btree_eof_actions[cs]; int __nacts = (int) _btree_actions[__acts++]; while ( __nacts-- > 0 ) { switch ( _btree_actions[__acts++] ) { case 0: // line 148 "BehaviorTreeReader.rl" { String value = new String(data, s, p - s); s = p; if (needsUnescape) value = unescape(value); outer: if (stringIsUnquoted) { if (debug) GdxAI.getLogger().info(LOG_TAG, "string: " + attrName + "=" + value); if (value.equals("true")) { if (debug) GdxAI.getLogger().info(LOG_TAG, "boolean: " + attrName + "=true"); attribute(attrName, Boolean.TRUE); break outer; } else if (value.equals("false")) { if (debug) GdxAI.getLogger().info(LOG_TAG, "boolean: " + attrName + "=false"); attribute(attrName, Boolean.FALSE); break outer; } else if (value.equals("null")) { attribute(attrName, null); break outer; } else { // number try { if (containsFloatingPointCharacters(value)) { if (debug) GdxAI.getLogger().info(LOG_TAG, "double: " + attrName + "=" + Double.parseDouble(value)); attribute(attrName, new Double(value)); break outer; } else { if (debug) GdxAI.getLogger().info(LOG_TAG, "double: " + attrName + "=" + Double.parseDouble(value)); attribute(attrName, new Long(value)); break outer; } } catch (NumberFormatException nfe) { throw new GdxRuntimeException("Attribute value must be a number, a boolean, a string or null"); } } } else { if (debug) GdxAI.getLogger().info(LOG_TAG, "string: " + attrName + "=\"" + value + "\""); attribute(attrName, value); } stringIsUnquoted = false; } break; case 5: // line 246 "BehaviorTreeReader.rl" { if (taskIndex >= 0) { endStatement(); // Close the last task of the line } taskProcessed = true; if (statementName != null) endLine(); if (debug) GdxAI.getLogger().info(LOG_TAG, "endLine: indent: " + indent + " taskName: " + statementName + " data[" + p + "] = " + (p >= eof ? "EOF" : "\"" + data[p] + "\"")); } break; case 6: // line 255 "BehaviorTreeReader.rl" { s = p; } break; case 7: // line 258 "BehaviorTreeReader.rl" { if (reportsComments) { comment(new String(data, s, p - s)); } else { if (debug) GdxAI.getLogger().info(LOG_TAG, "# Comment"); } } break; case 8: // line 265 "BehaviorTreeReader.rl" { if (taskIndex++ < 0) { startLine(indent); // First task/guard of the line } else { endStatement(); // Close previous task/guard in line } statementName = new String(data, s, p - s); startStatement(statementName, isSubtreeRef, isGuard); // Start this task/guard isGuard = false; } break; case 10: // line 290 "BehaviorTreeReader.rl" {isSubtreeRef = false;} break; case 11: // line 291 "BehaviorTreeReader.rl" {isSubtreeRef = true;} break; // line 522 "BehaviorTreeReader.java" } } } case 5: } break; } } // line 301 "BehaviorTreeReader.rl" } catch (RuntimeException ex) { parseRuntimeEx = ex; } if (p < pe || (statementName != null && !taskProcessed)) { throw new SerializationException("Error parsing behavior tree on line " + lineNumber + " near: " + new String(data, p, pe - p), parseRuntimeEx); } else if (parseRuntimeEx != null) { throw new SerializationException("Error parsing behavior tree: " + new String(data), parseRuntimeEx); } } }
public class class_name { public void parse (char[] data, int offset, int length) { int cs, p = offset, pe = length, eof = pe; int s = 0; int indent = 0; int taskIndex = -1; boolean isGuard = false; boolean isSubtreeRef = false; String statementName = null; boolean taskProcessed = false; boolean needsUnescape = false; boolean stringIsUnquoted = false; RuntimeException parseRuntimeEx = null; String attrName = null; lineNumber = 1; try { // line 147 "BehaviorTreeReader.java" { cs = btree_start; } // line 151 "BehaviorTreeReader.java" { int _klen; int _trans = 0; int _acts; int _nacts; int _keys; int _goto_targ = 0; _goto: while (true) { switch ( _goto_targ ) { case 0: if ( p == pe ) { _goto_targ = 4; // depends on control dependency: [if], data = [none] continue _goto; } if ( cs == 0 ) { _goto_targ = 5; // depends on control dependency: [if], data = [none] continue _goto; } case 1: _match: do { _keys = _btree_key_offsets[cs]; _trans = _btree_index_offsets[cs]; _klen = _btree_single_lengths[cs]; if ( _klen > 0 ) { int _lower = _keys; int _mid; int _upper = _keys + _klen - 1; while (true) { if ( _upper < _lower ) break; _mid = _lower + ((_upper-_lower) >> 1); // depends on control dependency: [while], data = [none] if ( data[p] < _btree_trans_keys[_mid] ) _upper = _mid - 1; else if ( data[p] > _btree_trans_keys[_mid] ) _lower = _mid + 1; else { _trans += (_mid - _keys); // depends on control dependency: [if], data = [none] break _match; } } _keys += _klen; // depends on control dependency: [if], data = [none] _trans += _klen; // depends on control dependency: [if], data = [none] } _klen = _btree_range_lengths[cs]; if ( _klen > 0 ) { int _lower = _keys; int _mid; int _upper = _keys + (_klen<<1) - 2; while (true) { if ( _upper < _lower ) break; _mid = _lower + (((_upper-_lower) >> 1) & ~1); // depends on control dependency: [while], data = [none] if ( data[p] < _btree_trans_keys[_mid] ) _upper = _mid - 2; else if ( data[p] > _btree_trans_keys[_mid+1] ) _lower = _mid + 2; else { _trans += ((_mid - _keys)>>1); // depends on control dependency: [if], data = [none] break _match; } } _trans += _klen; // depends on control dependency: [if], data = [none] } } while (false); _trans = _btree_indicies[_trans]; cs = _btree_trans_targs[_trans]; if ( _btree_trans_actions[_trans] != 0 ) { _acts = _btree_trans_actions[_trans]; // depends on control dependency: [if], data = [none] _nacts = (int) _btree_actions[_acts++]; // depends on control dependency: [if], data = [none] while ( _nacts-- > 0 ) { switch ( _btree_actions[_acts++] ) { case 0: // line 148 "BehaviorTreeReader.rl" { String value = new String(data, s, p - s); s = p; if (needsUnescape) value = unescape(value); outer: if (stringIsUnquoted) { if (debug) GdxAI.getLogger().info(LOG_TAG, "string: " + attrName + "=" + value); if (value.equals("true")) { if (debug) GdxAI.getLogger().info(LOG_TAG, "boolean: " + attrName + "=true"); attribute(attrName, Boolean.TRUE); // depends on control dependency: [if], data = [none] break outer; } else if (value.equals("false")) { if (debug) GdxAI.getLogger().info(LOG_TAG, "boolean: " + attrName + "=false"); attribute(attrName, Boolean.FALSE); // depends on control dependency: [if], data = [none] break outer; } else if (value.equals("null")) { attribute(attrName, null); // depends on control dependency: [if], data = [none] break outer; } else { // number try { if (containsFloatingPointCharacters(value)) { if (debug) GdxAI.getLogger().info(LOG_TAG, "double: " + attrName + "=" + Double.parseDouble(value)); attribute(attrName, new Double(value)); // depends on control dependency: [if], data = [none] break outer; } else { if (debug) GdxAI.getLogger().info(LOG_TAG, "double: " + attrName + "=" + Double.parseDouble(value)); attribute(attrName, new Long(value)); // depends on control dependency: [if], data = [none] break outer; } } catch (NumberFormatException nfe) { throw new GdxRuntimeException("Attribute value must be a number, a boolean, a string or null"); } // depends on control dependency: [catch], data = [none] } } else { if (debug) GdxAI.getLogger().info(LOG_TAG, "string: " + attrName + "=\"" + value + "\""); attribute(attrName, value); // depends on control dependency: [if], data = [none] } stringIsUnquoted = false; } break; case 1: // line 188 "BehaviorTreeReader.rl" { if (debug) GdxAI.getLogger().info(LOG_TAG, "unquotedChars"); s = p; needsUnescape = false; stringIsUnquoted = true; outer: while (true) { switch (data[p]) { case '\\': needsUnescape = true; break; case ')': case '(': case ' ': case '\r': case '\n': case '\t': break outer; } // if (debug) GdxAI.getLogger().info(LOG_TAG, "unquotedChar (value): '" + data[p] + "'"); p++; // depends on control dependency: [while], data = [none] if (p == eof) break; } p--; } break; case 2: // line 213 "BehaviorTreeReader.rl" { if (debug) GdxAI.getLogger().info(LOG_TAG, "quotedChars"); s = ++p; needsUnescape = false; outer: while (true) { switch (data[p]) { case '\\': needsUnescape = true; p++; break; case '"': break outer; } // if (debug) GdxAI.getLogger().info(LOG_TAG, "quotedChar: '" + data[p] + "'"); p++; // depends on control dependency: [while], data = [none] if (p == eof) break; } p--; } break; case 3: // line 233 "BehaviorTreeReader.rl" { indent = 0; taskIndex = -1; isGuard = false; isSubtreeRef = false; statementName = null; taskProcessed = false; lineNumber++; if (debug) GdxAI.getLogger().info(LOG_TAG, "****NEWLINE**** "+lineNumber); } break; case 4: // line 243 "BehaviorTreeReader.rl" { indent++; } break; case 5: // line 246 "BehaviorTreeReader.rl" { if (taskIndex >= 0) { endStatement(); // Close the last task of the line // depends on control dependency: [if], data = [none] } taskProcessed = true; if (statementName != null) endLine(); if (debug) GdxAI.getLogger().info(LOG_TAG, "endLine: indent: " + indent + " taskName: " + statementName + " data[" + p + "] = " + (p >= eof ? "EOF" : "\"" + data[p] + "\"")); } break; case 6: // line 255 "BehaviorTreeReader.rl" { s = p; } break; case 7: // line 258 "BehaviorTreeReader.rl" { if (reportsComments) { comment(new String(data, s, p - s)); // depends on control dependency: [if], data = [none] } else { if (debug) GdxAI.getLogger().info(LOG_TAG, "# Comment"); } } break; case 8: // line 265 "BehaviorTreeReader.rl" { if (taskIndex++ < 0) { startLine(indent); // First task/guard of the line // depends on control dependency: [if], data = [none] } else { endStatement(); // Close previous task/guard in line // depends on control dependency: [if], data = [none] } statementName = new String(data, s, p - s); startStatement(statementName, isSubtreeRef, isGuard); // Start this task/guard isGuard = false; } break; case 9: // line 276 "BehaviorTreeReader.rl" { attrName = new String(data, s, p - s); } break; case 10: // line 290 "BehaviorTreeReader.rl" {isSubtreeRef = false;} break; case 11: // line 291 "BehaviorTreeReader.rl" {isSubtreeRef = true;} break; case 12: // line 293 "BehaviorTreeReader.rl" {isGuard = true;} break; case 13: // line 293 "BehaviorTreeReader.rl" {isGuard = false;} break; // line 408 "BehaviorTreeReader.java" } } } case 2: if ( cs == 0 ) { _goto_targ = 5; // depends on control dependency: [if], data = [none] continue _goto; } if ( ++p != pe ) { _goto_targ = 1; // depends on control dependency: [if], data = [none] continue _goto; } case 4: if ( p == eof ) { int __acts = _btree_eof_actions[cs]; int __nacts = (int) _btree_actions[__acts++]; while ( __nacts-- > 0 ) { switch ( _btree_actions[__acts++] ) { case 0: // line 148 "BehaviorTreeReader.rl" { String value = new String(data, s, p - s); s = p; if (needsUnescape) value = unescape(value); outer: if (stringIsUnquoted) { if (debug) GdxAI.getLogger().info(LOG_TAG, "string: " + attrName + "=" + value); if (value.equals("true")) { if (debug) GdxAI.getLogger().info(LOG_TAG, "boolean: " + attrName + "=true"); attribute(attrName, Boolean.TRUE); // depends on control dependency: [if], data = [none] break outer; } else if (value.equals("false")) { if (debug) GdxAI.getLogger().info(LOG_TAG, "boolean: " + attrName + "=false"); attribute(attrName, Boolean.FALSE); // depends on control dependency: [if], data = [none] break outer; } else if (value.equals("null")) { attribute(attrName, null); // depends on control dependency: [if], data = [none] break outer; } else { // number try { if (containsFloatingPointCharacters(value)) { if (debug) GdxAI.getLogger().info(LOG_TAG, "double: " + attrName + "=" + Double.parseDouble(value)); attribute(attrName, new Double(value)); // depends on control dependency: [if], data = [none] break outer; } else { if (debug) GdxAI.getLogger().info(LOG_TAG, "double: " + attrName + "=" + Double.parseDouble(value)); attribute(attrName, new Long(value)); // depends on control dependency: [if], data = [none] break outer; } } catch (NumberFormatException nfe) { throw new GdxRuntimeException("Attribute value must be a number, a boolean, a string or null"); } // depends on control dependency: [catch], data = [none] } } else { if (debug) GdxAI.getLogger().info(LOG_TAG, "string: " + attrName + "=\"" + value + "\""); attribute(attrName, value); // depends on control dependency: [if], data = [none] } stringIsUnquoted = false; } break; case 5: // line 246 "BehaviorTreeReader.rl" { if (taskIndex >= 0) { endStatement(); // Close the last task of the line // depends on control dependency: [if], data = [none] } taskProcessed = true; if (statementName != null) endLine(); if (debug) GdxAI.getLogger().info(LOG_TAG, "endLine: indent: " + indent + " taskName: " + statementName + " data[" + p + "] = " + (p >= eof ? "EOF" : "\"" + data[p] + "\"")); } break; case 6: // line 255 "BehaviorTreeReader.rl" { s = p; } break; case 7: // line 258 "BehaviorTreeReader.rl" { if (reportsComments) { comment(new String(data, s, p - s)); // depends on control dependency: [if], data = [none] } else { if (debug) GdxAI.getLogger().info(LOG_TAG, "# Comment"); } } break; case 8: // line 265 "BehaviorTreeReader.rl" { if (taskIndex++ < 0) { startLine(indent); // First task/guard of the line // depends on control dependency: [if], data = [none] } else { endStatement(); // Close previous task/guard in line // depends on control dependency: [if], data = [none] } statementName = new String(data, s, p - s); startStatement(statementName, isSubtreeRef, isGuard); // Start this task/guard isGuard = false; } break; case 10: // line 290 "BehaviorTreeReader.rl" {isSubtreeRef = false;} break; case 11: // line 291 "BehaviorTreeReader.rl" {isSubtreeRef = true;} break; // line 522 "BehaviorTreeReader.java" } } } case 5: } break; } } // line 301 "BehaviorTreeReader.rl" } catch (RuntimeException ex) { parseRuntimeEx = ex; } // depends on control dependency: [catch], data = [none] if (p < pe || (statementName != null && !taskProcessed)) { throw new SerializationException("Error parsing behavior tree on line " + lineNumber + " near: " + new String(data, p, pe - p), parseRuntimeEx); } else if (parseRuntimeEx != null) { throw new SerializationException("Error parsing behavior tree: " + new String(data), parseRuntimeEx); } } }
public class class_name { protected void service(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { String id; if (req.getParameterValues(Service.REQUEST_TARGET_PATH) != null) { id = req.getParameterValues(Service.REQUEST_TARGET_PATH)[0]; } else { Matcher m = URI_REGEX.matcher(req.getRequestURI()); if (m.matches()) { id = m.group(1); } else { _logger.warning("Request not recognized: " + req.getRequestURI()); res.sendError(HttpServletResponse.SC_NOT_FOUND); return; } } Pair<Service, Persistence> service = ServicePlatform.getService(id); if (service == null) { _logger.warning("Request not recognized: " + req.getRequestURI()); res.sendError(HttpServletResponse.SC_NOT_FOUND); return; } List<File> upload = new ArrayList<File>(); DataBinder binder = new DataBinder(); try { if (ServletFileUpload.isMultipartContent(req)) { try { FileItemIterator it = new ServletFileUpload().getItemIterator(req); while (it.hasNext()) { FileItemStream item = it.next(); String name = item.getFieldName(); InputStream stream = item.openStream(); if (item.isFormField()) { binder.put(name, Streams.asString(stream)); } else { // File field with file name in item.getName() String original = item.getName(); int dot = original.lastIndexOf('.'); // store the file in a temporary place File file = File.createTempFile("xillium", dot > 0 ? original.substring(dot) : null, TEMPORARY); OutputStream out = new FileOutputStream(file); byte[] buffer = new byte[1024*1024]; int length; while ((length = stream.read(buffer)) >= 0) out.write(buffer, 0, length); out.close(); binder.put(name, original); binder.put(name + ":path", file.getAbsolutePath()); upload.add(file); } } } catch (FileUploadException x) { throw new RuntimeException("Failed to parse multipart content", x); } } else { String method = req.getMethod().toLowerCase(); if (service.first instanceof DataBinder.WithDecoder && "post".equals(method)) { ((DataBinder.WithDecoder)service.first).getDataBinderDecoder().decode(binder, req.getInputStream()).close(); } else { String content = req.getContentType(); if (content != null && isPostedXML(method, content.toLowerCase())) { XDBCodec.decode(binder, req.getInputStream()).close(); binder.put(Service.SERVICE_XML_CONTENT, Service.SERVICE_XML_CONTENT); } } Enumeration<String> en = req.getParameterNames(); while (en.hasMoreElements()) { String name = en.nextElement(); String[] values = req.getParameterValues(name); if (values.length == 1) { binder.put(name, values[0]); } else { StringBuilder sb = new StringBuilder(); for (int i = 0; i < values.length; ++i) { sb.append('{').append(values[i]).append('}'); } binder.put(name, sb.toString()); } } } // auto-parameters binder.putNamedObject(Service.REQUEST_SERVLET_REQ, req); binder.put(Service.REQUEST_CLIENT_ADDR, req.getRemoteAddr()); binder.put(Service.REQUEST_CLIENT_PORT, String.valueOf(req.getRemotePort())); binder.put(Service.REQUEST_SERVER_PORT, String.valueOf(req.getServerPort())); binder.put(Service.REQUEST_HTTP_METHOD, req.getMethod()); binder.put(Service.REQUEST_SERVER_PATH, _application); binder.put(Service.REQUEST_TARGET_PATH, id); binder.putNamedObject(Service.REQUEST_HTTP_COOKIE, req.getCookies()); if (req.isSecure()) binder.put(Service.REQUEST_HTTP_SECURE, Service.REQUEST_HTTP_SECURE); if (id.startsWith("x!/")) { req.setAttribute("intrinsic", "intrinsic"); } else if (id.endsWith(".html")) { // TODO provide a default, error reporting page template } // pre-service filtration if (service.first instanceof Service.Extended) { try { ((Service.Extended)service.first).filtrate(binder); } catch (AuthenticationRequiredException x) { if (binder.get(Service.REQUEST_HTTP_STATUS) != null) { res.sendError(HttpServletResponse.SC_UNAUTHORIZED); return; } else { throw x; } } catch (AuthorizationException x) { if (binder.get(Service.REQUEST_HTTP_STATUS) != null) { res.sendError(HttpServletResponse.SC_FORBIDDEN); return; } else { throw x; } } } // locate persistence object // authorization if (service.first instanceof Service.Secured) { try { ((Service.Secured)service.first).authorize(id, binder, service.second); } catch (AuthenticationRequiredException x) { if (binder.get(Service.REQUEST_HTTP_STATUS) != null) { res.sendError(HttpServletResponse.SC_UNAUTHORIZED); return; } else { throw x; } } catch (AuthorizationException x) { if (binder.get(Service.REQUEST_HTTP_STATUS) != null) { res.sendError(HttpServletResponse.SC_FORBIDDEN); return; } else { throw x; } } } // acknowledgement if (service.first instanceof Service.Extended) { try { ((Service.Extended)service.first).acknowledge(binder); } catch (Throwable t) {} } binder = service.first.run(binder, ServicePlatform.getReifier(), service.second); // post-service filter if (service.first instanceof Service.Extended) { try { ((Service.Extended)service.first).successful(binder); } catch (Throwable t) {} } // post-service action (deprecated) try { Runnable task = (Runnable)binder.getNamedObject(Service.SERVICE_POST_ACTION); if (task != null) { task.run(); } } catch (Throwable t) { _logger.warning("In post-service processing caught " + t.getClass() + ": " + t.getMessage()); } } catch (Throwable x) { // if a new binder can't be returned from Service.run, it can be placed in the original binder as a named object Object replacement = binder.getNamedObject(Service.SERVICE_DATA_BINDER); if (replacement != null && replacement instanceof DataBinder) { binder = (DataBinder)replacement; } String message = Throwables.getFirstMessage(x); if (x instanceof org.springframework.transaction.TransactionException) { Matcher matcher = SQL_CONSTRAINT.matcher(message); if (matcher.find()) { message = CrudConfiguration.icve.get(matcher.group(1)); if (message == null) { message = matcher.group(1); } } } binder.put(Service.FAILURE_MESSAGE, message); // post-service exception handler if (service.first instanceof Service.Extended) { try { ((Service.Extended)service.first).aborted(binder, x); } catch (Throwable t) {} } boolean sst = !(binder.get(Service.SERVICE_STACK_TRACE) == null); boolean pst = !(System.getProperty("xillium.service.PrintStackTrace") == null || id.startsWith("x!/")); if (sst || pst) { CharArrayWriter sw = new CharArrayWriter(); x.printStackTrace(new PrintWriter(sw)); String stack = sw.toString(); if (sst) binder.put(Service.FAILURE_STACK, stack); if (pst) _logger.warning(x.getClass().getSimpleName() + " caught in (" + id + "): " + message + '\n' + stack); } } finally { // post-service filter if (service.first instanceof Service.Extended) { try { ((Service.Extended)service.first).complete(binder); } catch (Throwable t) {} } res.setHeader("Access-Control-Allow-Headers", "origin,x-prototype-version,x-requested-with,accept"); res.setHeader("Access-Control-Allow-Origin", "*"); try { // HTTP headers @SuppressWarnings("unchecked") Multimap<String, String> headers = binder.getNamedObject(Service.SERVICE_HTTP_HEADER, Multimap.class); if (headers != null) { try { for (Map.Entry<String, List<String>> e: headers.entrySet()) { for (String value: e.getValue()) res.setHeader(e.getKey(), value); } } catch (Exception x) {} } String status; // return status only? if ((status = binder.get(Service.SERVICE_DO_REDIRECT)) != null) { try { res.sendRedirect(status); } catch (Exception x) { _logger.log(Level.WARNING, x.getMessage(), x); } } else if ((status = binder.get(Service.SERVICE_HTTP_STATUS)) != null) { try { res.setStatus(Integer.parseInt(status)); } catch (Exception x) { _logger.log(Level.WARNING, x.getMessage(), x); } } else { String page = binder.get(Service.SERVICE_PAGE_TARGET); if (page == null) { if (service.first instanceof DataBinder.WithEncoder) { DataBinder.Encoder encoder = ((DataBinder.WithEncoder)service.first).getDataBinderEncoder(); binder.clearAutoValues(); res.setContentType(encoder.getContentType(binder)); try { encoder.encode(res.getOutputStream(), binder).flush(); } catch (Exception x) { // bugs in the encoder? _logger.log(Level.FINE, x.getMessage(), x); } } else if (binder.find(Service.SERVICE_XML_CONTENT) != null) { binder.clearAutoValues(); res.setContentType("application/xml;charset=utf-8"); try { XDBCodec.encode(res.getWriter(), binder).flush(); } catch (Exception x) { // bugs in the codec? _logger.log(Level.FINE, x.getMessage(), x); } } else { String callback = binder.get(Service.REQUEST_JS_CALLBACK); binder.clearAutoValues(); if (callback != null) { res.setContentType("application/javascript;charset=utf-8"); } else if (id.endsWith(".html")) { res.setContentType("text/html;charset=utf-8"); } else if (id.endsWith(".text")) { res.setContentType("text/plain;charset=utf-8"); } else { res.setContentType("application/json;charset=utf-8"); } String json = binder.get(Service.SERVICE_JSON_TUNNEL); if (json == null) { json = binder.toJSON(); } if (callback != null) { res.getWriter().append(callback).append('(').append(json).append(");").flush(); } else { res.getWriter().append(json).flush(); } } } else { _logger.fine("\t=> " + getServletContext().getResource(page)); req.setAttribute(Service.SERVICE_DATA_BINDER, binder); getServletContext().getRequestDispatcher(page).include(req, res); } } } finally { for (File tmp: upload) { try { tmp.delete(); } catch (Exception x) {} } } } } }
public class class_name { protected void service(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { String id; if (req.getParameterValues(Service.REQUEST_TARGET_PATH) != null) { id = req.getParameterValues(Service.REQUEST_TARGET_PATH)[0]; } else { Matcher m = URI_REGEX.matcher(req.getRequestURI()); if (m.matches()) { id = m.group(1); // depends on control dependency: [if], data = [none] } else { _logger.warning("Request not recognized: " + req.getRequestURI()); // depends on control dependency: [if], data = [none] res.sendError(HttpServletResponse.SC_NOT_FOUND); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } } Pair<Service, Persistence> service = ServicePlatform.getService(id); if (service == null) { _logger.warning("Request not recognized: " + req.getRequestURI()); res.sendError(HttpServletResponse.SC_NOT_FOUND); return; } List<File> upload = new ArrayList<File>(); DataBinder binder = new DataBinder(); try { if (ServletFileUpload.isMultipartContent(req)) { try { FileItemIterator it = new ServletFileUpload().getItemIterator(req); while (it.hasNext()) { FileItemStream item = it.next(); String name = item.getFieldName(); InputStream stream = item.openStream(); if (item.isFormField()) { binder.put(name, Streams.asString(stream)); // depends on control dependency: [if], data = [none] } else { // File field with file name in item.getName() String original = item.getName(); int dot = original.lastIndexOf('.'); // store the file in a temporary place File file = File.createTempFile("xillium", dot > 0 ? original.substring(dot) : null, TEMPORARY); OutputStream out = new FileOutputStream(file); byte[] buffer = new byte[1024*1024]; int length; while ((length = stream.read(buffer)) >= 0) out.write(buffer, 0, length); out.close(); // depends on control dependency: [if], data = [none] binder.put(name, original); // depends on control dependency: [if], data = [none] binder.put(name + ":path", file.getAbsolutePath()); // depends on control dependency: [if], data = [none] upload.add(file); // depends on control dependency: [if], data = [none] } } } catch (FileUploadException x) { throw new RuntimeException("Failed to parse multipart content", x); } // depends on control dependency: [catch], data = [none] } else { String method = req.getMethod().toLowerCase(); if (service.first instanceof DataBinder.WithDecoder && "post".equals(method)) { ((DataBinder.WithDecoder)service.first).getDataBinderDecoder().decode(binder, req.getInputStream()).close(); // depends on control dependency: [if], data = [none] } else { String content = req.getContentType(); if (content != null && isPostedXML(method, content.toLowerCase())) { XDBCodec.decode(binder, req.getInputStream()).close(); // depends on control dependency: [if], data = [none] binder.put(Service.SERVICE_XML_CONTENT, Service.SERVICE_XML_CONTENT); // depends on control dependency: [if], data = [none] } } Enumeration<String> en = req.getParameterNames(); while (en.hasMoreElements()) { String name = en.nextElement(); String[] values = req.getParameterValues(name); if (values.length == 1) { binder.put(name, values[0]); // depends on control dependency: [if], data = [none] } else { StringBuilder sb = new StringBuilder(); for (int i = 0; i < values.length; ++i) { sb.append('{').append(values[i]).append('}'); // depends on control dependency: [for], data = [i] } binder.put(name, sb.toString()); // depends on control dependency: [if], data = [none] } } } // auto-parameters binder.putNamedObject(Service.REQUEST_SERVLET_REQ, req); binder.put(Service.REQUEST_CLIENT_ADDR, req.getRemoteAddr()); binder.put(Service.REQUEST_CLIENT_PORT, String.valueOf(req.getRemotePort())); binder.put(Service.REQUEST_SERVER_PORT, String.valueOf(req.getServerPort())); binder.put(Service.REQUEST_HTTP_METHOD, req.getMethod()); binder.put(Service.REQUEST_SERVER_PATH, _application); binder.put(Service.REQUEST_TARGET_PATH, id); binder.putNamedObject(Service.REQUEST_HTTP_COOKIE, req.getCookies()); if (req.isSecure()) binder.put(Service.REQUEST_HTTP_SECURE, Service.REQUEST_HTTP_SECURE); if (id.startsWith("x!/")) { req.setAttribute("intrinsic", "intrinsic"); // depends on control dependency: [if], data = [none] } else if (id.endsWith(".html")) { // TODO provide a default, error reporting page template } // pre-service filtration if (service.first instanceof Service.Extended) { try { ((Service.Extended)service.first).filtrate(binder); // depends on control dependency: [try], data = [none] } catch (AuthenticationRequiredException x) { if (binder.get(Service.REQUEST_HTTP_STATUS) != null) { res.sendError(HttpServletResponse.SC_UNAUTHORIZED); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } else { throw x; } } catch (AuthorizationException x) { // depends on control dependency: [catch], data = [none] if (binder.get(Service.REQUEST_HTTP_STATUS) != null) { res.sendError(HttpServletResponse.SC_FORBIDDEN); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } else { throw x; } } // depends on control dependency: [catch], data = [none] } // locate persistence object // authorization if (service.first instanceof Service.Secured) { try { ((Service.Secured)service.first).authorize(id, binder, service.second); // depends on control dependency: [try], data = [none] } catch (AuthenticationRequiredException x) { if (binder.get(Service.REQUEST_HTTP_STATUS) != null) { res.sendError(HttpServletResponse.SC_UNAUTHORIZED); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } else { throw x; } } catch (AuthorizationException x) { // depends on control dependency: [catch], data = [none] if (binder.get(Service.REQUEST_HTTP_STATUS) != null) { res.sendError(HttpServletResponse.SC_FORBIDDEN); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } else { throw x; } } // depends on control dependency: [catch], data = [none] } // acknowledgement if (service.first instanceof Service.Extended) { try { ((Service.Extended)service.first).acknowledge(binder); } catch (Throwable t) {} // depends on control dependency: [try], data = [none] // depends on control dependency: [catch], data = [none] } binder = service.first.run(binder, ServicePlatform.getReifier(), service.second); // post-service filter if (service.first instanceof Service.Extended) { try { ((Service.Extended)service.first).successful(binder); } catch (Throwable t) {} // depends on control dependency: [try], data = [none] // depends on control dependency: [catch], data = [none] } // post-service action (deprecated) try { Runnable task = (Runnable)binder.getNamedObject(Service.SERVICE_POST_ACTION); if (task != null) { task.run(); // depends on control dependency: [if], data = [none] } } catch (Throwable t) { _logger.warning("In post-service processing caught " + t.getClass() + ": " + t.getMessage()); } // depends on control dependency: [catch], data = [none] } catch (Throwable x) { // if a new binder can't be returned from Service.run, it can be placed in the original binder as a named object Object replacement = binder.getNamedObject(Service.SERVICE_DATA_BINDER); if (replacement != null && replacement instanceof DataBinder) { binder = (DataBinder)replacement; // depends on control dependency: [if], data = [none] } String message = Throwables.getFirstMessage(x); if (x instanceof org.springframework.transaction.TransactionException) { Matcher matcher = SQL_CONSTRAINT.matcher(message); if (matcher.find()) { message = CrudConfiguration.icve.get(matcher.group(1)); // depends on control dependency: [if], data = [none] if (message == null) { message = matcher.group(1); // depends on control dependency: [if], data = [none] } } } binder.put(Service.FAILURE_MESSAGE, message); // post-service exception handler if (service.first instanceof Service.Extended) { try { ((Service.Extended)service.first).aborted(binder, x); } catch (Throwable t) {} // depends on control dependency: [try], data = [none] // depends on control dependency: [catch], data = [none] } boolean sst = !(binder.get(Service.SERVICE_STACK_TRACE) == null); boolean pst = !(System.getProperty("xillium.service.PrintStackTrace") == null || id.startsWith("x!/")); if (sst || pst) { CharArrayWriter sw = new CharArrayWriter(); x.printStackTrace(new PrintWriter(sw)); // depends on control dependency: [if], data = [none] String stack = sw.toString(); if (sst) binder.put(Service.FAILURE_STACK, stack); if (pst) _logger.warning(x.getClass().getSimpleName() + " caught in (" + id + "): " + message + '\n' + stack); } } finally { // post-service filter if (service.first instanceof Service.Extended) { try { ((Service.Extended)service.first).complete(binder); } catch (Throwable t) {} // depends on control dependency: [try], data = [none] // depends on control dependency: [catch], data = [none] } res.setHeader("Access-Control-Allow-Headers", "origin,x-prototype-version,x-requested-with,accept"); res.setHeader("Access-Control-Allow-Origin", "*"); try { // HTTP headers @SuppressWarnings("unchecked") Multimap<String, String> headers = binder.getNamedObject(Service.SERVICE_HTTP_HEADER, Multimap.class); if (headers != null) { try { for (Map.Entry<String, List<String>> e: headers.entrySet()) { for (String value: e.getValue()) res.setHeader(e.getKey(), value); } } catch (Exception x) {} // depends on control dependency: [catch], data = [none] } String status; // return status only? if ((status = binder.get(Service.SERVICE_DO_REDIRECT)) != null) { try { res.sendRedirect(status); } catch (Exception x) { _logger.log(Level.WARNING, x.getMessage(), x); } // depends on control dependency: [try], data = [none] // depends on control dependency: [catch], data = [none] } else if ((status = binder.get(Service.SERVICE_HTTP_STATUS)) != null) { try { res.setStatus(Integer.parseInt(status)); } catch (Exception x) { _logger.log(Level.WARNING, x.getMessage(), x); } // depends on control dependency: [try], data = [none] // depends on control dependency: [catch], data = [none] } else { String page = binder.get(Service.SERVICE_PAGE_TARGET); if (page == null) { if (service.first instanceof DataBinder.WithEncoder) { DataBinder.Encoder encoder = ((DataBinder.WithEncoder)service.first).getDataBinderEncoder(); binder.clearAutoValues(); // depends on control dependency: [if], data = [none] res.setContentType(encoder.getContentType(binder)); // depends on control dependency: [if], data = [none] try { encoder.encode(res.getOutputStream(), binder).flush(); // depends on control dependency: [try], data = [none] } catch (Exception x) { // bugs in the encoder? _logger.log(Level.FINE, x.getMessage(), x); } // depends on control dependency: [catch], data = [none] } else if (binder.find(Service.SERVICE_XML_CONTENT) != null) { binder.clearAutoValues(); // depends on control dependency: [if], data = [none] res.setContentType("application/xml;charset=utf-8"); // depends on control dependency: [if], data = [none] try { XDBCodec.encode(res.getWriter(), binder).flush(); // depends on control dependency: [try], data = [none] } catch (Exception x) { // bugs in the codec? _logger.log(Level.FINE, x.getMessage(), x); } // depends on control dependency: [catch], data = [none] } else { String callback = binder.get(Service.REQUEST_JS_CALLBACK); binder.clearAutoValues(); // depends on control dependency: [if], data = [none] if (callback != null) { res.setContentType("application/javascript;charset=utf-8"); // depends on control dependency: [if], data = [none] } else if (id.endsWith(".html")) { res.setContentType("text/html;charset=utf-8"); // depends on control dependency: [if], data = [none] } else if (id.endsWith(".text")) { res.setContentType("text/plain;charset=utf-8"); // depends on control dependency: [if], data = [none] } else { res.setContentType("application/json;charset=utf-8"); // depends on control dependency: [if], data = [none] } String json = binder.get(Service.SERVICE_JSON_TUNNEL); if (json == null) { json = binder.toJSON(); // depends on control dependency: [if], data = [none] } if (callback != null) { res.getWriter().append(callback).append('(').append(json).append(");").flush(); // depends on control dependency: [if], data = [(callback] // depends on control dependency: [if], data = [none] } else { res.getWriter().append(json).flush(); // depends on control dependency: [if], data = [none] } } } else { _logger.fine("\t=> " + getServletContext().getResource(page)); // depends on control dependency: [if], data = [(page] req.setAttribute(Service.SERVICE_DATA_BINDER, binder); // depends on control dependency: [if], data = [none] getServletContext().getRequestDispatcher(page).include(req, res); // depends on control dependency: [if], data = [(page] } } } finally { for (File tmp: upload) { try { tmp.delete(); } catch (Exception x) {} // depends on control dependency: [try], data = [none] // depends on control dependency: [catch], data = [none] } } } } }
public class class_name { private boolean executeSQL(String sql) throws TException, SQLException { isCancelled = false; String sqlToLowerCase = sql.toLowerCase().trim(); if (sqlToLowerCase.startsWith(SHOW_TIMESERIES_COMMAND_LOWERCASE)) { String[] cmdSplited = sql.split("\\s+"); if (cmdSplited.length != 3) { throw new SQLException("Error format of \'SHOW TIMESERIES <PATH>\'"); } else { String path = cmdSplited[2]; DatabaseMetaData databaseMetaData = connection.getMetaData(); resultSet = databaseMetaData.getColumns(TsFileDBConstant.CatalogTimeseries, path, null, null); return true; } } else if (sqlToLowerCase.equals(SHOW_STORAGE_GROUP_COMMAND_LOWERCASE)) { DatabaseMetaData databaseMetaData = connection.getMetaData(); resultSet = databaseMetaData.getColumns(TsFileDBConstant.CatalogStorageGroup, null, null, null); return true; } else { TSExecuteStatementReq execReq = new TSExecuteStatementReq(sessionHandle, sql); TSExecuteStatementResp execResp = client.executeStatement(execReq); operationHandle = execResp.getOperationHandle(); Utils.verifySuccess(execResp.getStatus()); if (execResp.getOperationHandle().hasResultSet) { resultSet = new TsfileQueryResultSet(this, execResp.getColumns(), client, sessionHandle, operationHandle, sql, execResp.getOperationType(), getColumnsType(execResp.getColumns())); return true; } return false; } } }
public class class_name { private boolean executeSQL(String sql) throws TException, SQLException { isCancelled = false; String sqlToLowerCase = sql.toLowerCase().trim(); if (sqlToLowerCase.startsWith(SHOW_TIMESERIES_COMMAND_LOWERCASE)) { String[] cmdSplited = sql.split("\\s+"); if (cmdSplited.length != 3) { throw new SQLException("Error format of \'SHOW TIMESERIES <PATH>\'"); } else { String path = cmdSplited[2]; DatabaseMetaData databaseMetaData = connection.getMetaData(); resultSet = databaseMetaData.getColumns(TsFileDBConstant.CatalogTimeseries, path, null, null); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } } else if (sqlToLowerCase.equals(SHOW_STORAGE_GROUP_COMMAND_LOWERCASE)) { DatabaseMetaData databaseMetaData = connection.getMetaData(); resultSet = databaseMetaData.getColumns(TsFileDBConstant.CatalogStorageGroup, null, null, null); return true; } else { TSExecuteStatementReq execReq = new TSExecuteStatementReq(sessionHandle, sql); TSExecuteStatementResp execResp = client.executeStatement(execReq); operationHandle = execResp.getOperationHandle(); Utils.verifySuccess(execResp.getStatus()); if (execResp.getOperationHandle().hasResultSet) { resultSet = new TsfileQueryResultSet(this, execResp.getColumns(), client, sessionHandle, operationHandle, sql, execResp.getOperationType(), getColumnsType(execResp.getColumns())); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } return false; } } }
public class class_name { private void unmarshall() { sheetData = sheet.getJaxbElement().getSheetData(); rows = sheetData.getRow(); if(rows != null && rows.size() > 0) { Row r = (Row)rows.get(0); numColumns = r.getC().size(); } } }
public class class_name { private void unmarshall() { sheetData = sheet.getJaxbElement().getSheetData(); rows = sheetData.getRow(); if(rows != null && rows.size() > 0) { Row r = (Row)rows.get(0); numColumns = r.getC().size(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public Map<X509Certificate, byte[]> getOcspResponses() { Map<X509Certificate, byte[]> copy = new HashMap<>(ocspResponses.size()); for (Map.Entry<X509Certificate, byte[]> e : ocspResponses.entrySet()) { copy.put(e.getKey(), e.getValue().clone()); } return copy; } }
public class class_name { public Map<X509Certificate, byte[]> getOcspResponses() { Map<X509Certificate, byte[]> copy = new HashMap<>(ocspResponses.size()); for (Map.Entry<X509Certificate, byte[]> e : ocspResponses.entrySet()) { copy.put(e.getKey(), e.getValue().clone()); // depends on control dependency: [for], data = [e] } return copy; } }
public class class_name { @Override public E lower(E e) { int idx = indexOf(e); if (idx >= 1) { return list.get(idx-1); } else { int ip = insertPoint(idx); if (ip >= 1) { return list.get(ip-1); } else { return null; } } } }
public class class_name { @Override public E lower(E e) { int idx = indexOf(e); if (idx >= 1) { return list.get(idx-1); // depends on control dependency: [if], data = [(idx] } else { int ip = insertPoint(idx); if (ip >= 1) { return list.get(ip-1); // depends on control dependency: [if], data = [(ip] } else { return null; // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void setConfigurationSetAttributeNames(java.util.Collection<String> configurationSetAttributeNames) { if (configurationSetAttributeNames == null) { this.configurationSetAttributeNames = null; return; } this.configurationSetAttributeNames = new com.amazonaws.internal.SdkInternalList<String>(configurationSetAttributeNames); } }
public class class_name { public void setConfigurationSetAttributeNames(java.util.Collection<String> configurationSetAttributeNames) { if (configurationSetAttributeNames == null) { this.configurationSetAttributeNames = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.configurationSetAttributeNames = new com.amazonaws.internal.SdkInternalList<String>(configurationSetAttributeNames); } }
public class class_name { public void removeApplication(String pid) { // remove the application listener from the set we know about and stop it ApplicationListeners listeners = _appListeners.remove(pid); //check that the app is known, this can be run after the app is already removed. if (listeners != null) { listeners.stopListeners(true); } } }
public class class_name { public void removeApplication(String pid) { // remove the application listener from the set we know about and stop it ApplicationListeners listeners = _appListeners.remove(pid); //check that the app is known, this can be run after the app is already removed. if (listeners != null) { listeners.stopListeners(true); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void addIdHasContainer(HasContainer hasContainer) { Preconditions.checkState(BaseStrategy.SUPPORTED_ID_BI_PREDICATE.contains(hasContainer.getBiPredicate()), "Only " + BaseStrategy.SUPPORTED_ID_BI_PREDICATE.toString() + " is supported, found " + hasContainer.getBiPredicate().getClass().toString()); Object rawId = hasContainer.getValue(); if (rawId instanceof Collection) { @SuppressWarnings("unchecked") Collection<Object> ids = (Collection<Object>) rawId; Set<String> idLabels = new HashSet<>(); for (Object id : ids) { if (id instanceof RecordId) { RecordId recordId = (RecordId) id; idLabels.add(recordId.getSchemaTable().toString()); } else if (id instanceof Element) { SqlgElement sqlgElement = (SqlgElement) id; RecordId recordId = (RecordId) sqlgElement.id(); idLabels.add(recordId.getSchemaTable().toString()); } else if (id instanceof String) { RecordId recordId = RecordId.from(id); idLabels.add(recordId.getSchemaTable().toString()); } else { throw new IllegalStateException("id must be an Element or a RecordId, found " + id.getClass().toString()); } } if (hasContainer.getBiPredicate() == Contains.without) { //The id's label needs to be added to previous labelHasContainers labels. //without indicates that the label needs to be queried along with the rest, 'or' logic rather than 'and'. if (!this.labelHasContainers.isEmpty()) { Object previousHasContainerLabels = this.labelHasContainers.get(this.labelHasContainers.size() - 1).getValue(); List<String> mergedLabels; if (previousHasContainerLabels instanceof Collection) { @SuppressWarnings("unchecked") Collection<String> labels = (Collection<String>) previousHasContainerLabels; mergedLabels = new ArrayList<>(labels); } else { String label = (String) previousHasContainerLabels; mergedLabels = new ArrayList<>(); mergedLabels.add(label); } mergedLabels.addAll(idLabels); this.labelHasContainers.set(this.labelHasContainers.size() - 1, new HasContainer(T.label.getAccessor(), P.within(mergedLabels))); } } else { this.labelHasContainers.add(new HasContainer(T.label.getAccessor(), P.within(idLabels))); } } else { RecordId recordId; if (rawId instanceof RecordId) { recordId = (RecordId) rawId; } else if (rawId instanceof Element) { SqlgElement sqlgElement = (SqlgElement) rawId; recordId = (RecordId) sqlgElement.id(); } else if (rawId instanceof String) { recordId = RecordId.from(rawId); } else { throw new IllegalStateException("id must be an Element or a RecordId, found " + id.getClass().toString()); } if (hasContainer.getBiPredicate() == Compare.neq) { if (!this.labelHasContainers.isEmpty()) { Object previousHasContainerLabels = this.labelHasContainers.get(this.labelHasContainers.size() - 1).getValue(); List<String> mergedLabels; if (previousHasContainerLabels instanceof Collection) { @SuppressWarnings("unchecked") Collection<String> labels = (Collection<String>) previousHasContainerLabels; mergedLabels = new ArrayList<>(labels); } else { String label = (String) previousHasContainerLabels; mergedLabels = new ArrayList<>(); mergedLabels.add(label); } mergedLabels.add(recordId.getSchemaTable().toString()); this.labelHasContainers.set(this.labelHasContainers.size() - 1, new HasContainer(T.label.getAccessor(), P.within(mergedLabels))); } } else { this.labelHasContainers.add(new HasContainer(T.label.getAccessor(), P.eq(recordId.getSchemaTable().toString()))); } } this.idHasContainers.add(hasContainer); } }
public class class_name { public void addIdHasContainer(HasContainer hasContainer) { Preconditions.checkState(BaseStrategy.SUPPORTED_ID_BI_PREDICATE.contains(hasContainer.getBiPredicate()), "Only " + BaseStrategy.SUPPORTED_ID_BI_PREDICATE.toString() + " is supported, found " + hasContainer.getBiPredicate().getClass().toString()); Object rawId = hasContainer.getValue(); if (rawId instanceof Collection) { @SuppressWarnings("unchecked") Collection<Object> ids = (Collection<Object>) rawId; Set<String> idLabels = new HashSet<>(); for (Object id : ids) { if (id instanceof RecordId) { RecordId recordId = (RecordId) id; idLabels.add(recordId.getSchemaTable().toString()); // depends on control dependency: [if], data = [none] } else if (id instanceof Element) { SqlgElement sqlgElement = (SqlgElement) id; RecordId recordId = (RecordId) sqlgElement.id(); idLabels.add(recordId.getSchemaTable().toString()); // depends on control dependency: [if], data = [none] } else if (id instanceof String) { RecordId recordId = RecordId.from(id); idLabels.add(recordId.getSchemaTable().toString()); // depends on control dependency: [if], data = [none] } else { throw new IllegalStateException("id must be an Element or a RecordId, found " + id.getClass().toString()); } } if (hasContainer.getBiPredicate() == Contains.without) { //The id's label needs to be added to previous labelHasContainers labels. //without indicates that the label needs to be queried along with the rest, 'or' logic rather than 'and'. if (!this.labelHasContainers.isEmpty()) { Object previousHasContainerLabels = this.labelHasContainers.get(this.labelHasContainers.size() - 1).getValue(); List<String> mergedLabels; if (previousHasContainerLabels instanceof Collection) { @SuppressWarnings("unchecked") Collection<String> labels = (Collection<String>) previousHasContainerLabels; mergedLabels = new ArrayList<>(labels); // depends on control dependency: [if], data = [none] } else { String label = (String) previousHasContainerLabels; mergedLabels = new ArrayList<>(); // depends on control dependency: [if], data = [none] mergedLabels.add(label); // depends on control dependency: [if], data = [none] } mergedLabels.addAll(idLabels); // depends on control dependency: [if], data = [none] this.labelHasContainers.set(this.labelHasContainers.size() - 1, new HasContainer(T.label.getAccessor(), P.within(mergedLabels))); // depends on control dependency: [if], data = [none] } } else { this.labelHasContainers.add(new HasContainer(T.label.getAccessor(), P.within(idLabels))); // depends on control dependency: [if], data = [none] } } else { RecordId recordId; if (rawId instanceof RecordId) { recordId = (RecordId) rawId; // depends on control dependency: [if], data = [none] } else if (rawId instanceof Element) { SqlgElement sqlgElement = (SqlgElement) rawId; recordId = (RecordId) sqlgElement.id(); // depends on control dependency: [if], data = [none] } else if (rawId instanceof String) { recordId = RecordId.from(rawId); // depends on control dependency: [if], data = [none] } else { throw new IllegalStateException("id must be an Element or a RecordId, found " + id.getClass().toString()); } if (hasContainer.getBiPredicate() == Compare.neq) { if (!this.labelHasContainers.isEmpty()) { Object previousHasContainerLabels = this.labelHasContainers.get(this.labelHasContainers.size() - 1).getValue(); List<String> mergedLabels; if (previousHasContainerLabels instanceof Collection) { @SuppressWarnings("unchecked") Collection<String> labels = (Collection<String>) previousHasContainerLabels; mergedLabels = new ArrayList<>(labels); // depends on control dependency: [if], data = [none] } else { String label = (String) previousHasContainerLabels; mergedLabels = new ArrayList<>(); // depends on control dependency: [if], data = [none] mergedLabels.add(label); // depends on control dependency: [if], data = [none] } mergedLabels.add(recordId.getSchemaTable().toString()); // depends on control dependency: [if], data = [none] this.labelHasContainers.set(this.labelHasContainers.size() - 1, new HasContainer(T.label.getAccessor(), P.within(mergedLabels))); // depends on control dependency: [if], data = [none] } } else { this.labelHasContainers.add(new HasContainer(T.label.getAccessor(), P.eq(recordId.getSchemaTable().toString()))); // depends on control dependency: [if], data = [none] } } this.idHasContainers.add(hasContainer); } }
public class class_name { @Trivial public static String typeToString(MediaType type, List<String> ignoreParams) { if (type == null) { throw new IllegalArgumentException("MediaType parameter is null"); } StringBuilder sb = new StringBuilder(); sb.append(type.getType()).append('/').append(type.getSubtype()); Map<String, String> params = type.getParameters(); if (params != null) { for (Iterator<Map.Entry<String, String>> iter = params.entrySet().iterator(); iter.hasNext();) { Map.Entry<String, String> entry = iter.next(); if (ignoreParams != null && ignoreParams.contains(entry.getKey())) { continue; } sb.append(';').append(entry.getKey()).append('=').append(entry.getValue()); } } return sb.toString(); } }
public class class_name { @Trivial public static String typeToString(MediaType type, List<String> ignoreParams) { if (type == null) { throw new IllegalArgumentException("MediaType parameter is null"); } StringBuilder sb = new StringBuilder(); sb.append(type.getType()).append('/').append(type.getSubtype()); Map<String, String> params = type.getParameters(); if (params != null) { for (Iterator<Map.Entry<String, String>> iter = params.entrySet().iterator(); iter.hasNext();) { Map.Entry<String, String> entry = iter.next(); if (ignoreParams != null && ignoreParams.contains(entry.getKey())) { continue; } sb.append(';').append(entry.getKey()).append('=').append(entry.getValue()); // depends on control dependency: [for], data = [none] } } return sb.toString(); } }
public class class_name { public static Token findFirst(final String name, final List<Token> tokens, final int index) { for (int i = index, size = tokens.size(); i < size; i++) { final Token token = tokens.get(i); if (token.name().equals(name)) { return token; } } throw new IllegalStateException("name not found: " + name); } }
public class class_name { public static Token findFirst(final String name, final List<Token> tokens, final int index) { for (int i = index, size = tokens.size(); i < size; i++) { final Token token = tokens.get(i); if (token.name().equals(name)) { return token; // depends on control dependency: [if], data = [none] } } throw new IllegalStateException("name not found: " + name); } }
public class class_name { public void setActive(final boolean SELECTED) { if (null == active) { _active = SELECTED; fireTileEvent(REDRAW_EVENT); } else { active.set(SELECTED); } } }
public class class_name { public void setActive(final boolean SELECTED) { if (null == active) { _active = SELECTED; // depends on control dependency: [if], data = [none] fireTileEvent(REDRAW_EVENT); // depends on control dependency: [if], data = [none] } else { active.set(SELECTED); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public int compareTo(ExchangeRate o) { Objects.requireNonNull(o); int compare = this.getBaseCurrency().getCurrencyCode().compareTo(o.getBaseCurrency().getCurrencyCode()); if (compare == 0) { compare = this.getCurrency().getCurrencyCode().compareTo(o.getCurrency().getCurrencyCode()); } if (compare == 0) { compare = this.getContext().getProviderName().compareTo(o.getContext().getProviderName()); } return compare; } }
public class class_name { @Override public int compareTo(ExchangeRate o) { Objects.requireNonNull(o); int compare = this.getBaseCurrency().getCurrencyCode().compareTo(o.getBaseCurrency().getCurrencyCode()); if (compare == 0) { compare = this.getCurrency().getCurrencyCode().compareTo(o.getCurrency().getCurrencyCode()); // depends on control dependency: [if], data = [none] } if (compare == 0) { compare = this.getContext().getProviderName().compareTo(o.getContext().getProviderName()); // depends on control dependency: [if], data = [none] } return compare; } }
public class class_name { public SettingsManager getSettingsManager() { if (settingsManager != null) { return settingsManager; } settingsManager = (SettingsManager) ContainerManager.getComponent("settingsManager"); return settingsManager; } }
public class class_name { public SettingsManager getSettingsManager() { if (settingsManager != null) { return settingsManager; // depends on control dependency: [if], data = [none] } settingsManager = (SettingsManager) ContainerManager.getComponent("settingsManager"); return settingsManager; } }
public class class_name { public static ExpectedCondition<String> appearingOfWindowAndSwitchToIt(final String title) { return new ExpectedCondition<String>() { @Override public String apply(final WebDriver driver) { final String initialHandle = driver.getWindowHandle(); for (final String handle : driver.getWindowHandles()) { if (needToSwitch(initialHandle, handle)) { driver.switchTo().window(handle); if (driver.getTitle().equals(title)) { return handle; } } } driver.switchTo().window(initialHandle); return null; } @Override public String toString() { return String.format("appearing of window by title %s and switch to it", title); } }; } }
public class class_name { public static ExpectedCondition<String> appearingOfWindowAndSwitchToIt(final String title) { return new ExpectedCondition<String>() { @Override public String apply(final WebDriver driver) { final String initialHandle = driver.getWindowHandle(); for (final String handle : driver.getWindowHandles()) { if (needToSwitch(initialHandle, handle)) { driver.switchTo().window(handle); // depends on control dependency: [if], data = [none] if (driver.getTitle().equals(title)) { return handle; // depends on control dependency: [if], data = [none] } } } driver.switchTo().window(initialHandle); return null; } @Override public String toString() { return String.format("appearing of window by title %s and switch to it", title); } }; } }
public class class_name { public void remove(String key) { T mBeanImpl = null; ObjectName objectName = null; try { //Get mBeanImpl Object from meters map if ((mBeanImpl = meters.remove(key)) != null) { //Un-Register MXBean for specified Type of Meter (e.g. ServletStats, ThreadPoolStats, etc) objectName = MXBeanHelper(mBeanImpl.getClass().getSimpleName(), key, UNREGISTER_MXBEAN, null); } //Remove from a map where we are maintaining bundle specific MBeans. Set<ObjectName> s = MonitoringFrameworkExtender.mxmap.get(monitor); if (s != null && objectName != null) { s.remove(objectName); } } catch (Throwable t) { if (tc.isDebugEnabled()) { Tr.debug(tc, t.getMessage()); } } } }
public class class_name { public void remove(String key) { T mBeanImpl = null; ObjectName objectName = null; try { //Get mBeanImpl Object from meters map if ((mBeanImpl = meters.remove(key)) != null) { //Un-Register MXBean for specified Type of Meter (e.g. ServletStats, ThreadPoolStats, etc) objectName = MXBeanHelper(mBeanImpl.getClass().getSimpleName(), key, UNREGISTER_MXBEAN, null); // depends on control dependency: [if], data = [null)] } //Remove from a map where we are maintaining bundle specific MBeans. Set<ObjectName> s = MonitoringFrameworkExtender.mxmap.get(monitor); if (s != null && objectName != null) { s.remove(objectName); // depends on control dependency: [if], data = [none] } } catch (Throwable t) { if (tc.isDebugEnabled()) { Tr.debug(tc, t.getMessage()); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void writeObjectOrNull (Output output, Object object, Serializer serializer) { if (output == null) throw new IllegalArgumentException("output cannot be null."); if (serializer == null) throw new IllegalArgumentException("serializer cannot be null."); beginObject(); try { if (references) { if (writeReferenceOrNull(output, object, true)) return; } else if (!serializer.getAcceptsNull()) { if (object == null) { if (TRACE || (DEBUG && depth == 1)) log("Write", null, output.position()); output.writeByte(NULL); return; } if (TRACE) trace("kryo", "Write: <not null>" + pos(output.position())); output.writeByte(NOT_NULL); } if (TRACE || (DEBUG && depth == 1)) log("Write", object, output.position()); serializer.write(this, output, object); } finally { if (--depth == 0 && autoReset) reset(); } } }
public class class_name { public void writeObjectOrNull (Output output, Object object, Serializer serializer) { if (output == null) throw new IllegalArgumentException("output cannot be null."); if (serializer == null) throw new IllegalArgumentException("serializer cannot be null."); beginObject(); try { if (references) { if (writeReferenceOrNull(output, object, true)) return; } else if (!serializer.getAcceptsNull()) { if (object == null) { if (TRACE || (DEBUG && depth == 1)) log("Write", null, output.position()); output.writeByte(NULL); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (TRACE) trace("kryo", "Write: <not null>" + pos(output.position())); output.writeByte(NOT_NULL); // depends on control dependency: [if], data = [none] } if (TRACE || (DEBUG && depth == 1)) log("Write", object, output.position()); serializer.write(this, output, object); // depends on control dependency: [try], data = [none] } finally { if (--depth == 0 && autoReset) reset(); } } }
public class class_name { public static ContentMatcher getInstance(String xmlFileName) { ContentMatcher cm = new ContentMatcher(); // Load the pattern definitions from an XML file try { cm.loadXMLPatternDefinitions(cm.getClass().getResourceAsStream(xmlFileName)); } catch (JDOMException | IOException ex) { throw new IllegalArgumentException("Failed to initialize the ContentMatcher object using: " + xmlFileName, ex); } return cm; } }
public class class_name { public static ContentMatcher getInstance(String xmlFileName) { ContentMatcher cm = new ContentMatcher(); // Load the pattern definitions from an XML file try { cm.loadXMLPatternDefinitions(cm.getClass().getResourceAsStream(xmlFileName)); // depends on control dependency: [try], data = [none] } catch (JDOMException | IOException ex) { throw new IllegalArgumentException("Failed to initialize the ContentMatcher object using: " + xmlFileName, ex); } // depends on control dependency: [catch], data = [none] return cm; } }
public class class_name { static public byte[] convertStringToByteArr(String s) { if ((s.length() % 2) != 0) { throw new RuntimeException("String length must be even (was " + s.length() + ")"); } ArrayList<Byte> byteArrayList = new ArrayList<Byte>(); for (int i = 0; i < s.length(); i = i + 2) { String s2 = s.substring(i, i + 2); Integer i2 = Integer.parseInt(s2, 16); Byte b2 = (byte)(i2 & 0xff); byteArrayList.add(b2); } byte[] byteArr = new byte[byteArrayList.size()]; for (int i = 0; i < byteArr.length; i++) { byteArr[i] = byteArrayList.get(i); } return byteArr; } }
public class class_name { static public byte[] convertStringToByteArr(String s) { if ((s.length() % 2) != 0) { throw new RuntimeException("String length must be even (was " + s.length() + ")"); } ArrayList<Byte> byteArrayList = new ArrayList<Byte>(); for (int i = 0; i < s.length(); i = i + 2) { String s2 = s.substring(i, i + 2); Integer i2 = Integer.parseInt(s2, 16); Byte b2 = (byte)(i2 & 0xff); byteArrayList.add(b2); } byte[] byteArr = new byte[byteArrayList.size()]; for (int i = 0; i < byteArr.length; i++) { byteArr[i] = byteArrayList.get(i); // depends on control dependency: [for], data = [i] } return byteArr; // depends on control dependency: [if], data = [none] } }
public class class_name { public void setLemmaString(String lemmaString) { if (!StringTools.isEmpty(lemmaString)) { lemma = lemmaString; staticLemma = true; postagRegexp = true; if (posTag != null) { pPosRegexMatch = Pattern.compile(posTag); } } } }
public class class_name { public void setLemmaString(String lemmaString) { if (!StringTools.isEmpty(lemmaString)) { lemma = lemmaString; // depends on control dependency: [if], data = [none] staticLemma = true; // depends on control dependency: [if], data = [none] postagRegexp = true; // depends on control dependency: [if], data = [none] if (posTag != null) { pPosRegexMatch = Pattern.compile(posTag); // depends on control dependency: [if], data = [(posTag] } } } }
public class class_name { public FutureData<HistoricsQueryList> list(int max, int page, boolean withEstimate) { FutureData<HistoricsQueryList> future = new FutureData<>(); URI uri = newParams().forURL(config.newAPIEndpointURI(GET)); POST request = config.http() .POST(uri, new PageReader(newRequestCallback(future, new HistoricsQueryList(), config))) .form("with_estimate", withEstimate ? 1 : 0); if (max > 0) { request.form("max", max); } if (page > 0) { request.form("page", page); } performRequest(future, request); return future; } }
public class class_name { public FutureData<HistoricsQueryList> list(int max, int page, boolean withEstimate) { FutureData<HistoricsQueryList> future = new FutureData<>(); URI uri = newParams().forURL(config.newAPIEndpointURI(GET)); POST request = config.http() .POST(uri, new PageReader(newRequestCallback(future, new HistoricsQueryList(), config))) .form("with_estimate", withEstimate ? 1 : 0); if (max > 0) { request.form("max", max); // depends on control dependency: [if], data = [none] } if (page > 0) { request.form("page", page); // depends on control dependency: [if], data = [none] } performRequest(future, request); return future; } }
public class class_name { public boolean step7() { Target target = new ImageTarget(new File("image7.png")); target.setMinScore(DEFAULT_MINSCORE); ScreenRegion loc = screenRegion.find(target); if (loc != null){ mouse.click(loc.getCenter()); keyboard.type("something to type"); return true; }else{ return false; } } }
public class class_name { public boolean step7() { Target target = new ImageTarget(new File("image7.png")); target.setMinScore(DEFAULT_MINSCORE); ScreenRegion loc = screenRegion.find(target); if (loc != null){ mouse.click(loc.getCenter()); // depends on control dependency: [if], data = [(loc] keyboard.type("something to type"); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] }else{ return false; // depends on control dependency: [if], data = [none] } } }
public class class_name { private Object onSequenceGenerator(EntityMetadata m, Client<?> client, IdDiscriptor keyValue, Object e) { Object seqgenerator = getAutoGenClazz(client); if (seqgenerator instanceof SequenceGenerator) { Object generatedId = ((SequenceGenerator) seqgenerator).generate( keyValue.getSequenceDiscriptor(), client, m.getIdAttribute().getJavaType().getSimpleName()); try { generatedId = PropertyAccessorHelper.fromSourceToTargetClass(m.getIdAttribute().getJavaType(), generatedId.getClass(), generatedId); PropertyAccessorHelper.setId(e, m, generatedId); return generatedId; } catch (IllegalArgumentException iae) { log.error("Unknown integral data type for ids : " + m.getIdAttribute().getJavaType()); throw new KunderaException("Unknown integral data type for ids : " + m.getIdAttribute().getJavaType(), iae); } } throw new IllegalArgumentException(GenerationType.class.getSimpleName() + "." + GenerationType.SEQUENCE + " Strategy not supported by this client :" + client.getClass().getName()); } }
public class class_name { private Object onSequenceGenerator(EntityMetadata m, Client<?> client, IdDiscriptor keyValue, Object e) { Object seqgenerator = getAutoGenClazz(client); if (seqgenerator instanceof SequenceGenerator) { Object generatedId = ((SequenceGenerator) seqgenerator).generate( keyValue.getSequenceDiscriptor(), client, m.getIdAttribute().getJavaType().getSimpleName()); try { generatedId = PropertyAccessorHelper.fromSourceToTargetClass(m.getIdAttribute().getJavaType(), generatedId.getClass(), generatedId); // depends on control dependency: [try], data = [none] PropertyAccessorHelper.setId(e, m, generatedId); // depends on control dependency: [try], data = [none] return generatedId; // depends on control dependency: [try], data = [none] } catch (IllegalArgumentException iae) { log.error("Unknown integral data type for ids : " + m.getIdAttribute().getJavaType()); throw new KunderaException("Unknown integral data type for ids : " + m.getIdAttribute().getJavaType(), iae); } // depends on control dependency: [catch], data = [none] } throw new IllegalArgumentException(GenerationType.class.getSimpleName() + "." + GenerationType.SEQUENCE + " Strategy not supported by this client :" + client.getClass().getName()); } }
public class class_name { public String[] addToStringArray(String[] strArray, String str) { String[] result = null; if (strArray != null) { result = new String[strArray.length + 1]; System.arraycopy(strArray, 0, result, 0, strArray.length); result[strArray.length] = str; } return result; } }
public class class_name { public String[] addToStringArray(String[] strArray, String str) { String[] result = null; if (strArray != null) { result = new String[strArray.length + 1]; // depends on control dependency: [if], data = [none] System.arraycopy(strArray, 0, result, 0, strArray.length); // depends on control dependency: [if], data = [(strArray] result[strArray.length] = str; // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { public NextInputs remove(Input input) { final Set<InputSpec> willRemove = new HashSet<>(1); for (InputSpec spec : mInputSpecs) { if (spec.input == input) { willRemove.add(spec); } } mInputSpecs.removeAll(willRemove); return this; } }
public class class_name { public NextInputs remove(Input input) { final Set<InputSpec> willRemove = new HashSet<>(1); for (InputSpec spec : mInputSpecs) { if (spec.input == input) { willRemove.add(spec); // depends on control dependency: [if], data = [none] } } mInputSpecs.removeAll(willRemove); return this; } }
public class class_name { private String getValidLogoutExitPage(HttpServletRequest req) { boolean valid = false; String exitPage = req.getParameter("logoutExitPage"); if (exitPage != null && exitPage.length() != 0) { boolean logoutExitURLaccepted = verifyLogoutURL(req, exitPage); if (logoutExitURLaccepted) { exitPage = removeFirstSlash(exitPage); exitPage = compatibilityExitPage(req, exitPage); valid = true; } } return valid == true ? exitPage : null; } }
public class class_name { private String getValidLogoutExitPage(HttpServletRequest req) { boolean valid = false; String exitPage = req.getParameter("logoutExitPage"); if (exitPage != null && exitPage.length() != 0) { boolean logoutExitURLaccepted = verifyLogoutURL(req, exitPage); if (logoutExitURLaccepted) { exitPage = removeFirstSlash(exitPage); // depends on control dependency: [if], data = [none] exitPage = compatibilityExitPage(req, exitPage); // depends on control dependency: [if], data = [none] valid = true; // depends on control dependency: [if], data = [none] } } return valid == true ? exitPage : null; } }
public class class_name { public boolean addFileSet(FileSet<CopyEntity> fileSet, List<WorkUnit> workUnits) { boolean addedWorkunits = addFileSetImpl(fileSet, workUnits); if (!addedWorkunits) { this.rejectedFileSet = true; } return addedWorkunits; } }
public class class_name { public boolean addFileSet(FileSet<CopyEntity> fileSet, List<WorkUnit> workUnits) { boolean addedWorkunits = addFileSetImpl(fileSet, workUnits); if (!addedWorkunits) { this.rejectedFileSet = true; // depends on control dependency: [if], data = [none] } return addedWorkunits; } }
public class class_name { public EClass getGCCBEZ() { if (gccbezEClass == null) { gccbezEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(489); } return gccbezEClass; } }
public class class_name { public EClass getGCCBEZ() { if (gccbezEClass == null) { gccbezEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(489); // depends on control dependency: [if], data = [none] } return gccbezEClass; } }
public class class_name { private Tag setupDocument(final HttpServletRequest request, final Document doc) { final Tag head = doc.block("head"); head.block("title").text(TITLE); head.empty("meta").attr(new Attr("http-equiv", "Content-Type"), new Attr("content", "text/html;charset=utf-8")); head.empty("meta").attr(new Name("viewport"), new Attr("content", "width=1024, user-scalable=yes")); head.empty("link").attr(new Rel("stylesheet"), new Href("/structr/css/lib/jquery-ui-1.10.3.custom.min.css")); head.empty("link").attr(new Rel("stylesheet"), new Href("/structr/css/main.css")); head.empty("link").attr(new Rel("stylesheet"), new Href("/structr/css/sprites.css")); head.empty("link").attr(new Rel("stylesheet"), new Href("/structr/css/config.css")); head.empty("link").attr(new Rel("icon"), new Href("favicon.ico"), new Type("image/x-icon")); head.block("script").attr(new Src("/structr/js/lib/jquery-3.3.1.min.js")); head.block("script").attr(new Src("/structr/js/icons.js")); head.block("script").attr(new Src("/structr/js/config.js")); final Tag body = doc.block("body"); final Tag header = body.block("div").id("header"); header.block("i").css("logo sprite sprite-structr-logo"); final Tag links = header.block("div").id("menu").css("menu").block("ul"); if (isAuthenticated(request)) { final Tag form = links.block("li").block("form").attr(new Attr("action", ConfigUrl), new Attr("method", "post"), new Style("display: none")).id("logout-form"); form.empty("input").attr(new Type("hidden"), new Name("action"), new Value("logout")); links.block("a").text("Logout").attr(new Style("cursor: pointer"), new OnClick("$('#logout-form').submit();")); } return body; } }
public class class_name { private Tag setupDocument(final HttpServletRequest request, final Document doc) { final Tag head = doc.block("head"); head.block("title").text(TITLE); head.empty("meta").attr(new Attr("http-equiv", "Content-Type"), new Attr("content", "text/html;charset=utf-8")); head.empty("meta").attr(new Name("viewport"), new Attr("content", "width=1024, user-scalable=yes")); head.empty("link").attr(new Rel("stylesheet"), new Href("/structr/css/lib/jquery-ui-1.10.3.custom.min.css")); head.empty("link").attr(new Rel("stylesheet"), new Href("/structr/css/main.css")); head.empty("link").attr(new Rel("stylesheet"), new Href("/structr/css/sprites.css")); head.empty("link").attr(new Rel("stylesheet"), new Href("/structr/css/config.css")); head.empty("link").attr(new Rel("icon"), new Href("favicon.ico"), new Type("image/x-icon")); head.block("script").attr(new Src("/structr/js/lib/jquery-3.3.1.min.js")); head.block("script").attr(new Src("/structr/js/icons.js")); head.block("script").attr(new Src("/structr/js/config.js")); final Tag body = doc.block("body"); final Tag header = body.block("div").id("header"); header.block("i").css("logo sprite sprite-structr-logo"); final Tag links = header.block("div").id("menu").css("menu").block("ul"); if (isAuthenticated(request)) { final Tag form = links.block("li").block("form").attr(new Attr("action", ConfigUrl), new Attr("method", "post"), new Style("display: none")).id("logout-form"); form.empty("input").attr(new Type("hidden"), new Name("action"), new Value("logout")); // depends on control dependency: [if], data = [none] links.block("a").text("Logout").attr(new Style("cursor: pointer"), new OnClick("$('#logout-form').submit();")); // depends on control dependency: [if], data = [none] } return body; } }
public class class_name { private final static boolean hasBeenLogged(Throwable t) { boolean hasBeenLogged = false; Throwable cause = t; Throwable lastCause = null; while (cause != null && cause != lastCause) { if (cause instanceof RecursiveInjectionException) { if (((RecursiveInjectionException) cause).ivLogged) { hasBeenLogged = true; } else { // if we have not logged this recursive exception, make sure that it is only logged once ((RecursiveInjectionException) cause).ivLogged = true; hasBeenLogged = false; } break; } lastCause = cause; cause = cause.getCause(); } return hasBeenLogged; } }
public class class_name { private final static boolean hasBeenLogged(Throwable t) { boolean hasBeenLogged = false; Throwable cause = t; Throwable lastCause = null; while (cause != null && cause != lastCause) { if (cause instanceof RecursiveInjectionException) { if (((RecursiveInjectionException) cause).ivLogged) { hasBeenLogged = true; // depends on control dependency: [if], data = [none] } else { // if we have not logged this recursive exception, make sure that it is only logged once ((RecursiveInjectionException) cause).ivLogged = true; // depends on control dependency: [if], data = [none] hasBeenLogged = false; // depends on control dependency: [if], data = [none] } break; } lastCause = cause; // depends on control dependency: [while], data = [none] cause = cause.getCause(); // depends on control dependency: [while], data = [none] } return hasBeenLogged; } }
public class class_name { public void add(final RESTBaseEntityCollectionV1<?, ?, ?> value, final boolean isRevisions) { if (value != null && value.getItems() != null) { for (final RESTBaseEntityCollectionItemV1<?, ?, ?> item : value.getItems()) { if (item.getItem() != null) { add(item.getItem(), isRevisions); } } } } }
public class class_name { public void add(final RESTBaseEntityCollectionV1<?, ?, ?> value, final boolean isRevisions) { if (value != null && value.getItems() != null) { for (final RESTBaseEntityCollectionItemV1<?, ?, ?> item : value.getItems()) { if (item.getItem() != null) { add(item.getItem(), isRevisions); // depends on control dependency: [if], data = [(item.getItem()] } } } } }
public class class_name { protected <T> T executeIgnoreRollback(TransactionCallback<T> action, T rollbackValue) { try { // Try to create the mutex in a new TX return this.newTransactionTemplate.execute(action); } catch (TransactionSystemException e) { if (e.getCause() instanceof RollbackException) { // Ignore rollbacks return rollbackValue; } // re-throw exception with unhandled cause throw e; } } }
public class class_name { protected <T> T executeIgnoreRollback(TransactionCallback<T> action, T rollbackValue) { try { // Try to create the mutex in a new TX return this.newTransactionTemplate.execute(action); // depends on control dependency: [try], data = [none] } catch (TransactionSystemException e) { if (e.getCause() instanceof RollbackException) { // Ignore rollbacks return rollbackValue; // depends on control dependency: [if], data = [none] } // re-throw exception with unhandled cause throw e; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void marshall(UnsubscribeFromDatasetRequest unsubscribeFromDatasetRequest, ProtocolMarshaller protocolMarshaller) { if (unsubscribeFromDatasetRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(unsubscribeFromDatasetRequest.getIdentityPoolId(), IDENTITYPOOLID_BINDING); protocolMarshaller.marshall(unsubscribeFromDatasetRequest.getIdentityId(), IDENTITYID_BINDING); protocolMarshaller.marshall(unsubscribeFromDatasetRequest.getDatasetName(), DATASETNAME_BINDING); protocolMarshaller.marshall(unsubscribeFromDatasetRequest.getDeviceId(), DEVICEID_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(UnsubscribeFromDatasetRequest unsubscribeFromDatasetRequest, ProtocolMarshaller protocolMarshaller) { if (unsubscribeFromDatasetRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(unsubscribeFromDatasetRequest.getIdentityPoolId(), IDENTITYPOOLID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(unsubscribeFromDatasetRequest.getIdentityId(), IDENTITYID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(unsubscribeFromDatasetRequest.getDatasetName(), DATASETNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(unsubscribeFromDatasetRequest.getDeviceId(), DEVICEID_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 setFilterExists( final Set<String> attributeNames ) { final StringBuilder sb = new StringBuilder(); sb.append( "(&" ); for ( final String name : attributeNames ) { sb.append( "(" ); sb.append( new FilterSequence( name, "*", FilterSequence.MatchingRuleEnum.EQUALS ) ); sb.append( ")" ); } sb.append( ")" ); filter = sb.toString(); } }
public class class_name { public void setFilterExists( final Set<String> attributeNames ) { final StringBuilder sb = new StringBuilder(); sb.append( "(&" ); for ( final String name : attributeNames ) { sb.append( "(" ); // depends on control dependency: [for], data = [none] sb.append( new FilterSequence( name, "*", FilterSequence.MatchingRuleEnum.EQUALS ) ); // depends on control dependency: [for], data = [name] sb.append( ")" ); // depends on control dependency: [for], data = [none] } sb.append( ")" ); filter = sb.toString(); } }
public class class_name { public int getIdleThreads() { if (executor instanceof ThreadPoolExecutor) { final ThreadPoolExecutor tpe = (ThreadPoolExecutor)executor; return tpe.getPoolSize() - tpe.getActiveCount(); } return -1; } }
public class class_name { public int getIdleThreads() { if (executor instanceof ThreadPoolExecutor) { final ThreadPoolExecutor tpe = (ThreadPoolExecutor)executor; return tpe.getPoolSize() - tpe.getActiveCount(); // depends on control dependency: [if], data = [none] } return -1; } }
public class class_name { public EList<PGPRG> getRG() { if (rg == null) { rg = new EObjectContainmentEList.Resolving<PGPRG>(PGPRG.class, this, AfplibPackage.PGP__RG); } return rg; } }
public class class_name { public EList<PGPRG> getRG() { if (rg == null) { rg = new EObjectContainmentEList.Resolving<PGPRG>(PGPRG.class, this, AfplibPackage.PGP__RG); // depends on control dependency: [if], data = [none] } return rg; } }
public class class_name { public static Connection connect(Configuration conf) { Class<? extends Connection> connectionClass = getConnectionClass(); try { return connectionClass.getConstructor(Configuration.class).newInstance(conf); } catch (Exception e) { throw new IllegalStateException("Could not find an appropriate constructor for " + CONNECTION_CLASS.getCanonicalName(), e); } } }
public class class_name { public static Connection connect(Configuration conf) { Class<? extends Connection> connectionClass = getConnectionClass(); try { return connectionClass.getConstructor(Configuration.class).newInstance(conf); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new IllegalStateException("Could not find an appropriate constructor for " + CONNECTION_CLASS.getCanonicalName(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public HistogramResult evaluateOutlierResult(Database database, OutlierResult or) { if(scaling instanceof OutlierScaling) { ((OutlierScaling) scaling).prepare(or); } ModifiableDBIDs ids = DBIDUtil.newHashSet(or.getScores().getDBIDs()); DBIDs outlierIds = DatabaseUtil.getObjectsByLabelMatch(database, positiveClassName); // first value for outliers, second for each object // If we have useful (finite) min/max, use these for binning. double min = scaling.getMin(), max = scaling.getMax(); final ObjHistogram<double[]> hist; if(Double.isInfinite(min) || Double.isNaN(min) || Double.isInfinite(max) || Double.isNaN(max)) { hist = new AbstractObjDynamicHistogram<double[]>(bins) { @Override public double[] aggregate(double[] first, double[] second) { return VMath.plusEquals(first, second); } @Override protected double[] makeObject() { return new double[2]; } @Override protected double[] cloneForCache(double[] data) { return data.clone(); } @Override protected double[] downsample(Object[] data, int start, int end, int size) { double[] sum = new double[2]; for(int i = start; i < end; i++) { Object p = data[i]; if(p != null) { VMath.plusEquals(sum, (double[]) p); } } return sum; } }; } else { hist = new ObjHistogram<double[]>(bins, min, max, () -> { return new double[2]; }); } // first fill histogram only with values of outliers double negative = 1. / ids.size(), positive = negative; if(splitfreq) { negative = 1. / (ids.size() - outlierIds.size()); positive = 1. / outlierIds.size(); } ids.removeDBIDs(outlierIds); // fill histogram with values of each object for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) { double result = or.getScores().doubleValue(iter); result = scaling.getScaled(result); if(result > Double.NEGATIVE_INFINITY && result < Double.POSITIVE_INFINITY) { hist.get(result)[0] += negative; } } for(DBIDIter iter = outlierIds.iter(); iter.valid(); iter.advance()) { double result = or.getScores().doubleValue(iter); result = scaling.getScaled(result); if(result > Double.NEGATIVE_INFINITY && result < Double.POSITIVE_INFINITY) { hist.get(result)[1] += positive; } } Collection<double[]> collHist = new ArrayList<>(hist.getNumBins()); for(ObjHistogram<double[]>.Iter iter = hist.iter(); iter.valid(); iter.advance()) { double[] data = iter.getValue(); collHist.add(new double[] { iter.getCenter(), data[0], data[1] }); } return new HistogramResult("Outlier Score Histogram", "outlier-histogram", collHist); } }
public class class_name { public HistogramResult evaluateOutlierResult(Database database, OutlierResult or) { if(scaling instanceof OutlierScaling) { ((OutlierScaling) scaling).prepare(or); // depends on control dependency: [if], data = [none] } ModifiableDBIDs ids = DBIDUtil.newHashSet(or.getScores().getDBIDs()); DBIDs outlierIds = DatabaseUtil.getObjectsByLabelMatch(database, positiveClassName); // first value for outliers, second for each object // If we have useful (finite) min/max, use these for binning. double min = scaling.getMin(), max = scaling.getMax(); final ObjHistogram<double[]> hist; if(Double.isInfinite(min) || Double.isNaN(min) || Double.isInfinite(max) || Double.isNaN(max)) { hist = new AbstractObjDynamicHistogram<double[]>(bins) { @Override public double[] aggregate(double[] first, double[] second) { return VMath.plusEquals(first, second); } @Override protected double[] makeObject() { return new double[2]; } @Override protected double[] cloneForCache(double[] data) { return data.clone(); } @Override protected double[] downsample(Object[] data, int start, int end, int size) { double[] sum = new double[2]; for(int i = start; i < end; i++) { Object p = data[i]; if(p != null) { VMath.plusEquals(sum, (double[]) p); // depends on control dependency: [if], data = [none] } } return sum; } }; // depends on control dependency: [if], data = [none] } else { hist = new ObjHistogram<double[]>(bins, min, max, () -> { return new double[2]; }); // depends on control dependency: [if], data = [none] } // first fill histogram only with values of outliers double negative = 1. / ids.size(), positive = negative; if(splitfreq) { negative = 1. / (ids.size() - outlierIds.size()); // depends on control dependency: [if], data = [none] positive = 1. / outlierIds.size(); // depends on control dependency: [if], data = [none] } ids.removeDBIDs(outlierIds); // fill histogram with values of each object for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) { double result = or.getScores().doubleValue(iter); result = scaling.getScaled(result); // depends on control dependency: [for], data = [none] if(result > Double.NEGATIVE_INFINITY && result < Double.POSITIVE_INFINITY) { hist.get(result)[0] += negative; // depends on control dependency: [if], data = [(result] } } for(DBIDIter iter = outlierIds.iter(); iter.valid(); iter.advance()) { double result = or.getScores().doubleValue(iter); result = scaling.getScaled(result); // depends on control dependency: [for], data = [none] if(result > Double.NEGATIVE_INFINITY && result < Double.POSITIVE_INFINITY) { hist.get(result)[1] += positive; // depends on control dependency: [if], data = [(result] } } Collection<double[]> collHist = new ArrayList<>(hist.getNumBins()); for(ObjHistogram<double[]>.Iter iter = hist.iter(); iter.valid(); iter.advance()) { double[] data = iter.getValue(); collHist.add(new double[] { iter.getCenter(), data[0], data[1] }); // depends on control dependency: [for], data = [iter] } return new HistogramResult("Outlier Score Histogram", "outlier-histogram", collHist); } }
public class class_name { @SafeVarargs public final WordBuilder<I> append(I... symbols) { if (symbols.length == 0) { return this; } ensureAdditionalCapacity(symbols.length); System.arraycopy(symbols, 0, array, length, symbols.length); length += symbols.length; return this; } }
public class class_name { @SafeVarargs public final WordBuilder<I> append(I... symbols) { if (symbols.length == 0) { return this; // depends on control dependency: [if], data = [none] } ensureAdditionalCapacity(symbols.length); System.arraycopy(symbols, 0, array, length, symbols.length); length += symbols.length; return this; } }
public class class_name { public static double[] solve(double[] a, double[] b, double[] c, double[] r) { if (b[0] == 0.0) { throw new IllegalArgumentException("Invalid value of b[0] == 0. The equations should be rewritten as a set of order n - 1."); } int n = a.length; double[] u = new double[n]; double[] gam = new double[n]; double bet = b[0]; u[0] = r[0] / bet; for (int j = 1; j < n; j++) { gam[j] = c[j - 1] / bet; bet = b[j] - a[j] * gam[j]; if (bet == 0.0) { throw new IllegalArgumentException("The tridagonal matrix is not of diagonal dominance."); } u[j] = (r[j] - a[j] * u[j - 1]) / bet; } for (int j = (n - 2); j >= 0; j--) { u[j] -= gam[j + 1] * u[j + 1]; } return u; } }
public class class_name { public static double[] solve(double[] a, double[] b, double[] c, double[] r) { if (b[0] == 0.0) { throw new IllegalArgumentException("Invalid value of b[0] == 0. The equations should be rewritten as a set of order n - 1."); } int n = a.length; double[] u = new double[n]; double[] gam = new double[n]; double bet = b[0]; u[0] = r[0] / bet; for (int j = 1; j < n; j++) { gam[j] = c[j - 1] / bet; // depends on control dependency: [for], data = [j] bet = b[j] - a[j] * gam[j]; // depends on control dependency: [for], data = [j] if (bet == 0.0) { throw new IllegalArgumentException("The tridagonal matrix is not of diagonal dominance."); } u[j] = (r[j] - a[j] * u[j - 1]) / bet; // depends on control dependency: [for], data = [j] } for (int j = (n - 2); j >= 0; j--) { u[j] -= gam[j + 1] * u[j + 1]; // depends on control dependency: [for], data = [j] } return u; } }
public class class_name { public void setReservedInstancesListings(java.util.Collection<ReservedInstancesListing> reservedInstancesListings) { if (reservedInstancesListings == null) { this.reservedInstancesListings = null; return; } this.reservedInstancesListings = new com.amazonaws.internal.SdkInternalList<ReservedInstancesListing>(reservedInstancesListings); } }
public class class_name { public void setReservedInstancesListings(java.util.Collection<ReservedInstancesListing> reservedInstancesListings) { if (reservedInstancesListings == null) { this.reservedInstancesListings = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.reservedInstancesListings = new com.amazonaws.internal.SdkInternalList<ReservedInstancesListing>(reservedInstancesListings); } }
public class class_name { public void marshall(UpdateServiceSettingsRequest updateServiceSettingsRequest, ProtocolMarshaller protocolMarshaller) { if (updateServiceSettingsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(updateServiceSettingsRequest.getS3BucketArn(), S3BUCKETARN_BINDING); protocolMarshaller.marshall(updateServiceSettingsRequest.getSnsTopicArn(), SNSTOPICARN_BINDING); protocolMarshaller.marshall(updateServiceSettingsRequest.getOrganizationConfiguration(), ORGANIZATIONCONFIGURATION_BINDING); protocolMarshaller.marshall(updateServiceSettingsRequest.getEnableCrossAccountsDiscovery(), ENABLECROSSACCOUNTSDISCOVERY_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(UpdateServiceSettingsRequest updateServiceSettingsRequest, ProtocolMarshaller protocolMarshaller) { if (updateServiceSettingsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(updateServiceSettingsRequest.getS3BucketArn(), S3BUCKETARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(updateServiceSettingsRequest.getSnsTopicArn(), SNSTOPICARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(updateServiceSettingsRequest.getOrganizationConfiguration(), ORGANIZATIONCONFIGURATION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(updateServiceSettingsRequest.getEnableCrossAccountsDiscovery(), ENABLECROSSACCOUNTSDISCOVERY_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 static byte[] readHttpResponse(HttpURLConnection connection) { byte[] res; try { if (connection.getResponseCode() != HttpURLConnection.HTTP_OK) { LOG.log(Level.WARNING, "Http Response not OK: " + connection.getResponseCode()); } } catch (IOException e) { LOG.log(Level.SEVERE, "Failed to get response code", e); return new byte[0]; } int responseLength = connection.getContentLength(); if (responseLength <= 0) { LOG.log(Level.SEVERE, "Response length abnormal: " + responseLength); return new byte[0]; } try { res = new byte[responseLength]; InputStream is = connection.getInputStream(); int off = 0; int bRead = 0; while (off != (responseLength - 1) && (bRead = is.read(res, off, responseLength - off)) != -1) { off += bRead; } return res; } catch (IOException e) { LOG.log(Level.SEVERE, "Failed to read response: ", e); return new byte[0]; } finally { try { connection.getInputStream().close(); } catch (IOException e) { LOG.log(Level.SEVERE, "Failed to close InputStream: ", e); return new byte[0]; } } } }
public class class_name { public static byte[] readHttpResponse(HttpURLConnection connection) { byte[] res; try { if (connection.getResponseCode() != HttpURLConnection.HTTP_OK) { LOG.log(Level.WARNING, "Http Response not OK: " + connection.getResponseCode()); // depends on control dependency: [if], data = [none] } } catch (IOException e) { LOG.log(Level.SEVERE, "Failed to get response code", e); return new byte[0]; } // depends on control dependency: [catch], data = [none] int responseLength = connection.getContentLength(); if (responseLength <= 0) { LOG.log(Level.SEVERE, "Response length abnormal: " + responseLength); // depends on control dependency: [if], data = [none] return new byte[0]; // depends on control dependency: [if], data = [none] } try { res = new byte[responseLength]; // depends on control dependency: [try], data = [none] InputStream is = connection.getInputStream(); int off = 0; int bRead = 0; while (off != (responseLength - 1) && (bRead = is.read(res, off, responseLength - off)) != -1) { off += bRead; // depends on control dependency: [while], data = [none] } return res; // depends on control dependency: [try], data = [none] } catch (IOException e) { LOG.log(Level.SEVERE, "Failed to read response: ", e); return new byte[0]; } finally { // depends on control dependency: [catch], data = [none] try { connection.getInputStream().close(); // depends on control dependency: [try], data = [none] } catch (IOException e) { LOG.log(Level.SEVERE, "Failed to close InputStream: ", e); return new byte[0]; } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public OrderingType<WebFragmentDescriptor> getOrCreateOrdering() { List<Node> nodeList = model.get("ordering"); if (nodeList != null && nodeList.size() > 0) { return new OrderingTypeImpl<WebFragmentDescriptor>(this, "ordering", model, nodeList.get(0)); } return createOrdering(); } }
public class class_name { public OrderingType<WebFragmentDescriptor> getOrCreateOrdering() { List<Node> nodeList = model.get("ordering"); if (nodeList != null && nodeList.size() > 0) { return new OrderingTypeImpl<WebFragmentDescriptor>(this, "ordering", model, nodeList.get(0)); // depends on control dependency: [if], data = [none] } return createOrdering(); } }