code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { protected synchronized boolean cancel(Object x) { synchronized (lock) { if (putIndex > takeIndex) { for (int i = takeIndex; i < putIndex; i++) { if (buffer[i] == x) { System.arraycopy(buffer, i + 1, buffer, i, putIndex - i - 1); putIndex--; buffer[putIndex] = null; numberOfUsedSlots.getAndDecrement(); // D615053 return true; } } } else if (putIndex != takeIndex || buffer[takeIndex] != null) { for (int i = takeIndex; i < buffer.length; i++) { if (buffer[i] == x) { if (i != buffer.length - 1) { System.arraycopy(buffer, i + 1, buffer, i, buffer.length - i - 1); } if (putIndex != 0) { buffer[buffer.length - 1] = buffer[0]; System.arraycopy(buffer, 1, buffer, 0, putIndex - 1); putIndex--; } else { putIndex = buffer.length - 1; } buffer[putIndex] = null; numberOfUsedSlots.getAndDecrement(); // D615053 return true; } } // D610567 - Scan first section of BoundedBuffer for (int i = 0; i < putIndex; i++) { if (buffer[i] == x) { System.arraycopy(buffer, i + 1, buffer, i, putIndex - i - 1); putIndex--; buffer[putIndex] = null; numberOfUsedSlots.getAndDecrement(); // D615053 return true; } } } } return false; } }
public class class_name { protected synchronized boolean cancel(Object x) { synchronized (lock) { if (putIndex > takeIndex) { for (int i = takeIndex; i < putIndex; i++) { if (buffer[i] == x) { System.arraycopy(buffer, i + 1, buffer, i, putIndex - i - 1); // depends on control dependency: [if], data = [none] putIndex--; // depends on control dependency: [if], data = [none] buffer[putIndex] = null; // depends on control dependency: [if], data = [none] numberOfUsedSlots.getAndDecrement(); // D615053 // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } } } else if (putIndex != takeIndex || buffer[takeIndex] != null) { for (int i = takeIndex; i < buffer.length; i++) { if (buffer[i] == x) { if (i != buffer.length - 1) { System.arraycopy(buffer, i + 1, buffer, i, buffer.length - i - 1); // depends on control dependency: [if], data = [none] } if (putIndex != 0) { buffer[buffer.length - 1] = buffer[0]; // depends on control dependency: [if], data = [none] System.arraycopy(buffer, 1, buffer, 0, putIndex - 1); // depends on control dependency: [if], data = [none] putIndex--; // depends on control dependency: [if], data = [none] } else { putIndex = buffer.length - 1; // depends on control dependency: [if], data = [none] } buffer[putIndex] = null; // depends on control dependency: [if], data = [none] numberOfUsedSlots.getAndDecrement(); // D615053 // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } } // D610567 - Scan first section of BoundedBuffer for (int i = 0; i < putIndex; i++) { if (buffer[i] == x) { System.arraycopy(buffer, i + 1, buffer, i, putIndex - i - 1); // depends on control dependency: [if], data = [none] putIndex--; // depends on control dependency: [if], data = [none] buffer[putIndex] = null; // depends on control dependency: [if], data = [none] numberOfUsedSlots.getAndDecrement(); // D615053 // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } } } } return false; } }
public class class_name { public static String getPackage(Class clazz) { String s = clazz.getName(); int i = s.lastIndexOf('['); if (i >= 0) { s = s.substring(i + 2); } i = s.lastIndexOf('.'); if (i >= 0) { return s.substring(0, i); } return ""; } }
public class class_name { public static String getPackage(Class clazz) { String s = clazz.getName(); int i = s.lastIndexOf('['); if (i >= 0) { s = s.substring(i + 2); // depends on control dependency: [if], data = [(i] } i = s.lastIndexOf('.'); if (i >= 0) { return s.substring(0, i); // depends on control dependency: [if], data = [none] } return ""; } }
public class class_name { public XPointerEngine setLanguage(final String language) { if (language == null) { this.languageValue = XdmEmptySequence.getInstance(); } else { this.languageValue = new XdmAtomicValue(language); } return this; } }
public class class_name { public XPointerEngine setLanguage(final String language) { if (language == null) { this.languageValue = XdmEmptySequence.getInstance(); // depends on control dependency: [if], data = [none] } else { this.languageValue = new XdmAtomicValue(language); // depends on control dependency: [if], data = [(language] } return this; } }
public class class_name { @Override public boolean removeArc(int x, int y, ICause cause) throws ContradictionException { assert cause != null; if (LB.arcExists(x, y)) { this.contradiction(cause, "remove mandatory arc " + x + "->" + y); return false; } if (UB.removeArc(x, y)) { if (reactOnModification) { delta.add(x, GraphDelta.AR_TAIL, cause); delta.add(y, GraphDelta.AR_HEAD, cause); } GraphEventType e = GraphEventType.REMOVE_ARC; notifyPropagators(e, cause); return true; } return false; } }
public class class_name { @Override public boolean removeArc(int x, int y, ICause cause) throws ContradictionException { assert cause != null; if (LB.arcExists(x, y)) { this.contradiction(cause, "remove mandatory arc " + x + "->" + y); return false; } if (UB.removeArc(x, y)) { if (reactOnModification) { delta.add(x, GraphDelta.AR_TAIL, cause); // depends on control dependency: [if], data = [none] delta.add(y, GraphDelta.AR_HEAD, cause); // depends on control dependency: [if], data = [none] } GraphEventType e = GraphEventType.REMOVE_ARC; notifyPropagators(e, cause); return true; } return false; } }
public class class_name { private List<Schema.Field> flattenField(Schema.Field f, ImmutableList<String> parentLineage, boolean shouldPopulateLineage, boolean flattenComplexTypes, Optional<Schema> shouldWrapInOption) { Preconditions.checkNotNull(f); Preconditions.checkNotNull(f.schema()); Preconditions.checkNotNull(f.name()); List<Schema.Field> flattenedFields = new ArrayList<>(); ImmutableList<String> lineage = ImmutableList.<String>builder() .addAll(parentLineage.iterator()).add(f.name()).build(); // If field.Type = RECORD, un-nest its fields and return them if (Schema.Type.RECORD.equals(f.schema().getType())) { if (null != f.schema().getFields() && f.schema().getFields().size() > 0) { for (Schema.Field field : f.schema().getFields()) { flattenedFields.addAll(flattenField(field, lineage, true, flattenComplexTypes, Optional.<Schema>absent())); } } } // If field.Type = OPTION, un-nest its fields and return them else { Optional<Schema> optionalRecord = isOfOptionType(f.schema()); if (optionalRecord.isPresent()) { Schema record = optionalRecord.get(); if (record.getFields().size() > 0) { for (Schema.Field field : record.getFields()) { flattenedFields.addAll(flattenField(field, lineage, true, flattenComplexTypes, Optional.of(f.schema()))); } } } // If field.Type = any-other, copy and return it else { // Compute name and source using lineage String flattenName = f.name(); String flattenSource = StringUtils.EMPTY; if (shouldPopulateLineage) { flattenName = StringUtils.join(lineage, flattenedNameJoiner); flattenSource = StringUtils.join(lineage, flattenedSourceJoiner); } // Copy field Schema flattenedFieldSchema = flatten(f.schema(), shouldPopulateLineage, flattenComplexTypes); if (shouldWrapInOption.isPresent()) { boolean isNullFirstMember = Schema.Type.NULL.equals(shouldWrapInOption.get().getTypes().get(0).getType()); // If already Union, just copy it instead of wrapping (Union within Union is not supported) if (Schema.Type.UNION.equals(flattenedFieldSchema.getType())) { List<Schema> newUnionMembers = new ArrayList<>(); if (isNullFirstMember) { newUnionMembers.add(Schema.create(Schema.Type.NULL)); } for (Schema type : flattenedFieldSchema.getTypes()) { if (Schema.Type.NULL.equals(type.getType())) { continue; } newUnionMembers.add(type); } if (!isNullFirstMember) { newUnionMembers.add(Schema.create(Schema.Type.NULL)); } flattenedFieldSchema = Schema.createUnion(newUnionMembers); } // Wrap the Union, since parent Union is an option else { if (isNullFirstMember) { flattenedFieldSchema = Schema.createUnion(Arrays.asList(Schema.create(Schema.Type.NULL), flattenedFieldSchema)); } else { flattenedFieldSchema = Schema.createUnion(Arrays.asList(flattenedFieldSchema, Schema.create(Schema.Type.NULL))); } } } Schema.Field field = new Schema.Field(flattenName, flattenedFieldSchema, f.doc(), f.defaultValue(), f.order()); if (StringUtils.isNotBlank(flattenSource)) { field.addProp(FLATTENED_SOURCE_KEY, flattenSource); } for (Map.Entry<String, JsonNode> entry : f.getJsonProps().entrySet()) { field.addProp(entry.getKey(), entry.getValue()); } flattenedFields.add(field); } } return flattenedFields; } }
public class class_name { private List<Schema.Field> flattenField(Schema.Field f, ImmutableList<String> parentLineage, boolean shouldPopulateLineage, boolean flattenComplexTypes, Optional<Schema> shouldWrapInOption) { Preconditions.checkNotNull(f); Preconditions.checkNotNull(f.schema()); Preconditions.checkNotNull(f.name()); List<Schema.Field> flattenedFields = new ArrayList<>(); ImmutableList<String> lineage = ImmutableList.<String>builder() .addAll(parentLineage.iterator()).add(f.name()).build(); // If field.Type = RECORD, un-nest its fields and return them if (Schema.Type.RECORD.equals(f.schema().getType())) { if (null != f.schema().getFields() && f.schema().getFields().size() > 0) { for (Schema.Field field : f.schema().getFields()) { flattenedFields.addAll(flattenField(field, lineage, true, flattenComplexTypes, Optional.<Schema>absent())); // depends on control dependency: [for], data = [field] } } } // If field.Type = OPTION, un-nest its fields and return them else { Optional<Schema> optionalRecord = isOfOptionType(f.schema()); if (optionalRecord.isPresent()) { Schema record = optionalRecord.get(); if (record.getFields().size() > 0) { for (Schema.Field field : record.getFields()) { flattenedFields.addAll(flattenField(field, lineage, true, flattenComplexTypes, Optional.of(f.schema()))); // depends on control dependency: [for], data = [field] } } } // If field.Type = any-other, copy and return it else { // Compute name and source using lineage String flattenName = f.name(); String flattenSource = StringUtils.EMPTY; if (shouldPopulateLineage) { flattenName = StringUtils.join(lineage, flattenedNameJoiner); // depends on control dependency: [if], data = [none] flattenSource = StringUtils.join(lineage, flattenedSourceJoiner); // depends on control dependency: [if], data = [none] } // Copy field Schema flattenedFieldSchema = flatten(f.schema(), shouldPopulateLineage, flattenComplexTypes); if (shouldWrapInOption.isPresent()) { boolean isNullFirstMember = Schema.Type.NULL.equals(shouldWrapInOption.get().getTypes().get(0).getType()); // If already Union, just copy it instead of wrapping (Union within Union is not supported) if (Schema.Type.UNION.equals(flattenedFieldSchema.getType())) { List<Schema> newUnionMembers = new ArrayList<>(); if (isNullFirstMember) { newUnionMembers.add(Schema.create(Schema.Type.NULL)); // depends on control dependency: [if], data = [none] } for (Schema type : flattenedFieldSchema.getTypes()) { if (Schema.Type.NULL.equals(type.getType())) { continue; } newUnionMembers.add(type); // depends on control dependency: [for], data = [type] } if (!isNullFirstMember) { newUnionMembers.add(Schema.create(Schema.Type.NULL)); // depends on control dependency: [if], data = [none] } flattenedFieldSchema = Schema.createUnion(newUnionMembers); // depends on control dependency: [if], data = [none] } // Wrap the Union, since parent Union is an option else { if (isNullFirstMember) { flattenedFieldSchema = Schema.createUnion(Arrays.asList(Schema.create(Schema.Type.NULL), flattenedFieldSchema)); // depends on control dependency: [if], data = [none] } else { flattenedFieldSchema = Schema.createUnion(Arrays.asList(flattenedFieldSchema, Schema.create(Schema.Type.NULL))); // depends on control dependency: [if], data = [none] } } } Schema.Field field = new Schema.Field(flattenName, flattenedFieldSchema, f.doc(), f.defaultValue(), f.order()); if (StringUtils.isNotBlank(flattenSource)) { field.addProp(FLATTENED_SOURCE_KEY, flattenSource); // depends on control dependency: [if], data = [none] } for (Map.Entry<String, JsonNode> entry : f.getJsonProps().entrySet()) { field.addProp(entry.getKey(), entry.getValue()); // depends on control dependency: [for], data = [entry] } flattenedFields.add(field); // depends on control dependency: [if], data = [none] } } return flattenedFields; } }
public class class_name { public int[] mergeChunks() { int filledChunks = getFilledChunks(); int[] merged = new int[size()]; for (int i = 0; i < filledChunks ; i++) { if (chunks[i]!=null) { System.arraycopy(chunks[i], 0, merged, i * chunkSize, chunkSize); } } int remainder = size() % chunkSize; if (remainder != 0 && chunks[filledChunks]!=null) { System.arraycopy(chunks[filledChunks], 0, merged, (filledChunks) * chunkSize, remainder); } return merged; } }
public class class_name { public int[] mergeChunks() { int filledChunks = getFilledChunks(); int[] merged = new int[size()]; for (int i = 0; i < filledChunks ; i++) { if (chunks[i]!=null) { System.arraycopy(chunks[i], 0, merged, i * chunkSize, chunkSize); // depends on control dependency: [if], data = [(chunks[i]] } } int remainder = size() % chunkSize; if (remainder != 0 && chunks[filledChunks]!=null) { System.arraycopy(chunks[filledChunks], 0, merged, (filledChunks) * chunkSize, remainder); // depends on control dependency: [if], data = [none] } return merged; } }
public class class_name { public static byte[] readBytes( InputStream stream ) throws IOException { if (stream == null) return new byte[] {}; byte[] buffer = new byte[1024]; ByteArrayOutputStream output = new ByteArrayOutputStream(); boolean error = false; try { int numRead = 0; while ((numRead = stream.read(buffer)) > -1) { output.write(buffer, 0, numRead); } } catch (IOException e) { error = true; // this error should be thrown, even if there is an error closing stream throw e; } catch (RuntimeException e) { error = true; // this error should be thrown, even if there is an error closing stream throw e; } finally { try { stream.close(); } catch (IOException e) { if (!error) throw e; } } output.flush(); return output.toByteArray(); } }
public class class_name { public static byte[] readBytes( InputStream stream ) throws IOException { if (stream == null) return new byte[] {}; byte[] buffer = new byte[1024]; ByteArrayOutputStream output = new ByteArrayOutputStream(); boolean error = false; try { int numRead = 0; while ((numRead = stream.read(buffer)) > -1) { output.write(buffer, 0, numRead); // depends on control dependency: [while], data = [none] } } catch (IOException e) { error = true; // this error should be thrown, even if there is an error closing stream throw e; } catch (RuntimeException e) { error = true; // this error should be thrown, even if there is an error closing stream throw e; } finally { try { stream.close(); // depends on control dependency: [try], data = [none] } catch (IOException e) { if (!error) throw e; } // depends on control dependency: [catch], data = [none] } output.flush(); return output.toByteArray(); } }
public class class_name { public static String encodeLines(byte[] in, int iOff, int iLen, int lineLen, String lineSeparator) { final int blockLen = lineLen * 3 / 4; if (blockLen <= 0) { throw new IllegalArgumentException(); } final int lines = (iLen + blockLen - 1) / blockLen; final int bufLen = (iLen + 2) / 3 * 4 + lines * lineSeparator.length(); final StringBuilder buf = new StringBuilder(bufLen); int ip = 0; while (ip < iLen) { final int l = Math.min(iLen - ip, blockLen); buf.append(encode(in, iOff + ip, l)); buf.append(lineSeparator); ip += l; } return buf.toString(); } }
public class class_name { public static String encodeLines(byte[] in, int iOff, int iLen, int lineLen, String lineSeparator) { final int blockLen = lineLen * 3 / 4; if (blockLen <= 0) { throw new IllegalArgumentException(); } final int lines = (iLen + blockLen - 1) / blockLen; final int bufLen = (iLen + 2) / 3 * 4 + lines * lineSeparator.length(); final StringBuilder buf = new StringBuilder(bufLen); int ip = 0; while (ip < iLen) { final int l = Math.min(iLen - ip, blockLen); buf.append(encode(in, iOff + ip, l)); // depends on control dependency: [while], data = [none] buf.append(lineSeparator); // depends on control dependency: [while], data = [none] ip += l; // depends on control dependency: [while], data = [none] } return buf.toString(); } }
public class class_name { @FFDCIgnore(NoSuchMethodException.class) private static boolean isRRSTransactional(Object activationSpec) { try { return (Boolean) activationSpec.getClass().getMethod("getRRSTransactional").invoke(activationSpec); } catch (NoSuchMethodException x) { return false; } catch (Exception x) { return false; } } }
public class class_name { @FFDCIgnore(NoSuchMethodException.class) private static boolean isRRSTransactional(Object activationSpec) { try { return (Boolean) activationSpec.getClass().getMethod("getRRSTransactional").invoke(activationSpec); // depends on control dependency: [try], data = [none] } catch (NoSuchMethodException x) { return false; } catch (Exception x) { // depends on control dependency: [catch], data = [none] return false; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static com.sun.javadoc.Type[] getTypes(DocEnv env, List<Type> ts, com.sun.javadoc.Type res[]) { int i = 0; for (Type t : ts) { res[i++] = getType(env, t); } return res; } }
public class class_name { public static com.sun.javadoc.Type[] getTypes(DocEnv env, List<Type> ts, com.sun.javadoc.Type res[]) { int i = 0; for (Type t : ts) { res[i++] = getType(env, t); // depends on control dependency: [for], data = [t] } return res; } }
public class class_name { public Set<T> getKeysAboveCountThreshold(double threshold) { Set<T> keys = Sets.newHashSet(); for (T key : counts.keySet()) { if (counts.get(key) > threshold) { keys.add(key); } } return keys; } }
public class class_name { public Set<T> getKeysAboveCountThreshold(double threshold) { Set<T> keys = Sets.newHashSet(); for (T key : counts.keySet()) { if (counts.get(key) > threshold) { keys.add(key); // depends on control dependency: [if], data = [none] } } return keys; } }
public class class_name { public static int countIgnoreCase(final String source, final String sub) { int count = 0; int j = 0; int sublen = sub.length(); if (sublen == 0) { return 0; } while (true) { int i = indexOfIgnoreCase(source, sub, j); if (i == -1) { break; } count++; j = i + sublen; } return count; } }
public class class_name { public static int countIgnoreCase(final String source, final String sub) { int count = 0; int j = 0; int sublen = sub.length(); if (sublen == 0) { return 0; // depends on control dependency: [if], data = [none] } while (true) { int i = indexOfIgnoreCase(source, sub, j); if (i == -1) { break; } count++; // depends on control dependency: [while], data = [none] j = i + sublen; // depends on control dependency: [while], data = [none] } return count; } }
public class class_name { protected void generatePackageFiles(ClassTree classtree) throws Exception { Set<PackageDoc> packages = configuration.packages; if (packages.size() > 1) { PackageIndexFrameWriter.generate(configuration); } List<PackageDoc> pList = new ArrayList<>(configuration.packages); PackageDoc prev = null, next; for (int i = 0; i < pList.size(); i++) { // if -nodeprecated option is set and the package is marked as // deprecated, do not generate the package-summary.html, package-frame.html // and package-tree.html pages for that package. PackageDoc pkg = pList.get(i); if (!(configuration.nodeprecated && utils.isDeprecated(pkg))) { PackageFrameWriter.generate(configuration, pkg); next = getNamedPackage(pList, i + 1); //If the next package is unnamed package, skip 2 ahead if possible if (next == null) next = getNamedPackage(pList, i + 2); AbstractBuilder packageSummaryBuilder = configuration.getBuilderFactory().getPackageSummaryBuilder( pkg, prev, next); packageSummaryBuilder.build(); if (configuration.createtree) { PackageTreeWriter.generate(configuration, pkg, prev, next, configuration.nodeprecated); } prev = pkg; } } } }
public class class_name { protected void generatePackageFiles(ClassTree classtree) throws Exception { Set<PackageDoc> packages = configuration.packages; if (packages.size() > 1) { PackageIndexFrameWriter.generate(configuration); } List<PackageDoc> pList = new ArrayList<>(configuration.packages); PackageDoc prev = null, next; for (int i = 0; i < pList.size(); i++) { // if -nodeprecated option is set and the package is marked as // deprecated, do not generate the package-summary.html, package-frame.html // and package-tree.html pages for that package. PackageDoc pkg = pList.get(i); if (!(configuration.nodeprecated && utils.isDeprecated(pkg))) { PackageFrameWriter.generate(configuration, pkg); next = getNamedPackage(pList, i + 1); //If the next package is unnamed package, skip 2 ahead if possible if (next == null) next = getNamedPackage(pList, i + 2); AbstractBuilder packageSummaryBuilder = configuration.getBuilderFactory().getPackageSummaryBuilder( pkg, prev, next); packageSummaryBuilder.build(); if (configuration.createtree) { PackageTreeWriter.generate(configuration, pkg, prev, next, configuration.nodeprecated); // depends on control dependency: [if], data = [none] } prev = pkg; } } } }
public class class_name { protected void addIndexContents(Collection<PackageDoc> packages, String text, String tableSummary, Content body) { if (!packages.isEmpty()) { HtmlTree htmlTree = (configuration.allowTag(HtmlTag.NAV)) ? HtmlTree.NAV() : new HtmlTree(HtmlTag.DIV); htmlTree.addStyle(HtmlStyle.indexNav); HtmlTree ul = new HtmlTree(HtmlTag.UL); addAllClassesLink(ul); htmlTree.addContent(ul); body.addContent(htmlTree); addPackagesList(packages, text, tableSummary, body); } } }
public class class_name { protected void addIndexContents(Collection<PackageDoc> packages, String text, String tableSummary, Content body) { if (!packages.isEmpty()) { HtmlTree htmlTree = (configuration.allowTag(HtmlTag.NAV)) ? HtmlTree.NAV() : new HtmlTree(HtmlTag.DIV); htmlTree.addStyle(HtmlStyle.indexNav); // depends on control dependency: [if], data = [none] HtmlTree ul = new HtmlTree(HtmlTag.UL); addAllClassesLink(ul); // depends on control dependency: [if], data = [none] htmlTree.addContent(ul); // depends on control dependency: [if], data = [none] body.addContent(htmlTree); // depends on control dependency: [if], data = [none] addPackagesList(packages, text, tableSummary, body); // depends on control dependency: [if], data = [none] } } }
public class class_name { static boolean essentiallyEqualsTo(RedisClusterNode o1, RedisClusterNode o2) { if (o2 == null) { return false; } if (!sameFlags(o1, o2, RedisClusterNode.NodeFlag.MASTER)) { return false; } if (!sameFlags(o1, o2, RedisClusterNode.NodeFlag.SLAVE)) { return false; } if (!o1.hasSameSlotsAs(o2)) { return false; } return true; } }
public class class_name { static boolean essentiallyEqualsTo(RedisClusterNode o1, RedisClusterNode o2) { if (o2 == null) { return false; // depends on control dependency: [if], data = [none] } if (!sameFlags(o1, o2, RedisClusterNode.NodeFlag.MASTER)) { return false; // depends on control dependency: [if], data = [none] } if (!sameFlags(o1, o2, RedisClusterNode.NodeFlag.SLAVE)) { return false; // depends on control dependency: [if], data = [none] } if (!o1.hasSameSlotsAs(o2)) { return false; // depends on control dependency: [if], data = [none] } return true; } }
public class class_name { public java.util.List<BillingRecord> getBillingRecords() { if (billingRecords == null) { billingRecords = new com.amazonaws.internal.SdkInternalList<BillingRecord>(); } return billingRecords; } }
public class class_name { public java.util.List<BillingRecord> getBillingRecords() { if (billingRecords == null) { billingRecords = new com.amazonaws.internal.SdkInternalList<BillingRecord>(); // depends on control dependency: [if], data = [none] } return billingRecords; } }
public class class_name { public static BufferedImage convertTo( ImageBase src, BufferedImage dst, boolean orderRgb ) { if( src instanceof ImageGray) { if( GrayU8.class == src.getClass() ) { return convertTo((GrayU8)src,dst); } else if( GrayI16.class.isInstance(src) ) { return convertTo((GrayI16)src,dst); } else if( GrayF32.class == src.getClass() ) { return convertTo((GrayF32)src,dst); } else { throw new IllegalArgumentException("ImageGray type is not yet supported: "+src.getClass().getSimpleName()); } } else if( src instanceof Planar) { Planar ms = (Planar)src; if( GrayU8.class == ms.getBandType() ) { return convertTo_U8((Planar<GrayU8>) ms, dst, orderRgb); } else if( GrayF32.class == ms.getBandType() ) { return convertTo_F32((Planar<GrayF32>) ms, dst, orderRgb); } else { throw new IllegalArgumentException("Planar type is not yet supported: "+ ms.getBandType().getSimpleName()); } } else if( src instanceof ImageInterleaved ) { if( InterleavedU8.class == src.getClass() ) { return convertTo((InterleavedU8)src,dst,orderRgb); } else if( InterleavedF32.class == src.getClass() ) { return convertTo((InterleavedF32)src,dst,orderRgb); } else { throw new IllegalArgumentException("ImageGray type is not yet supported: "+src.getClass().getSimpleName()); } } throw new IllegalArgumentException("Image type is not yet supported: "+src.getClass().getSimpleName()); } }
public class class_name { public static BufferedImage convertTo( ImageBase src, BufferedImage dst, boolean orderRgb ) { if( src instanceof ImageGray) { if( GrayU8.class == src.getClass() ) { return convertTo((GrayU8)src,dst); // depends on control dependency: [if], data = [none] } else if( GrayI16.class.isInstance(src) ) { return convertTo((GrayI16)src,dst); // depends on control dependency: [if], data = [none] } else if( GrayF32.class == src.getClass() ) { return convertTo((GrayF32)src,dst); // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException("ImageGray type is not yet supported: "+src.getClass().getSimpleName()); } } else if( src instanceof Planar) { Planar ms = (Planar)src; if( GrayU8.class == ms.getBandType() ) { return convertTo_U8((Planar<GrayU8>) ms, dst, orderRgb); // depends on control dependency: [if], data = [none] } else if( GrayF32.class == ms.getBandType() ) { return convertTo_F32((Planar<GrayF32>) ms, dst, orderRgb); // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException("Planar type is not yet supported: "+ ms.getBandType().getSimpleName()); } } else if( src instanceof ImageInterleaved ) { if( InterleavedU8.class == src.getClass() ) { return convertTo((InterleavedU8)src,dst,orderRgb); // depends on control dependency: [if], data = [none] } else if( InterleavedF32.class == src.getClass() ) { return convertTo((InterleavedF32)src,dst,orderRgb); // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException("ImageGray type is not yet supported: "+src.getClass().getSimpleName()); } } throw new IllegalArgumentException("Image type is not yet supported: "+src.getClass().getSimpleName()); } }
public class class_name { private void convert(final int iIndex) { if (converted) return; Object o = list.get(iIndex); if (o == null) { o = serializedList.get(iIndex); if (o instanceof Number) o = enumClass.getEnumConstants()[((Number) o).intValue()]; else o = Enum.valueOf(enumClass, o.toString()); list.set(iIndex, (TYPE) o); } } }
public class class_name { private void convert(final int iIndex) { if (converted) return; Object o = list.get(iIndex); if (o == null) { o = serializedList.get(iIndex); // depends on control dependency: [if], data = [none] if (o instanceof Number) o = enumClass.getEnumConstants()[((Number) o).intValue()]; else o = Enum.valueOf(enumClass, o.toString()); list.set(iIndex, (TYPE) o); // depends on control dependency: [if], data = [none] } } }
public class class_name { private CompletableFuture<Long> apply(InitializeEntry entry) { // Iterate through all the server sessions and reset timestamps. This ensures that sessions do not // timeout during leadership changes or shortly thereafter. long timestamp = executor.timestamp(entry.getTimestamp()); for (ServerSessionContext session : executor.context().sessions().sessions.values()) { session.setTimestamp(timestamp); } log.release(entry.getIndex()); return Futures.completedFutureAsync(entry.getIndex(), ThreadContext.currentContextOrThrow().executor()); } }
public class class_name { private CompletableFuture<Long> apply(InitializeEntry entry) { // Iterate through all the server sessions and reset timestamps. This ensures that sessions do not // timeout during leadership changes or shortly thereafter. long timestamp = executor.timestamp(entry.getTimestamp()); for (ServerSessionContext session : executor.context().sessions().sessions.values()) { session.setTimestamp(timestamp); // depends on control dependency: [for], data = [session] } log.release(entry.getIndex()); return Futures.completedFutureAsync(entry.getIndex(), ThreadContext.currentContextOrThrow().executor()); } }
public class class_name { @Override public Map<String, Object> toSource() { Map<String, Object> sourceMap = new HashMap<>(); if (createdBy != null) { addFieldToSource(sourceMap, "createdBy", createdBy); } if (createdTime != null) { addFieldToSource(sourceMap, "createdTime", createdTime); } if (processType != null) { addFieldToSource(sourceMap, "processType", processType); } if (regex != null) { addFieldToSource(sourceMap, "regex", regex); } if (replacement != null) { addFieldToSource(sourceMap, "replacement", replacement); } if (sortOrder != null) { addFieldToSource(sourceMap, "sortOrder", sortOrder); } if (updatedBy != null) { addFieldToSource(sourceMap, "updatedBy", updatedBy); } if (updatedTime != null) { addFieldToSource(sourceMap, "updatedTime", updatedTime); } if (userAgent != null) { addFieldToSource(sourceMap, "userAgent", userAgent); } return sourceMap; } }
public class class_name { @Override public Map<String, Object> toSource() { Map<String, Object> sourceMap = new HashMap<>(); if (createdBy != null) { addFieldToSource(sourceMap, "createdBy", createdBy); // depends on control dependency: [if], data = [none] } if (createdTime != null) { addFieldToSource(sourceMap, "createdTime", createdTime); // depends on control dependency: [if], data = [none] } if (processType != null) { addFieldToSource(sourceMap, "processType", processType); // depends on control dependency: [if], data = [none] } if (regex != null) { addFieldToSource(sourceMap, "regex", regex); // depends on control dependency: [if], data = [none] } if (replacement != null) { addFieldToSource(sourceMap, "replacement", replacement); // depends on control dependency: [if], data = [none] } if (sortOrder != null) { addFieldToSource(sourceMap, "sortOrder", sortOrder); // depends on control dependency: [if], data = [none] } if (updatedBy != null) { addFieldToSource(sourceMap, "updatedBy", updatedBy); // depends on control dependency: [if], data = [none] } if (updatedTime != null) { addFieldToSource(sourceMap, "updatedTime", updatedTime); // depends on control dependency: [if], data = [none] } if (userAgent != null) { addFieldToSource(sourceMap, "userAgent", userAgent); // depends on control dependency: [if], data = [none] } return sourceMap; } }
public class class_name { void waitForAllDropletEventsToComplete(@Nonnull String instanceId, int timeout) throws InternalException, CloudException { APITrace.begin(getProvider(), "listVirtualMachineStatus"); try { // allow maximum five minutes for events to complete long wait = System.currentTimeMillis() + timeout * 60 * 1000; boolean eventsPending = false; while( System.currentTimeMillis() < wait ) { Actions actions = DigitalOceanModelFactory.getDropletEvents(getProvider(), instanceId); for( Action action : actions.getActions() ) { if( "in-progress".equalsIgnoreCase(action.getStatus()) ) { eventsPending = true; } } if( !eventsPending ) { break; } try { // must be careful here not to cause rate limits Thread.sleep(30000); } catch( InterruptedException e ) { break; } } // if events are still pending the cloud will fail the next operation anyway } finally { APITrace.end(); } } }
public class class_name { void waitForAllDropletEventsToComplete(@Nonnull String instanceId, int timeout) throws InternalException, CloudException { APITrace.begin(getProvider(), "listVirtualMachineStatus"); try { // allow maximum five minutes for events to complete long wait = System.currentTimeMillis() + timeout * 60 * 1000; boolean eventsPending = false; while( System.currentTimeMillis() < wait ) { Actions actions = DigitalOceanModelFactory.getDropletEvents(getProvider(), instanceId); for( Action action : actions.getActions() ) { if( "in-progress".equalsIgnoreCase(action.getStatus()) ) { eventsPending = true; // depends on control dependency: [if], data = [none] } } if( !eventsPending ) { break; } try { // must be careful here not to cause rate limits Thread.sleep(30000); // depends on control dependency: [try], data = [none] } catch( InterruptedException e ) { break; } // depends on control dependency: [catch], data = [none] } // if events are still pending the cloud will fail the next operation anyway } finally { APITrace.end(); } } }
public class class_name { public void marshall(DashConfigurationForPut dashConfigurationForPut, ProtocolMarshaller protocolMarshaller) { if (dashConfigurationForPut == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(dashConfigurationForPut.getMpdLocation(), MPDLOCATION_BINDING); protocolMarshaller.marshall(dashConfigurationForPut.getOriginManifestType(), ORIGINMANIFESTTYPE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DashConfigurationForPut dashConfigurationForPut, ProtocolMarshaller protocolMarshaller) { if (dashConfigurationForPut == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(dashConfigurationForPut.getMpdLocation(), MPDLOCATION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(dashConfigurationForPut.getOriginManifestType(), ORIGINMANIFESTTYPE_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 updateProperties(Map<Object, Object> properties) { this.commonProperties = properties; try { new TCPFactoryConfiguration(properties); } catch (ChannelFactoryException e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Unable to consume property updates"); } } } }
public class class_name { public void updateProperties(Map<Object, Object> properties) { this.commonProperties = properties; try { new TCPFactoryConfiguration(properties); // depends on control dependency: [try], data = [none] } catch (ChannelFactoryException e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Unable to consume property updates"); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void print( Queue<Runnable> queue, IoEvent event) { StringBuilder sb = new StringBuilder(); sb.append( "Adding event " ).append( event.getType() ).append( " to session " ).append(event.getSession().getId() ); boolean first = true; sb.append( "\nQueue : [" ); for (Runnable elem:queue) { if ( first ) { first = false; } else { sb.append( ", " ); } sb.append(((IoEvent)elem).getType()).append(", "); } sb.append( "]\n" ); LOGGER.debug( sb.toString() ); } }
public class class_name { private void print( Queue<Runnable> queue, IoEvent event) { StringBuilder sb = new StringBuilder(); sb.append( "Adding event " ).append( event.getType() ).append( " to session " ).append(event.getSession().getId() ); boolean first = true; sb.append( "\nQueue : [" ); for (Runnable elem:queue) { if ( first ) { first = false; // depends on control dependency: [if], data = [none] } else { sb.append( ", " ); // depends on control dependency: [if], data = [none] } sb.append(((IoEvent)elem).getType()).append(", "); // depends on control dependency: [for], data = [elem] } sb.append( "]\n" ); LOGGER.debug( sb.toString() ); } }
public class class_name { public List<String> getBoundVariablesInScope(final BaseSingleFieldConstraint con) { final List<String> result = new ArrayList<String>(); for (int i = 0; i < this.lhs.length; i++) { IPattern pat = this.lhs[i]; if (findBoundVariableNames(con, result, pat)) { return result; } } return result; } }
public class class_name { public List<String> getBoundVariablesInScope(final BaseSingleFieldConstraint con) { final List<String> result = new ArrayList<String>(); for (int i = 0; i < this.lhs.length; i++) { IPattern pat = this.lhs[i]; if (findBoundVariableNames(con, result, pat)) { return result; // depends on control dependency: [if], data = [none] } } return result; } }
public class class_name { protected EventIdentificationType setEventIdentification( RFC3881EventOutcomeCodes outcome, RFC3881EventActionCodes action, CodedValueType id, CodedValueType[] type, List<CodedValueType> purposesOfUse) { EventIdentificationType eventBlock = new EventIdentificationType(); eventBlock.setEventID(id); eventBlock.setEventDateTime(TimestampUtils.getRFC3881Timestamp(eventDateTime)); if (!EventUtils.isEmptyOrNull(action)) { eventBlock.setEventActionCode(action.getCode()); } if (!EventUtils.isEmptyOrNull(outcome)) { eventBlock.setEventOutcomeIndicator(outcome.getCode()); } if (!EventUtils.isEmptyOrNull(type, true)) { eventBlock.getEventTypeCode().addAll(Arrays.asList(type)); } eventBlock.setPurposesOfUse(purposesOfUse); getAuditMessage().setEventIdentification(eventBlock); return eventBlock; } }
public class class_name { protected EventIdentificationType setEventIdentification( RFC3881EventOutcomeCodes outcome, RFC3881EventActionCodes action, CodedValueType id, CodedValueType[] type, List<CodedValueType> purposesOfUse) { EventIdentificationType eventBlock = new EventIdentificationType(); eventBlock.setEventID(id); eventBlock.setEventDateTime(TimestampUtils.getRFC3881Timestamp(eventDateTime)); if (!EventUtils.isEmptyOrNull(action)) { eventBlock.setEventActionCode(action.getCode()); // depends on control dependency: [if], data = [none] } if (!EventUtils.isEmptyOrNull(outcome)) { eventBlock.setEventOutcomeIndicator(outcome.getCode()); // depends on control dependency: [if], data = [none] } if (!EventUtils.isEmptyOrNull(type, true)) { eventBlock.getEventTypeCode().addAll(Arrays.asList(type)); // depends on control dependency: [if], data = [none] } eventBlock.setPurposesOfUse(purposesOfUse); getAuditMessage().setEventIdentification(eventBlock); return eventBlock; } }
public class class_name { public void info(String format, Object... msg) { if (logger.isInfoEnabled()) { // check if the first message contains variables variables if (format.toString().contains("{")) { logger.info(format.toString(), msg); } else { logger.info(format.toString().concat(" ").concat(JKStringUtil.concat(msg))); } } } }
public class class_name { public void info(String format, Object... msg) { if (logger.isInfoEnabled()) { // check if the first message contains variables variables if (format.toString().contains("{")) { logger.info(format.toString(), msg); // depends on control dependency: [if], data = [none] } else { logger.info(format.toString().concat(" ").concat(JKStringUtil.concat(msg))); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private Set<String> populateTableNames(String url) throws SQLException { Set<String> tableNames = new HashSet<String>(); Connection connection = null; ResultSet rs = null; try { connection = DriverManager.getConnection(url); DatabaseMetaData dmd = connection.getMetaData(); rs = dmd.getTables(null, null, null, null); while (rs.next()) { tableNames.add(rs.getString("TABLE_NAME").toUpperCase()); } } finally { if (rs != null) { rs.close(); } if (connection != null) { connection.close(); } } return tableNames; } }
public class class_name { private Set<String> populateTableNames(String url) throws SQLException { Set<String> tableNames = new HashSet<String>(); Connection connection = null; ResultSet rs = null; try { connection = DriverManager.getConnection(url); DatabaseMetaData dmd = connection.getMetaData(); rs = dmd.getTables(null, null, null, null); while (rs.next()) { tableNames.add(rs.getString("TABLE_NAME").toUpperCase()); // depends on control dependency: [while], data = [none] } } finally { if (rs != null) { rs.close(); // depends on control dependency: [if], data = [none] } if (connection != null) { connection.close(); // depends on control dependency: [if], data = [none] } } return tableNames; } }
public class class_name { private String generateRFC1779DN(Map<String, String> oidMap) { if (names.length == 1) { return names[0].toRFC1779String(oidMap); } StringBuilder sb = new StringBuilder(48); if (names != null) { for (int i = names.length - 1; i >= 0; i--) { if (i != names.length - 1) { sb.append(", "); } sb.append(names[i].toRFC1779String(oidMap)); } } return sb.toString(); } }
public class class_name { private String generateRFC1779DN(Map<String, String> oidMap) { if (names.length == 1) { return names[0].toRFC1779String(oidMap); // depends on control dependency: [if], data = [none] } StringBuilder sb = new StringBuilder(48); if (names != null) { for (int i = names.length - 1; i >= 0; i--) { if (i != names.length - 1) { sb.append(", "); // depends on control dependency: [if], data = [none] } sb.append(names[i].toRFC1779String(oidMap)); // depends on control dependency: [for], data = [i] } } return sb.toString(); } }
public class class_name { public BeetlException validate(){ if(!(program instanceof ErrorGrammarProgram)){ return null; } ErrorGrammarProgram error = (ErrorGrammarProgram)program; BeetlException exception = error.getException(); return exception; } }
public class class_name { public BeetlException validate(){ if(!(program instanceof ErrorGrammarProgram)){ return null; // depends on control dependency: [if], data = [none] } ErrorGrammarProgram error = (ErrorGrammarProgram)program; BeetlException exception = error.getException(); return exception; } }
public class class_name { public void marshall(ListDocumentClassificationJobsRequest listDocumentClassificationJobsRequest, ProtocolMarshaller protocolMarshaller) { if (listDocumentClassificationJobsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(listDocumentClassificationJobsRequest.getFilter(), FILTER_BINDING); protocolMarshaller.marshall(listDocumentClassificationJobsRequest.getNextToken(), NEXTTOKEN_BINDING); protocolMarshaller.marshall(listDocumentClassificationJobsRequest.getMaxResults(), MAXRESULTS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ListDocumentClassificationJobsRequest listDocumentClassificationJobsRequest, ProtocolMarshaller protocolMarshaller) { if (listDocumentClassificationJobsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(listDocumentClassificationJobsRequest.getFilter(), FILTER_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(listDocumentClassificationJobsRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(listDocumentClassificationJobsRequest.getMaxResults(), MAXRESULTS_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 shuffleSelectedLeftRowsToRightTableModel(final int[] selectedRows) { final int lastIndex = selectedRows.length - 1; for (int i = lastIndex; -1 < i; i--) { final int selectedRow = selectedRows[i]; final T row = leftTableModel.removeAt(selectedRow); rightTableModel.add(row); } } }
public class class_name { public void shuffleSelectedLeftRowsToRightTableModel(final int[] selectedRows) { final int lastIndex = selectedRows.length - 1; for (int i = lastIndex; -1 < i; i--) { final int selectedRow = selectedRows[i]; final T row = leftTableModel.removeAt(selectedRow); rightTableModel.add(row); // depends on control dependency: [for], data = [none] } } }
public class class_name { JSField getFieldDef(int accessor, boolean mustBePresent) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) JmfTr.entry(this, tc, "getFieldDef", new Object[]{Integer.valueOf(accessor), Boolean.valueOf(mustBePresent)}); if (mustBePresent) { if ((map == null) || (map.fields[accessor] == null)) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) JmfTr.exit(this, tc, "getFieldDef", null); return null; } } JSField result = fields[accessor]; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) JmfTr.exit(this, tc, "getFieldDef", result); return result; } }
public class class_name { JSField getFieldDef(int accessor, boolean mustBePresent) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) JmfTr.entry(this, tc, "getFieldDef", new Object[]{Integer.valueOf(accessor), Boolean.valueOf(mustBePresent)}); if (mustBePresent) { if ((map == null) || (map.fields[accessor] == null)) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) JmfTr.exit(this, tc, "getFieldDef", null); return null; // depends on control dependency: [if], data = [none] } } JSField result = fields[accessor]; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) JmfTr.exit(this, tc, "getFieldDef", result); return result; } }
public class class_name { public Short toShort(final Object value, final Short defaultValue) { final Short result = toShort(value); if (result == null) { return defaultValue; } return result; } }
public class class_name { public Short toShort(final Object value, final Short defaultValue) { final Short result = toShort(value); if (result == null) { return defaultValue; // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { public VM validate(Iterator<Split> dataSplits, TrainingParameters trainingParameters) { AbstractModeler modeler = MLBuilder.create(trainingParameters, configuration); List<VM> validationMetricsList = new LinkedList<>(); while (dataSplits.hasNext()) { Split s = dataSplits.next(); Dataframe trainData = s.getTrain(); Dataframe testData = s.getTest(); modeler.fit(trainData); trainData.close(); modeler.predict(testData); VM entrySample = ValidationMetrics.newInstance(vmClass, testData); testData.close(); validationMetricsList.add(entrySample); } modeler.close(); VM avgValidationMetrics = ValidationMetrics.newInstance(vmClass, validationMetricsList); return avgValidationMetrics; } }
public class class_name { public VM validate(Iterator<Split> dataSplits, TrainingParameters trainingParameters) { AbstractModeler modeler = MLBuilder.create(trainingParameters, configuration); List<VM> validationMetricsList = new LinkedList<>(); while (dataSplits.hasNext()) { Split s = dataSplits.next(); Dataframe trainData = s.getTrain(); Dataframe testData = s.getTest(); modeler.fit(trainData); // depends on control dependency: [while], data = [none] trainData.close(); // depends on control dependency: [while], data = [none] modeler.predict(testData); // depends on control dependency: [while], data = [none] VM entrySample = ValidationMetrics.newInstance(vmClass, testData); testData.close(); // depends on control dependency: [while], data = [none] validationMetricsList.add(entrySample); // depends on control dependency: [while], data = [none] } modeler.close(); VM avgValidationMetrics = ValidationMetrics.newInstance(vmClass, validationMetricsList); return avgValidationMetrics; } }
public class class_name { public java.lang.String getValue() { java.lang.Object ref = value_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { value_ = s; } return s; } } }
public class class_name { public java.lang.String getValue() { java.lang.Object ref = value_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; // depends on control dependency: [if], data = [none] } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { value_ = s; // depends on control dependency: [if], data = [none] } return s; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static List<InetAddress> getLocalIpAddresses(boolean pruneSiteLocal, boolean pruneDown) throws RuntimeException { try { Enumeration<NetworkInterface> nics = NetworkInterface.getNetworkInterfaces(); List<InetAddress> addresses = new Vector<InetAddress>(); while (nics.hasMoreElements()) { NetworkInterface iface = nics.nextElement(); Enumeration<InetAddress> addrs = iface.getInetAddresses(); if (!pruneDown || iface.isUp()) { while (addrs.hasMoreElements()) { InetAddress addr = addrs.nextElement(); if (!addr.isLoopbackAddress() && !addr.isLinkLocalAddress()) { if (!pruneSiteLocal || (pruneSiteLocal && !addr.isSiteLocalAddress())) { addresses.add(addr); } } } } } return addresses; } catch (SocketException e) { throw new RuntimeException(e.getMessage(), e); } } }
public class class_name { public static List<InetAddress> getLocalIpAddresses(boolean pruneSiteLocal, boolean pruneDown) throws RuntimeException { try { Enumeration<NetworkInterface> nics = NetworkInterface.getNetworkInterfaces(); List<InetAddress> addresses = new Vector<InetAddress>(); while (nics.hasMoreElements()) { NetworkInterface iface = nics.nextElement(); Enumeration<InetAddress> addrs = iface.getInetAddresses(); if (!pruneDown || iface.isUp()) { while (addrs.hasMoreElements()) { InetAddress addr = addrs.nextElement(); if (!addr.isLoopbackAddress() && !addr.isLinkLocalAddress()) { if (!pruneSiteLocal || (pruneSiteLocal && !addr.isSiteLocalAddress())) { addresses.add(addr); // depends on control dependency: [if], data = [none] } } } } } return addresses; } catch (SocketException e) { throw new RuntimeException(e.getMessage(), e); } } }
public class class_name { public boolean isExceptionMatched(AnalyzedToken token) { if (exceptionSet) { for (PatternToken testException : exceptionList) { if (!testException.exceptionValidNext) { if (testException.isMatched(token)) { return true; } } } } return false; } }
public class class_name { public boolean isExceptionMatched(AnalyzedToken token) { if (exceptionSet) { for (PatternToken testException : exceptionList) { if (!testException.exceptionValidNext) { if (testException.isMatched(token)) { return true; // depends on control dependency: [if], data = [none] } } } } return false; } }
public class class_name { @Override protected URL findResource(String name) { if (resourceCache.containsKey(name)) { return resourceCache.get(name); } for (WeakReference<Bundle> ref : bundles) { final Bundle bundle = ref.get(); if (bundle != null && bundle.getState() == Bundle.ACTIVE) { try { final URL resource = bundle.getResource(name); if (resource != null) { resourceCache.put(name, resource); return resource; } } catch (Exception ignore) { } } } // TODO: Error? return null; } }
public class class_name { @Override protected URL findResource(String name) { if (resourceCache.containsKey(name)) { return resourceCache.get(name); // depends on control dependency: [if], data = [none] } for (WeakReference<Bundle> ref : bundles) { final Bundle bundle = ref.get(); if (bundle != null && bundle.getState() == Bundle.ACTIVE) { try { final URL resource = bundle.getResource(name); if (resource != null) { resourceCache.put(name, resource); // depends on control dependency: [if], data = [none] return resource; // depends on control dependency: [if], data = [none] } } catch (Exception ignore) { } // depends on control dependency: [catch], data = [none] } } // TODO: Error? return null; } }
public class class_name { private MapController createMapController(Map map, final GraphicsController controller, String id) { MapController mapController; if (ToolId.TOOL_MEASURE_DISTANCE_MODE.equalsIgnoreCase(id)) { mapController = new MeasureDistanceInfoControllerImpl(map, (MeasureDistanceController) controller); } else { mapController = new MapController(map, controller); } mapController.setActivationHandler(new ExportableFunction() { public void execute() { controller.onActivate(); } }); mapController.setDeactivationHandler(new ExportableFunction() { public void execute() { controller.onDeactivate(); } }); return mapController; } }
public class class_name { private MapController createMapController(Map map, final GraphicsController controller, String id) { MapController mapController; if (ToolId.TOOL_MEASURE_DISTANCE_MODE.equalsIgnoreCase(id)) { mapController = new MeasureDistanceInfoControllerImpl(map, (MeasureDistanceController) controller); // depends on control dependency: [if], data = [none] } else { mapController = new MapController(map, controller); // depends on control dependency: [if], data = [none] } mapController.setActivationHandler(new ExportableFunction() { public void execute() { controller.onActivate(); } }); mapController.setDeactivationHandler(new ExportableFunction() { public void execute() { controller.onDeactivate(); } }); return mapController; } }
public class class_name { @Override protected void addGenericHeaders(final UIContext uic, final WComponent ui) { // Note: This effectively prevents caching of anything served up from a WServlet. // We are ok for WContent and thrown ContentEscapes, as addGenericHeaders will not be called if (getBackingRequest() instanceof SubSessionHttpServletRequestWrapper) { getBackingResponse().setHeader("Cache-Control", CacheType.NO_CACHE.getSettings()); getBackingResponse().setHeader("Pragma", "no-cache"); getBackingResponse().setHeader("Expires", "-1"); } // This is to prevent clickjacking. It can also be set to "DENY" to prevent embedding in a frames at all or // "ALLOW-FROM uri" to allow embedding in a frame within a particular site. // The default will allow WComponents applications in a frame on the same origin. getBackingResponse().setHeader("X-Frame-Options", "SAMEORIGIN"); } }
public class class_name { @Override protected void addGenericHeaders(final UIContext uic, final WComponent ui) { // Note: This effectively prevents caching of anything served up from a WServlet. // We are ok for WContent and thrown ContentEscapes, as addGenericHeaders will not be called if (getBackingRequest() instanceof SubSessionHttpServletRequestWrapper) { getBackingResponse().setHeader("Cache-Control", CacheType.NO_CACHE.getSettings()); // depends on control dependency: [if], data = [none] getBackingResponse().setHeader("Pragma", "no-cache"); // depends on control dependency: [if], data = [none] getBackingResponse().setHeader("Expires", "-1"); // depends on control dependency: [if], data = [none] } // This is to prevent clickjacking. It can also be set to "DENY" to prevent embedding in a frames at all or // "ALLOW-FROM uri" to allow embedding in a frame within a particular site. // The default will allow WComponents applications in a frame on the same origin. getBackingResponse().setHeader("X-Frame-Options", "SAMEORIGIN"); } }
public class class_name { public void setLocale(Locale locale) { List<SimpleDateFormat> formats = new ArrayList<SimpleDateFormat>(); for (SimpleDateFormat format : m_formats) { formats.add(new SimpleDateFormat(format.toPattern(), locale)); } m_formats = formats.toArray(new SimpleDateFormat[formats.size()]); } }
public class class_name { public void setLocale(Locale locale) { List<SimpleDateFormat> formats = new ArrayList<SimpleDateFormat>(); for (SimpleDateFormat format : m_formats) { formats.add(new SimpleDateFormat(format.toPattern(), locale)); // depends on control dependency: [for], data = [format] } m_formats = formats.toArray(new SimpleDateFormat[formats.size()]); } }
public class class_name { synchronized void loadImageIfNecessary(final boolean isInLayoutPass) { int width = getWidth(); int height = getHeight(); boolean wrapWidth = false, wrapHeight = false; if (getLayoutParams() != null) { wrapWidth = getLayoutParams().width == LayoutParams.WRAP_CONTENT; wrapHeight = getLayoutParams().height == LayoutParams.WRAP_CONTENT; } // if the view's bounds aren't known yet, and this is not a wrap-content/wrap-content // view, hold off on loading the image. boolean isFullyWrapContent = wrapWidth && wrapHeight; if (width == 0 && height == 0 && !isFullyWrapContent) { return; } // if the URL to be loaded in this view is empty, cancel any old requests and clear the // currently loaded image. if (TextUtils.isEmpty(url)) { if (imageContainer != null) { imageContainer.cancelRequest(); imageContainer = null; } setDefaultImageOrNull(); return; } // if there was an old request in this view, check if it needs to be canceled. if (imageContainer != null && imageContainer.getRequestUrl() != null) { if (imageContainer.getRequestUrl().equals(url)) { // if the request is from the same URL, return. return; } else { // if there is a pre-existing request, cancel it if it's fetching a different URL. imageContainer.cancelRequest(); setDefaultImageOrNull(); } } // Calculate the max image width / height to use while ignoring WRAP_CONTENT dimens. int maxWidth = wrapWidth ? 0 : width; int maxHeight = wrapHeight ? 0 : height; // The pre-existing content of this view didn't match the current URL. Load the new image // from the network. ImageContainer newContainer = imageLoader.get(url, new ImageListener() { @Override public void onError(JusError error) { if (errorImageId != 0) { setImageResource(errorImageId); } } @Override public void onResponse(final ImageContainer response, boolean isImmediate) { //verify if we expect the same url if (NetworkImageView.this.url == null || !NetworkImageView.this.url.equals(response.getRequestUrl())) { JusLog.error("NetworkImageView received: " + response.getRequestUrl() + ", expected: " + NetworkImageView.this.url); return; } // If this was an immediate response that was delivered inside of a layout // pass do not set the image immediately as it will trigger a requestLayout // inside of a layout. Instead, defer setting the image by posting back to // the main threadId. if (isImmediate && isInLayoutPass) { post(new Runnable() { @Override public void run() { onResponse(response, false); } }); return; } if (response.getBitmap() != null && isOk2Draw(response.getBitmap())) { setImageBitmap(response.getBitmap()); } else if (defaultImageId != 0) { if (!isImmediate) { JusLog.error("NetworkImageView received null for: " + response .getRequestUrl()); } setImageResource(defaultImageId); } } }, maxWidth, maxHeight, tag); // update the ImageContainer to be the new bitmap container. imageContainer = newContainer; } }
public class class_name { synchronized void loadImageIfNecessary(final boolean isInLayoutPass) { int width = getWidth(); int height = getHeight(); boolean wrapWidth = false, wrapHeight = false; if (getLayoutParams() != null) { wrapWidth = getLayoutParams().width == LayoutParams.WRAP_CONTENT; // depends on control dependency: [if], data = [none] wrapHeight = getLayoutParams().height == LayoutParams.WRAP_CONTENT; // depends on control dependency: [if], data = [none] } // if the view's bounds aren't known yet, and this is not a wrap-content/wrap-content // view, hold off on loading the image. boolean isFullyWrapContent = wrapWidth && wrapHeight; if (width == 0 && height == 0 && !isFullyWrapContent) { return; // depends on control dependency: [if], data = [none] } // if the URL to be loaded in this view is empty, cancel any old requests and clear the // currently loaded image. if (TextUtils.isEmpty(url)) { if (imageContainer != null) { imageContainer.cancelRequest(); // depends on control dependency: [if], data = [none] imageContainer = null; // depends on control dependency: [if], data = [none] } setDefaultImageOrNull(); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } // if there was an old request in this view, check if it needs to be canceled. if (imageContainer != null && imageContainer.getRequestUrl() != null) { if (imageContainer.getRequestUrl().equals(url)) { // if the request is from the same URL, return. return; // depends on control dependency: [if], data = [none] } else { // if there is a pre-existing request, cancel it if it's fetching a different URL. imageContainer.cancelRequest(); // depends on control dependency: [if], data = [none] setDefaultImageOrNull(); // depends on control dependency: [if], data = [none] } } // Calculate the max image width / height to use while ignoring WRAP_CONTENT dimens. int maxWidth = wrapWidth ? 0 : width; int maxHeight = wrapHeight ? 0 : height; // The pre-existing content of this view didn't match the current URL. Load the new image // from the network. ImageContainer newContainer = imageLoader.get(url, new ImageListener() { @Override public void onError(JusError error) { if (errorImageId != 0) { setImageResource(errorImageId); // depends on control dependency: [if], data = [(errorImageId] } } @Override public void onResponse(final ImageContainer response, boolean isImmediate) { //verify if we expect the same url if (NetworkImageView.this.url == null || !NetworkImageView.this.url.equals(response.getRequestUrl())) { JusLog.error("NetworkImageView received: " + response.getRequestUrl() + ", expected: " + NetworkImageView.this.url); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } // If this was an immediate response that was delivered inside of a layout // pass do not set the image immediately as it will trigger a requestLayout // inside of a layout. Instead, defer setting the image by posting back to // the main threadId. if (isImmediate && isInLayoutPass) { post(new Runnable() { @Override public void run() { onResponse(response, false); } }); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (response.getBitmap() != null && isOk2Draw(response.getBitmap())) { setImageBitmap(response.getBitmap()); // depends on control dependency: [if], data = [(response.getBitmap()] } else if (defaultImageId != 0) { if (!isImmediate) { JusLog.error("NetworkImageView received null for: " + response .getRequestUrl()); // depends on control dependency: [if], data = [none] } setImageResource(defaultImageId); // depends on control dependency: [if], data = [(defaultImageId] } } }, maxWidth, maxHeight, tag); // update the ImageContainer to be the new bitmap container. imageContainer = newContainer; } }
public class class_name { public static IFileContentResultBean compareFileContentByLines(final File sourceFile, final File fileToCompare) { final IFileContentResultBean fileContentResultBean = new FileContentResultBean(sourceFile, fileToCompare); completeCompare(fileContentResultBean); final boolean simpleEquality = validateEquality(fileContentResultBean); boolean contentEquality = true; // Compare the content... if (simpleEquality) { try ( BufferedReader sourceReader = (BufferedReader)StreamExtensions .getReader(sourceFile); BufferedReader compareReader = (BufferedReader)StreamExtensions .getReader(fileToCompare);) { String sourceLine; String compareLine; while ((sourceLine = sourceReader.readLine()) != null) { compareLine = compareReader.readLine(); if (compareLine == null || !sourceLine.equals(compareLine)) { contentEquality = false; break; } } } catch (final FileNotFoundException e) { contentEquality = false; } catch (final IOException e) { contentEquality = false; } } fileContentResultBean.setContentEquality(contentEquality); return fileContentResultBean; } }
public class class_name { public static IFileContentResultBean compareFileContentByLines(final File sourceFile, final File fileToCompare) { final IFileContentResultBean fileContentResultBean = new FileContentResultBean(sourceFile, fileToCompare); completeCompare(fileContentResultBean); final boolean simpleEquality = validateEquality(fileContentResultBean); boolean contentEquality = true; // Compare the content... if (simpleEquality) { try ( BufferedReader sourceReader = (BufferedReader)StreamExtensions .getReader(sourceFile); BufferedReader compareReader = (BufferedReader)StreamExtensions .getReader(fileToCompare);) { String sourceLine; String compareLine; while ((sourceLine = sourceReader.readLine()) != null) { compareLine = compareReader.readLine(); // depends on control dependency: [while], data = [none] if (compareLine == null || !sourceLine.equals(compareLine)) { contentEquality = false; // depends on control dependency: [if], data = [none] break; } } } catch (final FileNotFoundException e) // depends on control dependency: [if], data = [none] { contentEquality = false; } catch (final IOException e) // depends on control dependency: [if], data = [none] { contentEquality = false; } } fileContentResultBean.setContentEquality(contentEquality); return fileContentResultBean; } }
public class class_name { protected void cleanup(StoreAccessException from) { try { store.obliterate(); } catch (StoreAccessException e) { inconsistent(from, e); return; } recovered(from); } }
public class class_name { protected void cleanup(StoreAccessException from) { try { store.obliterate(); // depends on control dependency: [try], data = [none] } catch (StoreAccessException e) { inconsistent(from, e); return; } // depends on control dependency: [catch], data = [none] recovered(from); } }
public class class_name { @Indexable(type = IndexableType.REINDEX) @Override public CommerceTierPriceEntry upsertCommerceTierPriceEntry( long commerceTierPriceEntryId, long commercePriceEntryId, String externalReferenceCode, BigDecimal price, BigDecimal promoPrice, int minQuantity, String priceEntryExternalReferenceCode, ServiceContext serviceContext) throws PortalException { // Update if (commerceTierPriceEntryId > 0) { try { return updateCommerceTierPriceEntry( commerceTierPriceEntryId, price, promoPrice, minQuantity, serviceContext); } catch (NoSuchTierPriceEntryException nstpee) { if (_log.isDebugEnabled()) { _log.debug( "Unable to find tier price entry with ID: " + commerceTierPriceEntryId); } } } if (Validator.isNotNull(externalReferenceCode)) { CommerceTierPriceEntry commerceTierPriceEntry = commerceTierPriceEntryPersistence.fetchByC_ERC( serviceContext.getCompanyId(), externalReferenceCode); if (commerceTierPriceEntry != null) { return updateCommerceTierPriceEntry( commerceTierPriceEntry.getCommerceTierPriceEntryId(), price, promoPrice, minQuantity, serviceContext); } } // Add if (commercePriceEntryId > 0) { validate(0L, commercePriceEntryId, minQuantity); CommercePriceEntry commercePriceEntry = _commercePriceEntryPersistence.findByPrimaryKey( commercePriceEntryId); return addCommerceTierPriceEntry( commercePriceEntry.getCommercePriceEntryId(), externalReferenceCode, price, promoPrice, minQuantity, serviceContext); } if (Validator.isNotNull(priceEntryExternalReferenceCode)) { CommercePriceEntry commercePriceEntry = _commercePriceEntryPersistence.findByC_ERC( serviceContext.getCompanyId(), priceEntryExternalReferenceCode); validate( 0L, commercePriceEntry.getCommercePriceEntryId(), minQuantity); return addCommerceTierPriceEntry( commercePriceEntry.getCommercePriceEntryId(), externalReferenceCode, price, promoPrice, minQuantity, serviceContext); } StringBundler sb = new StringBundler(6); sb.append("{commercePriceEntryId="); sb.append(commercePriceEntryId); sb.append(StringPool.COMMA_AND_SPACE); sb.append("priceEntryExternalReferenceCode="); sb.append(priceEntryExternalReferenceCode); sb.append(CharPool.CLOSE_CURLY_BRACE); throw new NoSuchPriceEntryException(sb.toString()); } }
public class class_name { @Indexable(type = IndexableType.REINDEX) @Override public CommerceTierPriceEntry upsertCommerceTierPriceEntry( long commerceTierPriceEntryId, long commercePriceEntryId, String externalReferenceCode, BigDecimal price, BigDecimal promoPrice, int minQuantity, String priceEntryExternalReferenceCode, ServiceContext serviceContext) throws PortalException { // Update if (commerceTierPriceEntryId > 0) { try { return updateCommerceTierPriceEntry( commerceTierPriceEntryId, price, promoPrice, minQuantity, serviceContext); // depends on control dependency: [try], data = [none] } catch (NoSuchTierPriceEntryException nstpee) { if (_log.isDebugEnabled()) { _log.debug( "Unable to find tier price entry with ID: " + commerceTierPriceEntryId); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } if (Validator.isNotNull(externalReferenceCode)) { CommerceTierPriceEntry commerceTierPriceEntry = commerceTierPriceEntryPersistence.fetchByC_ERC( serviceContext.getCompanyId(), externalReferenceCode); if (commerceTierPriceEntry != null) { return updateCommerceTierPriceEntry( commerceTierPriceEntry.getCommerceTierPriceEntryId(), price, promoPrice, minQuantity, serviceContext); // depends on control dependency: [if], data = [none] } } // Add if (commercePriceEntryId > 0) { validate(0L, commercePriceEntryId, minQuantity); CommercePriceEntry commercePriceEntry = _commercePriceEntryPersistence.findByPrimaryKey( commercePriceEntryId); return addCommerceTierPriceEntry( commercePriceEntry.getCommercePriceEntryId(), externalReferenceCode, price, promoPrice, minQuantity, serviceContext); } if (Validator.isNotNull(priceEntryExternalReferenceCode)) { CommercePriceEntry commercePriceEntry = _commercePriceEntryPersistence.findByC_ERC( serviceContext.getCompanyId(), priceEntryExternalReferenceCode); validate( 0L, commercePriceEntry.getCommercePriceEntryId(), minQuantity); return addCommerceTierPriceEntry( commercePriceEntry.getCommercePriceEntryId(), externalReferenceCode, price, promoPrice, minQuantity, serviceContext); } StringBundler sb = new StringBundler(6); sb.append("{commercePriceEntryId="); sb.append(commercePriceEntryId); sb.append(StringPool.COMMA_AND_SPACE); sb.append("priceEntryExternalReferenceCode="); sb.append(priceEntryExternalReferenceCode); sb.append(CharPool.CLOSE_CURLY_BRACE); throw new NoSuchPriceEntryException(sb.toString()); } }
public class class_name { public HttpTrailersImpl getTrailers() { Object o = this.hdrPool.get(); HttpTrailersImpl hdrs = (null == o) ? new HttpTrailersImpl() : (HttpTrailersImpl) o; hdrs.setFactory(this); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "getTrailers: " + hdrs); } return hdrs; } }
public class class_name { public HttpTrailersImpl getTrailers() { Object o = this.hdrPool.get(); HttpTrailersImpl hdrs = (null == o) ? new HttpTrailersImpl() : (HttpTrailersImpl) o; hdrs.setFactory(this); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "getTrailers: " + hdrs); // depends on control dependency: [if], data = [none] } return hdrs; } }
public class class_name { protected T getTypedFilter(Filter filter) { if (isFilterAProperSublcass(filter)) { return unchecked(filter); } throw new IllegalStateException( String.format( "FilterAdapter %s cannot operate on a filter of type %s", getClass().getCanonicalName(), filter.getClass().getCanonicalName())); } }
public class class_name { protected T getTypedFilter(Filter filter) { if (isFilterAProperSublcass(filter)) { return unchecked(filter); // depends on control dependency: [if], data = [none] } throw new IllegalStateException( String.format( "FilterAdapter %s cannot operate on a filter of type %s", getClass().getCanonicalName(), filter.getClass().getCanonicalName())); } }
public class class_name { public boolean verifyText(final By by, final String text) { WebElement element = driver.findElement(by); if (element.getText().equals(text)) { LOG.info("Element: " + element + " contains the given text: " + text); return true; } LOG.info("Element: " + element + " does NOT contain the given text: " + text); return false; } }
public class class_name { public boolean verifyText(final By by, final String text) { WebElement element = driver.findElement(by); if (element.getText().equals(text)) { LOG.info("Element: " + element + " contains the given text: " + text); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } LOG.info("Element: " + element + " does NOT contain the given text: " + text); return false; } }
public class class_name { private void validateTable(TableDefinition tableDef) { // No options are currently allowed: for (String optName : tableDef.getOptionNames()) { Utils.require(false, "Unknown option for OLAPService table: " + optName); } for (FieldDefinition fieldDef : tableDef.getFieldDefinitions()) { validateField(fieldDef); } } }
public class class_name { private void validateTable(TableDefinition tableDef) { // No options are currently allowed: for (String optName : tableDef.getOptionNames()) { Utils.require(false, "Unknown option for OLAPService table: " + optName); // depends on control dependency: [for], data = [optName] } for (FieldDefinition fieldDef : tableDef.getFieldDefinitions()) { validateField(fieldDef); // depends on control dependency: [for], data = [fieldDef] } } }
public class class_name { protected static void logParsingIssue(final String prefix, final SAXParseException e) { final StringBuilder buffer = new StringBuilder(); buffer.append(prefix); buffer.append(" while reading UAS data: "); buffer.append(e.getMessage()); buffer.append(" (line: "); buffer.append(e.getLineNumber()); if (e.getSystemId() != null) { buffer.append(" uri: "); buffer.append(e.getSystemId()); } buffer.append(")"); LOG.warn(buffer.toString()); } }
public class class_name { protected static void logParsingIssue(final String prefix, final SAXParseException e) { final StringBuilder buffer = new StringBuilder(); buffer.append(prefix); buffer.append(" while reading UAS data: "); buffer.append(e.getMessage()); buffer.append(" (line: "); buffer.append(e.getLineNumber()); if (e.getSystemId() != null) { buffer.append(" uri: "); // depends on control dependency: [if], data = [none] buffer.append(e.getSystemId()); // depends on control dependency: [if], data = [(e.getSystemId()] } buffer.append(")"); LOG.warn(buffer.toString()); } }
public class class_name { private static Throwable findRootCause(Throwable t) { Throwable root = t; Throwable cause = root.getCause(); while (cause != null) { root = cause; cause = root.getCause(); } return root; } }
public class class_name { private static Throwable findRootCause(Throwable t) { Throwable root = t; Throwable cause = root.getCause(); while (cause != null) { root = cause; // depends on control dependency: [while], data = [none] cause = root.getCause(); // depends on control dependency: [while], data = [none] } return root; } }
public class class_name { public static long parseHttpTime(final String time) { if (time == null) { return -1; } try { return TimeUtil.HTTP_DATE_FORMAT.parse(time).getTime(); } catch (ParseException e) { return -1; } } }
public class class_name { public static long parseHttpTime(final String time) { if (time == null) { return -1; // depends on control dependency: [if], data = [none] } try { return TimeUtil.HTTP_DATE_FORMAT.parse(time).getTime(); // depends on control dependency: [try], data = [none] } catch (ParseException e) { return -1; } // depends on control dependency: [catch], data = [none] } }
public class class_name { private HelpBlock findHelpBlock(Widget widget) { if (widget instanceof HelpBlock) { return (HelpBlock) widget; } // Try and find the HelpBlock in the children of the given widget. if (widget instanceof HasWidgets) { for (Widget w : (HasWidgets) widget) { if (w instanceof HelpBlock) { return (HelpBlock) w; } } } if (!(widget instanceof HasValidationState)) { // Try and find the HelpBlock in the parent of widget. return findHelpBlock(widget.getParent()); } return null; } }
public class class_name { private HelpBlock findHelpBlock(Widget widget) { if (widget instanceof HelpBlock) { return (HelpBlock) widget; } // depends on control dependency: [if], data = [none] // Try and find the HelpBlock in the children of the given widget. if (widget instanceof HasWidgets) { for (Widget w : (HasWidgets) widget) { if (w instanceof HelpBlock) { return (HelpBlock) w; } // depends on control dependency: [if], data = [none] } } if (!(widget instanceof HasValidationState)) { // Try and find the HelpBlock in the parent of widget. return findHelpBlock(widget.getParent()); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public static final AAFCon<?> obtain(Object servletRequest) { if(servletRequest instanceof CadiWrap) { Lur lur = ((CadiWrap)servletRequest).getLur(); if(lur != null) { if(lur instanceof EpiLur) { AbsAAFLur<?> aal = (AbsAAFLur<?>) ((EpiLur)lur).subLur(AbsAAFLur.class); if(aal!=null) { return aal.aaf; } } else { if(lur instanceof AbsAAFLur) { return ((AbsAAFLur<?>)lur).aaf; } } } } return null; } }
public class class_name { public static final AAFCon<?> obtain(Object servletRequest) { if(servletRequest instanceof CadiWrap) { Lur lur = ((CadiWrap)servletRequest).getLur(); if(lur != null) { if(lur instanceof EpiLur) { AbsAAFLur<?> aal = (AbsAAFLur<?>) ((EpiLur)lur).subLur(AbsAAFLur.class); if(aal!=null) { return aal.aaf; // depends on control dependency: [if], data = [none] } } else { if(lur instanceof AbsAAFLur) { return ((AbsAAFLur<?>)lur).aaf; // depends on control dependency: [if], data = [none] } } } } return null; } }
public class class_name { public void addDeploymentSpecificPersistenceProvider(PersistenceProvider persistenceProvider, Set<ClassLoader> deploymentClassLoaders) { synchronized(persistenceProviderPerClassLoader) { for (ClassLoader deploymentClassLoader: deploymentClassLoaders) { List<Class<? extends PersistenceProvider>> list = persistenceProviderPerClassLoader.get(deploymentClassLoader); ROOT_LOGGER.tracef("getting persistence provider list (%s) for deployment (%s)", list, deploymentClassLoader ); if (list == null) { list = new ArrayList<>(); persistenceProviderPerClassLoader.put(deploymentClassLoader, list); ROOT_LOGGER.tracef("saving new persistence provider list (%s) for deployment (%s)", list, deploymentClassLoader ); } list.add(persistenceProvider.getClass()); ROOT_LOGGER.tracef("added new persistence provider (%s) to provider list (%s)", persistenceProvider.getClass().getName(), list); } } } }
public class class_name { public void addDeploymentSpecificPersistenceProvider(PersistenceProvider persistenceProvider, Set<ClassLoader> deploymentClassLoaders) { synchronized(persistenceProviderPerClassLoader) { for (ClassLoader deploymentClassLoader: deploymentClassLoaders) { List<Class<? extends PersistenceProvider>> list = persistenceProviderPerClassLoader.get(deploymentClassLoader); ROOT_LOGGER.tracef("getting persistence provider list (%s) for deployment (%s)", list, deploymentClassLoader ); // depends on control dependency: [for], data = [deploymentClassLoader] if (list == null) { list = new ArrayList<>(); // depends on control dependency: [if], data = [none] persistenceProviderPerClassLoader.put(deploymentClassLoader, list); // depends on control dependency: [if], data = [none] ROOT_LOGGER.tracef("saving new persistence provider list (%s) for deployment (%s)", list, deploymentClassLoader ); // depends on control dependency: [if], data = [none] } list.add(persistenceProvider.getClass()); // depends on control dependency: [for], data = [none] ROOT_LOGGER.tracef("added new persistence provider (%s) to provider list (%s)", persistenceProvider.getClass().getName(), list); // depends on control dependency: [for], data = [none] } } } }
public class class_name { @Override public Enumeration<URL> getResources(final String name) throws IOException { final ArrayList<Enumeration<URL>> foundResources = new ArrayList<Enumeration<URL>>(); foundResources.add(delegate.getResources(name)); if (parent != null) { foundResources.add(parent.getResources(name)); } return new Enumeration<URL>() { private int position = foundResources.size() - 1; public boolean hasMoreElements() { while (position >= 0) { if (foundResources.get(position).hasMoreElements()) { return true; } position--; } return false; } public URL nextElement() { while (position >= 0) { try { return (foundResources.get(position)).nextElement(); } catch (NoSuchElementException e) { } position--; } throw new NoSuchElementException(); } }; } }
public class class_name { @Override public Enumeration<URL> getResources(final String name) throws IOException { final ArrayList<Enumeration<URL>> foundResources = new ArrayList<Enumeration<URL>>(); foundResources.add(delegate.getResources(name)); if (parent != null) { foundResources.add(parent.getResources(name)); } return new Enumeration<URL>() { private int position = foundResources.size() - 1; public boolean hasMoreElements() { while (position >= 0) { if (foundResources.get(position).hasMoreElements()) { return true; // depends on control dependency: [if], data = [none] } position--; // depends on control dependency: [while], data = [none] } return false; } public URL nextElement() { while (position >= 0) { try { return (foundResources.get(position)).nextElement(); // depends on control dependency: [try], data = [none] } catch (NoSuchElementException e) { } // depends on control dependency: [catch], data = [none] position--; // depends on control dependency: [while], data = [none] } throw new NoSuchElementException(); } }; } }
public class class_name { private static String getHistoryFileUrl(RetireJobInfo info) { String historyFile = info.getHistoryFile(); String historyFileUrl = null; if (historyFile != null && !historyFile.equals("")) { try { historyFileUrl = URLEncoder.encode(info.getHistoryFile(), "UTF-8"); } catch (UnsupportedEncodingException e) { LOG.warn("Can't create history url ", e); } } return historyFileUrl; } }
public class class_name { private static String getHistoryFileUrl(RetireJobInfo info) { String historyFile = info.getHistoryFile(); String historyFileUrl = null; if (historyFile != null && !historyFile.equals("")) { try { historyFileUrl = URLEncoder.encode(info.getHistoryFile(), "UTF-8"); // depends on control dependency: [try], data = [none] } catch (UnsupportedEncodingException e) { LOG.warn("Can't create history url ", e); } // depends on control dependency: [catch], data = [none] } return historyFileUrl; } }
public class class_name { protected synchronized long seekUnusedZero(Long bucketId, Aggressiveness aggressiveness) { AtomicLong freeSpace = new AtomicLong(0); int totalElements = (int) memoryHandler.getAllocatedHostObjects(bucketId); // these 2 variables will contain jvm-wise memory access frequencies float shortAverage = zeroShort.getAverage(); float longAverage = zeroLong.getAverage(); // threshold is calculated based on agressiveness specified via configuration float shortThreshold = shortAverage / (Aggressiveness.values().length - aggressiveness.ordinal()); float longThreshold = longAverage / (Aggressiveness.values().length - aggressiveness.ordinal()); // simple counter for dereferenced objects AtomicInteger elementsDropped = new AtomicInteger(0); AtomicInteger elementsSurvived = new AtomicInteger(0); for (Long object : memoryHandler.getHostTrackingPoints(bucketId)) { AllocationPoint point = getAllocationPoint(object); // point can be null, if memory was promoted to device and was deleted there if (point == null) continue; if (point.getAllocationStatus() == AllocationStatus.HOST) { //point.getAccessState().isToeAvailable() //point.getAccessState().requestToe(); /* Check if memory points to non-existant buffer, using externals. If externals don't have specified buffer - delete reference. */ if (point.getBuffer() == null) { purgeZeroObject(bucketId, object, point, false); freeSpace.addAndGet(AllocationUtils.getRequiredMemory(point.getShape())); elementsDropped.incrementAndGet(); continue; } else { elementsSurvived.incrementAndGet(); } //point.getAccessState().releaseToe(); } else { // log.warn("SKIPPING :("); } } //log.debug("Short average: ["+shortAverage+"], Long average: [" + longAverage + "]"); //log.debug("Aggressiveness: ["+ aggressiveness+"]; Short threshold: ["+shortThreshold+"]; Long threshold: [" + longThreshold + "]"); log.debug("Zero {} elements checked: [{}], deleted: {}, survived: {}", bucketId, totalElements, elementsDropped.get(), elementsSurvived.get()); return freeSpace.get(); } }
public class class_name { protected synchronized long seekUnusedZero(Long bucketId, Aggressiveness aggressiveness) { AtomicLong freeSpace = new AtomicLong(0); int totalElements = (int) memoryHandler.getAllocatedHostObjects(bucketId); // these 2 variables will contain jvm-wise memory access frequencies float shortAverage = zeroShort.getAverage(); float longAverage = zeroLong.getAverage(); // threshold is calculated based on agressiveness specified via configuration float shortThreshold = shortAverage / (Aggressiveness.values().length - aggressiveness.ordinal()); float longThreshold = longAverage / (Aggressiveness.values().length - aggressiveness.ordinal()); // simple counter for dereferenced objects AtomicInteger elementsDropped = new AtomicInteger(0); AtomicInteger elementsSurvived = new AtomicInteger(0); for (Long object : memoryHandler.getHostTrackingPoints(bucketId)) { AllocationPoint point = getAllocationPoint(object); // point can be null, if memory was promoted to device and was deleted there if (point == null) continue; if (point.getAllocationStatus() == AllocationStatus.HOST) { //point.getAccessState().isToeAvailable() //point.getAccessState().requestToe(); /* Check if memory points to non-existant buffer, using externals. If externals don't have specified buffer - delete reference. */ if (point.getBuffer() == null) { purgeZeroObject(bucketId, object, point, false); // depends on control dependency: [if], data = [none] freeSpace.addAndGet(AllocationUtils.getRequiredMemory(point.getShape())); // depends on control dependency: [if], data = [none] elementsDropped.incrementAndGet(); // depends on control dependency: [if], data = [none] continue; } else { elementsSurvived.incrementAndGet(); // depends on control dependency: [if], data = [none] } //point.getAccessState().releaseToe(); } else { // log.warn("SKIPPING :("); } } //log.debug("Short average: ["+shortAverage+"], Long average: [" + longAverage + "]"); //log.debug("Aggressiveness: ["+ aggressiveness+"]; Short threshold: ["+shortThreshold+"]; Long threshold: [" + longThreshold + "]"); log.debug("Zero {} elements checked: [{}], deleted: {}, survived: {}", bucketId, totalElements, elementsDropped.get(), elementsSurvived.get()); return freeSpace.get(); } }
public class class_name { public static List<InetSocketAddress> getRPCAddresses(String suffix, Configuration conf, Collection<String> serviceIds, String... keys) throws IOException { // Use default address as fall back String defaultAddress = null; try { defaultAddress = conf.get(FileSystem.FS_DEFAULT_NAME_KEY + suffix); if (defaultAddress != null) { defaultAddress = NameNode.getDefaultAddress(conf); } } catch (IllegalArgumentException e) { defaultAddress = null; } for (int i = 0; i < keys.length; i++) { keys[i] += suffix; } List<InetSocketAddress> addressList = DFSUtil.getAddresses(conf, serviceIds, defaultAddress, keys); if (addressList == null) { String keyStr = ""; for (String key: keys) { keyStr += key + " "; } throw new IOException("Incorrect configuration: namenode address " + keyStr + " is not configured."); } return addressList; } }
public class class_name { public static List<InetSocketAddress> getRPCAddresses(String suffix, Configuration conf, Collection<String> serviceIds, String... keys) throws IOException { // Use default address as fall back String defaultAddress = null; try { defaultAddress = conf.get(FileSystem.FS_DEFAULT_NAME_KEY + suffix); if (defaultAddress != null) { defaultAddress = NameNode.getDefaultAddress(conf); } } catch (IllegalArgumentException e) { defaultAddress = null; } for (int i = 0; i < keys.length; i++) { keys[i] += suffix; } List<InetSocketAddress> addressList = DFSUtil.getAddresses(conf, serviceIds, defaultAddress, keys); if (addressList == null) { String keyStr = ""; for (String key: keys) { keyStr += key + " "; // depends on control dependency: [for], data = [key] } throw new IOException("Incorrect configuration: namenode address " + keyStr + " is not configured."); } return addressList; } }
public class class_name { public void downloadAndUnzip() { URL dataURL = null; String fileName = folder + "/" + url.substring(url.lastIndexOf("/") + 1); File compressedData = new File(fileName); if (!new File(fileName).exists()) { try { dataURL = new URL(url); } catch (MalformedURLException e) { e.printStackTrace(); } try { assert dataURL != null; FileUtils.copyURLToFile(dataURL, compressedData); } catch (IOException e) { e.printStackTrace(); } } try { ZipFile zipFile = new ZipFile(compressedData); File dataFolder = new File(folder); zipFile.extractAll(dataFolder.getCanonicalPath()); } catch (ZipException | IOException e) { e.printStackTrace(); } } }
public class class_name { public void downloadAndUnzip() { URL dataURL = null; String fileName = folder + "/" + url.substring(url.lastIndexOf("/") + 1); File compressedData = new File(fileName); if (!new File(fileName).exists()) { try { dataURL = new URL(url); // depends on control dependency: [try], data = [none] } catch (MalformedURLException e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none] try { assert dataURL != null; FileUtils.copyURLToFile(dataURL, compressedData); // depends on control dependency: [try], data = [none] } catch (IOException e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none] } try { ZipFile zipFile = new ZipFile(compressedData); File dataFolder = new File(folder); zipFile.extractAll(dataFolder.getCanonicalPath()); // depends on control dependency: [try], data = [none] } catch (ZipException | IOException e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected Object actuallyEvaluate(String exp, Map<String, ? extends Object> contextMap, LaContainer container, String firstName, Object firstComponent) { final ScriptEngine engine = prepareScriptEngineManager().getEngineByName("javascript"); if (firstName != null) { engine.put(firstName, firstComponent); } try { return engine.eval(exp); } catch (ScriptException | RuntimeException e) { throwJavaScriptExpressionException(exp, contextMap, container, e); return null; // unreachable } } }
public class class_name { protected Object actuallyEvaluate(String exp, Map<String, ? extends Object> contextMap, LaContainer container, String firstName, Object firstComponent) { final ScriptEngine engine = prepareScriptEngineManager().getEngineByName("javascript"); if (firstName != null) { engine.put(firstName, firstComponent); // depends on control dependency: [if], data = [(firstName] } try { return engine.eval(exp); // depends on control dependency: [try], data = [none] } catch (ScriptException | RuntimeException e) { throwJavaScriptExpressionException(exp, contextMap, container, e); return null; // unreachable } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void update(CollisionCategory category) { final CollisionResult result = results.get(category.getName()); if (result != null && (result.getX() != null || result.getY() != null) && Boolean.TRUE.equals(enabledAxis.get(category.getAxis()))) { onCollided(result, category); } } }
public class class_name { private void update(CollisionCategory category) { final CollisionResult result = results.get(category.getName()); if (result != null && (result.getX() != null || result.getY() != null) && Boolean.TRUE.equals(enabledAxis.get(category.getAxis()))) { onCollided(result, category); // depends on control dependency: [if], data = [(result] } } }
public class class_name { @Override public boolean contains(String policyName) throws PolicyStoreException { // search for policy - active and inactive String pid = this.getPID(policyName); ObjectProfile objectProfile = null; try { objectProfile = this.apiAService.getObjectProfile(getContext(), pid, null); } catch (ObjectNotInLowlevelStorageException e) { } catch (ServerException e) { throw new PolicyStoreException("Add: error getting object profile for " + pid + " - " + e.getMessage(), e); } if (objectProfile == null) { // no object found return false; } else { if (objectProfile.objectState.equals("A") || objectProfile.objectState.equals("I")) { // active or inactive object found - policy exists return true; } else { // deleted object - policy does not exist return false; } } } }
public class class_name { @Override public boolean contains(String policyName) throws PolicyStoreException { // search for policy - active and inactive String pid = this.getPID(policyName); ObjectProfile objectProfile = null; try { objectProfile = this.apiAService.getObjectProfile(getContext(), pid, null); } catch (ObjectNotInLowlevelStorageException e) { } catch (ServerException e) { throw new PolicyStoreException("Add: error getting object profile for " + pid + " - " + e.getMessage(), e); } if (objectProfile == null) { // no object found return false; } else { if (objectProfile.objectState.equals("A") || objectProfile.objectState.equals("I")) { // active or inactive object found - policy exists return true; // depends on control dependency: [if], data = [none] } else { // deleted object - policy does not exist return false; // depends on control dependency: [if], data = [none] } } } }
public class class_name { protected static DefaultProcessDiagramCanvas.SHAPE_TYPE getShapeType(BaseElement baseElement) { if (baseElement instanceof Task || baseElement instanceof Activity || baseElement instanceof TextAnnotation) { return DefaultProcessDiagramCanvas.SHAPE_TYPE.Rectangle; } else if (baseElement instanceof Gateway) { return DefaultProcessDiagramCanvas.SHAPE_TYPE.Rhombus; } else if (baseElement instanceof Event) { return DefaultProcessDiagramCanvas.SHAPE_TYPE.Ellipse; } // unknown source element, just do not correct coordinates return null; } }
public class class_name { protected static DefaultProcessDiagramCanvas.SHAPE_TYPE getShapeType(BaseElement baseElement) { if (baseElement instanceof Task || baseElement instanceof Activity || baseElement instanceof TextAnnotation) { return DefaultProcessDiagramCanvas.SHAPE_TYPE.Rectangle; // depends on control dependency: [if], data = [none] } else if (baseElement instanceof Gateway) { return DefaultProcessDiagramCanvas.SHAPE_TYPE.Rhombus; // depends on control dependency: [if], data = [none] } else if (baseElement instanceof Event) { return DefaultProcessDiagramCanvas.SHAPE_TYPE.Ellipse; // depends on control dependency: [if], data = [none] } // unknown source element, just do not correct coordinates return null; } }
public class class_name { public void deployAll() throws MojoExecutionException { stager.stage(); ImmutableList.Builder<Path> computedDeployables = ImmutableList.builder(); // Look for app.yaml Path appYaml = deployMojo.getStagingDirectory().resolve("app.yaml"); if (!Files.exists(appYaml)) { throw new MojoExecutionException("Failed to deploy all: could not find app.yaml."); } deployMojo.getLog().info("deployAll: Preparing to deploy app.yaml"); computedDeployables.add(appYaml); // Look for config yamls String[] configYamls = {"cron.yaml", "dispatch.yaml", "dos.yaml", "index.yaml", "queue.yaml"}; for (String yamlName : configYamls) { Path yaml = appengineDirectory.resolve(yamlName); if (Files.exists(yaml)) { deployMojo.getLog().info("deployAll: Preparing to deploy " + yamlName); computedDeployables.add(yaml); } } DeployConfiguration config = configBuilder.buildDeployConfiguration(computedDeployables.build()); try { deployMojo.getAppEngineFactory().deployment().deploy(config); } catch (AppEngineException ex) { throw new MojoExecutionException("Failed to deploy", ex); } } }
public class class_name { public void deployAll() throws MojoExecutionException { stager.stage(); ImmutableList.Builder<Path> computedDeployables = ImmutableList.builder(); // Look for app.yaml Path appYaml = deployMojo.getStagingDirectory().resolve("app.yaml"); if (!Files.exists(appYaml)) { throw new MojoExecutionException("Failed to deploy all: could not find app.yaml."); } deployMojo.getLog().info("deployAll: Preparing to deploy app.yaml"); computedDeployables.add(appYaml); // Look for config yamls String[] configYamls = {"cron.yaml", "dispatch.yaml", "dos.yaml", "index.yaml", "queue.yaml"}; for (String yamlName : configYamls) { Path yaml = appengineDirectory.resolve(yamlName); if (Files.exists(yaml)) { deployMojo.getLog().info("deployAll: Preparing to deploy " + yamlName); // depends on control dependency: [if], data = [none] computedDeployables.add(yaml); // depends on control dependency: [if], data = [none] } } DeployConfiguration config = configBuilder.buildDeployConfiguration(computedDeployables.build()); try { deployMojo.getAppEngineFactory().deployment().deploy(config); } catch (AppEngineException ex) { throw new MojoExecutionException("Failed to deploy", ex); } } }
public class class_name { public Object execute(final Map<Object, Object> iArgs) { if (className == null) { throw new OCommandExecutionException("Cannot execute the command because it has not been parsed yet"); } final ODatabaseDocument database = getDatabase(); if (ifExists && !database.getMetadata().getSchema().existsClass(className)) { return true; } final OClass cls = database.getMetadata().getSchema().getClass(className); if (cls == null) { return null; } final long records = cls.count(true); if (records > 0 && !unsafe) { // NOT EMPTY, CHECK IF CLASS IS OF VERTEX OR EDGES if (cls.isSubClassOf("V")) { // FOUND VERTEX CLASS throw new OCommandExecutionException("'DROP CLASS' command cannot drop class '" + className + "' because it contains Vertices. Use 'DELETE VERTEX' command first to avoid broken edges in a database, or apply the 'UNSAFE' keyword to force it"); } else if (cls.isSubClassOf("E")) { // FOUND EDGE CLASS throw new OCommandExecutionException("'DROP CLASS' command cannot drop class '" + className + "' because it contains Edges. Use 'DELETE EDGE' command first to avoid broken vertices in a database, or apply the 'UNSAFE' keyword to force it"); } } database.getMetadata().getSchema().dropClass(className); if (records > 0 && unsafe) { // NOT EMPTY, CHECK IF CLASS IS OF VERTEX OR EDGES if (cls.isSubClassOf("V")) { // FOUND VERTICES if (unsafe) OLogManager.instance().warn(this, "Dropped class '%s' containing %d vertices using UNSAFE mode. Database could contain broken edges", className, records); } else if (cls.isSubClassOf("E")) { // FOUND EDGES OLogManager.instance().warn(this, "Dropped class '%s' containing %d edges using UNSAFE mode. Database could contain broken vertices", className, records); } } return true; } }
public class class_name { public Object execute(final Map<Object, Object> iArgs) { if (className == null) { throw new OCommandExecutionException("Cannot execute the command because it has not been parsed yet"); } final ODatabaseDocument database = getDatabase(); if (ifExists && !database.getMetadata().getSchema().existsClass(className)) { return true; // depends on control dependency: [if], data = [none] } final OClass cls = database.getMetadata().getSchema().getClass(className); if (cls == null) { return null; // depends on control dependency: [if], data = [none] } final long records = cls.count(true); if (records > 0 && !unsafe) { // NOT EMPTY, CHECK IF CLASS IS OF VERTEX OR EDGES if (cls.isSubClassOf("V")) { // FOUND VERTEX CLASS throw new OCommandExecutionException("'DROP CLASS' command cannot drop class '" + className + "' because it contains Vertices. Use 'DELETE VERTEX' command first to avoid broken edges in a database, or apply the 'UNSAFE' keyword to force it"); } else if (cls.isSubClassOf("E")) { // FOUND EDGE CLASS throw new OCommandExecutionException("'DROP CLASS' command cannot drop class '" + className + "' because it contains Edges. Use 'DELETE EDGE' command first to avoid broken vertices in a database, or apply the 'UNSAFE' keyword to force it"); } } database.getMetadata().getSchema().dropClass(className); if (records > 0 && unsafe) { // NOT EMPTY, CHECK IF CLASS IS OF VERTEX OR EDGES if (cls.isSubClassOf("V")) { // FOUND VERTICES if (unsafe) OLogManager.instance().warn(this, "Dropped class '%s' containing %d vertices using UNSAFE mode. Database could contain broken edges", className, records); } else if (cls.isSubClassOf("E")) { // FOUND EDGES OLogManager.instance().warn(this, "Dropped class '%s' containing %d edges using UNSAFE mode. Database could contain broken vertices", className, records); } } return true; } }
public class class_name { private static Collection<Utterance> destructiveFilter(final MMOs root) { final Collection<Utterance> utterances = new ArrayList<>(); for (final MMO mmo : root.getMMO()) { for (final Utterance utterance : mmo.getUtterances().getUtterance()) { // clear candidates to save heaps of bytes for (final Phrase phrase : utterance.getPhrases().getPhrase()) { phrase.setCandidates(null); } utterances.add(utterance); } } return utterances; } }
public class class_name { private static Collection<Utterance> destructiveFilter(final MMOs root) { final Collection<Utterance> utterances = new ArrayList<>(); for (final MMO mmo : root.getMMO()) { for (final Utterance utterance : mmo.getUtterances().getUtterance()) { // clear candidates to save heaps of bytes for (final Phrase phrase : utterance.getPhrases().getPhrase()) { phrase.setCandidates(null); // depends on control dependency: [for], data = [phrase] } utterances.add(utterance); // depends on control dependency: [for], data = [utterance] } } return utterances; } }
public class class_name { public static int copyBuffer(OutputStream dst, ByteBuffer buffer) throws IOException { int remaining = buffer.remaining(); int copied = 0; if (remaining > 0) { if (buffer.hasArray()) { byte[] bufferArray = buffer.array(); int bufferArrayOffset = buffer.arrayOffset(); int bufferPosition = buffer.position(); dst.write(bufferArray, bufferArrayOffset + bufferPosition, remaining); buffer.position(bufferPosition + remaining); } else { byte[] bufferBytes = new byte[remaining]; buffer.get(bufferBytes); dst.write(bufferBytes); } copied = remaining; } return copied; } }
public class class_name { public static int copyBuffer(OutputStream dst, ByteBuffer buffer) throws IOException { int remaining = buffer.remaining(); int copied = 0; if (remaining > 0) { if (buffer.hasArray()) { byte[] bufferArray = buffer.array(); int bufferArrayOffset = buffer.arrayOffset(); int bufferPosition = buffer.position(); dst.write(bufferArray, bufferArrayOffset + bufferPosition, remaining); // depends on control dependency: [if], data = [none] buffer.position(bufferPosition + remaining); // depends on control dependency: [if], data = [none] } else { byte[] bufferBytes = new byte[remaining]; buffer.get(bufferBytes); // depends on control dependency: [if], data = [none] dst.write(bufferBytes); // depends on control dependency: [if], data = [none] } copied = remaining; } return copied; } }
public class class_name { private void initRequestFromRpcContext(CmsContainerPageRpcContext context) { if (context.getTemplateContext() != null) { getRequest().setAttribute( CmsTemplateContextManager.ATTR_RPC_CONTEXT_OVERRIDE, context.getTemplateContext()); } } }
public class class_name { private void initRequestFromRpcContext(CmsContainerPageRpcContext context) { if (context.getTemplateContext() != null) { getRequest().setAttribute( CmsTemplateContextManager.ATTR_RPC_CONTEXT_OVERRIDE, context.getTemplateContext()); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public void visit(PCM pcm) { for (Product product : pcm.getProducts()) { product.accept(this); } } }
public class class_name { @Override public void visit(PCM pcm) { for (Product product : pcm.getProducts()) { product.accept(this); // depends on control dependency: [for], data = [product] } } }
public class class_name { public synchronized boolean isJobPaused(final String jobName, final String groupName) throws SchedulerException { if (!ifJobExist(jobName, groupName)) { throw new SchedulerException(String.format("Job (job name %s, group name %s) doesn't " + "exist'", jobName, groupName)); } final JobKey jobKey = new JobKey(jobName, groupName); final JobDetail jobDetail = this.scheduler.getJobDetail(jobKey); final List<? extends Trigger> triggers = this.scheduler.getTriggersOfJob(jobDetail.getKey()); for (final Trigger trigger : triggers) { final TriggerState triggerState = this.scheduler.getTriggerState(trigger.getKey()); if (TriggerState.PAUSED.equals(triggerState)) { return true; } } return false; } }
public class class_name { public synchronized boolean isJobPaused(final String jobName, final String groupName) throws SchedulerException { if (!ifJobExist(jobName, groupName)) { throw new SchedulerException(String.format("Job (job name %s, group name %s) doesn't " + "exist'", jobName, groupName)); } final JobKey jobKey = new JobKey(jobName, groupName); final JobDetail jobDetail = this.scheduler.getJobDetail(jobKey); final List<? extends Trigger> triggers = this.scheduler.getTriggersOfJob(jobDetail.getKey()); for (final Trigger trigger : triggers) { final TriggerState triggerState = this.scheduler.getTriggerState(trigger.getKey()); if (TriggerState.PAUSED.equals(triggerState)) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { private String getProxyTicket(PortletRequest request) { final HttpServletRequest httpServletRequest = this.portalRequestUtils.getPortletHttpRequest(request); // try to determine the URL for our portlet String targetService = null; try { URL url = null; // if the server port is 80 or 443, don't include it in the URL int port = request.getServerPort(); if (port == 80 || port == 443) url = new URL( request.getScheme(), request.getServerName(), request.getContextPath()); else url = new URL( request.getScheme(), request.getServerName(), request.getServerPort(), request.getContextPath()); targetService = url.toString(); } catch (MalformedURLException e) { log.error("Failed to create a URL for the target portlet", e); e.printStackTrace(); return null; } // get the CasSecurityContext final IUserInstance userInstance = userInstanceManager.getUserInstance(httpServletRequest); final IPerson person = userInstance.getPerson(); final ISecurityContext context = person.getSecurityContext(); if (context == null) { log.error("no security context, no proxy ticket passed to the portlet"); return null; } ISecurityContext casContext = getCasContext(context); if (casContext == null) { log.debug("no CAS security context, no proxy ticket passed to the portlet"); return null; } if (!casContext.isAuthenticated()) { log.debug("no CAS authentication, no proxy ticket passed to the portlet"); return null; } // get a proxy ticket for our portlet from the CasSecurityContext String proxyTicket = null; try { proxyTicket = ((ICasSecurityContext) casContext).getCasServiceToken(targetService); log.debug("Put proxy ticket in userinfo: " + proxyTicket); } catch (CasProxyTicketAcquisitionException e) { log.error("no proxy ticket passed to the portlet: " + e); } return proxyTicket; } }
public class class_name { private String getProxyTicket(PortletRequest request) { final HttpServletRequest httpServletRequest = this.portalRequestUtils.getPortletHttpRequest(request); // try to determine the URL for our portlet String targetService = null; try { URL url = null; // if the server port is 80 or 443, don't include it in the URL int port = request.getServerPort(); if (port == 80 || port == 443) url = new URL( request.getScheme(), request.getServerName(), request.getContextPath()); else url = new URL( request.getScheme(), request.getServerName(), request.getServerPort(), request.getContextPath()); targetService = url.toString(); // depends on control dependency: [try], data = [none] } catch (MalformedURLException e) { log.error("Failed to create a URL for the target portlet", e); e.printStackTrace(); return null; } // depends on control dependency: [catch], data = [none] // get the CasSecurityContext final IUserInstance userInstance = userInstanceManager.getUserInstance(httpServletRequest); final IPerson person = userInstance.getPerson(); final ISecurityContext context = person.getSecurityContext(); if (context == null) { log.error("no security context, no proxy ticket passed to the portlet"); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } ISecurityContext casContext = getCasContext(context); if (casContext == null) { log.debug("no CAS security context, no proxy ticket passed to the portlet"); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } if (!casContext.isAuthenticated()) { log.debug("no CAS authentication, no proxy ticket passed to the portlet"); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } // get a proxy ticket for our portlet from the CasSecurityContext String proxyTicket = null; try { proxyTicket = ((ICasSecurityContext) casContext).getCasServiceToken(targetService); // depends on control dependency: [try], data = [none] log.debug("Put proxy ticket in userinfo: " + proxyTicket); // depends on control dependency: [try], data = [none] } catch (CasProxyTicketAcquisitionException e) { log.error("no proxy ticket passed to the portlet: " + e); } // depends on control dependency: [catch], data = [none] return proxyTicket; } }
public class class_name { protected synchronized String getWthFileName(Map data) { // String agmipFileHack = getValueOr(wthFile, "wst_name", ""); // if (agmipFileHack.length() == 8) { // return agmipFileHack; // } String ret = getObjectOr(data, "wst_id", ""); if (ret.equals("") || ret.length() > 8) { ret = wthHelper.createWthFileName(getObjectOr(data, "weather", data)); if (ret.equals("")) { ret = "AGMP"; } } return ret; } }
public class class_name { protected synchronized String getWthFileName(Map data) { // String agmipFileHack = getValueOr(wthFile, "wst_name", ""); // if (agmipFileHack.length() == 8) { // return agmipFileHack; // } String ret = getObjectOr(data, "wst_id", ""); if (ret.equals("") || ret.length() > 8) { ret = wthHelper.createWthFileName(getObjectOr(data, "weather", data)); // depends on control dependency: [if], data = [none] if (ret.equals("")) { ret = "AGMP"; // depends on control dependency: [if], data = [none] } } return ret; } }
public class class_name { private Set<String> getResourcePaths(List<JoinableResourceBundle> bundles) { Set<String> resourcePaths = new HashSet<>(); for (JoinableResourceBundle bundle : bundles) { for (BundlePath bundlePath : bundle.getItemPathList()) { resourcePaths.add(bundlePath.getPath()); } } return resourcePaths; } }
public class class_name { private Set<String> getResourcePaths(List<JoinableResourceBundle> bundles) { Set<String> resourcePaths = new HashSet<>(); for (JoinableResourceBundle bundle : bundles) { for (BundlePath bundlePath : bundle.getItemPathList()) { resourcePaths.add(bundlePath.getPath()); // depends on control dependency: [for], data = [bundlePath] } } return resourcePaths; } }
public class class_name { private void setChaining(Map<Integer, byte[]> hashes, List<Map<Integer, byte[]>> legacyHashes, Map<Integer, List<Tuple2<byte[], byte[]>>> chainedOperatorHashes) { for (Integer sourceNodeId : streamGraph.getSourceIDs()) { createChain(sourceNodeId, sourceNodeId, hashes, legacyHashes, 0, chainedOperatorHashes); } } }
public class class_name { private void setChaining(Map<Integer, byte[]> hashes, List<Map<Integer, byte[]>> legacyHashes, Map<Integer, List<Tuple2<byte[], byte[]>>> chainedOperatorHashes) { for (Integer sourceNodeId : streamGraph.getSourceIDs()) { createChain(sourceNodeId, sourceNodeId, hashes, legacyHashes, 0, chainedOperatorHashes); // depends on control dependency: [for], data = [sourceNodeId] } } }
public class class_name { public static File writeBytesToFile(byte[] data, File file) { try { validateFile(file); } catch (Exception e1) { e1.printStackTrace(); } FileOutputStream outputStream = null; try { outputStream = new FileOutputStream(file); outputStream.write(data); } catch (FileNotFoundException e) { e.printStackTrace(); LOGGER.error(e); } catch (IOException e) { e.printStackTrace(); LOGGER.error(e); } finally { if (outputStream != null) { try { outputStream.flush(); outputStream.close(); } catch (IOException e) { e.printStackTrace(); LOGGER.error(e); } } } return file; } }
public class class_name { public static File writeBytesToFile(byte[] data, File file) { try { validateFile(file); // depends on control dependency: [try], data = [none] } catch (Exception e1) { e1.printStackTrace(); } // depends on control dependency: [catch], data = [none] FileOutputStream outputStream = null; try { outputStream = new FileOutputStream(file); // depends on control dependency: [try], data = [none] outputStream.write(data); // depends on control dependency: [try], data = [none] } catch (FileNotFoundException e) { e.printStackTrace(); LOGGER.error(e); } catch (IOException e) { // depends on control dependency: [catch], data = [none] e.printStackTrace(); LOGGER.error(e); } finally { // depends on control dependency: [catch], data = [none] if (outputStream != null) { try { outputStream.flush(); // depends on control dependency: [try], data = [none] outputStream.close(); // depends on control dependency: [try], data = [none] } catch (IOException e) { e.printStackTrace(); LOGGER.error(e); } // depends on control dependency: [catch], data = [none] } } return file; } }
public class class_name { public static void addEntries(File zip, ZipEntrySource[] entries, File destZip) { if (log.isDebugEnabled()) { log.debug("Copying '" + zip + "' to '" + destZip + "' and adding " + Arrays.asList(entries) + "."); } OutputStream destOut = null; try { destOut = new BufferedOutputStream(new FileOutputStream(destZip)); addEntries(zip, entries, destOut); } catch (IOException e) { ZipExceptionUtil.rethrow(e); } finally { IOUtils.closeQuietly(destOut); } } }
public class class_name { public static void addEntries(File zip, ZipEntrySource[] entries, File destZip) { if (log.isDebugEnabled()) { log.debug("Copying '" + zip + "' to '" + destZip + "' and adding " + Arrays.asList(entries) + "."); // depends on control dependency: [if], data = [none] } OutputStream destOut = null; try { destOut = new BufferedOutputStream(new FileOutputStream(destZip)); // depends on control dependency: [try], data = [none] addEntries(zip, entries, destOut); // depends on control dependency: [try], data = [none] } catch (IOException e) { ZipExceptionUtil.rethrow(e); } // depends on control dependency: [catch], data = [none] finally { IOUtils.closeQuietly(destOut); } } }
public class class_name { public List<OneToOne<EmbeddableAttributes<T>>> getAllOneToOne() { List<OneToOne<EmbeddableAttributes<T>>> list = new ArrayList<OneToOne<EmbeddableAttributes<T>>>(); List<Node> nodeList = childNode.get("one-to-one"); for(Node node: nodeList) { OneToOne<EmbeddableAttributes<T>> type = new OneToOneImpl<EmbeddableAttributes<T>>(this, "one-to-one", childNode, node); list.add(type); } return list; } }
public class class_name { public List<OneToOne<EmbeddableAttributes<T>>> getAllOneToOne() { List<OneToOne<EmbeddableAttributes<T>>> list = new ArrayList<OneToOne<EmbeddableAttributes<T>>>(); List<Node> nodeList = childNode.get("one-to-one"); for(Node node: nodeList) { OneToOne<EmbeddableAttributes<T>> type = new OneToOneImpl<EmbeddableAttributes<T>>(this, "one-to-one", childNode, node); list.add(type); // depends on control dependency: [for], data = [none] } return list; } }
public class class_name { protected boolean exportRegion(Region<Object, Object> region) { if(region == null) return false; if(PartitionRegionHelper.isPartitionedRegion(region)) { region = PartitionRegionHelper.getLocalData(region); } Logger logger = LogManager.getLogger(getClass()); logger.info("Exporting region"+region.getName()); //get name String regionName = region.getName(); File resultFile = DataOpsSecretary.determineFile(ExportFileType.gfd, regionName); //delete previous logger.info("deleting file:"+resultFile.getAbsolutePath()); boolean wasDeleted = resultFile.delete(); logger.info("delete:"+wasDeleted); try { //write data RegionSnapshotService<?,?> regionSnapshotService = region.getSnapshotService(); SnapshotOptionsImpl<?,?> options = (SnapshotOptionsImpl<?,?>) regionSnapshotService.createOptions(); //setting parallelMode=true will cause only the local region data to export options.setParallelMode(true); regionSnapshotService.save(resultFile, SnapshotFormat.GEMFIRE); return true; } catch (RuntimeException e) { throw e; } catch(Exception e) { throw new FunctionException("Error exporting ERROR:"+ e.getMessage()+" "+Debugger.stackTrace(e)); } } }
public class class_name { protected boolean exportRegion(Region<Object, Object> region) { if(region == null) return false; if(PartitionRegionHelper.isPartitionedRegion(region)) { region = PartitionRegionHelper.getLocalData(region); // depends on control dependency: [if], data = [none] } Logger logger = LogManager.getLogger(getClass()); logger.info("Exporting region"+region.getName()); //get name String regionName = region.getName(); File resultFile = DataOpsSecretary.determineFile(ExportFileType.gfd, regionName); //delete previous logger.info("deleting file:"+resultFile.getAbsolutePath()); boolean wasDeleted = resultFile.delete(); logger.info("delete:"+wasDeleted); try { //write data RegionSnapshotService<?,?> regionSnapshotService = region.getSnapshotService(); SnapshotOptionsImpl<?,?> options = (SnapshotOptionsImpl<?,?>) regionSnapshotService.createOptions(); //setting parallelMode=true will cause only the local region data to export options.setParallelMode(true); // depends on control dependency: [try], data = [none] regionSnapshotService.save(resultFile, SnapshotFormat.GEMFIRE); // depends on control dependency: [try], data = [none] return true; // depends on control dependency: [try], data = [none] } catch (RuntimeException e) { throw e; } // depends on control dependency: [catch], data = [none] catch(Exception e) { throw new FunctionException("Error exporting ERROR:"+ e.getMessage()+" "+Debugger.stackTrace(e)); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void refreshObjectTile (MisoSceneMetrics metrics, TileManager mgr, Colorizer colorizer) { int tsid = TileUtil.getTileSetId(info.tileId); int tidx = TileUtil.getTileIndex(info.tileId); try { tile = (ObjectTile)mgr.getTile(tsid, tidx, colorizer); computeInfo(metrics); } catch (NoSuchTileSetException te) { log.warning("Scene contains non-existent object tileset [info=" + info + "]."); } } }
public class class_name { public void refreshObjectTile (MisoSceneMetrics metrics, TileManager mgr, Colorizer colorizer) { int tsid = TileUtil.getTileSetId(info.tileId); int tidx = TileUtil.getTileIndex(info.tileId); try { tile = (ObjectTile)mgr.getTile(tsid, tidx, colorizer); // depends on control dependency: [try], data = [none] computeInfo(metrics); // depends on control dependency: [try], data = [none] } catch (NoSuchTileSetException te) { log.warning("Scene contains non-existent object tileset [info=" + info + "]."); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public synchronized ProgressBar setValue(int value) { if(value < min) { value = min; } if(value > max) { value = max; } if(this.value != value) { this.value = value; invalidate(); } return this; } }
public class class_name { public synchronized ProgressBar setValue(int value) { if(value < min) { value = min; // depends on control dependency: [if], data = [none] } if(value > max) { value = max; // depends on control dependency: [if], data = [none] } if(this.value != value) { this.value = value; // depends on control dependency: [if], data = [none] invalidate(); // depends on control dependency: [if], data = [none] } return this; } }
public class class_name { @Override public boolean cancelNumber(PhoneNumber phoneNumberObj) { String phoneNumber = phoneNumberObj.getPhoneNumber(); String numberToRemoveFromVi = phoneNumber; if(numberToRemoveFromVi.startsWith("+1")){ numberToRemoveFromVi = numberToRemoveFromVi.replaceFirst("\\+1", ""); } phoneNumber = numberToRemoveFromVi; if (!isValidDid(phoneNumber)) return false; if (phoneNumber != null && !phoneNumber.isEmpty()) { final StringBuilder buffer = new StringBuilder(); buffer.append("<request id=\""+generateId()+"\">"); buffer.append(header); buffer.append("<body>"); buffer.append("<requesttype>").append("releaseDID").append("</requesttype>"); buffer.append("<item>"); buffer.append("<did>").append(phoneNumber).append("</did>"); buffer.append("</item>"); buffer.append("</body>"); buffer.append("</request>"); final String body = buffer.toString(); final HttpPost post = new HttpPost(uri); try { List<NameValuePair> parameters = new ArrayList<NameValuePair>(); parameters.add(new BasicNameValuePair("apidata", body)); post.setEntity(new UrlEncodedFormEntity(parameters)); final DefaultHttpClient client = new DefaultHttpClient(); if(telestaxProxyEnabled) { addTelestaxProxyHeaders(post, ProvisionProvider.REQUEST_TYPE.RELEASEDID.name()); } final HttpResponse response = client.execute(post); if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { final String content = StringUtils.toString(response.getEntity().getContent()); if (content.contains("<statuscode>100</statuscode>")) { return true; } } } catch (final Exception ignored) { } } return false; } }
public class class_name { @Override public boolean cancelNumber(PhoneNumber phoneNumberObj) { String phoneNumber = phoneNumberObj.getPhoneNumber(); String numberToRemoveFromVi = phoneNumber; if(numberToRemoveFromVi.startsWith("+1")){ numberToRemoveFromVi = numberToRemoveFromVi.replaceFirst("\\+1", ""); // depends on control dependency: [if], data = [none] } phoneNumber = numberToRemoveFromVi; if (!isValidDid(phoneNumber)) return false; if (phoneNumber != null && !phoneNumber.isEmpty()) { final StringBuilder buffer = new StringBuilder(); buffer.append("<request id=\""+generateId()+"\">"); // depends on control dependency: [if], data = [none] buffer.append(header); // depends on control dependency: [if], data = [none] buffer.append("<body>"); // depends on control dependency: [if], data = [none] buffer.append("<requesttype>").append("releaseDID").append("</requesttype>"); // depends on control dependency: [if], data = [none] buffer.append("<item>"); // depends on control dependency: [if], data = [none] buffer.append("<did>").append(phoneNumber).append("</did>"); // depends on control dependency: [if], data = [(phoneNumber] buffer.append("</item>"); // depends on control dependency: [if], data = [none] buffer.append("</body>"); // depends on control dependency: [if], data = [none] buffer.append("</request>"); // depends on control dependency: [if], data = [none] final String body = buffer.toString(); final HttpPost post = new HttpPost(uri); try { List<NameValuePair> parameters = new ArrayList<NameValuePair>(); parameters.add(new BasicNameValuePair("apidata", body)); // depends on control dependency: [try], data = [none] post.setEntity(new UrlEncodedFormEntity(parameters)); // depends on control dependency: [try], data = [none] final DefaultHttpClient client = new DefaultHttpClient(); if(telestaxProxyEnabled) { addTelestaxProxyHeaders(post, ProvisionProvider.REQUEST_TYPE.RELEASEDID.name()); // depends on control dependency: [if], data = [none] } final HttpResponse response = client.execute(post); if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { final String content = StringUtils.toString(response.getEntity().getContent()); if (content.contains("<statuscode>100</statuscode>")) { return true; // depends on control dependency: [if], data = [none] } } } catch (final Exception ignored) { } // depends on control dependency: [catch], data = [none] } return false; } }
public class class_name { public InvalidRequestException withRequiredParameters(String... requiredParameters) { if (this.requiredParameters == null) { setRequiredParameters(new java.util.ArrayList<String>(requiredParameters.length)); } for (String ele : requiredParameters) { this.requiredParameters.add(ele); } return this; } }
public class class_name { public InvalidRequestException withRequiredParameters(String... requiredParameters) { if (this.requiredParameters == null) { setRequiredParameters(new java.util.ArrayList<String>(requiredParameters.length)); // depends on control dependency: [if], data = [none] } for (String ele : requiredParameters) { this.requiredParameters.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public JavaFile generate() { MethodSpec privateConstructor = MethodSpec.constructorBuilder() .addModifiers(Modifier.PRIVATE) .build(); TypeSpec.Builder casesClassBuilder = TypeSpec.classBuilder(className) .addModifiers(Modifier.PUBLIC, Modifier.FINAL) .addMethod(privateConstructor) .addMethods(methods); for (String javadoc : javadocs) { casesClassBuilder.addJavadoc(javadoc); } TypeSpec casesClass = casesClassBuilder.build(); JavaFile.Builder javaFileBuilder = JavaFile.builder(packageName, casesClass); if (fileComment != null) { javaFileBuilder.addFileComment(fileComment); } javaFileBuilder.addFileComment("\nGenerated by Motif. Do Not Edit!\n"); JavaFile javaFile = javaFileBuilder.build(); return javaFile; } }
public class class_name { public JavaFile generate() { MethodSpec privateConstructor = MethodSpec.constructorBuilder() .addModifiers(Modifier.PRIVATE) .build(); TypeSpec.Builder casesClassBuilder = TypeSpec.classBuilder(className) .addModifiers(Modifier.PUBLIC, Modifier.FINAL) .addMethod(privateConstructor) .addMethods(methods); for (String javadoc : javadocs) { casesClassBuilder.addJavadoc(javadoc); // depends on control dependency: [for], data = [javadoc] } TypeSpec casesClass = casesClassBuilder.build(); JavaFile.Builder javaFileBuilder = JavaFile.builder(packageName, casesClass); if (fileComment != null) { javaFileBuilder.addFileComment(fileComment); // depends on control dependency: [if], data = [(fileComment] } javaFileBuilder.addFileComment("\nGenerated by Motif. Do Not Edit!\n"); JavaFile javaFile = javaFileBuilder.build(); return javaFile; } }
public class class_name { public void bootstrapTrust() throws MyProxyException { try { SSLContext sc = SSLContext.getInstance("SSL"); MyTrustManager myTrustManager = new MyTrustManager(); TrustManager[] trustAllCerts = new TrustManager[] { myTrustManager }; sc.init(null, trustAllCerts, new java.security.SecureRandom()); SSLSocketFactory sf = sc.getSocketFactory(); SSLSocket socket = (SSLSocket)sf.createSocket(this.host, this.port); socket.startHandshake(); socket.close(); X509Certificate[] acceptedIssuers = myTrustManager.getAcceptedIssuers(); if (acceptedIssuers == null) { throw new MyProxyException("Failed to determine MyProxy server trust roots in bootstrapTrust."); } for (int idx = 0; idx < acceptedIssuers.length; idx++) { File x509Dir = new File(org.globus.myproxy.MyProxy.getTrustRootPath()); if (!x509Dir.exists()) { StringBuffer newSubject = new StringBuffer(); String[] subjArr = acceptedIssuers[idx].getSubjectDN().getName().split(", "); for(int i = (subjArr.length - 1); i > -1; i--) { newSubject.append("/"); newSubject.append(subjArr[i]); } String subject = newSubject.toString(); File tmpDir = new File(getTrustRootPath() + "-" + System.currentTimeMillis()); if (tmpDir.mkdir() == true) { String hash = opensslHash(acceptedIssuers[idx]); String filename = tmpDir.getPath() + tmpDir.separator + hash + ".0"; FileOutputStream os = new FileOutputStream(new File(filename)); CertificateIOUtil.writeCertificate(os, acceptedIssuers[idx]); os.close(); if (logger.isDebugEnabled()) { logger.debug("wrote trusted certificate to " + filename); } filename = tmpDir.getPath() + tmpDir.separator + hash + ".signing_policy"; os = new FileOutputStream(new File(filename)); Writer wr = new OutputStreamWriter(os, Charset.forName("UTF-8")); wr.write("access_id_CA X509 '"); wr.write(subject); wr.write("'\npos_rights globus CA:sign\ncond_subjects globus \"*\"\n"); wr.flush(); wr.close(); os.close(); if (logger.isDebugEnabled()) { logger.debug("wrote trusted certificate policy to " + filename); } // success. commit the bootstrapped directory. if (tmpDir.renameTo(x509Dir) == true) { if (logger.isDebugEnabled()) { logger.debug("renamed " + tmpDir.getPath() + " to " + x509Dir.getPath()); } } else { throw new MyProxyException("Unable to rename " + tmpDir.getPath() + " to " + x509Dir.getPath()); } } else { throw new MyProxyException("Cannot create temporary directory: " + tmpDir.getName()); } } } } catch(Exception e) { throw new MyProxyException("MyProxy bootstrapTrust failed.", e); } } }
public class class_name { public void bootstrapTrust() throws MyProxyException { try { SSLContext sc = SSLContext.getInstance("SSL"); MyTrustManager myTrustManager = new MyTrustManager(); TrustManager[] trustAllCerts = new TrustManager[] { myTrustManager }; sc.init(null, trustAllCerts, new java.security.SecureRandom()); SSLSocketFactory sf = sc.getSocketFactory(); SSLSocket socket = (SSLSocket)sf.createSocket(this.host, this.port); socket.startHandshake(); socket.close(); X509Certificate[] acceptedIssuers = myTrustManager.getAcceptedIssuers(); if (acceptedIssuers == null) { throw new MyProxyException("Failed to determine MyProxy server trust roots in bootstrapTrust."); } for (int idx = 0; idx < acceptedIssuers.length; idx++) { File x509Dir = new File(org.globus.myproxy.MyProxy.getTrustRootPath()); if (!x509Dir.exists()) { StringBuffer newSubject = new StringBuffer(); String[] subjArr = acceptedIssuers[idx].getSubjectDN().getName().split(", "); for(int i = (subjArr.length - 1); i > -1; i--) { newSubject.append("/"); // depends on control dependency: [for], data = [none] newSubject.append(subjArr[i]); // depends on control dependency: [for], data = [i] } String subject = newSubject.toString(); File tmpDir = new File(getTrustRootPath() + "-" + System.currentTimeMillis()); if (tmpDir.mkdir() == true) { String hash = opensslHash(acceptedIssuers[idx]); String filename = tmpDir.getPath() + tmpDir.separator + hash + ".0"; FileOutputStream os = new FileOutputStream(new File(filename)); CertificateIOUtil.writeCertificate(os, acceptedIssuers[idx]); // depends on control dependency: [if], data = [none] os.close(); // depends on control dependency: [if], data = [none] if (logger.isDebugEnabled()) { logger.debug("wrote trusted certificate to " + filename); // depends on control dependency: [if], data = [none] } filename = tmpDir.getPath() + tmpDir.separator + hash + ".signing_policy"; // depends on control dependency: [if], data = [none] os = new FileOutputStream(new File(filename)); // depends on control dependency: [if], data = [none] Writer wr = new OutputStreamWriter(os, Charset.forName("UTF-8")); wr.write("access_id_CA X509 '"); // depends on control dependency: [if], data = [none] wr.write(subject); // depends on control dependency: [if], data = [none] wr.write("'\npos_rights globus CA:sign\ncond_subjects globus \"*\"\n"); // depends on control dependency: [if], data = [none] wr.flush(); // depends on control dependency: [if], data = [none] wr.close(); // depends on control dependency: [if], data = [none] os.close(); // depends on control dependency: [if], data = [none] if (logger.isDebugEnabled()) { logger.debug("wrote trusted certificate policy to " + filename); // depends on control dependency: [if], data = [none] } // success. commit the bootstrapped directory. if (tmpDir.renameTo(x509Dir) == true) { if (logger.isDebugEnabled()) { logger.debug("renamed " + tmpDir.getPath() + " to " + x509Dir.getPath()); // depends on control dependency: [if], data = [none] } } else { throw new MyProxyException("Unable to rename " + tmpDir.getPath() + " to " + x509Dir.getPath()); } } else { throw new MyProxyException("Cannot create temporary directory: " + tmpDir.getName()); } } } } catch(Exception e) { throw new MyProxyException("MyProxy bootstrapTrust failed.", e); } } }
public class class_name { public boolean startDoclet(RootDoc root) { configuration = configuration(); configuration.root = root; utils = configuration.utils; if (!isValidDoclet()) { return false; } try { startGeneration(root); } catch (Configuration.Fault f) { root.printError(f.getMessage()); return false; } catch (FatalError fe) { return false; } catch (DocletAbortException e) { e.printStackTrace(); Throwable cause = e.getCause(); if (cause != null) { if (cause.getLocalizedMessage() != null) { root.printError(cause.getLocalizedMessage()); } else { root.printError(cause.toString()); } } return false; } catch (Exception exc) { return false; } return true; } }
public class class_name { public boolean startDoclet(RootDoc root) { configuration = configuration(); configuration.root = root; utils = configuration.utils; if (!isValidDoclet()) { return false; // depends on control dependency: [if], data = [none] } try { startGeneration(root); // depends on control dependency: [try], data = [none] } catch (Configuration.Fault f) { root.printError(f.getMessage()); return false; } catch (FatalError fe) { // depends on control dependency: [catch], data = [none] return false; } catch (DocletAbortException e) { // depends on control dependency: [catch], data = [none] e.printStackTrace(); Throwable cause = e.getCause(); if (cause != null) { if (cause.getLocalizedMessage() != null) { root.printError(cause.getLocalizedMessage()); // depends on control dependency: [if], data = [(cause.getLocalizedMessage()] } else { root.printError(cause.toString()); // depends on control dependency: [if], data = [none] } } return false; } catch (Exception exc) { // depends on control dependency: [catch], data = [none] return false; } // depends on control dependency: [catch], data = [none] return true; } }
public class class_name { private Element writeCoordTransform(CoordinateTransform ct) { Element ctElem = new Element("coordTransform"); ctElem.setAttribute("name", ct.getName()); ctElem.setAttribute("transformType", ct.getTransformType().toString()); for (Parameter param : ct.getParameters()) { Element pElem = new Element("parameter"); pElem.setAttribute("name", param.getName()); pElem.setAttribute("value", param.getStringValue()); ctElem.addContent(pElem); } return ctElem; } }
public class class_name { private Element writeCoordTransform(CoordinateTransform ct) { Element ctElem = new Element("coordTransform"); ctElem.setAttribute("name", ct.getName()); ctElem.setAttribute("transformType", ct.getTransformType().toString()); for (Parameter param : ct.getParameters()) { Element pElem = new Element("parameter"); pElem.setAttribute("name", param.getName()); // depends on control dependency: [for], data = [param] pElem.setAttribute("value", param.getStringValue()); // depends on control dependency: [for], data = [param] ctElem.addContent(pElem); // depends on control dependency: [for], data = [none] } return ctElem; } }
public class class_name { public RestRouterConfiguration build() { if (this.enabled) { try { validate(); } catch (Exception e) { throw logger.configurationValidationError(e); } return new RestRouterConfiguration(ip, port); } return null; } }
public class class_name { public RestRouterConfiguration build() { if (this.enabled) { try { validate(); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw logger.configurationValidationError(e); } // depends on control dependency: [catch], data = [none] return new RestRouterConfiguration(ip, port); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { @SuppressWarnings("unchecked") public NumberExpression<T> max() { if (max == null) { max = Expressions.numberOperation(getType(), Ops.AggOps.MAX_AGG, mixin); } return max; } }
public class class_name { @SuppressWarnings("unchecked") public NumberExpression<T> max() { if (max == null) { max = Expressions.numberOperation(getType(), Ops.AggOps.MAX_AGG, mixin); // depends on control dependency: [if], data = [none] } return max; } }
public class class_name { public void createLayout(final Sbgn sbgn, boolean doLayout) { viewToLayout = new HashMap(); glyphToVNode = new HashMap(); idToGLyph = new HashMap(); idToCompartmentGlyphs = new HashMap(); portIDToOwnerGlyph = new HashMap(); layoutToView = new HashMap(); idToArcs = new HashMap<String, Arc>(); this.layout = new SbgnPDLayout(); final LGraphManager graphMgr = layout.getGraphManager(); graphMgr.addRoot(); root = new VCompound(new Glyph()); // Detect compartment glyphs and put them in a hashmap; // also set compartment glyphs of members of complexes. for (Glyph g: sbgn.getMap().getGlyph()) { if(glyphClazzOneOf(g, GlyphClazz.COMPARTMENT)) { idToCompartmentGlyphs.put(g.getId(), g); } //Set compartmentRef to all children of a Complex node. Glyph compartment = (Glyph)g.getCompartmentRef(); if(compartment != null && glyphClazzOneOf(g, GlyphClazz.COMPLEX)) { setCompartmentRefForComplexMembers(g, compartment, new HashSet<Glyph>()); } } // Nest glyphs inside compartment glyphs according to their compartmentRef. // This list holds the glyphs that will be deleted after corresponding glyph // is added to child glyph of another glyph. if(!idToCompartmentGlyphs.isEmpty()) { List<Glyph> deletedList = new ArrayList<Glyph>(); for (Glyph g : sbgn.getMap().getGlyph()) { Glyph containerCompartment = (Glyph) g.getCompartmentRef(); if (containerCompartment != null) { idToCompartmentGlyphs.get(containerCompartment.getId()).getGlyph().add(g); deletedList.add(g); } } // Delete the duplicate glyphs, after they are moved to corresponding compartment glyph. for (Glyph g : deletedList) { sbgn.getMap().getGlyph().remove(g); } } // initialize the map for keeping ports and their owner glyphs // with entries like: <portID, ownerGlyph> initPortIdToGlyphMap(sbgn.getMap().getGlyph()); //Remove ports from source and target field of ports //replace them with owner glyphs of these ports removePortsFromArcs(sbgn.getMap().getArc()); // Assign logical operator and Process nodes to compartment assignProcessAndLogicOpNodesToCompartment(sbgn); // Create Vnodes for ChiLay layout component createVNodes(root, sbgn.getMap().getGlyph()); for (VNode vNode: root.children) { createLNode(vNode, null); } // Create LEdges for ChiLay layout component createLEdges(sbgn.getMap().getArc()); // Apply layout if(doLayout) { layout.runLayout(); } graphMgr.updateBounds(); // Here if any SbgnProcessNode node is returned from SBGNPD Layout // this means that we will have two additional port info. We should // add this information to libSbgn objects for (Object lNode : layout.getAllNodes()) { if (lNode instanceof SbgnProcessNode) { //Set geometry of corresponding node VNode vNode = layoutToView.get(((SbgnProcessNode) lNode).label); Bbox tempBbox = vNode.glyph.getBbox(); tempBbox.setX((float) (((SbgnProcessNode) lNode).getLeft())); tempBbox.setY((float) (((SbgnProcessNode) lNode).getTop())); vNode.glyph.setBbox(tempBbox); //Created port objects in layout level SbgnPDNode inputLPort = ((SbgnProcessNode) lNode).getInputPort(); SbgnPDNode outputLPort = ((SbgnProcessNode) lNode).getOutputPort(); // New port objects Port inputPort = new Port(); Port outputPort = new Port(); // Set port attributes inputPort.setX((float) (inputLPort.getCenterX())); inputPort.setY((float) (inputLPort.getCenterY())); inputPort.setId(inputLPort.label); outputPort.setX((float) (outputLPort.getCenterX())); outputPort.setY((float) (outputLPort.getCenterY())); outputPort.setId((outputLPort.label)); //Clear existing ports ! vNode.glyph.getPort().clear(); //Connect existing arcs to newly created ports //These ports are created by ChiLay and SBGNPD Layout connectArcToPort(inputLPort, inputPort); connectArcToPort(outputLPort, outputPort); //Add ports to the corresponding glyph vNode.glyph.getPort().add(inputPort); vNode.glyph.getPort().add(outputPort); } } // Update the bounds for (VNode vNode: root.children) { updateCompoundBounds(vNode.glyph, vNode.glyph.getGlyph()); } // Clear inside of the compartmentGlyphs for (Glyph compGlyph: idToCompartmentGlyphs.values()) { //Again add the members of compartments for(Glyph memberGlyph: compGlyph.getGlyph() ) { sbgn.getMap().getGlyph().add(memberGlyph); } compGlyph.getGlyph().clear(); } } }
public class class_name { public void createLayout(final Sbgn sbgn, boolean doLayout) { viewToLayout = new HashMap(); glyphToVNode = new HashMap(); idToGLyph = new HashMap(); idToCompartmentGlyphs = new HashMap(); portIDToOwnerGlyph = new HashMap(); layoutToView = new HashMap(); idToArcs = new HashMap<String, Arc>(); this.layout = new SbgnPDLayout(); final LGraphManager graphMgr = layout.getGraphManager(); graphMgr.addRoot(); root = new VCompound(new Glyph()); // Detect compartment glyphs and put them in a hashmap; // also set compartment glyphs of members of complexes. for (Glyph g: sbgn.getMap().getGlyph()) { if(glyphClazzOneOf(g, GlyphClazz.COMPARTMENT)) { idToCompartmentGlyphs.put(g.getId(), g); // depends on control dependency: [if], data = [none] } //Set compartmentRef to all children of a Complex node. Glyph compartment = (Glyph)g.getCompartmentRef(); if(compartment != null && glyphClazzOneOf(g, GlyphClazz.COMPLEX)) { setCompartmentRefForComplexMembers(g, compartment, new HashSet<Glyph>()); // depends on control dependency: [if], data = [none] } } // Nest glyphs inside compartment glyphs according to their compartmentRef. // This list holds the glyphs that will be deleted after corresponding glyph // is added to child glyph of another glyph. if(!idToCompartmentGlyphs.isEmpty()) { List<Glyph> deletedList = new ArrayList<Glyph>(); for (Glyph g : sbgn.getMap().getGlyph()) { Glyph containerCompartment = (Glyph) g.getCompartmentRef(); if (containerCompartment != null) { idToCompartmentGlyphs.get(containerCompartment.getId()).getGlyph().add(g); // depends on control dependency: [if], data = [(containerCompartment] deletedList.add(g); // depends on control dependency: [if], data = [none] } } // Delete the duplicate glyphs, after they are moved to corresponding compartment glyph. for (Glyph g : deletedList) { sbgn.getMap().getGlyph().remove(g); // depends on control dependency: [for], data = [g] } } // initialize the map for keeping ports and their owner glyphs // with entries like: <portID, ownerGlyph> initPortIdToGlyphMap(sbgn.getMap().getGlyph()); //Remove ports from source and target field of ports //replace them with owner glyphs of these ports removePortsFromArcs(sbgn.getMap().getArc()); // Assign logical operator and Process nodes to compartment assignProcessAndLogicOpNodesToCompartment(sbgn); // Create Vnodes for ChiLay layout component createVNodes(root, sbgn.getMap().getGlyph()); for (VNode vNode: root.children) { createLNode(vNode, null); // depends on control dependency: [for], data = [vNode] } // Create LEdges for ChiLay layout component createLEdges(sbgn.getMap().getArc()); // Apply layout if(doLayout) { layout.runLayout(); // depends on control dependency: [if], data = [none] } graphMgr.updateBounds(); // Here if any SbgnProcessNode node is returned from SBGNPD Layout // this means that we will have two additional port info. We should // add this information to libSbgn objects for (Object lNode : layout.getAllNodes()) { if (lNode instanceof SbgnProcessNode) { //Set geometry of corresponding node VNode vNode = layoutToView.get(((SbgnProcessNode) lNode).label); Bbox tempBbox = vNode.glyph.getBbox(); tempBbox.setX((float) (((SbgnProcessNode) lNode).getLeft())); // depends on control dependency: [if], data = [none] tempBbox.setY((float) (((SbgnProcessNode) lNode).getTop())); // depends on control dependency: [if], data = [none] vNode.glyph.setBbox(tempBbox); // depends on control dependency: [if], data = [none] //Created port objects in layout level SbgnPDNode inputLPort = ((SbgnProcessNode) lNode).getInputPort(); SbgnPDNode outputLPort = ((SbgnProcessNode) lNode).getOutputPort(); // New port objects Port inputPort = new Port(); Port outputPort = new Port(); // Set port attributes inputPort.setX((float) (inputLPort.getCenterX())); // depends on control dependency: [if], data = [none] inputPort.setY((float) (inputLPort.getCenterY())); // depends on control dependency: [if], data = [none] inputPort.setId(inputLPort.label); // depends on control dependency: [if], data = [none] outputPort.setX((float) (outputLPort.getCenterX())); // depends on control dependency: [if], data = [none] outputPort.setY((float) (outputLPort.getCenterY())); // depends on control dependency: [if], data = [none] outputPort.setId((outputLPort.label)); // depends on control dependency: [if], data = [none] //Clear existing ports ! vNode.glyph.getPort().clear(); // depends on control dependency: [if], data = [none] //Connect existing arcs to newly created ports //These ports are created by ChiLay and SBGNPD Layout connectArcToPort(inputLPort, inputPort); // depends on control dependency: [if], data = [none] connectArcToPort(outputLPort, outputPort); // depends on control dependency: [if], data = [none] //Add ports to the corresponding glyph vNode.glyph.getPort().add(inputPort); // depends on control dependency: [if], data = [none] vNode.glyph.getPort().add(outputPort); // depends on control dependency: [if], data = [none] } } // Update the bounds for (VNode vNode: root.children) { updateCompoundBounds(vNode.glyph, vNode.glyph.getGlyph()); // depends on control dependency: [for], data = [vNode] } // Clear inside of the compartmentGlyphs for (Glyph compGlyph: idToCompartmentGlyphs.values()) { //Again add the members of compartments for(Glyph memberGlyph: compGlyph.getGlyph() ) { sbgn.getMap().getGlyph().add(memberGlyph); // depends on control dependency: [for], data = [memberGlyph] } compGlyph.getGlyph().clear(); // depends on control dependency: [for], data = [compGlyph] } } }
public class class_name { public void remove(final T node) { if ( this.firstNode == node ) { removeFirst(); } else if ( this.lastNode == node ) { removeLast(); } else { node.getPrevious().setNext( node.getNext() ); (node.getNext()).setPrevious( node.getPrevious() ); this.size--; node.setPrevious( null ); node.setNext( null ); } } }
public class class_name { public void remove(final T node) { if ( this.firstNode == node ) { removeFirst(); // depends on control dependency: [if], data = [none] } else if ( this.lastNode == node ) { removeLast(); // depends on control dependency: [if], data = [none] } else { node.getPrevious().setNext( node.getNext() ); // depends on control dependency: [if], data = [none] (node.getNext()).setPrevious( node.getPrevious() ); // depends on control dependency: [if], data = [none] this.size--; // depends on control dependency: [if], data = [none] node.setPrevious( null ); // depends on control dependency: [if], data = [none] node.setNext( null ); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static double div(final double v1,final double v2,int scale,int roundingMode){ if(scale<0){ scale=DIV_SCALE; } if(roundingMode<0){ roundingMode=ROUNDING_MODE; } BigDecimal b1 = new BigDecimal(Double.toString(v1)); BigDecimal b2 = new BigDecimal(Double.toString(v2)); return b1.divide(b2,scale,roundingMode).doubleValue(); } }
public class class_name { public static double div(final double v1,final double v2,int scale,int roundingMode){ if(scale<0){ scale=DIV_SCALE; // depends on control dependency: [if], data = [none] } if(roundingMode<0){ roundingMode=ROUNDING_MODE; // depends on control dependency: [if], data = [none] } BigDecimal b1 = new BigDecimal(Double.toString(v1)); BigDecimal b2 = new BigDecimal(Double.toString(v2)); return b1.divide(b2,scale,roundingMode).doubleValue(); } }
public class class_name { @Write(consumes = {}) public Object stop() { try { return message; } finally { Thread thread = new Thread(this::stopServer); thread.setContextClassLoader(getClass().getClassLoader()); thread.start(); } } }
public class class_name { @Write(consumes = {}) public Object stop() { try { return message; // depends on control dependency: [try], data = [none] } finally { Thread thread = new Thread(this::stopServer); thread.setContextClassLoader(getClass().getClassLoader()); thread.start(); } } }
public class class_name { public void applyFeatureTransaction(FeatureTransaction ft) { if (ft != null) { VectorLayer layer = ft.getLayer(); if (layer != null) { // clear all the tiles layer.getFeatureStore().clear(); } // now update/add the features if (ft.getNewFeatures() != null) { for (Feature feature : ft.getNewFeatures()) { ft.getLayer().getFeatureStore().addFeature(feature); } } // make it fetch the tiles mapView.translate(0, 0); handlerManager.fireEvent(new FeatureTransactionEvent(ft)); } } }
public class class_name { public void applyFeatureTransaction(FeatureTransaction ft) { if (ft != null) { VectorLayer layer = ft.getLayer(); if (layer != null) { // clear all the tiles layer.getFeatureStore().clear(); // depends on control dependency: [if], data = [none] } // now update/add the features if (ft.getNewFeatures() != null) { for (Feature feature : ft.getNewFeatures()) { ft.getLayer().getFeatureStore().addFeature(feature); // depends on control dependency: [for], data = [feature] } } // make it fetch the tiles mapView.translate(0, 0); // depends on control dependency: [if], data = [none] handlerManager.fireEvent(new FeatureTransactionEvent(ft)); // depends on control dependency: [if], data = [(ft] } } }
public class class_name { public DBObject toDBObject(final Object entity) { try { return mapper.toDBObject(entity); } catch (Exception e) { throw new MappingException("Could not map entity to DBObject", e); } } }
public class class_name { public DBObject toDBObject(final Object entity) { try { return mapper.toDBObject(entity); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new MappingException("Could not map entity to DBObject", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public Description matchMemberReference(MemberReferenceTree tree, VisitorState state) { if (!matchWithinClass) { return Description.NO_MATCH; } Symbol.MethodSymbol referencedMethod = ASTHelpers.getSymbol(tree); Symbol.MethodSymbol funcInterfaceSymbol = NullabilityUtil.getFunctionalInterfaceMethod(tree, state.getTypes()); handler.onMatchMethodReference(this, tree, state, referencedMethod); return checkOverriding(funcInterfaceSymbol, referencedMethod, tree, state); } }
public class class_name { @Override public Description matchMemberReference(MemberReferenceTree tree, VisitorState state) { if (!matchWithinClass) { return Description.NO_MATCH; // depends on control dependency: [if], data = [none] } Symbol.MethodSymbol referencedMethod = ASTHelpers.getSymbol(tree); Symbol.MethodSymbol funcInterfaceSymbol = NullabilityUtil.getFunctionalInterfaceMethod(tree, state.getTypes()); handler.onMatchMethodReference(this, tree, state, referencedMethod); return checkOverriding(funcInterfaceSymbol, referencedMethod, tree, state); } }
public class class_name { @Override public void doExecute(TestContext context) { try { Message receivedMessage; String selector = MessageSelectorBuilder.build(messageSelector, messageSelectorMap, context); //receive message either selected or plain with message receiver if (StringUtils.hasText(selector)) { receivedMessage = receiveSelected(context, selector); } else { receivedMessage = receive(context); } if (receivedMessage == null) { throw new CitrusRuntimeException("Failed to receive message - message is not available"); } //validate the message validateMessage(receivedMessage, context); } catch (IOException e) { throw new CitrusRuntimeException(e); } } }
public class class_name { @Override public void doExecute(TestContext context) { try { Message receivedMessage; String selector = MessageSelectorBuilder.build(messageSelector, messageSelectorMap, context); //receive message either selected or plain with message receiver if (StringUtils.hasText(selector)) { receivedMessage = receiveSelected(context, selector); // depends on control dependency: [if], data = [none] } else { receivedMessage = receive(context); // depends on control dependency: [if], data = [none] } if (receivedMessage == null) { throw new CitrusRuntimeException("Failed to receive message - message is not available"); } //validate the message validateMessage(receivedMessage, context); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new CitrusRuntimeException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static int cuModuleLoadDataEx (CUmodule phMod, Pointer p, int numOptions, int options[], Pointer optionValues) { // Although it should be possible to pass 'null' for these parameters // when numOptions==0, the driver crashes when they are 'null', so // they are replaced by non-null (but empty) arrays here. // Also see the corresponding notes in the native method. if (numOptions == 0) { if (options == null) { options = new int[0]; } if (optionValues == null) { optionValues = Pointer.to(new int[0]); } } return checkResult(cuModuleLoadDataExNative( phMod, p, numOptions, options, optionValues)); } }
public class class_name { public static int cuModuleLoadDataEx (CUmodule phMod, Pointer p, int numOptions, int options[], Pointer optionValues) { // Although it should be possible to pass 'null' for these parameters // when numOptions==0, the driver crashes when they are 'null', so // they are replaced by non-null (but empty) arrays here. // Also see the corresponding notes in the native method. if (numOptions == 0) { if (options == null) { options = new int[0]; // depends on control dependency: [if], data = [none] } if (optionValues == null) { optionValues = Pointer.to(new int[0]); // depends on control dependency: [if], data = [none] } } return checkResult(cuModuleLoadDataExNative( phMod, p, numOptions, options, optionValues)); } }
public class class_name { @JsOverlay public final void addJavaWatch(Function javaMethod, String watchedPropertyName, boolean isDeep, boolean isImmediate) { if (!isDeep && !isImmediate) { addWatch(watchedPropertyName, javaMethod); return; } JsPropertyMap<Object> watchDefinition = JsPropertyMap.of(); watchDefinition.set("handler", javaMethod); watchDefinition.set("deep", isDeep); watchDefinition.set("immediate", isImmediate); addWatch(watchedPropertyName, watchDefinition); } }
public class class_name { @JsOverlay public final void addJavaWatch(Function javaMethod, String watchedPropertyName, boolean isDeep, boolean isImmediate) { if (!isDeep && !isImmediate) { addWatch(watchedPropertyName, javaMethod); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } JsPropertyMap<Object> watchDefinition = JsPropertyMap.of(); watchDefinition.set("handler", javaMethod); watchDefinition.set("deep", isDeep); watchDefinition.set("immediate", isImmediate); addWatch(watchedPropertyName, watchDefinition); } }