code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public Random getNewRandomInstance(long seed) { try { Random t = (Random) randomClass.newInstance(); if (t.getStatePointer() != null) { // TODO: attach this thing to deallocator // if it's stateless random - we just don't care then } t.setSeed(seed); return t; } catch (Exception e) { throw new RuntimeException(e); } } }
public class class_name { public Random getNewRandomInstance(long seed) { try { Random t = (Random) randomClass.newInstance(); if (t.getStatePointer() != null) { // TODO: attach this thing to deallocator // if it's stateless random - we just don't care then } t.setSeed(seed); // depends on control dependency: [try], data = [none] return t; // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public boolean compete(NamespaceSpecification other) { // if no wildcard for other then we check coverage if ("".equals(other.wildcard)) { return covers(other.ns); } // split the namespaces at wildcards String[] otherParts = split(other.ns, other.wildcard); // if the given namepsace specification does not use its wildcard // then we just look if the current namespace specification covers it if (otherParts.length == 1) { return covers(other.ns); } // if no wildcard for the current namespace specification if ("".equals(wildcard)) { return other.covers(ns); } // also for the current namespace specification String[] parts = split(ns, wildcard); // now check if the current namespace specification is just an URI if (parts.length == 1) { return other.covers(ns); } // now each namespace specification contains wildcards // suppose we have // ns = a1*a2*...*an // and // other.ns = b1*b2*...*bm // then we only need to check matchPrefix(a1, b1) and matchPrefix(an, bn) where // matchPrefix(a, b) means a starts with b or b starts with a. return matchPrefix(parts[0], otherParts[0]) && matchPrefix(parts[parts.length - 1], otherParts[otherParts.length - 1]); } }
public class class_name { public boolean compete(NamespaceSpecification other) { // if no wildcard for other then we check coverage if ("".equals(other.wildcard)) { return covers(other.ns); // depends on control dependency: [if], data = [none] } // split the namespaces at wildcards String[] otherParts = split(other.ns, other.wildcard); // if the given namepsace specification does not use its wildcard // then we just look if the current namespace specification covers it if (otherParts.length == 1) { return covers(other.ns); // depends on control dependency: [if], data = [none] } // if no wildcard for the current namespace specification if ("".equals(wildcard)) { return other.covers(ns); // depends on control dependency: [if], data = [none] } // also for the current namespace specification String[] parts = split(ns, wildcard); // now check if the current namespace specification is just an URI if (parts.length == 1) { return other.covers(ns); // depends on control dependency: [if], data = [none] } // now each namespace specification contains wildcards // suppose we have // ns = a1*a2*...*an // and // other.ns = b1*b2*...*bm // then we only need to check matchPrefix(a1, b1) and matchPrefix(an, bn) where // matchPrefix(a, b) means a starts with b or b starts with a. return matchPrefix(parts[0], otherParts[0]) && matchPrefix(parts[parts.length - 1], otherParts[otherParts.length - 1]); } }
public class class_name { public String getNormalisedContentTypeValue() { String contentType = getHeader(CONTENT_TYPE); if (contentType != null) { return contentType.toLowerCase(Locale.ROOT); } return null; } }
public class class_name { public String getNormalisedContentTypeValue() { String contentType = getHeader(CONTENT_TYPE); if (contentType != null) { return contentType.toLowerCase(Locale.ROOT); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { protected Content getPackage(PackageDoc pd, String profileName) { Content packageLinkContent; Content pkgLabel; if (pd.name().length() > 0) { pkgLabel = getPackageLabel(pd.name()); packageLinkContent = getHyperLink(pathString(pd, DocPaths.profilePackageFrame(profileName)), pkgLabel, "", "packageFrame"); } else { pkgLabel = new StringContent("<unnamed package>"); packageLinkContent = getHyperLink(DocPaths.PACKAGE_FRAME, pkgLabel, "", "packageFrame"); } Content li = HtmlTree.LI(packageLinkContent); return li; } }
public class class_name { protected Content getPackage(PackageDoc pd, String profileName) { Content packageLinkContent; Content pkgLabel; if (pd.name().length() > 0) { pkgLabel = getPackageLabel(pd.name()); // depends on control dependency: [if], data = [none] packageLinkContent = getHyperLink(pathString(pd, DocPaths.profilePackageFrame(profileName)), pkgLabel, "", "packageFrame"); // depends on control dependency: [if], data = [none] } else { pkgLabel = new StringContent("<unnamed package>"); // depends on control dependency: [if], data = [none] packageLinkContent = getHyperLink(DocPaths.PACKAGE_FRAME, pkgLabel, "", "packageFrame"); // depends on control dependency: [if], data = [none] } Content li = HtmlTree.LI(packageLinkContent); return li; } }
public class class_name { public FileIndexBuilder appendNextRecord(long recordSize) { checkIfDestroyed(); if (recordSize < 0) throw new IllegalArgumentException("Size cannot be negative."); if (currentRecord == step) { index.add(startingByte + currentByte); currentRecord = 0; } currentByte += recordSize; ++currentRecord; return this; } }
public class class_name { public FileIndexBuilder appendNextRecord(long recordSize) { checkIfDestroyed(); if (recordSize < 0) throw new IllegalArgumentException("Size cannot be negative."); if (currentRecord == step) { index.add(startingByte + currentByte); // depends on control dependency: [if], data = [none] currentRecord = 0; // depends on control dependency: [if], data = [none] } currentByte += recordSize; ++currentRecord; return this; } }
public class class_name { public void marshall(DeleteBaiduChannelRequest deleteBaiduChannelRequest, ProtocolMarshaller protocolMarshaller) { if (deleteBaiduChannelRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteBaiduChannelRequest.getApplicationId(), APPLICATIONID_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DeleteBaiduChannelRequest deleteBaiduChannelRequest, ProtocolMarshaller protocolMarshaller) { if (deleteBaiduChannelRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteBaiduChannelRequest.getApplicationId(), APPLICATIONID_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 { private RenditionMetadata getVirtualRendition(Set<RenditionMetadata> candidates, long destWidth, long destHeight, double destRatio) { // if ratio is defined get first rendition with matching ratio and same or bigger size if (destRatio > 0) { for (RenditionMetadata candidate : candidates) { if (candidate.matches(destWidth, destHeight, 0, 0, destRatio)) { return getVirtualRendition(candidate, destWidth, destHeight, destRatio); } } } // otherwise get first rendition which is same or bigger in width and height else { for (RenditionMetadata candidate : candidates) { if (candidate.matches(destWidth, destHeight, 0, 0, 0d)) { return getVirtualRendition(candidate, destWidth, destHeight, 0d); } } } // none found return null; } }
public class class_name { private RenditionMetadata getVirtualRendition(Set<RenditionMetadata> candidates, long destWidth, long destHeight, double destRatio) { // if ratio is defined get first rendition with matching ratio and same or bigger size if (destRatio > 0) { for (RenditionMetadata candidate : candidates) { if (candidate.matches(destWidth, destHeight, 0, 0, destRatio)) { return getVirtualRendition(candidate, destWidth, destHeight, destRatio); // depends on control dependency: [if], data = [none] } } } // otherwise get first rendition which is same or bigger in width and height else { for (RenditionMetadata candidate : candidates) { if (candidate.matches(destWidth, destHeight, 0, 0, 0d)) { return getVirtualRendition(candidate, destWidth, destHeight, 0d); // depends on control dependency: [if], data = [none] } } } // none found return null; } }
public class class_name { public void closeStaleConnections() { logger.debug("closeStaleConnections() count before expiring: {}", getConnectionCount()); Set<ConnectionKey> stale = getStaleConnectionKeys(); for (ConnectionKey connectionKey : stale) { connectionProvider.close(connectionKey); } logger.debug("closeStaleConnections() count after expiring: {}", getConnectionCount()); } }
public class class_name { public void closeStaleConnections() { logger.debug("closeStaleConnections() count before expiring: {}", getConnectionCount()); Set<ConnectionKey> stale = getStaleConnectionKeys(); for (ConnectionKey connectionKey : stale) { connectionProvider.close(connectionKey); // depends on control dependency: [for], data = [connectionKey] } logger.debug("closeStaleConnections() count after expiring: {}", getConnectionCount()); } }
public class class_name { protected void _generate(SarlScript script, IExtraLanguageGeneratorContext context) { if (script != null) { for (final XtendTypeDeclaration content : script.getXtendTypes()) { if (context.getCancelIndicator().isCanceled()) { return; } try { generate(content, context); } finally { context.clearData(); } } } } }
public class class_name { protected void _generate(SarlScript script, IExtraLanguageGeneratorContext context) { if (script != null) { for (final XtendTypeDeclaration content : script.getXtendTypes()) { if (context.getCancelIndicator().isCanceled()) { return; // depends on control dependency: [if], data = [none] } try { generate(content, context); // depends on control dependency: [try], data = [none] } finally { context.clearData(); } } } } }
public class class_name { protected final void addPropertyAlias(String alias, Class<?> type, String name) { Map<String, Property> typeMap = properties.get(type); if (typeMap == null) { typeMap = new HashMap<String, Property>(); properties.put(type, typeMap); } try { typeMap.put(alias, propertyUtils.getProperty(type, name)); } catch (IntrospectionException e) { throw new RuntimeException(e); } } }
public class class_name { protected final void addPropertyAlias(String alias, Class<?> type, String name) { Map<String, Property> typeMap = properties.get(type); if (typeMap == null) { typeMap = new HashMap<String, Property>(); // depends on control dependency: [if], data = [none] properties.put(type, typeMap); // depends on control dependency: [if], data = [none] } try { typeMap.put(alias, propertyUtils.getProperty(type, name)); // depends on control dependency: [try], data = [none] } catch (IntrospectionException e) { throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private Node createTryCatchFinally(Node tryBlock, Node catchBlocks, Node finallyBlock, int lineno) { boolean hasFinally = (finallyBlock != null) && (finallyBlock.getType() != Token.BLOCK || finallyBlock.hasChildren()); // short circuit if (tryBlock.getType() == Token.BLOCK && !tryBlock.hasChildren() && !hasFinally) { return tryBlock; } boolean hasCatch = catchBlocks.hasChildren(); // short circuit if (!hasFinally && !hasCatch) { // bc finally might be an empty block... return tryBlock; } Node handlerBlock = new Node(Token.LOCAL_BLOCK); Jump pn = new Jump(Token.TRY, tryBlock, lineno); pn.putProp(Node.LOCAL_BLOCK_PROP, handlerBlock); if (hasCatch) { // jump around catch code Node endCatch = Node.newTarget(); pn.addChildToBack(makeJump(Token.GOTO, endCatch)); // make a TARGET for the catch that the tcf node knows about Node catchTarget = Node.newTarget(); pn.target = catchTarget; // mark it pn.addChildToBack(catchTarget); // // Given // // try { // tryBlock; // } catch (e if condition1) { // something1; // ... // // } catch (e if conditionN) { // somethingN; // } catch (e) { // somethingDefault; // } // // rewrite as // // try { // tryBlock; // goto after_catch: // } catch (x) { // with (newCatchScope(e, x)) { // if (condition1) { // something1; // goto after_catch; // } // } // ... // with (newCatchScope(e, x)) { // if (conditionN) { // somethingN; // goto after_catch; // } // } // with (newCatchScope(e, x)) { // somethingDefault; // goto after_catch; // } // } // after_catch: // // If there is no default catch, then the last with block // arround "somethingDefault;" is replaced by "rethrow;" // It is assumed that catch handler generation will store // exeception object in handlerBlock register // Block with local for exception scope objects Node catchScopeBlock = new Node(Token.LOCAL_BLOCK); // expects catchblocks children to be (cond block) pairs. Node cb = catchBlocks.getFirstChild(); boolean hasDefault = false; int scopeIndex = 0; while (cb != null) { int catchLineNo = cb.getLineno(); Node name = cb.getFirstChild(); Node cond = name.getNext(); Node catchStatement = cond.getNext(); cb.removeChild(name); cb.removeChild(cond); cb.removeChild(catchStatement); // Add goto to the catch statement to jump out of catch // but prefix it with LEAVEWITH since try..catch produces // "with"code in order to limit the scope of the exception // object. catchStatement.addChildToBack(new Node(Token.LEAVEWITH)); catchStatement.addChildToBack(makeJump(Token.GOTO, endCatch)); // Create condition "if" when present Node condStmt; if (cond.getType() == Token.EMPTY) { condStmt = catchStatement; hasDefault = true; } else { condStmt = createIf(cond, catchStatement, null, catchLineNo); } // Generate code to create the scope object and store // it in catchScopeBlock register Node catchScope = new Node(Token.CATCH_SCOPE, name, createUseLocal(handlerBlock)); catchScope.putProp(Node.LOCAL_BLOCK_PROP, catchScopeBlock); catchScope.putIntProp(Node.CATCH_SCOPE_PROP, scopeIndex); catchScopeBlock.addChildToBack(catchScope); // Add with statement based on catch scope object catchScopeBlock.addChildToBack( createWith(createUseLocal(catchScopeBlock), condStmt, catchLineNo)); // move to next cb cb = cb.getNext(); ++scopeIndex; } pn.addChildToBack(catchScopeBlock); if (!hasDefault) { // Generate code to rethrow if no catch clause was executed Node rethrow = new Node(Token.RETHROW); rethrow.putProp(Node.LOCAL_BLOCK_PROP, handlerBlock); pn.addChildToBack(rethrow); } pn.addChildToBack(endCatch); } if (hasFinally) { Node finallyTarget = Node.newTarget(); pn.setFinally(finallyTarget); // add jsr finally to the try block pn.addChildToBack(makeJump(Token.JSR, finallyTarget)); // jump around finally code Node finallyEnd = Node.newTarget(); pn.addChildToBack(makeJump(Token.GOTO, finallyEnd)); pn.addChildToBack(finallyTarget); Node fBlock = new Node(Token.FINALLY, finallyBlock); fBlock.putProp(Node.LOCAL_BLOCK_PROP, handlerBlock); pn.addChildToBack(fBlock); pn.addChildToBack(finallyEnd); } handlerBlock.addChildToBack(pn); return handlerBlock; } }
public class class_name { private Node createTryCatchFinally(Node tryBlock, Node catchBlocks, Node finallyBlock, int lineno) { boolean hasFinally = (finallyBlock != null) && (finallyBlock.getType() != Token.BLOCK || finallyBlock.hasChildren()); // short circuit if (tryBlock.getType() == Token.BLOCK && !tryBlock.hasChildren() && !hasFinally) { return tryBlock; // depends on control dependency: [if], data = [none] } boolean hasCatch = catchBlocks.hasChildren(); // short circuit if (!hasFinally && !hasCatch) { // bc finally might be an empty block... return tryBlock; // depends on control dependency: [if], data = [none] } Node handlerBlock = new Node(Token.LOCAL_BLOCK); Jump pn = new Jump(Token.TRY, tryBlock, lineno); pn.putProp(Node.LOCAL_BLOCK_PROP, handlerBlock); if (hasCatch) { // jump around catch code Node endCatch = Node.newTarget(); pn.addChildToBack(makeJump(Token.GOTO, endCatch)); // depends on control dependency: [if], data = [none] // make a TARGET for the catch that the tcf node knows about Node catchTarget = Node.newTarget(); pn.target = catchTarget; // depends on control dependency: [if], data = [none] // mark it pn.addChildToBack(catchTarget); // depends on control dependency: [if], data = [none] // // Given // // try { // tryBlock; // } catch (e if condition1) { // something1; // ... // // } catch (e if conditionN) { // somethingN; // } catch (e) { // somethingDefault; // } // // rewrite as // // try { // tryBlock; // goto after_catch: // } catch (x) { // with (newCatchScope(e, x)) { // if (condition1) { // something1; // goto after_catch; // } // } // ... // with (newCatchScope(e, x)) { // if (conditionN) { // somethingN; // goto after_catch; // } // } // with (newCatchScope(e, x)) { // somethingDefault; // goto after_catch; // } // } // after_catch: // // If there is no default catch, then the last with block // arround "somethingDefault;" is replaced by "rethrow;" // It is assumed that catch handler generation will store // exeception object in handlerBlock register // Block with local for exception scope objects Node catchScopeBlock = new Node(Token.LOCAL_BLOCK); // expects catchblocks children to be (cond block) pairs. Node cb = catchBlocks.getFirstChild(); boolean hasDefault = false; int scopeIndex = 0; while (cb != null) { int catchLineNo = cb.getLineno(); Node name = cb.getFirstChild(); Node cond = name.getNext(); Node catchStatement = cond.getNext(); cb.removeChild(name); // depends on control dependency: [while], data = [none] cb.removeChild(cond); // depends on control dependency: [while], data = [none] cb.removeChild(catchStatement); // depends on control dependency: [while], data = [none] // Add goto to the catch statement to jump out of catch // but prefix it with LEAVEWITH since try..catch produces // "with"code in order to limit the scope of the exception // object. catchStatement.addChildToBack(new Node(Token.LEAVEWITH)); // depends on control dependency: [while], data = [none] catchStatement.addChildToBack(makeJump(Token.GOTO, endCatch)); // depends on control dependency: [while], data = [none] // Create condition "if" when present Node condStmt; if (cond.getType() == Token.EMPTY) { condStmt = catchStatement; // depends on control dependency: [if], data = [none] hasDefault = true; // depends on control dependency: [if], data = [none] } else { condStmt = createIf(cond, catchStatement, null, catchLineNo); // depends on control dependency: [if], data = [none] } // Generate code to create the scope object and store // it in catchScopeBlock register Node catchScope = new Node(Token.CATCH_SCOPE, name, createUseLocal(handlerBlock)); catchScope.putProp(Node.LOCAL_BLOCK_PROP, catchScopeBlock); // depends on control dependency: [while], data = [none] catchScope.putIntProp(Node.CATCH_SCOPE_PROP, scopeIndex); // depends on control dependency: [while], data = [none] catchScopeBlock.addChildToBack(catchScope); // depends on control dependency: [while], data = [none] // Add with statement based on catch scope object catchScopeBlock.addChildToBack( createWith(createUseLocal(catchScopeBlock), condStmt, catchLineNo)); // depends on control dependency: [while], data = [none] // move to next cb cb = cb.getNext(); // depends on control dependency: [while], data = [none] ++scopeIndex; // depends on control dependency: [while], data = [none] } pn.addChildToBack(catchScopeBlock); // depends on control dependency: [if], data = [none] if (!hasDefault) { // Generate code to rethrow if no catch clause was executed Node rethrow = new Node(Token.RETHROW); rethrow.putProp(Node.LOCAL_BLOCK_PROP, handlerBlock); // depends on control dependency: [if], data = [none] pn.addChildToBack(rethrow); // depends on control dependency: [if], data = [none] } pn.addChildToBack(endCatch); // depends on control dependency: [if], data = [none] } if (hasFinally) { Node finallyTarget = Node.newTarget(); pn.setFinally(finallyTarget); // depends on control dependency: [if], data = [none] // add jsr finally to the try block pn.addChildToBack(makeJump(Token.JSR, finallyTarget)); // depends on control dependency: [if], data = [none] // jump around finally code Node finallyEnd = Node.newTarget(); pn.addChildToBack(makeJump(Token.GOTO, finallyEnd)); // depends on control dependency: [if], data = [none] pn.addChildToBack(finallyTarget); // depends on control dependency: [if], data = [none] Node fBlock = new Node(Token.FINALLY, finallyBlock); fBlock.putProp(Node.LOCAL_BLOCK_PROP, handlerBlock); // depends on control dependency: [if], data = [none] pn.addChildToBack(fBlock); // depends on control dependency: [if], data = [none] pn.addChildToBack(finallyEnd); // depends on control dependency: [if], data = [none] } handlerBlock.addChildToBack(pn); return handlerBlock; } }
public class class_name { @SuppressWarnings("unchecked") @Override public V get(Object key) { LinkedHashMapSegment<K, V> seg = segmentFor(key.hashCode()); try { seg.lock.lock(); return mapEventListener.onGetEntry((K) key, seg.get(key)); } finally { seg.lock.unlock(); } } }
public class class_name { @SuppressWarnings("unchecked") @Override public V get(Object key) { LinkedHashMapSegment<K, V> seg = segmentFor(key.hashCode()); try { seg.lock.lock(); // depends on control dependency: [try], data = [none] return mapEventListener.onGetEntry((K) key, seg.get(key)); // depends on control dependency: [try], data = [none] } finally { seg.lock.unlock(); } } }
public class class_name { @Weight(value = Weight.Unit.VARIABLE, comment = "Depends on the current call stack depth") public static void checkPoint(@Nonnull final String timePointName) { final long time = System.currentTimeMillis(); final int stackDepth = ThreadUtils.stackDepth(); final List<TimeData> list = REGISTRY.get(); final Iterator<TimeData> iterator = list.iterator(); boolean detected = false; while (iterator.hasNext()) { final TimeData timeWatchItem = iterator.next(); if (timeWatchItem.isTimePoint() && timeWatchItem.getDetectedStackDepth() >= stackDepth && timePointName.equals(timeWatchItem.getAlertMessage())) { detected |= true; final long detectedDelay = time - timeWatchItem.getCreationTimeInMilliseconds(); try { timeWatchItem.getAlertListener().onTimeAlert(detectedDelay, timeWatchItem); } catch (Exception ex) { final UnexpectedProcessingError error = new UnexpectedProcessingError("Error during time point processing", ex); MetaErrorListeners.fireError(error.getMessage(), error); } finally { iterator.remove(); } } } if (!detected) { throw new IllegalStateException("Can't find time point [" + timePointName + ']'); } } }
public class class_name { @Weight(value = Weight.Unit.VARIABLE, comment = "Depends on the current call stack depth") public static void checkPoint(@Nonnull final String timePointName) { final long time = System.currentTimeMillis(); final int stackDepth = ThreadUtils.stackDepth(); final List<TimeData> list = REGISTRY.get(); final Iterator<TimeData> iterator = list.iterator(); boolean detected = false; while (iterator.hasNext()) { final TimeData timeWatchItem = iterator.next(); if (timeWatchItem.isTimePoint() && timeWatchItem.getDetectedStackDepth() >= stackDepth && timePointName.equals(timeWatchItem.getAlertMessage())) { detected |= true; // depends on control dependency: [if], data = [none] final long detectedDelay = time - timeWatchItem.getCreationTimeInMilliseconds(); try { timeWatchItem.getAlertListener().onTimeAlert(detectedDelay, timeWatchItem); // depends on control dependency: [try], data = [none] } catch (Exception ex) { final UnexpectedProcessingError error = new UnexpectedProcessingError("Error during time point processing", ex); MetaErrorListeners.fireError(error.getMessage(), error); } finally { // depends on control dependency: [catch], data = [none] iterator.remove(); } } } if (!detected) { throw new IllegalStateException("Can't find time point [" + timePointName + ']'); } } }
public class class_name { private void eatExpression() { List segments = new ArrayList(); eatSplicedRange(segments); list.add(segments); if (tokenizer.hasMoreTokens()) {// ∈ tokenizer.peekToken(0, TokenKind.COMMA); tokenizer.nextToken(); eatExpression(); } } }
public class class_name { private void eatExpression() { List segments = new ArrayList(); eatSplicedRange(segments); list.add(segments); if (tokenizer.hasMoreTokens()) {// ∈ tokenizer.peekToken(0, TokenKind.COMMA); // depends on control dependency: [if], data = [none] tokenizer.nextToken(); // depends on control dependency: [if], data = [none] eatExpression(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static Map<String, Method> getClassWriteMethods(Class<?> clazz) { Map<String, Method> writeMethods = classWriteMethods.get(clazz); if (writeMethods == null) { cacheReadWriteMethodsAndBoxField(clazz); return classWriteMethods.get(clazz); } else return writeMethods; } }
public class class_name { public static Map<String, Method> getClassWriteMethods(Class<?> clazz) { Map<String, Method> writeMethods = classWriteMethods.get(clazz); if (writeMethods == null) { cacheReadWriteMethodsAndBoxField(clazz); // depends on control dependency: [if], data = [none] return classWriteMethods.get(clazz); // depends on control dependency: [if], data = [none] } else return writeMethods; } }
public class class_name { @Override protected void doPerform() { if (isSourceDocumentRoot()) { getActions().contextClick().perform(); } else { getActions().contextClick(getFirstElement()).perform(); } } }
public class class_name { @Override protected void doPerform() { if (isSourceDocumentRoot()) { getActions().contextClick().perform(); // depends on control dependency: [if], data = [none] } else { getActions().contextClick(getFirstElement()).perform(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public String getTooltip() { final String key = "pm.field." + getEntity().getId() + "." + getId() + ".tooltip"; if (key == null) { return null; } final String message = getPm().message(key); if (key.equals(message)) { return null; } return message; } }
public class class_name { public String getTooltip() { final String key = "pm.field." + getEntity().getId() + "." + getId() + ".tooltip"; if (key == null) { return null; // depends on control dependency: [if], data = [none] } final String message = getPm().message(key); if (key.equals(message)) { return null; // depends on control dependency: [if], data = [none] } return message; } }
public class class_name { public static void main(String[] args) { try { SAXCLIParameters params = new SAXCLIParameters(); JCommander jct = new JCommander(params, args); if (0 == args.length) { jct.usage(); } else { // get params printed // StringBuffer sb = new StringBuffer(1024); sb.append("SAX CLI converter v.1").append(CR); sb.append("parameters:").append(CR); sb.append(" input file: ").append(SAXCLIParameters.IN_FILE).append(CR); sb.append(" output file: ").append(SAXCLIParameters.OUT_FILE).append(CR); sb.append(" SAX sliding window size: ").append(SAXCLIParameters.SAX_WINDOW_SIZE) .append(CR); sb.append(" SAX PAA size: ").append(SAXCLIParameters.SAX_PAA_SIZE) .append(CR); sb.append(" SAX alphabet size: ").append(SAXCLIParameters.SAX_ALPHABET_SIZE) .append(CR); sb.append(" SAX numerosity reduction: ").append(SAXCLIParameters.SAX_NR_STRATEGY) .append(CR); sb.append(" SAX normalization threshold: ").append(SAXCLIParameters.SAX_NORM_THRESHOLD) .append(CR); sb.append(" threads to use: ").append(SAXCLIParameters.THREADS_NUM) .append(CR); String dataFName = SAXCLIParameters.IN_FILE; double[] ts = TSProcessor.readFileColumn(dataFName, 0, 0); Integer slidingWindowSize = Integer.valueOf(SAXCLIParameters.SAX_WINDOW_SIZE); Integer paaSize = Integer.valueOf(SAXCLIParameters.SAX_PAA_SIZE); Integer alphabetSize = Integer.valueOf(SAXCLIParameters.SAX_ALPHABET_SIZE); NumerosityReductionStrategy nrStrategy = SAXCLIParameters.SAX_NR_STRATEGY; Double nThreshold = SAXCLIParameters.SAX_NORM_THRESHOLD; NormalAlphabet na = new NormalAlphabet(); SAXProcessor sp = new SAXProcessor(); Integer threadsNum = SAXCLIParameters.THREADS_NUM; SAXRecords res = null; if (threadsNum > 1) { ParallelSAXImplementation ps = new ParallelSAXImplementation(); res = ps.process(ts, threadsNum, slidingWindowSize, paaSize, alphabetSize, nrStrategy, nThreshold); } else { res = sp.ts2saxViaWindow(ts, slidingWindowSize, paaSize, na.getCuts(alphabetSize), nrStrategy, nThreshold); } ArrayList<Integer> indexes = new ArrayList<Integer>(); indexes.addAll(res.getIndexes()); Collections.sort(indexes); BufferedWriter bw = new BufferedWriter(new FileWriter(new File(SAXCLIParameters.OUT_FILE))); for (Integer idx : indexes) { bw.write(idx + COMMA + String.valueOf(res.getByIndex(idx).getPayload()) + CR); } bw.close(); } } catch (IOException | SAXException e) { System.err.println("error occured while parsing parameters " + Arrays.toString(args) + CR + StackTrace.toString(e)); System.exit(-1); } } }
public class class_name { public static void main(String[] args) { try { SAXCLIParameters params = new SAXCLIParameters(); JCommander jct = new JCommander(params, args); if (0 == args.length) { jct.usage(); // depends on control dependency: [if], data = [none] } else { // get params printed // StringBuffer sb = new StringBuffer(1024); sb.append("SAX CLI converter v.1").append(CR); // depends on control dependency: [if], data = [none] sb.append("parameters:").append(CR); // depends on control dependency: [if], data = [none] sb.append(" input file: ").append(SAXCLIParameters.IN_FILE).append(CR); // depends on control dependency: [if], data = [none] sb.append(" output file: ").append(SAXCLIParameters.OUT_FILE).append(CR); // depends on control dependency: [if], data = [none] sb.append(" SAX sliding window size: ").append(SAXCLIParameters.SAX_WINDOW_SIZE) .append(CR); // depends on control dependency: [if], data = [none] sb.append(" SAX PAA size: ").append(SAXCLIParameters.SAX_PAA_SIZE) .append(CR); // depends on control dependency: [if], data = [none] sb.append(" SAX alphabet size: ").append(SAXCLIParameters.SAX_ALPHABET_SIZE) .append(CR); // depends on control dependency: [if], data = [none] sb.append(" SAX numerosity reduction: ").append(SAXCLIParameters.SAX_NR_STRATEGY) .append(CR); // depends on control dependency: [if], data = [none] sb.append(" SAX normalization threshold: ").append(SAXCLIParameters.SAX_NORM_THRESHOLD) .append(CR); // depends on control dependency: [if], data = [none] sb.append(" threads to use: ").append(SAXCLIParameters.THREADS_NUM) .append(CR); // depends on control dependency: [if], data = [none] String dataFName = SAXCLIParameters.IN_FILE; double[] ts = TSProcessor.readFileColumn(dataFName, 0, 0); Integer slidingWindowSize = Integer.valueOf(SAXCLIParameters.SAX_WINDOW_SIZE); Integer paaSize = Integer.valueOf(SAXCLIParameters.SAX_PAA_SIZE); Integer alphabetSize = Integer.valueOf(SAXCLIParameters.SAX_ALPHABET_SIZE); NumerosityReductionStrategy nrStrategy = SAXCLIParameters.SAX_NR_STRATEGY; Double nThreshold = SAXCLIParameters.SAX_NORM_THRESHOLD; NormalAlphabet na = new NormalAlphabet(); SAXProcessor sp = new SAXProcessor(); Integer threadsNum = SAXCLIParameters.THREADS_NUM; SAXRecords res = null; if (threadsNum > 1) { ParallelSAXImplementation ps = new ParallelSAXImplementation(); res = ps.process(ts, threadsNum, slidingWindowSize, paaSize, alphabetSize, nrStrategy, nThreshold); // depends on control dependency: [if], data = [none] } else { res = sp.ts2saxViaWindow(ts, slidingWindowSize, paaSize, na.getCuts(alphabetSize), nrStrategy, nThreshold); // depends on control dependency: [if], data = [none] } ArrayList<Integer> indexes = new ArrayList<Integer>(); indexes.addAll(res.getIndexes()); // depends on control dependency: [if], data = [none] Collections.sort(indexes); // depends on control dependency: [if], data = [none] BufferedWriter bw = new BufferedWriter(new FileWriter(new File(SAXCLIParameters.OUT_FILE))); for (Integer idx : indexes) { bw.write(idx + COMMA + String.valueOf(res.getByIndex(idx).getPayload()) + CR); // depends on control dependency: [for], data = [idx] } bw.close(); // depends on control dependency: [if], data = [none] } } catch (IOException | SAXException e) { System.err.println("error occured while parsing parameters " + Arrays.toString(args) + CR + StackTrace.toString(e)); System.exit(-1); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public RequestDispatcher getErrorPageDispatcher(ServletRequest req, ServletErrorReport ser) { if (this.getDestroyed().booleanValue()) { // should be a fast boolean check. throw new MajorHandlingRuntimeException("WebContainer can not handle the request"); } String methodName = "getErrorPageDispatcher"; // Get and Set error request attributes. Integer errorCode = new Integer(ser.getErrorCode()); Class errorException = ser.getExceptionClass(); String errorMessage = ser.getMessage(); if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) { logger.logp(Level.FINE, CLASS_NAME, methodName, "Looking for defined Error Page!"); logger.logp(Level.FINE, CLASS_NAME, methodName, "Exception errorCode=" + errorCode); logger.logp(Level.FINE, CLASS_NAME, methodName, "Exception type=" + errorException); logger.logp(Level.FINE, CLASS_NAME, methodName, "Exception message=" + errorMessage); } // 114582 - begin - get down to the root servlet exception ServletException sx = (ServletException) ser; Throwable th = sx.getRootCause(); if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) { logger.logp(Level.FINE, CLASS_NAME, methodName, "Servlet Exception is: " + sx); logger.logp(Level.FINE, CLASS_NAME, methodName, "th (root cause) is: " + th); } // Defect 114582 - walk upwards to the root servlet exception. // Defect 114582 - test against ServletException if preV7; otherwise, test against ServletErrorReport. boolean isPreV7 = ((WCCustomProperties.ERROR_PAGE_COMPATIBILITY != null) && WCCustomProperties.ERROR_PAGE_COMPATIBILITY.equalsIgnoreCase("V6")); if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) { logger.logp(Level.FINE, CLASS_NAME, methodName, (isPreV7 ? "is PreV7" : "not PreV7")); } // Walk upwards while there is another servlet exception and a new root cause. // Defect 155880 - Don't shift upwards if the root cause is null. if (isPreV7) { while (th != null && th instanceof ServletException && ((ServletException) th).getRootCause() != null) { // defect sx = (ServletException) th; th = sx.getRootCause(); if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) { logger.logp(Level.FINE, CLASS_NAME, methodName, "unwrapping exceptions Servlet Exception is now: " + sx); logger.logp(Level.FINE, CLASS_NAME, methodName, "th (root cause) is now: " + th); } } } else { while (th != null && th instanceof ServletErrorReport && ((ServletErrorReport) th).getRootCause() != null) { sx = (ServletException) th; th = sx.getRootCause(); if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) { logger.logp(Level.FINE, CLASS_NAME, methodName, "unwrapping exceptions Servlet Exception is now: " + sx); logger.logp(Level.FINE, CLASS_NAME, methodName, "th (root cause) is now: " + th); } } } // 114582 - only set exception type if root exception is not null if (th != null) { req.setAttribute("javax.servlet.error.exception", th); if (errorException != null) { req.setAttribute("javax.servlet.error.exception_type", errorException); } } if (errorMessage != null) { req.setAttribute("javax.servlet.error.message", errorMessage); } // add the request uri to the request object HttpServletRequest httpServletReq = (HttpServletRequest) ServletUtil.unwrapRequest(req, HttpServletRequest.class); req.setAttribute("javax.servlet.error.request_uri", httpServletReq.getRequestURI()); WebContainerRequestState.getInstance(true).setAttribute("isErrorDispatcherType", "true"); // add the target servlet name to the request object if (ser.getTargetServletName() != null) { req.setAttribute("javax.servlet.error.servlet_name", ser.getTargetServletName()); } else { IExtendedRequest wsRequest = (IExtendedRequest) ServletUtil.unwrapRequest(req); WebAppDispatcherContext ctxt = (WebAppDispatcherContext) wsRequest.getWebAppDispatcherContext(); RequestProcessor processor = ctxt.getCurrentServletReference(); if (processor != null) { String name = processor.getName(); req.setAttribute("javax.servlet.error.servlet_name", name); } } // LIDB1234.5 - end // Arguably, the request attributes are unnecessary if the configuration is unavailable, // meaning, the exception maybe could be thrown at the beginning of this method. if (config==null) { //if the application was stopped then config will be null. It's possible that a previous request could have made it here and thrown an exception throw new MajorHandlingRuntimeException("WebContainer can not handle the request", sx); } // Look for an error page which matches by error-code or exception-type, then // look for a default error page. String errorURL = null; Object errorSelector = null; String errorURLCase = null; // START PK55149: // // If custom property "com.ibm.wsspi.webcontainer.WCCustomProperties.ERROR_EXCEPTION_TYPE_FIRST" is // enabled, lookup by exception type then by error code. // // Default to lookup by error code then by error code. // Maybe lookup the error-code first ... if (!errorExceptionTypeFirst) { ErrorPage errorPage = config.getErrorPageByErrorCode(errorCode); if (errorPage != null) { errorURL = errorPage.getLocation(); if ((errorURL != null)) { // Should not be null or empty, but check, just in case. if (errorURL.length() > 0) { errorSelector = errorCode; errorURLCase = "error-code"; } else { errorURL = null; } } } } // Either, the error-code lookup was first, but failed, // or the exception-type lookup is first. if (errorURL == null) { if (th != null) { ErrorPage errorPage; if (isPreV7) { errorPage = config.getErrorPageByExceptionType(th); } else { errorPage = config.getErrorPageTraverseRootCause(th); } if (errorPage != null) { errorURL = errorPage.getLocation(); if ((errorURL != null)) { // Should not be null or empty, but check, just in case. if (errorURL.length() > 0) { errorSelector = errorCode; errorURLCase = "exception-type"; } else { errorURL = null; } } } } } // .. or lookup by error-code second. if (errorExceptionTypeFirst && (errorURL == null)) { ErrorPage errorPage = config.getErrorPageByErrorCode(errorCode); if (errorPage != null) { errorURL = errorPage.getLocation(); if ((errorURL != null)) { // Should not be null or empty, but check, just in case. if (errorURL.length() > 0) { errorSelector = errorCode; errorURLCase = "error-code"; } else { errorURL = null; } } } } // END PK55149 // If no error page matching the specific error code or exception type was // obtained, then, if configured, use the default error page. A default // error page will be obtained from the web.xml or web-fragment.xml as // an error page with no error code and no exception type, or will be // obtained from the ibm-web-ext.xml as an expliclit value. // But, don't use a default error page for error code 403. // Error code 403 is a security error code: // "Error 403--Forbidden when trying to access the servlet". if (errorURL == null) { if (errorCode.intValue() == 403) { if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) { logger.logp(Level.FINE, CLASS_NAME, methodName, "No match on error-code or exception-type; code 403 prevents default error page"); } return null; } errorURL = config.getDefaultErrorPage(); if (errorURL != null) { // Should no be empty, but check, just in case. if (errorURL.length() > 0) { errorSelector = "DEFAULT"; errorURLCase = "default"; } else { errorURL = null; } } } if (errorURL == null) { if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) { logger.logp(Level.FINE, CLASS_NAME, methodName, "No match on error-code or exception-type; no default error page"); } return null; } // Prior logging put this out before forcing the initial "/"; keep to that pattern. if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) { logger.logp(Level.FINE, CLASS_NAME, methodName, "Found " + errorURLCase + "=" + errorSelector + " with location=" + errorURL); } if (!errorURL.startsWith("/")) { errorURL = "/" + errorURL; } // WebAppDispatcherContext dispatchContext = new // WebAppDispatcherContext(this); // dispatchContext.setRelativeUri(errorURL); return getRequestDispatcher(errorURL); } }
public class class_name { public RequestDispatcher getErrorPageDispatcher(ServletRequest req, ServletErrorReport ser) { if (this.getDestroyed().booleanValue()) { // should be a fast boolean check. throw new MajorHandlingRuntimeException("WebContainer can not handle the request"); } String methodName = "getErrorPageDispatcher"; // Get and Set error request attributes. Integer errorCode = new Integer(ser.getErrorCode()); Class errorException = ser.getExceptionClass(); String errorMessage = ser.getMessage(); if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) { logger.logp(Level.FINE, CLASS_NAME, methodName, "Looking for defined Error Page!"); logger.logp(Level.FINE, CLASS_NAME, methodName, "Exception errorCode=" + errorCode); logger.logp(Level.FINE, CLASS_NAME, methodName, "Exception type=" + errorException); logger.logp(Level.FINE, CLASS_NAME, methodName, "Exception message=" + errorMessage); // depends on control dependency: [if], data = [none] } // 114582 - begin - get down to the root servlet exception ServletException sx = (ServletException) ser; Throwable th = sx.getRootCause(); if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) { logger.logp(Level.FINE, CLASS_NAME, methodName, "Servlet Exception is: " + sx); // depends on control dependency: [if], data = [none] logger.logp(Level.FINE, CLASS_NAME, methodName, "th (root cause) is: " + th); // depends on control dependency: [if], data = [none] } // Defect 114582 - walk upwards to the root servlet exception. // Defect 114582 - test against ServletException if preV7; otherwise, test against ServletErrorReport. boolean isPreV7 = ((WCCustomProperties.ERROR_PAGE_COMPATIBILITY != null) && WCCustomProperties.ERROR_PAGE_COMPATIBILITY.equalsIgnoreCase("V6")); if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) { logger.logp(Level.FINE, CLASS_NAME, methodName, (isPreV7 ? "is PreV7" : "not PreV7")); // depends on control dependency: [if], data = [none] } // Walk upwards while there is another servlet exception and a new root cause. // Defect 155880 - Don't shift upwards if the root cause is null. if (isPreV7) { while (th != null && th instanceof ServletException && ((ServletException) th).getRootCause() != null) { // defect sx = (ServletException) th; // depends on control dependency: [while], data = [none] th = sx.getRootCause(); // depends on control dependency: [while], data = [none] if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) { logger.logp(Level.FINE, CLASS_NAME, methodName, "unwrapping exceptions Servlet Exception is now: " + sx); // depends on control dependency: [if], data = [none] logger.logp(Level.FINE, CLASS_NAME, methodName, "th (root cause) is now: " + th); // depends on control dependency: [if], data = [none] } } } else { while (th != null && th instanceof ServletErrorReport && ((ServletErrorReport) th).getRootCause() != null) { sx = (ServletException) th; // depends on control dependency: [while], data = [none] th = sx.getRootCause(); // depends on control dependency: [while], data = [none] if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) { logger.logp(Level.FINE, CLASS_NAME, methodName, "unwrapping exceptions Servlet Exception is now: " + sx); // depends on control dependency: [if], data = [none] logger.logp(Level.FINE, CLASS_NAME, methodName, "th (root cause) is now: " + th); // depends on control dependency: [if], data = [none] } } } // 114582 - only set exception type if root exception is not null if (th != null) { req.setAttribute("javax.servlet.error.exception", th); // depends on control dependency: [if], data = [none] if (errorException != null) { req.setAttribute("javax.servlet.error.exception_type", errorException); // depends on control dependency: [if], data = [none] } } if (errorMessage != null) { req.setAttribute("javax.servlet.error.message", errorMessage); // depends on control dependency: [if], data = [none] } // add the request uri to the request object HttpServletRequest httpServletReq = (HttpServletRequest) ServletUtil.unwrapRequest(req, HttpServletRequest.class); req.setAttribute("javax.servlet.error.request_uri", httpServletReq.getRequestURI()); WebContainerRequestState.getInstance(true).setAttribute("isErrorDispatcherType", "true"); // add the target servlet name to the request object if (ser.getTargetServletName() != null) { req.setAttribute("javax.servlet.error.servlet_name", ser.getTargetServletName()); // depends on control dependency: [if], data = [none] } else { IExtendedRequest wsRequest = (IExtendedRequest) ServletUtil.unwrapRequest(req); WebAppDispatcherContext ctxt = (WebAppDispatcherContext) wsRequest.getWebAppDispatcherContext(); RequestProcessor processor = ctxt.getCurrentServletReference(); if (processor != null) { String name = processor.getName(); req.setAttribute("javax.servlet.error.servlet_name", name); // depends on control dependency: [if], data = [none] } } // LIDB1234.5 - end // Arguably, the request attributes are unnecessary if the configuration is unavailable, // meaning, the exception maybe could be thrown at the beginning of this method. if (config==null) { //if the application was stopped then config will be null. It's possible that a previous request could have made it here and thrown an exception throw new MajorHandlingRuntimeException("WebContainer can not handle the request", sx); } // Look for an error page which matches by error-code or exception-type, then // look for a default error page. String errorURL = null; Object errorSelector = null; String errorURLCase = null; // START PK55149: // // If custom property "com.ibm.wsspi.webcontainer.WCCustomProperties.ERROR_EXCEPTION_TYPE_FIRST" is // enabled, lookup by exception type then by error code. // // Default to lookup by error code then by error code. // Maybe lookup the error-code first ... if (!errorExceptionTypeFirst) { ErrorPage errorPage = config.getErrorPageByErrorCode(errorCode); if (errorPage != null) { errorURL = errorPage.getLocation(); // depends on control dependency: [if], data = [none] if ((errorURL != null)) { // Should not be null or empty, but check, just in case. if (errorURL.length() > 0) { errorSelector = errorCode; // depends on control dependency: [if], data = [none] errorURLCase = "error-code"; // depends on control dependency: [if], data = [none] } else { errorURL = null; // depends on control dependency: [if], data = [none] } } } } // Either, the error-code lookup was first, but failed, // or the exception-type lookup is first. if (errorURL == null) { if (th != null) { ErrorPage errorPage; if (isPreV7) { errorPage = config.getErrorPageByExceptionType(th); // depends on control dependency: [if], data = [none] } else { errorPage = config.getErrorPageTraverseRootCause(th); // depends on control dependency: [if], data = [none] } if (errorPage != null) { errorURL = errorPage.getLocation(); // depends on control dependency: [if], data = [none] if ((errorURL != null)) { // Should not be null or empty, but check, just in case. if (errorURL.length() > 0) { errorSelector = errorCode; // depends on control dependency: [if], data = [none] errorURLCase = "exception-type"; // depends on control dependency: [if], data = [none] } else { errorURL = null; // depends on control dependency: [if], data = [none] } } } } } // .. or lookup by error-code second. if (errorExceptionTypeFirst && (errorURL == null)) { ErrorPage errorPage = config.getErrorPageByErrorCode(errorCode); if (errorPage != null) { errorURL = errorPage.getLocation(); // depends on control dependency: [if], data = [none] if ((errorURL != null)) { // Should not be null or empty, but check, just in case. if (errorURL.length() > 0) { errorSelector = errorCode; // depends on control dependency: [if], data = [none] errorURLCase = "error-code"; // depends on control dependency: [if], data = [none] } else { errorURL = null; // depends on control dependency: [if], data = [none] } } } } // END PK55149 // If no error page matching the specific error code or exception type was // obtained, then, if configured, use the default error page. A default // error page will be obtained from the web.xml or web-fragment.xml as // an error page with no error code and no exception type, or will be // obtained from the ibm-web-ext.xml as an expliclit value. // But, don't use a default error page for error code 403. // Error code 403 is a security error code: // "Error 403--Forbidden when trying to access the servlet". if (errorURL == null) { if (errorCode.intValue() == 403) { if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) { logger.logp(Level.FINE, CLASS_NAME, methodName, "No match on error-code or exception-type; code 403 prevents default error page"); // depends on control dependency: [if], data = [none] } return null; // depends on control dependency: [if], data = [none] } errorURL = config.getDefaultErrorPage(); // depends on control dependency: [if], data = [none] if (errorURL != null) { // Should no be empty, but check, just in case. if (errorURL.length() > 0) { errorSelector = "DEFAULT"; // depends on control dependency: [if], data = [none] errorURLCase = "default"; // depends on control dependency: [if], data = [none] } else { errorURL = null; // depends on control dependency: [if], data = [none] } } } if (errorURL == null) { if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) { logger.logp(Level.FINE, CLASS_NAME, methodName, "No match on error-code or exception-type; no default error page"); // depends on control dependency: [if], data = [none] } return null; // depends on control dependency: [if], data = [none] } // Prior logging put this out before forcing the initial "/"; keep to that pattern. if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) { logger.logp(Level.FINE, CLASS_NAME, methodName, "Found " + errorURLCase + "=" + errorSelector + " with location=" + errorURL); // depends on control dependency: [if], data = [none] } if (!errorURL.startsWith("/")) { errorURL = "/" + errorURL; // depends on control dependency: [if], data = [none] } // WebAppDispatcherContext dispatchContext = new // WebAppDispatcherContext(this); // dispatchContext.setRelativeUri(errorURL); return getRequestDispatcher(errorURL); } }
public class class_name { public void marshall(DeregisterVolumeRequest deregisterVolumeRequest, ProtocolMarshaller protocolMarshaller) { if (deregisterVolumeRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deregisterVolumeRequest.getVolumeId(), VOLUMEID_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DeregisterVolumeRequest deregisterVolumeRequest, ProtocolMarshaller protocolMarshaller) { if (deregisterVolumeRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deregisterVolumeRequest.getVolumeId(), VOLUMEID_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 writeUncommitted(SIMPMessage m) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "writeUncommitted", new Object[] { m }); TickRange tr = null; JsMessage jsMsg = m.getMessage(); long stamp = jsMsg.getGuaranteedValueValueTick(); long starts = jsMsg.getGuaranteedValueStartTick(); long ends = jsMsg.getGuaranteedValueEndTick(); long completedPrefix; tr = TickRange.newUncommittedTick(stamp); tr.startstamp = starts; tr.endstamp = ends; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { SibTr.debug(tc, "writeUncommitted at: " + stamp + " with Silence from: " + starts + " to " + ends + " on Stream " + streamID); } synchronized (this) { // write into stream oststream.writeCombinedRange(tr); completedPrefix = oststream.getCompletedPrefix(); sendSilence(starts, completedPrefix); // SIB0105 // If this is the first uncommitted messages to be added to the stream, start off the // blocked message health state timer. This will check back in the future to see if the // message successfully sent. if (blockedStreamAlarm == null) { blockedStreamAlarm = new BlockedStreamAlarm(this, getCompletedPrefix()); am.create(GDConfig.BLOCKED_STREAM_HEALTH_CHECK_INTERVAL, blockedStreamAlarm); } } // end synchronized if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "writeUncommitted"); } }
public class class_name { public void writeUncommitted(SIMPMessage m) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "writeUncommitted", new Object[] { m }); TickRange tr = null; JsMessage jsMsg = m.getMessage(); long stamp = jsMsg.getGuaranteedValueValueTick(); long starts = jsMsg.getGuaranteedValueStartTick(); long ends = jsMsg.getGuaranteedValueEndTick(); long completedPrefix; tr = TickRange.newUncommittedTick(stamp); tr.startstamp = starts; tr.endstamp = ends; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { SibTr.debug(tc, "writeUncommitted at: " + stamp + " with Silence from: " + starts + " to " + ends + " on Stream " + streamID); // depends on control dependency: [if], data = [none] } synchronized (this) { // write into stream oststream.writeCombinedRange(tr); completedPrefix = oststream.getCompletedPrefix(); sendSilence(starts, completedPrefix); // SIB0105 // If this is the first uncommitted messages to be added to the stream, start off the // blocked message health state timer. This will check back in the future to see if the // message successfully sent. if (blockedStreamAlarm == null) { blockedStreamAlarm = new BlockedStreamAlarm(this, getCompletedPrefix()); // depends on control dependency: [if], data = [none] am.create(GDConfig.BLOCKED_STREAM_HEALTH_CHECK_INTERVAL, blockedStreamAlarm); // depends on control dependency: [if], data = [none] } } // end synchronized if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "writeUncommitted"); } }
public class class_name { public void addOutgoingFor(String[] varNames, DifferentialFunction function) { if (function.getOwnName() == null) throw new ND4JIllegalStateException("Instance id can not be null. Function not initialized properly"); if (ops.get(function.getOwnName()).getOutputsOfOp() != null && !ops.get(function.getOwnName()).getOutputsOfOp().isEmpty()) { throw new ND4JIllegalStateException("Outgoing arguments already declared for " + function); } if (varNames == null) throw new ND4JIllegalStateException("Var names can not be null!"); for (int i = 0; i < varNames.length; i++) { if (varNames[i] == null) throw new ND4JIllegalStateException("Variable name elements can not be null!"); } ops.get(function.getOwnName()).setOutputsOfOp(Arrays.asList(varNames)); for (String resultName : varNames) { variables.get(resultName).setOutputOfOp(function.getOwnName()); } } }
public class class_name { public void addOutgoingFor(String[] varNames, DifferentialFunction function) { if (function.getOwnName() == null) throw new ND4JIllegalStateException("Instance id can not be null. Function not initialized properly"); if (ops.get(function.getOwnName()).getOutputsOfOp() != null && !ops.get(function.getOwnName()).getOutputsOfOp().isEmpty()) { throw new ND4JIllegalStateException("Outgoing arguments already declared for " + function); } if (varNames == null) throw new ND4JIllegalStateException("Var names can not be null!"); for (int i = 0; i < varNames.length; i++) { if (varNames[i] == null) throw new ND4JIllegalStateException("Variable name elements can not be null!"); } ops.get(function.getOwnName()).setOutputsOfOp(Arrays.asList(varNames)); for (String resultName : varNames) { variables.get(resultName).setOutputOfOp(function.getOwnName()); // depends on control dependency: [for], data = [resultName] } } }
public class class_name { @Unstable public static String serializeType(Type type) { if (type == null) { return null; } StringBuilder sb = new StringBuilder(); if (type instanceof ParameterizedType) { ParameterizedType parameterizedType = (ParameterizedType) type; String rawTypeName = getTypeName(parameterizedType.getRawType()); if (parameterizedType.getOwnerType() != null) { if (parameterizedType.getOwnerType() instanceof Class) { sb.append(((Class<?>) parameterizedType.getOwnerType()).getName()); } else { sb.append(parameterizedType.getOwnerType().toString()); } sb.append('.'); if (parameterizedType.getOwnerType() instanceof ParameterizedType) { // Find simple name of nested type by removing the // shared prefix with owner. sb.append(rawTypeName.replace( ((Class<?>) ((ParameterizedType) parameterizedType.getOwnerType()).getRawType()) .getName() + '$', "")); } else { sb.append(rawTypeName); } } else { sb.append(rawTypeName); } if (parameterizedType.getActualTypeArguments() != null && parameterizedType.getActualTypeArguments().length > 0) { sb.append(OPEN_GENERIC); boolean first = true; for (Type typeArgument : parameterizedType.getActualTypeArguments()) { if (!first) { sb.append(", "); } sb.append(getTypeName(typeArgument)); first = false; } sb.append(CLOSE_GENERIC); } } else { sb.append(getTypeName(type)); } return sb.toString(); } }
public class class_name { @Unstable public static String serializeType(Type type) { if (type == null) { return null; // depends on control dependency: [if], data = [none] } StringBuilder sb = new StringBuilder(); if (type instanceof ParameterizedType) { ParameterizedType parameterizedType = (ParameterizedType) type; String rawTypeName = getTypeName(parameterizedType.getRawType()); if (parameterizedType.getOwnerType() != null) { if (parameterizedType.getOwnerType() instanceof Class) { sb.append(((Class<?>) parameterizedType.getOwnerType()).getName()); // depends on control dependency: [if], data = [none] } else { sb.append(parameterizedType.getOwnerType().toString()); // depends on control dependency: [if], data = [none] } sb.append('.'); // depends on control dependency: [if], data = [none] if (parameterizedType.getOwnerType() instanceof ParameterizedType) { // Find simple name of nested type by removing the // shared prefix with owner. sb.append(rawTypeName.replace( ((Class<?>) ((ParameterizedType) parameterizedType.getOwnerType()).getRawType()) .getName() + '$', "")); // depends on control dependency: [if], data = [none] } else { sb.append(rawTypeName); // depends on control dependency: [if], data = [none] } } else { sb.append(rawTypeName); // depends on control dependency: [if], data = [none] } if (parameterizedType.getActualTypeArguments() != null && parameterizedType.getActualTypeArguments().length > 0) { sb.append(OPEN_GENERIC); // depends on control dependency: [if], data = [none] boolean first = true; for (Type typeArgument : parameterizedType.getActualTypeArguments()) { if (!first) { sb.append(", "); // depends on control dependency: [if], data = [none] } sb.append(getTypeName(typeArgument)); // depends on control dependency: [for], data = [typeArgument] first = false; // depends on control dependency: [for], data = [none] } sb.append(CLOSE_GENERIC); // depends on control dependency: [if], data = [none] } } else { sb.append(getTypeName(type)); // depends on control dependency: [if], data = [none] } return sb.toString(); } }
public class class_name { public static List<Integer> listDifferences(BitSet bs1, BitSet bs2) { List<Integer> l = new ArrayList<Integer>(); LOGGER.debug("Listing bit positions set in bs2 but not in bs1"); for (int f = 0; f < bs2.size(); f++) { if (bs2.get(f) && !bs1.get(f)) { l.add(f); LOGGER.debug("Bit " + f + " not set in bs1"); } } return l; } }
public class class_name { public static List<Integer> listDifferences(BitSet bs1, BitSet bs2) { List<Integer> l = new ArrayList<Integer>(); LOGGER.debug("Listing bit positions set in bs2 but not in bs1"); for (int f = 0; f < bs2.size(); f++) { if (bs2.get(f) && !bs1.get(f)) { l.add(f); // depends on control dependency: [if], data = [none] LOGGER.debug("Bit " + f + " not set in bs1"); // depends on control dependency: [if], data = [none] } } return l; } }
public class class_name { public long getLastModified(VirtualFile mountPoint, VirtualFile target) { final ZipNode zipNode = getZipNode(mountPoint, target); if (zipNode == null) { return 0L; } final File cachedFile = zipNode.cachedFile; final JarEntry entry = zipNode.entry; return cachedFile != null ? cachedFile.lastModified() : entry == null ? zipTime : entry.getTime(); } }
public class class_name { public long getLastModified(VirtualFile mountPoint, VirtualFile target) { final ZipNode zipNode = getZipNode(mountPoint, target); if (zipNode == null) { return 0L; // depends on control dependency: [if], data = [none] } final File cachedFile = zipNode.cachedFile; final JarEntry entry = zipNode.entry; return cachedFile != null ? cachedFile.lastModified() : entry == null ? zipTime : entry.getTime(); } }
public class class_name { public List<File> findAll() { List<File> allFiles = new ArrayList<>(); File file; while ((file = nextFile()) != null) { allFiles.add(file); } return allFiles; } }
public class class_name { public List<File> findAll() { List<File> allFiles = new ArrayList<>(); File file; while ((file = nextFile()) != null) { allFiles.add(file); // depends on control dependency: [while], data = [none] } return allFiles; } }
public class class_name { protected boolean doOrder(Node parentNode, List<OrderMember> members) { boolean success = true; for (int i = 0; i < members.size(); i++) { OrderMember member = members.get(i); int status = HTTPStatus.OK; try { parentNode.getSession().refresh(false); String positionedNodeName = null; if (!parentNode.hasNode(member.getSegment())) { throw new PathNotFoundException(); } if (!new QName("DAV:", "last").equals(member.getPosition())) { NodeIterator nodeIter = parentNode.getNodes(); boolean finded = false; while (nodeIter.hasNext()) { Node curNode = nodeIter.nextNode(); if (new QName("DAV:", "first").equals(member.getPosition())) { positionedNodeName = curNode.getName(); finded = true; break; } if (new QName("DAV:", "before").equals(member.getPosition()) && curNode.getName().equals(member.getPositionSegment())) { positionedNodeName = curNode.getName(); finded = true; break; } if (new QName("DAV:", "after").equals(member.getPosition()) && curNode.getName().equals(member.getPositionSegment())) { if (nodeIter.hasNext()) { positionedNodeName = nodeIter.nextNode().getName(); } finded = true; break; } } if (!finded) { throw new AccessDeniedException(); } } parentNode.getSession().refresh(false); parentNode.orderBefore(member.getSegment(), positionedNodeName); parentNode.getSession().save(); } catch (LockException exc) { status = HTTPStatus.LOCKED; } catch (PathNotFoundException exc) { status = HTTPStatus.FORBIDDEN; } catch (AccessDeniedException exc) { status = HTTPStatus.FORBIDDEN; } catch (RepositoryException exc) { LOG.error(exc.getMessage(), exc); status = HTTPStatus.INTERNAL_ERROR; } member.setStatus(status); if (status != HTTPStatus.OK) { success = false; } } return success; } }
public class class_name { protected boolean doOrder(Node parentNode, List<OrderMember> members) { boolean success = true; for (int i = 0; i < members.size(); i++) { OrderMember member = members.get(i); int status = HTTPStatus.OK; try { parentNode.getSession().refresh(false); // depends on control dependency: [try], data = [none] String positionedNodeName = null; if (!parentNode.hasNode(member.getSegment())) { throw new PathNotFoundException(); } if (!new QName("DAV:", "last").equals(member.getPosition())) { NodeIterator nodeIter = parentNode.getNodes(); boolean finded = false; while (nodeIter.hasNext()) { Node curNode = nodeIter.nextNode(); if (new QName("DAV:", "first").equals(member.getPosition())) { positionedNodeName = curNode.getName(); // depends on control dependency: [if], data = [none] finded = true; // depends on control dependency: [if], data = [none] break; } if (new QName("DAV:", "before").equals(member.getPosition()) && curNode.getName().equals(member.getPositionSegment())) { positionedNodeName = curNode.getName(); // depends on control dependency: [if], data = [none] finded = true; // depends on control dependency: [if], data = [none] break; } if (new QName("DAV:", "after").equals(member.getPosition()) && curNode.getName().equals(member.getPositionSegment())) { if (nodeIter.hasNext()) { positionedNodeName = nodeIter.nextNode().getName(); // depends on control dependency: [if], data = [none] } finded = true; // depends on control dependency: [if], data = [none] break; } } if (!finded) { throw new AccessDeniedException(); } } parentNode.getSession().refresh(false); // depends on control dependency: [try], data = [none] parentNode.orderBefore(member.getSegment(), positionedNodeName); // depends on control dependency: [try], data = [none] parentNode.getSession().save(); // depends on control dependency: [try], data = [none] } catch (LockException exc) { status = HTTPStatus.LOCKED; } // depends on control dependency: [catch], data = [none] catch (PathNotFoundException exc) { status = HTTPStatus.FORBIDDEN; } // depends on control dependency: [catch], data = [none] catch (AccessDeniedException exc) { status = HTTPStatus.FORBIDDEN; } // depends on control dependency: [catch], data = [none] catch (RepositoryException exc) { LOG.error(exc.getMessage(), exc); status = HTTPStatus.INTERNAL_ERROR; } // depends on control dependency: [catch], data = [none] member.setStatus(status); // depends on control dependency: [for], data = [none] if (status != HTTPStatus.OK) { success = false; // depends on control dependency: [if], data = [none] } } return success; } }
public class class_name { public String getType() { String type = getPropertyAsString(FIELD_TYPE); if (type == null){ return getPropertyAsString(FIELD_ITEM_TYPE); } return type; } }
public class class_name { public String getType() { String type = getPropertyAsString(FIELD_TYPE); if (type == null){ return getPropertyAsString(FIELD_ITEM_TYPE); // depends on control dependency: [if], data = [none] } return type; } }
public class class_name { public long getSequenceID() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getSequenceID"); long sequenceID=0; try { SIMPMessage msg = getSIMPMessage(); if(msg!=null) { sequenceID = msg.getMessage().getGuaranteedValueValueTick(); } } catch (SIResourceException e) { // No FFDC code needed SibTr.exception(tc, e); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getSequenceID", Long.valueOf(sequenceID)); return sequenceID; } }
public class class_name { public long getSequenceID() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getSequenceID"); long sequenceID=0; try { SIMPMessage msg = getSIMPMessage(); if(msg!=null) { sequenceID = msg.getMessage().getGuaranteedValueValueTick(); // depends on control dependency: [if], data = [none] } } catch (SIResourceException e) { // No FFDC code needed SibTr.exception(tc, e); } // depends on control dependency: [catch], data = [none] if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getSequenceID", Long.valueOf(sequenceID)); return sequenceID; } }
public class class_name { public JBBPIntegerValueEvaluator make(final String expression, final List<JBBPNamedFieldInfo> namedFields, final byte[] compiledScript) { final JBBPIntegerValueEvaluator result; if (JBBPExpressionEvaluator.hasExpressionOperators(expression)) { // expression result = new JBBPExpressionEvaluator(expression, namedFields, compiledScript); } else { // only field int index = -1; if (expression.startsWith("$")) { result = new JBBPOnlyFieldEvaluator(expression.substring(1), index); } else { for (int i = namedFields.size() - 1; i >= 0; i--) { final JBBPNamedFieldInfo field = namedFields.get(i); if (expression.equals(field.getFieldPath())) { index = i; break; } } if (index < 0) { result = new JBBPExpressionEvaluator(expression, namedFields, compiledScript); } else { JBBPCompilerUtils.assertFieldIsNotArrayOrInArray(namedFields.get(index), namedFields, compiledScript); result = new JBBPOnlyFieldEvaluator(null, index); } } } return result; } }
public class class_name { public JBBPIntegerValueEvaluator make(final String expression, final List<JBBPNamedFieldInfo> namedFields, final byte[] compiledScript) { final JBBPIntegerValueEvaluator result; if (JBBPExpressionEvaluator.hasExpressionOperators(expression)) { // expression result = new JBBPExpressionEvaluator(expression, namedFields, compiledScript); // depends on control dependency: [if], data = [none] } else { // only field int index = -1; if (expression.startsWith("$")) { result = new JBBPOnlyFieldEvaluator(expression.substring(1), index); // depends on control dependency: [if], data = [none] } else { for (int i = namedFields.size() - 1; i >= 0; i--) { final JBBPNamedFieldInfo field = namedFields.get(i); if (expression.equals(field.getFieldPath())) { index = i; // depends on control dependency: [if], data = [none] break; } } if (index < 0) { result = new JBBPExpressionEvaluator(expression, namedFields, compiledScript); // depends on control dependency: [if], data = [none] } else { JBBPCompilerUtils.assertFieldIsNotArrayOrInArray(namedFields.get(index), namedFields, compiledScript); // depends on control dependency: [if], data = [(index] result = new JBBPOnlyFieldEvaluator(null, index); // depends on control dependency: [if], data = [none] } } } return result; } }
public class class_name { static public int[] randomIntegers(int start, int end, int size){ Preconditions.checkArgument(start < end, "Start must be less than end."); Random random = new Random(); random.setSeed(System.currentTimeMillis()); int[] result = new int[size]; for (int i = 0; i < size; i ++){ int l = random.nextInt(); double d = (double)(end - start) / (Integer.MAX_VALUE - Integer.MIN_VALUE) * l + start; if (d <= start){ l = start; }else if (d >= end){ l = end; }else{ l = (int)d; } result[i] = l; } return result; } }
public class class_name { static public int[] randomIntegers(int start, int end, int size){ Preconditions.checkArgument(start < end, "Start must be less than end."); Random random = new Random(); random.setSeed(System.currentTimeMillis()); int[] result = new int[size]; for (int i = 0; i < size; i ++){ int l = random.nextInt(); double d = (double)(end - start) / (Integer.MAX_VALUE - Integer.MIN_VALUE) * l + start; if (d <= start){ l = start; // depends on control dependency: [if], data = [none] }else if (d >= end){ l = end; // depends on control dependency: [if], data = [none] }else{ l = (int)d; // depends on control dependency: [if], data = [none] } result[i] = l; } return result; } }
public class class_name { static FormattingTuple arrayFormat(final String messagePattern, final Object[] argArray) { if (argArray == null || argArray.length == 0) { return new FormattingTuple(messagePattern, null); } int lastArrIdx = argArray.length - 1; Object lastEntry = argArray[lastArrIdx]; Throwable throwable = lastEntry instanceof Throwable? (Throwable) lastEntry : null; if (messagePattern == null) { return new FormattingTuple(null, throwable); } int j = messagePattern.indexOf(DELIM_STR); if (j == -1) { // this is a simple string return new FormattingTuple(messagePattern, throwable); } StringBuilder sbuf = new StringBuilder(messagePattern.length() + 50); int i = 0; int L = 0; do { boolean notEscaped = j == 0 || messagePattern.charAt(j - 1) != ESCAPE_CHAR; if (notEscaped) { // normal case sbuf.append(messagePattern, i, j); } else { sbuf.append(messagePattern, i, j - 1); // check that escape char is not is escaped: "abc x:\\{}" notEscaped = j >= 2 && messagePattern.charAt(j - 2) == ESCAPE_CHAR; } i = j + 2; if (notEscaped) { deeplyAppendParameter(sbuf, argArray[L], null); L++; if (L > lastArrIdx) { break; } } else { sbuf.append(DELIM_STR); } j = messagePattern.indexOf(DELIM_STR, i); } while (j != -1); // append the characters following the last {} pair. sbuf.append(messagePattern, i, messagePattern.length()); return new FormattingTuple(sbuf.toString(), L <= lastArrIdx? throwable : null); } }
public class class_name { static FormattingTuple arrayFormat(final String messagePattern, final Object[] argArray) { if (argArray == null || argArray.length == 0) { return new FormattingTuple(messagePattern, null); // depends on control dependency: [if], data = [none] } int lastArrIdx = argArray.length - 1; Object lastEntry = argArray[lastArrIdx]; Throwable throwable = lastEntry instanceof Throwable? (Throwable) lastEntry : null; if (messagePattern == null) { return new FormattingTuple(null, throwable); // depends on control dependency: [if], data = [none] } int j = messagePattern.indexOf(DELIM_STR); if (j == -1) { // this is a simple string return new FormattingTuple(messagePattern, throwable); // depends on control dependency: [if], data = [none] } StringBuilder sbuf = new StringBuilder(messagePattern.length() + 50); int i = 0; int L = 0; do { boolean notEscaped = j == 0 || messagePattern.charAt(j - 1) != ESCAPE_CHAR; if (notEscaped) { // normal case sbuf.append(messagePattern, i, j); // depends on control dependency: [if], data = [none] } else { sbuf.append(messagePattern, i, j - 1); // depends on control dependency: [if], data = [none] // check that escape char is not is escaped: "abc x:\\{}" notEscaped = j >= 2 && messagePattern.charAt(j - 2) == ESCAPE_CHAR; // depends on control dependency: [if], data = [none] } i = j + 2; if (notEscaped) { deeplyAppendParameter(sbuf, argArray[L], null); // depends on control dependency: [if], data = [none] L++; // depends on control dependency: [if], data = [none] if (L > lastArrIdx) { break; } } else { sbuf.append(DELIM_STR); // depends on control dependency: [if], data = [none] } j = messagePattern.indexOf(DELIM_STR, i); } while (j != -1); // append the characters following the last {} pair. sbuf.append(messagePattern, i, messagePattern.length()); return new FormattingTuple(sbuf.toString(), L <= lastArrIdx? throwable : null); } }
public class class_name { protected void addToRelationStack(Map<Object, Object> relationStack, Object entity, EntityMetadata m) { Object obj = entity; if (entity instanceof EnhanceEntity) { obj = ((EnhanceEntity) entity).getEntity(); } relationStack.put(obj.getClass().getCanonicalName() + "#" + PropertyAccessorHelper.getId(obj, m), obj); } }
public class class_name { protected void addToRelationStack(Map<Object, Object> relationStack, Object entity, EntityMetadata m) { Object obj = entity; if (entity instanceof EnhanceEntity) { obj = ((EnhanceEntity) entity).getEntity(); // depends on control dependency: [if], data = [none] } relationStack.put(obj.getClass().getCanonicalName() + "#" + PropertyAccessorHelper.getId(obj, m), obj); } }
public class class_name { public final Flux<T> take(Duration timespan, Scheduler timer) { if (!timespan.isZero()) { return takeUntilOther(Mono.delay(timespan, timer)); } else { return take(0); } } }
public class class_name { public final Flux<T> take(Duration timespan, Scheduler timer) { if (!timespan.isZero()) { return takeUntilOther(Mono.delay(timespan, timer)); // depends on control dependency: [if], data = [none] } else { return take(0); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static void crashVoltDB(String reason, String traces[], String filename, int lineno) { VoltLogger hostLog = new VoltLogger("HOST"); String fn = (filename == null) ? "unknown" : filename; String re = (reason == null) ? "Fatal EE error." : reason; hostLog.fatal(re + " In " + fn + ":" + lineno); if (traces != null) { for ( String trace : traces) { hostLog.fatal(trace); } } VoltDB.crashLocalVoltDB(re + " In " + fn + ":" + lineno, true, null); } }
public class class_name { public static void crashVoltDB(String reason, String traces[], String filename, int lineno) { VoltLogger hostLog = new VoltLogger("HOST"); String fn = (filename == null) ? "unknown" : filename; String re = (reason == null) ? "Fatal EE error." : reason; hostLog.fatal(re + " In " + fn + ":" + lineno); if (traces != null) { for ( String trace : traces) { hostLog.fatal(trace); // depends on control dependency: [for], data = [trace] } } VoltDB.crashLocalVoltDB(re + " In " + fn + ":" + lineno, true, null); } }
public class class_name { public Action0 getEndAction() { return new Action0() { @Override public void call() { if (endTime == null) { endTime = new Date().getTime(); PerformanceLogger.log(PerformanceMetrics.this); } } }; } }
public class class_name { public Action0 getEndAction() { return new Action0() { @Override public void call() { if (endTime == null) { endTime = new Date().getTime(); // depends on control dependency: [if], data = [none] PerformanceLogger.log(PerformanceMetrics.this); // depends on control dependency: [if], data = [none] } } }; } }
public class class_name { public void marshall(BackendConnectionErrors backendConnectionErrors, ProtocolMarshaller protocolMarshaller) { if (backendConnectionErrors == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(backendConnectionErrors.getTimeoutCount(), TIMEOUTCOUNT_BINDING); protocolMarshaller.marshall(backendConnectionErrors.getConnectionRefusedCount(), CONNECTIONREFUSEDCOUNT_BINDING); protocolMarshaller.marshall(backendConnectionErrors.getHTTPCode4XXCount(), HTTPCODE4XXCOUNT_BINDING); protocolMarshaller.marshall(backendConnectionErrors.getHTTPCode5XXCount(), HTTPCODE5XXCOUNT_BINDING); protocolMarshaller.marshall(backendConnectionErrors.getUnknownHostCount(), UNKNOWNHOSTCOUNT_BINDING); protocolMarshaller.marshall(backendConnectionErrors.getOtherCount(), OTHERCOUNT_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(BackendConnectionErrors backendConnectionErrors, ProtocolMarshaller protocolMarshaller) { if (backendConnectionErrors == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(backendConnectionErrors.getTimeoutCount(), TIMEOUTCOUNT_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(backendConnectionErrors.getConnectionRefusedCount(), CONNECTIONREFUSEDCOUNT_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(backendConnectionErrors.getHTTPCode4XXCount(), HTTPCODE4XXCOUNT_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(backendConnectionErrors.getHTTPCode5XXCount(), HTTPCODE5XXCOUNT_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(backendConnectionErrors.getUnknownHostCount(), UNKNOWNHOSTCOUNT_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(backendConnectionErrors.getOtherCount(), OTHERCOUNT_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 { @Override public void actionCommit() { List errors = new ArrayList(); try { // get the correct module String moduleName = getParamModule(); CmsModule module = (CmsModule)OpenCms.getModuleManager().getModule(moduleName).clone(); // get the current exportpoints from the module List oldExportpoints = module.getExportPoints(); // now loop through the exportpoints and create the new list of exportpoints List newExportpoints = new ArrayList(); Iterator i = oldExportpoints.iterator(); while (i.hasNext()) { CmsExportPoint exp = (CmsExportPoint)i.next(); if (!exp.getUri().equals(m_exportpoint.getUri())) { newExportpoints.add(exp); } } // update the exportpoints newExportpoints.add(m_exportpoint); module.setExportPoints(newExportpoints); // update the module OpenCms.getModuleManager().updateModule(getCms(), module); // refresh the list Map objects = (Map)getSettings().getListObject(); if (objects != null) { objects.remove(CmsModulesList.class.getName()); objects.remove(CmsExportpointsList.class.getName()); } } catch (CmsConfigurationException ce) { errors.add(ce); } catch (CmsSecurityException se) { errors.add(se); } // set the list of errors to display when saving failed setCommitErrors(errors); } }
public class class_name { @Override public void actionCommit() { List errors = new ArrayList(); try { // get the correct module String moduleName = getParamModule(); CmsModule module = (CmsModule)OpenCms.getModuleManager().getModule(moduleName).clone(); // get the current exportpoints from the module List oldExportpoints = module.getExportPoints(); // now loop through the exportpoints and create the new list of exportpoints List newExportpoints = new ArrayList(); Iterator i = oldExportpoints.iterator(); while (i.hasNext()) { CmsExportPoint exp = (CmsExportPoint)i.next(); if (!exp.getUri().equals(m_exportpoint.getUri())) { newExportpoints.add(exp); // depends on control dependency: [if], data = [none] } } // update the exportpoints newExportpoints.add(m_exportpoint); // depends on control dependency: [try], data = [none] module.setExportPoints(newExportpoints); // depends on control dependency: [try], data = [none] // update the module OpenCms.getModuleManager().updateModule(getCms(), module); // depends on control dependency: [try], data = [none] // refresh the list Map objects = (Map)getSettings().getListObject(); if (objects != null) { objects.remove(CmsModulesList.class.getName()); // depends on control dependency: [if], data = [none] objects.remove(CmsExportpointsList.class.getName()); // depends on control dependency: [if], data = [none] } } catch (CmsConfigurationException ce) { errors.add(ce); } catch (CmsSecurityException se) { // depends on control dependency: [catch], data = [none] errors.add(se); } // depends on control dependency: [catch], data = [none] // set the list of errors to display when saving failed setCommitErrors(errors); } }
public class class_name { public static void removeLongLivedPageFlow( String modulePath, HttpServletRequest request, ServletContext servletContext ) { StorageHandler sh = Handlers.get( servletContext ).getStorageHandler(); HttpServletRequest unwrappedRequest = unwrapMultipart( request ); RequestContext rc = new RequestContext( unwrappedRequest, null ); String attrName = InternalUtils.getLongLivedFlowAttr( modulePath ); attrName = ScopedServletUtils.getScopedSessionAttrName( attrName, unwrappedRequest ); sh.removeAttribute( rc, attrName ); // // Now, if the current page flow is long-lived, remove the reference. // String currentLongLivedAttrName = ScopedServletUtils.getScopedSessionAttrName( CURRENT_LONGLIVED_ATTR, unwrappedRequest ); String currentLongLivedModulePath = ( String ) sh.getAttribute( rc, currentLongLivedAttrName ); if ( modulePath.equals( currentLongLivedModulePath ) ) { sh.removeAttribute( rc, currentLongLivedAttrName ); } } }
public class class_name { public static void removeLongLivedPageFlow( String modulePath, HttpServletRequest request, ServletContext servletContext ) { StorageHandler sh = Handlers.get( servletContext ).getStorageHandler(); HttpServletRequest unwrappedRequest = unwrapMultipart( request ); RequestContext rc = new RequestContext( unwrappedRequest, null ); String attrName = InternalUtils.getLongLivedFlowAttr( modulePath ); attrName = ScopedServletUtils.getScopedSessionAttrName( attrName, unwrappedRequest ); sh.removeAttribute( rc, attrName ); // // Now, if the current page flow is long-lived, remove the reference. // String currentLongLivedAttrName = ScopedServletUtils.getScopedSessionAttrName( CURRENT_LONGLIVED_ATTR, unwrappedRequest ); String currentLongLivedModulePath = ( String ) sh.getAttribute( rc, currentLongLivedAttrName ); if ( modulePath.equals( currentLongLivedModulePath ) ) { sh.removeAttribute( rc, currentLongLivedAttrName ); // depends on control dependency: [if], data = [none] } } }
public class class_name { public IDrawerItem generateMiniDrawerItem(IDrawerItem drawerItem) { if (drawerItem instanceof SecondaryDrawerItem) { return mIncludeSecondaryDrawerItems ? new MiniDrawerItem((SecondaryDrawerItem) drawerItem).withEnableSelectedBackground(mEnableSelectedMiniDrawerItemBackground).withSelectedBackgroundAnimated(false) : null; } else if (drawerItem instanceof PrimaryDrawerItem) { return new MiniDrawerItem((PrimaryDrawerItem) drawerItem).withEnableSelectedBackground(mEnableSelectedMiniDrawerItemBackground).withSelectedBackgroundAnimated(false); } else if (drawerItem instanceof ProfileDrawerItem) { MiniProfileDrawerItem mpdi = new MiniProfileDrawerItem((ProfileDrawerItem) drawerItem); mpdi.withEnabled(mEnableProfileClick); return mpdi; } return null; } }
public class class_name { public IDrawerItem generateMiniDrawerItem(IDrawerItem drawerItem) { if (drawerItem instanceof SecondaryDrawerItem) { return mIncludeSecondaryDrawerItems ? new MiniDrawerItem((SecondaryDrawerItem) drawerItem).withEnableSelectedBackground(mEnableSelectedMiniDrawerItemBackground).withSelectedBackgroundAnimated(false) : null; // depends on control dependency: [if], data = [none] } else if (drawerItem instanceof PrimaryDrawerItem) { return new MiniDrawerItem((PrimaryDrawerItem) drawerItem).withEnableSelectedBackground(mEnableSelectedMiniDrawerItemBackground).withSelectedBackgroundAnimated(false); // depends on control dependency: [if], data = [none] } else if (drawerItem instanceof ProfileDrawerItem) { MiniProfileDrawerItem mpdi = new MiniProfileDrawerItem((ProfileDrawerItem) drawerItem); mpdi.withEnabled(mEnableProfileClick); // depends on control dependency: [if], data = [none] return mpdi; // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { private List<CmsGalleryFolderBean> buildGalleriesList(Map<String, CmsGalleryTypeInfo> galleryTypes) { List<CmsGalleryFolderBean> list = new ArrayList<CmsGalleryFolderBean>(); if (galleryTypes == null) { return list; } Iterator<Entry<String, CmsGalleryTypeInfo>> iGalleryTypes = galleryTypes.entrySet().iterator(); while (iGalleryTypes.hasNext()) { Entry<String, CmsGalleryTypeInfo> ent = iGalleryTypes.next(); CmsGalleryTypeInfo tInfo = ent.getValue(); ArrayList<String> contentTypes = new ArrayList<String>(); Iterator<I_CmsResourceType> it = tInfo.getContentTypes().iterator(); while (it.hasNext()) { contentTypes.add(String.valueOf(it.next().getTypeName())); } Iterator<CmsResource> ir = tInfo.getGalleries().iterator(); while (ir.hasNext()) { CmsResource res = ir.next(); CmsGalleryFolderBean bean = new CmsGalleryFolderBean(); String sitePath = getCmsObject().getSitePath(res); String title = ""; try { // read the gallery title title = getCmsObject().readPropertyObject( sitePath, CmsPropertyDefinition.PROPERTY_TITLE, false).getValue(""); } catch (CmsException e) { // error reading title property logError(e); } // sitepath as gallery id bean.setPath(sitePath); // content types bean.setContentTypes(contentTypes); // title bean.setTitle(title); // gallery type name bean.setResourceType(tInfo.getResourceType().getTypeName()); bean.setEditable(isEditable(getCmsObject(), res)); bean.setBigIconClasses( CmsIconUtil.getIconClasses(CmsIconUtil.getDisplayType(getCmsObject(), res), sitePath, false)); list.add(bean); } } return list; } }
public class class_name { private List<CmsGalleryFolderBean> buildGalleriesList(Map<String, CmsGalleryTypeInfo> galleryTypes) { List<CmsGalleryFolderBean> list = new ArrayList<CmsGalleryFolderBean>(); if (galleryTypes == null) { return list; // depends on control dependency: [if], data = [none] } Iterator<Entry<String, CmsGalleryTypeInfo>> iGalleryTypes = galleryTypes.entrySet().iterator(); while (iGalleryTypes.hasNext()) { Entry<String, CmsGalleryTypeInfo> ent = iGalleryTypes.next(); CmsGalleryTypeInfo tInfo = ent.getValue(); ArrayList<String> contentTypes = new ArrayList<String>(); Iterator<I_CmsResourceType> it = tInfo.getContentTypes().iterator(); while (it.hasNext()) { contentTypes.add(String.valueOf(it.next().getTypeName())); // depends on control dependency: [while], data = [none] } Iterator<CmsResource> ir = tInfo.getGalleries().iterator(); while (ir.hasNext()) { CmsResource res = ir.next(); CmsGalleryFolderBean bean = new CmsGalleryFolderBean(); String sitePath = getCmsObject().getSitePath(res); String title = ""; try { // read the gallery title title = getCmsObject().readPropertyObject( sitePath, CmsPropertyDefinition.PROPERTY_TITLE, false).getValue(""); // depends on control dependency: [try], data = [none] } catch (CmsException e) { // error reading title property logError(e); } // depends on control dependency: [catch], data = [none] // sitepath as gallery id bean.setPath(sitePath); // depends on control dependency: [while], data = [none] // content types bean.setContentTypes(contentTypes); // depends on control dependency: [while], data = [none] // title bean.setTitle(title); // depends on control dependency: [while], data = [none] // gallery type name bean.setResourceType(tInfo.getResourceType().getTypeName()); // depends on control dependency: [while], data = [none] bean.setEditable(isEditable(getCmsObject(), res)); // depends on control dependency: [while], data = [none] bean.setBigIconClasses( CmsIconUtil.getIconClasses(CmsIconUtil.getDisplayType(getCmsObject(), res), sitePath, false)); // depends on control dependency: [while], data = [none] list.add(bean); // depends on control dependency: [while], data = [none] } } return list; } }
public class class_name { public final AbstractItemLink remove(long key) { AbstractItemLink link = null; synchronized (_getLock(key)) { if(null != _entry) /// 666212 {// 666212 int i = _indexOfKey(key); AbstractItemLink previousEntry = _entry[i]; AbstractItemLink thisEntry = previousEntry; while (null != thisEntry && null == link) { AbstractItemLink nextEntry = thisEntry.getNextMappedLink(); if (key == thisEntry.getID()) { link = thisEntry; _size.decrementAndGet(); // Defect 597160 if (previousEntry == thisEntry) { _entry[i] = nextEntry; } else { previousEntry.setNextMappedLink(nextEntry); } } previousEntry = thisEntry; thisEntry = nextEntry; } }// 666212 } return link; } }
public class class_name { public final AbstractItemLink remove(long key) { AbstractItemLink link = null; synchronized (_getLock(key)) { if(null != _entry) /// 666212 {// 666212 int i = _indexOfKey(key); AbstractItemLink previousEntry = _entry[i]; AbstractItemLink thisEntry = previousEntry; while (null != thisEntry && null == link) { AbstractItemLink nextEntry = thisEntry.getNextMappedLink(); if (key == thisEntry.getID()) { link = thisEntry; // depends on control dependency: [if], data = [none] _size.decrementAndGet(); // Defect 597160 // depends on control dependency: [if], data = [none] if (previousEntry == thisEntry) { _entry[i] = nextEntry; // depends on control dependency: [if], data = [none] } else { previousEntry.setNextMappedLink(nextEntry); // depends on control dependency: [if], data = [none] } } previousEntry = thisEntry; // depends on control dependency: [while], data = [none] thisEntry = nextEntry; // depends on control dependency: [while], data = [none] } }// 666212 } return link; } }
public class class_name { public static <T> T newInstance(final String className) { try { return (T) Thread.currentThread().getContextClassLoader().loadClass(className).newInstance(); } catch (final Exception e) { throw new RuntimeException(e); } } }
public class class_name { public static <T> T newInstance(final String className) { try { return (T) Thread.currentThread().getContextClassLoader().loadClass(className).newInstance(); // depends on control dependency: [try], data = [none] } catch (final Exception e) { throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected static <T> T _execute( final URL from_url, final HttpMethod method, final RequestCallback callback, final ResponseExtractor<T> extractor ) { _LOG_.debug( "HTTP: method = " + method + ", URL=" + from_url ); URI from_uri = null; try { from_uri = from_url.toURI(); //throws URISyntaxException } catch (URISyntaxException ex) { throw new HttpException( ex ); } T response = null; try { RestTemplate rest = new RestTemplate(); response = rest.execute( from_uri, method, callback, extractor ); } catch (RestClientException ex) { _LOG_.error( "HTTP error: " + ex ); throw new HttpException( ex ); } return response; } }
public class class_name { protected static <T> T _execute( final URL from_url, final HttpMethod method, final RequestCallback callback, final ResponseExtractor<T> extractor ) { _LOG_.debug( "HTTP: method = " + method + ", URL=" + from_url ); URI from_uri = null; try { from_uri = from_url.toURI(); // depends on control dependency: [try], data = [none] //throws URISyntaxException } catch (URISyntaxException ex) { throw new HttpException( ex ); } // depends on control dependency: [catch], data = [none] T response = null; try { RestTemplate rest = new RestTemplate(); response = rest.execute( from_uri, method, callback, extractor ); // depends on control dependency: [try], data = [none] } catch (RestClientException ex) { _LOG_.error( "HTTP error: " + ex ); throw new HttpException( ex ); } // depends on control dependency: [catch], data = [none] return response; } }
public class class_name { public void askSubscribers( Actor sender, String topic, Object message, Callback cb ) { List<ReceiverActor> subscriber = topic2Subscriber.get(topic); if ( subscriber != null ) { List<IPromise> results = subscriber.stream() .filter(subs -> !subs.equals(sender)) .map(subs -> subs.receiveAsk(topic, message)) .collect(Collectors.toList()); try { all((List) results).await(5000); // is non-blocking } catch (Exception ex) { // timeout goes here Log.Info(this, "timeout in broadcast"); } results.forEach( promise -> cb.pipe(promise.get())); cb.finish(); // important to release callback mapping in remoting ! } } }
public class class_name { public void askSubscribers( Actor sender, String topic, Object message, Callback cb ) { List<ReceiverActor> subscriber = topic2Subscriber.get(topic); if ( subscriber != null ) { List<IPromise> results = subscriber.stream() .filter(subs -> !subs.equals(sender)) .map(subs -> subs.receiveAsk(topic, message)) .collect(Collectors.toList()); try { all((List) results).await(5000); // is non-blocking // depends on control dependency: [try], data = [none] } catch (Exception ex) { // timeout goes here Log.Info(this, "timeout in broadcast"); } // depends on control dependency: [catch], data = [none] results.forEach( promise -> cb.pipe(promise.get())); // depends on control dependency: [if], data = [none] cb.finish(); // important to release callback mapping in remoting ! // depends on control dependency: [if], data = [none] } } }
public class class_name { private int getCarbonsCount(IAtomContainer ac, IAtom atom) { List<IAtom> neighbours = ac.getConnectedAtomsList(atom); int ccounter = 0; for (IAtom neighbour : neighbours) { if (neighbour.getSymbol().equals("C")) { if (!neighbour.getFlag(CDKConstants.ISAROMATIC)) { ccounter += 1; } } } return ccounter; } }
public class class_name { private int getCarbonsCount(IAtomContainer ac, IAtom atom) { List<IAtom> neighbours = ac.getConnectedAtomsList(atom); int ccounter = 0; for (IAtom neighbour : neighbours) { if (neighbour.getSymbol().equals("C")) { if (!neighbour.getFlag(CDKConstants.ISAROMATIC)) { ccounter += 1; // depends on control dependency: [if], data = [none] } } } return ccounter; } }
public class class_name { private void copyJnlpFiles() throws MavenReportException { if ( !jnlpSourceDirectory.exists() ) { throw new MavenReportException( "jnlpSourceDirectory does not exist" ); } try { File destinationDirectory = new File( outputDirectory, siteJnlpDirectory ); List<File> files = FileUtils.getFiles( jnlpSourceDirectory, "**/*", "" ); for ( File file : files ) { getLog().debug( "Copying " + file + " to " + destinationDirectory ); String path = file.getAbsolutePath().substring( jnlpSourceDirectory.getAbsolutePath().length() + 1 ); File destDir = new File( destinationDirectory, path ); getLog().debug( "Copying " + file + " to " + destDir ); if ( file.isDirectory() ) { destDir.mkdirs(); } else { FileUtils.copyFileToDirectory( file, destDir.getParentFile() ); } } } catch ( IOException e ) { throw new MavenReportException( "Failed to copy jnlp files", e ); } } }
public class class_name { private void copyJnlpFiles() throws MavenReportException { if ( !jnlpSourceDirectory.exists() ) { throw new MavenReportException( "jnlpSourceDirectory does not exist" ); } try { File destinationDirectory = new File( outputDirectory, siteJnlpDirectory ); List<File> files = FileUtils.getFiles( jnlpSourceDirectory, "**/*", "" ); for ( File file : files ) { getLog().debug( "Copying " + file + " to " + destinationDirectory ); // depends on control dependency: [for], data = [file] String path = file.getAbsolutePath().substring( jnlpSourceDirectory.getAbsolutePath().length() + 1 ); File destDir = new File( destinationDirectory, path ); getLog().debug( "Copying " + file + " to " + destDir ); // depends on control dependency: [for], data = [file] if ( file.isDirectory() ) { destDir.mkdirs(); // depends on control dependency: [if], data = [none] } else { FileUtils.copyFileToDirectory( file, destDir.getParentFile() ); // depends on control dependency: [if], data = [none] } } } catch ( IOException e ) { throw new MavenReportException( "Failed to copy jnlp files", e ); } } }
public class class_name { public boolean newPage() { if (!open || close) { return false; } DocListener listener; for (Iterator iterator = listeners.iterator(); iterator.hasNext();) { listener = (DocListener) iterator.next(); listener.newPage(); } return true; } }
public class class_name { public boolean newPage() { if (!open || close) { return false; // depends on control dependency: [if], data = [none] } DocListener listener; for (Iterator iterator = listeners.iterator(); iterator.hasNext();) { listener = (DocListener) iterator.next(); // depends on control dependency: [for], data = [iterator] listener.newPage(); // depends on control dependency: [for], data = [none] } return true; } }
public class class_name { public static IntIterator mergeAscending(List<IntIterator> iterators) { if (iterators.isEmpty()) { return IntIterators.EMPTY_ITERATOR; } if (iterators.size() == 1) { return iterators.get(0); } return new MergeIntIterator(iterators); } }
public class class_name { public static IntIterator mergeAscending(List<IntIterator> iterators) { if (iterators.isEmpty()) { return IntIterators.EMPTY_ITERATOR; // depends on control dependency: [if], data = [none] } if (iterators.size() == 1) { return iterators.get(0); // depends on control dependency: [if], data = [none] } return new MergeIntIterator(iterators); } }
public class class_name { public CreateRobotApplicationResult withSources(Source... sources) { if (this.sources == null) { setSources(new java.util.ArrayList<Source>(sources.length)); } for (Source ele : sources) { this.sources.add(ele); } return this; } }
public class class_name { public CreateRobotApplicationResult withSources(Source... sources) { if (this.sources == null) { setSources(new java.util.ArrayList<Source>(sources.length)); // depends on control dependency: [if], data = [none] } for (Source ele : sources) { this.sources.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { @Subscribe public void onLogout(LogoutRequestEvent event) { Subject subject = ThreadContext.getSubject(); if (subject != null) { subject.logout(); } } }
public class class_name { @Subscribe public void onLogout(LogoutRequestEvent event) { Subject subject = ThreadContext.getSubject(); if (subject != null) { subject.logout(); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected void findConfig() { String propLocation = sc.getInitParameter(PROP_LOCATION); if (Strings.isBlank(propLocation)) { propLocation = "nutz.properties"; } PropertiesProxy pp = new PropertiesProxy(); Enumeration<String> params = sc.getInitParameterNames(); while (params.hasMoreElements()) { String name = (String) params.nextElement(); if (name.startsWith("nutz-")) { pp.put(name, sc.getInitParameter(name).trim()); } } // 先找找classpath InputStream in = getClass().getClassLoader().getResourceAsStream("/" + propLocation); if (in == null) { in = sc.getResourceAsStream("/WEB-INF/" + propLocation); } if (in == null) { log.debug(propLocation + " not found"); } else { pp = new PropertiesProxy(in); Streams.safeClose(in); } this.pp = pp; } }
public class class_name { protected void findConfig() { String propLocation = sc.getInitParameter(PROP_LOCATION); if (Strings.isBlank(propLocation)) { propLocation = "nutz.properties"; // depends on control dependency: [if], data = [none] } PropertiesProxy pp = new PropertiesProxy(); Enumeration<String> params = sc.getInitParameterNames(); while (params.hasMoreElements()) { String name = (String) params.nextElement(); if (name.startsWith("nutz-")) { pp.put(name, sc.getInitParameter(name).trim()); // depends on control dependency: [if], data = [none] } } // 先找找classpath InputStream in = getClass().getClassLoader().getResourceAsStream("/" + propLocation); if (in == null) { in = sc.getResourceAsStream("/WEB-INF/" + propLocation); // depends on control dependency: [if], data = [none] } if (in == null) { log.debug(propLocation + " not found"); // depends on control dependency: [if], data = [none] } else { pp = new PropertiesProxy(in); // depends on control dependency: [if], data = [(in] Streams.safeClose(in); // depends on control dependency: [if], data = [(in] } this.pp = pp; } }
public class class_name { private void addChildren(final UIClassification _parent, final Set<Classification> _children, final Set<UUID> _selectedUUID, final Instance _instance) throws EFapsException { for (final Classification child : _children) { boolean access; if (!child.isAbstract()) { final Instance inst = AbstractInstanceObject.getInstance4Create(child); access = child.hasAccess(inst, getMode() == TargetMode.CREATE || getMode() == TargetMode.EDIT ? AccessTypeEnums.CREATE.getAccessType() : AccessTypeEnums.SHOW.getAccessType()); } else { access = true; } if (access) { final UIClassification childUI = new UIClassification(child.getUUID(), _parent.mode, false); if (_selectedUUID.contains(child.getUUID())) { childUI.selected = true; } childUI.addChildren(childUI, child.getChildClassifications(), _selectedUUID, _instance); _parent.children.add(childUI); childUI.setParent(_parent); } } Collections.sort(_parent.children, new Comparator<UIClassification>() { @Override public int compare(final UIClassification _class0, final UIClassification _class2) { return _class0.getLabel().compareTo(_class2.getLabel()); } }); } }
public class class_name { private void addChildren(final UIClassification _parent, final Set<Classification> _children, final Set<UUID> _selectedUUID, final Instance _instance) throws EFapsException { for (final Classification child : _children) { boolean access; if (!child.isAbstract()) { final Instance inst = AbstractInstanceObject.getInstance4Create(child); access = child.hasAccess(inst, getMode() == TargetMode.CREATE || getMode() == TargetMode.EDIT ? AccessTypeEnums.CREATE.getAccessType() : AccessTypeEnums.SHOW.getAccessType()); // depends on control dependency: [if], data = [none] } else { access = true; // depends on control dependency: [if], data = [none] } if (access) { final UIClassification childUI = new UIClassification(child.getUUID(), _parent.mode, false); if (_selectedUUID.contains(child.getUUID())) { childUI.selected = true; // depends on control dependency: [if], data = [none] } childUI.addChildren(childUI, child.getChildClassifications(), _selectedUUID, _instance); // depends on control dependency: [if], data = [none] _parent.children.add(childUI); // depends on control dependency: [if], data = [none] childUI.setParent(_parent); // depends on control dependency: [if], data = [none] } } Collections.sort(_parent.children, new Comparator<UIClassification>() { @Override public int compare(final UIClassification _class0, final UIClassification _class2) { return _class0.getLabel().compareTo(_class2.getLabel()); } }); } }
public class class_name { public static void main(String[] args) { if (args.length == EXPECTED_NUMBER_ARGS) { final String encryptValue = new EncryptProperty().encryptValue(args[0], args[1]); System.out.println(ENCRYPTED_VALUE +encryptValue); System.out.println(ENCRYPTED_PROPERTY_VALUE + ENC_CONTENT_PREFIX +encryptValue +ENC_CONTENT_SUFFIX); } else { System.out.println(HELP_MESSAGE); } } }
public class class_name { public static void main(String[] args) { if (args.length == EXPECTED_NUMBER_ARGS) { final String encryptValue = new EncryptProperty().encryptValue(args[0], args[1]); System.out.println(ENCRYPTED_VALUE +encryptValue); // depends on control dependency: [if], data = [none] System.out.println(ENCRYPTED_PROPERTY_VALUE + ENC_CONTENT_PREFIX +encryptValue +ENC_CONTENT_SUFFIX); // depends on control dependency: [if], data = [none] } else { System.out.println(HELP_MESSAGE); // depends on control dependency: [if], data = [none] } } }
public class class_name { public <E extends Edge> double[] compute(Graph<E> g) { // Perform a quick test for whether the vertices of g are a contiguous // sequence starting at 0, which makes the vertex mapping trivial if (!hasContiguousVertices(g)) throw new IllegalArgumentException( "Vertices must be in continugous order"); double[] centralities = new double[g.order()]; IntIterator vertexIter = g.vertices().iterator(); while (vertexIter.hasNext()) { int s = vertexIter.nextInt(); Deque<Integer> S = new ArrayDeque<Integer>(); // Initialize P to an empty list for each vertex List<List<Integer>> P = new ArrayList<List<Integer>>(g.order()); for (int i = 0; i < g.order(); ++i) P.add(new ArrayList<Integer>()); double[] sigma = new double[g.order()]; sigma[s] = 1; double[] d = new double[g.order()]; Arrays.fill(d, -1); d[s] = 0; Queue<Integer> Q = new ArrayDeque<Integer>(); Q.add(s); while (!Q.isEmpty()) { int v = Q.poll(); S.offer(v); IntIterator neighborIter = g.getNeighbors(v).iterator(); while (neighborIter.hasNext()) { int w = neighborIter.nextInt(); // Check whether this is the first time we've seen vertex w if (d[w] < 0) { Q.offer(w); d[w] = d[v] + 1; } // Check whether the shortest path to w is through v if (d[w] == d[v] + 1) { sigma[w] += sigma[v]; P.get(w).add(v); } } } double[] delta = new double[g.order()]; // S as a stack returns vertices in order of their non-increasing // distance from vertex s while (!S.isEmpty()) { int w = S.pollLast(); // get the top of the stack for (int v : P.get(w)) { delta[v] += (sigma[v] / sigma[w]) * (1 + delta[w]); } if (w != s) { centralities[w] += delta[w]; } } } return centralities; } }
public class class_name { public <E extends Edge> double[] compute(Graph<E> g) { // Perform a quick test for whether the vertices of g are a contiguous // sequence starting at 0, which makes the vertex mapping trivial if (!hasContiguousVertices(g)) throw new IllegalArgumentException( "Vertices must be in continugous order"); double[] centralities = new double[g.order()]; IntIterator vertexIter = g.vertices().iterator(); while (vertexIter.hasNext()) { int s = vertexIter.nextInt(); Deque<Integer> S = new ArrayDeque<Integer>(); // Initialize P to an empty list for each vertex List<List<Integer>> P = new ArrayList<List<Integer>>(g.order()); for (int i = 0; i < g.order(); ++i) P.add(new ArrayList<Integer>()); double[] sigma = new double[g.order()]; sigma[s] = 1; // depends on control dependency: [while], data = [none] double[] d = new double[g.order()]; Arrays.fill(d, -1); // depends on control dependency: [while], data = [none] d[s] = 0; // depends on control dependency: [while], data = [none] Queue<Integer> Q = new ArrayDeque<Integer>(); Q.add(s); // depends on control dependency: [while], data = [none] while (!Q.isEmpty()) { int v = Q.poll(); S.offer(v); // depends on control dependency: [while], data = [none] IntIterator neighborIter = g.getNeighbors(v).iterator(); while (neighborIter.hasNext()) { int w = neighborIter.nextInt(); // Check whether this is the first time we've seen vertex w if (d[w] < 0) { Q.offer(w); // depends on control dependency: [if], data = [none] d[w] = d[v] + 1; // depends on control dependency: [if], data = [none] } // Check whether the shortest path to w is through v if (d[w] == d[v] + 1) { sigma[w] += sigma[v]; // depends on control dependency: [if], data = [none] P.get(w).add(v); // depends on control dependency: [if], data = [none] } } } double[] delta = new double[g.order()]; // S as a stack returns vertices in order of their non-increasing // distance from vertex s while (!S.isEmpty()) { int w = S.pollLast(); // get the top of the stack for (int v : P.get(w)) { delta[v] += (sigma[v] / sigma[w]) * (1 + delta[w]); // depends on control dependency: [for], data = [v] } if (w != s) { centralities[w] += delta[w]; // depends on control dependency: [if], data = [none] } } } return centralities; } }
public class class_name { private List<Deployment> defaultDeployments(List<Deployment> deployments) { List<Deployment> defaults = new ArrayList<Deployment>(); for (Deployment deployment : deployments) { if (deployment.getDescription().getName().equals(DeploymentTargetDescription.DEFAULT.getName())) { defaults.add(deployment); } } return defaults; } }
public class class_name { private List<Deployment> defaultDeployments(List<Deployment> deployments) { List<Deployment> defaults = new ArrayList<Deployment>(); for (Deployment deployment : deployments) { if (deployment.getDescription().getName().equals(DeploymentTargetDescription.DEFAULT.getName())) { defaults.add(deployment); // depends on control dependency: [if], data = [none] } } return defaults; } }
public class class_name { public static String dateOffset(String initial, String offset) { Date date = convertFromAgmipDateString(initial); BigInteger iOffset; if (date == null) { // Invalid date return null; } GregorianCalendar cal = new GregorianCalendar(); cal.setTime(date); try { iOffset = new BigInteger(offset); cal.add(GregorianCalendar.DAY_OF_MONTH, iOffset.intValue()); } catch (Exception ex) { return null; } return convertToAgmipDateString(cal.getTime()); } }
public class class_name { public static String dateOffset(String initial, String offset) { Date date = convertFromAgmipDateString(initial); BigInteger iOffset; if (date == null) { // Invalid date return null; // depends on control dependency: [if], data = [none] } GregorianCalendar cal = new GregorianCalendar(); cal.setTime(date); try { iOffset = new BigInteger(offset); // depends on control dependency: [try], data = [none] cal.add(GregorianCalendar.DAY_OF_MONTH, iOffset.intValue()); // depends on control dependency: [try], data = [none] } catch (Exception ex) { return null; } // depends on control dependency: [catch], data = [none] return convertToAgmipDateString(cal.getTime()); } }
public class class_name { public final EObject ruleParameterReference() throws RecognitionException { EObject current = null; Token otherlv_0=null; enterRule(); try { // InternalXtext.g:2029:2: ( ( (otherlv_0= RULE_ID ) ) ) // InternalXtext.g:2030:2: ( (otherlv_0= RULE_ID ) ) { // InternalXtext.g:2030:2: ( (otherlv_0= RULE_ID ) ) // InternalXtext.g:2031:3: (otherlv_0= RULE_ID ) { // InternalXtext.g:2031:3: (otherlv_0= RULE_ID ) // InternalXtext.g:2032:4: otherlv_0= RULE_ID { if (current==null) { current = createModelElement(grammarAccess.getParameterReferenceRule()); } otherlv_0=(Token)match(input,RULE_ID,FollowSets000.FOLLOW_2); newLeafNode(otherlv_0, grammarAccess.getParameterReferenceAccess().getParameterParameterCrossReference_0()); } } } leaveRule(); } catch (RecognitionException re) { recover(input,re); appendSkippedTokens(); } finally { } return current; } }
public class class_name { public final EObject ruleParameterReference() throws RecognitionException { EObject current = null; Token otherlv_0=null; enterRule(); try { // InternalXtext.g:2029:2: ( ( (otherlv_0= RULE_ID ) ) ) // InternalXtext.g:2030:2: ( (otherlv_0= RULE_ID ) ) { // InternalXtext.g:2030:2: ( (otherlv_0= RULE_ID ) ) // InternalXtext.g:2031:3: (otherlv_0= RULE_ID ) { // InternalXtext.g:2031:3: (otherlv_0= RULE_ID ) // InternalXtext.g:2032:4: otherlv_0= RULE_ID { if (current==null) { current = createModelElement(grammarAccess.getParameterReferenceRule()); // depends on control dependency: [if], data = [none] } otherlv_0=(Token)match(input,RULE_ID,FollowSets000.FOLLOW_2); newLeafNode(otherlv_0, grammarAccess.getParameterReferenceAccess().getParameterParameterCrossReference_0()); } } } leaveRule(); } catch (RecognitionException re) { recover(input,re); appendSkippedTokens(); } finally { } return current; } }
public class class_name { static void setSingleParam(String key, String value, DbConn cnx) { QueryResult r = cnx.runUpdate("globalprm_update_value_by_key", value, key); if (r.nbUpdated == 0) { cnx.runUpdate("globalprm_insert", key, value); } cnx.commit(); } }
public class class_name { static void setSingleParam(String key, String value, DbConn cnx) { QueryResult r = cnx.runUpdate("globalprm_update_value_by_key", value, key); if (r.nbUpdated == 0) { cnx.runUpdate("globalprm_insert", key, value); // depends on control dependency: [if], data = [none] } cnx.commit(); } }
public class class_name { protected static boolean locateMatchingAttributeValue(final String attrName, final String attrValue, final Map<String, List<Object>> attributes, final boolean matchIfNoValueProvided) { LOGGER.debug("Locating matching attribute [{}] with value [{}] amongst the attribute collection [{}]", attrName, attrValue, attributes); if (StringUtils.isBlank(attrName)) { LOGGER.debug("Failed to match since attribute name is undefined"); return false; } val names = attributes.entrySet() .stream() .filter(e -> { LOGGER.debug("Attempting to match [{}] against [{}]", attrName, e.getKey()); return e.getKey().matches(attrName); }) .collect(Collectors.toSet()); LOGGER.debug("Found [{}] attributes relevant for multifactor authentication bypass", names.size()); if (names.isEmpty()) { return false; } if (StringUtils.isBlank(attrValue)) { LOGGER.debug("No attribute value to match is provided; Match result is set to [{}]", matchIfNoValueProvided); return matchIfNoValueProvided; } val values = names .stream() .filter(e -> { val valuesCol = CollectionUtils.toCollection(e.getValue()); LOGGER.debug("Matching attribute [{}] with values [{}] against [{}]", e.getKey(), valuesCol, attrValue); return valuesCol .stream() .anyMatch(v -> v.toString().matches(attrValue)); }).collect(Collectors.toSet()); LOGGER.debug("Matching attribute values remaining are [{}]", values); return !values.isEmpty(); } }
public class class_name { protected static boolean locateMatchingAttributeValue(final String attrName, final String attrValue, final Map<String, List<Object>> attributes, final boolean matchIfNoValueProvided) { LOGGER.debug("Locating matching attribute [{}] with value [{}] amongst the attribute collection [{}]", attrName, attrValue, attributes); if (StringUtils.isBlank(attrName)) { LOGGER.debug("Failed to match since attribute name is undefined"); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } val names = attributes.entrySet() .stream() .filter(e -> { LOGGER.debug("Attempting to match [{}] against [{}]", attrName, e.getKey()); return e.getKey().matches(attrName); }) .collect(Collectors.toSet()); LOGGER.debug("Found [{}] attributes relevant for multifactor authentication bypass", names.size()); if (names.isEmpty()) { return false; } if (StringUtils.isBlank(attrValue)) { LOGGER.debug("No attribute value to match is provided; Match result is set to [{}]", matchIfNoValueProvided); return matchIfNoValueProvided; } val values = names .stream() .filter(e -> { val valuesCol = CollectionUtils.toCollection(e.getValue()); LOGGER.debug("Matching attribute [{}] with values [{}] against [{}]", e.getKey(), valuesCol, attrValue); return valuesCol .stream() .anyMatch(v -> v.toString().matches(attrValue)); }).collect(Collectors.toSet()); LOGGER.debug("Matching attribute values remaining are [{}]", values); return !values.isEmpty(); } }
public class class_name { private Integer remove(String name, Integer defaultValue, int min, TimeUnit units, int... range) throws Exception { Object value = null; for (int diff; value == null && entry != null && (diff = entry.getKey().compareTo(name)) <= 0; entry = entries.pollFirstEntry()) { if (diff == 0) // matched value = entry.getValue(); else { // TODO: when we have a stricter variant of onError, apply it to unrecognized attributes if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "unrecognized attribute: " + entry.getKey()); //SQLException ex = AdapterUtil.ignoreWarnOrFail(tc, null, SQLException.class, "PROP_NOT_FOUND", jndiName == null ? id : jndiName, entry.getKey()); //if (ex != null) // throw ex; } } long l; if (value == null) return defaultValue; else if (value instanceof Number) l = ((Number) value).longValue(); else try { l = units == null ? Integer.parseInt((String) value) : MetatypeUtils.evaluateDuration((String) value, units); } catch (Exception x) { x = connectorSvc.ignoreWarnOrFail(null, x, x.getClass(), "UNSUPPORTED_VALUE_J2CA8011", value, name, jndiName == null ? id : jndiName); if (x == null) return defaultValue; else throw x; } if (l < min || l > Integer.MAX_VALUE || range.length > 0 && Arrays.binarySearch(range, (int) l) < 0) { SQLNonTransientException x = connectorSvc.ignoreWarnOrFail (null, null, SQLNonTransientException.class, "UNSUPPORTED_VALUE_J2CA8011", value, name, jndiName == null ? id : jndiName); if (x == null) return defaultValue; else throw x; } return (int) l; } }
public class class_name { private Integer remove(String name, Integer defaultValue, int min, TimeUnit units, int... range) throws Exception { Object value = null; for (int diff; value == null && entry != null && (diff = entry.getKey().compareTo(name)) <= 0; entry = entries.pollFirstEntry()) { if (diff == 0) // matched value = entry.getValue(); else { // TODO: when we have a stricter variant of onError, apply it to unrecognized attributes if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "unrecognized attribute: " + entry.getKey()); //SQLException ex = AdapterUtil.ignoreWarnOrFail(tc, null, SQLException.class, "PROP_NOT_FOUND", jndiName == null ? id : jndiName, entry.getKey()); //if (ex != null) // throw ex; } } long l; if (value == null) return defaultValue; else if (value instanceof Number) l = ((Number) value).longValue(); else try { l = units == null ? Integer.parseInt((String) value) : MetatypeUtils.evaluateDuration((String) value, units); // depends on control dependency: [try], data = [none] } catch (Exception x) { x = connectorSvc.ignoreWarnOrFail(null, x, x.getClass(), "UNSUPPORTED_VALUE_J2CA8011", value, name, jndiName == null ? id : jndiName); if (x == null) return defaultValue; else throw x; } // depends on control dependency: [catch], data = [none] if (l < min || l > Integer.MAX_VALUE || range.length > 0 && Arrays.binarySearch(range, (int) l) < 0) { SQLNonTransientException x = connectorSvc.ignoreWarnOrFail (null, null, SQLNonTransientException.class, "UNSUPPORTED_VALUE_J2CA8011", value, name, jndiName == null ? id : jndiName); if (x == null) return defaultValue; else throw x; } return (int) l; } }
public class class_name { private static Border createTableHeaderEmptyColumnPainter(final JTable table) { return new AbstractBorder() { @Override public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { // if this JTableHeader is parented in a JViewport, then paint // the table header background to the right of the last column // if neccessary. Container viewport = table.getParent(); if ((viewport instanceof JViewport) && table.getWidth() < viewport.getWidth()) { int startX = table.getWidth(); int emptyColumnWidth = viewport.getWidth() - table.getWidth(); TableCellRenderer renderer = table.getTableHeader().getDefaultRenderer(); // Rossi: Fix for indexoutofbounds exception: A try catch might be good too? Component component = renderer.getTableCellRendererComponent(table, "", false, false, 0, table.getColumnCount()-1); component.setBounds(0, 0, emptyColumnWidth, table.getTableHeader().getHeight()); ((JComponent) component).setOpaque(true); CELL_RENDER_PANE.paintComponent(g, component, null, startX, 0, emptyColumnWidth + 1, table.getTableHeader().getHeight(), true); } } }; } }
public class class_name { private static Border createTableHeaderEmptyColumnPainter(final JTable table) { return new AbstractBorder() { @Override public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { // if this JTableHeader is parented in a JViewport, then paint // the table header background to the right of the last column // if neccessary. Container viewport = table.getParent(); if ((viewport instanceof JViewport) && table.getWidth() < viewport.getWidth()) { int startX = table.getWidth(); int emptyColumnWidth = viewport.getWidth() - table.getWidth(); TableCellRenderer renderer = table.getTableHeader().getDefaultRenderer(); // Rossi: Fix for indexoutofbounds exception: A try catch might be good too? Component component = renderer.getTableCellRendererComponent(table, "", false, false, 0, table.getColumnCount()-1); component.setBounds(0, 0, emptyColumnWidth, table.getTableHeader().getHeight()); // depends on control dependency: [if], data = [none] ((JComponent) component).setOpaque(true); // depends on control dependency: [if], data = [none] CELL_RENDER_PANE.paintComponent(g, component, null, startX, 0, emptyColumnWidth + 1, table.getTableHeader().getHeight(), true); // depends on control dependency: [if], data = [none] } } }; } }
public class class_name { public static UUID from128(byte[] data, int offset, boolean littleEndian) { if (data == null || offset < 0 || data.length <= (offset + 15) || (Integer.MAX_VALUE - 15) < offset) { return null; } String uuid; if (littleEndian) { uuid = String.format(GENERIC_UUID_FORMAT, data[offset + 15] & 0xFF, data[offset + 14] & 0xFF, data[offset + 13] & 0xFF, data[offset + 12] & 0xFF, data[offset + 11] & 0xFF, data[offset + 10] & 0xFF, data[offset + 9] & 0xFF, data[offset + 8] & 0xFF, data[offset + 7] & 0xFF, data[offset + 6] & 0xFF, data[offset + 5] & 0xFF, data[offset + 4] & 0xFF, data[offset + 3] & 0xFF, data[offset + 2] & 0xFF, data[offset + 1] & 0xFF, data[offset + 0] & 0xFF); } else { uuid = String.format(GENERIC_UUID_FORMAT, data[offset + 0] & 0xFF, data[offset + 1] & 0xFF, data[offset + 2] & 0xFF, data[offset + 3] & 0xFF, data[offset + 4] & 0xFF, data[offset + 5] & 0xFF, data[offset + 6] & 0xFF, data[offset + 7] & 0xFF, data[offset + 8] & 0xFF, data[offset + 9] & 0xFF, data[offset + 10] & 0xFF, data[offset + 11] & 0xFF, data[offset + 12] & 0xFF, data[offset + 13] & 0xFF, data[offset + 14] & 0xFF, data[offset + 15] & 0xFF); } return UUID.fromString(uuid); } }
public class class_name { public static UUID from128(byte[] data, int offset, boolean littleEndian) { if (data == null || offset < 0 || data.length <= (offset + 15) || (Integer.MAX_VALUE - 15) < offset) { return null; // depends on control dependency: [if], data = [none] } String uuid; if (littleEndian) { uuid = String.format(GENERIC_UUID_FORMAT, data[offset + 15] & 0xFF, data[offset + 14] & 0xFF, data[offset + 13] & 0xFF, data[offset + 12] & 0xFF, data[offset + 11] & 0xFF, data[offset + 10] & 0xFF, data[offset + 9] & 0xFF, data[offset + 8] & 0xFF, data[offset + 7] & 0xFF, data[offset + 6] & 0xFF, data[offset + 5] & 0xFF, data[offset + 4] & 0xFF, data[offset + 3] & 0xFF, data[offset + 2] & 0xFF, data[offset + 1] & 0xFF, data[offset + 0] & 0xFF); // depends on control dependency: [if], data = [none] } else { uuid = String.format(GENERIC_UUID_FORMAT, data[offset + 0] & 0xFF, data[offset + 1] & 0xFF, data[offset + 2] & 0xFF, data[offset + 3] & 0xFF, data[offset + 4] & 0xFF, data[offset + 5] & 0xFF, data[offset + 6] & 0xFF, data[offset + 7] & 0xFF, data[offset + 8] & 0xFF, data[offset + 9] & 0xFF, data[offset + 10] & 0xFF, data[offset + 11] & 0xFF, data[offset + 12] & 0xFF, data[offset + 13] & 0xFF, data[offset + 14] & 0xFF, data[offset + 15] & 0xFF); // depends on control dependency: [if], data = [none] } return UUID.fromString(uuid); } }
public class class_name { public long checkPause() { if (pauseOnLongQueue && (getNumOfPendingMessages() > queue4Sink.remainingCapacity() || getNumOfPendingMessages() > MAX_PENDING_MESSAGES_TO_PAUSE)) { double throughputRate = Math.max(throughput.meanRate(), 1.0); return (long) (getNumOfPendingMessages() / throughputRate); } else { return 0; } } }
public class class_name { public long checkPause() { if (pauseOnLongQueue && (getNumOfPendingMessages() > queue4Sink.remainingCapacity() || getNumOfPendingMessages() > MAX_PENDING_MESSAGES_TO_PAUSE)) { double throughputRate = Math.max(throughput.meanRate(), 1.0); return (long) (getNumOfPendingMessages() / throughputRate); // depends on control dependency: [if], data = [none] } else { return 0; // depends on control dependency: [if], data = [none] } } }
public class class_name { private boolean validateResourceIsValid(final Resource externalResource) { boolean isValid = true; try { URL url = externalResource.getURL(); if (url.getPath() != null && url.getPath().contains(".jar") && !url.getPath().contains("dummyConfig")) { throw new IllegalArgumentException("The customer config file: \"config.properties\" was found in a jar file. This is not legal. Offending jar is: " + url.getPath()); } } catch (IOException e) { isValid = false; } return isValid; } }
public class class_name { private boolean validateResourceIsValid(final Resource externalResource) { boolean isValid = true; try { URL url = externalResource.getURL(); if (url.getPath() != null && url.getPath().contains(".jar") && !url.getPath().contains("dummyConfig")) { throw new IllegalArgumentException("The customer config file: \"config.properties\" was found in a jar file. This is not legal. Offending jar is: " + url.getPath()); } } catch (IOException e) { isValid = false; } // depends on control dependency: [catch], data = [none] return isValid; } }
public class class_name { public char[] toCharArray() { if (size == 0) { return ArrayUtils.EMPTY_CHAR_ARRAY; } final char chars[] = new char[size]; System.arraycopy(buffer, 0, chars, 0, size); return chars; } }
public class class_name { public char[] toCharArray() { if (size == 0) { return ArrayUtils.EMPTY_CHAR_ARRAY; // depends on control dependency: [if], data = [none] } final char chars[] = new char[size]; System.arraycopy(buffer, 0, chars, 0, size); return chars; } }
public class class_name { protected RestAdapter getRestAdapterApiFour() { if (restAdapterApiFour == null) { RestAdapter.Builder builder = newRestAdapterBuilder(); builder.setEndpoint(API_V4_URL); if (isDebug) { builder.setLogLevel(RestAdapter.LogLevel.FULL); } restAdapterApiFour = builder.build(); } return restAdapterApiFour; } }
public class class_name { protected RestAdapter getRestAdapterApiFour() { if (restAdapterApiFour == null) { RestAdapter.Builder builder = newRestAdapterBuilder(); builder.setEndpoint(API_V4_URL); // depends on control dependency: [if], data = [none] if (isDebug) { builder.setLogLevel(RestAdapter.LogLevel.FULL); // depends on control dependency: [if], data = [none] } restAdapterApiFour = builder.build(); // depends on control dependency: [if], data = [none] } return restAdapterApiFour; } }
public class class_name { synchronized public static void restart() { if (null != crontabSetting) { //重新读取配置文件 crontabSetting.load(); } if (scheduler.isStarted()) { //关闭并清除已有任务 scheduler.stop(true); } //重新加载任务 schedule(crontabSetting); //重新启动 scheduler.start(); } }
public class class_name { synchronized public static void restart() { if (null != crontabSetting) { //重新读取配置文件 crontabSetting.load(); // depends on control dependency: [if], data = [none] } if (scheduler.isStarted()) { //关闭并清除已有任务 scheduler.stop(true); // depends on control dependency: [if], data = [none] } //重新加载任务 schedule(crontabSetting); //重新启动 scheduler.start(); } }
public class class_name { public final void selector() throws RecognitionException { int selector_StartIndex = input.index(); try { if ( state.backtracking>0 && alreadyParsedRule(input, 138) ) { return; } // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1284:5: ( '.' methodName ( arguments )? | '.' 'this' | '.' 'super' superSuffix | '.' 'new' ( nonWildcardTypeArguments )? innerCreator | '[' expression ']' ) int alt189=5; int LA189_0 = input.LA(1); if ( (LA189_0==47) ) { switch ( input.LA(2) ) { case 111: { alt189=2; } break; case 108: { alt189=3; } break; case 97: { alt189=4; } break; case Identifier: case 75: case 90: case 95: case 103: case 117: { alt189=1; } break; default: if (state.backtracking>0) {state.failed=true; return;} int nvaeMark = input.mark(); try { input.consume(); NoViableAltException nvae = new NoViableAltException("", 189, 1, input); throw nvae; } finally { input.rewind(nvaeMark); } } } else if ( (LA189_0==59) ) { alt189=5; } else { if (state.backtracking>0) {state.failed=true; return;} NoViableAltException nvae = new NoViableAltException("", 189, 0, input); throw nvae; } switch (alt189) { case 1 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1284:7: '.' methodName ( arguments )? { match(input,47,FOLLOW_47_in_selector6270); if (state.failed) return; pushFollow(FOLLOW_methodName_in_selector6272); methodName(); state._fsp--; if (state.failed) return; // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1284:22: ( arguments )? int alt187=2; int LA187_0 = input.LA(1); if ( (LA187_0==36) ) { alt187=1; } switch (alt187) { case 1 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1284:23: arguments { pushFollow(FOLLOW_arguments_in_selector6275); arguments(); state._fsp--; if (state.failed) return; } break; } } break; case 2 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1285:9: '.' 'this' { match(input,47,FOLLOW_47_in_selector6287); if (state.failed) return; match(input,111,FOLLOW_111_in_selector6289); if (state.failed) return; } break; case 3 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1286:9: '.' 'super' superSuffix { match(input,47,FOLLOW_47_in_selector6299); if (state.failed) return; match(input,108,FOLLOW_108_in_selector6301); if (state.failed) return; pushFollow(FOLLOW_superSuffix_in_selector6303); superSuffix(); state._fsp--; if (state.failed) return; } break; case 4 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1287:9: '.' 'new' ( nonWildcardTypeArguments )? innerCreator { match(input,47,FOLLOW_47_in_selector6313); if (state.failed) return; match(input,97,FOLLOW_97_in_selector6315); if (state.failed) return; // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1287:19: ( nonWildcardTypeArguments )? int alt188=2; int LA188_0 = input.LA(1); if ( (LA188_0==53) ) { alt188=1; } switch (alt188) { case 1 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1287:20: nonWildcardTypeArguments { pushFollow(FOLLOW_nonWildcardTypeArguments_in_selector6318); nonWildcardTypeArguments(); state._fsp--; if (state.failed) return; } break; } pushFollow(FOLLOW_innerCreator_in_selector6322); innerCreator(); state._fsp--; if (state.failed) return; } break; case 5 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1288:9: '[' expression ']' { match(input,59,FOLLOW_59_in_selector6332); if (state.failed) return; pushFollow(FOLLOW_expression_in_selector6334); expression(); state._fsp--; if (state.failed) return; match(input,60,FOLLOW_60_in_selector6336); if (state.failed) return; } break; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving if ( state.backtracking>0 ) { memoize(input, 138, selector_StartIndex); } } } }
public class class_name { public final void selector() throws RecognitionException { int selector_StartIndex = input.index(); try { if ( state.backtracking>0 && alreadyParsedRule(input, 138) ) { return; } // depends on control dependency: [if], data = [none] // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1284:5: ( '.' methodName ( arguments )? | '.' 'this' | '.' 'super' superSuffix | '.' 'new' ( nonWildcardTypeArguments )? innerCreator | '[' expression ']' ) int alt189=5; int LA189_0 = input.LA(1); if ( (LA189_0==47) ) { switch ( input.LA(2) ) { case 111: { alt189=2; } break; case 108: { alt189=3; } break; case 97: { alt189=4; } break; case Identifier: case 75: case 90: case 95: case 103: case 117: { alt189=1; } break; default: if (state.backtracking>0) {state.failed=true; return;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] int nvaeMark = input.mark(); try { input.consume(); // depends on control dependency: [try], data = [none] NoViableAltException nvae = new NoViableAltException("", 189, 1, input); throw nvae; } finally { input.rewind(nvaeMark); } } } else if ( (LA189_0==59) ) { alt189=5; } else { if (state.backtracking>0) {state.failed=true; return;} NoViableAltException nvae = new NoViableAltException("", 189, 0, input); throw nvae; } switch (alt189) { case 1 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1284:7: '.' methodName ( arguments )? { match(input,47,FOLLOW_47_in_selector6270); if (state.failed) return; pushFollow(FOLLOW_methodName_in_selector6272); methodName(); state._fsp--; if (state.failed) return; // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1284:22: ( arguments )? int alt187=2; int LA187_0 = input.LA(1); if ( (LA187_0==36) ) { alt187=1; } switch (alt187) { case 1 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1284:23: arguments { pushFollow(FOLLOW_arguments_in_selector6275); arguments(); state._fsp--; if (state.failed) return; } break; } } break; case 2 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1285:9: '.' 'this' { match(input,47,FOLLOW_47_in_selector6287); if (state.failed) return; match(input,111,FOLLOW_111_in_selector6289); if (state.failed) return; } break; case 3 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1286:9: '.' 'super' superSuffix { match(input,47,FOLLOW_47_in_selector6299); if (state.failed) return; match(input,108,FOLLOW_108_in_selector6301); if (state.failed) return; pushFollow(FOLLOW_superSuffix_in_selector6303); superSuffix(); state._fsp--; if (state.failed) return; } break; case 4 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1287:9: '.' 'new' ( nonWildcardTypeArguments )? innerCreator { match(input,47,FOLLOW_47_in_selector6313); if (state.failed) return; match(input,97,FOLLOW_97_in_selector6315); if (state.failed) return; // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1287:19: ( nonWildcardTypeArguments )? int alt188=2; int LA188_0 = input.LA(1); if ( (LA188_0==53) ) { alt188=1; } switch (alt188) { case 1 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1287:20: nonWildcardTypeArguments { pushFollow(FOLLOW_nonWildcardTypeArguments_in_selector6318); nonWildcardTypeArguments(); state._fsp--; if (state.failed) return; } break; } pushFollow(FOLLOW_innerCreator_in_selector6322); innerCreator(); state._fsp--; if (state.failed) return; } break; case 5 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1288:9: '[' expression ']' { match(input,59,FOLLOW_59_in_selector6332); if (state.failed) return; pushFollow(FOLLOW_expression_in_selector6334); expression(); state._fsp--; if (state.failed) return; match(input,60,FOLLOW_60_in_selector6336); if (state.failed) return; } break; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving if ( state.backtracking>0 ) { memoize(input, 138, selector_StartIndex); } } } }
public class class_name { public int compareTo(Object o) { if (o instanceof ChartLongValue) { return ((ChartLongValue)o).value.compareTo(value); } else if (o instanceof String) { return ((String)o).compareTo(value); } return 1; } }
public class class_name { public int compareTo(Object o) { if (o instanceof ChartLongValue) { return ((ChartLongValue)o).value.compareTo(value); // depends on control dependency: [if], data = [none] } else if (o instanceof String) { return ((String)o).compareTo(value); // depends on control dependency: [if], data = [none] } return 1; } }
public class class_name { public void marshall(IpAddressResponse ipAddressResponse, ProtocolMarshaller protocolMarshaller) { if (ipAddressResponse == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(ipAddressResponse.getIpId(), IPID_BINDING); protocolMarshaller.marshall(ipAddressResponse.getSubnetId(), SUBNETID_BINDING); protocolMarshaller.marshall(ipAddressResponse.getIp(), IP_BINDING); protocolMarshaller.marshall(ipAddressResponse.getStatus(), STATUS_BINDING); protocolMarshaller.marshall(ipAddressResponse.getStatusMessage(), STATUSMESSAGE_BINDING); protocolMarshaller.marshall(ipAddressResponse.getCreationTime(), CREATIONTIME_BINDING); protocolMarshaller.marshall(ipAddressResponse.getModificationTime(), MODIFICATIONTIME_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(IpAddressResponse ipAddressResponse, ProtocolMarshaller protocolMarshaller) { if (ipAddressResponse == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(ipAddressResponse.getIpId(), IPID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(ipAddressResponse.getSubnetId(), SUBNETID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(ipAddressResponse.getIp(), IP_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(ipAddressResponse.getStatus(), STATUS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(ipAddressResponse.getStatusMessage(), STATUSMESSAGE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(ipAddressResponse.getCreationTime(), CREATIONTIME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(ipAddressResponse.getModificationTime(), MODIFICATIONTIME_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 { private void ack() { // Send a message to the other side of the connection indicating the // last message that we received in order. This will allow it to // purge messages we've already received from its queue. if (open && connected) { if (log.isDebugEnabled()) { log.debug(String.format("%s - Acking messages up to: %d", this, lastReceived)); } eventBus.send(outAddress, new JsonObject().putString("action", "ack").putNumber("id", lastReceived)); lastFeedbackTime = System.currentTimeMillis(); } } }
public class class_name { private void ack() { // Send a message to the other side of the connection indicating the // last message that we received in order. This will allow it to // purge messages we've already received from its queue. if (open && connected) { if (log.isDebugEnabled()) { log.debug(String.format("%s - Acking messages up to: %d", this, lastReceived)); // depends on control dependency: [if], data = [none] } eventBus.send(outAddress, new JsonObject().putString("action", "ack").putNumber("id", lastReceived)); // depends on control dependency: [if], data = [none] lastFeedbackTime = System.currentTimeMillis(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public Object start(IApplicationContext context) { Display display = PlatformUI.createDisplay(); try { /* FIXME: the static Sisu.lookup utility is currently being reworked... int returnCode = PlatformUI.createAndRunWorkbench(display, Sisu.lookup(WorkbenchAdvisor.class)); if (returnCode == PlatformUI.RETURN_RESTART) { return IApplication.EXIT_RESTART; } */ return IApplication.EXIT_OK; } finally { display.dispose(); } } }
public class class_name { public Object start(IApplicationContext context) { Display display = PlatformUI.createDisplay(); try { /* FIXME: the static Sisu.lookup utility is currently being reworked... int returnCode = PlatformUI.createAndRunWorkbench(display, Sisu.lookup(WorkbenchAdvisor.class)); if (returnCode == PlatformUI.RETURN_RESTART) { return IApplication.EXIT_RESTART; } */ return IApplication.EXIT_OK; // depends on control dependency: [try], data = [none] } finally { display.dispose(); } } }
public class class_name { @Override protected void processConditions(final BuildData buildData, final SpecTopic specTopic, final Document doc) { if (buildData.getContentSpec().getPublicanCfg() == null || !buildData.getContentSpec().getPublicanCfg().contains("condition:")) { super.processConditions(buildData, specTopic, doc); } } }
public class class_name { @Override protected void processConditions(final BuildData buildData, final SpecTopic specTopic, final Document doc) { if (buildData.getContentSpec().getPublicanCfg() == null || !buildData.getContentSpec().getPublicanCfg().contains("condition:")) { super.processConditions(buildData, specTopic, doc); // depends on control dependency: [if], data = [none] } } }
public class class_name { @SuppressWarnings("UnnecessaryLocalVariable") public static boolean isJsonApiRequest(HttpRequestContext requestContext, boolean acceptPlainJson) { String method = requestContext.getMethod().toUpperCase(); boolean isPatch = method.equals(HttpMethod.PATCH.toString()); boolean isPost = method.equals(HttpMethod.POST.toString()); if (isPatch || isPost) { String contentType = requestContext.getRequestHeader(HttpHeaders.HTTP_CONTENT_TYPE); if (contentType == null || !contentType.startsWith(HttpHeaders.JSONAPI_CONTENT_TYPE)) { LOGGER.warn("not a JSON-API request due to content type {}", contentType); return false; } } // short-circuit each of the possible Accept MIME type checks, so that we don't keep comparing after we have already // found a match. Intentionally kept as separate statements (instead of a big, chained ||) to ease debugging/maintenance. boolean acceptsJsonApi = requestContext.accepts(HttpHeaders.JSONAPI_CONTENT_TYPE); boolean acceptsAny = acceptsJsonApi || requestContext.acceptsAny(); boolean acceptsPlainJson = acceptsAny || (acceptPlainJson && requestContext.accepts("application/json")); LOGGER.debug("accepting request as JSON-API: {}", acceptPlainJson); return acceptsPlainJson; } }
public class class_name { @SuppressWarnings("UnnecessaryLocalVariable") public static boolean isJsonApiRequest(HttpRequestContext requestContext, boolean acceptPlainJson) { String method = requestContext.getMethod().toUpperCase(); boolean isPatch = method.equals(HttpMethod.PATCH.toString()); boolean isPost = method.equals(HttpMethod.POST.toString()); if (isPatch || isPost) { String contentType = requestContext.getRequestHeader(HttpHeaders.HTTP_CONTENT_TYPE); if (contentType == null || !contentType.startsWith(HttpHeaders.JSONAPI_CONTENT_TYPE)) { LOGGER.warn("not a JSON-API request due to content type {}", contentType); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } } // short-circuit each of the possible Accept MIME type checks, so that we don't keep comparing after we have already // found a match. Intentionally kept as separate statements (instead of a big, chained ||) to ease debugging/maintenance. boolean acceptsJsonApi = requestContext.accepts(HttpHeaders.JSONAPI_CONTENT_TYPE); boolean acceptsAny = acceptsJsonApi || requestContext.acceptsAny(); boolean acceptsPlainJson = acceptsAny || (acceptPlainJson && requestContext.accepts("application/json")); LOGGER.debug("accepting request as JSON-API: {}", acceptPlainJson); return acceptsPlainJson; } }
public class class_name { @Override public int[] getPartitionKey() { if (tasks.size() == 1) // ONE TASK, USE THE INNER TASK'S PARTITION KEY return tasks.get(0).getPartitionKey(); // MULTIPLE PARTITIONS final int[] partitions = new int[tasks.size()]; for (int i = 0; i < tasks.size(); ++i) { final OAbstractRecordReplicatedTask task = tasks.get(i); partitions[i] = task.getPartitionKey()[0]; } return partitions; } }
public class class_name { @Override public int[] getPartitionKey() { if (tasks.size() == 1) // ONE TASK, USE THE INNER TASK'S PARTITION KEY return tasks.get(0).getPartitionKey(); // MULTIPLE PARTITIONS final int[] partitions = new int[tasks.size()]; for (int i = 0; i < tasks.size(); ++i) { final OAbstractRecordReplicatedTask task = tasks.get(i); partitions[i] = task.getPartitionKey()[0]; // depends on control dependency: [for], data = [i] } return partitions; } }
public class class_name { public Observable<ServiceResponse<Page<ResourceMetricInner>>> listMultiRoleMetricsNextWithServiceResponseAsync(final String nextPageLink) { return listMultiRoleMetricsNextSinglePageAsync(nextPageLink) .concatMap(new Func1<ServiceResponse<Page<ResourceMetricInner>>, Observable<ServiceResponse<Page<ResourceMetricInner>>>>() { @Override public Observable<ServiceResponse<Page<ResourceMetricInner>>> call(ServiceResponse<Page<ResourceMetricInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listMultiRoleMetricsNextWithServiceResponseAsync(nextPageLink)); } }); } }
public class class_name { public Observable<ServiceResponse<Page<ResourceMetricInner>>> listMultiRoleMetricsNextWithServiceResponseAsync(final String nextPageLink) { return listMultiRoleMetricsNextSinglePageAsync(nextPageLink) .concatMap(new Func1<ServiceResponse<Page<ResourceMetricInner>>, Observable<ServiceResponse<Page<ResourceMetricInner>>>>() { @Override public Observable<ServiceResponse<Page<ResourceMetricInner>>> call(ServiceResponse<Page<ResourceMetricInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); // depends on control dependency: [if], data = [none] } return Observable.just(page).concatWith(listMultiRoleMetricsNextWithServiceResponseAsync(nextPageLink)); } }); } }
public class class_name { public static void saveKeyStore(File targetStoreFile, KeyStore store, String password) { File folder = targetStoreFile.getAbsoluteFile().getParentFile(); if (!folder.exists()) { folder.mkdirs(); } File tmpFile = new File(folder, Long.toHexString(System.currentTimeMillis()) + ".tmp"); FileOutputStream fos = null; try { fos = new FileOutputStream(tmpFile); store.store(fos, password.toCharArray()); fos.flush(); fos.close(); if (targetStoreFile.exists()) { targetStoreFile.delete(); } tmpFile.renameTo(targetStoreFile); } catch (IOException e) { String message = e.getMessage().toLowerCase(); if (message.contains("illegal key size")) { throw new RuntimeException("Illegal Key Size! You might consider installing the JCE Unlimited Strength Jurisdiction Policy files for your JVM."); } else { throw new RuntimeException("Could not save keystore " + targetStoreFile, e); } } catch (Exception e) { throw new RuntimeException("Could not save keystore " + targetStoreFile, e); } finally { if (fos != null) { try { fos.close(); } catch (IOException e) { } } if (tmpFile.exists()) { tmpFile.delete(); } } } }
public class class_name { public static void saveKeyStore(File targetStoreFile, KeyStore store, String password) { File folder = targetStoreFile.getAbsoluteFile().getParentFile(); if (!folder.exists()) { folder.mkdirs(); // depends on control dependency: [if], data = [none] } File tmpFile = new File(folder, Long.toHexString(System.currentTimeMillis()) + ".tmp"); FileOutputStream fos = null; try { fos = new FileOutputStream(tmpFile); // depends on control dependency: [try], data = [none] store.store(fos, password.toCharArray()); // depends on control dependency: [try], data = [none] fos.flush(); // depends on control dependency: [try], data = [none] fos.close(); // depends on control dependency: [try], data = [none] if (targetStoreFile.exists()) { targetStoreFile.delete(); // depends on control dependency: [if], data = [none] } tmpFile.renameTo(targetStoreFile); // depends on control dependency: [try], data = [none] } catch (IOException e) { String message = e.getMessage().toLowerCase(); if (message.contains("illegal key size")) { throw new RuntimeException("Illegal Key Size! You might consider installing the JCE Unlimited Strength Jurisdiction Policy files for your JVM."); } else { throw new RuntimeException("Could not save keystore " + targetStoreFile, e); } } catch (Exception e) { // depends on control dependency: [catch], data = [none] throw new RuntimeException("Could not save keystore " + targetStoreFile, e); } finally { // depends on control dependency: [catch], data = [none] if (fos != null) { try { fos.close(); // depends on control dependency: [try], data = [none] } catch (IOException e) { } // depends on control dependency: [catch], data = [none] } if (tmpFile.exists()) { tmpFile.delete(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void visit( final int version, final int access, final String name, final String signature, final String superName, final String[] interfaces) { this.version = version; this.access = access; this.name = newClass(name); thisName = name; if (ClassReader.SIGNATURES && signature != null) { this.signature = newUTF8(signature); } this.superName = superName == null ? 0 : newClass(superName); if (interfaces != null && interfaces.length > 0) { interfaceCount = interfaces.length; this.interfaces = new int[interfaceCount]; for (int i = 0; i < interfaceCount; ++i) { this.interfaces[i] = newClass(interfaces[i]); } } } }
public class class_name { public void visit( final int version, final int access, final String name, final String signature, final String superName, final String[] interfaces) { this.version = version; this.access = access; this.name = newClass(name); thisName = name; if (ClassReader.SIGNATURES && signature != null) { this.signature = newUTF8(signature); // depends on control dependency: [if], data = [none] } this.superName = superName == null ? 0 : newClass(superName); if (interfaces != null && interfaces.length > 0) { interfaceCount = interfaces.length; // depends on control dependency: [if], data = [none] this.interfaces = new int[interfaceCount]; // depends on control dependency: [if], data = [none] for (int i = 0; i < interfaceCount; ++i) { this.interfaces[i] = newClass(interfaces[i]); // depends on control dependency: [for], data = [i] } } } }
public class class_name { protected Collection<Method> sortMethods(Collection<Method> methods) { List<Method> list = new ArrayList<>(methods); Collections.sort(list, (m1, m2) -> { int o1 = Integer.MAX_VALUE; Order order1 = ClassUtil.getAnnotation(m1, Order.class); if (order1 != null) { o1 = order1.value(); } int o2 = Integer.MAX_VALUE; Order order2 = ClassUtil.getAnnotation(m2, Order.class); if (order2 != null) { o2 = order2.value(); } if (o1 == o2) { // same or unsorted, compare controller+method String s1 = Util.toString(m1); String s2 = Util.toString(m2); return s1.compareTo(s2); } if (o1 < o2) { return -1; } else { return 1; } }); return list; } }
public class class_name { protected Collection<Method> sortMethods(Collection<Method> methods) { List<Method> list = new ArrayList<>(methods); Collections.sort(list, (m1, m2) -> { int o1 = Integer.MAX_VALUE; Order order1 = ClassUtil.getAnnotation(m1, Order.class); if (order1 != null) { o1 = order1.value(); // depends on control dependency: [if], data = [none] } int o2 = Integer.MAX_VALUE; Order order2 = ClassUtil.getAnnotation(m2, Order.class); if (order2 != null) { o2 = order2.value(); // depends on control dependency: [if], data = [none] } if (o1 == o2) { // same or unsorted, compare controller+method String s1 = Util.toString(m1); String s2 = Util.toString(m2); return s1.compareTo(s2); // depends on control dependency: [if], data = [none] } if (o1 < o2) { return -1; // depends on control dependency: [if], data = [none] } else { return 1; // depends on control dependency: [if], data = [none] } }); return list; } }
public class class_name { private static int getSortPriority(JTable table, int column) { List<? extends SortKey> sortKeys = table.getRowSorter().getSortKeys(); for (int i=0; i<sortKeys.size(); i++) { SortKey sortKey = sortKeys.get(i); if (sortKey.getColumn() == table.convertColumnIndexToModel(column)) { return i; } } return -1; } }
public class class_name { private static int getSortPriority(JTable table, int column) { List<? extends SortKey> sortKeys = table.getRowSorter().getSortKeys(); for (int i=0; i<sortKeys.size(); i++) { SortKey sortKey = sortKeys.get(i); if (sortKey.getColumn() == table.convertColumnIndexToModel(column)) { return i; // depends on control dependency: [if], data = [none] } } return -1; } }
public class class_name { public static <K> double estimatePenalty(double l2, Map<K, Double> weights) { double penalty = 0.0; if(l2 > 0.0) { double sumWeightsSquared = 0.0; for(double w : weights.values()) { sumWeightsSquared += w*w; } penalty = l2*sumWeightsSquared/2.0; } return penalty; } }
public class class_name { public static <K> double estimatePenalty(double l2, Map<K, Double> weights) { double penalty = 0.0; if(l2 > 0.0) { double sumWeightsSquared = 0.0; for(double w : weights.values()) { sumWeightsSquared += w*w; // depends on control dependency: [for], data = [w] } penalty = l2*sumWeightsSquared/2.0; // depends on control dependency: [if], data = [none] } return penalty; } }
public class class_name { private static List<Field> getServiceFields(Object object) { final List<Field> toInject = new ArrayList<>(); Class<?> clazz = object.getClass(); while (clazz != null) { final Field[] fields = clazz.getDeclaredFields(); final int length = fields.length; for (int i = 0; i < length; i++) { final Field field = fields[i]; if (field.isAnnotationPresent(FeatureGet.class)) { toInject.add(field); } } clazz = clazz.getSuperclass(); } return toInject; } }
public class class_name { private static List<Field> getServiceFields(Object object) { final List<Field> toInject = new ArrayList<>(); Class<?> clazz = object.getClass(); while (clazz != null) { final Field[] fields = clazz.getDeclaredFields(); final int length = fields.length; for (int i = 0; i < length; i++) { final Field field = fields[i]; if (field.isAnnotationPresent(FeatureGet.class)) { toInject.add(field); // depends on control dependency: [if], data = [none] } } clazz = clazz.getSuperclass(); // depends on control dependency: [while], data = [none] } return toInject; } }
public class class_name { public String getPcType() { String result = m_loginForm.getPcType(); if (result == null) { result = CmsLoginForm.PC_TYPE_PUBLIC; } return result; } }
public class class_name { public String getPcType() { String result = m_loginForm.getPcType(); if (result == null) { result = CmsLoginForm.PC_TYPE_PUBLIC; // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { private void checkOptimisticLockingState(Serializable id, EntityKey key, Object object, Object[] loadedState, Object version, SharedSessionContractImplementor session, Tuple resultset) { int tableSpan = getTableSpan(); EntityMetamodel entityMetamodel = getEntityMetamodel(); boolean isImpliedOptimisticLocking = !entityMetamodel.isVersioned() && isAllOrDirtyOptLocking(); // Compare all the columns against their current state in the datastore if ( isImpliedOptimisticLocking && loadedState != null ) { // we need to utilize dynamic delete statements for ( int j = tableSpan - 1; j >= 0; j-- ) { boolean[] versionability = getPropertyVersionability(); //TODO do a diff on the properties value from resultset GridType[] types = gridPropertyTypes; for ( int i = 0; i < entityMetamodel.getPropertySpan(); i++ ) { boolean include = isPropertyOfTable( i, j ) && versionability[i]; if ( include ) { final GridType type = types[i]; final Object snapshotValue = type.nullSafeGet( resultset, getPropertyColumnNames( i ), session, object ); //TODO support other entity modes if ( ! type.isEqual( loadedState[i], snapshotValue, getFactory() ) ) { raiseStaleObjectStateException( id ); } } } } } // compare the version column only else if ( entityMetamodel.isVersioned() ) { checkVersionAndRaiseSOSE( id, version, session, resultset ); } } }
public class class_name { private void checkOptimisticLockingState(Serializable id, EntityKey key, Object object, Object[] loadedState, Object version, SharedSessionContractImplementor session, Tuple resultset) { int tableSpan = getTableSpan(); EntityMetamodel entityMetamodel = getEntityMetamodel(); boolean isImpliedOptimisticLocking = !entityMetamodel.isVersioned() && isAllOrDirtyOptLocking(); // Compare all the columns against their current state in the datastore if ( isImpliedOptimisticLocking && loadedState != null ) { // we need to utilize dynamic delete statements for ( int j = tableSpan - 1; j >= 0; j-- ) { boolean[] versionability = getPropertyVersionability(); //TODO do a diff on the properties value from resultset GridType[] types = gridPropertyTypes; for ( int i = 0; i < entityMetamodel.getPropertySpan(); i++ ) { boolean include = isPropertyOfTable( i, j ) && versionability[i]; if ( include ) { final GridType type = types[i]; final Object snapshotValue = type.nullSafeGet( resultset, getPropertyColumnNames( i ), session, object ); //TODO support other entity modes if ( ! type.isEqual( loadedState[i], snapshotValue, getFactory() ) ) { raiseStaleObjectStateException( id ); // depends on control dependency: [if], data = [none] } } } } } // compare the version column only else if ( entityMetamodel.isVersioned() ) { checkVersionAndRaiseSOSE( id, version, session, resultset ); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override protected String createDialogHtml(String dialog) { StringBuffer result = new StringBuffer(512); result.append(createWidgetTableStart()); // show error header once if there were validation errors result.append(createWidgetErrorHeader()); if (dialog.equals(PAGES[0])) { // create the widgets for the first dialog page result.append(dialogBlockStart(key(Messages.GUI_LIST_INDEXSOURCE_ACTION_DELETE_NAME_0))); result.append(createWidgetTableStart()); result.append( key(Messages.GUI_LIST_INDEXSOURCE_ACTION_DELETE_CONF_1, new Object[] {m_indexsource.getName()})); result.append(createWidgetTableEnd()); result.append(dialogBlockEnd()); } result.append(createWidgetTableEnd()); // See CmsWidgetDialog.dialogButtonsCustom(): if no widgets are defined that are non-display-only widgets, // no dialog buttons (Ok, Cancel) will be visible.... result.append(dialogButtons(new int[] {BUTTON_OK, BUTTON_CANCEL}, new String[2])); return result.toString(); } }
public class class_name { @Override protected String createDialogHtml(String dialog) { StringBuffer result = new StringBuffer(512); result.append(createWidgetTableStart()); // show error header once if there were validation errors result.append(createWidgetErrorHeader()); if (dialog.equals(PAGES[0])) { // create the widgets for the first dialog page result.append(dialogBlockStart(key(Messages.GUI_LIST_INDEXSOURCE_ACTION_DELETE_NAME_0))); // depends on control dependency: [if], data = [none] result.append(createWidgetTableStart()); // depends on control dependency: [if], data = [none] result.append( key(Messages.GUI_LIST_INDEXSOURCE_ACTION_DELETE_CONF_1, new Object[] {m_indexsource.getName()})); // depends on control dependency: [if], data = [none] result.append(createWidgetTableEnd()); // depends on control dependency: [if], data = [none] result.append(dialogBlockEnd()); // depends on control dependency: [if], data = [none] } result.append(createWidgetTableEnd()); // See CmsWidgetDialog.dialogButtonsCustom(): if no widgets are defined that are non-display-only widgets, // no dialog buttons (Ok, Cancel) will be visible.... result.append(dialogButtons(new int[] {BUTTON_OK, BUTTON_CANCEL}, new String[2])); return result.toString(); } }
public class class_name { public void put(final K key, final V newValue) { if (newValue == null || !newValue.isCurrent(key)) { if (LOG.isWarnEnabled()) { LOG.warn("Ignoring new cache entry for '{}' because it is {}", key, (newValue == null ? "null" : "not current")); } return; } V oldValue = cacheMap.get(key); if (oldValue != null && oldValue.isNewerThan(newValue)) { if (LOG.isWarnEnabled()) { LOG.warn("Ignoring new cache entry for '{}' because " + "existing cache entry is newer", key); } return; } // no existing value or new value is newer than old value oldValue = cacheMap.put(key, newValue); if (LOG.isDebugEnabled()) { if (oldValue == null) { LOG.debug("Added new cache entry for '{}'", key); } else { LOG.debug("Overwrote existing cache entry for '{}'", key); } } } }
public class class_name { public void put(final K key, final V newValue) { if (newValue == null || !newValue.isCurrent(key)) { if (LOG.isWarnEnabled()) { LOG.warn("Ignoring new cache entry for '{}' because it is {}", key, (newValue == null ? "null" : "not current")); // depends on control dependency: [if], data = [none] } return; // depends on control dependency: [if], data = [none] } V oldValue = cacheMap.get(key); if (oldValue != null && oldValue.isNewerThan(newValue)) { if (LOG.isWarnEnabled()) { LOG.warn("Ignoring new cache entry for '{}' because " + "existing cache entry is newer", key); // depends on control dependency: [if], data = [none] } return; // depends on control dependency: [if], data = [none] } // no existing value or new value is newer than old value oldValue = cacheMap.put(key, newValue); if (LOG.isDebugEnabled()) { if (oldValue == null) { LOG.debug("Added new cache entry for '{}'", key); // depends on control dependency: [if], data = [none] } else { LOG.debug("Overwrote existing cache entry for '{}'", key); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private File getDefaultOutputDirectory() { //The default output directory is the configuration name String childOutputDirectory = getConfiguration(); //However, for platforms others than Win32, the default output directory becomes platform/configuration if ( ! getPlatform().equals( "Win32" ) ) { childOutputDirectory = new File( getPlatform(), childOutputDirectory ).getPath(); } //Place the default output directory within the appropriate base directory return new File( getBaseDirectory(), childOutputDirectory ); } }
public class class_name { private File getDefaultOutputDirectory() { //The default output directory is the configuration name String childOutputDirectory = getConfiguration(); //However, for platforms others than Win32, the default output directory becomes platform/configuration if ( ! getPlatform().equals( "Win32" ) ) { childOutputDirectory = new File( getPlatform(), childOutputDirectory ).getPath(); // depends on control dependency: [if], data = [none] } //Place the default output directory within the appropriate base directory return new File( getBaseDirectory(), childOutputDirectory ); } }
public class class_name { public W addWindow(W newWindow, MergeFunction<W> mergeFunction) throws Exception { List<W> windows = new ArrayList<>(); windows.addAll(this.mapping.keySet()); windows.add(newWindow); final Map<W, Collection<W>> mergeResults = new HashMap<>(); windowAssigner.mergeWindows(windows, new MergingWindowAssigner.MergeCallback<W>() { @Override public void merge(Collection<W> toBeMerged, W mergeResult) { if (LOG.isDebugEnabled()) { LOG.debug("Merging {} into {}", toBeMerged, mergeResult); } mergeResults.put(mergeResult, toBeMerged); } }); W resultWindow = newWindow; boolean mergedNewWindow = false; // perform the merge for (Map.Entry<W, Collection<W>> c: mergeResults.entrySet()) { W mergeResult = c.getKey(); Collection<W> mergedWindows = c.getValue(); // if our new window is in the merged windows make the merge result the // result window if (mergedWindows.remove(newWindow)) { mergedNewWindow = true; resultWindow = mergeResult; } // pick any of the merged windows and choose that window's state window // as the state window for the merge result W mergedStateWindow = this.mapping.get(mergedWindows.iterator().next()); // figure out the state windows that we are merging List<W> mergedStateWindows = new ArrayList<>(); for (W mergedWindow: mergedWindows) { W res = this.mapping.remove(mergedWindow); if (res != null) { mergedStateWindows.add(res); } } this.mapping.put(mergeResult, mergedStateWindow); // don't put the target state window into the merged windows mergedStateWindows.remove(mergedStateWindow); // don't merge the new window itself, it never had any state associated with it // i.e. if we are only merging one pre-existing window into itself // without extending the pre-existing window if (!(mergedWindows.contains(mergeResult) && mergedWindows.size() == 1)) { mergeFunction.merge(mergeResult, mergedWindows, this.mapping.get(mergeResult), mergedStateWindows); } } // the new window created a new, self-contained window without merging if (mergeResults.isEmpty() || (resultWindow.equals(newWindow) && !mergedNewWindow)) { this.mapping.put(resultWindow, resultWindow); } return resultWindow; } }
public class class_name { public W addWindow(W newWindow, MergeFunction<W> mergeFunction) throws Exception { List<W> windows = new ArrayList<>(); windows.addAll(this.mapping.keySet()); windows.add(newWindow); final Map<W, Collection<W>> mergeResults = new HashMap<>(); windowAssigner.mergeWindows(windows, new MergingWindowAssigner.MergeCallback<W>() { @Override public void merge(Collection<W> toBeMerged, W mergeResult) { if (LOG.isDebugEnabled()) { LOG.debug("Merging {} into {}", toBeMerged, mergeResult); // depends on control dependency: [if], data = [none] } mergeResults.put(mergeResult, toBeMerged); } }); W resultWindow = newWindow; boolean mergedNewWindow = false; // perform the merge for (Map.Entry<W, Collection<W>> c: mergeResults.entrySet()) { W mergeResult = c.getKey(); Collection<W> mergedWindows = c.getValue(); // if our new window is in the merged windows make the merge result the // result window if (mergedWindows.remove(newWindow)) { mergedNewWindow = true; resultWindow = mergeResult; } // pick any of the merged windows and choose that window's state window // as the state window for the merge result W mergedStateWindow = this.mapping.get(mergedWindows.iterator().next()); // figure out the state windows that we are merging List<W> mergedStateWindows = new ArrayList<>(); for (W mergedWindow: mergedWindows) { W res = this.mapping.remove(mergedWindow); if (res != null) { mergedStateWindows.add(res); } } this.mapping.put(mergeResult, mergedStateWindow); // don't put the target state window into the merged windows mergedStateWindows.remove(mergedStateWindow); // don't merge the new window itself, it never had any state associated with it // i.e. if we are only merging one pre-existing window into itself // without extending the pre-existing window if (!(mergedWindows.contains(mergeResult) && mergedWindows.size() == 1)) { mergeFunction.merge(mergeResult, mergedWindows, this.mapping.get(mergeResult), mergedStateWindows); } } // the new window created a new, self-contained window without merging if (mergeResults.isEmpty() || (resultWindow.equals(newWindow) && !mergedNewWindow)) { this.mapping.put(resultWindow, resultWindow); } return resultWindow; } }
public class class_name { public int getPort() { String hostAndPort = hostAndPort(); int indexOfMaohao = hostAndPort.indexOf(":"); if (indexOfMaohao == -1) { return 3306; } else { return Integer.parseInt(hostAndPort.substring(indexOfMaohao + 1)); } } }
public class class_name { public int getPort() { String hostAndPort = hostAndPort(); int indexOfMaohao = hostAndPort.indexOf(":"); if (indexOfMaohao == -1) { return 3306; // depends on control dependency: [if], data = [none] } else { return Integer.parseInt(hostAndPort.substring(indexOfMaohao + 1)); // depends on control dependency: [if], data = [(indexOfMaohao] } } }
public class class_name { public Config setExecutorConfigs(Map<String, ExecutorConfig> executorConfigs) { this.executorConfigs.clear(); this.executorConfigs.putAll(executorConfigs); for (Entry<String, ExecutorConfig> entry : executorConfigs.entrySet()) { entry.getValue().setName(entry.getKey()); } return this; } }
public class class_name { public Config setExecutorConfigs(Map<String, ExecutorConfig> executorConfigs) { this.executorConfigs.clear(); this.executorConfigs.putAll(executorConfigs); for (Entry<String, ExecutorConfig> entry : executorConfigs.entrySet()) { entry.getValue().setName(entry.getKey()); // depends on control dependency: [for], data = [entry] } return this; } }
public class class_name { public String getProperty(String pKey, String pDefaultValue) { // Had to override this because Properties uses super.get()... String value = (String) get(pKey); // Safe cast, see get(Object) if (value != null) { return value; } return ((defaults != null) ? defaults.getProperty(pKey) : pDefaultValue); } }
public class class_name { public String getProperty(String pKey, String pDefaultValue) { // Had to override this because Properties uses super.get()... String value = (String) get(pKey); // Safe cast, see get(Object) if (value != null) { return value; // depends on control dependency: [if], data = [none] } return ((defaults != null) ? defaults.getProperty(pKey) : pDefaultValue); } }
public class class_name { public TemplateCallable[] addDefaults(TemplateCallable[] userCallables) { TemplateCallable strFunctionality = new TemplateCallable(String.class.getSimpleName(), String.class); for (TemplateCallable u : userCallables) { if (u.equals(strFunctionality)) { return userCallables; } } return GeneralUtils.concat(userCallables, new TemplateCallable[] { strFunctionality }); } }
public class class_name { public TemplateCallable[] addDefaults(TemplateCallable[] userCallables) { TemplateCallable strFunctionality = new TemplateCallable(String.class.getSimpleName(), String.class); for (TemplateCallable u : userCallables) { if (u.equals(strFunctionality)) { return userCallables; // depends on control dependency: [if], data = [none] } } return GeneralUtils.concat(userCallables, new TemplateCallable[] { strFunctionality }); } }
public class class_name { public int getRemainingDays(String startDate, String endDate, Date currentDate) throws java.text.ParseException { DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Calendar iterationEndDate = Calendar.getInstance(); iterationEndDate.setTime(dateFormat.parse(endDate)); Calendar iterationStartDate = Calendar.getInstance(); iterationStartDate.setTime(dateFormat.parse(startDate)); Calendar currentCalendarDate = Calendar.getInstance(); currentCalendarDate.setTime(currentDate); int remainingDays = 0; if ((iterationStartDate.compareTo(currentCalendarDate) == 1) || (iterationEndDate.compareTo(currentCalendarDate) == -1)) { return remainingDays; } while (iterationEndDate.compareTo(currentCalendarDate) == 1) { if ((currentCalendarDate.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY) && (currentCalendarDate.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY)) { ++remainingDays; } currentCalendarDate.add(Calendar.DAY_OF_MONTH, 1); } return remainingDays; } }
public class class_name { public int getRemainingDays(String startDate, String endDate, Date currentDate) throws java.text.ParseException { DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Calendar iterationEndDate = Calendar.getInstance(); iterationEndDate.setTime(dateFormat.parse(endDate)); Calendar iterationStartDate = Calendar.getInstance(); iterationStartDate.setTime(dateFormat.parse(startDate)); Calendar currentCalendarDate = Calendar.getInstance(); currentCalendarDate.setTime(currentDate); int remainingDays = 0; if ((iterationStartDate.compareTo(currentCalendarDate) == 1) || (iterationEndDate.compareTo(currentCalendarDate) == -1)) { return remainingDays; } while (iterationEndDate.compareTo(currentCalendarDate) == 1) { if ((currentCalendarDate.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY) && (currentCalendarDate.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY)) { ++remainingDays; // depends on control dependency: [if], data = [none] } currentCalendarDate.add(Calendar.DAY_OF_MONTH, 1); } return remainingDays; } }
public class class_name { @SuppressWarnings("all") public static void setField(Object target, Field field, Object value) { try { Assert.isFalse(Modifier.isFinal(field.getModifiers()), new FieldAccessException(String.format( "Cannot set the value of a final field (%1$s) on %2$s type (%3$s)!", field.getName(), BooleanUtils.toString(target == null, "class", "object of"), field.getDeclaringClass().getName()))); boolean currentAccessible = field.isAccessible(); field.setAccessible(true); field.set(target, value); field.setAccessible(currentAccessible); } catch (FieldAccessException e) { throw e; } catch (NullPointerException e) { throw e; } catch (Exception e) { throw new FieldAccessException(String.format("Failed to set field (%1$s) to value (%2$s) on %3$s type (%4$s)!", field.getName(), value, BooleanUtils.toString(target == null, "class", "object of"), field.getDeclaringClass().getName()), e); } } }
public class class_name { @SuppressWarnings("all") public static void setField(Object target, Field field, Object value) { try { Assert.isFalse(Modifier.isFinal(field.getModifiers()), new FieldAccessException(String.format( "Cannot set the value of a final field (%1$s) on %2$s type (%3$s)!", field.getName(), BooleanUtils.toString(target == null, "class", "object of"), field.getDeclaringClass().getName()))); // depends on control dependency: [try], data = [none] boolean currentAccessible = field.isAccessible(); field.setAccessible(true); // depends on control dependency: [try], data = [none] field.set(target, value); // depends on control dependency: [try], data = [none] field.setAccessible(currentAccessible); // depends on control dependency: [try], data = [none] } catch (FieldAccessException e) { throw e; } // depends on control dependency: [catch], data = [none] catch (NullPointerException e) { throw e; } // depends on control dependency: [catch], data = [none] catch (Exception e) { throw new FieldAccessException(String.format("Failed to set field (%1$s) to value (%2$s) on %3$s type (%4$s)!", field.getName(), value, BooleanUtils.toString(target == null, "class", "object of"), field.getDeclaringClass().getName()), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public List<YokeCookie> getAllCookies(@NotNull final String name) { List<YokeCookie> foundCookies = new ArrayList<>(); if (cookies != null) { for (YokeCookie c : cookies) { if (name.equals(c.name())) { foundCookies.add(c); } } } return foundCookies; } }
public class class_name { public List<YokeCookie> getAllCookies(@NotNull final String name) { List<YokeCookie> foundCookies = new ArrayList<>(); if (cookies != null) { for (YokeCookie c : cookies) { if (name.equals(c.name())) { foundCookies.add(c); // depends on control dependency: [if], data = [none] } } } return foundCookies; } }
public class class_name { @Override public String getContributorId() { final String sourceMethod = "getContributorId"; //$NON-NLS-1$ boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(AggregatorExtension.class.getName(), sourceMethod); log.exiting(AggregatorExtension.class.getName(), sourceMethod, contributorId); } return contributorId; } }
public class class_name { @Override public String getContributorId() { final String sourceMethod = "getContributorId"; //$NON-NLS-1$ boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(AggregatorExtension.class.getName(), sourceMethod); // depends on control dependency: [if], data = [none] log.exiting(AggregatorExtension.class.getName(), sourceMethod, contributorId); // depends on control dependency: [if], data = [none] } return contributorId; } }
public class class_name { private void checkType(String className) { if (_tc.isEntryEnabled()) { SibTr.entry(_tc, "checkType", new Object[]{this, className}); } // Of the classname supplied is not one of // com.ibm.wsspi.sib.core.selector.FactoryType or // com.ibm.wsspi.sib.core.selector.PrivateFactoryType then an exception is // thrown. if (!(className.equals("com.ibm.wsspi.sib.core.selector.FactoryType") || className .equals("com.ibm.ws.sib.core.selector.PrivateFactoryType"))) { // It would be preferable to throw an Exception version of this, however // the exception version // is a checked exception which can only be thrown when using reflection // to invoke classes. // As a result the Error version is thrown. IllegalAccessError e = new IllegalAccessError(_nls.getFormattedMessage( "INVALID_SUBCLASS_CWSJC0006E", new Object[]{className}, null)); if (_tc.isEventEnabled()) { SibTr.event(_tc, "throwing", e); } if (_tc.isEntryEnabled()) { SibTr.exit(_tc, "checkType", e); } throw e; } if (_tc.isEntryEnabled()) { SibTr.exit(_tc, "checkType"); } } }
public class class_name { private void checkType(String className) { if (_tc.isEntryEnabled()) { SibTr.entry(_tc, "checkType", new Object[]{this, className}); // depends on control dependency: [if], data = [none] } // Of the classname supplied is not one of // com.ibm.wsspi.sib.core.selector.FactoryType or // com.ibm.wsspi.sib.core.selector.PrivateFactoryType then an exception is // thrown. if (!(className.equals("com.ibm.wsspi.sib.core.selector.FactoryType") || className .equals("com.ibm.ws.sib.core.selector.PrivateFactoryType"))) { // It would be preferable to throw an Exception version of this, however // the exception version // is a checked exception which can only be thrown when using reflection // to invoke classes. // As a result the Error version is thrown. IllegalAccessError e = new IllegalAccessError(_nls.getFormattedMessage( "INVALID_SUBCLASS_CWSJC0006E", new Object[]{className}, null)); if (_tc.isEventEnabled()) { SibTr.event(_tc, "throwing", e); } if (_tc.isEntryEnabled()) { SibTr.exit(_tc, "checkType", e); } throw e; } if (_tc.isEntryEnabled()) { SibTr.exit(_tc, "checkType"); } } }
public class class_name { @Override public V putIfAbsentFailure(K key, V value, StoreAccessException e) { // FIXME: Should I care about useLoaderInAtomics? try { try { V loaded = loaderWriter.load(key); if (loaded != null) { return loaded; } } catch (Exception e1) { throw ExceptionFactory.newCacheLoadingException(e1, e); } try { loaderWriter.write(key, value); } catch (Exception e1) { throw ExceptionFactory.newCacheWritingException(e1, e); } } finally { cleanup(key, e); } return null; } }
public class class_name { @Override public V putIfAbsentFailure(K key, V value, StoreAccessException e) { // FIXME: Should I care about useLoaderInAtomics? try { try { V loaded = loaderWriter.load(key); if (loaded != null) { return loaded; // depends on control dependency: [if], data = [none] } } catch (Exception e1) { throw ExceptionFactory.newCacheLoadingException(e1, e); } // depends on control dependency: [catch], data = [none] try { loaderWriter.write(key, value); // depends on control dependency: [try], data = [none] } catch (Exception e1) { throw ExceptionFactory.newCacheWritingException(e1, e); } // depends on control dependency: [catch], data = [none] } finally { cleanup(key, e); } return null; } }
public class class_name { public void setDirectConnectGatewayAssociationProposals( java.util.Collection<DirectConnectGatewayAssociationProposal> directConnectGatewayAssociationProposals) { if (directConnectGatewayAssociationProposals == null) { this.directConnectGatewayAssociationProposals = null; return; } this.directConnectGatewayAssociationProposals = new com.amazonaws.internal.SdkInternalList<DirectConnectGatewayAssociationProposal>( directConnectGatewayAssociationProposals); } }
public class class_name { public void setDirectConnectGatewayAssociationProposals( java.util.Collection<DirectConnectGatewayAssociationProposal> directConnectGatewayAssociationProposals) { if (directConnectGatewayAssociationProposals == null) { this.directConnectGatewayAssociationProposals = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.directConnectGatewayAssociationProposals = new com.amazonaws.internal.SdkInternalList<DirectConnectGatewayAssociationProposal>( directConnectGatewayAssociationProposals); } }