code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public String getLockedByName() { String lockedBy = ""; if (!getLock().isNullLock()) { // user lockedBy = getLock().getUserId().toString(); try { lockedBy = getCurrentOuRelativeName( CmsPrincipal.readPrincipalIncludingHistory(getCms(), getLock().getUserId()).getName()); } catch (Throwable e) { lockedBy = e.getMessage(); } } return lockedBy; } }
public class class_name { public String getLockedByName() { String lockedBy = ""; if (!getLock().isNullLock()) { // user lockedBy = getLock().getUserId().toString(); // depends on control dependency: [if], data = [none] try { lockedBy = getCurrentOuRelativeName( CmsPrincipal.readPrincipalIncludingHistory(getCms(), getLock().getUserId()).getName()); // depends on control dependency: [try], data = [none] } catch (Throwable e) { lockedBy = e.getMessage(); } // depends on control dependency: [catch], data = [none] } return lockedBy; } }
public class class_name { boolean first(RowCursor minCursor, RowCursor resultCursor, boolean isMatch) { int ptr = _rowHead; int rowLength = resultCursor.length(); int removeLength = resultCursor.removeLength(); int sortOffset = _rowSortHead; byte []buffer = _buffer; while (ptr < sortOffset) { int code = buffer[ptr] & CODE_MASK; int minCmp; int cmp; switch (code) { case INSERT: if ((minCmp = minCursor.compareKeyRow(buffer, ptr)) <= 0 && ((cmp = resultCursor.compareKeyRow(buffer, ptr)) > 0 || cmp == 0 && ! isMatch)) { fillMatch(ptr, resultCursor); if (minCmp == 0) { return true; } isMatch = true; } ptr += rowLength; break; case INSERT_DEAD: ptr += rowLength; break; case REMOVE: if ((minCmp = minCursor.compareKeyRemove(buffer, ptr)) <= 0 && ((cmp = resultCursor.compareKeyRemove(buffer, ptr)) > 0 || cmp == 0 && ! isMatch)) { resultCursor.setRemove(buffer, ptr); //resultCursor.setKey(buffer, ptr + 1); if (minCmp == 0) { return true; } isMatch = true; } ptr += removeLength; break; default: System.out.println("BROKEN_ENTRY:"); return false; } } if (sortOffset < BLOCK_SIZE) { return findFirstSorted(minCursor, resultCursor, isMatch); } else { return isMatch; } } }
public class class_name { boolean first(RowCursor minCursor, RowCursor resultCursor, boolean isMatch) { int ptr = _rowHead; int rowLength = resultCursor.length(); int removeLength = resultCursor.removeLength(); int sortOffset = _rowSortHead; byte []buffer = _buffer; while (ptr < sortOffset) { int code = buffer[ptr] & CODE_MASK; int minCmp; int cmp; switch (code) { case INSERT: if ((minCmp = minCursor.compareKeyRow(buffer, ptr)) <= 0 && ((cmp = resultCursor.compareKeyRow(buffer, ptr)) > 0 || cmp == 0 && ! isMatch)) { fillMatch(ptr, resultCursor); // depends on control dependency: [if], data = [none] if (minCmp == 0) { return true; // depends on control dependency: [if], data = [none] } isMatch = true; // depends on control dependency: [if], data = [none] } ptr += rowLength; break; case INSERT_DEAD: ptr += rowLength; break; case REMOVE: if ((minCmp = minCursor.compareKeyRemove(buffer, ptr)) <= 0 && ((cmp = resultCursor.compareKeyRemove(buffer, ptr)) > 0 || cmp == 0 && ! isMatch)) { resultCursor.setRemove(buffer, ptr); // depends on control dependency: [if], data = [none] //resultCursor.setKey(buffer, ptr + 1); if (minCmp == 0) { return true; // depends on control dependency: [if], data = [none] } isMatch = true; // depends on control dependency: [if], data = [none] } ptr += removeLength; break; default: System.out.println("BROKEN_ENTRY:"); return false; } } if (sortOffset < BLOCK_SIZE) { return findFirstSorted(minCursor, resultCursor, isMatch); // depends on control dependency: [if], data = [none] } else { return isMatch; // depends on control dependency: [if], data = [none] } } }
public class class_name { public final EObject entryRuleXShortClosure() throws RecognitionException { EObject current = null; EObject iv_ruleXShortClosure = null; try { // InternalSARL.g:14143:54: (iv_ruleXShortClosure= ruleXShortClosure EOF ) // InternalSARL.g:14144:2: iv_ruleXShortClosure= ruleXShortClosure EOF { if ( state.backtracking==0 ) { newCompositeNode(grammarAccess.getXShortClosureRule()); } pushFollow(FOLLOW_1); iv_ruleXShortClosure=ruleXShortClosure(); state._fsp--; if (state.failed) return current; if ( state.backtracking==0 ) { current =iv_ruleXShortClosure; } match(input,EOF,FOLLOW_2); if (state.failed) return current; } } catch (RecognitionException re) { recover(input,re); appendSkippedTokens(); } finally { } return current; } }
public class class_name { public final EObject entryRuleXShortClosure() throws RecognitionException { EObject current = null; EObject iv_ruleXShortClosure = null; try { // InternalSARL.g:14143:54: (iv_ruleXShortClosure= ruleXShortClosure EOF ) // InternalSARL.g:14144:2: iv_ruleXShortClosure= ruleXShortClosure EOF { if ( state.backtracking==0 ) { newCompositeNode(grammarAccess.getXShortClosureRule()); // depends on control dependency: [if], data = [none] } pushFollow(FOLLOW_1); iv_ruleXShortClosure=ruleXShortClosure(); state._fsp--; if (state.failed) return current; if ( state.backtracking==0 ) { current =iv_ruleXShortClosure; // depends on control dependency: [if], data = [none] } match(input,EOF,FOLLOW_2); if (state.failed) return current; } } catch (RecognitionException re) { recover(input,re); appendSkippedTokens(); } finally { } return current; } }
public class class_name { public BucketsSample sample() { synchronized (buckets) { BucketSample[] bucketSamples = new BucketSample[buckets.length]; for (int i = 0; i < buckets.length; i++) { bucketSamples[i] = buckets[i].sample(); } Double[] quantiles = getQuantiles(0.50D, 0.90D); return new BucketsSample(bucketSamples, quantiles[0], quantiles[1]); } } }
public class class_name { public BucketsSample sample() { synchronized (buckets) { BucketSample[] bucketSamples = new BucketSample[buckets.length]; for (int i = 0; i < buckets.length; i++) { bucketSamples[i] = buckets[i].sample(); // depends on control dependency: [for], data = [i] } Double[] quantiles = getQuantiles(0.50D, 0.90D); return new BucketsSample(bucketSamples, quantiles[0], quantiles[1]); } } }
public class class_name { @Override public Date getFinalFireTime () { if (m_bComplete || getEndTime () == null) { return null; } // We have an endTime, we still need to check to see if there is a // endTimeOfDay if that's applicable. Date eTime = getEndTime (); if (m_aEndTimeOfDay != null) { final Date endTimeOfDayDate = m_aEndTimeOfDay.getTimeOfDayForDate (eTime); if (eTime.getTime () < endTimeOfDayDate.getTime ()) { eTime = endTimeOfDayDate; } } return eTime; } }
public class class_name { @Override public Date getFinalFireTime () { if (m_bComplete || getEndTime () == null) { return null; // depends on control dependency: [if], data = [none] } // We have an endTime, we still need to check to see if there is a // endTimeOfDay if that's applicable. Date eTime = getEndTime (); if (m_aEndTimeOfDay != null) { final Date endTimeOfDayDate = m_aEndTimeOfDay.getTimeOfDayForDate (eTime); if (eTime.getTime () < endTimeOfDayDate.getTime ()) { eTime = endTimeOfDayDate; // depends on control dependency: [if], data = [none] } } return eTime; } }
public class class_name { public void addConstant(ConstantPoolEntry entry) { if (entry instanceof Utf8Constant) { Utf8Constant utf8 = (Utf8Constant) entry; _utf8Map.put(utf8.getValue(), utf8); } _entries.add(entry); } }
public class class_name { public void addConstant(ConstantPoolEntry entry) { if (entry instanceof Utf8Constant) { Utf8Constant utf8 = (Utf8Constant) entry; _utf8Map.put(utf8.getValue(), utf8); // depends on control dependency: [if], data = [none] } _entries.add(entry); } }
public class class_name { public static <T> List<T> distinct(final T[] a) { if (N.isNullOrEmpty(a)) { return new ArrayList<>(); } return distinct(a, 0, a.length); } }
public class class_name { public static <T> List<T> distinct(final T[] a) { if (N.isNullOrEmpty(a)) { return new ArrayList<>(); // depends on control dependency: [if], data = [none] } return distinct(a, 0, a.length); } }
public class class_name { public static PvmExecutionImpl determinePropagatingExecutionOnEnd(PvmExecutionImpl propagatingExecution, Map<ScopeImpl, PvmExecutionImpl> activityExecutionMapping) { if (!propagatingExecution.isScope()) { // non-scope executions may end in the "wrong" flow scope return propagatingExecution; } else { // superfluous scope executions won't be contained in the activity-execution mapping if (activityExecutionMapping.values().contains(propagatingExecution)) { return propagatingExecution; } else { // skip one scope propagatingExecution.remove(); PvmExecutionImpl parent = propagatingExecution.getParent(); parent.setActivity(propagatingExecution.getActivity()); return propagatingExecution.getParent(); } } } }
public class class_name { public static PvmExecutionImpl determinePropagatingExecutionOnEnd(PvmExecutionImpl propagatingExecution, Map<ScopeImpl, PvmExecutionImpl> activityExecutionMapping) { if (!propagatingExecution.isScope()) { // non-scope executions may end in the "wrong" flow scope return propagatingExecution; // depends on control dependency: [if], data = [none] } else { // superfluous scope executions won't be contained in the activity-execution mapping if (activityExecutionMapping.values().contains(propagatingExecution)) { return propagatingExecution; // depends on control dependency: [if], data = [none] } else { // skip one scope propagatingExecution.remove(); // depends on control dependency: [if], data = [none] PvmExecutionImpl parent = propagatingExecution.getParent(); parent.setActivity(propagatingExecution.getActivity()); // depends on control dependency: [if], data = [none] return propagatingExecution.getParent(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private void copyMembers(CmsClientSitemapEntry source) { setId(source.getId()); setName(source.getName()); setOwnProperties(new HashMap<String, CmsClientProperty>(source.getOwnProperties())); setDefaultFileId(source.getDefaultFileId()); setDefaultFileType(source.getDefaultFileType()); Map<String, CmsClientProperty> defaultFileProperties = source.getDefaultFileProperties(); if (defaultFileProperties == null) { defaultFileProperties = new HashMap<String, CmsClientProperty>(); } setDefaultFileProperties(new HashMap<String, CmsClientProperty>(defaultFileProperties)); if (source.getDetailpageTypeName() != null) { // do not copy the detail page type name unless it is not null, otherwise newly created detail pages // are not displayed correctly in the sitemap editor. setDetailpageTypeName(source.getDetailpageTypeName()); } setSitePath(source.getSitePath()); setVfsPath(source.getVfsPath()); setLock(source.getLock()); setEntryType(source.getEntryType()); setInNavigation(source.isInNavigation()); setHasForeignFolderLock(source.hasForeignFolderLock()); setBlockingLockedChildren(source.hasBlockingLockedChildren()); setFolderDefaultPage(source.isFolderDefaultPage()); setResourceTypeName(source.getResourceTypeName()); setChildrenLoadedInitially(source.getChildrenLoadedInitially()); setFolderDefaultPage(source.isFolderDefaultPage()); setDateExpired(source.getDateExpired()); setDateReleased(source.getDateReleased()); setResleasedAndNotExpired(source.isResleasedAndNotExpired()); setDefaultFileReleased(source.isDefaultFileReleased()); setAliases(source.getAliases()); setRedirectTarget(source.getRedirectTarget()); setResourceState(source.getResourceState()); setPermissionInfo(source.m_permissionInfo); } }
public class class_name { private void copyMembers(CmsClientSitemapEntry source) { setId(source.getId()); setName(source.getName()); setOwnProperties(new HashMap<String, CmsClientProperty>(source.getOwnProperties())); setDefaultFileId(source.getDefaultFileId()); setDefaultFileType(source.getDefaultFileType()); Map<String, CmsClientProperty> defaultFileProperties = source.getDefaultFileProperties(); if (defaultFileProperties == null) { defaultFileProperties = new HashMap<String, CmsClientProperty>(); // depends on control dependency: [if], data = [none] } setDefaultFileProperties(new HashMap<String, CmsClientProperty>(defaultFileProperties)); if (source.getDetailpageTypeName() != null) { // do not copy the detail page type name unless it is not null, otherwise newly created detail pages // are not displayed correctly in the sitemap editor. setDetailpageTypeName(source.getDetailpageTypeName()); // depends on control dependency: [if], data = [(source.getDetailpageTypeName()] } setSitePath(source.getSitePath()); setVfsPath(source.getVfsPath()); setLock(source.getLock()); setEntryType(source.getEntryType()); setInNavigation(source.isInNavigation()); setHasForeignFolderLock(source.hasForeignFolderLock()); setBlockingLockedChildren(source.hasBlockingLockedChildren()); setFolderDefaultPage(source.isFolderDefaultPage()); setResourceTypeName(source.getResourceTypeName()); setChildrenLoadedInitially(source.getChildrenLoadedInitially()); setFolderDefaultPage(source.isFolderDefaultPage()); setDateExpired(source.getDateExpired()); setDateReleased(source.getDateReleased()); setResleasedAndNotExpired(source.isResleasedAndNotExpired()); setDefaultFileReleased(source.isDefaultFileReleased()); setAliases(source.getAliases()); setRedirectTarget(source.getRedirectTarget()); setResourceState(source.getResourceState()); setPermissionInfo(source.m_permissionInfo); } }
public class class_name { @Override void updateDataFields(int why) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "updateDataFields", why); super.updateDataFields(why); // If we have an unserialized object if (hasRealObject && !hasSerializedRealObject) { // If we are encoding for transmission, flattening or creation of a datagraph // then serialize the data if (why == MfpConstants.UDF_ENCODE || why == MfpConstants.UDF_FLATTEN || why == MfpConstants.UDF_MAKE_INBOUND_SDO) { try { serializeRealObject(); } catch (ObjectFailedToSerializeException ofse) { // No FFDC code needed // The underlying IOException has already been FFDC'd if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Payload object serialization failed so payload will be empty."); // We are unable to serialize the object due to an application error. // To avoid screwing up the system we clear the object reference and set null // into the JMF message then carry on. // We could hang on to the real object, in case a local consumer is available // quickly enough, but we don't as the outcome would then be non-deterministic // and the problem more difficult to diagnose. realObject = null; getPayload().setField(JmsObjectBodyAccess.BODY_DATA_VALUE, null); // We set hasRealObject to false, so we don't waste time looking for a soft // reference to it because it is null. There is no need to set // hasSerializedRealObject to true, as we no longer think we have a real object. hasRealObject = false; // We set the message's Exception fields so that there is a clue to why the payload is now empty. setExceptionReason(ofse.getExceptionReason()); setExceptionInserts(ofse.getExceptionInserts()); setExceptionTimestamp(System.currentTimeMillis()); setExceptionProblemDestination(null); setExceptionProblemSubscription(null); } } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "updateDataFields"); } }
public class class_name { @Override void updateDataFields(int why) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "updateDataFields", why); super.updateDataFields(why); // If we have an unserialized object if (hasRealObject && !hasSerializedRealObject) { // If we are encoding for transmission, flattening or creation of a datagraph // then serialize the data if (why == MfpConstants.UDF_ENCODE || why == MfpConstants.UDF_FLATTEN || why == MfpConstants.UDF_MAKE_INBOUND_SDO) { try { serializeRealObject(); // depends on control dependency: [try], data = [none] } catch (ObjectFailedToSerializeException ofse) { // No FFDC code needed // The underlying IOException has already been FFDC'd if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Payload object serialization failed so payload will be empty."); // We are unable to serialize the object due to an application error. // To avoid screwing up the system we clear the object reference and set null // into the JMF message then carry on. // We could hang on to the real object, in case a local consumer is available // quickly enough, but we don't as the outcome would then be non-deterministic // and the problem more difficult to diagnose. realObject = null; getPayload().setField(JmsObjectBodyAccess.BODY_DATA_VALUE, null); // We set hasRealObject to false, so we don't waste time looking for a soft // reference to it because it is null. There is no need to set // hasSerializedRealObject to true, as we no longer think we have a real object. hasRealObject = false; // We set the message's Exception fields so that there is a clue to why the payload is now empty. setExceptionReason(ofse.getExceptionReason()); setExceptionInserts(ofse.getExceptionInserts()); setExceptionTimestamp(System.currentTimeMillis()); setExceptionProblemDestination(null); setExceptionProblemSubscription(null); } // depends on control dependency: [catch], data = [none] } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "updateDataFields"); } }
public class class_name { public void write(InputStream is, long length, boolean escape, boolean noBackslashEscapes) throws IOException { byte[] array = new byte[4096]; int len; while (length > 0 && (len = is.read(array, 0, Math.min(4096, (int) length))) > 0) { if (escape) { writeBytesEscaped(array, len, noBackslashEscapes); } else { write(array, 0, len); } length -= len; } } }
public class class_name { public void write(InputStream is, long length, boolean escape, boolean noBackslashEscapes) throws IOException { byte[] array = new byte[4096]; int len; while (length > 0 && (len = is.read(array, 0, Math.min(4096, (int) length))) > 0) { if (escape) { writeBytesEscaped(array, len, noBackslashEscapes); // depends on control dependency: [if], data = [none] } else { write(array, 0, len); // depends on control dependency: [if], data = [none] } length -= len; } } }
public class class_name { private List<XsdElement> getAllElementsRecursively(XsdAbstractElement element) { List<XsdElement> allGroupElements = new ArrayList<>(); List<XsdAbstractElement> directElements = element.getXsdElements().collect(Collectors.toList()); allGroupElements.addAll( directElements.stream() .filter(elem1 -> elem1 instanceof XsdElement) .map(elem1 -> (XsdElement) elem1) .collect(Collectors.toList())); for (XsdAbstractElement elem : directElements) { if ((elem instanceof XsdMultipleElements || elem instanceof XsdGroup) && elem.getXsdElements() != null) { allGroupElements.addAll(getAllElementsRecursively(elem)); } } return allGroupElements; } }
public class class_name { private List<XsdElement> getAllElementsRecursively(XsdAbstractElement element) { List<XsdElement> allGroupElements = new ArrayList<>(); List<XsdAbstractElement> directElements = element.getXsdElements().collect(Collectors.toList()); allGroupElements.addAll( directElements.stream() .filter(elem1 -> elem1 instanceof XsdElement) .map(elem1 -> (XsdElement) elem1) .collect(Collectors.toList())); for (XsdAbstractElement elem : directElements) { if ((elem instanceof XsdMultipleElements || elem instanceof XsdGroup) && elem.getXsdElements() != null) { allGroupElements.addAll(getAllElementsRecursively(elem)); // depends on control dependency: [if], data = [none] } } return allGroupElements; } }
public class class_name { @Override public boolean matches(IAtom atom) { if (!atom.getSymbol().equals("H")) { return false; } if (atom.getFormalCharge() == 1) { // proton matches return true; } // hydrogens connected to other hydrogens, e.g., molecular hydrogen List<IAtom> list = invariants(atom).target().getConnectedAtomsList(atom); for (IAtom connAtom : list) { if (connAtom.getSymbol().equals("H")) { return true; } } // hydrogens connected to other than one other atom, e.g., bridging hydrogens if (invariants(atom).degree() > 1) { return true; } //isotopic hydrogen specifications, e.g. deuterium [2H] or tritium etc if (atom.getMassNumber() != null) { if (getMassNumber().intValue() == atom.getMassNumber().intValue()) return true; } else { // target atom is [H], so make sure query atom has mass number = 1 if (getMassNumber() == 1) return true; } return false; } }
public class class_name { @Override public boolean matches(IAtom atom) { if (!atom.getSymbol().equals("H")) { return false; // depends on control dependency: [if], data = [none] } if (atom.getFormalCharge() == 1) { // proton matches return true; // depends on control dependency: [if], data = [none] } // hydrogens connected to other hydrogens, e.g., molecular hydrogen List<IAtom> list = invariants(atom).target().getConnectedAtomsList(atom); for (IAtom connAtom : list) { if (connAtom.getSymbol().equals("H")) { return true; // depends on control dependency: [if], data = [none] } } // hydrogens connected to other than one other atom, e.g., bridging hydrogens if (invariants(atom).degree() > 1) { return true; // depends on control dependency: [if], data = [none] } //isotopic hydrogen specifications, e.g. deuterium [2H] or tritium etc if (atom.getMassNumber() != null) { if (getMassNumber().intValue() == atom.getMassNumber().intValue()) return true; } else { // target atom is [H], so make sure query atom has mass number = 1 if (getMassNumber() == 1) return true; } return false; } }
public class class_name { @Override public URLStreamHandler createURLStreamHandler(final String protocol) { if (null == protocol) { throw new IllegalArgumentException("null protocol not allowed"); } if (logger.isTraceEnabled()) { logger.trace("need to create URLStreamHandler for protocol {}", protocol); } final String proto = protocol.toLowerCase(); if (PROTO_HTTP.equals(proto) || PROTO_HTTPS.equals(proto)) { return new URLStreamHandler() { @Override protected URLConnection openConnection(final URL url) throws IOException { if (logger.isTraceEnabled()) { logger.trace("should open connection to {}", url.toExternalForm()); } // URLConnection only has a protected ctor, so we need to go through the URL ctor with the matching handler final URLConnection defaultUrlConnection = new URL(protocol, url.getHost(), url.getPort(), url.getFile(), handlers.get(protocol)) .openConnection(); if (!cache.urlShouldBeCached(url)) { if (logger.isTraceEnabled()) { logger.trace("not using cache for {}", url); } return defaultUrlConnection; } final Path cacheFile = cache.filenameForURL(url); // now wrap the defaultUrlConnection if (cache.isCached(url)) { // if cached, always use http connection to prevent ssl handshake. As we are reading from the // cache, this is enough return new CachingHttpURLConnection(cache, (HttpURLConnection) defaultUrlConnection); } else { switch (proto) { case PROTO_HTTP: return new CachingHttpURLConnection(cache, (HttpURLConnection) defaultUrlConnection); case PROTO_HTTPS: return new CachingHttpsURLConnection(cache, (HttpsURLConnection) defaultUrlConnection); } } throw new IOException("no matching handler"); } @Override protected URLConnection openConnection(final URL u, final Proxy p) throws IOException { if (logger.isTraceEnabled()) { logger.trace("should open connection to {} via {}", u.toExternalForm(), p); } // URLConnection only has a protected ctor, so we need to go through the URL ctor with the // matching handler to get a default implementation of the needed URLStreamHandler final URLConnection defaultUrlConnection = new URL(protocol, u.getHost(), u.getPort(), u.getFile(), handlers.get(protocol)) .openConnection(p); return defaultUrlConnection; } }; } // return null to use default ones return null; } }
public class class_name { @Override public URLStreamHandler createURLStreamHandler(final String protocol) { if (null == protocol) { throw new IllegalArgumentException("null protocol not allowed"); } if (logger.isTraceEnabled()) { logger.trace("need to create URLStreamHandler for protocol {}", protocol); // depends on control dependency: [if], data = [none] } final String proto = protocol.toLowerCase(); if (PROTO_HTTP.equals(proto) || PROTO_HTTPS.equals(proto)) { return new URLStreamHandler() { @Override protected URLConnection openConnection(final URL url) throws IOException { if (logger.isTraceEnabled()) { logger.trace("should open connection to {}", url.toExternalForm()); } // URLConnection only has a protected ctor, so we need to go through the URL ctor with the matching handler final URLConnection defaultUrlConnection = new URL(protocol, url.getHost(), url.getPort(), url.getFile(), handlers.get(protocol)) .openConnection(); if (!cache.urlShouldBeCached(url)) { if (logger.isTraceEnabled()) { logger.trace("not using cache for {}", url); // depends on control dependency: [if], data = [none] } return defaultUrlConnection; } final Path cacheFile = cache.filenameForURL(url); // now wrap the defaultUrlConnection if (cache.isCached(url)) { // if cached, always use http connection to prevent ssl handshake. As we are reading from the // cache, this is enough return new CachingHttpURLConnection(cache, (HttpURLConnection) defaultUrlConnection); } else { switch (proto) { case PROTO_HTTP: return new CachingHttpURLConnection(cache, (HttpURLConnection) defaultUrlConnection); case PROTO_HTTPS: return new CachingHttpsURLConnection(cache, (HttpsURLConnection) defaultUrlConnection); } } throw new IOException("no matching handler"); } // depends on control dependency: [if], data = [none] @Override protected URLConnection openConnection(final URL u, final Proxy p) throws IOException { if (logger.isTraceEnabled()) { logger.trace("should open connection to {} via {}", u.toExternalForm(), p); // depends on control dependency: [if], data = [none] } // URLConnection only has a protected ctor, so we need to go through the URL ctor with the // matching handler to get a default implementation of the needed URLStreamHandler final URLConnection defaultUrlConnection = new URL(protocol, u.getHost(), u.getPort(), u.getFile(), handlers.get(protocol)) .openConnection(p); return defaultUrlConnection; // depends on control dependency: [if], data = [none] } }; } // return null to use default ones return null; } }
public class class_name { public java.util.List<String> getOwners() { if (owners == null) { owners = new com.amazonaws.internal.SdkInternalList<String>(); } return owners; } }
public class class_name { public java.util.List<String> getOwners() { if (owners == null) { owners = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none] } return owners; } }
public class class_name { public static void main(String[] args) { CitrusRemoteServer server = new CitrusRemoteServer(args); if (server.configuration.getTimeToLive() > 0) { CompletableFuture.runAsync(() -> { try { new CompletableFuture<Void>().get(server.configuration.getTimeToLive(), TimeUnit.MILLISECONDS); } catch (InterruptedException | ExecutionException | TimeoutException e) { server.stop(); } }); } server.start(); if (server.configuration.isSystemExit()) { if (server.waitForCompletion()) { System.exit(0); } else { System.exit(-1); } } else { server.waitForCompletion(); } } }
public class class_name { public static void main(String[] args) { CitrusRemoteServer server = new CitrusRemoteServer(args); if (server.configuration.getTimeToLive() > 0) { CompletableFuture.runAsync(() -> { try { new CompletableFuture<Void>().get(server.configuration.getTimeToLive(), TimeUnit.MILLISECONDS); // depends on control dependency: [try], data = [none] } catch (InterruptedException | ExecutionException | TimeoutException e) { server.stop(); } // depends on control dependency: [catch], data = [none] }); } server.start(); if (server.configuration.isSystemExit()) { if (server.waitForCompletion()) { System.exit(0); // depends on control dependency: [if], data = [none] } else { System.exit(-1); // depends on control dependency: [if], data = [none] } } else { server.waitForCompletion(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public Observable<ServiceResponse<PersistedFace>> addFaceFromUrlWithServiceResponseAsync(String faceListId, String url, String userData, List<Integer> targetFace) { if (this.client.azureRegion() == null) { throw new IllegalArgumentException("Parameter this.client.azureRegion() is required and cannot be null."); } if (faceListId == null) { throw new IllegalArgumentException("Parameter faceListId is required and cannot be null."); } if (url == null) { throw new IllegalArgumentException("Parameter url is required and cannot be null."); } Validator.validate(targetFace); ImageUrl imageUrl = new ImageUrl(); imageUrl.withUrl(url); String parameterizedHost = Joiner.on(", ").join("{AzureRegion}", this.client.azureRegion()); String targetFaceConverted = this.client.serializerAdapter().serializeList(targetFace, CollectionFormat.CSV); return service.addFaceFromUrl(faceListId, userData, targetFaceConverted, this.client.acceptLanguage(), imageUrl, parameterizedHost, this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<PersistedFace>>>() { @Override public Observable<ServiceResponse<PersistedFace>> call(Response<ResponseBody> response) { try { ServiceResponse<PersistedFace> clientResponse = addFaceFromUrlDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } }
public class class_name { public Observable<ServiceResponse<PersistedFace>> addFaceFromUrlWithServiceResponseAsync(String faceListId, String url, String userData, List<Integer> targetFace) { if (this.client.azureRegion() == null) { throw new IllegalArgumentException("Parameter this.client.azureRegion() is required and cannot be null."); } if (faceListId == null) { throw new IllegalArgumentException("Parameter faceListId is required and cannot be null."); } if (url == null) { throw new IllegalArgumentException("Parameter url is required and cannot be null."); } Validator.validate(targetFace); ImageUrl imageUrl = new ImageUrl(); imageUrl.withUrl(url); String parameterizedHost = Joiner.on(", ").join("{AzureRegion}", this.client.azureRegion()); String targetFaceConverted = this.client.serializerAdapter().serializeList(targetFace, CollectionFormat.CSV); return service.addFaceFromUrl(faceListId, userData, targetFaceConverted, this.client.acceptLanguage(), imageUrl, parameterizedHost, this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<PersistedFace>>>() { @Override public Observable<ServiceResponse<PersistedFace>> call(Response<ResponseBody> response) { try { ServiceResponse<PersistedFace> clientResponse = addFaceFromUrlDelegate(response); return Observable.just(clientResponse); // depends on control dependency: [try], data = [none] } catch (Throwable t) { return Observable.error(t); } // depends on control dependency: [catch], data = [none] } }); } }
public class class_name { public static List<ContentRange> parseFromHeader(String rawRange, long totalSize, int maxNum) throws InvalidRangeException { List<ContentRange> result = new ArrayList<>(); if (rawRange != null) { if(!fullPattern.matcher(rawRange).matches()) { throw new InvalidRangeException("invalid syntax"); } rawRange = rawRange.substring("bytes=".length(), rawRange.length()); for(String partRange : Splitter.on(",") .omitEmptyStrings().trimResults().split(rawRange)) { if(result.size() >= totalSize) { throw new InvalidRangeException("more ranges than acceptable"); } long from = 0; long to = totalSize-1; Matcher m = partPattern.matcher(partRange); if(!m.find()) { throw new InvalidRangeException("invalid syntax for partial range"); } String fromString = m.group(1); String toString = m.group(2); if(fromString != null && !fromString.isEmpty()) { from = Long.parseLong(fromString); } if(toString != null && !toString.isEmpty()) { to = Long.parseLong(toString); } if(from > to) { throw new InvalidRangeException("start is larger then end"); } result.add(new ContentRange(from, to, totalSize)); } } return result; } }
public class class_name { public static List<ContentRange> parseFromHeader(String rawRange, long totalSize, int maxNum) throws InvalidRangeException { List<ContentRange> result = new ArrayList<>(); if (rawRange != null) { if(!fullPattern.matcher(rawRange).matches()) { throw new InvalidRangeException("invalid syntax"); } rawRange = rawRange.substring("bytes=".length(), rawRange.length()); for(String partRange : Splitter.on(",") .omitEmptyStrings().trimResults().split(rawRange)) { if(result.size() >= totalSize) { throw new InvalidRangeException("more ranges than acceptable"); } long from = 0; long to = totalSize-1; Matcher m = partPattern.matcher(partRange); if(!m.find()) { throw new InvalidRangeException("invalid syntax for partial range"); } String fromString = m.group(1); String toString = m.group(2); if(fromString != null && !fromString.isEmpty()) { from = Long.parseLong(fromString); // depends on control dependency: [if], data = [(fromString] } if(toString != null && !toString.isEmpty()) { to = Long.parseLong(toString); // depends on control dependency: [if], data = [(toString] } if(from > to) { throw new InvalidRangeException("start is larger then end"); } result.add(new ContentRange(from, to, totalSize)); } } return result; } }
public class class_name { static boolean isPortAvailable(int port) { ServerSocket ss = null; try { ss = new ServerSocket(port); ss.setReuseAddress(true); return true; } catch (IOException ioe) { // NOSONAR return false; } finally { closeQuietly(ss); } } }
public class class_name { static boolean isPortAvailable(int port) { ServerSocket ss = null; try { ss = new ServerSocket(port); // depends on control dependency: [try], data = [none] ss.setReuseAddress(true); // depends on control dependency: [try], data = [none] return true; // depends on control dependency: [try], data = [none] } catch (IOException ioe) { // NOSONAR return false; } finally { // depends on control dependency: [catch], data = [none] closeQuietly(ss); } } }
public class class_name { Observable<ChatResult> getPreviousMessages(final String conversationId) { return persistenceController.getConversation(conversationId) .map(conversation -> conversation != null ? conversation.getFirstLocalEventId() : null) .flatMap(from -> { final Long queryFrom; if (from != null) { if (from == 0) { return Observable.fromCallable(() -> new ChatResult(true, null)); } else if (from > 0) { queryFrom = from - 1; } else { queryFrom = null; } } else { queryFrom = null; } return checkState().flatMap(client -> client.service().messaging().queryMessages(conversationId, queryFrom, messagesPerQuery)) .flatMap(result -> persistenceController.processMessageQueryResponse(conversationId, result)) .flatMap(result -> persistenceController.processOrphanedEvents(result, orphanedEventsToRemoveListener)) .flatMap((Func1<ComapiResult<MessagesQueryResponse>, Observable<ChatResult>>) result -> (result.isSuccessful() && result.getResult().getMessages().isEmpty() && result.getResult().getEarliestEventId() > 0) ? getPreviousMessages(conversationId) : Observable.fromCallable(() -> new ChatResult(result.isSuccessful(), result.isSuccessful() ? null : new ChatResult.Error(result)))); }); } }
public class class_name { Observable<ChatResult> getPreviousMessages(final String conversationId) { return persistenceController.getConversation(conversationId) .map(conversation -> conversation != null ? conversation.getFirstLocalEventId() : null) .flatMap(from -> { final Long queryFrom; if (from != null) { if (from == 0) { return Observable.fromCallable(() -> new ChatResult(true, null)); // depends on control dependency: [if], data = [none] } else if (from > 0) { queryFrom = from - 1; // depends on control dependency: [if], data = [none] } else { queryFrom = null; // depends on control dependency: [if], data = [none] } } else { queryFrom = null; // depends on control dependency: [if], data = [none] } return checkState().flatMap(client -> client.service().messaging().queryMessages(conversationId, queryFrom, messagesPerQuery)) .flatMap(result -> persistenceController.processMessageQueryResponse(conversationId, result)) .flatMap(result -> persistenceController.processOrphanedEvents(result, orphanedEventsToRemoveListener)) .flatMap((Func1<ComapiResult<MessagesQueryResponse>, Observable<ChatResult>>) result -> (result.isSuccessful() && result.getResult().getMessages().isEmpty() && result.getResult().getEarliestEventId() > 0) ? getPreviousMessages(conversationId) : Observable.fromCallable(() -> new ChatResult(result.isSuccessful(), result.isSuccessful() ? null : new ChatResult.Error(result)))); }); } }
public class class_name { public static Vector<Object> toXmlRpcEnvironmentTypesParameters(Collection<EnvironmentType> envTypes) { Vector<Object> envTypesParams = new Vector<Object>(); for(EnvironmentType envType : envTypes) { envTypesParams.add(envType.marshallize()); } return envTypesParams; } }
public class class_name { public static Vector<Object> toXmlRpcEnvironmentTypesParameters(Collection<EnvironmentType> envTypes) { Vector<Object> envTypesParams = new Vector<Object>(); for(EnvironmentType envType : envTypes) { envTypesParams.add(envType.marshallize()); // depends on control dependency: [for], data = [envType] } return envTypesParams; } }
public class class_name { private void addDataSource(File adFile, List<Pair<Integer, Integer>> localPartitionsToSites, List<Integer> adFilePartitions, final ExportDataProcessor processor, final long genId) throws IOException { ExportDataSource source = new ExportDataSource(this, adFile, localPartitionsToSites, processor, genId); adFilePartitions.add(source.getPartitionId()); int migrateBatchSize = CatalogUtil.getPersistentMigrateBatchSize(source.getTableName()); source.setupMigrateRowsDeleter(migrateBatchSize); if (exportLog.isDebugEnabled()) { exportLog.debug("Creating " + source.toString() + " for " + adFile + " bytes " + source.sizeInBytes()); } synchronized(m_dataSourcesByPartition) { Map<String, ExportDataSource> dataSourcesForPartition = m_dataSourcesByPartition.get(source.getPartitionId()); if (dataSourcesForPartition == null) { dataSourcesForPartition = new HashMap<String, ExportDataSource>(); m_dataSourcesByPartition.put(source.getPartitionId(), dataSourcesForPartition); } else { if (dataSourcesForPartition.get(source.getTableName()) != null) { exportLog.warn("On Disk generation with same table, partition already exists using known data source."); return; } } dataSourcesForPartition.put(source.getTableName(), source); } } }
public class class_name { private void addDataSource(File adFile, List<Pair<Integer, Integer>> localPartitionsToSites, List<Integer> adFilePartitions, final ExportDataProcessor processor, final long genId) throws IOException { ExportDataSource source = new ExportDataSource(this, adFile, localPartitionsToSites, processor, genId); adFilePartitions.add(source.getPartitionId()); int migrateBatchSize = CatalogUtil.getPersistentMigrateBatchSize(source.getTableName()); source.setupMigrateRowsDeleter(migrateBatchSize); if (exportLog.isDebugEnabled()) { exportLog.debug("Creating " + source.toString() + " for " + adFile + " bytes " + source.sizeInBytes()); } synchronized(m_dataSourcesByPartition) { Map<String, ExportDataSource> dataSourcesForPartition = m_dataSourcesByPartition.get(source.getPartitionId()); if (dataSourcesForPartition == null) { dataSourcesForPartition = new HashMap<String, ExportDataSource>(); // depends on control dependency: [if], data = [none] m_dataSourcesByPartition.put(source.getPartitionId(), dataSourcesForPartition); // depends on control dependency: [if], data = [none] } else { if (dataSourcesForPartition.get(source.getTableName()) != null) { exportLog.warn("On Disk generation with same table, partition already exists using known data source."); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } } dataSourcesForPartition.put(source.getTableName(), source); } } }
public class class_name { public void setFidelity(String key, boolean decision) throws UnsupportedOption { if (key.equals(FEATURE_STRICT)) { if (decision) { // no other features allowed // (LEXICAL_VALUE is an exception) boolean prevContainedLexVal = options .contains(FEATURE_LEXICAL_VALUE); options.clear(); isComment = false; isPI = false; isDTD = false; isPrefix = false; isLexicalValue = false; isSC = false; if (prevContainedLexVal) { options.add(FEATURE_LEXICAL_VALUE); isLexicalValue = true; } options.add(FEATURE_STRICT); isStrict = true; } else { // remove strict (if present) options.remove(key); isStrict = false; } } else if (key.equals(FEATURE_LEXICAL_VALUE)) { // LEXICAL_VALUE is special --> does affect grammars if (decision) { options.add(key); isLexicalValue = true; } else { // remove option (if present) options.remove(key); isLexicalValue = false; } } else if (key.equals(FEATURE_COMMENT) || key.equals(FEATURE_PI) || key.equals(FEATURE_DTD) || key.equals(FEATURE_PREFIX) || key.equals(FEATURE_SC)) { if (decision) { if (isStrict()) { options.remove(FEATURE_STRICT); this.isStrict = false; // TODO inform user that STRICT mode is de-activated // throw new UnsupportedOption( // "StrictMode is exclusive and does not allow any other option."); } options.add(key); if (key.equals(FEATURE_COMMENT)) { isComment = true; } if (key.equals(FEATURE_PI)) { isPI = true; } if (key.equals(FEATURE_DTD)) { isDTD = true; } if (key.equals(FEATURE_PREFIX)) { isPrefix = true; } if (key.equals(FEATURE_SC)) { isSC = true; } } else { // remove option (if present) options.remove(key); if (key.equals(FEATURE_COMMENT)) { isComment = false; } if (key.equals(FEATURE_PI)) { isPI = false; } if (key.equals(FEATURE_DTD)) { isDTD = false; } if (key.equals(FEATURE_PREFIX)) { isPrefix = false; } if (key.equals(FEATURE_SC)) { isSC = false; } } } else { throw new UnsupportedOption("FidelityOption '" + key + "' is unknown!"); } } }
public class class_name { public void setFidelity(String key, boolean decision) throws UnsupportedOption { if (key.equals(FEATURE_STRICT)) { if (decision) { // no other features allowed // (LEXICAL_VALUE is an exception) boolean prevContainedLexVal = options .contains(FEATURE_LEXICAL_VALUE); options.clear(); // depends on control dependency: [if], data = [none] isComment = false; // depends on control dependency: [if], data = [none] isPI = false; // depends on control dependency: [if], data = [none] isDTD = false; // depends on control dependency: [if], data = [none] isPrefix = false; // depends on control dependency: [if], data = [none] isLexicalValue = false; // depends on control dependency: [if], data = [none] isSC = false; // depends on control dependency: [if], data = [none] if (prevContainedLexVal) { options.add(FEATURE_LEXICAL_VALUE); // depends on control dependency: [if], data = [none] isLexicalValue = true; // depends on control dependency: [if], data = [none] } options.add(FEATURE_STRICT); // depends on control dependency: [if], data = [none] isStrict = true; // depends on control dependency: [if], data = [none] } else { // remove strict (if present) options.remove(key); // depends on control dependency: [if], data = [none] isStrict = false; // depends on control dependency: [if], data = [none] } } else if (key.equals(FEATURE_LEXICAL_VALUE)) { // LEXICAL_VALUE is special --> does affect grammars if (decision) { options.add(key); // depends on control dependency: [if], data = [none] isLexicalValue = true; // depends on control dependency: [if], data = [none] } else { // remove option (if present) options.remove(key); // depends on control dependency: [if], data = [none] isLexicalValue = false; // depends on control dependency: [if], data = [none] } } else if (key.equals(FEATURE_COMMENT) || key.equals(FEATURE_PI) || key.equals(FEATURE_DTD) || key.equals(FEATURE_PREFIX) || key.equals(FEATURE_SC)) { if (decision) { if (isStrict()) { options.remove(FEATURE_STRICT); // depends on control dependency: [if], data = [none] this.isStrict = false; // depends on control dependency: [if], data = [none] // TODO inform user that STRICT mode is de-activated // throw new UnsupportedOption( // "StrictMode is exclusive and does not allow any other option."); } options.add(key); // depends on control dependency: [if], data = [none] if (key.equals(FEATURE_COMMENT)) { isComment = true; // depends on control dependency: [if], data = [none] } if (key.equals(FEATURE_PI)) { isPI = true; // depends on control dependency: [if], data = [none] } if (key.equals(FEATURE_DTD)) { isDTD = true; // depends on control dependency: [if], data = [none] } if (key.equals(FEATURE_PREFIX)) { isPrefix = true; // depends on control dependency: [if], data = [none] } if (key.equals(FEATURE_SC)) { isSC = true; // depends on control dependency: [if], data = [none] } } else { // remove option (if present) options.remove(key); // depends on control dependency: [if], data = [none] if (key.equals(FEATURE_COMMENT)) { isComment = false; // depends on control dependency: [if], data = [none] } if (key.equals(FEATURE_PI)) { isPI = false; // depends on control dependency: [if], data = [none] } if (key.equals(FEATURE_DTD)) { isDTD = false; // depends on control dependency: [if], data = [none] } if (key.equals(FEATURE_PREFIX)) { isPrefix = false; // depends on control dependency: [if], data = [none] } if (key.equals(FEATURE_SC)) { isSC = false; // depends on control dependency: [if], data = [none] } } } else { throw new UnsupportedOption("FidelityOption '" + key + "' is unknown!"); } } }
public class class_name { synchronized void clearInstance() { for (ServerSocket next : myControlSockets) { ourLog.info("Releasing control port: {}", next.getLocalPort()); try { next.close(); } catch (IOException theE) { // ignore } } myControlSockets.clear(); myCurrentControlSocketPort = null; } }
public class class_name { synchronized void clearInstance() { for (ServerSocket next : myControlSockets) { ourLog.info("Releasing control port: {}", next.getLocalPort()); // depends on control dependency: [for], data = [next] try { next.close(); // depends on control dependency: [try], data = [none] } catch (IOException theE) { // ignore } // depends on control dependency: [catch], data = [none] } myControlSockets.clear(); myCurrentControlSocketPort = null; } }
public class class_name { public static Map<Object, Integer> countTotalAnnotationsPerCategory( final ICodingAnnotationStudy study) { Map<Object, Integer> result = new HashMap<Object, Integer>(); for (ICodingAnnotationItem item : study.getItems()) { if (item.getRaterCount() <= 1) { continue; } for (IAnnotationUnit unit : item.getUnits()) { Object category = unit.getCategory(); if (category == null) { continue; } Integer count = result.get(category); if (count == null) { result.put(category, 1); } else { result.put(category, count + 1); } } } return result; } }
public class class_name { public static Map<Object, Integer> countTotalAnnotationsPerCategory( final ICodingAnnotationStudy study) { Map<Object, Integer> result = new HashMap<Object, Integer>(); for (ICodingAnnotationItem item : study.getItems()) { if (item.getRaterCount() <= 1) { continue; } for (IAnnotationUnit unit : item.getUnits()) { Object category = unit.getCategory(); if (category == null) { continue; } Integer count = result.get(category); if (count == null) { result.put(category, 1); // depends on control dependency: [if], data = [none] } else { result.put(category, count + 1); // depends on control dependency: [if], data = [none] } } } return result; } }
public class class_name { protected boolean equalElements(KTypeArrayList<?> other) { int max = size(); if (other.size() != max) { return false; } for (int i = 0; i < max; i++) { if (!Intrinsics.equals(this, get(i), other.get(i))) { return false; } } return true; } }
public class class_name { protected boolean equalElements(KTypeArrayList<?> other) { int max = size(); if (other.size() != max) { return false; // depends on control dependency: [if], data = [none] } for (int i = 0; i < max; i++) { if (!Intrinsics.equals(this, get(i), other.get(i))) { return false; // depends on control dependency: [if], data = [none] } } return true; } }
public class class_name { private File toFile( Entry entry ) { Stack<String> stack = new Stack<String>(); Entry entryRoot = entry.getFileSystem().getRoot(); while ( entry != null && !entryRoot.equals( entry ) ) { String name = entry.getName(); if ( "..".equals( name ) ) { if ( !stack.isEmpty() ) { stack.pop(); } } else if ( !".".equals( name ) ) { stack.push( name ); } entry = entry.getParent(); } File file = this.root; while ( !stack.empty() ) { file = new File( file, (String) stack.pop() ); } return file; } }
public class class_name { private File toFile( Entry entry ) { Stack<String> stack = new Stack<String>(); Entry entryRoot = entry.getFileSystem().getRoot(); while ( entry != null && !entryRoot.equals( entry ) ) { String name = entry.getName(); if ( "..".equals( name ) ) { if ( !stack.isEmpty() ) { stack.pop(); // depends on control dependency: [if], data = [none] } } else if ( !".".equals( name ) ) { stack.push( name ); // depends on control dependency: [if], data = [none] } entry = entry.getParent(); // depends on control dependency: [while], data = [none] } File file = this.root; while ( !stack.empty() ) { file = new File( file, (String) stack.pop() ); // depends on control dependency: [while], data = [none] } return file; } }
public class class_name { static @Nullable Object[] createValuesFromArray( @Nullable final Object[] array, @Nullable final Object... values) { if (isNullOrEmpty(values)) { return array; } if (isNullOrEmpty(array)) { return values; } final Object[] combined = Arrays.copyOf(values, array.length + values.length); for (int i = 0; i < array.length; ++i) { combined[values.length + i] = array[i]; } return combined; } }
public class class_name { static @Nullable Object[] createValuesFromArray( @Nullable final Object[] array, @Nullable final Object... values) { if (isNullOrEmpty(values)) { return array; // depends on control dependency: [if], data = [none] } if (isNullOrEmpty(array)) { return values; // depends on control dependency: [if], data = [none] } final Object[] combined = Arrays.copyOf(values, array.length + values.length); for (int i = 0; i < array.length; ++i) { combined[values.length + i] = array[i]; // depends on control dependency: [for], data = [i] } return combined; } }
public class class_name { private static void encodeConnectionPath(PaddedEPath path, ByteBuf buffer) { // length placeholder... int lengthStartIndex = buffer.writerIndex(); buffer.writeByte(0); // reserved buffer.writeZero(1); // encode the path segments... int dataStartIndex = buffer.writerIndex(); for (EPathSegment segment : path.getSegments()) { if (segment instanceof LogicalSegment) { LogicalSegment.encode((LogicalSegment) segment, path.isPadded(), buffer); } else if (segment instanceof PortSegment) { PortSegment.encode((PortSegment) segment, path.isPadded(), buffer); } else if (segment instanceof DataSegment) { DataSegment.encode((DataSegment) segment, path.isPadded(), buffer); } else { throw new RuntimeException("no encoder for " + segment.getClass().getSimpleName()); } } // go back and update the length int bytesWritten = buffer.writerIndex() - dataStartIndex; int wordsWritten = bytesWritten / 2; buffer.markWriterIndex(); buffer.writerIndex(lengthStartIndex); buffer.writeByte(wordsWritten); buffer.resetWriterIndex(); } }
public class class_name { private static void encodeConnectionPath(PaddedEPath path, ByteBuf buffer) { // length placeholder... int lengthStartIndex = buffer.writerIndex(); buffer.writeByte(0); // reserved buffer.writeZero(1); // encode the path segments... int dataStartIndex = buffer.writerIndex(); for (EPathSegment segment : path.getSegments()) { if (segment instanceof LogicalSegment) { LogicalSegment.encode((LogicalSegment) segment, path.isPadded(), buffer); // depends on control dependency: [if], data = [none] } else if (segment instanceof PortSegment) { PortSegment.encode((PortSegment) segment, path.isPadded(), buffer); // depends on control dependency: [if], data = [none] } else if (segment instanceof DataSegment) { DataSegment.encode((DataSegment) segment, path.isPadded(), buffer); // depends on control dependency: [if], data = [none] } else { throw new RuntimeException("no encoder for " + segment.getClass().getSimpleName()); } } // go back and update the length int bytesWritten = buffer.writerIndex() - dataStartIndex; int wordsWritten = bytesWritten / 2; buffer.markWriterIndex(); buffer.writerIndex(lengthStartIndex); buffer.writeByte(wordsWritten); buffer.resetWriterIndex(); } }
public class class_name { public JMProgressiveManager<T, R> getAfterCompletion() { try { completableFuture.get(); } catch (InterruptedException | ExecutionException e) { handleException(log, e, "stopSync"); } return this; } }
public class class_name { public JMProgressiveManager<T, R> getAfterCompletion() { try { completableFuture.get(); // depends on control dependency: [try], data = [none] } catch (InterruptedException | ExecutionException e) { handleException(log, e, "stopSync"); } // depends on control dependency: [catch], data = [none] return this; } }
public class class_name { @Draft public static void recvMsg(ZMQ.Socket socket, int flags, Consumer<ZMsg> handler, Consumer<ZMQException> exceptionHandler) { try { handler.accept(ZMsg.recvMsg(socket, flags)); } catch (ZMQException e) { exceptionHandler.accept(e); } } }
public class class_name { @Draft public static void recvMsg(ZMQ.Socket socket, int flags, Consumer<ZMsg> handler, Consumer<ZMQException> exceptionHandler) { try { handler.accept(ZMsg.recvMsg(socket, flags)); // depends on control dependency: [try], data = [none] } catch (ZMQException e) { exceptionHandler.accept(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void marshall(PolicyDetails policyDetails, ProtocolMarshaller protocolMarshaller) { if (policyDetails == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(policyDetails.getResourceTypes(), RESOURCETYPES_BINDING); protocolMarshaller.marshall(policyDetails.getTargetTags(), TARGETTAGS_BINDING); protocolMarshaller.marshall(policyDetails.getSchedules(), SCHEDULES_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(PolicyDetails policyDetails, ProtocolMarshaller protocolMarshaller) { if (policyDetails == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(policyDetails.getResourceTypes(), RESOURCETYPES_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(policyDetails.getTargetTags(), TARGETTAGS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(policyDetails.getSchedules(), SCHEDULES_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 DownloadbillResult payDownloadbill(MchDownloadbill downloadbill,String key){ Map<String,String> map = MapUtil.objectToMap(downloadbill); String sign = SignatureUtil.generateSign(map,downloadbill.getSign_type(),key); downloadbill.setSign(sign); String closeorderXML = XMLConverUtil.convertToXML(downloadbill); HttpUriRequest httpUriRequest = RequestBuilder.post() .setHeader(xmlHeader) .setUri(baseURI()+ "/pay/downloadbill") .setEntity(new StringEntity(closeorderXML,Charset.forName("utf-8"))) .build(); return LocalHttpClient.execute(httpUriRequest,new ResponseHandler<DownloadbillResult>() { @Override public DownloadbillResult handleResponse(HttpResponse response) throws ClientProtocolException, IOException { int status = response.getStatusLine().getStatusCode(); if (status >= 200 && status < 300) { HttpEntity entity = response.getEntity(); String str; //GZIP if (entity.getContentType().getValue().matches("(?i).*gzip.*")) { str = StreamUtils.copyToString(new GZIPInputStream(entity.getContent()), Charset.forName("UTF-8")); } else { str = EntityUtils.toString(entity, "utf-8"); } EntityUtils.consume(entity); if(str.matches(".*<xml>(.*|\\n)+</xml>.*")){ return XMLConverUtil.convertToObject(DownloadbillResult.class,str); }else{ DownloadbillResult dr = new DownloadbillResult(); dr.setData(str); // 获取返回头数据 签名信息 Header headerDigest = response.getFirstHeader("Digest"); if (headerDigest != null) { String[] hkv = headerDigest.getValue().split("="); dr.setSign_type(hkv[0]); dr.setSign(hkv[1]); } return dr; } } else { throw new ClientProtocolException("Unexpected response status: " + status); } } }); } }
public class class_name { public static DownloadbillResult payDownloadbill(MchDownloadbill downloadbill,String key){ Map<String,String> map = MapUtil.objectToMap(downloadbill); String sign = SignatureUtil.generateSign(map,downloadbill.getSign_type(),key); downloadbill.setSign(sign); String closeorderXML = XMLConverUtil.convertToXML(downloadbill); HttpUriRequest httpUriRequest = RequestBuilder.post() .setHeader(xmlHeader) .setUri(baseURI()+ "/pay/downloadbill") .setEntity(new StringEntity(closeorderXML,Charset.forName("utf-8"))) .build(); return LocalHttpClient.execute(httpUriRequest,new ResponseHandler<DownloadbillResult>() { @Override public DownloadbillResult handleResponse(HttpResponse response) throws ClientProtocolException, IOException { int status = response.getStatusLine().getStatusCode(); if (status >= 200 && status < 300) { HttpEntity entity = response.getEntity(); String str; //GZIP if (entity.getContentType().getValue().matches("(?i).*gzip.*")) { str = StreamUtils.copyToString(new GZIPInputStream(entity.getContent()), Charset.forName("UTF-8")); // depends on control dependency: [if], data = [none] } else { str = EntityUtils.toString(entity, "utf-8"); // depends on control dependency: [if], data = [none] } EntityUtils.consume(entity); if(str.matches(".*<xml>(.*|\\n)+</xml>.*")){ return XMLConverUtil.convertToObject(DownloadbillResult.class,str); // depends on control dependency: [if], data = [none] }else{ DownloadbillResult dr = new DownloadbillResult(); dr.setData(str); // depends on control dependency: [if], data = [none] // 获取返回头数据 签名信息 Header headerDigest = response.getFirstHeader("Digest"); if (headerDigest != null) { String[] hkv = headerDigest.getValue().split("="); dr.setSign_type(hkv[0]); // depends on control dependency: [if], data = [none] dr.setSign(hkv[1]); // depends on control dependency: [if], data = [none] } return dr; // depends on control dependency: [if], data = [none] } } else { throw new ClientProtocolException("Unexpected response status: " + status); } } }); } }
public class class_name { public void writeOntTxt(PrintWriter pw) { for (String id : terms.keySet()) { OntologyTerm term = terms.get(id); Set<String> synSet = new HashSet<String>(); synSet.add(term.getName()); for (Synonym s : term.getSynonyms()) { String st = s.getType(); if (id.startsWith("PTCO") || (st != null && !st .matches(".*(InChI|SMILES|FORMULA).*"))) { String synonym = s.getSyn(); if (!synonym.matches("\\S")) {// reject ontology terms // consisting of a single // letter as these produce too // many false positives synSet.add(synonym); } } } pw.println("[" + id + "]"); for (String syn : synSet) pw.println(syn); pw.println(); } pw.flush(); } }
public class class_name { public void writeOntTxt(PrintWriter pw) { for (String id : terms.keySet()) { OntologyTerm term = terms.get(id); Set<String> synSet = new HashSet<String>(); synSet.add(term.getName()); // depends on control dependency: [for], data = [none] for (Synonym s : term.getSynonyms()) { String st = s.getType(); if (id.startsWith("PTCO") || (st != null && !st .matches(".*(InChI|SMILES|FORMULA).*"))) { String synonym = s.getSyn(); if (!synonym.matches("\\S")) {// reject ontology terms // consisting of a single // letter as these produce too // many false positives synSet.add(synonym); // depends on control dependency: [if], data = [none] } } } pw.println("[" + id + "]"); // depends on control dependency: [for], data = [id] for (String syn : synSet) pw.println(syn); pw.println(); // depends on control dependency: [for], data = [none] } pw.flush(); } }
public class class_name { public void storeInDb() throws EFapsException { for (final Entry<String, UserAttribute> entry : this.attributes.entrySet()) { if (entry.getValue().isUpdate()) { final QueryBuilder queryBldr = new QueryBuilder(Type.get(entry.getValue().getType())); queryBldr.addWhereAttrEqValue("UserLink", this.userId.toString()); if (UserAttributesSet.MAPPER.get(entry.getValue().getType()).keyAttribute != null) { queryBldr.addWhereAttrEqValue(UserAttributesSet.MAPPER.get(entry.getValue().getType()).keyAttribute, entry.getKey()); } final InstanceQuery query = queryBldr.getQuery(); query.execute(); final Update update; if (query.next()) { update = new Update(query.getCurrentValue()); } else { update = new Insert(entry.getValue().getType()); if (UserAttributesSet.MAPPER.get(entry.getValue().getType()).keyAttribute != null) { update.add(UserAttributesSet.MAPPER.get(entry.getValue().getType()).keyAttribute, entry.getKey()); } update.add("UserLink", this.userId.toString()); } update.add("Value", entry.getValue().getValue()); update.execute(); update.close(); } } this.attributes.clear(); } }
public class class_name { public void storeInDb() throws EFapsException { for (final Entry<String, UserAttribute> entry : this.attributes.entrySet()) { if (entry.getValue().isUpdate()) { final QueryBuilder queryBldr = new QueryBuilder(Type.get(entry.getValue().getType())); queryBldr.addWhereAttrEqValue("UserLink", this.userId.toString()); if (UserAttributesSet.MAPPER.get(entry.getValue().getType()).keyAttribute != null) { queryBldr.addWhereAttrEqValue(UserAttributesSet.MAPPER.get(entry.getValue().getType()).keyAttribute, entry.getKey()); // depends on control dependency: [if], data = [none] } final InstanceQuery query = queryBldr.getQuery(); query.execute(); final Update update; if (query.next()) { update = new Update(query.getCurrentValue()); // depends on control dependency: [if], data = [none] } else { update = new Insert(entry.getValue().getType()); // depends on control dependency: [if], data = [none] if (UserAttributesSet.MAPPER.get(entry.getValue().getType()).keyAttribute != null) { update.add(UserAttributesSet.MAPPER.get(entry.getValue().getType()).keyAttribute, entry.getKey()); // depends on control dependency: [if], data = [none] } update.add("UserLink", this.userId.toString()); // depends on control dependency: [if], data = [none] } update.add("Value", entry.getValue().getValue()); update.execute(); update.close(); } } this.attributes.clear(); } }
public class class_name { private void finish() { try { if (session != null) { session.close(); } } finally { ManagedSessionContext.unbind(SESSION_FACTORY); if (!SESSIONS.get().isEmpty()) { ManagedSessionContext.bind(SESSIONS.get().pop()); } } } }
public class class_name { private void finish() { try { if (session != null) { session.close(); // depends on control dependency: [if], data = [none] } } finally { ManagedSessionContext.unbind(SESSION_FACTORY); if (!SESSIONS.get().isEmpty()) { ManagedSessionContext.bind(SESSIONS.get().pop()); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static boolean validateLicense(LicenseApi licenseApi, int numberOfNodes, DrRoleType replicationRole, StartAction startAction) { // Delay the handling of an invalid license file until here so // that the leader can terminate the full cluster. if (licenseApi == null) { hostLog.fatal("VoltDB license is not valid."); return false; } // do some extra initialization here if (!licenseApi.secondaryInitialization()) { return false; } Calendar now = GregorianCalendar.getInstance(); SimpleDateFormat sdf = new SimpleDateFormat("MMM d, yyyy"); String expiresStr = sdf.format(licenseApi.expires().getTime()); boolean valid = true; // make it really expire tomorrow to deal with timezone whiners Calendar yesterday = GregorianCalendar.getInstance(); yesterday.add(Calendar.DATE, -1); if (yesterday.after(licenseApi.expires())) { if (licenseApi.hardExpiration()) { if (licenseApi.isAnyKindOfTrial()) { hostLog.fatal("VoltDB trial license expired on " + expiresStr + "."); } else { hostLog.fatal("VoltDB license expired on " + expiresStr + "."); } hostLog.fatal("Please contact sales@voltdb.com to request a new license."); return false; } else { // Expired commercial licenses are allowed but generate log messages. hostLog.error("Warning, VoltDB commercial license expired on " + expiresStr + "."); valid = false; } } // enforce DR replication constraint if (licenseApi.isDrReplicationAllowed() == false) { if (replicationRole != DrRoleType.NONE) { hostLog.fatal("Warning, VoltDB license does not allow use of DR replication."); return false; } } else if (licenseApi.isDrActiveActiveAllowed() == false) { if (replicationRole == DrRoleType.XDCR) { hostLog.fatal("Warning, VoltDB license does not allow use of XDCR."); return false; } } // check node count if (licenseApi.maxHostcount() < numberOfNodes) { hostLog.fatal("Attempting to " + (startAction.doesJoin() ? "join" : "start") + " with too many nodes (" + numberOfNodes + "). " + "Current license only supports " + licenseApi.maxHostcount() + ". Please contact VoltDB at info@voltdb.com."); return false; } // If this is a commercial license, and there is less than or equal to 30 days until expiration, // issue a "days remaining" warning message. long diff = licenseApi.expires().getTimeInMillis() - now.getTimeInMillis(); // The original license is only a whole data (no minutes/millis). // There should thus be no issue with daylight savings time, // but just in case, if the diff is a negative number, round up to zero. if (diff < 0) { diff = 0; } long diffDays = diff / (24 * 60 * 60 * 1000); // print out trial success message if (licenseApi.isAnyKindOfTrial()) { consoleLog.info("Starting VoltDB with trial license. License expires on " + expiresStr + " (" + diffDays + " days remaining)."); return true; } if (licenseApi.isAWSMarketplace()) { return true; } // print out a warning within a month for other licenses if ((diff > 0) && (diff <= 30)) { String msg = "Warning: VoltDB license expires in " + diffDays + " day(s)."; consoleLog.info(msg); } // this gets printed even if there are non-fatal problems, so it // injects the word "invalid" to make it clear this is the case String msg = String.format("Starting VoltDB with %scommercial license. " + "License for %d nodes expires on %s.", (valid ? "" : "invalid "), licenseApi.maxHostcount(), expiresStr); consoleLog.info(msg); return true; } }
public class class_name { public static boolean validateLicense(LicenseApi licenseApi, int numberOfNodes, DrRoleType replicationRole, StartAction startAction) { // Delay the handling of an invalid license file until here so // that the leader can terminate the full cluster. if (licenseApi == null) { hostLog.fatal("VoltDB license is not valid."); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } // do some extra initialization here if (!licenseApi.secondaryInitialization()) { return false; // depends on control dependency: [if], data = [none] } Calendar now = GregorianCalendar.getInstance(); SimpleDateFormat sdf = new SimpleDateFormat("MMM d, yyyy"); String expiresStr = sdf.format(licenseApi.expires().getTime()); boolean valid = true; // make it really expire tomorrow to deal with timezone whiners Calendar yesterday = GregorianCalendar.getInstance(); yesterday.add(Calendar.DATE, -1); if (yesterday.after(licenseApi.expires())) { if (licenseApi.hardExpiration()) { if (licenseApi.isAnyKindOfTrial()) { hostLog.fatal("VoltDB trial license expired on " + expiresStr + "."); // depends on control dependency: [if], data = [none] } else { hostLog.fatal("VoltDB license expired on " + expiresStr + "."); // depends on control dependency: [if], data = [none] } hostLog.fatal("Please contact sales@voltdb.com to request a new license."); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } else { // Expired commercial licenses are allowed but generate log messages. hostLog.error("Warning, VoltDB commercial license expired on " + expiresStr + "."); // depends on control dependency: [if], data = [none] valid = false; // depends on control dependency: [if], data = [none] } } // enforce DR replication constraint if (licenseApi.isDrReplicationAllowed() == false) { if (replicationRole != DrRoleType.NONE) { hostLog.fatal("Warning, VoltDB license does not allow use of DR replication."); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } } else if (licenseApi.isDrActiveActiveAllowed() == false) { if (replicationRole == DrRoleType.XDCR) { hostLog.fatal("Warning, VoltDB license does not allow use of XDCR."); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } } // check node count if (licenseApi.maxHostcount() < numberOfNodes) { hostLog.fatal("Attempting to " + (startAction.doesJoin() ? "join" : "start") + " with too many nodes (" + numberOfNodes + "). " + "Current license only supports " + licenseApi.maxHostcount() + ". Please contact VoltDB at info@voltdb.com."); return false; // depends on control dependency: [if], data = [none] } // If this is a commercial license, and there is less than or equal to 30 days until expiration, // issue a "days remaining" warning message. long diff = licenseApi.expires().getTimeInMillis() - now.getTimeInMillis(); // The original license is only a whole data (no minutes/millis). // There should thus be no issue with daylight savings time, // but just in case, if the diff is a negative number, round up to zero. if (diff < 0) { diff = 0; // depends on control dependency: [if], data = [none] } long diffDays = diff / (24 * 60 * 60 * 1000); // print out trial success message if (licenseApi.isAnyKindOfTrial()) { consoleLog.info("Starting VoltDB with trial license. License expires on " + expiresStr + " (" + diffDays + " days remaining)."); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } if (licenseApi.isAWSMarketplace()) { return true; // depends on control dependency: [if], data = [none] } // print out a warning within a month for other licenses if ((diff > 0) && (diff <= 30)) { String msg = "Warning: VoltDB license expires in " + diffDays + " day(s)."; consoleLog.info(msg); // depends on control dependency: [if], data = [none] } // this gets printed even if there are non-fatal problems, so it // injects the word "invalid" to make it clear this is the case String msg = String.format("Starting VoltDB with %scommercial license. " + "License for %d nodes expires on %s.", (valid ? "" : "invalid "), licenseApi.maxHostcount(), expiresStr); consoleLog.info(msg); return true; } }
public class class_name { public synchronized void stop() { if (writer != null) { try { writer.close(headerBytes); writer = null; } catch (IOException ex) { // No need to crash on this error even if the tail won't be written // since reading logic can take care of that. } } // Ensure that timer is stopped as well. disableFileSwitch(); headerBytes = null; // Don't stop manager here since it can be reused for a different repository writer. //manager.stop(); } }
public class class_name { public synchronized void stop() { if (writer != null) { try { writer.close(headerBytes); // depends on control dependency: [try], data = [none] writer = null; // depends on control dependency: [try], data = [none] } catch (IOException ex) { // No need to crash on this error even if the tail won't be written // since reading logic can take care of that. } // depends on control dependency: [catch], data = [none] } // Ensure that timer is stopped as well. disableFileSwitch(); headerBytes = null; // Don't stop manager here since it can be reused for a different repository writer. //manager.stop(); } }
public class class_name { @Override public Enumeration<String> getInitParameterNames() { FilterConfig fc = getFilterConfig(); if (fc == null) { throw new IllegalStateException( lStrings.getString("err.filter_config_not_initialized")); } return fc.getInitParameterNames(); } }
public class class_name { @Override public Enumeration<String> getInitParameterNames() { FilterConfig fc = getFilterConfig(); if (fc == null) { throw new IllegalStateException( lStrings.getString("err.filter_config_not_initialized")); } return fc.getInitParameterNames(); // depends on control dependency: [if], data = [none] } }
public class class_name { @Override public EClass getIfcBeam() { if (ifcBeamEClass == null) { ifcBeamEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers() .get(38); } return ifcBeamEClass; } }
public class class_name { @Override public EClass getIfcBeam() { if (ifcBeamEClass == null) { ifcBeamEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers() .get(38); // depends on control dependency: [if], data = [none] } return ifcBeamEClass; } }
public class class_name { @Override public void cacheResult( List<CommerceAccountUserRel> commerceAccountUserRels) { for (CommerceAccountUserRel commerceAccountUserRel : commerceAccountUserRels) { if (entityCache.getResult( CommerceAccountUserRelModelImpl.ENTITY_CACHE_ENABLED, CommerceAccountUserRelImpl.class, commerceAccountUserRel.getPrimaryKey()) == null) { cacheResult(commerceAccountUserRel); } else { commerceAccountUserRel.resetOriginalValues(); } } } }
public class class_name { @Override public void cacheResult( List<CommerceAccountUserRel> commerceAccountUserRels) { for (CommerceAccountUserRel commerceAccountUserRel : commerceAccountUserRels) { if (entityCache.getResult( CommerceAccountUserRelModelImpl.ENTITY_CACHE_ENABLED, CommerceAccountUserRelImpl.class, commerceAccountUserRel.getPrimaryKey()) == null) { cacheResult(commerceAccountUserRel); // depends on control dependency: [if], data = [none] } else { commerceAccountUserRel.resetOriginalValues(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { @Override public int getDefaultPort() { try { Integer result = (Integer) _getDefaultPort.invoke(getInstance(), (Object[]) null); return result.intValue(); } catch (Exception e) { FFDCFilter.processException(e, getClass().getName(), "getDefaultPort"); return 0; } } }
public class class_name { @Override public int getDefaultPort() { try { Integer result = (Integer) _getDefaultPort.invoke(getInstance(), (Object[]) null); return result.intValue(); // depends on control dependency: [try], data = [none] } catch (Exception e) { FFDCFilter.processException(e, getClass().getName(), "getDefaultPort"); return 0; } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void startWorkerIfNeeded() { // Perform a compare-and-swap retry loop for synchronization to make sure we don't start more // workers than desired. int currentCount = mPendingWorkers.get(); while (currentCount < mMaxConcurrency) { int updatedCount = currentCount + 1; if (mPendingWorkers.compareAndSet(currentCount, updatedCount)) { // Start a new worker. FLog.v(TAG, "%s: starting worker %d of %d", mName, updatedCount, mMaxConcurrency); mExecutor.execute(mTaskRunner); break; } // else: compareAndSet failed due to race; snapshot the new count and try again FLog.v(TAG, "%s: race in startWorkerIfNeeded; retrying", mName); currentCount = mPendingWorkers.get(); } } }
public class class_name { private void startWorkerIfNeeded() { // Perform a compare-and-swap retry loop for synchronization to make sure we don't start more // workers than desired. int currentCount = mPendingWorkers.get(); while (currentCount < mMaxConcurrency) { int updatedCount = currentCount + 1; if (mPendingWorkers.compareAndSet(currentCount, updatedCount)) { // Start a new worker. FLog.v(TAG, "%s: starting worker %d of %d", mName, updatedCount, mMaxConcurrency); // depends on control dependency: [if], data = [none] mExecutor.execute(mTaskRunner); // depends on control dependency: [if], data = [none] break; } // else: compareAndSet failed due to race; snapshot the new count and try again FLog.v(TAG, "%s: race in startWorkerIfNeeded; retrying", mName); // depends on control dependency: [while], data = [none] currentCount = mPendingWorkers.get(); // depends on control dependency: [while], data = [none] } } }
public class class_name { public org.efaps.admin.ui.Form getType() { org.efaps.admin.ui.Form ret = null; try { ret = org.efaps.admin.ui.Form.get(this.uuid); } catch (final CacheReloadException e) { CIForm.LOG.error("Error on retrieving Type for CIType with uuid: {}", this.uuid); } return ret; } }
public class class_name { public org.efaps.admin.ui.Form getType() { org.efaps.admin.ui.Form ret = null; try { ret = org.efaps.admin.ui.Form.get(this.uuid); // depends on control dependency: [try], data = [none] } catch (final CacheReloadException e) { CIForm.LOG.error("Error on retrieving Type for CIType with uuid: {}", this.uuid); } // depends on control dependency: [catch], data = [none] return ret; } }
public class class_name { public JobScheduleUpdateOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) { if (ifUnmodifiedSince == null) { this.ifUnmodifiedSince = null; } else { this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince); } return this; } }
public class class_name { public JobScheduleUpdateOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) { if (ifUnmodifiedSince == null) { this.ifUnmodifiedSince = null; // depends on control dependency: [if], data = [none] } else { this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince); // depends on control dependency: [if], data = [(ifUnmodifiedSince] } return this; } }
public class class_name { static <T> T newInstance(final String className, final Class<?>[] argumentTypes, final Object[] arguments, final Class<T> expectedType, final ClassLoader cl) { // Precondition checks if (className == null) { throw new IllegalArgumentException("ClassName must be specified"); } if (argumentTypes == null) { throw new IllegalArgumentException("ArgumentTypes must be specified. Use empty array if no arguments"); } if (arguments == null) { throw new IllegalArgumentException("Arguments must be specified. Use empty array if no arguments"); } if (expectedType == null) { throw new IllegalArgumentException("Expected type must be specified"); } if (cl == null) { throw new IllegalArgumentException("CL must be specified"); } final Class<?> implClass; try { implClass = Class.forName(className, false, cl); } catch (ClassNotFoundException cnfe) { throw new IllegalArgumentException("Could not find class named " + className + " in the specified CL: " + cl, cnfe); } // Delegate return newInstance(implClass, argumentTypes, arguments, expectedType); } }
public class class_name { static <T> T newInstance(final String className, final Class<?>[] argumentTypes, final Object[] arguments, final Class<T> expectedType, final ClassLoader cl) { // Precondition checks if (className == null) { throw new IllegalArgumentException("ClassName must be specified"); } if (argumentTypes == null) { throw new IllegalArgumentException("ArgumentTypes must be specified. Use empty array if no arguments"); } if (arguments == null) { throw new IllegalArgumentException("Arguments must be specified. Use empty array if no arguments"); } if (expectedType == null) { throw new IllegalArgumentException("Expected type must be specified"); } if (cl == null) { throw new IllegalArgumentException("CL must be specified"); } final Class<?> implClass; try { implClass = Class.forName(className, false, cl); // depends on control dependency: [try], data = [none] } catch (ClassNotFoundException cnfe) { throw new IllegalArgumentException("Could not find class named " + className + " in the specified CL: " + cl, cnfe); } // depends on control dependency: [catch], data = [none] // Delegate return newInstance(implClass, argumentTypes, arguments, expectedType); } }
public class class_name { public static Object instance(String clsName,ClassLoader loader) { try { return Class.forName(clsName,true,loader).newInstance(); } catch (InstantiationException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } } }
public class class_name { public static Object instance(String clsName,ClassLoader loader) { try { return Class.forName(clsName,true,loader).newInstance(); // depends on control dependency: [try], data = [none] } catch (InstantiationException e) { throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] catch (IllegalAccessException e) { throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] catch (ClassNotFoundException e) { throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public List<Link> connect(int bandwidth, Switch sw, PhysicalElement... pelts) { List<Link> l = new ArrayList<>(); for (PhysicalElement pe : pelts) { l.add(connect(bandwidth, sw, pe)); } return l; } }
public class class_name { public List<Link> connect(int bandwidth, Switch sw, PhysicalElement... pelts) { List<Link> l = new ArrayList<>(); for (PhysicalElement pe : pelts) { l.add(connect(bandwidth, sw, pe)); // depends on control dependency: [for], data = [pe] } return l; } }
public class class_name { private MethodMetaData<? extends Annotation> getMethodMetaData(Method method) { MethodMetaData<? extends Annotation> methodMetaData = methodMetaDataCache.get(method); if (methodMetaData == null) { final String cacheName; final Annotation cacheAnnotation; final AggregatedParameterMetaData aggregatedParameterMetaData; final CacheKeyGenerator cacheKeyGenerator; final CacheDefaults cacheDefaultsAnnotation = method.getDeclaringClass().getAnnotation(CacheDefaults.class); if (method.isAnnotationPresent(CacheResult.class)) { final CacheResult cacheResultAnnotation = method.getAnnotation(CacheResult.class); cacheKeyGenerator = getCacheKeyGenerator(beanManager, cacheResultAnnotation.cacheKeyGenerator(), cacheDefaultsAnnotation); cacheName = getCacheName(method, cacheResultAnnotation.cacheName(), cacheDefaultsAnnotation, true); aggregatedParameterMetaData = getAggregatedParameterMetaData(method, false); cacheAnnotation = cacheResultAnnotation; } else if (method.isAnnotationPresent(CacheRemove.class)) { final CacheRemove cacheRemoveEntryAnnotation = method.getAnnotation(CacheRemove.class); cacheKeyGenerator = getCacheKeyGenerator(beanManager, cacheRemoveEntryAnnotation.cacheKeyGenerator(), cacheDefaultsAnnotation); cacheName = getCacheName(method, cacheRemoveEntryAnnotation.cacheName(), cacheDefaultsAnnotation, false); aggregatedParameterMetaData = getAggregatedParameterMetaData(method, false); cacheAnnotation = cacheRemoveEntryAnnotation; if (cacheName.isEmpty()) { throw log.cacheRemoveEntryMethodWithoutCacheName(method.getName()); } } else if (method.isAnnotationPresent(CacheRemoveAll.class)) { final CacheRemoveAll cacheRemoveAllAnnotation = method.getAnnotation(CacheRemoveAll.class); cacheKeyGenerator = null; cacheName = getCacheName(method, cacheRemoveAllAnnotation.cacheName(), cacheDefaultsAnnotation, false); aggregatedParameterMetaData = getAggregatedParameterMetaData(method, false); cacheAnnotation = cacheRemoveAllAnnotation; if (cacheName.isEmpty()) { throw log.cacheRemoveAllMethodWithoutCacheName(method.getName()); } } else if (method.isAnnotationPresent(CachePut.class)) { final CachePut cachePutAnnotation = method.getAnnotation(CachePut.class); cacheKeyGenerator = getCacheKeyGenerator(beanManager, cachePutAnnotation.cacheKeyGenerator(), cacheDefaultsAnnotation); cacheName = getCacheName(method, cachePutAnnotation.cacheName(), cacheDefaultsAnnotation, true); aggregatedParameterMetaData = getAggregatedParameterMetaData(method, true); cacheAnnotation = cachePutAnnotation; } else { throw log.methodWithoutCacheAnnotation(method.getName()); } final MethodMetaData<? extends Annotation> newCacheMethodMetaData = new MethodMetaData<Annotation>( method, aggregatedParameterMetaData, asSet(method.getAnnotations()), cacheKeyGenerator, cacheAnnotation, cacheName ); methodMetaData = methodMetaDataCache.putIfAbsent(method, newCacheMethodMetaData); if (methodMetaData == null) { methodMetaData = newCacheMethodMetaData; } } return methodMetaData; } }
public class class_name { private MethodMetaData<? extends Annotation> getMethodMetaData(Method method) { MethodMetaData<? extends Annotation> methodMetaData = methodMetaDataCache.get(method); if (methodMetaData == null) { final String cacheName; final Annotation cacheAnnotation; final AggregatedParameterMetaData aggregatedParameterMetaData; final CacheKeyGenerator cacheKeyGenerator; final CacheDefaults cacheDefaultsAnnotation = method.getDeclaringClass().getAnnotation(CacheDefaults.class); if (method.isAnnotationPresent(CacheResult.class)) { final CacheResult cacheResultAnnotation = method.getAnnotation(CacheResult.class); cacheKeyGenerator = getCacheKeyGenerator(beanManager, cacheResultAnnotation.cacheKeyGenerator(), cacheDefaultsAnnotation); // depends on control dependency: [if], data = [none] cacheName = getCacheName(method, cacheResultAnnotation.cacheName(), cacheDefaultsAnnotation, true); // depends on control dependency: [if], data = [none] aggregatedParameterMetaData = getAggregatedParameterMetaData(method, false); // depends on control dependency: [if], data = [none] cacheAnnotation = cacheResultAnnotation; // depends on control dependency: [if], data = [none] } else if (method.isAnnotationPresent(CacheRemove.class)) { final CacheRemove cacheRemoveEntryAnnotation = method.getAnnotation(CacheRemove.class); cacheKeyGenerator = getCacheKeyGenerator(beanManager, cacheRemoveEntryAnnotation.cacheKeyGenerator(), cacheDefaultsAnnotation); // depends on control dependency: [if], data = [none] cacheName = getCacheName(method, cacheRemoveEntryAnnotation.cacheName(), cacheDefaultsAnnotation, false); // depends on control dependency: [if], data = [none] aggregatedParameterMetaData = getAggregatedParameterMetaData(method, false); // depends on control dependency: [if], data = [none] cacheAnnotation = cacheRemoveEntryAnnotation; // depends on control dependency: [if], data = [none] if (cacheName.isEmpty()) { throw log.cacheRemoveEntryMethodWithoutCacheName(method.getName()); } } else if (method.isAnnotationPresent(CacheRemoveAll.class)) { final CacheRemoveAll cacheRemoveAllAnnotation = method.getAnnotation(CacheRemoveAll.class); cacheKeyGenerator = null; // depends on control dependency: [if], data = [none] cacheName = getCacheName(method, cacheRemoveAllAnnotation.cacheName(), cacheDefaultsAnnotation, false); // depends on control dependency: [if], data = [none] aggregatedParameterMetaData = getAggregatedParameterMetaData(method, false); // depends on control dependency: [if], data = [none] cacheAnnotation = cacheRemoveAllAnnotation; // depends on control dependency: [if], data = [none] if (cacheName.isEmpty()) { throw log.cacheRemoveAllMethodWithoutCacheName(method.getName()); } } else if (method.isAnnotationPresent(CachePut.class)) { final CachePut cachePutAnnotation = method.getAnnotation(CachePut.class); cacheKeyGenerator = getCacheKeyGenerator(beanManager, cachePutAnnotation.cacheKeyGenerator(), cacheDefaultsAnnotation); // depends on control dependency: [if], data = [none] cacheName = getCacheName(method, cachePutAnnotation.cacheName(), cacheDefaultsAnnotation, true); // depends on control dependency: [if], data = [none] aggregatedParameterMetaData = getAggregatedParameterMetaData(method, true); // depends on control dependency: [if], data = [none] cacheAnnotation = cachePutAnnotation; // depends on control dependency: [if], data = [none] } else { throw log.methodWithoutCacheAnnotation(method.getName()); } final MethodMetaData<? extends Annotation> newCacheMethodMetaData = new MethodMetaData<Annotation>( method, aggregatedParameterMetaData, asSet(method.getAnnotations()), cacheKeyGenerator, cacheAnnotation, cacheName ); methodMetaData = methodMetaDataCache.putIfAbsent(method, newCacheMethodMetaData); // depends on control dependency: [if], data = [none] if (methodMetaData == null) { methodMetaData = newCacheMethodMetaData; // depends on control dependency: [if], data = [none] } } return methodMetaData; } }
public class class_name { @SuppressWarnings("unchecked") @Override public Object invoke(Object proxy, Method method, Object[] arguments) throws Exception { // do not try to reuse remote invocation transaction; creates a new transaction instance for every invocation HttpRmiTransaction transaction = createTransaction(connectionFactory, implementationURL); String declaringClassName = method.getDeclaringClass().getCanonicalName(); String packageName = method.getDeclaringClass().getPackage().getName(); if (packageName.endsWith(CLIENT_PACKAGE_SUFIX)) { // if remote class is declared into client package just use parent package instead declaringClassName = declaringClassName.replace(CLIENT_PACKAGE_SUFIX, ""); } transaction.setMethod(declaringClassName, method.getName()); Type returnType = method.getGenericReturnType(); Callback<Object> callback = null; // excerpt from Java API regarding this method third argument: // arguments - an array of objects containing the values of the arguments passed in the method invocation // on the Proxy instance or null if interface method takes no arguments. // to be on safe side test both null and empty conditions if (arguments != null && arguments.length > 0) { List<Object> remoteArguments = new ArrayList<Object>(); for (int i = 0; i < arguments.length; ++i) { if (!(arguments[i] instanceof Callback)) { remoteArguments.add(arguments[i]); continue; } // here argument is the callback // it is expected to have a single callback; if more, uses the last one assert callback == null; callback = (Callback<Object>) arguments[i]; // if callback is present uses its parameterized type as return type for the remote method // extract type parameter from actual argument instance, not from method signature that can contain wild card Type callbackType = arguments[i].getClass().getGenericInterfaces()[0]; if (!(callbackType instanceof ParameterizedType)) { throw new BugError("Missing callback generic type. Cannot infer return type for |%s|.", method); } returnType = ((ParameterizedType) callbackType).getActualTypeArguments()[0]; } if (!remoteArguments.isEmpty()) { transaction.setArguments(remoteArguments.toArray()); } } transaction.setReturnType(returnType); transaction.setExceptions(method.getExceptionTypes()); if (transaction.isSynchronousForced() || (!Types.isVoid(returnType) && callback == null)) { // force synchronous execution if specialized transaction request synchronous mode // also execute synchronous if remote method is not void but there is no callback // uses null callback to force synchronous return transaction.exec(null); } // usually user code does not provide callbacks when invoking void methods, although it may happen to want to know when // execution is complete in order, for example, to chain another // anyway, if no callback is provided uses the default void callback if (callback == null) { callback = VOID_CALLBACK; } transaction.exec(callback); return null; } }
public class class_name { @SuppressWarnings("unchecked") @Override public Object invoke(Object proxy, Method method, Object[] arguments) throws Exception { // do not try to reuse remote invocation transaction; creates a new transaction instance for every invocation HttpRmiTransaction transaction = createTransaction(connectionFactory, implementationURL); String declaringClassName = method.getDeclaringClass().getCanonicalName(); String packageName = method.getDeclaringClass().getPackage().getName(); if (packageName.endsWith(CLIENT_PACKAGE_SUFIX)) { // if remote class is declared into client package just use parent package instead declaringClassName = declaringClassName.replace(CLIENT_PACKAGE_SUFIX, ""); } transaction.setMethod(declaringClassName, method.getName()); Type returnType = method.getGenericReturnType(); Callback<Object> callback = null; // excerpt from Java API regarding this method third argument: // arguments - an array of objects containing the values of the arguments passed in the method invocation // on the Proxy instance or null if interface method takes no arguments. // to be on safe side test both null and empty conditions if (arguments != null && arguments.length > 0) { List<Object> remoteArguments = new ArrayList<Object>(); for (int i = 0; i < arguments.length; ++i) { if (!(arguments[i] instanceof Callback)) { remoteArguments.add(arguments[i]); // depends on control dependency: [if], data = [none] continue; } // here argument is the callback // it is expected to have a single callback; if more, uses the last one assert callback == null; callback = (Callback<Object>) arguments[i]; // depends on control dependency: [for], data = [i] // if callback is present uses its parameterized type as return type for the remote method // extract type parameter from actual argument instance, not from method signature that can contain wild card Type callbackType = arguments[i].getClass().getGenericInterfaces()[0]; if (!(callbackType instanceof ParameterizedType)) { throw new BugError("Missing callback generic type. Cannot infer return type for |%s|.", method); } returnType = ((ParameterizedType) callbackType).getActualTypeArguments()[0]; // depends on control dependency: [for], data = [none] } if (!remoteArguments.isEmpty()) { transaction.setArguments(remoteArguments.toArray()); // depends on control dependency: [if], data = [none] } } transaction.setReturnType(returnType); transaction.setExceptions(method.getExceptionTypes()); if (transaction.isSynchronousForced() || (!Types.isVoid(returnType) && callback == null)) { // force synchronous execution if specialized transaction request synchronous mode // also execute synchronous if remote method is not void but there is no callback // uses null callback to force synchronous return transaction.exec(null); } // usually user code does not provide callbacks when invoking void methods, although it may happen to want to know when // execution is complete in order, for example, to chain another // anyway, if no callback is provided uses the default void callback if (callback == null) { callback = VOID_CALLBACK; } transaction.exec(callback); return null; } }
public class class_name { public String getUnitsString() { String units = null; Attribute att = findAttribute(CDM.UNITS); if (att == null) att = findAttributeIgnoreCase(CDM.UNITS); if ((att != null) && att.isString()) { units = att.getStringValue(); if (units != null) units = units.trim(); } return units; } }
public class class_name { public String getUnitsString() { String units = null; Attribute att = findAttribute(CDM.UNITS); if (att == null) att = findAttributeIgnoreCase(CDM.UNITS); if ((att != null) && att.isString()) { units = att.getStringValue(); // depends on control dependency: [if], data = [none] if (units != null) units = units.trim(); } return units; } }
public class class_name { public static byte[] decode(byte[] data) { if (data.length == 0) { return data; } int lastRealDataIndex = data.length - 1; while (data[lastRealDataIndex] == equalSign) { lastRealDataIndex--; } // original data digit is 8 bits long, but base64 digit is 6 bits long int padBytes = data.length - 1 - lastRealDataIndex; int byteLength = data.length * 6 / 8 - padBytes; byte[] result = new byte[byteLength]; // Each 4 bytes of input (encoded) we end up with 3 bytes of output int dataIndex = 0; int resultIndex = 0; int allBits = 0; // how many result chunks we can process before getting to pad bytes int resultChunks = (lastRealDataIndex + 1) / 4; for (int i = 0; i < resultChunks; i++) { allBits = 0; // Loop 4 times gathering input bits (4 * 6 = 24) for (int j = 0; j < 4; j++) { allBits = allBits << 6 | decodeDigit(data[dataIndex++]); } // Loop 3 times generating output bits (3 * 8 = 24) for (int j = resultIndex + 2; j >= resultIndex; j--) { result[j] = (byte) (allBits & 0xff); // Bottom 8 bits allBits = allBits >>> 8; } resultIndex += 3; // processed 3 result bytes } // Now we do the extra bytes in case the original (non-encoded) data // was not multiple of 3 bytes switch (padBytes) { case 1: // 1 pad byte means 3 (4-1) extra Base64 bytes of input, 18 // bits, of which only 16 are meaningful // Or: 2 bytes of result data allBits = 0; // Loop 3 times gathering input bits for (int j = 0; j < 3; j++) { allBits = allBits << 6 | decodeDigit(data[dataIndex++]); } // NOTE - The code below ends up being equivalent to allBits = // allBits>>>2 // But we code it in a non-optimized way for clarity // The 4th, missing 6 bits are all 0 allBits = allBits << 6; // The 3rd, missing 8 bits are all 0 allBits = allBits >>> 8; // Loop 2 times generating output bits for (int j = resultIndex + 1; j >= resultIndex; j--) { result[j] = (byte) (allBits & 0xff); // Bottom 8 // bits allBits = allBits >>> 8; } break; case 2: // 2 pad bytes mean 2 (4-2) extra Base64 bytes of input, 12 bits // of data, of which only 8 are meaningful // Or: 1 byte of result data allBits = 0; // Loop 2 times gathering input bits for (int j = 0; j < 2; j++) { allBits = allBits << 6 | decodeDigit(data[dataIndex++]); } // NOTE - The code below ends up being equivalent to allBits = // allBits>>>4 // But we code it in a non-optimized way for clarity // The 3rd and 4th, missing 6 bits are all 0 allBits = allBits << 6; allBits = allBits << 6; // The 3rd and 4th, missing 8 bits are all 0 allBits = allBits >>> 8; allBits = allBits >>> 8; result[resultIndex] = (byte) (allBits & 0xff); // Bottom // 8 // bits break; } return result; } }
public class class_name { public static byte[] decode(byte[] data) { if (data.length == 0) { return data; // depends on control dependency: [if], data = [none] } int lastRealDataIndex = data.length - 1; while (data[lastRealDataIndex] == equalSign) { lastRealDataIndex--; // depends on control dependency: [while], data = [none] } // original data digit is 8 bits long, but base64 digit is 6 bits long int padBytes = data.length - 1 - lastRealDataIndex; int byteLength = data.length * 6 / 8 - padBytes; byte[] result = new byte[byteLength]; // Each 4 bytes of input (encoded) we end up with 3 bytes of output int dataIndex = 0; int resultIndex = 0; int allBits = 0; // how many result chunks we can process before getting to pad bytes int resultChunks = (lastRealDataIndex + 1) / 4; for (int i = 0; i < resultChunks; i++) { allBits = 0; // depends on control dependency: [for], data = [none] // Loop 4 times gathering input bits (4 * 6 = 24) for (int j = 0; j < 4; j++) { allBits = allBits << 6 | decodeDigit(data[dataIndex++]); // depends on control dependency: [for], data = [none] } // Loop 3 times generating output bits (3 * 8 = 24) for (int j = resultIndex + 2; j >= resultIndex; j--) { result[j] = (byte) (allBits & 0xff); // Bottom 8 bits // depends on control dependency: [for], data = [j] allBits = allBits >>> 8; // depends on control dependency: [for], data = [none] } resultIndex += 3; // processed 3 result bytes // depends on control dependency: [for], data = [none] } // Now we do the extra bytes in case the original (non-encoded) data // was not multiple of 3 bytes switch (padBytes) { case 1: // 1 pad byte means 3 (4-1) extra Base64 bytes of input, 18 // bits, of which only 16 are meaningful // Or: 2 bytes of result data allBits = 0; // Loop 3 times gathering input bits for (int j = 0; j < 3; j++) { allBits = allBits << 6 | decodeDigit(data[dataIndex++]); // depends on control dependency: [for], data = [none] } // NOTE - The code below ends up being equivalent to allBits = // allBits>>>2 // But we code it in a non-optimized way for clarity // The 4th, missing 6 bits are all 0 allBits = allBits << 6; // The 3rd, missing 8 bits are all 0 allBits = allBits >>> 8; // Loop 2 times generating output bits for (int j = resultIndex + 1; j >= resultIndex; j--) { result[j] = (byte) (allBits & 0xff); // Bottom 8 // depends on control dependency: [for], data = [j] // bits allBits = allBits >>> 8; // depends on control dependency: [for], data = [none] } break; case 2: // 2 pad bytes mean 2 (4-2) extra Base64 bytes of input, 12 bits // of data, of which only 8 are meaningful // Or: 1 byte of result data allBits = 0; // Loop 2 times gathering input bits for (int j = 0; j < 2; j++) { allBits = allBits << 6 | decodeDigit(data[dataIndex++]); // depends on control dependency: [for], data = [none] } // NOTE - The code below ends up being equivalent to allBits = // allBits>>>4 // But we code it in a non-optimized way for clarity // The 3rd and 4th, missing 6 bits are all 0 allBits = allBits << 6; allBits = allBits << 6; // The 3rd and 4th, missing 8 bits are all 0 allBits = allBits >>> 8; allBits = allBits >>> 8; result[resultIndex] = (byte) (allBits & 0xff); // Bottom // 8 // bits break; } return result; } }
public class class_name { T getClosedFiniteEnd() { T temporal = this.end.getTemporal(); if ((temporal != null) && this.end.isOpen()) { return this.getTimeLine().stepBackwards(temporal); } else { return temporal; } } }
public class class_name { T getClosedFiniteEnd() { T temporal = this.end.getTemporal(); if ((temporal != null) && this.end.isOpen()) { return this.getTimeLine().stepBackwards(temporal); // depends on control dependency: [if], data = [none] } else { return temporal; // depends on control dependency: [if], data = [none] } } }
public class class_name { public void freePage(MemoryBlock page, MemoryConsumer consumer) { assert (page.pageNumber != MemoryBlock.NO_PAGE_NUMBER) : "Called freePage() on memory that wasn't allocated with allocatePage()"; assert (page.pageNumber != MemoryBlock.FREED_IN_ALLOCATOR_PAGE_NUMBER) : "Called freePage() on a memory block that has already been freed"; assert (page.pageNumber != MemoryBlock.FREED_IN_TMM_PAGE_NUMBER) : "Called freePage() on a memory block that has already been freed"; assert(allocatedPages.get(page.pageNumber)); pageTable[page.pageNumber] = null; synchronized (this) { allocatedPages.clear(page.pageNumber); } if (logger.isTraceEnabled()) { logger.trace("Freed page number {} ({} bytes)", page.pageNumber, page.size()); } long pageSize = page.size(); // Clear the page number before passing the block to the MemoryAllocator's free(). // Doing this allows the MemoryAllocator to detect when a TaskMemoryManager-managed // page has been inappropriately directly freed without calling TMM.freePage(). page.pageNumber = MemoryBlock.FREED_IN_TMM_PAGE_NUMBER; memoryManager.tungstenMemoryAllocator().free(page); releaseExecutionMemory(pageSize, consumer); } }
public class class_name { public void freePage(MemoryBlock page, MemoryConsumer consumer) { assert (page.pageNumber != MemoryBlock.NO_PAGE_NUMBER) : "Called freePage() on memory that wasn't allocated with allocatePage()"; assert (page.pageNumber != MemoryBlock.FREED_IN_ALLOCATOR_PAGE_NUMBER) : "Called freePage() on a memory block that has already been freed"; assert (page.pageNumber != MemoryBlock.FREED_IN_TMM_PAGE_NUMBER) : "Called freePage() on a memory block that has already been freed"; assert(allocatedPages.get(page.pageNumber)); pageTable[page.pageNumber] = null; synchronized (this) { allocatedPages.clear(page.pageNumber); } if (logger.isTraceEnabled()) { logger.trace("Freed page number {} ({} bytes)", page.pageNumber, page.size()); // depends on control dependency: [if], data = [none] } long pageSize = page.size(); // Clear the page number before passing the block to the MemoryAllocator's free(). // Doing this allows the MemoryAllocator to detect when a TaskMemoryManager-managed // page has been inappropriately directly freed without calling TMM.freePage(). page.pageNumber = MemoryBlock.FREED_IN_TMM_PAGE_NUMBER; memoryManager.tungstenMemoryAllocator().free(page); releaseExecutionMemory(pageSize, consumer); } }
public class class_name { public static String getStandardDeviationString(double[] standardDeviationDoubles) { if (standardDeviationDoubles == null) { return null; } StringBuilder standardDeviationString = new StringBuilder(standardDeviationDoubles.length * 9); // Abbreviate to 2 decimals // We don't use a local sensitive DecimalFormat, because other Scores don't use it either (see PLANNER-169) DecimalFormatSymbols decimalFormatSymbols = new DecimalFormatSymbols(Locale.US); DecimalFormat exponentialFormat = new DecimalFormat("0.0#E0", decimalFormatSymbols); DecimalFormat decimalFormat = new DecimalFormat("0.0#", decimalFormatSymbols); boolean first = true; for (double standardDeviationDouble : standardDeviationDoubles) { if (first) { first = false; } else { standardDeviationString.append("/"); } // See http://docs.oracle.com/javase/7/docs/api/java/lang/Double.html#toString%28double%29 String abbreviated; if (0.001 <= standardDeviationDouble && standardDeviationDouble <= 10000000.0) { abbreviated = decimalFormat.format(standardDeviationDouble); } else { abbreviated = exponentialFormat.format(standardDeviationDouble); } standardDeviationString.append(abbreviated); } return standardDeviationString.toString(); } }
public class class_name { public static String getStandardDeviationString(double[] standardDeviationDoubles) { if (standardDeviationDoubles == null) { return null; // depends on control dependency: [if], data = [none] } StringBuilder standardDeviationString = new StringBuilder(standardDeviationDoubles.length * 9); // Abbreviate to 2 decimals // We don't use a local sensitive DecimalFormat, because other Scores don't use it either (see PLANNER-169) DecimalFormatSymbols decimalFormatSymbols = new DecimalFormatSymbols(Locale.US); DecimalFormat exponentialFormat = new DecimalFormat("0.0#E0", decimalFormatSymbols); DecimalFormat decimalFormat = new DecimalFormat("0.0#", decimalFormatSymbols); boolean first = true; for (double standardDeviationDouble : standardDeviationDoubles) { if (first) { first = false; // depends on control dependency: [if], data = [none] } else { standardDeviationString.append("/"); // depends on control dependency: [if], data = [none] } // See http://docs.oracle.com/javase/7/docs/api/java/lang/Double.html#toString%28double%29 String abbreviated; if (0.001 <= standardDeviationDouble && standardDeviationDouble <= 10000000.0) { abbreviated = decimalFormat.format(standardDeviationDouble); // depends on control dependency: [if], data = [none] } else { abbreviated = exponentialFormat.format(standardDeviationDouble); // depends on control dependency: [if], data = [none] } standardDeviationString.append(abbreviated); // depends on control dependency: [for], data = [none] } return standardDeviationString.toString(); } }
public class class_name { private void healIfNeed(ConnectionPool pool, Url url) throws RemotingException, InterruptedException { String poolKey = url.getUniqueKey(); // only when async creating connections done // and the actual size of connections less than expected, the healing task can be run. if (pool.isAsyncCreationDone() && pool.size() < url.getConnNum()) { FutureTask<Integer> task = this.healTasks.get(poolKey); if (null == task) { task = new FutureTask<Integer>(new HealConnectionCall(url, pool)); task = this.healTasks.putIfAbsent(poolKey, task); if (null == task) { task = this.healTasks.get(poolKey); task.run(); } } try { int numAfterHeal = task.get(); if (logger.isDebugEnabled()) { logger.debug("[NOTIFYME] - conn num after heal {}, expected {}, warmup {}", numAfterHeal, url.getConnNum(), url.isConnWarmup()); } } catch (InterruptedException e) { this.healTasks.remove(poolKey); throw e; } catch (ExecutionException e) { this.healTasks.remove(poolKey); Throwable cause = e.getCause(); if (cause instanceof RemotingException) { throw (RemotingException) cause; } else { FutureTaskUtil.launderThrowable(cause); } } // heal task is one-off, remove from cache directly after run this.healTasks.remove(poolKey); } } }
public class class_name { private void healIfNeed(ConnectionPool pool, Url url) throws RemotingException, InterruptedException { String poolKey = url.getUniqueKey(); // only when async creating connections done // and the actual size of connections less than expected, the healing task can be run. if (pool.isAsyncCreationDone() && pool.size() < url.getConnNum()) { FutureTask<Integer> task = this.healTasks.get(poolKey); if (null == task) { task = new FutureTask<Integer>(new HealConnectionCall(url, pool)); task = this.healTasks.putIfAbsent(poolKey, task); if (null == task) { task = this.healTasks.get(poolKey); // depends on control dependency: [if], data = [none] task.run(); // depends on control dependency: [if], data = [none] } } try { int numAfterHeal = task.get(); if (logger.isDebugEnabled()) { logger.debug("[NOTIFYME] - conn num after heal {}, expected {}, warmup {}", numAfterHeal, url.getConnNum(), url.isConnWarmup()); // depends on control dependency: [if], data = [none] } } catch (InterruptedException e) { this.healTasks.remove(poolKey); throw e; } catch (ExecutionException e) { this.healTasks.remove(poolKey); Throwable cause = e.getCause(); if (cause instanceof RemotingException) { throw (RemotingException) cause; } else { FutureTaskUtil.launderThrowable(cause); // depends on control dependency: [if], data = [none] } } // heal task is one-off, remove from cache directly after run this.healTasks.remove(poolKey); } } }
public class class_name { public static <T> void forEach(List<T> list, int from, int to, Procedure<? super T> procedure) { ListIterate.rangeCheck(from, to, list.size()); if (list instanceof RandomAccess) { RandomAccessListIterate.forEach(list, from, to, procedure); } else { if (from <= to) { ListIterator<T> iterator = list.listIterator(from); for (int i = from; i <= to; i++) { procedure.value(iterator.next()); } } else { ListIterator<T> iterator = list.listIterator(from + 1); for (int i = from; i >= to; i--) { procedure.value(iterator.previous()); } } } } }
public class class_name { public static <T> void forEach(List<T> list, int from, int to, Procedure<? super T> procedure) { ListIterate.rangeCheck(from, to, list.size()); if (list instanceof RandomAccess) { RandomAccessListIterate.forEach(list, from, to, procedure); // depends on control dependency: [if], data = [none] } else { if (from <= to) { ListIterator<T> iterator = list.listIterator(from); for (int i = from; i <= to; i++) { procedure.value(iterator.next()); // depends on control dependency: [for], data = [none] } } else { ListIterator<T> iterator = list.listIterator(from + 1); for (int i = from; i >= to; i--) { procedure.value(iterator.previous()); // depends on control dependency: [for], data = [none] } } } } }
public class class_name { private void cacheStream() { try { File fi = getTemproralCacheFile(); if (fi.exists()) { if (!fi.delete()) { throw new IllegalStateException("Cannot delete file " + fi.getAbsolutePath() + "!"); } } FileOutputStream fout = new FileOutputStream(fi); InputStream in = grabStream(); byte[] buffer = new byte[DEFAULT_BUFFER_SIZE]; int n; while (-1 != (n = in.read(buffer))) { fout.write(buffer, 0, n); } fout.flush(); fout.close(); in.close(); File cacheFile = getCacheFile(); if (!fi.renameTo(cacheFile)) { throw new IllegalStateException("Cannot rename file \"" + fi.getAbsolutePath() + "\" to \"" + cacheFile.getAbsolutePath() + "\"!"); } } catch (Exception e) { e.printStackTrace(); } } }
public class class_name { private void cacheStream() { try { File fi = getTemproralCacheFile(); if (fi.exists()) { if (!fi.delete()) { throw new IllegalStateException("Cannot delete file " + fi.getAbsolutePath() + "!"); } } FileOutputStream fout = new FileOutputStream(fi); InputStream in = grabStream(); byte[] buffer = new byte[DEFAULT_BUFFER_SIZE]; int n; while (-1 != (n = in.read(buffer))) { fout.write(buffer, 0, n); // depends on control dependency: [while], data = [none] } fout.flush(); // depends on control dependency: [try], data = [none] fout.close(); // depends on control dependency: [try], data = [none] in.close(); // depends on control dependency: [try], data = [none] File cacheFile = getCacheFile(); if (!fi.renameTo(cacheFile)) { throw new IllegalStateException("Cannot rename file \"" + fi.getAbsolutePath() + "\" to \"" + cacheFile.getAbsolutePath() + "\"!"); } } catch (Exception e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void marshall(GetQueryResultsRequest getQueryResultsRequest, ProtocolMarshaller protocolMarshaller) { if (getQueryResultsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getQueryResultsRequest.getQueryExecutionId(), QUERYEXECUTIONID_BINDING); protocolMarshaller.marshall(getQueryResultsRequest.getNextToken(), NEXTTOKEN_BINDING); protocolMarshaller.marshall(getQueryResultsRequest.getMaxResults(), MAXRESULTS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(GetQueryResultsRequest getQueryResultsRequest, ProtocolMarshaller protocolMarshaller) { if (getQueryResultsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getQueryResultsRequest.getQueryExecutionId(), QUERYEXECUTIONID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(getQueryResultsRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(getQueryResultsRequest.getMaxResults(), MAXRESULTS_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 displayGalleries(Map<CmsGalleryType, List<CmsGalleryFolderEntry>> galleries) { m_galleryTree.clear(); m_galleryTreeItems.clear(); m_galleryTypeItems.clear(); CmsUUID galleriesFolderId = null; if (getRootItem().getChild(m_controller.getData().getDefaultGalleryFolder()) != null) { galleriesFolderId = ((CmsSitemapTreeItem)getRootItem().getChild( m_controller.getData().getDefaultGalleryFolder())).getEntryId(); } List<CmsGalleryType> types = new ArrayList<CmsGalleryType>(galleries.keySet()); Collections.sort(types, new Comparator<CmsGalleryType>() { public int compare(CmsGalleryType o1, CmsGalleryType o2) { return o1.getTitle().compareTo(o2.getTitle()); } }); m_toolbar.setGalleryTypes(types); boolean hasGalleries = false; for (CmsGalleryType type : types) { CmsGalleryTreeItem typeItem = new CmsGalleryTreeItem(type); if (m_controller.isEditable() && m_controller.getData().isGalleryManager()) { CmsHoverbarCreateGalleryButton createButton = new CmsHoverbarCreateGalleryButton( type.getTypeId(), galleriesFolderId); CmsSitemapHoverbar hoverbar = CmsSitemapHoverbar.installOn( m_controller, typeItem, Collections.<Widget> singleton(createButton)); createButton.setHoverbar(hoverbar); hoverbar.setAlwaysVisible(); } m_galleryTypeItems.put(type.getResourceType(), typeItem); addGalleryEntries(typeItem, galleries.get(type)); typeItem.setOpen(true); hasGalleries = true; m_galleryTree.addItem(typeItem); } // position image and download galleries at the top if (m_galleryTypeItems.containsKey(DOWNLOAD_GALLERY_TYPE)) { m_galleryTree.insertItem(m_galleryTypeItems.get(DOWNLOAD_GALLERY_TYPE), 0); } if (m_galleryTypeItems.containsKey(IMAGE_GALLERY_TYPE)) { m_galleryTree.insertItem(m_galleryTypeItems.get(IMAGE_GALLERY_TYPE), 0); } m_galleryTree.truncate(TM_SITEMAP, 920); if (hasGalleries) { m_noGalleriesLabel.getElement().getStyle().setDisplay(Display.NONE); } else { m_noGalleriesLabel.getElement().getStyle().clearDisplay(); } } }
public class class_name { public void displayGalleries(Map<CmsGalleryType, List<CmsGalleryFolderEntry>> galleries) { m_galleryTree.clear(); m_galleryTreeItems.clear(); m_galleryTypeItems.clear(); CmsUUID galleriesFolderId = null; if (getRootItem().getChild(m_controller.getData().getDefaultGalleryFolder()) != null) { galleriesFolderId = ((CmsSitemapTreeItem)getRootItem().getChild( m_controller.getData().getDefaultGalleryFolder())).getEntryId(); // depends on control dependency: [if], data = [none] } List<CmsGalleryType> types = new ArrayList<CmsGalleryType>(galleries.keySet()); Collections.sort(types, new Comparator<CmsGalleryType>() { public int compare(CmsGalleryType o1, CmsGalleryType o2) { return o1.getTitle().compareTo(o2.getTitle()); } }); m_toolbar.setGalleryTypes(types); boolean hasGalleries = false; for (CmsGalleryType type : types) { CmsGalleryTreeItem typeItem = new CmsGalleryTreeItem(type); if (m_controller.isEditable() && m_controller.getData().isGalleryManager()) { CmsHoverbarCreateGalleryButton createButton = new CmsHoverbarCreateGalleryButton( type.getTypeId(), galleriesFolderId); CmsSitemapHoverbar hoverbar = CmsSitemapHoverbar.installOn( m_controller, typeItem, Collections.<Widget> singleton(createButton)); createButton.setHoverbar(hoverbar); // depends on control dependency: [if], data = [none] hoverbar.setAlwaysVisible(); // depends on control dependency: [if], data = [none] } m_galleryTypeItems.put(type.getResourceType(), typeItem); // depends on control dependency: [for], data = [type] addGalleryEntries(typeItem, galleries.get(type)); // depends on control dependency: [for], data = [type] typeItem.setOpen(true); // depends on control dependency: [for], data = [type] hasGalleries = true; // depends on control dependency: [for], data = [none] m_galleryTree.addItem(typeItem); // depends on control dependency: [for], data = [type] } // position image and download galleries at the top if (m_galleryTypeItems.containsKey(DOWNLOAD_GALLERY_TYPE)) { m_galleryTree.insertItem(m_galleryTypeItems.get(DOWNLOAD_GALLERY_TYPE), 0); // depends on control dependency: [if], data = [none] } if (m_galleryTypeItems.containsKey(IMAGE_GALLERY_TYPE)) { m_galleryTree.insertItem(m_galleryTypeItems.get(IMAGE_GALLERY_TYPE), 0); // depends on control dependency: [if], data = [none] } m_galleryTree.truncate(TM_SITEMAP, 920); if (hasGalleries) { m_noGalleriesLabel.getElement().getStyle().setDisplay(Display.NONE); // depends on control dependency: [if], data = [none] } else { m_noGalleriesLabel.getElement().getStyle().clearDisplay(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static void makeHeap(Quicksortable q, int size) { for (int i = (size-1)/2; i >= 0; i--) { heapifyDown(q, i, size); } } }
public class class_name { public static void makeHeap(Quicksortable q, int size) { for (int i = (size-1)/2; i >= 0; i--) { heapifyDown(q, i, size); // depends on control dependency: [for], data = [i] } } }
public class class_name { @Override public String url() { String url = ""; if (!StringUtils.isEmpty(baseUrl())) { url = baseUrl() + path(); } else { if (!StringUtils.isEmpty(properties.getProperty(Constants.DEFAULT_PROPERTY_URL))) { url = properties.getProperty(Constants.DEFAULT_PROPERTY_URL); } if (testConfig != null && (!StringUtils.isEmpty(testConfig.url()))) { url = testConfig.url(); } if (!StringUtils.isEmpty(JvmUtil.getJvmProperty(Constants.JVM_CONDUCTOR_URL))) { url = JvmUtil.getJvmProperty(Constants.JVM_CONDUCTOR_URL); } } return url; } }
public class class_name { @Override public String url() { String url = ""; if (!StringUtils.isEmpty(baseUrl())) { url = baseUrl() + path(); // depends on control dependency: [if], data = [none] } else { if (!StringUtils.isEmpty(properties.getProperty(Constants.DEFAULT_PROPERTY_URL))) { url = properties.getProperty(Constants.DEFAULT_PROPERTY_URL); // depends on control dependency: [if], data = [none] } if (testConfig != null && (!StringUtils.isEmpty(testConfig.url()))) { url = testConfig.url(); // depends on control dependency: [if], data = [none] } if (!StringUtils.isEmpty(JvmUtil.getJvmProperty(Constants.JVM_CONDUCTOR_URL))) { url = JvmUtil.getJvmProperty(Constants.JVM_CONDUCTOR_URL); // depends on control dependency: [if], data = [none] } } return url; } }
public class class_name { public String toURLQueryString() { StringJoiner joiner = new StringJoiner("&"); if (releaseIdFilter.getGroupId() != null) { joiner.add("groupId=" + releaseIdFilter.getGroupId()); } if (releaseIdFilter.getArtifactId() != null) { joiner.add("artifactId=" + releaseIdFilter.getArtifactId()); } if (releaseIdFilter.getVersion() != null) { joiner.add("version=" + releaseIdFilter.getVersion()); } // don't send over the default status filter (e.g. one that accepts all the states) as it is not needed, it is // the default if (!statusFilter.equals(KieContainerStatusFilter.ACCEPT_ALL)) { String status = statusFilter.getAcceptedStatuses() .stream() .map(s -> s.toString()) .collect(Collectors.joining(",")); joiner.add("status=" + status); } return joiner.toString(); } }
public class class_name { public String toURLQueryString() { StringJoiner joiner = new StringJoiner("&"); if (releaseIdFilter.getGroupId() != null) { joiner.add("groupId=" + releaseIdFilter.getGroupId()); // depends on control dependency: [if], data = [none] } if (releaseIdFilter.getArtifactId() != null) { joiner.add("artifactId=" + releaseIdFilter.getArtifactId()); // depends on control dependency: [if], data = [none] } if (releaseIdFilter.getVersion() != null) { joiner.add("version=" + releaseIdFilter.getVersion()); // depends on control dependency: [if], data = [none] } // don't send over the default status filter (e.g. one that accepts all the states) as it is not needed, it is // the default if (!statusFilter.equals(KieContainerStatusFilter.ACCEPT_ALL)) { String status = statusFilter.getAcceptedStatuses() .stream() .map(s -> s.toString()) .collect(Collectors.joining(",")); joiner.add("status=" + status); // depends on control dependency: [if], data = [none] } return joiner.toString(); } }
public class class_name { public static NDArrayMessage[] chunkedMessages(NDArrayMessage arrayMessage, int chunkSize) { int sizeOfMessage = NDArrayMessage.byteBufferSizeForMessage(arrayMessage) - 4; int numMessages = sizeOfMessage / chunkSize; ByteBuffer direct = NDArrayMessage.toBuffer(arrayMessage).byteBuffer(); NDArrayMessage[] ret = new NDArrayMessage[numMessages]; for (int i = 0; i < numMessages; i++) { byte[] chunk = new byte[chunkSize]; direct.get(chunk, i * chunkSize, chunkSize); ret[i] = NDArrayMessage.builder().chunk(chunk).numChunks(numMessages).build(); } return ret; } }
public class class_name { public static NDArrayMessage[] chunkedMessages(NDArrayMessage arrayMessage, int chunkSize) { int sizeOfMessage = NDArrayMessage.byteBufferSizeForMessage(arrayMessage) - 4; int numMessages = sizeOfMessage / chunkSize; ByteBuffer direct = NDArrayMessage.toBuffer(arrayMessage).byteBuffer(); NDArrayMessage[] ret = new NDArrayMessage[numMessages]; for (int i = 0; i < numMessages; i++) { byte[] chunk = new byte[chunkSize]; direct.get(chunk, i * chunkSize, chunkSize); // depends on control dependency: [for], data = [i] ret[i] = NDArrayMessage.builder().chunk(chunk).numChunks(numMessages).build(); // depends on control dependency: [for], data = [i] } return ret; } }
public class class_name { int getOperationFromRecord( Record record, int defaultOpCode, UnsupportedOperationAction unsupportedAction, List<OnRecordErrorException> errorRecords ) { String op = record.getHeader().getAttribute(OperationType.SDC_OPERATION_TYPE); int opCode = -1; // unsupported if (Strings.isNullOrEmpty(op)) { return defaultOpCode; } // Check if the operation code from header attribute is valid try { opCode = JDBCOperationType.convertToIntCode(op); } catch (NumberFormatException | UnsupportedOperationException ex) { LOG.debug( "Operation obtained from record is not supported. Handle by UnsupportedOperationAction {}. {}", unsupportedAction.getLabel(), ex ); switch (unsupportedAction) { case SEND_TO_ERROR: LOG.debug("Sending record to error due to unsupported operation {}", op); errorRecords.add(new OnRecordErrorException(record, JdbcErrors.JDBC_70, op)); break; case USE_DEFAULT: opCode = defaultOpCode; break; case DISCARD: default: // unknown action LOG.debug("Discarding record with unsupported operation {}", op); } } return opCode; } }
public class class_name { int getOperationFromRecord( Record record, int defaultOpCode, UnsupportedOperationAction unsupportedAction, List<OnRecordErrorException> errorRecords ) { String op = record.getHeader().getAttribute(OperationType.SDC_OPERATION_TYPE); int opCode = -1; // unsupported if (Strings.isNullOrEmpty(op)) { return defaultOpCode; // depends on control dependency: [if], data = [none] } // Check if the operation code from header attribute is valid try { opCode = JDBCOperationType.convertToIntCode(op); // depends on control dependency: [try], data = [none] } catch (NumberFormatException | UnsupportedOperationException ex) { LOG.debug( "Operation obtained from record is not supported. Handle by UnsupportedOperationAction {}. {}", unsupportedAction.getLabel(), ex ); switch (unsupportedAction) { case SEND_TO_ERROR: LOG.debug("Sending record to error due to unsupported operation {}", op); errorRecords.add(new OnRecordErrorException(record, JdbcErrors.JDBC_70, op)); break; case USE_DEFAULT: opCode = defaultOpCode; break; case DISCARD: default: // unknown action LOG.debug("Discarding record with unsupported operation {}", op); } } // depends on control dependency: [catch], data = [none] return opCode; } }
public class class_name { @Override protected void resizeDynamicText() { double maxWidth = unitText.isVisible() ? width - size * 0.275 : width - size * 0.1; double fontSize = 0.24 * size; valueText.setFont(Fonts.latoRegular(fontSize)); if (valueText.getLayoutBounds().getWidth() > maxWidth) { Helper.adjustTextSize(valueText, maxWidth, fontSize); } maxWidth = width - size * 0.55; fontSize = size * 0.18; deviationText.setFont(Fonts.latoRegular(fontSize)); if (deviationText.getLayoutBounds().getWidth() > maxWidth) { Helper.adjustTextSize(deviationText, maxWidth, fontSize); } maxWidth = width - size * 0.9; fontSize = size * 0.12; deviationUnitText.setFont(Fonts.latoRegular(fontSize)); if (deviationUnitText.getLayoutBounds().getWidth() > maxWidth) { Helper.adjustTextSize(deviationUnitText, maxWidth, fontSize); } } }
public class class_name { @Override protected void resizeDynamicText() { double maxWidth = unitText.isVisible() ? width - size * 0.275 : width - size * 0.1; double fontSize = 0.24 * size; valueText.setFont(Fonts.latoRegular(fontSize)); if (valueText.getLayoutBounds().getWidth() > maxWidth) { Helper.adjustTextSize(valueText, maxWidth, fontSize); } // depends on control dependency: [if], data = [none] maxWidth = width - size * 0.55; fontSize = size * 0.18; deviationText.setFont(Fonts.latoRegular(fontSize)); if (deviationText.getLayoutBounds().getWidth() > maxWidth) { Helper.adjustTextSize(deviationText, maxWidth, fontSize); } // depends on control dependency: [if], data = [none] maxWidth = width - size * 0.9; fontSize = size * 0.12; deviationUnitText.setFont(Fonts.latoRegular(fontSize)); if (deviationUnitText.getLayoutBounds().getWidth() > maxWidth) { Helper.adjustTextSize(deviationUnitText, maxWidth, fontSize); } // depends on control dependency: [if], data = [none] } }
public class class_name { private double preNorm(NumberVector v, final int start, final int end) { double agg = 0.; for(int d = start; d < end; d++) { final double xd = v.doubleValue(d); final double delta = xd >= 0. ? xd : -xd; agg += MathUtil.powi(delta, intp); } return agg; } }
public class class_name { private double preNorm(NumberVector v, final int start, final int end) { double agg = 0.; for(int d = start; d < end; d++) { final double xd = v.doubleValue(d); final double delta = xd >= 0. ? xd : -xd; agg += MathUtil.powi(delta, intp); // depends on control dependency: [for], data = [none] } return agg; } }
public class class_name { public static String getNewResourceTitle(CmsWorkplace wp, String name) { // try to find the localized key String title = wp.key(GUI_NEW_RESOURCE_TITLE_PREFIX + name.toLowerCase()); if (CmsMessages.isUnknownKey(title)) { // still unknown - use default title title = wp.key(org.opencms.workplace.explorer.Messages.GUI_TITLE_NEWFILEOTHER_0); } return title; } }
public class class_name { public static String getNewResourceTitle(CmsWorkplace wp, String name) { // try to find the localized key String title = wp.key(GUI_NEW_RESOURCE_TITLE_PREFIX + name.toLowerCase()); if (CmsMessages.isUnknownKey(title)) { // still unknown - use default title title = wp.key(org.opencms.workplace.explorer.Messages.GUI_TITLE_NEWFILEOTHER_0); // depends on control dependency: [if], data = [none] } return title; } }
public class class_name { public void marshall(ChildWorkflowExecutionCanceledEventAttributes childWorkflowExecutionCanceledEventAttributes, ProtocolMarshaller protocolMarshaller) { if (childWorkflowExecutionCanceledEventAttributes == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(childWorkflowExecutionCanceledEventAttributes.getWorkflowExecution(), WORKFLOWEXECUTION_BINDING); protocolMarshaller.marshall(childWorkflowExecutionCanceledEventAttributes.getWorkflowType(), WORKFLOWTYPE_BINDING); protocolMarshaller.marshall(childWorkflowExecutionCanceledEventAttributes.getDetails(), DETAILS_BINDING); protocolMarshaller.marshall(childWorkflowExecutionCanceledEventAttributes.getInitiatedEventId(), INITIATEDEVENTID_BINDING); protocolMarshaller.marshall(childWorkflowExecutionCanceledEventAttributes.getStartedEventId(), STARTEDEVENTID_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ChildWorkflowExecutionCanceledEventAttributes childWorkflowExecutionCanceledEventAttributes, ProtocolMarshaller protocolMarshaller) { if (childWorkflowExecutionCanceledEventAttributes == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(childWorkflowExecutionCanceledEventAttributes.getWorkflowExecution(), WORKFLOWEXECUTION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(childWorkflowExecutionCanceledEventAttributes.getWorkflowType(), WORKFLOWTYPE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(childWorkflowExecutionCanceledEventAttributes.getDetails(), DETAILS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(childWorkflowExecutionCanceledEventAttributes.getInitiatedEventId(), INITIATEDEVENTID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(childWorkflowExecutionCanceledEventAttributes.getStartedEventId(), STARTEDEVENTID_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void updateProcessedCounters(int snapshotFinishedWorkers) { if (isInterrupted()) { wakeUpWorkers(); return; } if (countStartedWorkers_.get() > snapshotFinishedWorkers) { /* * We are not the last worker processing the saturation state, so * the current jobs and contexts may not be processed yet. */ return; } /* * Otherwise we were the last worker processing the saturation state; * take the values for current jobs and contexts and verify that we are * still the last worker (thus the order is important here). */ int snapshotCountJobsSubmitted = countJobsSubmittedUpper_.get(); int snapshotCountContextNonSaturated = saturationState_ .getContextMarkNonSaturatedCount(); int snapshotCountStartedWorkers = countStartedWorkers_.get(); if (snapshotCountStartedWorkers > snapshotFinishedWorkers) { /* no longer the last worker */ return; } /* * If we arrive here, #snapshotCountJobsSubmitted and * #snapshotCountContextNonSaturated represents at least the number of * jobs processed and saturated contexts. Furthermore, since we took * them in this order, we know that all contexts for the processed jobs * were created, saturated, and counted. Now, we updated the * corresponding counters for the processed contexts and jobs but in the * reversed order to make sure that for every job considered to be * processed all contexts were already considered to be processed. */ if (updateIfSmaller(countContextsSaturatedLower_, snapshotCountContextNonSaturated)) { /* * Sleeping workers can now take new inputs. */ wakeUpWorkers(); } updateIfSmaller(countJobsProcessedLower_, snapshotCountJobsSubmitted); } }
public class class_name { private void updateProcessedCounters(int snapshotFinishedWorkers) { if (isInterrupted()) { wakeUpWorkers(); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (countStartedWorkers_.get() > snapshotFinishedWorkers) { /* * We are not the last worker processing the saturation state, so * the current jobs and contexts may not be processed yet. */ return; // depends on control dependency: [if], data = [none] } /* * Otherwise we were the last worker processing the saturation state; * take the values for current jobs and contexts and verify that we are * still the last worker (thus the order is important here). */ int snapshotCountJobsSubmitted = countJobsSubmittedUpper_.get(); int snapshotCountContextNonSaturated = saturationState_ .getContextMarkNonSaturatedCount(); int snapshotCountStartedWorkers = countStartedWorkers_.get(); if (snapshotCountStartedWorkers > snapshotFinishedWorkers) { /* no longer the last worker */ return; // depends on control dependency: [if], data = [none] } /* * If we arrive here, #snapshotCountJobsSubmitted and * #snapshotCountContextNonSaturated represents at least the number of * jobs processed and saturated contexts. Furthermore, since we took * them in this order, we know that all contexts for the processed jobs * were created, saturated, and counted. Now, we updated the * corresponding counters for the processed contexts and jobs but in the * reversed order to make sure that for every job considered to be * processed all contexts were already considered to be processed. */ if (updateIfSmaller(countContextsSaturatedLower_, snapshotCountContextNonSaturated)) { /* * Sleeping workers can now take new inputs. */ wakeUpWorkers(); // depends on control dependency: [if], data = [none] } updateIfSmaller(countJobsProcessedLower_, snapshotCountJobsSubmitted); } }
public class class_name { public Observable<ServiceResponse<Iteration>> getIterationWithServiceResponseAsync(UUID projectId, UUID iterationId) { if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } if (iterationId == null) { throw new IllegalArgumentException("Parameter iterationId is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } return service.getIteration(projectId, iterationId, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Iteration>>>() { @Override public Observable<ServiceResponse<Iteration>> call(Response<ResponseBody> response) { try { ServiceResponse<Iteration> clientResponse = getIterationDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } }
public class class_name { public Observable<ServiceResponse<Iteration>> getIterationWithServiceResponseAsync(UUID projectId, UUID iterationId) { if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } if (iterationId == null) { throw new IllegalArgumentException("Parameter iterationId is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } return service.getIteration(projectId, iterationId, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Iteration>>>() { @Override public Observable<ServiceResponse<Iteration>> call(Response<ResponseBody> response) { try { ServiceResponse<Iteration> clientResponse = getIterationDelegate(response); return Observable.just(clientResponse); // depends on control dependency: [try], data = [none] } catch (Throwable t) { return Observable.error(t); } // depends on control dependency: [catch], data = [none] } }); } }
public class class_name { public void up(SpinEvent spinEvent) { try { // get the control that has fired the event, XControl xControl = (XControl) UnoRuntime.queryInterface(XControl.class, spinEvent.Source); XControlModel xControlModel = xControl.getModel(); XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xControlModel); String sName = (String) xPSet.getPropertyValue("Name"); // just in case the listener has been added to several controls, // we make sure we refer to the right one if (sName.equals("FormattedField1")){ double fvalue = AnyConverter.toDouble(xPSet.getPropertyValue("EffectiveValue")); System.out.println("Controlvalue: " + fvalue); // insert your code here to validate the value of the control... } }catch (com.sun.star.uno.Exception ex){ /* perform individual exception handling here. * Possible exception types are: * com.sun.star.lang.WrappedTargetException, * com.sun.star.beans.UnknownPropertyException, * com.sun.star.uno.Exception */ ex.printStackTrace(System.out); } } }
public class class_name { public void up(SpinEvent spinEvent) { try { // get the control that has fired the event, XControl xControl = (XControl) UnoRuntime.queryInterface(XControl.class, spinEvent.Source); XControlModel xControlModel = xControl.getModel(); XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xControlModel); String sName = (String) xPSet.getPropertyValue("Name"); // just in case the listener has been added to several controls, // we make sure we refer to the right one if (sName.equals("FormattedField1")){ double fvalue = AnyConverter.toDouble(xPSet.getPropertyValue("EffectiveValue")); System.out.println("Controlvalue: " + fvalue); // depends on control dependency: [if], data = [none] // insert your code here to validate the value of the control... } }catch (com.sun.star.uno.Exception ex){ /* perform individual exception handling here. * Possible exception types are: * com.sun.star.lang.WrappedTargetException, * com.sun.star.beans.UnknownPropertyException, * com.sun.star.uno.Exception */ ex.printStackTrace(System.out); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void closeQueue(Throwable causingException) { // Close the operation queue and extract any outstanding Operations from it. Collection<CompletableOperation> remainingOperations = this.operationQueue.close(); if (remainingOperations != null && remainingOperations.size() > 0) { // If any outstanding Operations were left in the queue, they need to be failed. // If no other cause was passed, assume we are closing the queue because we are shutting down. Throwable failException = causingException != null ? causingException : new CancellationException(); cancelIncompleteOperations(remainingOperations, failException); } // The commit queue will auto-close when we are done and it itself is empty. We just need to unblock it in case // it was idle and waiting on a pending take() operation. this.commitQueue.cancelPendingTake(); } }
public class class_name { private void closeQueue(Throwable causingException) { // Close the operation queue and extract any outstanding Operations from it. Collection<CompletableOperation> remainingOperations = this.operationQueue.close(); if (remainingOperations != null && remainingOperations.size() > 0) { // If any outstanding Operations were left in the queue, they need to be failed. // If no other cause was passed, assume we are closing the queue because we are shutting down. Throwable failException = causingException != null ? causingException : new CancellationException(); cancelIncompleteOperations(remainingOperations, failException); // depends on control dependency: [if], data = [(remainingOperations] } // The commit queue will auto-close when we are done and it itself is empty. We just need to unblock it in case // it was idle and waiting on a pending take() operation. this.commitQueue.cancelPendingTake(); } }
public class class_name { public static boolean isSorted(short[] shortArray) { for(int i = 0; i < shortArray.length - 1 ; i++) { if(shortArray[i] > shortArray [i + 1]) { return false; } } return true; } }
public class class_name { public static boolean isSorted(short[] shortArray) { for(int i = 0; i < shortArray.length - 1 ; i++) { if(shortArray[i] > shortArray [i + 1]) { return false; // depends on control dependency: [if], data = [none] } } return true; } }
public class class_name { public void handleThrowable(Throwable e, Object target) { try { ExceptionCallback exceptionCallback = (ExceptionCallback) target; if (e instanceof Exception) { exceptionCallback.exceptionThrown((Exception) e); } else { exceptionCallback.exceptionThrown(new RuntimeException(e)); } } catch (IllegalArgumentException | ClassCastException e1) { log.fatal("unable to provide callback for: " + target.toString(), e); } } }
public class class_name { public void handleThrowable(Throwable e, Object target) { try { ExceptionCallback exceptionCallback = (ExceptionCallback) target; if (e instanceof Exception) { exceptionCallback.exceptionThrown((Exception) e); // depends on control dependency: [if], data = [none] } else { exceptionCallback.exceptionThrown(new RuntimeException(e)); // depends on control dependency: [if], data = [none] } } catch (IllegalArgumentException | ClassCastException e1) { log.fatal("unable to provide callback for: " + target.toString(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public FileInfo getFileInfo() throws IOException { try { load(false); if (m_resource.isFile()) { // Fill in a file information object for this file/directory long flen = m_resource.getLength(); //long alloc = (flen + 512L) & 0xFFFFFFFFFFFFFE00L; long alloc = flen; int fattr = 0; if (m_cms.getRequestContext().getCurrentProject().isOnlineProject()) { fattr += FileAttribute.ReadOnly; } // Create the file information FileInfo finfo = new FileInfo(m_resource.getName(), flen, fattr); long fdate = m_resource.getDateLastModified(); finfo.setModifyDateTime(fdate); finfo.setAllocationSize(alloc); finfo.setFileId(m_resource.getStructureId().hashCode()); finfo.setCreationDateTime(m_resource.getDateCreated()); finfo.setChangeDateTime(fdate); return finfo; } else { // Fill in a file information object for this directory int fattr = FileAttribute.Directory; if (m_cms.getRequestContext().getCurrentProject().isOnlineProject()) { fattr += FileAttribute.ReadOnly; } // Can't use negative file size here, since this stops Windows 7 from connecting FileInfo finfo = new FileInfo(m_resource.getName(), 1, fattr); long fdate = m_resource.getDateLastModified(); finfo.setModifyDateTime(fdate); finfo.setAllocationSize(1); finfo.setFileId(m_resource.getStructureId().hashCode()); finfo.setCreationDateTime(m_resource.getDateCreated()); finfo.setChangeDateTime(fdate); return finfo; } } catch (CmsException e) { throw CmsJlanDiskInterface.convertCmsException(e); } } }
public class class_name { public FileInfo getFileInfo() throws IOException { try { load(false); if (m_resource.isFile()) { // Fill in a file information object for this file/directory long flen = m_resource.getLength(); //long alloc = (flen + 512L) & 0xFFFFFFFFFFFFFE00L; long alloc = flen; int fattr = 0; if (m_cms.getRequestContext().getCurrentProject().isOnlineProject()) { fattr += FileAttribute.ReadOnly; } // Create the file information FileInfo finfo = new FileInfo(m_resource.getName(), flen, fattr); long fdate = m_resource.getDateLastModified(); finfo.setModifyDateTime(fdate); finfo.setAllocationSize(alloc); finfo.setFileId(m_resource.getStructureId().hashCode()); finfo.setCreationDateTime(m_resource.getDateCreated()); finfo.setChangeDateTime(fdate); return finfo; } else { // Fill in a file information object for this directory int fattr = FileAttribute.Directory; if (m_cms.getRequestContext().getCurrentProject().isOnlineProject()) { fattr += FileAttribute.ReadOnly; // depends on control dependency: [if], data = [none] } // Can't use negative file size here, since this stops Windows 7 from connecting FileInfo finfo = new FileInfo(m_resource.getName(), 1, fattr); long fdate = m_resource.getDateLastModified(); finfo.setModifyDateTime(fdate); finfo.setAllocationSize(1); finfo.setFileId(m_resource.getStructureId().hashCode()); finfo.setCreationDateTime(m_resource.getDateCreated()); finfo.setChangeDateTime(fdate); return finfo; } } catch (CmsException e) { throw CmsJlanDiskInterface.convertCmsException(e); } } }
public class class_name { @Override public Blob transformOut(JdbcPreparedStatementFactory jpsf, byte[] attributeObject) throws CpoException { BLOB newBlob = null; try { if (attributeObject != null) { newBlob = BLOB.createTemporary(jpsf.getPreparedStatement().getConnection(), false, BLOB.DURATION_SESSION); jpsf.AddReleasible(new OracleTemporaryBlob(newBlob)); //OutputStream os = newBlob.getBinaryOutputStream(); OutputStream os = newBlob.setBinaryStream(0); os.write(attributeObject); os.close(); } } catch (Exception e) { String msg = "Error BLOBing Byte Array"; logger.error(msg, e); throw new CpoException(msg, e); } return newBlob; } }
public class class_name { @Override public Blob transformOut(JdbcPreparedStatementFactory jpsf, byte[] attributeObject) throws CpoException { BLOB newBlob = null; try { if (attributeObject != null) { newBlob = BLOB.createTemporary(jpsf.getPreparedStatement().getConnection(), false, BLOB.DURATION_SESSION); // depends on control dependency: [if], data = [none] jpsf.AddReleasible(new OracleTemporaryBlob(newBlob)); // depends on control dependency: [if], data = [none] //OutputStream os = newBlob.getBinaryOutputStream(); OutputStream os = newBlob.setBinaryStream(0); os.write(attributeObject); // depends on control dependency: [if], data = [(attributeObject] os.close(); // depends on control dependency: [if], data = [none] } } catch (Exception e) { String msg = "Error BLOBing Byte Array"; logger.error(msg, e); throw new CpoException(msg, e); } return newBlob; } }
public class class_name { public static File zip(File... files) { try { File temp = File.createTempFile("osgl", ".zip"); zipInto(temp, files); return temp; } catch (IOException e) { throw E.ioException(e); } } }
public class class_name { public static File zip(File... files) { try { File temp = File.createTempFile("osgl", ".zip"); zipInto(temp, files); // depends on control dependency: [try], data = [none] return temp; // depends on control dependency: [try], data = [none] } catch (IOException e) { throw E.ioException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @View(name = "by_serviceName", map = "function(doc) { if (doc.service) { emit(doc.service.name, doc._id) }}") public RegisteredServiceDocument findByServiceName(final String serviceName) { try { return queryView("by_serviceName", serviceName).stream().findFirst().orElse(null); } catch (final DocumentNotFoundException e) { LOGGER.debug("Service [{}] not found. [{}]", serviceName, e.getMessage()); return null; } } }
public class class_name { @View(name = "by_serviceName", map = "function(doc) { if (doc.service) { emit(doc.service.name, doc._id) }}") public RegisteredServiceDocument findByServiceName(final String serviceName) { try { return queryView("by_serviceName", serviceName).stream().findFirst().orElse(null); // depends on control dependency: [try], data = [none] } catch (final DocumentNotFoundException e) { LOGGER.debug("Service [{}] not found. [{}]", serviceName, e.getMessage()); return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void sessionHeartbeat(long sessionId) { synchronized (mSessions) { if (mSessions.containsKey(sessionId)) { mSessions.get(sessionId).heartbeat(); } else { int sessionTimeoutMs = (int) ServerConfiguration .getMs(PropertyKey.WORKER_SESSION_TIMEOUT_MS); mSessions.put(sessionId, new SessionInfo(sessionId, sessionTimeoutMs)); } } } }
public class class_name { public void sessionHeartbeat(long sessionId) { synchronized (mSessions) { if (mSessions.containsKey(sessionId)) { mSessions.get(sessionId).heartbeat(); // depends on control dependency: [if], data = [none] } else { int sessionTimeoutMs = (int) ServerConfiguration .getMs(PropertyKey.WORKER_SESSION_TIMEOUT_MS); mSessions.put(sessionId, new SessionInfo(sessionId, sessionTimeoutMs)); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void accept(PainterVisitor visitor, Object group, Bbox bounds, boolean recursive) { for (Paintable p : children) { visitor.visit(p, group); } } }
public class class_name { public void accept(PainterVisitor visitor, Object group, Bbox bounds, boolean recursive) { for (Paintable p : children) { visitor.visit(p, group); // depends on control dependency: [for], data = [p] } } }
public class class_name { private ColumnDef getColumnDefByName(CfDef columnFamily, ByteBuffer columnName) { for (ColumnDef columnDef : columnFamily.getColumn_metadata()) { byte[] currName = columnDef.getName(); if (ByteBufferUtil.compare(currName, columnName) == 0) { return columnDef; } } return null; } }
public class class_name { private ColumnDef getColumnDefByName(CfDef columnFamily, ByteBuffer columnName) { for (ColumnDef columnDef : columnFamily.getColumn_metadata()) { byte[] currName = columnDef.getName(); if (ByteBufferUtil.compare(currName, columnName) == 0) { return columnDef; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { static public X509Certificate readCertificate(String filename) throws Exception { InputStream inStream = null; X509Certificate cert = null; try { inStream = Config.getInstance().getInputStreamFromFile(filename); if (inStream != null) { CertificateFactory cf = CertificateFactory.getInstance("X.509"); cert = (X509Certificate) cf.generateCertificate(inStream); } else { logger.info("Certificate " + Encode.forJava(filename) + " not found."); } } catch (Exception e) { logger.error("Exception: ", e); } finally { if (inStream != null) { try { inStream.close(); } catch (IOException ioe) { logger.error("Exception: ", ioe); } } } return cert; } }
public class class_name { static public X509Certificate readCertificate(String filename) throws Exception { InputStream inStream = null; X509Certificate cert = null; try { inStream = Config.getInstance().getInputStreamFromFile(filename); if (inStream != null) { CertificateFactory cf = CertificateFactory.getInstance("X.509"); cert = (X509Certificate) cf.generateCertificate(inStream); // depends on control dependency: [if], data = [(inStream] } else { logger.info("Certificate " + Encode.forJava(filename) + " not found."); // depends on control dependency: [if], data = [none] } } catch (Exception e) { logger.error("Exception: ", e); } finally { if (inStream != null) { try { inStream.close(); // depends on control dependency: [try], data = [none] } catch (IOException ioe) { logger.error("Exception: ", ioe); } // depends on control dependency: [catch], data = [none] } } return cert; } }
public class class_name { public void visitTryCatchBlock( final Label start, final Label end, final Label handler, final String type) { if (mv != null) { mv.visitTryCatchBlock(start, end, handler, type); } } }
public class class_name { public void visitTryCatchBlock( final Label start, final Label end, final Label handler, final String type) { if (mv != null) { mv.visitTryCatchBlock(start, end, handler, type); // depends on control dependency: [if], data = [none] } } }
public class class_name { public List<String> extractModelReferences(XAttributable target) { ArrayList<String> modelReferences = new ArrayList<String>(); XAttributeLiteral modelReferenceAttribute = (XAttributeLiteral) target .getAttributes().get(KEY_MODELREFERENCE); if (modelReferenceAttribute != null) { String refString = modelReferenceAttribute.getValue().trim(); for (String reference : refString.split("\\s")) { modelReferences.add(reference.trim()); } } return modelReferences; } }
public class class_name { public List<String> extractModelReferences(XAttributable target) { ArrayList<String> modelReferences = new ArrayList<String>(); XAttributeLiteral modelReferenceAttribute = (XAttributeLiteral) target .getAttributes().get(KEY_MODELREFERENCE); if (modelReferenceAttribute != null) { String refString = modelReferenceAttribute.getValue().trim(); for (String reference : refString.split("\\s")) { modelReferences.add(reference.trim()); // depends on control dependency: [for], data = [reference] } } return modelReferences; } }
public class class_name { private void addNamedNativeQueryMetadata(Class clazz) { ApplicationMetadata appMetadata = kunderaMetadata.getApplicationMetadata(); String name, query = null; if (clazz.isAnnotationPresent(NamedQuery.class)) { NamedQuery ann = (NamedQuery) clazz.getAnnotation(NamedQuery.class); appMetadata.addQueryToCollection(ann.name(), ann.query(), false, clazz); } if (clazz.isAnnotationPresent(NamedQueries.class)) { NamedQueries ann = (NamedQueries) clazz.getAnnotation(NamedQueries.class); NamedQuery[] anns = ann.value(); for (NamedQuery a : anns) { appMetadata.addQueryToCollection(a.name(), a.query(), false, clazz); } } if (clazz.isAnnotationPresent(NamedNativeQuery.class)) { NamedNativeQuery ann = (NamedNativeQuery) clazz.getAnnotation(NamedNativeQuery.class); appMetadata.addQueryToCollection(ann.name(), ann.query(), true, clazz); } if (clazz.isAnnotationPresent(NamedNativeQueries.class)) { NamedNativeQueries ann = (NamedNativeQueries) clazz.getAnnotation(NamedNativeQueries.class); NamedNativeQuery[] anns = ann.value(); for (NamedNativeQuery a : anns) { appMetadata.addQueryToCollection(a.name(), a.query(), true, clazz); } } } }
public class class_name { private void addNamedNativeQueryMetadata(Class clazz) { ApplicationMetadata appMetadata = kunderaMetadata.getApplicationMetadata(); String name, query = null; if (clazz.isAnnotationPresent(NamedQuery.class)) { NamedQuery ann = (NamedQuery) clazz.getAnnotation(NamedQuery.class); appMetadata.addQueryToCollection(ann.name(), ann.query(), false, clazz); // depends on control dependency: [if], data = [none] } if (clazz.isAnnotationPresent(NamedQueries.class)) { NamedQueries ann = (NamedQueries) clazz.getAnnotation(NamedQueries.class); NamedQuery[] anns = ann.value(); for (NamedQuery a : anns) { appMetadata.addQueryToCollection(a.name(), a.query(), false, clazz); // depends on control dependency: [for], data = [a] } } if (clazz.isAnnotationPresent(NamedNativeQuery.class)) { NamedNativeQuery ann = (NamedNativeQuery) clazz.getAnnotation(NamedNativeQuery.class); appMetadata.addQueryToCollection(ann.name(), ann.query(), true, clazz); // depends on control dependency: [if], data = [none] } if (clazz.isAnnotationPresent(NamedNativeQueries.class)) { NamedNativeQueries ann = (NamedNativeQueries) clazz.getAnnotation(NamedNativeQueries.class); NamedNativeQuery[] anns = ann.value(); for (NamedNativeQuery a : anns) { appMetadata.addQueryToCollection(a.name(), a.query(), true, clazz); // depends on control dependency: [for], data = [a] } } } }
public class class_name { public void marshall(GetInstanceSnapshotsRequest getInstanceSnapshotsRequest, ProtocolMarshaller protocolMarshaller) { if (getInstanceSnapshotsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getInstanceSnapshotsRequest.getPageToken(), PAGETOKEN_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(GetInstanceSnapshotsRequest getInstanceSnapshotsRequest, ProtocolMarshaller protocolMarshaller) { if (getInstanceSnapshotsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getInstanceSnapshotsRequest.getPageToken(), PAGETOKEN_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 { @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1869") @SuppressWarnings("unchecked") public <T> T getOption(Key<T> key) { Preconditions.checkNotNull(key, "key"); for (int i = 0; i < customOptions.length; i++) { if (key.equals(customOptions[i][0])) { return (T) customOptions[i][1]; } } return key.defaultValue; } }
public class class_name { @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1869") @SuppressWarnings("unchecked") public <T> T getOption(Key<T> key) { Preconditions.checkNotNull(key, "key"); for (int i = 0; i < customOptions.length; i++) { if (key.equals(customOptions[i][0])) { return (T) customOptions[i][1]; // depends on control dependency: [if], data = [none] } } return key.defaultValue; } }
public class class_name { public List<Integer> findIntValues(JvmAnnotationTarget op, Class<? extends Annotation> annotationType) { final JvmAnnotationReference reference = this.lookup.findAnnotation(op, annotationType); if (reference != null) { return findIntValues(reference); } return null; } }
public class class_name { public List<Integer> findIntValues(JvmAnnotationTarget op, Class<? extends Annotation> annotationType) { final JvmAnnotationReference reference = this.lookup.findAnnotation(op, annotationType); if (reference != null) { return findIntValues(reference); // depends on control dependency: [if], data = [(reference] } return null; } }
public class class_name { public Response propPatch(Session session, String path, HierarchicalProperty body, List<String> tokens, String baseURI) { try { lockHolder.checkLock(session, path, tokens); Node node = (Node)session.getItem(path); WebDavNamespaceContext nsContext = new WebDavNamespaceContext(session); URI uri = new URI(TextUtil.escape(baseURI + node.getPath(), '%', true)); List<HierarchicalProperty> setList = Collections.emptyList(); if (body.getChild(new QName("DAV:", "set")) != null) { setList = setList(body); } List<HierarchicalProperty> removeList = Collections.emptyList(); if (body.getChild(new QName("DAV:", "remove")) != null) { removeList = removeList(body); } PropPatchResponseEntity entity = new PropPatchResponseEntity(nsContext, node, uri, setList, removeList); return Response.status(HTTPStatus.MULTISTATUS).entity(entity).type(MediaType.TEXT_XML).build(); } catch (PathNotFoundException exc) { return Response.status(HTTPStatus.NOT_FOUND).entity(exc.getMessage()).build(); } catch (LockException exc) { return Response.status(HTTPStatus.LOCKED).entity(exc.getMessage()).build(); } catch (Exception exc) { log.error(exc.getMessage(), exc); return Response.serverError().entity(exc.getMessage()).build(); } } }
public class class_name { public Response propPatch(Session session, String path, HierarchicalProperty body, List<String> tokens, String baseURI) { try { lockHolder.checkLock(session, path, tokens); // depends on control dependency: [try], data = [none] Node node = (Node)session.getItem(path); WebDavNamespaceContext nsContext = new WebDavNamespaceContext(session); URI uri = new URI(TextUtil.escape(baseURI + node.getPath(), '%', true)); List<HierarchicalProperty> setList = Collections.emptyList(); if (body.getChild(new QName("DAV:", "set")) != null) { setList = setList(body); // depends on control dependency: [if], data = [none] } List<HierarchicalProperty> removeList = Collections.emptyList(); if (body.getChild(new QName("DAV:", "remove")) != null) { removeList = removeList(body); // depends on control dependency: [if], data = [none] } PropPatchResponseEntity entity = new PropPatchResponseEntity(nsContext, node, uri, setList, removeList); return Response.status(HTTPStatus.MULTISTATUS).entity(entity).type(MediaType.TEXT_XML).build(); // depends on control dependency: [try], data = [none] } catch (PathNotFoundException exc) { return Response.status(HTTPStatus.NOT_FOUND).entity(exc.getMessage()).build(); } // depends on control dependency: [catch], data = [none] catch (LockException exc) { return Response.status(HTTPStatus.LOCKED).entity(exc.getMessage()).build(); } // depends on control dependency: [catch], data = [none] catch (Exception exc) { log.error(exc.getMessage(), exc); return Response.serverError().entity(exc.getMessage()).build(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public Observable<ServiceResponse<Page<AppServicePlanInner>>> listAppServicePlansWithServiceResponseAsync(final String resourceGroupName, final String name) { return listAppServicePlansSinglePageAsync(resourceGroupName, name) .concatMap(new Func1<ServiceResponse<Page<AppServicePlanInner>>, Observable<ServiceResponse<Page<AppServicePlanInner>>>>() { @Override public Observable<ServiceResponse<Page<AppServicePlanInner>>> call(ServiceResponse<Page<AppServicePlanInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listAppServicePlansNextWithServiceResponseAsync(nextPageLink)); } }); } }
public class class_name { public Observable<ServiceResponse<Page<AppServicePlanInner>>> listAppServicePlansWithServiceResponseAsync(final String resourceGroupName, final String name) { return listAppServicePlansSinglePageAsync(resourceGroupName, name) .concatMap(new Func1<ServiceResponse<Page<AppServicePlanInner>>, Observable<ServiceResponse<Page<AppServicePlanInner>>>>() { @Override public Observable<ServiceResponse<Page<AppServicePlanInner>>> call(ServiceResponse<Page<AppServicePlanInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); // depends on control dependency: [if], data = [none] } return Observable.just(page).concatWith(listAppServicePlansNextWithServiceResponseAsync(nextPageLink)); } }); } }
public class class_name { public String format(final String code, @Nullable final Object... args) { String pattern = getMessage(code); if (args != null) { return String.format(pattern, args); } else { return pattern; } } }
public class class_name { public String format(final String code, @Nullable final Object... args) { String pattern = getMessage(code); if (args != null) { return String.format(pattern, args); // depends on control dependency: [if], data = [none] } else { return pattern; // depends on control dependency: [if], data = [none] } } }
public class class_name { public void restart(PersistentMessageStore PM) throws TransactionException, SevereMessageStoreException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "restart", "PersistenceManager="+PM); if (PM != null) { // We need to store the PM so that we can call // it during transaction completion. if (PM instanceof PersistenceManager) { _persistence = (PersistenceManager)PM; } else { // We don't have a valid PersistenceManager so we // are up the spout. Need to fall over in a big heap. if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "No PersistenceManager provided at startup. MessageStore cannot continue!"); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "restart"); throw new SevereMessageStoreException("UNRECOVERABLE_ERROR_SIMS1499", new Object[]{}); } // We need to read our indoubt xid list in preperation // for a call from the transaction manager at recovery // time. try { List list = PM.readIndoubtXIDs(); Iterator iterator = list.iterator(); while (iterator.hasNext()) { PersistentTranId ptid = (PersistentTranId)iterator.next(); _indoubtXids.add(ptid); synchronized(_associationLock) { _unassociatedTrans.put(ptid, new XidParticipant(_ms, ptid, _persistence, 0, TransactionState.STATE_PREPARED)); } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Indoubt Transaction Re-instated from database: "+ptid); } } catch (PersistenceException pe) { com.ibm.ws.ffdc.FFDCFilter.processException(pe, "com.ibm.ws.sib.msgstore.transactions.XidManager.restart", "1:516:1.62"); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "Persistence exception caught reading indoubt transactions from database!", pe); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "restart"); throw new TransactionException("UNEXPECTED_EXCEPTION_SIMS1099", new Object[]{pe}, pe); } } else { // We don't have a valid PersistenceManager so we // are up the spout. Need to fall over in a big heap. if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "PersistenceManager is null. MessageStore cannot continue!"); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "restart"); throw new SevereMessageStoreException("UNRECOVERABLE_ERROR_SIMS1499", new Object[]{}); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "restart"); } }
public class class_name { public void restart(PersistentMessageStore PM) throws TransactionException, SevereMessageStoreException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "restart", "PersistenceManager="+PM); if (PM != null) { // We need to store the PM so that we can call // it during transaction completion. if (PM instanceof PersistenceManager) { _persistence = (PersistenceManager)PM; } else { // We don't have a valid PersistenceManager so we // are up the spout. Need to fall over in a big heap. if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "No PersistenceManager provided at startup. MessageStore cannot continue!"); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "restart"); throw new SevereMessageStoreException("UNRECOVERABLE_ERROR_SIMS1499", new Object[]{}); } // We need to read our indoubt xid list in preperation // for a call from the transaction manager at recovery // time. try { List list = PM.readIndoubtXIDs(); Iterator iterator = list.iterator(); while (iterator.hasNext()) { PersistentTranId ptid = (PersistentTranId)iterator.next(); _indoubtXids.add(ptid); // depends on control dependency: [while], data = [none] synchronized(_associationLock) // depends on control dependency: [while], data = [none] { _unassociatedTrans.put(ptid, new XidParticipant(_ms, ptid, _persistence, 0, TransactionState.STATE_PREPARED)); } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Indoubt Transaction Re-instated from database: "+ptid); } } catch (PersistenceException pe) { com.ibm.ws.ffdc.FFDCFilter.processException(pe, "com.ibm.ws.sib.msgstore.transactions.XidManager.restart", "1:516:1.62"); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "Persistence exception caught reading indoubt transactions from database!", pe); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "restart"); throw new TransactionException("UNEXPECTED_EXCEPTION_SIMS1099", new Object[]{pe}, pe); } } else { // We don't have a valid PersistenceManager so we // are up the spout. Need to fall over in a big heap. if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "PersistenceManager is null. MessageStore cannot continue!"); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "restart"); throw new SevereMessageStoreException("UNRECOVERABLE_ERROR_SIMS1499", new Object[]{}); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "restart"); } }
public class class_name { public void setProxy(Proxy proxy) { if (verifiers.removeIf(verifier -> verifier instanceof SkillRequestSignatureVerifier)) { verifiers.add(new SkillRequestSignatureVerifier(proxy)); } } }
public class class_name { public void setProxy(Proxy proxy) { if (verifiers.removeIf(verifier -> verifier instanceof SkillRequestSignatureVerifier)) { verifiers.add(new SkillRequestSignatureVerifier(proxy)); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void marshall(GetUsagePlanRequest getUsagePlanRequest, ProtocolMarshaller protocolMarshaller) { if (getUsagePlanRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getUsagePlanRequest.getUsagePlanId(), USAGEPLANID_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(GetUsagePlanRequest getUsagePlanRequest, ProtocolMarshaller protocolMarshaller) { if (getUsagePlanRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getUsagePlanRequest.getUsagePlanId(), USAGEPLANID_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 { protected Rectangle2D getBounds (TextLayout layout) { if (RunAnywhere.isMacOS()) { return layout.getOutline(null).getBounds(); } else { return layout.getBounds(); } } }
public class class_name { protected Rectangle2D getBounds (TextLayout layout) { if (RunAnywhere.isMacOS()) { return layout.getOutline(null).getBounds(); // depends on control dependency: [if], data = [none] } else { return layout.getBounds(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public <T extends RegisteredService> List<T> getDynamicServices(Class<T> serviceInterface) { List<T> dynServices = new ArrayList<>(); if (dynamicServices.containsKey(serviceInterface.getName())) { Set<String> deregister = new HashSet<>(); for (String serviceClassName : dynamicServices.get(serviceInterface.getName())) { try { Class<?> clazz = CompiledJavaCache.getClassFromAssetName(null, serviceClassName); if (clazz != null) { RegisteredService rs = (RegisteredService)(clazz).newInstance(); dynServices.add(serviceInterface.cast(rs)); } } catch (Exception ex) { logger.severeException("Failed to get Dynamic Java service : " + serviceClassName + " (removing from registry)", ex); deregister.add(serviceClassName); } } // avoid repeated attempts to recompile until cache is refreshed dynamicServices.get(serviceInterface.getName()).removeAll(deregister); } return dynServices; } }
public class class_name { public <T extends RegisteredService> List<T> getDynamicServices(Class<T> serviceInterface) { List<T> dynServices = new ArrayList<>(); if (dynamicServices.containsKey(serviceInterface.getName())) { Set<String> deregister = new HashSet<>(); for (String serviceClassName : dynamicServices.get(serviceInterface.getName())) { try { Class<?> clazz = CompiledJavaCache.getClassFromAssetName(null, serviceClassName); if (clazz != null) { RegisteredService rs = (RegisteredService)(clazz).newInstance(); dynServices.add(serviceInterface.cast(rs)); // depends on control dependency: [if], data = [none] } } catch (Exception ex) { logger.severeException("Failed to get Dynamic Java service : " + serviceClassName + " (removing from registry)", ex); deregister.add(serviceClassName); } // depends on control dependency: [catch], data = [none] } // avoid repeated attempts to recompile until cache is refreshed dynamicServices.get(serviceInterface.getName()).removeAll(deregister); // depends on control dependency: [if], data = [none] } return dynServices; } }
public class class_name { public void setParity(String parity) { if (ModbusUtil.isBlank(parity) || parity.equalsIgnoreCase("none")) { this.parity = AbstractSerialConnection.NO_PARITY; } else if (parity.equalsIgnoreCase("even")) { this.parity = AbstractSerialConnection.EVEN_PARITY; } else if (parity.equalsIgnoreCase("odd")) { this.parity = AbstractSerialConnection.ODD_PARITY; } else if (parity.equalsIgnoreCase("mark")) { this.parity = AbstractSerialConnection.MARK_PARITY; } else if (parity.equalsIgnoreCase("space")) { this.parity = AbstractSerialConnection.SPACE_PARITY; } else { this.parity = AbstractSerialConnection.NO_PARITY; } } }
public class class_name { public void setParity(String parity) { if (ModbusUtil.isBlank(parity) || parity.equalsIgnoreCase("none")) { this.parity = AbstractSerialConnection.NO_PARITY; // depends on control dependency: [if], data = [none] } else if (parity.equalsIgnoreCase("even")) { this.parity = AbstractSerialConnection.EVEN_PARITY; // depends on control dependency: [if], data = [none] } else if (parity.equalsIgnoreCase("odd")) { this.parity = AbstractSerialConnection.ODD_PARITY; // depends on control dependency: [if], data = [none] } else if (parity.equalsIgnoreCase("mark")) { this.parity = AbstractSerialConnection.MARK_PARITY; // depends on control dependency: [if], data = [none] } else if (parity.equalsIgnoreCase("space")) { this.parity = AbstractSerialConnection.SPACE_PARITY; // depends on control dependency: [if], data = [none] } else { this.parity = AbstractSerialConnection.NO_PARITY; // depends on control dependency: [if], data = [none] } } }
public class class_name { public void setSourceContent(String aSourceFile, String aSourceContent) { String source = aSourceFile; if (this._sourceRoot != null) { source = Util.relative(this._sourceRoot, source); } if (aSourceContent != null) { // Add the source content to the _sourcesContents map. // Create a new _sourcesContents map if the property is null. if (this._sourcesContents == null) { this._sourcesContents = new HashMap<>(); } this._sourcesContents.put(source, aSourceContent); } else if (this._sourcesContents != null) { // Remove the source file from the _sourcesContents map. // If the _sourcesContents map is empty, set the property to null. this._sourcesContents.remove(source); if (this._sourcesContents.isEmpty()) { this._sourcesContents = null; } } } }
public class class_name { public void setSourceContent(String aSourceFile, String aSourceContent) { String source = aSourceFile; if (this._sourceRoot != null) { source = Util.relative(this._sourceRoot, source); // depends on control dependency: [if], data = [(this._sourceRoot] } if (aSourceContent != null) { // Add the source content to the _sourcesContents map. // Create a new _sourcesContents map if the property is null. if (this._sourcesContents == null) { this._sourcesContents = new HashMap<>(); // depends on control dependency: [if], data = [none] } this._sourcesContents.put(source, aSourceContent); // depends on control dependency: [if], data = [none] } else if (this._sourcesContents != null) { // Remove the source file from the _sourcesContents map. // If the _sourcesContents map is empty, set the property to null. this._sourcesContents.remove(source); // depends on control dependency: [if], data = [none] if (this._sourcesContents.isEmpty()) { this._sourcesContents = null; // depends on control dependency: [if], data = [none] } } } }
public class class_name { @Override public void removeByUuid_C(String uuid, long companyId) { for (CPFriendlyURLEntry cpFriendlyURLEntry : findByUuid_C(uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(cpFriendlyURLEntry); } } }
public class class_name { @Override public void removeByUuid_C(String uuid, long companyId) { for (CPFriendlyURLEntry cpFriendlyURLEntry : findByUuid_C(uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(cpFriendlyURLEntry); // depends on control dependency: [for], data = [cpFriendlyURLEntry] } } }