code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public void setRules(java.util.Collection<Rule> rules) { if (rules == null) { this.rules = null; return; } this.rules = new java.util.ArrayList<Rule>(rules); } }
public class class_name { public void setRules(java.util.Collection<Rule> rules) { if (rules == null) { this.rules = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.rules = new java.util.ArrayList<Rule>(rules); } }
public class class_name { @VisibleForTesting String constructContentRangeHeaderValue( long requestLength, boolean isLastRequest, BatchJobUploadStatus batchJobUploadStatus) { Preconditions.checkArgument(requestLength > 0, "Request length %s is <= 0", requestLength); long previousTotalLength = batchJobUploadStatus.getTotalContentLength(); long contentLowerBound = previousTotalLength; long contentUpperBound = previousTotalLength + requestLength - 1; String totalBytesString; if (isLastRequest) { totalBytesString = String.valueOf(contentUpperBound + 1); } else { totalBytesString = "*"; } return String.format("bytes %d-%d/%s", contentLowerBound, contentUpperBound, totalBytesString); } }
public class class_name { @VisibleForTesting String constructContentRangeHeaderValue( long requestLength, boolean isLastRequest, BatchJobUploadStatus batchJobUploadStatus) { Preconditions.checkArgument(requestLength > 0, "Request length %s is <= 0", requestLength); long previousTotalLength = batchJobUploadStatus.getTotalContentLength(); long contentLowerBound = previousTotalLength; long contentUpperBound = previousTotalLength + requestLength - 1; String totalBytesString; if (isLastRequest) { totalBytesString = String.valueOf(contentUpperBound + 1); // depends on control dependency: [if], data = [none] } else { totalBytesString = "*"; // depends on control dependency: [if], data = [none] } return String.format("bytes %d-%d/%s", contentLowerBound, contentUpperBound, totalBytesString); } }
public class class_name { public double ptLength(TermLengthOrPercent spec, double whole) { float nval = spec.getValue(); if (spec.isPercentage()) { return (whole * nval) / 100; } else if (spec instanceof TermCalc) { final CalcArgs args = ((TermCalc) spec).getArgs(); return args.evaluate(getPtEval().setWhole(whole)); } else { final TermLength.Unit unit = spec.getUnit(); if (unit == null) return 0; switch (unit) { case pt: return nval; case in: return nval * 72; case cm: return (nval * 72) / 2.54; case mm: return (nval * 72) / 25.4; case q: return (nval * 72) / (2.54 * 40.0); case pc: return nval * 12; case px: return (nval * 72) / dpi; case em: return (em * nval * 72) / dpi; //em is in pixels case rem: return (rem * nval * 72) / dpi; case ex: return (ex * nval * 72) / dpi; case ch: return (ch * nval * 72) / dpi; case vw: return (viewport.getVisibleRect().getWidth() * nval * 72) / (100.0 * dpi); case vh: return (viewport.getVisibleRect().getHeight() * nval * 72) / (100.0 * dpi); case vmin: return (Math.min(viewport.getVisibleRect().getWidth(), viewport.getVisibleRect().getHeight()) * nval * 72) / (100.0 * dpi); case vmax: return (Math.max(viewport.getVisibleRect().getWidth(), viewport.getVisibleRect().getHeight()) * nval * 72) / (100.0 * dpi); default: return 0; } } } }
public class class_name { public double ptLength(TermLengthOrPercent spec, double whole) { float nval = spec.getValue(); if (spec.isPercentage()) { return (whole * nval) / 100; // depends on control dependency: [if], data = [none] } else if (spec instanceof TermCalc) { final CalcArgs args = ((TermCalc) spec).getArgs(); return args.evaluate(getPtEval().setWhole(whole)); // depends on control dependency: [if], data = [none] } else { final TermLength.Unit unit = spec.getUnit(); if (unit == null) return 0; switch (unit) { case pt: return nval; case in: return nval * 72; case cm: return (nval * 72) / 2.54; case mm: return (nval * 72) / 25.4; case q: return (nval * 72) / (2.54 * 40.0); case pc: return nval * 12; case px: return (nval * 72) / dpi; case em: return (em * nval * 72) / dpi; //em is in pixels case rem: return (rem * nval * 72) / dpi; case ex: return (ex * nval * 72) / dpi; case ch: return (ch * nval * 72) / dpi; case vw: return (viewport.getVisibleRect().getWidth() * nval * 72) / (100.0 * dpi); case vh: return (viewport.getVisibleRect().getHeight() * nval * 72) / (100.0 * dpi); case vmin: return (Math.min(viewport.getVisibleRect().getWidth(), viewport.getVisibleRect().getHeight()) * nval * 72) / (100.0 * dpi); case vmax: return (Math.max(viewport.getVisibleRect().getWidth(), viewport.getVisibleRect().getHeight()) * nval * 72) / (100.0 * dpi); default: return 0; } } } }
public class class_name { public static <T> void assertThrows(String message, Class<? extends Exception> exceptionClass, Callable<T> callable) { T result; try { result = callable.call(); fail(message, "No exception was thrown (expected " + exceptionClass.getSimpleName() + " but '" + result + "' was returned instead)"); } catch (Exception e) { if (!e.getClass().equals(exceptionClass)) { fail(message, e.getClass().getSimpleName() + " was thrown instead of " + exceptionClass.getSimpleName()); } } pass(message); } }
public class class_name { public static <T> void assertThrows(String message, Class<? extends Exception> exceptionClass, Callable<T> callable) { T result; try { result = callable.call(); // depends on control dependency: [try], data = [none] fail(message, "No exception was thrown (expected " + exceptionClass.getSimpleName() + " but '" + result + "' was returned instead)"); // depends on control dependency: [try], data = [exception] } catch (Exception e) { if (!e.getClass().equals(exceptionClass)) { fail(message, e.getClass().getSimpleName() + " was thrown instead of " + exceptionClass.getSimpleName()); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] pass(message); } }
public class class_name { private DependencyInfo createDependencyInfo(PhpPackage phpPackage) { String groupId = getGroupIdFromName(phpPackage); String artifactId = phpPackage.getName(); String version = phpPackage.getVersion(); String commit = phpPackage.getPackageSource().getReference(); if (StringUtils.isNotBlank(version) || StringUtils.isNotBlank(commit)) { DependencyInfo dependencyInfo = new DependencyInfo(groupId, artifactId, version); dependencyInfo.setCommit(commit); dependencyInfo.setDependencyType(getDependencyType()); if (this.addSha1) { String sha1 = null; String sha1Source = StringUtils.isNotBlank(version) ? version : commit; try { sha1 = this.hashCalculator.calculateSha1ByNameVersionAndType(artifactId, sha1Source, DependencyType.PHP); } catch (IOException e) { logger.debug("Failed to calculate sha1 of: {}", artifactId); } if (sha1 != null) { dependencyInfo.setSha1(sha1); } } return dependencyInfo; } else { logger.debug("The parameters version and commit of {} are null", phpPackage.getName()); return null; } } }
public class class_name { private DependencyInfo createDependencyInfo(PhpPackage phpPackage) { String groupId = getGroupIdFromName(phpPackage); String artifactId = phpPackage.getName(); String version = phpPackage.getVersion(); String commit = phpPackage.getPackageSource().getReference(); if (StringUtils.isNotBlank(version) || StringUtils.isNotBlank(commit)) { DependencyInfo dependencyInfo = new DependencyInfo(groupId, artifactId, version); dependencyInfo.setCommit(commit); // depends on control dependency: [if], data = [none] dependencyInfo.setDependencyType(getDependencyType()); // depends on control dependency: [if], data = [none] if (this.addSha1) { String sha1 = null; String sha1Source = StringUtils.isNotBlank(version) ? version : commit; try { sha1 = this.hashCalculator.calculateSha1ByNameVersionAndType(artifactId, sha1Source, DependencyType.PHP); // depends on control dependency: [try], data = [none] } catch (IOException e) { logger.debug("Failed to calculate sha1 of: {}", artifactId); } // depends on control dependency: [catch], data = [none] if (sha1 != null) { dependencyInfo.setSha1(sha1); // depends on control dependency: [if], data = [(sha1] } } return dependencyInfo; // depends on control dependency: [if], data = [none] } else { logger.debug("The parameters version and commit of {} are null", phpPackage.getName()); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static String addStaticQueryParamtersToRequest(final Request<?> request, final String uriResourcePath) { if (request == null || uriResourcePath == null) { return null; } String resourcePath = uriResourcePath; int index = resourcePath.indexOf("?"); if (index != -1) { String queryString = resourcePath.substring(index + 1); resourcePath = resourcePath.substring(0, index); for (String s : queryString.split("[;&]")) { index = s.indexOf("="); if (index != -1) { request.addParameter(s.substring(0, index), s.substring(index + 1)); } else { request.addParameter(s, (String)null); } } } return resourcePath; } }
public class class_name { public static String addStaticQueryParamtersToRequest(final Request<?> request, final String uriResourcePath) { if (request == null || uriResourcePath == null) { return null; // depends on control dependency: [if], data = [none] } String resourcePath = uriResourcePath; int index = resourcePath.indexOf("?"); if (index != -1) { String queryString = resourcePath.substring(index + 1); resourcePath = resourcePath.substring(0, index); // depends on control dependency: [if], data = [none] for (String s : queryString.split("[;&]")) { index = s.indexOf("="); // depends on control dependency: [for], data = [s] if (index != -1) { request.addParameter(s.substring(0, index), s.substring(index + 1)); // depends on control dependency: [if], data = [(index] } else { request.addParameter(s, (String)null); // depends on control dependency: [if], data = [none] } } } return resourcePath; } }
public class class_name { public V remove(Object key) { // Check if the key is in the map Integer index = keyToIndex.get(key); if (index == null) { return null; } // Leave the data in the array but remove its key keyToIndex.remove(key); keySet.remove(key); // Remove the data from the array V removedValue = data.remove(index.intValue()); // Go through the whole key to index map reducing by one the value of any indexes greater that the removed index for (K nextKey : keyToIndex.keySet()) { Integer nextIndex = keyToIndex.get(nextKey); if (nextIndex > index) { keyToIndex.put(nextKey, nextIndex - 1); } } // Return the removed object return removedValue; } }
public class class_name { public V remove(Object key) { // Check if the key is in the map Integer index = keyToIndex.get(key); if (index == null) { return null; // depends on control dependency: [if], data = [none] } // Leave the data in the array but remove its key keyToIndex.remove(key); keySet.remove(key); // Remove the data from the array V removedValue = data.remove(index.intValue()); // Go through the whole key to index map reducing by one the value of any indexes greater that the removed index for (K nextKey : keyToIndex.keySet()) { Integer nextIndex = keyToIndex.get(nextKey); if (nextIndex > index) { keyToIndex.put(nextKey, nextIndex - 1); // depends on control dependency: [if], data = [none] } } // Return the removed object return removedValue; } }
public class class_name { public static boolean isLegalPoolInfo(PoolInfo poolInfo) { if (poolInfo == null || poolInfo.getPoolGroupName() == null || poolInfo.getPoolName() == null) { return false; } if (INVALID_REGEX_PATTERN.matcher(poolInfo.getPoolGroupName()).matches() || poolInfo.getPoolGroupName().isEmpty()) { return false; } if (INVALID_REGEX_PATTERN.matcher(poolInfo.getPoolName()).matches() || poolInfo.getPoolName().isEmpty()) { return false; } return true; } }
public class class_name { public static boolean isLegalPoolInfo(PoolInfo poolInfo) { if (poolInfo == null || poolInfo.getPoolGroupName() == null || poolInfo.getPoolName() == null) { return false; // depends on control dependency: [if], data = [none] } if (INVALID_REGEX_PATTERN.matcher(poolInfo.getPoolGroupName()).matches() || poolInfo.getPoolGroupName().isEmpty()) { return false; // depends on control dependency: [if], data = [none] } if (INVALID_REGEX_PATTERN.matcher(poolInfo.getPoolName()).matches() || poolInfo.getPoolName().isEmpty()) { return false; // depends on control dependency: [if], data = [none] } return true; } }
public class class_name { private void computeDivUVD(GrayF32 u , GrayF32 v , GrayF32 psi , GrayF32 divU , GrayF32 divV , GrayF32 divD ) { final int stride = psi.stride; // compute the inside pixel for (int y = 1; y < psi.height-1; y++) { // index of the current pixel int index = y*stride + 1; for (int x = 1; x < psi.width-1; x++ , index++) { float psi_index = psi.data[index]; float coef0 = 0.5f*(psi.data[index+1] + psi_index); float coef1 = 0.5f*(psi.data[index-1] + psi_index); float coef2 = 0.5f*(psi.data[index+stride] + psi_index); float coef3 = 0.5f*(psi.data[index-stride] + psi_index); float u_index = u.data[index]; divU.data[index] = coef0*(u.data[index+1] - u_index) + coef1*(u.data[index-1] - u_index) + coef2*(u.data[index+stride] - u_index) + coef3*(u.data[index-stride] - u_index); float v_index = v.data[index]; divV.data[index] = coef0*(v.data[index+1] - v_index) + coef1*(v.data[index-1] - v_index) + coef2*(v.data[index+stride] - v_index) + coef3*(v.data[index-stride] - v_index); divD.data[index] = coef0 + coef1 + coef2 + coef3; } } // handle the image borders for( int x = 0; x < psi.width; x++ ) { computeDivUVD_safe(x,0,u,v,psi,divU,divV,divD); computeDivUVD_safe(x,psi.height-1,u,v,psi,divU,divV,divD); } for( int y = 1; y < psi.height-1; y++ ) { computeDivUVD_safe(0,y,u,v,psi,divU,divV,divD); computeDivUVD_safe(psi.width-1,y,u,v,psi,divU,divV,divD); } } }
public class class_name { private void computeDivUVD(GrayF32 u , GrayF32 v , GrayF32 psi , GrayF32 divU , GrayF32 divV , GrayF32 divD ) { final int stride = psi.stride; // compute the inside pixel for (int y = 1; y < psi.height-1; y++) { // index of the current pixel int index = y*stride + 1; for (int x = 1; x < psi.width-1; x++ , index++) { float psi_index = psi.data[index]; float coef0 = 0.5f*(psi.data[index+1] + psi_index); float coef1 = 0.5f*(psi.data[index-1] + psi_index); float coef2 = 0.5f*(psi.data[index+stride] + psi_index); float coef3 = 0.5f*(psi.data[index-stride] + psi_index); float u_index = u.data[index]; divU.data[index] = coef0*(u.data[index+1] - u_index) + coef1*(u.data[index-1] - u_index) + coef2*(u.data[index+stride] - u_index) + coef3*(u.data[index-stride] - u_index); // depends on control dependency: [for], data = [none] float v_index = v.data[index]; divV.data[index] = coef0*(v.data[index+1] - v_index) + coef1*(v.data[index-1] - v_index) + coef2*(v.data[index+stride] - v_index) + coef3*(v.data[index-stride] - v_index); // depends on control dependency: [for], data = [none] divD.data[index] = coef0 + coef1 + coef2 + coef3; // depends on control dependency: [for], data = [none] } } // handle the image borders for( int x = 0; x < psi.width; x++ ) { computeDivUVD_safe(x,0,u,v,psi,divU,divV,divD); // depends on control dependency: [for], data = [x] computeDivUVD_safe(x,psi.height-1,u,v,psi,divU,divV,divD); // depends on control dependency: [for], data = [x] } for( int y = 1; y < psi.height-1; y++ ) { computeDivUVD_safe(0,y,u,v,psi,divU,divV,divD); // depends on control dependency: [for], data = [y] computeDivUVD_safe(psi.width-1,y,u,v,psi,divU,divV,divD); // depends on control dependency: [for], data = [y] } } }
public class class_name { public boolean foldComposite(final Instruction _instruction) throws ClassParseException { boolean handled = false; if (logger.isLoggable(Level.FINE)) { System.out.println("foldComposite: curr = " + _instruction); System.out.println(dumpDiagram(_instruction)); // System.out.println(dumpDiagram(null, _instruction)); } if (_instruction.isForwardBranchTarget() || ((tail != null) && tail.isBranch() && tail.asBranch().isReverseConditional())) { while (_instruction.isForwardBranchTarget() || ((tail != null) && tail.isBranch() && tail.asBranch().isReverseConditional())) { if (logger.isLoggable(Level.FINE)) { System.out.println(dumpDiagram(_instruction)); } handled = false; if ((tail != null) && tail.isBranch() && tail.asBranch().isReverseConditional()) { /** * This looks like an eclipse style for/while loop or possibly a do{}while() * <pre> * eclipse for (INIT,??,DELTA){BODY} ... * [INIT] >> [BODY] [DELTA] ?? ?< ... * ----------------> * <----------------- * * eclipse for (,??,DELTA){BODY} ... * >> [BODY] [DELTA] ?? ?< ... * ---------------> * <----------------- * * do {BODY} while(??) * [BODY] ?? ?< ... * <----------- * * eclipse while (??){BODY} ... * >> [BODY] ?? ?< ... * --------> * <---------- * </pre> **/ final BranchSet branchSet = ((ConditionalBranch) tail.asBranch()).getOrCreateBranchSet(); Instruction loopTop = branchSet.getTarget().getRootExpr(); final Instruction beginingOfBranch = branchSet.getFirst(); final Instruction startOfBeginningOfBranch = beginingOfBranch.getStartInstruction(); // empty loops sometimes look like eclipse loops! if (startOfBeginningOfBranch == loopTop) { loopTop = loopTop.getPrevExpr(); if (loopTop instanceof AssignToLocalVariable) { final LocalVariableInfo localVariableInfo = ((AssignToLocalVariable) loopTop).getLocalVariableInfo(); if ((localVariableInfo.getStart() == loopTop.getNextExpr().getStartPC()) && (localVariableInfo.getEnd() == _instruction.getThisPC())) { loopTop = loopTop.getPrevExpr(); // back up over the initialization } } addAsComposites(ByteCode.COMPOSITE_EMPTY_LOOP, loopTop, branchSet); handled = true; } else { if ((loopTop.getPrevExpr() != null) && loopTop.getPrevExpr().isBranch() && loopTop.getPrevExpr().asBranch().isForwardUnconditional()) { if (doesNotContainCompositeOrBranch(branchSet.getTarget().getRootExpr(), branchSet.getFirst().getPrevExpr())) { branchSet.unhook(); loopTop.getPrevExpr().asBranch().unhook(); loopTop = loopTop.getPrevExpr(); // looptop == the unconditional? loopTop = loopTop.getPrevExpr(); if (loopTop instanceof AssignToLocalVariable) { final LocalVariableInfo localVariableInfo = ((AssignToLocalVariable) loopTop).getLocalVariableInfo(); if ((localVariableInfo.getStart() == loopTop.getNextExpr().getStartPC()) && (localVariableInfo.getEnd() == _instruction.getThisPC())) { loopTop = loopTop.getPrevExpr(); // back up over the initialization } } addAsComposites(ByteCode.COMPOSITE_FOR_ECLIPSE, loopTop, branchSet); handled = true; } } if (!handled) { // do{}while()_ do not require any previous instruction if (loopTop.getPrevExpr() == null) { throw new IllegalStateException("might be a dowhile with no provious expression"); } else if (!(loopTop.getPrevExpr().isBranch() && loopTop.getPrevExpr().asBranch().isForwardUnconditional())) { if (doesNotContainCompositeOrBranch(branchSet.getTarget().getRootExpr(), branchSet.getFirst() .getPrevExpr())) { loopTop = loopTop.getPrevExpr(); branchSet.unhook(); addAsComposites(ByteCode.COMPOSITE_DO_WHILE, loopTop, branchSet); handled = true; } } else { throw new IllegalStateException("might be mistaken for a do while!"); } } } } if (!handled && _instruction.isForwardConditionalBranchTarget() && tail.isBranch() && tail.asBranch().isReverseUnconditional()) { /** * This is s sun style loop * <pre> * sun for (INIT,??,DELTA){BODY} ... * * [INIT] ?? ?> [BODY] [DELTA] << ... * ------------------> * <------------------- * * sun for (,??,DELTA){BODY} ... * * ?? ?> [BODY] [DELTA] << ... * ------------------> * <------------------- * * sun while (?){l} ... * * ?? ?> [BODY] << ... * -----------> * <------------ * *</pre> */ final ConditionalBranch lastForwardConditional = _instruction.getForwardConditionalBranches().getLast(); final BranchSet branchSet = lastForwardConditional.getOrCreateBranchSet(); final Branch reverseGoto = tail.asBranch(); final Instruction loopBackTarget = reverseGoto.getTarget(); if (loopBackTarget.getReverseUnconditionalBranches().size() > 1) { throw new ClassParseException(ClassParseException.TYPE.CONFUSINGBRANCHESPOSSIBLYCONTINUE); } if (_instruction.isForwardUnconditionalBranchTarget()) { /** * Check if we have a break * <pre> * ?? ?> [BODY] ?1 ?> >> [BODY] << ... * --------------------------> * ----> * -----------> * <---------------------------- * *</pre> */ final Branch lastForwardUnconditional = _instruction.getForwardUnconditionalBranches().getLast(); if ((lastForwardUnconditional != null) && lastForwardUnconditional.isAfter(lastForwardConditional)) { throw new ClassParseException(ClassParseException.TYPE.CONFUSINGBRANCHESPOSSIBLYBREAK); } } if (loopBackTarget != branchSet.getFirst().getStartInstruction()) { /** * we may have a if(?1){while(?2){}}else{...} where the else goto has been optimized away. * <pre> * One might expect * ?1 ?> ?2 ?> [BODY] << >> [ELSE] ... * -------------------> * ----------->! * <---------- * --------> * * However as above the conditional branch to the unconditional (!) can be optimized away and the conditional inverted and extended * ?1 ?> ?2 ?> [BODY] << >> [ELSE] ... * --------------------> * -----------*---------> * <----------- * * However we can also now remove the forward unconditional completely as it is unreachable * ?1 ?> ?2 ?> [BODY] << [ELSE] ... * -----------------> * ------------------> * <----------- * * </pre> */ final Instruction loopbackTargetRoot = loopBackTarget.getRootExpr(); if (loopbackTargetRoot.isBranch() && loopbackTargetRoot.asBranch().isConditional()) { final ConditionalBranch topOfRealLoop = (ConditionalBranch) loopbackTargetRoot.asBranch(); BranchSet extentBranchSet = topOfRealLoop.getBranchSet(); if (topOfRealLoop.getBranchSet() == null) { extentBranchSet = topOfRealLoop.findEndOfConditionalBranchSet(_instruction.getNextPC()) .getOrCreateBranchSet(); } // We believe that this extendBranchSet is the real top of the while. if (doesNotContainCompositeOrBranch(extentBranchSet.getLast().getNextExpr(), reverseGoto)) { Instruction loopTop = topOfRealLoop.getPrevExpr(); if (loopTop instanceof AssignToLocalVariable) { final LocalVariableInfo localVariableInfo = ((AssignToLocalVariable) loopTop).getLocalVariableInfo(); if ((localVariableInfo.getStart() == loopTop.getNextExpr().getStartPC()) && (localVariableInfo.getEnd() == _instruction.getThisPC())) { loopTop = loopTop.getPrevExpr(); // back up over the initialization } } extentBranchSet.unhook(); addAsComposites(ByteCode.COMPOSITE_FOR_SUN, loopTop, extentBranchSet); final UnconditionalBranch fakeGoto = new FakeGoto(methodModel, extentBranchSet.getLast().getTarget()); add(fakeGoto); extentBranchSet.getLast().getTarget().addBranchTarget(fakeGoto); handled = true; } } } else { /** * Just a normal sun style loop */ if (doesNotContainCompositeOrBranch(branchSet.getLast().getNextExpr(), reverseGoto)) { Instruction loopTop = reverseGoto.getTarget().getRootExpr().getPrevExpr(); if (logger.isLoggable(Level.FINEST)) { Instruction next = branchSet.getFirst().getNextExpr(); System.out.println("### for/while candidate exprs: " + branchSet.getFirst()); while (next != null) { System.out.println("### expr = " + next); next = next.getNextExpr(); } } if (loopTop instanceof AssignToLocalVariable) { final LocalVariableInfo localVariableInfo = ((AssignToLocalVariable) loopTop).getLocalVariableInfo(); if ((localVariableInfo != null) && (localVariableInfo.getStart() == loopTop.getNextExpr().getStartPC()) && (localVariableInfo.getEnd() == _instruction.getThisPC())) { loopTop = loopTop.getPrevExpr(); // back up over the initialization } } branchSet.unhook(); // If there is an inner scope, it is likely that the loop counter var // is modified using an inner scope variable so use while rather than for if (reverseGoto.getPrevExpr() instanceof CompositeArbitraryScopeInstruction) { addAsComposites(ByteCode.COMPOSITE_WHILE, loopTop, branchSet); } else { addAsComposites(ByteCode.COMPOSITE_FOR_SUN, loopTop, branchSet); } handled = true; } } } if (!handled && !tail.isForwardBranch() && _instruction.isForwardConditionalBranchTarget()) { /** * This an if(exp) *<pre> * * if(??){then}... * ?? ?> [THEN] ... * --------> * *</pre> */ final ConditionalBranch lastForwardConditional = _instruction.getForwardConditionalBranches().getLast(); final BranchSet branchSet = lastForwardConditional.getOrCreateBranchSet(); if (doesNotContainContinueOrBreak(branchSet.getLast().getNextExpr(), _instruction)) { branchSet.unhook(); addAsComposites(ByteCode.COMPOSITE_IF, branchSet.getFirst().getPrevExpr(), branchSet); handled = true; } } if (!handled && !tail.isForwardBranch() && _instruction.isForwardUnconditionalBranchTarget()) { final LinkedList<Branch> forwardUnconditionalBranches = _instruction.getForwardUnconditionalBranches(); final Branch lastForwardUnconditional = forwardUnconditionalBranches.getLast(); final Instruction afterGoto = lastForwardUnconditional.getNextExpr(); if (afterGoto.getStartInstruction().isForwardConditionalBranchTarget()) { final LinkedList<ConditionalBranch> forwardConditionalBranches = afterGoto.getStartInstruction() .getForwardConditionalBranches(); final ConditionalBranch lastForwardConditional = forwardConditionalBranches.getLast(); final BranchSet branchSet = lastForwardConditional.getOrCreateBranchSet(); if (doesNotContainCompositeOrBranch(branchSet.getLast().getNextExpr(), lastForwardUnconditional)) { if (doesNotContainContinueOrBreak(afterGoto.getNextExpr(), _instruction)) { branchSet.unhook(); lastForwardUnconditional.unhook(); addAsComposites(ByteCode.COMPOSITE_IF_ELSE, branchSet.getFirst().getPrevExpr(), branchSet); handled = true; } } else { //then not clean. final ExpressionList newHeadTail = new ExpressionList(methodModel, this, lastForwardUnconditional); handled = newHeadTail.foldComposite(lastForwardUnconditional.getStartInstruction()); newHeadTail.unwind(); // handled = foldCompositeRecurse(lastForwardUnconditional); if (!handled && (forwardUnconditionalBranches.size() > 1)) { // BI AI AE BE // ?> ?> .. >> .. >> C S // ?---------------------->22 // ?---------->18 // +-------------->31 // +------>31 // Javac sometimes performs the above optimization. Basically the GOTO for the inner IFELSE(AI,AE) instead of targeting the GOTO // from the outer IFELSE(B1,BE) so instead of AE->BE->... we have AE-->... // // So given more than one target we retreat up the list of unconditionals until we find a clean one treating the previously visited GOTO // as a possible end for (int i = forwardUnconditionalBranches.size(); i > 1; i--) { final Branch thisGoto = forwardUnconditionalBranches.get(i - 1); final Branch elseGoto = forwardUnconditionalBranches.get(i - 2); final Instruction afterElseGoto = elseGoto.getNextExpr(); if (afterElseGoto.getStartInstruction().isConditionalBranchTarget()) { final BranchSet elseBranchSet = afterElseGoto.getStartInstruction() .getForwardConditionalBranches().getLast().getOrCreateBranchSet(); if (doesNotContainCompositeOrBranch(elseBranchSet.getLast().getNextExpr(), elseGoto)) { if (doesNotContainCompositeOrBranch(afterElseGoto.getNextExpr(), thisGoto)) { if (logger.isLoggable(Level.FINE)) { System.out.println(dumpDiagram(_instruction)); } elseBranchSet.unhook(); elseGoto.unhook(); if (logger.isLoggable(Level.FINE)) { System.out.println(dumpDiagram(_instruction)); } final CompositeInstruction composite = CompositeInstruction.create( ByteCode.COMPOSITE_IF_ELSE, methodModel, elseBranchSet.getFirst(), thisGoto, elseBranchSet); replaceInclusive(elseBranchSet.getFirst(), thisGoto.getPrevExpr(), composite); handled = true; break; } } } } } } } } if (!handled && !tail.isForwardBranch() && _instruction.isForwardConditionalBranchTarget() && _instruction.isForwardUnconditionalBranchTarget()) { // here we have multiple composites ending at the same point final Branch lastForwardUnconditional = _instruction.getForwardUnconditionalBranches().getLast(); final ConditionalBranch lastForwardConditional = _instruction.getStartInstruction() .getForwardConditionalBranches().getLast(); // we will clip the tail and see if recursing helps if (lastForwardConditional.getTarget().isAfter(lastForwardUnconditional)) { lastForwardConditional.retarget(lastForwardUnconditional); final ExpressionList newHeadTail = new ExpressionList(methodModel, this, lastForwardUnconditional); handled = newHeadTail.foldComposite(lastForwardUnconditional.getStartInstruction()); newHeadTail.unwind(); } } if (!handled) { break; } } } else { // might be end of arbitrary scope final LocalVariableTableEntry<LocalVariableInfo> localVariableTable = methodModel.getMethod() .getLocalVariableTableEntry(); int startPc = Short.MAX_VALUE; for (final LocalVariableInfo localVariableInfo : localVariableTable) { if (localVariableInfo.getEnd() == _instruction.getThisPC()) { logger.fine(localVariableInfo.getVariableName() + " scope " + localVariableInfo.getStart() + " ," + localVariableInfo.getEnd()); if (localVariableInfo.getStart() < startPc) { startPc = localVariableInfo.getStart(); } } } if (startPc < Short.MAX_VALUE) { logger.fine("Scope block from " + startPc + " to " + (tail.getThisPC() + tail.getLength())); for (Instruction i = head; i != null; i = i.getNextPC()) { if (i.getThisPC() == startPc) { final Instruction j = i.getRootExpr().getPrevExpr(); final Instruction startInstruction = j == null ? i : j; logger.fine("Start = " + startInstruction); addAsComposites(ByteCode.COMPOSITE_ARBITRARY_SCOPE, startInstruction.getPrevExpr(), null); handled = true; break; } } } } if (Config.instructionListener != null) { Config.instructionListener.showAndTell("after folding", head, _instruction); } return (handled); } }
public class class_name { public boolean foldComposite(final Instruction _instruction) throws ClassParseException { boolean handled = false; if (logger.isLoggable(Level.FINE)) { System.out.println("foldComposite: curr = " + _instruction); System.out.println(dumpDiagram(_instruction)); // System.out.println(dumpDiagram(null, _instruction)); } if (_instruction.isForwardBranchTarget() || ((tail != null) && tail.isBranch() && tail.asBranch().isReverseConditional())) { while (_instruction.isForwardBranchTarget() || ((tail != null) && tail.isBranch() && tail.asBranch().isReverseConditional())) { if (logger.isLoggable(Level.FINE)) { System.out.println(dumpDiagram(_instruction)); // depends on control dependency: [if], data = [none] } handled = false; // depends on control dependency: [while], data = [none] if ((tail != null) && tail.isBranch() && tail.asBranch().isReverseConditional()) { /** * This looks like an eclipse style for/while loop or possibly a do{}while() * <pre> * eclipse for (INIT,??,DELTA){BODY} ... * [INIT] >> [BODY] [DELTA] ?? ?< ... * ----------------> * <----------------- * * eclipse for (,??,DELTA){BODY} ... * >> [BODY] [DELTA] ?? ?< ... * ---------------> * <----------------- * * do {BODY} while(??) * [BODY] ?? ?< ... * <----------- * * eclipse while (??){BODY} ... * >> [BODY] ?? ?< ... * --------> * <---------- * </pre> **/ final BranchSet branchSet = ((ConditionalBranch) tail.asBranch()).getOrCreateBranchSet(); Instruction loopTop = branchSet.getTarget().getRootExpr(); final Instruction beginingOfBranch = branchSet.getFirst(); final Instruction startOfBeginningOfBranch = beginingOfBranch.getStartInstruction(); // empty loops sometimes look like eclipse loops! if (startOfBeginningOfBranch == loopTop) { loopTop = loopTop.getPrevExpr(); // depends on control dependency: [if], data = [none] if (loopTop instanceof AssignToLocalVariable) { final LocalVariableInfo localVariableInfo = ((AssignToLocalVariable) loopTop).getLocalVariableInfo(); if ((localVariableInfo.getStart() == loopTop.getNextExpr().getStartPC()) && (localVariableInfo.getEnd() == _instruction.getThisPC())) { loopTop = loopTop.getPrevExpr(); // back up over the initialization // depends on control dependency: [if], data = [none] } } addAsComposites(ByteCode.COMPOSITE_EMPTY_LOOP, loopTop, branchSet); // depends on control dependency: [if], data = [none] handled = true; // depends on control dependency: [if], data = [none] } else { if ((loopTop.getPrevExpr() != null) && loopTop.getPrevExpr().isBranch() && loopTop.getPrevExpr().asBranch().isForwardUnconditional()) { if (doesNotContainCompositeOrBranch(branchSet.getTarget().getRootExpr(), branchSet.getFirst().getPrevExpr())) { branchSet.unhook(); // depends on control dependency: [if], data = [none] loopTop.getPrevExpr().asBranch().unhook(); // depends on control dependency: [if], data = [none] loopTop = loopTop.getPrevExpr(); // depends on control dependency: [if], data = [none] // looptop == the unconditional? loopTop = loopTop.getPrevExpr(); // depends on control dependency: [if], data = [none] if (loopTop instanceof AssignToLocalVariable) { final LocalVariableInfo localVariableInfo = ((AssignToLocalVariable) loopTop).getLocalVariableInfo(); if ((localVariableInfo.getStart() == loopTop.getNextExpr().getStartPC()) && (localVariableInfo.getEnd() == _instruction.getThisPC())) { loopTop = loopTop.getPrevExpr(); // back up over the initialization // depends on control dependency: [if], data = [none] } } addAsComposites(ByteCode.COMPOSITE_FOR_ECLIPSE, loopTop, branchSet); // depends on control dependency: [if], data = [none] handled = true; // depends on control dependency: [if], data = [none] } } if (!handled) { // do{}while()_ do not require any previous instruction if (loopTop.getPrevExpr() == null) { throw new IllegalStateException("might be a dowhile with no provious expression"); } else if (!(loopTop.getPrevExpr().isBranch() && loopTop.getPrevExpr().asBranch().isForwardUnconditional())) { if (doesNotContainCompositeOrBranch(branchSet.getTarget().getRootExpr(), branchSet.getFirst() .getPrevExpr())) { loopTop = loopTop.getPrevExpr(); // depends on control dependency: [if], data = [none] branchSet.unhook(); // depends on control dependency: [if], data = [none] addAsComposites(ByteCode.COMPOSITE_DO_WHILE, loopTop, branchSet); // depends on control dependency: [if], data = [none] handled = true; // depends on control dependency: [if], data = [none] } } else { throw new IllegalStateException("might be mistaken for a do while!"); } } } } if (!handled && _instruction.isForwardConditionalBranchTarget() && tail.isBranch() && tail.asBranch().isReverseUnconditional()) { /** * This is s sun style loop * <pre> * sun for (INIT,??,DELTA){BODY} ... * * [INIT] ?? ?> [BODY] [DELTA] << ... * ------------------> * <------------------- * * sun for (,??,DELTA){BODY} ... * * ?? ?> [BODY] [DELTA] << ... * ------------------> * <------------------- * * sun while (?){l} ... * * ?? ?> [BODY] << ... * -----------> * <------------ * *</pre> */ final ConditionalBranch lastForwardConditional = _instruction.getForwardConditionalBranches().getLast(); final BranchSet branchSet = lastForwardConditional.getOrCreateBranchSet(); final Branch reverseGoto = tail.asBranch(); final Instruction loopBackTarget = reverseGoto.getTarget(); if (loopBackTarget.getReverseUnconditionalBranches().size() > 1) { throw new ClassParseException(ClassParseException.TYPE.CONFUSINGBRANCHESPOSSIBLYCONTINUE); } if (_instruction.isForwardUnconditionalBranchTarget()) { /** * Check if we have a break * <pre> * ?? ?> [BODY] ?1 ?> >> [BODY] << ... * --------------------------> * ----> * -----------> * <---------------------------- * *</pre> */ final Branch lastForwardUnconditional = _instruction.getForwardUnconditionalBranches().getLast(); if ((lastForwardUnconditional != null) && lastForwardUnconditional.isAfter(lastForwardConditional)) { throw new ClassParseException(ClassParseException.TYPE.CONFUSINGBRANCHESPOSSIBLYBREAK); } } if (loopBackTarget != branchSet.getFirst().getStartInstruction()) { /** * we may have a if(?1){while(?2){}}else{...} where the else goto has been optimized away. * <pre> * One might expect * ?1 ?> ?2 ?> [BODY] << >> [ELSE] ... * -------------------> * ----------->! * <---------- * --------> * * However as above the conditional branch to the unconditional (!) can be optimized away and the conditional inverted and extended * ?1 ?> ?2 ?> [BODY] << >> [ELSE] ... * --------------------> * -----------*---------> * <----------- * * However we can also now remove the forward unconditional completely as it is unreachable * ?1 ?> ?2 ?> [BODY] << [ELSE] ... * -----------------> * ------------------> * <----------- * * </pre> */ final Instruction loopbackTargetRoot = loopBackTarget.getRootExpr(); if (loopbackTargetRoot.isBranch() && loopbackTargetRoot.asBranch().isConditional()) { final ConditionalBranch topOfRealLoop = (ConditionalBranch) loopbackTargetRoot.asBranch(); BranchSet extentBranchSet = topOfRealLoop.getBranchSet(); if (topOfRealLoop.getBranchSet() == null) { extentBranchSet = topOfRealLoop.findEndOfConditionalBranchSet(_instruction.getNextPC()) .getOrCreateBranchSet(); // depends on control dependency: [if], data = [none] } // We believe that this extendBranchSet is the real top of the while. if (doesNotContainCompositeOrBranch(extentBranchSet.getLast().getNextExpr(), reverseGoto)) { Instruction loopTop = topOfRealLoop.getPrevExpr(); if (loopTop instanceof AssignToLocalVariable) { final LocalVariableInfo localVariableInfo = ((AssignToLocalVariable) loopTop).getLocalVariableInfo(); if ((localVariableInfo.getStart() == loopTop.getNextExpr().getStartPC()) && (localVariableInfo.getEnd() == _instruction.getThisPC())) { loopTop = loopTop.getPrevExpr(); // back up over the initialization // depends on control dependency: [if], data = [none] } } extentBranchSet.unhook(); // depends on control dependency: [if], data = [none] addAsComposites(ByteCode.COMPOSITE_FOR_SUN, loopTop, extentBranchSet); // depends on control dependency: [if], data = [none] final UnconditionalBranch fakeGoto = new FakeGoto(methodModel, extentBranchSet.getLast().getTarget()); add(fakeGoto); // depends on control dependency: [if], data = [none] extentBranchSet.getLast().getTarget().addBranchTarget(fakeGoto); // depends on control dependency: [if], data = [none] handled = true; // depends on control dependency: [if], data = [none] } } } else { /** * Just a normal sun style loop */ if (doesNotContainCompositeOrBranch(branchSet.getLast().getNextExpr(), reverseGoto)) { Instruction loopTop = reverseGoto.getTarget().getRootExpr().getPrevExpr(); if (logger.isLoggable(Level.FINEST)) { Instruction next = branchSet.getFirst().getNextExpr(); System.out.println("### for/while candidate exprs: " + branchSet.getFirst()); // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] while (next != null) { System.out.println("### expr = " + next); // depends on control dependency: [while], data = [none] next = next.getNextExpr(); // depends on control dependency: [while], data = [none] } } if (loopTop instanceof AssignToLocalVariable) { final LocalVariableInfo localVariableInfo = ((AssignToLocalVariable) loopTop).getLocalVariableInfo(); if ((localVariableInfo != null) && (localVariableInfo.getStart() == loopTop.getNextExpr().getStartPC()) && (localVariableInfo.getEnd() == _instruction.getThisPC())) { loopTop = loopTop.getPrevExpr(); // back up over the initialization // depends on control dependency: [if], data = [none] } } branchSet.unhook(); // depends on control dependency: [if], data = [none] // If there is an inner scope, it is likely that the loop counter var // is modified using an inner scope variable so use while rather than for if (reverseGoto.getPrevExpr() instanceof CompositeArbitraryScopeInstruction) { addAsComposites(ByteCode.COMPOSITE_WHILE, loopTop, branchSet); // depends on control dependency: [if], data = [none] } else { addAsComposites(ByteCode.COMPOSITE_FOR_SUN, loopTop, branchSet); // depends on control dependency: [if], data = [none] } handled = true; // depends on control dependency: [if], data = [none] } } } if (!handled && !tail.isForwardBranch() && _instruction.isForwardConditionalBranchTarget()) { /** * This an if(exp) *<pre> * * if(??){then}... * ?? ?> [THEN] ... * --------> * *</pre> */ final ConditionalBranch lastForwardConditional = _instruction.getForwardConditionalBranches().getLast(); final BranchSet branchSet = lastForwardConditional.getOrCreateBranchSet(); if (doesNotContainContinueOrBreak(branchSet.getLast().getNextExpr(), _instruction)) { branchSet.unhook(); // depends on control dependency: [if], data = [none] addAsComposites(ByteCode.COMPOSITE_IF, branchSet.getFirst().getPrevExpr(), branchSet); // depends on control dependency: [if], data = [none] handled = true; // depends on control dependency: [if], data = [none] } } if (!handled && !tail.isForwardBranch() && _instruction.isForwardUnconditionalBranchTarget()) { final LinkedList<Branch> forwardUnconditionalBranches = _instruction.getForwardUnconditionalBranches(); final Branch lastForwardUnconditional = forwardUnconditionalBranches.getLast(); final Instruction afterGoto = lastForwardUnconditional.getNextExpr(); if (afterGoto.getStartInstruction().isForwardConditionalBranchTarget()) { final LinkedList<ConditionalBranch> forwardConditionalBranches = afterGoto.getStartInstruction() .getForwardConditionalBranches(); final ConditionalBranch lastForwardConditional = forwardConditionalBranches.getLast(); final BranchSet branchSet = lastForwardConditional.getOrCreateBranchSet(); if (doesNotContainCompositeOrBranch(branchSet.getLast().getNextExpr(), lastForwardUnconditional)) { if (doesNotContainContinueOrBreak(afterGoto.getNextExpr(), _instruction)) { branchSet.unhook(); // depends on control dependency: [if], data = [none] lastForwardUnconditional.unhook(); // depends on control dependency: [if], data = [none] addAsComposites(ByteCode.COMPOSITE_IF_ELSE, branchSet.getFirst().getPrevExpr(), branchSet); // depends on control dependency: [if], data = [none] handled = true; // depends on control dependency: [if], data = [none] } } else { //then not clean. final ExpressionList newHeadTail = new ExpressionList(methodModel, this, lastForwardUnconditional); handled = newHeadTail.foldComposite(lastForwardUnconditional.getStartInstruction()); // depends on control dependency: [if], data = [none] newHeadTail.unwind(); // depends on control dependency: [if], data = [none] // handled = foldCompositeRecurse(lastForwardUnconditional); if (!handled && (forwardUnconditionalBranches.size() > 1)) { // BI AI AE BE // ?> ?> .. >> .. >> C S // ?---------------------->22 // ?---------->18 // +-------------->31 // +------>31 // Javac sometimes performs the above optimization. Basically the GOTO for the inner IFELSE(AI,AE) instead of targeting the GOTO // from the outer IFELSE(B1,BE) so instead of AE->BE->... we have AE-->... // // So given more than one target we retreat up the list of unconditionals until we find a clean one treating the previously visited GOTO // as a possible end for (int i = forwardUnconditionalBranches.size(); i > 1; i--) { final Branch thisGoto = forwardUnconditionalBranches.get(i - 1); final Branch elseGoto = forwardUnconditionalBranches.get(i - 2); final Instruction afterElseGoto = elseGoto.getNextExpr(); if (afterElseGoto.getStartInstruction().isConditionalBranchTarget()) { final BranchSet elseBranchSet = afterElseGoto.getStartInstruction() .getForwardConditionalBranches().getLast().getOrCreateBranchSet(); if (doesNotContainCompositeOrBranch(elseBranchSet.getLast().getNextExpr(), elseGoto)) { if (doesNotContainCompositeOrBranch(afterElseGoto.getNextExpr(), thisGoto)) { if (logger.isLoggable(Level.FINE)) { System.out.println(dumpDiagram(_instruction)); // depends on control dependency: [if], data = [none] } elseBranchSet.unhook(); // depends on control dependency: [if], data = [none] elseGoto.unhook(); // depends on control dependency: [if], data = [none] if (logger.isLoggable(Level.FINE)) { System.out.println(dumpDiagram(_instruction)); // depends on control dependency: [if], data = [none] } final CompositeInstruction composite = CompositeInstruction.create( ByteCode.COMPOSITE_IF_ELSE, methodModel, elseBranchSet.getFirst(), thisGoto, elseBranchSet); replaceInclusive(elseBranchSet.getFirst(), thisGoto.getPrevExpr(), composite); // depends on control dependency: [if], data = [none] handled = true; // depends on control dependency: [if], data = [none] break; } } } } } } } } if (!handled && !tail.isForwardBranch() && _instruction.isForwardConditionalBranchTarget() && _instruction.isForwardUnconditionalBranchTarget()) { // here we have multiple composites ending at the same point final Branch lastForwardUnconditional = _instruction.getForwardUnconditionalBranches().getLast(); final ConditionalBranch lastForwardConditional = _instruction.getStartInstruction() .getForwardConditionalBranches().getLast(); // we will clip the tail and see if recursing helps if (lastForwardConditional.getTarget().isAfter(lastForwardUnconditional)) { lastForwardConditional.retarget(lastForwardUnconditional); // depends on control dependency: [if], data = [none] final ExpressionList newHeadTail = new ExpressionList(methodModel, this, lastForwardUnconditional); handled = newHeadTail.foldComposite(lastForwardUnconditional.getStartInstruction()); // depends on control dependency: [if], data = [none] newHeadTail.unwind(); // depends on control dependency: [if], data = [none] } } if (!handled) { break; } } } else { // might be end of arbitrary scope final LocalVariableTableEntry<LocalVariableInfo> localVariableTable = methodModel.getMethod() .getLocalVariableTableEntry(); int startPc = Short.MAX_VALUE; for (final LocalVariableInfo localVariableInfo : localVariableTable) { if (localVariableInfo.getEnd() == _instruction.getThisPC()) { logger.fine(localVariableInfo.getVariableName() + " scope " + localVariableInfo.getStart() + " ," + localVariableInfo.getEnd()); // depends on control dependency: [if], data = [none] if (localVariableInfo.getStart() < startPc) { startPc = localVariableInfo.getStart(); // depends on control dependency: [if], data = [none] } } } if (startPc < Short.MAX_VALUE) { logger.fine("Scope block from " + startPc + " to " + (tail.getThisPC() + tail.getLength())); // depends on control dependency: [if], data = [none] for (Instruction i = head; i != null; i = i.getNextPC()) { if (i.getThisPC() == startPc) { final Instruction j = i.getRootExpr().getPrevExpr(); final Instruction startInstruction = j == null ? i : j; logger.fine("Start = " + startInstruction); // depends on control dependency: [if], data = [none] addAsComposites(ByteCode.COMPOSITE_ARBITRARY_SCOPE, startInstruction.getPrevExpr(), null); // depends on control dependency: [if], data = [none] handled = true; // depends on control dependency: [if], data = [none] break; } } } } if (Config.instructionListener != null) { Config.instructionListener.showAndTell("after folding", head, _instruction); } return (handled); } }
public class class_name { public Object convert( String value, TypeLiteral<?> toType ) { Properties properties = new Properties(); ByteArrayInputStream bais = null; try { bais = new ByteArrayInputStream( value.getBytes( PROPERTIES_ENCODING ) ); properties.load( bais ); } catch ( IOException e ) { // Should never happen. throw new ProvisionException( "Failed to parse " + value + "' into Properties", e ); } finally { if ( bais != null ) { try { bais.close(); } catch ( IOException e ) { // close quietly } } } return properties; } }
public class class_name { public Object convert( String value, TypeLiteral<?> toType ) { Properties properties = new Properties(); ByteArrayInputStream bais = null; try { bais = new ByteArrayInputStream( value.getBytes( PROPERTIES_ENCODING ) ); // depends on control dependency: [try], data = [none] properties.load( bais ); // depends on control dependency: [try], data = [none] } catch ( IOException e ) { // Should never happen. throw new ProvisionException( "Failed to parse " + value + "' into Properties", e ); } // depends on control dependency: [catch], data = [none] finally { if ( bais != null ) { try { bais.close(); // depends on control dependency: [try], data = [none] } catch ( IOException e ) { // close quietly } // depends on control dependency: [catch], data = [none] } } return properties; } }
public class class_name { static void writeBytesToFile(File file, byte[] bytes) throws IOException { BufferedOutputStream bos = null; try { FileOutputStream fos = new FileOutputStream(file); bos = new BufferedOutputStream(fos); bos.write(bytes); } finally { if (bos != null) { try { // flush and close the BufferedOutputStream bos.flush(); bos.close(); } catch (Exception e) {} } } } }
public class class_name { static void writeBytesToFile(File file, byte[] bytes) throws IOException { BufferedOutputStream bos = null; try { FileOutputStream fos = new FileOutputStream(file); bos = new BufferedOutputStream(fos); bos.write(bytes); } finally { if (bos != null) { try { // flush and close the BufferedOutputStream bos.flush(); // depends on control dependency: [try], data = [none] bos.close(); // depends on control dependency: [try], data = [none] } catch (Exception e) {} // depends on control dependency: [catch], data = [none] } } } }
public class class_name { public Collection<VTimezone> getComponents() { List<VTimezone> components = new ArrayList<VTimezone>(assignments.size()); for (TimezoneAssignment assignment : assignments) { VTimezone component = assignment.getComponent(); if (component != null) { components.add(component); } } return Collections.unmodifiableList(components); } }
public class class_name { public Collection<VTimezone> getComponents() { List<VTimezone> components = new ArrayList<VTimezone>(assignments.size()); for (TimezoneAssignment assignment : assignments) { VTimezone component = assignment.getComponent(); if (component != null) { components.add(component); // depends on control dependency: [if], data = [(component] } } return Collections.unmodifiableList(components); } }
public class class_name { private int matchesDigit(String str, int start, int[] decVal) { String[] localeDigits = symbols.getDigitStringsLocal(); // Check if the sequence at the current position matches locale digits. for (int i = 0; i < 10; i++) { int digitStrLen = localeDigits[i].length(); if (str.regionMatches(start, localeDigits[i], 0, digitStrLen)) { decVal[0] = i; return digitStrLen; } } // If no locale digit match, then check if this is a Unicode digit int cp = str.codePointAt(start); decVal[0] = UCharacter.digit(cp, 10); if (decVal[0] >= 0) { return Character.charCount(cp); } return 0; } }
public class class_name { private int matchesDigit(String str, int start, int[] decVal) { String[] localeDigits = symbols.getDigitStringsLocal(); // Check if the sequence at the current position matches locale digits. for (int i = 0; i < 10; i++) { int digitStrLen = localeDigits[i].length(); if (str.regionMatches(start, localeDigits[i], 0, digitStrLen)) { decVal[0] = i; // depends on control dependency: [if], data = [none] return digitStrLen; // depends on control dependency: [if], data = [none] } } // If no locale digit match, then check if this is a Unicode digit int cp = str.codePointAt(start); decVal[0] = UCharacter.digit(cp, 10); if (decVal[0] >= 0) { return Character.charCount(cp); // depends on control dependency: [if], data = [none] } return 0; } }
public class class_name { public EClass getIfcFrequencyMeasure() { if (ifcFrequencyMeasureEClass == null) { ifcFrequencyMeasureEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(680); } return ifcFrequencyMeasureEClass; } }
public class class_name { public EClass getIfcFrequencyMeasure() { if (ifcFrequencyMeasureEClass == null) { ifcFrequencyMeasureEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(680); // depends on control dependency: [if], data = [none] } return ifcFrequencyMeasureEClass; } }
public class class_name { public static Map<String, Method> getReadMethods(Object bean) { Class<? extends Object> beanClass = bean.getClass(); try { Map<String, Method> readMethods = new HashMap<>(); final BeanInfo beanInfo = Introspector.getBeanInfo(beanClass); final PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); if (propertyDescriptors != null) { for (final PropertyDescriptor propertyDescriptor : propertyDescriptors) { if (propertyDescriptor != null) { final String name = propertyDescriptor.getName(); final Method readMethod = propertyDescriptor.getReadMethod(); if (readMethod != null) { readMethods.put(name, readMethod); } } } } return readMethods; } catch (final IntrospectionException e) { throw new BeanWrapperException("Failed to initialize bean wrapper on " + beanClass, e); } } }
public class class_name { public static Map<String, Method> getReadMethods(Object bean) { Class<? extends Object> beanClass = bean.getClass(); try { Map<String, Method> readMethods = new HashMap<>(); final BeanInfo beanInfo = Introspector.getBeanInfo(beanClass); final PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); if (propertyDescriptors != null) { for (final PropertyDescriptor propertyDescriptor : propertyDescriptors) { if (propertyDescriptor != null) { final String name = propertyDescriptor.getName(); final Method readMethod = propertyDescriptor.getReadMethod(); if (readMethod != null) { readMethods.put(name, readMethod); // depends on control dependency: [if], data = [none] } } } } return readMethods; // depends on control dependency: [try], data = [none] } catch (final IntrospectionException e) { throw new BeanWrapperException("Failed to initialize bean wrapper on " + beanClass, e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static double sumOfProducts(double[]... nums) { if (nums == null || nums.length < 1) return 0; double sum = 0; for (int i = 0; i < nums.length; i++) { /* The ith column for all of the rows */ double[] column = column(i, nums); sum += times(column); } return sum; } }
public class class_name { public static double sumOfProducts(double[]... nums) { if (nums == null || nums.length < 1) return 0; double sum = 0; for (int i = 0; i < nums.length; i++) { /* The ith column for all of the rows */ double[] column = column(i, nums); sum += times(column); // depends on control dependency: [for], data = [none] } return sum; } }
public class class_name { private static Level translateLevel(final int level) { if (level <= TRACE_INT) { return Level.TRACE; } else if (level <= DEBUG_INT) { return Level.DEBUG; } else if (level <= INFO_INT) { return Level.INFO; } else if (level <= WARN_INT) { return Level.WARN; } else { return Level.ERROR; } } }
public class class_name { private static Level translateLevel(final int level) { if (level <= TRACE_INT) { return Level.TRACE; // depends on control dependency: [if], data = [none] } else if (level <= DEBUG_INT) { return Level.DEBUG; // depends on control dependency: [if], data = [none] } else if (level <= INFO_INT) { return Level.INFO; // depends on control dependency: [if], data = [none] } else if (level <= WARN_INT) { return Level.WARN; // depends on control dependency: [if], data = [none] } else { return Level.ERROR; // depends on control dependency: [if], data = [none] } } }
public class class_name { public FormEncodingBuilder add(String name, String value) { if (content.size() > 0) { content.writeByte('&'); } HttpUrl.canonicalize(content, name, 0, name.length(), HttpUrl.FORM_ENCODE_SET, false, false, true, true); content.writeByte('='); HttpUrl.canonicalize(content, value, 0, value.length(), HttpUrl.FORM_ENCODE_SET, false, false, true, true); return this; } }
public class class_name { public FormEncodingBuilder add(String name, String value) { if (content.size() > 0) { content.writeByte('&'); // depends on control dependency: [if], data = [none] } HttpUrl.canonicalize(content, name, 0, name.length(), HttpUrl.FORM_ENCODE_SET, false, false, true, true); content.writeByte('='); HttpUrl.canonicalize(content, value, 0, value.length(), HttpUrl.FORM_ENCODE_SET, false, false, true, true); return this; } }
public class class_name { public GetSessionStatisticsResponse getSessionStatistics(GetSessionStatisticsRequest request) { checkNotNull(request, "The parameter request should NOT be null."); checkStringNotEmpty(request.getSessionId(), "The parameter sessionId should NOT be null or empty string."); InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, STATISTICS, LIVE_SESSION, request.getSessionId()); if (request.getStartDate() != null) { internalRequest.addParameter("startDate", request.getStartDate()); } if (request.getEndDate() != null) { internalRequest.addParameter("endDate", request.getEndDate()); } if (request.getAggregate() != null) { internalRequest.addParameter("aggregate", request.getAggregate().toString()); } return invokeHttpClient(internalRequest, GetSessionStatisticsResponse.class); } }
public class class_name { public GetSessionStatisticsResponse getSessionStatistics(GetSessionStatisticsRequest request) { checkNotNull(request, "The parameter request should NOT be null."); checkStringNotEmpty(request.getSessionId(), "The parameter sessionId should NOT be null or empty string."); InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, STATISTICS, LIVE_SESSION, request.getSessionId()); if (request.getStartDate() != null) { internalRequest.addParameter("startDate", request.getStartDate()); // depends on control dependency: [if], data = [none] } if (request.getEndDate() != null) { internalRequest.addParameter("endDate", request.getEndDate()); // depends on control dependency: [if], data = [none] } if (request.getAggregate() != null) { internalRequest.addParameter("aggregate", request.getAggregate().toString()); // depends on control dependency: [if], data = [none] } return invokeHttpClient(internalRequest, GetSessionStatisticsResponse.class); } }
public class class_name { public void title(String title) { Validate.notNull(title); Element titleEl = getElementsByTag("title").first(); if (titleEl == null) { // add to head head().appendElement("title").text(title); } else { titleEl.text(title); } } }
public class class_name { public void title(String title) { Validate.notNull(title); Element titleEl = getElementsByTag("title").first(); if (titleEl == null) { // add to head head().appendElement("title").text(title); // depends on control dependency: [if], data = [none] } else { titleEl.text(title); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void addLanguage(Language language) { languages.add(language); if (dropdown.isAttached()) { addLanguageItem(language); } else { lazyLoaded = true; } } }
public class class_name { public void addLanguage(Language language) { languages.add(language); if (dropdown.isAttached()) { addLanguageItem(language); // depends on control dependency: [if], data = [none] } else { lazyLoaded = true; // depends on control dependency: [if], data = [none] } } }
public class class_name { public void initializeMap(final MapPresenter mapPresenter, String applicationId, String id, final DefaultMapWidget... mapWidgets) { GwtCommand commandRequest = new GwtCommand(GetMapConfigurationRequest.COMMAND); commandRequest.setCommandRequest(new GetMapConfigurationRequest(id, applicationId)); commandService.execute(commandRequest, new AbstractCommandCallback<GetMapConfigurationResponse>() { public void execute(GetMapConfigurationResponse response) { // Initialize the MapModel and ViewPort: ClientMapInfo mapInfo = response.getMapInfo(); // Create the map configuration MapConfiguration configuration = createMapConfiguration(mapInfo, mapPresenter); // We must initialize the map first (without firing the event), as layer constructors may depend on it : ((MapPresenterImpl) mapPresenter).initialize(configuration, false, mapWidgets); // Add all layers: for (ClientLayerInfo layerInfo : mapInfo.getLayers()) { ServerLayer<?> layer = createLayer(configuration, layerInfo, mapPresenter.getViewPort(), mapPresenter.getEventBus()); mapPresenter.getLayersModel().addLayer(layer); } // All layers animated LayersModelRenderer modelRenderer = mapPresenter.getLayersModelRenderer(); for (int i = 0; i < mapPresenter.getLayersModel().getLayerCount(); i++) { modelRenderer.setAnimated(mapPresenter.getLayersModel().getLayer(i), true); } // Also add a renderer for feature selection: FeatureSelectionRenderer renderer = new FeatureSelectionRenderer(mapPresenter); renderer.initialize(mapInfo); mapPresenter.getEventBus().addFeatureSelectionHandler(renderer); mapPresenter.getEventBus().addLayerVisibilityHandler(renderer); // now we can fire the initialization event mapPresenter.getEventBus().fireEvent(new MapInitializationEvent(mapPresenter)); } }); } }
public class class_name { public void initializeMap(final MapPresenter mapPresenter, String applicationId, String id, final DefaultMapWidget... mapWidgets) { GwtCommand commandRequest = new GwtCommand(GetMapConfigurationRequest.COMMAND); commandRequest.setCommandRequest(new GetMapConfigurationRequest(id, applicationId)); commandService.execute(commandRequest, new AbstractCommandCallback<GetMapConfigurationResponse>() { public void execute(GetMapConfigurationResponse response) { // Initialize the MapModel and ViewPort: ClientMapInfo mapInfo = response.getMapInfo(); // Create the map configuration MapConfiguration configuration = createMapConfiguration(mapInfo, mapPresenter); // We must initialize the map first (without firing the event), as layer constructors may depend on it : ((MapPresenterImpl) mapPresenter).initialize(configuration, false, mapWidgets); // Add all layers: for (ClientLayerInfo layerInfo : mapInfo.getLayers()) { ServerLayer<?> layer = createLayer(configuration, layerInfo, mapPresenter.getViewPort(), mapPresenter.getEventBus()); mapPresenter.getLayersModel().addLayer(layer); // depends on control dependency: [for], data = [none] } // All layers animated LayersModelRenderer modelRenderer = mapPresenter.getLayersModelRenderer(); for (int i = 0; i < mapPresenter.getLayersModel().getLayerCount(); i++) { modelRenderer.setAnimated(mapPresenter.getLayersModel().getLayer(i), true); // depends on control dependency: [for], data = [i] } // Also add a renderer for feature selection: FeatureSelectionRenderer renderer = new FeatureSelectionRenderer(mapPresenter); renderer.initialize(mapInfo); mapPresenter.getEventBus().addFeatureSelectionHandler(renderer); mapPresenter.getEventBus().addLayerVisibilityHandler(renderer); // now we can fire the initialization event mapPresenter.getEventBus().fireEvent(new MapInitializationEvent(mapPresenter)); } }); } }
public class class_name { @Override public Period until(ChronoLocalDate endDate) { LocalDate end = LocalDate.from(endDate); long totalMonths = end.getProlepticMonth() - this.getProlepticMonth(); // safe int days = end.day - this.day; if (totalMonths > 0 && days < 0) { totalMonths--; LocalDate calcDate = this.plusMonths(totalMonths); days = (int) (end.toEpochDay() - calcDate.toEpochDay()); // safe } else if (totalMonths < 0 && days > 0) { totalMonths++; days -= end.lengthOfMonth(); } long years = totalMonths / 12; // safe int months = (int) (totalMonths % 12); // safe return Period.of(Jdk8Methods.safeToInt(years), months, days); } }
public class class_name { @Override public Period until(ChronoLocalDate endDate) { LocalDate end = LocalDate.from(endDate); long totalMonths = end.getProlepticMonth() - this.getProlepticMonth(); // safe int days = end.day - this.day; if (totalMonths > 0 && days < 0) { totalMonths--; // depends on control dependency: [if], data = [none] LocalDate calcDate = this.plusMonths(totalMonths); days = (int) (end.toEpochDay() - calcDate.toEpochDay()); // safe // depends on control dependency: [if], data = [none] } else if (totalMonths < 0 && days > 0) { totalMonths++; // depends on control dependency: [if], data = [none] days -= end.lengthOfMonth(); // depends on control dependency: [if], data = [none] } long years = totalMonths / 12; // safe int months = (int) (totalMonths % 12); // safe return Period.of(Jdk8Methods.safeToInt(years), months, days); } }
public class class_name { @Override public List<Content> rewriteElement(@NotNull Element element) { // rewrite anchor elements if (StringUtils.equalsIgnoreCase(element.getName(), "a")) { return rewriteAnchor(element); } // rewrite image elements else if (StringUtils.equalsIgnoreCase(element.getName(), "img")) { return rewriteImage(element); } // detect BR elements and turn those into "self-closing" elements // since the otherwise generated <br> </br> structures are illegal and // are not handled correctly by Internet Explorers else if (StringUtils.equalsIgnoreCase(element.getName(), "br")) { if (element.getContent().size() > 0) { element.removeContent(); } return null; } // detect empty elements and insert at least an empty string to avoid "self-closing" elements // that are not handled correctly by most browsers else if (NONSELFCLOSING_TAGS.contains(StringUtils.lowerCase(element.getName()))) { if (element.getContent().isEmpty()) { element.setText(""); } return null; } return null; } }
public class class_name { @Override public List<Content> rewriteElement(@NotNull Element element) { // rewrite anchor elements if (StringUtils.equalsIgnoreCase(element.getName(), "a")) { return rewriteAnchor(element); // depends on control dependency: [if], data = [none] } // rewrite image elements else if (StringUtils.equalsIgnoreCase(element.getName(), "img")) { return rewriteImage(element); // depends on control dependency: [if], data = [none] } // detect BR elements and turn those into "self-closing" elements // since the otherwise generated <br> </br> structures are illegal and // are not handled correctly by Internet Explorers else if (StringUtils.equalsIgnoreCase(element.getName(), "br")) { if (element.getContent().size() > 0) { element.removeContent(); // depends on control dependency: [if], data = [none] } return null; // depends on control dependency: [if], data = [none] } // detect empty elements and insert at least an empty string to avoid "self-closing" elements // that are not handled correctly by most browsers else if (NONSELFCLOSING_TAGS.contains(StringUtils.lowerCase(element.getName()))) { if (element.getContent().isEmpty()) { element.setText(""); // depends on control dependency: [if], data = [none] } return null; // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { private void processURLPatterns(List<ServletMapping> servletMappings) { for (ServletMapping servletMapping : servletMappings) { String servletName = servletMapping.getServletName(); List<String> urlPatterns = servletMapping.getURLPatterns(); if (urlPatterns != null) { for (String pattern : urlPatterns) { urlPatternToServletName.put(pattern, servletName); } } } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "urlPatternToServletName: " + urlPatternToServletName); } } }
public class class_name { private void processURLPatterns(List<ServletMapping> servletMappings) { for (ServletMapping servletMapping : servletMappings) { String servletName = servletMapping.getServletName(); List<String> urlPatterns = servletMapping.getURLPatterns(); if (urlPatterns != null) { for (String pattern : urlPatterns) { urlPatternToServletName.put(pattern, servletName); // depends on control dependency: [for], data = [pattern] } } } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "urlPatternToServletName: " + urlPatternToServletName); // depends on control dependency: [if], data = [none] } } }
public class class_name { public ExecutableFlow getFlow(final int executionId) { if (hasExecution(executionId)) { return this.queuedFlowMap.get(executionId).getSecond(); } return null; } }
public class class_name { public ExecutableFlow getFlow(final int executionId) { if (hasExecution(executionId)) { return this.queuedFlowMap.get(executionId).getSecond(); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public static base_responses add(nitro_service client, responderaction resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { responderaction addresources[] = new responderaction[resources.length]; for (int i=0;i<resources.length;i++){ addresources[i] = new responderaction(); addresources[i].name = resources[i].name; addresources[i].type = resources[i].type; addresources[i].target = resources[i].target; addresources[i].htmlpage = resources[i].htmlpage; addresources[i].bypasssafetycheck = resources[i].bypasssafetycheck; addresources[i].comment = resources[i].comment; } result = add_bulk_request(client, addresources); } return result; } }
public class class_name { public static base_responses add(nitro_service client, responderaction resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { responderaction addresources[] = new responderaction[resources.length]; for (int i=0;i<resources.length;i++){ addresources[i] = new responderaction(); // depends on control dependency: [for], data = [i] addresources[i].name = resources[i].name; // depends on control dependency: [for], data = [i] addresources[i].type = resources[i].type; // depends on control dependency: [for], data = [i] addresources[i].target = resources[i].target; // depends on control dependency: [for], data = [i] addresources[i].htmlpage = resources[i].htmlpage; // depends on control dependency: [for], data = [i] addresources[i].bypasssafetycheck = resources[i].bypasssafetycheck; // depends on control dependency: [for], data = [i] addresources[i].comment = resources[i].comment; // depends on control dependency: [for], data = [i] } result = add_bulk_request(client, addresources); } return result; } }
public class class_name { public static List<String> getParamNames(Method method) { try { int size = method.getParameterTypes().length; if (size == 0) return new ArrayList<String>(0); List<String> list = ClassMetaReader.getParamNames(method.getDeclaringClass()).get(ClassMetaReader.getKey(method)); if (list == null) return null; if (list.size() == size) return list; if (list.size() > size) return list.subList(0, size); return null; } catch (Throwable e) { throw new RuntimeException(e); } } }
public class class_name { public static List<String> getParamNames(Method method) { try { int size = method.getParameterTypes().length; if (size == 0) return new ArrayList<String>(0); List<String> list = ClassMetaReader.getParamNames(method.getDeclaringClass()).get(ClassMetaReader.getKey(method)); if (list == null) return null; if (list.size() == size) return list; if (list.size() > size) return list.subList(0, size); return null; // depends on control dependency: [try], data = [none] } catch (Throwable e) { throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public boolean knowsFunction(String functionName) { String functionPrefix = functionName.substring(0, functionName.indexOf(':') + 1); if (!functionPrefix.equals(prefix)) { return false; } return members.containsKey(functionName.substring(functionName.indexOf(':') + 1, functionName.indexOf('('))); } }
public class class_name { public boolean knowsFunction(String functionName) { String functionPrefix = functionName.substring(0, functionName.indexOf(':') + 1); if (!functionPrefix.equals(prefix)) { return false; // depends on control dependency: [if], data = [none] } return members.containsKey(functionName.substring(functionName.indexOf(':') + 1, functionName.indexOf('('))); } }
public class class_name { public static base_responses delete(nitro_service client, String fipskeyname[]) throws Exception { base_responses result = null; if (fipskeyname != null && fipskeyname.length > 0) { sslfipskey deleteresources[] = new sslfipskey[fipskeyname.length]; for (int i=0;i<fipskeyname.length;i++){ deleteresources[i] = new sslfipskey(); deleteresources[i].fipskeyname = fipskeyname[i]; } result = delete_bulk_request(client, deleteresources); } return result; } }
public class class_name { public static base_responses delete(nitro_service client, String fipskeyname[]) throws Exception { base_responses result = null; if (fipskeyname != null && fipskeyname.length > 0) { sslfipskey deleteresources[] = new sslfipskey[fipskeyname.length]; for (int i=0;i<fipskeyname.length;i++){ deleteresources[i] = new sslfipskey(); // depends on control dependency: [for], data = [i] deleteresources[i].fipskeyname = fipskeyname[i]; // depends on control dependency: [for], data = [i] } result = delete_bulk_request(client, deleteresources); } return result; } }
public class class_name { @Override public final void close() { externalAccessLock.writeLock().lock(); try { if (closed) return; closed = true; onConnectionClose(); } finally { externalAccessLock.writeLock().unlock(); } onConnectionClosed(); } }
public class class_name { @Override public final void close() { externalAccessLock.writeLock().lock(); try { if (closed) return; closed = true; // depends on control dependency: [try], data = [none] onConnectionClose(); // depends on control dependency: [try], data = [none] } finally { externalAccessLock.writeLock().unlock(); } onConnectionClosed(); } }
public class class_name { public boolean supports(Class<?> clazz) { for (AccessDecisionVoter voter : this.decisionVoters) { if (!voter.supports(clazz)) { return false; } } return true; } }
public class class_name { public boolean supports(Class<?> clazz) { for (AccessDecisionVoter voter : this.decisionVoters) { if (!voter.supports(clazz)) { return false; // depends on control dependency: [if], data = [none] } } return true; } }
public class class_name { @Override public void setClassPathEntries(List<IRuntimeClasspathEntry> libraries) { if (isDirty()) { setDirty(false); resolveDirtyFields(true); } if ((libraries == null && this.classPathEntries != null) || (libraries != null && (this.classPathEntries == null || libraries != this.classPathEntries))) { final PropertyChangeEvent event = new PropertyChangeEvent( this, ISREInstallChangedListener.PROPERTY_LIBRARY_LOCATIONS, this.classPathEntries, libraries); this.classPathEntries = libraries; if (this.notify) { SARLRuntime.fireSREChanged(event); } } } }
public class class_name { @Override public void setClassPathEntries(List<IRuntimeClasspathEntry> libraries) { if (isDirty()) { setDirty(false); // depends on control dependency: [if], data = [none] resolveDirtyFields(true); // depends on control dependency: [if], data = [none] } if ((libraries == null && this.classPathEntries != null) || (libraries != null && (this.classPathEntries == null || libraries != this.classPathEntries))) { final PropertyChangeEvent event = new PropertyChangeEvent( this, ISREInstallChangedListener.PROPERTY_LIBRARY_LOCATIONS, this.classPathEntries, libraries); this.classPathEntries = libraries; // depends on control dependency: [if], data = [none] if (this.notify) { SARLRuntime.fireSREChanged(event); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static BigInteger power(BigInteger self, BigInteger exponent) { if ((exponent.signum() >= 0) && (exponent.compareTo(BI_INT_MAX) <= 0)) { return self.pow(exponent.intValue()); } else { return BigDecimal.valueOf(Math.pow(self.doubleValue(), exponent.doubleValue())).toBigInteger(); } } }
public class class_name { public static BigInteger power(BigInteger self, BigInteger exponent) { if ((exponent.signum() >= 0) && (exponent.compareTo(BI_INT_MAX) <= 0)) { return self.pow(exponent.intValue()); // depends on control dependency: [if], data = [none] } else { return BigDecimal.valueOf(Math.pow(self.doubleValue(), exponent.doubleValue())).toBigInteger(); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public void addToList() { meldungStart(); if (Config.getStop()) { meldungThreadUndFertig(); } else { if (CrawlerTool.loadLongMax()) { addCategories(); meldungAddMax(listeThemen.size()); for (int t = 0; t < getMaxThreadLaufen(); ++t) { Thread th = new CategoryLoader(); th.setName(getSendername() + t); th.start(); } } else { addTage(); meldungAddMax(listeThemen.size()); for (int t = 0; t < getMaxThreadLaufen(); ++t) { Thread th = new ThemaLaden(); th.setName(getSendername() + t); th.start(); } } } } }
public class class_name { @Override public void addToList() { meldungStart(); if (Config.getStop()) { meldungThreadUndFertig(); // depends on control dependency: [if], data = [none] } else { if (CrawlerTool.loadLongMax()) { addCategories(); // depends on control dependency: [if], data = [none] meldungAddMax(listeThemen.size()); // depends on control dependency: [if], data = [none] for (int t = 0; t < getMaxThreadLaufen(); ++t) { Thread th = new CategoryLoader(); th.setName(getSendername() + t); // depends on control dependency: [for], data = [t] th.start(); // depends on control dependency: [for], data = [none] } } else { addTage(); // depends on control dependency: [if], data = [none] meldungAddMax(listeThemen.size()); // depends on control dependency: [if], data = [none] for (int t = 0; t < getMaxThreadLaufen(); ++t) { Thread th = new ThemaLaden(); th.setName(getSendername() + t); // depends on control dependency: [for], data = [t] th.start(); // depends on control dependency: [for], data = [none] } } } } }
public class class_name { public String getString() { StringBuffer buf = new StringBuffer(); for (int i = 0; i != string.length; i++) { buf.append(table[(string[i] >>> 4) % 0xf]); buf.append(table[string[i] & 0xf]); } return buf.toString(); } }
public class class_name { public String getString() { StringBuffer buf = new StringBuffer(); for (int i = 0; i != string.length; i++) { buf.append(table[(string[i] >>> 4) % 0xf]); // depends on control dependency: [for], data = [i] buf.append(table[string[i] & 0xf]); // depends on control dependency: [for], data = [i] } return buf.toString(); } }
public class class_name { public static String getProxyHost(AppleServer server) { String host = server != null ? server.getProxyHost() : null; if (host != null && host.length() > 0) { return host; } else { host = System.getProperty(LOCAL_PROXY_HOST_PROPERTY); if (host != null && host.length() > 0) { return host; } else { host = System.getProperty(JVM_PROXY_HOST_PROPERTY); if (host != null && host.length() > 0) { return host; } else { return null; } } } } }
public class class_name { public static String getProxyHost(AppleServer server) { String host = server != null ? server.getProxyHost() : null; if (host != null && host.length() > 0) { return host; // depends on control dependency: [if], data = [none] } else { host = System.getProperty(LOCAL_PROXY_HOST_PROPERTY); // depends on control dependency: [if], data = [none] if (host != null && host.length() > 0) { return host; // depends on control dependency: [if], data = [none] } else { host = System.getProperty(JVM_PROXY_HOST_PROPERTY); // depends on control dependency: [if], data = [none] if (host != null && host.length() > 0) { return host; // depends on control dependency: [if], data = [none] } else { return null; // depends on control dependency: [if], data = [none] } } } } }
public class class_name { protected void transportHeadersReceived(Metadata headers) { Preconditions.checkNotNull(headers, "headers"); if (transportError != null) { // Already received a transport error so just augment it. Something is really, really strange. transportError = transportError.augmentDescription("headers: " + headers); return; } try { if (headersReceived) { transportError = Status.INTERNAL.withDescription("Received headers twice"); return; } Integer httpStatus = headers.get(HTTP2_STATUS); if (httpStatus != null && httpStatus >= 100 && httpStatus < 200) { // Ignore the headers. See RFC 7540 §8.1 return; } headersReceived = true; transportError = validateInitialMetadata(headers); if (transportError != null) { return; } stripTransportDetails(headers); inboundHeadersReceived(headers); } finally { if (transportError != null) { // Note we don't immediately report the transport error, instead we wait for more data on // the stream so we can accumulate more detail into the error before reporting it. transportError = transportError.augmentDescription("headers: " + headers); transportErrorMetadata = headers; errorCharset = extractCharset(headers); } } } }
public class class_name { protected void transportHeadersReceived(Metadata headers) { Preconditions.checkNotNull(headers, "headers"); if (transportError != null) { // Already received a transport error so just augment it. Something is really, really strange. transportError = transportError.augmentDescription("headers: " + headers); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } try { if (headersReceived) { transportError = Status.INTERNAL.withDescription("Received headers twice"); return; } Integer httpStatus = headers.get(HTTP2_STATUS); if (httpStatus != null && httpStatus >= 100 && httpStatus < 200) { // Ignore the headers. See RFC 7540 §8.1 return; } headersReceived = true; transportError = validateInitialMetadata(headers); if (transportError != null) { return; } stripTransportDetails(headers); inboundHeadersReceived(headers); } finally { if (transportError != null) { // Note we don't immediately report the transport error, instead we wait for more data on // the stream so we can accumulate more detail into the error before reporting it. transportError = transportError.augmentDescription("headers: " + headers); transportErrorMetadata = headers; errorCharset = extractCharset(headers); } } } }
public class class_name { private static String createPostgresTimeZone() { String tz = TimeZone.getDefault().getID(); if (tz.length() <= 3 || !tz.startsWith("GMT")) { return tz; } char sign = tz.charAt(3); String start; switch (sign) { case '+': start = "GMT-"; break; case '-': start = "GMT+"; break; default: // unknown type return tz; } return start + tz.substring(4); } }
public class class_name { private static String createPostgresTimeZone() { String tz = TimeZone.getDefault().getID(); if (tz.length() <= 3 || !tz.startsWith("GMT")) { return tz; // depends on control dependency: [if], data = [none] } char sign = tz.charAt(3); String start; switch (sign) { case '+': start = "GMT-"; break; case '-': start = "GMT+"; break; default: // unknown type return tz; } return start + tz.substring(4); } }
public class class_name { public void setIncludeFilter(File filterFile) { if (filterFile != null && filterFile.length() > 0) { includeFile = filterFile; } else { if (filterFile != null) { log("Warning: include filter file " + filterFile + (filterFile.exists() ? " is empty" : " does not exist")); } includeFile = null; } } }
public class class_name { public void setIncludeFilter(File filterFile) { if (filterFile != null && filterFile.length() > 0) { includeFile = filterFile; // depends on control dependency: [if], data = [none] } else { if (filterFile != null) { log("Warning: include filter file " + filterFile + (filterFile.exists() ? " is empty" : " does not exist")); // depends on control dependency: [if], data = [none] } includeFile = null; // depends on control dependency: [if], data = [none] } } }
public class class_name { public void stratify(int numFolds) { if (classAttribute().isNominal()) { // sort by class int index = 1; while (index < numInstances()) { Instance instance1 = instance(index - 1); for (int j = index; j < numInstances(); j++) { Instance instance2 = instance(j); if ((instance1.classValue() == instance2.classValue()) || (instance1.classIsMissing() && instance2.classIsMissing())) { swap(index, j); index++; } } index++; } stratStep(numFolds); } } }
public class class_name { public void stratify(int numFolds) { if (classAttribute().isNominal()) { // sort by class int index = 1; while (index < numInstances()) { Instance instance1 = instance(index - 1); for (int j = index; j < numInstances(); j++) { Instance instance2 = instance(j); if ((instance1.classValue() == instance2.classValue()) || (instance1.classIsMissing() && instance2.classIsMissing())) { swap(index, j); // depends on control dependency: [if], data = [none] index++; // depends on control dependency: [if], data = [none] } } index++; // depends on control dependency: [while], data = [none] } stratStep(numFolds); // depends on control dependency: [if], data = [none] } } }
public class class_name { public boolean replaceIn(final StringBuffer source, final int offset, final int length) { if (source == null) { return false; } final StrBuilder buf = new StrBuilder(length).append(source, offset, length); if (substitute(buf, 0, length) == false) { return false; } source.replace(offset, offset + length, buf.toString()); return true; } }
public class class_name { public boolean replaceIn(final StringBuffer source, final int offset, final int length) { if (source == null) { return false; // depends on control dependency: [if], data = [none] } final StrBuilder buf = new StrBuilder(length).append(source, offset, length); if (substitute(buf, 0, length) == false) { return false; // depends on control dependency: [if], data = [none] } source.replace(offset, offset + length, buf.toString()); return true; } }
public class class_name { public Map<Object, Object> getPropertyBag() { if (this.properties == null) { this.properties = new HashMap<Object, Object>(); } return this.properties; } }
public class class_name { public Map<Object, Object> getPropertyBag() { if (this.properties == null) { this.properties = new HashMap<Object, Object>(); // depends on control dependency: [if], data = [none] } return this.properties; } }
public class class_name { public Observable<ServiceResponse<Page<IotHubSkuDescriptionInner>>> getValidSkusNextWithServiceResponseAsync(final String nextPageLink) { return getValidSkusNextSinglePageAsync(nextPageLink) .concatMap(new Func1<ServiceResponse<Page<IotHubSkuDescriptionInner>>, Observable<ServiceResponse<Page<IotHubSkuDescriptionInner>>>>() { @Override public Observable<ServiceResponse<Page<IotHubSkuDescriptionInner>>> call(ServiceResponse<Page<IotHubSkuDescriptionInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(getValidSkusNextWithServiceResponseAsync(nextPageLink)); } }); } }
public class class_name { public Observable<ServiceResponse<Page<IotHubSkuDescriptionInner>>> getValidSkusNextWithServiceResponseAsync(final String nextPageLink) { return getValidSkusNextSinglePageAsync(nextPageLink) .concatMap(new Func1<ServiceResponse<Page<IotHubSkuDescriptionInner>>, Observable<ServiceResponse<Page<IotHubSkuDescriptionInner>>>>() { @Override public Observable<ServiceResponse<Page<IotHubSkuDescriptionInner>>> call(ServiceResponse<Page<IotHubSkuDescriptionInner>> 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(getValidSkusNextWithServiceResponseAsync(nextPageLink)); } }); } }
public class class_name { public static Type resolveType(Type targetType, Type rootType) { Type resolvedType; if (targetType instanceof ParameterizedType && rootType instanceof ParameterizedType) { ParameterizedType parameterizedType = (ParameterizedType) targetType; resolvedType = resolveType((Class<?>) parameterizedType.getRawType(), parameterizedType.getActualTypeArguments(), getTypeClass(rootType)); } else { resolvedType = resolveType(getTypeClass(rootType), null, getTypeClass(targetType)); } return resolvedType; } }
public class class_name { public static Type resolveType(Type targetType, Type rootType) { Type resolvedType; if (targetType instanceof ParameterizedType && rootType instanceof ParameterizedType) { ParameterizedType parameterizedType = (ParameterizedType) targetType; resolvedType = resolveType((Class<?>) parameterizedType.getRawType(), parameterizedType.getActualTypeArguments(), getTypeClass(rootType)); // depends on control dependency: [if], data = [none] } else { resolvedType = resolveType(getTypeClass(rootType), null, getTypeClass(targetType)); // depends on control dependency: [if], data = [none] } return resolvedType; } }
public class class_name { public void reset() { if (isEditable()) { String val = ""; CmsUUID sid = m_imageInfoProvider.get().getStructureId(); List<CmsPropertyModification> propChanges = new ArrayList<>(); propChanges.add(new CmsPropertyModification(sid, CmsGwtConstants.PROPERTY_IMAGE_FOCALPOINT, val, false)); propChanges.add(new CmsPropertyModification(sid, CmsGwtConstants.PROPERTY_IMAGE_FOCALPOINT, val, true)); final CmsPropertyChangeSet changeSet = new CmsPropertyChangeSet(sid, propChanges); CmsRpcAction<Void> action = new CmsRpcAction<Void>() { @Override public void execute() { CmsCoreProvider.getVfsService().saveProperties(changeSet, this); } @SuppressWarnings("synthetic-access") @Override protected void onResponse(Void result) { m_focalPoint = null; m_savedFocalPoint = null; m_imageInfoProvider.get().setFocalPoint(null); updatePoint(); if (m_nextAction != null) { m_nextAction.run(); } } }; action.execute(); } } }
public class class_name { public void reset() { if (isEditable()) { String val = ""; CmsUUID sid = m_imageInfoProvider.get().getStructureId(); List<CmsPropertyModification> propChanges = new ArrayList<>(); propChanges.add(new CmsPropertyModification(sid, CmsGwtConstants.PROPERTY_IMAGE_FOCALPOINT, val, false)); // depends on control dependency: [if], data = [none] propChanges.add(new CmsPropertyModification(sid, CmsGwtConstants.PROPERTY_IMAGE_FOCALPOINT, val, true)); // depends on control dependency: [if], data = [none] final CmsPropertyChangeSet changeSet = new CmsPropertyChangeSet(sid, propChanges); CmsRpcAction<Void> action = new CmsRpcAction<Void>() { @Override public void execute() { CmsCoreProvider.getVfsService().saveProperties(changeSet, this); } @SuppressWarnings("synthetic-access") @Override protected void onResponse(Void result) { m_focalPoint = null; m_savedFocalPoint = null; m_imageInfoProvider.get().setFocalPoint(null); updatePoint(); if (m_nextAction != null) { m_nextAction.run(); // depends on control dependency: [if], data = [none] } } }; action.execute(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public Node getNodeFromEntity(Object entity, Object key, GraphDatabaseService graphDb, EntityMetadata m, boolean isUpdate) { // Construct top level node first, making sure unique ID in the index Node node = null; if (!isUpdate) { node = getOrCreateNodeWithUniqueFactory(entity, key, m, graphDb); } else { node = searchNode(key, m, graphDb, true); } if (node != null) { populateNodeProperties(entity, m, node); } return node; } }
public class class_name { public Node getNodeFromEntity(Object entity, Object key, GraphDatabaseService graphDb, EntityMetadata m, boolean isUpdate) { // Construct top level node first, making sure unique ID in the index Node node = null; if (!isUpdate) { node = getOrCreateNodeWithUniqueFactory(entity, key, m, graphDb); // depends on control dependency: [if], data = [none] } else { node = searchNode(key, m, graphDb, true); // depends on control dependency: [if], data = [none] } if (node != null) { populateNodeProperties(entity, m, node); // depends on control dependency: [if], data = [none] } return node; } }
public class class_name { public void close(int closemode) { HsqlException he = null; setState(DATABASE_CLOSING); sessionManager.closeAllSessions(); sessionManager.clearAll(); if (filesReadOnly) { closemode = CLOSEMODE_IMMEDIATELY; } /** * @todo fredt - impact of possible error conditions in closing the log * should be investigated for the CLOSEMODE_COMPACT mode */ logger.closeLog(closemode); try { if (closemode == CLOSEMODE_COMPACT) { clearStructures(); reopen(); setState(DATABASE_CLOSING); logger.closeLog(CLOSEMODE_NORMAL); } } catch (Throwable t) { if (t instanceof HsqlException) { he = (HsqlException) t; } else { he = Error.error(ErrorCode.GENERAL_ERROR, t.toString()); } } logger.releaseLock(); setState(DATABASE_SHUTDOWN); clearStructures(); // fredt - this could change to avoid removing a db from the // DatabaseManager repository if there are pending getDatabase() // calls DatabaseManager.removeDatabase(this); if (he != null) { throw he; } } }
public class class_name { public void close(int closemode) { HsqlException he = null; setState(DATABASE_CLOSING); sessionManager.closeAllSessions(); sessionManager.clearAll(); if (filesReadOnly) { closemode = CLOSEMODE_IMMEDIATELY; // depends on control dependency: [if], data = [none] } /** * @todo fredt - impact of possible error conditions in closing the log * should be investigated for the CLOSEMODE_COMPACT mode */ logger.closeLog(closemode); try { if (closemode == CLOSEMODE_COMPACT) { clearStructures(); // depends on control dependency: [if], data = [none] reopen(); // depends on control dependency: [if], data = [none] setState(DATABASE_CLOSING); // depends on control dependency: [if], data = [none] logger.closeLog(CLOSEMODE_NORMAL); // depends on control dependency: [if], data = [none] } } catch (Throwable t) { if (t instanceof HsqlException) { he = (HsqlException) t; // depends on control dependency: [if], data = [none] } else { he = Error.error(ErrorCode.GENERAL_ERROR, t.toString()); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] logger.releaseLock(); setState(DATABASE_SHUTDOWN); clearStructures(); // fredt - this could change to avoid removing a db from the // DatabaseManager repository if there are pending getDatabase() // calls DatabaseManager.removeDatabase(this); if (he != null) { throw he; } } }
public class class_name { private static byte convertHexDigit( final byte b ) { if ( ( b >= '0' ) && ( b <= '9' ) ) { return (byte) ( b - '0' ); } if ( ( b >= 'a' ) && ( b <= 'f' ) ) { return (byte) ( b - 'a' + 10 ); } if ( ( b >= 'A' ) && ( b <= 'F' ) ) { return (byte) ( b - 'A' + 10 ); } return 0; } }
public class class_name { private static byte convertHexDigit( final byte b ) { if ( ( b >= '0' ) && ( b <= '9' ) ) { return (byte) ( b - '0' ); // depends on control dependency: [if], data = [none] } if ( ( b >= 'a' ) && ( b <= 'f' ) ) { return (byte) ( b - 'a' + 10 ); // depends on control dependency: [if], data = [none] } if ( ( b >= 'A' ) && ( b <= 'F' ) ) { return (byte) ( b - 'A' + 10 ); // depends on control dependency: [if], data = [none] } return 0; } }
public class class_name { protected final void doStop() { log.info("Stopping {} in {}", new Object[]{this, getLocationOrNull()}); if (getAttribute(SERVICE_STATE_ACTUAL) .equals(Lifecycle.STOPPED)) { log.warn("The entity {} is already stopped", new Object[]{this}); return; } ServiceStateLogic.setExpectedState(this, Lifecycle.STOPPING); try { preStop(); driver.stop(); postDriverStop(); postStop(); ServiceStateLogic.setExpectedState(this, Lifecycle.STOPPED); log.info("The entity stop operation {} is completed without errors", new Object[]{this}); } catch (Throwable t) { ServiceStateLogic.setExpectedState(this, Lifecycle.ON_FIRE); throw Exceptions.propagate(t); } } }
public class class_name { protected final void doStop() { log.info("Stopping {} in {}", new Object[]{this, getLocationOrNull()}); if (getAttribute(SERVICE_STATE_ACTUAL) .equals(Lifecycle.STOPPED)) { log.warn("The entity {} is already stopped", new Object[]{this}); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } ServiceStateLogic.setExpectedState(this, Lifecycle.STOPPING); try { preStop(); // depends on control dependency: [try], data = [none] driver.stop(); // depends on control dependency: [try], data = [none] postDriverStop(); // depends on control dependency: [try], data = [none] postStop(); // depends on control dependency: [try], data = [none] ServiceStateLogic.setExpectedState(this, Lifecycle.STOPPED); // depends on control dependency: [try], data = [none] log.info("The entity stop operation {} is completed without errors", new Object[]{this}); // depends on control dependency: [try], data = [none] } catch (Throwable t) { ServiceStateLogic.setExpectedState(this, Lifecycle.ON_FIRE); throw Exceptions.propagate(t); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public HistoricDate getBeginOfYear( HistoricEra era, int yearOfEra ) { HistoricDate newYear = this.getNewYearStrategy().newYear(era, yearOfEra); if (this.isValid(newYear)) { PlainDate date = this.convert(newYear); HistoricEra preferredEra = this.eraPreference.getPreferredEra(newYear, date); if (preferredEra != era) { int yoe = preferredEra.yearOfEra(newYear.getEra(), newYear.getYearOfEra()); newYear = HistoricDate.of(preferredEra, yoe, newYear.getMonth(), newYear.getDayOfMonth()); } return newYear; } else { throw new IllegalArgumentException("Cannot determine valid New Year: " + era + "-" + yearOfEra); } } }
public class class_name { public HistoricDate getBeginOfYear( HistoricEra era, int yearOfEra ) { HistoricDate newYear = this.getNewYearStrategy().newYear(era, yearOfEra); if (this.isValid(newYear)) { PlainDate date = this.convert(newYear); HistoricEra preferredEra = this.eraPreference.getPreferredEra(newYear, date); if (preferredEra != era) { int yoe = preferredEra.yearOfEra(newYear.getEra(), newYear.getYearOfEra()); newYear = HistoricDate.of(preferredEra, yoe, newYear.getMonth(), newYear.getDayOfMonth()); // depends on control dependency: [if], data = [(preferredEra] } return newYear; // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException("Cannot determine valid New Year: " + era + "-" + yearOfEra); } } }
public class class_name { private String expandEntities(String src) { int refStart = -1; int len = src.length(); char[] dst = new char[len]; int dstlen = 0; for (int i = 0; i < len; i++) { char ch = src.charAt(i); dst[dstlen++] = ch; if (ch == '&' && refStart == -1) { // start of a ref excluding & refStart = dstlen; } else if (refStart == -1) { // not in a ref } else if (Character.isLetter(ch) || Character.isDigit(ch) || ch == '#') { // valid entity char } else if (ch == ';') { // properly terminated ref int ent = lookupEntity(dst, refStart, dstlen - refStart - 1); if (ent > 0xFFFF) { ent -= 0x10000; dst[refStart - 1] = (char) ((ent >> 10) + 0xD800); dst[refStart] = (char) ((ent & 0x3FF) + 0xDC00); dstlen = refStart + 1; } else if (ent != 0) { dst[refStart - 1] = (char) ent; dstlen = refStart; } refStart = -1; } else { // improperly terminated ref refStart = -1; } } return new String(dst, 0, dstlen); } }
public class class_name { private String expandEntities(String src) { int refStart = -1; int len = src.length(); char[] dst = new char[len]; int dstlen = 0; for (int i = 0; i < len; i++) { char ch = src.charAt(i); dst[dstlen++] = ch; // depends on control dependency: [for], data = [none] if (ch == '&' && refStart == -1) { // start of a ref excluding & refStart = dstlen; // depends on control dependency: [if], data = [none] } else if (refStart == -1) { // not in a ref } else if (Character.isLetter(ch) || Character.isDigit(ch) || ch == '#') { // valid entity char } else if (ch == ';') { // properly terminated ref int ent = lookupEntity(dst, refStart, dstlen - refStart - 1); if (ent > 0xFFFF) { ent -= 0x10000; // depends on control dependency: [if], data = [none] dst[refStart - 1] = (char) ((ent >> 10) + 0xD800); // depends on control dependency: [if], data = [(ent] dst[refStart] = (char) ((ent & 0x3FF) + 0xDC00); // depends on control dependency: [if], data = [(ent] dstlen = refStart + 1; // depends on control dependency: [if], data = [none] } else if (ent != 0) { dst[refStart - 1] = (char) ent; // depends on control dependency: [if], data = [none] dstlen = refStart; // depends on control dependency: [if], data = [none] } refStart = -1; // depends on control dependency: [if], data = [none] } else { // improperly terminated ref refStart = -1; // depends on control dependency: [if], data = [none] } } return new String(dst, 0, dstlen); } }
public class class_name { public static Geometry split(Geometry geomA, Geometry geomB, double tolerance) throws SQLException { if (geomA instanceof Polygon) { throw new SQLException("Split a Polygon by a line is not supported using a tolerance. \n" + "Please used ST_Split(geom1, geom2)"); } else if (geomA instanceof LineString) { if (geomB instanceof LineString) { throw new SQLException("Split a line by a line is not supported using a tolerance. \n" + "Please used ST_Split(geom1, geom2)"); } else if (geomB instanceof Point) { return splitLineWithPoint((LineString) geomA, (Point) geomB, tolerance); } } else if (geomA instanceof MultiLineString) { if (geomB instanceof LineString) { throw new SQLException("Split a multiline by a line is not supported using a tolerance. \n" + "Please used ST_Split(geom1, geom2)"); } else if (geomB instanceof Point) { return splitMultiLineStringWithPoint((MultiLineString) geomA, (Point) geomB, tolerance); } } throw new SQLException("Split a " + geomA.getGeometryType() + " by a " + geomB.getGeometryType() + " is not supported."); } }
public class class_name { public static Geometry split(Geometry geomA, Geometry geomB, double tolerance) throws SQLException { if (geomA instanceof Polygon) { throw new SQLException("Split a Polygon by a line is not supported using a tolerance. \n" + "Please used ST_Split(geom1, geom2)"); } else if (geomA instanceof LineString) { if (geomB instanceof LineString) { throw new SQLException("Split a line by a line is not supported using a tolerance. \n" + "Please used ST_Split(geom1, geom2)"); } else if (geomB instanceof Point) { return splitLineWithPoint((LineString) geomA, (Point) geomB, tolerance); // depends on control dependency: [if], data = [none] } } else if (geomA instanceof MultiLineString) { if (geomB instanceof LineString) { throw new SQLException("Split a multiline by a line is not supported using a tolerance. \n" + "Please used ST_Split(geom1, geom2)"); } else if (geomB instanceof Point) { return splitMultiLineStringWithPoint((MultiLineString) geomA, (Point) geomB, tolerance); // depends on control dependency: [if], data = [none] } } throw new SQLException("Split a " + geomA.getGeometryType() + " by a " + geomB.getGeometryType() + " is not supported."); } }
public class class_name { private static boolean serialClassInclude(ClassDoc cd) { if (cd.isEnum()) { return false; } try { cd.superclassType(); } catch (NullPointerException e) { //Workaround for null pointer bug in ClassDoc.superclassType(). return false; } if (cd.isSerializable()) { if (cd.tags("serial").length > 0) { return serialDocInclude(cd); } else if (cd.isPublic() || cd.isProtected()) { return true; } else { return false; } } return false; } }
public class class_name { private static boolean serialClassInclude(ClassDoc cd) { if (cd.isEnum()) { return false; // depends on control dependency: [if], data = [none] } try { cd.superclassType(); // depends on control dependency: [try], data = [none] } catch (NullPointerException e) { //Workaround for null pointer bug in ClassDoc.superclassType(). return false; } // depends on control dependency: [catch], data = [none] if (cd.isSerializable()) { if (cd.tags("serial").length > 0) { return serialDocInclude(cd); // depends on control dependency: [if], data = [none] } else if (cd.isPublic() || cd.isProtected()) { return true; // depends on control dependency: [if], data = [none] } else { return false; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { public String getEffectiveBuilderScope() { String scope = beanBuilderScope; if ("smart".equals(scope)) { scope = typeScope; } return "package".equals(scope) ? "" : scope + " "; } }
public class class_name { public String getEffectiveBuilderScope() { String scope = beanBuilderScope; if ("smart".equals(scope)) { scope = typeScope; // depends on control dependency: [if], data = [none] } return "package".equals(scope) ? "" : scope + " "; } }
public class class_name { public void updateInsideEntry(int spanStart, int spanEnd, int splitInd, double[] values, Factor binaryRuleProbabilities) { Preconditions.checkArgument(binaryRuleProbabilities.getVars().size() == 4); if (sumProduct) { updateEntrySumProduct(insideChart[spanStart][spanEnd], values, binaryRuleProbabilities.coerceToDiscrete().getWeights(), parentVar.getOnlyVariableNum()); } else { Tensor weights = binaryRuleProbabilities.coerceToDiscrete().getWeights(); updateInsideEntryMaxProduct(spanStart, spanEnd, values, weights, splitInd); } } }
public class class_name { public void updateInsideEntry(int spanStart, int spanEnd, int splitInd, double[] values, Factor binaryRuleProbabilities) { Preconditions.checkArgument(binaryRuleProbabilities.getVars().size() == 4); if (sumProduct) { updateEntrySumProduct(insideChart[spanStart][spanEnd], values, binaryRuleProbabilities.coerceToDiscrete().getWeights(), parentVar.getOnlyVariableNum()); // depends on control dependency: [if], data = [none] } else { Tensor weights = binaryRuleProbabilities.coerceToDiscrete().getWeights(); updateInsideEntryMaxProduct(spanStart, spanEnd, values, weights, splitInd); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void setLicenseSpecifications(java.util.Collection<LicenseSpecification> licenseSpecifications) { if (licenseSpecifications == null) { this.licenseSpecifications = null; return; } this.licenseSpecifications = new java.util.ArrayList<LicenseSpecification>(licenseSpecifications); } }
public class class_name { public void setLicenseSpecifications(java.util.Collection<LicenseSpecification> licenseSpecifications) { if (licenseSpecifications == null) { this.licenseSpecifications = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.licenseSpecifications = new java.util.ArrayList<LicenseSpecification>(licenseSpecifications); } }
public class class_name { public void removeGroup(@Nullable L group) { if (group == null) { return; } List<L> cards = getGroups(); boolean changed = cards.remove(group); if (changed) { setData(cards); } } }
public class class_name { public void removeGroup(@Nullable L group) { if (group == null) { return; // depends on control dependency: [if], data = [none] } List<L> cards = getGroups(); boolean changed = cards.remove(group); if (changed) { setData(cards); // depends on control dependency: [if], data = [none] } } }
public class class_name { public List<Project> getAllProjects() { try { sessionService.startSession(); List<Project> projects = projectDao.getAll(); log.debug("Retrieved All Projects number: " + projects.size()); return projects; } finally { sessionService.closeSession(); } } }
public class class_name { public List<Project> getAllProjects() { try { sessionService.startSession(); // depends on control dependency: [try], data = [none] List<Project> projects = projectDao.getAll(); log.debug("Retrieved All Projects number: " + projects.size()); // depends on control dependency: [try], data = [none] return projects; // depends on control dependency: [try], data = [none] } finally { sessionService.closeSession(); } } }
public class class_name { protected void fillContext(final IoSession session, final Map<String, String> context) { if (mdcKeys.contains(MdcKey.handlerClass)) { context.put(MdcKey.handlerClass.name(), session.getHandler() .getClass().getName()); } if (mdcKeys.contains(MdcKey.remoteAddress)) { context.put(MdcKey.remoteAddress.name(), session.getRemoteAddress() .toString()); } if (mdcKeys.contains(MdcKey.localAddress)) { context.put(MdcKey.localAddress.name(), session.getLocalAddress() .toString()); } if (session.getTransportMetadata().getAddressType() == InetSocketAddress.class) { InetSocketAddress remoteAddress = (InetSocketAddress) session .getRemoteAddress(); InetSocketAddress localAddress = (InetSocketAddress) session .getLocalAddress(); if (mdcKeys.contains(MdcKey.remoteIp)) { context.put(MdcKey.remoteIp.name(), remoteAddress.getAddress() .getHostAddress()); } if (mdcKeys.contains(MdcKey.remotePort)) { context.put(MdcKey.remotePort.name(), String .valueOf(remoteAddress.getPort())); } if (mdcKeys.contains(MdcKey.localIp)) { context.put(MdcKey.localIp.name(), localAddress.getAddress() .getHostAddress()); } if (mdcKeys.contains(MdcKey.localPort)) { context.put(MdcKey.localPort.name(), String .valueOf(localAddress.getPort())); } } } }
public class class_name { protected void fillContext(final IoSession session, final Map<String, String> context) { if (mdcKeys.contains(MdcKey.handlerClass)) { context.put(MdcKey.handlerClass.name(), session.getHandler() .getClass().getName()); // depends on control dependency: [if], data = [none] } if (mdcKeys.contains(MdcKey.remoteAddress)) { context.put(MdcKey.remoteAddress.name(), session.getRemoteAddress() .toString()); // depends on control dependency: [if], data = [none] } if (mdcKeys.contains(MdcKey.localAddress)) { context.put(MdcKey.localAddress.name(), session.getLocalAddress() .toString()); // depends on control dependency: [if], data = [none] } if (session.getTransportMetadata().getAddressType() == InetSocketAddress.class) { InetSocketAddress remoteAddress = (InetSocketAddress) session .getRemoteAddress(); InetSocketAddress localAddress = (InetSocketAddress) session .getLocalAddress(); if (mdcKeys.contains(MdcKey.remoteIp)) { context.put(MdcKey.remoteIp.name(), remoteAddress.getAddress() .getHostAddress()); // depends on control dependency: [if], data = [none] } if (mdcKeys.contains(MdcKey.remotePort)) { context.put(MdcKey.remotePort.name(), String .valueOf(remoteAddress.getPort())); // depends on control dependency: [if], data = [none] } if (mdcKeys.contains(MdcKey.localIp)) { context.put(MdcKey.localIp.name(), localAddress.getAddress() .getHostAddress()); // depends on control dependency: [if], data = [none] } if (mdcKeys.contains(MdcKey.localPort)) { context.put(MdcKey.localPort.name(), String .valueOf(localAddress.getPort())); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void validateInjectionPointForDefinitionErrors(InjectionPoint ij, Bean<?> bean, BeanManagerImpl beanManager) { if (ij.getAnnotated().getAnnotation(New.class) != null && ij.getQualifiers().size() > 1) { throw ValidatorLogger.LOG.newWithQualifiers(ij, Formats.formatAsStackTraceElement(ij)); } if (ij.getType() instanceof TypeVariable<?>) { throw ValidatorLogger.LOG.injectionPointWithTypeVariable(ij, Formats.formatAsStackTraceElement(ij)); } // WELD-1739 if (ij.getMember() instanceof Executable && ij.getAnnotated().isAnnotationPresent(Named.class) && ij.getAnnotated().getAnnotation(Named.class).value().equals("")) { Executable executable = (Executable) ij.getMember(); AnnotatedParameter<?> annotatedParameter = (AnnotatedParameter<?>) ij.getAnnotated(); if (!executable.getParameters()[annotatedParameter.getPosition()].isNamePresent()) { // No parameters info available throw ValidatorLogger.LOG.nonFieldInjectionPointCannotUseNamed(ij, Formats.formatAsStackTraceElement(ij)); } } if (ij.getAnnotated().isAnnotationPresent(Produces.class)) { if (bean != null) { throw BeanLogger.LOG.injectedFieldCannotBeProducer(ij.getAnnotated(), bean); } else { throw BeanLogger.LOG.injectedFieldCannotBeProducer(ij.getAnnotated(), Reflections.<AnnotatedField<?>>cast(ij.getAnnotated()).getDeclaringType()); } } boolean newBean = (bean instanceof NewBean); if (!newBean) { checkScopeAnnotations(ij, beanManager.getServices().get(MetaAnnotationStore.class)); } checkFacadeInjectionPoint(ij, Instance.class); checkFacadeInjectionPoint(ij, Event.class); if (InterceptionFactory.class.equals(Reflections.getRawType(ij.getType())) && !(bean instanceof ProducerMethod<?, ?>)) { throw ValidatorLogger.LOG.invalidInterceptionFactoryInjectionPoint(ij, Formats.formatAsStackTraceElement(ij)); } for (PlugableValidator validator : plugableValidators) { validator.validateInjectionPointForDefinitionErrors(ij, bean, beanManager); } } }
public class class_name { public void validateInjectionPointForDefinitionErrors(InjectionPoint ij, Bean<?> bean, BeanManagerImpl beanManager) { if (ij.getAnnotated().getAnnotation(New.class) != null && ij.getQualifiers().size() > 1) { throw ValidatorLogger.LOG.newWithQualifiers(ij, Formats.formatAsStackTraceElement(ij)); } if (ij.getType() instanceof TypeVariable<?>) { throw ValidatorLogger.LOG.injectionPointWithTypeVariable(ij, Formats.formatAsStackTraceElement(ij)); } // WELD-1739 if (ij.getMember() instanceof Executable && ij.getAnnotated().isAnnotationPresent(Named.class) && ij.getAnnotated().getAnnotation(Named.class).value().equals("")) { Executable executable = (Executable) ij.getMember(); AnnotatedParameter<?> annotatedParameter = (AnnotatedParameter<?>) ij.getAnnotated(); if (!executable.getParameters()[annotatedParameter.getPosition()].isNamePresent()) { // No parameters info available throw ValidatorLogger.LOG.nonFieldInjectionPointCannotUseNamed(ij, Formats.formatAsStackTraceElement(ij)); } } if (ij.getAnnotated().isAnnotationPresent(Produces.class)) { if (bean != null) { throw BeanLogger.LOG.injectedFieldCannotBeProducer(ij.getAnnotated(), bean); } else { throw BeanLogger.LOG.injectedFieldCannotBeProducer(ij.getAnnotated(), Reflections.<AnnotatedField<?>>cast(ij.getAnnotated()).getDeclaringType()); } } boolean newBean = (bean instanceof NewBean); if (!newBean) { checkScopeAnnotations(ij, beanManager.getServices().get(MetaAnnotationStore.class)); } checkFacadeInjectionPoint(ij, Instance.class); checkFacadeInjectionPoint(ij, Event.class); if (InterceptionFactory.class.equals(Reflections.getRawType(ij.getType())) && !(bean instanceof ProducerMethod<?, ?>)) { throw ValidatorLogger.LOG.invalidInterceptionFactoryInjectionPoint(ij, Formats.formatAsStackTraceElement(ij)); } for (PlugableValidator validator : plugableValidators) { validator.validateInjectionPointForDefinitionErrors(ij, bean, beanManager); // depends on control dependency: [for], data = [validator] } } }
public class class_name { private void rebuild(long newNumBucketSegments) throws IOException { // Get new bucket segments releaseBucketSegments(); allocateBucketSegments((int)newNumBucketSegments); T record = buildSideSerializer.createInstance(); try { EntryIterator iter = getEntryIterator(); recordArea.resetAppendPosition(); recordArea.setWritePosition(0); while ((record = iter.next(record)) != null && !closed) { final int hashCode = MathUtils.jenkinsHash(buildSideComparator.hash(record)); final int bucket = hashCode & numBucketsMask; final int bucketSegmentIndex = bucket >>> numBucketsPerSegmentBits; // which segment contains the bucket final MemorySegment bucketSegment = bucketSegments[bucketSegmentIndex]; final int bucketOffset = (bucket & numBucketsPerSegmentMask) << bucketSizeBits; // offset of the bucket in the segment final long firstPointer = bucketSegment.getLong(bucketOffset); long ptrToAppended = recordArea.noSeekAppendPointerAndRecord(firstPointer, record); bucketSegment.putLong(bucketOffset, ptrToAppended); } recordArea.freeSegmentsAfterAppendPosition(); holes = 0; } catch (EOFException ex) { throw new RuntimeException("Bug in InPlaceMutableHashTable: we shouldn't get out of memory during a rebuild, " + "because we aren't allocating any new memory."); } } }
public class class_name { private void rebuild(long newNumBucketSegments) throws IOException { // Get new bucket segments releaseBucketSegments(); allocateBucketSegments((int)newNumBucketSegments); T record = buildSideSerializer.createInstance(); try { EntryIterator iter = getEntryIterator(); recordArea.resetAppendPosition(); recordArea.setWritePosition(0); while ((record = iter.next(record)) != null && !closed) { final int hashCode = MathUtils.jenkinsHash(buildSideComparator.hash(record)); final int bucket = hashCode & numBucketsMask; final int bucketSegmentIndex = bucket >>> numBucketsPerSegmentBits; // which segment contains the bucket final MemorySegment bucketSegment = bucketSegments[bucketSegmentIndex]; final int bucketOffset = (bucket & numBucketsPerSegmentMask) << bucketSizeBits; // offset of the bucket in the segment final long firstPointer = bucketSegment.getLong(bucketOffset); long ptrToAppended = recordArea.noSeekAppendPointerAndRecord(firstPointer, record); bucketSegment.putLong(bucketOffset, ptrToAppended); // depends on control dependency: [while], data = [none] } recordArea.freeSegmentsAfterAppendPosition(); holes = 0; } catch (EOFException ex) { throw new RuntimeException("Bug in InPlaceMutableHashTable: we shouldn't get out of memory during a rebuild, " + "because we aren't allocating any new memory."); } } }
public class class_name { private static byte[] ensureCapacity(byte[] buf, int needed) { if (buf.length <= needed) { byte[] old = buf; buf = new byte[Integer.highestOneBit(needed) << 1]; System.arraycopy(old, 0, buf, 0, old.length); } return buf; } }
public class class_name { private static byte[] ensureCapacity(byte[] buf, int needed) { if (buf.length <= needed) { byte[] old = buf; buf = new byte[Integer.highestOneBit(needed) << 1]; // depends on control dependency: [if], data = [none] System.arraycopy(old, 0, buf, 0, old.length); // depends on control dependency: [if], data = [none] } return buf; } }
public class class_name { public static boolean compileJavaClass(String sourceCode) { try { String fileName = getClassName(sourceCode).concat(".java"); logger.info("Compiling Java Class ({})", fileName); File rootDir = JKIOUtil.createTempDirectory(); String packageDir = getPackageDir(sourceCode); File sourceFile ; if(packageDir!=null) { File file=new File(rootDir,packageDir); file.mkdirs(); sourceFile=new File(file, fileName); }else { sourceFile=new File(rootDir, fileName); } JKIOUtil.writeDataToFile(sourceCode, sourceFile); // Compile source file. JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); StandardJavaFileManager standardJavaFileManager = compiler.getStandardFileManager(null, null, null); standardJavaFileManager.setLocation(StandardLocation.CLASS_PATH, getClassPath()); standardJavaFileManager.setLocation(StandardLocation.SOURCE_PATH, Arrays.asList(rootDir)); List<String> options = new ArrayList<String>(); options.add("-Xlint:unchecked"); CompilationTask compilationTask = compiler.getTask(null, standardJavaFileManager, null, options, null, standardJavaFileManager.getJavaFileObjectsFromFiles(JK.toList(sourceFile))); return compilationTask.call(); } catch (IOException e) { JK.throww(e); return false; } // if (compiler.run(System.in, System.out, System.err, sourceFile.getPath()) != 0) { // JK.error("Compilation failed, check stack trace"); // } } }
public class class_name { public static boolean compileJavaClass(String sourceCode) { try { String fileName = getClassName(sourceCode).concat(".java"); logger.info("Compiling Java Class ({})", fileName); // depends on control dependency: [try], data = [none] File rootDir = JKIOUtil.createTempDirectory(); String packageDir = getPackageDir(sourceCode); File sourceFile ; if(packageDir!=null) { File file=new File(rootDir,packageDir); file.mkdirs(); // depends on control dependency: [if], data = [none] sourceFile=new File(file, fileName); // depends on control dependency: [if], data = [none] }else { sourceFile=new File(rootDir, fileName); // depends on control dependency: [if], data = [none] } JKIOUtil.writeDataToFile(sourceCode, sourceFile); // depends on control dependency: [try], data = [none] // Compile source file. JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); StandardJavaFileManager standardJavaFileManager = compiler.getStandardFileManager(null, null, null); standardJavaFileManager.setLocation(StandardLocation.CLASS_PATH, getClassPath()); // depends on control dependency: [try], data = [none] standardJavaFileManager.setLocation(StandardLocation.SOURCE_PATH, Arrays.asList(rootDir)); // depends on control dependency: [try], data = [none] List<String> options = new ArrayList<String>(); options.add("-Xlint:unchecked"); // depends on control dependency: [try], data = [none] CompilationTask compilationTask = compiler.getTask(null, standardJavaFileManager, null, options, null, standardJavaFileManager.getJavaFileObjectsFromFiles(JK.toList(sourceFile))); return compilationTask.call(); // depends on control dependency: [try], data = [none] } catch (IOException e) { JK.throww(e); return false; } // depends on control dependency: [catch], data = [none] // if (compiler.run(System.in, System.out, System.err, sourceFile.getPath()) != 0) { // JK.error("Compilation failed, check stack trace"); // } } }
public class class_name { public static void fillManagerWithSimons(int roughCount) { System.out.print("Filling manager with ~" + roughCount + " Simons..."); while (SimonManager.getSimonNames().size() < roughCount) { SimonManager.getStopwatch(generateRandomName(RANDOM.nextInt(10) + 1)); } System.out.println(" " + SimonManager.getSimonNames().size() + " created."); } }
public class class_name { public static void fillManagerWithSimons(int roughCount) { System.out.print("Filling manager with ~" + roughCount + " Simons..."); while (SimonManager.getSimonNames().size() < roughCount) { SimonManager.getStopwatch(generateRandomName(RANDOM.nextInt(10) + 1)); // depends on control dependency: [while], data = [none] } System.out.println(" " + SimonManager.getSimonNames().size() + " created."); } }
public class class_name { @Override public boolean isValidDimension(String dimensionName, String informationName) { if (StringUtils.isNotBlank(dimensionName)) { DimensionTable dim = dimensions.get(dimensionName.toUpperCase()); if (dim == null) { return false; } if (StringUtils.isBlank(informationName)) { return true; } if (dim.getSqlTableColumnByInformationName(informationName.toUpperCase()) != null) { return true; } } return false; } }
public class class_name { @Override public boolean isValidDimension(String dimensionName, String informationName) { if (StringUtils.isNotBlank(dimensionName)) { DimensionTable dim = dimensions.get(dimensionName.toUpperCase()); if (dim == null) { return false; // depends on control dependency: [if], data = [none] } if (StringUtils.isBlank(informationName)) { return true; // depends on control dependency: [if], data = [none] } if (dim.getSqlTableColumnByInformationName(informationName.toUpperCase()) != null) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { public void marshall(RelationalDatabaseBundle relationalDatabaseBundle, ProtocolMarshaller protocolMarshaller) { if (relationalDatabaseBundle == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(relationalDatabaseBundle.getBundleId(), BUNDLEID_BINDING); protocolMarshaller.marshall(relationalDatabaseBundle.getName(), NAME_BINDING); protocolMarshaller.marshall(relationalDatabaseBundle.getPrice(), PRICE_BINDING); protocolMarshaller.marshall(relationalDatabaseBundle.getRamSizeInGb(), RAMSIZEINGB_BINDING); protocolMarshaller.marshall(relationalDatabaseBundle.getDiskSizeInGb(), DISKSIZEINGB_BINDING); protocolMarshaller.marshall(relationalDatabaseBundle.getTransferPerMonthInGb(), TRANSFERPERMONTHINGB_BINDING); protocolMarshaller.marshall(relationalDatabaseBundle.getCpuCount(), CPUCOUNT_BINDING); protocolMarshaller.marshall(relationalDatabaseBundle.getIsEncrypted(), ISENCRYPTED_BINDING); protocolMarshaller.marshall(relationalDatabaseBundle.getIsActive(), ISACTIVE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(RelationalDatabaseBundle relationalDatabaseBundle, ProtocolMarshaller protocolMarshaller) { if (relationalDatabaseBundle == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(relationalDatabaseBundle.getBundleId(), BUNDLEID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(relationalDatabaseBundle.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(relationalDatabaseBundle.getPrice(), PRICE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(relationalDatabaseBundle.getRamSizeInGb(), RAMSIZEINGB_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(relationalDatabaseBundle.getDiskSizeInGb(), DISKSIZEINGB_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(relationalDatabaseBundle.getTransferPerMonthInGb(), TRANSFERPERMONTHINGB_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(relationalDatabaseBundle.getCpuCount(), CPUCOUNT_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(relationalDatabaseBundle.getIsEncrypted(), ISENCRYPTED_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(relationalDatabaseBundle.getIsActive(), ISACTIVE_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 { static HijriAdjustment from(String variant) { int index = variant.indexOf(':'); if (index == -1) { return new HijriAdjustment(variant, 0); } else { try { int adjustment = Integer.parseInt(variant.substring(index + 1)); return new HijriAdjustment(variant.substring(0, index), adjustment); } catch (NumberFormatException nfe) { throw new ChronoException("Invalid day adjustment: " + variant); } } } }
public class class_name { static HijriAdjustment from(String variant) { int index = variant.indexOf(':'); if (index == -1) { return new HijriAdjustment(variant, 0); // depends on control dependency: [if], data = [none] } else { try { int adjustment = Integer.parseInt(variant.substring(index + 1)); return new HijriAdjustment(variant.substring(0, index), adjustment); // depends on control dependency: [try], data = [none] } catch (NumberFormatException nfe) { throw new ChronoException("Invalid day adjustment: " + variant); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public MultipartFormDataParser createMultipartFormDataParser() { MultipartFormDataParser parser = new MemoryMultipartFormDataParser(); if (maxRequestSize > -1L) { parser.setMaxRequestSize(maxRequestSize); } if (maxFileSize > -1L) { parser.setMaxFileSize(maxFileSize); } parser.setAllowedFileExtensions(allowedFileExtensions); parser.setDeniedFileExtensions(deniedFileExtensions); return parser; } }
public class class_name { public MultipartFormDataParser createMultipartFormDataParser() { MultipartFormDataParser parser = new MemoryMultipartFormDataParser(); if (maxRequestSize > -1L) { parser.setMaxRequestSize(maxRequestSize); // depends on control dependency: [if], data = [(maxRequestSize] } if (maxFileSize > -1L) { parser.setMaxFileSize(maxFileSize); // depends on control dependency: [if], data = [(maxFileSize] } parser.setAllowedFileExtensions(allowedFileExtensions); parser.setDeniedFileExtensions(deniedFileExtensions); return parser; } }
public class class_name { private void initScopeRoots(Node n) { Deque<Node> queuedScopeRoots = new ArrayDeque<>(); while (n != null) { if (isScopeRoot(n)) { queuedScopeRoots.addFirst(n); } n = n.getParent(); } for (Node queuedScopeRoot : queuedScopeRoots) { pushScope(queuedScopeRoot); } } }
public class class_name { private void initScopeRoots(Node n) { Deque<Node> queuedScopeRoots = new ArrayDeque<>(); while (n != null) { if (isScopeRoot(n)) { queuedScopeRoots.addFirst(n); // depends on control dependency: [if], data = [none] } n = n.getParent(); // depends on control dependency: [while], data = [none] } for (Node queuedScopeRoot : queuedScopeRoots) { pushScope(queuedScopeRoot); // depends on control dependency: [for], data = [queuedScopeRoot] } } }
public class class_name { public AddResourcePermissionsRequest withPrincipals(SharePrincipal... principals) { if (this.principals == null) { setPrincipals(new java.util.ArrayList<SharePrincipal>(principals.length)); } for (SharePrincipal ele : principals) { this.principals.add(ele); } return this; } }
public class class_name { public AddResourcePermissionsRequest withPrincipals(SharePrincipal... principals) { if (this.principals == null) { setPrincipals(new java.util.ArrayList<SharePrincipal>(principals.length)); // depends on control dependency: [if], data = [none] } for (SharePrincipal ele : principals) { this.principals.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public static String toHex(byte[] byteArray) { String result = null; if (byteArray != null) { result = Hex.encodeHexString(byteArray); } return result; } }
public class class_name { public static String toHex(byte[] byteArray) { String result = null; if (byteArray != null) { result = Hex.encodeHexString(byteArray); // depends on control dependency: [if], data = [(byteArray] } return result; } }
public class class_name { boolean isSimpleBound() { if (opType == OpTypes.IS_NULL) { return true; } if (nodes[RIGHT] != null) { if (nodes[RIGHT].opType == OpTypes.VALUE) { // also true for all parameters return true; } if (nodes[RIGHT].opType == OpTypes.SQL_FUNCTION) { if (((FunctionSQL) nodes[RIGHT]).isValueFunction()) { return true; } } } return false; } }
public class class_name { boolean isSimpleBound() { if (opType == OpTypes.IS_NULL) { return true; // depends on control dependency: [if], data = [none] } if (nodes[RIGHT] != null) { if (nodes[RIGHT].opType == OpTypes.VALUE) { // also true for all parameters return true; // depends on control dependency: [if], data = [none] } if (nodes[RIGHT].opType == OpTypes.SQL_FUNCTION) { if (((FunctionSQL) nodes[RIGHT]).isValueFunction()) { return true; // depends on control dependency: [if], data = [none] } } } return false; } }
public class class_name { public static synchronized void configure(final ApiConfiguration config) { ApiConfiguration.Builder builder = ApiConfiguration.newBuilder(); builder.apiUrl(config.getApiUrl()); builder.apiKey(config.getApiKey()); builder.application(config.getApplication()); builder.environment(config.getEnvironment()); if (config.getEnvDetail() == null) { builder.envDetail(EnvironmentDetails.getEnvironmentDetail(config.getApplication(), config.getEnvironment())); } else { builder.envDetail(config.getEnvDetail()); } CONFIG = builder.build(); } }
public class class_name { public static synchronized void configure(final ApiConfiguration config) { ApiConfiguration.Builder builder = ApiConfiguration.newBuilder(); builder.apiUrl(config.getApiUrl()); builder.apiKey(config.getApiKey()); builder.application(config.getApplication()); builder.environment(config.getEnvironment()); if (config.getEnvDetail() == null) { builder.envDetail(EnvironmentDetails.getEnvironmentDetail(config.getApplication(), config.getEnvironment())); // depends on control dependency: [if], data = [none] } else { builder.envDetail(config.getEnvDetail()); // depends on control dependency: [if], data = [(config.getEnvDetail()] } CONFIG = builder.build(); } }
public class class_name { public void configurationUpdated(Object emailConfig) { EmailConfiguration config = (EmailConfiguration) emailConfig; if(config != null && (this.config == null || !config.equals(this.config))) { log.info("Updating configuration for email."); this.config = config; //Set the captcha validator up. if(!StringUtils.isEmptyOrNull(config.getCaptchaPrivateKey())) { log.info("Setting up captcha validation: "+config.getCaptchaPrivateKey()); captchaValidator = new CaptchaValidator(config.getCaptchaPrivateKey()); } else { log.info("Unsetting captcha validation."); captchaValidator = null; } // Need to get the Session Strategy and Transform class names out of the // Dictionary, and then use reflection to use them Dictionary<String,Object> props = new Hashtable<String,Object>(); if(!StringUtils.isEmptyOrNull(config.getJndiName())) { props.put("com.meltmedia.email.jndi",config.getJndiName()); log.debug("Using jndiName: "+config.getJndiName()); } log.debug("Using {} as the default from address.", config.getDefaultFromAddress()); if(StringUtils.isEmptyOrNull(config.getSessionStrategy())) { config.setSessionStrategy(null); } log.debug("Using mail session strategy: " + config.getSessionStrategy()); if(StringUtils.isEmptyOrNull(config.getMessageTransformer())) { config.setMessageTransformer(DEFAULT_MESSAGE_TRANSFORMER); } log.debug("Using message transformer: " + config.getMessageTransformer()); EmailSetup newSetup = new EmailSetup(); SessionStrategy strategy = null; MessageTransformer transformer = null; try { if(config.getSessionStrategy() != null) { strategy = setSessionStrategy(config, props, newSetup); } } catch (Exception e) { log.error("Error Registering Mail Session Strategy "+config.getSessionStrategy(), e); config.setSessionStrategy(null); } try { transformer = setMessageTransformer(config, newSetup); } catch(Exception e) { log.error("Error Registering Mail Session Strategy "+config.getSessionStrategy(), e); config.setMessageTransformer(DEFAULT_MESSAGE_TRANSFORMER); try { transformer = setMessageTransformer(config, newSetup); } catch(Exception e1) { log.error("Failed to fall back to default message transformer.", e1); } } this.setup = newSetup; log.debug("Using new config jndi {}, strategy {}, transformer {}", new Object[] {config.getJndiName(), strategy, transformer}); } } }
public class class_name { public void configurationUpdated(Object emailConfig) { EmailConfiguration config = (EmailConfiguration) emailConfig; if(config != null && (this.config == null || !config.equals(this.config))) { log.info("Updating configuration for email."); // depends on control dependency: [if], data = [none] this.config = config; // depends on control dependency: [if], data = [none] //Set the captcha validator up. if(!StringUtils.isEmptyOrNull(config.getCaptchaPrivateKey())) { log.info("Setting up captcha validation: "+config.getCaptchaPrivateKey()); // depends on control dependency: [if], data = [none] captchaValidator = new CaptchaValidator(config.getCaptchaPrivateKey()); // depends on control dependency: [if], data = [none] } else { log.info("Unsetting captcha validation."); // depends on control dependency: [if], data = [none] captchaValidator = null; // depends on control dependency: [if], data = [none] } // Need to get the Session Strategy and Transform class names out of the // Dictionary, and then use reflection to use them Dictionary<String,Object> props = new Hashtable<String,Object>(); if(!StringUtils.isEmptyOrNull(config.getJndiName())) { props.put("com.meltmedia.email.jndi",config.getJndiName()); // depends on control dependency: [if], data = [none] log.debug("Using jndiName: "+config.getJndiName()); // depends on control dependency: [if], data = [none] } log.debug("Using {} as the default from address.", config.getDefaultFromAddress()); // depends on control dependency: [if], data = [none] if(StringUtils.isEmptyOrNull(config.getSessionStrategy())) { config.setSessionStrategy(null); // depends on control dependency: [if], data = [none] } log.debug("Using mail session strategy: " + config.getSessionStrategy()); // depends on control dependency: [if], data = [none] if(StringUtils.isEmptyOrNull(config.getMessageTransformer())) { config.setMessageTransformer(DEFAULT_MESSAGE_TRANSFORMER); // depends on control dependency: [if], data = [none] } log.debug("Using message transformer: " + config.getMessageTransformer()); // depends on control dependency: [if], data = [none] EmailSetup newSetup = new EmailSetup(); SessionStrategy strategy = null; MessageTransformer transformer = null; try { if(config.getSessionStrategy() != null) { strategy = setSessionStrategy(config, props, newSetup); // depends on control dependency: [if], data = [none] } } catch (Exception e) { log.error("Error Registering Mail Session Strategy "+config.getSessionStrategy(), e); config.setSessionStrategy(null); } // depends on control dependency: [catch], data = [none] try { transformer = setMessageTransformer(config, newSetup); // depends on control dependency: [try], data = [none] } catch(Exception e) { log.error("Error Registering Mail Session Strategy "+config.getSessionStrategy(), e); config.setMessageTransformer(DEFAULT_MESSAGE_TRANSFORMER); try { transformer = setMessageTransformer(config, newSetup); // depends on control dependency: [try], data = [none] } catch(Exception e1) { log.error("Failed to fall back to default message transformer.", e1); } // depends on control dependency: [catch], data = [none] } // depends on control dependency: [catch], data = [none] this.setup = newSetup; // depends on control dependency: [if], data = [none] log.debug("Using new config jndi {}, strategy {}, transformer {}", new Object[] {config.getJndiName(), strategy, transformer}); // depends on control dependency: [if], data = [none] } } }
public class class_name { public MainToolbarPanel getMainToolbarPanel() { if (mainToolbarPanel == null) { mainToolbarPanel = new MainToolbarPanel(); mainToolbarPanel.addButton(getShowAllTabsButton()); mainToolbarPanel.addButton(getHideAllTabsButton()); mainToolbarPanel.addButton(getShowTabIconNamesButton()); mainToolbarPanel.addSeparator(); ButtonGroup layoutsButtonGroup = new ButtonGroup(); mainToolbarPanel.addButton(getExpandSelectLayoutButton()); layoutsButtonGroup.add(getExpandSelectLayoutButton()); mainToolbarPanel.addButton(getExpandStatusLayoutButton()); layoutsButtonGroup.add(getExpandStatusLayoutButton()); mainToolbarPanel.addButton(getFullLayoutButton()); layoutsButtonGroup.add(getFullLayoutButton()); mainToolbarPanel.addSeparator(); ButtonGroup responsePanelPositionsButtonGroup = new ButtonGroup(); mainToolbarPanel.addButton(getTabsResponsePanelPositionButton()); responsePanelPositionsButtonGroup.add(getTabsResponsePanelPositionButton()); mainToolbarPanel.addButton(getTabSideBySideResponsePanelPositionButton()); responsePanelPositionsButtonGroup.add(getTabSideBySideResponsePanelPositionButton()); mainToolbarPanel.addButton(getPanelsResponsePanelPositionButton()); responsePanelPositionsButtonGroup.add(getPanelsResponsePanelPositionButton()); mainToolbarPanel.addButton(getAboveResponsePanelPositionButton()); responsePanelPositionsButtonGroup.add(getAboveResponsePanelPositionButton()); mainToolbarPanel.addSeparator(); } return mainToolbarPanel; } }
public class class_name { public MainToolbarPanel getMainToolbarPanel() { if (mainToolbarPanel == null) { mainToolbarPanel = new MainToolbarPanel(); // depends on control dependency: [if], data = [none] mainToolbarPanel.addButton(getShowAllTabsButton()); // depends on control dependency: [if], data = [none] mainToolbarPanel.addButton(getHideAllTabsButton()); // depends on control dependency: [if], data = [none] mainToolbarPanel.addButton(getShowTabIconNamesButton()); // depends on control dependency: [if], data = [none] mainToolbarPanel.addSeparator(); // depends on control dependency: [if], data = [none] ButtonGroup layoutsButtonGroup = new ButtonGroup(); mainToolbarPanel.addButton(getExpandSelectLayoutButton()); // depends on control dependency: [if], data = [none] layoutsButtonGroup.add(getExpandSelectLayoutButton()); // depends on control dependency: [if], data = [none] mainToolbarPanel.addButton(getExpandStatusLayoutButton()); // depends on control dependency: [if], data = [none] layoutsButtonGroup.add(getExpandStatusLayoutButton()); // depends on control dependency: [if], data = [none] mainToolbarPanel.addButton(getFullLayoutButton()); // depends on control dependency: [if], data = [none] layoutsButtonGroup.add(getFullLayoutButton()); // depends on control dependency: [if], data = [none] mainToolbarPanel.addSeparator(); // depends on control dependency: [if], data = [none] ButtonGroup responsePanelPositionsButtonGroup = new ButtonGroup(); mainToolbarPanel.addButton(getTabsResponsePanelPositionButton()); // depends on control dependency: [if], data = [none] responsePanelPositionsButtonGroup.add(getTabsResponsePanelPositionButton()); // depends on control dependency: [if], data = [none] mainToolbarPanel.addButton(getTabSideBySideResponsePanelPositionButton()); // depends on control dependency: [if], data = [none] responsePanelPositionsButtonGroup.add(getTabSideBySideResponsePanelPositionButton()); // depends on control dependency: [if], data = [none] mainToolbarPanel.addButton(getPanelsResponsePanelPositionButton()); // depends on control dependency: [if], data = [none] responsePanelPositionsButtonGroup.add(getPanelsResponsePanelPositionButton()); // depends on control dependency: [if], data = [none] mainToolbarPanel.addButton(getAboveResponsePanelPositionButton()); // depends on control dependency: [if], data = [none] responsePanelPositionsButtonGroup.add(getAboveResponsePanelPositionButton()); // depends on control dependency: [if], data = [none] mainToolbarPanel.addSeparator(); // depends on control dependency: [if], data = [none] } return mainToolbarPanel; } }
public class class_name { public QuorumConfig findQuorumConfig(String name) { name = getBaseName(name); QuorumConfig config = lookupByPattern(configPatternMatcher, quorumConfigs, name); if (config != null) { return config; } return getQuorumConfig("default"); } }
public class class_name { public QuorumConfig findQuorumConfig(String name) { name = getBaseName(name); QuorumConfig config = lookupByPattern(configPatternMatcher, quorumConfigs, name); if (config != null) { return config; // depends on control dependency: [if], data = [none] } return getQuorumConfig("default"); } }
public class class_name { public void addListeners() { super.addListeners(); this.getMainRecord().addListener(new FileListener(null) { public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) { // Return an error to stop the change if (iChangeType == DBConstants.AFTER_ADD_TYPE) { strMessage = DBConstants.BLANK; afterAdd(); if ((strMessage != null) && (strMessage.toUpperCase().startsWith("ERROR"))) return getTask().setLastError(strMessage); } return super.doRecordChange(field, iChangeType, bDisplayOption); } }); MessageManager messageManager = ((Application)this.getTask().getApplication()).getMessageManager(); if (messageManager != null) { Object source = this; BaseMessageFilter filter = new BaseMessageFilter(MessageConstants.TRX_RETURN_QUEUE, MessageConstants.INTERNET_QUEUE, source, null); filter.addMessageListener(this); messageManager.addMessageFilter(filter); m_intRegistryID = filter.getRegistryID(); } } }
public class class_name { public void addListeners() { super.addListeners(); this.getMainRecord().addListener(new FileListener(null) { public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) { // Return an error to stop the change if (iChangeType == DBConstants.AFTER_ADD_TYPE) { strMessage = DBConstants.BLANK; // depends on control dependency: [if], data = [none] afterAdd(); // depends on control dependency: [if], data = [none] if ((strMessage != null) && (strMessage.toUpperCase().startsWith("ERROR"))) return getTask().setLastError(strMessage); } return super.doRecordChange(field, iChangeType, bDisplayOption); } }); MessageManager messageManager = ((Application)this.getTask().getApplication()).getMessageManager(); if (messageManager != null) { Object source = this; BaseMessageFilter filter = new BaseMessageFilter(MessageConstants.TRX_RETURN_QUEUE, MessageConstants.INTERNET_QUEUE, source, null); filter.addMessageListener(this); // depends on control dependency: [if], data = [none] messageManager.addMessageFilter(filter); // depends on control dependency: [if], data = [none] m_intRegistryID = filter.getRegistryID(); // depends on control dependency: [if], data = [none] } } }
public class class_name { <V> ElementRule<T, V> getRule(ChronoElement<V> element) { if (element == null) { throw new NullPointerException("Missing chronological element."); } ElementRule<?, ?> rule = this.ruleMap.get(element); if (rule == null) { rule = this.getDerivedRule(element, true); if (rule == null) { throw new RuleNotFoundException(this, element); } } return cast(rule); // type-safe } }
public class class_name { <V> ElementRule<T, V> getRule(ChronoElement<V> element) { if (element == null) { throw new NullPointerException("Missing chronological element."); } ElementRule<?, ?> rule = this.ruleMap.get(element); if (rule == null) { rule = this.getDerivedRule(element, true); // depends on control dependency: [if], data = [none] if (rule == null) { throw new RuleNotFoundException(this, element); } } return cast(rule); // type-safe } }
public class class_name { public void setToolTipText(String text) { this.toolTipText = text; if (toolTipDialog != null) { toolTipDialog.setText(text); } } }
public class class_name { public void setToolTipText(String text) { this.toolTipText = text; if (toolTipDialog != null) { toolTipDialog.setText(text); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void populateNextRate() { final MutableDataPoint prev_data = new MutableDataPoint(); if (source.hasNext()) { prev_data.reset(next_data); next_data.reset(source.next()); final long t0 = prev_data.timestamp(); final long t1 = next_data.timestamp(); if (t1 <= t0) { throw new IllegalStateException( "Next timestamp (" + t1 + ") is supposed to be " + " strictly greater than the previous one (" + t0 + "), but it's" + " not. this=" + this); } // TODO: for backwards compatibility we'll convert the ms to seconds // but in the future we should add a ratems flag that will calculate // the rate as is. final double time_delta_secs = ((double)(t1 - t0) / 1000.0); double difference; if (prev_data.isInteger() && next_data.isInteger()) { // NOTE: Calculates in the long type to avoid precision loss // while converting long values to double values if both values are long. // NOTE: Ignores the integer overflow. difference = next_data.longValue() - prev_data.longValue(); } else { difference = next_data.toDouble() - prev_data.toDouble(); } if (options.isCounter() && difference < 0) { if (options.getDropResets()) { populateNextRate(); return; } if (prev_data.isInteger() && next_data.isInteger()) { // NOTE: Calculates in the long type to avoid precision loss // while converting long values to double values if both values are long. difference = options.getCounterMax() - prev_data.longValue() + next_data.longValue(); } else { difference = options.getCounterMax() - prev_data.toDouble() + next_data.toDouble(); } // If the rate is greater than the reset value, return a 0 final double rate = difference / time_delta_secs; if (options.getResetValue() > RateOptions.DEFAULT_RESET_VALUE && rate > options.getResetValue()) { next_rate.reset(next_data.timestamp(), 0.0D); } else { next_rate.reset(next_data.timestamp(), rate); } } else { next_rate.reset(next_data.timestamp(), (difference / time_delta_secs)); } } else { // Invalidates the next rate with invalid timestamp. next_rate.reset(INVALID_TIMESTAMP, 0); } } }
public class class_name { private void populateNextRate() { final MutableDataPoint prev_data = new MutableDataPoint(); if (source.hasNext()) { prev_data.reset(next_data); // depends on control dependency: [if], data = [none] next_data.reset(source.next()); // depends on control dependency: [if], data = [none] final long t0 = prev_data.timestamp(); final long t1 = next_data.timestamp(); if (t1 <= t0) { throw new IllegalStateException( "Next timestamp (" + t1 + ") is supposed to be " + " strictly greater than the previous one (" + t0 + "), but it's" + " not. this=" + this); } // TODO: for backwards compatibility we'll convert the ms to seconds // but in the future we should add a ratems flag that will calculate // the rate as is. final double time_delta_secs = ((double)(t1 - t0) / 1000.0); double difference; if (prev_data.isInteger() && next_data.isInteger()) { // NOTE: Calculates in the long type to avoid precision loss // while converting long values to double values if both values are long. // NOTE: Ignores the integer overflow. difference = next_data.longValue() - prev_data.longValue(); // depends on control dependency: [if], data = [none] } else { difference = next_data.toDouble() - prev_data.toDouble(); // depends on control dependency: [if], data = [none] } if (options.isCounter() && difference < 0) { if (options.getDropResets()) { populateNextRate(); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (prev_data.isInteger() && next_data.isInteger()) { // NOTE: Calculates in the long type to avoid precision loss // while converting long values to double values if both values are long. difference = options.getCounterMax() - prev_data.longValue() + next_data.longValue(); // depends on control dependency: [if], data = [none] } else { difference = options.getCounterMax() - prev_data.toDouble() + next_data.toDouble(); // depends on control dependency: [if], data = [none] } // If the rate is greater than the reset value, return a 0 final double rate = difference / time_delta_secs; if (options.getResetValue() > RateOptions.DEFAULT_RESET_VALUE && rate > options.getResetValue()) { next_rate.reset(next_data.timestamp(), 0.0D); // depends on control dependency: [if], data = [none] } else { next_rate.reset(next_data.timestamp(), rate); // depends on control dependency: [if], data = [none] } } else { next_rate.reset(next_data.timestamp(), (difference / time_delta_secs)); // depends on control dependency: [if], data = [none] } } else { // Invalidates the next rate with invalid timestamp. next_rate.reset(INVALID_TIMESTAMP, 0); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Trivial protected SubjectThreadContext getSubjectThreadContext() { ThreadLocal<SubjectThreadContext> currentThreadLocal = getThreadLocal(); SubjectThreadContext subjectThreadContext = currentThreadLocal.get(); if (subjectThreadContext == null) { subjectThreadContext = new SubjectThreadContext(); currentThreadLocal.set(subjectThreadContext); } return subjectThreadContext; } }
public class class_name { @Trivial protected SubjectThreadContext getSubjectThreadContext() { ThreadLocal<SubjectThreadContext> currentThreadLocal = getThreadLocal(); SubjectThreadContext subjectThreadContext = currentThreadLocal.get(); if (subjectThreadContext == null) { subjectThreadContext = new SubjectThreadContext(); // depends on control dependency: [if], data = [none] currentThreadLocal.set(subjectThreadContext); // depends on control dependency: [if], data = [(subjectThreadContext] } return subjectThreadContext; } }
public class class_name { public void rerender() { clear(); if (dataItems != null) { for (M m : dataItems) { addDataItem(m); } } doRefresh(); } }
public class class_name { public void rerender() { clear(); if (dataItems != null) { for (M m : dataItems) { addDataItem(m); // depends on control dependency: [for], data = [m] } } doRefresh(); } }
public class class_name { public DescribeSpotInstanceRequestsResult withSpotInstanceRequests(SpotInstanceRequest... spotInstanceRequests) { if (this.spotInstanceRequests == null) { setSpotInstanceRequests(new com.amazonaws.internal.SdkInternalList<SpotInstanceRequest>(spotInstanceRequests.length)); } for (SpotInstanceRequest ele : spotInstanceRequests) { this.spotInstanceRequests.add(ele); } return this; } }
public class class_name { public DescribeSpotInstanceRequestsResult withSpotInstanceRequests(SpotInstanceRequest... spotInstanceRequests) { if (this.spotInstanceRequests == null) { setSpotInstanceRequests(new com.amazonaws.internal.SdkInternalList<SpotInstanceRequest>(spotInstanceRequests.length)); // depends on control dependency: [if], data = [none] } for (SpotInstanceRequest ele : spotInstanceRequests) { this.spotInstanceRequests.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public static boolean needsDoubleQuotes(String s) { // this method should only be called for C*-provided identifiers, // so we expect it to be non-null and non-empty. assert s != null && !s.isEmpty(); char c = s.charAt(0); if (!(c >= 97 && c <= 122)) // a-z return true; for (int i = 1; i < s.length(); i++) { c = s.charAt(i); if (!((c >= 48 && c <= 57) // 0-9 || (c == 95) // _ || (c >= 97 && c <= 122) // a-z )) { return true; } } return isReservedCqlKeyword(s); } }
public class class_name { public static boolean needsDoubleQuotes(String s) { // this method should only be called for C*-provided identifiers, // so we expect it to be non-null and non-empty. assert s != null && !s.isEmpty(); char c = s.charAt(0); if (!(c >= 97 && c <= 122)) // a-z return true; for (int i = 1; i < s.length(); i++) { c = s.charAt(i); // depends on control dependency: [for], data = [i] if (!((c >= 48 && c <= 57) // 0-9 || (c == 95) // _ || (c >= 97 && c <= 122) // a-z )) { return true; // depends on control dependency: [if], data = [] } } return isReservedCqlKeyword(s); } }
public class class_name { private InterceptorProxy[] getInterceptorProxies(InterceptorMethodKind kind, List<String> orderedList) // d630717 throws EJBConfigurationException { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) { Tr.entry(tc, "getInterceptorProxies: " + kind + ", " + orderedList); } List<InterceptorProxy> proxyList = new ArrayList<InterceptorProxy>(); // Iterate over the ordered list of interceptor classes. For each // interceptor, get the list of interceptor proxies of the appropriate // interceptor kind, and add the proxies to the list. for (String name : orderedList) { // Every class should have been loaded by this point. We make this // a requirement because it's more efficient than going to the class // loader and because it's trivial to ensure. Class<?> klass = ivInterceptorNameToClassMap.get(name); Map<InterceptorMethodKind, List<InterceptorProxy>> proxyMap = ivInterceptorProxyMaps.get(klass); if (proxyMap == null) { // The proxies for this interceptor have not been created yet. Add // the class to the list of interceptor proxy classes, and then // create the map using that array index. int index = ivInterceptorClasses.size(); ivInterceptorClasses.add(klass); proxyMap = createInterceptorProxyMap(klass, index); ivInterceptorProxyMaps.put(klass, proxyMap); } List<InterceptorProxy> kindProxyList = proxyMap.get(kind); if (kindProxyList != null) { proxyList.addAll(kindProxyList); } } // If CDI is enabled, add the proxies from the first JCDI interceptor // class. It should run before all other interceptors. F743-29169 if (ivJCDIFirstInterceptorClass != null) { Map<InterceptorMethodKind, List<InterceptorProxy>> proxyMap = ivInterceptorProxyMaps.get(ivJCDIFirstInterceptorClass); if (proxyMap == null) { // The proxies for this interceptor have not been created yet. Add // the class to the list of interceptor proxy classes, and then // create the map using that array index. int index = ivInterceptorClasses.size(); ivInterceptorClasses.add(ivJCDIFirstInterceptorClass); proxyMap = createInterceptorProxyMap(ivJCDIFirstInterceptorClass, index); ivInterceptorProxyMaps.put(ivJCDIFirstInterceptorClass, proxyMap); } List<InterceptorProxy> kindProxyList = proxyMap.get(kind); if (kindProxyList != null) { proxyList.addAll(0, kindProxyList); // adds to beginning } } // If CDI is enabled, add the proxies from the last JCDI interceptor // class. It should run after all other interceptors. F743-15628 if (ivJCDILastInterceptorClass != null) { Map<InterceptorMethodKind, List<InterceptorProxy>> proxyMap = ivInterceptorProxyMaps.get(ivJCDILastInterceptorClass); if (proxyMap == null) { // The proxies for this interceptor have not been created yet. Add // the class to the list of interceptor proxy classes, and then // create the map using that array index. int index = ivInterceptorClasses.size(); ivInterceptorClasses.add(ivJCDILastInterceptorClass); proxyMap = createInterceptorProxyMap(ivJCDILastInterceptorClass, index); ivInterceptorProxyMaps.put(ivJCDILastInterceptorClass, proxyMap); } List<InterceptorProxy> kindProxyList = proxyMap.get(kind); if (kindProxyList != null) { proxyList.addAll(kindProxyList); // adds to end } } // Finally, add the interceptor proxies from the bean class. List<InterceptorProxy> kindProxyList = ivBeanInterceptorProxyMap.get(kind); if (kindProxyList != null) { proxyList.addAll(kindProxyList); } // Convert the list of proxies to an array. InterceptorProxy[] proxies; if (proxyList.isEmpty()) { proxies = null; } else { proxies = new InterceptorProxy[proxyList.size()]; proxyList.toArray(proxies); } if (isTraceOn && tc.isEntryEnabled()) { Tr.exit(tc, "getInterceptorProxies: " + Arrays.toString(proxies)); } return proxies; } }
public class class_name { private InterceptorProxy[] getInterceptorProxies(InterceptorMethodKind kind, List<String> orderedList) // d630717 throws EJBConfigurationException { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) { Tr.entry(tc, "getInterceptorProxies: " + kind + ", " + orderedList); } List<InterceptorProxy> proxyList = new ArrayList<InterceptorProxy>(); // Iterate over the ordered list of interceptor classes. For each // interceptor, get the list of interceptor proxies of the appropriate // interceptor kind, and add the proxies to the list. for (String name : orderedList) { // Every class should have been loaded by this point. We make this // a requirement because it's more efficient than going to the class // loader and because it's trivial to ensure. Class<?> klass = ivInterceptorNameToClassMap.get(name); Map<InterceptorMethodKind, List<InterceptorProxy>> proxyMap = ivInterceptorProxyMaps.get(klass); if (proxyMap == null) { // The proxies for this interceptor have not been created yet. Add // the class to the list of interceptor proxy classes, and then // create the map using that array index. int index = ivInterceptorClasses.size(); ivInterceptorClasses.add(klass); // depends on control dependency: [if], data = [none] proxyMap = createInterceptorProxyMap(klass, index); // depends on control dependency: [if], data = [none] ivInterceptorProxyMaps.put(klass, proxyMap); // depends on control dependency: [if], data = [none] } List<InterceptorProxy> kindProxyList = proxyMap.get(kind); if (kindProxyList != null) { proxyList.addAll(kindProxyList); // depends on control dependency: [if], data = [(kindProxyList] } } // If CDI is enabled, add the proxies from the first JCDI interceptor // class. It should run before all other interceptors. F743-29169 if (ivJCDIFirstInterceptorClass != null) { Map<InterceptorMethodKind, List<InterceptorProxy>> proxyMap = ivInterceptorProxyMaps.get(ivJCDIFirstInterceptorClass); if (proxyMap == null) { // The proxies for this interceptor have not been created yet. Add // the class to the list of interceptor proxy classes, and then // create the map using that array index. int index = ivInterceptorClasses.size(); ivInterceptorClasses.add(ivJCDIFirstInterceptorClass); proxyMap = createInterceptorProxyMap(ivJCDIFirstInterceptorClass, index); ivInterceptorProxyMaps.put(ivJCDIFirstInterceptorClass, proxyMap); } List<InterceptorProxy> kindProxyList = proxyMap.get(kind); if (kindProxyList != null) { proxyList.addAll(0, kindProxyList); // adds to beginning } } // If CDI is enabled, add the proxies from the last JCDI interceptor // class. It should run after all other interceptors. F743-15628 if (ivJCDILastInterceptorClass != null) { Map<InterceptorMethodKind, List<InterceptorProxy>> proxyMap = ivInterceptorProxyMaps.get(ivJCDILastInterceptorClass); if (proxyMap == null) { // The proxies for this interceptor have not been created yet. Add // the class to the list of interceptor proxy classes, and then // create the map using that array index. int index = ivInterceptorClasses.size(); ivInterceptorClasses.add(ivJCDILastInterceptorClass); // depends on control dependency: [if], data = [none] proxyMap = createInterceptorProxyMap(ivJCDILastInterceptorClass, index); // depends on control dependency: [if], data = [none] ivInterceptorProxyMaps.put(ivJCDILastInterceptorClass, proxyMap); // depends on control dependency: [if], data = [none] } List<InterceptorProxy> kindProxyList = proxyMap.get(kind); if (kindProxyList != null) { proxyList.addAll(kindProxyList); // adds to end // depends on control dependency: [if], data = [(kindProxyList] } } // Finally, add the interceptor proxies from the bean class. List<InterceptorProxy> kindProxyList = ivBeanInterceptorProxyMap.get(kind); if (kindProxyList != null) { proxyList.addAll(kindProxyList); } // Convert the list of proxies to an array. InterceptorProxy[] proxies; if (proxyList.isEmpty()) { proxies = null; } else { proxies = new InterceptorProxy[proxyList.size()]; proxyList.toArray(proxies); } if (isTraceOn && tc.isEntryEnabled()) { Tr.exit(tc, "getInterceptorProxies: " + Arrays.toString(proxies)); } return proxies; } }
public class class_name { @SafeVarargs public static <E> void addAll(Collection<E> collection, E[]... arr) { if (collection == null) { throw new IllegalArgumentException("collection cannot be null"); } for (E[] oarr : arr) { for (E o : oarr) { collection.add(o); } } } }
public class class_name { @SafeVarargs public static <E> void addAll(Collection<E> collection, E[]... arr) { if (collection == null) { throw new IllegalArgumentException("collection cannot be null"); } for (E[] oarr : arr) { for (E o : oarr) { collection.add(o); // depends on control dependency: [for], data = [o] } } } }
public class class_name { public BufferedImage getTileSetImage (String path, Colorization[] zations) { BufferedImage image = _cache.get(path); if (image == null) { try { image = loadImage(path); _cache.put(path, image); } catch (IOException ioe) { log.warning("Failed to load image", "path", path, "ioe", ioe); } } if (zations == null || image == null) { return image; } else { return ImageUtil.recolorImage(image, zations); } } }
public class class_name { public BufferedImage getTileSetImage (String path, Colorization[] zations) { BufferedImage image = _cache.get(path); if (image == null) { try { image = loadImage(path); // depends on control dependency: [try], data = [none] _cache.put(path, image); // depends on control dependency: [try], data = [none] } catch (IOException ioe) { log.warning("Failed to load image", "path", path, "ioe", ioe); } // depends on control dependency: [catch], data = [none] } if (zations == null || image == null) { return image; // depends on control dependency: [if], data = [none] } else { return ImageUtil.recolorImage(image, zations); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void addAnchor(DeprecatedAPIListBuilder builder, DeprElementKind kind, Content htmlTree) { if (builder.hasDocumentation(kind)) { htmlTree.addContent(getMarkerAnchor(getAnchorName(kind))); } } }
public class class_name { private void addAnchor(DeprecatedAPIListBuilder builder, DeprElementKind kind, Content htmlTree) { if (builder.hasDocumentation(kind)) { htmlTree.addContent(getMarkerAnchor(getAnchorName(kind))); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public TopologyInfo getTopologyInfo(String topologyId) throws TException { long start = System.nanoTime(); StormClusterState stormClusterState = data.getStormClusterState(); try { // get topology's StormBase StormBase base = stormClusterState.storm_base(topologyId, null); if (base == null) { throw new NotAliveException("No topology of " + topologyId); } Assignment assignment = stormClusterState.assignment_info(topologyId, null); if (assignment == null) { throw new NotAliveException("No topology of " + topologyId); } TopologyTaskHbInfo topologyTaskHbInfo = data.getTasksHeartbeat().get(topologyId); Map<Integer, TaskHeartbeat> taskHbMap = null; if (topologyTaskHbInfo != null) taskHbMap = topologyTaskHbInfo.get_taskHbs(); Map<Integer, TaskInfo> taskInfoMap = Cluster.get_all_taskInfo(stormClusterState, topologyId); Map<Integer, String> taskToComponent = Cluster.get_all_task_component(stormClusterState, topologyId, taskInfoMap); Map<Integer, String> taskToType = Cluster.get_all_task_type(stormClusterState, topologyId, taskInfoMap); String errorString; if (Cluster.is_topology_exist_error(stormClusterState, topologyId)) { errorString = "Y"; } else { errorString = ""; } TopologySummary topologySummary = new TopologySummary(); topologySummary.set_id(topologyId); topologySummary.set_name(base.getStormName()); topologySummary.set_uptimeSecs(TimeUtils.time_delta(base.getLanchTimeSecs())); topologySummary.set_status(base.getStatusString()); topologySummary.set_numTasks(NimbusUtils.getTopologyTaskNum(assignment)); topologySummary.set_numWorkers(assignment.getWorkers().size()); topologySummary.set_errorInfo(errorString); Map<String, ComponentSummary> componentSummaryMap = new HashMap<>(); HashMap<String, List<Integer>> componentToTasks = JStormUtils.reverse_map(taskToComponent); for (Entry<String, List<Integer>> entry : componentToTasks.entrySet()) { String name = entry.getKey(); List<Integer> taskIds = entry.getValue(); if (taskIds == null || taskIds.size() == 0) { LOG.warn("No task of component " + name); continue; } ComponentSummary componentSummary = new ComponentSummary(); componentSummaryMap.put(name, componentSummary); componentSummary.set_name(name); componentSummary.set_type(taskToType.get(taskIds.get(0))); componentSummary.set_parallel(taskIds.size()); componentSummary.set_taskIds(taskIds); } Map<Integer, TaskSummary> taskSummaryMap = new TreeMap<>(); Map<Integer, List<TaskError>> taskErrors = Cluster.get_all_task_errors(stormClusterState, topologyId); for (Integer taskId : taskInfoMap.keySet()) { TaskSummary taskSummary = new TaskSummary(); taskSummaryMap.put(taskId, taskSummary); taskSummary.set_taskId(taskId); if (taskHbMap == null) { taskSummary.set_status("Starting"); taskSummary.set_uptime(0); } else { TaskHeartbeat hb = taskHbMap.get(taskId); if (hb == null) { taskSummary.set_status("Starting"); taskSummary.set_uptime(0); } else { boolean isInactive = NimbusUtils.isTaskDead(data, topologyId, taskId); if (isInactive) taskSummary.set_status("INACTIVE"); else taskSummary.set_status("ACTIVE"); taskSummary.set_uptime(hb.get_uptime()); } } if (StringUtils.isBlank(errorString)) { continue; } List<TaskError> taskErrorList = taskErrors.get(taskId); if (taskErrorList != null && taskErrorList.size() != 0) { for (TaskError taskError : taskErrorList) { ErrorInfo errorInfo = new ErrorInfo(taskError.getError(), taskError.getTimSecs(), taskError.getLevel(), taskError.getCode()); taskSummary.add_to_errors(errorInfo); String component = taskToComponent.get(taskId); componentSummaryMap.get(component).add_to_errors(errorInfo); } } } for (ResourceWorkerSlot workerSlot : assignment.getWorkers()) { String hostname = workerSlot.getHostname(); int port = workerSlot.getPort(); for (Integer taskId : workerSlot.getTasks()) { TaskSummary taskSummary = taskSummaryMap.get(taskId); taskSummary.set_host(hostname); taskSummary.set_port(port); } } TopologyInfo topologyInfo = new TopologyInfo(); topologyInfo.set_topology(topologySummary); topologyInfo.set_components(JStormUtils.mk_list(componentSummaryMap.values())); topologyInfo.set_tasks(JStormUtils.mk_list(taskSummaryMap.values())); // return topology metric & component metric only List<MetricInfo> tpMetricList = data.getMetricCache().getMetricData(topologyId, MetaType.TOPOLOGY); List<MetricInfo> compMetricList = data.getMetricCache().getMetricData(topologyId, MetaType.COMPONENT); List<MetricInfo> workerMetricList = data.getMetricCache().getMetricData(topologyId, MetaType.WORKER); List<MetricInfo> compStreamMetricList = data.getMetricCache().getMetricData(topologyId, MetaType.COMPONENT_STREAM); MetricInfo taskMetric = MetricUtils.mkMetricInfo(); MetricInfo streamMetric = MetricUtils.mkMetricInfo(); MetricInfo nettyMetric = MetricUtils.mkMetricInfo(); MetricInfo tpMetric, compMetric, compStreamMetric, workerMetric; if (tpMetricList == null || tpMetricList.size() == 0) { tpMetric = MetricUtils.mkMetricInfo(); } else { // get the last min topology metric tpMetric = tpMetricList.get(tpMetricList.size() - 1); } if (compMetricList == null || compMetricList.size() == 0) { compMetric = MetricUtils.mkMetricInfo(); } else { compMetric = compMetricList.get(0); } if (compStreamMetricList == null || compStreamMetricList.size() == 0) { compStreamMetric = MetricUtils.mkMetricInfo(); } else { compStreamMetric = compStreamMetricList.get(0); } if (workerMetricList == null || workerMetricList.size() == 0) { workerMetric = MetricUtils.mkMetricInfo(); } else { workerMetric = workerMetricList.get(0); } TopologyMetric topologyMetrics = new TopologyMetric(tpMetric, compMetric, workerMetric, taskMetric, streamMetric, nettyMetric); topologyMetrics.set_compStreamMetric(compStreamMetric); topologyInfo.set_metrics(topologyMetrics); return topologyInfo; } catch (TException e) { LOG.info("Failed to get topologyInfo " + topologyId, e); throw e; } catch (Exception e) { LOG.info("Failed to get topologyInfo " + topologyId, e); throw new TException("Failed to get topologyInfo" + topologyId); } finally { long end = System.nanoTime(); SimpleJStormMetric.updateNimbusHistogram("getTopologyInfo", (end - start) / TimeUtils.NS_PER_US); } } }
public class class_name { @Override public TopologyInfo getTopologyInfo(String topologyId) throws TException { long start = System.nanoTime(); StormClusterState stormClusterState = data.getStormClusterState(); try { // get topology's StormBase StormBase base = stormClusterState.storm_base(topologyId, null); if (base == null) { throw new NotAliveException("No topology of " + topologyId); } Assignment assignment = stormClusterState.assignment_info(topologyId, null); if (assignment == null) { throw new NotAliveException("No topology of " + topologyId); } TopologyTaskHbInfo topologyTaskHbInfo = data.getTasksHeartbeat().get(topologyId); Map<Integer, TaskHeartbeat> taskHbMap = null; if (topologyTaskHbInfo != null) taskHbMap = topologyTaskHbInfo.get_taskHbs(); Map<Integer, TaskInfo> taskInfoMap = Cluster.get_all_taskInfo(stormClusterState, topologyId); Map<Integer, String> taskToComponent = Cluster.get_all_task_component(stormClusterState, topologyId, taskInfoMap); Map<Integer, String> taskToType = Cluster.get_all_task_type(stormClusterState, topologyId, taskInfoMap); String errorString; if (Cluster.is_topology_exist_error(stormClusterState, topologyId)) { errorString = "Y"; // depends on control dependency: [if], data = [none] } else { errorString = ""; // depends on control dependency: [if], data = [none] } TopologySummary topologySummary = new TopologySummary(); topologySummary.set_id(topologyId); topologySummary.set_name(base.getStormName()); topologySummary.set_uptimeSecs(TimeUtils.time_delta(base.getLanchTimeSecs())); topologySummary.set_status(base.getStatusString()); topologySummary.set_numTasks(NimbusUtils.getTopologyTaskNum(assignment)); topologySummary.set_numWorkers(assignment.getWorkers().size()); topologySummary.set_errorInfo(errorString); Map<String, ComponentSummary> componentSummaryMap = new HashMap<>(); HashMap<String, List<Integer>> componentToTasks = JStormUtils.reverse_map(taskToComponent); for (Entry<String, List<Integer>> entry : componentToTasks.entrySet()) { String name = entry.getKey(); List<Integer> taskIds = entry.getValue(); if (taskIds == null || taskIds.size() == 0) { LOG.warn("No task of component " + name); // depends on control dependency: [if], data = [none] continue; } ComponentSummary componentSummary = new ComponentSummary(); componentSummaryMap.put(name, componentSummary); // depends on control dependency: [for], data = [none] componentSummary.set_name(name); // depends on control dependency: [for], data = [none] componentSummary.set_type(taskToType.get(taskIds.get(0))); // depends on control dependency: [for], data = [none] componentSummary.set_parallel(taskIds.size()); // depends on control dependency: [for], data = [none] componentSummary.set_taskIds(taskIds); // depends on control dependency: [for], data = [none] } Map<Integer, TaskSummary> taskSummaryMap = new TreeMap<>(); Map<Integer, List<TaskError>> taskErrors = Cluster.get_all_task_errors(stormClusterState, topologyId); for (Integer taskId : taskInfoMap.keySet()) { TaskSummary taskSummary = new TaskSummary(); taskSummaryMap.put(taskId, taskSummary); // depends on control dependency: [for], data = [taskId] taskSummary.set_taskId(taskId); // depends on control dependency: [for], data = [taskId] if (taskHbMap == null) { taskSummary.set_status("Starting"); // depends on control dependency: [if], data = [none] taskSummary.set_uptime(0); // depends on control dependency: [if], data = [none] } else { TaskHeartbeat hb = taskHbMap.get(taskId); if (hb == null) { taskSummary.set_status("Starting"); // depends on control dependency: [if], data = [none] taskSummary.set_uptime(0); // depends on control dependency: [if], data = [none] } else { boolean isInactive = NimbusUtils.isTaskDead(data, topologyId, taskId); if (isInactive) taskSummary.set_status("INACTIVE"); else taskSummary.set_status("ACTIVE"); taskSummary.set_uptime(hb.get_uptime()); // depends on control dependency: [if], data = [(hb] } } if (StringUtils.isBlank(errorString)) { continue; } List<TaskError> taskErrorList = taskErrors.get(taskId); if (taskErrorList != null && taskErrorList.size() != 0) { for (TaskError taskError : taskErrorList) { ErrorInfo errorInfo = new ErrorInfo(taskError.getError(), taskError.getTimSecs(), taskError.getLevel(), taskError.getCode()); taskSummary.add_to_errors(errorInfo); // depends on control dependency: [for], data = [none] String component = taskToComponent.get(taskId); componentSummaryMap.get(component).add_to_errors(errorInfo); // depends on control dependency: [for], data = [none] } } } for (ResourceWorkerSlot workerSlot : assignment.getWorkers()) { String hostname = workerSlot.getHostname(); int port = workerSlot.getPort(); for (Integer taskId : workerSlot.getTasks()) { TaskSummary taskSummary = taskSummaryMap.get(taskId); taskSummary.set_host(hostname); // depends on control dependency: [for], data = [none] taskSummary.set_port(port); // depends on control dependency: [for], data = [none] } } TopologyInfo topologyInfo = new TopologyInfo(); topologyInfo.set_topology(topologySummary); topologyInfo.set_components(JStormUtils.mk_list(componentSummaryMap.values())); topologyInfo.set_tasks(JStormUtils.mk_list(taskSummaryMap.values())); // return topology metric & component metric only List<MetricInfo> tpMetricList = data.getMetricCache().getMetricData(topologyId, MetaType.TOPOLOGY); List<MetricInfo> compMetricList = data.getMetricCache().getMetricData(topologyId, MetaType.COMPONENT); List<MetricInfo> workerMetricList = data.getMetricCache().getMetricData(topologyId, MetaType.WORKER); List<MetricInfo> compStreamMetricList = data.getMetricCache().getMetricData(topologyId, MetaType.COMPONENT_STREAM); MetricInfo taskMetric = MetricUtils.mkMetricInfo(); MetricInfo streamMetric = MetricUtils.mkMetricInfo(); MetricInfo nettyMetric = MetricUtils.mkMetricInfo(); MetricInfo tpMetric, compMetric, compStreamMetric, workerMetric; if (tpMetricList == null || tpMetricList.size() == 0) { tpMetric = MetricUtils.mkMetricInfo(); // depends on control dependency: [if], data = [none] } else { // get the last min topology metric tpMetric = tpMetricList.get(tpMetricList.size() - 1); // depends on control dependency: [if], data = [(tpMetricList] } if (compMetricList == null || compMetricList.size() == 0) { compMetric = MetricUtils.mkMetricInfo(); // depends on control dependency: [if], data = [none] } else { compMetric = compMetricList.get(0); // depends on control dependency: [if], data = [none] } if (compStreamMetricList == null || compStreamMetricList.size() == 0) { compStreamMetric = MetricUtils.mkMetricInfo(); // depends on control dependency: [if], data = [none] } else { compStreamMetric = compStreamMetricList.get(0); // depends on control dependency: [if], data = [none] } if (workerMetricList == null || workerMetricList.size() == 0) { workerMetric = MetricUtils.mkMetricInfo(); // depends on control dependency: [if], data = [none] } else { workerMetric = workerMetricList.get(0); // depends on control dependency: [if], data = [none] } TopologyMetric topologyMetrics = new TopologyMetric(tpMetric, compMetric, workerMetric, taskMetric, streamMetric, nettyMetric); topologyMetrics.set_compStreamMetric(compStreamMetric); topologyInfo.set_metrics(topologyMetrics); return topologyInfo; } catch (TException e) { LOG.info("Failed to get topologyInfo " + topologyId, e); throw e; } catch (Exception e) { LOG.info("Failed to get topologyInfo " + topologyId, e); throw new TException("Failed to get topologyInfo" + topologyId); } finally { long end = System.nanoTime(); SimpleJStormMetric.updateNimbusHistogram("getTopologyInfo", (end - start) / TimeUtils.NS_PER_US); } } }
public class class_name { public void notifyAfterEvaluation(String expr) { if (getEvaluationListeners() == null) return; for (EvaluationListener listener: getEvaluationListeners()) { listener.afterEvaluation(this, expr); } } }
public class class_name { public void notifyAfterEvaluation(String expr) { if (getEvaluationListeners() == null) return; for (EvaluationListener listener: getEvaluationListeners()) { listener.afterEvaluation(this, expr); // depends on control dependency: [for], data = [listener] } } }
public class class_name { public List<UserPermission> retrievePermissions(User user) { if (domain == null) { return new ArrayList<UserPermission>(); } Criteria criteria = this.dao.newCriteria(UserPermission.class).add(Restrictions.eq("user", user)) .add(Restrictions.eq("company", domain.getCompany())).add(Restrictions.eq("revoked", false)); return this.dao.findByCriteria(criteria, UserPermission.class); } }
public class class_name { public List<UserPermission> retrievePermissions(User user) { if (domain == null) { return new ArrayList<UserPermission>(); // depends on control dependency: [if], data = [none] } Criteria criteria = this.dao.newCriteria(UserPermission.class).add(Restrictions.eq("user", user)) .add(Restrictions.eq("company", domain.getCompany())).add(Restrictions.eq("revoked", false)); return this.dao.findByCriteria(criteria, UserPermission.class); } }
public class class_name { Item newInvokeDynamicItem(final String name, final String desc, final Handle bsm, final Object... bsmArgs) { // cache for performance ByteVector bootstrapMethods = this.bootstrapMethods; if (bootstrapMethods == null) { bootstrapMethods = this.bootstrapMethods = new ByteVector(); } int position = bootstrapMethods.length; // record current position int hashCode = bsm.hashCode(); bootstrapMethods.putShort(newHandle(bsm.tag, bsm.owner, bsm.name, bsm.desc, bsm.isInterface())); int argsLength = bsmArgs.length; bootstrapMethods.putShort(argsLength); for (int i = 0; i < argsLength; i++) { Object bsmArg = bsmArgs[i]; hashCode ^= bsmArg.hashCode(); bootstrapMethods.putShort(newConst(bsmArg)); } byte[] data = bootstrapMethods.data; int length = (1 + 1 + argsLength) << 1; // (bsm + argCount + arguments) hashCode &= 0x7FFFFFFF; Item result = items[hashCode % items.length]; loop: while (result != null) { if (result.type != BSM || result.hashCode != hashCode) { result = result.next; continue; } // because the data encode the size of the argument // we don't need to test if these size are equals int resultPosition = result.intVal; for (int p = 0; p < length; p++) { if (data[position + p] != data[resultPosition + p]) { result = result.next; continue loop; } } break; } int bootstrapMethodIndex; if (result != null) { bootstrapMethodIndex = result.index; bootstrapMethods.length = position; // revert to old position } else { bootstrapMethodIndex = bootstrapMethodsCount++; result = new Item(bootstrapMethodIndex); result.set(position, hashCode); put(result); } // now, create the InvokeDynamic constant key3.set(name, desc, bootstrapMethodIndex); result = get(key3); if (result == null) { put122(INDY, bootstrapMethodIndex, newNameType(name, desc)); result = new Item(index++, key3); put(result); } return result; } }
public class class_name { Item newInvokeDynamicItem(final String name, final String desc, final Handle bsm, final Object... bsmArgs) { // cache for performance ByteVector bootstrapMethods = this.bootstrapMethods; if (bootstrapMethods == null) { bootstrapMethods = this.bootstrapMethods = new ByteVector(); // depends on control dependency: [if], data = [none] } int position = bootstrapMethods.length; // record current position int hashCode = bsm.hashCode(); bootstrapMethods.putShort(newHandle(bsm.tag, bsm.owner, bsm.name, bsm.desc, bsm.isInterface())); int argsLength = bsmArgs.length; bootstrapMethods.putShort(argsLength); for (int i = 0; i < argsLength; i++) { Object bsmArg = bsmArgs[i]; hashCode ^= bsmArg.hashCode(); // depends on control dependency: [for], data = [none] bootstrapMethods.putShort(newConst(bsmArg)); // depends on control dependency: [for], data = [none] } byte[] data = bootstrapMethods.data; int length = (1 + 1 + argsLength) << 1; // (bsm + argCount + arguments) hashCode &= 0x7FFFFFFF; Item result = items[hashCode % items.length]; loop: while (result != null) { if (result.type != BSM || result.hashCode != hashCode) { result = result.next; // depends on control dependency: [if], data = [none] continue; } // because the data encode the size of the argument // we don't need to test if these size are equals int resultPosition = result.intVal; for (int p = 0; p < length; p++) { if (data[position + p] != data[resultPosition + p]) { result = result.next; // depends on control dependency: [if], data = [none] continue loop; } } break; } int bootstrapMethodIndex; if (result != null) { bootstrapMethodIndex = result.index; // depends on control dependency: [if], data = [none] bootstrapMethods.length = position; // revert to old position // depends on control dependency: [if], data = [none] } else { bootstrapMethodIndex = bootstrapMethodsCount++; // depends on control dependency: [if], data = [none] result = new Item(bootstrapMethodIndex); // depends on control dependency: [if], data = [none] result.set(position, hashCode); // depends on control dependency: [if], data = [none] put(result); // depends on control dependency: [if], data = [(result] } // now, create the InvokeDynamic constant key3.set(name, desc, bootstrapMethodIndex); result = get(key3); if (result == null) { put122(INDY, bootstrapMethodIndex, newNameType(name, desc)); // depends on control dependency: [if], data = [none] result = new Item(index++, key3); // depends on control dependency: [if], data = [none] put(result); // depends on control dependency: [if], data = [(result] } return result; } }
public class class_name { public static Frame create(String[] headers, double[][] rows) { Futures fs = new Futures(); Vec[] vecs = new Vec[rows[0].length]; Key keys[] = new Vec.VectorGroup().addVecs(vecs.length); for( int c = 0; c < vecs.length; c++ ) { AppendableVec vec = new AppendableVec(keys[c]); NewChunk chunk = new NewChunk(vec, 0); for( int r = 0; r < rows.length; r++ ) chunk.addNum(rows[r][c]); chunk.close(0, fs); vecs[c] = vec.close(fs); } fs.blockForPending(); return new Frame(headers, vecs); } }
public class class_name { public static Frame create(String[] headers, double[][] rows) { Futures fs = new Futures(); Vec[] vecs = new Vec[rows[0].length]; Key keys[] = new Vec.VectorGroup().addVecs(vecs.length); for( int c = 0; c < vecs.length; c++ ) { AppendableVec vec = new AppendableVec(keys[c]); NewChunk chunk = new NewChunk(vec, 0); for( int r = 0; r < rows.length; r++ ) chunk.addNum(rows[r][c]); chunk.close(0, fs); // depends on control dependency: [for], data = [none] vecs[c] = vec.close(fs); // depends on control dependency: [for], data = [c] } fs.blockForPending(); return new Frame(headers, vecs); } }
public class class_name { private static <T extends Annotation> void insertAnnotationValues(Annotation annotation, Class<T> annotationClass, ArrayList<T> unfoldedAnnotations) { // annotation is a complex annotation which has elements of instance annotationClass // (whose static type is T). // // @interface SomeName { <--- = annotation.getClass() // ... // T[] value(); <--- T.class == annotationClass // } // // Use reflection to access these values. Class<T[]> annotationArrayClass = (Class<T[]>)((T[])Array.newInstance(annotationClass, 0)).getClass(); Method valuesMethod; try { valuesMethod = annotation.getClass().getDeclaredMethod("value"); // This will always succeed unless the annotation and its repeatable annotation class were // recompiled separately, then this is a binary incompatibility error. } catch (NoSuchMethodException e) { throw new AssertionError("annotation container = " + annotation + "annotation element class = " + annotationClass + "; missing value() method"); } catch (SecurityException e) { throw new IncompleteAnnotationException(annotation.getClass(), "value"); } // Ensure that value() returns a T[] if (!valuesMethod.getReturnType().isArray()) { throw new AssertionError("annotation container = " + annotation + "annotation element class = " + annotationClass + "; value() doesn't return array"); } // Ensure that the T[] value() is actually the correct type (T==annotationClass). if (!annotationClass.equals(valuesMethod.getReturnType().getComponentType())) { throw new AssertionError("annotation container = " + annotation + "annotation element class = " + annotationClass + "; value() returns incorrect type"); } // Append those values into the existing list. T[] nestedAnnotations; try { nestedAnnotations = (T[])valuesMethod.invoke(annotation); // Safe because of #getMethod. } catch (IllegalAccessException|InvocationTargetException e) { throw new AssertionError(e); } for (int i = 0; i < nestedAnnotations.length; ++i) { unfoldedAnnotations.add(nestedAnnotations[i]); } } }
public class class_name { private static <T extends Annotation> void insertAnnotationValues(Annotation annotation, Class<T> annotationClass, ArrayList<T> unfoldedAnnotations) { // annotation is a complex annotation which has elements of instance annotationClass // (whose static type is T). // // @interface SomeName { <--- = annotation.getClass() // ... // T[] value(); <--- T.class == annotationClass // } // // Use reflection to access these values. Class<T[]> annotationArrayClass = (Class<T[]>)((T[])Array.newInstance(annotationClass, 0)).getClass(); Method valuesMethod; try { valuesMethod = annotation.getClass().getDeclaredMethod("value"); // depends on control dependency: [try], data = [none] // This will always succeed unless the annotation and its repeatable annotation class were // recompiled separately, then this is a binary incompatibility error. } catch (NoSuchMethodException e) { throw new AssertionError("annotation container = " + annotation + "annotation element class = " + annotationClass + "; missing value() method"); } catch (SecurityException e) { // depends on control dependency: [catch], data = [none] throw new IncompleteAnnotationException(annotation.getClass(), "value"); } // depends on control dependency: [catch], data = [none] // Ensure that value() returns a T[] if (!valuesMethod.getReturnType().isArray()) { throw new AssertionError("annotation container = " + annotation + "annotation element class = " + annotationClass + "; value() doesn't return array"); } // Ensure that the T[] value() is actually the correct type (T==annotationClass). if (!annotationClass.equals(valuesMethod.getReturnType().getComponentType())) { throw new AssertionError("annotation container = " + annotation + "annotation element class = " + annotationClass + "; value() returns incorrect type"); } // Append those values into the existing list. T[] nestedAnnotations; try { nestedAnnotations = (T[])valuesMethod.invoke(annotation); // Safe because of #getMethod. // depends on control dependency: [try], data = [none] } catch (IllegalAccessException|InvocationTargetException e) { throw new AssertionError(e); } // depends on control dependency: [catch], data = [none] for (int i = 0; i < nestedAnnotations.length; ++i) { unfoldedAnnotations.add(nestedAnnotations[i]); // depends on control dependency: [for], data = [i] } } }
public class class_name { public static String getRelativePath(final File baseDir, final File dir) { checkNotNull("baseDir", baseDir); checkNotNull("dir", dir); final String base = getCanonicalPath(baseDir); final String path = getCanonicalPath(dir); if (!path.startsWith(base)) { throw new IllegalArgumentException("The path '" + path + "' is not inside the base directory '" + base + "'!"); } if (base.equals(path)) { return ""; } return path.substring(base.length() + 1); } }
public class class_name { public static String getRelativePath(final File baseDir, final File dir) { checkNotNull("baseDir", baseDir); checkNotNull("dir", dir); final String base = getCanonicalPath(baseDir); final String path = getCanonicalPath(dir); if (!path.startsWith(base)) { throw new IllegalArgumentException("The path '" + path + "' is not inside the base directory '" + base + "'!"); } if (base.equals(path)) { return ""; // depends on control dependency: [if], data = [none] } return path.substring(base.length() + 1); } }
public class class_name { public static boolean getBooleanProperty(@Nonnull LogManager manager, @Nullable String name, boolean defaultValue) { if (name == null) { return defaultValue; } String val = manager.getProperty(name); if (val == null) { return defaultValue; } val = val.toLowerCase(); if (val.equals("true") || val.equals("1")) { return true; } else if (val.equals("false") || val.equals("0")) { return false; } return defaultValue; } }
public class class_name { public static boolean getBooleanProperty(@Nonnull LogManager manager, @Nullable String name, boolean defaultValue) { if (name == null) { return defaultValue; // depends on control dependency: [if], data = [none] } String val = manager.getProperty(name); if (val == null) { return defaultValue; // depends on control dependency: [if], data = [none] } val = val.toLowerCase(); if (val.equals("true") || val.equals("1")) { return true; // depends on control dependency: [if], data = [none] } else if (val.equals("false") || val.equals("0")) { return false; // depends on control dependency: [if], data = [none] } return defaultValue; } }
public class class_name { @JsIgnore public static void initWithoutVueLib() { if (!isVueLibInjected()) { throw new RuntimeException( "Couldn't find Vue.js on init. Either include it Vue.js in your index.html or call VueGWT.init() instead of initWithoutVueLib."); } // Register custom observers for Collection and Maps VueGWTObserverManager.get().registerVueGWTObserver(new CollectionObserver()); VueGWTObserverManager.get().registerVueGWTObserver(new MapObserver()); isReady = true; // Call on ready callbacks for (Runnable onReadyCbk : onReadyCallbacks) { onReadyCbk.run(); } onReadyCallbacks.clear(); } }
public class class_name { @JsIgnore public static void initWithoutVueLib() { if (!isVueLibInjected()) { throw new RuntimeException( "Couldn't find Vue.js on init. Either include it Vue.js in your index.html or call VueGWT.init() instead of initWithoutVueLib."); } // Register custom observers for Collection and Maps VueGWTObserverManager.get().registerVueGWTObserver(new CollectionObserver()); VueGWTObserverManager.get().registerVueGWTObserver(new MapObserver()); isReady = true; // Call on ready callbacks for (Runnable onReadyCbk : onReadyCallbacks) { onReadyCbk.run(); // depends on control dependency: [for], data = [onReadyCbk] } onReadyCallbacks.clear(); } }
public class class_name { public void removeRemedyIndex(RemedyIndexEventData data) { String path = StagePathUtils.getRemedyRoot(data.getPipelineId()); try { zookeeper.delete(path + "/" + RemedyIndexEventData.formatNodeName(data)); } catch (ZkNoNodeException e) { // ignore } catch (ZkException e) { throw new ArbitrateException("removeRemedyIndex", data.getPipelineId().toString(), e); } } }
public class class_name { public void removeRemedyIndex(RemedyIndexEventData data) { String path = StagePathUtils.getRemedyRoot(data.getPipelineId()); try { zookeeper.delete(path + "/" + RemedyIndexEventData.formatNodeName(data)); // depends on control dependency: [try], data = [none] } catch (ZkNoNodeException e) { // ignore } catch (ZkException e) { // depends on control dependency: [catch], data = [none] throw new ArbitrateException("removeRemedyIndex", data.getPipelineId().toString(), e); } // depends on control dependency: [catch], data = [none] } }