code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public static boolean intersectLineCircle(float a, float b, float c, float centerX, float centerY, float radius, Vector3f intersectionCenterAndHL) { float invDenom = 1.0f / (float) Math.sqrt(a * a + b * b); float dist = (a * centerX + b * centerY + c) * invDenom; if (-radius <= dist && dist <= radius) { intersectionCenterAndHL.x = centerX + dist * a * invDenom; intersectionCenterAndHL.y = centerY + dist * b * invDenom; intersectionCenterAndHL.z = (float) Math.sqrt(radius * radius - dist * dist); return true; } return false; } }
public class class_name { public static boolean intersectLineCircle(float a, float b, float c, float centerX, float centerY, float radius, Vector3f intersectionCenterAndHL) { float invDenom = 1.0f / (float) Math.sqrt(a * a + b * b); float dist = (a * centerX + b * centerY + c) * invDenom; if (-radius <= dist && dist <= radius) { intersectionCenterAndHL.x = centerX + dist * a * invDenom; // depends on control dependency: [if], data = [none] intersectionCenterAndHL.y = centerY + dist * b * invDenom; // depends on control dependency: [if], data = [none] intersectionCenterAndHL.z = (float) Math.sqrt(radius * radius - dist * dist); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { void handleFileItemClick(ItemClickEvent event) { if (isEditing()) { stopEdit(); } else if (!event.isCtrlKey() && !event.isShiftKey()) { // don't interfere with multi-selection using control key String itemId = (String)event.getItemId(); CmsUUID structureId = getUUIDFromItemID(itemId); boolean openedFolder = false; if (event.getButton().equals(MouseButton.RIGHT)) { handleSelection(itemId); openContextMenu(event); } else { if ((event.getPropertyId() == null) || CmsResourceTableProperty.PROPERTY_TYPE_ICON.equals(event.getPropertyId())) { handleSelection(itemId); openContextMenu(event); } else { if (m_actionColumnProperty.equals(event.getPropertyId())) { Boolean isFolder = (Boolean)event.getItem().getItemProperty( CmsResourceTableProperty.PROPERTY_IS_FOLDER).getValue(); if ((isFolder != null) && isFolder.booleanValue()) { if (m_folderSelectHandler != null) { m_folderSelectHandler.onFolderSelect(structureId); } openedFolder = true; } else { try { CmsObject cms = A_CmsUI.getCmsObject(); CmsResource res = cms.readResource(structureId, CmsResourceFilter.IGNORE_EXPIRATION); m_currentResources = Collections.singletonList(res); I_CmsDialogContext context = m_contextProvider.getDialogContext(); I_CmsDefaultAction action = OpenCms.getWorkplaceAppManager().getDefaultAction( context, m_menuBuilder); if (action != null) { action.executeAction(context); return; } } catch (CmsVfsResourceNotFoundException e) { LOG.info(e.getLocalizedMessage(), e); } catch (CmsException e) { LOG.error(e.getLocalizedMessage(), e); } } } else { I_CmsDialogContext context = m_contextProvider.getDialogContext(); if ((m_currentResources.size() == 1) && m_currentResources.get(0).getStructureId().equals(structureId) && (context instanceof I_CmsEditPropertyContext) && ((I_CmsEditPropertyContext)context).isPropertyEditable(event.getPropertyId())) { ((I_CmsEditPropertyContext)context).editProperty(event.getPropertyId()); } } } } // update the item on click to show any available changes if (!openedFolder) { update(Collections.singletonList(structureId), false); } } } }
public class class_name { void handleFileItemClick(ItemClickEvent event) { if (isEditing()) { stopEdit(); // depends on control dependency: [if], data = [none] } else if (!event.isCtrlKey() && !event.isShiftKey()) { // don't interfere with multi-selection using control key String itemId = (String)event.getItemId(); CmsUUID structureId = getUUIDFromItemID(itemId); boolean openedFolder = false; if (event.getButton().equals(MouseButton.RIGHT)) { handleSelection(itemId); // depends on control dependency: [if], data = [none] openContextMenu(event); // depends on control dependency: [if], data = [none] } else { if ((event.getPropertyId() == null) || CmsResourceTableProperty.PROPERTY_TYPE_ICON.equals(event.getPropertyId())) { handleSelection(itemId); // depends on control dependency: [if], data = [none] openContextMenu(event); // depends on control dependency: [if], data = [none] } else { if (m_actionColumnProperty.equals(event.getPropertyId())) { Boolean isFolder = (Boolean)event.getItem().getItemProperty( CmsResourceTableProperty.PROPERTY_IS_FOLDER).getValue(); if ((isFolder != null) && isFolder.booleanValue()) { if (m_folderSelectHandler != null) { m_folderSelectHandler.onFolderSelect(structureId); // depends on control dependency: [if], data = [none] } openedFolder = true; // depends on control dependency: [if], data = [none] } else { try { CmsObject cms = A_CmsUI.getCmsObject(); CmsResource res = cms.readResource(structureId, CmsResourceFilter.IGNORE_EXPIRATION); m_currentResources = Collections.singletonList(res); // depends on control dependency: [try], data = [none] I_CmsDialogContext context = m_contextProvider.getDialogContext(); I_CmsDefaultAction action = OpenCms.getWorkplaceAppManager().getDefaultAction( context, m_menuBuilder); if (action != null) { action.executeAction(context); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } } catch (CmsVfsResourceNotFoundException e) { LOG.info(e.getLocalizedMessage(), e); } catch (CmsException e) { // depends on control dependency: [catch], data = [none] LOG.error(e.getLocalizedMessage(), e); } // depends on control dependency: [catch], data = [none] } } else { I_CmsDialogContext context = m_contextProvider.getDialogContext(); if ((m_currentResources.size() == 1) && m_currentResources.get(0).getStructureId().equals(structureId) && (context instanceof I_CmsEditPropertyContext) && ((I_CmsEditPropertyContext)context).isPropertyEditable(event.getPropertyId())) { ((I_CmsEditPropertyContext)context).editProperty(event.getPropertyId()); // depends on control dependency: [if], data = [none] } } } } // update the item on click to show any available changes if (!openedFolder) { update(Collections.singletonList(structureId), false); // depends on control dependency: [if], data = [none] } } } }
public class class_name { @Override protected void parse(Node node) { NamedNodeMap attributes = node.getAttributes(); version = getValueRecursive(attributes.getNamedItem("version")); tilemapservice = getValueRecursive(attributes.getNamedItem("tilemapservice")); NodeList childNodes = node.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { Node child = childNodes.item(i); String nodeName = child.getNodeName(); if ("Title".equalsIgnoreCase(nodeName)) { title = getValueRecursive(child); } else if ("Abstract".equalsIgnoreCase(nodeName)) { abstractt = getValueRecursive(child); } else if ("SRS".equalsIgnoreCase(nodeName)) { srs = getValueRecursive(child); } else if ("BoundingBox".equalsIgnoreCase(nodeName)) { boundingBox = getBoundingBox(child); } else if ("Origin".equalsIgnoreCase(nodeName)) { origin = getCoordinate(child); } else if ("TileFormat".equalsIgnoreCase(nodeName)) { tileFormat = new TileFormatInfo100(child); } else if ("TileSets".equalsIgnoreCase(nodeName)) { addTileSets(child); } } if (title == null) { throw new IllegalArgumentException("Cannot parse XML into a TileMapInfo object."); } setParsed(true); } }
public class class_name { @Override protected void parse(Node node) { NamedNodeMap attributes = node.getAttributes(); version = getValueRecursive(attributes.getNamedItem("version")); tilemapservice = getValueRecursive(attributes.getNamedItem("tilemapservice")); NodeList childNodes = node.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { Node child = childNodes.item(i); String nodeName = child.getNodeName(); if ("Title".equalsIgnoreCase(nodeName)) { title = getValueRecursive(child); // depends on control dependency: [if], data = [none] } else if ("Abstract".equalsIgnoreCase(nodeName)) { abstractt = getValueRecursive(child); // depends on control dependency: [if], data = [none] } else if ("SRS".equalsIgnoreCase(nodeName)) { srs = getValueRecursive(child); // depends on control dependency: [if], data = [none] } else if ("BoundingBox".equalsIgnoreCase(nodeName)) { boundingBox = getBoundingBox(child); // depends on control dependency: [if], data = [none] } else if ("Origin".equalsIgnoreCase(nodeName)) { origin = getCoordinate(child); // depends on control dependency: [if], data = [none] } else if ("TileFormat".equalsIgnoreCase(nodeName)) { tileFormat = new TileFormatInfo100(child); // depends on control dependency: [if], data = [none] } else if ("TileSets".equalsIgnoreCase(nodeName)) { addTileSets(child); // depends on control dependency: [if], data = [none] } } if (title == null) { throw new IllegalArgumentException("Cannot parse XML into a TileMapInfo object."); } setParsed(true); } }
public class class_name { @Override public MultiDataSet next() { val features = new ArrayList<INDArray>(); val labels = new ArrayList<INDArray>(); val featuresMask = new ArrayList<INDArray>(); val labelsMask = new ArrayList<INDArray>(); boolean hasFM = false; boolean hasLM = false; int cnt = 0; for (val i: iterators) { val ds = i.next(); features.add(ds.getFeatures()); featuresMask.add(ds.getFeaturesMaskArray()); if (outcome < 0 || cnt == outcome) { labels.add(ds.getLabels()); labelsMask.add(ds.getLabelsMaskArray()); } if (ds.getFeaturesMaskArray() != null) hasFM = true; if (ds.getLabelsMaskArray() != null) hasLM = true; cnt++; } INDArray[] fm = hasFM ? featuresMask.toArray(new INDArray[0]) : null; INDArray[] lm = hasLM ? labelsMask.toArray(new INDArray[0]) : null; val mds = new org.nd4j.linalg.dataset.MultiDataSet(features.toArray(new INDArray[0]), labels.toArray(new INDArray[0]), fm, lm); if (preProcessor != null) preProcessor.preProcess(mds); return mds; } }
public class class_name { @Override public MultiDataSet next() { val features = new ArrayList<INDArray>(); val labels = new ArrayList<INDArray>(); val featuresMask = new ArrayList<INDArray>(); val labelsMask = new ArrayList<INDArray>(); boolean hasFM = false; boolean hasLM = false; int cnt = 0; for (val i: iterators) { val ds = i.next(); features.add(ds.getFeatures()); // depends on control dependency: [for], data = [none] featuresMask.add(ds.getFeaturesMaskArray()); // depends on control dependency: [for], data = [none] if (outcome < 0 || cnt == outcome) { labels.add(ds.getLabels()); // depends on control dependency: [if], data = [none] labelsMask.add(ds.getLabelsMaskArray()); // depends on control dependency: [if], data = [none] } if (ds.getFeaturesMaskArray() != null) hasFM = true; if (ds.getLabelsMaskArray() != null) hasLM = true; cnt++; // depends on control dependency: [for], data = [none] } INDArray[] fm = hasFM ? featuresMask.toArray(new INDArray[0]) : null; INDArray[] lm = hasLM ? labelsMask.toArray(new INDArray[0]) : null; val mds = new org.nd4j.linalg.dataset.MultiDataSet(features.toArray(new INDArray[0]), labels.toArray(new INDArray[0]), fm, lm); if (preProcessor != null) preProcessor.preProcess(mds); return mds; } }
public class class_name { public TerminateDriverFlyweight tokenBuffer( final DirectBuffer tokenBuffer, final int tokenOffset, final int tokenLength) { buffer.putInt(TOKEN_LENGTH_OFFSET, tokenLength); if (null != tokenBuffer && tokenLength > 0) { buffer.putBytes(tokenBufferOffset(), tokenBuffer, tokenOffset, tokenLength); } return this; } }
public class class_name { public TerminateDriverFlyweight tokenBuffer( final DirectBuffer tokenBuffer, final int tokenOffset, final int tokenLength) { buffer.putInt(TOKEN_LENGTH_OFFSET, tokenLength); if (null != tokenBuffer && tokenLength > 0) { buffer.putBytes(tokenBufferOffset(), tokenBuffer, tokenOffset, tokenLength); // depends on control dependency: [if], data = [none] } return this; } }
public class class_name { static void releaseInstance(final StatefulSessionComponentInstance instance, boolean toDiscard) { try { if (!instance.isDiscarded() && !toDiscard) { // mark the SFSB instance as no longer in use instance.getComponent().getCache().release(instance); } } finally { instance.setSynchronizationRegistered(false); // release the lock on the SFSB instance releaseLock(instance); } } }
public class class_name { static void releaseInstance(final StatefulSessionComponentInstance instance, boolean toDiscard) { try { if (!instance.isDiscarded() && !toDiscard) { // mark the SFSB instance as no longer in use instance.getComponent().getCache().release(instance); // depends on control dependency: [if], data = [none] } } finally { instance.setSynchronizationRegistered(false); // release the lock on the SFSB instance releaseLock(instance); } } }
public class class_name { @SuppressWarnings("PMD.AvoidDeeplyNestedIfStmts") private @Nullable V getOrLoad(K key) { boolean statsEnabled = statistics.isEnabled(); long start = statsEnabled ? ticker.read() : 0L; long millis = 0L; Expirable<V> expirable = cache.getIfPresent(key); if ((expirable != null) && !expirable.isEternal()) { millis = nanosToMillis((start == 0L) ? ticker.read() : start); if (expirable.hasExpired(millis)) { Expirable<V> expired = expirable; cache.asMap().computeIfPresent(key, (k, e) -> { if (e == expired) { dispatcher.publishExpired(this, key, expired.get()); statistics.recordEvictions(1); return null; } return e; }); expirable = null; } } if (expirable == null) { expirable = cache.get(key); statistics.recordMisses(1L); } else { statistics.recordHits(1L); } V value = null; if (expirable != null) { setAccessExpirationTime(expirable, millis); value = copyValue(expirable); } if (statsEnabled) { statistics.recordGetTime(ticker.read() - start); } return value; } }
public class class_name { @SuppressWarnings("PMD.AvoidDeeplyNestedIfStmts") private @Nullable V getOrLoad(K key) { boolean statsEnabled = statistics.isEnabled(); long start = statsEnabled ? ticker.read() : 0L; long millis = 0L; Expirable<V> expirable = cache.getIfPresent(key); if ((expirable != null) && !expirable.isEternal()) { millis = nanosToMillis((start == 0L) ? ticker.read() : start); // depends on control dependency: [if], data = [none] if (expirable.hasExpired(millis)) { Expirable<V> expired = expirable; cache.asMap().computeIfPresent(key, (k, e) -> { if (e == expired) { dispatcher.publishExpired(this, key, expired.get()); // depends on control dependency: [if], data = [none] statistics.recordEvictions(1); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } return e; }); expirable = null; // depends on control dependency: [if], data = [none] } } if (expirable == null) { expirable = cache.get(key); // depends on control dependency: [if], data = [none] statistics.recordMisses(1L); // depends on control dependency: [if], data = [none] } else { statistics.recordHits(1L); // depends on control dependency: [if], data = [none] } V value = null; if (expirable != null) { setAccessExpirationTime(expirable, millis); // depends on control dependency: [if], data = [(expirable] value = copyValue(expirable); // depends on control dependency: [if], data = [(expirable] } if (statsEnabled) { statistics.recordGetTime(ticker.read() - start); // depends on control dependency: [if], data = [none] } return value; } }
public class class_name { private List<CmsSelectWidgetOption> createComboConfigurationEncodingChoice() { List<CmsSelectWidgetOption> result = new LinkedList<CmsSelectWidgetOption>(); SortedMap<String, Charset> csMap = Charset.availableCharsets(); // default charset: see http://java.sun.com/j2se/corejava/intl/reference/faqs/index.html#default-encoding // before java 1.5 there is no other way (System property "file.encoding" is implementation detail not in vmspec. Charset defaultCs = Charset.forName(new OutputStreamWriter(new ByteArrayOutputStream()).getEncoding()); Charset cs; Iterator<Charset> it = csMap.values().iterator(); while (it.hasNext()) { cs = it.next(); // default? no equals required: safety by design! if (cs == defaultCs) { result.add( new CmsSelectWidgetOption( cs.name(), true, null, key(Messages.GUI_WORKPLACE_LOGVIEW_FILE_CHARSET_DEF_HELP_0))); } else { if (!cs.name().startsWith("x")) { result.add( new CmsSelectWidgetOption( cs.name(), false, null, key(Messages.GUI_WORKPLACE_LOGVIEW_FILE_CHARSET_HELP_0))); } } } return result; } }
public class class_name { private List<CmsSelectWidgetOption> createComboConfigurationEncodingChoice() { List<CmsSelectWidgetOption> result = new LinkedList<CmsSelectWidgetOption>(); SortedMap<String, Charset> csMap = Charset.availableCharsets(); // default charset: see http://java.sun.com/j2se/corejava/intl/reference/faqs/index.html#default-encoding // before java 1.5 there is no other way (System property "file.encoding" is implementation detail not in vmspec. Charset defaultCs = Charset.forName(new OutputStreamWriter(new ByteArrayOutputStream()).getEncoding()); Charset cs; Iterator<Charset> it = csMap.values().iterator(); while (it.hasNext()) { cs = it.next(); // depends on control dependency: [while], data = [none] // default? no equals required: safety by design! if (cs == defaultCs) { result.add( new CmsSelectWidgetOption( cs.name(), true, null, key(Messages.GUI_WORKPLACE_LOGVIEW_FILE_CHARSET_DEF_HELP_0))); // depends on control dependency: [if], data = [none] } else { if (!cs.name().startsWith("x")) { result.add( new CmsSelectWidgetOption( cs.name(), false, null, key(Messages.GUI_WORKPLACE_LOGVIEW_FILE_CHARSET_HELP_0))); // depends on control dependency: [if], data = [none] } } } return result; } }
public class class_name { public static void enableHelpKey (Component component, String id) { if (component instanceof JComponent) { JComponent jComponent = (JComponent) component; if (componentsWithHelp == null) { componentsWithHelp = new WeakHashMap<>(); } componentsWithHelp.put(jComponent, id); } if (hb != null) { hb.enableHelp(component, id, hs); } } }
public class class_name { public static void enableHelpKey (Component component, String id) { if (component instanceof JComponent) { JComponent jComponent = (JComponent) component; if (componentsWithHelp == null) { componentsWithHelp = new WeakHashMap<>(); // depends on control dependency: [if], data = [none] } componentsWithHelp.put(jComponent, id); // depends on control dependency: [if], data = [none] } if (hb != null) { hb.enableHelp(component, id, hs); // depends on control dependency: [if], data = [none] } } }
public class class_name { private synchronized PrintStream getPrintStream(long numNewChars) { switch (currentStatus) { case INIT: if (!newLogsOnStart) { // Check if we can fill into an existing file (including a new log header). File primaryFile = getPrimaryFile(); if (primaryFile.exists()) { // If maxFileSize is set in bootstrap.properties, then maxFileSizeBytes will have been // updated before this INIT check to that value; otherwise, if maxFileSize was not // set (i.e. default) or it was set in server.xml, then config processing hasn't run // yet, so maxFileSizeBytes will be 0 (there will be an `update` call later). In the // latter case, this means that we might add the logging header (about 1KB) plus // any other messages up until that size update, meaning that we could go // over the configured maxFileSize by a little bit, but this is okay. In that case, // maxFileSizeBytes will be 0, so we'll fill the existing file, and then later on, // it'll roll over if needed. if (maxFileSizeBytes <= 0 || primaryFile.length() + logHeader.length() + numNewChars <= maxFileSizeBytes) { // There's space, so print the header and return the stream. return getPrimaryStream(true); } } } return createStream(true); case ACTIVE: if (maxFileSizeBytes > 0) { long bytesWritten = currentCountingStream.count(); // Replace the stream if the size is or will likely be // exceeded. We're estimating one byte per char, which is // only accurate for single-byte character sets. That's // fine: if a multi-byte character set is being used and // we underestimate the number of bytes that will be // written, we'll roll the log next time. if (bytesWritten + numNewChars > maxFileSizeBytes) return createStream(true); } break; case CLOSED: if (checkTime == null) { checkTime = Long.valueOf(Calendar.getInstance().getTimeInMillis()); } else { long currentTime = Calendar.getInstance().getTimeInMillis(); // try to create stream again for every 5 seconds if (currentTime - checkTime.longValue() > 5000L) { checkTime = Long.valueOf(currentTime); // show error for every 10 minutes boolean showError = (retryTime == null) || (currentTime - retryTime.longValue() > 600000L); if (showError) retryTime = Long.valueOf(currentTime); PrintStream ps = createStream(showError); if (this.currentStatus == StreamStatus.ACTIVE) { // stream successfully created Tr.audit(getTc(), "LOG_FILE_RESUMED", new Object[] { getPrimaryFile().getAbsolutePath() }); this.checkTime = null; this.retryTime = null; } return ps; } } } return currentPrintStream; } }
public class class_name { private synchronized PrintStream getPrintStream(long numNewChars) { switch (currentStatus) { case INIT: if (!newLogsOnStart) { // Check if we can fill into an existing file (including a new log header). File primaryFile = getPrimaryFile(); if (primaryFile.exists()) { // If maxFileSize is set in bootstrap.properties, then maxFileSizeBytes will have been // updated before this INIT check to that value; otherwise, if maxFileSize was not // set (i.e. default) or it was set in server.xml, then config processing hasn't run // yet, so maxFileSizeBytes will be 0 (there will be an `update` call later). In the // latter case, this means that we might add the logging header (about 1KB) plus // any other messages up until that size update, meaning that we could go // over the configured maxFileSize by a little bit, but this is okay. In that case, // maxFileSizeBytes will be 0, so we'll fill the existing file, and then later on, // it'll roll over if needed. if (maxFileSizeBytes <= 0 || primaryFile.length() + logHeader.length() + numNewChars <= maxFileSizeBytes) { // There's space, so print the header and return the stream. return getPrimaryStream(true); // depends on control dependency: [if], data = [none] } } } return createStream(true); case ACTIVE: if (maxFileSizeBytes > 0) { long bytesWritten = currentCountingStream.count(); // Replace the stream if the size is or will likely be // exceeded. We're estimating one byte per char, which is // only accurate for single-byte character sets. That's // fine: if a multi-byte character set is being used and // we underestimate the number of bytes that will be // written, we'll roll the log next time. if (bytesWritten + numNewChars > maxFileSizeBytes) return createStream(true); } break; case CLOSED: if (checkTime == null) { checkTime = Long.valueOf(Calendar.getInstance().getTimeInMillis()); // depends on control dependency: [if], data = [none] } else { long currentTime = Calendar.getInstance().getTimeInMillis(); // try to create stream again for every 5 seconds if (currentTime - checkTime.longValue() > 5000L) { checkTime = Long.valueOf(currentTime); // depends on control dependency: [if], data = [none] // show error for every 10 minutes boolean showError = (retryTime == null) || (currentTime - retryTime.longValue() > 600000L); if (showError) retryTime = Long.valueOf(currentTime); PrintStream ps = createStream(showError); if (this.currentStatus == StreamStatus.ACTIVE) { // stream successfully created Tr.audit(getTc(), "LOG_FILE_RESUMED", new Object[] { getPrimaryFile().getAbsolutePath() }); // depends on control dependency: [if], data = [none] this.checkTime = null; // depends on control dependency: [if], data = [none] this.retryTime = null; // depends on control dependency: [if], data = [none] } return ps; // depends on control dependency: [if], data = [none] } } } return currentPrintStream; } }
public class class_name { public void marshall(InitiateDocumentVersionUploadRequest initiateDocumentVersionUploadRequest, ProtocolMarshaller protocolMarshaller) { if (initiateDocumentVersionUploadRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(initiateDocumentVersionUploadRequest.getAuthenticationToken(), AUTHENTICATIONTOKEN_BINDING); protocolMarshaller.marshall(initiateDocumentVersionUploadRequest.getId(), ID_BINDING); protocolMarshaller.marshall(initiateDocumentVersionUploadRequest.getName(), NAME_BINDING); protocolMarshaller.marshall(initiateDocumentVersionUploadRequest.getContentCreatedTimestamp(), CONTENTCREATEDTIMESTAMP_BINDING); protocolMarshaller.marshall(initiateDocumentVersionUploadRequest.getContentModifiedTimestamp(), CONTENTMODIFIEDTIMESTAMP_BINDING); protocolMarshaller.marshall(initiateDocumentVersionUploadRequest.getContentType(), CONTENTTYPE_BINDING); protocolMarshaller.marshall(initiateDocumentVersionUploadRequest.getDocumentSizeInBytes(), DOCUMENTSIZEINBYTES_BINDING); protocolMarshaller.marshall(initiateDocumentVersionUploadRequest.getParentFolderId(), PARENTFOLDERID_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(InitiateDocumentVersionUploadRequest initiateDocumentVersionUploadRequest, ProtocolMarshaller protocolMarshaller) { if (initiateDocumentVersionUploadRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(initiateDocumentVersionUploadRequest.getAuthenticationToken(), AUTHENTICATIONTOKEN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(initiateDocumentVersionUploadRequest.getId(), ID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(initiateDocumentVersionUploadRequest.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(initiateDocumentVersionUploadRequest.getContentCreatedTimestamp(), CONTENTCREATEDTIMESTAMP_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(initiateDocumentVersionUploadRequest.getContentModifiedTimestamp(), CONTENTMODIFIEDTIMESTAMP_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(initiateDocumentVersionUploadRequest.getContentType(), CONTENTTYPE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(initiateDocumentVersionUploadRequest.getDocumentSizeInBytes(), DOCUMENTSIZEINBYTES_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(initiateDocumentVersionUploadRequest.getParentFolderId(), PARENTFOLDERID_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static boolean isPrimes(int n) { Assert.isTrue(n > 1, "The number must be > 1"); for (int i = 2; i <= Math.sqrt(n); i++) { if (n % i == 0) { return false; } } return true; } }
public class class_name { public static boolean isPrimes(int n) { Assert.isTrue(n > 1, "The number must be > 1"); for (int i = 2; i <= Math.sqrt(n); i++) { if (n % i == 0) { return false; // depends on control dependency: [if], data = [none] } } return true; } }
public class class_name { private void checkMultiLevelKeys(final Map<String, KeyDef> keysDefMap, final Map<String, String> keysRefMap) { String key; KeyDef value; // tempMap storing values to avoid ConcurrentModificationException final Map<String, KeyDef> tempMap = new HashMap<>(); for (Entry<String, KeyDef> entry : keysDefMap.entrySet()) { key = entry.getKey(); value = entry.getValue(); // there is multi-level keys exist. if (keysRefMap.containsValue(key)) { // get multi-level keys final List<String> keysList = getKeysList(key, keysRefMap); for (final String multikey : keysList) { // update tempMap tempMap.put(multikey, value); } } } // update keysDefMap. keysDefMap.putAll(tempMap); } }
public class class_name { private void checkMultiLevelKeys(final Map<String, KeyDef> keysDefMap, final Map<String, String> keysRefMap) { String key; KeyDef value; // tempMap storing values to avoid ConcurrentModificationException final Map<String, KeyDef> tempMap = new HashMap<>(); for (Entry<String, KeyDef> entry : keysDefMap.entrySet()) { key = entry.getKey(); // depends on control dependency: [for], data = [entry] value = entry.getValue(); // depends on control dependency: [for], data = [entry] // there is multi-level keys exist. if (keysRefMap.containsValue(key)) { // get multi-level keys final List<String> keysList = getKeysList(key, keysRefMap); for (final String multikey : keysList) { // update tempMap tempMap.put(multikey, value); // depends on control dependency: [for], data = [multikey] } } } // update keysDefMap. keysDefMap.putAll(tempMap); } }
public class class_name { public final void setApplicationName(String... applicationNames) { synchronized (lock) { if (applicationNames == null) { serviceProperties.remove(APPLICATION_NAME); } else { serviceProperties.put(APPLICATION_NAME, applicationNames); } if (serviceRegistration != null) { serviceRegistration.setProperties(serviceProperties); } } } }
public class class_name { public final void setApplicationName(String... applicationNames) { synchronized (lock) { if (applicationNames == null) { serviceProperties.remove(APPLICATION_NAME); // depends on control dependency: [if], data = [none] } else { serviceProperties.put(APPLICATION_NAME, applicationNames); // depends on control dependency: [if], data = [none] } if (serviceRegistration != null) { serviceRegistration.setProperties(serviceProperties); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static String getVersion(String reportFile) { try { String text = readAsString(reportFile); return getVersionFromText(text); } catch (IOException e) { LOG.error(e.getMessage(), e); return null; } } }
public class class_name { public static String getVersion(String reportFile) { try { String text = readAsString(reportFile); return getVersionFromText(text); // depends on control dependency: [try], data = [none] } catch (IOException e) { LOG.error(e.getMessage(), e); return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static final CThreadContext getInstance() { SoftReference ref = (SoftReference)CThreadContext.contextLocal .get(Thread.currentThread()); CThreadContext context = null; if ((ref == null) || (ref.get() == null)) { context = new CThreadContext(); ref = new SoftReference(context); CThreadContext.contextLocal.put(Thread.currentThread(), ref); } else { context = (CThreadContext)ref.get(); } return context; } }
public class class_name { public static final CThreadContext getInstance() { SoftReference ref = (SoftReference)CThreadContext.contextLocal .get(Thread.currentThread()); CThreadContext context = null; if ((ref == null) || (ref.get() == null)) { context = new CThreadContext(); // depends on control dependency: [if], data = [none] ref = new SoftReference(context); // depends on control dependency: [if], data = [none] CThreadContext.contextLocal.put(Thread.currentThread(), ref); // depends on control dependency: [if], data = [none] } else { context = (CThreadContext)ref.get(); // depends on control dependency: [if], data = [none] } return context; } }
public class class_name { public static List<byte[]> getTagPairsFromTSUID(final byte[] tsuid) { if (tsuid == null) { throw new IllegalArgumentException("Missing TSUID"); } if (tsuid.length <= TSDB.metrics_width()) { throw new IllegalArgumentException( "TSUID is too short, may be missing tags"); } final List<byte[]> tags = new ArrayList<byte[]>(); final int pair_width = TSDB.tagk_width() + TSDB.tagv_width(); // start after the metric then iterate over each tagk/tagv pair for (int i = TSDB.metrics_width(); i < tsuid.length; i+= pair_width) { if (i + pair_width > tsuid.length){ throw new IllegalArgumentException( "The TSUID appears to be malformed, improper tag width"); } tags.add(Arrays.copyOfRange(tsuid, i, i + pair_width)); } return tags; } }
public class class_name { public static List<byte[]> getTagPairsFromTSUID(final byte[] tsuid) { if (tsuid == null) { throw new IllegalArgumentException("Missing TSUID"); } if (tsuid.length <= TSDB.metrics_width()) { throw new IllegalArgumentException( "TSUID is too short, may be missing tags"); } final List<byte[]> tags = new ArrayList<byte[]>(); final int pair_width = TSDB.tagk_width() + TSDB.tagv_width(); // start after the metric then iterate over each tagk/tagv pair for (int i = TSDB.metrics_width(); i < tsuid.length; i+= pair_width) { if (i + pair_width > tsuid.length){ throw new IllegalArgumentException( "The TSUID appears to be malformed, improper tag width"); } tags.add(Arrays.copyOfRange(tsuid, i, i + pair_width)); // depends on control dependency: [for], data = [i] } return tags; } }
public class class_name { public static Map<String, Object> toMap(Object object) { if (object == null) { return null; } return toMap(toJSONString(object)); } }
public class class_name { public static Map<String, Object> toMap(Object object) { if (object == null) { return null; // depends on control dependency: [if], data = [none] } return toMap(toJSONString(object)); } }
public class class_name { @Override public void perform() throws PortalException { // push the change into the PLF if (nodeId.startsWith(Constants.FRAGMENT_ID_USER_PREFIX)) { // we are dealing with an incorporated node, so get a plf ghost // node, set its attribute, then add a directive indicating the // attribute that should be pushed into the ilf during merge Element plfNode = HandlerUtils.getPLFNode( ilfNode, person, true, // create node if not found false); // don't create children plfNode.setAttribute(name, value); /* * add directive to hold override value. This is not necessary for * folder names since they are overridden at render time with their * locale specific version and persisted via a different mechanism. */ EditManager.addEditDirective(plfNode, name, person); } else { // node owned by user so change attribute in child directly Document plf = RDBMDistributedLayoutStore.getPLF(person); Element plfNode = plf.getElementById(nodeId); if (plfNode != null) // should always be non-null { plfNode.setAttribute(name, value); } } /* * push the change into the ILF if not the name attribute. For names * the rendering will inject the localized name via a special processor. * So it doesn't matter what is in the ILF's folder name attribute. */ if (!name.equals(Constants.ATT_NAME)) // should always be non-null { ilfNode.setAttribute(name, value); } } }
public class class_name { @Override public void perform() throws PortalException { // push the change into the PLF if (nodeId.startsWith(Constants.FRAGMENT_ID_USER_PREFIX)) { // we are dealing with an incorporated node, so get a plf ghost // node, set its attribute, then add a directive indicating the // attribute that should be pushed into the ilf during merge Element plfNode = HandlerUtils.getPLFNode( ilfNode, person, true, // create node if not found false); // don't create children plfNode.setAttribute(name, value); /* * add directive to hold override value. This is not necessary for * folder names since they are overridden at render time with their * locale specific version and persisted via a different mechanism. */ EditManager.addEditDirective(plfNode, name, person); } else { // node owned by user so change attribute in child directly Document plf = RDBMDistributedLayoutStore.getPLF(person); Element plfNode = plf.getElementById(nodeId); if (plfNode != null) // should always be non-null { plfNode.setAttribute(name, value); // depends on control dependency: [if], data = [none] } } /* * push the change into the ILF if not the name attribute. For names * the rendering will inject the localized name via a special processor. * So it doesn't matter what is in the ILF's folder name attribute. */ if (!name.equals(Constants.ATT_NAME)) // should always be non-null { ilfNode.setAttribute(name, value); } } }
public class class_name { public static boolean hasWildcardCharacters( String expression ) { Objects.requireNonNull(expression); CharacterIterator iter = new StringCharacterIterator(expression); boolean skipNext = false; for (char c = iter.first(); c != CharacterIterator.DONE; c = iter.next()) { if (skipNext) { skipNext = false; continue; } if (c == '*' || c == '?' || c == '%' || c == '_') return true; if (c == '\\') skipNext = true; } return false; } }
public class class_name { public static boolean hasWildcardCharacters( String expression ) { Objects.requireNonNull(expression); CharacterIterator iter = new StringCharacterIterator(expression); boolean skipNext = false; for (char c = iter.first(); c != CharacterIterator.DONE; c = iter.next()) { if (skipNext) { skipNext = false; // depends on control dependency: [if], data = [none] continue; } if (c == '*' || c == '?' || c == '%' || c == '_') return true; if (c == '\\') skipNext = true; } return false; } }
public class class_name { protected final List<String> getExtraneousArguments() { if (commandLine == null) { return emptyList(); } String[] args = commandLine.getArgs(); if (noItems(args)) { return emptyList(); } return asList(args); } }
public class class_name { protected final List<String> getExtraneousArguments() { if (commandLine == null) { return emptyList(); // depends on control dependency: [if], data = [none] } String[] args = commandLine.getArgs(); if (noItems(args)) { return emptyList(); // depends on control dependency: [if], data = [none] } return asList(args); } }
public class class_name { public static DirLock tryLock(FileSystem fs, Path dir) throws IOException { Path lockFile = getDirLockFile(dir); try { FSDataOutputStream ostream = HdfsUtils.tryCreateFile(fs, lockFile); if (ostream!=null) { LOG.debug("Thread ({}) Acquired lock on dir {}", threadInfo(), dir); ostream.close(); return new DirLock(fs, lockFile); } else { LOG.debug("Thread ({}) cannot lock dir {} as its already locked.", threadInfo(), dir); return null; } } catch (IOException e) { LOG.error("Error when acquiring lock on dir " + dir, e); throw e; } } }
public class class_name { public static DirLock tryLock(FileSystem fs, Path dir) throws IOException { Path lockFile = getDirLockFile(dir); try { FSDataOutputStream ostream = HdfsUtils.tryCreateFile(fs, lockFile); if (ostream!=null) { LOG.debug("Thread ({}) Acquired lock on dir {}", threadInfo(), dir); // depends on control dependency: [if], data = [none] ostream.close(); // depends on control dependency: [if], data = [none] return new DirLock(fs, lockFile); // depends on control dependency: [if], data = [none] } else { LOG.debug("Thread ({}) cannot lock dir {} as its already locked.", threadInfo(), dir); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } } catch (IOException e) { LOG.error("Error when acquiring lock on dir " + dir, e); throw e; } } }
public class class_name { public Source getAssociatedStylesheet() { int sz = m_stylesheets.size(); if (sz > 0) { Source source = (Source) m_stylesheets.elementAt(sz-1); return source; } else return null; } }
public class class_name { public Source getAssociatedStylesheet() { int sz = m_stylesheets.size(); if (sz > 0) { Source source = (Source) m_stylesheets.elementAt(sz-1); return source; // depends on control dependency: [if], data = [none] } else return null; } }
public class class_name { public AttachmentMessageBuilder addQuickReply(String title, String payload) { if (this.quickReplies == null) { this.quickReplies = new ArrayList<QuickReply>(); } this.quickReplies.add(new QuickReply(title, payload)); return this; } }
public class class_name { public AttachmentMessageBuilder addQuickReply(String title, String payload) { if (this.quickReplies == null) { this.quickReplies = new ArrayList<QuickReply>(); // depends on control dependency: [if], data = [none] } this.quickReplies.add(new QuickReply(title, payload)); return this; } }
public class class_name { @Override public void setPrinter(WikiPrinter printer) { // If the printer is already a XWiki Syntax Escape printer don't wrap it again. This case happens when // the createChainingListenerInstance() method is called, ie when this renderer's state is stacked // (for example when a Group event is being handled). if (printer instanceof XWikiSyntaxEscapeWikiPrinter) { super.setPrinter(printer); } else { super.setPrinter(new XWikiSyntaxEscapeWikiPrinter(printer, (XWikiSyntaxListenerChain) getListenerChain())); } } }
public class class_name { @Override public void setPrinter(WikiPrinter printer) { // If the printer is already a XWiki Syntax Escape printer don't wrap it again. This case happens when // the createChainingListenerInstance() method is called, ie when this renderer's state is stacked // (for example when a Group event is being handled). if (printer instanceof XWikiSyntaxEscapeWikiPrinter) { super.setPrinter(printer); // depends on control dependency: [if], data = [none] } else { super.setPrinter(new XWikiSyntaxEscapeWikiPrinter(printer, (XWikiSyntaxListenerChain) getListenerChain())); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void visit(final WebAppFilter webAppFilter) { NullArgumentException.validateNotNull(webAppFilter, "Web app filter"); String filterName = webAppFilter.getFilterName(); if (filterName != null) { //CHECKSTYLE:OFF try { webContainer.unregisterFilter(filterName); } catch (Exception ignore) { LOG.warn("Unregistration exception. Skipping.", ignore); } //CHECKSTYLE:ON } } }
public class class_name { public void visit(final WebAppFilter webAppFilter) { NullArgumentException.validateNotNull(webAppFilter, "Web app filter"); String filterName = webAppFilter.getFilterName(); if (filterName != null) { //CHECKSTYLE:OFF try { webContainer.unregisterFilter(filterName); // depends on control dependency: [try], data = [none] } catch (Exception ignore) { LOG.warn("Unregistration exception. Skipping.", ignore); } // depends on control dependency: [catch], data = [none] //CHECKSTYLE:ON } } }
public class class_name { private static void propagateProperties( final Collection<String> vargs, final boolean copyNull, final String... propNames) { for (final String propName : propNames) { final String propValue = System.getProperty(propName); if (propValue == null || propValue.isEmpty()) { if (copyNull) { vargs.add("-D" + propName); } } else { vargs.add(String.format("-D%s=%s", propName, propValue)); } } } }
public class class_name { private static void propagateProperties( final Collection<String> vargs, final boolean copyNull, final String... propNames) { for (final String propName : propNames) { final String propValue = System.getProperty(propName); if (propValue == null || propValue.isEmpty()) { if (copyNull) { vargs.add("-D" + propName); // depends on control dependency: [if], data = [none] } } else { vargs.add(String.format("-D%s=%s", propName, propValue)); // depends on control dependency: [if], data = [none] } } } }
public class class_name { protected <T extends DObject> void registerObjectAndNotify (ObjectResponse<T> orsp) { // let the object know that we'll be managing it T obj = orsp.getObject(); obj.setManager(this); // stick the object into the proxy object table _ocache.put(obj.getOid(), obj); // let the penders know that the object is available PendingRequest<?> req = _penders.remove(obj.getOid()); if (req == null) { log.warning("Got object, but no one cares?!", "oid", obj.getOid(), "obj", obj); return; } for (int ii = 0; ii < req.targets.size(); ii++) { @SuppressWarnings("unchecked") Subscriber<T> target = (Subscriber<T>)req.targets.get(ii); // add them as a subscriber obj.addSubscriber(target); // and let them know that the object is in target.objectAvailable(obj); } } }
public class class_name { protected <T extends DObject> void registerObjectAndNotify (ObjectResponse<T> orsp) { // let the object know that we'll be managing it T obj = orsp.getObject(); obj.setManager(this); // stick the object into the proxy object table _ocache.put(obj.getOid(), obj); // let the penders know that the object is available PendingRequest<?> req = _penders.remove(obj.getOid()); if (req == null) { log.warning("Got object, but no one cares?!", "oid", obj.getOid(), "obj", obj); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } for (int ii = 0; ii < req.targets.size(); ii++) { @SuppressWarnings("unchecked") Subscriber<T> target = (Subscriber<T>)req.targets.get(ii); // add them as a subscriber obj.addSubscriber(target); // depends on control dependency: [for], data = [none] // and let them know that the object is in target.objectAvailable(obj); // depends on control dependency: [for], data = [none] } } }
public class class_name { public static File getMountSource(Closeable handle) { if (handle instanceof MountHandle) { return MountHandle.class.cast(handle).getMountSource(); } return null; } }
public class class_name { public static File getMountSource(Closeable handle) { if (handle instanceof MountHandle) { return MountHandle.class.cast(handle).getMountSource(); } // depends on control dependency: [if], data = [none] return null; } }
public class class_name { private List<Pair<Integer, Integer>> doGenerateEdgesSimpler() { final int numberOfNodes = getConfiguration().getNumberOfNodes(); final long numberOfEdges = getConfiguration().getNumberOfEdges(); final Set<Pair<Integer, Integer>> edges = new HashSet<>(); while (edges.size() < numberOfEdges) { int origin = random.nextInt(numberOfNodes); int target = random.nextInt(numberOfNodes); if (target == origin) { continue; } edges.add(Pair.of(origin, target)); } return new LinkedList<>(edges); } }
public class class_name { private List<Pair<Integer, Integer>> doGenerateEdgesSimpler() { final int numberOfNodes = getConfiguration().getNumberOfNodes(); final long numberOfEdges = getConfiguration().getNumberOfEdges(); final Set<Pair<Integer, Integer>> edges = new HashSet<>(); while (edges.size() < numberOfEdges) { int origin = random.nextInt(numberOfNodes); int target = random.nextInt(numberOfNodes); if (target == origin) { continue; } edges.add(Pair.of(origin, target)); // depends on control dependency: [while], data = [none] } return new LinkedList<>(edges); } }
public class class_name { @DefinedBy(Api.COMPILER) public long getLineNumber() { if (sourcePosition == null) { sourcePosition = new SourcePosition(); } return sourcePosition.getLineNumber(); } }
public class class_name { @DefinedBy(Api.COMPILER) public long getLineNumber() { if (sourcePosition == null) { sourcePosition = new SourcePosition(); // depends on control dependency: [if], data = [none] } return sourcePosition.getLineNumber(); } }
public class class_name { @Override public void handleLoadInstruction(LoadInstruction obj) { int numProduced = obj.produceStack(cpg); if (numProduced == Const.UNPREDICTABLE) { throw new InvalidBytecodeException("Unpredictable stack production"); } if (numProduced != 1) { super.handleLoadInstruction(obj); return; } int index = obj.getIndex(); TypeFrame frame = getFrame(); Type value = frame.getValue(index); if (value instanceof ReferenceType && !(value instanceof GenericObjectType)) { GenericObjectType gType = getLocalVariable(index, getLocation().getHandle().getPosition()); value = GenericUtilities.merge(gType, value); } boolean isExact = frame.isExact(index); frame.pushValue(value); if (isExact) { setTopOfStackIsExact(); } } }
public class class_name { @Override public void handleLoadInstruction(LoadInstruction obj) { int numProduced = obj.produceStack(cpg); if (numProduced == Const.UNPREDICTABLE) { throw new InvalidBytecodeException("Unpredictable stack production"); } if (numProduced != 1) { super.handleLoadInstruction(obj); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } int index = obj.getIndex(); TypeFrame frame = getFrame(); Type value = frame.getValue(index); if (value instanceof ReferenceType && !(value instanceof GenericObjectType)) { GenericObjectType gType = getLocalVariable(index, getLocation().getHandle().getPosition()); value = GenericUtilities.merge(gType, value); // depends on control dependency: [if], data = [none] } boolean isExact = frame.isExact(index); frame.pushValue(value); if (isExact) { setTopOfStackIsExact(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public final void importDeclaration() throws RecognitionException { int importDeclaration_StartIndex = input.index(); try { if ( state.backtracking>0 && alreadyParsedRule(input, 3) ) { return; } // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:281:5: ( 'import' ( 'static' )? Identifier ( '.' Identifier )* ( '.' '*' )? ';' ) // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:281:7: 'import' ( 'static' )? Identifier ( '.' Identifier )* ( '.' '*' )? ';' { match(input,89,FOLLOW_89_in_importDeclaration153); if (state.failed) return; // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:281:16: ( 'static' )? int alt5=2; int LA5_0 = input.LA(1); if ( (LA5_0==106) ) { alt5=1; } switch (alt5) { case 1 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:281:16: 'static' { match(input,106,FOLLOW_106_in_importDeclaration155); if (state.failed) return; } break; } match(input,Identifier,FOLLOW_Identifier_in_importDeclaration158); if (state.failed) return; // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:281:37: ( '.' Identifier )* loop6: while (true) { int alt6=2; int LA6_0 = input.LA(1); if ( (LA6_0==47) ) { int LA6_1 = input.LA(2); if ( (LA6_1==Identifier) ) { alt6=1; } } switch (alt6) { case 1 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:281:38: '.' Identifier { match(input,47,FOLLOW_47_in_importDeclaration161); if (state.failed) return; match(input,Identifier,FOLLOW_Identifier_in_importDeclaration163); if (state.failed) return; } break; default : break loop6; } } // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:281:55: ( '.' '*' )? int alt7=2; int LA7_0 = input.LA(1); if ( (LA7_0==47) ) { alt7=1; } switch (alt7) { case 1 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:281:56: '.' '*' { match(input,47,FOLLOW_47_in_importDeclaration168); if (state.failed) return; match(input,38,FOLLOW_38_in_importDeclaration170); if (state.failed) return; } break; } match(input,52,FOLLOW_52_in_importDeclaration174); if (state.failed) return; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving if ( state.backtracking>0 ) { memoize(input, 3, importDeclaration_StartIndex); } } } }
public class class_name { public final void importDeclaration() throws RecognitionException { int importDeclaration_StartIndex = input.index(); try { if ( state.backtracking>0 && alreadyParsedRule(input, 3) ) { return; } // depends on control dependency: [if], data = [none] // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:281:5: ( 'import' ( 'static' )? Identifier ( '.' Identifier )* ( '.' '*' )? ';' ) // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:281:7: 'import' ( 'static' )? Identifier ( '.' Identifier )* ( '.' '*' )? ';' { match(input,89,FOLLOW_89_in_importDeclaration153); if (state.failed) return; // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:281:16: ( 'static' )? int alt5=2; int LA5_0 = input.LA(1); if ( (LA5_0==106) ) { alt5=1; // depends on control dependency: [if], data = [none] } switch (alt5) { case 1 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:281:16: 'static' { match(input,106,FOLLOW_106_in_importDeclaration155); if (state.failed) return; } break; } match(input,Identifier,FOLLOW_Identifier_in_importDeclaration158); if (state.failed) return; // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:281:37: ( '.' Identifier )* loop6: while (true) { int alt6=2; int LA6_0 = input.LA(1); if ( (LA6_0==47) ) { int LA6_1 = input.LA(2); if ( (LA6_1==Identifier) ) { alt6=1; // depends on control dependency: [if], data = [none] } } switch (alt6) { case 1 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:281:38: '.' Identifier { match(input,47,FOLLOW_47_in_importDeclaration161); if (state.failed) return; match(input,Identifier,FOLLOW_Identifier_in_importDeclaration163); if (state.failed) return; } break; default : break loop6; } } // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:281:55: ( '.' '*' )? int alt7=2; int LA7_0 = input.LA(1); if ( (LA7_0==47) ) { alt7=1; // depends on control dependency: [if], data = [none] } switch (alt7) { case 1 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:281:56: '.' '*' { match(input,47,FOLLOW_47_in_importDeclaration168); if (state.failed) return; match(input,38,FOLLOW_38_in_importDeclaration170); if (state.failed) return; } break; } match(input,52,FOLLOW_52_in_importDeclaration174); if (state.failed) return; } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving if ( state.backtracking>0 ) { memoize(input, 3, importDeclaration_StartIndex); } // depends on control dependency: [if], data = [none] } } }
public class class_name { public void marshall(InstanceAssociationOutputUrl instanceAssociationOutputUrl, ProtocolMarshaller protocolMarshaller) { if (instanceAssociationOutputUrl == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(instanceAssociationOutputUrl.getS3OutputUrl(), S3OUTPUTURL_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(InstanceAssociationOutputUrl instanceAssociationOutputUrl, ProtocolMarshaller protocolMarshaller) { if (instanceAssociationOutputUrl == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(instanceAssociationOutputUrl.getS3OutputUrl(), S3OUTPUTURL_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public List<Resource> list(String path) { try { final List<Resource> ret = new ArrayList<>(); Resource res = deploymentResourceManager.getResource(path); if (res != null) { for (Resource child : res.list()) { ret.add(new ServletResource(this, child)); } } String p = path; if (p.startsWith("/")) { p = p.substring(1); } if (overlays != null) { for (VirtualFile overlay : overlays) { VirtualFile child = overlay.getChild(p); if (child.exists()) { VirtualFileResource vfsResource = new VirtualFileResource(overlay.getPhysicalFile(), child, path); for (Resource c : vfsResource.list()) { ret.add(new ServletResource(this, c)); } } } } return ret; } catch (IOException e) { throw new RuntimeException(e); //this method really should have thrown IOException } } }
public class class_name { public List<Resource> list(String path) { try { final List<Resource> ret = new ArrayList<>(); Resource res = deploymentResourceManager.getResource(path); if (res != null) { for (Resource child : res.list()) { ret.add(new ServletResource(this, child)); // depends on control dependency: [for], data = [child] } } String p = path; if (p.startsWith("/")) { p = p.substring(1); // depends on control dependency: [if], data = [none] } if (overlays != null) { for (VirtualFile overlay : overlays) { VirtualFile child = overlay.getChild(p); if (child.exists()) { VirtualFileResource vfsResource = new VirtualFileResource(overlay.getPhysicalFile(), child, path); for (Resource c : vfsResource.list()) { ret.add(new ServletResource(this, c)); // depends on control dependency: [for], data = [c] } } } } return ret; // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new RuntimeException(e); //this method really should have thrown IOException } // depends on control dependency: [catch], data = [none] } }
public class class_name { public ThreddsMetadata getInheritableMetadata() { ThreddsMetadata tmi = (ThreddsMetadata) get(Dataset.ThreddsMetadataInheritable); if (tmi == null) { tmi = new ThreddsMetadata(); put(Dataset.ThreddsMetadataInheritable, tmi); } return tmi; } }
public class class_name { public ThreddsMetadata getInheritableMetadata() { ThreddsMetadata tmi = (ThreddsMetadata) get(Dataset.ThreddsMetadataInheritable); if (tmi == null) { tmi = new ThreddsMetadata(); // depends on control dependency: [if], data = [none] put(Dataset.ThreddsMetadataInheritable, tmi); // depends on control dependency: [if], data = [none] } return tmi; } }
public class class_name { private void reConnect(ConnectInfo connectInfo, boolean isHelp) { if (loopGroup == null) { return; } if (!isHelp && response.isSupportRange()) { connectInfo.setStartPosition(connectInfo.getStartPosition() + connectInfo.getDownSize()); } connectInfo.setDownSize(0); if (connectInfo.getErrorCount() < downConfig.getRetryCount()) { connect(connectInfo); } else { if (callback != null) { callback.onChunkError(this, taskInfo.getChunkInfoList().get(connectInfo.getChunkIndex())); } if (taskInfo.getConnectInfoList().stream() .filter(connect -> connect.getStatus() != HttpDownStatus.DONE) .allMatch(connect -> connect.getErrorCount() >= downConfig.getRetryCount())) { taskInfo.setStatus(HttpDownStatus.ERROR); taskInfo.getChunkInfoList().stream() .filter(chunk -> chunk.getStatus() != HttpDownStatus.DONE) .forEach(chunkInfo -> chunkInfo.setStatus(HttpDownStatus.ERROR)); close(); if (callback != null) { callback.onError(this); } } } } }
public class class_name { private void reConnect(ConnectInfo connectInfo, boolean isHelp) { if (loopGroup == null) { return; // depends on control dependency: [if], data = [none] } if (!isHelp && response.isSupportRange()) { connectInfo.setStartPosition(connectInfo.getStartPosition() + connectInfo.getDownSize()); // depends on control dependency: [if], data = [none] } connectInfo.setDownSize(0); if (connectInfo.getErrorCount() < downConfig.getRetryCount()) { connect(connectInfo); // depends on control dependency: [if], data = [none] } else { if (callback != null) { callback.onChunkError(this, taskInfo.getChunkInfoList().get(connectInfo.getChunkIndex())); // depends on control dependency: [if], data = [none] } if (taskInfo.getConnectInfoList().stream() .filter(connect -> connect.getStatus() != HttpDownStatus.DONE) .allMatch(connect -> connect.getErrorCount() >= downConfig.getRetryCount())) { taskInfo.setStatus(HttpDownStatus.ERROR); // depends on control dependency: [if], data = [none] taskInfo.getChunkInfoList().stream() .filter(chunk -> chunk.getStatus() != HttpDownStatus.DONE) .forEach(chunkInfo -> chunkInfo.setStatus(HttpDownStatus.ERROR)); // depends on control dependency: [if], data = [none] close(); // depends on control dependency: [if], data = [none] if (callback != null) { callback.onError(this); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { private String getObjectInfoFromSerializedObject() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getObjectInfoFromSerializedObject"); String oscDesc; byte[] data = new byte[0]; try { data = objMsg.getSerializedObject(); oscDesc = SerializedObjectInfoHelper.getObjectInfo(data); } catch (ObjectFailedToSerializeException e) { oscDesc = String.format("unserializable class: %s", e.getExceptionInserts()[0]); } final String result = String.format("%s: %d%n%s: %s", HEADER_PAYLOAD_SIZE, data.length, HEADER_PAYLOAD_OBJ, oscDesc); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getObjectInfoFromSerializedObject", result); return result; } }
public class class_name { private String getObjectInfoFromSerializedObject() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getObjectInfoFromSerializedObject"); String oscDesc; byte[] data = new byte[0]; try { data = objMsg.getSerializedObject(); // depends on control dependency: [try], data = [none] oscDesc = SerializedObjectInfoHelper.getObjectInfo(data); // depends on control dependency: [try], data = [none] } catch (ObjectFailedToSerializeException e) { oscDesc = String.format("unserializable class: %s", e.getExceptionInserts()[0]); } // depends on control dependency: [catch], data = [none] final String result = String.format("%s: %d%n%s: %s", HEADER_PAYLOAD_SIZE, data.length, HEADER_PAYLOAD_OBJ, oscDesc); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getObjectInfoFromSerializedObject", result); return result; } }
public class class_name { public static String simplifyPath(String pathname) { checkNotNull(pathname); if (pathname.length() == 0) { return "."; } // split the path apart Iterable<String> components = Splitter.on('/').omitEmptyStrings().split(pathname); List<String> path = new ArrayList<String>(); // resolve ., .., and // for (String component : components) { if (component.equals(".")) { continue; } else if (component.equals("..")) { if (path.size() > 0 && !path.get(path.size() - 1).equals("..")) { path.remove(path.size() - 1); } else { path.add(".."); } } else { path.add(component); } } // put it back together String result = Joiner.on('/').join(path); if (pathname.charAt(0) == '/') { result = "/" + result; } while (result.startsWith("/../")) { result = result.substring(3); } if (result.equals("/..")) { result = "/"; } else if ("".equals(result)) { result = "."; } return result; } }
public class class_name { public static String simplifyPath(String pathname) { checkNotNull(pathname); if (pathname.length() == 0) { return "."; // depends on control dependency: [if], data = [none] } // split the path apart Iterable<String> components = Splitter.on('/').omitEmptyStrings().split(pathname); List<String> path = new ArrayList<String>(); // resolve ., .., and // for (String component : components) { if (component.equals(".")) { continue; } else if (component.equals("..")) { if (path.size() > 0 && !path.get(path.size() - 1).equals("..")) { path.remove(path.size() - 1); // depends on control dependency: [if], data = [(path.size()] } else { path.add(".."); // depends on control dependency: [if], data = [none] } } else { path.add(component); // depends on control dependency: [if], data = [none] } } // put it back together String result = Joiner.on('/').join(path); if (pathname.charAt(0) == '/') { result = "/" + result; // depends on control dependency: [if], data = [none] } while (result.startsWith("/../")) { result = result.substring(3); // depends on control dependency: [while], data = [none] } if (result.equals("/..")) { result = "/"; // depends on control dependency: [if], data = [none] } else if ("".equals(result)) { result = "."; // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { public static String formatDate(Long timestamp, String format, Locale loc) { if (StringUtils.isBlank(format)) { format = DateFormatUtils.ISO_8601_EXTENDED_DATE_FORMAT.getPattern(); } if (timestamp == null) { timestamp = timestamp(); } if (loc == null) { loc = Locale.US; } return DateFormatUtils.format(timestamp, format, loc); } }
public class class_name { public static String formatDate(Long timestamp, String format, Locale loc) { if (StringUtils.isBlank(format)) { format = DateFormatUtils.ISO_8601_EXTENDED_DATE_FORMAT.getPattern(); // depends on control dependency: [if], data = [none] } if (timestamp == null) { timestamp = timestamp(); // depends on control dependency: [if], data = [none] } if (loc == null) { loc = Locale.US; // depends on control dependency: [if], data = [none] } return DateFormatUtils.format(timestamp, format, loc); } }
public class class_name { private void render(SVG.Group obj) { debug("Group render"); updateStyleForElement(state, obj); if (!display()) return; if (obj.transform != null) { canvas.concat(obj.transform); } checkForClipPath(obj); boolean compositing = pushLayer(); renderChildren(obj, true); if (compositing) popLayer(obj); updateParentBoundingBox(obj); } }
public class class_name { private void render(SVG.Group obj) { debug("Group render"); updateStyleForElement(state, obj); if (!display()) return; if (obj.transform != null) { canvas.concat(obj.transform); // depends on control dependency: [if], data = [(obj.transform] } checkForClipPath(obj); boolean compositing = pushLayer(); renderChildren(obj, true); if (compositing) popLayer(obj); updateParentBoundingBox(obj); } }
public class class_name { private void notifyStatus(final Task task, final TaskStatus taskStatus, String reasonFormat, Object... args) { giant.lock(); try { Preconditions.checkNotNull(task, "task"); Preconditions.checkNotNull(taskStatus, "status"); Preconditions.checkState(active, "Queue is not active!"); Preconditions.checkArgument( task.getId().equals(taskStatus.getId()), "Mismatching task ids[%s/%s]", task.getId(), taskStatus.getId() ); // Inform taskRunner that this task can be shut down try { taskRunner.shutdown(task.getId(), reasonFormat, args); } catch (Exception e) { log.warn(e, "TaskRunner failed to cleanup task after completion: %s", task.getId()); } // Remove from running tasks int removed = 0; for (int i = tasks.size() - 1; i >= 0; i--) { if (tasks.get(i).getId().equals(task.getId())) { removed++; removeTaskInternal(tasks.get(i)); break; } } if (removed == 0) { log.warn("Unknown task completed: %s", task.getId()); } else if (removed > 1) { log.makeAlert("Removed multiple copies of task").addData("count", removed).addData("task", task.getId()).emit(); } // Remove from futures list taskFutures.remove(task.getId()); if (removed > 0) { // If we thought this task should be running, save status to DB try { final Optional<TaskStatus> previousStatus = taskStorage.getStatus(task.getId()); if (!previousStatus.isPresent() || !previousStatus.get().isRunnable()) { log.makeAlert("Ignoring notification for already-complete task").addData("task", task.getId()).emit(); } else { taskStorage.setStatus(taskStatus); log.info("Task done: %s", task); managementMayBeNecessary.signalAll(); } } catch (Exception e) { log.makeAlert(e, "Failed to persist status for task") .addData("task", task.getId()) .addData("statusCode", taskStatus.getStatusCode()) .emit(); } } } finally { giant.unlock(); } } }
public class class_name { private void notifyStatus(final Task task, final TaskStatus taskStatus, String reasonFormat, Object... args) { giant.lock(); try { Preconditions.checkNotNull(task, "task"); // depends on control dependency: [try], data = [none] Preconditions.checkNotNull(taskStatus, "status"); // depends on control dependency: [try], data = [none] Preconditions.checkState(active, "Queue is not active!"); // depends on control dependency: [try], data = [none] Preconditions.checkArgument( task.getId().equals(taskStatus.getId()), "Mismatching task ids[%s/%s]", task.getId(), taskStatus.getId() ); // depends on control dependency: [try], data = [none] // Inform taskRunner that this task can be shut down try { taskRunner.shutdown(task.getId(), reasonFormat, args); // depends on control dependency: [try], data = [none] } catch (Exception e) { log.warn(e, "TaskRunner failed to cleanup task after completion: %s", task.getId()); } // depends on control dependency: [catch], data = [none] // Remove from running tasks int removed = 0; for (int i = tasks.size() - 1; i >= 0; i--) { if (tasks.get(i).getId().equals(task.getId())) { removed++; // depends on control dependency: [if], data = [none] removeTaskInternal(tasks.get(i)); // depends on control dependency: [if], data = [none] break; } } if (removed == 0) { log.warn("Unknown task completed: %s", task.getId()); // depends on control dependency: [if], data = [none] } else if (removed > 1) { log.makeAlert("Removed multiple copies of task").addData("count", removed).addData("task", task.getId()).emit(); // depends on control dependency: [if], data = [none] } // Remove from futures list taskFutures.remove(task.getId()); // depends on control dependency: [try], data = [none] if (removed > 0) { // If we thought this task should be running, save status to DB try { final Optional<TaskStatus> previousStatus = taskStorage.getStatus(task.getId()); if (!previousStatus.isPresent() || !previousStatus.get().isRunnable()) { log.makeAlert("Ignoring notification for already-complete task").addData("task", task.getId()).emit(); // depends on control dependency: [if], data = [none] } else { taskStorage.setStatus(taskStatus); // depends on control dependency: [if], data = [none] log.info("Task done: %s", task); // depends on control dependency: [if], data = [none] managementMayBeNecessary.signalAll(); // depends on control dependency: [if], data = [none] } } catch (Exception e) { log.makeAlert(e, "Failed to persist status for task") .addData("task", task.getId()) .addData("statusCode", taskStatus.getStatusCode()) .emit(); } // depends on control dependency: [catch], data = [none] } } finally { giant.unlock(); } } }
public class class_name { public String encode(byte[] in, int off, int len) { checkBounds(in, off, len); StringBuilder sb = new StringBuilder(maxEncodedLength(len)); int accu = 0; int count = 0; int b = alphabet.bitsPerChar(); for (int i = off; i < off + len; i++) { accu = (accu << 8) | (in[i] & 0xFF); count += 8; while (count >= b) { count -= b; sb.append(alphabet.encode(accu >>> count)); } } if (count > 0) { accu = (accu & (0xFF >>> (8 - count))) << (b - count); sb.append(alphabet.encode(accu)); if (!omitPadding) { int c = alphabet.charsPerBlock(); int pad = c - (sb.length() % c); for (int i = 0; i < pad; i++) { sb.append(PADDING_CHAR); } } } insertSeparators(sb); return sb.toString(); } }
public class class_name { public String encode(byte[] in, int off, int len) { checkBounds(in, off, len); StringBuilder sb = new StringBuilder(maxEncodedLength(len)); int accu = 0; int count = 0; int b = alphabet.bitsPerChar(); for (int i = off; i < off + len; i++) { accu = (accu << 8) | (in[i] & 0xFF); // depends on control dependency: [for], data = [i] count += 8; // depends on control dependency: [for], data = [none] while (count >= b) { count -= b; // depends on control dependency: [while], data = [none] sb.append(alphabet.encode(accu >>> count)); // depends on control dependency: [while], data = [none] } } if (count > 0) { accu = (accu & (0xFF >>> (8 - count))) << (b - count); // depends on control dependency: [if], data = [none] sb.append(alphabet.encode(accu)); // depends on control dependency: [if], data = [none] if (!omitPadding) { int c = alphabet.charsPerBlock(); int pad = c - (sb.length() % c); for (int i = 0; i < pad; i++) { sb.append(PADDING_CHAR); // depends on control dependency: [for], data = [none] } } } insertSeparators(sb); return sb.toString(); } }
public class class_name { public boolean intersects(Geometry geometry) { if (isEmpty()) { return false; } for (Point point : points) { if (point.intersects(geometry)) { return true; } } return false; } }
public class class_name { public boolean intersects(Geometry geometry) { if (isEmpty()) { return false; // depends on control dependency: [if], data = [none] } for (Point point : points) { if (point.intersects(geometry)) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { public void delete( Key job_key, float dummy ) { if( _key != null ) { Log.debug(Log.Tag.Sys.LOCKS,"lock-then-delete "+_key+" by job "+job_key); new PriorWriteLock(job_key).invoke(_key); } Futures fs = new Futures(); delete_impl(fs); if( _key != null ) DKV.remove(_key,fs); // Delete self also fs.blockForPending(); } }
public class class_name { public void delete( Key job_key, float dummy ) { if( _key != null ) { Log.debug(Log.Tag.Sys.LOCKS,"lock-then-delete "+_key+" by job "+job_key); // depends on control dependency: [if], data = [none] new PriorWriteLock(job_key).invoke(_key); // depends on control dependency: [if], data = [none] } Futures fs = new Futures(); delete_impl(fs); if( _key != null ) DKV.remove(_key,fs); // Delete self also fs.blockForPending(); } }
public class class_name { private DoubleDBIDList initialRange(DBIDRef obj, DBIDs cands, PrimitiveDistanceFunction<? super NumberVector> df, double eps, KernelDensityEstimator kernel, ModifiableDoubleDBIDList n) { n.clear(); NumberVector o = kernel.relation.get(obj); final double twoeps = eps * 2; int matches = 0; for(DBIDIter cand = cands.iter(); cand.valid(); cand.advance()) { final double dist = df.distance(o, kernel.relation.get(cand)); if(dist <= twoeps) { n.add(dist, cand); if(dist <= eps) { ++matches; } } } n.sort(); return n.slice(0, matches); } }
public class class_name { private DoubleDBIDList initialRange(DBIDRef obj, DBIDs cands, PrimitiveDistanceFunction<? super NumberVector> df, double eps, KernelDensityEstimator kernel, ModifiableDoubleDBIDList n) { n.clear(); NumberVector o = kernel.relation.get(obj); final double twoeps = eps * 2; int matches = 0; for(DBIDIter cand = cands.iter(); cand.valid(); cand.advance()) { final double dist = df.distance(o, kernel.relation.get(cand)); if(dist <= twoeps) { n.add(dist, cand); // depends on control dependency: [if], data = [(dist] if(dist <= eps) { ++matches; // depends on control dependency: [if], data = [none] } } } n.sort(); return n.slice(0, matches); } }
public class class_name { private void skip(boolean stopAtImport, boolean stopAtMemberDecl, boolean stopAtIdentifier, boolean stopAtStatement) { while (true) { switch (token.kind) { case SEMI: nextToken(); return; case PUBLIC: case FINAL: case ABSTRACT: case MONKEYS_AT: case EOF: case CLASS: case INTERFACE: case ENUM: return; case IMPORT: if (stopAtImport) return; break; case LBRACE: case RBRACE: case PRIVATE: case PROTECTED: case STATIC: case TRANSIENT: case NATIVE: case VOLATILE: case SYNCHRONIZED: case STRICTFP: case LT: case BYTE: case SHORT: case CHAR: case INT: case LONG: case FLOAT: case DOUBLE: case BOOLEAN: case VOID: if (stopAtMemberDecl) return; break; case UNDERSCORE: case IDENTIFIER: if (stopAtIdentifier) return; break; case CASE: case DEFAULT: case IF: case FOR: case WHILE: case DO: case TRY: case SWITCH: case RETURN: case THROW: case BREAK: case CONTINUE: case ELSE: case FINALLY: case CATCH: if (stopAtStatement) return; break; } nextToken(); } } }
public class class_name { private void skip(boolean stopAtImport, boolean stopAtMemberDecl, boolean stopAtIdentifier, boolean stopAtStatement) { while (true) { switch (token.kind) { case SEMI: nextToken(); return; case PUBLIC: case FINAL: case ABSTRACT: case MONKEYS_AT: case EOF: case CLASS: case INTERFACE: case ENUM: return; case IMPORT: if (stopAtImport) return; break; case LBRACE: case RBRACE: case PRIVATE: case PROTECTED: case STATIC: case TRANSIENT: case NATIVE: case VOLATILE: case SYNCHRONIZED: case STRICTFP: case LT: case BYTE: case SHORT: case CHAR: case INT: case LONG: case FLOAT: case DOUBLE: case BOOLEAN: case VOID: if (stopAtMemberDecl) return; break; case UNDERSCORE: case IDENTIFIER: if (stopAtIdentifier) return; break; case CASE: case DEFAULT: case IF: case FOR: case WHILE: case DO: case TRY: case SWITCH: case RETURN: case THROW: case BREAK: case CONTINUE: case ELSE: case FINALLY: case CATCH: if (stopAtStatement) return; break; } nextToken(); // depends on control dependency: [while], data = [none] } } }
public class class_name { public <T> BroadcastVariableMaterialization<T, ?> materializeBroadcastVariable(String name, int superstep, BatchTask<?, ?> holder, MutableReader<?> reader, TypeSerializerFactory<T> serializerFactory) throws IOException { final BroadcastVariableKey key = new BroadcastVariableKey(holder.getEnvironment().getJobVertexId(), name, superstep); while (true) { final BroadcastVariableMaterialization<T, Object> newMat = new BroadcastVariableMaterialization<T, Object>(key); final BroadcastVariableMaterialization<?, ?> previous = variables.putIfAbsent(key, newMat); @SuppressWarnings("unchecked") final BroadcastVariableMaterialization<T, ?> materialization = (previous == null) ? newMat : (BroadcastVariableMaterialization<T, ?>) previous; try { materialization.materializeVariable(reader, serializerFactory, holder); return materialization; } catch (MaterializationExpiredException e) { // concurrent release. as an optimization, try to replace the previous one with our version. otherwise we might spin for a while // until the releaser removes the variable // NOTE: This would also catch a bug prevented an expired materialization from ever being removed, so it acts as a future safeguard boolean replaceSuccessful = false; try { replaceSuccessful = variables.replace(key, materialization, newMat); } catch (Throwable t) {} if (replaceSuccessful) { try { newMat.materializeVariable(reader, serializerFactory, holder); return newMat; } catch (MaterializationExpiredException ee) { // can still happen in cases of extreme races and fast tasks // fall through the loop; } } // else fall through the loop } } } }
public class class_name { public <T> BroadcastVariableMaterialization<T, ?> materializeBroadcastVariable(String name, int superstep, BatchTask<?, ?> holder, MutableReader<?> reader, TypeSerializerFactory<T> serializerFactory) throws IOException { final BroadcastVariableKey key = new BroadcastVariableKey(holder.getEnvironment().getJobVertexId(), name, superstep); while (true) { final BroadcastVariableMaterialization<T, Object> newMat = new BroadcastVariableMaterialization<T, Object>(key); final BroadcastVariableMaterialization<?, ?> previous = variables.putIfAbsent(key, newMat); @SuppressWarnings("unchecked") final BroadcastVariableMaterialization<T, ?> materialization = (previous == null) ? newMat : (BroadcastVariableMaterialization<T, ?>) previous; try { materialization.materializeVariable(reader, serializerFactory, holder); // depends on control dependency: [try], data = [none] return materialization; // depends on control dependency: [try], data = [none] } catch (MaterializationExpiredException e) { // concurrent release. as an optimization, try to replace the previous one with our version. otherwise we might spin for a while // until the releaser removes the variable // NOTE: This would also catch a bug prevented an expired materialization from ever being removed, so it acts as a future safeguard boolean replaceSuccessful = false; try { replaceSuccessful = variables.replace(key, materialization, newMat); // depends on control dependency: [try], data = [none] } catch (Throwable t) {} // depends on control dependency: [catch], data = [none] if (replaceSuccessful) { try { newMat.materializeVariable(reader, serializerFactory, holder); // depends on control dependency: [try], data = [none] return newMat; // depends on control dependency: [try], data = [none] } catch (MaterializationExpiredException ee) { // can still happen in cases of extreme races and fast tasks // fall through the loop; } // depends on control dependency: [catch], data = [none] } // else fall through the loop } // depends on control dependency: [catch], data = [none] } } }
public class class_name { private static XColor getXColorFromRgbClr(final CTSRgbColor ctrColor) { XSSFColor bcolor = null; try { byte[] rgb = ctrColor.getVal(); bcolor = new XSSFColor(rgb); } catch (Exception ex) { LOG.log(Level.SEVERE, "Cannot get rgb color error = " + ex.getLocalizedMessage(), ex); return null; } int lumOff = 0; int lumMod = 0; int alphaStr = 0; try { lumOff = ctrColor.getLumOffArray(0).getVal(); } catch (Exception ex) { LOG.log(Level.FINE, "No lumOff entry", ex); } try { lumMod = ctrColor.getLumModArray(0).getVal(); } catch (Exception ex) { LOG.log(Level.FINE, "No lumMod entry", ex); } try { alphaStr = ctrColor.getAlphaArray(0).getVal(); } catch (Exception ex) { LOG.log(Level.FINE, "No alpha entry", ex); } return assembleXcolor(bcolor, 0, lumOff, lumMod, alphaStr); } }
public class class_name { private static XColor getXColorFromRgbClr(final CTSRgbColor ctrColor) { XSSFColor bcolor = null; try { byte[] rgb = ctrColor.getVal(); bcolor = new XSSFColor(rgb); // depends on control dependency: [try], data = [none] } catch (Exception ex) { LOG.log(Level.SEVERE, "Cannot get rgb color error = " + ex.getLocalizedMessage(), ex); return null; } // depends on control dependency: [catch], data = [none] int lumOff = 0; int lumMod = 0; int alphaStr = 0; try { lumOff = ctrColor.getLumOffArray(0).getVal(); // depends on control dependency: [try], data = [none] } catch (Exception ex) { LOG.log(Level.FINE, "No lumOff entry", ex); } // depends on control dependency: [catch], data = [none] try { lumMod = ctrColor.getLumModArray(0).getVal(); // depends on control dependency: [try], data = [none] } catch (Exception ex) { LOG.log(Level.FINE, "No lumMod entry", ex); } // depends on control dependency: [catch], data = [none] try { alphaStr = ctrColor.getAlphaArray(0).getVal(); // depends on control dependency: [try], data = [none] } catch (Exception ex) { LOG.log(Level.FINE, "No alpha entry", ex); } // depends on control dependency: [catch], data = [none] return assembleXcolor(bcolor, 0, lumOff, lumMod, alphaStr); } }
public class class_name { public void addItem (int index, T item) { if (_items == null) { return; } _items.add(index, item); } }
public class class_name { public void addItem (int index, T item) { if (_items == null) { return; // depends on control dependency: [if], data = [none] } _items.add(index, item); } }
public class class_name { public static boolean isValidNmtoken(String nmtoken) { final int length = nmtoken.length(); if (length == 0) { return false; } for (int i = 0; i < length; ++i) { char ch = nmtoken.charAt(i); if (!isName(ch)) { return false; } } return true; } }
public class class_name { public static boolean isValidNmtoken(String nmtoken) { final int length = nmtoken.length(); if (length == 0) { return false; // depends on control dependency: [if], data = [none] } for (int i = 0; i < length; ++i) { char ch = nmtoken.charAt(i); if (!isName(ch)) { return false; // depends on control dependency: [if], data = [none] } } return true; } }
public class class_name { public void disableInlineEditing(CmsContainerPageElementPanel notThisOne) { removeEditButtonsPositionTimer(); if (isGroupcontainerEditing()) { for (Widget element : m_groupEditor.getGroupContainerWidget()) { if ((element instanceof CmsContainerPageElementPanel) && (element != notThisOne)) { ((CmsContainerPageElementPanel)element).removeInlineEditor(); } } } else { for (org.opencms.ade.containerpage.client.ui.CmsContainerPageContainer container : m_targetContainers.values()) { for (Widget element : container) { if ((element instanceof CmsContainerPageElementPanel) && (element != notThisOne)) { ((CmsContainerPageElementPanel)element).removeInlineEditor(); } } } } } }
public class class_name { public void disableInlineEditing(CmsContainerPageElementPanel notThisOne) { removeEditButtonsPositionTimer(); if (isGroupcontainerEditing()) { for (Widget element : m_groupEditor.getGroupContainerWidget()) { if ((element instanceof CmsContainerPageElementPanel) && (element != notThisOne)) { ((CmsContainerPageElementPanel)element).removeInlineEditor(); // depends on control dependency: [if], data = [none] } } } else { for (org.opencms.ade.containerpage.client.ui.CmsContainerPageContainer container : m_targetContainers.values()) { for (Widget element : container) { if ((element instanceof CmsContainerPageElementPanel) && (element != notThisOne)) { ((CmsContainerPageElementPanel)element).removeInlineEditor(); // depends on control dependency: [if], data = [none] } } } } } }
public class class_name { public String getValidationScript(TestContext context) { try { if (validationScriptResourcePath != null) { return context.replaceDynamicContentInString(FileUtils.readToString(FileUtils.getFileResource(validationScriptResourcePath, context), Charset.forName(context.replaceDynamicContentInString(validationScriptResourceCharset)))); } else if (validationScript != null) { return context.replaceDynamicContentInString(validationScript); } else { return ""; } } catch (IOException e) { throw new CitrusRuntimeException("Failed to load validation script resource", e); } } }
public class class_name { public String getValidationScript(TestContext context) { try { if (validationScriptResourcePath != null) { return context.replaceDynamicContentInString(FileUtils.readToString(FileUtils.getFileResource(validationScriptResourcePath, context), Charset.forName(context.replaceDynamicContentInString(validationScriptResourceCharset)))); // depends on control dependency: [if], data = [none] } else if (validationScript != null) { return context.replaceDynamicContentInString(validationScript); // depends on control dependency: [if], data = [(validationScript] } else { return ""; // depends on control dependency: [if], data = [none] } } catch (IOException e) { throw new CitrusRuntimeException("Failed to load validation script resource", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private static void registerFromClasspath( String beanName, String deserName, Map<Class<?>, SerDeserializer> map) throws Exception { Class<? extends Bean> beanClass = Class.forName(beanName).asSubclass(Bean.class); Class<?> deserClass = Class.forName(deserName); Field field = null; SerDeserializer deser; try { field = deserClass.getDeclaredField("DESERIALIZER"); if (!Modifier.isStatic(field.getModifiers())) { throw new IllegalStateException("Field " + field + " must be static"); } deser = SerDeserializer.class.cast(field.get(null)); } catch (NoSuchFieldException ex) { Constructor<?> cons = null; try { cons = deserClass.getConstructor(); deser = SerDeserializer.class.cast(cons.newInstance()); } catch (NoSuchMethodException ex2) { throw new IllegalStateException( "Class " + deserClass.getName() + " must have field DESERIALIZER or a no-arg constructor"); } catch (IllegalAccessException ex2) { cons.setAccessible(true); deser = SerDeserializer.class.cast(cons.newInstance()); } } catch (IllegalAccessException ex) { field.setAccessible(true); deser = SerDeserializer.class.cast(field.get(null)); } map.put(beanClass, deser); } }
public class class_name { private static void registerFromClasspath( String beanName, String deserName, Map<Class<?>, SerDeserializer> map) throws Exception { Class<? extends Bean> beanClass = Class.forName(beanName).asSubclass(Bean.class); Class<?> deserClass = Class.forName(deserName); Field field = null; SerDeserializer deser; try { field = deserClass.getDeclaredField("DESERIALIZER"); if (!Modifier.isStatic(field.getModifiers())) { throw new IllegalStateException("Field " + field + " must be static"); } deser = SerDeserializer.class.cast(field.get(null)); } catch (NoSuchFieldException ex) { Constructor<?> cons = null; try { cons = deserClass.getConstructor(); // depends on control dependency: [try], data = [none] deser = SerDeserializer.class.cast(cons.newInstance()); // depends on control dependency: [try], data = [none] } catch (NoSuchMethodException ex2) { throw new IllegalStateException( "Class " + deserClass.getName() + " must have field DESERIALIZER or a no-arg constructor"); } catch (IllegalAccessException ex2) { // depends on control dependency: [catch], data = [none] cons.setAccessible(true); deser = SerDeserializer.class.cast(cons.newInstance()); } // depends on control dependency: [catch], data = [none] } catch (IllegalAccessException ex) { field.setAccessible(true); deser = SerDeserializer.class.cast(field.get(null)); } map.put(beanClass, deser); } }
public class class_name { @Override public int countByG_C_C_DS(long groupId, long classNameId, long classPK, boolean defaultShipping) { FinderPath finderPath = FINDER_PATH_COUNT_BY_G_C_C_DS; Object[] finderArgs = new Object[] { groupId, classNameId, classPK, defaultShipping }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(5); query.append(_SQL_COUNT_COMMERCEADDRESS_WHERE); query.append(_FINDER_COLUMN_G_C_C_DS_GROUPID_2); query.append(_FINDER_COLUMN_G_C_C_DS_CLASSNAMEID_2); query.append(_FINDER_COLUMN_G_C_C_DS_CLASSPK_2); query.append(_FINDER_COLUMN_G_C_C_DS_DEFAULTSHIPPING_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(classNameId); qPos.add(classPK); qPos.add(defaultShipping); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); } }
public class class_name { @Override public int countByG_C_C_DS(long groupId, long classNameId, long classPK, boolean defaultShipping) { FinderPath finderPath = FINDER_PATH_COUNT_BY_G_C_C_DS; Object[] finderArgs = new Object[] { groupId, classNameId, classPK, defaultShipping }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(5); query.append(_SQL_COUNT_COMMERCEADDRESS_WHERE); // depends on control dependency: [if], data = [none] query.append(_FINDER_COLUMN_G_C_C_DS_GROUPID_2); // depends on control dependency: [if], data = [none] query.append(_FINDER_COLUMN_G_C_C_DS_CLASSNAMEID_2); // depends on control dependency: [if], data = [none] query.append(_FINDER_COLUMN_G_C_C_DS_CLASSPK_2); // depends on control dependency: [if], data = [none] query.append(_FINDER_COLUMN_G_C_C_DS_DEFAULTSHIPPING_2); // depends on control dependency: [if], data = [none] String sql = query.toString(); Session session = null; try { session = openSession(); // depends on control dependency: [try], data = [none] Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); // depends on control dependency: [try], data = [none] qPos.add(classNameId); // depends on control dependency: [try], data = [none] qPos.add(classPK); // depends on control dependency: [try], data = [none] qPos.add(defaultShipping); // depends on control dependency: [try], data = [none] count = (Long)q.uniqueResult(); // depends on control dependency: [try], data = [none] finderCache.putResult(finderPath, finderArgs, count); // depends on control dependency: [try], data = [none] } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } // depends on control dependency: [catch], data = [none] finally { closeSession(session); } } return count.intValue(); } }
public class class_name { private void search(Node node, E q, int k, List<Neighbor<E, E>> neighbors) { int d = (int) distance.d(node.object, q); if (d <= k) { if (node.object != q || !identicalExcluded) { neighbors.add(new Neighbor<>(node.object, node.object, node.index, d)); } } if (node.children != null) { int start = Math.max(1, d-k); int end = Math.min(node.children.size(), d+k+1); for (int i = start; i < end; i++) { Node child = node.children.get(i); if (child != null) { search(child, q, k, neighbors); } } } } }
public class class_name { private void search(Node node, E q, int k, List<Neighbor<E, E>> neighbors) { int d = (int) distance.d(node.object, q); if (d <= k) { if (node.object != q || !identicalExcluded) { neighbors.add(new Neighbor<>(node.object, node.object, node.index, d)); // depends on control dependency: [if], data = [(node.object] } } if (node.children != null) { int start = Math.max(1, d-k); int end = Math.min(node.children.size(), d+k+1); for (int i = start; i < end; i++) { Node child = node.children.get(i); if (child != null) { search(child, q, k, neighbors); // depends on control dependency: [if], data = [(child] } } } } }
public class class_name { protected void updateA( int w ) { final double u[] = dataQR[w]; for( int j = w+1; j < numCols; j++ ) { final double colQ[] = dataQR[j]; double val = colQ[w]; for( int k = w+1; k < numRows; k++ ) { val += u[k]*colQ[k]; } val *= gamma; colQ[w] -= val; for( int i = w+1; i < numRows; i++ ) { colQ[i] -= u[i]*val; } } } }
public class class_name { protected void updateA( int w ) { final double u[] = dataQR[w]; for( int j = w+1; j < numCols; j++ ) { final double colQ[] = dataQR[j]; double val = colQ[w]; for( int k = w+1; k < numRows; k++ ) { val += u[k]*colQ[k]; // depends on control dependency: [for], data = [k] } val *= gamma; // depends on control dependency: [for], data = [none] colQ[w] -= val; // depends on control dependency: [for], data = [none] for( int i = w+1; i < numRows; i++ ) { colQ[i] -= u[i]*val; // depends on control dependency: [for], data = [i] } } } }
public class class_name { public static Content content(String somePlainText) { Content c = null; try { c = new Content("text/plain; charset=UTF-8", somePlainText.getBytes("UTF-8")); } catch (UnsupportedEncodingException e) { /* UTF-8 is never unsupported */ } return c; } }
public class class_name { public static Content content(String somePlainText) { Content c = null; try { c = new Content("text/plain; charset=UTF-8", somePlainText.getBytes("UTF-8")); // depends on control dependency: [try], data = [none] } catch (UnsupportedEncodingException e) { /* UTF-8 is never unsupported */ } // depends on control dependency: [catch], data = [none] return c; } }
public class class_name { void heartbeatCheck() { if (!getNameNode().shouldCheckHeartbeat()) { // not to check dead nodes. return; } boolean allAlive = false; while (!allAlive) { boolean foundDead = false; DatanodeID nodeID = null; // locate the first dead node. synchronized (heartbeats) { for (Iterator<DatanodeDescriptor> it = heartbeats.iterator(); it.hasNext();) { DatanodeDescriptor nodeInfo = it.next(); if (isDatanodeDead(nodeInfo)) { foundDead = true; nodeID = nodeInfo; break; } } } // acquire the fsnamesystem lock, and then remove the dead node. if (foundDead) { writeLock(); try { synchronized (heartbeats) { synchronized (datanodeMap) { DatanodeDescriptor nodeInfo = null; try { nodeInfo = getDatanode(nodeID); } catch (IOException e) { nodeInfo = null; } if (nodeInfo != null && isDatanodeDead(nodeInfo)) { NameNode.stateChangeLog.info("BLOCK* NameSystem.heartbeatCheck: " + "lost heartbeat from " + nodeInfo.getName()); removeDatanode(nodeInfo); nodeInfo.setStartTime(now()); } } } } finally { writeUnlock(); } } allAlive = !foundDead; } } }
public class class_name { void heartbeatCheck() { if (!getNameNode().shouldCheckHeartbeat()) { // not to check dead nodes. return; // depends on control dependency: [if], data = [none] } boolean allAlive = false; while (!allAlive) { boolean foundDead = false; DatanodeID nodeID = null; // locate the first dead node. synchronized (heartbeats) { // depends on control dependency: [while], data = [none] for (Iterator<DatanodeDescriptor> it = heartbeats.iterator(); it.hasNext();) { DatanodeDescriptor nodeInfo = it.next(); if (isDatanodeDead(nodeInfo)) { foundDead = true; // depends on control dependency: [if], data = [none] nodeID = nodeInfo; // depends on control dependency: [if], data = [none] break; } } } // acquire the fsnamesystem lock, and then remove the dead node. if (foundDead) { writeLock(); // depends on control dependency: [if], data = [none] try { synchronized (heartbeats) { // depends on control dependency: [try], data = [none] synchronized (datanodeMap) { DatanodeDescriptor nodeInfo = null; try { nodeInfo = getDatanode(nodeID); // depends on control dependency: [try], data = [none] } catch (IOException e) { nodeInfo = null; } // depends on control dependency: [catch], data = [none] if (nodeInfo != null && isDatanodeDead(nodeInfo)) { NameNode.stateChangeLog.info("BLOCK* NameSystem.heartbeatCheck: " + "lost heartbeat from " + nodeInfo.getName()); // depends on control dependency: [if], data = [none] removeDatanode(nodeInfo); // depends on control dependency: [if], data = [(nodeInfo] nodeInfo.setStartTime(now()); // depends on control dependency: [if], data = [none] } } } } finally { writeUnlock(); } } allAlive = !foundDead; // depends on control dependency: [while], data = [none] } } }
public class class_name { @Nullable private static Resource merge(@Nullable Resource resource, @Nullable Resource otherResource) { if (otherResource == null) { return resource; } if (resource == null) { return otherResource; } String mergedType = resource.getType() != null ? resource.getType() : otherResource.getType(); Map<String, String> mergedLabelMap = new LinkedHashMap<String, String>(otherResource.getLabels()); // Labels from resource overwrite labels from otherResource. for (Entry<String, String> entry : resource.getLabels().entrySet()) { mergedLabelMap.put(entry.getKey(), entry.getValue()); } return createInternal(mergedType, Collections.unmodifiableMap(mergedLabelMap)); } }
public class class_name { @Nullable private static Resource merge(@Nullable Resource resource, @Nullable Resource otherResource) { if (otherResource == null) { return resource; // depends on control dependency: [if], data = [none] } if (resource == null) { return otherResource; // depends on control dependency: [if], data = [none] } String mergedType = resource.getType() != null ? resource.getType() : otherResource.getType(); Map<String, String> mergedLabelMap = new LinkedHashMap<String, String>(otherResource.getLabels()); // Labels from resource overwrite labels from otherResource. for (Entry<String, String> entry : resource.getLabels().entrySet()) { mergedLabelMap.put(entry.getKey(), entry.getValue()); // depends on control dependency: [for], data = [entry] } return createInternal(mergedType, Collections.unmodifiableMap(mergedLabelMap)); } }
public class class_name { private static String buildParentString(final String tag, final String tail) { if (tail.isEmpty()) { return tag; } else { return tag + " " + tail; } } }
public class class_name { private static String buildParentString(final String tag, final String tail) { if (tail.isEmpty()) { return tag; // depends on control dependency: [if], data = [none] } else { return tag + " " + tail; // depends on control dependency: [if], data = [none] } } }
public class class_name { public String buildResourceList() { // check how many resources are selected to decide using a div or not boolean scroll = (getResourceList().size() > 6); StringBuffer result = new StringBuffer(1024); result.append(dialogWhiteBoxStart()); // if the output to long, wrap it in a div if (scroll) { result.append("<div style='width: 100%; height:100px; overflow: auto;'>\n"); } result.append("<table border=\"0\">\n"); Iterator<String> i = getResourceList().iterator(); while (i.hasNext()) { String resName = i.next(); result.append("\t<tr>\n"); result.append("\t\t<td class='textbold' style=\"vertical-align:top;\">"); result.append(CmsResource.getName(resName)); result.append("&nbsp;</td>\n\t\t<td style=\"vertical-align:top;\">"); String title = null; try { // get the title property value title = getCms().readPropertyObject(resName, CmsPropertyDefinition.PROPERTY_TITLE, false).getValue( null); } catch (CmsException e) { // ignore this exception, title not found } if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(title)) { // show the title information result.append(title); } result.append("</td>\n\t</tr>\n"); } result.append("</table>"); // close the div if needed if (scroll) { result.append("</div>\n"); } result.append(dialogWhiteBoxEnd()); return result.toString(); } }
public class class_name { public String buildResourceList() { // check how many resources are selected to decide using a div or not boolean scroll = (getResourceList().size() > 6); StringBuffer result = new StringBuffer(1024); result.append(dialogWhiteBoxStart()); // if the output to long, wrap it in a div if (scroll) { result.append("<div style='width: 100%; height:100px; overflow: auto;'>\n"); // depends on control dependency: [if], data = [none] } result.append("<table border=\"0\">\n"); Iterator<String> i = getResourceList().iterator(); while (i.hasNext()) { String resName = i.next(); result.append("\t<tr>\n"); // depends on control dependency: [while], data = [none] result.append("\t\t<td class='textbold' style=\"vertical-align:top;\">"); // depends on control dependency: [while], data = [none] result.append(CmsResource.getName(resName)); // depends on control dependency: [while], data = [none] result.append("&nbsp;</td>\n\t\t<td style=\"vertical-align:top;\">"); // depends on control dependency: [while], data = [none] // depends on control dependency: [while], data = [none] String title = null; try { // get the title property value title = getCms().readPropertyObject(resName, CmsPropertyDefinition.PROPERTY_TITLE, false).getValue( null); // depends on control dependency: [try], data = [none] } catch (CmsException e) { // ignore this exception, title not found } // depends on control dependency: [catch], data = [none] if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(title)) { // show the title information result.append(title); // depends on control dependency: [if], data = [none] } result.append("</td>\n\t</tr>\n"); // depends on control dependency: [while], data = [none] } result.append("</table>"); // close the div if needed if (scroll) { result.append("</div>\n"); // depends on control dependency: [if], data = [none] } result.append(dialogWhiteBoxEnd()); return result.toString(); } }
public class class_name { public String resolveLastaEnvPath(String envPath) { if (envPath == null) { throw new IllegalArgumentException("The argument 'envPath' should not be null."); } final String lastaEnv = getLastaEnv(); if (lastaEnv != null && envPath.contains("_env.")) { // e.g. maihama_env.properties to maihama_env_prod.properties final String front = LdiSrl.substringLastFront(envPath, "_env."); final String rear = LdiSrl.substringLastRear(envPath, "_env."); return front + "_env_" + lastaEnv + "." + rear; } else { return envPath; } } }
public class class_name { public String resolveLastaEnvPath(String envPath) { if (envPath == null) { throw new IllegalArgumentException("The argument 'envPath' should not be null."); } final String lastaEnv = getLastaEnv(); if (lastaEnv != null && envPath.contains("_env.")) { // e.g. maihama_env.properties to maihama_env_prod.properties final String front = LdiSrl.substringLastFront(envPath, "_env."); final String rear = LdiSrl.substringLastRear(envPath, "_env."); return front + "_env_" + lastaEnv + "." + rear; // depends on control dependency: [if], data = [none] } else { return envPath; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static int indexOfDifference(final String a, final String b) { if (N.equals(a, b) || (N.isNullOrEmpty(a) && N.isNullOrEmpty(b))) { return N.INDEX_NOT_FOUND; } if (N.isNullOrEmpty(a) || N.isNullOrEmpty(b)) { return 0; } int i = 0; for (int len = N.min(a.length(), b.length()); i < len; i++) { if (a.charAt(i) != b.charAt(i)) { break; } } if (i < b.length() || i < a.length()) { return i; } return N.INDEX_NOT_FOUND; } }
public class class_name { public static int indexOfDifference(final String a, final String b) { if (N.equals(a, b) || (N.isNullOrEmpty(a) && N.isNullOrEmpty(b))) { return N.INDEX_NOT_FOUND; // depends on control dependency: [if], data = [none] } if (N.isNullOrEmpty(a) || N.isNullOrEmpty(b)) { return 0; // depends on control dependency: [if], data = [none] } int i = 0; for (int len = N.min(a.length(), b.length()); i < len; i++) { if (a.charAt(i) != b.charAt(i)) { break; } } if (i < b.length() || i < a.length()) { return i; // depends on control dependency: [if], data = [none] } return N.INDEX_NOT_FOUND; } }
public class class_name { protected void openFile() { try { FileAccess fa = isDump ? FileUtil.getDefaultInstance() : database.getFileAccess(); OutputStream fos = fa.openOutputStreamElement(outFile); outDescriptor = fa.getFileSync(fos); fileStreamOut = new BufferedOutputStream(fos, 2 << 12); } catch (IOException e) { throw Error.error(ErrorCode.FILE_IO_ERROR, ErrorCode.M_Message_Pair, new Object[] { e.toString(), outFile }); } } }
public class class_name { protected void openFile() { try { FileAccess fa = isDump ? FileUtil.getDefaultInstance() : database.getFileAccess(); OutputStream fos = fa.openOutputStreamElement(outFile); outDescriptor = fa.getFileSync(fos); // depends on control dependency: [try], data = [none] fileStreamOut = new BufferedOutputStream(fos, 2 << 12); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw Error.error(ErrorCode.FILE_IO_ERROR, ErrorCode.M_Message_Pair, new Object[] { e.toString(), outFile }); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void copyRequireFeatureToRequireFeatureWithTolerates() { Collection<RequireFeatureWithTolerates> rfwt = _asset.getWlpInformation().getRequireFeatureWithTolerates(); if (rfwt != null) { // Both fields (with and without tolerates) should exist, as // rfwt should not be created unless the other field is created first. // No need to copy, as the two fields should always be in sync return; } Collection<String> requireFeature = _asset.getWlpInformation().getRequireFeature(); if (requireFeature == null) { // Neither field exists, no need to copy return; } // We have the requireFeature field but not rfwt, so copy info into // the new field (rfwt). Collection<RequireFeatureWithTolerates> newOne = new HashSet<RequireFeatureWithTolerates>(); for (String feature : requireFeature) { RequireFeatureWithTolerates newFeature = new RequireFeatureWithTolerates(); newFeature.setFeature(feature); newFeature.setTolerates(Collections.<String> emptyList()); newOne.add(newFeature); } _asset.getWlpInformation().setRequireFeatureWithTolerates(newOne); } }
public class class_name { private void copyRequireFeatureToRequireFeatureWithTolerates() { Collection<RequireFeatureWithTolerates> rfwt = _asset.getWlpInformation().getRequireFeatureWithTolerates(); if (rfwt != null) { // Both fields (with and without tolerates) should exist, as // rfwt should not be created unless the other field is created first. // No need to copy, as the two fields should always be in sync return; // depends on control dependency: [if], data = [none] } Collection<String> requireFeature = _asset.getWlpInformation().getRequireFeature(); if (requireFeature == null) { // Neither field exists, no need to copy return; // depends on control dependency: [if], data = [none] } // We have the requireFeature field but not rfwt, so copy info into // the new field (rfwt). Collection<RequireFeatureWithTolerates> newOne = new HashSet<RequireFeatureWithTolerates>(); for (String feature : requireFeature) { RequireFeatureWithTolerates newFeature = new RequireFeatureWithTolerates(); newFeature.setFeature(feature); // depends on control dependency: [for], data = [feature] newFeature.setTolerates(Collections.<String> emptyList()); // depends on control dependency: [for], data = [none] newOne.add(newFeature); // depends on control dependency: [for], data = [none] } _asset.getWlpInformation().setRequireFeatureWithTolerates(newOne); } }
public class class_name { public boolean lock(boolean shared, boolean block) { if (shared && !_canRead) { // Invalid request for a shared "read" lock on a write only stream. return false; } if (!shared && !_canWrite) { // Invalid request for an exclusive "write" lock on a read only stream. return false; } return true; } }
public class class_name { public boolean lock(boolean shared, boolean block) { if (shared && !_canRead) { // Invalid request for a shared "read" lock on a write only stream. return false; // depends on control dependency: [if], data = [none] } if (!shared && !_canWrite) { // Invalid request for an exclusive "write" lock on a read only stream. return false; // depends on control dependency: [if], data = [none] } return true; } }
public class class_name { protected String callBridge(RestHttpHelper restHelper, String bridgeURL) { log.info("Making bridge call to get snapshot contents. URL: {}", bridgeURL); try { RestHttpHelper.HttpResponse response = restHelper.get(bridgeURL); int statusCode = response.getStatusCode(); if (statusCode != 200) { throw new RuntimeException("Unexpected response code: " + statusCode); } return response.getResponseBody(); } catch (Exception e) { throw new TaskException("Exception encountered attempting to " + "get snapshot contents. " + "Error reported: " + e.getMessage(), e); } } }
public class class_name { protected String callBridge(RestHttpHelper restHelper, String bridgeURL) { log.info("Making bridge call to get snapshot contents. URL: {}", bridgeURL); try { RestHttpHelper.HttpResponse response = restHelper.get(bridgeURL); int statusCode = response.getStatusCode(); if (statusCode != 200) { throw new RuntimeException("Unexpected response code: " + statusCode); } return response.getResponseBody(); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new TaskException("Exception encountered attempting to " + "get snapshot contents. " + "Error reported: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static <T extends ContentMeta> ResourceSelector<T> exactMetadataResourceSelector(final Map<String, String> required, final boolean requireAll) { return new ResourceSelector<T>() { @Override public boolean matchesContent(T content) { for (String key : required.keySet()) { String expect = required.get(key); String test = content.getMeta().get(key); if (null != test && expect.equals(test)) { if (!requireAll) { return true; } } else if (requireAll) { return false; } } return requireAll; } }; } }
public class class_name { public static <T extends ContentMeta> ResourceSelector<T> exactMetadataResourceSelector(final Map<String, String> required, final boolean requireAll) { return new ResourceSelector<T>() { @Override public boolean matchesContent(T content) { for (String key : required.keySet()) { String expect = required.get(key); String test = content.getMeta().get(key); if (null != test && expect.equals(test)) { if (!requireAll) { return true; // depends on control dependency: [if], data = [none] } } else if (requireAll) { return false; // depends on control dependency: [if], data = [none] } } return requireAll; } }; } }
public class class_name { public void marshall(EventDetailsErrorItem eventDetailsErrorItem, ProtocolMarshaller protocolMarshaller) { if (eventDetailsErrorItem == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(eventDetailsErrorItem.getEventArn(), EVENTARN_BINDING); protocolMarshaller.marshall(eventDetailsErrorItem.getErrorName(), ERRORNAME_BINDING); protocolMarshaller.marshall(eventDetailsErrorItem.getErrorMessage(), ERRORMESSAGE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(EventDetailsErrorItem eventDetailsErrorItem, ProtocolMarshaller protocolMarshaller) { if (eventDetailsErrorItem == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(eventDetailsErrorItem.getEventArn(), EVENTARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(eventDetailsErrorItem.getErrorName(), ERRORNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(eventDetailsErrorItem.getErrorMessage(), ERRORMESSAGE_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { static String removePrivateuseVariant(String privuseVal) { StringTokenIterator itr = new StringTokenIterator(privuseVal, LanguageTag.SEP); // Note: privateuse value "abc-lvariant" is unchanged // because no subtags after "lvariant". int prefixStart = -1; boolean sawPrivuseVar = false; while (!itr.isDone()) { if (prefixStart != -1) { // Note: privateuse value "abc-lvariant" is unchanged // because no subtags after "lvariant". sawPrivuseVar = true; break; } if (AsciiUtil.caseIgnoreMatch(itr.current(), LanguageTag.PRIVUSE_VARIANT_PREFIX)) { prefixStart = itr.currentStart(); } itr.next(); } if (!sawPrivuseVar) { return privuseVal; } assert(prefixStart == 0 || prefixStart > 1); return (prefixStart == 0) ? null : privuseVal.substring(0, prefixStart -1); } }
public class class_name { static String removePrivateuseVariant(String privuseVal) { StringTokenIterator itr = new StringTokenIterator(privuseVal, LanguageTag.SEP); // Note: privateuse value "abc-lvariant" is unchanged // because no subtags after "lvariant". int prefixStart = -1; boolean sawPrivuseVar = false; while (!itr.isDone()) { if (prefixStart != -1) { // Note: privateuse value "abc-lvariant" is unchanged // because no subtags after "lvariant". sawPrivuseVar = true; // depends on control dependency: [if], data = [none] break; } if (AsciiUtil.caseIgnoreMatch(itr.current(), LanguageTag.PRIVUSE_VARIANT_PREFIX)) { prefixStart = itr.currentStart(); // depends on control dependency: [if], data = [none] } itr.next(); // depends on control dependency: [while], data = [none] } if (!sawPrivuseVar) { return privuseVal; // depends on control dependency: [if], data = [none] } assert(prefixStart == 0 || prefixStart > 1); return (prefixStart == 0) ? null : privuseVal.substring(0, prefixStart -1); } }
public class class_name { public @Nonnull String getRootUrlFromRequest() { StaplerRequest req = Stapler.getCurrentRequest(); if (req == null) { throw new IllegalStateException("cannot call getRootUrlFromRequest from outside a request handling thread"); } StringBuilder buf = new StringBuilder(); String scheme = getXForwardedHeader(req, "X-Forwarded-Proto", req.getScheme()); buf.append(scheme).append("://"); String host = getXForwardedHeader(req, "X-Forwarded-Host", req.getServerName()); int index = host.indexOf(':'); int port = req.getServerPort(); if (index == -1) { // Almost everyone else except Nginx put the host and port in separate headers buf.append(host); } else { // Nginx uses the same spec as for the Host header, i.e. hostname:port buf.append(host.substring(0, index)); if (index + 1 < host.length()) { try { port = Integer.parseInt(host.substring(index + 1)); } catch (NumberFormatException e) { // ignore } } // but if a user has configured Nginx with an X-Forwarded-Port, that will win out. } String forwardedPort = getXForwardedHeader(req, "X-Forwarded-Port", null); if (forwardedPort != null) { try { port = Integer.parseInt(forwardedPort); } catch (NumberFormatException e) { // ignore } } if (port != ("https".equals(scheme) ? 443 : 80)) { buf.append(':').append(port); } buf.append(req.getContextPath()).append('/'); return buf.toString(); } }
public class class_name { public @Nonnull String getRootUrlFromRequest() { StaplerRequest req = Stapler.getCurrentRequest(); if (req == null) { throw new IllegalStateException("cannot call getRootUrlFromRequest from outside a request handling thread"); } StringBuilder buf = new StringBuilder(); String scheme = getXForwardedHeader(req, "X-Forwarded-Proto", req.getScheme()); buf.append(scheme).append("://"); String host = getXForwardedHeader(req, "X-Forwarded-Host", req.getServerName()); int index = host.indexOf(':'); int port = req.getServerPort(); if (index == -1) { // Almost everyone else except Nginx put the host and port in separate headers buf.append(host); // depends on control dependency: [if], data = [none] } else { // Nginx uses the same spec as for the Host header, i.e. hostname:port buf.append(host.substring(0, index)); // depends on control dependency: [if], data = [none] if (index + 1 < host.length()) { try { port = Integer.parseInt(host.substring(index + 1)); // depends on control dependency: [try], data = [none] } catch (NumberFormatException e) { // ignore } // depends on control dependency: [catch], data = [none] } // but if a user has configured Nginx with an X-Forwarded-Port, that will win out. } String forwardedPort = getXForwardedHeader(req, "X-Forwarded-Port", null); if (forwardedPort != null) { try { port = Integer.parseInt(forwardedPort); // depends on control dependency: [try], data = [none] } catch (NumberFormatException e) { // ignore } // depends on control dependency: [catch], data = [none] } if (port != ("https".equals(scheme) ? 443 : 80)) { buf.append(':').append(port); // depends on control dependency: [if], data = [(port] } buf.append(req.getContextPath()).append('/'); return buf.toString(); } }
public class class_name { protected Control createContents(Composite parent) { setTitle("TODO: property title (VdmBreakpointPropertyPage)"); noDefaultAndApplyButton(); Composite mainComposite = createComposite(parent, 1); createLabels(mainComposite); try { createEnabledButton(mainComposite); createHitValueEditor(mainComposite); createTypeSpecificEditors(mainComposite); // createSuspendPolicyEditor(mainComposite); // Suspend policy is considered uncommon. Add it last. } catch (CoreException e) { ; } setValid(true); // if this breakpoint is being created, change the shell title to indicate 'creation' try { if (getBreakpoint().getMarker().getAttribute(ATTR_DELETE_ON_CANCEL) != null) { getShell().addShellListener(new ShellListener() { public void shellActivated(ShellEvent e) { Shell shell = (Shell) e.getSource(); shell.setText("TEXT HERE (VdmBreakpointPropertyPage)");// MessageFormat.format("TODO: property page 10 (VdmBreakpointPropertyPage)", // new // String[]{getName(getBreakpoint())})); shell.removeShellListener(this); } public void shellClosed(ShellEvent e) { } public void shellDeactivated(ShellEvent e) { } public void shellDeiconified(ShellEvent e) { } public void shellIconified(ShellEvent e) { } }); } } catch (CoreException e) { } return mainComposite; } }
public class class_name { protected Control createContents(Composite parent) { setTitle("TODO: property title (VdmBreakpointPropertyPage)"); noDefaultAndApplyButton(); Composite mainComposite = createComposite(parent, 1); createLabels(mainComposite); try { createEnabledButton(mainComposite); // depends on control dependency: [try], data = [none] createHitValueEditor(mainComposite); // depends on control dependency: [try], data = [none] createTypeSpecificEditors(mainComposite); // depends on control dependency: [try], data = [none] // createSuspendPolicyEditor(mainComposite); // Suspend policy is considered uncommon. Add it last. } catch (CoreException e) { ; } // depends on control dependency: [catch], data = [none] setValid(true); // if this breakpoint is being created, change the shell title to indicate 'creation' try { if (getBreakpoint().getMarker().getAttribute(ATTR_DELETE_ON_CANCEL) != null) { getShell().addShellListener(new ShellListener() { public void shellActivated(ShellEvent e) { Shell shell = (Shell) e.getSource(); shell.setText("TEXT HERE (VdmBreakpointPropertyPage)");// MessageFormat.format("TODO: property page 10 (VdmBreakpointPropertyPage)", // new // String[]{getName(getBreakpoint())})); shell.removeShellListener(this); } public void shellClosed(ShellEvent e) { } public void shellDeactivated(ShellEvent e) { } public void shellDeiconified(ShellEvent e) { } public void shellIconified(ShellEvent e) { } }); // depends on control dependency: [if], data = [none] } } catch (CoreException e) { } // depends on control dependency: [catch], data = [none] return mainComposite; } }
public class class_name { private static int[][] findAromaticRings(int[][] cycles, int[] contribution, int[] dbs) { // loop control variables, the while loop continual checks all cycles // until no changes are found boolean found; boolean[] checked = new boolean[cycles.length]; // stores the aromatic atoms as a bit set and the aromatic bonds as // a hash set. the aromatic bonds are the result of this method but the // aromatic atoms are needed for checking each ring final boolean[] aromaticAtoms = new boolean[contribution.length]; final List<int[]> ringsOfSize6 = new ArrayList<int[]>(); final List<int[]> ringsOfSize5 = new ArrayList<int[]>(); do { found = false; for (int i = 0; i < cycles.length; i++) { // note paths are closed walks and repeat first/last vertex so // the true length is one less int[] cycle = cycles[i]; int len = cycle.length - 1; if (checked[i]) continue; if (isAromaticRing(cycle, contribution, dbs, aromaticAtoms)) { checked[i] = true; found |= true; for (int j = 0; j < len; j++) { aromaticAtoms[cycle[j]] = true; } if (len == 6) ringsOfSize6.add(cycle); else if (len == 5) ringsOfSize5.add(cycle); } } } while (found); List<int[]> rings = new ArrayList<int[]>(); rings.addAll(ringsOfSize6); rings.addAll(ringsOfSize5); return rings.toArray(new int[rings.size()][]); } }
public class class_name { private static int[][] findAromaticRings(int[][] cycles, int[] contribution, int[] dbs) { // loop control variables, the while loop continual checks all cycles // until no changes are found boolean found; boolean[] checked = new boolean[cycles.length]; // stores the aromatic atoms as a bit set and the aromatic bonds as // a hash set. the aromatic bonds are the result of this method but the // aromatic atoms are needed for checking each ring final boolean[] aromaticAtoms = new boolean[contribution.length]; final List<int[]> ringsOfSize6 = new ArrayList<int[]>(); final List<int[]> ringsOfSize5 = new ArrayList<int[]>(); do { found = false; for (int i = 0; i < cycles.length; i++) { // note paths are closed walks and repeat first/last vertex so // the true length is one less int[] cycle = cycles[i]; int len = cycle.length - 1; if (checked[i]) continue; if (isAromaticRing(cycle, contribution, dbs, aromaticAtoms)) { checked[i] = true; // depends on control dependency: [if], data = [none] found |= true; // depends on control dependency: [if], data = [none] for (int j = 0; j < len; j++) { aromaticAtoms[cycle[j]] = true; // depends on control dependency: [for], data = [j] } if (len == 6) ringsOfSize6.add(cycle); else if (len == 5) ringsOfSize5.add(cycle); } } } while (found); List<int[]> rings = new ArrayList<int[]>(); rings.addAll(ringsOfSize6); rings.addAll(ringsOfSize5); return rings.toArray(new int[rings.size()][]); } }
public class class_name { private String getPassword(ISecurityContext baseContext) { String password = null; IOpaqueCredentials oc = baseContext.getOpaqueCredentials(); if (oc instanceof NotSoOpaqueCredentials) { NotSoOpaqueCredentials nsoc = (NotSoOpaqueCredentials) oc; password = nsoc.getCredentials(); } // If still no password, loop through subcontexts to find cached credentials Enumeration en = baseContext.getSubContexts(); while (password == null && en.hasMoreElements()) { ISecurityContext subContext = (ISecurityContext) en.nextElement(); password = this.getPassword(subContext); } return password; } }
public class class_name { private String getPassword(ISecurityContext baseContext) { String password = null; IOpaqueCredentials oc = baseContext.getOpaqueCredentials(); if (oc instanceof NotSoOpaqueCredentials) { NotSoOpaqueCredentials nsoc = (NotSoOpaqueCredentials) oc; password = nsoc.getCredentials(); // depends on control dependency: [if], data = [none] } // If still no password, loop through subcontexts to find cached credentials Enumeration en = baseContext.getSubContexts(); while (password == null && en.hasMoreElements()) { ISecurityContext subContext = (ISecurityContext) en.nextElement(); password = this.getPassword(subContext); // depends on control dependency: [while], data = [none] } return password; } }
public class class_name { private Boolean toBoolean(Object value) { if (value == null) { return null; } else if (value instanceof Boolean) { return (Boolean) value; } else if (value instanceof String) { return Boolean.parseBoolean((String) value); } else if (value instanceof Short) { return (Short) value != 0; } else if (value instanceof Integer) { return (Integer) value != 0; } else if (value instanceof Long) { return (Long) value != 0; } else if (value instanceof Float) { return (Float) value != 0; } else if (value instanceof Double) { return (Double) value != 0; } return null; } }
public class class_name { private Boolean toBoolean(Object value) { if (value == null) { return null; // depends on control dependency: [if], data = [none] } else if (value instanceof Boolean) { return (Boolean) value; // depends on control dependency: [if], data = [none] } else if (value instanceof String) { return Boolean.parseBoolean((String) value); // depends on control dependency: [if], data = [none] } else if (value instanceof Short) { return (Short) value != 0; // depends on control dependency: [if], data = [none] } else if (value instanceof Integer) { return (Integer) value != 0; // depends on control dependency: [if], data = [none] } else if (value instanceof Long) { return (Long) value != 0; // depends on control dependency: [if], data = [none] } else if (value instanceof Float) { return (Float) value != 0; // depends on control dependency: [if], data = [none] } else if (value instanceof Double) { return (Double) value != 0; // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public byte[] decrypt(final byte[] encryptedContent) { FastByteBuffer fbb = new FastByteBuffer(); int length = encryptedContent.length; int blockCount = length / blockSizeInBytes; int offset = 0; for (int i = 0; i < blockCount - 1; i++) { byte[] decrypted = decryptBlock(encryptedContent, offset); fbb.append(decrypted); offset += blockSizeInBytes; } // process last block byte[] decrypted = decryptBlock(encryptedContent, offset); // find terminator int ndx = blockSizeInBytes - 1; while (ndx >= 0) { if (decrypted[ndx] == TERMINATOR) { break; } ndx--; } fbb.append(decrypted, 0, ndx); return fbb.toArray(); } }
public class class_name { public byte[] decrypt(final byte[] encryptedContent) { FastByteBuffer fbb = new FastByteBuffer(); int length = encryptedContent.length; int blockCount = length / blockSizeInBytes; int offset = 0; for (int i = 0; i < blockCount - 1; i++) { byte[] decrypted = decryptBlock(encryptedContent, offset); fbb.append(decrypted); // depends on control dependency: [for], data = [none] offset += blockSizeInBytes; // depends on control dependency: [for], data = [none] } // process last block byte[] decrypted = decryptBlock(encryptedContent, offset); // find terminator int ndx = blockSizeInBytes - 1; while (ndx >= 0) { if (decrypted[ndx] == TERMINATOR) { break; } ndx--; // depends on control dependency: [while], data = [none] } fbb.append(decrypted, 0, ndx); return fbb.toArray(); } }
public class class_name { public void setBaselineBugs(File baselineBugs) { if (baselineBugs != null && baselineBugs.length() > 0) { this.baselineBugs = baselineBugs; } else { if (baselineBugs != null) { log("Warning: baseline bugs file " + baselineBugs + (baselineBugs.exists() ? " is empty" : " does not exist")); } this.baselineBugs = null; } } }
public class class_name { public void setBaselineBugs(File baselineBugs) { if (baselineBugs != null && baselineBugs.length() > 0) { this.baselineBugs = baselineBugs; // depends on control dependency: [if], data = [none] } else { if (baselineBugs != null) { log("Warning: baseline bugs file " + baselineBugs + (baselineBugs.exists() ? " is empty" : " does not exist")); // depends on control dependency: [if], data = [none] } this.baselineBugs = null; // depends on control dependency: [if], data = [none] } } }
public class class_name { protected void parseSql() { int commentStartPos = sql.indexOf("/*", position); int lineCommentStartPos = sql.indexOf("--", position); int bindVariableStartPos = sql.indexOf("?", position); int elseCommentStartPos = -1; if (lineCommentStartPos >= 0) { int skipPos = skipWhitespace(lineCommentStartPos + 2); if (skipPos + 4 < sql.length() && "ELSE".equals(sql.substring(skipPos, skipPos + 4))) { elseCommentStartPos = lineCommentStartPos; } } int nextStartPos = getNextStartPos(commentStartPos, elseCommentStartPos, bindVariableStartPos); if (nextStartPos < 0) { token = sql.substring(position); nextTokenType = TokenType.EOF; position = sql.length(); tokenType = TokenType.SQL; } else { token = sql.substring(position, nextStartPos); tokenType = TokenType.SQL; boolean needNext = nextStartPos == position; if (nextStartPos == commentStartPos) { nextTokenType = TokenType.COMMENT; position = commentStartPos + 2; } else if (nextStartPos == elseCommentStartPos) { nextTokenType = TokenType.ELSE; position = elseCommentStartPos + 2; } else if (nextStartPos == bindVariableStartPos) { nextTokenType = TokenType.BIND_VARIABLE; position = bindVariableStartPos; } if (needNext) { next(); } } } }
public class class_name { protected void parseSql() { int commentStartPos = sql.indexOf("/*", position); int lineCommentStartPos = sql.indexOf("--", position); int bindVariableStartPos = sql.indexOf("?", position); int elseCommentStartPos = -1; if (lineCommentStartPos >= 0) { int skipPos = skipWhitespace(lineCommentStartPos + 2); if (skipPos + 4 < sql.length() && "ELSE".equals(sql.substring(skipPos, skipPos + 4))) { elseCommentStartPos = lineCommentStartPos; // depends on control dependency: [if], data = [none] } } int nextStartPos = getNextStartPos(commentStartPos, elseCommentStartPos, bindVariableStartPos); if (nextStartPos < 0) { token = sql.substring(position); // depends on control dependency: [if], data = [none] nextTokenType = TokenType.EOF; // depends on control dependency: [if], data = [none] position = sql.length(); // depends on control dependency: [if], data = [none] tokenType = TokenType.SQL; // depends on control dependency: [if], data = [none] } else { token = sql.substring(position, nextStartPos); // depends on control dependency: [if], data = [none] tokenType = TokenType.SQL; // depends on control dependency: [if], data = [none] boolean needNext = nextStartPos == position; if (nextStartPos == commentStartPos) { nextTokenType = TokenType.COMMENT; // depends on control dependency: [if], data = [none] position = commentStartPos + 2; // depends on control dependency: [if], data = [none] } else if (nextStartPos == elseCommentStartPos) { nextTokenType = TokenType.ELSE; // depends on control dependency: [if], data = [none] position = elseCommentStartPos + 2; // depends on control dependency: [if], data = [none] } else if (nextStartPos == bindVariableStartPos) { nextTokenType = TokenType.BIND_VARIABLE; // depends on control dependency: [if], data = [none] position = bindVariableStartPos; // depends on control dependency: [if], data = [none] } if (needNext) { next(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void randomize() { numKnots = 4 + (int)(6*Math.random()); xKnots = new int[numKnots]; yKnots = new int[numKnots]; knotTypes = new byte[numKnots]; for (int i = 0; i < numKnots; i++) { xKnots[i] = (int)(255 * Math.random()); yKnots[i] = 0xff000000 | ((int)(255 * Math.random()) << 16) | ((int)(255 * Math.random()) << 8) | (int)(255 * Math.random()); knotTypes[i] = RGB|SPLINE; } xKnots[0] = -1; xKnots[1] = 0; xKnots[numKnots-2] = 255; xKnots[numKnots-1] = 256; sortKnots(); rebuildGradient(); } }
public class class_name { public void randomize() { numKnots = 4 + (int)(6*Math.random()); xKnots = new int[numKnots]; yKnots = new int[numKnots]; knotTypes = new byte[numKnots]; for (int i = 0; i < numKnots; i++) { xKnots[i] = (int)(255 * Math.random()); // depends on control dependency: [for], data = [i] yKnots[i] = 0xff000000 | ((int)(255 * Math.random()) << 16) | ((int)(255 * Math.random()) << 8) | (int)(255 * Math.random()); // depends on control dependency: [for], data = [i] knotTypes[i] = RGB|SPLINE; // depends on control dependency: [for], data = [i] } xKnots[0] = -1; xKnots[1] = 0; xKnots[numKnots-2] = 255; xKnots[numKnots-1] = 256; sortKnots(); rebuildGradient(); } }
public class class_name { protected void initIdGenerator() { if (idGenerator == null) { CommandExecutor idGeneratorCommandExecutor = null; if (idGeneratorDataSource != null) { ProcessEngineConfigurationImpl processEngineConfiguration = new StandaloneProcessEngineConfiguration(); processEngineConfiguration.setDataSource(idGeneratorDataSource); processEngineConfiguration.setDatabaseSchemaUpdate(DB_SCHEMA_UPDATE_FALSE); processEngineConfiguration.init(); idGeneratorCommandExecutor = processEngineConfiguration.getCommandExecutorTxRequiresNew(); } else if (idGeneratorDataSourceJndiName != null) { ProcessEngineConfigurationImpl processEngineConfiguration = new StandaloneProcessEngineConfiguration(); processEngineConfiguration.setDataSourceJndiName(idGeneratorDataSourceJndiName); processEngineConfiguration.setDatabaseSchemaUpdate(DB_SCHEMA_UPDATE_FALSE); processEngineConfiguration.init(); idGeneratorCommandExecutor = processEngineConfiguration.getCommandExecutorTxRequiresNew(); } else { idGeneratorCommandExecutor = commandExecutorTxRequiresNew; } DbIdGenerator dbIdGenerator = new DbIdGenerator(); dbIdGenerator.setIdBlockSize(idBlockSize); dbIdGenerator.setCommandExecutor(idGeneratorCommandExecutor); idGenerator = dbIdGenerator; } } }
public class class_name { protected void initIdGenerator() { if (idGenerator == null) { CommandExecutor idGeneratorCommandExecutor = null; if (idGeneratorDataSource != null) { ProcessEngineConfigurationImpl processEngineConfiguration = new StandaloneProcessEngineConfiguration(); processEngineConfiguration.setDataSource(idGeneratorDataSource); // depends on control dependency: [if], data = [(idGeneratorDataSource] processEngineConfiguration.setDatabaseSchemaUpdate(DB_SCHEMA_UPDATE_FALSE); // depends on control dependency: [if], data = [none] processEngineConfiguration.init(); // depends on control dependency: [if], data = [none] idGeneratorCommandExecutor = processEngineConfiguration.getCommandExecutorTxRequiresNew(); // depends on control dependency: [if], data = [none] } else if (idGeneratorDataSourceJndiName != null) { ProcessEngineConfigurationImpl processEngineConfiguration = new StandaloneProcessEngineConfiguration(); processEngineConfiguration.setDataSourceJndiName(idGeneratorDataSourceJndiName); // depends on control dependency: [if], data = [(idGeneratorDataSourceJndiName] processEngineConfiguration.setDatabaseSchemaUpdate(DB_SCHEMA_UPDATE_FALSE); // depends on control dependency: [if], data = [none] processEngineConfiguration.init(); // depends on control dependency: [if], data = [none] idGeneratorCommandExecutor = processEngineConfiguration.getCommandExecutorTxRequiresNew(); // depends on control dependency: [if], data = [none] } else { idGeneratorCommandExecutor = commandExecutorTxRequiresNew; // depends on control dependency: [if], data = [none] } DbIdGenerator dbIdGenerator = new DbIdGenerator(); dbIdGenerator.setIdBlockSize(idBlockSize); // depends on control dependency: [if], data = [none] dbIdGenerator.setCommandExecutor(idGeneratorCommandExecutor); // depends on control dependency: [if], data = [(idGenerator] idGenerator = dbIdGenerator; // depends on control dependency: [if], data = [none] } } }
public class class_name { public void setUnknownTokenBoundaries() { if ( children==null ) { if ( startIndex<0 || stopIndex<0 ) { startIndex = stopIndex = token.getTokenIndex(); } return; } for (int i=0; i<children.size(); i++) { ((CommonTree)children.get(i)).setUnknownTokenBoundaries(); } if ( startIndex>=0 && stopIndex>=0 ) return; // already set if ( children.size() > 0 ) { CommonTree firstChild = (CommonTree)children.get(0); CommonTree lastChild = (CommonTree)children.get(children.size()-1); startIndex = firstChild.getTokenStartIndex(); stopIndex = lastChild.getTokenStopIndex(); } } }
public class class_name { public void setUnknownTokenBoundaries() { if ( children==null ) { if ( startIndex<0 || stopIndex<0 ) { startIndex = stopIndex = token.getTokenIndex(); // depends on control dependency: [if], data = [none] } return; // depends on control dependency: [if], data = [none] } for (int i=0; i<children.size(); i++) { ((CommonTree)children.get(i)).setUnknownTokenBoundaries(); // depends on control dependency: [for], data = [i] } if ( startIndex>=0 && stopIndex>=0 ) return; // already set if ( children.size() > 0 ) { CommonTree firstChild = (CommonTree)children.get(0); CommonTree lastChild = (CommonTree)children.get(children.size()-1); startIndex = firstChild.getTokenStartIndex(); // depends on control dependency: [if], data = [none] stopIndex = lastChild.getTokenStopIndex(); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public EEnum getIfcBuildingSystemTypeEnum() { if (ifcBuildingSystemTypeEnumEEnum == null) { ifcBuildingSystemTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(926); } return ifcBuildingSystemTypeEnumEEnum; } }
public class class_name { @Override public EEnum getIfcBuildingSystemTypeEnum() { if (ifcBuildingSystemTypeEnumEEnum == null) { ifcBuildingSystemTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(926); // depends on control dependency: [if], data = [none] } return ifcBuildingSystemTypeEnumEEnum; } }
public class class_name { private static String getRealDeptId(String deptId){ int start=deptId.indexOf("["); String realKey=deptId; if(start>0){ realKey=deptId.substring(0,start); } return realKey; } }
public class class_name { private static String getRealDeptId(String deptId){ int start=deptId.indexOf("["); String realKey=deptId; if(start>0){ realKey=deptId.substring(0,start); // depends on control dependency: [if], data = [none] } return realKey; } }
public class class_name { @Override @SuppressWarnings("unchecked") protected Enumeration<URL> findResources(String name) { final List<Enumeration<URL>> enumerations = new ArrayList<>(); for (WeakReference<Bundle> ref : bundles) { final Bundle bundle = ref.get(); if (bundle != null && bundle.getState() == Bundle.ACTIVE) { try { final Enumeration<URL> resources = bundle.getResources(name); if (resources != null) { enumerations.add(resources); } } catch (Exception ignore) { } } } return new Enumeration<URL>() { @Override public boolean hasMoreElements() { for (Enumeration<URL> enumeration : enumerations) { if (enumeration != null && enumeration.hasMoreElements()) { return true; } } return false; } @Override public URL nextElement() { for (Enumeration<URL> enumeration : enumerations) { if (enumeration != null && enumeration.hasMoreElements()) { return enumeration.nextElement(); } } throw new NoSuchElementException(); } }; } }
public class class_name { @Override @SuppressWarnings("unchecked") protected Enumeration<URL> findResources(String name) { final List<Enumeration<URL>> enumerations = new ArrayList<>(); for (WeakReference<Bundle> ref : bundles) { final Bundle bundle = ref.get(); if (bundle != null && bundle.getState() == Bundle.ACTIVE) { try { final Enumeration<URL> resources = bundle.getResources(name); if (resources != null) { enumerations.add(resources); // depends on control dependency: [if], data = [(resources] } } catch (Exception ignore) { } // depends on control dependency: [catch], data = [none] } } return new Enumeration<URL>() { @Override public boolean hasMoreElements() { for (Enumeration<URL> enumeration : enumerations) { if (enumeration != null && enumeration.hasMoreElements()) { return true; // depends on control dependency: [if], data = [none] } } return false; } @Override public URL nextElement() { for (Enumeration<URL> enumeration : enumerations) { if (enumeration != null && enumeration.hasMoreElements()) { return enumeration.nextElement(); // depends on control dependency: [if], data = [none] } } throw new NoSuchElementException(); } }; } }
public class class_name { public Result<Void> createPerm(AuthzTrans trans, PermDAO.Data perm, boolean fromApproval) { String user = trans.user(); // Next, see if User is allowed to Manage Parent Permission Result<NsDAO.Data> rnsd; if (!fromApproval) { rnsd = q.mayUser(trans, user, perm, Access.write); if (rnsd.notOK()) { return Result.err(rnsd); } } else { rnsd = q.deriveNs(trans, perm.ns); } // Does Child exist? if (!trans.forceRequested()) { if (q.permDAO.read(trans, perm).isOKhasData()) { return Result.err(Status.ERR_ConflictAlreadyExists, "Permission [%s.%s|%s|%s] already exists.", perm.ns, perm.type, perm.instance, perm.action); } } // Attempt to add perms to roles, creating as possible Set<String> roles; String pstring = perm.encode(); // For each Role for (String role : roles = perm.roles(true)) { Result<RoleDAO.Data> rdd = RoleDAO.Data.decode(trans,q,role); if(rdd.isOKhasData()) { RoleDAO.Data rd = rdd.value; if (!fromApproval) { // May User write to the Role in question. Result<NsDAO.Data> rns = q.mayUser(trans, user, rd, Access.write); if (rns.notOK()) { // Remove the role from Add, because roles.remove(role); // Don't allow adding trans.warn() .log("User [%s] does not have permission to relate Permissions to Role [%s]", user, role); } } Result<List<RoleDAO.Data>> rlrd; if ((rlrd = q.roleDAO.read(trans, rd)).notOKorIsEmpty()) { rd.perms(true).add(pstring); if (q.roleDAO.create(trans, rd).notOK()) { roles.remove(role); // Role doesn't exist, and can't be // created } } else { rd = rlrd.value.get(0); if (!rd.perms.contains(pstring)) { q.roleDAO.addPerm(trans, rd, perm); } } } } Result<PermDAO.Data> pdr = q.permDAO.create(trans, perm); if (pdr.isOK()) { return Result.ok(); } else { return Result.err(pdr); } } }
public class class_name { public Result<Void> createPerm(AuthzTrans trans, PermDAO.Data perm, boolean fromApproval) { String user = trans.user(); // Next, see if User is allowed to Manage Parent Permission Result<NsDAO.Data> rnsd; if (!fromApproval) { rnsd = q.mayUser(trans, user, perm, Access.write); // depends on control dependency: [if], data = [none] if (rnsd.notOK()) { return Result.err(rnsd); // depends on control dependency: [if], data = [none] } } else { rnsd = q.deriveNs(trans, perm.ns); // depends on control dependency: [if], data = [none] } // Does Child exist? if (!trans.forceRequested()) { if (q.permDAO.read(trans, perm).isOKhasData()) { return Result.err(Status.ERR_ConflictAlreadyExists, "Permission [%s.%s|%s|%s] already exists.", perm.ns, perm.type, perm.instance, perm.action); // depends on control dependency: [if], data = [none] } } // Attempt to add perms to roles, creating as possible Set<String> roles; String pstring = perm.encode(); // For each Role for (String role : roles = perm.roles(true)) { Result<RoleDAO.Data> rdd = RoleDAO.Data.decode(trans,q,role); if(rdd.isOKhasData()) { RoleDAO.Data rd = rdd.value; if (!fromApproval) { // May User write to the Role in question. Result<NsDAO.Data> rns = q.mayUser(trans, user, rd, Access.write); if (rns.notOK()) { // Remove the role from Add, because roles.remove(role); // Don't allow adding // depends on control dependency: [if], data = [none] trans.warn() .log("User [%s] does not have permission to relate Permissions to Role [%s]", user, role); // depends on control dependency: [if], data = [none] } } Result<List<RoleDAO.Data>> rlrd; if ((rlrd = q.roleDAO.read(trans, rd)).notOKorIsEmpty()) { rd.perms(true).add(pstring); // depends on control dependency: [if], data = [none] if (q.roleDAO.create(trans, rd).notOK()) { roles.remove(role); // Role doesn't exist, and can't be // depends on control dependency: [if], data = [none] // created } } else { rd = rlrd.value.get(0); // depends on control dependency: [if], data = [none] if (!rd.perms.contains(pstring)) { q.roleDAO.addPerm(trans, rd, perm); // depends on control dependency: [if], data = [none] } } } } Result<PermDAO.Data> pdr = q.permDAO.create(trans, perm); if (pdr.isOK()) { return Result.ok(); // depends on control dependency: [if], data = [none] } else { return Result.err(pdr); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void link(String from, String to) throws AccessDeniedException, StorageClientException { // a link places a pointer to the content in the parent of from, but // does not delete or modify the structure of to. // read from is required and write to. long t = System.currentTimeMillis(); try { checkOpen(); accessControlManager.check(Security.ZONE_CONTENT, to, Permissions.CAN_READ); accessControlManager.check(Security.ZONE_CONTENT, from, Permissions.CAN_READ.combine(Permissions.CAN_WRITE)); Map<String, Object> toStructure = getCached(keySpace, contentColumnFamily, to); if (!exists(toStructure)) { throw new StorageClientException("The source content to link from " + to + " does not exist, link operation failed"); } Map<String, Object> fromStructure = getCached(keySpace, contentColumnFamily, from); if (exists(fromStructure)) { throw new StorageClientException("The destination content to link to " + from + " exists, link operation failed"); } if (StorageClientUtils.isRoot(from)) { throw new StorageClientException("The link " + to + " is a root, not possible to create a soft link"); } // create a new structure object pointing back to the shared // location Object idStore = toStructure.get(STRUCTURE_UUID_FIELD); // if not a root, modify the new parent location, creating the // structured if necessary String parent = StorageClientUtils.getParentObjectPath(from); Map<String, Object> parentToStructure = getCached(keySpace, contentColumnFamily, parent); if (!exists(parentToStructure)) { // create a new parent Content content = new Content(parent, null); update(content); } // create the new object for the path, pointing to the Object putCached(keySpace, contentColumnFamily, from, ImmutableMap.of(STRUCTURE_UUID_FIELD, idStore, PATH_FIELD, from, LINKED_PATH_FIELD, to, DELETED_FIELD, new RemoveProperty()), true); } finally { statsService.apiCall(ContentManagerImpl.class.getName(), "link", System.currentTimeMillis() - t); } } }
public class class_name { public void link(String from, String to) throws AccessDeniedException, StorageClientException { // a link places a pointer to the content in the parent of from, but // does not delete or modify the structure of to. // read from is required and write to. long t = System.currentTimeMillis(); try { checkOpen(); accessControlManager.check(Security.ZONE_CONTENT, to, Permissions.CAN_READ); accessControlManager.check(Security.ZONE_CONTENT, from, Permissions.CAN_READ.combine(Permissions.CAN_WRITE)); Map<String, Object> toStructure = getCached(keySpace, contentColumnFamily, to); if (!exists(toStructure)) { throw new StorageClientException("The source content to link from " + to + " does not exist, link operation failed"); } Map<String, Object> fromStructure = getCached(keySpace, contentColumnFamily, from); if (exists(fromStructure)) { throw new StorageClientException("The destination content to link to " + from + " exists, link operation failed"); } if (StorageClientUtils.isRoot(from)) { throw new StorageClientException("The link " + to + " is a root, not possible to create a soft link"); } // create a new structure object pointing back to the shared // location Object idStore = toStructure.get(STRUCTURE_UUID_FIELD); // if not a root, modify the new parent location, creating the // structured if necessary String parent = StorageClientUtils.getParentObjectPath(from); Map<String, Object> parentToStructure = getCached(keySpace, contentColumnFamily, parent); if (!exists(parentToStructure)) { // create a new parent Content content = new Content(parent, null); update(content); // depends on control dependency: [if], data = [none] } // create the new object for the path, pointing to the Object putCached(keySpace, contentColumnFamily, from, ImmutableMap.of(STRUCTURE_UUID_FIELD, idStore, PATH_FIELD, from, LINKED_PATH_FIELD, to, DELETED_FIELD, new RemoveProperty()), true); } finally { statsService.apiCall(ContentManagerImpl.class.getName(), "link", System.currentTimeMillis() - t); } } }
public class class_name { protected void moveSelectionUp() { final IStructuredSelection selection = this.list.getStructuredSelection(); final int index = this.conversions.indexOf(selection.getFirstElement()); if (index > 0) { final ConversionMapping previous = this.conversions.remove(index - 1); this.conversions.add(index + selection.size() - 1, previous); refreshListUI(); this.list.refresh(true); enableButtons(); preferenceValueChanged(); } } }
public class class_name { protected void moveSelectionUp() { final IStructuredSelection selection = this.list.getStructuredSelection(); final int index = this.conversions.indexOf(selection.getFirstElement()); if (index > 0) { final ConversionMapping previous = this.conversions.remove(index - 1); this.conversions.add(index + selection.size() - 1, previous); // depends on control dependency: [if], data = [(index] refreshListUI(); // depends on control dependency: [if], data = [none] this.list.refresh(true); // depends on control dependency: [if], data = [none] enableButtons(); // depends on control dependency: [if], data = [none] preferenceValueChanged(); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected String resolveHttpMethodFromMethodName(final String methodName) { int i = 0; while (i < methodName.length()) { if (CharUtil.isUppercaseAlpha(methodName.charAt(i))) { break; } i++; } final String name = methodName.substring(0, i).toUpperCase(); for (final HttpMethod httpMethod : HttpMethod.values()) { if (httpMethod.equalsName(name)) { return httpMethod.name(); } } return null; } }
public class class_name { protected String resolveHttpMethodFromMethodName(final String methodName) { int i = 0; while (i < methodName.length()) { if (CharUtil.isUppercaseAlpha(methodName.charAt(i))) { break; } i++; // depends on control dependency: [while], data = [none] } final String name = methodName.substring(0, i).toUpperCase(); for (final HttpMethod httpMethod : HttpMethod.values()) { if (httpMethod.equalsName(name)) { return httpMethod.name(); // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { public void append(final float element) { if (offset - buffer.length >= 0) { grow(offset); } buffer[offset++] = element; } }
public class class_name { public void append(final float element) { if (offset - buffer.length >= 0) { grow(offset); // depends on control dependency: [if], data = [none] } buffer[offset++] = element; } }
public class class_name { protected void countPoiTags(TDNode poi) { if (poi == null || poi.getTags() == null) { return; } for (short tag : poi.getTags().keySet()) { this.histogramPoiTags.adjustOrPutValue(tag, 1, 1); } } }
public class class_name { protected void countPoiTags(TDNode poi) { if (poi == null || poi.getTags() == null) { return; // depends on control dependency: [if], data = [none] } for (short tag : poi.getTags().keySet()) { this.histogramPoiTags.adjustOrPutValue(tag, 1, 1); // depends on control dependency: [for], data = [tag] } } }
public class class_name { private Collection<String> getCertServerNames(X509Certificate x509) throws CertificateParsingException { Collection<String> serverNames = new LinkedHashSet<>(); /* Add CN for the certificate */ String certCN = getCertCN(x509); serverNames.add(certCN); /* Add alternative names for each certificate */ try { Collection<List<?>> altNames = x509.getSubjectAlternativeNames(); if (altNames != null) { for (List<?> entry : altNames) { if (entry.size() >= 2) { Object entryType = entry.get(0); if (entryType instanceof Integer && (Integer) entryType == 2) { Object field = entry.get(1); if (field instanceof String) { serverNames.add(((String) field).toLowerCase()); } } } } } } catch (CertificateParsingException cpe) { LOGGER.warn("Certificate alternative names ignored for certificate " + (certCN != null ? " " + certCN : ""), cpe); } return serverNames; } }
public class class_name { private Collection<String> getCertServerNames(X509Certificate x509) throws CertificateParsingException { Collection<String> serverNames = new LinkedHashSet<>(); /* Add CN for the certificate */ String certCN = getCertCN(x509); serverNames.add(certCN); /* Add alternative names for each certificate */ try { Collection<List<?>> altNames = x509.getSubjectAlternativeNames(); if (altNames != null) { for (List<?> entry : altNames) { if (entry.size() >= 2) { Object entryType = entry.get(0); if (entryType instanceof Integer && (Integer) entryType == 2) { Object field = entry.get(1); if (field instanceof String) { serverNames.add(((String) field).toLowerCase()); // depends on control dependency: [if], data = [none] } } } } } } catch (CertificateParsingException cpe) { LOGGER.warn("Certificate alternative names ignored for certificate " + (certCN != null ? " " + certCN : ""), cpe); } return serverNames; } }
public class class_name { public void afterPropertiesSet() throws Exception { Resource portletXml = resourceLoader.getResource("/WEB-INF/portlet.xml"); Document doc = getDocument(portletXml.getInputStream()); final XPathExpression roleNamesExpression; if (portletConfig == null) { final XPathFactory xPathFactory = XPathFactory.newInstance(); final XPath xPath = xPathFactory.newXPath(); roleNamesExpression = xPath.compile("/portlet-app/portlet/security-role-ref/role-name"); } else { final XPathFactory xPathFactory = XPathFactory.newInstance(); xPathFactory.setXPathVariableResolver(new XPathVariableResolver() { @Override public Object resolveVariable(QName variableName) { if ("portletName".equals(variableName.getLocalPart())) { return portletConfig.getPortletName(); } return null; } }); final XPath xPath = xPathFactory.newXPath(); roleNamesExpression = xPath.compile("/portlet-app/portlet[portlet-name=$portletName]/security-role-ref/role-name"); } final NodeList securityRoles = (NodeList)roleNamesExpression.evaluate(doc, XPathConstants.NODESET); final Set<String> roleNames = new HashSet<String>(); for (int i=0; i < securityRoles.getLength(); i++) { Element secRoleElt = (Element) securityRoles.item(i); String roleName = secRoleElt.getTextContent().trim(); roleNames.add(roleName); logger.info("Retrieved role-name '" + roleName + "' from portlet.xml"); } if (roleNames.isEmpty()) { logger.info("No security-role-ref elements found in " + portletXml + (portletConfig == null ? "" : " for portlet " + portletConfig.getPortletName())); } mappableAttributes = Collections.unmodifiableSet(roleNames); } }
public class class_name { public void afterPropertiesSet() throws Exception { Resource portletXml = resourceLoader.getResource("/WEB-INF/portlet.xml"); Document doc = getDocument(portletXml.getInputStream()); final XPathExpression roleNamesExpression; if (portletConfig == null) { final XPathFactory xPathFactory = XPathFactory.newInstance(); final XPath xPath = xPathFactory.newXPath(); roleNamesExpression = xPath.compile("/portlet-app/portlet/security-role-ref/role-name"); } else { final XPathFactory xPathFactory = XPathFactory.newInstance(); xPathFactory.setXPathVariableResolver(new XPathVariableResolver() { @Override public Object resolveVariable(QName variableName) { if ("portletName".equals(variableName.getLocalPart())) { return portletConfig.getPortletName(); // depends on control dependency: [if], data = [none] } return null; } }); final XPath xPath = xPathFactory.newXPath(); roleNamesExpression = xPath.compile("/portlet-app/portlet[portlet-name=$portletName]/security-role-ref/role-name"); } final NodeList securityRoles = (NodeList)roleNamesExpression.evaluate(doc, XPathConstants.NODESET); final Set<String> roleNames = new HashSet<String>(); for (int i=0; i < securityRoles.getLength(); i++) { Element secRoleElt = (Element) securityRoles.item(i); String roleName = secRoleElt.getTextContent().trim(); roleNames.add(roleName); logger.info("Retrieved role-name '" + roleName + "' from portlet.xml"); } if (roleNames.isEmpty()) { logger.info("No security-role-ref elements found in " + portletXml + (portletConfig == null ? "" : " for portlet " + portletConfig.getPortletName())); } mappableAttributes = Collections.unmodifiableSet(roleNames); } }
public class class_name { public void marshall(Eac3Settings eac3Settings, ProtocolMarshaller protocolMarshaller) { if (eac3Settings == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(eac3Settings.getAttenuationControl(), ATTENUATIONCONTROL_BINDING); protocolMarshaller.marshall(eac3Settings.getBitrate(), BITRATE_BINDING); protocolMarshaller.marshall(eac3Settings.getBitstreamMode(), BITSTREAMMODE_BINDING); protocolMarshaller.marshall(eac3Settings.getCodingMode(), CODINGMODE_BINDING); protocolMarshaller.marshall(eac3Settings.getDcFilter(), DCFILTER_BINDING); protocolMarshaller.marshall(eac3Settings.getDialnorm(), DIALNORM_BINDING); protocolMarshaller.marshall(eac3Settings.getDynamicRangeCompressionLine(), DYNAMICRANGECOMPRESSIONLINE_BINDING); protocolMarshaller.marshall(eac3Settings.getDynamicRangeCompressionRf(), DYNAMICRANGECOMPRESSIONRF_BINDING); protocolMarshaller.marshall(eac3Settings.getLfeControl(), LFECONTROL_BINDING); protocolMarshaller.marshall(eac3Settings.getLfeFilter(), LFEFILTER_BINDING); protocolMarshaller.marshall(eac3Settings.getLoRoCenterMixLevel(), LOROCENTERMIXLEVEL_BINDING); protocolMarshaller.marshall(eac3Settings.getLoRoSurroundMixLevel(), LOROSURROUNDMIXLEVEL_BINDING); protocolMarshaller.marshall(eac3Settings.getLtRtCenterMixLevel(), LTRTCENTERMIXLEVEL_BINDING); protocolMarshaller.marshall(eac3Settings.getLtRtSurroundMixLevel(), LTRTSURROUNDMIXLEVEL_BINDING); protocolMarshaller.marshall(eac3Settings.getMetadataControl(), METADATACONTROL_BINDING); protocolMarshaller.marshall(eac3Settings.getPassthroughControl(), PASSTHROUGHCONTROL_BINDING); protocolMarshaller.marshall(eac3Settings.getPhaseControl(), PHASECONTROL_BINDING); protocolMarshaller.marshall(eac3Settings.getSampleRate(), SAMPLERATE_BINDING); protocolMarshaller.marshall(eac3Settings.getStereoDownmix(), STEREODOWNMIX_BINDING); protocolMarshaller.marshall(eac3Settings.getSurroundExMode(), SURROUNDEXMODE_BINDING); protocolMarshaller.marshall(eac3Settings.getSurroundMode(), SURROUNDMODE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(Eac3Settings eac3Settings, ProtocolMarshaller protocolMarshaller) { if (eac3Settings == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(eac3Settings.getAttenuationControl(), ATTENUATIONCONTROL_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(eac3Settings.getBitrate(), BITRATE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(eac3Settings.getBitstreamMode(), BITSTREAMMODE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(eac3Settings.getCodingMode(), CODINGMODE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(eac3Settings.getDcFilter(), DCFILTER_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(eac3Settings.getDialnorm(), DIALNORM_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(eac3Settings.getDynamicRangeCompressionLine(), DYNAMICRANGECOMPRESSIONLINE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(eac3Settings.getDynamicRangeCompressionRf(), DYNAMICRANGECOMPRESSIONRF_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(eac3Settings.getLfeControl(), LFECONTROL_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(eac3Settings.getLfeFilter(), LFEFILTER_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(eac3Settings.getLoRoCenterMixLevel(), LOROCENTERMIXLEVEL_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(eac3Settings.getLoRoSurroundMixLevel(), LOROSURROUNDMIXLEVEL_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(eac3Settings.getLtRtCenterMixLevel(), LTRTCENTERMIXLEVEL_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(eac3Settings.getLtRtSurroundMixLevel(), LTRTSURROUNDMIXLEVEL_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(eac3Settings.getMetadataControl(), METADATACONTROL_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(eac3Settings.getPassthroughControl(), PASSTHROUGHCONTROL_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(eac3Settings.getPhaseControl(), PHASECONTROL_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(eac3Settings.getSampleRate(), SAMPLERATE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(eac3Settings.getStereoDownmix(), STEREODOWNMIX_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(eac3Settings.getSurroundExMode(), SURROUNDEXMODE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(eac3Settings.getSurroundMode(), SURROUNDMODE_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void start(final int timeout, boolean daemon) throws IOException { this.myServerSocket = this.getServerSocketFactory().create(); this.myServerSocket.setReuseAddress(true); ServerRunnable serverRunnable = createServerRunnable(timeout); this.myThread = new Thread(serverRunnable); this.myThread.setDaemon(daemon); this.myThread.setName("NanoHttpd Main Listener"); this.myThread.start(); while (!serverRunnable.hasBinded && serverRunnable.bindException == null) { try { Thread.sleep(10L); } catch (Throwable e) { // on android this may not be allowed, that's why we // catch throwable the wait should be very short because we are // just waiting for the bind of the socket } } if (serverRunnable.bindException != null) { throw serverRunnable.bindException; } } }
public class class_name { public void start(final int timeout, boolean daemon) throws IOException { this.myServerSocket = this.getServerSocketFactory().create(); this.myServerSocket.setReuseAddress(true); ServerRunnable serverRunnable = createServerRunnable(timeout); this.myThread = new Thread(serverRunnable); this.myThread.setDaemon(daemon); this.myThread.setName("NanoHttpd Main Listener"); this.myThread.start(); while (!serverRunnable.hasBinded && serverRunnable.bindException == null) { try { Thread.sleep(10L); // depends on control dependency: [try], data = [none] } catch (Throwable e) { // on android this may not be allowed, that's why we // catch throwable the wait should be very short because we are // just waiting for the bind of the socket } // depends on control dependency: [catch], data = [none] } if (serverRunnable.bindException != null) { throw serverRunnable.bindException; } } }
public class class_name { public static String rot13(String _input) { if (_input == null) { return null; } StringBuilder sb = new StringBuilder(); for (int i = 0; i < _input.length(); i++) { char c = _input.charAt(i); if (c >= 'a' && c <= 'm') { c += 13; } else if (c >= 'A' && c <= 'M') { c += 13; } else if (c >= 'n' && c <= 'z') { c -= 13; } else if (c >= 'N' && c <= 'Z') { c -= 13; } sb.append(c); } return sb.toString(); } }
public class class_name { public static String rot13(String _input) { if (_input == null) { return null; // depends on control dependency: [if], data = [none] } StringBuilder sb = new StringBuilder(); for (int i = 0; i < _input.length(); i++) { char c = _input.charAt(i); if (c >= 'a' && c <= 'm') { c += 13; // depends on control dependency: [if], data = [none] } else if (c >= 'A' && c <= 'M') { c += 13; // depends on control dependency: [if], data = [none] } else if (c >= 'n' && c <= 'z') { c -= 13; // depends on control dependency: [if], data = [none] } else if (c >= 'N' && c <= 'Z') { c -= 13; // depends on control dependency: [if], data = [none] } sb.append(c); // depends on control dependency: [for], data = [none] } return sb.toString(); } }
public class class_name { protected synchronized MessageDigest getDigest() { if (this.digest == null) { try { this.digest = MessageDigest.getInstance(algorithm); } catch (NoSuchAlgorithmException e) { try { this.digest = MessageDigest.getInstance(DEFAULT_ALGORITHM); } catch (NoSuchAlgorithmException f) { this.digest = null; } } } return (this.digest); } }
public class class_name { protected synchronized MessageDigest getDigest() { if (this.digest == null) { try { this.digest = MessageDigest.getInstance(algorithm); // depends on control dependency: [try], data = [none] } catch (NoSuchAlgorithmException e) { try { this.digest = MessageDigest.getInstance(DEFAULT_ALGORITHM); // depends on control dependency: [try], data = [none] } catch (NoSuchAlgorithmException f) { this.digest = null; } // depends on control dependency: [catch], data = [none] } // depends on control dependency: [catch], data = [none] } return (this.digest); } }
public class class_name { public InjectionNode analyze(final InjectionSignature signature, final InjectionSignature concreteType, final AnalysisContext context) { InjectionNode injectionNode; if (context.isDependent(concreteType.getType())) { //if this type is a dependency of itself, we've found a back link. //This dependency loop must be broken using a virtual proxy injectionNode = context.getInjectionNode(concreteType.getType()); Collection<InjectionNode> loopedDependencies = context.getDependencyHistory(); InjectionNode proxyDependency = findProxyableDependency(injectionNode, loopedDependencies); if (proxyDependency == null) { throw new TransfuseAnalysisException("Unable to find a dependency to proxy"); } VirtualProxyAspect proxyAspect = getProxyAspect(proxyDependency); proxyAspect.getProxyInterfaces().add(proxyDependency.getUsageType()); } else { injectionNode = new InjectionNode(signature, concreteType); //default variable builder injectionNode.addAspect(VariableBuilder.class, variableInjectionBuilderProvider.get()); AnalysisContext nextContext = context.addDependent(injectionNode); //loop over super classes (extension and implements) scanClassHierarchy(concreteType.getType(), injectionNode, nextContext); } return injectionNode; } }
public class class_name { public InjectionNode analyze(final InjectionSignature signature, final InjectionSignature concreteType, final AnalysisContext context) { InjectionNode injectionNode; if (context.isDependent(concreteType.getType())) { //if this type is a dependency of itself, we've found a back link. //This dependency loop must be broken using a virtual proxy injectionNode = context.getInjectionNode(concreteType.getType()); // depends on control dependency: [if], data = [none] Collection<InjectionNode> loopedDependencies = context.getDependencyHistory(); InjectionNode proxyDependency = findProxyableDependency(injectionNode, loopedDependencies); if (proxyDependency == null) { throw new TransfuseAnalysisException("Unable to find a dependency to proxy"); } VirtualProxyAspect proxyAspect = getProxyAspect(proxyDependency); proxyAspect.getProxyInterfaces().add(proxyDependency.getUsageType()); // depends on control dependency: [if], data = [none] } else { injectionNode = new InjectionNode(signature, concreteType); // depends on control dependency: [if], data = [none] //default variable builder injectionNode.addAspect(VariableBuilder.class, variableInjectionBuilderProvider.get()); // depends on control dependency: [if], data = [none] AnalysisContext nextContext = context.addDependent(injectionNode); //loop over super classes (extension and implements) scanClassHierarchy(concreteType.getType(), injectionNode, nextContext); // depends on control dependency: [if], data = [none] } return injectionNode; } }
public class class_name { public List<String> asLabels() { List<String> labels = new ArrayList<>(); for (T element : getElements()) { labels.add(element.getLabel()); } return labels; } }
public class class_name { public List<String> asLabels() { List<String> labels = new ArrayList<>(); for (T element : getElements()) { labels.add(element.getLabel()); // depends on control dependency: [for], data = [element] } return labels; } }
public class class_name { public ExecutionVertex getInputExecutionVertex(int index) { final Iterator<ExecutionGroupVertex> it = this.stageMembers.iterator(); while (it.hasNext()) { final ExecutionGroupVertex groupVertex = it.next(); if (groupVertex.isInputVertex()) { final int numberOfMembers = groupVertex.getCurrentNumberOfGroupMembers(); if (index >= numberOfMembers) { index -= numberOfMembers; } else { return groupVertex.getGroupMember(index); } } } return null; } }
public class class_name { public ExecutionVertex getInputExecutionVertex(int index) { final Iterator<ExecutionGroupVertex> it = this.stageMembers.iterator(); while (it.hasNext()) { final ExecutionGroupVertex groupVertex = it.next(); if (groupVertex.isInputVertex()) { final int numberOfMembers = groupVertex.getCurrentNumberOfGroupMembers(); if (index >= numberOfMembers) { index -= numberOfMembers; // depends on control dependency: [if], data = [none] } else { return groupVertex.getGroupMember(index); // depends on control dependency: [if], data = [(index] } } } return null; } }