code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { @Override public ResponseStubbing withBody(final InputStream is) { try { final byte[] responseBody; try { responseBody = IOUtils.toByteArray(is); } catch (final IOException e) { throw new JadlerException("A problem occurred while reading the given input stream", e); } return this.withBody(responseBody); } finally { IOUtils.closeQuietly(is); } } }
public class class_name { @Override public ResponseStubbing withBody(final InputStream is) { try { final byte[] responseBody; try { responseBody = IOUtils.toByteArray(is); // depends on control dependency: [try], data = [none] } catch (final IOException e) { throw new JadlerException("A problem occurred while reading the given input stream", e); } // depends on control dependency: [catch], data = [none] return this.withBody(responseBody); // depends on control dependency: [try], data = [none] } finally { IOUtils.closeQuietly(is); } } }
public class class_name { private static int[][] deepClone(int[][] array) { int[][] result = new int[array.length][]; for (int i = 0; i < result.length; i++) { result[i] = array[i].clone(); } return result; } }
public class class_name { private static int[][] deepClone(int[][] array) { int[][] result = new int[array.length][]; for (int i = 0; i < result.length; i++) { result[i] = array[i].clone(); // depends on control dependency: [for], data = [i] } return result; } }
public class class_name { public TaskReactivateOptions withOcpDate(DateTime ocpDate) { if (ocpDate == null) { this.ocpDate = null; } else { this.ocpDate = new DateTimeRfc1123(ocpDate); } return this; } }
public class class_name { public TaskReactivateOptions withOcpDate(DateTime ocpDate) { if (ocpDate == null) { this.ocpDate = null; // depends on control dependency: [if], data = [none] } else { this.ocpDate = new DateTimeRfc1123(ocpDate); // depends on control dependency: [if], data = [(ocpDate] } return this; } }
public class class_name { private static CSLItemData[] sanitizeItems(ItemDataProvider provider) { Set<String> knownIds = new LinkedHashSet<>(); //create a date parser which will be used to get the item's year CSLDateParser dateParser = new CSLDateParser(); //iterate through all items String[] ids = provider.getIds(); CSLItemData[] result = new CSLItemData[ids.length]; for (int i = 0; i < ids.length; ++i) { String id = ids[i]; CSLItemData item = provider.retrieveItem(id); //create a new ID String newId = makeId(item, dateParser); //make ID unique newId = uniquify(newId, knownIds); knownIds.add(newId); //copy item and replace ID item = new CSLItemDataBuilder(item).id(newId).build(); result[i] = item; } return result; } }
public class class_name { private static CSLItemData[] sanitizeItems(ItemDataProvider provider) { Set<String> knownIds = new LinkedHashSet<>(); //create a date parser which will be used to get the item's year CSLDateParser dateParser = new CSLDateParser(); //iterate through all items String[] ids = provider.getIds(); CSLItemData[] result = new CSLItemData[ids.length]; for (int i = 0; i < ids.length; ++i) { String id = ids[i]; CSLItemData item = provider.retrieveItem(id); //create a new ID String newId = makeId(item, dateParser); //make ID unique newId = uniquify(newId, knownIds); // depends on control dependency: [for], data = [none] knownIds.add(newId); // depends on control dependency: [for], data = [none] //copy item and replace ID item = new CSLItemDataBuilder(item).id(newId).build(); // depends on control dependency: [for], data = [none] result[i] = item; // depends on control dependency: [for], data = [i] } return result; } }
public class class_name { public static boolean setDockIcon(final Image icon) { try { final Class<?> clazz = Class.forName("com.apple.eawt.Application"); final Method am = clazz.getMethod("getApplication"); final Object app = am.invoke(null, new Object[0]); final Method si = clazz.getMethod("setDockIconImage", new Class[] { Image.class }); si.invoke(app, new Object[] { icon }); return true; } catch (Exception e) { e.printStackTrace(); } // end of catch return false; } }
public class class_name { public static boolean setDockIcon(final Image icon) { try { final Class<?> clazz = Class.forName("com.apple.eawt.Application"); final Method am = clazz.getMethod("getApplication"); final Object app = am.invoke(null, new Object[0]); final Method si = clazz.getMethod("setDockIconImage", new Class[] { Image.class }); si.invoke(app, new Object[] { icon }); // depends on control dependency: [try], data = [none] return true; // depends on control dependency: [try], data = [none] } catch (Exception e) { e.printStackTrace(); } // end of catch // depends on control dependency: [catch], data = [none] return false; } }
public class class_name { public Context attach() { Context prev = storage().doAttach(this); if (prev == null) { return ROOT; } return prev; } }
public class class_name { public Context attach() { Context prev = storage().doAttach(this); if (prev == null) { return ROOT; // depends on control dependency: [if], data = [none] } return prev; } }
public class class_name { public void previsit(Collection<? extends IRenderingElement> elements) { Deque<IRenderingElement> queue = new ArrayDeque<>(2 * elements.size()); queue.addAll(elements); FreqMap<Color> strokeFreq = new FreqMap<>(); FreqMap<Color> fillFreq = new FreqMap<>(); FreqMap<Double> strokeWidthFreq = new FreqMap<>(); while (!queue.isEmpty()) { IRenderingElement element = queue.poll(); // wrappers first if (element instanceof Bounds) { queue.add(((Bounds) element).root()); } else if (element instanceof MarkedElement) { queue.add(((MarkedElement) element).element()); } else if (element instanceof ElementGroup) { for (IRenderingElement child : (ElementGroup) element) queue.add(child); } else if (element instanceof LineElement) { strokeFreq.add(((LineElement) element).color); strokeWidthFreq.add(scaled(((LineElement) element).width)); } else if (element instanceof GeneralPath) { if (((GeneralPath) element).fill) fillFreq.add(((GeneralPath) element).color); } else { // ignored } } if (!defaultsWritten) { defaultFill = fillFreq.getMostFrequent(); defaultStroke = strokeFreq.getMostFrequent(); Double strokeWidth = strokeWidthFreq.getMostFrequent(); if (strokeWidth != null) defaultStrokeWidth = toStr(strokeWidth); } } }
public class class_name { public void previsit(Collection<? extends IRenderingElement> elements) { Deque<IRenderingElement> queue = new ArrayDeque<>(2 * elements.size()); queue.addAll(elements); FreqMap<Color> strokeFreq = new FreqMap<>(); FreqMap<Color> fillFreq = new FreqMap<>(); FreqMap<Double> strokeWidthFreq = new FreqMap<>(); while (!queue.isEmpty()) { IRenderingElement element = queue.poll(); // wrappers first if (element instanceof Bounds) { queue.add(((Bounds) element).root()); // depends on control dependency: [if], data = [none] } else if (element instanceof MarkedElement) { queue.add(((MarkedElement) element).element()); // depends on control dependency: [if], data = [none] } else if (element instanceof ElementGroup) { for (IRenderingElement child : (ElementGroup) element) queue.add(child); } else if (element instanceof LineElement) { strokeFreq.add(((LineElement) element).color); // depends on control dependency: [if], data = [none] strokeWidthFreq.add(scaled(((LineElement) element).width)); // depends on control dependency: [if], data = [none] } else if (element instanceof GeneralPath) { if (((GeneralPath) element).fill) fillFreq.add(((GeneralPath) element).color); } else { // ignored } } if (!defaultsWritten) { defaultFill = fillFreq.getMostFrequent(); // depends on control dependency: [if], data = [none] defaultStroke = strokeFreq.getMostFrequent(); // depends on control dependency: [if], data = [none] Double strokeWidth = strokeWidthFreq.getMostFrequent(); if (strokeWidth != null) defaultStrokeWidth = toStr(strokeWidth); } } }
public class class_name { public void choke() { if (!this.choking) { logger.trace("Choking {}", this); this.send(PeerMessage.ChokeMessage.craft()); this.choking = true; } } }
public class class_name { public void choke() { if (!this.choking) { logger.trace("Choking {}", this); // depends on control dependency: [if], data = [none] this.send(PeerMessage.ChokeMessage.craft()); // depends on control dependency: [if], data = [none] this.choking = true; // depends on control dependency: [if], data = [none] } } }
public class class_name { private Map<String, ProvisioningFeatureDefinition> getUsrProductFeatureDefinitions() { Map<String, ProvisioningFeatureDefinition> features = null; File userDir = Utils.getUserDir(); if (userDir != null && userDir.exists()) { File userFeatureDir = new File(userDir, USER_FEATURE_DIR); if (userFeatureDir.exists()) { features = new TreeMap<String, ProvisioningFeatureDefinition>(); File[] userManifestFiles = userFeatureDir.listFiles(MFFilter); if (userManifestFiles != null) { for (File file : userManifestFiles) { try { ProvisioningFeatureDefinition fd = new SubsystemFeatureDefinitionImpl(USR_PRODUCT_EXT_NAME, file); features.put(fd.getSymbolicName(), fd); } catch (IOException e) { // TODO: PROPER NLS MESSAGE throw new FeatureToolException("Unable to read feature manifest from user extension: " + file, (String) null, e, ReturnCode.BAD_FEATURE_DEFINITION); } } } } } return features; } }
public class class_name { private Map<String, ProvisioningFeatureDefinition> getUsrProductFeatureDefinitions() { Map<String, ProvisioningFeatureDefinition> features = null; File userDir = Utils.getUserDir(); if (userDir != null && userDir.exists()) { File userFeatureDir = new File(userDir, USER_FEATURE_DIR); if (userFeatureDir.exists()) { features = new TreeMap<String, ProvisioningFeatureDefinition>(); // depends on control dependency: [if], data = [none] File[] userManifestFiles = userFeatureDir.listFiles(MFFilter); if (userManifestFiles != null) { for (File file : userManifestFiles) { try { ProvisioningFeatureDefinition fd = new SubsystemFeatureDefinitionImpl(USR_PRODUCT_EXT_NAME, file); features.put(fd.getSymbolicName(), fd); // depends on control dependency: [try], data = [none] } catch (IOException e) { // TODO: PROPER NLS MESSAGE throw new FeatureToolException("Unable to read feature manifest from user extension: " + file, (String) null, e, ReturnCode.BAD_FEATURE_DEFINITION); } // depends on control dependency: [catch], data = [none] } } } } return features; } }
public class class_name { @Override public boolean hasInstance(Scriptable value) { Scriptable proto = value.getPrototype(); while (proto != null) { if (proto.equals(this)) return true; proto = proto.getPrototype(); } return false; } }
public class class_name { @Override public boolean hasInstance(Scriptable value) { Scriptable proto = value.getPrototype(); while (proto != null) { if (proto.equals(this)) return true; proto = proto.getPrototype(); // depends on control dependency: [while], data = [none] } return false; } }
public class class_name { public void setPolicyAttributeDescriptions(java.util.Collection<PolicyAttributeDescription> policyAttributeDescriptions) { if (policyAttributeDescriptions == null) { this.policyAttributeDescriptions = null; return; } this.policyAttributeDescriptions = new com.amazonaws.internal.SdkInternalList<PolicyAttributeDescription>(policyAttributeDescriptions); } }
public class class_name { public void setPolicyAttributeDescriptions(java.util.Collection<PolicyAttributeDescription> policyAttributeDescriptions) { if (policyAttributeDescriptions == null) { this.policyAttributeDescriptions = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.policyAttributeDescriptions = new com.amazonaws.internal.SdkInternalList<PolicyAttributeDescription>(policyAttributeDescriptions); } }
public class class_name { public final void char_key() throws RecognitionException { Token id=null; try { // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:764:5: ({...}? =>id= ID ) // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:764:12: {...}? =>id= ID { if ( !(((helper.validateIdentifierKey(DroolsSoftKeywords.CHAR)))) ) { if (state.backtracking>0) {state.failed=true; return;} throw new FailedPredicateException(input, "char_key", "(helper.validateIdentifierKey(DroolsSoftKeywords.CHAR))"); } id=(Token)match(input,ID,FOLLOW_ID_in_char_key4853); if (state.failed) return; if ( state.backtracking==0 ) { helper.emit(id, DroolsEditorType.KEYWORD); } } } catch (RecognitionException re) { throw re; } finally { // do for sure before leaving } } }
public class class_name { public final void char_key() throws RecognitionException { Token id=null; try { // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:764:5: ({...}? =>id= ID ) // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:764:12: {...}? =>id= ID { if ( !(((helper.validateIdentifierKey(DroolsSoftKeywords.CHAR)))) ) { if (state.backtracking>0) {state.failed=true; return;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] throw new FailedPredicateException(input, "char_key", "(helper.validateIdentifierKey(DroolsSoftKeywords.CHAR))"); } id=(Token)match(input,ID,FOLLOW_ID_in_char_key4853); if (state.failed) return; if ( state.backtracking==0 ) { helper.emit(id, DroolsEditorType.KEYWORD); } // depends on control dependency: [if], data = [none] } } catch (RecognitionException re) { throw re; } finally { // do for sure before leaving } } }
public class class_name { @Override protected Object processObject(Object o) { if (o instanceof PGobject && ((PGobject)o).getType().equals("jsonb")) { return ((PGobject) o).getValue(); } return super.processObject(o); } }
public class class_name { @Override protected Object processObject(Object o) { if (o instanceof PGobject && ((PGobject)o).getType().equals("jsonb")) { return ((PGobject) o).getValue(); // depends on control dependency: [if], data = [none] } return super.processObject(o); } }
public class class_name { public int[] toIntArray(final int[] dst) { if (dst.length == size) { System.arraycopy(elements, 0, dst, 0, dst.length); return dst; } else { return Arrays.copyOf(elements, size); } } }
public class class_name { public int[] toIntArray(final int[] dst) { if (dst.length == size) { System.arraycopy(elements, 0, dst, 0, dst.length); // depends on control dependency: [if], data = [none] return dst; // depends on control dependency: [if], data = [none] } else { return Arrays.copyOf(elements, size); // depends on control dependency: [if], data = [size)] } } }
public class class_name { @Override public RequestEntity<?> convert(OAuth2UserRequest userRequest) { ClientRegistration clientRegistration = userRequest.getClientRegistration(); HttpMethod httpMethod = HttpMethod.GET; if (AuthenticationMethod.FORM.equals(clientRegistration.getProviderDetails().getUserInfoEndpoint().getAuthenticationMethod())) { httpMethod = HttpMethod.POST; } HttpHeaders headers = new HttpHeaders(); headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON)); URI uri = UriComponentsBuilder.fromUriString(clientRegistration.getProviderDetails().getUserInfoEndpoint().getUri()) .build() .toUri(); RequestEntity<?> request; if (HttpMethod.POST.equals(httpMethod)) { headers.setContentType(DEFAULT_CONTENT_TYPE); MultiValueMap<String, String> formParameters = new LinkedMultiValueMap<>(); formParameters.add(OAuth2ParameterNames.ACCESS_TOKEN, userRequest.getAccessToken().getTokenValue()); request = new RequestEntity<>(formParameters, headers, httpMethod, uri); } else { headers.setBearerAuth(userRequest.getAccessToken().getTokenValue()); request = new RequestEntity<>(headers, httpMethod, uri); } return request; } }
public class class_name { @Override public RequestEntity<?> convert(OAuth2UserRequest userRequest) { ClientRegistration clientRegistration = userRequest.getClientRegistration(); HttpMethod httpMethod = HttpMethod.GET; if (AuthenticationMethod.FORM.equals(clientRegistration.getProviderDetails().getUserInfoEndpoint().getAuthenticationMethod())) { httpMethod = HttpMethod.POST; // depends on control dependency: [if], data = [none] } HttpHeaders headers = new HttpHeaders(); headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON)); URI uri = UriComponentsBuilder.fromUriString(clientRegistration.getProviderDetails().getUserInfoEndpoint().getUri()) .build() .toUri(); RequestEntity<?> request; if (HttpMethod.POST.equals(httpMethod)) { headers.setContentType(DEFAULT_CONTENT_TYPE); // depends on control dependency: [if], data = [none] MultiValueMap<String, String> formParameters = new LinkedMultiValueMap<>(); formParameters.add(OAuth2ParameterNames.ACCESS_TOKEN, userRequest.getAccessToken().getTokenValue()); // depends on control dependency: [if], data = [none] request = new RequestEntity<>(formParameters, headers, httpMethod, uri); // depends on control dependency: [if], data = [none] } else { headers.setBearerAuth(userRequest.getAccessToken().getTokenValue()); // depends on control dependency: [if], data = [none] request = new RequestEntity<>(headers, httpMethod, uri); // depends on control dependency: [if], data = [none] } return request; } }
public class class_name { public final static String trim(String value) { String result = null; if (null != value) { result = value.trim(); } return result; } }
public class class_name { public final static String trim(String value) { String result = null; if (null != value) { result = value.trim(); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { public static boolean isIpv4(String hostName) { int periodCount = 0; int numberCount = 0; int lowerCount = 0; int upperCount = 0; int otherCount = 0; for(int i = 0; i < hostName.length(); i++ ) { char myChar = hostName.charAt(i); if (myChar=='.') { periodCount++; } else if (myChar >= '0' && myChar <= '9') { numberCount++; } else if (myChar >= 'a' & myChar <= 'z') { lowerCount++; } else if (myChar >= 'A' & myChar <= 'Z') { upperCount++; } else { otherCount++; } } if (periodCount==3 && numberCount >= 4 && lowerCount==0 && upperCount==0 && otherCount==0) { return true; } else { return false; } } }
public class class_name { public static boolean isIpv4(String hostName) { int periodCount = 0; int numberCount = 0; int lowerCount = 0; int upperCount = 0; int otherCount = 0; for(int i = 0; i < hostName.length(); i++ ) { char myChar = hostName.charAt(i); if (myChar=='.') { periodCount++; // depends on control dependency: [if], data = [none] } else if (myChar >= '0' && myChar <= '9') { numberCount++; // depends on control dependency: [if], data = [none] } else if (myChar >= 'a' & myChar <= 'z') { lowerCount++; // depends on control dependency: [if], data = [none] } else if (myChar >= 'A' & myChar <= 'Z') { upperCount++; // depends on control dependency: [if], data = [none] } else { otherCount++; // depends on control dependency: [if], data = [none] } } if (periodCount==3 && numberCount >= 4 && lowerCount==0 && upperCount==0 && otherCount==0) { return true; // depends on control dependency: [if], data = [none] } else { return false; // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public void close() { if (!this.closed.getAndSet(true)) { this.metricReporter.cancel(true); this.metrics.close(); this.rolloverProcessor.close(); this.writeProcessor.close(); // Close active ledger. WriteLedger writeLedger; synchronized (this.lock) { writeLedger = this.writeLedger; this.writeLedger = null; this.logMetadata = null; } // Close the write queue and cancel the pending writes. this.writes.close().forEach(w -> w.fail(new CancellationException("BookKeeperLog has been closed."), true)); if (writeLedger != null) { try { Ledgers.close(writeLedger.ledger); } catch (DurableDataLogException bkEx) { log.error("{}: Unable to close LedgerHandle for Ledger {}.", this.traceObjectId, writeLedger.ledger.getId(), bkEx); } } log.info("{}: Closed.", this.traceObjectId); } } }
public class class_name { @Override public void close() { if (!this.closed.getAndSet(true)) { this.metricReporter.cancel(true); // depends on control dependency: [if], data = [none] this.metrics.close(); // depends on control dependency: [if], data = [none] this.rolloverProcessor.close(); // depends on control dependency: [if], data = [none] this.writeProcessor.close(); // depends on control dependency: [if], data = [none] // Close active ledger. WriteLedger writeLedger; synchronized (this.lock) { // depends on control dependency: [if], data = [none] writeLedger = this.writeLedger; this.writeLedger = null; this.logMetadata = null; } // Close the write queue and cancel the pending writes. this.writes.close().forEach(w -> w.fail(new CancellationException("BookKeeperLog has been closed."), true)); // depends on control dependency: [if], data = [none] if (writeLedger != null) { try { Ledgers.close(writeLedger.ledger); // depends on control dependency: [try], data = [none] } catch (DurableDataLogException bkEx) { log.error("{}: Unable to close LedgerHandle for Ledger {}.", this.traceObjectId, writeLedger.ledger.getId(), bkEx); } // depends on control dependency: [catch], data = [none] } log.info("{}: Closed.", this.traceObjectId); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void setRepositories(java.util.Collection<Repository> repositories) { if (repositories == null) { this.repositories = null; return; } this.repositories = new java.util.ArrayList<Repository>(repositories); } }
public class class_name { public void setRepositories(java.util.Collection<Repository> repositories) { if (repositories == null) { this.repositories = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.repositories = new java.util.ArrayList<Repository>(repositories); } }
public class class_name { protected byte[] getSignedData() throws KSIException { ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); try { byteStream.write(FILE_BEGINNING_MAGIC_BYTES); for (TLVElement element : elements) { if (ELEMENT_TYPE_CMS_SIGNATURE != element.getType()) { element.writeTo(byteStream); } } } catch (IOException e) { return new byte[]{}; } return byteStream.toByteArray(); } }
public class class_name { protected byte[] getSignedData() throws KSIException { ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); try { byteStream.write(FILE_BEGINNING_MAGIC_BYTES); for (TLVElement element : elements) { if (ELEMENT_TYPE_CMS_SIGNATURE != element.getType()) { element.writeTo(byteStream); // depends on control dependency: [if], data = [none] } } } catch (IOException e) { return new byte[]{}; } return byteStream.toByteArray(); } }
public class class_name { @Override public EClass getIfcMaterialConstituentSet() { if (ifcMaterialConstituentSetEClass == null) { ifcMaterialConstituentSetEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(359); } return ifcMaterialConstituentSetEClass; } }
public class class_name { @Override public EClass getIfcMaterialConstituentSet() { if (ifcMaterialConstituentSetEClass == null) { ifcMaterialConstituentSetEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(359); // depends on control dependency: [if], data = [none] } return ifcMaterialConstituentSetEClass; } }
public class class_name { protected void configureGraphics(Graphics2D g) { //configure antialiasing if(isAntialiasing()) { g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } else { g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); } getInterpolation().configureGraphics(g); } }
public class class_name { protected void configureGraphics(Graphics2D g) { //configure antialiasing if(isAntialiasing()) { g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); // depends on control dependency: [if], data = [none] } else { g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); // depends on control dependency: [if], data = [none] } getInterpolation().configureGraphics(g); } }
public class class_name { public static boolean chmod(String as, File f, File copyOf) { if (!f.exists()) { log.error("[FileHelper] {chmod} Non-existant file: " + f.getPath()); return false; } if (!copyOf.exists()) { log.error("[FileHelper] {chmod} Non-existant file: " + copyOf.getPath()); return false; } try { Execed call = Exec.utilityAs(as, "chmod", "--reference=" + copyOf.getPath(), f.getPath()); int returnCode = call.waitForExit(); return returnCode == 0; } catch (Exception e) { log.error("[LockRecord] {chmod} Failure: " + e.getMessage(), e); return false; } } }
public class class_name { public static boolean chmod(String as, File f, File copyOf) { if (!f.exists()) { log.error("[FileHelper] {chmod} Non-existant file: " + f.getPath()); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } if (!copyOf.exists()) { log.error("[FileHelper] {chmod} Non-existant file: " + copyOf.getPath()); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } try { Execed call = Exec.utilityAs(as, "chmod", "--reference=" + copyOf.getPath(), f.getPath()); int returnCode = call.waitForExit(); return returnCode == 0; // depends on control dependency: [try], data = [none] } catch (Exception e) { log.error("[LockRecord] {chmod} Failure: " + e.getMessage(), e); return false; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public Object remove(int index) { if (index >= elementCount) { throw new IndexOutOfBoundsException("Index out of bounds: " + index + " >= " + elementCount); } if (index < 0) { throw new IndexOutOfBoundsException("Index out of bounds: " + index + " < 0"); } Object removedObj = elementData[index]; for (int i = index; i < elementCount - 1; i++) { elementData[i] = elementData[i + 1]; } elementCount--; if (elementCount == 0) { clear(); } else { elementData[elementCount] = null; } return removedObj; } }
public class class_name { public Object remove(int index) { if (index >= elementCount) { throw new IndexOutOfBoundsException("Index out of bounds: " + index + " >= " + elementCount); } if (index < 0) { throw new IndexOutOfBoundsException("Index out of bounds: " + index + " < 0"); } Object removedObj = elementData[index]; for (int i = index; i < elementCount - 1; i++) { elementData[i] = elementData[i + 1]; // depends on control dependency: [for], data = [i] } elementCount--; if (elementCount == 0) { clear(); // depends on control dependency: [if], data = [none] } else { elementData[elementCount] = null; // depends on control dependency: [if], data = [none] } return removedObj; } }
public class class_name { public static String findServerSettings(String[] args) { for (String s : args) { if (s.startsWith("--server:")) { return s; } } return null; } }
public class class_name { public static String findServerSettings(String[] args) { for (String s : args) { if (s.startsWith("--server:")) { return s; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { public static String dot2path(String qualifiedName, String fileExtension) { if(qualifiedName == null) { return null; } StringBuilder path = new StringBuilder(); path.append(dot2path(qualifiedName)); if(fileExtension != null) { if(fileExtension.charAt(0) != '.') { path.append('.'); } path.append(fileExtension); } return path.toString(); } }
public class class_name { public static String dot2path(String qualifiedName, String fileExtension) { if(qualifiedName == null) { return null; // depends on control dependency: [if], data = [none] } StringBuilder path = new StringBuilder(); path.append(dot2path(qualifiedName)); if(fileExtension != null) { if(fileExtension.charAt(0) != '.') { path.append('.'); // depends on control dependency: [if], data = ['.')] } path.append(fileExtension); // depends on control dependency: [if], data = [(fileExtension] } return path.toString(); } }
public class class_name { public ByteBuffer readBuffer(long address, int length) { ByteBuffer[] buffers = readBuffers(address, length); if (buffers.length == 1) { return buffers[0]; } else { ByteBuffer copy = ByteBuffer.allocate(length); for (ByteBuffer b : buffers) { copy.put(b); } return ((ByteBuffer) copy.flip()).asReadOnlyBuffer(); } } }
public class class_name { public ByteBuffer readBuffer(long address, int length) { ByteBuffer[] buffers = readBuffers(address, length); if (buffers.length == 1) { return buffers[0]; // depends on control dependency: [if], data = [none] } else { ByteBuffer copy = ByteBuffer.allocate(length); for (ByteBuffer b : buffers) { copy.put(b); // depends on control dependency: [for], data = [b] } return ((ByteBuffer) copy.flip()).asReadOnlyBuffer(); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void checkAccess(Database database) { // // Manage Access control // if (database.check_access && !database.isAccess_checked()) { database.access = checkAccessControl(database, database.devname, database.url); database.setAccess_checked(true); // Initialize value. ApiUtil.getReconnectionDelay(); //System.out.println(this + "." + database.deviceName + " -> " + // ((database.access==TangoConst.ACCESS_READ)? "Read" : "Write")); } } }
public class class_name { private void checkAccess(Database database) { // // Manage Access control // if (database.check_access && !database.isAccess_checked()) { database.access = checkAccessControl(database, database.devname, database.url); // depends on control dependency: [if], data = [none] database.setAccess_checked(true); // depends on control dependency: [if], data = [none] // Initialize value. ApiUtil.getReconnectionDelay(); // depends on control dependency: [if], data = [none] //System.out.println(this + "." + database.deviceName + " -> " + // ((database.access==TangoConst.ACCESS_READ)? "Read" : "Write")); } } }
public class class_name { public static Chainr fromFile( File chainrSpecFile, ChainrInstantiator chainrInstantiator ) { Object chainrSpec; try { FileInputStream fileInputStream = new FileInputStream( chainrSpecFile ); chainrSpec = JsonUtils.jsonToObject( fileInputStream ); } catch ( Exception e ) { throw new RuntimeException( "Unable to load chainr spec file " + chainrSpecFile.getAbsolutePath() ); } return getChainr( chainrInstantiator, chainrSpec ); } }
public class class_name { public static Chainr fromFile( File chainrSpecFile, ChainrInstantiator chainrInstantiator ) { Object chainrSpec; try { FileInputStream fileInputStream = new FileInputStream( chainrSpecFile ); chainrSpec = JsonUtils.jsonToObject( fileInputStream ); // depends on control dependency: [try], data = [none] } catch ( Exception e ) { throw new RuntimeException( "Unable to load chainr spec file " + chainrSpecFile.getAbsolutePath() ); } // depends on control dependency: [catch], data = [none] return getChainr( chainrInstantiator, chainrSpec ); } }
public class class_name { public Collection getScopeFor(Collection.Key key, Scope defaultValue) { Object rtn = null; if (checkArguments) { rtn = local.get(key, NullSupportHelper.NULL()); if (rtn != NullSupportHelper.NULL()) return local; rtn = argument.getFunctionArgument(key, NullSupportHelper.NULL()); if (rtn != NullSupportHelper.NULL()) return argument; } // get data from queries if (allowImplicidQueryCall && pc.getCurrentTemplateDialect() == CFMLEngine.DIALECT_CFML && !qryStack.isEmpty()) { QueryColumn qc = qryStack.getColumnFromACollection(key); if (qc != null) return (Query) qc.getParent(); } // variable rtn = variable.get(key, NullSupportHelper.NULL()); if (rtn != NullSupportHelper.NULL()) { return variable; } // thread scopes if (pc.hasFamily()) { Threads t = (Threads) pc.getThreadScope(key, NullSupportHelper.NULL()); if (rtn != NullSupportHelper.NULL()) return t; } // get a scope value (only cfml is searcing additional scopes) if (pc.getCurrentTemplateDialect() == CFMLEngine.DIALECT_CFML) { for (int i = 0; i < scopes.length; i++) { rtn = scopes[i].get(key, NullSupportHelper.NULL()); if (rtn != NullSupportHelper.NULL()) { return scopes[i]; } } } return defaultValue; } }
public class class_name { public Collection getScopeFor(Collection.Key key, Scope defaultValue) { Object rtn = null; if (checkArguments) { rtn = local.get(key, NullSupportHelper.NULL()); // depends on control dependency: [if], data = [none] if (rtn != NullSupportHelper.NULL()) return local; rtn = argument.getFunctionArgument(key, NullSupportHelper.NULL()); // depends on control dependency: [if], data = [none] if (rtn != NullSupportHelper.NULL()) return argument; } // get data from queries if (allowImplicidQueryCall && pc.getCurrentTemplateDialect() == CFMLEngine.DIALECT_CFML && !qryStack.isEmpty()) { QueryColumn qc = qryStack.getColumnFromACollection(key); if (qc != null) return (Query) qc.getParent(); } // variable rtn = variable.get(key, NullSupportHelper.NULL()); if (rtn != NullSupportHelper.NULL()) { return variable; // depends on control dependency: [if], data = [none] } // thread scopes if (pc.hasFamily()) { Threads t = (Threads) pc.getThreadScope(key, NullSupportHelper.NULL()); if (rtn != NullSupportHelper.NULL()) return t; } // get a scope value (only cfml is searcing additional scopes) if (pc.getCurrentTemplateDialect() == CFMLEngine.DIALECT_CFML) { for (int i = 0; i < scopes.length; i++) { rtn = scopes[i].get(key, NullSupportHelper.NULL()); // depends on control dependency: [for], data = [i] if (rtn != NullSupportHelper.NULL()) { return scopes[i]; // depends on control dependency: [if], data = [none] } } } return defaultValue; } }
public class class_name { public static int unpackInt(final byte[] array, final JBBPIntCounter position) { final int code = array[position.getAndIncrement()] & 0xFF; if (code < 0x80) { return code; } final int result; switch (code) { case 0x80: { result = ((array[position.getAndIncrement()] & 0xFF) << 8) | (array[position.getAndIncrement()] & 0xFF); } break; case 0x81: { result = ((array[position.getAndIncrement()] & 0xFF) << 24) | ((array[position.getAndIncrement()] & 0xFF) << 16) | ((array[position.getAndIncrement()] & 0xFF) << 8) | (array[position.getAndIncrement()] & 0xFF); } break; default: throw new IllegalArgumentException("Unsupported packed integer prefix [0x" + Integer.toHexString(code).toUpperCase(Locale.ENGLISH) + ']'); } return result; } }
public class class_name { public static int unpackInt(final byte[] array, final JBBPIntCounter position) { final int code = array[position.getAndIncrement()] & 0xFF; if (code < 0x80) { return code; // depends on control dependency: [if], data = [none] } final int result; switch (code) { case 0x80: { result = ((array[position.getAndIncrement()] & 0xFF) << 8) | (array[position.getAndIncrement()] & 0xFF); } break; case 0x81: { result = ((array[position.getAndIncrement()] & 0xFF) << 24) | ((array[position.getAndIncrement()] & 0xFF) << 16) | ((array[position.getAndIncrement()] & 0xFF) << 8) | (array[position.getAndIncrement()] & 0xFF); } break; default: throw new IllegalArgumentException("Unsupported packed integer prefix [0x" + Integer.toHexString(code).toUpperCase(Locale.ENGLISH) + ']'); } return result; } }
public class class_name { public void marshall(GetCelebrityInfoRequest getCelebrityInfoRequest, ProtocolMarshaller protocolMarshaller) { if (getCelebrityInfoRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getCelebrityInfoRequest.getId(), ID_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(GetCelebrityInfoRequest getCelebrityInfoRequest, ProtocolMarshaller protocolMarshaller) { if (getCelebrityInfoRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getCelebrityInfoRequest.getId(), ID_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 removeZeroCounts() { for (Iterator<E> iter = map.keySet().iterator(); iter.hasNext();) { if (getCount(iter.next()) == 0) { iter.remove(); } } } }
public class class_name { public void removeZeroCounts() { for (Iterator<E> iter = map.keySet().iterator(); iter.hasNext();) { if (getCount(iter.next()) == 0) { iter.remove(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void removeNameUrl(final String name, final String url) throws IOException { // need to first see if there is already an entry for this name. // if not, do nothing // if so, loop thru all current url locations for name // keep any that are not url // if any locations are left, update to the new value, sans url // if none are left, remove the entry from the db StringBuilder newValue = new StringBuilder(); String oldValue = get(name); if(oldValue != null && oldValue.length() > 0) { String curUrls[] = oldValue.split(urlDelimiterRE); for(int i=0; i < curUrls.length; i++) { if(!url.equals(curUrls[i])) { if(newValue.length() > 0) { newValue.append(urlDelimiter); } newValue.append(curUrls[i]); } } if(newValue.length() > 0) { // update put(name, newValue.toString()); } else { // remove the entry: delete(name); } } } }
public class class_name { public void removeNameUrl(final String name, final String url) throws IOException { // need to first see if there is already an entry for this name. // if not, do nothing // if so, loop thru all current url locations for name // keep any that are not url // if any locations are left, update to the new value, sans url // if none are left, remove the entry from the db StringBuilder newValue = new StringBuilder(); String oldValue = get(name); if(oldValue != null && oldValue.length() > 0) { String curUrls[] = oldValue.split(urlDelimiterRE); for(int i=0; i < curUrls.length; i++) { if(!url.equals(curUrls[i])) { if(newValue.length() > 0) { newValue.append(urlDelimiter); // depends on control dependency: [if], data = [none] } newValue.append(curUrls[i]); // depends on control dependency: [if], data = [none] } } if(newValue.length() > 0) { // update put(name, newValue.toString()); // depends on control dependency: [if], data = [none] } else { // remove the entry: delete(name); // depends on control dependency: [if], data = [none] } } } }
public class class_name { @Override public TraceMethod wayout() { TraceMethod traceMethod = this.tracer.wayout(); if (getThreadMap().getCurrentStackSize() == 0) { clearCurrentTracingContext(); if (!TracerFactory.getInstance().offerTracer(this)) System.err.printf("WARNING: Offer failed. Possible queue corruption.%n"); } return traceMethod; } }
public class class_name { @Override public TraceMethod wayout() { TraceMethod traceMethod = this.tracer.wayout(); if (getThreadMap().getCurrentStackSize() == 0) { clearCurrentTracingContext(); // depends on control dependency: [if], data = [none] if (!TracerFactory.getInstance().offerTracer(this)) System.err.printf("WARNING: Offer failed. Possible queue corruption.%n"); } return traceMethod; } }
public class class_name { public void actionDeleteElementLocale() throws JspException { try { Locale loc = getElementLocale(); m_content.removeLocale(loc); //write the modified xml content writeContent(); List<Locale> locales = m_content.getLocales(); if (locales.size() > 0) { // set first locale as new display locale Locale newLoc = locales.get(0); setParamElementlanguage(newLoc.toString()); m_elementLocale = newLoc; } else { if (LOG.isErrorEnabled()) { LOG.error(Messages.get().getBundle().key(Messages.LOG_GET_LOCALES_1, getParamResource())); } } } catch (CmsXmlException e) { // an error occurred while trying to delete the locale, stop action showErrorPage(e); } catch (CmsException e) { // should usually never happen if (LOG.isInfoEnabled()) { LOG.info(e.getLocalizedMessage(), e); } } } }
public class class_name { public void actionDeleteElementLocale() throws JspException { try { Locale loc = getElementLocale(); m_content.removeLocale(loc); //write the modified xml content writeContent(); List<Locale> locales = m_content.getLocales(); if (locales.size() > 0) { // set first locale as new display locale Locale newLoc = locales.get(0); setParamElementlanguage(newLoc.toString()); m_elementLocale = newLoc; } else { if (LOG.isErrorEnabled()) { LOG.error(Messages.get().getBundle().key(Messages.LOG_GET_LOCALES_1, getParamResource())); // depends on control dependency: [if], data = [none] } } } catch (CmsXmlException e) { // an error occurred while trying to delete the locale, stop action showErrorPage(e); } catch (CmsException e) { // should usually never happen if (LOG.isInfoEnabled()) { LOG.info(e.getLocalizedMessage(), e); } } } }
public class class_name { public void setSplitTransition(Transition transition) { if (split == null) { if (transition != null) { setSplitHref("#"); } else { return; } } if (split != null) JQMCommon.setTransition(split, transition); } }
public class class_name { public void setSplitTransition(Transition transition) { if (split == null) { if (transition != null) { setSplitHref("#"); // depends on control dependency: [if], data = [none] } else { return; // depends on control dependency: [if], data = [none] } } if (split != null) JQMCommon.setTransition(split, transition); } }
public class class_name { protected KdTree.Node computeChild(List<P> points , GrowQueue_I32 indexes ) { if( points.size() == 0 ) return null; if( points.size() == 1 ) { return createLeaf(points,indexes); } else { return computeBranch(points,indexes); } } }
public class class_name { protected KdTree.Node computeChild(List<P> points , GrowQueue_I32 indexes ) { if( points.size() == 0 ) return null; if( points.size() == 1 ) { return createLeaf(points,indexes); // depends on control dependency: [if], data = [none] } else { return computeBranch(points,indexes); // depends on control dependency: [if], data = [none] } } }
public class class_name { String dump() { StringBuilder sbuf = new StringBuilder(); sbuf.append("\n").append(toString()); sbuf.append("\n PersistenceUnit name : ").append(ivArchivePuId.getPuName()); sbuf.append("\n Schema Version : ").append(xmlSchemaVersion); //F743-8064 sbuf.append("\t Archive name : ").append(ivArchivePuId.getModJarName()); sbuf.append("\t Application name : ").append(ivArchivePuId.getApplName()); sbuf.append("\n Root URL : ").append(ivPUnitRootURL); sbuf.append("\n Transaction Type : ").append(ivTxType); sbuf.append("\n Description : ").append(ivDesc); sbuf.append("\n Provider class name : ").append(ivProviderClassName); sbuf.append("\n JTA Data Source : ").append(ivJtaDataSourceJNDIName).append(" | ").append(ivJtaDataSource); sbuf.append("\n Non JTA Data Source : ").append(ivNonJtaDataSourceJNDIName).append(" | ").append(ivNonJtaDataSource); sbuf.append("\n ExcludeUnlistedClass : ").append(ivExcludeUnlistedClasses); sbuf.append("\n SharedCacheMode : ").append(ivCaching); // d597764 sbuf.append("\n ValidationMode : ").append(ivValidationMode); // d597764 sbuf.append("\n Properties : ").append(ivProperties); boolean first; sbuf.append("\n Mapping Files : ["); if (ivMappingFileNames != null) { first = true; for (String fname : ivMappingFileNames) { sbuf.append(first ? "" : ",").append(fname); first = false; } } sbuf.append(']'); sbuf.append("\n Jar Files : ["); if (ivJarFileURLs != null) { first = true; for (URL jarUrl : ivJarFileURLs) { sbuf.append(first ? "" : ",").append(jarUrl); first = false; } } sbuf.append(']'); sbuf.append("\n ManagedClasses : ["); if (ivManagedClassNames != null) { first = true; for (String className : ivManagedClassNames) { sbuf.append(first ? "" : ",").append(className); first = false; } } sbuf.append(']'); sbuf.append("\n ClassLoader : ").append(ivClassLoader); sbuf.append("\n Temp ClassLoader : ").append(tempClassLoader); sbuf.append("\n Transformer : ["); if (ivTransformers != null) { first = true; for (ClassTransformer transformer : ivTransformers) { sbuf.append(first ? "" : ",").append(transformer); first = false; } } sbuf.append(']'); return sbuf.toString(); } }
public class class_name { String dump() { StringBuilder sbuf = new StringBuilder(); sbuf.append("\n").append(toString()); sbuf.append("\n PersistenceUnit name : ").append(ivArchivePuId.getPuName()); sbuf.append("\n Schema Version : ").append(xmlSchemaVersion); //F743-8064 sbuf.append("\t Archive name : ").append(ivArchivePuId.getModJarName()); sbuf.append("\t Application name : ").append(ivArchivePuId.getApplName()); sbuf.append("\n Root URL : ").append(ivPUnitRootURL); sbuf.append("\n Transaction Type : ").append(ivTxType); sbuf.append("\n Description : ").append(ivDesc); sbuf.append("\n Provider class name : ").append(ivProviderClassName); sbuf.append("\n JTA Data Source : ").append(ivJtaDataSourceJNDIName).append(" | ").append(ivJtaDataSource); sbuf.append("\n Non JTA Data Source : ").append(ivNonJtaDataSourceJNDIName).append(" | ").append(ivNonJtaDataSource); sbuf.append("\n ExcludeUnlistedClass : ").append(ivExcludeUnlistedClasses); sbuf.append("\n SharedCacheMode : ").append(ivCaching); // d597764 sbuf.append("\n ValidationMode : ").append(ivValidationMode); // d597764 sbuf.append("\n Properties : ").append(ivProperties); boolean first; sbuf.append("\n Mapping Files : ["); if (ivMappingFileNames != null) { first = true; // depends on control dependency: [if], data = [none] for (String fname : ivMappingFileNames) { sbuf.append(first ? "" : ",").append(fname); // depends on control dependency: [for], data = [fname] first = false; // depends on control dependency: [for], data = [none] } } sbuf.append(']'); sbuf.append("\n Jar Files : ["); if (ivJarFileURLs != null) { first = true; // depends on control dependency: [if], data = [none] for (URL jarUrl : ivJarFileURLs) { sbuf.append(first ? "" : ",").append(jarUrl); // depends on control dependency: [for], data = [jarUrl] first = false; // depends on control dependency: [for], data = [none] } } sbuf.append(']'); sbuf.append("\n ManagedClasses : ["); if (ivManagedClassNames != null) { first = true; // depends on control dependency: [if], data = [none] for (String className : ivManagedClassNames) { sbuf.append(first ? "" : ",").append(className); // depends on control dependency: [for], data = [className] first = false; // depends on control dependency: [for], data = [none] } } sbuf.append(']'); sbuf.append("\n ClassLoader : ").append(ivClassLoader); sbuf.append("\n Temp ClassLoader : ").append(tempClassLoader); sbuf.append("\n Transformer : ["); if (ivTransformers != null) { first = true; // depends on control dependency: [if], data = [none] for (ClassTransformer transformer : ivTransformers) { sbuf.append(first ? "" : ",").append(transformer); // depends on control dependency: [for], data = [transformer] first = false; // depends on control dependency: [for], data = [none] } } sbuf.append(']'); return sbuf.toString(); } }
public class class_name { public static void generateInitSectionCode(JavaCodeWriter writer, int type, JspOptions jspOptions) { //PM06063 writer.println("private javax.el.ExpressionFactory _el_expressionfactory;"); if (type==GeneratorUtils.TAG_FILE_TYPE) { //LIDB4147-24 & 443243 : need to define injection helpers for .tag files if (jspOptions == null || !jspOptions.isDisableResourceInjection()){ //PM06063 generateInjectionSection(writer); } //PM06063 writer.println("private void _jspInit(ServletConfig config) {"); } else { writer.println("public void _jspInit() {"); } writer.print("_el_expressionfactory"); writer.print(" = _jspxFactory.getJspApplicationContext("); if (type==GeneratorUtils.TAG_FILE_TYPE) { writer.print("config"); } else { writer.print("getServletConfig()"); } writer.print(".getServletContext()).getExpressionFactory();"); writer.println(); writer.println(); // LIDB4147-24 if (jspOptions == null || !jspOptions.isDisableResourceInjection()){ //PM06063 writer.print ("com.ibm.wsspi.webcontainer.annotation.AnnotationHelperManager _jspx_aHelper = "); writer.print ("com.ibm.wsspi.webcontainer.annotation.AnnotationHelperManager.getInstance ("); //443243: need to have the servletConfig to get the servletContext if (type==GeneratorUtils.TAG_FILE_TYPE) { writer.print("config"); } else { writer.print("getServletConfig()"); } writer.println(".getServletContext());"); writer.println ("_jspx_iaHelper = _jspx_aHelper.getAnnotationHelper();"); } //PM06063 //PK81147 start //if this is a JSP page, need to set this to true to indicate that we have already run_jspInit() for this generated servlet. if(type==GeneratorUtils.JSP_FILE_TYPE){ writer.println("_jspx_isJspInited = true;"); } //PK81147 end writer.println("}"); } }
public class class_name { public static void generateInitSectionCode(JavaCodeWriter writer, int type, JspOptions jspOptions) { //PM06063 writer.println("private javax.el.ExpressionFactory _el_expressionfactory;"); if (type==GeneratorUtils.TAG_FILE_TYPE) { //LIDB4147-24 & 443243 : need to define injection helpers for .tag files if (jspOptions == null || !jspOptions.isDisableResourceInjection()){ //PM06063 generateInjectionSection(writer); // depends on control dependency: [if], data = [none] } //PM06063 writer.println("private void _jspInit(ServletConfig config) {"); // depends on control dependency: [if], data = [none] } else { writer.println("public void _jspInit() {"); // depends on control dependency: [if], data = [none] } writer.print("_el_expressionfactory"); writer.print(" = _jspxFactory.getJspApplicationContext("); if (type==GeneratorUtils.TAG_FILE_TYPE) { writer.print("config"); // depends on control dependency: [if], data = [none] } else { writer.print("getServletConfig()"); // depends on control dependency: [if], data = [none] } writer.print(".getServletContext()).getExpressionFactory();"); writer.println(); writer.println(); // LIDB4147-24 if (jspOptions == null || !jspOptions.isDisableResourceInjection()){ //PM06063 writer.print ("com.ibm.wsspi.webcontainer.annotation.AnnotationHelperManager _jspx_aHelper = "); // depends on control dependency: [if], data = [none] writer.print ("com.ibm.wsspi.webcontainer.annotation.AnnotationHelperManager.getInstance ("); // depends on control dependency: [if], data = [none] //443243: need to have the servletConfig to get the servletContext if (type==GeneratorUtils.TAG_FILE_TYPE) { writer.print("config"); // depends on control dependency: [if], data = [none] } else { writer.print("getServletConfig()"); // depends on control dependency: [if], data = [none] } writer.println(".getServletContext());"); // depends on control dependency: [if], data = [none] writer.println ("_jspx_iaHelper = _jspx_aHelper.getAnnotationHelper();"); // depends on control dependency: [if], data = [none] } //PM06063 //PK81147 start //if this is a JSP page, need to set this to true to indicate that we have already run_jspInit() for this generated servlet. if(type==GeneratorUtils.JSP_FILE_TYPE){ writer.println("_jspx_isJspInited = true;"); // depends on control dependency: [if], data = [none] } //PK81147 end writer.println("}"); } }
public class class_name { protected User safeGetSender(MessageEnvelope envelope) { if (envelope != null && envelope.getSender() != null && envelope.getSender().getId() != null) { return envelope.getSender(); } return new User(); } }
public class class_name { protected User safeGetSender(MessageEnvelope envelope) { if (envelope != null && envelope.getSender() != null && envelope.getSender().getId() != null) { return envelope.getSender(); // depends on control dependency: [if], data = [none] } return new User(); } }
public class class_name { public SqlBuilder newFrom(final String from) { if (null == from) { this.from = null; } else { if (Strings.contains(from.toLowerCase(), "from")) { this.from = from; } else { this.from = " from " + from; } } return this; } }
public class class_name { public SqlBuilder newFrom(final String from) { if (null == from) { this.from = null; // depends on control dependency: [if], data = [none] } else { if (Strings.contains(from.toLowerCase(), "from")) { this.from = from; // depends on control dependency: [if], data = [none] } else { this.from = " from " + from; // depends on control dependency: [if], data = [none] } } return this; } }
public class class_name { @Override public void registerChildren(ManagementResourceRegistration resourceRegistration) { // Register wildcard children last to prevent duplicate registration errors when override definitions exist for (ResourceDefinition rd : singletonChildren) { resourceRegistration.registerSubModel(rd); } for (ResourceDefinition rd : wildcardChildren) { resourceRegistration.registerSubModel(rd); } } }
public class class_name { @Override public void registerChildren(ManagementResourceRegistration resourceRegistration) { // Register wildcard children last to prevent duplicate registration errors when override definitions exist for (ResourceDefinition rd : singletonChildren) { resourceRegistration.registerSubModel(rd); // depends on control dependency: [for], data = [rd] } for (ResourceDefinition rd : wildcardChildren) { resourceRegistration.registerSubModel(rd); // depends on control dependency: [for], data = [rd] } } }
public class class_name { public void readTreeLevel(CmsObject cms, CmsUUID parentId) { try { CmsResource parent = cms.readResource(parentId, m_filter); List<CmsResource> children = cms.readResources(parent, m_filter, false); // sets the parent to leaf mode, in case no child folders are present setChildrenAllowed(parentId, !children.isEmpty()); for (CmsResource resource : children) { addTreeItem(cms, resource, parentId); } } catch (CmsException e) { CmsErrorDialog.showErrorDialog( CmsVaadinUtils.getMessageText(Messages.ERR_EXPLORER_CAN_NOT_READ_RESOURCE_1, parentId), e); LOG.error(e.getLocalizedMessage(), e); } } }
public class class_name { public void readTreeLevel(CmsObject cms, CmsUUID parentId) { try { CmsResource parent = cms.readResource(parentId, m_filter); List<CmsResource> children = cms.readResources(parent, m_filter, false); // sets the parent to leaf mode, in case no child folders are present setChildrenAllowed(parentId, !children.isEmpty()); // depends on control dependency: [try], data = [none] for (CmsResource resource : children) { addTreeItem(cms, resource, parentId); // depends on control dependency: [for], data = [resource] } } catch (CmsException e) { CmsErrorDialog.showErrorDialog( CmsVaadinUtils.getMessageText(Messages.ERR_EXPLORER_CAN_NOT_READ_RESOURCE_1, parentId), e); LOG.error(e.getLocalizedMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static String locate(String className, ClassLoader classLoader) { String resource = new String(className); // format the file name into a valid resource name if (!resource.startsWith("/")) { resource = "/" + resource; } resource = resource.replace('.', '/'); resource = resource + ".class"; // attempt to locate the file using the class loader URL classUrl = classLoader.getResource(resource); if (classUrl == null && classLoader == ClasspathUtil.class.getClassLoader()) { // Apparently clazz.getResource() works sometimes when clazz.getClassLoader().getResource() does not. // TODO: why? classUrl = ClasspathUtil.class.getResource(resource); } if (classUrl == null) { return "\nClass not found: [" + className + "]"; } else { return classUrl.getFile(); } } }
public class class_name { public static String locate(String className, ClassLoader classLoader) { String resource = new String(className); // format the file name into a valid resource name if (!resource.startsWith("/")) { resource = "/" + resource; // depends on control dependency: [if], data = [none] } resource = resource.replace('.', '/'); resource = resource + ".class"; // attempt to locate the file using the class loader URL classUrl = classLoader.getResource(resource); if (classUrl == null && classLoader == ClasspathUtil.class.getClassLoader()) { // Apparently clazz.getResource() works sometimes when clazz.getClassLoader().getResource() does not. // TODO: why? classUrl = ClasspathUtil.class.getResource(resource); // depends on control dependency: [if], data = [none] } if (classUrl == null) { return "\nClass not found: [" + className + "]"; // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] } else { return classUrl.getFile(); // depends on control dependency: [if], data = [none] } } }
public class class_name { void setCertificateToTruststore(X509Certificate[] chain) throws Exception { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(tc, "setCertificateToTruststore"); try { WSKeyStore wsks = KeyStoreManager.getInstance().getKeyStore(tsCfgAlias); if (wsks == null) throw (new Exception("Keystore " + tsCfgAlias + " does not exist in the configuration.")); if (wsks.getReadOnly()) { issueMessage("ssl.keystore.readonly.CWPKI0810I", new Object[] { tsCfgAlias }, "The " + tsCfgAlias + " keystore is read only and the certificate will not be written to the keystore file. Trust will be accepted only for this connection."); } else { for (int j = 0; j < chain.length; j++) { String alias = chain[j].getSubjectDN().getName(); alias = alias.trim(); if (tc.isDebugEnabled()) Tr.debug(tc, "Adding alias \"" + alias + "\" to truststore \"" + tsFile + "\"."); wsks.setCertificateEntry(alias, chain[chain.length - 1]); String shaDigest = KeyStoreManager.getInstance().generateDigest("SHA-1", chain[chain.length - 1]); issueMessage("ssl.signer.add.to.local.truststore.CWPKI0308I", new Object[] { alias, tsFile, shaDigest }, "CWPKI0308I: Adding signer alias \"" + alias + "\" to local keystore \"" + tsFile + "\" with the following SHA digest: " + shaDigest); //Certificate is set on the truststore now clear the caches, if the file monitor is on let it handle the change. String trigger = wsks.getTrigger(); if (!trigger.equalsIgnoreCase("disabled")) clearSSLCachesAndResetDefault(); } } } catch (Exception e) { if (tc.isDebugEnabled()) Tr.debug(tc, "Exception while trying to write certificate to the truststore. Exception is " + e.getMessage()); throw e; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "setCertificateToTruststore"); } }
public class class_name { void setCertificateToTruststore(X509Certificate[] chain) throws Exception { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(tc, "setCertificateToTruststore"); try { WSKeyStore wsks = KeyStoreManager.getInstance().getKeyStore(tsCfgAlias); if (wsks == null) throw (new Exception("Keystore " + tsCfgAlias + " does not exist in the configuration.")); if (wsks.getReadOnly()) { issueMessage("ssl.keystore.readonly.CWPKI0810I", new Object[] { tsCfgAlias }, "The " + tsCfgAlias + " keystore is read only and the certificate will not be written to the keystore file. Trust will be accepted only for this connection."); // depends on control dependency: [if], data = [none] } else { for (int j = 0; j < chain.length; j++) { String alias = chain[j].getSubjectDN().getName(); alias = alias.trim(); // depends on control dependency: [for], data = [none] if (tc.isDebugEnabled()) Tr.debug(tc, "Adding alias \"" + alias + "\" to truststore \"" + tsFile + "\"."); wsks.setCertificateEntry(alias, chain[chain.length - 1]); // depends on control dependency: [for], data = [none] String shaDigest = KeyStoreManager.getInstance().generateDigest("SHA-1", chain[chain.length - 1]); issueMessage("ssl.signer.add.to.local.truststore.CWPKI0308I", new Object[] { alias, tsFile, shaDigest }, "CWPKI0308I: Adding signer alias \"" + alias + "\" to local keystore \"" + tsFile + "\" with the following SHA digest: " + shaDigest); // depends on control dependency: [for], data = [none] //Certificate is set on the truststore now clear the caches, if the file monitor is on let it handle the change. String trigger = wsks.getTrigger(); if (!trigger.equalsIgnoreCase("disabled")) clearSSLCachesAndResetDefault(); } } } catch (Exception e) { if (tc.isDebugEnabled()) Tr.debug(tc, "Exception while trying to write certificate to the truststore. Exception is " + e.getMessage()); throw e; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "setCertificateToTruststore"); } }
public class class_name { protected ClassLoader getClassLoader() { ClassLoader loader = null; Package pkg = PackageCache.getProcessPackage(getProcessId()); if (pkg != null) { loader = pkg.getCloudClassLoader(); } if (loader == null) { loader = getClass().getClassLoader(); } return loader; } }
public class class_name { protected ClassLoader getClassLoader() { ClassLoader loader = null; Package pkg = PackageCache.getProcessPackage(getProcessId()); if (pkg != null) { loader = pkg.getCloudClassLoader(); // depends on control dependency: [if], data = [none] } if (loader == null) { loader = getClass().getClassLoader(); // depends on control dependency: [if], data = [none] } return loader; } }
public class class_name { @Override public EClass getIfcSlab() { if (ifcSlabEClass == null) { ifcSlabEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers() .get(602); } return ifcSlabEClass; } }
public class class_name { @Override public EClass getIfcSlab() { if (ifcSlabEClass == null) { ifcSlabEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers() .get(602); // depends on control dependency: [if], data = [none] } return ifcSlabEClass; } }
public class class_name { public static NfsCreateMode fromValue(int value) { NfsCreateMode createMode = VALUES.get(value); if (createMode == null) { createMode = new NfsCreateMode(value); VALUES.put(value, createMode); } return createMode; } }
public class class_name { public static NfsCreateMode fromValue(int value) { NfsCreateMode createMode = VALUES.get(value); if (createMode == null) { createMode = new NfsCreateMode(value); // depends on control dependency: [if], data = [none] VALUES.put(value, createMode); // depends on control dependency: [if], data = [none] } return createMode; } }
public class class_name { public void decode(FacesContext context, UIComponent component) { if (context == null) { throw new NullPointerException("context"); } if (component == null) { throw new NullPointerException("component"); } // If a BehaviorRenderer is available for the specified behavior renderer type, this method delegates // to the BehaviorRenderer's decode() method. Otherwise, no decoding is performed. ClientBehaviorRenderer renderer = getRenderer(context); if (renderer != null) { renderer.decode(context, component, this); } } }
public class class_name { public void decode(FacesContext context, UIComponent component) { if (context == null) { throw new NullPointerException("context"); } if (component == null) { throw new NullPointerException("component"); } // If a BehaviorRenderer is available for the specified behavior renderer type, this method delegates // to the BehaviorRenderer's decode() method. Otherwise, no decoding is performed. ClientBehaviorRenderer renderer = getRenderer(context); if (renderer != null) { renderer.decode(context, component, this); // depends on control dependency: [if], data = [none] } } }
public class class_name { private static void buildMethod(ClassWriter cw, String className, Class<?> parentClass) { /* Build method */ MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, // public method DISTRIBUTE_METHOD_NAME, // name DISTRIBUTE_METHOD_DESC, // descriptor null, // signature (null means not generic) CollectionUtil.array(convert(NoSuchMethodException.class))); // exceptions (array of strings) // 开始方法区 mv.visitCode(); // 判断要调用那个方法,然后将动态调用转化为对应的本地调用 { List<Method> allMethod = ReflectUtil.getAllMethod(parentClass); Label next = new Label(); Label start = new Label(); for (Method method : allMethod) { // 只处理非静态的public方法和protected方法 if (Modifier.isStatic(method.getModifiers()) || (!AccessorUtil.isPublic(method) && !AccessorUtil.isProtected(method))) { continue; } createIf(mv, method, next, start, className, parentClass); start = next; next = new Label(); } // 结束位置标记 mv.visitLabel(start); mv.visitFrame(F_SAME, 0, null, 0, null); } // throw new NoSuchMethodException(String.format("method [%s:%s:%s] not found", owner, methodName, desc)); { // 默认抛出Error,不应该有这种情况 mv.visitTypeInsn(NEW, convert(NoSuchMethodException.class)); mv.visitInsn(DUP); mv.visitLdcInsn("method [%s:%s:%s] not found"); mv.visitInsn(ICONST_3); mv.visitTypeInsn(ANEWARRAY, convert(Object.class)); mv.visitInsn(DUP); mv.visitInsn(ICONST_0); mv.visitVarInsn(ALOAD, 1); mv.visitInsn(AASTORE); mv.visitInsn(DUP); mv.visitInsn(ICONST_1); mv.visitVarInsn(ALOAD, 2); mv.visitInsn(AASTORE); mv.visitInsn(DUP); mv.visitInsn(ICONST_2); mv.visitVarInsn(ALOAD, 3); mv.visitInsn(AASTORE); mv.visitMethodInsn(INVOKESTATIC, convert(String.class), MethodConst.FORMAT_METHOD.getName(), getMethodDesc(MethodConst.FORMAT_METHOD), false); mv.visitMethodInsn(INVOKESPECIAL, convert(NoSuchMethodException.class), INIT, getConstructorDesc(ERROR_CONSTRUCTOR), false); mv.visitInsn(ATHROW); mv.visitMaxs(0, 0); } mv.visitEnd(); } }
public class class_name { private static void buildMethod(ClassWriter cw, String className, Class<?> parentClass) { /* Build method */ MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, // public method DISTRIBUTE_METHOD_NAME, // name DISTRIBUTE_METHOD_DESC, // descriptor null, // signature (null means not generic) CollectionUtil.array(convert(NoSuchMethodException.class))); // exceptions (array of strings) // 开始方法区 mv.visitCode(); // 判断要调用那个方法,然后将动态调用转化为对应的本地调用 { List<Method> allMethod = ReflectUtil.getAllMethod(parentClass); Label next = new Label(); Label start = new Label(); for (Method method : allMethod) { // 只处理非静态的public方法和protected方法 if (Modifier.isStatic(method.getModifiers()) || (!AccessorUtil.isPublic(method) && !AccessorUtil.isProtected(method))) { continue; } createIf(mv, method, next, start, className, parentClass); // depends on control dependency: [for], data = [method] start = next; // depends on control dependency: [for], data = [none] next = new Label(); // depends on control dependency: [for], data = [none] } // 结束位置标记 mv.visitLabel(start); mv.visitFrame(F_SAME, 0, null, 0, null); } // throw new NoSuchMethodException(String.format("method [%s:%s:%s] not found", owner, methodName, desc)); { // 默认抛出Error,不应该有这种情况 mv.visitTypeInsn(NEW, convert(NoSuchMethodException.class)); mv.visitInsn(DUP); mv.visitLdcInsn("method [%s:%s:%s] not found"); mv.visitInsn(ICONST_3); mv.visitTypeInsn(ANEWARRAY, convert(Object.class)); mv.visitInsn(DUP); mv.visitInsn(ICONST_0); mv.visitVarInsn(ALOAD, 1); mv.visitInsn(AASTORE); mv.visitInsn(DUP); mv.visitInsn(ICONST_1); mv.visitVarInsn(ALOAD, 2); mv.visitInsn(AASTORE); mv.visitInsn(DUP); mv.visitInsn(ICONST_2); mv.visitVarInsn(ALOAD, 3); mv.visitInsn(AASTORE); mv.visitMethodInsn(INVOKESTATIC, convert(String.class), MethodConst.FORMAT_METHOD.getName(), getMethodDesc(MethodConst.FORMAT_METHOD), false); mv.visitMethodInsn(INVOKESPECIAL, convert(NoSuchMethodException.class), INIT, getConstructorDesc(ERROR_CONSTRUCTOR), false); mv.visitInsn(ATHROW); mv.visitMaxs(0, 0); } mv.visitEnd(); } }
public class class_name { protected void stopAndroidEmulator() throws MojoExecutionException { parseParameters(); final AndroidDebugBridge androidDebugBridge = initAndroidDebugBridge(); if ( androidDebugBridge.isConnected() ) { List<IDevice> devices = Arrays.asList( androidDebugBridge.getDevices() ); int numberOfDevices = devices.size(); getLog().info( "Found " + numberOfDevices + " devices connected with the Android Debug Bridge" ); for ( IDevice device : devices ) { if ( device.isEmulator() ) { if ( isExistingEmulator( device ) ) { stopEmulator( device ); } } else { getLog().info( "Skipping stop. Not an emulator. " + DeviceHelper.getDescriptiveName( device ) ); } } } } }
public class class_name { protected void stopAndroidEmulator() throws MojoExecutionException { parseParameters(); final AndroidDebugBridge androidDebugBridge = initAndroidDebugBridge(); if ( androidDebugBridge.isConnected() ) { List<IDevice> devices = Arrays.asList( androidDebugBridge.getDevices() ); int numberOfDevices = devices.size(); getLog().info( "Found " + numberOfDevices + " devices connected with the Android Debug Bridge" ); for ( IDevice device : devices ) { if ( device.isEmulator() ) { if ( isExistingEmulator( device ) ) { stopEmulator( device ); // depends on control dependency: [if], data = [none] } } else { getLog().info( "Skipping stop. Not an emulator. " + DeviceHelper.getDescriptiveName( device ) ); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public void reset() { if (isCommitted()) throw new IllegalStateException("Already committed"); try { ((HttpOutputStream)getOutputStream()).resetBuffer(); _status= __200_OK; _reason=null; super.reset(); setField(HttpFields.__Date,getRequest().getTimeStampStr()); if (!Version.isParanoid()) setField(HttpFields.__Server,Version.getDetail()); } catch(Exception e) { log.warn(LogSupport.EXCEPTION,e); throw new IllegalStateException(e.toString()); } } }
public class class_name { public void reset() { if (isCommitted()) throw new IllegalStateException("Already committed"); try { ((HttpOutputStream)getOutputStream()).resetBuffer(); // depends on control dependency: [try], data = [none] _status= __200_OK; // depends on control dependency: [try], data = [none] _reason=null; // depends on control dependency: [try], data = [none] super.reset(); // depends on control dependency: [try], data = [none] setField(HttpFields.__Date,getRequest().getTimeStampStr()); // depends on control dependency: [try], data = [none] if (!Version.isParanoid()) setField(HttpFields.__Server,Version.getDetail()); } catch(Exception e) { log.warn(LogSupport.EXCEPTION,e); throw new IllegalStateException(e.toString()); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.rte_crop_image); mImageView = (CropImageView) findViewById(R.id.image); Intent intent = getIntent(); Bundle extras = intent.getExtras(); if (extras != null) { if (extras.getString(CIRCLE_CROP) != null) { mImageView.setLayerType(View.LAYER_TYPE_SOFTWARE, null); mCircleCrop = true; mAspectX = 1; mAspectY = 1; } mImageSource = extras.getString(IMAGE_SOURCE_FILE); mBitmap = getBitmap(mImageSource); mImageDest = extras.getString(IMAGE_DESTINATION_FILE); if (mImageDest == null) { mImageDest = mImageSource; } mSaveUri = Uri.fromFile(new File(mImageDest)); if (extras.containsKey(ASPECT_X) && extras.get(ASPECT_X) instanceof Integer) { mAspectX = extras.getInt(ASPECT_X); } else { throw new IllegalArgumentException("aspect_x must be integer"); } if (extras.containsKey(ASPECT_Y) && extras.get(ASPECT_Y) instanceof Integer) { mAspectY = extras.getInt(ASPECT_Y); } else { throw new IllegalArgumentException("aspect_y must be integer"); } mOutputX = extras.getInt(OUTPUT_X); mOutputY = extras.getInt(OUTPUT_Y); mScale = extras.getBoolean(SCALE, true); mScaleUp = extras.getBoolean(SCALE_UP_IF_NEEDED, true); } if (mBitmap == null) { finish(); return; } startFaceDetection(); } }
public class class_name { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.rte_crop_image); mImageView = (CropImageView) findViewById(R.id.image); Intent intent = getIntent(); Bundle extras = intent.getExtras(); if (extras != null) { if (extras.getString(CIRCLE_CROP) != null) { mImageView.setLayerType(View.LAYER_TYPE_SOFTWARE, null); // depends on control dependency: [if], data = [null)] mCircleCrop = true; // depends on control dependency: [if], data = [none] mAspectX = 1; // depends on control dependency: [if], data = [none] mAspectY = 1; // depends on control dependency: [if], data = [none] } mImageSource = extras.getString(IMAGE_SOURCE_FILE); // depends on control dependency: [if], data = [none] mBitmap = getBitmap(mImageSource); // depends on control dependency: [if], data = [none] mImageDest = extras.getString(IMAGE_DESTINATION_FILE); // depends on control dependency: [if], data = [none] if (mImageDest == null) { mImageDest = mImageSource; // depends on control dependency: [if], data = [none] } mSaveUri = Uri.fromFile(new File(mImageDest)); // depends on control dependency: [if], data = [none] if (extras.containsKey(ASPECT_X) && extras.get(ASPECT_X) instanceof Integer) { mAspectX = extras.getInt(ASPECT_X); // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException("aspect_x must be integer"); } if (extras.containsKey(ASPECT_Y) && extras.get(ASPECT_Y) instanceof Integer) { mAspectY = extras.getInt(ASPECT_Y); // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException("aspect_y must be integer"); } mOutputX = extras.getInt(OUTPUT_X); // depends on control dependency: [if], data = [none] mOutputY = extras.getInt(OUTPUT_Y); // depends on control dependency: [if], data = [none] mScale = extras.getBoolean(SCALE, true); // depends on control dependency: [if], data = [none] mScaleUp = extras.getBoolean(SCALE_UP_IF_NEEDED, true); // depends on control dependency: [if], data = [none] } if (mBitmap == null) { finish(); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } startFaceDetection(); } }
public class class_name { public String[] getAttributesAsString(List<?> attributes) { Iterator<?> i = attributes.iterator(); StringBuffer res1 = new StringBuffer(512); StringBuffer res2 = new StringBuffer(512); while (i.hasNext()) { CmsAttributeComparison compare = (CmsAttributeComparison)i.next(); res1.append(key(compare.getName())).append(": ").append(compare.getVersion1()).append("\n"); res2.append(key(compare.getName())).append(": ").append(compare.getVersion2()).append("\n"); } return new String[] {res1.toString(), res2.toString()}; } }
public class class_name { public String[] getAttributesAsString(List<?> attributes) { Iterator<?> i = attributes.iterator(); StringBuffer res1 = new StringBuffer(512); StringBuffer res2 = new StringBuffer(512); while (i.hasNext()) { CmsAttributeComparison compare = (CmsAttributeComparison)i.next(); res1.append(key(compare.getName())).append(": ").append(compare.getVersion1()).append("\n"); // depends on control dependency: [while], data = [none] res2.append(key(compare.getName())).append(": ").append(compare.getVersion2()).append("\n"); // depends on control dependency: [while], data = [none] } return new String[] {res1.toString(), res2.toString()}; } }
public class class_name { public void acceptVisitor(CFG cfg, PathVisitor visitor) { if (getLength() > 0) { BasicBlock startBlock = cfg.lookupBlockByLabel(getBlockIdAt(0)); acceptVisitorStartingFromLocation(cfg, visitor, startBlock, startBlock.getFirstInstruction()); } } }
public class class_name { public void acceptVisitor(CFG cfg, PathVisitor visitor) { if (getLength() > 0) { BasicBlock startBlock = cfg.lookupBlockByLabel(getBlockIdAt(0)); acceptVisitorStartingFromLocation(cfg, visitor, startBlock, startBlock.getFirstInstruction()); // depends on control dependency: [if], data = [none] } } }
public class class_name { public com.google.protobuf.ByteString getMethodNameBytes() { java.lang.Object ref = methodName_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); methodName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } }
public class class_name { public com.google.protobuf.ByteString getMethodNameBytes() { java.lang.Object ref = methodName_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); methodName_ = b; // depends on control dependency: [if], data = [none] return b; // depends on control dependency: [if], data = [none] } else { return (com.google.protobuf.ByteString) ref; // depends on control dependency: [if], data = [none] } } }
public class class_name { private void findReferenced(ClassDocImpl containingClass) { if (where.length() > 0) { if (containingClass != null) { referencedClass = containingClass.findClass(where); } else { referencedClass = docenv().lookupClass(where); } if (referencedClass == null && holder() instanceof ProgramElementDoc) { referencedClass = docenv().lookupClass( ((ProgramElementDoc) holder()).containingPackage().name() + "." + where); } if (referencedClass == null) { /* may just not be in this run */ // check if it's a package name referencedPackage = docenv().lookupPackage(where); return; } } else { if (containingClass == null) { docenv().warning(holder, "tag.see.class_not_specified", name, text); return; } else { referencedClass = containingClass; } } where = referencedClass.qualifiedName(); if (what == null) { return; } else { int paren = what.indexOf('('); String memName = (paren >= 0 ? what.substring(0, paren) : what); String[] paramarr; if (paren > 0) { // has parameter list -- should be method or constructor paramarr = new ParameterParseMachine(what. substring(paren, what.length())).parseParameters(); if (paramarr != null) { referencedMember = findExecutableMember(memName, paramarr, referencedClass); } else { referencedMember = null; } } else { // no parameter list -- should be field referencedMember = findExecutableMember(memName, null, referencedClass); FieldDoc fd = ((ClassDocImpl)referencedClass). findField(memName); // when no args given, prefer fields over methods if (referencedMember == null || (fd != null && fd.containingClass() .subclassOf(referencedMember.containingClass()))) { referencedMember = fd; } } if (referencedMember == null) { docenv().warning(holder, "tag.see.can_not_find_member", name, what, where); } } } }
public class class_name { private void findReferenced(ClassDocImpl containingClass) { if (where.length() > 0) { if (containingClass != null) { referencedClass = containingClass.findClass(where); // depends on control dependency: [if], data = [none] } else { referencedClass = docenv().lookupClass(where); // depends on control dependency: [if], data = [none] } if (referencedClass == null && holder() instanceof ProgramElementDoc) { referencedClass = docenv().lookupClass( ((ProgramElementDoc) holder()).containingPackage().name() + "." + where); // depends on control dependency: [if], data = [none] } if (referencedClass == null) { /* may just not be in this run */ // check if it's a package name referencedPackage = docenv().lookupPackage(where); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } } else { if (containingClass == null) { docenv().warning(holder, "tag.see.class_not_specified", name, text); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } else { referencedClass = containingClass; // depends on control dependency: [if], data = [none] } } where = referencedClass.qualifiedName(); if (what == null) { return; // depends on control dependency: [if], data = [none] } else { int paren = what.indexOf('('); String memName = (paren >= 0 ? what.substring(0, paren) : what); String[] paramarr; if (paren > 0) { // has parameter list -- should be method or constructor paramarr = new ParameterParseMachine(what. substring(paren, what.length())).parseParameters(); // depends on control dependency: [if], data = [none] if (paramarr != null) { referencedMember = findExecutableMember(memName, paramarr, referencedClass); // depends on control dependency: [if], data = [none] } else { referencedMember = null; // depends on control dependency: [if], data = [none] } } else { // no parameter list -- should be field referencedMember = findExecutableMember(memName, null, referencedClass); // depends on control dependency: [if], data = [none] FieldDoc fd = ((ClassDocImpl)referencedClass). findField(memName); // when no args given, prefer fields over methods if (referencedMember == null || (fd != null && fd.containingClass() .subclassOf(referencedMember.containingClass()))) { referencedMember = fd; // depends on control dependency: [if], data = [none] } } if (referencedMember == null) { docenv().warning(holder, "tag.see.can_not_find_member", name, what, where); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public boolean asBoolean(Object value) { if (value == null) { return false; } if (value instanceof Boolean) { return (Boolean) value; } return true; } }
public class class_name { public boolean asBoolean(Object value) { if (value == null) { return false; // depends on control dependency: [if], data = [none] } if (value instanceof Boolean) { return (Boolean) value; // depends on control dependency: [if], data = [none] } return true; } }
public class class_name { public static <T, E> E reduce(final Iterable<T> iterable, final BiFunction<E, T, E> func, final E zeroElem) { E accum = zeroElem; for (T element : iterable) { accum = func.apply(accum, element); } return accum; } }
public class class_name { public static <T, E> E reduce(final Iterable<T> iterable, final BiFunction<E, T, E> func, final E zeroElem) { E accum = zeroElem; for (T element : iterable) { accum = func.apply(accum, element); // depends on control dependency: [for], data = [element] } return accum; } }
public class class_name { private static Tuple3<Set<Object>, Set<PathSpec>, Boolean> reduceIds(Tuple3<Set<Object>, Set<PathSpec>, Boolean> state, Request<?> request) { if (request instanceof GetRequest) { GetRequest<?> getRequest = (GetRequest<?>)request; state._1().add(getRequest.getObjectId()); return state; } else if (request instanceof BatchRequest) { BatchRequest<?> batchRequest = (BatchRequest<?>)request; state._1().addAll(batchRequest.getObjectIds()); return state; } else { throw unsupportedGetRequestType(request); } } }
public class class_name { private static Tuple3<Set<Object>, Set<PathSpec>, Boolean> reduceIds(Tuple3<Set<Object>, Set<PathSpec>, Boolean> state, Request<?> request) { if (request instanceof GetRequest) { GetRequest<?> getRequest = (GetRequest<?>)request; state._1().add(getRequest.getObjectId()); // depends on control dependency: [if], data = [none] return state; // depends on control dependency: [if], data = [none] } else if (request instanceof BatchRequest) { BatchRequest<?> batchRequest = (BatchRequest<?>)request; state._1().addAll(batchRequest.getObjectIds()); // depends on control dependency: [if], data = [none] return state; // depends on control dependency: [if], data = [none] } else { throw unsupportedGetRequestType(request); } } }
public class class_name { public static String filterHtmlAttributes(String value) { if (EscapingConventions.FilterHtmlAttributes.INSTANCE.getValueFilter().matcher(value).find()) { return value; } logger.log(Level.WARNING, "|filterHtmlAttributes received bad value ''{0}''", value); return EscapingConventions.FilterHtmlAttributes.INSTANCE.getInnocuousOutput(); } }
public class class_name { public static String filterHtmlAttributes(String value) { if (EscapingConventions.FilterHtmlAttributes.INSTANCE.getValueFilter().matcher(value).find()) { return value; // depends on control dependency: [if], data = [none] } logger.log(Level.WARNING, "|filterHtmlAttributes received bad value ''{0}''", value); return EscapingConventions.FilterHtmlAttributes.INSTANCE.getInnocuousOutput(); } }
public class class_name { @SuppressWarnings("rawtypes") public org.grails.datastore.mapping.query.api.Criteria eq(String propertyName, Object propertyValue, Map params) { if (!validateSimpleExpression()) { throwRuntimeException(new IllegalArgumentException("Call to [eq] with propertyName [" + propertyName + "] and value [" + propertyValue + "] not allowed here.")); } propertyName = calculatePropertyName(propertyName); propertyValue = calculatePropertyValue(propertyValue); Criterion eq; if (propertyValue instanceof org.hibernate.criterion.DetachedCriteria) { eq = Property.forName(propertyName).eq((org.hibernate.criterion.DetachedCriteria) propertyValue); } else { eq = Restrictions.eq(propertyName, propertyValue); } if (params != null && (eq instanceof SimpleExpression)) { Object ignoreCase = params.get("ignoreCase"); if (ignoreCase instanceof Boolean && (Boolean)ignoreCase) { eq = ((SimpleExpression)eq).ignoreCase(); } } addToCriteria(eq); return this; } }
public class class_name { @SuppressWarnings("rawtypes") public org.grails.datastore.mapping.query.api.Criteria eq(String propertyName, Object propertyValue, Map params) { if (!validateSimpleExpression()) { throwRuntimeException(new IllegalArgumentException("Call to [eq] with propertyName [" + propertyName + "] and value [" + propertyValue + "] not allowed here.")); // depends on control dependency: [if], data = [none] } propertyName = calculatePropertyName(propertyName); propertyValue = calculatePropertyValue(propertyValue); Criterion eq; if (propertyValue instanceof org.hibernate.criterion.DetachedCriteria) { eq = Property.forName(propertyName).eq((org.hibernate.criterion.DetachedCriteria) propertyValue); // depends on control dependency: [if], data = [none] } else { eq = Restrictions.eq(propertyName, propertyValue); // depends on control dependency: [if], data = [none] } if (params != null && (eq instanceof SimpleExpression)) { Object ignoreCase = params.get("ignoreCase"); if (ignoreCase instanceof Boolean && (Boolean)ignoreCase) { eq = ((SimpleExpression)eq).ignoreCase(); // depends on control dependency: [if], data = [none] } } addToCriteria(eq); return this; } }
public class class_name { public static MethodUsage toMethodUsage(MethodCallExpr call, ResolvedMethodDeclaration methodDeclaration, TypeSolver typeSolver) { TypeInference typeInference = new TypeInference(typeSolver); Optional<InstantiationSet> instantiationSetOpt = typeInference.instantiationInference(call, methodDeclaration); if (instantiationSetOpt.isPresent()) { return instantiationSetToMethodUsage(methodDeclaration, instantiationSetOpt.get()); } else { throw new IllegalArgumentException(); } } }
public class class_name { public static MethodUsage toMethodUsage(MethodCallExpr call, ResolvedMethodDeclaration methodDeclaration, TypeSolver typeSolver) { TypeInference typeInference = new TypeInference(typeSolver); Optional<InstantiationSet> instantiationSetOpt = typeInference.instantiationInference(call, methodDeclaration); if (instantiationSetOpt.isPresent()) { return instantiationSetToMethodUsage(methodDeclaration, instantiationSetOpt.get()); // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException(); } } }
public class class_name { public void callASTVisitors(JavacAST ast, long priority) { for (VisitorContainer container : visitorHandlers) try { if (container.getPriority() == priority) ast.traverse(container.visitor); } catch (Throwable t) { javacError(String.format("Lombok visitor handler %s failed", container.visitor.getClass()), t); } } }
public class class_name { public void callASTVisitors(JavacAST ast, long priority) { for (VisitorContainer container : visitorHandlers) try { if (container.getPriority() == priority) ast.traverse(container.visitor); } catch (Throwable t) { javacError(String.format("Lombok visitor handler %s failed", container.visitor.getClass()), t); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public <T> Result<T> get(final Key<T> key) { assert !isExecuted(); SessionValue<T> sv = getSession().get(key); if (sv == null) { log.trace("Adding to round (session miss): {}", key); this.pending.add(key.getRaw()); Result<T> result = new ResultCache<T>() { @Override @SuppressWarnings("unchecked") public T nowUncached() { // Because clients could conceivably get() in the middle of our operations (see LoadCollectionRefsTest.specialListWorks()), // we need to check for early execution. This will perform poorly, but at least it will work. //assert Round.this.isExecuted(); loadEngine.execute(); return (T)translated.now().get(key); } @Override public String toString() { return "(Fetch result for " + key + ")"; } }; sv = new SessionValue<>(result, getLoadArrangement()); getSession().add(key, sv); } else { log.trace("Adding to round (session hit): {}", key); if (sv.loadWith(getLoadArrangement())) { log.trace("New load group arrangement, checking for upgrades: {}", getLoadArrangement()); // We are looking at a brand-new arrangement for something that already existed in the session. // We need to go through any Ref<?>s that might be in need of loading. We find those refs by // actually saving the entity into a custom SaveContext. T thing = sv.getResult().now(); if (thing != null) { SaveContext saveCtx = new SaveContext() { @Override public boolean skipLifecycle() { return true; } @Override public com.google.cloud.datastore.Key saveRef(Ref<?> value, LoadConditions loadConditions) { com.google.cloud.datastore.Key key = super.saveRef(value, loadConditions); if (loadEngine.shouldLoad(loadConditions)) { log.trace("Upgrading key {}", key); loadEngine.load(value.key()); } return key; } }; // We throw away the saved entity and we are done loadEngine.ofy.factory().getMetadataForEntity(thing).save(thing, saveCtx); } } } return sv.getResult(); } }
public class class_name { public <T> Result<T> get(final Key<T> key) { assert !isExecuted(); SessionValue<T> sv = getSession().get(key); if (sv == null) { log.trace("Adding to round (session miss): {}", key); // depends on control dependency: [if], data = [none] this.pending.add(key.getRaw()); // depends on control dependency: [if], data = [none] Result<T> result = new ResultCache<T>() { @Override @SuppressWarnings("unchecked") public T nowUncached() { // Because clients could conceivably get() in the middle of our operations (see LoadCollectionRefsTest.specialListWorks()), // we need to check for early execution. This will perform poorly, but at least it will work. //assert Round.this.isExecuted(); loadEngine.execute(); return (T)translated.now().get(key); } @Override public String toString() { return "(Fetch result for " + key + ")"; } }; sv = new SessionValue<>(result, getLoadArrangement()); // depends on control dependency: [if], data = [none] getSession().add(key, sv); // depends on control dependency: [if], data = [none] } else { log.trace("Adding to round (session hit): {}", key); // depends on control dependency: [if], data = [none] if (sv.loadWith(getLoadArrangement())) { log.trace("New load group arrangement, checking for upgrades: {}", getLoadArrangement()); // depends on control dependency: [if], data = [none] // We are looking at a brand-new arrangement for something that already existed in the session. // We need to go through any Ref<?>s that might be in need of loading. We find those refs by // actually saving the entity into a custom SaveContext. T thing = sv.getResult().now(); if (thing != null) { SaveContext saveCtx = new SaveContext() { @Override public boolean skipLifecycle() { return true; } @Override public com.google.cloud.datastore.Key saveRef(Ref<?> value, LoadConditions loadConditions) { com.google.cloud.datastore.Key key = super.saveRef(value, loadConditions); if (loadEngine.shouldLoad(loadConditions)) { log.trace("Upgrading key {}", key); // depends on control dependency: [if], data = [none] loadEngine.load(value.key()); // depends on control dependency: [if], data = [none] } return key; } }; // We throw away the saved entity and we are done loadEngine.ofy.factory().getMetadataForEntity(thing).save(thing, saveCtx); // depends on control dependency: [if], data = [(thing] } } } return sv.getResult(); } }
public class class_name { public static BufferedImage loadImage(File file){ try { BufferedImage bimg = ImageIO.read(file); if(bimg == null){ throw new ImageLoaderException("Could not load Image! ImageIO.read() returned null."); } return bimg; } catch (IOException e) { throw new ImageLoaderException(e); } } }
public class class_name { public static BufferedImage loadImage(File file){ try { BufferedImage bimg = ImageIO.read(file); if(bimg == null){ throw new ImageLoaderException("Could not load Image! ImageIO.read() returned null."); } return bimg; // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new ImageLoaderException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @SuppressWarnings("unchecked") public static void serialize(Output out, Field field, Method getter, Object object, Object value) { log.trace("serialize"); if (value instanceof IExternalizable) { // make sure all IExternalizable objects are serialized as objects out.writeObject(value); } else if (value instanceof ByteArray) { // write ByteArray objects directly out.writeByteArray((ByteArray) value); } else if (value instanceof Vector) { log.trace("Serialize Vector"); // scan the vector to determine the generic type Vector<?> vector = (Vector<?>) value; int ints = 0; int longs = 0; int dubs = 0; int nans = 0; for (Object o : vector) { if (o instanceof Integer) { ints++; } else if (o instanceof Long) { longs++; } else if (o instanceof Number || o instanceof Double) { dubs++; } else { nans++; } } // look at the type counts if (nans > 0) { // if we have non-number types, use object ((org.red5.io.amf3.Output) out).enforceAMF3(); out.writeVectorObject((Vector<Object>) value); } else if (dubs == 0 && longs == 0) { // no doubles or longs out.writeVectorInt((Vector<Integer>) value); } else if (dubs == 0 && ints == 0) { // no doubles or ints out.writeVectorUInt((Vector<Long>) value); } else { // handle any other types of numbers ((org.red5.io.amf3.Output) out).enforceAMF3(); out.writeVectorNumber((Vector<Double>) value); } } else { if (writeBasic(out, value)) { log.trace("Wrote as basic"); } else if (!writeComplex(out, value)) { log.trace("Unable to serialize: {}", value); } } } }
public class class_name { @SuppressWarnings("unchecked") public static void serialize(Output out, Field field, Method getter, Object object, Object value) { log.trace("serialize"); if (value instanceof IExternalizable) { // make sure all IExternalizable objects are serialized as objects out.writeObject(value); // depends on control dependency: [if], data = [none] } else if (value instanceof ByteArray) { // write ByteArray objects directly out.writeByteArray((ByteArray) value); // depends on control dependency: [if], data = [none] } else if (value instanceof Vector) { log.trace("Serialize Vector"); // depends on control dependency: [if], data = [none] // scan the vector to determine the generic type Vector<?> vector = (Vector<?>) value; int ints = 0; int longs = 0; int dubs = 0; int nans = 0; for (Object o : vector) { if (o instanceof Integer) { ints++; // depends on control dependency: [if], data = [none] } else if (o instanceof Long) { longs++; // depends on control dependency: [if], data = [none] } else if (o instanceof Number || o instanceof Double) { dubs++; // depends on control dependency: [if], data = [none] } else { nans++; // depends on control dependency: [if], data = [none] } } // look at the type counts if (nans > 0) { // if we have non-number types, use object ((org.red5.io.amf3.Output) out).enforceAMF3(); // depends on control dependency: [if], data = [none] out.writeVectorObject((Vector<Object>) value); // depends on control dependency: [if], data = [none] } else if (dubs == 0 && longs == 0) { // no doubles or longs out.writeVectorInt((Vector<Integer>) value); // depends on control dependency: [if], data = [none] } else if (dubs == 0 && ints == 0) { // no doubles or ints out.writeVectorUInt((Vector<Long>) value); // depends on control dependency: [if], data = [none] } else { // handle any other types of numbers ((org.red5.io.amf3.Output) out).enforceAMF3(); // depends on control dependency: [if], data = [none] out.writeVectorNumber((Vector<Double>) value); // depends on control dependency: [if], data = [none] } } else { if (writeBasic(out, value)) { log.trace("Wrote as basic"); // depends on control dependency: [if], data = [none] } else if (!writeComplex(out, value)) { log.trace("Unable to serialize: {}", value); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static ResourceResolutionComponent[] resolve(Object... resolutionParams) { ResourceResolutionComponent[] components = new ResourceResolutionComponent[resolutionParams.length]; for (int i = 0; i < resolutionParams.length; i++) { if (resolutionParams[i] == null) { components[i] = new StringResolutionComponent(""); } else if (resolutionParams[i] instanceof ResourceResolutionComponent) { components[i] = (ResourceResolutionComponent) resolutionParams[i]; } else if (resolutionParams[i] instanceof Locale) { components[i] = new LocaleResolutionComponent((Locale) resolutionParams[i]); } else if (resolutionParams[i] instanceof String) { components[i] = new StringResolutionComponent((String) resolutionParams[i]); } else if (resolutionParams[i] instanceof String[]) { components[i] = new StringResolutionComponent((String[]) resolutionParams[i]); } else { components[i] = new StringResolutionComponent(String.valueOf(resolutionParams[i])); } } return components; } }
public class class_name { public static ResourceResolutionComponent[] resolve(Object... resolutionParams) { ResourceResolutionComponent[] components = new ResourceResolutionComponent[resolutionParams.length]; for (int i = 0; i < resolutionParams.length; i++) { if (resolutionParams[i] == null) { components[i] = new StringResolutionComponent(""); // depends on control dependency: [if], data = [none] } else if (resolutionParams[i] instanceof ResourceResolutionComponent) { components[i] = (ResourceResolutionComponent) resolutionParams[i]; // depends on control dependency: [if], data = [none] } else if (resolutionParams[i] instanceof Locale) { components[i] = new LocaleResolutionComponent((Locale) resolutionParams[i]); // depends on control dependency: [if], data = [none] } else if (resolutionParams[i] instanceof String) { components[i] = new StringResolutionComponent((String) resolutionParams[i]); // depends on control dependency: [if], data = [none] } else if (resolutionParams[i] instanceof String[]) { components[i] = new StringResolutionComponent((String[]) resolutionParams[i]); // depends on control dependency: [if], data = [none] } else { components[i] = new StringResolutionComponent(String.valueOf(resolutionParams[i])); // depends on control dependency: [if], data = [none] } } return components; } }
public class class_name { public static String toFormattedString(LongArrayND array, String format) { if (array == null) { return "null"; } StringBuilder sb = new StringBuilder(); Iterable<MutableIntTuple> iterable = IntTupleIterables.lexicographicalIterable(array.getSize()); IntTuple previous = null; for (IntTuple coordinates : iterable) { if (previous != null) { int c = Utils.countDifferences(previous, coordinates); for (int i=0; i<c-1; i++) { sb.append("\n"); } } long value = array.get(coordinates); sb.append(String.format(format+", ", value)); previous = coordinates; } return sb.toString(); } }
public class class_name { public static String toFormattedString(LongArrayND array, String format) { if (array == null) { return "null"; // depends on control dependency: [if], data = [none] } StringBuilder sb = new StringBuilder(); Iterable<MutableIntTuple> iterable = IntTupleIterables.lexicographicalIterable(array.getSize()); IntTuple previous = null; for (IntTuple coordinates : iterable) { if (previous != null) { int c = Utils.countDifferences(previous, coordinates); for (int i=0; i<c-1; i++) { sb.append("\n"); // depends on control dependency: [for], data = [none] } } long value = array.get(coordinates); sb.append(String.format(format+", ", value)); // depends on control dependency: [for], data = [none] previous = coordinates; // depends on control dependency: [for], data = [coordinates] } return sb.toString(); } }
public class class_name { public void ReInit(java.io.InputStream stream, String encoding) { try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } token_source.ReInit(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 23; i++) jj_la1[i] = -1; } }
public class class_name { public void ReInit(java.io.InputStream stream, String encoding) { try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } // depends on control dependency: [try], data = [none] // depends on control dependency: [catch], data = [none] token_source.ReInit(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 23; i++) jj_la1[i] = -1; } }
public class class_name { private final void checkHeartbeat(boolean withCreateNewFile) throws LockFile.FileSecurityException, LockFile.LockHeldExternallyException, LockFile.UnexpectedEndOfFileException, LockFile.UnexpectedFileIOException, LockFile.UnexpectedFileNotFoundException, LockFile.WrongLengthException, LockFile.WrongMagicException { long now; long lastHeartbeat; long length = 0; try { if (withCreateNewFile) { try { file.createNewFile(); return; } catch (IOException ioe) {} } if (!file.exists()) { return; } length = file.length(); } catch (SecurityException se) { throw new FileSecurityException(this, "checkHeartbeat", se); } if (length != USED_REGION) { throw new WrongLengthException(this, "checkHeartbeat", length); } // Compute the current wall clock time *first* to reduce possibility // of unwanted time dilation effects introduced, for example, // by intervening thread or process context switches under CPU // bursts. // // Example: // // Say currentTimeMillis is actually somewhere in (-0.5 and 0.5] // and another LockFile concurrently writes a 0-valued heartbeat // timestamp. // // Then, if readHeartbeat comes first here, happens to 'win the race // condition' (reads the previous heartbeat: -10,000) and an intervening // switch causes greater than ~0.5 millisecond elapsed time to // be experienced between readHeartbeat and currentTimeMillis, then // currentTimeMillis will be computed as n (n > 0), and (now - // lastHearbeat) will be HEARTBEAT_INTERVAL + n, instead of // HEARTBEAT_INTERVAL. // // Now, let n be greater than (HEARTBEAT_INTERVAL_PADDED - // HEARTBEAT_INTERVAL). // // Then the check will succeed, although it should fail. // // On the other hand, if currentTimeMillis is computed first, the // worst than can happen is a false positive indication that // the read heartbeat timestamp value was written by a live LockFile // instance. // now = System.currentTimeMillis(); lastHeartbeat = readHeartbeat(); // Using padded interval to further reduce corner case effects, // now that heartbeat polling is in effect. // // Basically, it is absolutely essential to fail when a lock really is // still held elsewhere, so it is OK to fail on corner cases where // the last written heartbeat is very close to HEARTBEAT_INTERVAL // in the past and it is possible that timing jitters make it uncertain // whether the lock really is still held. if (Math.abs(now - lastHeartbeat) <= (HEARTBEAT_INTERVAL_PADDED)) { throw new LockHeldExternallyException(this, "checkHeartbeat", now, lastHeartbeat); } } }
public class class_name { private final void checkHeartbeat(boolean withCreateNewFile) throws LockFile.FileSecurityException, LockFile.LockHeldExternallyException, LockFile.UnexpectedEndOfFileException, LockFile.UnexpectedFileIOException, LockFile.UnexpectedFileNotFoundException, LockFile.WrongLengthException, LockFile.WrongMagicException { long now; long lastHeartbeat; long length = 0; try { if (withCreateNewFile) { try { file.createNewFile(); // depends on control dependency: [try], data = [none] return; // depends on control dependency: [try], data = [none] } catch (IOException ioe) {} // depends on control dependency: [catch], data = [none] } if (!file.exists()) { return; // depends on control dependency: [if], data = [none] } length = file.length(); } catch (SecurityException se) { throw new FileSecurityException(this, "checkHeartbeat", se); } if (length != USED_REGION) { throw new WrongLengthException(this, "checkHeartbeat", length); } // Compute the current wall clock time *first* to reduce possibility // of unwanted time dilation effects introduced, for example, // by intervening thread or process context switches under CPU // bursts. // // Example: // // Say currentTimeMillis is actually somewhere in (-0.5 and 0.5] // and another LockFile concurrently writes a 0-valued heartbeat // timestamp. // // Then, if readHeartbeat comes first here, happens to 'win the race // condition' (reads the previous heartbeat: -10,000) and an intervening // switch causes greater than ~0.5 millisecond elapsed time to // be experienced between readHeartbeat and currentTimeMillis, then // currentTimeMillis will be computed as n (n > 0), and (now - // lastHearbeat) will be HEARTBEAT_INTERVAL + n, instead of // HEARTBEAT_INTERVAL. // // Now, let n be greater than (HEARTBEAT_INTERVAL_PADDED - // HEARTBEAT_INTERVAL). // // Then the check will succeed, although it should fail. // // On the other hand, if currentTimeMillis is computed first, the // worst than can happen is a false positive indication that // the read heartbeat timestamp value was written by a live LockFile // instance. // now = System.currentTimeMillis(); lastHeartbeat = readHeartbeat(); // Using padded interval to further reduce corner case effects, // now that heartbeat polling is in effect. // // Basically, it is absolutely essential to fail when a lock really is // still held elsewhere, so it is OK to fail on corner cases where // the last written heartbeat is very close to HEARTBEAT_INTERVAL // in the past and it is possible that timing jitters make it uncertain // whether the lock really is still held. if (Math.abs(now - lastHeartbeat) <= (HEARTBEAT_INTERVAL_PADDED)) { throw new LockHeldExternallyException(this, "checkHeartbeat", now, lastHeartbeat); } } }
public class class_name { @Internal public static Method getRequiredInternalMethod(Class type, String name, Class... argumentTypes) { try { return type.getDeclaredMethod(name, argumentTypes); } catch (NoSuchMethodException e) { return findMethod(type, name, argumentTypes) .orElseThrow(() -> newNoSuchMethodInternalError(type, name, argumentTypes)); } } }
public class class_name { @Internal public static Method getRequiredInternalMethod(Class type, String name, Class... argumentTypes) { try { return type.getDeclaredMethod(name, argumentTypes); // depends on control dependency: [try], data = [none] } catch (NoSuchMethodException e) { return findMethod(type, name, argumentTypes) .orElseThrow(() -> newNoSuchMethodInternalError(type, name, argumentTypes)); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public void setMaxInactiveInterval(int maxInactiveInterval) { if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) { StringBuffer sb = new StringBuffer(newValueString).append(maxInactiveInterval).append(oldValueString).append(_maxInactiveInterval).append(appNameAndIdString); LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, "setMaxInactiveInterval", sb.toString()); } if (maxInactiveInterval <= 0) { _maxInactiveInterval = -1; } else { _maxInactiveInterval = maxInactiveInterval; } } }
public class class_name { @Override public void setMaxInactiveInterval(int maxInactiveInterval) { if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) { StringBuffer sb = new StringBuffer(newValueString).append(maxInactiveInterval).append(oldValueString).append(_maxInactiveInterval).append(appNameAndIdString); LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, "setMaxInactiveInterval", sb.toString()); // depends on control dependency: [if], data = [none] } if (maxInactiveInterval <= 0) { _maxInactiveInterval = -1; // depends on control dependency: [if], data = [none] } else { _maxInactiveInterval = maxInactiveInterval; // depends on control dependency: [if], data = [none] } } }
public class class_name { public void marshall(GetItemRequest getItemRequest, ProtocolMarshaller protocolMarshaller) { if (getItemRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getItemRequest.getTableName(), TABLENAME_BINDING); protocolMarshaller.marshall(getItemRequest.getKey(), KEY_BINDING); protocolMarshaller.marshall(getItemRequest.getAttributesToGet(), ATTRIBUTESTOGET_BINDING); protocolMarshaller.marshall(getItemRequest.getConsistentRead(), CONSISTENTREAD_BINDING); protocolMarshaller.marshall(getItemRequest.getReturnConsumedCapacity(), RETURNCONSUMEDCAPACITY_BINDING); protocolMarshaller.marshall(getItemRequest.getProjectionExpression(), PROJECTIONEXPRESSION_BINDING); protocolMarshaller.marshall(getItemRequest.getExpressionAttributeNames(), EXPRESSIONATTRIBUTENAMES_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(GetItemRequest getItemRequest, ProtocolMarshaller protocolMarshaller) { if (getItemRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getItemRequest.getTableName(), TABLENAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(getItemRequest.getKey(), KEY_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(getItemRequest.getAttributesToGet(), ATTRIBUTESTOGET_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(getItemRequest.getConsistentRead(), CONSISTENTREAD_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(getItemRequest.getReturnConsumedCapacity(), RETURNCONSUMEDCAPACITY_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(getItemRequest.getProjectionExpression(), PROJECTIONEXPRESSION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(getItemRequest.getExpressionAttributeNames(), EXPRESSIONATTRIBUTENAMES_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static InterleavedU8 extractInterleavedU8(BufferedImage img) { DataBuffer buffer = img.getRaster().getDataBuffer(); if (buffer.getDataType() == DataBuffer.TYPE_BYTE && isKnownByteFormat(img) ) { WritableRaster raster = img.getRaster(); InterleavedU8 ret = new InterleavedU8(); ret.width = img.getWidth(); ret.height = img.getHeight(); ret.startIndex = ConvertRaster.getOffset(raster); ret.imageType.numBands = raster.getNumBands(); ret.numBands = raster.getNumBands(); ret.stride = ConvertRaster.stride(raster); ret.data = ((DataBufferByte)buffer).getData(); ret.subImage = ret.startIndex != 0; return ret; } throw new IllegalArgumentException("Buffered image does not have an interleaved byte raster"); } }
public class class_name { public static InterleavedU8 extractInterleavedU8(BufferedImage img) { DataBuffer buffer = img.getRaster().getDataBuffer(); if (buffer.getDataType() == DataBuffer.TYPE_BYTE && isKnownByteFormat(img) ) { WritableRaster raster = img.getRaster(); InterleavedU8 ret = new InterleavedU8(); ret.width = img.getWidth(); // depends on control dependency: [if], data = [none] ret.height = img.getHeight(); // depends on control dependency: [if], data = [none] ret.startIndex = ConvertRaster.getOffset(raster); // depends on control dependency: [if], data = [none] ret.imageType.numBands = raster.getNumBands(); // depends on control dependency: [if], data = [none] ret.numBands = raster.getNumBands(); // depends on control dependency: [if], data = [none] ret.stride = ConvertRaster.stride(raster); // depends on control dependency: [if], data = [none] ret.data = ((DataBufferByte)buffer).getData(); // depends on control dependency: [if], data = [none] ret.subImage = ret.startIndex != 0; // depends on control dependency: [if], data = [none] return ret; // depends on control dependency: [if], data = [none] } throw new IllegalArgumentException("Buffered image does not have an interleaved byte raster"); } }
public class class_name { public static String adjustToRelativeDirectoryContext(final String path) { // Return nulls if (path == null) { return path; } // Strip absolute form final String removedPrefix = optionallyRemovePrecedingSlash(path); // Add end of context slash final String addedPostfix = optionallyAppendSlash(removedPrefix); // Return return addedPostfix; } }
public class class_name { public static String adjustToRelativeDirectoryContext(final String path) { // Return nulls if (path == null) { return path; // depends on control dependency: [if], data = [none] } // Strip absolute form final String removedPrefix = optionallyRemovePrecedingSlash(path); // Add end of context slash final String addedPostfix = optionallyAppendSlash(removedPrefix); // Return return addedPostfix; } }
public class class_name { public boolean maybeCommitTransaction(final JtxTransaction tx) { if (tx == null) { return false; } log.debug("commit tx"); tx.commit(); return true; } }
public class class_name { public boolean maybeCommitTransaction(final JtxTransaction tx) { if (tx == null) { return false; // depends on control dependency: [if], data = [none] } log.debug("commit tx"); tx.commit(); return true; } }
public class class_name { public String End(final boolean format) { if (this.openedStructCounter != 0) { throw new IllegalStateException("Detected unclosed structs: " + this.openedStructCounter); } final StringBuilder buffer = new StringBuilder(128); int structCounter = 0; for (final Item item : this.items) { switch (item.type) { case STRUCT: { doTabs(format, buffer, structCounter).append(item.name == null ? "" : item.name).append('{'); structCounter++; } break; case STRUCT_ARRAY: { doTabs(format, buffer, structCounter).append(item.name == null ? "" : item.name).append('[').append(item.sizeExpression).append(']').append('{'); structCounter++; } break; case UNDEFINED: { if (item instanceof ItemStructEnd) { final ItemStructEnd structEnd = (ItemStructEnd) item; if (structEnd.endAll) { while (structCounter > 0) { structCounter--; doTabs(format, buffer, structCounter).append('}'); if (structCounter > 0 && format) { buffer.append('\n'); } } } else { structCounter--; doTabs(format, buffer, structCounter).append('}'); } } else if (item instanceof ItemCustom) { doTabs(format, buffer, structCounter).append(item.toString()); } else if (item instanceof ItemAlign) { doTabs(format, buffer, structCounter).append("align").append(item.sizeExpression == null ? "" : ':' + item.makeExpressionForExtraField(item.sizeExpression)).append(';'); } else if (item instanceof ItemVal) { doTabs(format, buffer, structCounter).append("val").append(':').append(item.makeExpressionForExtraField(item.sizeExpression)).append(' ').append(item.name).append(';'); } else if (item instanceof ItemResetCounter) { doTabs(format, buffer, structCounter).append("reset$$;"); } else if (item instanceof ItemSkip) { doTabs(format, buffer, structCounter).append("skip").append(item.sizeExpression == null ? "" : ':' + item.makeExpressionForExtraField(item.sizeExpression)).append(';'); } else if (item instanceof ItemComment) { final ItemComment comment = (ItemComment) item; final String commentText = comment.getComment().replace("\n", " "); if (comment.isNewLine()) { if (buffer.length() > 0) { final int lastNewLine = buffer.lastIndexOf("\n"); if (lastNewLine < 0 || buffer.substring(lastNewLine + 1).length() != 0) { buffer.append('\n'); } } doTabs(format, buffer, structCounter).append("// ").append(commentText); } else { final String current = buffer.toString(); if (current.endsWith(";\n") || current.endsWith("}\n")) { buffer.setLength(buffer.length() - 1); } final int lastCommentIndex = buffer.lastIndexOf("//"); if (lastCommentIndex < 0) { buffer.append("// "); } else if (buffer.lastIndexOf("\n") > lastCommentIndex) { buffer.append("// "); } else { buffer.append(' '); } buffer.append(commentText); } } else { throw new IllegalArgumentException("Unexpected item : " + item.getClass().getName()); } } break; default: { doTabs(format, buffer, structCounter).append(item.toString()); } break; } if (format || item instanceof ItemComment) { buffer.append('\n'); } } return buffer.toString(); } }
public class class_name { public String End(final boolean format) { if (this.openedStructCounter != 0) { throw new IllegalStateException("Detected unclosed structs: " + this.openedStructCounter); } final StringBuilder buffer = new StringBuilder(128); int structCounter = 0; for (final Item item : this.items) { switch (item.type) { case STRUCT: { doTabs(format, buffer, structCounter).append(item.name == null ? "" : item.name).append('{'); structCounter++; } break; case STRUCT_ARRAY: { doTabs(format, buffer, structCounter).append(item.name == null ? "" : item.name).append('[').append(item.sizeExpression).append(']').append('{'); // depends on control dependency: [for], data = [item] structCounter++; // depends on control dependency: [for], data = [none] } break; case UNDEFINED: { if (item instanceof ItemStructEnd) { final ItemStructEnd structEnd = (ItemStructEnd) item; if (structEnd.endAll) { while (structCounter > 0) { structCounter--; // depends on control dependency: [while], data = [none] doTabs(format, buffer, structCounter).append('}'); // depends on control dependency: [while], data = [none] if (structCounter > 0 && format) { buffer.append('\n'); // depends on control dependency: [if], data = [none] } } } else { structCounter--; // depends on control dependency: [if], data = [none] doTabs(format, buffer, structCounter).append('}'); // depends on control dependency: [if], data = [none] } } else if (item instanceof ItemCustom) { doTabs(format, buffer, structCounter).append(item.toString()); } else if (item instanceof ItemAlign) { doTabs(format, buffer, structCounter).append("align").append(item.sizeExpression == null ? "" : ':' + item.makeExpressionForExtraField(item.sizeExpression)).append(';'); } else if (item instanceof ItemVal) { doTabs(format, buffer, structCounter).append("val").append(':').append(item.makeExpressionForExtraField(item.sizeExpression)).append(' ').append(item.name).append(';'); } else if (item instanceof ItemResetCounter) { doTabs(format, buffer, structCounter).append("reset$$;"); } else if (item instanceof ItemSkip) { doTabs(format, buffer, structCounter).append("skip").append(item.sizeExpression == null ? "" : ':' + item.makeExpressionForExtraField(item.sizeExpression)).append(';'); } else if (item instanceof ItemComment) { final ItemComment comment = (ItemComment) item; final String commentText = comment.getComment().replace("\n", " "); if (comment.isNewLine()) { if (buffer.length() > 0) { final int lastNewLine = buffer.lastIndexOf("\n"); if (lastNewLine < 0 || buffer.substring(lastNewLine + 1).length() != 0) { buffer.append('\n'); // depends on control dependency: [if], data = [none] } } doTabs(format, buffer, structCounter).append("// ").append(commentText); } else { final String current = buffer.toString(); if (current.endsWith(";\n") || current.endsWith("}\n")) { buffer.setLength(buffer.length() - 1); // depends on control dependency: [if], data = [none] } final int lastCommentIndex = buffer.lastIndexOf("//"); if (lastCommentIndex < 0) { buffer.append("// "); } else if (buffer.lastIndexOf("\n") > lastCommentIndex) { buffer.append("// "); } else { buffer.append(' '); } buffer.append(commentText); } } else { throw new IllegalArgumentException("Unexpected item : " + item.getClass().getName()); } } break; default: { doTabs(format, buffer, structCounter).append(item.toString()); } break; } if (format || item instanceof ItemComment) { buffer.append('\n'); } } return buffer.toString(); } }
public class class_name { public void setScriptsPermission(int event) { if (event == InstallProgressEvent.POST_INSTALL ? setScriptsPermission : getUninstallDirector().needToSetScriptsPermission()) { fireProgressEvent(event, 95, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("STATE_SET_SCRIPTS_PERMISSION")); try { SelfExtractUtils.fixScriptPermissions(new SelfExtractor.NullExtractProgress(), product.getInstallDir(), null); } catch (Exception e) { } } } }
public class class_name { public void setScriptsPermission(int event) { if (event == InstallProgressEvent.POST_INSTALL ? setScriptsPermission : getUninstallDirector().needToSetScriptsPermission()) { fireProgressEvent(event, 95, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("STATE_SET_SCRIPTS_PERMISSION")); // depends on control dependency: [if], data = [(event] try { SelfExtractUtils.fixScriptPermissions(new SelfExtractor.NullExtractProgress(), product.getInstallDir(), null); // depends on control dependency: [try], data = [none] } catch (Exception e) { } // depends on control dependency: [catch], data = [none] } } }
public class class_name { protected final void init() { if (inited) { return; } inited = true; if (texture != null) { width = texture.getImageWidth(); height = texture.getImageHeight(); textureOffsetX = 0; textureOffsetY = 0; textureWidth = texture.getWidth(); textureHeight = texture.getHeight(); } initImpl(); centerX = width / 2; centerY = height / 2; } }
public class class_name { protected final void init() { if (inited) { return; // depends on control dependency: [if], data = [none] } inited = true; if (texture != null) { width = texture.getImageWidth(); // depends on control dependency: [if], data = [none] height = texture.getImageHeight(); // depends on control dependency: [if], data = [none] textureOffsetX = 0; // depends on control dependency: [if], data = [none] textureOffsetY = 0; // depends on control dependency: [if], data = [none] textureWidth = texture.getWidth(); // depends on control dependency: [if], data = [none] textureHeight = texture.getHeight(); // depends on control dependency: [if], data = [none] } initImpl(); centerX = width / 2; centerY = height / 2; } }
public class class_name { public static synchronized NativePlatform getNativePlatform() { if (platform == null) { String platformFactoryProperty = AccessController.doPrivileged((PrivilegedAction<String>) () -> System.getProperty("monocle.platform", "MX6,OMAP,Dispman,Android,X11,Linux,Headless")); String[] platformFactories = platformFactoryProperty.split(","); for (int i = 0; i < platformFactories.length; i++) { String factoryName = platformFactories[i].trim(); String factoryClassName; if (factoryName.contains(".")) { factoryClassName = factoryName; } else { factoryClassName = "com.sun.glass.ui.monocle." + factoryName + "PlatformFactory"; } if (MonocleSettings.settings.tracePlatformConfig) { MonocleTrace.traceConfig("Trying platform %s with class %s", factoryName, factoryClassName); } try { final ClassLoader loader = NativePlatformFactory.class.getClassLoader(); final Class<?> clazz = Class.forName(factoryClassName, false, loader); if (!NativePlatformFactory.class.isAssignableFrom(clazz)) { throw new IllegalArgumentException("Unrecognized Monocle platform: " + factoryClassName); } NativePlatformFactory npf = (NativePlatformFactory) clazz.newInstance(); if (npf.matches() && npf.getMajorVersion() == majorVersion && npf.getMinorVersion() == minorVersion) { platform = npf.createNativePlatform(); if (MonocleSettings.settings.tracePlatformConfig) { MonocleTrace.traceConfig("Matched %s", factoryName); } return platform; } } catch (Exception e) { if (MonocleSettings.settings.tracePlatformConfig) { MonocleTrace.traceConfig("Failed to create platform %s", factoryClassName); } e.printStackTrace(); } } throw new UnsupportedOperationException( "Cannot load a native platform from: '" + platformFactoryProperty + "'"); } return platform; } }
public class class_name { public static synchronized NativePlatform getNativePlatform() { if (platform == null) { String platformFactoryProperty = AccessController.doPrivileged((PrivilegedAction<String>) () -> System.getProperty("monocle.platform", "MX6,OMAP,Dispman,Android,X11,Linux,Headless")); String[] platformFactories = platformFactoryProperty.split(","); for (int i = 0; i < platformFactories.length; i++) { String factoryName = platformFactories[i].trim(); String factoryClassName; if (factoryName.contains(".")) { factoryClassName = factoryName; // depends on control dependency: [if], data = [none] } else { factoryClassName = "com.sun.glass.ui.monocle." + factoryName + "PlatformFactory"; // depends on control dependency: [if], data = [none] } if (MonocleSettings.settings.tracePlatformConfig) { MonocleTrace.traceConfig("Trying platform %s with class %s", factoryName, factoryClassName); // depends on control dependency: [if], data = [none] } try { final ClassLoader loader = NativePlatformFactory.class.getClassLoader(); final Class<?> clazz = Class.forName(factoryClassName, false, loader); if (!NativePlatformFactory.class.isAssignableFrom(clazz)) { throw new IllegalArgumentException("Unrecognized Monocle platform: " + factoryClassName); } NativePlatformFactory npf = (NativePlatformFactory) clazz.newInstance(); if (npf.matches() && npf.getMajorVersion() == majorVersion && npf.getMinorVersion() == minorVersion) { platform = npf.createNativePlatform(); // depends on control dependency: [if], data = [none] if (MonocleSettings.settings.tracePlatformConfig) { MonocleTrace.traceConfig("Matched %s", factoryName); // depends on control dependency: [if], data = [none] } return platform; // depends on control dependency: [if], data = [none] } } catch (Exception e) { if (MonocleSettings.settings.tracePlatformConfig) { MonocleTrace.traceConfig("Failed to create platform %s", factoryClassName); // depends on control dependency: [if], data = [none] } e.printStackTrace(); } // depends on control dependency: [catch], data = [none] } throw new UnsupportedOperationException( "Cannot load a native platform from: '" + platformFactoryProperty + "'"); } return platform; } }
public class class_name { public static <T> T newInstance(Constructor<T> ctor, Object... params) { try { return ctor.newInstance(params); } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) { throw new RuntimeException(e); } } }
public class class_name { public static <T> T newInstance(Constructor<T> ctor, Object... params) { try { return ctor.newInstance(params); // depends on control dependency: [try], data = [none] } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) { throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected final void registClass(Class<? extends T> scriptClass,Class<?> ...depends) { if(scriptClass!=null) { boolean isAbstract=Modifier.isAbstract(scriptClass.getModifiers());//是否是抽象类 if(isAbstract) {//抽象类 _log.error("can't regist isAbstract class:"+scriptClass.getClass()); return ; }else { try { T script= scriptClass.newInstance(); int code=script.getMessageCode(); if(codeMap.containsKey(code)) {//如果已经存在相同code的脚步则不加载 _log.error("find Repeat code script,addingScript:"+script.getClass()+",existScript:"+codeMap.get(code)); }else { codeMap.put(code,scriptClass); _log.info("loaded codeScript,code="+code+"(0x"+Integer.toHexString(code)+"),class="+scriptClass); } } catch (Exception e) { _log.error("scriptClass error:"+scriptClass,e); } } //注册class文件方便热更新 String className=scriptClass.getName(); String[] parents=new String[depends.length]; for(int i=0;i<depends.length;i++) { Class<?> pt=depends[i]; parents[i]=pt.getName(); } registClass(className,parents); } } }
public class class_name { protected final void registClass(Class<? extends T> scriptClass,Class<?> ...depends) { if(scriptClass!=null) { boolean isAbstract=Modifier.isAbstract(scriptClass.getModifiers());//是否是抽象类 if(isAbstract) {//抽象类 _log.error("can't regist isAbstract class:"+scriptClass.getClass()); // depends on control dependency: [if], data = [none] return ; // depends on control dependency: [if], data = [none] }else { try { T script= scriptClass.newInstance(); int code=script.getMessageCode(); if(codeMap.containsKey(code)) {//如果已经存在相同code的脚步则不加载 _log.error("find Repeat code script,addingScript:"+script.getClass()+",existScript:"+codeMap.get(code)); // depends on control dependency: [if], data = [none] }else { codeMap.put(code,scriptClass); // depends on control dependency: [if], data = [none] _log.info("loaded codeScript,code="+code+"(0x"+Integer.toHexString(code)+"),class="+scriptClass); // depends on control dependency: [if], data = [none] } } catch (Exception e) { _log.error("scriptClass error:"+scriptClass,e); } // depends on control dependency: [catch], data = [none] } //注册class文件方便热更新 String className=scriptClass.getName(); String[] parents=new String[depends.length]; for(int i=0;i<depends.length;i++) { Class<?> pt=depends[i]; parents[i]=pt.getName(); } registClass(className,parents); // depends on control dependency: [if], data = [none] } } }
public class class_name { public Long getPosition() { Interval interval = getInterval(); if (interval != null) { return interval.getMinStart(); } else { return null; } } }
public class class_name { public Long getPosition() { Interval interval = getInterval(); if (interval != null) { return interval.getMinStart(); // depends on control dependency: [if], data = [none] } else { return null; // depends on control dependency: [if], data = [none] } } }
public class class_name { public void setActionTotalCount(String action, int count) { ArrayList<String> actions = getActions(); if (!actions.contains(action)) { actions.add(action); setActions(actions); } setInteger(KEY_TOTAL_BASE + action, count); } }
public class class_name { public void setActionTotalCount(String action, int count) { ArrayList<String> actions = getActions(); if (!actions.contains(action)) { actions.add(action); // depends on control dependency: [if], data = [none] setActions(actions); // depends on control dependency: [if], data = [none] } setInteger(KEY_TOTAL_BASE + action, count); } }
public class class_name { private void onOwnableType(Generic ownableType) { Generic ownerType = ownableType.getOwnerType(); if (ownerType != null && ownerType.getSort().isParameterized()) { onOwnableType(ownerType); signatureVisitor.visitInnerClassType(ownableType.asErasure().getSimpleName()); } else { signatureVisitor.visitClassType(ownableType.asErasure().getInternalName()); } for (Generic typeArgument : ownableType.getTypeArguments()) { typeArgument.accept(new OfTypeArgument(signatureVisitor)); } } }
public class class_name { private void onOwnableType(Generic ownableType) { Generic ownerType = ownableType.getOwnerType(); if (ownerType != null && ownerType.getSort().isParameterized()) { onOwnableType(ownerType); // depends on control dependency: [if], data = [(ownerType] signatureVisitor.visitInnerClassType(ownableType.asErasure().getSimpleName()); // depends on control dependency: [if], data = [none] } else { signatureVisitor.visitClassType(ownableType.asErasure().getInternalName()); // depends on control dependency: [if], data = [none] } for (Generic typeArgument : ownableType.getTypeArguments()) { typeArgument.accept(new OfTypeArgument(signatureVisitor)); // depends on control dependency: [for], data = [typeArgument] } } }
public class class_name { public void set(String[] attributeNames, Object[] values) { if (attributeNames == null || values == null || attributeNames.length != values.length) { throw new IllegalArgumentException("must pass non-null arrays of equal length"); } for (int i = 0; i < attributeNames.length; i++) { set(attributeNames[i], values[i]); } } }
public class class_name { public void set(String[] attributeNames, Object[] values) { if (attributeNames == null || values == null || attributeNames.length != values.length) { throw new IllegalArgumentException("must pass non-null arrays of equal length"); } for (int i = 0; i < attributeNames.length; i++) { set(attributeNames[i], values[i]); // depends on control dependency: [for], data = [i] } } }
public class class_name { public void marshall(GlacierJobDescription glacierJobDescription, ProtocolMarshaller protocolMarshaller) { if (glacierJobDescription == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(glacierJobDescription.getJobId(), JOBID_BINDING); protocolMarshaller.marshall(glacierJobDescription.getJobDescription(), JOBDESCRIPTION_BINDING); protocolMarshaller.marshall(glacierJobDescription.getAction(), ACTION_BINDING); protocolMarshaller.marshall(glacierJobDescription.getArchiveId(), ARCHIVEID_BINDING); protocolMarshaller.marshall(glacierJobDescription.getVaultARN(), VAULTARN_BINDING); protocolMarshaller.marshall(glacierJobDescription.getCreationDate(), CREATIONDATE_BINDING); protocolMarshaller.marshall(glacierJobDescription.getCompleted(), COMPLETED_BINDING); protocolMarshaller.marshall(glacierJobDescription.getStatusCode(), STATUSCODE_BINDING); protocolMarshaller.marshall(glacierJobDescription.getStatusMessage(), STATUSMESSAGE_BINDING); protocolMarshaller.marshall(glacierJobDescription.getArchiveSizeInBytes(), ARCHIVESIZEINBYTES_BINDING); protocolMarshaller.marshall(glacierJobDescription.getInventorySizeInBytes(), INVENTORYSIZEINBYTES_BINDING); protocolMarshaller.marshall(glacierJobDescription.getSNSTopic(), SNSTOPIC_BINDING); protocolMarshaller.marshall(glacierJobDescription.getCompletionDate(), COMPLETIONDATE_BINDING); protocolMarshaller.marshall(glacierJobDescription.getSHA256TreeHash(), SHA256TREEHASH_BINDING); protocolMarshaller.marshall(glacierJobDescription.getArchiveSHA256TreeHash(), ARCHIVESHA256TREEHASH_BINDING); protocolMarshaller.marshall(glacierJobDescription.getRetrievalByteRange(), RETRIEVALBYTERANGE_BINDING); protocolMarshaller.marshall(glacierJobDescription.getTier(), TIER_BINDING); protocolMarshaller.marshall(glacierJobDescription.getInventoryRetrievalParameters(), INVENTORYRETRIEVALPARAMETERS_BINDING); protocolMarshaller.marshall(glacierJobDescription.getJobOutputPath(), JOBOUTPUTPATH_BINDING); protocolMarshaller.marshall(glacierJobDescription.getSelectParameters(), SELECTPARAMETERS_BINDING); protocolMarshaller.marshall(glacierJobDescription.getOutputLocation(), OUTPUTLOCATION_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(GlacierJobDescription glacierJobDescription, ProtocolMarshaller protocolMarshaller) { if (glacierJobDescription == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(glacierJobDescription.getJobId(), JOBID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(glacierJobDescription.getJobDescription(), JOBDESCRIPTION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(glacierJobDescription.getAction(), ACTION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(glacierJobDescription.getArchiveId(), ARCHIVEID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(glacierJobDescription.getVaultARN(), VAULTARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(glacierJobDescription.getCreationDate(), CREATIONDATE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(glacierJobDescription.getCompleted(), COMPLETED_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(glacierJobDescription.getStatusCode(), STATUSCODE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(glacierJobDescription.getStatusMessage(), STATUSMESSAGE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(glacierJobDescription.getArchiveSizeInBytes(), ARCHIVESIZEINBYTES_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(glacierJobDescription.getInventorySizeInBytes(), INVENTORYSIZEINBYTES_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(glacierJobDescription.getSNSTopic(), SNSTOPIC_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(glacierJobDescription.getCompletionDate(), COMPLETIONDATE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(glacierJobDescription.getSHA256TreeHash(), SHA256TREEHASH_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(glacierJobDescription.getArchiveSHA256TreeHash(), ARCHIVESHA256TREEHASH_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(glacierJobDescription.getRetrievalByteRange(), RETRIEVALBYTERANGE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(glacierJobDescription.getTier(), TIER_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(glacierJobDescription.getInventoryRetrievalParameters(), INVENTORYRETRIEVALPARAMETERS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(glacierJobDescription.getJobOutputPath(), JOBOUTPUTPATH_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(glacierJobDescription.getSelectParameters(), SELECTPARAMETERS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(glacierJobDescription.getOutputLocation(), OUTPUTLOCATION_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 HttpUriBuilder replacePath(String path) { requireNonNull(path, "path is null"); if (!path.isEmpty() && !path.startsWith("/")) { path = "/" + path; } this.path = path; return this; } }
public class class_name { public HttpUriBuilder replacePath(String path) { requireNonNull(path, "path is null"); if (!path.isEmpty() && !path.startsWith("/")) { path = "/" + path; // depends on control dependency: [if], data = [none] } this.path = path; return this; } }
public class class_name { public Result compile(String[] argv, Context context) { if (stdOut != null) { context.put(Log.outKey, stdOut); } if (stdErr != null) { context.put(Log.errKey, stdErr); } log = Log.instance(context); if (argv.length == 0) { OptionHelper h = new OptionHelper.GrumpyHelper(log) { @Override public String getOwnName() { return ownName; } @Override public void put(String name, String value) { } }; try { Option.HELP.process(h, "-help"); } catch (Option.InvalidValueException ignore) { } return Result.CMDERR; } // prefix argv with contents of environment variable and expand @-files try { argv = CommandLine.parse(ENV_OPT_NAME, argv); } catch (UnmatchedQuote ex) { error("err.unmatched.quote", ex.variableName); return Result.CMDERR; } catch (FileNotFoundException | NoSuchFileException e) { warning("err.file.not.found", e.getMessage()); return Result.SYSERR; } catch (IOException ex) { log.printLines(PrefixKind.JAVAC, "msg.io"); ex.printStackTrace(log.getWriter(WriterKind.NOTICE)); return Result.SYSERR; } Arguments args = Arguments.instance(context); args.init(ownName, argv); if (log.nerrors > 0) return Result.CMDERR; Options options = Options.instance(context); // init Log boolean forceStdOut = options.isSet("stdout"); if (forceStdOut) { log.flush(); log.setWriters(new PrintWriter(System.out, true)); } // init CacheFSInfo // allow System property in following line as a Mustang legacy boolean batchMode = (options.isUnset("nonBatchMode") && System.getProperty("nonBatchMode") == null); if (batchMode) CacheFSInfo.preRegister(context); boolean ok = true; // init file manager fileManager = context.get(JavaFileManager.class); if (fileManager instanceof BaseFileManager) { ((BaseFileManager) fileManager).setContext(context); // reinit with options ok &= ((BaseFileManager) fileManager).handleOptions(args.getDeferredFileManagerOptions()); } // handle this here so it works even if no other options given String showClass = options.get("showClass"); if (showClass != null) { if (showClass.equals("showClass")) // no value given for option showClass = "com.sun.tools.javac.Main"; showClass(showClass); } ok &= args.validate(); if (!ok || log.nerrors > 0) return Result.CMDERR; if (args.isEmpty()) return Result.OK; // init Dependencies if (options.isSet("debug.completionDeps")) { Dependencies.GraphDependencies.preRegister(context); } // init plugins Set<List<String>> pluginOpts = args.getPluginOpts(); if (!pluginOpts.isEmpty() || context.get(PlatformDescription.class) != null) { BasicJavacTask t = (BasicJavacTask) BasicJavacTask.instance(context); t.initPlugins(pluginOpts); } // init multi-release jar handling if (fileManager.isSupportedOption(Option.MULTIRELEASE.primaryName) == 1) { Target target = Target.instance(context); List<String> list = List.of(target.multiReleaseValue()); fileManager.handleOption(Option.MULTIRELEASE.primaryName, list.iterator()); } // init JavaCompiler JavaCompiler comp = JavaCompiler.instance(context); // init doclint List<String> docLintOpts = args.getDocLintOpts(); if (!docLintOpts.isEmpty()) { BasicJavacTask t = (BasicJavacTask) BasicJavacTask.instance(context); t.initDocLint(docLintOpts); } if (options.get(Option.XSTDOUT) != null) { // Stdout reassigned - ask compiler to close it when it is done comp.closeables = comp.closeables.prepend(log.getWriter(WriterKind.NOTICE)); } try { comp.compile(args.getFileObjects(), args.getClassNames(), null, List.nil()); if (log.expectDiagKeys != null) { if (log.expectDiagKeys.isEmpty()) { log.printRawLines("all expected diagnostics found"); return Result.OK; } else { log.printRawLines("expected diagnostic keys not found: " + log.expectDiagKeys); return Result.ERROR; } } return (comp.errorCount() == 0) ? Result.OK : Result.ERROR; } catch (OutOfMemoryError | StackOverflowError ex) { resourceMessage(ex); return Result.SYSERR; } catch (FatalError ex) { feMessage(ex, options); return Result.SYSERR; } catch (AnnotationProcessingError ex) { apMessage(ex); return Result.SYSERR; } catch (PropagatedException ex) { // TODO: what about errors from plugins? should not simply rethrow the error here throw ex.getCause(); } catch (Throwable ex) { // Nasty. If we've already reported an error, compensate // for buggy compiler error recovery by swallowing thrown // exceptions. if (comp == null || comp.errorCount() == 0 || options.isSet("dev")) bugMessage(ex); return Result.ABNORMAL; } finally { if (comp != null) { try { comp.close(); } catch (ClientCodeException ex) { throw new RuntimeException(ex.getCause()); } } } } }
public class class_name { public Result compile(String[] argv, Context context) { if (stdOut != null) { context.put(Log.outKey, stdOut); // depends on control dependency: [if], data = [none] } if (stdErr != null) { context.put(Log.errKey, stdErr); // depends on control dependency: [if], data = [none] } log = Log.instance(context); if (argv.length == 0) { OptionHelper h = new OptionHelper.GrumpyHelper(log) { @Override public String getOwnName() { return ownName; } @Override public void put(String name, String value) { } }; try { Option.HELP.process(h, "-help"); // depends on control dependency: [try], data = [none] } catch (Option.InvalidValueException ignore) { } // depends on control dependency: [catch], data = [none] return Result.CMDERR; // depends on control dependency: [if], data = [none] } // prefix argv with contents of environment variable and expand @-files try { argv = CommandLine.parse(ENV_OPT_NAME, argv); // depends on control dependency: [try], data = [none] } catch (UnmatchedQuote ex) { error("err.unmatched.quote", ex.variableName); return Result.CMDERR; } catch (FileNotFoundException | NoSuchFileException e) { // depends on control dependency: [catch], data = [none] warning("err.file.not.found", e.getMessage()); return Result.SYSERR; } catch (IOException ex) { // depends on control dependency: [catch], data = [none] log.printLines(PrefixKind.JAVAC, "msg.io"); ex.printStackTrace(log.getWriter(WriterKind.NOTICE)); return Result.SYSERR; } // depends on control dependency: [catch], data = [none] Arguments args = Arguments.instance(context); args.init(ownName, argv); if (log.nerrors > 0) return Result.CMDERR; Options options = Options.instance(context); // init Log boolean forceStdOut = options.isSet("stdout"); if (forceStdOut) { log.flush(); // depends on control dependency: [if], data = [none] log.setWriters(new PrintWriter(System.out, true)); // depends on control dependency: [if], data = [none] } // init CacheFSInfo // allow System property in following line as a Mustang legacy boolean batchMode = (options.isUnset("nonBatchMode") && System.getProperty("nonBatchMode") == null); if (batchMode) CacheFSInfo.preRegister(context); boolean ok = true; // init file manager fileManager = context.get(JavaFileManager.class); if (fileManager instanceof BaseFileManager) { ((BaseFileManager) fileManager).setContext(context); // reinit with options // depends on control dependency: [if], data = [none] ok &= ((BaseFileManager) fileManager).handleOptions(args.getDeferredFileManagerOptions()); // depends on control dependency: [if], data = [none] } // handle this here so it works even if no other options given String showClass = options.get("showClass"); if (showClass != null) { if (showClass.equals("showClass")) // no value given for option showClass = "com.sun.tools.javac.Main"; showClass(showClass); // depends on control dependency: [if], data = [(showClass] } ok &= args.validate(); if (!ok || log.nerrors > 0) return Result.CMDERR; if (args.isEmpty()) return Result.OK; // init Dependencies if (options.isSet("debug.completionDeps")) { Dependencies.GraphDependencies.preRegister(context); } // init plugins Set<List<String>> pluginOpts = args.getPluginOpts(); if (!pluginOpts.isEmpty() || context.get(PlatformDescription.class) != null) { BasicJavacTask t = (BasicJavacTask) BasicJavacTask.instance(context); t.initPlugins(pluginOpts); } // init multi-release jar handling if (fileManager.isSupportedOption(Option.MULTIRELEASE.primaryName) == 1) { Target target = Target.instance(context); List<String> list = List.of(target.multiReleaseValue()); fileManager.handleOption(Option.MULTIRELEASE.primaryName, list.iterator()); } // init JavaCompiler JavaCompiler comp = JavaCompiler.instance(context); // init doclint List<String> docLintOpts = args.getDocLintOpts(); if (!docLintOpts.isEmpty()) { BasicJavacTask t = (BasicJavacTask) BasicJavacTask.instance(context); t.initDocLint(docLintOpts); } if (options.get(Option.XSTDOUT) != null) { // Stdout reassigned - ask compiler to close it when it is done comp.closeables = comp.closeables.prepend(log.getWriter(WriterKind.NOTICE)); } try { comp.compile(args.getFileObjects(), args.getClassNames(), null, List.nil()); if (log.expectDiagKeys != null) { if (log.expectDiagKeys.isEmpty()) { log.printRawLines("all expected diagnostics found"); return Result.OK; } else { log.printRawLines("expected diagnostic keys not found: " + log.expectDiagKeys); return Result.ERROR; } } return (comp.errorCount() == 0) ? Result.OK : Result.ERROR; } catch (OutOfMemoryError | StackOverflowError ex) { resourceMessage(ex); return Result.SYSERR; } catch (FatalError ex) { feMessage(ex, options); return Result.SYSERR; } catch (AnnotationProcessingError ex) { apMessage(ex); return Result.SYSERR; } catch (PropagatedException ex) { // TODO: what about errors from plugins? should not simply rethrow the error here throw ex.getCause(); } catch (Throwable ex) { // Nasty. If we've already reported an error, compensate // for buggy compiler error recovery by swallowing thrown // exceptions. if (comp == null || comp.errorCount() == 0 || options.isSet("dev")) bugMessage(ex); return Result.ABNORMAL; } finally { if (comp != null) { try { comp.close(); } catch (ClientCodeException ex) { throw new RuntimeException(ex.getCause()); } } } } }
public class class_name { public <T> CalendarPeriodAssociative<T> MakeUpCalendarPeriodAssociative( List<Tree> trees, List<T> values, CalendarPeriodAssociative.AddFunction<T> addFunction ) { if( trees.size() != values.size() ) { assert false : "Calendar.MakeUpCalendarPeriodAssociative : trees and values should have the same size !"; return null; } int nbPeriod = trees.size(); if( nbPeriod == 0 ) return new CalendarPeriodAssociative<T>(); // get the first non empty period CalendarPeriodAssociative<T> res = null; int first = 0; do { Tree tree = trees.get( first ); T value = values.get( first ); // PeriodAssociative firstPeriodAndValue = periodsAndValues.get( // first ); // Tree tree = Parse( firstPeriodAndValue.getFrom() ); if( tree.getNbDays() == 0 ) { first++; if( first >= nbPeriod ) return new CalendarPeriodAssociative<T>(); continue; } CalendarPeriod flat = tree.getFlat(); res = new CalendarPeriodAssociative<T>(); res.Init( flat, value ); break; } while( true ); if( res == null ) return null; // no non-empty period for( int i = first + 1; i < nbPeriod; i++ ) { Tree tree = trees.get( i ); T value = values.get( i ); if( tree.getNbDays() == 0 ) { // echo "IGNORING N PERIOD $i (" . $periodsAndValues[$i][0] . // ") BECAUSE EMPTY<br>"; continue; } CalendarPeriod flat = tree.getFlat(); CalendarPeriodAssociative<T> assoc = new CalendarPeriodAssociative<T>(); assoc.Init( flat, value ); if( res.Add( assoc, addFunction ) == null ) return null; } return res; } }
public class class_name { public <T> CalendarPeriodAssociative<T> MakeUpCalendarPeriodAssociative( List<Tree> trees, List<T> values, CalendarPeriodAssociative.AddFunction<T> addFunction ) { if( trees.size() != values.size() ) { assert false : "Calendar.MakeUpCalendarPeriodAssociative : trees and values should have the same size !"; return null; // depends on control dependency: [if], data = [none] } int nbPeriod = trees.size(); if( nbPeriod == 0 ) return new CalendarPeriodAssociative<T>(); // get the first non empty period CalendarPeriodAssociative<T> res = null; int first = 0; do { Tree tree = trees.get( first ); T value = values.get( first ); // PeriodAssociative firstPeriodAndValue = periodsAndValues.get( // first ); // Tree tree = Parse( firstPeriodAndValue.getFrom() ); if( tree.getNbDays() == 0 ) { first++; // depends on control dependency: [if], data = [none] if( first >= nbPeriod ) return new CalendarPeriodAssociative<T>(); continue; } CalendarPeriod flat = tree.getFlat(); res = new CalendarPeriodAssociative<T>(); res.Init( flat, value ); break; } while( true ); if( res == null ) return null; // no non-empty period for( int i = first + 1; i < nbPeriod; i++ ) { Tree tree = trees.get( i ); T value = values.get( i ); if( tree.getNbDays() == 0 ) { // echo "IGNORING N PERIOD $i (" . $periodsAndValues[$i][0] . // ") BECAUSE EMPTY<br>"; continue; } CalendarPeriod flat = tree.getFlat(); CalendarPeriodAssociative<T> assoc = new CalendarPeriodAssociative<T>(); assoc.Init( flat, value ); // depends on control dependency: [for], data = [none] if( res.Add( assoc, addFunction ) == null ) return null; } return res; } }
public class class_name { public static boolean inAttributes(String attrName, Attributes attrs) { for (NamingEnumeration<String> neu = attrs.getIDs(); neu.hasMoreElements();) { String attrId = neu.nextElement(); if (attrId.equalsIgnoreCase(attrName)) { return true; } } return false; } }
public class class_name { public static boolean inAttributes(String attrName, Attributes attrs) { for (NamingEnumeration<String> neu = attrs.getIDs(); neu.hasMoreElements();) { String attrId = neu.nextElement(); if (attrId.equalsIgnoreCase(attrName)) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { public Map getVariables(String attribute) { Bindings binds = rslTree.getBindings(attribute); if (binds == null) return null; List values = binds.getValues(); Map map = new HashMap(); Iterator iter = values.iterator(); Binding binding; while( iter.hasNext() ) { binding = (Binding)iter.next(); map.put(binding.getName(), binding.getValue().getCompleteValue()); } return map; } }
public class class_name { public Map getVariables(String attribute) { Bindings binds = rslTree.getBindings(attribute); if (binds == null) return null; List values = binds.getValues(); Map map = new HashMap(); Iterator iter = values.iterator(); Binding binding; while( iter.hasNext() ) { binding = (Binding)iter.next(); // depends on control dependency: [while], data = [none] map.put(binding.getName(), binding.getValue().getCompleteValue()); // depends on control dependency: [while], data = [none] } return map; } }
public class class_name { public V get(Object key) { int hashCode = hash((key == null) ? NULL : key); HashEntry<K, V> entry = data[hashIndex(hashCode, data.length)]; // no // local // for // hash // index while (entry != null) { if (entry.hashCode == hashCode && isEqualKey(key, entry.key)) { return entry.getValue(); } entry = entry.next; } return null; } }
public class class_name { public V get(Object key) { int hashCode = hash((key == null) ? NULL : key); HashEntry<K, V> entry = data[hashIndex(hashCode, data.length)]; // no // local // for // hash // index while (entry != null) { if (entry.hashCode == hashCode && isEqualKey(key, entry.key)) { return entry.getValue(); // depends on control dependency: [if], data = [none] } entry = entry.next; // depends on control dependency: [while], data = [none] } return null; } }
public class class_name { private List<KafkaTopic> getFilteredTopics(SourceState state) { List<Pattern> blacklist = DatasetFilterUtils.getPatternList(state, TOPIC_BLACKLIST); List<Pattern> whitelist = DatasetFilterUtils.getPatternList(state, TOPIC_WHITELIST); List<KafkaTopic> topics = this.kafkaConsumerClient.get().getFilteredTopics(blacklist, whitelist); Optional<String> configStoreUri = ConfigStoreUtils.getConfigStoreUri(state.getProperties()); if (configStoreUri.isPresent()) { List<KafkaTopic> topicsFromConfigStore = ConfigStoreUtils .getTopicsFromConfigStore(state.getProperties(), configStoreUri.get(), this.kafkaConsumerClient.get()); return topics.stream().filter((KafkaTopic p) -> (topicsFromConfigStore.stream() .anyMatch((KafkaTopic q) -> q.getName().equalsIgnoreCase(p.getName())))).collect(toList()); } return topics; } }
public class class_name { private List<KafkaTopic> getFilteredTopics(SourceState state) { List<Pattern> blacklist = DatasetFilterUtils.getPatternList(state, TOPIC_BLACKLIST); List<Pattern> whitelist = DatasetFilterUtils.getPatternList(state, TOPIC_WHITELIST); List<KafkaTopic> topics = this.kafkaConsumerClient.get().getFilteredTopics(blacklist, whitelist); Optional<String> configStoreUri = ConfigStoreUtils.getConfigStoreUri(state.getProperties()); if (configStoreUri.isPresent()) { List<KafkaTopic> topicsFromConfigStore = ConfigStoreUtils .getTopicsFromConfigStore(state.getProperties(), configStoreUri.get(), this.kafkaConsumerClient.get()); return topics.stream().filter((KafkaTopic p) -> (topicsFromConfigStore.stream() .anyMatch((KafkaTopic q) -> q.getName().equalsIgnoreCase(p.getName())))).collect(toList()); // depends on control dependency: [if], data = [none] } return topics; } }
public class class_name { public static Number parseNumber( String value ) { // Try to parse as a number ... char c = value.charAt(0); if ((c >= '0' && c <= '9') || c == '.' || c == '-' || c == '+') { // It's definitely a number ... if (c == '0' && value.length() > 2) { // it might be a hex number that starts with '0x' char two = value.charAt(1); if (two == 'x' || two == 'X') { try { // Parse the remainder of the hex number ... return Integer.parseInt(value.substring(2), 16); } catch (NumberFormatException e) { // Ignore and continue ... } } } // Try parsing as a double ... try { if ((value.indexOf('.') > -1) || (value.indexOf('E') > -1) || (value.indexOf('e') > -1)) { return Double.parseDouble(value); } Long longObj = new Long(value); long longValue = longObj.longValue(); int intValue = longObj.intValue(); if (longValue == intValue) { // Then it's just an integer ... return new Integer(intValue); } return longObj; } catch (NumberFormatException e) { // ignore ... } } return null; } }
public class class_name { public static Number parseNumber( String value ) { // Try to parse as a number ... char c = value.charAt(0); if ((c >= '0' && c <= '9') || c == '.' || c == '-' || c == '+') { // It's definitely a number ... if (c == '0' && value.length() > 2) { // it might be a hex number that starts with '0x' char two = value.charAt(1); if (two == 'x' || two == 'X') { try { // Parse the remainder of the hex number ... return Integer.parseInt(value.substring(2), 16); // depends on control dependency: [try], data = [none] } catch (NumberFormatException e) { // Ignore and continue ... } // depends on control dependency: [catch], data = [none] } } // Try parsing as a double ... try { if ((value.indexOf('.') > -1) || (value.indexOf('E') > -1) || (value.indexOf('e') > -1)) { return Double.parseDouble(value); // depends on control dependency: [if], data = [none] } Long longObj = new Long(value); long longValue = longObj.longValue(); int intValue = longObj.intValue(); if (longValue == intValue) { // Then it's just an integer ... return new Integer(intValue); // depends on control dependency: [if], data = [intValue)] } return longObj; // depends on control dependency: [try], data = [none] } catch (NumberFormatException e) { // ignore ... } // depends on control dependency: [catch], data = [none] } return null; } }
public class class_name { public static boolean isExpression(String text) { if (text == null) { return false; } text = text.trim(); return text.startsWith("${") || text.startsWith("#{"); } }
public class class_name { public static boolean isExpression(String text) { if (text == null) { return false; // depends on control dependency: [if], data = [none] } text = text.trim(); return text.startsWith("${") || text.startsWith("#{"); } }
public class class_name { private JPanel getJPanel() { if (jPanel == null) { GridBagConstraints gridBagConstraints15 = new GridBagConstraints(); java.awt.GridBagConstraints gridBagConstraints13 = new GridBagConstraints(); javax.swing.JLabel jLabel2 = new JLabel(); java.awt.GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); java.awt.GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); jPanel = new JPanel(); jPanel.setLayout(new GridBagLayout()); jPanel.setPreferredSize(DisplayUtils.getScaledDimension(400,400)); jPanel.setMinimumSize(DisplayUtils.getScaledDimension(400,400)); gridBagConstraints2.gridx = 1; gridBagConstraints2.gridy = 5; gridBagConstraints2.insets = new java.awt.Insets(2,2,2,2); gridBagConstraints2.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints3.gridx = 2; gridBagConstraints3.gridy = 5; gridBagConstraints3.insets = new java.awt.Insets(2,2,2,10); gridBagConstraints3.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints13.gridx = 0; gridBagConstraints13.gridy = 5; gridBagConstraints13.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints13.weightx = 1.0D; gridBagConstraints13.insets = new java.awt.Insets(2,10,2,5); gridBagConstraints15.weightx = 1.0D; gridBagConstraints15.weighty = 1.0D; gridBagConstraints15.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints15.insets = new java.awt.Insets(2,2,2,2); gridBagConstraints15.gridwidth = 3; gridBagConstraints15.gridx = 0; gridBagConstraints15.gridy = 2; gridBagConstraints15.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints15.ipadx = 0; gridBagConstraints15.ipady = 10; jPanel.add(new ContextsSitesPanel(getTreeContext(), getTreeSite()), gridBagConstraints15); jPanel.add(jLabel2, gridBagConstraints13); jPanel.add(getCancelButton(), gridBagConstraints2); jPanel.add(getSelectButton(), gridBagConstraints3); } return jPanel; } }
public class class_name { private JPanel getJPanel() { if (jPanel == null) { GridBagConstraints gridBagConstraints15 = new GridBagConstraints(); java.awt.GridBagConstraints gridBagConstraints13 = new GridBagConstraints(); javax.swing.JLabel jLabel2 = new JLabel(); java.awt.GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); java.awt.GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); jPanel = new JPanel(); // depends on control dependency: [if], data = [none] jPanel.setLayout(new GridBagLayout()); // depends on control dependency: [if], data = [none] jPanel.setPreferredSize(DisplayUtils.getScaledDimension(400,400)); // depends on control dependency: [if], data = [none] jPanel.setMinimumSize(DisplayUtils.getScaledDimension(400,400)); // depends on control dependency: [if], data = [none] gridBagConstraints2.gridx = 1; // depends on control dependency: [if], data = [none] gridBagConstraints2.gridy = 5; // depends on control dependency: [if], data = [none] gridBagConstraints2.insets = new java.awt.Insets(2,2,2,2); // depends on control dependency: [if], data = [none] gridBagConstraints2.anchor = java.awt.GridBagConstraints.EAST; // depends on control dependency: [if], data = [none] gridBagConstraints3.gridx = 2; // depends on control dependency: [if], data = [none] gridBagConstraints3.gridy = 5; // depends on control dependency: [if], data = [none] gridBagConstraints3.insets = new java.awt.Insets(2,2,2,10); // depends on control dependency: [if], data = [none] gridBagConstraints3.anchor = java.awt.GridBagConstraints.EAST; // depends on control dependency: [if], data = [none] gridBagConstraints13.gridx = 0; // depends on control dependency: [if], data = [none] gridBagConstraints13.gridy = 5; // depends on control dependency: [if], data = [none] gridBagConstraints13.fill = java.awt.GridBagConstraints.HORIZONTAL; // depends on control dependency: [if], data = [none] gridBagConstraints13.weightx = 1.0D; // depends on control dependency: [if], data = [none] gridBagConstraints13.insets = new java.awt.Insets(2,10,2,5); // depends on control dependency: [if], data = [none] gridBagConstraints15.weightx = 1.0D; // depends on control dependency: [if], data = [none] gridBagConstraints15.weighty = 1.0D; // depends on control dependency: [if], data = [none] gridBagConstraints15.fill = java.awt.GridBagConstraints.BOTH; // depends on control dependency: [if], data = [none] gridBagConstraints15.insets = new java.awt.Insets(2,2,2,2); // depends on control dependency: [if], data = [none] gridBagConstraints15.gridwidth = 3; // depends on control dependency: [if], data = [none] gridBagConstraints15.gridx = 0; // depends on control dependency: [if], data = [none] gridBagConstraints15.gridy = 2; // depends on control dependency: [if], data = [none] gridBagConstraints15.anchor = java.awt.GridBagConstraints.NORTHWEST; // depends on control dependency: [if], data = [none] gridBagConstraints15.ipadx = 0; // depends on control dependency: [if], data = [none] gridBagConstraints15.ipady = 10; // depends on control dependency: [if], data = [none] jPanel.add(new ContextsSitesPanel(getTreeContext(), getTreeSite()), gridBagConstraints15); // depends on control dependency: [if], data = [none] jPanel.add(jLabel2, gridBagConstraints13); // depends on control dependency: [if], data = [none] jPanel.add(getCancelButton(), gridBagConstraints2); // depends on control dependency: [if], data = [none] jPanel.add(getSelectButton(), gridBagConstraints3); // depends on control dependency: [if], data = [none] } return jPanel; } }
public class class_name { public static PackedDecimal valueOf(String zahl) { String trimmed = StringUtils.trimToEmpty(zahl); if (StringUtils.isEmpty(trimmed)) { return EMPTY; } if ((trimmed.length() == 1 && Character.isDigit(trimmed.charAt(0)))) { return CACHE[Character.getNumericValue(trimmed.charAt(0))]; } else { return WEAK_CACHE.computeIfAbsent(zahl, PackedDecimal::new); } } }
public class class_name { public static PackedDecimal valueOf(String zahl) { String trimmed = StringUtils.trimToEmpty(zahl); if (StringUtils.isEmpty(trimmed)) { return EMPTY; // depends on control dependency: [if], data = [none] } if ((trimmed.length() == 1 && Character.isDigit(trimmed.charAt(0)))) { return CACHE[Character.getNumericValue(trimmed.charAt(0))]; // depends on control dependency: [if], data = [none] } else { return WEAK_CACHE.computeIfAbsent(zahl, PackedDecimal::new); // depends on control dependency: [if], data = [none] } } }