code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public ThingTypeProperties withSearchableAttributes(String... searchableAttributes) { if (this.searchableAttributes == null) { setSearchableAttributes(new java.util.ArrayList<String>(searchableAttributes.length)); } for (String ele : searchableAttributes) { this.searchableAttributes.add(ele); } return this; } }
public class class_name { public ThingTypeProperties withSearchableAttributes(String... searchableAttributes) { if (this.searchableAttributes == null) { setSearchableAttributes(new java.util.ArrayList<String>(searchableAttributes.length)); // depends on control dependency: [if], data = [none] } for (String ele : searchableAttributes) { this.searchableAttributes.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public void marshall(Permission permission, ProtocolMarshaller protocolMarshaller) { if (permission == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(permission.getGranteeId(), GRANTEEID_BINDING); protocolMarshaller.marshall(permission.getGranteeType(), GRANTEETYPE_BINDING); protocolMarshaller.marshall(permission.getPermissionValues(), PERMISSIONVALUES_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(Permission permission, ProtocolMarshaller protocolMarshaller) { if (permission == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(permission.getGranteeId(), GRANTEEID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(permission.getGranteeType(), GRANTEETYPE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(permission.getPermissionValues(), PERMISSIONVALUES_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public boolean voteDown(ParaObject obj, String voterid) { if (obj == null || StringUtils.isBlank(voterid)) { return false; } return getEntity(invokePatch(obj.getType().concat("/").concat(obj.getId()), Entity.json(Collections.singletonMap("_votedown", voterid))), Boolean.class); } }
public class class_name { public boolean voteDown(ParaObject obj, String voterid) { if (obj == null || StringUtils.isBlank(voterid)) { return false; // depends on control dependency: [if], data = [none] } return getEntity(invokePatch(obj.getType().concat("/").concat(obj.getId()), Entity.json(Collections.singletonMap("_votedown", voterid))), Boolean.class); } }
public class class_name { public static Point findImage(int[] imagePixels, int imageWidth, int imageHeight, int[] findmePixels, int findmeWidth, int findmeHeight, double tolerance) { final int searchWidth = imageWidth - findmeWidth; if(searchWidth >= 0) { final int searchHeight = imageHeight - findmeHeight; if(searchHeight >= 0) { // Each pixel can deviate by up to 255 for each primary color final double maxDeviation = (double)3 * (double)255 * (double)findmeWidth * (double)findmeHeight; final long maxMismatch = (long)(tolerance * maxDeviation); // Get pixels all at once for(int imageY = 0; imageY <= searchHeight; imageY++) { NextLocation : for(int imageX = 0; imageX <= searchWidth; imageX++) { long totalMismatch = 0; int findMeIndex = 0; for(int findmeY=0; findmeY<findmeHeight; findmeY++) { for(int findmeX=0; findmeX<findmeWidth; findmeX++) { int imagePixel = imagePixels[(imageY + findmeY) * imageWidth + imageX + findmeX]; int findmePixel = findmePixels[findMeIndex++]; if( // Check for exact match imagePixel != findmePixel // If either is full alpha, consider a match && (imagePixel & 0xff000000)!=0 && (findmePixel & 0xff000000)!=0 ) { totalMismatch += // Red difference Math.abs(((imagePixel >>> 16) & 255) - ((findmePixel >>> 16) & 255)) // Green difference + Math.abs(((imagePixel >>> 8) & 255) - ((findmePixel >>> 8) & 255)) // Blue difference + Math.abs((imagePixel & 255) - (findmePixel & 255)) ; if(totalMismatch > maxMismatch) continue NextLocation; } } } return new Point(imageX, imageY); } } } } return null; } }
public class class_name { public static Point findImage(int[] imagePixels, int imageWidth, int imageHeight, int[] findmePixels, int findmeWidth, int findmeHeight, double tolerance) { final int searchWidth = imageWidth - findmeWidth; if(searchWidth >= 0) { final int searchHeight = imageHeight - findmeHeight; if(searchHeight >= 0) { // Each pixel can deviate by up to 255 for each primary color final double maxDeviation = (double)3 * (double)255 * (double)findmeWidth * (double)findmeHeight; final long maxMismatch = (long)(tolerance * maxDeviation); // Get pixels all at once for(int imageY = 0; imageY <= searchHeight; imageY++) { NextLocation : for(int imageX = 0; imageX <= searchWidth; imageX++) { long totalMismatch = 0; int findMeIndex = 0; for(int findmeY=0; findmeY<findmeHeight; findmeY++) { for(int findmeX=0; findmeX<findmeWidth; findmeX++) { int imagePixel = imagePixels[(imageY + findmeY) * imageWidth + imageX + findmeX]; int findmePixel = findmePixels[findMeIndex++]; if( // Check for exact match imagePixel != findmePixel // If either is full alpha, consider a match && (imagePixel & 0xff000000)!=0 && (findmePixel & 0xff000000)!=0 ) { totalMismatch += // Red difference Math.abs(((imagePixel >>> 16) & 255) - ((findmePixel >>> 16) & 255)) // Green difference + Math.abs(((imagePixel >>> 8) & 255) - ((findmePixel >>> 8) & 255)) // Blue difference + Math.abs((imagePixel & 255) - (findmePixel & 255)) ; // depends on control dependency: [if], data = [] if(totalMismatch > maxMismatch) continue NextLocation; } } } return new Point(imageX, imageY); // depends on control dependency: [for], data = [imageX] } } } } return null; } }
public class class_name { private String[] getRequestedFileExtensions(MediaArgs mediaArgs) { // get file extension defined in media args Set<String> mediaArgsFileExtensions = new HashSet<String>(); if (mediaArgs.getFileExtensions() != null && mediaArgs.getFileExtensions().length > 0) { mediaArgsFileExtensions.addAll(ImmutableList.copyOf(mediaArgs.getFileExtensions())); } // get file extensions from media formats final Set<String> mediaFormatFileExtensions = new HashSet<String>(); visitMediaFormats(mediaArgs, new MediaFormatVisitor<Object>() { @Override public Object visit(MediaFormat mediaFormat) { if (mediaFormat.getExtensions() != null && mediaFormat.getExtensions().length > 0) { mediaFormatFileExtensions.addAll(ImmutableList.copyOf(mediaFormat.getExtensions())); } return null; } }); // if extensions are defined both in mediaargs and media formats use intersection of both final String[] fileExtensions; if (!mediaArgsFileExtensions.isEmpty() && !mediaFormatFileExtensions.isEmpty()) { Collection<String> intersection = Sets.intersection(mediaArgsFileExtensions, mediaFormatFileExtensions); if (intersection.isEmpty()) { // not intersected file extensions - return null to singal no valid file extension request return null; } else { fileExtensions = intersection.toArray(new String[intersection.size()]); } } else if (!mediaArgsFileExtensions.isEmpty()) { fileExtensions = mediaArgsFileExtensions.toArray(new String[mediaArgsFileExtensions.size()]); } else { fileExtensions = mediaFormatFileExtensions.toArray(new String[mediaFormatFileExtensions.size()]); } return fileExtensions; } }
public class class_name { private String[] getRequestedFileExtensions(MediaArgs mediaArgs) { // get file extension defined in media args Set<String> mediaArgsFileExtensions = new HashSet<String>(); if (mediaArgs.getFileExtensions() != null && mediaArgs.getFileExtensions().length > 0) { mediaArgsFileExtensions.addAll(ImmutableList.copyOf(mediaArgs.getFileExtensions())); // depends on control dependency: [if], data = [(mediaArgs.getFileExtensions()] } // get file extensions from media formats final Set<String> mediaFormatFileExtensions = new HashSet<String>(); visitMediaFormats(mediaArgs, new MediaFormatVisitor<Object>() { @Override public Object visit(MediaFormat mediaFormat) { if (mediaFormat.getExtensions() != null && mediaFormat.getExtensions().length > 0) { mediaFormatFileExtensions.addAll(ImmutableList.copyOf(mediaFormat.getExtensions())); // depends on control dependency: [if], data = [(mediaFormat.getExtensions()] } return null; } }); // if extensions are defined both in mediaargs and media formats use intersection of both final String[] fileExtensions; if (!mediaArgsFileExtensions.isEmpty() && !mediaFormatFileExtensions.isEmpty()) { Collection<String> intersection = Sets.intersection(mediaArgsFileExtensions, mediaFormatFileExtensions); if (intersection.isEmpty()) { // not intersected file extensions - return null to singal no valid file extension request return null; // depends on control dependency: [if], data = [none] } else { fileExtensions = intersection.toArray(new String[intersection.size()]); // depends on control dependency: [if], data = [none] } } else if (!mediaArgsFileExtensions.isEmpty()) { fileExtensions = mediaArgsFileExtensions.toArray(new String[mediaArgsFileExtensions.size()]); // depends on control dependency: [if], data = [none] } else { fileExtensions = mediaFormatFileExtensions.toArray(new String[mediaFormatFileExtensions.size()]); // depends on control dependency: [if], data = [none] } return fileExtensions; } }
public class class_name { protected void iterateContributor(Counter counter, Element parent, java.util.Collection list, java.lang.String parentTag, java.lang.String childTag) { boolean shouldExist = (list != null) && (list.size() > 0); Element element = updateElement(counter, parent, parentTag, shouldExist); if (shouldExist) { Iterator it = list.iterator(); Iterator elIt = element.getChildren(childTag, element.getNamespace()).iterator(); if (!elIt.hasNext()) { elIt = null; } Counter innerCount = new Counter(counter.getDepth() + 1); while (it.hasNext()) { Contributor value = (Contributor) it.next(); Element el; if ((elIt != null) && elIt.hasNext()) { el = (Element) elIt.next(); if (!elIt.hasNext()) { elIt = null; } } else { el = factory.element(childTag, element.getNamespace()); insertAtPreferredLocation(element, el, innerCount); } updateContributor(value, childTag, innerCount, el); innerCount.increaseCount(); } if (elIt != null) { while (elIt.hasNext()) { elIt.next(); elIt.remove(); } } } } }
public class class_name { protected void iterateContributor(Counter counter, Element parent, java.util.Collection list, java.lang.String parentTag, java.lang.String childTag) { boolean shouldExist = (list != null) && (list.size() > 0); Element element = updateElement(counter, parent, parentTag, shouldExist); if (shouldExist) { Iterator it = list.iterator(); Iterator elIt = element.getChildren(childTag, element.getNamespace()).iterator(); if (!elIt.hasNext()) { elIt = null; // depends on control dependency: [if], data = [none] } Counter innerCount = new Counter(counter.getDepth() + 1); while (it.hasNext()) { Contributor value = (Contributor) it.next(); Element el; if ((elIt != null) && elIt.hasNext()) { el = (Element) elIt.next(); // depends on control dependency: [if], data = [none] if (!elIt.hasNext()) { elIt = null; // depends on control dependency: [if], data = [none] } } else { el = factory.element(childTag, element.getNamespace()); // depends on control dependency: [if], data = [none] insertAtPreferredLocation(element, el, innerCount); // depends on control dependency: [if], data = [none] } updateContributor(value, childTag, innerCount, el); // depends on control dependency: [while], data = [none] innerCount.increaseCount(); // depends on control dependency: [while], data = [none] } if (elIt != null) { while (elIt.hasNext()) { elIt.next(); // depends on control dependency: [while], data = [none] elIt.remove(); // depends on control dependency: [while], data = [none] } } } } }
public class class_name { private String getRelativePomPath(MavenModule mavenModule, MavenModuleSetBuild mavenBuild) { String relativePath = mavenModule.getRelativePath(); if (StringUtils.isBlank(relativePath)) { return POM_NAME; } // If this is the root module, return the root pom path. if (mavenModule.getModuleName().toString(). equals(mavenBuild.getProject().getRootModule().getModuleName().toString())) { return mavenBuild.getProject().getRootPOM(null); } // to remove the project folder name if exists // keeps only the name of the module String modulePath = relativePath.substring(relativePath.indexOf("/") + 1); for (String moduleName : mavenModules) { if (moduleName.contains(modulePath)) { return createPomPath(relativePath, moduleName); } } // In case this module is not in the parent pom return relativePath + "/" + POM_NAME; } }
public class class_name { private String getRelativePomPath(MavenModule mavenModule, MavenModuleSetBuild mavenBuild) { String relativePath = mavenModule.getRelativePath(); if (StringUtils.isBlank(relativePath)) { return POM_NAME; // depends on control dependency: [if], data = [none] } // If this is the root module, return the root pom path. if (mavenModule.getModuleName().toString(). equals(mavenBuild.getProject().getRootModule().getModuleName().toString())) { return mavenBuild.getProject().getRootPOM(null); // depends on control dependency: [if], data = [none] } // to remove the project folder name if exists // keeps only the name of the module String modulePath = relativePath.substring(relativePath.indexOf("/") + 1); for (String moduleName : mavenModules) { if (moduleName.contains(modulePath)) { return createPomPath(relativePath, moduleName); // depends on control dependency: [if], data = [none] } } // In case this module is not in the parent pom return relativePath + "/" + POM_NAME; } }
public class class_name { public static Thread findThreadById(final long threadId, final String threadGroupName) { Validate.isTrue(threadGroupName != null, "The thread group name must not be null"); final Thread thread = findThreadById(threadId); if(thread != null && thread.getThreadGroup() != null && thread.getThreadGroup().getName().equals(threadGroupName)) { return thread; } return null; } }
public class class_name { public static Thread findThreadById(final long threadId, final String threadGroupName) { Validate.isTrue(threadGroupName != null, "The thread group name must not be null"); final Thread thread = findThreadById(threadId); if(thread != null && thread.getThreadGroup() != null && thread.getThreadGroup().getName().equals(threadGroupName)) { return thread; // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { private boolean tryPath(StringBuilder prefix, String el, boolean dir) { String path = prefix + "/" + el; if (dir && directoryBrowsingDisallowed) { path += "/" + xsltdirMarkerName; } if (debug()) { debug("trypath: " + path); } try { URL u = new URL(path); URLConnection uc = u.openConnection(); if (!(uc instanceof HttpURLConnection)) { return false; } HttpURLConnection huc = (HttpURLConnection)uc; if (huc.getResponseCode() != 200) { return false; } prefix.append("/"); prefix.append(el); return true; } catch (final Throwable t) { if (debug()) { debug("trypath exception: "); error(t); } } return false; } }
public class class_name { private boolean tryPath(StringBuilder prefix, String el, boolean dir) { String path = prefix + "/" + el; if (dir && directoryBrowsingDisallowed) { path += "/" + xsltdirMarkerName; // depends on control dependency: [if], data = [none] } if (debug()) { debug("trypath: " + path); // depends on control dependency: [if], data = [none] } try { URL u = new URL(path); URLConnection uc = u.openConnection(); if (!(uc instanceof HttpURLConnection)) { return false; // depends on control dependency: [if], data = [none] } HttpURLConnection huc = (HttpURLConnection)uc; if (huc.getResponseCode() != 200) { return false; // depends on control dependency: [if], data = [none] } prefix.append("/"); // depends on control dependency: [try], data = [none] prefix.append(el); // depends on control dependency: [try], data = [none] return true; // depends on control dependency: [try], data = [none] } catch (final Throwable t) { if (debug()) { debug("trypath exception: "); // depends on control dependency: [if], data = [none] error(t); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] return false; } }
public class class_name { public int[] getNext () { if (numLeft.equals (total)) { numLeft = numLeft.subtract (BigInteger.ONE); return a; } int temp; // Find largest index j with a[j] < a[j+1] int j = a.length - 2; while (a[j] > a[j+1]) { j--; } // Find index k such that a[k] is smallest integer // greater than a[j] to the right of a[j] int k = a.length - 1; while (a[j] > a[k]) { k--; } // Interchange a[j] and a[k] temp = a[k]; a[k] = a[j]; a[j] = temp; // Put tail end of permutation after jth position in increasing order int r = a.length - 1; int s = j + 1; while (r > s) { temp = a[s]; a[s] = a[r]; a[r] = temp; r--; s++; } numLeft = numLeft.subtract (BigInteger.ONE); return a; } }
public class class_name { public int[] getNext () { if (numLeft.equals (total)) { numLeft = numLeft.subtract (BigInteger.ONE); // depends on control dependency: [if], data = [none] return a; // depends on control dependency: [if], data = [none] } int temp; // Find largest index j with a[j] < a[j+1] int j = a.length - 2; while (a[j] > a[j+1]) { j--; // depends on control dependency: [while], data = [none] } // Find index k such that a[k] is smallest integer // greater than a[j] to the right of a[j] int k = a.length - 1; while (a[j] > a[k]) { k--; // depends on control dependency: [while], data = [none] } // Interchange a[j] and a[k] temp = a[k]; a[k] = a[j]; a[j] = temp; // Put tail end of permutation after jth position in increasing order int r = a.length - 1; int s = j + 1; while (r > s) { temp = a[s]; // depends on control dependency: [while], data = [none] a[s] = a[r]; // depends on control dependency: [while], data = [none] a[r] = temp; // depends on control dependency: [while], data = [none] r--; // depends on control dependency: [while], data = [none] s++; // depends on control dependency: [while], data = [none] } numLeft = numLeft.subtract (BigInteger.ONE); return a; } }
public class class_name { private boolean isSegment(SNode currNode) { List<SRelation<SNode, SNode>> edges = currNode.getGraph().getOutRelations(currNode.getId()); if (edges != null && edges.size() > 0) { for (SRelation<SNode, SNode> edge : edges) { if (edge.getTarget() instanceof SToken) { return true; } } } return false; } }
public class class_name { private boolean isSegment(SNode currNode) { List<SRelation<SNode, SNode>> edges = currNode.getGraph().getOutRelations(currNode.getId()); if (edges != null && edges.size() > 0) { for (SRelation<SNode, SNode> edge : edges) { if (edge.getTarget() instanceof SToken) { return true; // depends on control dependency: [if], data = [none] } } } return false; } }
public class class_name { public @NotNull IntAssert isGreaterThan(int other) { if (actual > other) { return this; } failIfCustomMessageIsSet(); throw failure(unexpectedLessThanOrEqualTo(actual, other)); } }
public class class_name { public @NotNull IntAssert isGreaterThan(int other) { if (actual > other) { return this; // depends on control dependency: [if], data = [none] } failIfCustomMessageIsSet(); throw failure(unexpectedLessThanOrEqualTo(actual, other)); } }
public class class_name { private Session createConnection() { /* reorder locations */ List<String> locations = Lists.newArrayList(split.getReplicas()); Collections.sort(locations, new DeepPartitionLocationComparator()); Exception lastException = null; LOG.debug("createConnection: " + locations); for (String location : locations) { try { return trySessionForLocation(location, config, false).left; } catch (Exception e) { LOG.error("Could not get connection for: {}, replicas: {}", location, locations); lastException = e; } } throw new DeepIOException(lastException); } }
public class class_name { private Session createConnection() { /* reorder locations */ List<String> locations = Lists.newArrayList(split.getReplicas()); Collections.sort(locations, new DeepPartitionLocationComparator()); Exception lastException = null; LOG.debug("createConnection: " + locations); for (String location : locations) { try { return trySessionForLocation(location, config, false).left; // depends on control dependency: [try], data = [none] } catch (Exception e) { LOG.error("Could not get connection for: {}, replicas: {}", location, locations); lastException = e; } // depends on control dependency: [catch], data = [none] } throw new DeepIOException(lastException); } }
public class class_name { private void displaySuperToast(SuperToast superToast) { // Make sure the SuperToast isn't already showing for some reason if (superToast.isShowing()) return; // If the SuperToast is a SuperActivityToast, show it via the supplied ViewGroup if (superToast instanceof SuperActivityToast) { if (((SuperActivityToast) superToast).getViewGroup() == null) { Log.e(getClass().getName(), ERROR_SAT_VIEWGROUP_NULL); return; } try { ((SuperActivityToast) superToast).getViewGroup().addView(superToast.getView()); // Do not use the show animation on the first SuperToast if from orientation change if (!((SuperActivityToast) superToast).isFromOrientationChange()) { AnimationUtils.getShowAnimation((SuperActivityToast) superToast).start(); } } catch (IllegalStateException illegalStateException) { Log.e(getClass().getName(), illegalStateException.toString()); } if (!((SuperActivityToast) superToast).isIndeterminate()) { // This will remove the SuperToast after the total duration sendDelayedMessage(superToast, Messages.REMOVE_SUPERTOAST, superToast.getDuration() + AnimationUtils.SHOW_DURATION); } // The SuperToast is NOT a SuperActivityToast, show it via the WindowManager } else { final WindowManager windowManager = (WindowManager) superToast.getContext() .getApplicationContext().getSystemService(Context.WINDOW_SERVICE); if (windowManager != null) { windowManager.addView(superToast.getView(), superToast.getWindowManagerParams()); } // This will remove the SuperToast after a certain duration sendDelayedMessage(superToast, Messages.REMOVE_SUPERTOAST, superToast.getDuration() + AnimationUtils.SHOW_DURATION); } } }
public class class_name { private void displaySuperToast(SuperToast superToast) { // Make sure the SuperToast isn't already showing for some reason if (superToast.isShowing()) return; // If the SuperToast is a SuperActivityToast, show it via the supplied ViewGroup if (superToast instanceof SuperActivityToast) { if (((SuperActivityToast) superToast).getViewGroup() == null) { Log.e(getClass().getName(), ERROR_SAT_VIEWGROUP_NULL); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } try { ((SuperActivityToast) superToast).getViewGroup().addView(superToast.getView()); // depends on control dependency: [try], data = [none] // Do not use the show animation on the first SuperToast if from orientation change if (!((SuperActivityToast) superToast).isFromOrientationChange()) { AnimationUtils.getShowAnimation((SuperActivityToast) superToast).start(); // depends on control dependency: [if], data = [none] } } catch (IllegalStateException illegalStateException) { Log.e(getClass().getName(), illegalStateException.toString()); } // depends on control dependency: [catch], data = [none] if (!((SuperActivityToast) superToast).isIndeterminate()) { // This will remove the SuperToast after the total duration sendDelayedMessage(superToast, Messages.REMOVE_SUPERTOAST, superToast.getDuration() + AnimationUtils.SHOW_DURATION); // depends on control dependency: [if], data = [none] } // The SuperToast is NOT a SuperActivityToast, show it via the WindowManager } else { final WindowManager windowManager = (WindowManager) superToast.getContext() .getApplicationContext().getSystemService(Context.WINDOW_SERVICE); if (windowManager != null) { windowManager.addView(superToast.getView(), superToast.getWindowManagerParams()); // depends on control dependency: [if], data = [none] } // This will remove the SuperToast after a certain duration sendDelayedMessage(superToast, Messages.REMOVE_SUPERTOAST, superToast.getDuration() + AnimationUtils.SHOW_DURATION); // depends on control dependency: [if], data = [none] } } }
public class class_name { public int[] getRoles() { List<Integer> roles = new ArrayList<Integer>(); for(int i = 0; i < data.length; i++) { if(data[i] != null) { roles.add(i); } } int[] res = new int[roles.size()]; for(int i = 0; i < res.length; i++) { res[i] = roles.get(i); } return res; } }
public class class_name { public int[] getRoles() { List<Integer> roles = new ArrayList<Integer>(); for(int i = 0; i < data.length; i++) { if(data[i] != null) { roles.add(i); // depends on control dependency: [if], data = [none] } } int[] res = new int[roles.size()]; for(int i = 0; i < res.length; i++) { res[i] = roles.get(i); // depends on control dependency: [for], data = [i] } return res; } }
public class class_name { private Size parseAtomicSize(String token) { String trimmedToken = token.trim(); if (trimmedToken.startsWith("'") && trimmedToken.endsWith("'")) { int length = trimmedToken.length(); if (length < 2) { throw new IllegalArgumentException("Missing closing \"'\" for prototype."); } return new PrototypeSize(trimmedToken.substring(1, length - 1)); } Sizes.ComponentSize componentSize = Sizes.ComponentSize.valueOf(trimmedToken); if (componentSize != null) { return componentSize; } return ConstantSize.valueOf(trimmedToken, isHorizontal()); } }
public class class_name { private Size parseAtomicSize(String token) { String trimmedToken = token.trim(); if (trimmedToken.startsWith("'") && trimmedToken.endsWith("'")) { int length = trimmedToken.length(); if (length < 2) { throw new IllegalArgumentException("Missing closing \"'\" for prototype."); } return new PrototypeSize(trimmedToken.substring(1, length - 1)); // depends on control dependency: [if], data = [none] } Sizes.ComponentSize componentSize = Sizes.ComponentSize.valueOf(trimmedToken); if (componentSize != null) { return componentSize; // depends on control dependency: [if], data = [none] } return ConstantSize.valueOf(trimmedToken, isHorizontal()); } }
public class class_name { public List<JAXBElement<Object>> get_GenericApplicationPropertyOfIntBridgeInstallation() { if (_GenericApplicationPropertyOfIntBridgeInstallation == null) { _GenericApplicationPropertyOfIntBridgeInstallation = new ArrayList<JAXBElement<Object>>(); } return this._GenericApplicationPropertyOfIntBridgeInstallation; } }
public class class_name { public List<JAXBElement<Object>> get_GenericApplicationPropertyOfIntBridgeInstallation() { if (_GenericApplicationPropertyOfIntBridgeInstallation == null) { _GenericApplicationPropertyOfIntBridgeInstallation = new ArrayList<JAXBElement<Object>>(); // depends on control dependency: [if], data = [none] } return this._GenericApplicationPropertyOfIntBridgeInstallation; } }
public class class_name { public static Object parseKeepingOrder(Reader in) { try { return new JSONParser(DEFAULT_PERMISSIVE_MODE).parse(in, defaultReader.DEFAULT_ORDERED); } catch (Exception e) { return null; } } }
public class class_name { public static Object parseKeepingOrder(Reader in) { try { return new JSONParser(DEFAULT_PERMISSIVE_MODE).parse(in, defaultReader.DEFAULT_ORDERED); // depends on control dependency: [try], data = [none] } catch (Exception e) { return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static String getCellFormatPattern(final Cell cell, final CellFormatter cellFormatter) { if(cell == null) { return ""; } String pattern = cellFormatter.getPattern(cell); if(pattern.equalsIgnoreCase("general")) { return ""; } return pattern; } }
public class class_name { public static String getCellFormatPattern(final Cell cell, final CellFormatter cellFormatter) { if(cell == null) { return ""; // depends on control dependency: [if], data = [none] } String pattern = cellFormatter.getPattern(cell); if(pattern.equalsIgnoreCase("general")) { return ""; // depends on control dependency: [if], data = [none] } return pattern; } }
public class class_name { public void bind(C data) { if (itemView == null || controller == null) { return; } this.controller.mountView(data, itemView); this.data = data; } }
public class class_name { public void bind(C data) { if (itemView == null || controller == null) { return; // depends on control dependency: [if], data = [none] } this.controller.mountView(data, itemView); this.data = data; } }
public class class_name { @SuppressWarnings("unchecked") private boolean trySetValue(List<?> datas, Object pojo, CustomPropertyDescriptor field, Class<? extends Collection> clazz) { log.debug("要赋值的fieldName为{}", field.getName()); Collection collection = tryBuildCollection(clazz); if (collection == null) { log.warn("无法为class[{}]构建实例", clazz); return false; } collection.addAll(datas); try { return BeanUtils.setProperty(pojo, field.getName(), collection); } catch (Exception e) { log.debug("字段[{}]赋值失败,使用的集合类为[{}]", field.getName(), clazz, e); return false; } } }
public class class_name { @SuppressWarnings("unchecked") private boolean trySetValue(List<?> datas, Object pojo, CustomPropertyDescriptor field, Class<? extends Collection> clazz) { log.debug("要赋值的fieldName为{}", field.getName()); Collection collection = tryBuildCollection(clazz); if (collection == null) { log.warn("无法为class[{}]构建实例", clazz); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } collection.addAll(datas); try { return BeanUtils.setProperty(pojo, field.getName(), collection); // depends on control dependency: [try], data = [none] } catch (Exception e) { log.debug("字段[{}]赋值失败,使用的集合类为[{}]", field.getName(), clazz, e); return false; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static boolean equalsAny(final Object o1, final Object... o2s) { if (o2s != null) { for (final Object o2 : o2s) { if (o1 == null) { if (o2 == null) { return true; } continue; } // o1 != null if (o1.equals(o2)) { return true; } } } else { return o1 == null; } return false; } }
public class class_name { public static boolean equalsAny(final Object o1, final Object... o2s) { if (o2s != null) { for (final Object o2 : o2s) { if (o1 == null) { if (o2 == null) { return true; // depends on control dependency: [if], data = [none] } continue; } // o1 != null if (o1.equals(o2)) { return true; // depends on control dependency: [if], data = [none] } } } else { return o1 == null; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public boolean updateAttribute(String property, String newValueStr, boolean overwrite) { try { boolean changed = false; if (property.charAt(0) == RpcConstants.HIDE_KEY_PREFIX) { // 方法级配置 例如.echoStr.timeout String methodAndP = property.substring(1); int index = methodAndP.indexOf(RpcConstants.HIDE_KEY_PREFIX); if (index <= 0) { throw ExceptionUtils.buildRuntime(property, newValueStr, "Unknown update attribute key!"); } String methodName = methodAndP.substring(0, index); String methodProperty = methodAndP.substring(index + 1); MethodConfig methodConfig = getMethodConfig(methodName); Method getMethod = ReflectUtils.getPropertyGetterMethod(MethodConfig.class, methodProperty); Class propertyClazz = getMethod.getReturnType(); // 旧值的类型 // 拿到旧的值 Object oldValue = null; Object newValue = CompatibleTypeUtils.convert(newValueStr, propertyClazz); if (methodConfig == null) { methodConfig = new MethodConfig(); methodConfig.setName(methodName); if (this.methods == null) { this.methods = new ConcurrentHashMap<String, MethodConfig>(); } this.methods.put(methodName, methodConfig); changed = true; } else { oldValue = BeanUtils.getProperty(methodConfig, methodProperty, propertyClazz); if (oldValue == null) { if (newValueStr != null) { changed = true; } } else { changed = !oldValue.equals(newValue); } } if (changed && overwrite) { BeanUtils.setProperty(methodConfig, methodProperty, propertyClazz, newValue);// 覆盖属性 if (LOGGER.isInfoEnabled()) { LOGGER.info("Property \"" + methodName + "." + methodProperty + "\" changed from {} to {}", oldValue, newValueStr); } } } else { // 接口级配置 例如timeout // 先通过get方法找到类型 Method getMethod = ReflectUtils.getPropertyGetterMethod(getClass(), property); Class propertyClazz = getMethod.getReturnType(); // 旧值的类型 // 拿到旧的值 Object oldValue = BeanUtils.getProperty(this, property, propertyClazz); Object newValue = CompatibleTypeUtils.convert(newValueStr, propertyClazz); if (oldValue == null) { if (newValueStr != null) { changed = true; } } else { changed = !oldValue.equals(newValue); } if (changed && overwrite) { BeanUtils.setProperty(this, property, propertyClazz, newValue);// 覆盖属性 if (LOGGER.isInfoEnabled()) { LOGGER.info("Property \"" + property + "\" changed from {} to {}", oldValue, newValueStr); } } } return changed; } catch (Exception e) { throw new SofaRpcRuntimeException("Exception when update attribute, The key is " + property + " and value is " + newValueStr, e); } } }
public class class_name { public boolean updateAttribute(String property, String newValueStr, boolean overwrite) { try { boolean changed = false; if (property.charAt(0) == RpcConstants.HIDE_KEY_PREFIX) { // 方法级配置 例如.echoStr.timeout String methodAndP = property.substring(1); int index = methodAndP.indexOf(RpcConstants.HIDE_KEY_PREFIX); if (index <= 0) { throw ExceptionUtils.buildRuntime(property, newValueStr, "Unknown update attribute key!"); } String methodName = methodAndP.substring(0, index); String methodProperty = methodAndP.substring(index + 1); MethodConfig methodConfig = getMethodConfig(methodName); Method getMethod = ReflectUtils.getPropertyGetterMethod(MethodConfig.class, methodProperty); Class propertyClazz = getMethod.getReturnType(); // 旧值的类型 // 拿到旧的值 Object oldValue = null; Object newValue = CompatibleTypeUtils.convert(newValueStr, propertyClazz); if (methodConfig == null) { methodConfig = new MethodConfig(); // depends on control dependency: [if], data = [none] methodConfig.setName(methodName); // depends on control dependency: [if], data = [none] if (this.methods == null) { this.methods = new ConcurrentHashMap<String, MethodConfig>(); // depends on control dependency: [if], data = [none] } this.methods.put(methodName, methodConfig); // depends on control dependency: [if], data = [none] changed = true; // depends on control dependency: [if], data = [none] } else { oldValue = BeanUtils.getProperty(methodConfig, methodProperty, propertyClazz); // depends on control dependency: [if], data = [(methodConfig] if (oldValue == null) { if (newValueStr != null) { changed = true; // depends on control dependency: [if], data = [none] } } else { changed = !oldValue.equals(newValue); // depends on control dependency: [if], data = [none] } } if (changed && overwrite) { BeanUtils.setProperty(methodConfig, methodProperty, propertyClazz, newValue);// 覆盖属性 // depends on control dependency: [if], data = [none] if (LOGGER.isInfoEnabled()) { LOGGER.info("Property \"" + methodName + "." + methodProperty + "\" changed from {} to {}", oldValue, newValueStr); // depends on control dependency: [if], data = [none] } } } else { // 接口级配置 例如timeout // 先通过get方法找到类型 Method getMethod = ReflectUtils.getPropertyGetterMethod(getClass(), property); Class propertyClazz = getMethod.getReturnType(); // 旧值的类型 // 拿到旧的值 Object oldValue = BeanUtils.getProperty(this, property, propertyClazz); Object newValue = CompatibleTypeUtils.convert(newValueStr, propertyClazz); if (oldValue == null) { if (newValueStr != null) { changed = true; // depends on control dependency: [if], data = [none] } } else { changed = !oldValue.equals(newValue); // depends on control dependency: [if], data = [none] } if (changed && overwrite) { BeanUtils.setProperty(this, property, propertyClazz, newValue);// 覆盖属性 // depends on control dependency: [if], data = [none] if (LOGGER.isInfoEnabled()) { LOGGER.info("Property \"" + property + "\" changed from {} to {}", oldValue, newValueStr); // depends on control dependency: [if], data = [none] } } } return changed; // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SofaRpcRuntimeException("Exception when update attribute, The key is " + property + " and value is " + newValueStr, e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void setLayerIds(java.util.Collection<String> layerIds) { if (layerIds == null) { this.layerIds = null; return; } this.layerIds = new com.amazonaws.internal.SdkInternalList<String>(layerIds); } }
public class class_name { public void setLayerIds(java.util.Collection<String> layerIds) { if (layerIds == null) { this.layerIds = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.layerIds = new com.amazonaws.internal.SdkInternalList<String>(layerIds); } }
public class class_name { private void rePrimeNF6(AxiomSet as, IConceptMap<IConceptSet> subsumptions) { int size = as.getNf6Axioms().size(); if (size == 0) return; IConceptSet deltaNF6 = new SparseConceptSet(size); for (NF6 nf6 : as.getNf6Axioms()) { deltaNF6.add(nf6.getR()); } for (IntIterator it = deltaNF6.iterator(); it.hasNext();) { int role = it.next(); for (IntIterator it2 = contextIndex.keyIterator(); it2.hasNext();) { int concept = it2.next(); Context ctx = contextIndex.get(concept); if (ctx.getSucc().containsRole(role) && !ctx.getSucc().lookupConcept(role).contains(concept)) { ctx.processExternalEdge(role, concept); affectedContexts.add(ctx); ctx.startTracking(); if (ctx.activate()) { todo.add(ctx); } } } } } }
public class class_name { private void rePrimeNF6(AxiomSet as, IConceptMap<IConceptSet> subsumptions) { int size = as.getNf6Axioms().size(); if (size == 0) return; IConceptSet deltaNF6 = new SparseConceptSet(size); for (NF6 nf6 : as.getNf6Axioms()) { deltaNF6.add(nf6.getR()); // depends on control dependency: [for], data = [nf6] } for (IntIterator it = deltaNF6.iterator(); it.hasNext();) { int role = it.next(); for (IntIterator it2 = contextIndex.keyIterator(); it2.hasNext();) { int concept = it2.next(); Context ctx = contextIndex.get(concept); if (ctx.getSucc().containsRole(role) && !ctx.getSucc().lookupConcept(role).contains(concept)) { ctx.processExternalEdge(role, concept); // depends on control dependency: [if], data = [none] affectedContexts.add(ctx); // depends on control dependency: [if], data = [none] ctx.startTracking(); // depends on control dependency: [if], data = [none] if (ctx.activate()) { todo.add(ctx); // depends on control dependency: [if], data = [none] } } } } } }
public class class_name { public Word07Writer addText(ParagraphAlignment align, Font font, String... texts) { final XWPFParagraph p = this.doc.createParagraph(); if (null != align) { p.setAlignment(align); } if (ArrayUtil.isNotEmpty(texts)) { XWPFRun run; for (String text : texts) { run = p.createRun(); run.setText(text); if (null != font) { run.setFontFamily(font.getFamily()); run.setFontSize(font.getSize()); run.setBold(font.isBold()); run.setItalic(font.isItalic()); } } } return this; } }
public class class_name { public Word07Writer addText(ParagraphAlignment align, Font font, String... texts) { final XWPFParagraph p = this.doc.createParagraph(); if (null != align) { p.setAlignment(align); // depends on control dependency: [if], data = [align)] } if (ArrayUtil.isNotEmpty(texts)) { XWPFRun run; for (String text : texts) { run = p.createRun(); // depends on control dependency: [for], data = [none] run.setText(text); // depends on control dependency: [for], data = [text] if (null != font) { run.setFontFamily(font.getFamily()); // depends on control dependency: [if], data = [none] run.setFontSize(font.getSize()); // depends on control dependency: [if], data = [none] run.setBold(font.isBold()); // depends on control dependency: [if], data = [none] run.setItalic(font.isItalic()); // depends on control dependency: [if], data = [none] } } } return this; } }
public class class_name { @FFDCIgnore(PrivilegedActionException.class) private String getConfigNameForRef(final String ref) { String name = null; if (ref != null) { final ConfigurationAdmin configAdmin = configAdminRef.getService(); Configuration config; try { config = AccessController.doPrivileged(new PrivilegedExceptionAction<Configuration>() { @Override public Configuration run() throws IOException { return configAdmin.getConfiguration(ref, configAdminRef.getReference().getBundle().getLocation()); } }); } catch (PrivilegedActionException paex) { return null; } Dictionary<String, Object> props = config.getProperties(); name = (String) props.get(KEY_NAME); } return name; } }
public class class_name { @FFDCIgnore(PrivilegedActionException.class) private String getConfigNameForRef(final String ref) { String name = null; if (ref != null) { final ConfigurationAdmin configAdmin = configAdminRef.getService(); Configuration config; try { config = AccessController.doPrivileged(new PrivilegedExceptionAction<Configuration>() { @Override public Configuration run() throws IOException { return configAdmin.getConfiguration(ref, configAdminRef.getReference().getBundle().getLocation()); } }); // depends on control dependency: [try], data = [none] } catch (PrivilegedActionException paex) { return null; } // depends on control dependency: [catch], data = [none] Dictionary<String, Object> props = config.getProperties(); name = (String) props.get(KEY_NAME); // depends on control dependency: [if], data = [none] } return name; } }
public class class_name { protected List<JcrNodeType> supertypesFor( NodeTypeDefinition nodeType, Collection<JcrNodeType> pendingTypes ) throws RepositoryException { assert nodeType != null; List<JcrNodeType> supertypes = new LinkedList<JcrNodeType>(); boolean isMixin = nodeType.isMixin(); boolean needsPrimaryAncestor = !isMixin; String nodeTypeName = nodeType.getName(); for (String supertypeNameStr : nodeType.getDeclaredSupertypeNames()) { Name supertypeName = nameFactory.create(supertypeNameStr); JcrNodeType supertype = findTypeInMapOrList(supertypeName, pendingTypes); if (supertype == null) { throw new InvalidNodeTypeDefinitionException(JcrI18n.invalidSupertypeName.text(supertypeNameStr, nodeTypeName)); } needsPrimaryAncestor &= supertype.isMixin(); supertypes.add(supertype); } // primary types (other than nt:base) always have at least one ancestor that's a primary type - nt:base if (needsPrimaryAncestor) { Name nodeName = nameFactory.create(nodeTypeName); if (!JcrNtLexicon.BASE.equals(nodeName)) { JcrNodeType ntBase = findTypeInMapOrList(JcrNtLexicon.BASE, pendingTypes); assert ntBase != null; supertypes.add(0, ntBase); } } return supertypes; } }
public class class_name { protected List<JcrNodeType> supertypesFor( NodeTypeDefinition nodeType, Collection<JcrNodeType> pendingTypes ) throws RepositoryException { assert nodeType != null; List<JcrNodeType> supertypes = new LinkedList<JcrNodeType>(); boolean isMixin = nodeType.isMixin(); boolean needsPrimaryAncestor = !isMixin; String nodeTypeName = nodeType.getName(); for (String supertypeNameStr : nodeType.getDeclaredSupertypeNames()) { Name supertypeName = nameFactory.create(supertypeNameStr); JcrNodeType supertype = findTypeInMapOrList(supertypeName, pendingTypes); if (supertype == null) { throw new InvalidNodeTypeDefinitionException(JcrI18n.invalidSupertypeName.text(supertypeNameStr, nodeTypeName)); } needsPrimaryAncestor &= supertype.isMixin(); supertypes.add(supertype); } // primary types (other than nt:base) always have at least one ancestor that's a primary type - nt:base if (needsPrimaryAncestor) { Name nodeName = nameFactory.create(nodeTypeName); if (!JcrNtLexicon.BASE.equals(nodeName)) { JcrNodeType ntBase = findTypeInMapOrList(JcrNtLexicon.BASE, pendingTypes); assert ntBase != null; supertypes.add(0, ntBase); // depends on control dependency: [if], data = [none] } } return supertypes; } }
public class class_name { public static TaskManagerConfiguration fromConfiguration(Configuration configuration) { int numberSlots = configuration.getInteger(TaskManagerOptions.NUM_TASK_SLOTS, 1); if (numberSlots == -1) { numberSlots = 1; } final String[] tmpDirPaths = ConfigurationUtils.parseTempDirectories(configuration); final Time timeout; try { timeout = Time.milliseconds(AkkaUtils.getTimeout(configuration).toMillis()); } catch (Exception e) { throw new IllegalArgumentException( "Invalid format for '" + AkkaOptions.ASK_TIMEOUT.key() + "'.Use formats like '50 s' or '1 min' to specify the timeout."); } LOG.info("Messages have a max timeout of " + timeout); final Time finiteRegistrationDuration; try { Duration maxRegistrationDuration = Duration.create(configuration.getString(TaskManagerOptions.REGISTRATION_TIMEOUT)); if (maxRegistrationDuration.isFinite()) { finiteRegistrationDuration = Time.milliseconds(maxRegistrationDuration.toMillis()); } else { finiteRegistrationDuration = null; } } catch (NumberFormatException e) { throw new IllegalArgumentException("Invalid format for parameter " + TaskManagerOptions.REGISTRATION_TIMEOUT.key(), e); } final Time initialRegistrationPause; try { Duration pause = Duration.create(configuration.getString(TaskManagerOptions.INITIAL_REGISTRATION_BACKOFF)); if (pause.isFinite()) { initialRegistrationPause = Time.milliseconds(pause.toMillis()); } else { throw new IllegalArgumentException("The initial registration pause must be finite: " + pause); } } catch (NumberFormatException e) { throw new IllegalArgumentException("Invalid format for parameter " + TaskManagerOptions.INITIAL_REGISTRATION_BACKOFF.key(), e); } final Time maxRegistrationPause; try { Duration pause = Duration.create(configuration.getString( TaskManagerOptions.REGISTRATION_MAX_BACKOFF)); if (pause.isFinite()) { maxRegistrationPause = Time.milliseconds(pause.toMillis()); } else { throw new IllegalArgumentException("The maximum registration pause must be finite: " + pause); } } catch (NumberFormatException e) { throw new IllegalArgumentException("Invalid format for parameter " + TaskManagerOptions.INITIAL_REGISTRATION_BACKOFF.key(), e); } final Time refusedRegistrationPause; try { Duration pause = Duration.create(configuration.getString(TaskManagerOptions.REFUSED_REGISTRATION_BACKOFF)); if (pause.isFinite()) { refusedRegistrationPause = Time.milliseconds(pause.toMillis()); } else { throw new IllegalArgumentException("The refused registration pause must be finite: " + pause); } } catch (NumberFormatException e) { throw new IllegalArgumentException("Invalid format for parameter " + TaskManagerOptions.INITIAL_REGISTRATION_BACKOFF.key(), e); } final boolean exitOnOom = configuration.getBoolean(TaskManagerOptions.KILL_ON_OUT_OF_MEMORY); final String classLoaderResolveOrder = configuration.getString(CoreOptions.CLASSLOADER_RESOLVE_ORDER); final String[] alwaysParentFirstLoaderPatterns = CoreOptions.getParentFirstLoaderPatterns(configuration); final String taskManagerLogPath = configuration.getString(ConfigConstants.TASK_MANAGER_LOG_PATH_KEY, System.getProperty("log.file")); final String taskManagerStdoutPath; if (taskManagerLogPath != null) { final int extension = taskManagerLogPath.lastIndexOf('.'); if (extension > 0) { taskManagerStdoutPath = taskManagerLogPath.substring(0, extension) + ".out"; } else { taskManagerStdoutPath = null; } } else { taskManagerStdoutPath = null; } final RetryingRegistrationConfiguration retryingRegistrationConfiguration = RetryingRegistrationConfiguration.fromConfiguration(configuration); return new TaskManagerConfiguration( numberSlots, tmpDirPaths, timeout, finiteRegistrationDuration, initialRegistrationPause, maxRegistrationPause, refusedRegistrationPause, configuration, exitOnOom, FlinkUserCodeClassLoaders.ResolveOrder.fromString(classLoaderResolveOrder), alwaysParentFirstLoaderPatterns, taskManagerLogPath, taskManagerStdoutPath, retryingRegistrationConfiguration); } }
public class class_name { public static TaskManagerConfiguration fromConfiguration(Configuration configuration) { int numberSlots = configuration.getInteger(TaskManagerOptions.NUM_TASK_SLOTS, 1); if (numberSlots == -1) { numberSlots = 1; // depends on control dependency: [if], data = [none] } final String[] tmpDirPaths = ConfigurationUtils.parseTempDirectories(configuration); final Time timeout; try { timeout = Time.milliseconds(AkkaUtils.getTimeout(configuration).toMillis()); } catch (Exception e) { throw new IllegalArgumentException( "Invalid format for '" + AkkaOptions.ASK_TIMEOUT.key() + "'.Use formats like '50 s' or '1 min' to specify the timeout."); } LOG.info("Messages have a max timeout of " + timeout); final Time finiteRegistrationDuration; try { Duration maxRegistrationDuration = Duration.create(configuration.getString(TaskManagerOptions.REGISTRATION_TIMEOUT)); if (maxRegistrationDuration.isFinite()) { finiteRegistrationDuration = Time.milliseconds(maxRegistrationDuration.toMillis()); } else { finiteRegistrationDuration = null; } } catch (NumberFormatException e) { throw new IllegalArgumentException("Invalid format for parameter " + TaskManagerOptions.REGISTRATION_TIMEOUT.key(), e); } final Time initialRegistrationPause; try { Duration pause = Duration.create(configuration.getString(TaskManagerOptions.INITIAL_REGISTRATION_BACKOFF)); if (pause.isFinite()) { initialRegistrationPause = Time.milliseconds(pause.toMillis()); } else { throw new IllegalArgumentException("The initial registration pause must be finite: " + pause); } } catch (NumberFormatException e) { throw new IllegalArgumentException("Invalid format for parameter " + TaskManagerOptions.INITIAL_REGISTRATION_BACKOFF.key(), e); } final Time maxRegistrationPause; try { Duration pause = Duration.create(configuration.getString( TaskManagerOptions.REGISTRATION_MAX_BACKOFF)); if (pause.isFinite()) { maxRegistrationPause = Time.milliseconds(pause.toMillis()); } else { throw new IllegalArgumentException("The maximum registration pause must be finite: " + pause); } } catch (NumberFormatException e) { throw new IllegalArgumentException("Invalid format for parameter " + TaskManagerOptions.INITIAL_REGISTRATION_BACKOFF.key(), e); } final Time refusedRegistrationPause; try { Duration pause = Duration.create(configuration.getString(TaskManagerOptions.REFUSED_REGISTRATION_BACKOFF)); if (pause.isFinite()) { refusedRegistrationPause = Time.milliseconds(pause.toMillis()); } else { throw new IllegalArgumentException("The refused registration pause must be finite: " + pause); } } catch (NumberFormatException e) { throw new IllegalArgumentException("Invalid format for parameter " + TaskManagerOptions.INITIAL_REGISTRATION_BACKOFF.key(), e); } final boolean exitOnOom = configuration.getBoolean(TaskManagerOptions.KILL_ON_OUT_OF_MEMORY); final String classLoaderResolveOrder = configuration.getString(CoreOptions.CLASSLOADER_RESOLVE_ORDER); final String[] alwaysParentFirstLoaderPatterns = CoreOptions.getParentFirstLoaderPatterns(configuration); final String taskManagerLogPath = configuration.getString(ConfigConstants.TASK_MANAGER_LOG_PATH_KEY, System.getProperty("log.file")); final String taskManagerStdoutPath; if (taskManagerLogPath != null) { final int extension = taskManagerLogPath.lastIndexOf('.'); if (extension > 0) { taskManagerStdoutPath = taskManagerLogPath.substring(0, extension) + ".out"; } else { taskManagerStdoutPath = null; } } else { taskManagerStdoutPath = null; } final RetryingRegistrationConfiguration retryingRegistrationConfiguration = RetryingRegistrationConfiguration.fromConfiguration(configuration); return new TaskManagerConfiguration( numberSlots, tmpDirPaths, timeout, finiteRegistrationDuration, initialRegistrationPause, maxRegistrationPause, refusedRegistrationPause, configuration, exitOnOom, FlinkUserCodeClassLoaders.ResolveOrder.fromString(classLoaderResolveOrder), alwaysParentFirstLoaderPatterns, taskManagerLogPath, taskManagerStdoutPath, retryingRegistrationConfiguration); } }
public class class_name { public Query rewrite(IndexReader reader) throws IOException { if (version.getVersion() >= IndexFormatVersion.V3.getVersion()) { // use LOCAL_NAME and NAMESPACE_URI field BooleanQuery name = new BooleanQuery(); name.add(new JcrTermQuery(new Term(FieldNames.NAMESPACE_URI, nodeName.getNamespace())), BooleanClause.Occur.MUST); name.add(new JcrTermQuery(new Term(FieldNames.LOCAL_NAME, nodeName.getName())), BooleanClause.Occur.MUST); return name; } else { // use LABEL field try { return new JcrTermQuery(new Term(FieldNames.LABEL, nsMappings.translateName(nodeName))); } catch (IllegalNameException e) { throw Util.createIOException(e); } } } }
public class class_name { public Query rewrite(IndexReader reader) throws IOException { if (version.getVersion() >= IndexFormatVersion.V3.getVersion()) { // use LOCAL_NAME and NAMESPACE_URI field BooleanQuery name = new BooleanQuery(); name.add(new JcrTermQuery(new Term(FieldNames.NAMESPACE_URI, nodeName.getNamespace())), BooleanClause.Occur.MUST); name.add(new JcrTermQuery(new Term(FieldNames.LOCAL_NAME, nodeName.getName())), BooleanClause.Occur.MUST); return name; } else { // use LABEL field try { return new JcrTermQuery(new Term(FieldNames.LABEL, nsMappings.translateName(nodeName))); // depends on control dependency: [try], data = [none] } catch (IllegalNameException e) { throw Util.createIOException(e); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public PlainTimestamp plus( long amount, CalendarUnit unit ) { if (unit == null) { throw new NullPointerException("Missing unit."); } else if (amount == 0) { return this; } try { return CALENDAR_UNIT_RULE_MAP.get(unit).addTo(this, amount); } catch (IllegalArgumentException iae) { ArithmeticException ex = new ArithmeticException("Result beyond boundaries of time axis."); ex.initCause(iae); throw ex; } } }
public class class_name { public PlainTimestamp plus( long amount, CalendarUnit unit ) { if (unit == null) { throw new NullPointerException("Missing unit."); } else if (amount == 0) { return this; // depends on control dependency: [if], data = [none] } try { return CALENDAR_UNIT_RULE_MAP.get(unit).addTo(this, amount); // depends on control dependency: [try], data = [none] } catch (IllegalArgumentException iae) { ArithmeticException ex = new ArithmeticException("Result beyond boundaries of time axis."); ex.initCause(iae); throw ex; } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public CommerceOrder fetchByG_C_Last(long groupId, long commerceAccountId, OrderByComparator<CommerceOrder> orderByComparator) { int count = countByG_C(groupId, commerceAccountId); if (count == 0) { return null; } List<CommerceOrder> list = findByG_C(groupId, commerceAccountId, count - 1, count, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } }
public class class_name { @Override public CommerceOrder fetchByG_C_Last(long groupId, long commerceAccountId, OrderByComparator<CommerceOrder> orderByComparator) { int count = countByG_C(groupId, commerceAccountId); if (count == 0) { return null; // depends on control dependency: [if], data = [none] } List<CommerceOrder> list = findByG_C(groupId, commerceAccountId, count - 1, count, orderByComparator); if (!list.isEmpty()) { return list.get(0); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public ObjectValue newInstance(SClassDefinition node, PDefinition ctorDefinition, ValueList argvals, Context ctxt) throws AnalysisException { if (node instanceof ABusClassDefinition) { return newInstance((ABusClassDefinition) node, ctorDefinition, argvals, ctxt); } else if (node instanceof AClassClassDefinition) { if (node.getIsAbstract()) { VdmRuntimeError.abort(node.getLocation(), 4000, "Cannot instantiate abstract class " + node.getName(), ctxt); } return af.createSClassDefinitionAssistant().makeNewInstance(node, ctorDefinition, argvals, ctxt, new HashMap<ILexNameToken, ObjectValue>(), false); //return af.createAClassClassDefinitionAssistant().newInstance((AClassClassDefinition) node, ctorDefinition, argvals, ctxt); } else if (node instanceof ACpuClassDefinition) { return af.createACpuClassDefinitionAssistant().newInstance((ACpuClassDefinition) node, ctorDefinition, argvals, ctxt); } else if (node instanceof ASystemClassDefinition) { VdmRuntimeError.abort(node.getLocation(), 4135, "Cannot instantiate system class " + node.getName(), ctxt); } return null; } }
public class class_name { public ObjectValue newInstance(SClassDefinition node, PDefinition ctorDefinition, ValueList argvals, Context ctxt) throws AnalysisException { if (node instanceof ABusClassDefinition) { return newInstance((ABusClassDefinition) node, ctorDefinition, argvals, ctxt); } else if (node instanceof AClassClassDefinition) { if (node.getIsAbstract()) { VdmRuntimeError.abort(node.getLocation(), 4000, "Cannot instantiate abstract class " + node.getName(), ctxt); // depends on control dependency: [if], data = [none] } return af.createSClassDefinitionAssistant().makeNewInstance(node, ctorDefinition, argvals, ctxt, new HashMap<ILexNameToken, ObjectValue>(), false); //return af.createAClassClassDefinitionAssistant().newInstance((AClassClassDefinition) node, ctorDefinition, argvals, ctxt); } else if (node instanceof ACpuClassDefinition) { return af.createACpuClassDefinitionAssistant().newInstance((ACpuClassDefinition) node, ctorDefinition, argvals, ctxt); } else if (node instanceof ASystemClassDefinition) { VdmRuntimeError.abort(node.getLocation(), 4135, "Cannot instantiate system class " + node.getName(), ctxt); } return null; } }
public class class_name { private void resize() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "resize", table.length); Entry[] newTable = new Entry[table.length + (table.length / 2)]; /* We have to walk the entire SchemaSet, rehashing each Entry and putting */ /* it in its new home. As contains() may be running at the same time, we */ /* have to create a new Entry instance for each. */ for (int i = 0; i < table.length; i++) { Entry ent = table[i]; Entry newEntry; int j; while (ent != null) { j = hashToTable(ent.schemaId, newTable); newEntry = new Entry(ent.schemaId, newTable[j]); newTable[j] = newEntry; ent = ent.next; } } /* Now replace the old table with the new one. */ table = newTable; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "resize", table.length); } }
public class class_name { private void resize() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "resize", table.length); Entry[] newTable = new Entry[table.length + (table.length / 2)]; /* We have to walk the entire SchemaSet, rehashing each Entry and putting */ /* it in its new home. As contains() may be running at the same time, we */ /* have to create a new Entry instance for each. */ for (int i = 0; i < table.length; i++) { Entry ent = table[i]; Entry newEntry; int j; while (ent != null) { j = hashToTable(ent.schemaId, newTable); // depends on control dependency: [while], data = [(ent] newEntry = new Entry(ent.schemaId, newTable[j]); // depends on control dependency: [while], data = [(ent] newTable[j] = newEntry; // depends on control dependency: [while], data = [none] ent = ent.next; // depends on control dependency: [while], data = [none] } } /* Now replace the old table with the new one. */ table = newTable; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "resize", table.length); } }
public class class_name { public Map<String, String> getNodeBreadcrumbs(final UriInfo uriInfo, final Node subject) { final String topic = subject.getURI(); LOGGER.trace("Generating breadcrumbs for subject {}", subject); final String baseUri = uriInfo.getBaseUri().toString(); if (!topic.startsWith(baseUri)) { LOGGER.trace("Topic wasn't part of our base URI {}", baseUri); return emptyMap(); } final String salientPath = topic.substring(baseUri.length()); final StringJoiner cumulativePath = new StringJoiner("/"); return stream(salientPath.split("/")).filter(seg -> !seg.isEmpty()).collect(toMap(seg -> uriInfo .getBaseUriBuilder().path(cumulativePath.add(seg).toString()) .build().toString(), seg -> seg, (u, v) -> null, LinkedHashMap::new)); } }
public class class_name { public Map<String, String> getNodeBreadcrumbs(final UriInfo uriInfo, final Node subject) { final String topic = subject.getURI(); LOGGER.trace("Generating breadcrumbs for subject {}", subject); final String baseUri = uriInfo.getBaseUri().toString(); if (!topic.startsWith(baseUri)) { LOGGER.trace("Topic wasn't part of our base URI {}", baseUri); // depends on control dependency: [if], data = [none] return emptyMap(); // depends on control dependency: [if], data = [none] } final String salientPath = topic.substring(baseUri.length()); final StringJoiner cumulativePath = new StringJoiner("/"); return stream(salientPath.split("/")).filter(seg -> !seg.isEmpty()).collect(toMap(seg -> uriInfo .getBaseUriBuilder().path(cumulativePath.add(seg).toString()) .build().toString(), seg -> seg, (u, v) -> null, LinkedHashMap::new)); } }
public class class_name { protected List<Instance> getInstancesForApp(String serviceId) throws Exception { List<Instance> instances = new ArrayList<>(); log.info("Fetching instances for app: " + serviceId); List<ServiceInstance> serviceInstances = discoveryClient.getInstances(serviceId); if (serviceInstances == null || serviceInstances.isEmpty()) { log.warn("DiscoveryClient returned null or empty for service: " + serviceId); return instances; } try { log.info("Received instance list for service: " + serviceId + ", size=" + serviceInstances.size()); for (ServiceInstance serviceInstance : serviceInstances) { Instance instance = marshall(serviceInstance); if (instance != null) { instances.add(instance); } } } catch (Exception e) { log.warn("Failed to retrieve instances from DiscoveryClient", e); } return instances; } }
public class class_name { protected List<Instance> getInstancesForApp(String serviceId) throws Exception { List<Instance> instances = new ArrayList<>(); log.info("Fetching instances for app: " + serviceId); List<ServiceInstance> serviceInstances = discoveryClient.getInstances(serviceId); if (serviceInstances == null || serviceInstances.isEmpty()) { log.warn("DiscoveryClient returned null or empty for service: " + serviceId); return instances; } try { log.info("Received instance list for service: " + serviceId + ", size=" + serviceInstances.size()); for (ServiceInstance serviceInstance : serviceInstances) { Instance instance = marshall(serviceInstance); if (instance != null) { instances.add(instance); // depends on control dependency: [if], data = [(instance] } } } catch (Exception e) { log.warn("Failed to retrieve instances from DiscoveryClient", e); } return instances; } }
public class class_name { public void setFilters(java.util.Collection<QueryFilter> filters) { if (filters == null) { this.filters = null; return; } this.filters = new java.util.ArrayList<QueryFilter>(filters); } }
public class class_name { public void setFilters(java.util.Collection<QueryFilter> filters) { if (filters == null) { this.filters = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.filters = new java.util.ArrayList<QueryFilter>(filters); } }
public class class_name { public static boolean loadAgent(String className, int num, AObjectCatalog agents) { // Load the Agent class Class<?> aclass = loadClass(className, Agent.class); if (aclass == null) { return false; } // Save this agent type to the catalog of known agent types AgentType atype = new AgentType(className); atype.setAgentClass(aclass); GlobalState.agentTypes.push(atype); // Find the goals that this agent has String[] goals = getGoalsFromAgentInfoAnnotation(aclass); if (goals.length == 0) { return false; } // First pass: get the goals and their plans (flat goal-plan list) loadGoalPlanNodes(atype, goals); // Second pass: complete the goal-plan hierarchy completeGoalPlanHierarchy(); // Now create the specified number of instances of this agent type createAgentsInCatalog(agents, atype, aclass, num); // return success return true; } }
public class class_name { public static boolean loadAgent(String className, int num, AObjectCatalog agents) { // Load the Agent class Class<?> aclass = loadClass(className, Agent.class); if (aclass == null) { return false; // depends on control dependency: [if], data = [none] } // Save this agent type to the catalog of known agent types AgentType atype = new AgentType(className); atype.setAgentClass(aclass); GlobalState.agentTypes.push(atype); // Find the goals that this agent has String[] goals = getGoalsFromAgentInfoAnnotation(aclass); if (goals.length == 0) { return false; // depends on control dependency: [if], data = [none] } // First pass: get the goals and their plans (flat goal-plan list) loadGoalPlanNodes(atype, goals); // Second pass: complete the goal-plan hierarchy completeGoalPlanHierarchy(); // Now create the specified number of instances of this agent type createAgentsInCatalog(agents, atype, aclass, num); // return success return true; } }
public class class_name { @Override public void setJobQueue(int idJob, int idQueue) { DbConn cnx = null; try { cnx = getDbSession(); QueryResult qr = cnx.runUpdate("jj_update_queue_by_id", idQueue, idJob); if (qr.nbUpdated != 1) { throw new JqmClientException("Job instance does not exist or has already started"); } cnx.commit(); } catch (DatabaseException e) { if (e.getCause() instanceof SQLIntegrityConstraintViolationException) throw new JqmClientException("Queue does not exist", e); else throw new JqmClientException("could not change the queue of a job (internal error)", e); } catch (Exception e) { throw new JqmClientException("could not change the queue of a job (internal error)", e); } finally { closeQuietly(cnx); } } }
public class class_name { @Override public void setJobQueue(int idJob, int idQueue) { DbConn cnx = null; try { cnx = getDbSession(); // depends on control dependency: [try], data = [none] QueryResult qr = cnx.runUpdate("jj_update_queue_by_id", idQueue, idJob); if (qr.nbUpdated != 1) { throw new JqmClientException("Job instance does not exist or has already started"); } cnx.commit(); // depends on control dependency: [try], data = [none] } catch (DatabaseException e) { if (e.getCause() instanceof SQLIntegrityConstraintViolationException) throw new JqmClientException("Queue does not exist", e); else throw new JqmClientException("could not change the queue of a job (internal error)", e); } // depends on control dependency: [catch], data = [none] catch (Exception e) { throw new JqmClientException("could not change the queue of a job (internal error)", e); } // depends on control dependency: [catch], data = [none] finally { closeQuietly(cnx); } } }
public class class_name { public Project getProject() { JsonValidationService service = JsonValidationService.newInstance(); JsonSchema schema = service.createSchemaReaderFactoryBuilder().withSchemaResolver( new SchemaResourceResolver( service)).build() .createSchemaReader( openSchemaResource( "project-schema.json")) .read(); ProblemHandler handler = ProblemHandler.throwing(); try( JsonReader reader = service.createReader( stream_, schema, handler)) { JsonObject json; try { json = reader.readObject(); } catch( Exception e) { throw new ProjectException( "Invalid project definition", e); } return ProjectJson.asProject( json); } } }
public class class_name { public Project getProject() { JsonValidationService service = JsonValidationService.newInstance(); JsonSchema schema = service.createSchemaReaderFactoryBuilder().withSchemaResolver( new SchemaResourceResolver( service)).build() .createSchemaReader( openSchemaResource( "project-schema.json")) .read(); ProblemHandler handler = ProblemHandler.throwing(); try( JsonReader reader = service.createReader( stream_, schema, handler)) { JsonObject json; try { json = reader.readObject(); // depends on control dependency: [try], data = [none] } catch( Exception e) { throw new ProjectException( "Invalid project definition", e); } // depends on control dependency: [catch], data = [none] return ProjectJson.asProject( json); } } }
public class class_name { public WordBuilder<I> truncate(int truncLen) { if (truncLen >= length) { return this; } ensureUnlocked(); for (int i = truncLen; i < length; i++) { array[i] = null; } length = truncLen; return this; } }
public class class_name { public WordBuilder<I> truncate(int truncLen) { if (truncLen >= length) { return this; // depends on control dependency: [if], data = [none] } ensureUnlocked(); for (int i = truncLen; i < length; i++) { array[i] = null; // depends on control dependency: [for], data = [i] } length = truncLen; return this; } }
public class class_name { public Rational plus(final Rational pOther) { // special cases if (equals(ZERO)) { return pOther; } if (pOther.equals(ZERO)) { return this; } // Find gcd of numerators and denominators long f = gcd(numerator, pOther.numerator); long g = gcd(denominator, pOther.denominator); // add cross-product terms for numerator // multiply back in return new Rational( ((numerator / f) * (pOther.denominator / g) + (pOther.numerator / f) * (denominator / g)) * f, lcm(denominator, pOther.denominator) ); } }
public class class_name { public Rational plus(final Rational pOther) { // special cases if (equals(ZERO)) { return pOther; // depends on control dependency: [if], data = [none] } if (pOther.equals(ZERO)) { return this; // depends on control dependency: [if], data = [none] } // Find gcd of numerators and denominators long f = gcd(numerator, pOther.numerator); long g = gcd(denominator, pOther.denominator); // add cross-product terms for numerator // multiply back in return new Rational( ((numerator / f) * (pOther.denominator / g) + (pOther.numerator / f) * (denominator / g)) * f, lcm(denominator, pOther.denominator) ); } }
public class class_name { private boolean addExtractorOrDynamicValueAsFieldWriter(List<Object> list, FieldExtractor extractor, String header, boolean commaMightBeNeeded) { if (extractor != null) { String head = header; if (commaMightBeNeeded) { head = "," + head; } list.add(new FieldWriter(head, extractor)); return true; } return commaMightBeNeeded; } }
public class class_name { private boolean addExtractorOrDynamicValueAsFieldWriter(List<Object> list, FieldExtractor extractor, String header, boolean commaMightBeNeeded) { if (extractor != null) { String head = header; if (commaMightBeNeeded) { head = "," + head; // depends on control dependency: [if], data = [none] } list.add(new FieldWriter(head, extractor)); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } return commaMightBeNeeded; } }
public class class_name { public void updateGroupMembers(long logIndex, Collection<Endpoint> members) { assert committedGroupMembers == lastGroupMembers : "Cannot update group members to: " + members + " at log index: " + logIndex + " because last group members: " + lastGroupMembers + " is different than committed group members: " + committedGroupMembers; assert lastGroupMembers.index() < logIndex : "Cannot update group members to: " + members + " at log index: " + logIndex + " because last group members: " + lastGroupMembers + " has a bigger log index."; RaftGroupMembers newGroupMembers = new RaftGroupMembers(logIndex, members, localEndpoint); committedGroupMembers = lastGroupMembers; lastGroupMembers = newGroupMembers; if (leaderState != null) { for (Endpoint endpoint : members) { if (!committedGroupMembers.isKnownMember(endpoint)) { leaderState.add(endpoint, log.lastLogOrSnapshotIndex()); } } for (Endpoint endpoint : committedGroupMembers.remoteMembers()) { if (!members.contains(endpoint)) { leaderState.remove(endpoint); } } } } }
public class class_name { public void updateGroupMembers(long logIndex, Collection<Endpoint> members) { assert committedGroupMembers == lastGroupMembers : "Cannot update group members to: " + members + " at log index: " + logIndex + " because last group members: " + lastGroupMembers + " is different than committed group members: " + committedGroupMembers; assert lastGroupMembers.index() < logIndex : "Cannot update group members to: " + members + " at log index: " + logIndex + " because last group members: " + lastGroupMembers + " has a bigger log index."; RaftGroupMembers newGroupMembers = new RaftGroupMembers(logIndex, members, localEndpoint); committedGroupMembers = lastGroupMembers; lastGroupMembers = newGroupMembers; if (leaderState != null) { for (Endpoint endpoint : members) { if (!committedGroupMembers.isKnownMember(endpoint)) { leaderState.add(endpoint, log.lastLogOrSnapshotIndex()); // depends on control dependency: [if], data = [none] } } for (Endpoint endpoint : committedGroupMembers.remoteMembers()) { if (!members.contains(endpoint)) { leaderState.remove(endpoint); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public void write(Engine engine, Writer writer, Reader reader) throws IOException { if (exportHeaders) { writer.append(header(engine)).append("\n"); } String line; int lineNumber = 0; BufferedReader bufferedReader = new BufferedReader(reader); try { while ((line = bufferedReader.readLine()) != null) { ++lineNumber; List<Double> inputValues; if (lineNumber == 1) { //automatic detection of header. try { inputValues = parse(line); } catch (Exception ex) { continue; } } else { inputValues = parse(line); } write(engine, writer, inputValues, engine.getInputVariables()); } } catch (RuntimeException ex) { throw ex; } catch (IOException ex) { throw ex; } finally { bufferedReader.close(); } } }
public class class_name { public void write(Engine engine, Writer writer, Reader reader) throws IOException { if (exportHeaders) { writer.append(header(engine)).append("\n"); } String line; int lineNumber = 0; BufferedReader bufferedReader = new BufferedReader(reader); try { while ((line = bufferedReader.readLine()) != null) { ++lineNumber; // depends on control dependency: [while], data = [none] List<Double> inputValues; if (lineNumber == 1) { //automatic detection of header. try { inputValues = parse(line); // depends on control dependency: [try], data = [none] } catch (Exception ex) { continue; } // depends on control dependency: [catch], data = [none] } else { inputValues = parse(line); // depends on control dependency: [if], data = [none] } write(engine, writer, inputValues, engine.getInputVariables()); // depends on control dependency: [while], data = [none] } } catch (RuntimeException ex) { throw ex; } catch (IOException ex) { throw ex; } finally { bufferedReader.close(); } } }
public class class_name { public EClass getGCHST() { if (gchstEClass == null) { gchstEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(443); } return gchstEClass; } }
public class class_name { public EClass getGCHST() { if (gchstEClass == null) { gchstEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(443); // depends on control dependency: [if], data = [none] } return gchstEClass; } }
public class class_name { protected VoteResponse handleVote(VoteRequest request) { // If the request term is not as great as the current context term then don't // vote for the candidate. We want to vote for candidates that are at least // as up to date as us. if (request.term() < raft.getTerm()) { log.debug("Rejected {}: candidate's term is less than the current term", request); return VoteResponse.builder() .withStatus(RaftResponse.Status.OK) .withTerm(raft.getTerm()) .withVoted(false) .build(); } // If a leader was already determined for this term then reject the request. else if (raft.getLeader() != null) { log.debug("Rejected {}: leader already exists", request); return VoteResponse.builder() .withStatus(RaftResponse.Status.OK) .withTerm(raft.getTerm()) .withVoted(false) .build(); } // If the requesting candidate is not a known member of the cluster (to this // node) then don't vote for it. Only vote for candidates that we know about. else if (!raft.getCluster().getRemoteMemberStates().stream().map(m -> m.getMember().memberId()).collect(Collectors.toSet()).contains(request.candidate())) { log.debug("Rejected {}: candidate is not known to the local member", request); return VoteResponse.builder() .withStatus(RaftResponse.Status.OK) .withTerm(raft.getTerm()) .withVoted(false) .build(); } // If no vote has been cast, check the log and cast a vote if necessary. else if (raft.getLastVotedFor() == null) { if (isLogUpToDate(request.lastLogIndex(), request.lastLogTerm(), request)) { raft.setLastVotedFor(request.candidate()); return VoteResponse.builder() .withStatus(RaftResponse.Status.OK) .withTerm(raft.getTerm()) .withVoted(true) .build(); } else { return VoteResponse.builder() .withStatus(RaftResponse.Status.OK) .withTerm(raft.getTerm()) .withVoted(false) .build(); } } // If we already voted for the requesting server, respond successfully. else if (raft.getLastVotedFor() == request.candidate()) { log.debug("Accepted {}: already voted for {}", request, raft.getCluster().getMember(raft.getLastVotedFor()).memberId()); return VoteResponse.builder() .withStatus(RaftResponse.Status.OK) .withTerm(raft.getTerm()) .withVoted(true) .build(); } // In this case, we've already voted for someone else. else { log.debug("Rejected {}: already voted for {}", request, raft.getCluster().getMember(raft.getLastVotedFor()).memberId()); return VoteResponse.builder() .withStatus(RaftResponse.Status.OK) .withTerm(raft.getTerm()) .withVoted(false) .build(); } } }
public class class_name { protected VoteResponse handleVote(VoteRequest request) { // If the request term is not as great as the current context term then don't // vote for the candidate. We want to vote for candidates that are at least // as up to date as us. if (request.term() < raft.getTerm()) { log.debug("Rejected {}: candidate's term is less than the current term", request); return VoteResponse.builder() .withStatus(RaftResponse.Status.OK) .withTerm(raft.getTerm()) .withVoted(false) .build(); } // If a leader was already determined for this term then reject the request. else if (raft.getLeader() != null) { log.debug("Rejected {}: leader already exists", request); return VoteResponse.builder() .withStatus(RaftResponse.Status.OK) .withTerm(raft.getTerm()) .withVoted(false) .build(); } // If the requesting candidate is not a known member of the cluster (to this // node) then don't vote for it. Only vote for candidates that we know about. else if (!raft.getCluster().getRemoteMemberStates().stream().map(m -> m.getMember().memberId()).collect(Collectors.toSet()).contains(request.candidate())) { log.debug("Rejected {}: candidate is not known to the local member", request); // depends on control dependency: [if], data = [none] return VoteResponse.builder() .withStatus(RaftResponse.Status.OK) .withTerm(raft.getTerm()) .withVoted(false) .build(); // depends on control dependency: [if], data = [none] } // If no vote has been cast, check the log and cast a vote if necessary. else if (raft.getLastVotedFor() == null) { if (isLogUpToDate(request.lastLogIndex(), request.lastLogTerm(), request)) { raft.setLastVotedFor(request.candidate()); // depends on control dependency: [if], data = [none] return VoteResponse.builder() .withStatus(RaftResponse.Status.OK) .withTerm(raft.getTerm()) .withVoted(true) .build(); // depends on control dependency: [if], data = [none] } else { return VoteResponse.builder() .withStatus(RaftResponse.Status.OK) .withTerm(raft.getTerm()) .withVoted(false) .build(); // depends on control dependency: [if], data = [none] } } // If we already voted for the requesting server, respond successfully. else if (raft.getLastVotedFor() == request.candidate()) { log.debug("Accepted {}: already voted for {}", request, raft.getCluster().getMember(raft.getLastVotedFor()).memberId()); // depends on control dependency: [if], data = [(raft.getLastVotedFor()] return VoteResponse.builder() .withStatus(RaftResponse.Status.OK) .withTerm(raft.getTerm()) .withVoted(true) .build(); // depends on control dependency: [if], data = [none] } // In this case, we've already voted for someone else. else { log.debug("Rejected {}: already voted for {}", request, raft.getCluster().getMember(raft.getLastVotedFor()).memberId()); // depends on control dependency: [if], data = [(raft.getLastVotedFor()] return VoteResponse.builder() .withStatus(RaftResponse.Status.OK) .withTerm(raft.getTerm()) .withVoted(false) .build(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void setCiphers(java.util.Collection<Cipher> ciphers) { if (ciphers == null) { this.ciphers = null; return; } this.ciphers = new java.util.ArrayList<Cipher>(ciphers); } }
public class class_name { public void setCiphers(java.util.Collection<Cipher> ciphers) { if (ciphers == null) { this.ciphers = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.ciphers = new java.util.ArrayList<Cipher>(ciphers); } }
public class class_name { public static <V, C extends Collection<Node<V>>> C collectNodesByPath(List<Node<V>> parents, String path, C collection) { checkArgNotNull(path, "path"); checkArgNotNull(collection, "collection"); if (parents != null && !parents.isEmpty()) { int separatorIndex = path.indexOf('/'); String prefix = separatorIndex != -1 ? path.substring(0, separatorIndex) : path; for (Node<V> child : parents) { if (StringUtils.startsWith(child.getLabel(), prefix)) { if (separatorIndex == -1) { collection.add(child); } else { collectNodesByPath(child, path.substring(separatorIndex + 1), collection); } } } } return collection; } }
public class class_name { public static <V, C extends Collection<Node<V>>> C collectNodesByPath(List<Node<V>> parents, String path, C collection) { checkArgNotNull(path, "path"); checkArgNotNull(collection, "collection"); if (parents != null && !parents.isEmpty()) { int separatorIndex = path.indexOf('/'); String prefix = separatorIndex != -1 ? path.substring(0, separatorIndex) : path; for (Node<V> child : parents) { if (StringUtils.startsWith(child.getLabel(), prefix)) { if (separatorIndex == -1) { collection.add(child); // depends on control dependency: [if], data = [none] } else { collectNodesByPath(child, path.substring(separatorIndex + 1), collection); // depends on control dependency: [if], data = [(separatorIndex] } } } } return collection; } }
public class class_name { private void signalNoConnections() { EventEngine events = _commsServerFacade.getEventEngine(); if (null == events) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { SibTr.event(tc, "Unable to send event, missing service"); } return; } if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { SibTr.event(tc, "No active connections, sending stop chain event"); } Event event = events.createEvent(ChannelFramework.EVENT_STOPCHAIN); event.setProperty(ChannelFramework.EVENT_CHANNELNAME, _cfw.getChannel(_jfapName).getExternalName()); events.postEvent(event); } }
public class class_name { private void signalNoConnections() { EventEngine events = _commsServerFacade.getEventEngine(); if (null == events) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { SibTr.event(tc, "Unable to send event, missing service"); // depends on control dependency: [if], data = [none] } return; // depends on control dependency: [if], data = [none] } if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { SibTr.event(tc, "No active connections, sending stop chain event"); // depends on control dependency: [if], data = [none] } Event event = events.createEvent(ChannelFramework.EVENT_STOPCHAIN); event.setProperty(ChannelFramework.EVENT_CHANNELNAME, _cfw.getChannel(_jfapName).getExternalName()); events.postEvent(event); } }
public class class_name { private static Class checkClass(ProtoFile protoFile, Type type, Map<String, String> mappedUniName, boolean isUniName) { String packageName = protoFile.getPackageName(); String defaultClsName = type.getName(); // to check if has "java_package" option and "java_outer_classname" List<Option> options = protoFile.getOptions(); if (options != null) { for (Option option : options) { if (option.getName().equals(JAVA_PACKAGE_OPTION)) { packageName = option.getValue().toString(); } else if (option.getName().equals(JAVA_OUTER_CLASSNAME_OPTION)) { defaultClsName = option.getValue().toString(); } } } String simpleName = getProxyClassName(defaultClsName, mappedUniName, isUniName); String className = packageName + PACKAGE_SPLIT_CHAR + simpleName; Class<?> c = null; try { c = Class.forName(className); } catch (ClassNotFoundException e1) { // if class not found so should generate a new java source class. c = null; } return c; } }
public class class_name { private static Class checkClass(ProtoFile protoFile, Type type, Map<String, String> mappedUniName, boolean isUniName) { String packageName = protoFile.getPackageName(); String defaultClsName = type.getName(); // to check if has "java_package" option and "java_outer_classname" List<Option> options = protoFile.getOptions(); if (options != null) { for (Option option : options) { if (option.getName().equals(JAVA_PACKAGE_OPTION)) { packageName = option.getValue().toString(); // depends on control dependency: [if], data = [none] } else if (option.getName().equals(JAVA_OUTER_CLASSNAME_OPTION)) { defaultClsName = option.getValue().toString(); // depends on control dependency: [if], data = [none] } } } String simpleName = getProxyClassName(defaultClsName, mappedUniName, isUniName); String className = packageName + PACKAGE_SPLIT_CHAR + simpleName; Class<?> c = null; try { c = Class.forName(className); } catch (ClassNotFoundException e1) { // if class not found so should generate a new java source class. c = null; } return c; } }
public class class_name { public static <V> V callWithRetries( int nAttempts, int initialRetrySec, Callable<V> action, IPredicate<Exception> retryableException) throws Exception { int retryDelaySec = initialRetrySec; for (int attemptsLeftAfterThis = nAttempts - 1; attemptsLeftAfterThis >= 0; attemptsLeftAfterThis--) { try { return action.call(); } catch (Exception e) { if (!retryableException.test(e)) { throw e; } if (attemptsLeftAfterThis <= 0) { throw new RuntimeException("Ultimately failed after " + nAttempts + " attempts.", e); } log.warn("Failed; {} attempts left: {}", e.toString(), attemptsLeftAfterThis); } retryDelaySec = pauseAndIncrease(retryDelaySec); } throw new RuntimeException("Failed; total attempts allowed: " + nAttempts); } }
public class class_name { public static <V> V callWithRetries( int nAttempts, int initialRetrySec, Callable<V> action, IPredicate<Exception> retryableException) throws Exception { int retryDelaySec = initialRetrySec; for (int attemptsLeftAfterThis = nAttempts - 1; attemptsLeftAfterThis >= 0; attemptsLeftAfterThis--) { try { return action.call(); // depends on control dependency: [try], data = [none] } catch (Exception e) { if (!retryableException.test(e)) { throw e; } if (attemptsLeftAfterThis <= 0) { throw new RuntimeException("Ultimately failed after " + nAttempts + " attempts.", e); } log.warn("Failed; {} attempts left: {}", e.toString(), attemptsLeftAfterThis); } // depends on control dependency: [catch], data = [none] retryDelaySec = pauseAndIncrease(retryDelaySec); } throw new RuntimeException("Failed; total attempts allowed: " + nAttempts); } }
public class class_name { long allocate() { if (elemSize == 0) { return toHandle(0); } if (numAvail == 0 || !doNotDestroy) { return -1; } final int bitmapIdx = getNextAvail(); int q = bitmapIdx >>> 6; int r = bitmapIdx & 63; assert (bitmap[q] >>> r & 1) == 0; bitmap[q] |= 1L << r; if (-- numAvail == 0) { removeFromPool(); } return toHandle(bitmapIdx); } }
public class class_name { long allocate() { if (elemSize == 0) { return toHandle(0); // depends on control dependency: [if], data = [0)] } if (numAvail == 0 || !doNotDestroy) { return -1; // depends on control dependency: [if], data = [none] } final int bitmapIdx = getNextAvail(); int q = bitmapIdx >>> 6; int r = bitmapIdx & 63; assert (bitmap[q] >>> r & 1) == 0; bitmap[q] |= 1L << r; if (-- numAvail == 0) { removeFromPool(); // depends on control dependency: [if], data = [none] } return toHandle(bitmapIdx); } }
public class class_name { public static <T extends ImageGray<T>> double block_zero( T integral , int x0 , int y0 , int x1 , int y1 ) { if( integral instanceof GrayF32) { return IntegralImageOps.block_zero((GrayF32)integral,x0,y0,x1,y1); } else if( integral instanceof GrayF64) { return IntegralImageOps.block_zero((GrayF64)integral,x0,y0,x1,y1); } else if( integral instanceof GrayS32) { return IntegralImageOps.block_zero((GrayS32)integral,x0,y0,x1,y1); } else if( integral instanceof GrayS64) { return IntegralImageOps.block_zero((GrayS64)integral,x0,y0,x1,y1); } else { throw new IllegalArgumentException("Unknown input type"); } } }
public class class_name { public static <T extends ImageGray<T>> double block_zero( T integral , int x0 , int y0 , int x1 , int y1 ) { if( integral instanceof GrayF32) { return IntegralImageOps.block_zero((GrayF32)integral,x0,y0,x1,y1); // depends on control dependency: [if], data = [none] } else if( integral instanceof GrayF64) { return IntegralImageOps.block_zero((GrayF64)integral,x0,y0,x1,y1); // depends on control dependency: [if], data = [none] } else if( integral instanceof GrayS32) { return IntegralImageOps.block_zero((GrayS32)integral,x0,y0,x1,y1); // depends on control dependency: [if], data = [none] } else if( integral instanceof GrayS64) { return IntegralImageOps.block_zero((GrayS64)integral,x0,y0,x1,y1); // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException("Unknown input type"); } } }
public class class_name { protected boolean findLine(int pos) { if (pos == Position.NOPOS) return false; try { // try and recover buffer from soft reference cache if (buf == null && refBuf != null) buf = refBuf.get(); if (buf == null) { buf = initBuf(fileObject); lineStart = 0; line = 1; } else if (lineStart > pos) { // messages don't come in order lineStart = 0; line = 1; } int bp = lineStart; while (bp < bufLen && bp < pos) { switch (buf[bp++]) { case CR: if (bp < bufLen && buf[bp] == LF) bp++; line++; lineStart = bp; break; case LF: line++; lineStart = bp; break; } } return bp <= bufLen; } catch (IOException e) { log.directError("source.unavailable"); buf = new char[0]; return false; } } }
public class class_name { protected boolean findLine(int pos) { if (pos == Position.NOPOS) return false; try { // try and recover buffer from soft reference cache if (buf == null && refBuf != null) buf = refBuf.get(); if (buf == null) { buf = initBuf(fileObject); // depends on control dependency: [if], data = [none] lineStart = 0; // depends on control dependency: [if], data = [none] line = 1; // depends on control dependency: [if], data = [none] } else if (lineStart > pos) { // messages don't come in order lineStart = 0; // depends on control dependency: [if], data = [none] line = 1; // depends on control dependency: [if], data = [none] } int bp = lineStart; while (bp < bufLen && bp < pos) { switch (buf[bp++]) { case CR: if (bp < bufLen && buf[bp] == LF) bp++; line++; lineStart = bp; break; case LF: line++; lineStart = bp; break; } } return bp <= bufLen; // depends on control dependency: [try], data = [none] } catch (IOException e) { log.directError("source.unavailable"); buf = new char[0]; return false; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void marshall(DeleteClusterRequest deleteClusterRequest, ProtocolMarshaller protocolMarshaller) { if (deleteClusterRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteClusterRequest.getName(), NAME_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DeleteClusterRequest deleteClusterRequest, ProtocolMarshaller protocolMarshaller) { if (deleteClusterRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteClusterRequest.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static String URLEncode(String s, String enc) { if (s == null) { return "null"; } if (enc == null) { enc = "ISO-8859-1"; // Is this right? } StringBuffer out = new StringBuffer(s.length()); ByteArrayOutputStream buf = new ByteArrayOutputStream(); OutputStreamWriter writer = null; try { writer = new OutputStreamWriter(buf, enc); } catch (java.io.UnsupportedEncodingException ex) { // Use the default encoding? writer = new OutputStreamWriter(buf); } for (int i = 0; i < s.length(); i++) { int c = s.charAt(i); if (c == ' ') { out.append('+'); } else if (isSafeChar(c)) { out.append((char)c); } else { // convert to external encoding before hex conversion try { writer.write(c); writer.flush(); } catch(IOException e) { buf.reset(); continue; } byte[] ba = buf.toByteArray(); for (int j = 0; j < ba.length; j++) { out.append('%'); // Converting each byte in the buffer out.append(Character.forDigit((ba[j]>>4) & 0xf, 16)); out.append(Character.forDigit(ba[j] & 0xf, 16)); } buf.reset(); } } return out.toString(); } }
public class class_name { public static String URLEncode(String s, String enc) { if (s == null) { return "null"; // depends on control dependency: [if], data = [none] } if (enc == null) { enc = "ISO-8859-1"; // Is this right? // depends on control dependency: [if], data = [none] } StringBuffer out = new StringBuffer(s.length()); ByteArrayOutputStream buf = new ByteArrayOutputStream(); OutputStreamWriter writer = null; try { writer = new OutputStreamWriter(buf, enc); // depends on control dependency: [try], data = [none] } catch (java.io.UnsupportedEncodingException ex) { // Use the default encoding? writer = new OutputStreamWriter(buf); } // depends on control dependency: [catch], data = [none] for (int i = 0; i < s.length(); i++) { int c = s.charAt(i); if (c == ' ') { out.append('+'); // depends on control dependency: [if], data = [none] } else if (isSafeChar(c)) { out.append((char)c); // depends on control dependency: [if], data = [none] } else { // convert to external encoding before hex conversion try { writer.write(c); // depends on control dependency: [try], data = [none] writer.flush(); // depends on control dependency: [try], data = [none] } catch(IOException e) { buf.reset(); continue; } // depends on control dependency: [catch], data = [none] byte[] ba = buf.toByteArray(); for (int j = 0; j < ba.length; j++) { out.append('%'); // depends on control dependency: [for], data = [none] // Converting each byte in the buffer out.append(Character.forDigit((ba[j]>>4) & 0xf, 16)); // depends on control dependency: [for], data = [j] out.append(Character.forDigit(ba[j] & 0xf, 16)); // depends on control dependency: [for], data = [j] } buf.reset(); // depends on control dependency: [if], data = [none] } } return out.toString(); } }
public class class_name { public static DumpData toDumpData(Node node, PageContext pageContext, int maxlevel, DumpProperties props) { if (maxlevel <= 0) { return DumpUtil.MAX_LEVEL_REACHED; } maxlevel--; // Document if (node instanceof Document) { DumpTable table = new DumpTable("xml", "#cc9999", "#ffffff", "#000000"); table.setTitle("XML Document"); table.appendRow(1, new SimpleDumpData("XmlComment"), new SimpleDumpData(XMLUtil.getProperty(node, XMLUtil.XMLCOMMENT, null).toString())); table.appendRow(1, new SimpleDumpData("XmlRoot"), DumpUtil.toDumpData(XMLUtil.getProperty(node, XMLUtil.XMLROOT, null), pageContext, maxlevel, props)); return table; } // Element if (node instanceof Element) { DumpTable table = new DumpTable("xml", "#cc9999", "#ffffff", "#000000"); table.setTitle("XML Element"); table.appendRow(1, new SimpleDumpData("xmlName"), new SimpleDumpData(XMLUtil.getProperty(node, XMLUtil.XMLNAME, null).toString())); table.appendRow(1, new SimpleDumpData("XmlNsPrefix"), new SimpleDumpData(XMLUtil.getProperty(node, XMLUtil.XMLNSPREFIX, null).toString())); table.appendRow(1, new SimpleDumpData("XmlNsURI"), new SimpleDumpData(XMLUtil.getProperty(node, XMLUtil.XMLNSURI, null).toString())); table.appendRow(1, new SimpleDumpData("XmlText"), DumpUtil.toDumpData(XMLUtil.getProperty(node, XMLUtil.XMLTEXT, null), pageContext, maxlevel, props)); table.appendRow(1, new SimpleDumpData("XmlComment"), new SimpleDumpData(XMLUtil.getProperty(node, XMLUtil.XMLCOMMENT, null).toString())); table.appendRow(1, new SimpleDumpData("XmlAttributes"), DumpUtil.toDumpData(XMLUtil.getProperty(node, XMLUtil.XMLATTRIBUTES, null), pageContext, maxlevel, props)); table.appendRow(1, new SimpleDumpData("XmlChildren"), DumpUtil.toDumpData(XMLUtil.getProperty(node, XMLUtil.XMLCHILDREN, null), pageContext, maxlevel, props)); return table; } // Text if (node instanceof Text) { DumpTable table = new DumpTable("xml", "#cc9999", "#ffffff", "#000000"); table.setTitle("XML Text"); Text txt = (Text) node; table.appendRow(1, new SimpleDumpData("XmlText"), new SimpleDumpData(txt.getData())); return table; } // Attr if (node instanceof Attr) { DumpTable table = new DumpTable("xml", "#cc9999", "#ffffff", "#000000"); table.setTitle("XML Attr"); table.appendRow(1, new SimpleDumpData("xmlName"), new SimpleDumpData(XMLUtil.getProperty(node, XMLUtil.XMLNAME, null).toString())); table.appendRow(1, new SimpleDumpData("XmlValue"), DumpUtil.toDumpData(((Attr) node).getValue(), pageContext, maxlevel, props)); table.appendRow(1, new SimpleDumpData("XmlType"), new SimpleDumpData(XMLUtil.getTypeAsString(node, true))); return table; } // Node DumpTable table = new DumpTable("xml", "#cc9999", "#ffffff", "#000000"); table.setTitle("XML Node (" + ListUtil.last(node.getClass().getName(), ".", true) + ")"); table.appendRow(1, new SimpleDumpData("xmlName"), new SimpleDumpData(XMLUtil.getProperty(node, XMLUtil.XMLNAME, null).toString())); table.appendRow(1, new SimpleDumpData("XmlNsPrefix"), new SimpleDumpData(XMLUtil.getProperty(node, XMLUtil.XMLNSPREFIX, null).toString())); table.appendRow(1, new SimpleDumpData("XmlNsURI"), new SimpleDumpData(XMLUtil.getProperty(node, XMLUtil.XMLNSURI, null).toString())); table.appendRow(1, new SimpleDumpData("XmlText"), DumpUtil.toDumpData(XMLUtil.getProperty(node, XMLUtil.XMLTEXT, null), pageContext, maxlevel, props)); table.appendRow(1, new SimpleDumpData("XmlComment"), new SimpleDumpData(XMLUtil.getProperty(node, XMLUtil.XMLCOMMENT, null).toString())); table.appendRow(1, new SimpleDumpData("XmlAttributes"), DumpUtil.toDumpData(XMLUtil.getProperty(node, XMLUtil.XMLATTRIBUTES, null), pageContext, maxlevel, props)); table.appendRow(1, new SimpleDumpData("XmlChildren"), DumpUtil.toDumpData(XMLUtil.getProperty(node, XMLUtil.XMLCHILDREN, null), pageContext, maxlevel, props)); table.appendRow(1, new SimpleDumpData("XmlType"), new SimpleDumpData(XMLUtil.getTypeAsString(node, true))); return table; } }
public class class_name { public static DumpData toDumpData(Node node, PageContext pageContext, int maxlevel, DumpProperties props) { if (maxlevel <= 0) { return DumpUtil.MAX_LEVEL_REACHED; // depends on control dependency: [if], data = [none] } maxlevel--; // Document if (node instanceof Document) { DumpTable table = new DumpTable("xml", "#cc9999", "#ffffff", "#000000"); table.setTitle("XML Document"); // depends on control dependency: [if], data = [none] table.appendRow(1, new SimpleDumpData("XmlComment"), new SimpleDumpData(XMLUtil.getProperty(node, XMLUtil.XMLCOMMENT, null).toString())); // depends on control dependency: [if], data = [none] table.appendRow(1, new SimpleDumpData("XmlRoot"), DumpUtil.toDumpData(XMLUtil.getProperty(node, XMLUtil.XMLROOT, null), pageContext, maxlevel, props)); // depends on control dependency: [if], data = [none] return table; // depends on control dependency: [if], data = [none] } // Element if (node instanceof Element) { DumpTable table = new DumpTable("xml", "#cc9999", "#ffffff", "#000000"); table.setTitle("XML Element"); // depends on control dependency: [if], data = [none] table.appendRow(1, new SimpleDumpData("xmlName"), new SimpleDumpData(XMLUtil.getProperty(node, XMLUtil.XMLNAME, null).toString())); // depends on control dependency: [if], data = [none] table.appendRow(1, new SimpleDumpData("XmlNsPrefix"), new SimpleDumpData(XMLUtil.getProperty(node, XMLUtil.XMLNSPREFIX, null).toString())); // depends on control dependency: [if], data = [none] table.appendRow(1, new SimpleDumpData("XmlNsURI"), new SimpleDumpData(XMLUtil.getProperty(node, XMLUtil.XMLNSURI, null).toString())); // depends on control dependency: [if], data = [none] table.appendRow(1, new SimpleDumpData("XmlText"), DumpUtil.toDumpData(XMLUtil.getProperty(node, XMLUtil.XMLTEXT, null), pageContext, maxlevel, props)); // depends on control dependency: [if], data = [none] table.appendRow(1, new SimpleDumpData("XmlComment"), new SimpleDumpData(XMLUtil.getProperty(node, XMLUtil.XMLCOMMENT, null).toString())); // depends on control dependency: [if], data = [none] table.appendRow(1, new SimpleDumpData("XmlAttributes"), DumpUtil.toDumpData(XMLUtil.getProperty(node, XMLUtil.XMLATTRIBUTES, null), pageContext, maxlevel, props)); // depends on control dependency: [if], data = [none] table.appendRow(1, new SimpleDumpData("XmlChildren"), DumpUtil.toDumpData(XMLUtil.getProperty(node, XMLUtil.XMLCHILDREN, null), pageContext, maxlevel, props)); // depends on control dependency: [if], data = [none] return table; // depends on control dependency: [if], data = [none] } // Text if (node instanceof Text) { DumpTable table = new DumpTable("xml", "#cc9999", "#ffffff", "#000000"); table.setTitle("XML Text"); // depends on control dependency: [if], data = [none] Text txt = (Text) node; table.appendRow(1, new SimpleDumpData("XmlText"), new SimpleDumpData(txt.getData())); // depends on control dependency: [if], data = [none] return table; // depends on control dependency: [if], data = [none] } // Attr if (node instanceof Attr) { DumpTable table = new DumpTable("xml", "#cc9999", "#ffffff", "#000000"); table.setTitle("XML Attr"); // depends on control dependency: [if], data = [none] table.appendRow(1, new SimpleDumpData("xmlName"), new SimpleDumpData(XMLUtil.getProperty(node, XMLUtil.XMLNAME, null).toString())); // depends on control dependency: [if], data = [none] table.appendRow(1, new SimpleDumpData("XmlValue"), DumpUtil.toDumpData(((Attr) node).getValue(), pageContext, maxlevel, props)); // depends on control dependency: [if], data = [none] table.appendRow(1, new SimpleDumpData("XmlType"), new SimpleDumpData(XMLUtil.getTypeAsString(node, true))); // depends on control dependency: [if], data = [none] return table; // depends on control dependency: [if], data = [none] } // Node DumpTable table = new DumpTable("xml", "#cc9999", "#ffffff", "#000000"); table.setTitle("XML Node (" + ListUtil.last(node.getClass().getName(), ".", true) + ")"); table.appendRow(1, new SimpleDumpData("xmlName"), new SimpleDumpData(XMLUtil.getProperty(node, XMLUtil.XMLNAME, null).toString())); table.appendRow(1, new SimpleDumpData("XmlNsPrefix"), new SimpleDumpData(XMLUtil.getProperty(node, XMLUtil.XMLNSPREFIX, null).toString())); table.appendRow(1, new SimpleDumpData("XmlNsURI"), new SimpleDumpData(XMLUtil.getProperty(node, XMLUtil.XMLNSURI, null).toString())); table.appendRow(1, new SimpleDumpData("XmlText"), DumpUtil.toDumpData(XMLUtil.getProperty(node, XMLUtil.XMLTEXT, null), pageContext, maxlevel, props)); table.appendRow(1, new SimpleDumpData("XmlComment"), new SimpleDumpData(XMLUtil.getProperty(node, XMLUtil.XMLCOMMENT, null).toString())); table.appendRow(1, new SimpleDumpData("XmlAttributes"), DumpUtil.toDumpData(XMLUtil.getProperty(node, XMLUtil.XMLATTRIBUTES, null), pageContext, maxlevel, props)); table.appendRow(1, new SimpleDumpData("XmlChildren"), DumpUtil.toDumpData(XMLUtil.getProperty(node, XMLUtil.XMLCHILDREN, null), pageContext, maxlevel, props)); table.appendRow(1, new SimpleDumpData("XmlType"), new SimpleDumpData(XMLUtil.getTypeAsString(node, true))); return table; } }
public class class_name { DataSource getDataSource() { if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINER)) { LoggingUtil.SESSION_LOGGER_WAS.entering(methodClassName, methodNames[GET_DATA_SOURCE]); } if (dataSource != null) return dataSource; try { // Properties p = new Properties(); // // p.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory"); // InitialContext ic = new javax.naming.InitialContext(p); beginDBContext(); // PK06395/d321615 // dataSource = (DataSource) ic.lookup(_smc.getJNDIDataSourceName()); ResourceConfig rc = this.getDatabaseStoreService().getResourceConfigFactory().createResourceConfig("javax.sql.DataSource"); rc.setResAuthType(ResourceConfig.AUTH_CONTAINER); rc.setSharingScope(ResourceConfig.SHARING_SCOPE_SHAREABLE); rc.setIsolationLevel(Connection.TRANSACTION_READ_COMMITTED); // ResRef.APPLICATION, // resAuth - org.eclipse.jst.j2ee.common.ResAuthTypeBase.APPLICATION= // ResRef.SHAREABLE, // resSharingScope - org.eclipse.jst.j2ee.common.ResSharingScopeType.SHAREABLE // ResRef.TRANSACTION_READ_COMMITTED); // resIsolationLevel - com.ibm.ejs.models.base.extensions.commonext.IsolationLevelKind.TRANSACTION_READ_COMMITTED dataSource = (DataSource) this.getDatabaseStoreService().getDataSourceFactory().createResource(rc); // dataSource = (DataSource)SessionMgrComponentImpl.getDataSourceFactory().createResource(null); // direct JNDI lookup endDBContext(); // PK06395/d321615 return dataSource; } catch (Exception e) { com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ws.session.store.db.DatabaseHashMap.getDataSource", "558", this); LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[GET_DATA_SOURCE], "DatabaseHashMap.dataSrcErr"); LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[GET_DATA_SOURCE], "CommonMessage.exception", e); dataSource = null; } return null; } }
public class class_name { DataSource getDataSource() { if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINER)) { LoggingUtil.SESSION_LOGGER_WAS.entering(methodClassName, methodNames[GET_DATA_SOURCE]); // depends on control dependency: [if], data = [none] } if (dataSource != null) return dataSource; try { // Properties p = new Properties(); // // p.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory"); // InitialContext ic = new javax.naming.InitialContext(p); beginDBContext(); // PK06395/d321615 // depends on control dependency: [try], data = [none] // dataSource = (DataSource) ic.lookup(_smc.getJNDIDataSourceName()); ResourceConfig rc = this.getDatabaseStoreService().getResourceConfigFactory().createResourceConfig("javax.sql.DataSource"); rc.setResAuthType(ResourceConfig.AUTH_CONTAINER); // depends on control dependency: [try], data = [none] rc.setSharingScope(ResourceConfig.SHARING_SCOPE_SHAREABLE); // depends on control dependency: [try], data = [none] rc.setIsolationLevel(Connection.TRANSACTION_READ_COMMITTED); // depends on control dependency: [try], data = [none] // ResRef.APPLICATION, // resAuth - org.eclipse.jst.j2ee.common.ResAuthTypeBase.APPLICATION= // ResRef.SHAREABLE, // resSharingScope - org.eclipse.jst.j2ee.common.ResSharingScopeType.SHAREABLE // ResRef.TRANSACTION_READ_COMMITTED); // resIsolationLevel - com.ibm.ejs.models.base.extensions.commonext.IsolationLevelKind.TRANSACTION_READ_COMMITTED dataSource = (DataSource) this.getDatabaseStoreService().getDataSourceFactory().createResource(rc); // depends on control dependency: [try], data = [none] // dataSource = (DataSource)SessionMgrComponentImpl.getDataSourceFactory().createResource(null); // direct JNDI lookup endDBContext(); // PK06395/d321615 // depends on control dependency: [try], data = [none] return dataSource; // depends on control dependency: [try], data = [none] } catch (Exception e) { com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ws.session.store.db.DatabaseHashMap.getDataSource", "558", this); LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[GET_DATA_SOURCE], "DatabaseHashMap.dataSrcErr"); LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[GET_DATA_SOURCE], "CommonMessage.exception", e); dataSource = null; } // depends on control dependency: [catch], data = [none] return null; } }
public class class_name { public FunctionType<TldTaglibType<T>> getOrCreateFunction() { List<Node> nodeList = childNode.get("function"); if (nodeList != null && nodeList.size() > 0) { return new FunctionTypeImpl<TldTaglibType<T>>(this, "function", childNode, nodeList.get(0)); } return createFunction(); } }
public class class_name { public FunctionType<TldTaglibType<T>> getOrCreateFunction() { List<Node> nodeList = childNode.get("function"); if (nodeList != null && nodeList.size() > 0) { return new FunctionTypeImpl<TldTaglibType<T>>(this, "function", childNode, nodeList.get(0)); // depends on control dependency: [if], data = [none] } return createFunction(); } }
public class class_name { public void marshall(OperationFilter operationFilter, ProtocolMarshaller protocolMarshaller) { if (operationFilter == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(operationFilter.getName(), NAME_BINDING); protocolMarshaller.marshall(operationFilter.getValues(), VALUES_BINDING); protocolMarshaller.marshall(operationFilter.getCondition(), CONDITION_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(OperationFilter operationFilter, ProtocolMarshaller protocolMarshaller) { if (operationFilter == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(operationFilter.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(operationFilter.getValues(), VALUES_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(operationFilter.getCondition(), CONDITION_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void marshall(RestoreJobsListMember restoreJobsListMember, ProtocolMarshaller protocolMarshaller) { if (restoreJobsListMember == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(restoreJobsListMember.getRestoreJobId(), RESTOREJOBID_BINDING); protocolMarshaller.marshall(restoreJobsListMember.getRecoveryPointArn(), RECOVERYPOINTARN_BINDING); protocolMarshaller.marshall(restoreJobsListMember.getCreationDate(), CREATIONDATE_BINDING); protocolMarshaller.marshall(restoreJobsListMember.getCompletionDate(), COMPLETIONDATE_BINDING); protocolMarshaller.marshall(restoreJobsListMember.getStatus(), STATUS_BINDING); protocolMarshaller.marshall(restoreJobsListMember.getStatusMessage(), STATUSMESSAGE_BINDING); protocolMarshaller.marshall(restoreJobsListMember.getPercentDone(), PERCENTDONE_BINDING); protocolMarshaller.marshall(restoreJobsListMember.getBackupSizeInBytes(), BACKUPSIZEINBYTES_BINDING); protocolMarshaller.marshall(restoreJobsListMember.getIamRoleArn(), IAMROLEARN_BINDING); protocolMarshaller.marshall(restoreJobsListMember.getExpectedCompletionTimeMinutes(), EXPECTEDCOMPLETIONTIMEMINUTES_BINDING); protocolMarshaller.marshall(restoreJobsListMember.getCreatedResourceArn(), CREATEDRESOURCEARN_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(RestoreJobsListMember restoreJobsListMember, ProtocolMarshaller protocolMarshaller) { if (restoreJobsListMember == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(restoreJobsListMember.getRestoreJobId(), RESTOREJOBID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(restoreJobsListMember.getRecoveryPointArn(), RECOVERYPOINTARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(restoreJobsListMember.getCreationDate(), CREATIONDATE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(restoreJobsListMember.getCompletionDate(), COMPLETIONDATE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(restoreJobsListMember.getStatus(), STATUS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(restoreJobsListMember.getStatusMessage(), STATUSMESSAGE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(restoreJobsListMember.getPercentDone(), PERCENTDONE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(restoreJobsListMember.getBackupSizeInBytes(), BACKUPSIZEINBYTES_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(restoreJobsListMember.getIamRoleArn(), IAMROLEARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(restoreJobsListMember.getExpectedCompletionTimeMinutes(), EXPECTEDCOMPLETIONTIMEMINUTES_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(restoreJobsListMember.getCreatedResourceArn(), CREATEDRESOURCEARN_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void beginBatchedUpdates() { if (mCallback instanceof BatchedCallback) { return; } if (mBatchedCallback == null) { mBatchedCallback = new BatchedCallback(mCallback); } mCallback = mBatchedCallback; } }
public class class_name { public void beginBatchedUpdates() { if (mCallback instanceof BatchedCallback) { return; // depends on control dependency: [if], data = [none] } if (mBatchedCallback == null) { mBatchedCallback = new BatchedCallback(mCallback); // depends on control dependency: [if], data = [none] } mCallback = mBatchedCallback; } }
public class class_name { public ResponseDownloadResource toDownloadResource() { final ResponseDownloadResource resource = createResponseDownloadResource(); if (contentType != null) { resource.contentType(contentType); } for (Entry<String, String[]> entry : headerMap.entrySet()) { resource.header(entry.getKey(), entry.getValue()); } if (needsFileNameEncoding) { resource.encodeFileName(getHeaderFileNameEncoding()); // should be before content-disposition process } if (reservedHeaderContentDispositionAttachment) { resource.headerContentDispositionAttachment(); } if (reservedHeaderContentDispositionInline) { resource.headerContentDispositionInline(); } if (!returnAsEmptyBody && byteData == null && streamCall == null && zipStreamCall == null) { throwStreamByteDataInputStreamNotFoundException(); } if (byteData != null) { resource.data(byteData); } if (streamCall != null) { if (contentLength != null) { resource.stream(streamCall, contentLength); } else { resource.stream(streamCall); } } if (zipStreamCall != null) { resource.zipStreamChunked(zipStreamCall); } if (returnAsEmptyBody) { resource.asEmptyBody(); } return resource; } }
public class class_name { public ResponseDownloadResource toDownloadResource() { final ResponseDownloadResource resource = createResponseDownloadResource(); if (contentType != null) { resource.contentType(contentType); // depends on control dependency: [if], data = [(contentType] } for (Entry<String, String[]> entry : headerMap.entrySet()) { resource.header(entry.getKey(), entry.getValue()); // depends on control dependency: [for], data = [entry] } if (needsFileNameEncoding) { resource.encodeFileName(getHeaderFileNameEncoding()); // should be before content-disposition process // depends on control dependency: [if], data = [none] } if (reservedHeaderContentDispositionAttachment) { resource.headerContentDispositionAttachment(); // depends on control dependency: [if], data = [none] } if (reservedHeaderContentDispositionInline) { resource.headerContentDispositionInline(); // depends on control dependency: [if], data = [none] } if (!returnAsEmptyBody && byteData == null && streamCall == null && zipStreamCall == null) { throwStreamByteDataInputStreamNotFoundException(); // depends on control dependency: [if], data = [none] } if (byteData != null) { resource.data(byteData); // depends on control dependency: [if], data = [(byteData] } if (streamCall != null) { if (contentLength != null) { resource.stream(streamCall, contentLength); // depends on control dependency: [if], data = [none] } else { resource.stream(streamCall); // depends on control dependency: [if], data = [none] } } if (zipStreamCall != null) { resource.zipStreamChunked(zipStreamCall); // depends on control dependency: [if], data = [(zipStreamCall] } if (returnAsEmptyBody) { resource.asEmptyBody(); // depends on control dependency: [if], data = [none] } return resource; } }
public class class_name { private I_CmsSearchDocument appendFieldsForListSortOptions(I_CmsSearchDocument document) { // add non-localized fields // add instance date String fieldName = CmsSearchField.FIELD_INSTANCEDATE + CmsSearchField.FIELD_POSTFIX_DATE; Date instanceDate = document.getFieldValueAsDate(fieldName); if ((null == instanceDate) || (instanceDate.getTime() == 0)) { String instanceDateCopyField = document.getFieldValueAsString( CmsPropertyDefinition.PROPERTY_INSTANCEDATE_COPYFIELD + CmsSearchField.FIELD_DYNAMIC_PROPERTIES); if (null != instanceDateCopyField) { instanceDate = document.getFieldValueAsDate(instanceDateCopyField); } if ((null == instanceDate) || (instanceDate.getTime() == 0)) { instanceDate = document.getFieldValueAsDate(CmsSearchField.FIELD_DATE_RELEASED); } if ((null == instanceDate) || (instanceDate.getTime() == 0)) { instanceDate = document.getFieldValueAsDate(CmsSearchField.FIELD_DATE_LASTMODIFIED); } document.addDateField(fieldName, instanceDate.getTime(), false); } // add disp-title field fieldName = CmsSearchField.FIELD_DISPTITLE + CmsSearchField.FIELD_POSTFIX_SORT; String dispTitle = document.getFieldValueAsString(fieldName); if (null == dispTitle) { dispTitle = document.getFieldValueAsString( CmsPropertyDefinition.PROPERTY_TITLE + CmsSearchField.FIELD_DYNAMIC_PROPERTIES_DIRECT); if (null == dispTitle) { dispTitle = document.getFieldValueAsString(CmsSearchField.FIELD_FILENAME); } document.addSearchField(new CmsSolrField(fieldName, null, null, null), dispTitle); } // add disp-order field fieldName = CmsSearchField.FIELD_DISPORDER + CmsSearchField.FIELD_POSTFIX_INT; String dispOrder = document.getFieldValueAsString(fieldName); if (null == dispOrder) { dispOrder = document.getFieldValueAsString( CmsPropertyDefinition.PROPERTY_DISPLAY_ORDER + CmsSearchField.FIELD_DYNAMIC_PROPERTIES); if (null != dispOrder) { try { int o = Integer.parseInt(dispOrder); dispOrder = String.valueOf(o); } catch (NullPointerException | NumberFormatException e) { LOG.warn( "Property " + CmsPropertyDefinition.PROPERTY_DISPLAY_ORDER + " contains not a valid integer number."); dispOrder = "0"; } } else { dispOrder = "0"; } document.addSearchField(new CmsSolrField(fieldName, null, null, null), dispOrder); } // add localized fields for (String locale : document.getMultivaluedFieldAsStringList(CmsSearchField.FIELD_CONTENT_LOCALES)) { // instance date fieldName = CmsSearchField.FIELD_INSTANCEDATE + "_" + locale + CmsSearchField.FIELD_POSTFIX_DATE; Date presetInstanceDate = document.getFieldValueAsDate(fieldName); if ((null == presetInstanceDate) || (presetInstanceDate.getTime() == 0)) { document.addDateField(fieldName, instanceDate.getTime(), false); } // disp-title field for title display and sorting fieldName = CmsSearchField.FIELD_DISPTITLE + "_" + locale + CmsSearchField.FIELD_POSTFIX_SORT; if (null == document.getFieldValueAsString(fieldName)) { String localizedTitle = document.getFieldValueAsString( CmsPropertyDefinition.PROPERTY_TITLE + "_" + locale + CmsSearchField.FIELD_DYNAMIC_PROPERTIES_DIRECT); document.addSearchField( new CmsSolrField(fieldName, null, null, null), null == localizedTitle ? dispTitle : localizedTitle); } // disp-order field fieldName = CmsSearchField.FIELD_DISPORDER + "_" + locale + CmsSearchField.FIELD_POSTFIX_INT; if (null == document.getFieldValueAsString(fieldName)) { String localizedOrder = document.getFieldValueAsString( CmsPropertyDefinition.PROPERTY_DISPLAY_ORDER + "_" + locale + CmsSearchField.FIELD_DYNAMIC_PROPERTIES); if (null != localizedOrder) { try { int o = Integer.parseInt(localizedOrder); localizedOrder = String.valueOf(o); } catch (NullPointerException | NumberFormatException e) { LOG.warn( "Property " + CmsPropertyDefinition.PROPERTY_DISPLAY_ORDER + "_" + locale + " contains not a valid integer number."); } } document.addSearchField( new CmsSolrField(fieldName, null, null, null), null == localizedOrder ? dispOrder : localizedOrder); } } return document; } }
public class class_name { private I_CmsSearchDocument appendFieldsForListSortOptions(I_CmsSearchDocument document) { // add non-localized fields // add instance date String fieldName = CmsSearchField.FIELD_INSTANCEDATE + CmsSearchField.FIELD_POSTFIX_DATE; Date instanceDate = document.getFieldValueAsDate(fieldName); if ((null == instanceDate) || (instanceDate.getTime() == 0)) { String instanceDateCopyField = document.getFieldValueAsString( CmsPropertyDefinition.PROPERTY_INSTANCEDATE_COPYFIELD + CmsSearchField.FIELD_DYNAMIC_PROPERTIES); if (null != instanceDateCopyField) { instanceDate = document.getFieldValueAsDate(instanceDateCopyField); // depends on control dependency: [if], data = [instanceDateCopyField)] } if ((null == instanceDate) || (instanceDate.getTime() == 0)) { instanceDate = document.getFieldValueAsDate(CmsSearchField.FIELD_DATE_RELEASED); // depends on control dependency: [if], data = [none] } if ((null == instanceDate) || (instanceDate.getTime() == 0)) { instanceDate = document.getFieldValueAsDate(CmsSearchField.FIELD_DATE_LASTMODIFIED); // depends on control dependency: [if], data = [none] } document.addDateField(fieldName, instanceDate.getTime(), false); // depends on control dependency: [if], data = [none] } // add disp-title field fieldName = CmsSearchField.FIELD_DISPTITLE + CmsSearchField.FIELD_POSTFIX_SORT; String dispTitle = document.getFieldValueAsString(fieldName); if (null == dispTitle) { dispTitle = document.getFieldValueAsString( CmsPropertyDefinition.PROPERTY_TITLE + CmsSearchField.FIELD_DYNAMIC_PROPERTIES_DIRECT); // depends on control dependency: [if], data = [none] if (null == dispTitle) { dispTitle = document.getFieldValueAsString(CmsSearchField.FIELD_FILENAME); // depends on control dependency: [if], data = [none] } document.addSearchField(new CmsSolrField(fieldName, null, null, null), dispTitle); // depends on control dependency: [if], data = [dispTitle)] } // add disp-order field fieldName = CmsSearchField.FIELD_DISPORDER + CmsSearchField.FIELD_POSTFIX_INT; String dispOrder = document.getFieldValueAsString(fieldName); if (null == dispOrder) { dispOrder = document.getFieldValueAsString( CmsPropertyDefinition.PROPERTY_DISPLAY_ORDER + CmsSearchField.FIELD_DYNAMIC_PROPERTIES); // depends on control dependency: [if], data = [none] if (null != dispOrder) { try { int o = Integer.parseInt(dispOrder); dispOrder = String.valueOf(o); // depends on control dependency: [try], data = [none] } catch (NullPointerException | NumberFormatException e) { LOG.warn( "Property " + CmsPropertyDefinition.PROPERTY_DISPLAY_ORDER + " contains not a valid integer number."); dispOrder = "0"; } // depends on control dependency: [catch], data = [none] } else { dispOrder = "0"; // depends on control dependency: [if], data = [none] } document.addSearchField(new CmsSolrField(fieldName, null, null, null), dispOrder); // depends on control dependency: [if], data = [dispOrder)] } // add localized fields for (String locale : document.getMultivaluedFieldAsStringList(CmsSearchField.FIELD_CONTENT_LOCALES)) { // instance date fieldName = CmsSearchField.FIELD_INSTANCEDATE + "_" + locale + CmsSearchField.FIELD_POSTFIX_DATE; // depends on control dependency: [for], data = [locale] Date presetInstanceDate = document.getFieldValueAsDate(fieldName); if ((null == presetInstanceDate) || (presetInstanceDate.getTime() == 0)) { document.addDateField(fieldName, instanceDate.getTime(), false); // depends on control dependency: [if], data = [none] } // disp-title field for title display and sorting fieldName = CmsSearchField.FIELD_DISPTITLE + "_" + locale + CmsSearchField.FIELD_POSTFIX_SORT; // depends on control dependency: [for], data = [locale] if (null == document.getFieldValueAsString(fieldName)) { String localizedTitle = document.getFieldValueAsString( CmsPropertyDefinition.PROPERTY_TITLE + "_" + locale + CmsSearchField.FIELD_DYNAMIC_PROPERTIES_DIRECT); document.addSearchField( new CmsSolrField(fieldName, null, null, null), null == localizedTitle ? dispTitle : localizedTitle); // depends on control dependency: [if], data = [none] } // disp-order field fieldName = CmsSearchField.FIELD_DISPORDER + "_" + locale + CmsSearchField.FIELD_POSTFIX_INT; // depends on control dependency: [for], data = [locale] if (null == document.getFieldValueAsString(fieldName)) { String localizedOrder = document.getFieldValueAsString( CmsPropertyDefinition.PROPERTY_DISPLAY_ORDER + "_" + locale + CmsSearchField.FIELD_DYNAMIC_PROPERTIES); if (null != localizedOrder) { try { int o = Integer.parseInt(localizedOrder); localizedOrder = String.valueOf(o); // depends on control dependency: [try], data = [none] } catch (NullPointerException | NumberFormatException e) { LOG.warn( "Property " + CmsPropertyDefinition.PROPERTY_DISPLAY_ORDER + "_" + locale + " contains not a valid integer number."); } // depends on control dependency: [catch], data = [none] } document.addSearchField( new CmsSolrField(fieldName, null, null, null), null == localizedOrder ? dispOrder : localizedOrder); // depends on control dependency: [if], data = [none] } } return document; } }
public class class_name { @SuppressWarnings("WeakerAccess") public synchronized void stop() { if (isRunning()) { final Set<DeviceAnnouncement> lastDevices = getCurrentDevices(); socket.get().close(); socket.set(null); devices.clear(); firstDeviceTime.set(0); // Report the loss of all our devices, on the proper thread, outside our lock SwingUtilities.invokeLater(new Runnable() { @Override public void run() { for (DeviceAnnouncement announcement : lastDevices) { deliverLostAnnouncement(announcement); } } }); deliverLifecycleAnnouncement(logger, false); } } }
public class class_name { @SuppressWarnings("WeakerAccess") public synchronized void stop() { if (isRunning()) { final Set<DeviceAnnouncement> lastDevices = getCurrentDevices(); socket.get().close(); // depends on control dependency: [if], data = [none] socket.set(null); // depends on control dependency: [if], data = [none] devices.clear(); // depends on control dependency: [if], data = [none] firstDeviceTime.set(0); // depends on control dependency: [if], data = [none] // Report the loss of all our devices, on the proper thread, outside our lock SwingUtilities.invokeLater(new Runnable() { @Override public void run() { for (DeviceAnnouncement announcement : lastDevices) { deliverLostAnnouncement(announcement); // depends on control dependency: [for], data = [announcement] } } }); // depends on control dependency: [if], data = [none] deliverLifecycleAnnouncement(logger, false); // depends on control dependency: [if], data = [none] } } }
public class class_name { public EEnum getObjectContainerPresentationSpaceSizePDFSize() { if (objectContainerPresentationSpaceSizePDFSizeEEnum == null) { objectContainerPresentationSpaceSizePDFSizeEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(177); } return objectContainerPresentationSpaceSizePDFSizeEEnum; } }
public class class_name { public EEnum getObjectContainerPresentationSpaceSizePDFSize() { if (objectContainerPresentationSpaceSizePDFSizeEEnum == null) { objectContainerPresentationSpaceSizePDFSizeEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(177); // depends on control dependency: [if], data = [none] } return objectContainerPresentationSpaceSizePDFSizeEEnum; } }
public class class_name { public LookupResult resolveName(String name, CompilationUnit compilationUnit) { ClassNode res = getFromClassCache(name); if (res==NO_CLASS) return null; if (res!=null) return new LookupResult(null,res); LookupResult lr = findClassNode(name, compilationUnit); if (lr != null) { if (lr.isClassNode()) cacheClass(name, lr.getClassNode()); return lr; } else { cacheClass(name, NO_CLASS); return null; } } }
public class class_name { public LookupResult resolveName(String name, CompilationUnit compilationUnit) { ClassNode res = getFromClassCache(name); if (res==NO_CLASS) return null; if (res!=null) return new LookupResult(null,res); LookupResult lr = findClassNode(name, compilationUnit); if (lr != null) { if (lr.isClassNode()) cacheClass(name, lr.getClassNode()); return lr; // depends on control dependency: [if], data = [none] } else { cacheClass(name, NO_CLASS); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static String getLocaleNames(List<Locale> locales) { StringBuffer result = new StringBuffer(); if (locales != null) { Iterator<Locale> i = locales.iterator(); while (i.hasNext()) { result.append(i.next().toString()); if (i.hasNext()) { result.append(", "); } } } return result.toString(); } }
public class class_name { public static String getLocaleNames(List<Locale> locales) { StringBuffer result = new StringBuffer(); if (locales != null) { Iterator<Locale> i = locales.iterator(); while (i.hasNext()) { result.append(i.next().toString()); // depends on control dependency: [while], data = [none] if (i.hasNext()) { result.append(", "); // depends on control dependency: [if], data = [none] } } } return result.toString(); } }
public class class_name { private TableView getDefaultTableView() { // No user input. String viewStr = System.getProperty("use.view"); if ( viewStr == null ) { jmiGetter.setEnabled( false ); return new GetterTableView( currFile ); } // Valid user input. if ( viewStr.equalsIgnoreCase("hex") ) { jmiHex.setEnabled( false ); return new HexTableView( currFile ); } else if ( viewStr.equalsIgnoreCase("date") ) { jmiDate.setEnabled( false ); return new DateTableView( currFile ); } else if ( viewStr.equalsIgnoreCase("cal") ) { jmiCal.setEnabled( false ); return new CalTableView( currFile ); } else if ( viewStr.equalsIgnoreCase("getter") ) { jmiGetter.setEnabled( false ); return new GetterTableView( currFile ); } else { // error by user System.err.println("View name: " + viewStr + " invalid."); jmiGetter.setEnabled( false ); return new GetterTableView( currFile ); } } }
public class class_name { private TableView getDefaultTableView() { // No user input. String viewStr = System.getProperty("use.view"); if ( viewStr == null ) { jmiGetter.setEnabled( false ); // depends on control dependency: [if], data = [none] return new GetterTableView( currFile ); // depends on control dependency: [if], data = [none] } // Valid user input. if ( viewStr.equalsIgnoreCase("hex") ) { jmiHex.setEnabled( false ); // depends on control dependency: [if], data = [none] return new HexTableView( currFile ); // depends on control dependency: [if], data = [none] } else if ( viewStr.equalsIgnoreCase("date") ) { jmiDate.setEnabled( false ); // depends on control dependency: [if], data = [none] return new DateTableView( currFile ); // depends on control dependency: [if], data = [none] } else if ( viewStr.equalsIgnoreCase("cal") ) { jmiCal.setEnabled( false ); // depends on control dependency: [if], data = [none] return new CalTableView( currFile ); // depends on control dependency: [if], data = [none] } else if ( viewStr.equalsIgnoreCase("getter") ) { jmiGetter.setEnabled( false ); // depends on control dependency: [if], data = [none] return new GetterTableView( currFile ); // depends on control dependency: [if], data = [none] } else { // error by user System.err.println("View name: " + viewStr + " invalid."); // depends on control dependency: [if], data = [none] jmiGetter.setEnabled( false ); // depends on control dependency: [if], data = [none] return new GetterTableView( currFile ); // depends on control dependency: [if], data = [none] } } }
public class class_name { public boolean isMatch(String expectedSignature, Request request) { try { return isMatch(Base64.decode(expectedSignature), request); } catch (IOException e) { throw new RequestSigningException(e); } } }
public class class_name { public boolean isMatch(String expectedSignature, Request request) { try { return isMatch(Base64.decode(expectedSignature), request); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new RequestSigningException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public RuntimeEngine getRuntimeEngine(Context<?> context) { KnowledgeRuntimeEngine runtimeEngine; if (context == null || _type != KnowledgeRuntimeManagerType.PER_PROCESS_INSTANCE) { context = EmptyContext.get(); } final ClassLoader origTCCL = Classes.setTCCL(_classLoader); try { RuntimeEngine wrapped = _runtimeManager.getRuntimeEngine(context); initRuntimeEngine(wrapped); runtimeEngine = new KnowledgeRuntimeEngine(wrapped, _persistent); } finally { Classes.setTCCL(origTCCL); } return runtimeEngine; } }
public class class_name { @Override public RuntimeEngine getRuntimeEngine(Context<?> context) { KnowledgeRuntimeEngine runtimeEngine; if (context == null || _type != KnowledgeRuntimeManagerType.PER_PROCESS_INSTANCE) { context = EmptyContext.get(); // depends on control dependency: [if], data = [none] } final ClassLoader origTCCL = Classes.setTCCL(_classLoader); try { RuntimeEngine wrapped = _runtimeManager.getRuntimeEngine(context); initRuntimeEngine(wrapped); // depends on control dependency: [try], data = [none] runtimeEngine = new KnowledgeRuntimeEngine(wrapped, _persistent); // depends on control dependency: [try], data = [none] } finally { Classes.setTCCL(origTCCL); } return runtimeEngine; } }
public class class_name { public ResourceBundle getResourceBundle(Class<?> aClass, String bundleName, Locale locale) { ResourceBundle bundle = null; ClassLoader classLoader = null; if (bundleName == null) // instead of waiting for ResourceBundle to // throw the NPE, do it now throw new NullPointerException("Unable to load resource bundle: null bundleName"); if (locale == null) locale = Locale.getDefault(); // TODO: add resource bundle cache.. ? // yikes! TRY to figure out the class from the callstack-- // have to do this every time aClass is null coming in, which is // definitely not optimal, but at least makes sure the resource bundle // is loaded from the right place if (aClass == null) { if (finder == null) finder = StackFinder.getInstance(); if (finder != null) aClass = finder.getCaller(); } if (aClass != null) { // If aClass is NOT null (it was passed in, or we found it), // use its classloader first to try loading the resource bundle try { classLoader = aClass.getClassLoader(); bundle = ResourceBundle.getBundle(bundleName, locale, classLoader); } catch (RuntimeException re) { logEvent("Unable to load {0} from {1} (from class {2}) in {3}; caught exception: {4}", new Object[] { bundleName, classLoader, aClass, locale, re }); } } if (bundle == null) { // If the bundle wasn't found using the class' classloader, // try the default classloader (in OSGi, will be in the RAS // bundle..) try { bundle = ResourceBundle.getBundle(bundleName, locale); } catch (RuntimeException re) { logEvent("Unable to load {0} from {1} in {2}; caught exception: {3}", new Object[] { bundleName, classLoader, locale, re }); try { // Try the context classloader classLoader = (ClassLoader) AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { public Object run() throws Exception { return Thread.currentThread().getContextClassLoader(); } }); bundle = ResourceBundle.getBundle(bundleName, locale, classLoader); } catch (PrivilegedActionException pae) { logEvent("Unable to load {0} from {1} in {2}; caught exception: {3}", new Object[] { bundleName, classLoader, locale, pae }); throw new RuntimeException("Unable to get context classloader", pae); } } } return bundle; } }
public class class_name { public ResourceBundle getResourceBundle(Class<?> aClass, String bundleName, Locale locale) { ResourceBundle bundle = null; ClassLoader classLoader = null; if (bundleName == null) // instead of waiting for ResourceBundle to // throw the NPE, do it now throw new NullPointerException("Unable to load resource bundle: null bundleName"); if (locale == null) locale = Locale.getDefault(); // TODO: add resource bundle cache.. ? // yikes! TRY to figure out the class from the callstack-- // have to do this every time aClass is null coming in, which is // definitely not optimal, but at least makes sure the resource bundle // is loaded from the right place if (aClass == null) { if (finder == null) finder = StackFinder.getInstance(); if (finder != null) aClass = finder.getCaller(); } if (aClass != null) { // If aClass is NOT null (it was passed in, or we found it), // use its classloader first to try loading the resource bundle try { classLoader = aClass.getClassLoader(); // depends on control dependency: [try], data = [none] bundle = ResourceBundle.getBundle(bundleName, locale, classLoader); // depends on control dependency: [try], data = [none] } catch (RuntimeException re) { logEvent("Unable to load {0} from {1} (from class {2}) in {3}; caught exception: {4}", new Object[] { bundleName, classLoader, aClass, locale, re }); } // depends on control dependency: [catch], data = [none] } if (bundle == null) { // If the bundle wasn't found using the class' classloader, // try the default classloader (in OSGi, will be in the RAS // bundle..) try { bundle = ResourceBundle.getBundle(bundleName, locale); // depends on control dependency: [try], data = [none] } catch (RuntimeException re) { logEvent("Unable to load {0} from {1} in {2}; caught exception: {3}", new Object[] { bundleName, classLoader, locale, re }); try { // Try the context classloader classLoader = (ClassLoader) AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { public Object run() throws Exception { return Thread.currentThread().getContextClassLoader(); } }); // depends on control dependency: [try], data = [none] bundle = ResourceBundle.getBundle(bundleName, locale, classLoader); // depends on control dependency: [try], data = [none] } catch (PrivilegedActionException pae) { logEvent("Unable to load {0} from {1} in {2}; caught exception: {3}", new Object[] { bundleName, classLoader, locale, pae }); throw new RuntimeException("Unable to get context classloader", pae); } // depends on control dependency: [catch], data = [none] } // depends on control dependency: [catch], data = [none] } return bundle; } }
public class class_name { public static Constraint url() { return new Constraint("url", simplePayload("url")) { public boolean isValid(Object actualValue) { if (actualValue != null) { if (!Utils.isValidURL(actualValue.toString())) { return false; } } return true; } }; } }
public class class_name { public static Constraint url() { return new Constraint("url", simplePayload("url")) { public boolean isValid(Object actualValue) { if (actualValue != null) { if (!Utils.isValidURL(actualValue.toString())) { return false; // depends on control dependency: [if], data = [none] } } return true; } }; } }
public class class_name { protected void fixupOverloadedOperationNames() throws RMIIIOPViolationException { for (int i = 0; i < methods.length; ++i) { if ((m_flags[i] & M_OVERLOADED) == 0) continue; // Find the operation OperationAnalysis oa = null; String javaName = methods[i].getName(); for (int opIdx = 0; oa == null && opIdx < operations.length; ++opIdx) if (operations[opIdx].getMethod().equals(methods[i])) oa = operations[opIdx]; if (oa == null) continue; // This method is not mapped. // Calculate new IDL name ParameterAnalysis[] params = oa.getParameters(); StringBuffer b = new StringBuffer(oa.getIDLName()); if (params.length == 0) b.append("__"); for (int j = 0; j < params.length; ++j) { String s = params[j].getTypeIDLName(); if (s.startsWith("::")) s = s.substring(2); if (s.startsWith("_")) { // remove leading underscore in IDL escaped identifier s = s.substring(1); } b.append('_'); while (!"".equals(s)) { int idx = s.indexOf("::"); b.append('_'); if (idx == -1) { b.append(s); s = ""; } else { b.append(s.substring(0, idx)); if (s.length() > idx + 2 && s.charAt(idx + 2) == '_') { // remove leading underscore in IDL escaped identifier s = s.substring(idx + 3); } else { s = s.substring(idx + 2); } } } } // Set new IDL name oa.setIDLName(b.toString()); } } }
public class class_name { protected void fixupOverloadedOperationNames() throws RMIIIOPViolationException { for (int i = 0; i < methods.length; ++i) { if ((m_flags[i] & M_OVERLOADED) == 0) continue; // Find the operation OperationAnalysis oa = null; String javaName = methods[i].getName(); for (int opIdx = 0; oa == null && opIdx < operations.length; ++opIdx) if (operations[opIdx].getMethod().equals(methods[i])) oa = operations[opIdx]; if (oa == null) continue; // This method is not mapped. // Calculate new IDL name ParameterAnalysis[] params = oa.getParameters(); StringBuffer b = new StringBuffer(oa.getIDLName()); if (params.length == 0) b.append("__"); for (int j = 0; j < params.length; ++j) { String s = params[j].getTypeIDLName(); if (s.startsWith("::")) s = s.substring(2); if (s.startsWith("_")) { // remove leading underscore in IDL escaped identifier s = s.substring(1); } b.append('_'); while (!"".equals(s)) { int idx = s.indexOf("::"); b.append('_'); if (idx == -1) { b.append(s); s = ""; } else { b.append(s.substring(0, idx)); if (s.length() > idx + 2 && s.charAt(idx + 2) == '_') { // remove leading underscore in IDL escaped identifier s = s.substring(idx + 3); // depends on control dependency: [if], data = [none] } else { s = s.substring(idx + 2); // depends on control dependency: [if], data = [none] } } } } // Set new IDL name oa.setIDLName(b.toString()); } } }
public class class_name { public void broadcastEvents(FacesContext context, PhaseId phaseId) { if (null == events) { // no events have been queued return; } boolean hasMoreAnyPhaseEvents; boolean hasMoreCurrentPhaseEvents; List<FacesEvent> eventsForPhaseId = events.get(PhaseId.ANY_PHASE.getOrdinal()); // keep iterating till we have no more events to broadcast. // This is necessary for events that cause other events to be // queued. PENDING(edburns): here's where we'd put in a check // to prevent infinite event queueing. do { // broadcast the ANY_PHASE events first if (null != eventsForPhaseId) { // We cannot use an Iterator because we will get // ConcurrentModificationException errors, so fake it while (!eventsForPhaseId.isEmpty()) { FacesEvent event = eventsForPhaseId.get(0); UIComponent source = event.getComponent(); UIComponent compositeParent = null; try { if (!UIComponent.isCompositeComponent(source)) { compositeParent = UIComponent.getCompositeComponentParent(source); } if (compositeParent != null) { compositeParent.pushComponentToEL(context, null); } source.pushComponentToEL(context, null); source.broadcast(event); } catch (AbortProcessingException e) { context.getApplication().publishEvent(context, ExceptionQueuedEvent.class, new ExceptionQueuedEventContext(context, e, source, phaseId)); } finally { source.popComponentFromEL(context); if (compositeParent != null) { compositeParent.popComponentFromEL(context); } } eventsForPhaseId.remove(0); // Stay at current position } } // then broadcast the events for this phase. if (null != (eventsForPhaseId = events.get(phaseId.getOrdinal()))) { // We cannot use an Iterator because we will get // ConcurrentModificationException errors, so fake it while (!eventsForPhaseId.isEmpty()) { FacesEvent event = eventsForPhaseId.get(0); UIComponent source = event.getComponent(); UIComponent compositeParent = null; try { if (!UIComponent.isCompositeComponent(source)) { compositeParent = getCompositeComponentParent(source); } if (compositeParent != null) { compositeParent.pushComponentToEL(context, null); } source.pushComponentToEL(context, null); source.broadcast(event); } catch (AbortProcessingException ape) { // A "return" here would abort remaining events too context.getApplication().publishEvent(context, ExceptionQueuedEvent.class, new ExceptionQueuedEventContext(context, ape, source, phaseId)); } finally { source.popComponentFromEL(context); if (compositeParent != null) { compositeParent.popComponentFromEL(context); } } eventsForPhaseId.remove(0); // Stay at current position } } // true if we have any more ANY_PHASE events hasMoreAnyPhaseEvents = (null != (eventsForPhaseId = events.get(PhaseId.ANY_PHASE.getOrdinal()))) && !eventsForPhaseId.isEmpty(); // true if we have any more events for the argument phaseId hasMoreCurrentPhaseEvents = (null != events.get(phaseId.getOrdinal())) && !events.get(phaseId.getOrdinal()).isEmpty(); } while (hasMoreAnyPhaseEvents || hasMoreCurrentPhaseEvents); } }
public class class_name { public void broadcastEvents(FacesContext context, PhaseId phaseId) { if (null == events) { // no events have been queued return; // depends on control dependency: [if], data = [none] } boolean hasMoreAnyPhaseEvents; boolean hasMoreCurrentPhaseEvents; List<FacesEvent> eventsForPhaseId = events.get(PhaseId.ANY_PHASE.getOrdinal()); // keep iterating till we have no more events to broadcast. // This is necessary for events that cause other events to be // queued. PENDING(edburns): here's where we'd put in a check // to prevent infinite event queueing. do { // broadcast the ANY_PHASE events first if (null != eventsForPhaseId) { // We cannot use an Iterator because we will get // ConcurrentModificationException errors, so fake it while (!eventsForPhaseId.isEmpty()) { FacesEvent event = eventsForPhaseId.get(0); UIComponent source = event.getComponent(); UIComponent compositeParent = null; try { if (!UIComponent.isCompositeComponent(source)) { compositeParent = UIComponent.getCompositeComponentParent(source); // depends on control dependency: [if], data = [none] } if (compositeParent != null) { compositeParent.pushComponentToEL(context, null); // depends on control dependency: [if], data = [null)] } source.pushComponentToEL(context, null); // depends on control dependency: [try], data = [none] source.broadcast(event); // depends on control dependency: [try], data = [none] } catch (AbortProcessingException e) { context.getApplication().publishEvent(context, ExceptionQueuedEvent.class, new ExceptionQueuedEventContext(context, e, source, phaseId)); } // depends on control dependency: [catch], data = [none] finally { source.popComponentFromEL(context); if (compositeParent != null) { compositeParent.popComponentFromEL(context); // depends on control dependency: [if], data = [none] } } eventsForPhaseId.remove(0); // Stay at current position // depends on control dependency: [while], data = [none] } } // then broadcast the events for this phase. if (null != (eventsForPhaseId = events.get(phaseId.getOrdinal()))) { // We cannot use an Iterator because we will get // ConcurrentModificationException errors, so fake it while (!eventsForPhaseId.isEmpty()) { FacesEvent event = eventsForPhaseId.get(0); UIComponent source = event.getComponent(); UIComponent compositeParent = null; try { if (!UIComponent.isCompositeComponent(source)) { compositeParent = getCompositeComponentParent(source); // depends on control dependency: [if], data = [none] } if (compositeParent != null) { compositeParent.pushComponentToEL(context, null); // depends on control dependency: [if], data = [null)] } source.pushComponentToEL(context, null); // depends on control dependency: [try], data = [none] source.broadcast(event); // depends on control dependency: [try], data = [none] } catch (AbortProcessingException ape) { // A "return" here would abort remaining events too context.getApplication().publishEvent(context, ExceptionQueuedEvent.class, new ExceptionQueuedEventContext(context, ape, source, phaseId)); } // depends on control dependency: [catch], data = [none] finally { source.popComponentFromEL(context); if (compositeParent != null) { compositeParent.popComponentFromEL(context); // depends on control dependency: [if], data = [none] } } eventsForPhaseId.remove(0); // Stay at current position // depends on control dependency: [while], data = [none] } } // true if we have any more ANY_PHASE events hasMoreAnyPhaseEvents = (null != (eventsForPhaseId = events.get(PhaseId.ANY_PHASE.getOrdinal()))) && !eventsForPhaseId.isEmpty(); // true if we have any more events for the argument phaseId hasMoreCurrentPhaseEvents = (null != events.get(phaseId.getOrdinal())) && !events.get(phaseId.getOrdinal()).isEmpty(); } while (hasMoreAnyPhaseEvents || hasMoreCurrentPhaseEvents); } }
public class class_name { private PBXObjectRef addNativeTarget(final Map objects, final TargetInfo linkTarget, final PBXObjectRef product, final String projectName, final List<PBXObjectRef> sourceGroupChildren, final List<PBXObjectRef> frameworkBuildFiles) { final PBXObjectRef buildConfigurations = addNativeTargetConfigurationList(objects, projectName); int buildActionMask = 2147483647; final List<PBXObjectRef> buildPhases = new ArrayList<>(); final Map settings = new HashMap(); settings.put("ATTRIBUTES", new ArrayList()); final List buildFiles = new ArrayList(); for (final PBXObjectRef sourceFile : sourceGroupChildren) { final PBXObjectRef buildFile = createPBXBuildFile(sourceFile, settings); buildFiles.add(buildFile); objects.put(buildFile.getID(), buildFile.getProperties()); } final PBXObjectRef sourcesBuildPhase = createPBXSourcesBuildPhase(buildActionMask, buildFiles, false); objects.put(sourcesBuildPhase.getID(), sourcesBuildPhase.getProperties()); buildPhases.add(sourcesBuildPhase); buildActionMask = 8; final PBXObjectRef frameworksBuildPhase = createPBXFrameworksBuildPhase(buildActionMask, frameworkBuildFiles, false); objects.put(frameworksBuildPhase.getID(), frameworksBuildPhase.getProperties()); buildPhases.add(frameworksBuildPhase); final PBXObjectRef copyFilesBuildPhase = createPBXCopyFilesBuildPhase(8, "/usr/share/man/man1", "0", new ArrayList(), true); objects.put(copyFilesBuildPhase.getID(), copyFilesBuildPhase.getProperties()); buildPhases.add(copyFilesBuildPhase); final List buildRules = new ArrayList(); final List dependencies = new ArrayList(); final String productInstallPath = "$(HOME)/bin"; final String productType = getProductType(linkTarget); final PBXObjectRef nativeTarget = createPBXNativeTarget(projectName, buildConfigurations, buildPhases, buildRules, dependencies, productInstallPath, projectName, product, productType); objects.put(nativeTarget.getID(), nativeTarget.getProperties()); return nativeTarget; } }
public class class_name { private PBXObjectRef addNativeTarget(final Map objects, final TargetInfo linkTarget, final PBXObjectRef product, final String projectName, final List<PBXObjectRef> sourceGroupChildren, final List<PBXObjectRef> frameworkBuildFiles) { final PBXObjectRef buildConfigurations = addNativeTargetConfigurationList(objects, projectName); int buildActionMask = 2147483647; final List<PBXObjectRef> buildPhases = new ArrayList<>(); final Map settings = new HashMap(); settings.put("ATTRIBUTES", new ArrayList()); final List buildFiles = new ArrayList(); for (final PBXObjectRef sourceFile : sourceGroupChildren) { final PBXObjectRef buildFile = createPBXBuildFile(sourceFile, settings); buildFiles.add(buildFile); // depends on control dependency: [for], data = [none] objects.put(buildFile.getID(), buildFile.getProperties()); // depends on control dependency: [for], data = [none] } final PBXObjectRef sourcesBuildPhase = createPBXSourcesBuildPhase(buildActionMask, buildFiles, false); objects.put(sourcesBuildPhase.getID(), sourcesBuildPhase.getProperties()); buildPhases.add(sourcesBuildPhase); buildActionMask = 8; final PBXObjectRef frameworksBuildPhase = createPBXFrameworksBuildPhase(buildActionMask, frameworkBuildFiles, false); objects.put(frameworksBuildPhase.getID(), frameworksBuildPhase.getProperties()); buildPhases.add(frameworksBuildPhase); final PBXObjectRef copyFilesBuildPhase = createPBXCopyFilesBuildPhase(8, "/usr/share/man/man1", "0", new ArrayList(), true); objects.put(copyFilesBuildPhase.getID(), copyFilesBuildPhase.getProperties()); buildPhases.add(copyFilesBuildPhase); final List buildRules = new ArrayList(); final List dependencies = new ArrayList(); final String productInstallPath = "$(HOME)/bin"; final String productType = getProductType(linkTarget); final PBXObjectRef nativeTarget = createPBXNativeTarget(projectName, buildConfigurations, buildPhases, buildRules, dependencies, productInstallPath, projectName, product, productType); objects.put(nativeTarget.getID(), nativeTarget.getProperties()); return nativeTarget; } }
public class class_name { private Map<String, Integer> getAttemptsMap(String projectId, String eventCollection) throws IOException { Map<String, Integer> attempts = new HashMap<String, Integer>(); if (eventStore instanceof KeenAttemptCountingEventStore) { KeenAttemptCountingEventStore res = (KeenAttemptCountingEventStore)eventStore; String attemptsJSON = res.getAttempts(projectId, eventCollection); if (attemptsJSON != null) { StringReader reader = new StringReader(attemptsJSON); Map<String, Object> attemptTmp = jsonHandler.readJson(reader); for (Entry<String, Object> entry : attemptTmp.entrySet()) { if (entry.getValue() instanceof Number) { attempts.put(entry.getKey(), ((Number)entry.getValue()).intValue()); } } } } return attempts; } }
public class class_name { private Map<String, Integer> getAttemptsMap(String projectId, String eventCollection) throws IOException { Map<String, Integer> attempts = new HashMap<String, Integer>(); if (eventStore instanceof KeenAttemptCountingEventStore) { KeenAttemptCountingEventStore res = (KeenAttemptCountingEventStore)eventStore; String attemptsJSON = res.getAttempts(projectId, eventCollection); if (attemptsJSON != null) { StringReader reader = new StringReader(attemptsJSON); Map<String, Object> attemptTmp = jsonHandler.readJson(reader); for (Entry<String, Object> entry : attemptTmp.entrySet()) { if (entry.getValue() instanceof Number) { attempts.put(entry.getKey(), ((Number)entry.getValue()).intValue()); // depends on control dependency: [if], data = [none] } } } } return attempts; } }
public class class_name { public static DocumentAndSize [] cut(final Document doc,final PageSize size) { NodeList nl = doc.getElementsByTagNameNS("http://www.allcolor.org/xmlns/yahp", "pb"); if (nl.getLength() == 0) { // see if someone forget namespace decl ? nl = doc.getElementsByTagName("yahp:pb"); } // if no pagebreak found, return the given document. if (nl.getLength() == 0) { return new DocumentAndSize [] { new DocumentAndSize(doc,size) }; } // end if // get the start-end offset of all page breaks. PbDocument pbdocs[] = getPbDocs(nl); // create as much document as they are pages. DocumentAndSize array[] = new DocumentAndSize[pbdocs.length]; for (int i = 0; i < pbdocs.length; i++) { PbDocument pbdoc = pbdocs[i]; // get start and end offset Element pbstart = (Element) pbdoc.getPbStart(); Element pbend = (Element) pbdoc.getPbEnd(); PageSize tmpSize = getPageSize(pbstart == null ? null : pbstart.getAttribute("size"),size); // create a new doc and set the URI ADocument ndoc = new CDom2HTMLDocument(); ndoc.setDocumentURI(doc.getDocumentURI()); CNamespace xmlnsdef = new CNamespace((pbend != null) ? pbend.getPrefix() : pbstart.getPrefix(), "http://www.allcolor.org/xmlns/yahp"); ndoc.getNamespaceList().add(xmlnsdef); if (pbend == null) { // from pbstart to the end of the document. // create the container node Element parentPb = (Element) ndoc.adoptNode(pbstart.getParentNode() .cloneNode(false)); // copy all next siblings Node Sibling = pbstart.getNextSibling(); while (Sibling != null) { Node node = ndoc.adoptNode(Sibling.cloneNode(true)); // add to container node parentPb.appendChild(node); Sibling = Sibling.getNextSibling(); } // end while // copy parent node of the start page break Node parent = pbstart.getParentNode(); Node nextNode = null; Node ppr = null; while (parent != null) { if (parent.getNodeType() == Node.ELEMENT_NODE) { // copy the node Node node = ndoc.adoptNode(parent.cloneNode( false)); if (nextNode != null) { // append the node to the container node.appendChild(nextNode); if (!("body".equals(ppr.getNodeName()))) { // append next sibling of the previous container Sibling = ppr.getNextSibling(); while (Sibling != null) { Node n = ndoc.adoptNode(Sibling.cloneNode( true)); node.appendChild(n); Sibling = Sibling.getNextSibling(); } // end while } // end if nextNode = node; } // end if else { nextNode = parentPb; } // end else ppr = parent; } // end if parent = parent.getParentNode(); } // end while ndoc.appendChild(nextNode); } // end if else { Element parentPb = (Element) ndoc.adoptNode(pbend.getParentNode() .cloneNode(false)); Node Sibling = pbend.getPreviousSibling(); boolean hasbeendes = false; while (!hasbeendes && (Sibling != null)) { if (isDescendant(pbstart, Sibling)) { hasbeendes = true; break; } // end if Node node = ndoc.adoptNode(Sibling.cloneNode(true)); if (parentPb.getChildNodes().getLength() == 0) { parentPb.appendChild(node); } // end if else { parentPb.insertBefore(node, parentPb.getFirstChild()); } // end else Sibling = Sibling.getPreviousSibling(); } // end while if (hasbeendes && pbstart != Sibling) { Node c = ndoc.adoptNode(Sibling.cloneNode( true)); ((Element)c).setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:yahp", "http://www.allcolor.org/xmlns/yahp"); Node pb = ((Element) c).getElementsByTagNameNS("http://www.allcolor.org/xmlns/yahp", "pb").item(0); Node p = pb; Node pp = pb.getParentNode() .getPreviousSibling(); while (p != null) { Node tmp = p.getPreviousSibling(); p.getParentNode() .removeChild(p); p = tmp; } // end while while (pp != null) { Node tmp = pp.getPreviousSibling(); if (tmp == null) { Node ppz = pp.getParentNode(); if (ppz.getPreviousSibling() != null) { tmp = ppz.getPreviousSibling(); } // end if else { Node prev = null; while (prev == null) { ppz = ppz.getParentNode(); if (ppz == null) { break; } // end if prev = ppz.getPreviousSibling(); } // end while if (prev != null) { tmp = prev; } // end if } // end else } // end if pp.getParentNode() .removeChild(pp); pp = tmp; } // end while if (parentPb.getChildNodes() .getLength() == 0) { parentPb.appendChild(c); } // end if else { parentPb.insertBefore(c, parentPb.getFirstChild()); } // end else } // end if Node parent = pbend.getParentNode(); Node previousNode = null; Node ppr = null; while (parent != null) { if (parent.getNodeType() == Node.ELEMENT_NODE) { if (previousNode != null) { Node node = ndoc.adoptNode(parent.cloneNode( false)); node.appendChild(previousNode); if (!("body".equals(ppr.getNodeName()))) { Sibling = ppr.getPreviousSibling(); while (!hasbeendes && (Sibling != null)) { if (isDescendant(pbstart, Sibling)) { // here special handling need to be // taken. if (pbstart != Sibling) { Node c = ndoc.adoptNode(Sibling.cloneNode( true)); Node pb = ((Element) c).getElementsByTagNameNS("http://www.allcolor.org/xmlns/yahp", "pb").item(0); Node p = pb; Node pp = pb.getParentNode() .getPreviousSibling(); while (p != null) { Node tmp = p.getPreviousSibling(); p.getParentNode() .removeChild(p); p = tmp; } // end while while (pp != null) { Node tmp = pp.getPreviousSibling(); if (tmp == null) { Node ppz = pp.getParentNode(); if (ppz.getPreviousSibling() != null) { tmp = ppz.getPreviousSibling(); } // end if else { Node prev = null; while (prev == null) { ppz = ppz.getParentNode(); if (ppz == null) { break; } // end if prev = ppz.getPreviousSibling(); } // end while if (prev != null) { tmp = prev; } // end if } // end else } // end if pp.getParentNode() .removeChild(pp); pp = tmp; } // end while if (node.getChildNodes() .getLength() == 0) { node.appendChild(c); } // end if else { node.insertBefore(c, node.getFirstChild()); } // end else } // end if hasbeendes = true; break; } // end if Node n = ndoc.adoptNode(Sibling.cloneNode( true)); if (node.getChildNodes().getLength() == 0) { node.appendChild(n); } // end if else { node.insertBefore(n, node.getFirstChild()); } // end else Sibling = Sibling.getPreviousSibling(); } // end while } // end if previousNode = node; } // end if else { previousNode = parentPb; } // end else ppr = parent; } // end if parent = parent.getParentNode(); } // end while ndoc.appendChild(previousNode); } // end else // copy header copyHeader(doc, ndoc); array[i] = new DocumentAndSize(ndoc,tmpSize); } // end for return array; } }
public class class_name { public static DocumentAndSize [] cut(final Document doc,final PageSize size) { NodeList nl = doc.getElementsByTagNameNS("http://www.allcolor.org/xmlns/yahp", "pb"); if (nl.getLength() == 0) { // see if someone forget namespace decl ? nl = doc.getElementsByTagName("yahp:pb"); // depends on control dependency: [if], data = [none] } // if no pagebreak found, return the given document. if (nl.getLength() == 0) { return new DocumentAndSize [] { new DocumentAndSize(doc,size) }; // depends on control dependency: [if], data = [none] } // end if // get the start-end offset of all page breaks. PbDocument pbdocs[] = getPbDocs(nl); // create as much document as they are pages. DocumentAndSize array[] = new DocumentAndSize[pbdocs.length]; for (int i = 0; i < pbdocs.length; i++) { PbDocument pbdoc = pbdocs[i]; // get start and end offset Element pbstart = (Element) pbdoc.getPbStart(); Element pbend = (Element) pbdoc.getPbEnd(); PageSize tmpSize = getPageSize(pbstart == null ? null : pbstart.getAttribute("size"),size); // create a new doc and set the URI ADocument ndoc = new CDom2HTMLDocument(); ndoc.setDocumentURI(doc.getDocumentURI()); // depends on control dependency: [for], data = [none] CNamespace xmlnsdef = new CNamespace((pbend != null) ? pbend.getPrefix() : pbstart.getPrefix(), "http://www.allcolor.org/xmlns/yahp"); ndoc.getNamespaceList().add(xmlnsdef); if (pbend == null) { // from pbstart to the end of the document. // create the container node Element parentPb = (Element) ndoc.adoptNode(pbstart.getParentNode() .cloneNode(false)); // copy all next siblings Node Sibling = pbstart.getNextSibling(); while (Sibling != null) { Node node = ndoc.adoptNode(Sibling.cloneNode(true)); // add to container node parentPb.appendChild(node); // depends on control dependency: [while], data = [none] Sibling = Sibling.getNextSibling(); // depends on control dependency: [while], data = [none] } // end while // copy parent node of the start page break Node parent = pbstart.getParentNode(); Node nextNode = null; Node ppr = null; while (parent != null) { if (parent.getNodeType() == Node.ELEMENT_NODE) { // copy the node Node node = ndoc.adoptNode(parent.cloneNode( false)); if (nextNode != null) { // append the node to the container node.appendChild(nextNode); // depends on control dependency: [if], data = [(nextNode] if (!("body".equals(ppr.getNodeName()))) { // append next sibling of the previous container Sibling = ppr.getNextSibling(); // depends on control dependency: [if], data = [none] while (Sibling != null) { Node n = ndoc.adoptNode(Sibling.cloneNode( true)); node.appendChild(n); // depends on control dependency: [while], data = [none] Sibling = Sibling.getNextSibling(); // depends on control dependency: [while], data = [none] } // end while } // end if nextNode = node; // depends on control dependency: [if], data = [none] } // end if else { nextNode = parentPb; // depends on control dependency: [if], data = [none] } // end else ppr = parent; // depends on control dependency: [if], data = [none] } // end if parent = parent.getParentNode(); // depends on control dependency: [while], data = [none] } // end while ndoc.appendChild(nextNode); // depends on control dependency: [if], data = [none] } // end if else { Element parentPb = (Element) ndoc.adoptNode(pbend.getParentNode() .cloneNode(false)); Node Sibling = pbend.getPreviousSibling(); boolean hasbeendes = false; while (!hasbeendes && (Sibling != null)) { if (isDescendant(pbstart, Sibling)) { hasbeendes = true; // depends on control dependency: [if], data = [none] break; } // end if Node node = ndoc.adoptNode(Sibling.cloneNode(true)); if (parentPb.getChildNodes().getLength() == 0) { parentPb.appendChild(node); // depends on control dependency: [if], data = [none] } // end if else { parentPb.insertBefore(node, parentPb.getFirstChild()); // depends on control dependency: [if], data = [none] } // end else Sibling = Sibling.getPreviousSibling(); // depends on control dependency: [while], data = [none] } // end while if (hasbeendes && pbstart != Sibling) { Node c = ndoc.adoptNode(Sibling.cloneNode( true)); ((Element)c).setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:yahp", "http://www.allcolor.org/xmlns/yahp"); Node pb = ((Element) c).getElementsByTagNameNS("http://www.allcolor.org/xmlns/yahp", "pb").item(0); // depends on control dependency: [if], data = [none] Node p = pb; Node pp = pb.getParentNode() .getPreviousSibling(); while (p != null) { Node tmp = p.getPreviousSibling(); p.getParentNode() .removeChild(p); // depends on control dependency: [while], data = [none] p = tmp; // depends on control dependency: [while], data = [none] } // end while while (pp != null) { Node tmp = pp.getPreviousSibling(); if (tmp == null) { Node ppz = pp.getParentNode(); if (ppz.getPreviousSibling() != null) { tmp = ppz.getPreviousSibling(); // depends on control dependency: [if], data = [none] } // end if else { Node prev = null; while (prev == null) { ppz = ppz.getParentNode(); // depends on control dependency: [while], data = [none] if (ppz == null) { break; } // end if prev = ppz.getPreviousSibling(); // depends on control dependency: [while], data = [none] } // end while if (prev != null) { tmp = prev; // depends on control dependency: [if], data = [none] } // end if } // end else } // end if pp.getParentNode() .removeChild(pp); // depends on control dependency: [while], data = [none] pp = tmp; // depends on control dependency: [while], data = [none] } // end while if (parentPb.getChildNodes() .getLength() == 0) { parentPb.appendChild(c); // depends on control dependency: [if], data = [none] } // end if else { parentPb.insertBefore(c, parentPb.getFirstChild()); // depends on control dependency: [if], data = [none] } // end else } // end if Node parent = pbend.getParentNode(); Node previousNode = null; Node ppr = null; while (parent != null) { if (parent.getNodeType() == Node.ELEMENT_NODE) { if (previousNode != null) { Node node = ndoc.adoptNode(parent.cloneNode( false)); node.appendChild(previousNode); // depends on control dependency: [if], data = [(previousNode] if (!("body".equals(ppr.getNodeName()))) { Sibling = ppr.getPreviousSibling(); // depends on control dependency: [if], data = [none] while (!hasbeendes && (Sibling != null)) { if (isDescendant(pbstart, Sibling)) { // here special handling need to be // taken. if (pbstart != Sibling) { Node c = ndoc.adoptNode(Sibling.cloneNode( true)); Node pb = ((Element) c).getElementsByTagNameNS("http://www.allcolor.org/xmlns/yahp", "pb").item(0); Node p = pb; Node pp = pb.getParentNode() .getPreviousSibling(); while (p != null) { Node tmp = p.getPreviousSibling(); p.getParentNode() .removeChild(p); // depends on control dependency: [while], data = [none] p = tmp; // depends on control dependency: [while], data = [none] } // end while while (pp != null) { Node tmp = pp.getPreviousSibling(); if (tmp == null) { Node ppz = pp.getParentNode(); if (ppz.getPreviousSibling() != null) { tmp = ppz.getPreviousSibling(); // depends on control dependency: [if], data = [none] } // end if else { Node prev = null; while (prev == null) { ppz = ppz.getParentNode(); // depends on control dependency: [while], data = [none] if (ppz == null) { break; } // end if prev = ppz.getPreviousSibling(); // depends on control dependency: [while], data = [none] } // end while if (prev != null) { tmp = prev; // depends on control dependency: [if], data = [none] } // end if } // end else } // end if pp.getParentNode() .removeChild(pp); // depends on control dependency: [while], data = [none] pp = tmp; // depends on control dependency: [while], data = [none] } // end while if (node.getChildNodes() .getLength() == 0) { node.appendChild(c); // depends on control dependency: [if], data = [none] } // end if else { node.insertBefore(c, node.getFirstChild()); // depends on control dependency: [if], data = [none] } // end else } // end if hasbeendes = true; // depends on control dependency: [if], data = [none] break; } // end if Node n = ndoc.adoptNode(Sibling.cloneNode( true)); if (node.getChildNodes().getLength() == 0) { node.appendChild(n); // depends on control dependency: [if], data = [none] } // end if else { node.insertBefore(n, node.getFirstChild()); // depends on control dependency: [if], data = [none] } // end else Sibling = Sibling.getPreviousSibling(); // depends on control dependency: [while], data = [none] } // end while } // end if previousNode = node; // depends on control dependency: [if], data = [none] } // end if else { previousNode = parentPb; // depends on control dependency: [if], data = [none] } // end else ppr = parent; // depends on control dependency: [if], data = [none] } // end if parent = parent.getParentNode(); // depends on control dependency: [while], data = [none] } // end while ndoc.appendChild(previousNode); // depends on control dependency: [if], data = [none] } // end else // copy header copyHeader(doc, ndoc); // depends on control dependency: [for], data = [none] array[i] = new DocumentAndSize(ndoc,tmpSize); // depends on control dependency: [for], data = [i] } // end for return array; } }
public class class_name { public void buildClassConstantSummary(XMLNode node, Content summariesTree) { ClassDoc[] classes = currentPackage.name().length() > 0 ? currentPackage.allClasses() : configuration.classDocCatalog.allClasses( DocletConstants.DEFAULT_PACKAGE_NAME); Arrays.sort(classes); Content classConstantTree = writer.getClassConstantHeader(); for (ClassDoc doc : classes) { if (!classDocsWithConstFields.contains(doc) || !doc.isIncluded()) { continue; } currentClass = doc; //Build the documentation for the current class. buildChildren(node, classConstantTree); } writer.addClassConstant(summariesTree, classConstantTree); } }
public class class_name { public void buildClassConstantSummary(XMLNode node, Content summariesTree) { ClassDoc[] classes = currentPackage.name().length() > 0 ? currentPackage.allClasses() : configuration.classDocCatalog.allClasses( DocletConstants.DEFAULT_PACKAGE_NAME); Arrays.sort(classes); Content classConstantTree = writer.getClassConstantHeader(); for (ClassDoc doc : classes) { if (!classDocsWithConstFields.contains(doc) || !doc.isIncluded()) { continue; } currentClass = doc; // depends on control dependency: [for], data = [doc] //Build the documentation for the current class. buildChildren(node, classConstantTree); // depends on control dependency: [for], data = [none] } writer.addClassConstant(summariesTree, classConstantTree); } }
public class class_name { private Cipher getCipherInstance(String algorithm) { Cipher cipher = null; if (!useBCProvider) { try { cipher = Cipher.getInstance(algorithm); } catch (NoSuchAlgorithmException e) { Log.v(Log.TAG_SYMMETRIC_KEY, "Cannot find a cipher (no algorithm); will try with Bouncy Castle provider."); } catch (NoSuchPaddingException e) { Log.v(Log.TAG_SYMMETRIC_KEY, "Cannot find a cipher (no padding); will try with Bouncy Castle provider."); } } if (cipher == null) { // Register and use BouncyCastle provider if applicable: try { if (Security.getProvider("BC") == null) { try { Class bc = Class.forName("org.bouncycastle.jce.provider.BouncyCastleProvider"); Security.addProvider((Provider)bc.newInstance()); } catch (Exception e) { Log.e(Log.TAG_SYMMETRIC_KEY, "Cannot instantiate Bouncy Castle provider", e); return null; } } cipher = Cipher.getInstance(algorithm, "BC"); useBCProvider = true; } catch (Exception e) { Log.e(Log.TAG_SYMMETRIC_KEY, "Cannot find a cipher with Bouncy Castle provider", e); } } return cipher; } }
public class class_name { private Cipher getCipherInstance(String algorithm) { Cipher cipher = null; if (!useBCProvider) { try { cipher = Cipher.getInstance(algorithm); // depends on control dependency: [try], data = [none] } catch (NoSuchAlgorithmException e) { Log.v(Log.TAG_SYMMETRIC_KEY, "Cannot find a cipher (no algorithm); will try with Bouncy Castle provider."); } catch (NoSuchPaddingException e) { // depends on control dependency: [catch], data = [none] Log.v(Log.TAG_SYMMETRIC_KEY, "Cannot find a cipher (no padding); will try with Bouncy Castle provider."); } // depends on control dependency: [catch], data = [none] } if (cipher == null) { // Register and use BouncyCastle provider if applicable: try { if (Security.getProvider("BC") == null) { try { Class bc = Class.forName("org.bouncycastle.jce.provider.BouncyCastleProvider"); Security.addProvider((Provider)bc.newInstance()); } catch (Exception e) { Log.e(Log.TAG_SYMMETRIC_KEY, "Cannot instantiate Bouncy Castle provider", e); return null; } // depends on control dependency: [catch], data = [none] } cipher = Cipher.getInstance(algorithm, "BC"); // depends on control dependency: [try], data = [none] useBCProvider = true; // depends on control dependency: [try], data = [none] } catch (Exception e) { Log.e(Log.TAG_SYMMETRIC_KEY, "Cannot find a cipher with Bouncy Castle provider", e); } // depends on control dependency: [catch], data = [none] } return cipher; } }
public class class_name { private void compareAndTakeAction(JsMEConfig newConfig) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "compareAndTakeAction", newConfig); } // newDestinationSet is a sorted set containing the destination id of // new config object TreeSet<String> newDestinationSet = new TreeSet<String>(newConfig .getMessagingEngine().getDestinationList().keySet()); // oldDestinationSet is a sorted set containing the destination id of // old config object TreeSet<String> oldDestinationSet = new TreeSet<String>(jsMEConfig .getMessagingEngine().getDestinationList().keySet()); // completeDestinationSet is union of newDestinationSet and // oldDestinationSet TreeSet<String> completeDestinationSet = new TreeSet<String>(); // continas the destinations which are deleted TreeSet<String> deletedDestinationSet = new TreeSet<String>(); // contains the destinations which are added TreeSet<String> addedDestinationSet = new TreeSet<String>(); // contains the modified destinations.It will first have the destinations which is modified or the unalteed destiantion //Then via a logic some of the same destinations will be removed so that it will have only the modified destinations TreeSet<String> modifiedDestinationSet = new TreeSet<String>(); completeDestinationSet.addAll(oldDestinationSet); completeDestinationSet.addAll(newDestinationSet); Iterator it = completeDestinationSet.iterator(); //identify the destinations which has to be added, deleted or modified and create a set while (it.hasNext()) { String key = (String) it.next(); if (jsMEConfig.getMessagingEngine().getDestinationList() .containsKey(key)) {// check if the key exists in old set if (newConfig.getMessagingEngine().getDestinationList() .containsKey(key)) {// check if the key exists in new // set.if yes then destination might // have been modified or it might have not been altered modifiedDestinationSet.add(key); } else {// destination have been deleted deletedDestinationSet.add(key); } } else {// destination does not exist in old set.Implies a new // destiantion has been added addedDestinationSet.add(key); } } //iterate through the modifiedDestinationSet to set the UUID //This is done because when modified is called a new jsMeConfiG Object is created //and the UUID information is lost.Hence we try to restore the UUID for both destination and the localization Iterator mit = modifiedDestinationSet.iterator(); while (mit.hasNext()) { String meName = newConfig.getMessagingEngine().getName(); String destinationName = (String) mit.next(); // set the UUID of the destination newConfig.getMessagingEngine().getDestinationList().get(destinationName) .setUUID( jsMEConfig.getMessagingEngine() .getDestinationList().get(destinationName).getUUID()); BaseDestination bd = newConfig.getMessagingEngine().getDestinationList().get(destinationName); //Localization is not applicable for alias type.Hence the check is made to see if its local if (bd.isLocal()) { String uuid = jsMEConfig.getMessagingEngine().getSibLocalizationPointList().get(destinationName + "@" + meName).getUuid(); String targetUuid = jsMEConfig.getMessagingEngine().getSibLocalizationPointList().get(destinationName + "@" + meName).getTargetUuid(); //set the uuid and targetuuid of the localization newConfig.getMessagingEngine().getSibLocalizationPointList().get(destinationName + "@" + meName).setUuid(uuid); newConfig.getMessagingEngine().getSibLocalizationPointList().get(destinationName + "@" + meName).setTargetUuid(targetUuid); } } // now check in modifiedDestinationSet to see if at all anything have // changed. If nothing is changed we just ignore it mit = modifiedDestinationSet.iterator(); while (mit.hasNext()) { String key = (String) mit.next(); BaseDestination modifiedDestination = newConfig.getMessagingEngine() .getDestinationList().get(key); BaseDestination oldDestination = jsMEConfig.getMessagingEngine() .getDestinationList().get(key); // if the properties are different then remove destination from modifiedDestinationSet, else do nothing(i.e retain it in the set) // IMP : here equals() used is overridden method if (modifiedDestination.isLocal()) { if (((SIBDestination) modifiedDestination).equals(oldDestination)) mit.remove(); // remove the destination from the modifiedDestinationSet as both the objects are equal } else if (modifiedDestination.isAlias()) { if (((AliasDestination) modifiedDestination).equals(oldDestination)) mit.remove(); // remove the destination from the modifiedDestinationSet as both the objects are equal } } // Check if the highMessageThreshold is different.If yes then invoke reloadEngine() if (jsMEConfig.getMessagingEngine().getHighMessageThreshold() != newConfig.getMessagingEngine().getHighMessageThreshold()) { try { _jsMainImpl.reloadEngine(newConfig.getMessagingEngine().getHighMessageThreshold()); } catch (Exception e) { SibTr.exception(tc, e); FFDCFilter.processException(e, this.getClass().getName(), "972", this); } } Iterator dit = deletedDestinationSet.iterator(); while (dit.hasNext()) { String key = (String) dit.next(); // deleted SIBDestination can be got from the old jsMEConfig try { _jsMainImpl.deleteDestinationLocalization(jsMEConfig .getMessagingEngine().getDestinationList().get( (key))); } catch (Exception e) { SibTr.exception(tc, e); FFDCFilter.processException(e, this.getClass().getName(), "974", this); } } Iterator nit = addedDestinationSet.iterator(); while (nit.hasNext()) { String key = (String) nit.next(); // New SIBDestination can be got from the new jsMEConfig try { _jsMainImpl.createDestinationLocalization(newConfig .getMessagingEngine().getDestinationList().get( (key))); } catch (Exception e) { SibTr.exception(tc, e); FFDCFilter.processException(e, this.getClass().getName(), "992", this); } } Iterator mmit = modifiedDestinationSet.iterator(); while (mmit.hasNext()) { String key = (String) mmit.next(); // Modified SIBDestination can be got from the new jsMEConfig try { _jsMainImpl.alterDestinationLocalization(newConfig .getMessagingEngine().getDestinationList().get( (key))); } catch (Exception e) { SibTr.exception(tc, e); FFDCFilter.processException(e, this.getClass().getName(), "1010", this); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, "compareAndTakeAction"); } } }
public class class_name { private void compareAndTakeAction(JsMEConfig newConfig) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "compareAndTakeAction", newConfig); // depends on control dependency: [if], data = [none] } // newDestinationSet is a sorted set containing the destination id of // new config object TreeSet<String> newDestinationSet = new TreeSet<String>(newConfig .getMessagingEngine().getDestinationList().keySet()); // oldDestinationSet is a sorted set containing the destination id of // old config object TreeSet<String> oldDestinationSet = new TreeSet<String>(jsMEConfig .getMessagingEngine().getDestinationList().keySet()); // completeDestinationSet is union of newDestinationSet and // oldDestinationSet TreeSet<String> completeDestinationSet = new TreeSet<String>(); // continas the destinations which are deleted TreeSet<String> deletedDestinationSet = new TreeSet<String>(); // contains the destinations which are added TreeSet<String> addedDestinationSet = new TreeSet<String>(); // contains the modified destinations.It will first have the destinations which is modified or the unalteed destiantion //Then via a logic some of the same destinations will be removed so that it will have only the modified destinations TreeSet<String> modifiedDestinationSet = new TreeSet<String>(); completeDestinationSet.addAll(oldDestinationSet); completeDestinationSet.addAll(newDestinationSet); Iterator it = completeDestinationSet.iterator(); //identify the destinations which has to be added, deleted or modified and create a set while (it.hasNext()) { String key = (String) it.next(); if (jsMEConfig.getMessagingEngine().getDestinationList() .containsKey(key)) {// check if the key exists in old set if (newConfig.getMessagingEngine().getDestinationList() .containsKey(key)) {// check if the key exists in new // set.if yes then destination might // have been modified or it might have not been altered modifiedDestinationSet.add(key); // depends on control dependency: [if], data = [none] } else {// destination have been deleted deletedDestinationSet.add(key); // depends on control dependency: [if], data = [none] } } else {// destination does not exist in old set.Implies a new // destiantion has been added addedDestinationSet.add(key); // depends on control dependency: [if], data = [none] } } //iterate through the modifiedDestinationSet to set the UUID //This is done because when modified is called a new jsMeConfiG Object is created //and the UUID information is lost.Hence we try to restore the UUID for both destination and the localization Iterator mit = modifiedDestinationSet.iterator(); while (mit.hasNext()) { String meName = newConfig.getMessagingEngine().getName(); String destinationName = (String) mit.next(); // set the UUID of the destination newConfig.getMessagingEngine().getDestinationList().get(destinationName) .setUUID( jsMEConfig.getMessagingEngine() .getDestinationList().get(destinationName).getUUID()); // depends on control dependency: [while], data = [none] BaseDestination bd = newConfig.getMessagingEngine().getDestinationList().get(destinationName); //Localization is not applicable for alias type.Hence the check is made to see if its local if (bd.isLocal()) { String uuid = jsMEConfig.getMessagingEngine().getSibLocalizationPointList().get(destinationName + "@" + meName).getUuid(); String targetUuid = jsMEConfig.getMessagingEngine().getSibLocalizationPointList().get(destinationName + "@" + meName).getTargetUuid(); //set the uuid and targetuuid of the localization newConfig.getMessagingEngine().getSibLocalizationPointList().get(destinationName + "@" + meName).setUuid(uuid); // depends on control dependency: [if], data = [none] newConfig.getMessagingEngine().getSibLocalizationPointList().get(destinationName + "@" + meName).setTargetUuid(targetUuid); // depends on control dependency: [if], data = [none] } } // now check in modifiedDestinationSet to see if at all anything have // changed. If nothing is changed we just ignore it mit = modifiedDestinationSet.iterator(); while (mit.hasNext()) { String key = (String) mit.next(); BaseDestination modifiedDestination = newConfig.getMessagingEngine() .getDestinationList().get(key); BaseDestination oldDestination = jsMEConfig.getMessagingEngine() .getDestinationList().get(key); // if the properties are different then remove destination from modifiedDestinationSet, else do nothing(i.e retain it in the set) // IMP : here equals() used is overridden method if (modifiedDestination.isLocal()) { if (((SIBDestination) modifiedDestination).equals(oldDestination)) mit.remove(); // remove the destination from the modifiedDestinationSet as both the objects are equal } else if (modifiedDestination.isAlias()) { if (((AliasDestination) modifiedDestination).equals(oldDestination)) mit.remove(); // remove the destination from the modifiedDestinationSet as both the objects are equal } } // Check if the highMessageThreshold is different.If yes then invoke reloadEngine() if (jsMEConfig.getMessagingEngine().getHighMessageThreshold() != newConfig.getMessagingEngine().getHighMessageThreshold()) { try { _jsMainImpl.reloadEngine(newConfig.getMessagingEngine().getHighMessageThreshold()); // depends on control dependency: [try], data = [none] } catch (Exception e) { SibTr.exception(tc, e); FFDCFilter.processException(e, this.getClass().getName(), "972", this); } // depends on control dependency: [catch], data = [none] } Iterator dit = deletedDestinationSet.iterator(); while (dit.hasNext()) { String key = (String) dit.next(); // deleted SIBDestination can be got from the old jsMEConfig try { _jsMainImpl.deleteDestinationLocalization(jsMEConfig .getMessagingEngine().getDestinationList().get( (key))); // depends on control dependency: [try], data = [none] } catch (Exception e) { SibTr.exception(tc, e); FFDCFilter.processException(e, this.getClass().getName(), "974", this); } // depends on control dependency: [catch], data = [none] } Iterator nit = addedDestinationSet.iterator(); while (nit.hasNext()) { String key = (String) nit.next(); // New SIBDestination can be got from the new jsMEConfig try { _jsMainImpl.createDestinationLocalization(newConfig .getMessagingEngine().getDestinationList().get( (key))); // depends on control dependency: [try], data = [none] } catch (Exception e) { SibTr.exception(tc, e); FFDCFilter.processException(e, this.getClass().getName(), "992", this); } // depends on control dependency: [catch], data = [none] } Iterator mmit = modifiedDestinationSet.iterator(); while (mmit.hasNext()) { String key = (String) mmit.next(); // Modified SIBDestination can be got from the new jsMEConfig try { _jsMainImpl.alterDestinationLocalization(newConfig .getMessagingEngine().getDestinationList().get( (key))); // depends on control dependency: [try], data = [none] } catch (Exception e) { SibTr.exception(tc, e); FFDCFilter.processException(e, this.getClass().getName(), "1010", this); } // depends on control dependency: [catch], data = [none] } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, "compareAndTakeAction"); // depends on control dependency: [if], data = [none] } } }
public class class_name { public final boolean release(int arg) { if (tryRelease(arg)) { Node h = head; if (h != null && h.waitStatus != 0) unparkSuccessor(h); return true; } return false; } }
public class class_name { public final boolean release(int arg) { if (tryRelease(arg)) { Node h = head; if (h != null && h.waitStatus != 0) unparkSuccessor(h); return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public void marshall(DescribeSharedDirectoriesRequest describeSharedDirectoriesRequest, ProtocolMarshaller protocolMarshaller) { if (describeSharedDirectoriesRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(describeSharedDirectoriesRequest.getOwnerDirectoryId(), OWNERDIRECTORYID_BINDING); protocolMarshaller.marshall(describeSharedDirectoriesRequest.getSharedDirectoryIds(), SHAREDDIRECTORYIDS_BINDING); protocolMarshaller.marshall(describeSharedDirectoriesRequest.getNextToken(), NEXTTOKEN_BINDING); protocolMarshaller.marshall(describeSharedDirectoriesRequest.getLimit(), LIMIT_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DescribeSharedDirectoriesRequest describeSharedDirectoriesRequest, ProtocolMarshaller protocolMarshaller) { if (describeSharedDirectoriesRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(describeSharedDirectoriesRequest.getOwnerDirectoryId(), OWNERDIRECTORYID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(describeSharedDirectoriesRequest.getSharedDirectoryIds(), SHAREDDIRECTORYIDS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(describeSharedDirectoriesRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(describeSharedDirectoriesRequest.getLimit(), LIMIT_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void _updateStatus() { boolean doneWithoutErrors = true; boolean doneWithErrors = true; boolean finishedOne = false; if (_status == Status.DONE || _status == Status.ERROR) { return; } for (AsyncBatchedMetricQuery query: _queries) { Status status = query.getStatus(); if (status == Status.PROCESSING) { _status = Status.PROCESSING; return; } boolean queryFinished = (status == Status.DONE || status == Status.ERROR); if (queryFinished) { finishedOne = true; } doneWithErrors &= queryFinished; doneWithoutErrors &= (status == Status.DONE); } if (!doneWithoutErrors && doneWithErrors) { _status = Status.ERROR; } else if (doneWithoutErrors) { _status = Status.DONE; } else if (finishedOne) { _status = Status.PROCESSING; } else { _status = Status.QUEUED; } } }
public class class_name { private void _updateStatus() { boolean doneWithoutErrors = true; boolean doneWithErrors = true; boolean finishedOne = false; if (_status == Status.DONE || _status == Status.ERROR) { return; // depends on control dependency: [if], data = [none] } for (AsyncBatchedMetricQuery query: _queries) { Status status = query.getStatus(); if (status == Status.PROCESSING) { _status = Status.PROCESSING; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } boolean queryFinished = (status == Status.DONE || status == Status.ERROR); if (queryFinished) { finishedOne = true; // depends on control dependency: [if], data = [none] } doneWithErrors &= queryFinished; // depends on control dependency: [for], data = [query] doneWithoutErrors &= (status == Status.DONE); // depends on control dependency: [for], data = [none] } if (!doneWithoutErrors && doneWithErrors) { _status = Status.ERROR; // depends on control dependency: [if], data = [none] } else if (doneWithoutErrors) { _status = Status.DONE; // depends on control dependency: [if], data = [none] } else if (finishedOne) { _status = Status.PROCESSING; // depends on control dependency: [if], data = [none] } else { _status = Status.QUEUED; // depends on control dependency: [if], data = [none] } } }
public class class_name { public String show() { try { specification = gpUtil.getGPServerService().getSpecificationById(getId()); } catch (GreenPepperServerException e) { addActionError(e.getId()); } return SUCCESS; } }
public class class_name { public String show() { try { specification = gpUtil.getGPServerService().getSpecificationById(getId()); // depends on control dependency: [try], data = [none] } catch (GreenPepperServerException e) { addActionError(e.getId()); } // depends on control dependency: [catch], data = [none] return SUCCESS; } }
public class class_name { private static boolean validateMongoConnection(ExternalTestService mongoService) { String method = "validateMongoConnection"; MongoClient mongoClient = null; String host = mongoService.getAddress(); int port = mongoService.getPort(); File trustStore = null; MongoClientOptions.Builder optionsBuilder = new MongoClientOptions.Builder().connectTimeout(30000); try { trustStore = File.createTempFile("mongoTrustStore", "jks"); Map<String, String> serviceProperties = mongoService.getProperties(); String password = serviceProperties.get(TEST_USERNAME + "_password"); // will be null if there's no auth for this server SSLSocketFactory sslSocketFactory = null; try { mongoService.writePropertyAsFile("ca_truststore", trustStore); sslSocketFactory = getSocketFactory(trustStore); } catch (IllegalStateException e) { // Ignore exception thrown if truststore is not present for this server // This indicates that we are not using SSL for this server and sslSocketFactory will be null } if (sslSocketFactory != null) { optionsBuilder.socketFactory(sslSocketFactory); } MongoClientOptions clientOptions = optionsBuilder.build(); List<MongoCredential> credentials = Collections.emptyList(); if (password != null) { MongoCredential credential = MongoCredential.createCredential(TEST_USERNAME, TEST_DATABASE, password.toCharArray()); credentials = Collections.singletonList(credential); } Log.info(c, method, "Attempting to contact server " + host + ":" + port + " with password " + (password != null ? "set" : "not set") + " and truststore " + (sslSocketFactory != null ? "set" : "not set")); mongoClient = new MongoClient(new ServerAddress(host, port), credentials, clientOptions); mongoClient.getDB("default").getCollectionNames(); mongoClient.close(); } catch (Exception e) { Log.info(c, method, "Couldn't create a connection to " + mongoService.getServiceName() + " on " + mongoService.getAddress() + ". " + e.toString()); mongoService.reportUnhealthy("Couldn't connect to server. Exception: " + e.toString()); return false; } finally { if (trustStore != null) { trustStore.delete(); } } return true; } }
public class class_name { private static boolean validateMongoConnection(ExternalTestService mongoService) { String method = "validateMongoConnection"; MongoClient mongoClient = null; String host = mongoService.getAddress(); int port = mongoService.getPort(); File trustStore = null; MongoClientOptions.Builder optionsBuilder = new MongoClientOptions.Builder().connectTimeout(30000); try { trustStore = File.createTempFile("mongoTrustStore", "jks"); // depends on control dependency: [try], data = [none] Map<String, String> serviceProperties = mongoService.getProperties(); String password = serviceProperties.get(TEST_USERNAME + "_password"); // will be null if there's no auth for this server SSLSocketFactory sslSocketFactory = null; try { mongoService.writePropertyAsFile("ca_truststore", trustStore); // depends on control dependency: [try], data = [none] sslSocketFactory = getSocketFactory(trustStore); // depends on control dependency: [try], data = [none] } catch (IllegalStateException e) { // Ignore exception thrown if truststore is not present for this server // This indicates that we are not using SSL for this server and sslSocketFactory will be null } // depends on control dependency: [catch], data = [none] if (sslSocketFactory != null) { optionsBuilder.socketFactory(sslSocketFactory); // depends on control dependency: [if], data = [(sslSocketFactory] } MongoClientOptions clientOptions = optionsBuilder.build(); List<MongoCredential> credentials = Collections.emptyList(); if (password != null) { MongoCredential credential = MongoCredential.createCredential(TEST_USERNAME, TEST_DATABASE, password.toCharArray()); credentials = Collections.singletonList(credential); // depends on control dependency: [if], data = [none] } Log.info(c, method, "Attempting to contact server " + host + ":" + port + " with password " + (password != null ? "set" : "not set") + " and truststore " + (sslSocketFactory != null ? "set" : "not set")); // depends on control dependency: [try], data = [none] mongoClient = new MongoClient(new ServerAddress(host, port), credentials, clientOptions); // depends on control dependency: [try], data = [none] mongoClient.getDB("default").getCollectionNames(); // depends on control dependency: [try], data = [none] mongoClient.close(); // depends on control dependency: [try], data = [none] } catch (Exception e) { Log.info(c, method, "Couldn't create a connection to " + mongoService.getServiceName() + " on " + mongoService.getAddress() + ". " + e.toString()); mongoService.reportUnhealthy("Couldn't connect to server. Exception: " + e.toString()); return false; } finally { // depends on control dependency: [catch], data = [none] if (trustStore != null) { trustStore.delete(); // depends on control dependency: [if], data = [none] } } return true; } }
public class class_name { private static int getLocalDelta(int rawBefore, int dstBefore, int rawAfter, int dstAfter, int NonExistingTimeOpt, int DuplicatedTimeOpt) { int delta = 0; int offsetBefore = rawBefore + dstBefore; int offsetAfter = rawAfter + dstAfter; boolean dstToStd = (dstBefore != 0) && (dstAfter == 0); boolean stdToDst = (dstBefore == 0) && (dstAfter != 0); if (offsetAfter - offsetBefore >= 0) { // Positive transition, which makes a non-existing local time range if (((NonExistingTimeOpt & STD_DST_MASK) == LOCAL_STD && dstToStd) || ((NonExistingTimeOpt & STD_DST_MASK) == LOCAL_DST && stdToDst)) { delta = offsetBefore; } else if (((NonExistingTimeOpt & STD_DST_MASK) == LOCAL_STD && stdToDst) || ((NonExistingTimeOpt & STD_DST_MASK) == LOCAL_DST && dstToStd)) { delta = offsetAfter; } else if ((NonExistingTimeOpt & FORMER_LATTER_MASK) == LOCAL_LATTER) { delta = offsetBefore; } else { // Interprets the time with rule before the transition, // default for non-existing time range delta = offsetAfter; } } else { // Negative transition, which makes a duplicated local time range if (((DuplicatedTimeOpt & STD_DST_MASK) == LOCAL_STD && dstToStd) || ((DuplicatedTimeOpt & STD_DST_MASK) == LOCAL_DST && stdToDst)) { delta = offsetAfter; } else if (((DuplicatedTimeOpt & STD_DST_MASK) == LOCAL_STD && stdToDst) || ((DuplicatedTimeOpt & STD_DST_MASK) == LOCAL_DST && dstToStd)) { delta = offsetBefore; } else if ((DuplicatedTimeOpt & FORMER_LATTER_MASK) == LOCAL_FORMER) { delta = offsetBefore; } else { // Interprets the time with rule after the transition, // default for duplicated local time range delta = offsetAfter; } } return delta; } }
public class class_name { private static int getLocalDelta(int rawBefore, int dstBefore, int rawAfter, int dstAfter, int NonExistingTimeOpt, int DuplicatedTimeOpt) { int delta = 0; int offsetBefore = rawBefore + dstBefore; int offsetAfter = rawAfter + dstAfter; boolean dstToStd = (dstBefore != 0) && (dstAfter == 0); boolean stdToDst = (dstBefore == 0) && (dstAfter != 0); if (offsetAfter - offsetBefore >= 0) { // Positive transition, which makes a non-existing local time range if (((NonExistingTimeOpt & STD_DST_MASK) == LOCAL_STD && dstToStd) || ((NonExistingTimeOpt & STD_DST_MASK) == LOCAL_DST && stdToDst)) { delta = offsetBefore; // depends on control dependency: [if], data = [none] } else if (((NonExistingTimeOpt & STD_DST_MASK) == LOCAL_STD && stdToDst) || ((NonExistingTimeOpt & STD_DST_MASK) == LOCAL_DST && dstToStd)) { delta = offsetAfter; // depends on control dependency: [if], data = [none] } else if ((NonExistingTimeOpt & FORMER_LATTER_MASK) == LOCAL_LATTER) { delta = offsetBefore; // depends on control dependency: [if], data = [none] } else { // Interprets the time with rule before the transition, // default for non-existing time range delta = offsetAfter; // depends on control dependency: [if], data = [none] } } else { // Negative transition, which makes a duplicated local time range if (((DuplicatedTimeOpt & STD_DST_MASK) == LOCAL_STD && dstToStd) || ((DuplicatedTimeOpt & STD_DST_MASK) == LOCAL_DST && stdToDst)) { delta = offsetAfter; // depends on control dependency: [if], data = [none] } else if (((DuplicatedTimeOpt & STD_DST_MASK) == LOCAL_STD && stdToDst) || ((DuplicatedTimeOpt & STD_DST_MASK) == LOCAL_DST && dstToStd)) { delta = offsetBefore; // depends on control dependency: [if], data = [none] } else if ((DuplicatedTimeOpt & FORMER_LATTER_MASK) == LOCAL_FORMER) { delta = offsetBefore; // depends on control dependency: [if], data = [none] } else { // Interprets the time with rule after the transition, // default for duplicated local time range delta = offsetAfter; // depends on control dependency: [if], data = [none] } } return delta; } }
public class class_name { public void setStackErrors(java.util.Collection<StackError> stackErrors) { if (stackErrors == null) { this.stackErrors = null; return; } this.stackErrors = new java.util.ArrayList<StackError>(stackErrors); } }
public class class_name { public void setStackErrors(java.util.Collection<StackError> stackErrors) { if (stackErrors == null) { this.stackErrors = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.stackErrors = new java.util.ArrayList<StackError>(stackErrors); } }
public class class_name { @Override public boolean databaseExists(final String name) { List<String> databases = this.describeDatabases(); for (String databaseName : databases) { if (databaseName.trim().equals(name)) { return true; } } return false; } }
public class class_name { @Override public boolean databaseExists(final String name) { List<String> databases = this.describeDatabases(); for (String databaseName : databases) { if (databaseName.trim().equals(name)) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { public static void phase( ImageInterleaved transform , GrayF phase ) { if( transform instanceof InterleavedF32 ) { DiscreteFourierTransformOps.phase((InterleavedF32) transform, (GrayF32) phase); } else if( transform instanceof InterleavedF64 ) { DiscreteFourierTransformOps.phase((InterleavedF64) transform, (GrayF64) phase); } else { throw new IllegalArgumentException("Unknown image type"); } } }
public class class_name { public static void phase( ImageInterleaved transform , GrayF phase ) { if( transform instanceof InterleavedF32 ) { DiscreteFourierTransformOps.phase((InterleavedF32) transform, (GrayF32) phase); // depends on control dependency: [if], data = [none] } else if( transform instanceof InterleavedF64 ) { DiscreteFourierTransformOps.phase((InterleavedF64) transform, (GrayF64) phase); // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException("Unknown image type"); } } }
public class class_name { public void savePendingComposingMessage() { Editable content = getPendingComposingContent(); SharedPreferences prefs = ApptentiveInternal.getInstance().getGlobalSharedPrefs(); SharedPreferences.Editor editor = prefs.edit(); ConversationProxy conversation = getConversation(); assertNotNull(conversation); if (conversation == null) { return; } if (content != null) { conversation.setMessageCenterPendingMessage(content.toString().trim()); } else { conversation.setMessageCenterPendingMessage(null); } JSONArray pendingAttachmentsJsonArray = new JSONArray(); // Save pending attachment for (ImageItem pendingAttachment : pendingAttachments) { pendingAttachmentsJsonArray.put(pendingAttachment.toJSON()); } if (pendingAttachmentsJsonArray.length() > 0) { conversation.setMessageCenterPendingAttachments(pendingAttachmentsJsonArray.toString()); } else { conversation.setMessageCenterPendingAttachments(null); } editor.apply(); } }
public class class_name { public void savePendingComposingMessage() { Editable content = getPendingComposingContent(); SharedPreferences prefs = ApptentiveInternal.getInstance().getGlobalSharedPrefs(); SharedPreferences.Editor editor = prefs.edit(); ConversationProxy conversation = getConversation(); assertNotNull(conversation); if (conversation == null) { return; // depends on control dependency: [if], data = [none] } if (content != null) { conversation.setMessageCenterPendingMessage(content.toString().trim()); // depends on control dependency: [if], data = [(content] } else { conversation.setMessageCenterPendingMessage(null); // depends on control dependency: [if], data = [null)] } JSONArray pendingAttachmentsJsonArray = new JSONArray(); // Save pending attachment for (ImageItem pendingAttachment : pendingAttachments) { pendingAttachmentsJsonArray.put(pendingAttachment.toJSON()); // depends on control dependency: [for], data = [pendingAttachment] } if (pendingAttachmentsJsonArray.length() > 0) { conversation.setMessageCenterPendingAttachments(pendingAttachmentsJsonArray.toString()); // depends on control dependency: [if], data = [none] } else { conversation.setMessageCenterPendingAttachments(null); // depends on control dependency: [if], data = [none] } editor.apply(); } }
public class class_name { @Nonnull public static ApiError parseError(@Nullable String errorBody, int statusCode, @Nullable String message) { if (errorBody == null) { return new ApiError(null, statusCode, message); } Moshi moshi = new Moshi.Builder().build(); JsonAdapter<CompatibilityApiError> oldApiErrorJsonAdapter = moshi.adapter(CompatibilityApiError.class).failOnUnknown(); try { return new ApiError(oldApiErrorJsonAdapter.fromJson(errorBody), statusCode); } catch (IOException | JsonDataException exception) { // Not old type of error, move on } JsonAdapter<ApiError> apiErrorJsonAdapter = moshi.adapter(ApiError.class).failOnUnknown(); try { return apiErrorJsonAdapter.fromJson(errorBody); } catch (IOException | JsonDataException exception) { return new ApiError(null, statusCode, "Unknown Error"); } } }
public class class_name { @Nonnull public static ApiError parseError(@Nullable String errorBody, int statusCode, @Nullable String message) { if (errorBody == null) { return new ApiError(null, statusCode, message); // depends on control dependency: [if], data = [none] } Moshi moshi = new Moshi.Builder().build(); JsonAdapter<CompatibilityApiError> oldApiErrorJsonAdapter = moshi.adapter(CompatibilityApiError.class).failOnUnknown(); try { return new ApiError(oldApiErrorJsonAdapter.fromJson(errorBody), statusCode); // depends on control dependency: [try], data = [none] } catch (IOException | JsonDataException exception) { // Not old type of error, move on } // depends on control dependency: [catch], data = [none] JsonAdapter<ApiError> apiErrorJsonAdapter = moshi.adapter(ApiError.class).failOnUnknown(); try { return apiErrorJsonAdapter.fromJson(errorBody); // depends on control dependency: [try], data = [none] } catch (IOException | JsonDataException exception) { return new ApiError(null, statusCode, "Unknown Error"); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static boolean contentEquals(Reader input1, Reader input2) throws IOException { input1 = toBufferedReader(input1); input2 = toBufferedReader(input2); int ch = input1.read(); while (EOF != ch) { int ch2 = input2.read(); if (ch != ch2) { return false; } ch = input1.read(); } int ch2 = input2.read(); return ch2 == EOF; } }
public class class_name { public static boolean contentEquals(Reader input1, Reader input2) throws IOException { input1 = toBufferedReader(input1); input2 = toBufferedReader(input2); int ch = input1.read(); while (EOF != ch) { int ch2 = input2.read(); if (ch != ch2) { return false; // depends on control dependency: [if], data = [none] } ch = input1.read(); } int ch2 = input2.read(); return ch2 == EOF; } }
public class class_name { public static void fillUniform(ZMatrixD1 mat , double min , double max , Random rand ) { double d[] = mat.getData(); int size = mat.getDataLength(); double r = max-min; for( int i = 0; i < size; i++ ) { d[i] = r*rand.nextDouble()+min; } } }
public class class_name { public static void fillUniform(ZMatrixD1 mat , double min , double max , Random rand ) { double d[] = mat.getData(); int size = mat.getDataLength(); double r = max-min; for( int i = 0; i < size; i++ ) { d[i] = r*rand.nextDouble()+min; // depends on control dependency: [for], data = [i] } } }
public class class_name { public void visit(final String name, final Object value) { if (av != null) { av.visit(name, value); } } }
public class class_name { public void visit(final String name, final Object value) { if (av != null) { av.visit(name, value); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public String getContextPath() { final HttpServletRequest request = getCurrentRequest(); String appUri = (String) request.getAttribute(GrailsApplicationAttributes.APP_URI_ATTRIBUTE); if (appUri == null) { appUri = urlHelper.getContextPath(request); } return appUri; } }
public class class_name { @Override public String getContextPath() { final HttpServletRequest request = getCurrentRequest(); String appUri = (String) request.getAttribute(GrailsApplicationAttributes.APP_URI_ATTRIBUTE); if (appUri == null) { appUri = urlHelper.getContextPath(request); // depends on control dependency: [if], data = [none] } return appUri; } }
public class class_name { private static final <E> void moveAll(ArrayList<E> source, ArrayList<E> target) { target.ensureCapacity(target.size() + source.size()); for (int i = source.size() - 1; i >= 0; i--) { target.add(source.remove(i)); } } }
public class class_name { private static final <E> void moveAll(ArrayList<E> source, ArrayList<E> target) { target.ensureCapacity(target.size() + source.size()); for (int i = source.size() - 1; i >= 0; i--) { target.add(source.remove(i)); // depends on control dependency: [for], data = [i] } } }
public class class_name { private String _getAuthorizationUrl(String oauthCallback) { String url = null; try { url = mOAuthProvider.retrieveRequestToken(mOAuthConsumer, oauthCallback); } catch (OAuthException e) { e.printStackTrace(); } return url; } }
public class class_name { private String _getAuthorizationUrl(String oauthCallback) { String url = null; try { url = mOAuthProvider.retrieveRequestToken(mOAuthConsumer, oauthCallback); // depends on control dependency: [try], data = [none] } catch (OAuthException e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none] return url; } }
public class class_name { void topicSpaceDeleted(DestinationHandler destination) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "topicSpaceDeleted", destination); // Synchronize around the topic space references to stop removal and // additions occuring at the same time. synchronized (_topicSpaces) { // Get the list of the different PubSubOutputHandlers from the Destination // Clone the list as the original is locked final HashMap pubsubOutputHandlers = (HashMap)(destination.getAllPubSubOutputHandlers()).clone(); // Unlock the list as leaving it locked results in deadlock destination.unlockPubsubOutputHandlers(); // Check that there are some output handlers as they may have all been // removed or none have ever been created on this topicSpace destination if (pubsubOutputHandlers != null && pubsubOutputHandlers.size() > 0) { final ArrayList topicSpacesDeleted = new ArrayList(); final ArrayList topicsDeleted = new ArrayList(); // Get the set of keys from the pubsubOutputHandlers which is infact the // list of meNames final Iterator neighbourUuids = pubsubOutputHandlers.keySet().iterator(); // Iterate over the list of meNames while (neighbourUuids.hasNext()) { // Reset the created topicSpaces topicSpacesDeleted.clear(); // Reset the created topics topicsDeleted.clear(); // Get the next me Name final SIBUuid8 neighbourUuid = (SIBUuid8) neighbourUuids.next(); // Get the PubSubOutputHandler associated with this ME. final PubSubOutputHandler handler = (PubSubOutputHandler) pubsubOutputHandlers.get(neighbourUuid); final String topics[] = handler.getTopics(); Neighbour neighbour = getNeighbour(neighbourUuid); // In the case that this neighbour is recovered, but not activated, // this neighbour should be got from the recovered list boolean warmRestarted = false; if (neighbour == null) { synchronized(_recoveredNeighbours) { neighbour = (Neighbour)_recoveredNeighbours.get(neighbourUuid); } warmRestarted = true; } // Cycle through the topics removing each one from this ME. // but only if there are topics to remove. if ( neighbour != null && topics != null) { for (int i = 0; i < topics.length; i++) { // Remove this Handler from the MatchSpace if (!warmRestarted) { MESubscription meSub = neighbour.getSubscription(destination.getUuid(), topics[i]); ControllableProxySubscription sub = meSub.getMatchspaceSub(); _proxyHandler .getMessageProcessor() .getMessageProcessorMatching() .removePubSubOutputHandlerMatchTarget(sub); destination.getSubscriptionIndex().remove(sub); } // Remove the topic from the referenced topics in the handler. handler.removeTopic(topics[i]); // Add a reference into the reference list so when a delete arrives // The proxy can be removed. addTopicSpaceReference(neighbourUuid, destination.getUuid(), topics[i], warmRestarted); // Add the topicSpace and topic to the set of deleted topics. topicSpacesDeleted.add(destination.getUuid()); topicsDeleted.add(topics[i]); } } // Having cleaned all the topics out from the handler // delete the handler. destination.deletePubSubOutputHandler(neighbourUuid); // Publish the deleted event for the deleted topics on the topic space if ( neighbour!= null ) _proxyHandler.unsubscribeEvent( topicSpacesDeleted, topicsDeleted, neighbour.getBusId(), null); } } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "topicSpaceDeleted"); } }
public class class_name { void topicSpaceDeleted(DestinationHandler destination) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "topicSpaceDeleted", destination); // Synchronize around the topic space references to stop removal and // additions occuring at the same time. synchronized (_topicSpaces) { // Get the list of the different PubSubOutputHandlers from the Destination // Clone the list as the original is locked final HashMap pubsubOutputHandlers = (HashMap)(destination.getAllPubSubOutputHandlers()).clone(); // Unlock the list as leaving it locked results in deadlock destination.unlockPubsubOutputHandlers(); // Check that there are some output handlers as they may have all been // removed or none have ever been created on this topicSpace destination if (pubsubOutputHandlers != null && pubsubOutputHandlers.size() > 0) { final ArrayList topicSpacesDeleted = new ArrayList(); final ArrayList topicsDeleted = new ArrayList(); // Get the set of keys from the pubsubOutputHandlers which is infact the // list of meNames final Iterator neighbourUuids = pubsubOutputHandlers.keySet().iterator(); // Iterate over the list of meNames while (neighbourUuids.hasNext()) { // Reset the created topicSpaces topicSpacesDeleted.clear(); // depends on control dependency: [while], data = [none] // Reset the created topics topicsDeleted.clear(); // depends on control dependency: [while], data = [none] // Get the next me Name final SIBUuid8 neighbourUuid = (SIBUuid8) neighbourUuids.next(); // Get the PubSubOutputHandler associated with this ME. final PubSubOutputHandler handler = (PubSubOutputHandler) pubsubOutputHandlers.get(neighbourUuid); final String topics[] = handler.getTopics(); Neighbour neighbour = getNeighbour(neighbourUuid); // In the case that this neighbour is recovered, but not activated, // this neighbour should be got from the recovered list boolean warmRestarted = false; if (neighbour == null) { synchronized(_recoveredNeighbours) // depends on control dependency: [if], data = [none] { neighbour = (Neighbour)_recoveredNeighbours.get(neighbourUuid); } warmRestarted = true; // depends on control dependency: [if], data = [none] } // Cycle through the topics removing each one from this ME. // but only if there are topics to remove. if ( neighbour != null && topics != null) { for (int i = 0; i < topics.length; i++) { // Remove this Handler from the MatchSpace if (!warmRestarted) { MESubscription meSub = neighbour.getSubscription(destination.getUuid(), topics[i]); ControllableProxySubscription sub = meSub.getMatchspaceSub(); _proxyHandler .getMessageProcessor() .getMessageProcessorMatching() .removePubSubOutputHandlerMatchTarget(sub); // depends on control dependency: [if], data = [none] destination.getSubscriptionIndex().remove(sub); // depends on control dependency: [if], data = [none] } // Remove the topic from the referenced topics in the handler. handler.removeTopic(topics[i]); // depends on control dependency: [for], data = [i] // Add a reference into the reference list so when a delete arrives // The proxy can be removed. addTopicSpaceReference(neighbourUuid, destination.getUuid(), topics[i], warmRestarted); // depends on control dependency: [for], data = [i] // Add the topicSpace and topic to the set of deleted topics. topicSpacesDeleted.add(destination.getUuid()); // depends on control dependency: [for], data = [none] topicsDeleted.add(topics[i]); // depends on control dependency: [for], data = [i] } } // Having cleaned all the topics out from the handler // delete the handler. destination.deletePubSubOutputHandler(neighbourUuid); // depends on control dependency: [while], data = [none] // Publish the deleted event for the deleted topics on the topic space if ( neighbour!= null ) _proxyHandler.unsubscribeEvent( topicSpacesDeleted, topicsDeleted, neighbour.getBusId(), null); } } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "topicSpaceDeleted"); } }