code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { protected double[][] extractFeaturesInternal(BufferedImage image) { double[][] features = super.extractFeaturesInternal(image); for (int i = 0; i < features.length; i++) { Normalization.normalizePower(features[i], 0.5); Normalization.normalizeL2(features[i]); } return features; } }
public class class_name { protected double[][] extractFeaturesInternal(BufferedImage image) { double[][] features = super.extractFeaturesInternal(image); for (int i = 0; i < features.length; i++) { Normalization.normalizePower(features[i], 0.5); // depends on control dependency: [for], data = [i] Normalization.normalizeL2(features[i]); // depends on control dependency: [for], data = [i] } return features; } }
public class class_name { public void setVTLDeviceARNs(java.util.Collection<String> vTLDeviceARNs) { if (vTLDeviceARNs == null) { this.vTLDeviceARNs = null; return; } this.vTLDeviceARNs = new com.amazonaws.internal.SdkInternalList<String>(vTLDeviceARNs); } }
public class class_name { public void setVTLDeviceARNs(java.util.Collection<String> vTLDeviceARNs) { if (vTLDeviceARNs == null) { this.vTLDeviceARNs = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.vTLDeviceARNs = new com.amazonaws.internal.SdkInternalList<String>(vTLDeviceARNs); } }
public class class_name { private SICoreConnection remoteBootstrap(CredentialType credentialType, ClientAttachProperties cap) throws SIAuthenticationException, SIErrorException, SIIncorrectCallException, SINotAuthorizedException, SINotPossibleInCurrentConfigurationException, SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "remoteBootstrap", new Object[] { credentialType, cap }); SICoreConnection sc = null; ClientConnectionFactory ccf = CommonServiceFacade.getClientConnectionFactory(); if (ccf == null) { throw new SIErrorException(nls.getString("NO_CCF_CWSIT0004")); } // contact bootstrap service ContactBootstrapServiceResponse cbsr = contactBootstrapService(credentialType, cap, ccf); // process bootstrap reply ClientConnection cc = cbsr.getClientConnection(); TrmClientBootstrapReply cbr = cbsr.getClientBootstrapReply(); int rc = cbsr.getReturnCode(); boolean goodReply = cbsr.isGoodReply(); ProviderEndPoint ep = cbsr.getEndPoint(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "cc=" + cc + ", cbr=" + cbr + ", rc=" + rc + ", goodReply=" + goodReply + ", ep=" + ep.getEndPointInfo()); if (goodReply) { //250165 if (rc == TrmConstantsImpl.RETURN_CODE_OK) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Staying with bootstrap messaging engine"); sc = cc.getSICoreConnection(); } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "*** shouldn't ever get here!"); //250165 } } else { List uncontactableBootstrapServers = cbsr.getUncontactableBootstrapServers(); List failedBootstrapServers = cbsr.getFailedBootstrapServers(); Exception firstMirroredFailureException = cbsr.getFirstMirroredFailureException(); Exception firstBootstrapFailureException = cbsr.getFirstBootstrapFailureException(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "uncontactableBootstrapServers=" + uncontactableBootstrapServers + ", failedBootstrapServers=" + failedBootstrapServers + ", firstMirroredFailureException=" + firstMirroredFailureException + ", firstBootstrapFailureException=" + firstBootstrapFailureException); if (null != firstMirroredFailureException) { if (firstMirroredFailureException instanceof SIAuthenticationException) { // authentication with the bootstrap server failed throw (SIAuthenticationException) firstMirroredFailureException; } else if (firstMirroredFailureException instanceof SINotAuthorizedException) { // not authorised to use the bootstrap server throw (SINotAuthorizedException) firstMirroredFailureException; } else { // we successfully connected to a bootstrap server but got an error generateException(getRC(firstMirroredFailureException), nls.getFormattedMessage("LIBERTY_BOOTSTRAP_FAILURE_CWSIT0126", new Object[] { failedBootstrapServers.get(0).toString(), Utils.getFailureMessage(cbr.getFailureReason()) }, null), firstMirroredFailureException, true); } } else { // none of the specified bootstrap endpoints could be contacted generateException(getRC(firstBootstrapFailureException), nls.getFormattedMessage("LIBERTY_NO_BOOTSTRAP_CWSIT0127", new Object[] { uncontactableBootstrapServers.toString() }, null), firstBootstrapFailureException, true); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "remoteBootstrap", sc); return sc; } }
public class class_name { private SICoreConnection remoteBootstrap(CredentialType credentialType, ClientAttachProperties cap) throws SIAuthenticationException, SIErrorException, SIIncorrectCallException, SINotAuthorizedException, SINotPossibleInCurrentConfigurationException, SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "remoteBootstrap", new Object[] { credentialType, cap }); SICoreConnection sc = null; ClientConnectionFactory ccf = CommonServiceFacade.getClientConnectionFactory(); if (ccf == null) { throw new SIErrorException(nls.getString("NO_CCF_CWSIT0004")); } // contact bootstrap service ContactBootstrapServiceResponse cbsr = contactBootstrapService(credentialType, cap, ccf); // process bootstrap reply ClientConnection cc = cbsr.getClientConnection(); TrmClientBootstrapReply cbr = cbsr.getClientBootstrapReply(); int rc = cbsr.getReturnCode(); boolean goodReply = cbsr.isGoodReply(); ProviderEndPoint ep = cbsr.getEndPoint(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "cc=" + cc + ", cbr=" + cbr + ", rc=" + rc + ", goodReply=" + goodReply + ", ep=" + ep.getEndPointInfo()); if (goodReply) { //250165 if (rc == TrmConstantsImpl.RETURN_CODE_OK) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Staying with bootstrap messaging engine"); sc = cc.getSICoreConnection(); // depends on control dependency: [if], data = [none] } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "*** shouldn't ever get here!"); //250165 } } else { List uncontactableBootstrapServers = cbsr.getUncontactableBootstrapServers(); List failedBootstrapServers = cbsr.getFailedBootstrapServers(); Exception firstMirroredFailureException = cbsr.getFirstMirroredFailureException(); Exception firstBootstrapFailureException = cbsr.getFirstBootstrapFailureException(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "uncontactableBootstrapServers=" + uncontactableBootstrapServers + ", failedBootstrapServers=" + failedBootstrapServers + ", firstMirroredFailureException=" + firstMirroredFailureException + ", firstBootstrapFailureException=" + firstBootstrapFailureException); if (null != firstMirroredFailureException) { if (firstMirroredFailureException instanceof SIAuthenticationException) { // authentication with the bootstrap server failed throw (SIAuthenticationException) firstMirroredFailureException; } else if (firstMirroredFailureException instanceof SINotAuthorizedException) { // not authorised to use the bootstrap server throw (SINotAuthorizedException) firstMirroredFailureException; } else { // we successfully connected to a bootstrap server but got an error generateException(getRC(firstMirroredFailureException), nls.getFormattedMessage("LIBERTY_BOOTSTRAP_FAILURE_CWSIT0126", new Object[] { failedBootstrapServers.get(0).toString(), Utils.getFailureMessage(cbr.getFailureReason()) }, null), firstMirroredFailureException, true); // depends on control dependency: [if], data = [none] } } else { // none of the specified bootstrap endpoints could be contacted generateException(getRC(firstBootstrapFailureException), nls.getFormattedMessage("LIBERTY_NO_BOOTSTRAP_CWSIT0127", new Object[] { uncontactableBootstrapServers.toString() }, null), firstBootstrapFailureException, true); // depends on control dependency: [if], data = [none] } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "remoteBootstrap", sc); return sc; } }
public class class_name { private boolean matchesTemplateShape(Node template, Node ast) { while (template != null) { if (ast == null || !matchesNodeShape(template, ast)) { return false; } template = template.getNext(); ast = ast.getNext(); } return true; } }
public class class_name { private boolean matchesTemplateShape(Node template, Node ast) { while (template != null) { if (ast == null || !matchesNodeShape(template, ast)) { return false; // depends on control dependency: [if], data = [none] } template = template.getNext(); // depends on control dependency: [while], data = [none] ast = ast.getNext(); // depends on control dependency: [while], data = [none] } return true; } }
public class class_name { public final String replaceAll(String s, char replacementCharacter) { final StringBuilder sb = new StringBuilder(); for (int offset = 0; offset < s.length(); ) { final int codePoint = s.codePointAt(offset); if (matches(codePoint)) { sb.append(replacementCharacter); } else { sb.appendCodePoint(codePoint); } offset += Character.charCount(codePoint); } return sb.toString(); } }
public class class_name { public final String replaceAll(String s, char replacementCharacter) { final StringBuilder sb = new StringBuilder(); for (int offset = 0; offset < s.length(); ) { final int codePoint = s.codePointAt(offset); if (matches(codePoint)) { sb.append(replacementCharacter); // depends on control dependency: [if], data = [none] } else { sb.appendCodePoint(codePoint); // depends on control dependency: [if], data = [none] } offset += Character.charCount(codePoint); // depends on control dependency: [for], data = [offset] } return sb.toString(); } }
public class class_name { public CLIQUESubspace join(CLIQUESubspace other, double all, double tau) { long[] dimensions = joinLastDimensions(other); if(dimensions == null) { return null; } CLIQUESubspace s = new CLIQUESubspace(dimensions); for(CLIQUEUnit u1 : this.denseUnits) { for(CLIQUEUnit u2 : other.denseUnits) { CLIQUEUnit u = u1.join(u2, all, tau); if(u != null) { s.addDenseUnit(u); } } } if(s.denseUnits.isEmpty()) { return null; } return s; } }
public class class_name { public CLIQUESubspace join(CLIQUESubspace other, double all, double tau) { long[] dimensions = joinLastDimensions(other); if(dimensions == null) { return null; // depends on control dependency: [if], data = [none] } CLIQUESubspace s = new CLIQUESubspace(dimensions); for(CLIQUEUnit u1 : this.denseUnits) { for(CLIQUEUnit u2 : other.denseUnits) { CLIQUEUnit u = u1.join(u2, all, tau); if(u != null) { s.addDenseUnit(u); // depends on control dependency: [if], data = [(u] } } } if(s.denseUnits.isEmpty()) { return null; // depends on control dependency: [if], data = [none] } return s; } }
public class class_name { public static boolean isHdfsUri(URI endpoint) { final String path = endpoint.getPath(); if (path != null && path.indexOf('/', 1) != -1) { return path.substring(1, path.indexOf('/', 1)).equalsIgnoreCase("webhdfs"); } else { return false; } } }
public class class_name { public static boolean isHdfsUri(URI endpoint) { final String path = endpoint.getPath(); if (path != null && path.indexOf('/', 1) != -1) { return path.substring(1, path.indexOf('/', 1)).equalsIgnoreCase("webhdfs"); // depends on control dependency: [if], data = [none] } else { return false; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static Map<String, String> getMetadataFromSequenceFile(FileSystem fs, Path path) { try { Configuration conf = new Configuration(); conf.setInt("io.file.buffer.size", 4096); SequenceFile.Reader reader = new SequenceFile.Reader(fs, path, new Configuration()); SequenceFile.Metadata meta = reader.getMetadata(); reader.close(); TreeMap<Text, Text> map = meta.getMetadata(); Map<String, String> values = new HashMap<String, String>(); for(Map.Entry<Text, Text> entry: map.entrySet()) values.put(entry.getKey().toString(), entry.getValue().toString()); return values; } catch(IOException e) { throw new RuntimeException(e); } } }
public class class_name { public static Map<String, String> getMetadataFromSequenceFile(FileSystem fs, Path path) { try { Configuration conf = new Configuration(); conf.setInt("io.file.buffer.size", 4096); // depends on control dependency: [try], data = [none] SequenceFile.Reader reader = new SequenceFile.Reader(fs, path, new Configuration()); SequenceFile.Metadata meta = reader.getMetadata(); reader.close(); // depends on control dependency: [try], data = [none] TreeMap<Text, Text> map = meta.getMetadata(); Map<String, String> values = new HashMap<String, String>(); for(Map.Entry<Text, Text> entry: map.entrySet()) values.put(entry.getKey().toString(), entry.getValue().toString()); return values; // depends on control dependency: [try], data = [none] } catch(IOException e) { throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private ServiceInfo generateServiceInfo(ServiceReference reference) { Map<String, String> map = Utils.toMap(reference); Set<String> keys = map.keySet(); String slpUrl = Utils.subst((String)reference.getProperty(SLP_URL), map); ServiceURL serviceURL; if (keys.contains(SLP_URL_LIFETIME)) { try { int lifetime = Integer.parseInt((String)reference.getProperty(SLP_URL_LIFETIME)); serviceURL = new ServiceURL(slpUrl, lifetime); } catch (NumberFormatException e) { serviceURL = new ServiceURL(slpUrl); } } else { serviceURL = new ServiceURL(slpUrl); } String language; if (keys.contains(SLP_LANGUAGE)) language = (String)reference.getProperty(SLP_LANGUAGE); else language = Locale.getDefault().getLanguage(); Scopes scopes = Scopes.NONE; if (keys.contains(SLP_SCOPES)) { String[] values = ((String)reference.getProperty(SLP_SCOPES)).split(","); for (int i = 0; i < values.length; i++) values[i] = values[i].trim(); scopes = Scopes.from(values); } ServiceType serviceType = null; if (keys.contains(SLP_SERVICE_TYPE)) { serviceType = new ServiceType((String)reference.getProperty(SLP_SERVICE_TYPE)); } map.remove(SLP_URL); map.remove(SLP_URL_LIFETIME); map.remove(SLP_LANGUAGE); map.remove(SLP_SCOPES); map.remove(SLP_SERVICE_TYPE); Attributes attributes = Attributes.from(map); ServiceInfo serviceInfo; if (serviceType != null) { serviceInfo = new ServiceInfo(serviceType, serviceURL, language, scopes, attributes); } else { serviceInfo = new ServiceInfo(serviceURL, language, scopes, attributes); } return serviceInfo; } }
public class class_name { private ServiceInfo generateServiceInfo(ServiceReference reference) { Map<String, String> map = Utils.toMap(reference); Set<String> keys = map.keySet(); String slpUrl = Utils.subst((String)reference.getProperty(SLP_URL), map); ServiceURL serviceURL; if (keys.contains(SLP_URL_LIFETIME)) { try { int lifetime = Integer.parseInt((String)reference.getProperty(SLP_URL_LIFETIME)); serviceURL = new ServiceURL(slpUrl, lifetime); // depends on control dependency: [try], data = [none] } catch (NumberFormatException e) { serviceURL = new ServiceURL(slpUrl); } // depends on control dependency: [catch], data = [none] } else { serviceURL = new ServiceURL(slpUrl); // depends on control dependency: [if], data = [none] } String language; if (keys.contains(SLP_LANGUAGE)) language = (String)reference.getProperty(SLP_LANGUAGE); else language = Locale.getDefault().getLanguage(); Scopes scopes = Scopes.NONE; if (keys.contains(SLP_SCOPES)) { String[] values = ((String)reference.getProperty(SLP_SCOPES)).split(","); for (int i = 0; i < values.length; i++) values[i] = values[i].trim(); scopes = Scopes.from(values); // depends on control dependency: [if], data = [none] } ServiceType serviceType = null; if (keys.contains(SLP_SERVICE_TYPE)) { serviceType = new ServiceType((String)reference.getProperty(SLP_SERVICE_TYPE)); // depends on control dependency: [if], data = [none] } map.remove(SLP_URL); map.remove(SLP_URL_LIFETIME); map.remove(SLP_LANGUAGE); map.remove(SLP_SCOPES); map.remove(SLP_SERVICE_TYPE); Attributes attributes = Attributes.from(map); ServiceInfo serviceInfo; if (serviceType != null) { serviceInfo = new ServiceInfo(serviceType, serviceURL, language, scopes, attributes); // depends on control dependency: [if], data = [(serviceType] } else { serviceInfo = new ServiceInfo(serviceURL, language, scopes, attributes); // depends on control dependency: [if], data = [none] } return serviceInfo; } }
public class class_name { @Override public boolean decompose( DMatrixRMaj A ) { commonSetup(A); for( int j = 0; j < minLength; j++ ) { householder(j); updateA(j); } return !error; } }
public class class_name { @Override public boolean decompose( DMatrixRMaj A ) { commonSetup(A); for( int j = 0; j < minLength; j++ ) { householder(j); // depends on control dependency: [for], data = [j] updateA(j); // depends on control dependency: [for], data = [j] } return !error; } }
public class class_name { public void addAndSimplify(double x, double y) { // simplify curve when possible: final int len = data.size(); if (len >= 4) { // Look at the previous 2 points final double l1x = data.get(len - 4); final double l1y = data.get(len - 3); final double l2x = data.get(len - 2); final double l2y = data.get(len - 1); // Differences: final double ldx = l2x - l1x; final double ldy = l2y - l1y; final double cdx = x - l2x; final double cdy = y - l2y; // X simplification if ((ldx == 0) && (cdx == 0)) { data.remove(len - 2, 2); } // horizontal simplification else if ((ldy == 0) && (cdy == 0)) { data.remove(len - 2, 2); } // diagonal simplification else if (ldy > 0 && cdy > 0) { if (Math.abs((ldx / ldy) - (cdx / cdy)) < THRESHOLD) { data.remove(len - 2, 2); } } } add(x, y); } }
public class class_name { public void addAndSimplify(double x, double y) { // simplify curve when possible: final int len = data.size(); if (len >= 4) { // Look at the previous 2 points final double l1x = data.get(len - 4); final double l1y = data.get(len - 3); final double l2x = data.get(len - 2); final double l2y = data.get(len - 1); // Differences: final double ldx = l2x - l1x; final double ldy = l2y - l1y; final double cdx = x - l2x; final double cdy = y - l2y; // X simplification if ((ldx == 0) && (cdx == 0)) { data.remove(len - 2, 2); // depends on control dependency: [if], data = [none] } // horizontal simplification else if ((ldy == 0) && (cdy == 0)) { data.remove(len - 2, 2); // depends on control dependency: [if], data = [none] } // diagonal simplification else if (ldy > 0 && cdy > 0) { if (Math.abs((ldx / ldy) - (cdx / cdy)) < THRESHOLD) { data.remove(len - 2, 2); // depends on control dependency: [if], data = [none] } } } add(x, y); } }
public class class_name { protected synchronized void fireAttributeAddedEvent(String name, AttributeValue attr) { if (this.listenerList != null && isEventFirable()) { final AttributeChangeListener[] list = new AttributeChangeListener[this.listenerList.size()]; this.listenerList.toArray(list); final AttributeChangeEvent event = new AttributeChangeEvent( this, Type.ADDITION, null, null, name, attr); for (final AttributeChangeListener listener : list) { listener.onAttributeChangeEvent(event); } } } }
public class class_name { protected synchronized void fireAttributeAddedEvent(String name, AttributeValue attr) { if (this.listenerList != null && isEventFirable()) { final AttributeChangeListener[] list = new AttributeChangeListener[this.listenerList.size()]; this.listenerList.toArray(list); // depends on control dependency: [if], data = [none] final AttributeChangeEvent event = new AttributeChangeEvent( this, Type.ADDITION, null, null, name, attr); for (final AttributeChangeListener listener : list) { listener.onAttributeChangeEvent(event); // depends on control dependency: [for], data = [listener] } } } }
public class class_name { public byte[] write(Bean bean, boolean rootType) { ByteArrayOutputStream baos = new ByteArrayOutputStream(1024); try { write(bean, rootType, baos); } catch (IOException ex) { throw new IllegalStateException(ex); } return baos.toByteArray(); } }
public class class_name { public byte[] write(Bean bean, boolean rootType) { ByteArrayOutputStream baos = new ByteArrayOutputStream(1024); try { write(bean, rootType, baos); // depends on control dependency: [try], data = [none] } catch (IOException ex) { throw new IllegalStateException(ex); } // depends on control dependency: [catch], data = [none] return baos.toByteArray(); } }
public class class_name { @Nonnull public ParametersAction createUpdated(Collection<? extends ParameterValue> overrides) { if(overrides == null) { ParametersAction parametersAction = new ParametersAction(parameters); parametersAction.safeParameters = this.safeParameters; return parametersAction; } List<ParameterValue> combinedParameters = Lists.<ParameterValue>newArrayList(overrides); Set<String> names = newHashSet(); for(ParameterValue v : overrides) { if (v == null) continue; names.add(v.getName()); } for (ParameterValue v : parameters) { if (v == null) continue; if (!names.contains(v.getName())) { combinedParameters.add(v); } } return new ParametersAction(combinedParameters, this.safeParameters); } }
public class class_name { @Nonnull public ParametersAction createUpdated(Collection<? extends ParameterValue> overrides) { if(overrides == null) { ParametersAction parametersAction = new ParametersAction(parameters); parametersAction.safeParameters = this.safeParameters; // depends on control dependency: [if], data = [none] return parametersAction; // depends on control dependency: [if], data = [none] } List<ParameterValue> combinedParameters = Lists.<ParameterValue>newArrayList(overrides); Set<String> names = newHashSet(); for(ParameterValue v : overrides) { if (v == null) continue; names.add(v.getName()); // depends on control dependency: [for], data = [v] } for (ParameterValue v : parameters) { if (v == null) continue; if (!names.contains(v.getName())) { combinedParameters.add(v); // depends on control dependency: [if], data = [none] } } return new ParametersAction(combinedParameters, this.safeParameters); } }
public class class_name { public void setNavigationAddonEnabled(boolean enabled) { navigationAddonEnabled = enabled; final String panId = "panBTNCollection"; final String zoomId = "zoomAddon"; final String zoomRectId = "zoomRectAddon"; if (enabled) { if (!getMapAddons().containsKey(panId)) { PanButtonCollection panButtons = new PanButtonCollection(panId, this); panButtons.setHorizontalMargin(5); panButtons.setVerticalMargin(5); registerMapAddon(panButtons); } if (!getMapAddons().containsKey(zoomId)) { ZoomAddon zoomAddon = new ZoomAddon(zoomId, this); zoomAddon.setHorizontalMargin(20); zoomAddon.setVerticalMargin(65); registerMapAddon(zoomAddon); } if (!getMapAddons().containsKey(zoomRectId)) { ZoomToRectangleAddon zoomToRectangleAddon = new ZoomToRectangleAddon(zoomRectId, this); zoomToRectangleAddon.setHorizontalMargin(20); zoomToRectangleAddon.setVerticalMargin(135); registerMapAddon(zoomToRectangleAddon); } } else { unregisterMapAddon(addons.get(panId)); unregisterMapAddon(addons.get(zoomId)); unregisterMapAddon(addons.get(zoomRectId)); } } }
public class class_name { public void setNavigationAddonEnabled(boolean enabled) { navigationAddonEnabled = enabled; final String panId = "panBTNCollection"; final String zoomId = "zoomAddon"; final String zoomRectId = "zoomRectAddon"; if (enabled) { if (!getMapAddons().containsKey(panId)) { PanButtonCollection panButtons = new PanButtonCollection(panId, this); panButtons.setHorizontalMargin(5); // depends on control dependency: [if], data = [none] panButtons.setVerticalMargin(5); // depends on control dependency: [if], data = [none] registerMapAddon(panButtons); // depends on control dependency: [if], data = [none] } if (!getMapAddons().containsKey(zoomId)) { ZoomAddon zoomAddon = new ZoomAddon(zoomId, this); zoomAddon.setHorizontalMargin(20); // depends on control dependency: [if], data = [none] zoomAddon.setVerticalMargin(65); // depends on control dependency: [if], data = [none] registerMapAddon(zoomAddon); // depends on control dependency: [if], data = [none] } if (!getMapAddons().containsKey(zoomRectId)) { ZoomToRectangleAddon zoomToRectangleAddon = new ZoomToRectangleAddon(zoomRectId, this); zoomToRectangleAddon.setHorizontalMargin(20); // depends on control dependency: [if], data = [none] zoomToRectangleAddon.setVerticalMargin(135); // depends on control dependency: [if], data = [none] registerMapAddon(zoomToRectangleAddon); // depends on control dependency: [if], data = [none] } } else { unregisterMapAddon(addons.get(panId)); // depends on control dependency: [if], data = [none] unregisterMapAddon(addons.get(zoomId)); // depends on control dependency: [if], data = [none] unregisterMapAddon(addons.get(zoomRectId)); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override protected void onStartObject(String fieldName, JsonParser jp) { log.trace(fieldName); if ("result".equals(fieldName)) { resultStarted = true; } } }
public class class_name { @Override protected void onStartObject(String fieldName, JsonParser jp) { log.trace(fieldName); if ("result".equals(fieldName)) { resultStarted = true; // depends on control dependency: [if], data = [none] } } }
public class class_name { Table ENABLED_ROLES() { Table t = sysTables[ENABLED_ROLES]; if (t == null) { t = createBlankTable(sysTableHsqlNames[ENABLED_ROLES]); addColumn(t, "ROLE_NAME", SQL_IDENTIFIER); // true PK HsqlName name = HsqlNameManager.newInfoSchemaObjectName( sysTableHsqlNames[ENABLED_ROLES].name, false, SchemaObject.INDEX); t.createPrimaryKey(name, new int[]{ 0 }, true); return t; } PersistentStore store = database.persistentStoreCollection.getStore(t); // Intermediate holders Iterator grantees; Grantee grantee; Object[] row; // initialization grantees = session.getGrantee().getAllRoles().iterator(); while (grantees.hasNext()) { grantee = (Grantee) grantees.next(); row = t.getEmptyRowData(); row[0] = grantee.getNameString(); t.insertSys(store, row); } return t; } }
public class class_name { Table ENABLED_ROLES() { Table t = sysTables[ENABLED_ROLES]; if (t == null) { t = createBlankTable(sysTableHsqlNames[ENABLED_ROLES]); // depends on control dependency: [if], data = [none] addColumn(t, "ROLE_NAME", SQL_IDENTIFIER); // depends on control dependency: [if], data = [(t] // true PK HsqlName name = HsqlNameManager.newInfoSchemaObjectName( sysTableHsqlNames[ENABLED_ROLES].name, false, SchemaObject.INDEX); t.createPrimaryKey(name, new int[]{ 0 }, true); // depends on control dependency: [if], data = [none] return t; // depends on control dependency: [if], data = [none] } PersistentStore store = database.persistentStoreCollection.getStore(t); // Intermediate holders Iterator grantees; Grantee grantee; Object[] row; // initialization grantees = session.getGrantee().getAllRoles().iterator(); while (grantees.hasNext()) { grantee = (Grantee) grantees.next(); // depends on control dependency: [while], data = [none] row = t.getEmptyRowData(); // depends on control dependency: [while], data = [none] row[0] = grantee.getNameString(); // depends on control dependency: [while], data = [none] t.insertSys(store, row); // depends on control dependency: [while], data = [none] } return t; } }
public class class_name { public static boolean deleteRecursive(@NonNull File item) { boolean ok = true; if (item.isDirectory()) { for (File child : item.listFiles()) { ok = ok && deleteRecursive(child); } } ok = ok && item.delete(); return ok; } }
public class class_name { public static boolean deleteRecursive(@NonNull File item) { boolean ok = true; if (item.isDirectory()) { for (File child : item.listFiles()) { ok = ok && deleteRecursive(child); // depends on control dependency: [for], data = [child] } } ok = ok && item.delete(); return ok; } }
public class class_name { public String getFullName() { String fullName; if (tagLib != null) { fullName = tagLib.getNameSpaceAndSeparator() + name; } else { fullName = name; } return fullName; } }
public class class_name { public String getFullName() { String fullName; if (tagLib != null) { fullName = tagLib.getNameSpaceAndSeparator() + name; // depends on control dependency: [if], data = [none] } else { fullName = name; // depends on control dependency: [if], data = [none] } return fullName; } }
public class class_name { protected Object invokeExecuteMethod(Method executeMethod, Object[] requestArgs) { Object result = null; try { result = executeMethod.invoke(action, requestArgs); // #to_action just here redCardableAssist.checkValidatorCalled(); } catch (InvocationTargetException e) { // e.g. exception in the method return handleExecuteMethodInvocationTargetException(executeMethod, requestArgs, e); } catch (IllegalAccessException e) { // e.g. private invoking throwExecuteMethodAccessFailureException(executeMethod, requestArgs, e); } catch (IllegalArgumentException e) { // e.g. different argument number throwExecuteMethodArgumentMismatchException(executeMethod, requestArgs, e); } return result; } }
public class class_name { protected Object invokeExecuteMethod(Method executeMethod, Object[] requestArgs) { Object result = null; try { result = executeMethod.invoke(action, requestArgs); // #to_action just here // depends on control dependency: [try], data = [none] redCardableAssist.checkValidatorCalled(); // depends on control dependency: [try], data = [none] } catch (InvocationTargetException e) { // e.g. exception in the method return handleExecuteMethodInvocationTargetException(executeMethod, requestArgs, e); } catch (IllegalAccessException e) { // e.g. private invoking // depends on control dependency: [catch], data = [none] throwExecuteMethodAccessFailureException(executeMethod, requestArgs, e); } catch (IllegalArgumentException e) { // e.g. different argument number // depends on control dependency: [catch], data = [none] throwExecuteMethodArgumentMismatchException(executeMethod, requestArgs, e); } // depends on control dependency: [catch], data = [none] return result; } }
public class class_name { @Deprecated public void trans(VoidFunc1<Session> func) { try { beginTransaction(); func.call(this); commit(); } catch (Exception e) { quietRollback(); throw new DbRuntimeException(e); } } }
public class class_name { @Deprecated public void trans(VoidFunc1<Session> func) { try { beginTransaction(); // depends on control dependency: [try], data = [none] func.call(this); // depends on control dependency: [try], data = [none] commit(); // depends on control dependency: [try], data = [none] } catch (Exception e) { quietRollback(); throw new DbRuntimeException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public List<GcEvent> getLogs() { final List<GcEvent> logs = new ArrayList<>(); for (CircularBuffer<GcEvent> buffer : gcLogs.values()) { logs.addAll(buffer.toList()); } Collections.sort(logs, GcEvent.REVERSE_TIME_ORDER); return logs; } }
public class class_name { public List<GcEvent> getLogs() { final List<GcEvent> logs = new ArrayList<>(); for (CircularBuffer<GcEvent> buffer : gcLogs.values()) { logs.addAll(buffer.toList()); // depends on control dependency: [for], data = [buffer] } Collections.sort(logs, GcEvent.REVERSE_TIME_ORDER); return logs; } }
public class class_name { public ResourceFormatParser getParserForMIMEType(final String mimeType) throws UnsupportedFormatException { //clean up encoding final String cleanMime; if (null != mimeType && mimeType.indexOf(";") > 0) { cleanMime = mimeType.substring(0, mimeType.indexOf(";")); } else { cleanMime = mimeType; } if (!validMimeType(cleanMime)) { throw new IllegalArgumentException("Invalid MIME type: " + mimeType); } for (final ResourceFormatParser resourceFormatParser : listParsers()) { if(null!= resourceFormatParser.getMIMETypes()){ if (resourceFormatParser.getMIMETypes().contains(cleanMime)) { return resourceFormatParser; } else { for (final String s : resourceFormatParser.getMIMETypes()) { if (validMimeType(s) && s.startsWith("*/")) { String t1 = s.substring(2); String t2 = cleanMime.substring(cleanMime.indexOf("/") + 1); if (t1.equals(t2)) { return resourceFormatParser; } } } } } } throw new UnsupportedFormatException("No provider available to parse MIME type: " + mimeType); } }
public class class_name { public ResourceFormatParser getParserForMIMEType(final String mimeType) throws UnsupportedFormatException { //clean up encoding final String cleanMime; if (null != mimeType && mimeType.indexOf(";") > 0) { cleanMime = mimeType.substring(0, mimeType.indexOf(";")); } else { cleanMime = mimeType; } if (!validMimeType(cleanMime)) { throw new IllegalArgumentException("Invalid MIME type: " + mimeType); } for (final ResourceFormatParser resourceFormatParser : listParsers()) { if(null!= resourceFormatParser.getMIMETypes()){ if (resourceFormatParser.getMIMETypes().contains(cleanMime)) { return resourceFormatParser; // depends on control dependency: [if], data = [none] } else { for (final String s : resourceFormatParser.getMIMETypes()) { if (validMimeType(s) && s.startsWith("*/")) { String t1 = s.substring(2); String t2 = cleanMime.substring(cleanMime.indexOf("/") + 1); if (t1.equals(t2)) { return resourceFormatParser; // depends on control dependency: [if], data = [none] } } } } } } throw new UnsupportedFormatException("No provider available to parse MIME type: " + mimeType); } }
public class class_name { public static AccessToken createFromNativeLinkingIntent(Intent intent) { Validate.notNull(intent, "intent"); if (intent.getExtras() == null) { return null; } return createFromBundle(null, intent.getExtras(), AccessTokenSource.FACEBOOK_APPLICATION_WEB, new Date()); } }
public class class_name { public static AccessToken createFromNativeLinkingIntent(Intent intent) { Validate.notNull(intent, "intent"); if (intent.getExtras() == null) { return null; // depends on control dependency: [if], data = [none] } return createFromBundle(null, intent.getExtras(), AccessTokenSource.FACEBOOK_APPLICATION_WEB, new Date()); } }
public class class_name { public void init(ScreenLocation itsLocation, BasePanel parentScreen, Converter fieldConverter, int iDisplayFieldDesc, String strValue, String strDesc, String strImage, String strCommand, String strToolTip) { m_strImageButton = strImage; // Image for this button m_strToolTip = strToolTip; Converter converter = null; if (strValue != null) converter = new CheckConverter(fieldConverter, strValue, strDesc, true); else if (strDesc != null) converter = new FieldDescConverter(fieldConverter, strDesc); if (converter != null) { if (fieldConverter == null) m_DependentConverter = converter; // Remember to remove this fieldConverter = converter; } super.init(itsLocation, parentScreen, fieldConverter, iDisplayFieldDesc, null); } }
public class class_name { public void init(ScreenLocation itsLocation, BasePanel parentScreen, Converter fieldConverter, int iDisplayFieldDesc, String strValue, String strDesc, String strImage, String strCommand, String strToolTip) { m_strImageButton = strImage; // Image for this button m_strToolTip = strToolTip; Converter converter = null; if (strValue != null) converter = new CheckConverter(fieldConverter, strValue, strDesc, true); else if (strDesc != null) converter = new FieldDescConverter(fieldConverter, strDesc); if (converter != null) { if (fieldConverter == null) m_DependentConverter = converter; // Remember to remove this fieldConverter = converter; // depends on control dependency: [if], data = [none] } super.init(itsLocation, parentScreen, fieldConverter, iDisplayFieldDesc, null); } }
public class class_name { protected void parseNegOp(TokenList tokens, Sequence sequence) { if( tokens.size == 0 ) return; TokenList.Token token = tokens.first; while( token != null ) { TokenList.Token next = token.next; escape: if( token.getSymbol() == Symbol.MINUS ) { if( token.previous != null && token.previous.getType() != Type.SYMBOL) break escape; if( token.previous != null && token.previous.getType() == Type.SYMBOL && (token.previous.symbol == Symbol.TRANSPOSE)) break escape; if( token.next == null || token.next.getType() == Type.SYMBOL) break escape; if( token.next.getType() != Type.VARIABLE ) throw new RuntimeException("Crap bug rethink this function"); // create the operation Operation.Info info = Operation.neg(token.next.getVariable(),functions.getManagerTemp()); // add the operation to the sequence sequence.addOperation(info.op); // update the token list TokenList.Token t = new TokenList.Token(info.output); tokens.insert(token.next,t); tokens.remove(token.next); tokens.remove(token); next = t; } token = next; } } }
public class class_name { protected void parseNegOp(TokenList tokens, Sequence sequence) { if( tokens.size == 0 ) return; TokenList.Token token = tokens.first; while( token != null ) { TokenList.Token next = token.next; escape: if( token.getSymbol() == Symbol.MINUS ) { if( token.previous != null && token.previous.getType() != Type.SYMBOL) break escape; if( token.previous != null && token.previous.getType() == Type.SYMBOL && (token.previous.symbol == Symbol.TRANSPOSE)) break escape; if( token.next == null || token.next.getType() == Type.SYMBOL) break escape; if( token.next.getType() != Type.VARIABLE ) throw new RuntimeException("Crap bug rethink this function"); // create the operation Operation.Info info = Operation.neg(token.next.getVariable(),functions.getManagerTemp()); // add the operation to the sequence sequence.addOperation(info.op); // depends on control dependency: [if], data = [none] // update the token list TokenList.Token t = new TokenList.Token(info.output); tokens.insert(token.next,t); // depends on control dependency: [if], data = [none] tokens.remove(token.next); // depends on control dependency: [if], data = [none] tokens.remove(token); // depends on control dependency: [if], data = [none] next = t; // depends on control dependency: [if], data = [none] } token = next; // depends on control dependency: [while], data = [none] } } }
public class class_name { static String toNumeral( NumberSystem numsys, char zeroDigit, int number ) { if (numsys.isDecimal()) { int delta = zeroDigit - '0'; String standard = Integer.toString(number); if (delta == 0) { return standard; } StringBuilder numeral = new StringBuilder(); for (int i = 0, n = standard.length(); i < n; i++) { int codepoint = standard.charAt(i) + delta; numeral.append((char) codepoint); } return numeral.toString(); } else { return numsys.toNumeral(number); } } }
public class class_name { static String toNumeral( NumberSystem numsys, char zeroDigit, int number ) { if (numsys.isDecimal()) { int delta = zeroDigit - '0'; String standard = Integer.toString(number); if (delta == 0) { return standard; // depends on control dependency: [if], data = [none] } StringBuilder numeral = new StringBuilder(); for (int i = 0, n = standard.length(); i < n; i++) { int codepoint = standard.charAt(i) + delta; numeral.append((char) codepoint); // depends on control dependency: [for], data = [none] } return numeral.toString(); // depends on control dependency: [if], data = [none] } else { return numsys.toNumeral(number); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static void createPurelyNonPolyEntities(List<List<Chain>> nonPolyModels, List<List<Chain>> waterModels, List<EntityInfo> entities) { if (nonPolyModels.isEmpty()) return; // let's find first the max entity id to assign entity ids to the newly found entities int maxMolId = 0; if (!entities.isEmpty()) { maxMolId = Collections.max(entities, new Comparator<EntityInfo>() { @Override public int compare(EntityInfo o1, EntityInfo o2) { return new Integer(o1.getMolId()).compareTo(o2.getMolId()); } }).getMolId(); } // we go one over the max int molId = maxMolId + 1; if (!nonPolyModels.get(0).isEmpty()) { List<EntityInfo> nonPolyEntities = new ArrayList<>(); for (List<Chain> model:nonPolyModels) { for (Chain c: model) { // we assume there's only 1 group per non-poly chain String molecPdbName = c.getAtomGroup(0).getPDBName(); EntityInfo nonPolyEntity = findNonPolyEntityWithDescription(molecPdbName, nonPolyEntities); if (nonPolyEntity == null) { nonPolyEntity = new EntityInfo(); nonPolyEntity.setDescription(molecPdbName); nonPolyEntity.setType(EntityType.NONPOLYMER); nonPolyEntity.setMolId(molId++); nonPolyEntities.add(nonPolyEntity); } nonPolyEntity.addChain(c); c.setEntityInfo(nonPolyEntity); } } entities.addAll(nonPolyEntities); } if (!waterModels.get(0).isEmpty()) { EntityInfo waterEntity = new EntityInfo(); waterEntity.setType(EntityType.WATER); waterEntity.setDescription("water"); waterEntity.setMolId(molId); for (List<Chain> model:waterModels) { for (Chain waterChain:model) { waterEntity.addChain(waterChain); waterChain.setEntityInfo(waterEntity); } } entities.add(waterEntity); } } }
public class class_name { public static void createPurelyNonPolyEntities(List<List<Chain>> nonPolyModels, List<List<Chain>> waterModels, List<EntityInfo> entities) { if (nonPolyModels.isEmpty()) return; // let's find first the max entity id to assign entity ids to the newly found entities int maxMolId = 0; if (!entities.isEmpty()) { maxMolId = Collections.max(entities, new Comparator<EntityInfo>() { @Override public int compare(EntityInfo o1, EntityInfo o2) { return new Integer(o1.getMolId()).compareTo(o2.getMolId()); } }).getMolId(); // depends on control dependency: [if], data = [none] } // we go one over the max int molId = maxMolId + 1; if (!nonPolyModels.get(0).isEmpty()) { List<EntityInfo> nonPolyEntities = new ArrayList<>(); for (List<Chain> model:nonPolyModels) { for (Chain c: model) { // we assume there's only 1 group per non-poly chain String molecPdbName = c.getAtomGroup(0).getPDBName(); EntityInfo nonPolyEntity = findNonPolyEntityWithDescription(molecPdbName, nonPolyEntities); if (nonPolyEntity == null) { nonPolyEntity = new EntityInfo(); // depends on control dependency: [if], data = [none] nonPolyEntity.setDescription(molecPdbName); // depends on control dependency: [if], data = [none] nonPolyEntity.setType(EntityType.NONPOLYMER); // depends on control dependency: [if], data = [none] nonPolyEntity.setMolId(molId++); // depends on control dependency: [if], data = [none] nonPolyEntities.add(nonPolyEntity); // depends on control dependency: [if], data = [(nonPolyEntity] } nonPolyEntity.addChain(c); // depends on control dependency: [for], data = [c] c.setEntityInfo(nonPolyEntity); // depends on control dependency: [for], data = [c] } } entities.addAll(nonPolyEntities); // depends on control dependency: [if], data = [none] } if (!waterModels.get(0).isEmpty()) { EntityInfo waterEntity = new EntityInfo(); waterEntity.setType(EntityType.WATER); // depends on control dependency: [if], data = [none] waterEntity.setDescription("water"); // depends on control dependency: [if], data = [none] waterEntity.setMolId(molId); // depends on control dependency: [if], data = [none] for (List<Chain> model:waterModels) { for (Chain waterChain:model) { waterEntity.addChain(waterChain); // depends on control dependency: [for], data = [waterChain] waterChain.setEntityInfo(waterEntity); // depends on control dependency: [for], data = [waterChain] } } entities.add(waterEntity); // depends on control dependency: [if], data = [none] } } }
public class class_name { public String nextSnapshotVersion(final Integer index) { List<String> digits = getDigits(); String nextVersion = null; if (digits != null) { if (index != null && index >= 0 && index < digits.size()) { int origDigitsLength = joinDigitString(digits).length(); digits.set(index, incrementVersionString((String) digits.get(index))); for (int i = index + 1; i < digits.size(); i++) { digits.set(i, "0"); } String digitsStr = joinDigitString(digits); nextVersion = digitsStr + getSnapshotVersionString() .substring(origDigitsLength); } else { nextVersion = getNextVersion().getSnapshotVersionString(); } } else { nextVersion = getSnapshotVersionString(); } return nextVersion; } }
public class class_name { public String nextSnapshotVersion(final Integer index) { List<String> digits = getDigits(); String nextVersion = null; if (digits != null) { if (index != null && index >= 0 && index < digits.size()) { int origDigitsLength = joinDigitString(digits).length(); digits.set(index, incrementVersionString((String) digits.get(index))); // depends on control dependency: [if], data = [(index] for (int i = index + 1; i < digits.size(); i++) { digits.set(i, "0"); // depends on control dependency: [for], data = [i] } String digitsStr = joinDigitString(digits); nextVersion = digitsStr + getSnapshotVersionString() .substring(origDigitsLength); // depends on control dependency: [if], data = [none] } else { nextVersion = getNextVersion().getSnapshotVersionString(); // depends on control dependency: [if], data = [none] } } else { nextVersion = getSnapshotVersionString(); // depends on control dependency: [if], data = [none] } return nextVersion; } }
public class class_name { private RowKeyAndTuple createAndPutAssociationRowForInsert(Serializable key, PersistentCollection collection, AssociationPersister associationPersister, SharedSessionContractImplementor session, int i, Object entry) { RowKeyBuilder rowKeyBuilder = initializeRowKeyBuilder(); Tuple associationRow = new Tuple(); // the collection has a surrogate key (see @CollectionId) if ( hasIdentifier ) { final Object identifier = collection.getIdentifier( entry, i ); String[] names = { getIdentifierColumnName() }; identifierGridType.nullSafeSet( associationRow, identifier, names, session ); } getKeyGridType().nullSafeSet( associationRow, key, getKeyColumnNames(), session ); // No need to write to where as we don't do where clauses in OGM :) if ( hasIndex ) { Object index = collection.getIndex( entry, i, this ); indexGridType.nullSafeSet( associationRow, incrementIndexByBase( index ), getIndexColumnNames(), session ); } // columns of referenced key final Object element = collection.getElement( entry ); getElementGridType().nullSafeSet( associationRow, element, getElementColumnNames(), session ); RowKeyAndTuple result = new RowKeyAndTuple(); result.key = rowKeyBuilder.values( associationRow ).build(); result.tuple = associationRow; associationPersister.getAssociation().put( result.key, result.tuple ); return result; } }
public class class_name { private RowKeyAndTuple createAndPutAssociationRowForInsert(Serializable key, PersistentCollection collection, AssociationPersister associationPersister, SharedSessionContractImplementor session, int i, Object entry) { RowKeyBuilder rowKeyBuilder = initializeRowKeyBuilder(); Tuple associationRow = new Tuple(); // the collection has a surrogate key (see @CollectionId) if ( hasIdentifier ) { final Object identifier = collection.getIdentifier( entry, i ); String[] names = { getIdentifierColumnName() }; identifierGridType.nullSafeSet( associationRow, identifier, names, session ); // depends on control dependency: [if], data = [none] } getKeyGridType().nullSafeSet( associationRow, key, getKeyColumnNames(), session ); // No need to write to where as we don't do where clauses in OGM :) if ( hasIndex ) { Object index = collection.getIndex( entry, i, this ); indexGridType.nullSafeSet( associationRow, incrementIndexByBase( index ), getIndexColumnNames(), session ); // depends on control dependency: [if], data = [none] } // columns of referenced key final Object element = collection.getElement( entry ); getElementGridType().nullSafeSet( associationRow, element, getElementColumnNames(), session ); RowKeyAndTuple result = new RowKeyAndTuple(); result.key = rowKeyBuilder.values( associationRow ).build(); result.tuple = associationRow; associationPersister.getAssociation().put( result.key, result.tuple ); return result; } }
public class class_name { public void setState(int newState) throws SystemException { if (tc.isEntryEnabled()) Tr.entry(tc, "setState", "from " + stateToString(_state) + " to " + stateToString(newState)); final int oldState = _state; // Check that the state change is valid if (validStateChange[_state][newState]) { // Change state. This is the point at which some log records may be written _state = newState; // // Unconditional add of state information to // log for various states. // if ((newState == STATE_COMMITTING) || (newState == STATE_LAST_PARTICIPANT) || (_tran.isSubordinate() && (newState == STATE_PREPARED || newState == STATE_HEURISTIC_ON_COMMIT || newState == STATE_HEURISTIC_ON_ROLLBACK ) )) { byteData[0] = (byte) _state; // For a recovered transaction (peer or local), _logSection is always populated by the reconstruct call. As // a result we don't need to worry here about which log (ie a peer or a local) to use. if (_logSection != null) { try { _logSection.addData(byteData); if (tc.isDebugEnabled()) Tr.debug(tc, "State logged ok"); } catch (Exception e) { FFDCFilter.processException(e, "com.ibm.tx.jta.impl.TransactionState.setState", "416", this); if (tc.isEventEnabled()) Tr.event(tc, "addData failed during setState!"); } } else if (!_loggingFailed) // First time through only - trap any failed attempts { try { _tranLog = _tran.getLog(); if (_tranLog != null) { if (tc.isDebugEnabled()) Tr.debug(tc, "Create sections in the Log for Recovery Coordinator"); // PK84994 // Create sections in the Log for Recovery coordinator // PK84994 if (_tran.isRAImport()) { // We were imported from an RA // Write the recoveryId of the partner log entry for this provider to the tran log // and the imported JCA Xid final JCARecoveryData jcard = _tran.getJCARecoveryData(); if (tc.isEventEnabled()) Tr.event(tc, "TX is imported from provider: " + jcard.getWrapper().getProviderId()); jcard.logRecoveryEntry(); final RecoverableUnitSection raSection = _tranLog.createSection(TransactionImpl.RESOURCE_ADAPTER_SECTION, true); final byte[] longBytes = Util.longToBytes(jcard.getRecoveryId()); // @249308A final byte[] xidBytes = ((XidImpl) _tran.getJCAXid()).toBytes(); // @249308A final byte[] logBytes = new byte[xidBytes.length + longBytes.length]; // @249308A System.arraycopy(longBytes, 0, logBytes, 0, longBytes.length); // @249308A System.arraycopy(xidBytes, 0, logBytes, longBytes.length, xidBytes.length); // @249308A raSection.addData(logBytes); // @249308C } else if (_tran.isSubordinate()) { logSupOrRecCoord(); } else if (tc.isEventEnabled()) { Tr.event(tc, "Superior transaction."); } // PK84994 starts here if (tc.isDebugEnabled()) Tr.debug(tc, "Create sections in the Log for XID and TransactionState"); // Create sections in the Log for XID and TransactionState RecoverableUnitSection gtidSection = _tranLog.createSection(TransactionImpl.GLOBALID_SECTION, true); gtidSection.addData(_tran.getXidImpl().toBytes()); _logSection = _tranLog.createSection(TransactionImpl.TRAN_STATE_SECTION, true); _logSection.addData(byteData); // PK84994 ends here } } catch (Exception e) { FFDCFilter.processException(e, "com.ibm.tx.jta.impl.TransactionState.setState", "408", this); if (tc.isEntryEnabled()) Tr.exit(tc, "setState : CreateSection failed", e); _logSection = null; // Reset this so we do not write a rollback to the log _loggingFailed = true; // Force no further subordinate logging throw new SystemException(e.toString()); } } } // Defect 1441 // // Do we need to write to the log? Have // we written any data to our section? // if (_logSection != null) { // // Conditional add of state data to the log. // this only happens if a RecoverableUnitSection // has been created previously. This stops 1PC // transactions from having any state written to // the log. // if (newState == STATE_COMMITTED || newState == STATE_ROLLED_BACK || newState == STATE_ROLLING_BACK || (_tran.isSubordinate() && newState == STATE_HEURISTIC_ON_ROLLBACK)) { byteData[0] = (byte) _state; try { _logSection.addData(byteData); } catch (Exception e) { FFDCFilter.processException(e, "com.ibm.tx.jta.impl.TransactionState.setState", "500", this); if (tc.isEventEnabled()) Tr.event(tc, "addData failed during setState!"); } } try { switch (newState) { case STATE_PREPARED: // // Subordinate transactions need to force a // write before returning vote to root tran. // if (_tran.isSubordinate()) { _tranLog.forceSections(); } break; case STATE_COMMITTING: case STATE_ROLLING_BACK: // // If we are a root or RA transaction then we need // to force logging once our completion direction // has been chosen. Normally subordinates simply do an // unforced write, but we always force since we reply // early on commit and if a resource has failed and we // crash, the superior may have already forgotten everything. // _tranLog.forceSections(); break; case STATE_HEURISTIC_ON_COMMIT: case STATE_HEURISTIC_ON_ROLLBACK: // Always force heuristic and we only do it on a subordinate... if (_tran.isSubordinate()) { // Need to force sections here for the case where // we get a heuristic on prepare _tranLog.forceSections(); } break; case STATE_COMMITTED: case STATE_ROLLED_BACK: // // Transaction has finished completion so write // a non-forced log update. // // We only need to update the state to the log // No need to log as we will be logging a removeRecoverableUnit anyway // _logSection.write(); break; case STATE_LAST_PARTICIPANT: // All 2PC resources have been prepared and we // are waiting on the outcome of the 1PC last // participant before confirming our completion // direction. _tranLog.forceSections(); break; } } catch (Exception e) { FFDCFilter.processException(e, "com.ibm.tx.jta.impl.TransactionState.setState", "505", this); if (_partnerLogTable != null) FFDCFilter.processException(e, "com.ibm.ws.Transaction.JTA.TransactionState.setState", "506", _partnerLogTable); if (e instanceof LogFullException) Tr.error(tc, "WTRN0083_LOG_FULL_ERROR", _tran.getTranName()); else Tr.error(tc, "WTRN0066_LOG_WRITE_ERROR", e); // If this is the first log write and it fails, then stop further logging if (oldState == STATE_PREPARING) { _logSection = null; // Reset this so we do not write a rollback to the log _loggingFailed = true; // Force no further subordinate logging _state = oldState; // Reset state so we can rollback } if (tc.isEntryEnabled()) Tr.exit(tc, "setState: Error writing log record", e); throw new SystemException(e.toString()); } } } else { if (tc.isDebugEnabled()) Tr.debug(tc, "TransactionState change FAILED from: " + stateToString(_state) + ", to: " + stateToString(newState)); if (tc.isEntryEnabled()) Tr.exit(tc, "setState"); throw new SystemException(); } if (tc.isEntryEnabled()) Tr.exit(tc, "setState"); } }
public class class_name { public void setState(int newState) throws SystemException { if (tc.isEntryEnabled()) Tr.entry(tc, "setState", "from " + stateToString(_state) + " to " + stateToString(newState)); final int oldState = _state; // Check that the state change is valid if (validStateChange[_state][newState]) { // Change state. This is the point at which some log records may be written _state = newState; // // Unconditional add of state information to // log for various states. // if ((newState == STATE_COMMITTING) || (newState == STATE_LAST_PARTICIPANT) || (_tran.isSubordinate() && (newState == STATE_PREPARED || newState == STATE_HEURISTIC_ON_COMMIT || newState == STATE_HEURISTIC_ON_ROLLBACK ) )) { byteData[0] = (byte) _state; // depends on control dependency: [if], data = [none] // For a recovered transaction (peer or local), _logSection is always populated by the reconstruct call. As // a result we don't need to worry here about which log (ie a peer or a local) to use. if (_logSection != null) { try { _logSection.addData(byteData); // depends on control dependency: [try], data = [none] if (tc.isDebugEnabled()) Tr.debug(tc, "State logged ok"); } catch (Exception e) { FFDCFilter.processException(e, "com.ibm.tx.jta.impl.TransactionState.setState", "416", this); if (tc.isEventEnabled()) Tr.event(tc, "addData failed during setState!"); } // depends on control dependency: [catch], data = [none] } else if (!_loggingFailed) // First time through only - trap any failed attempts { try { _tranLog = _tran.getLog(); // depends on control dependency: [try], data = [none] if (_tranLog != null) { if (tc.isDebugEnabled()) Tr.debug(tc, "Create sections in the Log for Recovery Coordinator"); // PK84994 // Create sections in the Log for Recovery coordinator // PK84994 if (_tran.isRAImport()) { // We were imported from an RA // Write the recoveryId of the partner log entry for this provider to the tran log // and the imported JCA Xid final JCARecoveryData jcard = _tran.getJCARecoveryData(); if (tc.isEventEnabled()) Tr.event(tc, "TX is imported from provider: " + jcard.getWrapper().getProviderId()); jcard.logRecoveryEntry(); // depends on control dependency: [if], data = [none] final RecoverableUnitSection raSection = _tranLog.createSection(TransactionImpl.RESOURCE_ADAPTER_SECTION, true); final byte[] longBytes = Util.longToBytes(jcard.getRecoveryId()); // @249308A final byte[] xidBytes = ((XidImpl) _tran.getJCAXid()).toBytes(); // @249308A final byte[] logBytes = new byte[xidBytes.length + longBytes.length]; // @249308A System.arraycopy(longBytes, 0, logBytes, 0, longBytes.length); // @249308A // depends on control dependency: [if], data = [none] System.arraycopy(xidBytes, 0, logBytes, longBytes.length, xidBytes.length); // @249308A // depends on control dependency: [if], data = [none] raSection.addData(logBytes); // @249308C // depends on control dependency: [if], data = [none] } else if (_tran.isSubordinate()) { logSupOrRecCoord(); // depends on control dependency: [if], data = [none] } else if (tc.isEventEnabled()) { Tr.event(tc, "Superior transaction."); // depends on control dependency: [if], data = [none] } // PK84994 starts here if (tc.isDebugEnabled()) Tr.debug(tc, "Create sections in the Log for XID and TransactionState"); // Create sections in the Log for XID and TransactionState RecoverableUnitSection gtidSection = _tranLog.createSection(TransactionImpl.GLOBALID_SECTION, true); gtidSection.addData(_tran.getXidImpl().toBytes()); // depends on control dependency: [if], data = [none] _logSection = _tranLog.createSection(TransactionImpl.TRAN_STATE_SECTION, true); // depends on control dependency: [if], data = [none] _logSection.addData(byteData); // depends on control dependency: [if], data = [none] // PK84994 ends here } } catch (Exception e) { FFDCFilter.processException(e, "com.ibm.tx.jta.impl.TransactionState.setState", "408", this); if (tc.isEntryEnabled()) Tr.exit(tc, "setState : CreateSection failed", e); _logSection = null; // Reset this so we do not write a rollback to the log _loggingFailed = true; // Force no further subordinate logging throw new SystemException(e.toString()); } // depends on control dependency: [catch], data = [none] } } // Defect 1441 // // Do we need to write to the log? Have // we written any data to our section? // if (_logSection != null) { // // Conditional add of state data to the log. // this only happens if a RecoverableUnitSection // has been created previously. This stops 1PC // transactions from having any state written to // the log. // if (newState == STATE_COMMITTED || newState == STATE_ROLLED_BACK || newState == STATE_ROLLING_BACK || (_tran.isSubordinate() && newState == STATE_HEURISTIC_ON_ROLLBACK)) { byteData[0] = (byte) _state; // depends on control dependency: [if], data = [none] try { _logSection.addData(byteData); // depends on control dependency: [try], data = [none] } catch (Exception e) { FFDCFilter.processException(e, "com.ibm.tx.jta.impl.TransactionState.setState", "500", this); if (tc.isEventEnabled()) Tr.event(tc, "addData failed during setState!"); } // depends on control dependency: [catch], data = [none] } try { switch (newState) { case STATE_PREPARED: // // Subordinate transactions need to force a // write before returning vote to root tran. // if (_tran.isSubordinate()) { _tranLog.forceSections(); // depends on control dependency: [if], data = [none] } break; case STATE_COMMITTING: case STATE_ROLLING_BACK: // // If we are a root or RA transaction then we need // to force logging once our completion direction // has been chosen. Normally subordinates simply do an // unforced write, but we always force since we reply // early on commit and if a resource has failed and we // crash, the superior may have already forgotten everything. // _tranLog.forceSections(); break; case STATE_HEURISTIC_ON_COMMIT: case STATE_HEURISTIC_ON_ROLLBACK: // Always force heuristic and we only do it on a subordinate... if (_tran.isSubordinate()) { // Need to force sections here for the case where // we get a heuristic on prepare _tranLog.forceSections(); // depends on control dependency: [if], data = [none] } break; case STATE_COMMITTED: case STATE_ROLLED_BACK: // // Transaction has finished completion so write // a non-forced log update. // // We only need to update the state to the log // No need to log as we will be logging a removeRecoverableUnit anyway // _logSection.write(); break; case STATE_LAST_PARTICIPANT: // All 2PC resources have been prepared and we // are waiting on the outcome of the 1PC last // participant before confirming our completion // direction. _tranLog.forceSections(); break; } } catch (Exception e) { FFDCFilter.processException(e, "com.ibm.tx.jta.impl.TransactionState.setState", "505", this); if (_partnerLogTable != null) FFDCFilter.processException(e, "com.ibm.ws.Transaction.JTA.TransactionState.setState", "506", _partnerLogTable); if (e instanceof LogFullException) Tr.error(tc, "WTRN0083_LOG_FULL_ERROR", _tran.getTranName()); else Tr.error(tc, "WTRN0066_LOG_WRITE_ERROR", e); // If this is the first log write and it fails, then stop further logging if (oldState == STATE_PREPARING) { _logSection = null; // Reset this so we do not write a rollback to the log // depends on control dependency: [if], data = [none] _loggingFailed = true; // Force no further subordinate logging // depends on control dependency: [if], data = [none] _state = oldState; // Reset state so we can rollback // depends on control dependency: [if], data = [none] } if (tc.isEntryEnabled()) Tr.exit(tc, "setState: Error writing log record", e); throw new SystemException(e.toString()); } // depends on control dependency: [catch], data = [none] } } else { if (tc.isDebugEnabled()) Tr.debug(tc, "TransactionState change FAILED from: " + stateToString(_state) + ", to: " + stateToString(newState)); if (tc.isEntryEnabled()) Tr.exit(tc, "setState"); throw new SystemException(); } if (tc.isEntryEnabled()) Tr.exit(tc, "setState"); } }
public class class_name { public static void constraintMatrix6x6( DMatrixRMaj L_6x10 , DMatrixRMaj L_6x6 ) { int index = 0; for( int i = 0; i < 6; i++ ) { L_6x6.data[index++] = L_6x10.get(i,0); L_6x6.data[index++] = L_6x10.get(i,1); L_6x6.data[index++] = L_6x10.get(i,2); L_6x6.data[index++] = L_6x10.get(i,4); L_6x6.data[index++] = L_6x10.get(i,5); L_6x6.data[index++] = L_6x10.get(i,7); } } }
public class class_name { public static void constraintMatrix6x6( DMatrixRMaj L_6x10 , DMatrixRMaj L_6x6 ) { int index = 0; for( int i = 0; i < 6; i++ ) { L_6x6.data[index++] = L_6x10.get(i,0); // depends on control dependency: [for], data = [i] L_6x6.data[index++] = L_6x10.get(i,1); // depends on control dependency: [for], data = [i] L_6x6.data[index++] = L_6x10.get(i,2); // depends on control dependency: [for], data = [i] L_6x6.data[index++] = L_6x10.get(i,4); // depends on control dependency: [for], data = [i] L_6x6.data[index++] = L_6x10.get(i,5); // depends on control dependency: [for], data = [i] L_6x6.data[index++] = L_6x10.get(i,7); // depends on control dependency: [for], data = [i] } } }
public class class_name { public Tuple shiftLeft() { if (degree() < 2) { return Tuple0.INSTANCE; } Object[] copy = new Object[degree() - 1]; System.arraycopy(array(), 1, copy, 0, copy.length); return NTuple.of(copy); } }
public class class_name { public Tuple shiftLeft() { if (degree() < 2) { return Tuple0.INSTANCE; // depends on control dependency: [if], data = [none] } Object[] copy = new Object[degree() - 1]; System.arraycopy(array(), 1, copy, 0, copy.length); return NTuple.of(copy); } }
public class class_name { public InetSocketAddress updateConnectAddr( String hostProperty, String addressProperty, String defaultAddressValue, InetSocketAddress addr) { final String host = get(hostProperty); final String connectHostPort = getTrimmed(addressProperty, defaultAddressValue); if (host == null || host.isEmpty() || connectHostPort == null || connectHostPort.isEmpty()) { //not our case, fall back to original logic return updateConnectAddr(addressProperty, addr); } final String connectHost = connectHostPort.split(":")[0]; // Create connect address using client address hostname and server port. return updateConnectAddr(addressProperty, NetUtils.createSocketAddrForHost( connectHost, addr.getPort())); } }
public class class_name { public InetSocketAddress updateConnectAddr( String hostProperty, String addressProperty, String defaultAddressValue, InetSocketAddress addr) { final String host = get(hostProperty); final String connectHostPort = getTrimmed(addressProperty, defaultAddressValue); if (host == null || host.isEmpty() || connectHostPort == null || connectHostPort.isEmpty()) { //not our case, fall back to original logic return updateConnectAddr(addressProperty, addr); // depends on control dependency: [if], data = [none] } final String connectHost = connectHostPort.split(":")[0]; // Create connect address using client address hostname and server port. return updateConnectAddr(addressProperty, NetUtils.createSocketAddrForHost( connectHost, addr.getPort())); } }
public class class_name { protected void parse(Element element) { String rootElementName = element.getTagName(); if (!rootElementName.equals(CONFIGURATION_TAG)) { if(rootElementName.equals(OLD_CONFIGURATION_TAG)) { LogLog.warn("The <"+OLD_CONFIGURATION_TAG+ "> element has been deprecated."); LogLog.warn("Use the <"+CONFIGURATION_TAG+"> element instead."); } else { LogLog.error("DOM element is - not a <"+CONFIGURATION_TAG+"> element."); return; } } String debugAttrib = subst(element.getAttribute(INTERNAL_DEBUG_ATTR)); LogLog.debug("debug attribute= \"" + debugAttrib +"\"."); // if the log4j.dtd is not specified in the XML file, then the // "debug" attribute is returned as the empty string. if(!debugAttrib.equals("") && !debugAttrib.equals("null")) { LogLog.setInternalDebugging(OptionConverter.toBoolean(debugAttrib, true)); } else { LogLog.debug("Ignoring " + INTERNAL_DEBUG_ATTR + " attribute."); } // // reset repository before configuration if reset="true" // on configuration element. // String resetAttrib = subst(element.getAttribute(RESET_ATTR)); LogLog.debug("reset attribute= \"" + resetAttrib +"\"."); if(!("".equals(resetAttrib)) && OptionConverter.toBoolean(resetAttrib, false)) { repository.resetConfiguration(); } String confDebug = subst(element.getAttribute(CONFIG_DEBUG_ATTR)); if(!confDebug.equals("") && !confDebug.equals("null")) { LogLog.warn("The \""+CONFIG_DEBUG_ATTR+"\" attribute is deprecated."); LogLog.warn("Use the \""+INTERNAL_DEBUG_ATTR+"\" attribute instead."); LogLog.setInternalDebugging(OptionConverter.toBoolean(confDebug, true)); } String thresholdStr = subst(element.getAttribute(THRESHOLD_ATTR)); LogLog.debug("Threshold =\"" + thresholdStr +"\"."); if(!"".equals(thresholdStr) && !"null".equals(thresholdStr)) { repository.setThreshold(thresholdStr); } //Hashtable appenderBag = new Hashtable(11); /* Building Appender objects, placing them in a local namespace for future reference */ // First configure each category factory under the root element. // Category factories need to be configured before any of // categories they support. // String tagName = null; Element currentElement = null; Node currentNode = null; NodeList children = element.getChildNodes(); final int length = children.getLength(); for (int loop = 0; loop < length; loop++) { currentNode = children.item(loop); if (currentNode.getNodeType() == Node.ELEMENT_NODE) { currentElement = (Element) currentNode; tagName = currentElement.getTagName(); if (tagName.equals(CATEGORY_FACTORY_TAG) || tagName.equals(LOGGER_FACTORY_TAG)) { parseCategoryFactory(currentElement); } } } for (int loop = 0; loop < length; loop++) { currentNode = children.item(loop); if (currentNode.getNodeType() == Node.ELEMENT_NODE) { currentElement = (Element) currentNode; tagName = currentElement.getTagName(); if (tagName.equals(CATEGORY) || tagName.equals(LOGGER)) { parseCategory(currentElement); } else if (tagName.equals(ROOT_TAG)) { parseRoot(currentElement); } else if(tagName.equals(RENDERER_TAG)) { parseRenderer(currentElement); } else if (!(tagName.equals(APPENDER_TAG) || tagName.equals(CATEGORY_FACTORY_TAG) || tagName.equals(LOGGER_FACTORY_TAG))) { quietParseUnrecognizedElement(repository, currentElement, props); } } } } }
public class class_name { protected void parse(Element element) { String rootElementName = element.getTagName(); if (!rootElementName.equals(CONFIGURATION_TAG)) { if(rootElementName.equals(OLD_CONFIGURATION_TAG)) { LogLog.warn("The <"+OLD_CONFIGURATION_TAG+ "> element has been deprecated."); // depends on control dependency: [if], data = [none] LogLog.warn("Use the <"+CONFIGURATION_TAG+"> element instead."); // depends on control dependency: [if], data = [none] } else { LogLog.error("DOM element is - not a <"+CONFIGURATION_TAG+"> element."); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } } String debugAttrib = subst(element.getAttribute(INTERNAL_DEBUG_ATTR)); LogLog.debug("debug attribute= \"" + debugAttrib +"\"."); // if the log4j.dtd is not specified in the XML file, then the // "debug" attribute is returned as the empty string. if(!debugAttrib.equals("") && !debugAttrib.equals("null")) { LogLog.setInternalDebugging(OptionConverter.toBoolean(debugAttrib, true)); // depends on control dependency: [if], data = [none] } else { LogLog.debug("Ignoring " + INTERNAL_DEBUG_ATTR + " attribute."); // depends on control dependency: [if], data = [none] } // // reset repository before configuration if reset="true" // on configuration element. // String resetAttrib = subst(element.getAttribute(RESET_ATTR)); LogLog.debug("reset attribute= \"" + resetAttrib +"\"."); if(!("".equals(resetAttrib)) && OptionConverter.toBoolean(resetAttrib, false)) { repository.resetConfiguration(); // depends on control dependency: [if], data = [none] } String confDebug = subst(element.getAttribute(CONFIG_DEBUG_ATTR)); if(!confDebug.equals("") && !confDebug.equals("null")) { LogLog.warn("The \""+CONFIG_DEBUG_ATTR+"\" attribute is deprecated."); // depends on control dependency: [if], data = [none] LogLog.warn("Use the \""+INTERNAL_DEBUG_ATTR+"\" attribute instead."); // depends on control dependency: [if], data = [none] LogLog.setInternalDebugging(OptionConverter.toBoolean(confDebug, true)); // depends on control dependency: [if], data = [none] } String thresholdStr = subst(element.getAttribute(THRESHOLD_ATTR)); LogLog.debug("Threshold =\"" + thresholdStr +"\"."); if(!"".equals(thresholdStr) && !"null".equals(thresholdStr)) { repository.setThreshold(thresholdStr); // depends on control dependency: [if], data = [none] } //Hashtable appenderBag = new Hashtable(11); /* Building Appender objects, placing them in a local namespace for future reference */ // First configure each category factory under the root element. // Category factories need to be configured before any of // categories they support. // String tagName = null; Element currentElement = null; Node currentNode = null; NodeList children = element.getChildNodes(); final int length = children.getLength(); for (int loop = 0; loop < length; loop++) { currentNode = children.item(loop); // depends on control dependency: [for], data = [loop] if (currentNode.getNodeType() == Node.ELEMENT_NODE) { currentElement = (Element) currentNode; // depends on control dependency: [if], data = [none] tagName = currentElement.getTagName(); // depends on control dependency: [if], data = [none] if (tagName.equals(CATEGORY_FACTORY_TAG) || tagName.equals(LOGGER_FACTORY_TAG)) { parseCategoryFactory(currentElement); // depends on control dependency: [if], data = [none] } } } for (int loop = 0; loop < length; loop++) { currentNode = children.item(loop); // depends on control dependency: [for], data = [loop] if (currentNode.getNodeType() == Node.ELEMENT_NODE) { currentElement = (Element) currentNode; // depends on control dependency: [if], data = [none] tagName = currentElement.getTagName(); // depends on control dependency: [if], data = [none] if (tagName.equals(CATEGORY) || tagName.equals(LOGGER)) { parseCategory(currentElement); // depends on control dependency: [if], data = [none] } else if (tagName.equals(ROOT_TAG)) { parseRoot(currentElement); // depends on control dependency: [if], data = [none] } else if(tagName.equals(RENDERER_TAG)) { parseRenderer(currentElement); // depends on control dependency: [if], data = [none] } else if (!(tagName.equals(APPENDER_TAG) || tagName.equals(CATEGORY_FACTORY_TAG) || tagName.equals(LOGGER_FACTORY_TAG))) { quietParseUnrecognizedElement(repository, currentElement, props); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public PropertiesAdapter filter(Filter<String> filter) { Properties properties = new Properties(); for (String propertyName : this) { if (filter.accept(propertyName)) { properties.setProperty(propertyName, get(propertyName)); } } return from(properties); } }
public class class_name { public PropertiesAdapter filter(Filter<String> filter) { Properties properties = new Properties(); for (String propertyName : this) { if (filter.accept(propertyName)) { properties.setProperty(propertyName, get(propertyName)); // depends on control dependency: [if], data = [none] } } return from(properties); } }
public class class_name { private Attributes getMainAttributes() { if (null == mainAttributes) { mainAttributes = getJarMainAttributes(pluginJar); String pluginName = mainAttributes.getValue(RUNDECK_PLUGIN_NAME); if(pluginName == null) { //Fallback to something that will rarely change //This is not ideal, but old plugins do not always have a name //set in the attributes pluginName = mainAttributes.getValue(RUNDECK_PLUGIN_CLASSNAMES); } pluginId = PluginUtils.generateShaIdFromName(pluginName); } return mainAttributes; } }
public class class_name { private Attributes getMainAttributes() { if (null == mainAttributes) { mainAttributes = getJarMainAttributes(pluginJar); // depends on control dependency: [if], data = [none] String pluginName = mainAttributes.getValue(RUNDECK_PLUGIN_NAME); if(pluginName == null) { //Fallback to something that will rarely change //This is not ideal, but old plugins do not always have a name //set in the attributes pluginName = mainAttributes.getValue(RUNDECK_PLUGIN_CLASSNAMES); // depends on control dependency: [if], data = [none] } pluginId = PluginUtils.generateShaIdFromName(pluginName); // depends on control dependency: [if], data = [none] } return mainAttributes; } }
public class class_name { @FFDCIgnore(Throwable.class) @Override public <R> MethodResult<R> run(Callable<R> callable) { try { return MethodResult.success(callable.call()); } catch (Throwable t) { return MethodResult.failure(t); } } }
public class class_name { @FFDCIgnore(Throwable.class) @Override public <R> MethodResult<R> run(Callable<R> callable) { try { return MethodResult.success(callable.call()); // depends on control dependency: [try], data = [none] } catch (Throwable t) { return MethodResult.failure(t); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static TypeDesc forDescriptor(String desc) throws IllegalArgumentException { // TODO: Figure out how to cache these. Using a plain IdentityMap poses // a problem. The back reference to the key causes a memory leak. TypeDesc td; int cursor = 0; int dim = 0; try { char c; while ((c = desc.charAt(cursor++)) == '[') { dim++; } switch (c) { case 'V': td = VOID; break; case 'Z': td = BOOLEAN; break; case 'C': td = CHAR; break; case 'B': td = BYTE; break; case 'S': td = SHORT; break; case 'I': td = INT; break; case 'J': td = LONG; break; case 'F': td = FLOAT; break; case 'D': td = DOUBLE; break; case 'L': if (dim > 0) { desc = desc.substring(dim); cursor = 1; } StringBuffer name = new StringBuffer(desc.length() - 2); while ((c = desc.charAt(cursor++)) != ';') { if (c == '/') { c = '.'; } name.append(c); } td = intern(new ObjectType(desc, name.toString())); break; default: throw invalidDescriptor(desc); } } catch (NullPointerException e) { throw invalidDescriptor(desc); } catch (IndexOutOfBoundsException e) { throw invalidDescriptor(desc); } if (cursor != desc.length()) { throw invalidDescriptor(desc); } while (--dim >= 0) { td = td.toArrayType(); } return td; } }
public class class_name { public static TypeDesc forDescriptor(String desc) throws IllegalArgumentException { // TODO: Figure out how to cache these. Using a plain IdentityMap poses // a problem. The back reference to the key causes a memory leak. TypeDesc td; int cursor = 0; int dim = 0; try { char c; while ((c = desc.charAt(cursor++)) == '[') { dim++; // depends on control dependency: [while], data = [none] } switch (c) { case 'V': td = VOID; break; case 'Z': td = BOOLEAN; break; case 'C': td = CHAR; break; case 'B': td = BYTE; break; case 'S': td = SHORT; break; case 'I': td = INT; break; case 'J': td = LONG; break; case 'F': td = FLOAT; break; case 'D': td = DOUBLE; break; case 'L': if (dim > 0) { desc = desc.substring(dim); // depends on control dependency: [if], data = [(dim] cursor = 1; // depends on control dependency: [if], data = [none] } StringBuffer name = new StringBuffer(desc.length() - 2); while ((c = desc.charAt(cursor++)) != ';') { if (c == '/') { c = '.'; // depends on control dependency: [if], data = [none] } name.append(c); // depends on control dependency: [while], data = [none] } td = intern(new ObjectType(desc, name.toString())); break; default: throw invalidDescriptor(desc); } } catch (NullPointerException e) { throw invalidDescriptor(desc); } catch (IndexOutOfBoundsException e) { throw invalidDescriptor(desc); } if (cursor != desc.length()) { throw invalidDescriptor(desc); } while (--dim >= 0) { td = td.toArrayType(); } return td; } }
public class class_name { @Override public void rollback() { try { if (conn.isClosed()) { throw new TransactionException("the connection is closed in transaction."); } conn.rollback(); conn.setAutoCommit(true); } catch (SQLException e) { throw new TransactionException(e); } } }
public class class_name { @Override public void rollback() { try { if (conn.isClosed()) { throw new TransactionException("the connection is closed in transaction."); } conn.rollback(); // depends on control dependency: [try], data = [none] conn.setAutoCommit(true); // depends on control dependency: [try], data = [none] } catch (SQLException e) { throw new TransactionException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private boolean matches(EvaluationContext ctx, Object[] params, DTDecisionRule rule) { for( int i = 0; i < params.length; i++ ) { CompiledExpression compiledInput = inputs.get(i).getCompiledInput(); if ( compiledInput instanceof CompiledFEELExpression) { ctx.setValue("?", ((CompiledFEELExpression) compiledInput).apply(ctx)); } if( ! satisfies( ctx, params[i], rule.getInputEntry().get( i ) ) ) { return false; } } return true; } }
public class class_name { private boolean matches(EvaluationContext ctx, Object[] params, DTDecisionRule rule) { for( int i = 0; i < params.length; i++ ) { CompiledExpression compiledInput = inputs.get(i).getCompiledInput(); if ( compiledInput instanceof CompiledFEELExpression) { ctx.setValue("?", ((CompiledFEELExpression) compiledInput).apply(ctx)); // depends on control dependency: [if], data = [none] } if( ! satisfies( ctx, params[i], rule.getInputEntry().get( i ) ) ) { return false; // depends on control dependency: [if], data = [none] } } return true; } }
public class class_name { @Override public File findArtifact(final Artifact artifact) { String type = artifact.getProperty("type", "jar"); if ("ceylon-jar".equals(type) || "car".equals(type)) { if ("ceylon-jar".equals(type)) { type = "jar"; } File art = new File(CeylonUtil.ceylonSystemFullPath(artifact, type)); if (art.isFile()) { if (logger != null) { logger.info("Resolved from Ceylon repo: " + artifact); } artifact.setFile(art); return art; } } return null; } }
public class class_name { @Override public File findArtifact(final Artifact artifact) { String type = artifact.getProperty("type", "jar"); if ("ceylon-jar".equals(type) || "car".equals(type)) { if ("ceylon-jar".equals(type)) { type = "jar"; // depends on control dependency: [if], data = [none] } File art = new File(CeylonUtil.ceylonSystemFullPath(artifact, type)); if (art.isFile()) { if (logger != null) { logger.info("Resolved from Ceylon repo: " + artifact); // depends on control dependency: [if], data = [none] } artifact.setFile(art); // depends on control dependency: [if], data = [none] return art; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { public static ObjectMethodMatchConf match(Method method, Class[] paras) { Class[] metodParaTypes = method.getParameterTypes(); if (paras.length < metodParaTypes.length) { return null; } else if (paras.length == metodParaTypes.length) { //精确匹配或者可变参数 } else if (paras.length > metodParaTypes.length && metodParaTypes.length != 0 && metodParaTypes[metodParaTypes.length - 1].isArray()) { //可变参数, } else { //不匹配 return null; } int[] convert = new int[metodParaTypes.length]; for (int j = 0; j < paras.length; j++) { if (paras[j] == null) { // 认为匹配 convert[j] = NO_CONVERT; continue; } if (paras[j] == metodParaTypes[j]) { convert[j] = NO_CONVERT; continue; } if (metodParaTypes[j] == Object.class) { convert[j] = NO_CONVERT; continue; } else if (metodParaTypes[j].isAssignableFrom(paras[j])) { convert[j] = NO_CONVERT; continue; } else if (metodParaTypes[j].isPrimitive() && Number.class.isAssignableFrom(paras[j])) { //匹配,但需要类型转化 if (metodParaTypes[j] == int.class) { convert[j] = INT_CONVERT; } else if (metodParaTypes[j] == byte.class) { convert[j] = BYTE_CONVERT; } else if (metodParaTypes[j] == char.class) { convert[j] = CHAR_CONVERT; } else if (metodParaTypes[j] == long.class) { convert[j] = LONG_CONVERT; } else if (metodParaTypes[j] == double.class) { convert[j] = DOUBLE_CONVERT; } else if (metodParaTypes[j] == float.class) { convert[j] = FLOAT_CONVERT; } else if (metodParaTypes[j] == short.class) { convert[j] = SHORT_CONVERT; } continue; } else if (Number.class.isAssignableFrom(metodParaTypes[j]) && Number.class.isAssignableFrom(paras[j])) { //匹配,但需要类型转化 if (metodParaTypes[j] == Integer.class) { convert[j] = INT_CONVERT; } else if (metodParaTypes[j] == Byte.class) { convert[j] = BYTE_CONVERT; } else if (metodParaTypes[j] == Character.class) { convert[j] = CHAR_CONVERT; } else if (metodParaTypes[j] == Long.class) { convert[j] = LONG_CONVERT; } else if (metodParaTypes[j] == Double.class) { convert[j] = DOUBLE_CONVERT; } else if (metodParaTypes[j] == Float.class) { convert[j] = FLOAT_CONVERT; } else if (metodParaTypes[j] == Short.class) { convert[j] = SHORT_CONVERT; } else if (metodParaTypes[j] == BigDecimal.class) { convert[j] = BIGDECIMAL_CONVERT; } continue; } else if (metodParaTypes[j] == Boolean.class) { if (paras[j] == boolean.class) { convert[j] = NO_CONVERT; continue; } } else if (metodParaTypes[j] == boolean.class) { if (paras[j] == Boolean.class) { convert[j] = NO_CONVERT; continue; } } else if (metodParaTypes[j] == Character.class) { if (paras[j] == char.class) { convert[j] = CHAR_CONVERT; continue; } } else if (metodParaTypes[j] == char.class) { if (paras[j] == Character.class) { convert[j] = CHAR_CONVERT; continue; } } else if (metodParaTypes[j].isArray()) { if (paras[j].isArray()) { Class metodParaTypeComponent = metodParaTypes[j].getComponentType(); Class paraTypeComponent = paras[j].getComponentType(); if (metodParaTypeComponent == paraTypeComponent) { //不做转化了 convert[j] = NO_CONVERT; continue; } return null; } else if (j == metodParaTypes.length - 1) { convert[j] = VARIABLE_ARRAY; break; } else { return null; } } return null; } ObjectMethodMatchConf mc = new ObjectMethodMatchConf(); mc.method = method; mc.convert = convert; for (int c : convert) { if (c != 0) { mc.isNeedConvert = true; break; } } mc.method.setAccessible(true); return mc; } }
public class class_name { public static ObjectMethodMatchConf match(Method method, Class[] paras) { Class[] metodParaTypes = method.getParameterTypes(); if (paras.length < metodParaTypes.length) { return null; // depends on control dependency: [if], data = [none] } else if (paras.length == metodParaTypes.length) { //精确匹配或者可变参数 } else if (paras.length > metodParaTypes.length && metodParaTypes.length != 0 && metodParaTypes[metodParaTypes.length - 1].isArray()) { //可变参数, } else { //不匹配 return null; // depends on control dependency: [if], data = [none] } int[] convert = new int[metodParaTypes.length]; for (int j = 0; j < paras.length; j++) { if (paras[j] == null) { // 认为匹配 convert[j] = NO_CONVERT; // depends on control dependency: [if], data = [none] continue; } if (paras[j] == metodParaTypes[j]) { convert[j] = NO_CONVERT; // depends on control dependency: [if], data = [none] continue; } if (metodParaTypes[j] == Object.class) { convert[j] = NO_CONVERT; // depends on control dependency: [if], data = [none] continue; } else if (metodParaTypes[j].isAssignableFrom(paras[j])) { convert[j] = NO_CONVERT; // depends on control dependency: [if], data = [none] continue; } else if (metodParaTypes[j].isPrimitive() && Number.class.isAssignableFrom(paras[j])) { //匹配,但需要类型转化 if (metodParaTypes[j] == int.class) { convert[j] = INT_CONVERT; // depends on control dependency: [if], data = [none] } else if (metodParaTypes[j] == byte.class) { convert[j] = BYTE_CONVERT; // depends on control dependency: [if], data = [none] } else if (metodParaTypes[j] == char.class) { convert[j] = CHAR_CONVERT; // depends on control dependency: [if], data = [none] } else if (metodParaTypes[j] == long.class) { convert[j] = LONG_CONVERT; // depends on control dependency: [if], data = [none] } else if (metodParaTypes[j] == double.class) { convert[j] = DOUBLE_CONVERT; // depends on control dependency: [if], data = [none] } else if (metodParaTypes[j] == float.class) { convert[j] = FLOAT_CONVERT; // depends on control dependency: [if], data = [none] } else if (metodParaTypes[j] == short.class) { convert[j] = SHORT_CONVERT; // depends on control dependency: [if], data = [none] } continue; } else if (Number.class.isAssignableFrom(metodParaTypes[j]) && Number.class.isAssignableFrom(paras[j])) { //匹配,但需要类型转化 if (metodParaTypes[j] == Integer.class) { convert[j] = INT_CONVERT; // depends on control dependency: [if], data = [none] } else if (metodParaTypes[j] == Byte.class) { convert[j] = BYTE_CONVERT; // depends on control dependency: [if], data = [none] } else if (metodParaTypes[j] == Character.class) { convert[j] = CHAR_CONVERT; // depends on control dependency: [if], data = [none] } else if (metodParaTypes[j] == Long.class) { convert[j] = LONG_CONVERT; // depends on control dependency: [if], data = [none] } else if (metodParaTypes[j] == Double.class) { convert[j] = DOUBLE_CONVERT; // depends on control dependency: [if], data = [none] } else if (metodParaTypes[j] == Float.class) { convert[j] = FLOAT_CONVERT; // depends on control dependency: [if], data = [none] } else if (metodParaTypes[j] == Short.class) { convert[j] = SHORT_CONVERT; // depends on control dependency: [if], data = [none] } else if (metodParaTypes[j] == BigDecimal.class) { convert[j] = BIGDECIMAL_CONVERT; // depends on control dependency: [if], data = [none] } continue; } else if (metodParaTypes[j] == Boolean.class) { if (paras[j] == boolean.class) { convert[j] = NO_CONVERT; // depends on control dependency: [if], data = [none] continue; } } else if (metodParaTypes[j] == boolean.class) { if (paras[j] == Boolean.class) { convert[j] = NO_CONVERT; // depends on control dependency: [if], data = [none] continue; } } else if (metodParaTypes[j] == Character.class) { if (paras[j] == char.class) { convert[j] = CHAR_CONVERT; // depends on control dependency: [if], data = [none] continue; } } else if (metodParaTypes[j] == char.class) { if (paras[j] == Character.class) { convert[j] = CHAR_CONVERT; // depends on control dependency: [if], data = [none] continue; } } else if (metodParaTypes[j].isArray()) { if (paras[j].isArray()) { Class metodParaTypeComponent = metodParaTypes[j].getComponentType(); Class paraTypeComponent = paras[j].getComponentType(); if (metodParaTypeComponent == paraTypeComponent) { //不做转化了 convert[j] = NO_CONVERT; // depends on control dependency: [if], data = [none] continue; } return null; // depends on control dependency: [if], data = [none] } else if (j == metodParaTypes.length - 1) { convert[j] = VARIABLE_ARRAY; // depends on control dependency: [if], data = [none] break; } else { return null; // depends on control dependency: [if], data = [none] } } return null; // depends on control dependency: [for], data = [none] } ObjectMethodMatchConf mc = new ObjectMethodMatchConf(); mc.method = method; mc.convert = convert; for (int c : convert) { if (c != 0) { mc.isNeedConvert = true; // depends on control dependency: [if], data = [none] break; } } mc.method.setAccessible(true); return mc; } }
public class class_name { public static <T> List<T> filtered(Collection<T> data, Filter<T> filter) { List<T> list = new ArrayList<>(); if (!Utils.isEmpty(data)) { for (T item : data) { if (filter.accept(item)) { list.add(item); } } } return list; } }
public class class_name { public static <T> List<T> filtered(Collection<T> data, Filter<T> filter) { List<T> list = new ArrayList<>(); if (!Utils.isEmpty(data)) { for (T item : data) { if (filter.accept(item)) { list.add(item); // depends on control dependency: [if], data = [none] } } } return list; } }
public class class_name { public static int cardinality(long[] bits) { int card = 0; for (int i = bits.length - 1; i >= 0; i--) { long a = bits[i]; if (a == 0) continue; if (a == -1) { card += 64; continue; } // Successively collapse alternating bit groups into a sum. a = ((a >> 1) & 0x5555555555555555L) + (a & 0x5555555555555555L); a = ((a >> 2) & 0x3333333333333333L) + (a & 0x3333333333333333L); int b = (int) ((a >>> 32) + a); b = ((b >> 4) & 0x0f0f0f0f) + (b & 0x0f0f0f0f); b = ((b >> 8) & 0x00ff00ff) + (b & 0x00ff00ff); card += ((b >> 16) & 0x0000ffff) + (b & 0x0000ffff); } return card; } }
public class class_name { public static int cardinality(long[] bits) { int card = 0; for (int i = bits.length - 1; i >= 0; i--) { long a = bits[i]; if (a == 0) continue; if (a == -1) { card += 64; // depends on control dependency: [if], data = [none] continue; } // Successively collapse alternating bit groups into a sum. a = ((a >> 1) & 0x5555555555555555L) + (a & 0x5555555555555555L); // depends on control dependency: [for], data = [none] a = ((a >> 2) & 0x3333333333333333L) + (a & 0x3333333333333333L); // depends on control dependency: [for], data = [none] int b = (int) ((a >>> 32) + a); b = ((b >> 4) & 0x0f0f0f0f) + (b & 0x0f0f0f0f); // depends on control dependency: [for], data = [none] b = ((b >> 8) & 0x00ff00ff) + (b & 0x00ff00ff); // depends on control dependency: [for], data = [none] card += ((b >> 16) & 0x0000ffff) + (b & 0x0000ffff); // depends on control dependency: [for], data = [none] } return card; } }
public class class_name { private static boolean isConnectionSpecific(ConnectionNotation connectionNotation) { String connection = connectionNotation.getSourceUnit() + ":" + connectionNotation.getrGroupSource() + "-" + connectionNotation.getTargetUnit() + ":" + connectionNotation.getrGroupTarget(); /* check for specific interaction */ if (connection.matches("\\d+:R\\d-\\d+:R\\d|\\d+:pair-\\d+:pair")) { return true; } return false; } }
public class class_name { private static boolean isConnectionSpecific(ConnectionNotation connectionNotation) { String connection = connectionNotation.getSourceUnit() + ":" + connectionNotation.getrGroupSource() + "-" + connectionNotation.getTargetUnit() + ":" + connectionNotation.getrGroupTarget(); /* check for specific interaction */ if (connection.matches("\\d+:R\\d-\\d+:R\\d|\\d+:pair-\\d+:pair")) { return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { @SuppressWarnings("rawtypes") @Override public EntityManagerFactory createEntityManagerFactory(final String unit, final Map map) { initJpaCounter(); final PersistenceProvider persistenceProvider = findDelegate(map); final ClassLoader tccl = tccl(); final ClassLoader hack = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() { // pour findbugs /** {@inheritDoc} */ @Override public ClassLoader run() { return new JpaOverridePersistenceXmlClassLoader(tccl, persistenceProvider.getClass().getName()); } }); Thread.currentThread().setContextClassLoader(hack); try { final EntityManagerFactory entityManagerFactory = persistenceProvider .createEntityManagerFactory(unit, map); if (entityManagerFactory == null) { return null; } return JpaWrapper.createEntityManagerFactoryProxy(entityManagerFactory); } finally { Thread.currentThread().setContextClassLoader(tccl); } } }
public class class_name { @SuppressWarnings("rawtypes") @Override public EntityManagerFactory createEntityManagerFactory(final String unit, final Map map) { initJpaCounter(); final PersistenceProvider persistenceProvider = findDelegate(map); final ClassLoader tccl = tccl(); final ClassLoader hack = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() { // pour findbugs /** {@inheritDoc} */ @Override public ClassLoader run() { return new JpaOverridePersistenceXmlClassLoader(tccl, persistenceProvider.getClass().getName()); } }); Thread.currentThread().setContextClassLoader(hack); try { final EntityManagerFactory entityManagerFactory = persistenceProvider .createEntityManagerFactory(unit, map); if (entityManagerFactory == null) { return null; // depends on control dependency: [if], data = [none] } return JpaWrapper.createEntityManagerFactoryProxy(entityManagerFactory); // depends on control dependency: [try], data = [none] } finally { Thread.currentThread().setContextClassLoader(tccl); } } }
public class class_name { public VoltTable startSnapshotting( final String file_path, final String pathType, final String file_nonce, final SnapshotFormat format, final byte block, final long multiPartTxnId, final long partitionTxnId, final long legacyPerPartitionTxnIds[], final String data, final SystemProcedureExecutionContext context, final String hostname, final HashinatorSnapshotData hashinatorData, final long timestamp) { // TRAIL [SnapSave:3] 3 [all SP] Start to execute create snapshot target requests. TRACE_LOG.trace("Creating snapshot target and handing to EEs"); final VoltTable result = SnapshotUtil.constructNodeResultsTable(); JSONObject jsData = null; if (data != null && !data.isEmpty()) { try { jsData = new JSONObject(data); } catch (JSONException e) { SNAP_LOG.error(String.format("JSON exception on snapshot data \"%s\".", data), e); } } final JSONObject finalJsData = jsData; JSONObject perSiteRemoteDataCenterDrIds; try { perSiteRemoteDataCenterDrIds = ExtensibleSnapshotDigestData.serializeSiteConsumerDrIdTrackersToJSON( context.getDrAppliedTrackers()); } catch (JSONException e) { SNAP_LOG.warn("Failed to serialize the Remote DataCenter's Last applied DRIds"); perSiteRemoteDataCenterDrIds = new JSONObject(); } // One site wins the race to create the snapshot targets, populating // m_taskListsForHSIds for the other sites and creating an appropriate // number of snapshot permits. synchronized (SnapshotSiteProcessor.m_snapshotCreateLock) { SnapshotSiteProcessor.m_snapshotCreateSetupBarrierActualAction.set(new Runnable() { @Override public void run() { Map<Integer, Long> partitionTransactionIds = m_partitionLastSeenTransactionIds; SNAP_LOG.debug("Last seen partition transaction ids " + partitionTransactionIds); m_partitionLastSeenTransactionIds = new HashMap<Integer, Long>(); partitionTransactionIds.put(TxnEgo.getPartitionId(multiPartTxnId), multiPartTxnId); Map<Integer, JSONObject> remoteDataCenterLastIds = m_remoteDataCenterLastIds; m_remoteDataCenterLastIds = new HashMap<Integer, JSONObject>(); /* * Do a quick sanity check that the provided IDs * don't conflict with currently active partitions. If they do * it isn't fatal we can just skip it. */ for (long txnId : legacyPerPartitionTxnIds) { final int legacyPartition = TxnEgo.getPartitionId(txnId); if (partitionTransactionIds.containsKey(legacyPartition)) { SNAP_LOG.warn("While saving a snapshot and propagating legacy " + "transaction ids found an id that matches currently active partition" + partitionTransactionIds.get(legacyPartition)); } else { partitionTransactionIds.put( legacyPartition, txnId); } } ElasticService es = VoltDB.instance().getElasticService(); m_allLocalSiteSnapshotDigestData = new ExtensibleSnapshotDigestData( SnapshotSiteProcessor.getExportSequenceNumbers(), SnapshotSiteProcessor.getDRTupleStreamStateInfo(), remoteDataCenterLastIds, es == null ? null : es.getResumeMetadata(), finalJsData); m_allLocalSiteSnapshotDigestData.setDisabledExternalStreams( SnapshotSiteProcessor.getDisabledExternalStreams()); createSetupIv2( file_path, pathType, file_nonce, format, multiPartTxnId, partitionTransactionIds, finalJsData, context, result, m_allLocalSiteSnapshotDigestData, context.getSiteTrackerForSnapshot(), hashinatorData, timestamp); } }); // Create a barrier to use with the current number of sites to wait for // or if the barrier is already set up check if it is broken and reset if necessary final int numLocalSites = context.getLocalSitesCount(); SnapshotSiteProcessor.readySnapshotSetupBarriers(numLocalSites); //From within this EE, record the sequence numbers as of the start of the snapshot (now) //so that the info can be put in the digest. SnapshotSiteProcessor.populateExternalStreamsStatesFromSites(context); Integer partitionId = TxnEgo.getPartitionId(partitionTxnId); if (SNAP_LOG.isDebugEnabled()) { SNAP_LOG.debug("Registering transaction id " + partitionTxnId + " for " + TxnEgo.getPartitionId(partitionTxnId) + " SP Txn:" + TxnEgo.txnIdSeqToString(partitionTxnId) + " MP Txn:" + TxnEgo.txnIdSeqToString(multiPartTxnId)); } m_partitionLastSeenTransactionIds.put(partitionId, partitionTxnId); m_remoteDataCenterLastIds.put(partitionId, perSiteRemoteDataCenterDrIds); m_isTruncation = finalJsData != null && finalJsData.has("truncReqId"); } boolean runPostTasks = false; VoltTable earlyResultTable = null; try { //if all sites can not come together in 30 seconds, some sites may never receive //request to start snapshot, most likely some nodes are down. So break out the barrier //for early exit. try { SnapshotSiteProcessor.m_snapshotCreateSetupBarrier.await(30, TimeUnit.SECONDS); } catch (TimeoutException e) { throw new InterruptException(0); } try { synchronized (m_createLock) { if (SNAP_LOG.isDebugEnabled()) { SNAP_LOG.debug("Found tasks for HSIds: " + CoreUtils.hsIdCollectionToString(m_taskListsForHSIds.keySet())); SNAP_LOG.debug("Looking for local HSID: " + CoreUtils.hsIdToString(context.getSiteId())); } Deque<SnapshotTableTask> taskList = m_taskListsForHSIds.remove(context.getSiteId()); // If createSetup failed, then the first site to reach here is going // to send the results table generated by createSetup, and then empty out the table. // All other sites to reach here will send the appropriate empty table. // If createSetup was a success but the taskList is null, then we'll use the block // switch to figure out what flavor of empty SnapshotSave result table to return. if (!m_createSuccess.get()) { // There shouldn't be any work for any site if we failed assert(m_taskListsForHSIds.isEmpty()); VoltTable finalresult = m_createResult.get(); if (finalresult != null) { m_createResult.set(null); earlyResultTable = finalresult; } else { // We returned a non-empty NodeResultsTable with the failures in it, // every other site needs to return a NodeResultsTable as well. earlyResultTable = SnapshotUtil.constructNodeResultsTable(); } } else if (taskList == null) { SNAP_LOG.debug("No task for this site, block " + block); // This node is participating in the snapshot but this site has nothing to do. // Send back an appropriate empty table based on the block flag if (block != 0) { runPostTasks = true; earlyResultTable = SnapshotUtil.constructPartitionResultsTable(); earlyResultTable.addRow(context.getHostId(), hostname, CoreUtils.getSiteIdFromHSId(context.getSiteId()), "SUCCESS", ""); } else { //If doing snapshot for only replicated table(s), earlyResultTable here //may not be empty even if the taskList of this site is null. //In that case, snapshot result is preserved by earlyResultTable. earlyResultTable = result; } } else { context.getSiteSnapshotConnection().initiateSnapshots( format, taskList, multiPartTxnId, m_isTruncation, m_allLocalSiteSnapshotDigestData); } if (m_deferredSetupFuture != null && taskList != null) { // Add a listener to the deferred setup so that it can kick off the snapshot // task once the setup is done. m_deferredSetupFuture.addListener(new Runnable() { @Override public void run() { DeferredSnapshotSetup deferredSnapshotSetup = null; try { deferredSnapshotSetup = m_deferredSetupFuture.get(); } catch (Exception e) { // it doesn't throw } assert deferredSnapshotSetup != null; if (m_isTruncation && deferredSnapshotSetup.getError() != null) { VoltDB.crashLocalVoltDB("Unexpected exception while attempting to create truncation snapshot headers", true, deferredSnapshotSetup.getError()); } context.getSiteSnapshotConnection().startSnapshotWithTargets( deferredSnapshotSetup.getPlan().getSnapshotDataTargets()); } }, CoreUtils.SAMETHREADEXECUTOR); } } } finally { SnapshotSiteProcessor.m_snapshotCreateFinishBarrier.await(120, TimeUnit.SECONDS); } } catch (TimeoutException e) { VoltDB.crashLocalVoltDB( "Timed out waiting 120 seconds for all threads to arrive and start snapshot", true, null); } catch (InterruptedException | InterruptException | BrokenBarrierException | IllegalArgumentException e) { result.addRow( context.getHostId(), hostname, "", "FAILURE", CoreUtils.throwableToString(e)); earlyResultTable = result; } // If earlyResultTable is set, return here if (earlyResultTable != null) { if (runPostTasks) { // Need to run post-snapshot tasks before finishing SnapshotSiteProcessor.runPostSnapshotTasks(context); } return earlyResultTable; } if (block != 0) { HashSet<Exception> failures = Sets.newHashSet(); String status = "SUCCESS"; String err = ""; try { // For blocking snapshot, propogate the error from deferred setup back to the client final DeferredSnapshotSetup deferredSnapshotSetup = m_deferredSetupFuture.get(); if (deferredSnapshotSetup != null && deferredSnapshotSetup.getError() != null) { status = "FAILURE"; err = deferredSnapshotSetup.getError().toString(); failures.add(deferredSnapshotSetup.getError()); } failures.addAll(context.getSiteSnapshotConnection().completeSnapshotWork()); SnapshotSiteProcessor.runPostSnapshotTasks(context); } catch (Exception e) { status = "FAILURE"; err = e.toString(); failures.add(e); } final VoltTable blockingResult = SnapshotUtil.constructPartitionResultsTable(); if (failures.isEmpty()) { blockingResult.addRow( context.getHostId(), hostname, CoreUtils.getSiteIdFromHSId(context.getSiteId()), status, err); } else { status = "FAILURE"; for (Exception e : failures) { err = e.toString(); } blockingResult.addRow( context.getHostId(), hostname, CoreUtils.getSiteIdFromHSId(context.getSiteId()), status, err); } return blockingResult; } return result; } }
public class class_name { public VoltTable startSnapshotting( final String file_path, final String pathType, final String file_nonce, final SnapshotFormat format, final byte block, final long multiPartTxnId, final long partitionTxnId, final long legacyPerPartitionTxnIds[], final String data, final SystemProcedureExecutionContext context, final String hostname, final HashinatorSnapshotData hashinatorData, final long timestamp) { // TRAIL [SnapSave:3] 3 [all SP] Start to execute create snapshot target requests. TRACE_LOG.trace("Creating snapshot target and handing to EEs"); final VoltTable result = SnapshotUtil.constructNodeResultsTable(); JSONObject jsData = null; if (data != null && !data.isEmpty()) { try { jsData = new JSONObject(data); // depends on control dependency: [try], data = [none] } catch (JSONException e) { SNAP_LOG.error(String.format("JSON exception on snapshot data \"%s\".", data), e); } // depends on control dependency: [catch], data = [none] } final JSONObject finalJsData = jsData; JSONObject perSiteRemoteDataCenterDrIds; try { perSiteRemoteDataCenterDrIds = ExtensibleSnapshotDigestData.serializeSiteConsumerDrIdTrackersToJSON( context.getDrAppliedTrackers()); // depends on control dependency: [try], data = [none] } catch (JSONException e) { SNAP_LOG.warn("Failed to serialize the Remote DataCenter's Last applied DRIds"); perSiteRemoteDataCenterDrIds = new JSONObject(); } // One site wins the race to create the snapshot targets, populating // m_taskListsForHSIds for the other sites and creating an appropriate // number of snapshot permits. synchronized (SnapshotSiteProcessor.m_snapshotCreateLock) { SnapshotSiteProcessor.m_snapshotCreateSetupBarrierActualAction.set(new Runnable() { @Override public void run() { Map<Integer, Long> partitionTransactionIds = m_partitionLastSeenTransactionIds; SNAP_LOG.debug("Last seen partition transaction ids " + partitionTransactionIds); m_partitionLastSeenTransactionIds = new HashMap<Integer, Long>(); partitionTransactionIds.put(TxnEgo.getPartitionId(multiPartTxnId), multiPartTxnId); Map<Integer, JSONObject> remoteDataCenterLastIds = m_remoteDataCenterLastIds; m_remoteDataCenterLastIds = new HashMap<Integer, JSONObject>(); /* * Do a quick sanity check that the provided IDs * don't conflict with currently active partitions. If they do * it isn't fatal we can just skip it. */ for (long txnId : legacyPerPartitionTxnIds) { final int legacyPartition = TxnEgo.getPartitionId(txnId); if (partitionTransactionIds.containsKey(legacyPartition)) { SNAP_LOG.warn("While saving a snapshot and propagating legacy " + "transaction ids found an id that matches currently active partition" + partitionTransactionIds.get(legacyPartition)); // depends on control dependency: [if], data = [none] } else { partitionTransactionIds.put( legacyPartition, txnId); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] ElasticService es = VoltDB.instance().getElasticService(); m_allLocalSiteSnapshotDigestData = new ExtensibleSnapshotDigestData( SnapshotSiteProcessor.getExportSequenceNumbers(), SnapshotSiteProcessor.getDRTupleStreamStateInfo(), remoteDataCenterLastIds, es == null ? null : es.getResumeMetadata(), finalJsData); m_allLocalSiteSnapshotDigestData.setDisabledExternalStreams( SnapshotSiteProcessor.getDisabledExternalStreams()); createSetupIv2( file_path, pathType, file_nonce, format, multiPartTxnId, partitionTransactionIds, finalJsData, context, result, m_allLocalSiteSnapshotDigestData, context.getSiteTrackerForSnapshot(), hashinatorData, timestamp); } }); // Create a barrier to use with the current number of sites to wait for // or if the barrier is already set up check if it is broken and reset if necessary final int numLocalSites = context.getLocalSitesCount(); SnapshotSiteProcessor.readySnapshotSetupBarriers(numLocalSites); //From within this EE, record the sequence numbers as of the start of the snapshot (now) //so that the info can be put in the digest. SnapshotSiteProcessor.populateExternalStreamsStatesFromSites(context); Integer partitionId = TxnEgo.getPartitionId(partitionTxnId); if (SNAP_LOG.isDebugEnabled()) { SNAP_LOG.debug("Registering transaction id " + partitionTxnId + " for " + TxnEgo.getPartitionId(partitionTxnId) + " SP Txn:" + TxnEgo.txnIdSeqToString(partitionTxnId) + " MP Txn:" + TxnEgo.txnIdSeqToString(multiPartTxnId)); } m_partitionLastSeenTransactionIds.put(partitionId, partitionTxnId); m_remoteDataCenterLastIds.put(partitionId, perSiteRemoteDataCenterDrIds); m_isTruncation = finalJsData != null && finalJsData.has("truncReqId"); } boolean runPostTasks = false; VoltTable earlyResultTable = null; try { //if all sites can not come together in 30 seconds, some sites may never receive //request to start snapshot, most likely some nodes are down. So break out the barrier //for early exit. try { SnapshotSiteProcessor.m_snapshotCreateSetupBarrier.await(30, TimeUnit.SECONDS); } catch (TimeoutException e) { throw new InterruptException(0); } try { synchronized (m_createLock) { if (SNAP_LOG.isDebugEnabled()) { SNAP_LOG.debug("Found tasks for HSIds: " + CoreUtils.hsIdCollectionToString(m_taskListsForHSIds.keySet())); SNAP_LOG.debug("Looking for local HSID: " + CoreUtils.hsIdToString(context.getSiteId())); } Deque<SnapshotTableTask> taskList = m_taskListsForHSIds.remove(context.getSiteId()); // If createSetup failed, then the first site to reach here is going // to send the results table generated by createSetup, and then empty out the table. // All other sites to reach here will send the appropriate empty table. // If createSetup was a success but the taskList is null, then we'll use the block // switch to figure out what flavor of empty SnapshotSave result table to return. if (!m_createSuccess.get()) { // There shouldn't be any work for any site if we failed assert(m_taskListsForHSIds.isEmpty()); VoltTable finalresult = m_createResult.get(); if (finalresult != null) { m_createResult.set(null); earlyResultTable = finalresult; } else { // We returned a non-empty NodeResultsTable with the failures in it, // every other site needs to return a NodeResultsTable as well. earlyResultTable = SnapshotUtil.constructNodeResultsTable(); } } else if (taskList == null) { SNAP_LOG.debug("No task for this site, block " + block); // This node is participating in the snapshot but this site has nothing to do. // Send back an appropriate empty table based on the block flag if (block != 0) { runPostTasks = true; earlyResultTable = SnapshotUtil.constructPartitionResultsTable(); earlyResultTable.addRow(context.getHostId(), hostname, CoreUtils.getSiteIdFromHSId(context.getSiteId()), "SUCCESS", ""); } else { //If doing snapshot for only replicated table(s), earlyResultTable here //may not be empty even if the taskList of this site is null. //In that case, snapshot result is preserved by earlyResultTable. earlyResultTable = result; } } else { context.getSiteSnapshotConnection().initiateSnapshots( format, taskList, multiPartTxnId, m_isTruncation, m_allLocalSiteSnapshotDigestData); } if (m_deferredSetupFuture != null && taskList != null) { // Add a listener to the deferred setup so that it can kick off the snapshot // task once the setup is done. m_deferredSetupFuture.addListener(new Runnable() { @Override public void run() { DeferredSnapshotSetup deferredSnapshotSetup = null; try { deferredSnapshotSetup = m_deferredSetupFuture.get(); } catch (Exception e) { // it doesn't throw } assert deferredSnapshotSetup != null; if (m_isTruncation && deferredSnapshotSetup.getError() != null) { VoltDB.crashLocalVoltDB("Unexpected exception while attempting to create truncation snapshot headers", true, deferredSnapshotSetup.getError()); } context.getSiteSnapshotConnection().startSnapshotWithTargets( deferredSnapshotSetup.getPlan().getSnapshotDataTargets()); } }, CoreUtils.SAMETHREADEXECUTOR); } } } finally { SnapshotSiteProcessor.m_snapshotCreateFinishBarrier.await(120, TimeUnit.SECONDS); } } catch (TimeoutException e) { VoltDB.crashLocalVoltDB( "Timed out waiting 120 seconds for all threads to arrive and start snapshot", true, null); } catch (InterruptedException | InterruptException | BrokenBarrierException | IllegalArgumentException e) { result.addRow( context.getHostId(), hostname, "", "FAILURE", CoreUtils.throwableToString(e)); earlyResultTable = result; } // If earlyResultTable is set, return here if (earlyResultTable != null) { if (runPostTasks) { // Need to run post-snapshot tasks before finishing SnapshotSiteProcessor.runPostSnapshotTasks(context); } return earlyResultTable; } if (block != 0) { HashSet<Exception> failures = Sets.newHashSet(); String status = "SUCCESS"; String err = ""; try { // For blocking snapshot, propogate the error from deferred setup back to the client final DeferredSnapshotSetup deferredSnapshotSetup = m_deferredSetupFuture.get(); if (deferredSnapshotSetup != null && deferredSnapshotSetup.getError() != null) { status = "FAILURE"; err = deferredSnapshotSetup.getError().toString(); failures.add(deferredSnapshotSetup.getError()); } failures.addAll(context.getSiteSnapshotConnection().completeSnapshotWork()); SnapshotSiteProcessor.runPostSnapshotTasks(context); } catch (Exception e) { status = "FAILURE"; err = e.toString(); failures.add(e); } final VoltTable blockingResult = SnapshotUtil.constructPartitionResultsTable(); if (failures.isEmpty()) { blockingResult.addRow( context.getHostId(), hostname, CoreUtils.getSiteIdFromHSId(context.getSiteId()), status, err); } else { status = "FAILURE"; for (Exception e : failures) { err = e.toString(); } blockingResult.addRow( context.getHostId(), hostname, CoreUtils.getSiteIdFromHSId(context.getSiteId()), status, err); } return blockingResult; } return result; } }
public class class_name { private void initRepositoryFeatures() { if (this.repositoryVersion == null) { // Default features this.repositoryVersion = new DefaultVersion(Resources.VERSION10); this.filterable = false; this.sortable = false; // Get remote features CloseableHttpResponse response; try { response = getRESTResource(this.rootUriBuider); } catch (IOException e) { // Assume it's a 1.0 repository return; } try { Repository repository = getRESTObject(response); this.repositoryVersion = new DefaultVersion(repository.getVersion()); this.filterable = repository.isFilterable() == Boolean.TRUE; this.sortable = repository.isSortable() == Boolean.TRUE; } catch (Exception e) { LOGGER.error("Failed to get repository features", e); } } } }
public class class_name { private void initRepositoryFeatures() { if (this.repositoryVersion == null) { // Default features this.repositoryVersion = new DefaultVersion(Resources.VERSION10); // depends on control dependency: [if], data = [none] this.filterable = false; // depends on control dependency: [if], data = [none] this.sortable = false; // depends on control dependency: [if], data = [none] // Get remote features CloseableHttpResponse response; try { response = getRESTResource(this.rootUriBuider); // depends on control dependency: [try], data = [none] } catch (IOException e) { // Assume it's a 1.0 repository return; } // depends on control dependency: [catch], data = [none] try { Repository repository = getRESTObject(response); this.repositoryVersion = new DefaultVersion(repository.getVersion()); // depends on control dependency: [try], data = [none] this.filterable = repository.isFilterable() == Boolean.TRUE; // depends on control dependency: [try], data = [none] this.sortable = repository.isSortable() == Boolean.TRUE; // depends on control dependency: [try], data = [none] } catch (Exception e) { LOGGER.error("Failed to get repository features", e); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public void generateBackgroundEdgeFromForegroundEdge() { backgroundEdgePixels.clear(); Point p, p2; Iterator<Point> it = foregroundEdgePixels.iterator(); while( it.hasNext() ) { p = new Point(it.next()); for( int j = -1; j < 2; ++j ) { for( int i = -1; i < 2; ++i ) { if ((p.x + i >= 0) && (p.x + i < width) && (p.y + j >= 0) && (p.y + j < height)) { p2 = new Point(p.x + i, p.y + j); if (pixels[p2.x][p2.y] == BACKGROUND) { backgroundEdgePixels.add(p2); } } } } } } }
public class class_name { public void generateBackgroundEdgeFromForegroundEdge() { backgroundEdgePixels.clear(); Point p, p2; Iterator<Point> it = foregroundEdgePixels.iterator(); while( it.hasNext() ) { p = new Point(it.next()); // depends on control dependency: [while], data = [none] for( int j = -1; j < 2; ++j ) { for( int i = -1; i < 2; ++i ) { if ((p.x + i >= 0) && (p.x + i < width) && (p.y + j >= 0) && (p.y + j < height)) { p2 = new Point(p.x + i, p.y + j); // depends on control dependency: [if], data = [none] if (pixels[p2.x][p2.y] == BACKGROUND) { backgroundEdgePixels.add(p2); // depends on control dependency: [if], data = [none] } } } } } } }
public class class_name { public void registerListener(ResponseListener listener) { if (! listeners.contains(listener)) { boolean unique = true; for (ResponseListener existing : listeners) { if (existing.getClass().equals(listener.getClass())) { unique = false; break; } } if (unique) { listeners.add(listener); } } } }
public class class_name { public void registerListener(ResponseListener listener) { if (! listeners.contains(listener)) { boolean unique = true; for (ResponseListener existing : listeners) { if (existing.getClass().equals(listener.getClass())) { unique = false; // depends on control dependency: [if], data = [none] break; } } if (unique) { listeners.add(listener); // depends on control dependency: [if], data = [none] } } } }
public class class_name { protected void runPollingCycle() { synchronized(this.LOCK) { Set<Entry<FaxClientSpi,Map<FaxJob,FaxJobStatus>>> entrySet=this.data.entrySet(); Iterator<Entry<FaxClientSpi,Map<FaxJob,FaxJobStatus>>> faxClientSpiIterator=entrySet.iterator(); Entry<FaxClientSpi,Map<FaxJob,FaxJobStatus>> faxClientSpiEntry=null; FaxClientSpi faxClientSpi=null; Map<FaxJob,FaxJobStatus> faxJobMap=null; Iterator<Entry<FaxJob,FaxJobStatus>> faxJobIterator=null; Entry<FaxJob,FaxJobStatus> faxJobEntry=null; FaxJob[] faxJobs=null; FaxJobStatus[] previousFaxJobStatuses=null; FaxJobStatus[] currentFaxJobStatuses=null; FaxJob faxJob=null; FaxJobStatus previousFaxJobStatus=null; FaxJobStatus currentFaxJobStatus=null; int counter=0; while(faxClientSpiIterator.hasNext()) { //get next entry faxClientSpiEntry=faxClientSpiIterator.next(); //get values faxClientSpi=faxClientSpiEntry.getKey(); faxJobMap=faxClientSpiEntry.getValue(); //get iterator faxJobIterator=faxJobMap.entrySet().iterator(); int amount=faxJobMap.size(); if(amount>0) { //init arrays faxJobs=new FaxJob[amount]; previousFaxJobStatuses=new FaxJobStatus[amount]; counter=0; while(faxJobIterator.hasNext()) { //get next entry faxJobEntry=faxJobIterator.next(); //get values faxJob=faxJobEntry.getKey(); previousFaxJobStatus=faxJobEntry.getValue(); //put in array faxJobs[counter]=faxJob; previousFaxJobStatuses[counter]=previousFaxJobStatus; counter++; } //poll for changes currentFaxJobStatuses=faxClientSpi.pollForFaxJobStatues(faxJobs); if((currentFaxJobStatuses!=null)&&(currentFaxJobStatuses.length==amount)) { for(int index=0;index<amount;index++) { //get current fax job status currentFaxJobStatus=currentFaxJobStatuses[index]; if(currentFaxJobStatus!=null) { //get values faxJob=faxJobs[index]; previousFaxJobStatus=previousFaxJobStatuses[index]; //if status was changed if(!previousFaxJobStatus.equals(currentFaxJobStatus)) { //update data structure faxJobMap.put(faxJob,currentFaxJobStatus); //fire event faxClientSpi.fireFaxMonitorEvent(FaxMonitorEventID.FAX_JOB_STATUS_CHANGE,faxJob,currentFaxJobStatus); } //if status is unknown or error, stop monitoring fax job switch(currentFaxJobStatus) { case UNKNOWN: case ERROR: faxJobMap.remove(faxJob); break; case IN_PROGRESS: case PENDING: default: //do nothing break; } } } } } if(faxJobMap.isEmpty()) { faxClientSpiIterator.remove(); } } } //check if need to stop the monitor this.checkAndStopMonitor(); } }
public class class_name { protected void runPollingCycle() { synchronized(this.LOCK) { Set<Entry<FaxClientSpi,Map<FaxJob,FaxJobStatus>>> entrySet=this.data.entrySet(); Iterator<Entry<FaxClientSpi,Map<FaxJob,FaxJobStatus>>> faxClientSpiIterator=entrySet.iterator(); Entry<FaxClientSpi,Map<FaxJob,FaxJobStatus>> faxClientSpiEntry=null; FaxClientSpi faxClientSpi=null; Map<FaxJob,FaxJobStatus> faxJobMap=null; Iterator<Entry<FaxJob,FaxJobStatus>> faxJobIterator=null; Entry<FaxJob,FaxJobStatus> faxJobEntry=null; FaxJob[] faxJobs=null; FaxJobStatus[] previousFaxJobStatuses=null; FaxJobStatus[] currentFaxJobStatuses=null; FaxJob faxJob=null; FaxJobStatus previousFaxJobStatus=null; FaxJobStatus currentFaxJobStatus=null; int counter=0; while(faxClientSpiIterator.hasNext()) { //get next entry faxClientSpiEntry=faxClientSpiIterator.next(); // depends on control dependency: [while], data = [none] //get values faxClientSpi=faxClientSpiEntry.getKey(); // depends on control dependency: [while], data = [none] faxJobMap=faxClientSpiEntry.getValue(); // depends on control dependency: [while], data = [none] //get iterator faxJobIterator=faxJobMap.entrySet().iterator(); // depends on control dependency: [while], data = [none] int amount=faxJobMap.size(); if(amount>0) { //init arrays faxJobs=new FaxJob[amount]; // depends on control dependency: [if], data = [none] previousFaxJobStatuses=new FaxJobStatus[amount]; // depends on control dependency: [if], data = [none] counter=0; // depends on control dependency: [if], data = [none] while(faxJobIterator.hasNext()) { //get next entry faxJobEntry=faxJobIterator.next(); // depends on control dependency: [while], data = [none] //get values faxJob=faxJobEntry.getKey(); // depends on control dependency: [while], data = [none] previousFaxJobStatus=faxJobEntry.getValue(); // depends on control dependency: [while], data = [none] //put in array faxJobs[counter]=faxJob; // depends on control dependency: [while], data = [none] previousFaxJobStatuses[counter]=previousFaxJobStatus; // depends on control dependency: [while], data = [none] counter++; // depends on control dependency: [while], data = [none] } //poll for changes currentFaxJobStatuses=faxClientSpi.pollForFaxJobStatues(faxJobs); // depends on control dependency: [if], data = [none] if((currentFaxJobStatuses!=null)&&(currentFaxJobStatuses.length==amount)) { for(int index=0;index<amount;index++) { //get current fax job status currentFaxJobStatus=currentFaxJobStatuses[index]; // depends on control dependency: [for], data = [index] if(currentFaxJobStatus!=null) { //get values faxJob=faxJobs[index]; // depends on control dependency: [if], data = [none] previousFaxJobStatus=previousFaxJobStatuses[index]; // depends on control dependency: [if], data = [none] //if status was changed if(!previousFaxJobStatus.equals(currentFaxJobStatus)) { //update data structure faxJobMap.put(faxJob,currentFaxJobStatus); // depends on control dependency: [if], data = [none] //fire event faxClientSpi.fireFaxMonitorEvent(FaxMonitorEventID.FAX_JOB_STATUS_CHANGE,faxJob,currentFaxJobStatus); // depends on control dependency: [if], data = [none] } //if status is unknown or error, stop monitoring fax job switch(currentFaxJobStatus) { case UNKNOWN: case ERROR: faxJobMap.remove(faxJob); break; case IN_PROGRESS: case PENDING: default: //do nothing break; } } } } } if(faxJobMap.isEmpty()) { faxClientSpiIterator.remove(); // depends on control dependency: [if], data = [none] } } } //check if need to stop the monitor this.checkAndStopMonitor(); } }
public class class_name { public String getFirstExistingParamName(String[] paramNames) { for (final String paramName : paramNames) { if (isPresent(paramName)) { return paramName; } } throw new ParameterException("One of " + Arrays.toString(paramNames) + " must be present"); } }
public class class_name { public String getFirstExistingParamName(String[] paramNames) { for (final String paramName : paramNames) { if (isPresent(paramName)) { return paramName; // depends on control dependency: [if], data = [none] } } throw new ParameterException("One of " + Arrays.toString(paramNames) + " must be present"); } }
public class class_name { public Observable<ServiceResponse<GetPersonalPreferencesResponseInner>> getPersonalPreferencesWithServiceResponseAsync(String userName, PersonalPreferencesOperationsPayload personalPreferencesOperationsPayload) { if (userName == null) { throw new IllegalArgumentException("Parameter userName is required and cannot be null."); } if (personalPreferencesOperationsPayload == null) { throw new IllegalArgumentException("Parameter personalPreferencesOperationsPayload is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } Validator.validate(personalPreferencesOperationsPayload); return service.getPersonalPreferences(userName, personalPreferencesOperationsPayload, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<GetPersonalPreferencesResponseInner>>>() { @Override public Observable<ServiceResponse<GetPersonalPreferencesResponseInner>> call(Response<ResponseBody> response) { try { ServiceResponse<GetPersonalPreferencesResponseInner> clientResponse = getPersonalPreferencesDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } }
public class class_name { public Observable<ServiceResponse<GetPersonalPreferencesResponseInner>> getPersonalPreferencesWithServiceResponseAsync(String userName, PersonalPreferencesOperationsPayload personalPreferencesOperationsPayload) { if (userName == null) { throw new IllegalArgumentException("Parameter userName is required and cannot be null."); } if (personalPreferencesOperationsPayload == null) { throw new IllegalArgumentException("Parameter personalPreferencesOperationsPayload is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } Validator.validate(personalPreferencesOperationsPayload); return service.getPersonalPreferences(userName, personalPreferencesOperationsPayload, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<GetPersonalPreferencesResponseInner>>>() { @Override public Observable<ServiceResponse<GetPersonalPreferencesResponseInner>> call(Response<ResponseBody> response) { try { ServiceResponse<GetPersonalPreferencesResponseInner> clientResponse = getPersonalPreferencesDelegate(response); return Observable.just(clientResponse); // depends on control dependency: [try], data = [none] } catch (Throwable t) { return Observable.error(t); } // depends on control dependency: [catch], data = [none] } }); } }
public class class_name { private <T> QueuedCallback<T> checkConcurrentAssignment(String segmentName, Function<Long, CompletableFuture<T>> thenCompose) { QueuedCallback<T> queuedCallback = null; synchronized (this.pendingRequests) { PendingRequest pendingRequest = this.pendingRequests.getOrDefault(segmentName, null); if (pendingRequest != null) { queuedCallback = new QueuedCallback<>(thenCompose); pendingRequest.callbacks.add(queuedCallback); } } return queuedCallback; } }
public class class_name { private <T> QueuedCallback<T> checkConcurrentAssignment(String segmentName, Function<Long, CompletableFuture<T>> thenCompose) { QueuedCallback<T> queuedCallback = null; synchronized (this.pendingRequests) { PendingRequest pendingRequest = this.pendingRequests.getOrDefault(segmentName, null); if (pendingRequest != null) { queuedCallback = new QueuedCallback<>(thenCompose); // depends on control dependency: [if], data = [none] pendingRequest.callbacks.add(queuedCallback); // depends on control dependency: [if], data = [none] } } return queuedCallback; } }
public class class_name { private Properties parseProperties(String propertiesString) { Properties properties = null; String[] propPairs = propertiesString.split(";"); if (propPairs.length > 0) { properties = new Properties(); for (String propPair : propPairs) { int eq = propPair.indexOf('='); assert eq > -1 : "Invalid properties syntax: " + propertiesString; properties.put(propPair.substring(0, eq), propPair.substring(eq + 1, propPair.length())); } } return properties; } }
public class class_name { private Properties parseProperties(String propertiesString) { Properties properties = null; String[] propPairs = propertiesString.split(";"); if (propPairs.length > 0) { properties = new Properties(); // depends on control dependency: [if], data = [none] for (String propPair : propPairs) { int eq = propPair.indexOf('='); assert eq > -1 : "Invalid properties syntax: " + propertiesString; properties.put(propPair.substring(0, eq), propPair.substring(eq + 1, propPair.length())); // depends on control dependency: [for], data = [propPair] } } return properties; } }
public class class_name { public static String getTextContent(Document document, boolean individualTokens) { String textContent = null; if (individualTokens) { List<String> tokens = getTextTokens(document); textContent = StringUtils.join(tokens, ","); } else { textContent = document.getDocumentElement().getTextContent().trim().replaceAll("\\s+", ","); } return textContent; } }
public class class_name { public static String getTextContent(Document document, boolean individualTokens) { String textContent = null; if (individualTokens) { List<String> tokens = getTextTokens(document); textContent = StringUtils.join(tokens, ","); // depends on control dependency: [if], data = [none] } else { textContent = document.getDocumentElement().getTextContent().trim().replaceAll("\\s+", ","); // depends on control dependency: [if], data = [none] } return textContent; } }
public class class_name { public static AppLinkData createFromActivity(Activity activity) { Validate.notNull(activity, "activity"); Intent intent = activity.getIntent(); if (intent == null) { return null; } AppLinkData appLinkData = createFromAlApplinkData(intent); if (appLinkData == null) { String appLinkArgsJsonString = intent.getStringExtra(BUNDLE_APPLINK_ARGS_KEY); appLinkData = createFromJson(appLinkArgsJsonString); } if (appLinkData == null) { // Try regular app linking appLinkData = createFromUri(intent.getData()); } return appLinkData; } }
public class class_name { public static AppLinkData createFromActivity(Activity activity) { Validate.notNull(activity, "activity"); Intent intent = activity.getIntent(); if (intent == null) { return null; // depends on control dependency: [if], data = [none] } AppLinkData appLinkData = createFromAlApplinkData(intent); if (appLinkData == null) { String appLinkArgsJsonString = intent.getStringExtra(BUNDLE_APPLINK_ARGS_KEY); appLinkData = createFromJson(appLinkArgsJsonString); // depends on control dependency: [if], data = [none] } if (appLinkData == null) { // Try regular app linking appLinkData = createFromUri(intent.getData()); // depends on control dependency: [if], data = [none] } return appLinkData; } }
public class class_name { public void setMobileData(Boolean turnedOn){ ConnectivityManager dataManager=(ConnectivityManager)instrumentation.getTargetContext().getSystemService(Context.CONNECTIVITY_SERVICE); Method dataClass = null; try { dataClass = ConnectivityManager.class.getDeclaredMethod("setMobileDataEnabled", boolean.class); dataClass.setAccessible(true); dataClass.invoke(dataManager, turnedOn); } catch (Exception e) { e.printStackTrace(); } } }
public class class_name { public void setMobileData(Boolean turnedOn){ ConnectivityManager dataManager=(ConnectivityManager)instrumentation.getTargetContext().getSystemService(Context.CONNECTIVITY_SERVICE); Method dataClass = null; try { dataClass = ConnectivityManager.class.getDeclaredMethod("setMobileDataEnabled", boolean.class); // depends on control dependency: [try], data = [none] dataClass.setAccessible(true); // depends on control dependency: [try], data = [none] dataClass.invoke(dataManager, turnedOn); // depends on control dependency: [try], data = [none] } catch (Exception e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void marshall(BatchAttachTypedLinkResponse batchAttachTypedLinkResponse, ProtocolMarshaller protocolMarshaller) { if (batchAttachTypedLinkResponse == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(batchAttachTypedLinkResponse.getTypedLinkSpecifier(), TYPEDLINKSPECIFIER_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(BatchAttachTypedLinkResponse batchAttachTypedLinkResponse, ProtocolMarshaller protocolMarshaller) { if (batchAttachTypedLinkResponse == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(batchAttachTypedLinkResponse.getTypedLinkSpecifier(), TYPEDLINKSPECIFIER_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 { @Nullable public static String getTableName(Path rootPath, Path path) { path = qualified(rootPath, path); if (rootPath.equals(path)) { // Path is root, no table return null; } Path tablePath; Path parent = path.getParent(); if (Objects.equals(parent, rootPath)) { // The path itself represents a table (e.g.; emodb://ci.us/mytable) tablePath = path; } else if (parent != null && Objects.equals(parent.getParent(), rootPath)) { // The path is a split (e.g.; emodb://ci.us/mytable/split-id) tablePath = parent; } else { throw new IllegalArgumentException( format("Path does not represent a table, split, or root (path=%s, root=%s)", path, rootPath)); } return decode(tablePath.getName()); } }
public class class_name { @Nullable public static String getTableName(Path rootPath, Path path) { path = qualified(rootPath, path); if (rootPath.equals(path)) { // Path is root, no table return null; // depends on control dependency: [if], data = [none] } Path tablePath; Path parent = path.getParent(); if (Objects.equals(parent, rootPath)) { // The path itself represents a table (e.g.; emodb://ci.us/mytable) tablePath = path; // depends on control dependency: [if], data = [none] } else if (parent != null && Objects.equals(parent.getParent(), rootPath)) { // The path is a split (e.g.; emodb://ci.us/mytable/split-id) tablePath = parent; // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException( format("Path does not represent a table, split, or root (path=%s, root=%s)", path, rootPath)); } return decode(tablePath.getName()); } }
public class class_name { @Override public void stop(ShutdownModeAmp mode) throws Exception { super.stop(mode); Alarm alarm = _alarm; _alarm = null; if (alarm != null) { alarm.dequeue(); } for (PortTcp port : _ports) { try { port.close(); } catch (Throwable e) { log.log(Level.WARNING, e.toString(), e); } } _clusterService.stop(); } }
public class class_name { @Override public void stop(ShutdownModeAmp mode) throws Exception { super.stop(mode); Alarm alarm = _alarm; _alarm = null; if (alarm != null) { alarm.dequeue(); } for (PortTcp port : _ports) { try { port.close(); // depends on control dependency: [try], data = [none] } catch (Throwable e) { log.log(Level.WARNING, e.toString(), e); } // depends on control dependency: [catch], data = [none] } _clusterService.stop(); } }
public class class_name { private UnicodeSet xor(int[] other, int otherLen, int polarity) { ensureBufferCapacity(len + otherLen); int i = 0, j = 0, k = 0; int a = list[i++]; int b; // TODO: Based on the call hierarchy, polarity of 1 or 2 is never used // so the following if statement will not be called. ///CLOVER:OFF if (polarity == 1 || polarity == 2) { b = LOW; if (other[j] == LOW) { // skip base if already LOW ++j; b = other[j]; } ///CLOVER:ON } else { b = other[j++]; } // simplest of all the routines // sort the values, discarding identicals! while (true) { if (a < b) { buffer[k++] = a; a = list[i++]; } else if (b < a) { buffer[k++] = b; b = other[j++]; } else if (a != HIGH) { // at this point, a == b // discard both values! a = list[i++]; b = other[j++]; } else { // DONE! buffer[k++] = HIGH; len = k; break; } } // swap list and buffer int[] temp = list; list = buffer; buffer = temp; pat = null; return this; } }
public class class_name { private UnicodeSet xor(int[] other, int otherLen, int polarity) { ensureBufferCapacity(len + otherLen); int i = 0, j = 0, k = 0; int a = list[i++]; int b; // TODO: Based on the call hierarchy, polarity of 1 or 2 is never used // so the following if statement will not be called. ///CLOVER:OFF if (polarity == 1 || polarity == 2) { b = LOW; // depends on control dependency: [if], data = [none] if (other[j] == LOW) { // skip base if already LOW ++j; // depends on control dependency: [if], data = [none] b = other[j]; // depends on control dependency: [if], data = [none] } ///CLOVER:ON } else { b = other[j++]; // depends on control dependency: [if], data = [none] } // simplest of all the routines // sort the values, discarding identicals! while (true) { if (a < b) { buffer[k++] = a; // depends on control dependency: [if], data = [none] a = list[i++]; // depends on control dependency: [if], data = [none] } else if (b < a) { buffer[k++] = b; // depends on control dependency: [if], data = [none] b = other[j++]; // depends on control dependency: [if], data = [none] } else if (a != HIGH) { // at this point, a == b // discard both values! a = list[i++]; // depends on control dependency: [if], data = [none] b = other[j++]; // depends on control dependency: [if], data = [none] } else { // DONE! buffer[k++] = HIGH; // depends on control dependency: [if], data = [none] len = k; // depends on control dependency: [if], data = [none] break; } } // swap list and buffer int[] temp = list; list = buffer; buffer = temp; pat = null; return this; } }
public class class_name { public void setSymbolMapsDirectory(String symbolMapsDir) { if (deobfuscator == null) { deobfuscator = new StackTraceDeobfuscator(symbolMapsDir); } else { deobfuscator.setSymbolMapsDirectory(symbolMapsDir); } } }
public class class_name { public void setSymbolMapsDirectory(String symbolMapsDir) { if (deobfuscator == null) { deobfuscator = new StackTraceDeobfuscator(symbolMapsDir); // depends on control dependency: [if], data = [none] } else { deobfuscator.setSymbolMapsDirectory(symbolMapsDir); // depends on control dependency: [if], data = [none] } } }
public class class_name { public double normSq() { double total = 0; int N = getDimension(); for( int i = 0; i < N; i++ ) { double a = getIdx( i ); total += a * a; } return total; } }
public class class_name { public double normSq() { double total = 0; int N = getDimension(); for( int i = 0; i < N; i++ ) { double a = getIdx( i ); total += a * a; // depends on control dependency: [for], data = [none] } return total; } }
public class class_name { private Content.Type getContentType(String suffix) { List<Content.Type<?>> cts = project.getParent().getContentTypes(); // for (int i = 0; i != cts.size(); ++i) { Content.Type<?> ct = cts.get(i); if (ct.getSuffix().equals(suffix)) { // hit return ct; } } // miss throw new IllegalArgumentException("unknown content-type: " + suffix); } }
public class class_name { private Content.Type getContentType(String suffix) { List<Content.Type<?>> cts = project.getParent().getContentTypes(); // for (int i = 0; i != cts.size(); ++i) { Content.Type<?> ct = cts.get(i); if (ct.getSuffix().equals(suffix)) { // hit return ct; // depends on control dependency: [if], data = [none] } } // miss throw new IllegalArgumentException("unknown content-type: " + suffix); } }
public class class_name { private Object bindResolve(Object o, JSONObject src) { if (o instanceof DataBoundResolvable) { DataBoundResolvable dbr = (DataBoundResolvable) o; o = dbr.bindResolve(this,src); } return o; } }
public class class_name { private Object bindResolve(Object o, JSONObject src) { if (o instanceof DataBoundResolvable) { DataBoundResolvable dbr = (DataBoundResolvable) o; o = dbr.bindResolve(this,src); // depends on control dependency: [if], data = [none] } return o; } }
public class class_name { @CheckReturnValue public RoleAction setPermissions(Permission... permissions) { if (permissions != null) { for (Permission p : permissions) { Checks.notNull(p, "Permissions"); checkPermission(p); } } this.permissions = permissions == null ? null : Permission.getRaw(permissions); return this; } }
public class class_name { @CheckReturnValue public RoleAction setPermissions(Permission... permissions) { if (permissions != null) { for (Permission p : permissions) { Checks.notNull(p, "Permissions"); // depends on control dependency: [for], data = [p] checkPermission(p); // depends on control dependency: [for], data = [p] } } this.permissions = permissions == null ? null : Permission.getRaw(permissions); return this; } }
public class class_name { public static boolean containRegexGreaterThan(String srcString, String desString, int number) { boolean res = false; int totalNumber = containRegexStatistics(srcString, desString); if (totalNumber > number) { res = true; } return res; } }
public class class_name { public static boolean containRegexGreaterThan(String srcString, String desString, int number) { boolean res = false; int totalNumber = containRegexStatistics(srcString, desString); if (totalNumber > number) { res = true; // depends on control dependency: [if], data = [none] } return res; } }
public class class_name { @Override protected boolean isForAction(Method actionMethod, Class<?> controllerClazz) { for (Class<?> paramType : actionMethod.getParameterTypes()) { if (paramType == Portal.class) { return true; } } return false; } }
public class class_name { @Override protected boolean isForAction(Method actionMethod, Class<?> controllerClazz) { for (Class<?> paramType : actionMethod.getParameterTypes()) { if (paramType == Portal.class) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { public JobService getJobService() { if (service == null) { try { Registry registry = LocateRegistry.getRegistry(host, JdcpUtil.DEFAULT_PORT); AuthenticationService auth = (AuthenticationService) registry.lookup("AuthenticationService"); service = auth.authenticate(username, password, JdcpUtil.PROTOCOL_VERSION_ID); } catch (NotBoundException e) { System.err.println("Job service not found at remote host."); System.exit(1); } catch (RemoteException e) { System.err.println("Could not connect to job service."); e.printStackTrace(); System.exit(1); } catch (LoginException e) { System.err.println("Login failed."); System.exit(1); } catch (ProtocolVersionException e) { System.err.println("This client is incompatible with the remote server. Please update the client and try again."); System.exit(1); } } return service; } }
public class class_name { public JobService getJobService() { if (service == null) { try { Registry registry = LocateRegistry.getRegistry(host, JdcpUtil.DEFAULT_PORT); AuthenticationService auth = (AuthenticationService) registry.lookup("AuthenticationService"); service = auth.authenticate(username, password, JdcpUtil.PROTOCOL_VERSION_ID); // depends on control dependency: [try], data = [none] } catch (NotBoundException e) { System.err.println("Job service not found at remote host."); System.exit(1); } catch (RemoteException e) { // depends on control dependency: [catch], data = [none] System.err.println("Could not connect to job service."); e.printStackTrace(); System.exit(1); } catch (LoginException e) { // depends on control dependency: [catch], data = [none] System.err.println("Login failed."); System.exit(1); } catch (ProtocolVersionException e) { // depends on control dependency: [catch], data = [none] System.err.println("This client is incompatible with the remote server. Please update the client and try again."); System.exit(1); } // depends on control dependency: [catch], data = [none] } return service; } }
public class class_name { private void resetContentLocale(Locale defaultLocale) { m_resetting = true; m_localeSelect.removeAllItems(); if (m_currentConfig.getFolders().isEmpty()) { m_localeSelect.addItem(defaultLocale); m_localeSelect.setItemCaption(defaultLocale, defaultLocale.getDisplayLanguage(UI.getCurrent().getLocale())); } else { for (String folder : m_currentConfig.getFolders()) { for (Locale locale : OpenCms.getLocaleManager().getAvailableLocales(A_CmsUI.getCmsObject(), folder)) { if (!m_localeSelect.containsId(locale)) { m_localeSelect.addItem(locale); m_localeSelect.setItemCaption(locale, locale.getDisplayLanguage(UI.getCurrent().getLocale())); } } } } m_localeSelect.setValue(defaultLocale); m_localeSelect.setEnabled(m_localeSelect.getItemIds().size() > 1); m_resetting = false; } }
public class class_name { private void resetContentLocale(Locale defaultLocale) { m_resetting = true; m_localeSelect.removeAllItems(); if (m_currentConfig.getFolders().isEmpty()) { m_localeSelect.addItem(defaultLocale); // depends on control dependency: [if], data = [none] m_localeSelect.setItemCaption(defaultLocale, defaultLocale.getDisplayLanguage(UI.getCurrent().getLocale())); // depends on control dependency: [if], data = [none] } else { for (String folder : m_currentConfig.getFolders()) { for (Locale locale : OpenCms.getLocaleManager().getAvailableLocales(A_CmsUI.getCmsObject(), folder)) { if (!m_localeSelect.containsId(locale)) { m_localeSelect.addItem(locale); // depends on control dependency: [if], data = [none] m_localeSelect.setItemCaption(locale, locale.getDisplayLanguage(UI.getCurrent().getLocale())); // depends on control dependency: [if], data = [none] } } } } m_localeSelect.setValue(defaultLocale); m_localeSelect.setEnabled(m_localeSelect.getItemIds().size() > 1); m_resetting = false; } }
public class class_name { @Override public OAuth2TokenValidatorResult validate(T token) { Collection<OAuth2Error> errors = new ArrayList<>(); for ( OAuth2TokenValidator<T> validator : this.tokenValidators) { errors.addAll(validator.validate(token).getErrors()); } return OAuth2TokenValidatorResult.failure(errors); } }
public class class_name { @Override public OAuth2TokenValidatorResult validate(T token) { Collection<OAuth2Error> errors = new ArrayList<>(); for ( OAuth2TokenValidator<T> validator : this.tokenValidators) { errors.addAll(validator.validate(token).getErrors()); // depends on control dependency: [for], data = [validator] } return OAuth2TokenValidatorResult.failure(errors); } }
public class class_name { @Nullable public static Object unwrapOptional(@Nullable final Object obj) { if (obj instanceof Optional) { final Optional<?> optional = (Optional<?>) obj; if (!optional.isPresent()) { return null; } final Object result = optional.get(); Assert.isTrue(!(result instanceof Optional), "Multi-level Optional usage not supported"); return result; } return obj; } }
public class class_name { @Nullable public static Object unwrapOptional(@Nullable final Object obj) { if (obj instanceof Optional) { final Optional<?> optional = (Optional<?>) obj; if (!optional.isPresent()) { return null; // depends on control dependency: [if], data = [none] } final Object result = optional.get(); Assert.isTrue(!(result instanceof Optional), "Multi-level Optional usage not supported"); // depends on control dependency: [if], data = [none] return result; // depends on control dependency: [if], data = [none] } return obj; } }
public class class_name { @Override public JvmIdentifiableElement getLinkedFeature(/* @Nullable */ XConstructorCall constructorCall) { if (!shared.allLinking.contains(constructorCall)) { return null; } return doGetLinkedFeature(constructorCall); } }
public class class_name { @Override public JvmIdentifiableElement getLinkedFeature(/* @Nullable */ XConstructorCall constructorCall) { if (!shared.allLinking.contains(constructorCall)) { return null; // depends on control dependency: [if], data = [none] } return doGetLinkedFeature(constructorCall); } }
public class class_name { protected void processDeletions(CmsObject cms, List<CmsResource> toDelete) throws CmsException { Collections.sort(toDelete, (a, b) -> b.getRootPath().compareTo(a.getRootPath())); for (CmsResource deleteRes : toDelete) { m_report.print( org.opencms.importexport.Messages.get().container(org.opencms.importexport.Messages.RPT_DELFOLDER_0), I_CmsReport.FORMAT_NOTE); m_report.print( org.opencms.report.Messages.get().container( org.opencms.report.Messages.RPT_ARGUMENT_1, deleteRes.getRootPath())); CmsLock lock = cms.getLock(deleteRes); if (lock.isUnlocked()) { lock(cms, deleteRes); } cms.deleteResource(deleteRes, CmsResource.DELETE_PRESERVE_SIBLINGS); m_report.println( org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0), I_CmsReport.FORMAT_OK); } } }
public class class_name { protected void processDeletions(CmsObject cms, List<CmsResource> toDelete) throws CmsException { Collections.sort(toDelete, (a, b) -> b.getRootPath().compareTo(a.getRootPath())); for (CmsResource deleteRes : toDelete) { m_report.print( org.opencms.importexport.Messages.get().container(org.opencms.importexport.Messages.RPT_DELFOLDER_0), I_CmsReport.FORMAT_NOTE); m_report.print( org.opencms.report.Messages.get().container( org.opencms.report.Messages.RPT_ARGUMENT_1, deleteRes.getRootPath())); CmsLock lock = cms.getLock(deleteRes); if (lock.isUnlocked()) { lock(cms, deleteRes); // depends on control dependency: [if], data = [none] } cms.deleteResource(deleteRes, CmsResource.DELETE_PRESERVE_SIBLINGS); m_report.println( org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0), I_CmsReport.FORMAT_OK); } } }
public class class_name { private void injectFreemarkerTags() { if(!tagsInjected){ AbstractFreeMarkerConfig freeMarkerConfig = Configuration.getFreeMarkerConfig(); Injector injector = Configuration.getInjector(); tagsInjected = true; if(injector == null || freeMarkerConfig == null){ return; } freeMarkerConfig.inject(injector); } } }
public class class_name { private void injectFreemarkerTags() { if(!tagsInjected){ AbstractFreeMarkerConfig freeMarkerConfig = Configuration.getFreeMarkerConfig(); Injector injector = Configuration.getInjector(); tagsInjected = true; // depends on control dependency: [if], data = [none] if(injector == null || freeMarkerConfig == null){ return; // depends on control dependency: [if], data = [none] } freeMarkerConfig.inject(injector); // depends on control dependency: [if], data = [none] } } }
public class class_name { public boolean set(long index, String newValue) { try { return getJedisCommands(groupName).lset(key, index, newValue).equals(RESP_OK); } finally { getJedisProvider(groupName).release(); } } }
public class class_name { public boolean set(long index, String newValue) { try { return getJedisCommands(groupName).lset(key, index, newValue).equals(RESP_OK); // depends on control dependency: [try], data = [none] } finally { getJedisProvider(groupName).release(); } } }
public class class_name { public ICredentialRepository getCredentialRepository() { if (this.credentialRepositorySearched) return this.credentialRepository; this.credentialRepositorySearched = true; ServiceLoader<ICredentialRepository> loader = ServiceLoader.load(ICredentialRepository.class); //noinspection LoopStatementThatDoesntLoop for (ICredentialRepository repository : loader) { this.credentialRepository = repository; break; } return this.credentialRepository; } }
public class class_name { public ICredentialRepository getCredentialRepository() { if (this.credentialRepositorySearched) return this.credentialRepository; this.credentialRepositorySearched = true; ServiceLoader<ICredentialRepository> loader = ServiceLoader.load(ICredentialRepository.class); //noinspection LoopStatementThatDoesntLoop for (ICredentialRepository repository : loader) { this.credentialRepository = repository; // depends on control dependency: [for], data = [repository] break; } return this.credentialRepository; } }
public class class_name { public DBObject toDBObject() { BasicDBObject cmd = new BasicDBObject(); cmd.put("mapreduce", mapReduce); cmd.put("map", map); cmd.put("reduce", reduce); if (verbose != null) { cmd.put("verbose", verbose); } BasicDBObject out = new BasicDBObject(); switch (outputType) { case INLINE: out.put("inline", 1); break; case REPLACE: out.put("replace", outputCollection); break; case MERGE: out.put("merge", outputCollection); break; case REDUCE: out.put("reduce", outputCollection); break; default: throw new IllegalArgumentException("Unexpected output type"); } if (outputDB != null) { out.put("db", outputDB); } cmd.put("out", out); if (query != null) { cmd.put("query", query); } if (finalize != null) { cmd.put("finalize", finalize); } if (sort != null) { cmd.put("sort", sort); } if (limit > 0) { cmd.put("limit", limit); } if (scope != null) { cmd.put("scope", scope); } if (jsMode != null) { cmd.put("jsMode", jsMode); } if (maxTimeMS != 0) { cmd.put("maxTimeMS", maxTimeMS); } return cmd; } }
public class class_name { public DBObject toDBObject() { BasicDBObject cmd = new BasicDBObject(); cmd.put("mapreduce", mapReduce); cmd.put("map", map); cmd.put("reduce", reduce); if (verbose != null) { cmd.put("verbose", verbose); // depends on control dependency: [if], data = [none] } BasicDBObject out = new BasicDBObject(); switch (outputType) { case INLINE: out.put("inline", 1); break; case REPLACE: out.put("replace", outputCollection); break; case MERGE: out.put("merge", outputCollection); break; case REDUCE: out.put("reduce", outputCollection); break; default: throw new IllegalArgumentException("Unexpected output type"); } if (outputDB != null) { out.put("db", outputDB); // depends on control dependency: [if], data = [none] } cmd.put("out", out); if (query != null) { cmd.put("query", query); // depends on control dependency: [if], data = [none] } if (finalize != null) { cmd.put("finalize", finalize); // depends on control dependency: [if], data = [none] } if (sort != null) { cmd.put("sort", sort); // depends on control dependency: [if], data = [none] } if (limit > 0) { cmd.put("limit", limit); // depends on control dependency: [if], data = [none] } if (scope != null) { cmd.put("scope", scope); // depends on control dependency: [if], data = [none] } if (jsMode != null) { cmd.put("jsMode", jsMode); // depends on control dependency: [if], data = [none] } if (maxTimeMS != 0) { cmd.put("maxTimeMS", maxTimeMS); // depends on control dependency: [if], data = [none] } return cmd; } }
public class class_name { public static String toQualifiedName(char[][] typeName) { int len = typeName.length - 1; // number of dots if (len == 0) return new String(typeName[0]); for (char[] c : typeName) len += c.length; char[] ret = new char[len]; char[] part = typeName[0]; System.arraycopy(part, 0, ret, 0, part.length); int pos = part.length; for (int i = 1; i < typeName.length; i++) { ret[pos++] = '.'; part = typeName[i]; System.arraycopy(part, 0, ret, pos, part.length); pos += part.length; } return new String(ret); } }
public class class_name { public static String toQualifiedName(char[][] typeName) { int len = typeName.length - 1; // number of dots if (len == 0) return new String(typeName[0]); for (char[] c : typeName) len += c.length; char[] ret = new char[len]; char[] part = typeName[0]; System.arraycopy(part, 0, ret, 0, part.length); int pos = part.length; for (int i = 1; i < typeName.length; i++) { ret[pos++] = '.'; // depends on control dependency: [for], data = [none] part = typeName[i]; // depends on control dependency: [for], data = [i] System.arraycopy(part, 0, ret, pos, part.length); // depends on control dependency: [for], data = [none] pos += part.length; // depends on control dependency: [for], data = [none] } return new String(ret); } }
public class class_name { private void checkBeginSelection(Cursor cursor, SelectorModel model) { final boolean canClick = !model.getClickableArea().contains(cursor.getScreenX(), cursor.getScreenY()); if (!model.isSelecting() && !canClick) { model.setSelecting(true); startX = cursor.getX(); startY = cursor.getY(); for (final SelectorListener listener : listeners) { listener.notifySelectionStarted(Geom.createArea(startX, startY, 0, 0)); } } } }
public class class_name { private void checkBeginSelection(Cursor cursor, SelectorModel model) { final boolean canClick = !model.getClickableArea().contains(cursor.getScreenX(), cursor.getScreenY()); if (!model.isSelecting() && !canClick) { model.setSelecting(true); // depends on control dependency: [if], data = [none] startX = cursor.getX(); // depends on control dependency: [if], data = [none] startY = cursor.getY(); // depends on control dependency: [if], data = [none] for (final SelectorListener listener : listeners) { listener.notifySelectionStarted(Geom.createArea(startX, startY, 0, 0)); // depends on control dependency: [for], data = [listener] } } } }
public class class_name { public void removeProvider(UserTransactionProvider provider) { UserTransactionProviderImpl impl = providers.get(provider); if (impl != null) { delegator.removeProvider(impl); providers.remove(provider); } } }
public class class_name { public void removeProvider(UserTransactionProvider provider) { UserTransactionProviderImpl impl = providers.get(provider); if (impl != null) { delegator.removeProvider(impl); // depends on control dependency: [if], data = [(impl] providers.remove(provider); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void collectFeatureInfos(Map<String, ProductInfo> productInfos, Map<String, FeatureInfo> featuresBySymbolicName) { ManifestFileProcessor manifestFileProcessor = new ManifestFileProcessor(); for (Map.Entry<String, Map<String, ProvisioningFeatureDefinition>> productEntry : manifestFileProcessor.getFeatureDefinitionsByProduct().entrySet()) { String productName = productEntry.getKey(); Map<String, ProvisioningFeatureDefinition> features = productEntry.getValue(); ContentBasedLocalBundleRepository repository; if (productName.equals(ManifestFileProcessor.CORE_PRODUCT_NAME)) { repository = BundleRepositoryRegistry.getInstallBundleRepository(); } else if (productName.equals(ManifestFileProcessor.USR_PRODUCT_EXT_NAME)) { repository = BundleRepositoryRegistry.getUsrInstallBundleRepository(); } else { repository = manifestFileProcessor.getBundleRepository(productName, null); } ProductInfo productInfo = new ProductInfo(repository); productInfos.put(productName, productInfo); for (Map.Entry<String, ProvisioningFeatureDefinition> featureEntry : features.entrySet()) { String featureSymbolicName = featureEntry.getKey(); ProvisioningFeatureDefinition feature = featureEntry.getValue(); FeatureInfo featureInfo = new FeatureInfo(productInfo, feature); featuresBySymbolicName.put(featureSymbolicName, featureInfo); String shortName = feature.getIbmShortName(); if (shortName != null) { productInfo.featuresByShortName.put(shortName, featureInfo); } } } } }
public class class_name { private void collectFeatureInfos(Map<String, ProductInfo> productInfos, Map<String, FeatureInfo> featuresBySymbolicName) { ManifestFileProcessor manifestFileProcessor = new ManifestFileProcessor(); for (Map.Entry<String, Map<String, ProvisioningFeatureDefinition>> productEntry : manifestFileProcessor.getFeatureDefinitionsByProduct().entrySet()) { String productName = productEntry.getKey(); Map<String, ProvisioningFeatureDefinition> features = productEntry.getValue(); ContentBasedLocalBundleRepository repository; if (productName.equals(ManifestFileProcessor.CORE_PRODUCT_NAME)) { repository = BundleRepositoryRegistry.getInstallBundleRepository(); // depends on control dependency: [if], data = [none] } else if (productName.equals(ManifestFileProcessor.USR_PRODUCT_EXT_NAME)) { repository = BundleRepositoryRegistry.getUsrInstallBundleRepository(); // depends on control dependency: [if], data = [none] } else { repository = manifestFileProcessor.getBundleRepository(productName, null); // depends on control dependency: [if], data = [none] } ProductInfo productInfo = new ProductInfo(repository); productInfos.put(productName, productInfo); // depends on control dependency: [for], data = [none] for (Map.Entry<String, ProvisioningFeatureDefinition> featureEntry : features.entrySet()) { String featureSymbolicName = featureEntry.getKey(); ProvisioningFeatureDefinition feature = featureEntry.getValue(); FeatureInfo featureInfo = new FeatureInfo(productInfo, feature); featuresBySymbolicName.put(featureSymbolicName, featureInfo); // depends on control dependency: [for], data = [none] String shortName = feature.getIbmShortName(); if (shortName != null) { productInfo.featuresByShortName.put(shortName, featureInfo); // depends on control dependency: [if], data = [(shortName] } } } } }
public class class_name { public static void printMessage (String message, boolean force) { if (isDebugEnabled () || force) { String toOutput = "log-helper DEBUG: " + message.replaceAll ("\n", "\nlog-helper DEBUG: "); System.out.println (toOutput); } } }
public class class_name { public static void printMessage (String message, boolean force) { if (isDebugEnabled () || force) { String toOutput = "log-helper DEBUG: " + message.replaceAll ("\n", "\nlog-helper DEBUG: "); System.out.println (toOutput); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected int getInternalDayFromLocation(float x, float y) { int dayStart = mEdgePadding; if (x < dayStart || x > mWidth - mEdgePadding) { return -1; } // Selection is (x - start) / (pixels/day) == (x -s) * day / pixels int row = (int) (y - getMonthHeaderSize()) / mRowHeight; int column = (int) ((x - dayStart) * mNumDays / (mWidth - dayStart - mEdgePadding)); int day = column - findDayOffset() + 1; day += row * mNumDays; return day; } }
public class class_name { protected int getInternalDayFromLocation(float x, float y) { int dayStart = mEdgePadding; if (x < dayStart || x > mWidth - mEdgePadding) { return -1; // depends on control dependency: [if], data = [none] } // Selection is (x - start) / (pixels/day) == (x -s) * day / pixels int row = (int) (y - getMonthHeaderSize()) / mRowHeight; int column = (int) ((x - dayStart) * mNumDays / (mWidth - dayStart - mEdgePadding)); int day = column - findDayOffset() + 1; day += row * mNumDays; return day; } }
public class class_name { public void setup() { LogActivator.logToFile(logger, this.getName(), Level.ALL); introspector = JadeAgentIntrospector.getMyInstance(this); // introspector.storeBeliefValue(this, Definitions.RECEIVED_MESSAGE_COUNT, 0); MockConfiguration configuration = (MockConfiguration) this.getArguments()[0]; messages = new ArrayList<ACLMessage>(); // Attemps to register the aggent. registered = false; try { AgentRegistration.registerAgent(this, configuration.getDFservice(), this.getLocalName()); registered = true; } catch(FIPAException e) { logger.warning("Exception while registring the ListenerMock"); logger.warning(e.getMessage()); // Will this show anything useful? } // Adds the behavior to store the messages. addBehaviour(new MessageReceiver()); } }
public class class_name { public void setup() { LogActivator.logToFile(logger, this.getName(), Level.ALL); introspector = JadeAgentIntrospector.getMyInstance(this); // introspector.storeBeliefValue(this, Definitions.RECEIVED_MESSAGE_COUNT, 0); MockConfiguration configuration = (MockConfiguration) this.getArguments()[0]; messages = new ArrayList<ACLMessage>(); // Attemps to register the aggent. registered = false; try { AgentRegistration.registerAgent(this, configuration.getDFservice(), this.getLocalName()); // depends on control dependency: [try], data = [none] registered = true; // depends on control dependency: [try], data = [none] } catch(FIPAException e) { logger.warning("Exception while registring the ListenerMock"); logger.warning(e.getMessage()); // Will this show anything useful? } // depends on control dependency: [catch], data = [none] // Adds the behavior to store the messages. addBehaviour(new MessageReceiver()); } }
public class class_name { public AsciiSet union(AsciiSet set) { final boolean[] unionMembers = new boolean[128]; for (int i = 0; i < unionMembers.length; ++i) { unionMembers[i] = members[i] || set.members[i]; } return new AsciiSet(unionMembers); } }
public class class_name { public AsciiSet union(AsciiSet set) { final boolean[] unionMembers = new boolean[128]; for (int i = 0; i < unionMembers.length; ++i) { unionMembers[i] = members[i] || set.members[i]; // depends on control dependency: [for], data = [i] } return new AsciiSet(unionMembers); } }
public class class_name { @Override public double getWeight(double distance, double max, double stddev) { if(max <= 0) { return 1.0; } double relativedistance = distance / max; // -2.303 is log(.1) to suit the intended range of 1.0-0.1 return FastMath.exp(-2.3025850929940455 * relativedistance * relativedistance); } }
public class class_name { @Override public double getWeight(double distance, double max, double stddev) { if(max <= 0) { return 1.0; // depends on control dependency: [if], data = [none] } double relativedistance = distance / max; // -2.303 is log(.1) to suit the intended range of 1.0-0.1 return FastMath.exp(-2.3025850929940455 * relativedistance * relativedistance); } }
public class class_name { final Table SYSTEM_PRIMARYKEYS() { Table t = sysTables[SYSTEM_PRIMARYKEYS]; if (t == null) { t = createBlankTable(sysTableHsqlNames[SYSTEM_PRIMARYKEYS]); addColumn(t, "TABLE_CAT", SQL_IDENTIFIER); addColumn(t, "TABLE_SCHEM", SQL_IDENTIFIER); addColumn(t, "TABLE_NAME", SQL_IDENTIFIER); // not null addColumn(t, "COLUMN_NAME", SQL_IDENTIFIER); // not null addColumn(t, "KEY_SEQ", Type.SQL_SMALLINT); // not null addColumn(t, "PK_NAME", SQL_IDENTIFIER); // order: COLUMN_NAME // added for unique: TABLE_NAME, TABLE_SCHEM, TABLE_CAT // false PK, as TABLE_SCHEM and/or TABLE_CAT may be null HsqlName name = HsqlNameManager.newInfoSchemaObjectName( sysTableHsqlNames[SYSTEM_PRIMARYKEYS].name, false, SchemaObject.INDEX); t.createPrimaryKey(name, new int[] { 3, 2, 1, 0 }, false); return t; } PersistentStore store = database.persistentStoreCollection.getStore(t); // calculated column values String tableCatalog; String tableSchema; String tableName; //String columnName; //Integer keySequence; String primaryKeyName; // Intermediate holders Iterator tables; Table table; Object[] row; Constraint constraint; int[] cols; int colCount; HsqlProperties p; // column number mappings final int itable_cat = 0; final int itable_schem = 1; final int itable_name = 2; final int icolumn_name = 3; final int ikey_seq = 4; final int ipk_name = 5; // Initialization p = database.getProperties(); tables = p.isPropertyTrue("hsqldb.system_table_primarykeys") ? allTables() : database.schemaManager.databaseObjectIterator( SchemaObject.TABLE); while (tables.hasNext()) { table = (Table) tables.next(); if (table.isView() || !isAccessibleTable(table) || !table.hasPrimaryKey()) { continue; } constraint = table.getPrimaryConstraint(); tableCatalog = table.getCatalogName().name; tableSchema = table.getSchemaName().name; tableName = table.getName().name; primaryKeyName = constraint.getName().name; cols = constraint.getMainColumns(); colCount = cols.length; for (int j = 0; j < colCount; j++) { row = t.getEmptyRowData(); row[itable_cat] = tableCatalog; row[itable_schem] = tableSchema; row[itable_name] = tableName; row[icolumn_name] = table.getColumn(cols[j]).getName().name; row[ikey_seq] = ValuePool.getInt(j + 1); row[ipk_name] = primaryKeyName; t.insertSys(store, row); } } return t; } }
public class class_name { final Table SYSTEM_PRIMARYKEYS() { Table t = sysTables[SYSTEM_PRIMARYKEYS]; if (t == null) { t = createBlankTable(sysTableHsqlNames[SYSTEM_PRIMARYKEYS]); // depends on control dependency: [if], data = [none] addColumn(t, "TABLE_CAT", SQL_IDENTIFIER); // depends on control dependency: [if], data = [(t] addColumn(t, "TABLE_SCHEM", SQL_IDENTIFIER); // depends on control dependency: [if], data = [(t] addColumn(t, "TABLE_NAME", SQL_IDENTIFIER); // not null // depends on control dependency: [if], data = [(t] addColumn(t, "COLUMN_NAME", SQL_IDENTIFIER); // not null // depends on control dependency: [if], data = [(t] addColumn(t, "KEY_SEQ", Type.SQL_SMALLINT); // not null // depends on control dependency: [if], data = [(t] addColumn(t, "PK_NAME", SQL_IDENTIFIER); // depends on control dependency: [if], data = [(t] // order: COLUMN_NAME // added for unique: TABLE_NAME, TABLE_SCHEM, TABLE_CAT // false PK, as TABLE_SCHEM and/or TABLE_CAT may be null HsqlName name = HsqlNameManager.newInfoSchemaObjectName( sysTableHsqlNames[SYSTEM_PRIMARYKEYS].name, false, SchemaObject.INDEX); t.createPrimaryKey(name, new int[] { 3, 2, 1, 0 }, false); // depends on control dependency: [if], data = [none] return t; // depends on control dependency: [if], data = [none] } PersistentStore store = database.persistentStoreCollection.getStore(t); // calculated column values String tableCatalog; String tableSchema; String tableName; //String columnName; //Integer keySequence; String primaryKeyName; // Intermediate holders Iterator tables; Table table; Object[] row; Constraint constraint; int[] cols; int colCount; HsqlProperties p; // column number mappings final int itable_cat = 0; final int itable_schem = 1; final int itable_name = 2; final int icolumn_name = 3; final int ikey_seq = 4; final int ipk_name = 5; // Initialization p = database.getProperties(); tables = p.isPropertyTrue("hsqldb.system_table_primarykeys") ? allTables() : database.schemaManager.databaseObjectIterator( SchemaObject.TABLE); while (tables.hasNext()) { table = (Table) tables.next(); // depends on control dependency: [while], data = [none] if (table.isView() || !isAccessibleTable(table) || !table.hasPrimaryKey()) { continue; } constraint = table.getPrimaryConstraint(); // depends on control dependency: [while], data = [none] tableCatalog = table.getCatalogName().name; // depends on control dependency: [while], data = [none] tableSchema = table.getSchemaName().name; // depends on control dependency: [while], data = [none] tableName = table.getName().name; // depends on control dependency: [while], data = [none] primaryKeyName = constraint.getName().name; // depends on control dependency: [while], data = [none] cols = constraint.getMainColumns(); // depends on control dependency: [while], data = [none] colCount = cols.length; // depends on control dependency: [while], data = [none] for (int j = 0; j < colCount; j++) { row = t.getEmptyRowData(); // depends on control dependency: [for], data = [none] row[itable_cat] = tableCatalog; // depends on control dependency: [for], data = [none] row[itable_schem] = tableSchema; // depends on control dependency: [for], data = [none] row[itable_name] = tableName; // depends on control dependency: [for], data = [none] row[icolumn_name] = table.getColumn(cols[j]).getName().name; // depends on control dependency: [for], data = [j] row[ikey_seq] = ValuePool.getInt(j + 1); // depends on control dependency: [for], data = [j] row[ipk_name] = primaryKeyName; // depends on control dependency: [for], data = [none] t.insertSys(store, row); // depends on control dependency: [for], data = [none] } } return t; } }
public class class_name { public void setTableModel(final TableModel tableModel) { getOrCreateComponentModel().tableModel = tableModel; getOrCreateComponentModel().rowIndexMapping = null; setSelectedRows(null); setExpandedRows(null); clearPrevExpandedRows(); clearPrevRenderedRows(); if (tableModel instanceof BeanBoundTableModel) { ((BeanBoundTableModel) tableModel). setBeanProvider(new BeanBoundTableModelBeanProvider(this)); ((BeanBoundTableModel) tableModel).setBeanProperty("."); } if (tableModel instanceof ScrollableTableModel) { if (!isPaginated()) { throw new IllegalStateException( "Set a ScrollableTableModel on a table that is not paginated."); } int startIndex = getCurrentPage() * getRowsPerPage(); int endIndex = startIndex + getRowsPerPage() - 1; ((ScrollableTableModel) tableModel).setCurrentRows(startIndex, endIndex); } // Flush the repeater's row contexts and scratch maps repeater.reset(); } }
public class class_name { public void setTableModel(final TableModel tableModel) { getOrCreateComponentModel().tableModel = tableModel; getOrCreateComponentModel().rowIndexMapping = null; setSelectedRows(null); setExpandedRows(null); clearPrevExpandedRows(); clearPrevRenderedRows(); if (tableModel instanceof BeanBoundTableModel) { ((BeanBoundTableModel) tableModel). setBeanProvider(new BeanBoundTableModelBeanProvider(this)); // depends on control dependency: [if], data = [none] ((BeanBoundTableModel) tableModel).setBeanProperty("."); // depends on control dependency: [if], data = [none] } if (tableModel instanceof ScrollableTableModel) { if (!isPaginated()) { throw new IllegalStateException( "Set a ScrollableTableModel on a table that is not paginated."); } int startIndex = getCurrentPage() * getRowsPerPage(); int endIndex = startIndex + getRowsPerPage() - 1; ((ScrollableTableModel) tableModel).setCurrentRows(startIndex, endIndex); // depends on control dependency: [if], data = [none] } // Flush the repeater's row contexts and scratch maps repeater.reset(); } }
public class class_name { private void addUV(String data) { String coords[] = data.split("\\s+"); float u = 0; float v = 0; if (coords.length != 2) { MalisisCore.log.error( "[ObjFileImporter] Wrong UV coordinates number {} at line {} : {}", coords.length, lineNumber, currentLine); } else { u = Float.parseFloat(coords[0]); v = 1 - Float.parseFloat(coords[1]); } uvs.add(new UV(u, v)); } }
public class class_name { private void addUV(String data) { String coords[] = data.split("\\s+"); float u = 0; float v = 0; if (coords.length != 2) { MalisisCore.log.error( "[ObjFileImporter] Wrong UV coordinates number {} at line {} : {}", coords.length, lineNumber, currentLine); // depends on control dependency: [if], data = [none] } else { u = Float.parseFloat(coords[0]); // depends on control dependency: [if], data = [none] v = 1 - Float.parseFloat(coords[1]); // depends on control dependency: [if], data = [none] } uvs.add(new UV(u, v)); } }
public class class_name { public DifferentialFunction[] functions() { List<DifferentialFunction> out = new ArrayList<>(ops.size()); for(SameDiffOp op : ops.values()){ out.add(op.getOp()); } return out.toArray(new DifferentialFunction[out.size()]); } }
public class class_name { public DifferentialFunction[] functions() { List<DifferentialFunction> out = new ArrayList<>(ops.size()); for(SameDiffOp op : ops.values()){ out.add(op.getOp()); // depends on control dependency: [for], data = [op] } return out.toArray(new DifferentialFunction[out.size()]); } }
public class class_name { public void setByteMatchTuples(java.util.Collection<ByteMatchTuple> byteMatchTuples) { if (byteMatchTuples == null) { this.byteMatchTuples = null; return; } this.byteMatchTuples = new java.util.ArrayList<ByteMatchTuple>(byteMatchTuples); } }
public class class_name { public void setByteMatchTuples(java.util.Collection<ByteMatchTuple> byteMatchTuples) { if (byteMatchTuples == null) { this.byteMatchTuples = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.byteMatchTuples = new java.util.ArrayList<ByteMatchTuple>(byteMatchTuples); } }
public class class_name { private CmsListItem createListItem(CmsResourceInfoBean resourceInfo, CmsDNDHandler dndHandler) { CmsListInfoBean infoBean = new CmsListInfoBean(); infoBean.setTitle( CmsStringUtil.isNotEmptyOrWhitespaceOnly(resourceInfo.getProperties().get(CmsClientProperty.PROPERTY_TITLE)) ? resourceInfo.getProperties().get(CmsClientProperty.PROPERTY_TITLE) : resourceInfo.getTitle()); infoBean.setSubTitle(resourceInfo.getResourcePath()); infoBean.setResourceType(resourceInfo.getResourceType()); infoBean.setBigIconClasses(resourceInfo.getBigIconClasses()); infoBean.setSmallIconClasses(resourceInfo.getSmallIconClasses()); infoBean.addAdditionalInfo(Messages.get().key(Messages.GUI_PREVIEW_LABEL_SIZE_0), resourceInfo.getSize()); if (resourceInfo.getDescription() != null) { infoBean.addAdditionalInfo( Messages.get().key(Messages.GUI_PREVIEW_LABEL_DESCRIPTION_0), resourceInfo.getDescription()); } if (resourceInfo.getLastModified() != null) { infoBean.addAdditionalInfo( Messages.get().key(Messages.GUI_PREVIEW_LABEL_DATEMODIFIED_0), CmsDateTimeUtil.getDate(resourceInfo.getLastModified(), Format.MEDIUM)); } CmsListItemWidget itemWidget = new CmsListItemWidget(infoBean); itemWidget.addOpenHandler(new OpenHandler<CmsListItemWidget>() { public void onOpen(OpenEvent<CmsListItemWidget> event) { int widgetHeight = event.getTarget().getOffsetHeight(); m_previewContent.getElement().getStyle().setTop(12 + widgetHeight, Unit.PX); } }); itemWidget.addCloseHandler(new CloseHandler<CmsListItemWidget>() { public void onClose(CloseEvent<CmsListItemWidget> event) { m_previewContent.getElement().getStyle().clearTop(); } }); CmsListItem result = new CmsListItem(itemWidget); CmsPushButton button = CmsResultListItem.createDeleteButton(); if (dndHandler != null) { result.initMoveHandle(dndHandler); } CmsResultsTab resultsTab = m_binaryPreviewHandler.getGalleryDialog().getResultsTab(); final DeleteHandler deleteHandler = resultsTab.makeDeleteHandler(resourceInfo.getResourcePath()); ClickHandler handler = new ClickHandler() { public void onClick(ClickEvent event) { deleteHandler.onClick(event); m_binaryPreviewHandler.closePreview(); } }; button.addClickHandler(handler); itemWidget.addButton(button); return result; } }
public class class_name { private CmsListItem createListItem(CmsResourceInfoBean resourceInfo, CmsDNDHandler dndHandler) { CmsListInfoBean infoBean = new CmsListInfoBean(); infoBean.setTitle( CmsStringUtil.isNotEmptyOrWhitespaceOnly(resourceInfo.getProperties().get(CmsClientProperty.PROPERTY_TITLE)) ? resourceInfo.getProperties().get(CmsClientProperty.PROPERTY_TITLE) : resourceInfo.getTitle()); infoBean.setSubTitle(resourceInfo.getResourcePath()); infoBean.setResourceType(resourceInfo.getResourceType()); infoBean.setBigIconClasses(resourceInfo.getBigIconClasses()); infoBean.setSmallIconClasses(resourceInfo.getSmallIconClasses()); infoBean.addAdditionalInfo(Messages.get().key(Messages.GUI_PREVIEW_LABEL_SIZE_0), resourceInfo.getSize()); if (resourceInfo.getDescription() != null) { infoBean.addAdditionalInfo( Messages.get().key(Messages.GUI_PREVIEW_LABEL_DESCRIPTION_0), resourceInfo.getDescription()); // depends on control dependency: [if], data = [none] } if (resourceInfo.getLastModified() != null) { infoBean.addAdditionalInfo( Messages.get().key(Messages.GUI_PREVIEW_LABEL_DATEMODIFIED_0), CmsDateTimeUtil.getDate(resourceInfo.getLastModified(), Format.MEDIUM)); // depends on control dependency: [if], data = [none] } CmsListItemWidget itemWidget = new CmsListItemWidget(infoBean); itemWidget.addOpenHandler(new OpenHandler<CmsListItemWidget>() { public void onOpen(OpenEvent<CmsListItemWidget> event) { int widgetHeight = event.getTarget().getOffsetHeight(); m_previewContent.getElement().getStyle().setTop(12 + widgetHeight, Unit.PX); } }); itemWidget.addCloseHandler(new CloseHandler<CmsListItemWidget>() { public void onClose(CloseEvent<CmsListItemWidget> event) { m_previewContent.getElement().getStyle().clearTop(); } }); CmsListItem result = new CmsListItem(itemWidget); CmsPushButton button = CmsResultListItem.createDeleteButton(); if (dndHandler != null) { result.initMoveHandle(dndHandler); // depends on control dependency: [if], data = [(dndHandler] } CmsResultsTab resultsTab = m_binaryPreviewHandler.getGalleryDialog().getResultsTab(); final DeleteHandler deleteHandler = resultsTab.makeDeleteHandler(resourceInfo.getResourcePath()); ClickHandler handler = new ClickHandler() { public void onClick(ClickEvent event) { deleteHandler.onClick(event); m_binaryPreviewHandler.closePreview(); } }; button.addClickHandler(handler); itemWidget.addButton(button); return result; } }
public class class_name { protected OAuthToken getOAuthTokenFromRequest(final HttpServletRequest request) { val token = getOAuthConfigurationContext().getTicketRegistry().getTicket(getOAuthParameter(request), OAuthToken.class); if (token == null || token.isExpired()) { LOGGER.error("OAuth token indicated by parameter [{}] has expired or not found: [{}]", getOAuthParameter(request), token); if (token != null) { getOAuthConfigurationContext().getTicketRegistry().deleteTicket(token.getId()); } return null; } return token; } }
public class class_name { protected OAuthToken getOAuthTokenFromRequest(final HttpServletRequest request) { val token = getOAuthConfigurationContext().getTicketRegistry().getTicket(getOAuthParameter(request), OAuthToken.class); if (token == null || token.isExpired()) { LOGGER.error("OAuth token indicated by parameter [{}] has expired or not found: [{}]", getOAuthParameter(request), token); // depends on control dependency: [if], data = [none] if (token != null) { getOAuthConfigurationContext().getTicketRegistry().deleteTicket(token.getId()); // depends on control dependency: [if], data = [(token] } return null; // depends on control dependency: [if], data = [none] } return token; } }
public class class_name { public Observable<ServiceResponse<RecoveryWalkResponseInner>> forceRecoveryServiceFabricPlatformUpdateDomainWalkWithServiceResponseAsync(String resourceGroupName, String vmScaleSetName, int platformUpdateDomain) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (vmScaleSetName == null) { throw new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.forceRecoveryServiceFabricPlatformUpdateDomainWalk(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), this.client.apiVersion(), platformUpdateDomain, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<RecoveryWalkResponseInner>>>() { @Override public Observable<ServiceResponse<RecoveryWalkResponseInner>> call(Response<ResponseBody> response) { try { ServiceResponse<RecoveryWalkResponseInner> clientResponse = forceRecoveryServiceFabricPlatformUpdateDomainWalkDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } }
public class class_name { public Observable<ServiceResponse<RecoveryWalkResponseInner>> forceRecoveryServiceFabricPlatformUpdateDomainWalkWithServiceResponseAsync(String resourceGroupName, String vmScaleSetName, int platformUpdateDomain) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (vmScaleSetName == null) { throw new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.forceRecoveryServiceFabricPlatformUpdateDomainWalk(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), this.client.apiVersion(), platformUpdateDomain, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<RecoveryWalkResponseInner>>>() { @Override public Observable<ServiceResponse<RecoveryWalkResponseInner>> call(Response<ResponseBody> response) { try { ServiceResponse<RecoveryWalkResponseInner> clientResponse = forceRecoveryServiceFabricPlatformUpdateDomainWalkDelegate(response); return Observable.just(clientResponse); // depends on control dependency: [try], data = [none] } catch (Throwable t) { return Observable.error(t); } // depends on control dependency: [catch], data = [none] } }); } }
public class class_name { public void updateContentList(List<CmsTreeItem> treeItemsToShow) { m_scrollList.clearList(); if ((treeItemsToShow != null) && !treeItemsToShow.isEmpty()) { for (CmsTreeItem dataValue : treeItemsToShow) { dataValue.removeOpener(); m_scrollList.add(dataValue); CmsScrollPanel scrollparent = (CmsScrollPanel)m_scrollList.getParent(); scrollparent.onResizeDescendant(); } } else { showIsEmptyLabel(); } scheduleResize(); } }
public class class_name { public void updateContentList(List<CmsTreeItem> treeItemsToShow) { m_scrollList.clearList(); if ((treeItemsToShow != null) && !treeItemsToShow.isEmpty()) { for (CmsTreeItem dataValue : treeItemsToShow) { dataValue.removeOpener(); // depends on control dependency: [for], data = [dataValue] m_scrollList.add(dataValue); // depends on control dependency: [for], data = [dataValue] CmsScrollPanel scrollparent = (CmsScrollPanel)m_scrollList.getParent(); scrollparent.onResizeDescendant(); // depends on control dependency: [for], data = [none] } } else { showIsEmptyLabel(); // depends on control dependency: [if], data = [none] } scheduleResize(); } }
public class class_name { private void buildMappings(final CronDefinition from, final CronDefinition to) { final Map<CronFieldName, FieldDefinition> sourceFieldDefinitions = getFieldDefinitions(from); final Map<CronFieldName, FieldDefinition> destFieldDefinitions = getFieldDefinitions(to); boolean startedDestMapping = false; boolean startedSourceMapping = false; for (final CronFieldName name : CronFieldName.values()) { final FieldDefinition destinationFieldDefinition = destFieldDefinitions.get(name); final FieldDefinition sourceFieldDefinition = sourceFieldDefinitions.get(name); if (destinationFieldDefinition != null) { startedDestMapping = true; } if (sourceFieldDefinition != null) { startedSourceMapping = true; } if (startedDestMapping && destinationFieldDefinition == null) { break; } //destination has fields before source definition starts. We default them to zero. if (!startedSourceMapping && destinationFieldDefinition != null) { mappings.put(name, returnOnZeroExpression(name)); } //destination has fields after source definition was processed. We default them to always. if (startedSourceMapping && sourceFieldDefinition == null && destinationFieldDefinition != null) { mappings.put(name, returnAlwaysExpression(name)); } if (sourceFieldDefinition == null || destinationFieldDefinition == null) { continue; } if (CronFieldName.DAY_OF_WEEK.equals(name)) { mappings.put(name, dayOfWeekMapping((DayOfWeekFieldDefinition) sourceFieldDefinition, (DayOfWeekFieldDefinition) destinationFieldDefinition)); } else if (CronFieldName.DAY_OF_MONTH.equals(name)) { mappings.put(name, dayOfMonthMapping(sourceFieldDefinition, destinationFieldDefinition)); } else { mappings.put(name, returnSameExpression()); } } } }
public class class_name { private void buildMappings(final CronDefinition from, final CronDefinition to) { final Map<CronFieldName, FieldDefinition> sourceFieldDefinitions = getFieldDefinitions(from); final Map<CronFieldName, FieldDefinition> destFieldDefinitions = getFieldDefinitions(to); boolean startedDestMapping = false; boolean startedSourceMapping = false; for (final CronFieldName name : CronFieldName.values()) { final FieldDefinition destinationFieldDefinition = destFieldDefinitions.get(name); final FieldDefinition sourceFieldDefinition = sourceFieldDefinitions.get(name); if (destinationFieldDefinition != null) { startedDestMapping = true; // depends on control dependency: [if], data = [none] } if (sourceFieldDefinition != null) { startedSourceMapping = true; // depends on control dependency: [if], data = [none] } if (startedDestMapping && destinationFieldDefinition == null) { break; } //destination has fields before source definition starts. We default them to zero. if (!startedSourceMapping && destinationFieldDefinition != null) { mappings.put(name, returnOnZeroExpression(name)); // depends on control dependency: [if], data = [none] } //destination has fields after source definition was processed. We default them to always. if (startedSourceMapping && sourceFieldDefinition == null && destinationFieldDefinition != null) { mappings.put(name, returnAlwaysExpression(name)); // depends on control dependency: [if], data = [none] } if (sourceFieldDefinition == null || destinationFieldDefinition == null) { continue; } if (CronFieldName.DAY_OF_WEEK.equals(name)) { mappings.put(name, dayOfWeekMapping((DayOfWeekFieldDefinition) sourceFieldDefinition, (DayOfWeekFieldDefinition) destinationFieldDefinition)); // depends on control dependency: [if], data = [none] } else if (CronFieldName.DAY_OF_MONTH.equals(name)) { mappings.put(name, dayOfMonthMapping(sourceFieldDefinition, destinationFieldDefinition)); // depends on control dependency: [if], data = [none] } else { mappings.put(name, returnSameExpression()); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public Address createAddress(URI uri) { if (logger.isDebugEnabled()) { logger.debug("Creating Address fromm URI[" + uri.toString() + "]"); } URIImpl uriImpl = (URIImpl) uri; return new AddressImpl(SipFactoryImpl.addressFactory .createAddress(uriImpl.getURI()), null, ModifiableRule.Modifiable); } }
public class class_name { public Address createAddress(URI uri) { if (logger.isDebugEnabled()) { logger.debug("Creating Address fromm URI[" + uri.toString() + "]"); // depends on control dependency: [if], data = [none] } URIImpl uriImpl = (URIImpl) uri; return new AddressImpl(SipFactoryImpl.addressFactory .createAddress(uriImpl.getURI()), null, ModifiableRule.Modifiable); } }