code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { private static File getDirectoryIfExists(final File existingCandidate, final String path) { if (existingCandidate != null) { return existingCandidate; } if (!Strings.isNullOrEmpty(path)) { final File directory = new File(path); if (directory.exists() && directory.isDirectory()) { return directory; } } return null; } }
public class class_name { private static File getDirectoryIfExists(final File existingCandidate, final String path) { if (existingCandidate != null) { return existingCandidate; // depends on control dependency: [if], data = [none] } if (!Strings.isNullOrEmpty(path)) { final File directory = new File(path); if (directory.exists() && directory.isDirectory()) { return directory; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { @Override public boolean deletePolicy(String name) throws PolicyIndexException { log.debug("Deleting document: " + name); DbXmlManager.writeLock.lock(); try { m_dbXmlManager.container.deleteDocument(name, m_dbXmlManager.updateContext); setLastUpdate(System.currentTimeMillis()); } catch (XmlException xe) { // safe delete - only warn if not found if (xe.getDbError() == XmlException.DOCUMENT_NOT_FOUND){ log.warn("Error deleting document: " + name + " - document does not exist"); } else { throw new PolicyIndexException("Error deleting document: " + name + xe.getMessage(), xe); } } finally { DbXmlManager.writeLock.unlock(); } return true; } }
public class class_name { @Override public boolean deletePolicy(String name) throws PolicyIndexException { log.debug("Deleting document: " + name); DbXmlManager.writeLock.lock(); try { m_dbXmlManager.container.deleteDocument(name, m_dbXmlManager.updateContext); setLastUpdate(System.currentTimeMillis()); } catch (XmlException xe) { // safe delete - only warn if not found if (xe.getDbError() == XmlException.DOCUMENT_NOT_FOUND){ log.warn("Error deleting document: " + name + " - document does not exist"); // depends on control dependency: [if], data = [none] } else { throw new PolicyIndexException("Error deleting document: " + name + xe.getMessage(), xe); } } finally { DbXmlManager.writeLock.unlock(); } return true; } }
public class class_name { public V load(K key) { final byte[] bytes = store.load(toKeyBytes(key)); if (bytes != null) { return toValueObject(bytes); } else { return null; } } }
public class class_name { public V load(K key) { final byte[] bytes = store.load(toKeyBytes(key)); if (bytes != null) { return toValueObject(bytes); // depends on control dependency: [if], data = [(bytes] } else { return null; // depends on control dependency: [if], data = [none] } } }
public class class_name { public List<Integer> commonPrefixSearch(String key, int pos, int len, int nodePos) { if (len <= 0) len = key.length(); if (nodePos <= 0) nodePos = 0; List<Integer> result = new ArrayList<Integer>(); char[] keyChars = key.toCharArray(); int b = base[nodePos]; int n; int p; for (int i = pos; i < len; i++) { p = b + (int) (keyChars[i]) + 1; // 状态转移 p = base[char[i-1]] + char[i] + 1 if (b == check[p]) // base[char[i-1]] == check[base[char[i-1]] + char[i] + 1] b = base[p]; else return result; p = b; n = base[p]; if (b == check[p] && n < 0) // base[p] == check[p] && base[p] < 0 查到一个词 { result.add(-n - 1); } } return result; } }
public class class_name { public List<Integer> commonPrefixSearch(String key, int pos, int len, int nodePos) { if (len <= 0) len = key.length(); if (nodePos <= 0) nodePos = 0; List<Integer> result = new ArrayList<Integer>(); char[] keyChars = key.toCharArray(); int b = base[nodePos]; int n; int p; for (int i = pos; i < len; i++) { p = b + (int) (keyChars[i]) + 1; // 状态转移 p = base[char[i-1]] + char[i] + 1 // depends on control dependency: [for], data = [i] if (b == check[p]) // base[char[i-1]] == check[base[char[i-1]] + char[i] + 1] b = base[p]; else return result; p = b; // depends on control dependency: [for], data = [none] n = base[p]; // depends on control dependency: [for], data = [none] if (b == check[p] && n < 0) // base[p] == check[p] && base[p] < 0 查到一个词 { result.add(-n - 1); // depends on control dependency: [if], data = [none] } } return result; } }
public class class_name { public NominalTypeBuilder superClass() { FunctionType ctor = instance.getSuperClassConstructor(); if (ctor == null) { return null; } return new NominalTypeBuilder(ctor, ctor.getInstanceType()); } }
public class class_name { public NominalTypeBuilder superClass() { FunctionType ctor = instance.getSuperClassConstructor(); if (ctor == null) { return null; // depends on control dependency: [if], data = [none] } return new NominalTypeBuilder(ctor, ctor.getInstanceType()); } }
public class class_name { public static boolean isBetweenHours(long dt, TimeZone tz, int from, int to, int tolerance) { long start = 0L; long end = 0L; // If from > to then the "to" date may be in the next day // or the "from" date may be in the previous day, depending // on whether or not it's before or after midnight if(from > to) { // Assume that start is in today and end is in tomorrow start = getDateForHour(dt, tz, from, 0); end = getDateForHour(dt, tz, to, 1)+(tolerance*1000L); // If we end up before the start date, // try moving the dates back by a day if(dt < start) // move start to yesterday { start = getDateForHour(dt, tz, from, -1); end = getDateForHour(dt, tz, to, 0)+(tolerance*1000L); } } else // to > from { start = getDateForHour(dt, tz, from, 0); end = getDateForHour(dt, tz, to, 0)+(tolerance*1000L); } return dt >= start && dt <= end; } }
public class class_name { public static boolean isBetweenHours(long dt, TimeZone tz, int from, int to, int tolerance) { long start = 0L; long end = 0L; // If from > to then the "to" date may be in the next day // or the "from" date may be in the previous day, depending // on whether or not it's before or after midnight if(from > to) { // Assume that start is in today and end is in tomorrow start = getDateForHour(dt, tz, from, 0); // depends on control dependency: [if], data = [none] end = getDateForHour(dt, tz, to, 1)+(tolerance*1000L); // depends on control dependency: [if], data = [none] // If we end up before the start date, // try moving the dates back by a day if(dt < start) // move start to yesterday { start = getDateForHour(dt, tz, from, -1); // depends on control dependency: [if], data = [(dt] end = getDateForHour(dt, tz, to, 0)+(tolerance*1000L); // depends on control dependency: [if], data = [(dt] } } else // to > from { start = getDateForHour(dt, tz, from, 0); // depends on control dependency: [if], data = [none] end = getDateForHour(dt, tz, to, 0)+(tolerance*1000L); // depends on control dependency: [if], data = [none] } return dt >= start && dt <= end; } }
public class class_name { public E get() { E r = null; if (numElems > 0) { numElems--; r = ea[first]; ea[first] = null; if (++first == maxSize) first = 0; } return r; } }
public class class_name { public E get() { E r = null; if (numElems > 0) { numElems--; // depends on control dependency: [if], data = [none] r = ea[first]; // depends on control dependency: [if], data = [none] ea[first] = null; // depends on control dependency: [if], data = [none] if (++first == maxSize) first = 0; } return r; } }
public class class_name { public JsonFluentAssert isAbsent() { if (!nodeAbsent(actual, path, configuration)) { failOnDifference("node to be absent", quoteTextValue(getNode(actual, path))); } return this; } }
public class class_name { public JsonFluentAssert isAbsent() { if (!nodeAbsent(actual, path, configuration)) { failOnDifference("node to be absent", quoteTextValue(getNode(actual, path))); // depends on control dependency: [if], data = [none] } return this; } }
public class class_name { public PoolRemoveNodesOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) { if (ifUnmodifiedSince == null) { this.ifUnmodifiedSince = null; } else { this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince); } return this; } }
public class class_name { public PoolRemoveNodesOptions 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 { public final Stream<T> onClose(final Object... objects) { synchronized (this.state) { for (final Object object : objects) { if (!(object instanceof Closeable) && !(object instanceof Runnable) && !(object instanceof Callable)) { throw new IllegalArgumentException("Illegal object: " + object); } else if (this.state.closed) { closeAction(object); } else { boolean alreadyContained = false; for (final Object o : this.state.closeObjects) { if (o == object) { alreadyContained = true; break; } } if (!alreadyContained) { this.state.closeObjects.add(object); } } } } return this; } }
public class class_name { public final Stream<T> onClose(final Object... objects) { synchronized (this.state) { for (final Object object : objects) { if (!(object instanceof Closeable) && !(object instanceof Runnable) && !(object instanceof Callable)) { throw new IllegalArgumentException("Illegal object: " + object); } else if (this.state.closed) { closeAction(object); // depends on control dependency: [if], data = [none] } else { boolean alreadyContained = false; for (final Object o : this.state.closeObjects) { if (o == object) { alreadyContained = true; // depends on control dependency: [if], data = [none] break; } } if (!alreadyContained) { this.state.closeObjects.add(object); // depends on control dependency: [if], data = [none] } } } } return this; } }
public class class_name { public static TestConstructor findSingle(Class<?> cls) { final TestConstructor[] constructors = findAll(cls); if (constructors.length == 0) { throw new IllegalStateException(cls.getName() + " requires at least 1 public constructor"); } else if (constructors.length == 1) { return constructors[0]; } else { throw new IllegalStateException("Class " + cls.getName() + " has too many parameterized constructors. " + "Should only be 1 (with enum variations)."); } } }
public class class_name { public static TestConstructor findSingle(Class<?> cls) { final TestConstructor[] constructors = findAll(cls); if (constructors.length == 0) { throw new IllegalStateException(cls.getName() + " requires at least 1 public constructor"); } else if (constructors.length == 1) { return constructors[0]; // depends on control dependency: [if], data = [none] } else { throw new IllegalStateException("Class " + cls.getName() + " has too many parameterized constructors. " + "Should only be 1 (with enum variations)."); } } }
public class class_name { @Override public EClass getIfcProperty() { if (ifcPropertyEClass == null) { ifcPropertyEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers() .get(464); } return ifcPropertyEClass; } }
public class class_name { @Override public EClass getIfcProperty() { if (ifcPropertyEClass == null) { ifcPropertyEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers() .get(464); // depends on control dependency: [if], data = [none] } return ifcPropertyEClass; } }
public class class_name { private boolean validateMinValue(Object validationObject, Annotation annotate) { if (checkNullObject(validationObject)) { return true; } Long minValue = ((Min) annotate).value(); if (checkvalidDigitTypes(validationObject.getClass())) { if ((NumberUtils.toLong(toString(validationObject))) < minValue) { throwValidationException(((Min) annotate).message()); } } return true; } }
public class class_name { private boolean validateMinValue(Object validationObject, Annotation annotate) { if (checkNullObject(validationObject)) { return true; // depends on control dependency: [if], data = [none] } Long minValue = ((Min) annotate).value(); if (checkvalidDigitTypes(validationObject.getClass())) { if ((NumberUtils.toLong(toString(validationObject))) < minValue) { throwValidationException(((Min) annotate).message()); // depends on control dependency: [if], data = [none] } } return true; } }
public class class_name { public static void dump(PrintStream out, byte[] b, int off, int len) { int end = off + len; int offDiv16 = off / 16; int endDiv16 = end / 16; if (offDiv16 == endDiv16) { out.println(dumpLine(b, offDiv16, off % 16, end % 16)); } else { out.println(dumpLine(b, offDiv16, off % 16, 16)); for (int i = offDiv16 + 1; i < endDiv16; i ++) { out.println(dumpLine(b, i, 0, 16)); } if (end % 16 > 0) { out.println(dumpLine(b, endDiv16, 0, end % 16)); } } } }
public class class_name { public static void dump(PrintStream out, byte[] b, int off, int len) { int end = off + len; int offDiv16 = off / 16; int endDiv16 = end / 16; if (offDiv16 == endDiv16) { out.println(dumpLine(b, offDiv16, off % 16, end % 16)); // depends on control dependency: [if], data = [none] } else { out.println(dumpLine(b, offDiv16, off % 16, 16)); // depends on control dependency: [if], data = [none] for (int i = offDiv16 + 1; i < endDiv16; i ++) { out.println(dumpLine(b, i, 0, 16)); // depends on control dependency: [for], data = [i] } if (end % 16 > 0) { out.println(dumpLine(b, endDiv16, 0, end % 16)); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private static Path getLocalCache(URI cache, Configuration conf, Path subDir, FileStatus fileStatus, boolean isArchive, long confFileStamp, long fileLength, Path currentWorkDir, boolean honorSymLinkConf, MRAsyncDiskService asyncDiskService, LocalDirAllocator lDirAllocator) throws IOException { String key = getKey(cache, conf, confFileStamp); CacheStatus lcacheStatus; Path localizedPath; synchronized (cachedArchives) { lcacheStatus = cachedArchives.get(key); if (lcacheStatus == null) { // was never localized Path uniqueParentDir = new Path(subDir, String.valueOf(random.nextLong())); String cachePath = new Path(uniqueParentDir, makeRelative(cache, conf)).toString(); Path localPath = lDirAllocator.getLocalPathForWrite(cachePath, fileLength, conf); lcacheStatus = new CacheStatus(new Path(localPath.toString().replace(cachePath, "")), localPath, uniqueParentDir); cachedArchives.put(key, lcacheStatus); } lcacheStatus.refcount++; } boolean initSuccessful = false; try { synchronized (lcacheStatus) { if (!lcacheStatus.isInited()) { localizedPath = localizeCache(conf, cache, confFileStamp, lcacheStatus, isArchive); lcacheStatus.initComplete(); } else { if (fileStatus != null) { localizedPath = checkCacheStatusValidity(conf, cache, confFileStamp, lcacheStatus, fileStatus, isArchive); } else { // if fileStatus is null, then the md5 must be correct // so there is no need to check for cache validity localizedPath = lcacheStatus.localizedLoadPath; } } createSymlink(conf, cache, lcacheStatus, isArchive, currentWorkDir, honorSymLinkConf); } // try deleting stuff if you can long size = 0; int numberSubDir = 0; synchronized (lcacheStatus) { synchronized (baseDirSize) { Long get = baseDirSize.get(lcacheStatus.getBaseDir()); if (get != null) { size = get.longValue(); } else { LOG.warn("Cannot find size of baseDir: " + lcacheStatus.getBaseDir()); } } synchronized (baseDirNumberSubDir) { Integer get = baseDirNumberSubDir.get(lcacheStatus.getBaseDir()); if ( get != null ) { numberSubDir = get.intValue(); } else { LOG.warn("Cannot find subdirectories limit of baseDir: " + lcacheStatus.getBaseDir()); } } } // setting the cache size to a default of 10GB long allowedSize = conf.getLong("local.cache.size", DEFAULT_CACHE_SIZE); long allowedNumberSubDir = conf.getLong("local.cache.numbersubdir", DEFAULT_CACHE_SUBDIR_LIMIT); if (allowedSize < size || allowedNumberSubDir < numberSubDir) { // try some cache deletions LOG.debug("Start deleting released cache because" + " [size, allowedSize, numberSubDir, allowedNumberSubDir] =" + " [" + size + ", " + allowedSize + ", " + numberSubDir + ", " + allowedNumberSubDir + "]"); deleteCache(conf, asyncDiskService); } initSuccessful = true; return localizedPath; } finally { if (!initSuccessful) { synchronized (cachedArchives) { lcacheStatus.refcount--; } } } } }
public class class_name { private static Path getLocalCache(URI cache, Configuration conf, Path subDir, FileStatus fileStatus, boolean isArchive, long confFileStamp, long fileLength, Path currentWorkDir, boolean honorSymLinkConf, MRAsyncDiskService asyncDiskService, LocalDirAllocator lDirAllocator) throws IOException { String key = getKey(cache, conf, confFileStamp); CacheStatus lcacheStatus; Path localizedPath; synchronized (cachedArchives) { lcacheStatus = cachedArchives.get(key); if (lcacheStatus == null) { // was never localized Path uniqueParentDir = new Path(subDir, String.valueOf(random.nextLong())); String cachePath = new Path(uniqueParentDir, makeRelative(cache, conf)).toString(); Path localPath = lDirAllocator.getLocalPathForWrite(cachePath, fileLength, conf); lcacheStatus = new CacheStatus(new Path(localPath.toString().replace(cachePath, "")), localPath, uniqueParentDir); // depends on control dependency: [if], data = [none] cachedArchives.put(key, lcacheStatus); // depends on control dependency: [if], data = [none] } lcacheStatus.refcount++; } boolean initSuccessful = false; try { synchronized (lcacheStatus) { if (!lcacheStatus.isInited()) { localizedPath = localizeCache(conf, cache, confFileStamp, lcacheStatus, isArchive); // depends on control dependency: [if], data = [none] lcacheStatus.initComplete(); // depends on control dependency: [if], data = [none] } else { if (fileStatus != null) { localizedPath = checkCacheStatusValidity(conf, cache, confFileStamp, lcacheStatus, fileStatus, isArchive); // depends on control dependency: [if], data = [none] } else { // if fileStatus is null, then the md5 must be correct // so there is no need to check for cache validity localizedPath = lcacheStatus.localizedLoadPath; // depends on control dependency: [if], data = [none] } } createSymlink(conf, cache, lcacheStatus, isArchive, currentWorkDir, honorSymLinkConf); } // try deleting stuff if you can long size = 0; int numberSubDir = 0; synchronized (lcacheStatus) { synchronized (baseDirSize) { Long get = baseDirSize.get(lcacheStatus.getBaseDir()); if (get != null) { size = get.longValue(); // depends on control dependency: [if], data = [none] } else { LOG.warn("Cannot find size of baseDir: " + lcacheStatus.getBaseDir()); // depends on control dependency: [if], data = [none] } } synchronized (baseDirNumberSubDir) { Integer get = baseDirNumberSubDir.get(lcacheStatus.getBaseDir()); if ( get != null ) { numberSubDir = get.intValue(); // depends on control dependency: [if], data = [none] } else { LOG.warn("Cannot find subdirectories limit of baseDir: " + lcacheStatus.getBaseDir()); // depends on control dependency: [if], data = [none] } } } // setting the cache size to a default of 10GB long allowedSize = conf.getLong("local.cache.size", DEFAULT_CACHE_SIZE); long allowedNumberSubDir = conf.getLong("local.cache.numbersubdir", DEFAULT_CACHE_SUBDIR_LIMIT); if (allowedSize < size || allowedNumberSubDir < numberSubDir) { // try some cache deletions LOG.debug("Start deleting released cache because" + " [size, allowedSize, numberSubDir, allowedNumberSubDir] =" + " [" + size + ", " + allowedSize + ", " + numberSubDir + ", " + allowedNumberSubDir + "]"); // depends on control dependency: [if], data = [none] deleteCache(conf, asyncDiskService); // depends on control dependency: [if], data = [none] } initSuccessful = true; return localizedPath; } finally { if (!initSuccessful) { synchronized (cachedArchives) { // depends on control dependency: [if], data = [none] lcacheStatus.refcount--; } } } } }
public class class_name { public boolean execute (PathFinderRequest<N> request) { request.executionFrames++; while (true) { if (DEBUG) GdxAI.getLogger().debug(TAG, "------"); // Should perform search begin? if (request.status == PathFinderRequest.SEARCH_NEW) { long currentTime = TimeUtils.nanoTime(); timeToRun -= currentTime - lastTime; if (timeToRun <= timeTolerance) return false; if (DEBUG) GdxAI.getLogger().debug(TAG, "search begin"); if (!request.initializeSearch(timeToRun)) return false; request.changeStatus(PathFinderRequest.SEARCH_INITIALIZED); lastTime = currentTime; } // Should perform search path? if (request.status == PathFinderRequest.SEARCH_INITIALIZED) { long currentTime = TimeUtils.nanoTime(); timeToRun -= currentTime - lastTime; if (timeToRun <= timeTolerance) return false; if (DEBUG) GdxAI.getLogger().debug(TAG, "search path"); if (!request.search(pathFinder, timeToRun)) return false; request.changeStatus(PathFinderRequest.SEARCH_DONE); lastTime = currentTime; } // Should perform search end? if (request.status == PathFinderRequest.SEARCH_DONE) { long currentTime = TimeUtils.nanoTime(); timeToRun -= currentTime - lastTime; if (timeToRun <= timeTolerance) return false; if (DEBUG) GdxAI.getLogger().debug(TAG, "search end"); if (!request.finalizeSearch(timeToRun)) return false; request.changeStatus(PathFinderRequest.SEARCH_FINALIZED); // Search finished, send result to the client if (server != null) { MessageDispatcher dispatcher = request.dispatcher != null ? request.dispatcher : MessageManager.getInstance(); dispatcher.dispatchMessage(server, request.client, request.responseMessageCode, request); } lastTime = currentTime; if (request.statusChanged && request.status == PathFinderRequest.SEARCH_NEW) { if (DEBUG) GdxAI.getLogger().debug(TAG, "search renew"); continue; } } return true; } } }
public class class_name { public boolean execute (PathFinderRequest<N> request) { request.executionFrames++; while (true) { if (DEBUG) GdxAI.getLogger().debug(TAG, "------"); // Should perform search begin? if (request.status == PathFinderRequest.SEARCH_NEW) { long currentTime = TimeUtils.nanoTime(); timeToRun -= currentTime - lastTime; // depends on control dependency: [if], data = [none] if (timeToRun <= timeTolerance) return false; if (DEBUG) GdxAI.getLogger().debug(TAG, "search begin"); if (!request.initializeSearch(timeToRun)) return false; request.changeStatus(PathFinderRequest.SEARCH_INITIALIZED); // depends on control dependency: [if], data = [none] lastTime = currentTime; // depends on control dependency: [if], data = [none] } // Should perform search path? if (request.status == PathFinderRequest.SEARCH_INITIALIZED) { long currentTime = TimeUtils.nanoTime(); timeToRun -= currentTime - lastTime; // depends on control dependency: [if], data = [none] if (timeToRun <= timeTolerance) return false; if (DEBUG) GdxAI.getLogger().debug(TAG, "search path"); if (!request.search(pathFinder, timeToRun)) return false; request.changeStatus(PathFinderRequest.SEARCH_DONE); // depends on control dependency: [if], data = [none] lastTime = currentTime; // depends on control dependency: [if], data = [none] } // Should perform search end? if (request.status == PathFinderRequest.SEARCH_DONE) { long currentTime = TimeUtils.nanoTime(); timeToRun -= currentTime - lastTime; // depends on control dependency: [if], data = [none] if (timeToRun <= timeTolerance) return false; if (DEBUG) GdxAI.getLogger().debug(TAG, "search end"); if (!request.finalizeSearch(timeToRun)) return false; request.changeStatus(PathFinderRequest.SEARCH_FINALIZED); // depends on control dependency: [if], data = [none] // Search finished, send result to the client if (server != null) { MessageDispatcher dispatcher = request.dispatcher != null ? request.dispatcher : MessageManager.getInstance(); dispatcher.dispatchMessage(server, request.client, request.responseMessageCode, request); // depends on control dependency: [if], data = [(server] } lastTime = currentTime; // depends on control dependency: [if], data = [none] if (request.statusChanged && request.status == PathFinderRequest.SEARCH_NEW) { if (DEBUG) GdxAI.getLogger().debug(TAG, "search renew"); continue; } } return true; // depends on control dependency: [while], data = [none] } } }
public class class_name { public void marshall(BatchDetectSentimentItemResult batchDetectSentimentItemResult, ProtocolMarshaller protocolMarshaller) { if (batchDetectSentimentItemResult == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(batchDetectSentimentItemResult.getIndex(), INDEX_BINDING); protocolMarshaller.marshall(batchDetectSentimentItemResult.getSentiment(), SENTIMENT_BINDING); protocolMarshaller.marshall(batchDetectSentimentItemResult.getSentimentScore(), SENTIMENTSCORE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(BatchDetectSentimentItemResult batchDetectSentimentItemResult, ProtocolMarshaller protocolMarshaller) { if (batchDetectSentimentItemResult == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(batchDetectSentimentItemResult.getIndex(), INDEX_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(batchDetectSentimentItemResult.getSentiment(), SENTIMENT_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(batchDetectSentimentItemResult.getSentimentScore(), SENTIMENTSCORE_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 static FaxClientSpiInterceptor[] createFaxClientSpiInterceptors(FaxClientSpi faxClientSpi) { //get type list String typeListStr=faxClientSpi.getConfigurationValue(FaxClientSpiFactory.SPI_INTERCEPTOR_LIST_PROPERTY_KEY); FaxClientSpiInterceptor[] interceptors=null; if(typeListStr!=null) { //split list String[] types=typeListStr.split(FaxClientSpiFactory.SPI_INTERCEPTOR_LIST_SEPARATOR); //get amount int amount=types.length; String type=null; String propertyKey=null; String className=null; FaxClientSpiInterceptor interceptor=null; List<FaxClientSpiInterceptor> interceptorList=new LinkedList<FaxClientSpiInterceptor>(); for(int index=0;index<amount;index++) { //get next type type=types[index]; if((type!=null)&&(type.length()>0)) { //get property key propertyKey=FaxClientSpiFactory.SPI_INTERCEPTOR_TYPE_PROPERTY_KEY_PREFIX+type; //get class name className=faxClientSpi.getConfigurationValue(propertyKey); if(className==null) { throw new FaxException("Class name not defined by property: "+propertyKey+" for SPI interceptor."); } //create new instance interceptor=(FaxClientSpiInterceptor)ReflectionHelper.createInstance(className); //initialize interceptor.initialize(faxClientSpi); //add to list interceptorList.add(interceptor); } //convert to array interceptors=interceptorList.toArray(new FaxClientSpiInterceptor[interceptorList.size()]); } } return interceptors; } }
public class class_name { private static FaxClientSpiInterceptor[] createFaxClientSpiInterceptors(FaxClientSpi faxClientSpi) { //get type list String typeListStr=faxClientSpi.getConfigurationValue(FaxClientSpiFactory.SPI_INTERCEPTOR_LIST_PROPERTY_KEY); FaxClientSpiInterceptor[] interceptors=null; if(typeListStr!=null) { //split list String[] types=typeListStr.split(FaxClientSpiFactory.SPI_INTERCEPTOR_LIST_SEPARATOR); //get amount int amount=types.length; String type=null; String propertyKey=null; String className=null; FaxClientSpiInterceptor interceptor=null; List<FaxClientSpiInterceptor> interceptorList=new LinkedList<FaxClientSpiInterceptor>(); for(int index=0;index<amount;index++) { //get next type type=types[index]; // depends on control dependency: [for], data = [index] if((type!=null)&&(type.length()>0)) { //get property key propertyKey=FaxClientSpiFactory.SPI_INTERCEPTOR_TYPE_PROPERTY_KEY_PREFIX+type; // depends on control dependency: [if], data = [none] //get class name className=faxClientSpi.getConfigurationValue(propertyKey); // depends on control dependency: [if], data = [none] if(className==null) { throw new FaxException("Class name not defined by property: "+propertyKey+" for SPI interceptor."); } //create new instance interceptor=(FaxClientSpiInterceptor)ReflectionHelper.createInstance(className); // depends on control dependency: [if], data = [none] //initialize interceptor.initialize(faxClientSpi); // depends on control dependency: [if], data = [none] //add to list interceptorList.add(interceptor); // depends on control dependency: [if], data = [none] } //convert to array interceptors=interceptorList.toArray(new FaxClientSpiInterceptor[interceptorList.size()]); // depends on control dependency: [for], data = [none] } } return interceptors; } }
public class class_name { public final void put(final String pNm, final Double pVal) { if (this.doubles == null) { this.doubles = new HashMap<String, Double>(); } this.doubles.put(pNm, pVal); } }
public class class_name { public final void put(final String pNm, final Double pVal) { if (this.doubles == null) { this.doubles = new HashMap<String, Double>(); // depends on control dependency: [if], data = [none] } this.doubles.put(pNm, pVal); } }
public class class_name { public CreateCommitRequest withDeleteFiles(DeleteFileEntry... deleteFiles) { if (this.deleteFiles == null) { setDeleteFiles(new java.util.ArrayList<DeleteFileEntry>(deleteFiles.length)); } for (DeleteFileEntry ele : deleteFiles) { this.deleteFiles.add(ele); } return this; } }
public class class_name { public CreateCommitRequest withDeleteFiles(DeleteFileEntry... deleteFiles) { if (this.deleteFiles == null) { setDeleteFiles(new java.util.ArrayList<DeleteFileEntry>(deleteFiles.length)); // depends on control dependency: [if], data = [none] } for (DeleteFileEntry ele : deleteFiles) { this.deleteFiles.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { @NotNull public String toSimpleString(boolean allowDecimal) { if (_denominator == 0 && _numerator != 0) { return toString(); } else if (isInteger()) { return Integer.toString(intValue()); } else if (_numerator != 1 && _denominator % _numerator == 0) { // common factor between denominator and numerator long newDenominator = _denominator / _numerator; return new Rational(1, newDenominator).toSimpleString(allowDecimal); } else { Rational simplifiedInstance = getSimplifiedInstance(); if (allowDecimal) { String doubleString = Double.toString(simplifiedInstance.doubleValue()); if (doubleString.length() < 5) { return doubleString; } } return simplifiedInstance.toString(); } } }
public class class_name { @NotNull public String toSimpleString(boolean allowDecimal) { if (_denominator == 0 && _numerator != 0) { return toString(); // depends on control dependency: [if], data = [none] } else if (isInteger()) { return Integer.toString(intValue()); // depends on control dependency: [if], data = [none] } else if (_numerator != 1 && _denominator % _numerator == 0) { // common factor between denominator and numerator long newDenominator = _denominator / _numerator; return new Rational(1, newDenominator).toSimpleString(allowDecimal); // depends on control dependency: [if], data = [none] } else { Rational simplifiedInstance = getSimplifiedInstance(); if (allowDecimal) { String doubleString = Double.toString(simplifiedInstance.doubleValue()); if (doubleString.length() < 5) { return doubleString; // depends on control dependency: [if], data = [none] } } return simplifiedInstance.toString(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void marshall(NotificationOptions notificationOptions, ProtocolMarshaller protocolMarshaller) { if (notificationOptions == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(notificationOptions.getSendEmail(), SENDEMAIL_BINDING); protocolMarshaller.marshall(notificationOptions.getEmailMessage(), EMAILMESSAGE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(NotificationOptions notificationOptions, ProtocolMarshaller protocolMarshaller) { if (notificationOptions == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(notificationOptions.getSendEmail(), SENDEMAIL_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(notificationOptions.getEmailMessage(), EMAILMESSAGE_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 BundleHashcodeType getBundleHashcodeType(String requestedPath) { if (binaryResourcePathMap.containsValue(requestedPath)) { return BundleHashcodeType.VALID_HASHCODE; } BundleHashcodeType bundleHashcodeType = BundleHashcodeType.UNKNOW_BUNDLE; String[] resourceInfo = PathNormalizer.extractBinaryResourceInfo(requestedPath); String binaryRequest = resourceInfo[0]; if (resourceInfo[1] != null) { // an hashcode is defined in the path try { String cacheBustedPath = CheckSumUtils.getCacheBustedUrl(binaryRequest, getRsReaderHandler(), jawrConfig); addMapping(binaryRequest, cacheBustedPath); if (requestedPath.equals(cacheBustedPath)) { bundleHashcodeType = BundleHashcodeType.VALID_HASHCODE; } else { bundleHashcodeType = BundleHashcodeType.INVALID_HASHCODE; } } catch (IOException | ResourceNotFoundException e) { // Nothing to do } } return bundleHashcodeType; } }
public class class_name { public BundleHashcodeType getBundleHashcodeType(String requestedPath) { if (binaryResourcePathMap.containsValue(requestedPath)) { return BundleHashcodeType.VALID_HASHCODE; // depends on control dependency: [if], data = [none] } BundleHashcodeType bundleHashcodeType = BundleHashcodeType.UNKNOW_BUNDLE; String[] resourceInfo = PathNormalizer.extractBinaryResourceInfo(requestedPath); String binaryRequest = resourceInfo[0]; if (resourceInfo[1] != null) { // an hashcode is defined in the path try { String cacheBustedPath = CheckSumUtils.getCacheBustedUrl(binaryRequest, getRsReaderHandler(), jawrConfig); addMapping(binaryRequest, cacheBustedPath); // depends on control dependency: [try], data = [none] if (requestedPath.equals(cacheBustedPath)) { bundleHashcodeType = BundleHashcodeType.VALID_HASHCODE; // depends on control dependency: [if], data = [none] } else { bundleHashcodeType = BundleHashcodeType.INVALID_HASHCODE; // depends on control dependency: [if], data = [none] } } catch (IOException | ResourceNotFoundException e) { // Nothing to do } // depends on control dependency: [catch], data = [none] } return bundleHashcodeType; } }
public class class_name { public Scheduler stop(boolean clearTasks) { synchronized (lock) { if (false == started) { throw new IllegalStateException("Scheduler not started !"); } // 停止CronTimer this.timer.stopTimer(); this.timer = null; //停止线程池 this.threadExecutor.shutdown(); this.threadExecutor = null; //可选是否清空任务表 if(clearTasks) { clear(); } // 修改标志 started = false; } return this; } }
public class class_name { public Scheduler stop(boolean clearTasks) { synchronized (lock) { if (false == started) { throw new IllegalStateException("Scheduler not started !"); } // 停止CronTimer this.timer.stopTimer(); this.timer = null; //停止线程池 this.threadExecutor.shutdown(); this.threadExecutor = null; //可选是否清空任务表 if(clearTasks) { clear(); // depends on control dependency: [if], data = [none] } // 修改标志 started = false; } return this; } }
public class class_name { public Object get(Type type, List<Annotation> sources) { if (Types.isArray(type)) { logger.warn("Array type is not supported in [" + getClass() + "]"); return null; } else if (Types.isBuiltinType(type)) { return builtin(type); } for (Annotation source : sources) { Object parameter = null; if (source instanceof Query) { Query query = (Query) source; parameter = query(type, query.value()); } else if (source instanceof Body) { Body body = (Body) source; parameter = body(type, body.value()); } else if (source instanceof Header) { Header header = (Header) source; parameter = header(type, header.value()); } else if (source instanceof org.eiichiro.bootleg.annotation.Cookie) { org.eiichiro.bootleg.annotation.Cookie cookie = (org.eiichiro.bootleg.annotation.Cookie) source; parameter = cookie(type, cookie.value()); } else if (source instanceof Session) { Session session = (Session) source; parameter = session(type, session.value()); } else if (source instanceof Application) { Application application = (Application) source; parameter = application(type, application.value()); } else if (source instanceof Path) { Path path = (Path) source; parameter = path(type, path.value()); } else { logger.warn("Unknown source [" + source + "]"); } if (parameter != null) { return parameter; } } if (Types.isPrimitive(type)) { logger.debug("Cannot construct [" + type + "] primitive; Returns the default value"); return primitive(type); } else if (Types.isCollection(type)) { if (Types.isSupportedCollection(type)) { logger.debug("Cannot construct [" + type + "] collection; Returns the empty colleciton"); return Types.getEmptyCollection(type); } else { logger.warn("Collection type " + type + " is not supported in [" + getClass() + "]"); return null; } } StringBuilder builder = new StringBuilder(); for (Annotation source : sources) { builder.append(source + " "); } logger.debug("Cannot construct Web endpoint method parameter [" + builder + type + "]"); return null; } }
public class class_name { public Object get(Type type, List<Annotation> sources) { if (Types.isArray(type)) { logger.warn("Array type is not supported in [" + getClass() + "]"); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } else if (Types.isBuiltinType(type)) { return builtin(type); // depends on control dependency: [if], data = [none] } for (Annotation source : sources) { Object parameter = null; if (source instanceof Query) { Query query = (Query) source; parameter = query(type, query.value()); // depends on control dependency: [if], data = [none] } else if (source instanceof Body) { Body body = (Body) source; parameter = body(type, body.value()); // depends on control dependency: [if], data = [none] } else if (source instanceof Header) { Header header = (Header) source; parameter = header(type, header.value()); // depends on control dependency: [if], data = [none] } else if (source instanceof org.eiichiro.bootleg.annotation.Cookie) { org.eiichiro.bootleg.annotation.Cookie cookie = (org.eiichiro.bootleg.annotation.Cookie) source; parameter = cookie(type, cookie.value()); // depends on control dependency: [if], data = [none] } else if (source instanceof Session) { Session session = (Session) source; parameter = session(type, session.value()); // depends on control dependency: [if], data = [none] } else if (source instanceof Application) { Application application = (Application) source; parameter = application(type, application.value()); // depends on control dependency: [if], data = [none] } else if (source instanceof Path) { Path path = (Path) source; parameter = path(type, path.value()); // depends on control dependency: [if], data = [none] } else { logger.warn("Unknown source [" + source + "]"); // depends on control dependency: [if], data = [none] } if (parameter != null) { return parameter; // depends on control dependency: [if], data = [none] } } if (Types.isPrimitive(type)) { logger.debug("Cannot construct [" + type + "] primitive; Returns the default value"); // depends on control dependency: [if], data = [none] return primitive(type); // depends on control dependency: [if], data = [none] } else if (Types.isCollection(type)) { if (Types.isSupportedCollection(type)) { logger.debug("Cannot construct [" + type + "] collection; Returns the empty colleciton"); // depends on control dependency: [if], data = [none] return Types.getEmptyCollection(type); // depends on control dependency: [if], data = [none] } else { logger.warn("Collection type " + type + " is not supported in [" + getClass() + "]"); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } } StringBuilder builder = new StringBuilder(); for (Annotation source : sources) { builder.append(source + " "); // depends on control dependency: [for], data = [source] } logger.debug("Cannot construct Web endpoint method parameter [" + builder + type + "]"); return null; } }
public class class_name { public JsonObject putAndEncrypt(final String name, final Object value, String providerName) { addValueEncryptionInfo(name, providerName, true); if (this == value) { throw new IllegalArgumentException("Cannot put self"); } else if (value == JsonValue.NULL) { putNull(name); } else if (checkType(value)) { content.put(name, value); } else { throw new IllegalArgumentException("Unsupported type for JsonObject: " + value.getClass()); } return this; } }
public class class_name { public JsonObject putAndEncrypt(final String name, final Object value, String providerName) { addValueEncryptionInfo(name, providerName, true); if (this == value) { throw new IllegalArgumentException("Cannot put self"); } else if (value == JsonValue.NULL) { putNull(name); // depends on control dependency: [if], data = [none] } else if (checkType(value)) { content.put(name, value); // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException("Unsupported type for JsonObject: " + value.getClass()); } return this; } }
public class class_name { public static Font getQuicksandBoldFont() { if (quicksandBoldFont == null) { try { quicksandBoldFont = Font.createFont(Font.TRUETYPE_FONT, FontUtils.class.getResourceAsStream("/resource/Quicksand-Bold.ttf")); GraphicsEnvironment.getLocalGraphicsEnvironment().registerFont(quicksandBoldFont); // Ensure its scaled properly - only need to do this when its first loaded quicksandBoldFont = quicksandBoldFont.deriveFont((float)getDefaultFont().getSize()); } catch (IOException|FontFormatException e) { quicksandBoldFont = defaultFonts.get(FontType.general); } } return quicksandBoldFont; } }
public class class_name { public static Font getQuicksandBoldFont() { if (quicksandBoldFont == null) { try { quicksandBoldFont = Font.createFont(Font.TRUETYPE_FONT, FontUtils.class.getResourceAsStream("/resource/Quicksand-Bold.ttf")); GraphicsEnvironment.getLocalGraphicsEnvironment().registerFont(quicksandBoldFont); // depends on control dependency: [try], data = [none] // Ensure its scaled properly - only need to do this when its first loaded quicksandBoldFont = quicksandBoldFont.deriveFont((float)getDefaultFont().getSize()); // depends on control dependency: [try], data = [none] } catch (IOException|FontFormatException e) { quicksandBoldFont = defaultFonts.get(FontType.general); } // depends on control dependency: [catch], data = [none] } return quicksandBoldFont; } }
public class class_name { @SuppressWarnings("unchecked") public Set<RateType> getRateTypes() { Set<RateType> result = get(KEY_RATE_TYPES, Set.class); if (result == null) { return Collections.emptySet(); } return result; } }
public class class_name { @SuppressWarnings("unchecked") public Set<RateType> getRateTypes() { Set<RateType> result = get(KEY_RATE_TYPES, Set.class); if (result == null) { return Collections.emptySet(); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { public void setWebsiteCertificateAuthorities(java.util.Collection<WebsiteCaSummary> websiteCertificateAuthorities) { if (websiteCertificateAuthorities == null) { this.websiteCertificateAuthorities = null; return; } this.websiteCertificateAuthorities = new java.util.ArrayList<WebsiteCaSummary>(websiteCertificateAuthorities); } }
public class class_name { public void setWebsiteCertificateAuthorities(java.util.Collection<WebsiteCaSummary> websiteCertificateAuthorities) { if (websiteCertificateAuthorities == null) { this.websiteCertificateAuthorities = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.websiteCertificateAuthorities = new java.util.ArrayList<WebsiteCaSummary>(websiteCertificateAuthorities); } }
public class class_name { public List<PPVItemsType.PPVItem> getPPVItem() { if (ppvItem == null) { ppvItem = new ArrayList<PPVItemsType.PPVItem>(); } return this.ppvItem; } }
public class class_name { public List<PPVItemsType.PPVItem> getPPVItem() { if (ppvItem == null) { ppvItem = new ArrayList<PPVItemsType.PPVItem>(); // depends on control dependency: [if], data = [none] } return this.ppvItem; } }
public class class_name { public static final SipInitialLine parse(final Buffer buffer) throws SipParseException { Buffer part1 = null; Buffer part2 = null; Buffer part3 = null; try { part1 = buffer.readUntil(SipParser.SP); part2 = buffer.readUntil(SipParser.SP); part3 = buffer.readLine(); if (SipParser.SIP2_0.equals(part1)) { final int statusCode = part2.parseToInt(); return new SipResponseLine(statusCode, part3); } // not a response so then the last part must be the SIP/2.0 // otherwise this is not a valid SIP initial line expectSIP2_0(part3); return new SipRequestLine(part1, part2); } catch (final NumberFormatException e) { final int index = buffer.getReaderIndex() - part3.capacity() - part2.capacity() - 1; throw new SipParseException(index, "unable to parse the SIP response code as an integer"); } catch (final ByteNotFoundException e) { throw new SipParseException(buffer.getReaderIndex(), "expected space"); } catch (final SipParseException e) { // is only thrown by the expectSIP2_0. Calculate the correct // index into the buffer e.printStackTrace();; final int index = buffer.getReaderIndex() - part3.capacity() + e.getErrorOffset() - 1; throw new SipParseException(index, "Wrong SIP version"); } catch (final IOException e) { throw new SipParseException(buffer.getReaderIndex(), "could not read from stream", e); } } }
public class class_name { public static final SipInitialLine parse(final Buffer buffer) throws SipParseException { Buffer part1 = null; Buffer part2 = null; Buffer part3 = null; try { part1 = buffer.readUntil(SipParser.SP); part2 = buffer.readUntil(SipParser.SP); part3 = buffer.readLine(); if (SipParser.SIP2_0.equals(part1)) { final int statusCode = part2.parseToInt(); return new SipResponseLine(statusCode, part3); // depends on control dependency: [if], data = [none] } // not a response so then the last part must be the SIP/2.0 // otherwise this is not a valid SIP initial line expectSIP2_0(part3); return new SipRequestLine(part1, part2); } catch (final NumberFormatException e) { final int index = buffer.getReaderIndex() - part3.capacity() - part2.capacity() - 1; throw new SipParseException(index, "unable to parse the SIP response code as an integer"); } catch (final ByteNotFoundException e) { throw new SipParseException(buffer.getReaderIndex(), "expected space"); } catch (final SipParseException e) { // is only thrown by the expectSIP2_0. Calculate the correct // index into the buffer e.printStackTrace();; final int index = buffer.getReaderIndex() - part3.capacity() + e.getErrorOffset() - 1; throw new SipParseException(index, "Wrong SIP version"); } catch (final IOException e) { throw new SipParseException(buffer.getReaderIndex(), "could not read from stream", e); } } }
public class class_name { protected synchronized void notifyListenersSpiderProgress(int percentageComplete, int numberCrawled, int numberToCrawl) { for (SpiderListener l : listeners) { l.spiderProgress(percentageComplete, numberCrawled, numberToCrawl); } } }
public class class_name { protected synchronized void notifyListenersSpiderProgress(int percentageComplete, int numberCrawled, int numberToCrawl) { for (SpiderListener l : listeners) { l.spiderProgress(percentageComplete, numberCrawled, numberToCrawl); // depends on control dependency: [for], data = [l] } } }
public class class_name { private HashMap<String, HashSet<Node>> getRackToHostsMapForStripe( String srcFileName, String parityFileName, int stripeLen, int parityLen, int stripeIndex) throws IOException { HashMap<String, HashSet<Node>> rackToHosts = new HashMap<String, HashSet<Node>>(); if (srcFileName != null) { rackToHosts = getRackToHostsMapForStripe(srcFileName, stripeIndex, stripeLen); } if (parityFileName != null) { HashMap<String, HashSet<Node>> rackToHostsForParity = getRackToHostsMapForStripe(parityFileName, stripeIndex, parityLen); for (Map.Entry<String, HashSet<Node>> e : rackToHostsForParity.entrySet()) { HashSet<Node> nodes = rackToHosts.get(e.getKey()); if (nodes == null) { nodes = new HashSet<Node>(); rackToHosts.put(e.getKey(), nodes); } for (Node n : e.getValue()) { nodes.add(n); } } } for (Map.Entry<String, HashSet<Node>> e : rackToHosts.entrySet()) { if (e.getValue().size() > 1) { FSNamesystem.LOG.warn("F4: Rack " + e.getKey() + " being overused for stripe: " + stripeIndex); } } return rackToHosts; } }
public class class_name { private HashMap<String, HashSet<Node>> getRackToHostsMapForStripe( String srcFileName, String parityFileName, int stripeLen, int parityLen, int stripeIndex) throws IOException { HashMap<String, HashSet<Node>> rackToHosts = new HashMap<String, HashSet<Node>>(); if (srcFileName != null) { rackToHosts = getRackToHostsMapForStripe(srcFileName, stripeIndex, stripeLen); } if (parityFileName != null) { HashMap<String, HashSet<Node>> rackToHostsForParity = getRackToHostsMapForStripe(parityFileName, stripeIndex, parityLen); for (Map.Entry<String, HashSet<Node>> e : rackToHostsForParity.entrySet()) { HashSet<Node> nodes = rackToHosts.get(e.getKey()); if (nodes == null) { nodes = new HashSet<Node>(); // depends on control dependency: [if], data = [none] rackToHosts.put(e.getKey(), nodes); // depends on control dependency: [if], data = [none] } for (Node n : e.getValue()) { nodes.add(n); // depends on control dependency: [for], data = [n] } } } for (Map.Entry<String, HashSet<Node>> e : rackToHosts.entrySet()) { if (e.getValue().size() > 1) { FSNamesystem.LOG.warn("F4: Rack " + e.getKey() + " being overused for stripe: " + stripeIndex); } } return rackToHosts; } }
public class class_name { public static UITaskMetric getTaskMetric(List<MetricInfo> taskStreamMetrics, String component, int id, int window) { UITaskMetric taskMetric = new UITaskMetric(component, id); if (taskStreamMetrics.size() > 1) { MetricInfo info = taskStreamMetrics.get(0); if (info != null) { for (Map.Entry<String, Map<Integer, MetricSnapshot>> metric : info.get_metrics().entrySet()) { String name = metric.getKey(); String[] split_name = name.split("@"); int taskId = JStormUtils.parseInt(UIMetricUtils.extractTaskId(split_name)); if (taskId != id) continue; //only handle the specific task String metricName = UIMetricUtils.extractMetricName(split_name); String parentComp = null; if (metricName != null && metricName.contains(".")) { parentComp = metricName.split("\\.")[0]; metricName = metricName.split("\\.")[1]; } MetricSnapshot snapshot = metric.getValue().get(window); taskMetric.setMetricValue(snapshot, parentComp, metricName); } } } taskMetric.mergeValue(); return taskMetric; } }
public class class_name { public static UITaskMetric getTaskMetric(List<MetricInfo> taskStreamMetrics, String component, int id, int window) { UITaskMetric taskMetric = new UITaskMetric(component, id); if (taskStreamMetrics.size() > 1) { MetricInfo info = taskStreamMetrics.get(0); if (info != null) { for (Map.Entry<String, Map<Integer, MetricSnapshot>> metric : info.get_metrics().entrySet()) { String name = metric.getKey(); String[] split_name = name.split("@"); int taskId = JStormUtils.parseInt(UIMetricUtils.extractTaskId(split_name)); if (taskId != id) continue; //only handle the specific task String metricName = UIMetricUtils.extractMetricName(split_name); String parentComp = null; if (metricName != null && metricName.contains(".")) { parentComp = metricName.split("\\.")[0]; // depends on control dependency: [if], data = [none] metricName = metricName.split("\\.")[1]; // depends on control dependency: [if], data = [none] } MetricSnapshot snapshot = metric.getValue().get(window); taskMetric.setMetricValue(snapshot, parentComp, metricName); // depends on control dependency: [for], data = [metric] } } } taskMetric.mergeValue(); return taskMetric; } }
public class class_name { @Override public boolean hasNext() { // first return all values of the first operand while (mOp1.hasNext()) { mOp1.next(); if (getNode().getDataKey() < 0) { // only nodes are // allowed throw new XPathError(ErrorType.XPTY0004); } return true; } // then all values of the second operand. while (mOp2.hasNext()) { mOp2.next(); if (getNode().getDataKey() < 0) { // only nodes are // allowed throw new XPathError(ErrorType.XPTY0004); } return true; } return false; } }
public class class_name { @Override public boolean hasNext() { // first return all values of the first operand while (mOp1.hasNext()) { mOp1.next(); // depends on control dependency: [while], data = [none] if (getNode().getDataKey() < 0) { // only nodes are // allowed throw new XPathError(ErrorType.XPTY0004); } return true; // depends on control dependency: [while], data = [none] } // then all values of the second operand. while (mOp2.hasNext()) { mOp2.next(); // depends on control dependency: [while], data = [none] if (getNode().getDataKey() < 0) { // only nodes are // allowed throw new XPathError(ErrorType.XPTY0004); } return true; // depends on control dependency: [while], data = [none] } return false; } }
public class class_name { @Override public DatatypeLibrary createDatatypeLibrary(String namespaceURI) { if (NAMESPACE.equals(namespaceURI)) { return new Html5DatatypeLibrary(); } return null; } }
public class class_name { @Override public DatatypeLibrary createDatatypeLibrary(String namespaceURI) { if (NAMESPACE.equals(namespaceURI)) { return new Html5DatatypeLibrary(); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { Reference<T> lookupReference(String name, boolean isLongName) { if (isLongName) { for (Reference<T> r : referenceMap.values()) { if (r.longName.equals(name)) { return r; } } return null; } return referenceMap.get(name); } }
public class class_name { Reference<T> lookupReference(String name, boolean isLongName) { if (isLongName) { for (Reference<T> r : referenceMap.values()) { if (r.longName.equals(name)) { return r; // depends on control dependency: [if], data = [none] } } return null; // depends on control dependency: [if], data = [none] } return referenceMap.get(name); } }
public class class_name { @TCB private static void encodeHtmlOnto( String plainText, Appendable output, @Nullable String braceReplacement) throws IOException { int n = plainText.length(); int pos = 0; for (int i = 0; i < n; ++i) { char ch = plainText.charAt(i); if (ch < REPLACEMENTS.length) { // Handles all ASCII. String repl = REPLACEMENTS[ch]; if (ch == '{' && repl == null) { if (i + 1 == n || plainText.charAt(i + 1) == '{') { repl = braceReplacement; } } if (repl != null) { output.append(plainText, pos, i).append(repl); pos = i + 1; } } else if ((0x93A <= ch && ch <= 0xC4C) && ( // Devanagari vowel ch <= 0x94F // Benagli vowels || 0x985 <= ch && ch <= 0x994 || 0x9BE <= ch && ch < 0x9CC // 0x9CC (Bengali AU) is ok || 0x9E0 <= ch && ch <= 0x9E3 // Telugu vowels || 0xC05 <= ch && ch <= 0xC14 || 0xC3E <= ch && ch != 0xC48 /* 0xC48 (Telugu AI) is ok */)) { // https://manishearth.github.io/blog/2018/02/15/picking-apart-the-crashing-ios-string/ // > So, ultimately, the full set of cases that cause the crash are: // > Any sequence <consonant1, virama, consonant2, ZWNJ, vowel> // > in Devanagari, Bengali, and Telugu, where: ... // TODO: This is needed as of February 2018, but hopefully not long after that. // We eliminate the ZWNJ which seems the minimally damaging thing to do to // Telugu rendering per the article above: // > a ZWNJ before a vowel doesn’t really do anything for most Indic scripts. if (pos < i) { if (plainText.charAt(i - 1) == 0x200C /* ZWNJ */) { output.append(plainText, pos, i - 1); // Drop the ZWNJ on the floor. pos = i; } } else if (output instanceof StringBuilder) { StringBuilder sb = (StringBuilder) output; int len = sb.length(); if (len != 0) { if (sb.charAt(len - 1) == 0x200C /* ZWNJ */) { sb.setLength(len - 1); } } } } else if (((char) 0xd800) <= ch) { if (ch <= ((char) 0xdfff)) { char next; if (i + 1 < n && Character.isSurrogatePair( ch, next = plainText.charAt(i + 1))) { // Emit supplemental codepoints as entity so that they cannot // be mis-encoded as UTF-8 of surrogates instead of UTF-8 proper // and get involved in UTF-16/UCS-2 confusion. int codepoint = Character.toCodePoint(ch, next); output.append(plainText, pos, i); appendNumericEntity(codepoint, output); ++i; pos = i + 1; } else { output.append(plainText, pos, i); // Elide the orphaned surrogate. pos = i + 1; } } else if (0xfe60 <= ch) { // Is a control character or possible full-width version of a // special character, a BOM, or one of the FE60 block that might // be elided or normalized to an HTML special character. // Running // cat NormalizationText.txt \ // | perl -pe 's/ ?#.*//' \ // | egrep '(;003C(;|$)|003E|0026|0022|0027|0060)' // dumps a list of code-points that can normalize to HTML special // characters. output.append(plainText, pos, i); pos = i + 1; if ((ch & 0xfffe) == 0xfffe) { // Elide since not an the XML Character. } else { appendNumericEntity(ch, output); } } } else if (ch == '\u1FEF') { // Normalizes to backtick. output.append(plainText, pos, i).append("&#8175;"); pos = i + 1; } } output.append(plainText, pos, n); } }
public class class_name { @TCB private static void encodeHtmlOnto( String plainText, Appendable output, @Nullable String braceReplacement) throws IOException { int n = plainText.length(); int pos = 0; for (int i = 0; i < n; ++i) { char ch = plainText.charAt(i); if (ch < REPLACEMENTS.length) { // Handles all ASCII. String repl = REPLACEMENTS[ch]; if (ch == '{' && repl == null) { if (i + 1 == n || plainText.charAt(i + 1) == '{') { repl = braceReplacement; } } if (repl != null) { output.append(plainText, pos, i).append(repl); pos = i + 1; } } else if ((0x93A <= ch && ch <= 0xC4C) && ( // Devanagari vowel ch <= 0x94F // Benagli vowels || 0x985 <= ch && ch <= 0x994 || 0x9BE <= ch && ch < 0x9CC // 0x9CC (Bengali AU) is ok || 0x9E0 <= ch && ch <= 0x9E3 // Telugu vowels || 0xC05 <= ch && ch <= 0xC14 || 0xC3E <= ch && ch != 0xC48 /* 0xC48 (Telugu AI) is ok */)) { // https://manishearth.github.io/blog/2018/02/15/picking-apart-the-crashing-ios-string/ // > So, ultimately, the full set of cases that cause the crash are: // > Any sequence <consonant1, virama, consonant2, ZWNJ, vowel> // > in Devanagari, Bengali, and Telugu, where: ... // TODO: This is needed as of February 2018, but hopefully not long after that. // We eliminate the ZWNJ which seems the minimally damaging thing to do to // Telugu rendering per the article above: // > a ZWNJ before a vowel doesn’t really do anything for most Indic scripts. if (pos < i) { if (plainText.charAt(i - 1) == 0x200C /* ZWNJ */) { output.append(plainText, pos, i - 1); // depends on control dependency: [if], data = [none] // Drop the ZWNJ on the floor. pos = i; // depends on control dependency: [if], data = [none] } } else if (output instanceof StringBuilder) { StringBuilder sb = (StringBuilder) output; int len = sb.length(); if (len != 0) { if (sb.charAt(len - 1) == 0x200C /* ZWNJ */) { sb.setLength(len - 1); // depends on control dependency: [if], data = [none] } } } } else if (((char) 0xd800) <= ch) { if (ch <= ((char) 0xdfff)) { char next; if (i + 1 < n && Character.isSurrogatePair( ch, next = plainText.charAt(i + 1))) { // Emit supplemental codepoints as entity so that they cannot // be mis-encoded as UTF-8 of surrogates instead of UTF-8 proper // and get involved in UTF-16/UCS-2 confusion. int codepoint = Character.toCodePoint(ch, next); output.append(plainText, pos, i); // depends on control dependency: [if], data = [n] appendNumericEntity(codepoint, output); // depends on control dependency: [if], data = [n] ++i; // depends on control dependency: [if], data = [none] pos = i + 1; // depends on control dependency: [if], data = [none] } else { output.append(plainText, pos, i); // depends on control dependency: [if], data = [n] // Elide the orphaned surrogate. pos = i + 1; // depends on control dependency: [if], data = [none] } } else if (0xfe60 <= ch) { // Is a control character or possible full-width version of a // special character, a BOM, or one of the FE60 block that might // be elided or normalized to an HTML special character. // Running // cat NormalizationText.txt \ // | perl -pe 's/ ?#.*//' \ // | egrep '(;003C(;|$)|003E|0026|0022|0027|0060)' // dumps a list of code-points that can normalize to HTML special // characters. output.append(plainText, pos, i); // depends on control dependency: [if], data = [none] pos = i + 1; // depends on control dependency: [if], data = [none] if ((ch & 0xfffe) == 0xfffe) { // Elide since not an the XML Character. } else { appendNumericEntity(ch, output); // depends on control dependency: [if], data = [none] } } } else if (ch == '\u1FEF') { // Normalizes to backtick. output.append(plainText, pos, i).append("&#8175;"); pos = i + 1; } } output.append(plainText, pos, n); } }
public class class_name { protected void publishDeletedFile( CmsDbContext dbc, CmsProject onlineProject, CmsResource offlineResource, CmsUUID publishHistoryId, int publishTag) throws CmsDataAccessException { CmsResourceState resourceState = fixMovedResource( dbc, onlineProject, offlineResource, publishHistoryId, publishTag); boolean existsOnline = m_driverManager.getVfsDriver(dbc).validateStructureIdExists( dbc, CmsProject.ONLINE_PROJECT_ID, offlineResource.getStructureId()); CmsResource onlineResource = null; if (existsOnline) { try { // read the file header online onlineResource = m_driverManager.getVfsDriver(dbc).readResource( dbc, onlineProject.getUuid(), offlineResource.getStructureId(), true); } catch (CmsDataAccessException e) { if (LOG.isErrorEnabled()) { LOG.error( Messages.get().getBundle().key(Messages.LOG_READING_RESOURCE_1, offlineResource.getRootPath()), e); } throw e; } } if (offlineResource.isLabeled() && !m_driverManager.labelResource(dbc, offlineResource, null, 2)) { // update the resource flags to "unlabeled" of the siblings of the offline resource int flags = offlineResource.getFlags(); flags &= ~CmsResource.FLAG_LABELED; offlineResource.setFlags(flags); } // write history before deleting CmsFile offlineFile = new CmsFile(offlineResource); offlineFile.setContents( m_driverManager.getVfsDriver(dbc).readContent( dbc, dbc.currentProject().getUuid(), offlineFile.getResourceId())); internalWriteHistory(dbc, offlineFile, resourceState, null, publishHistoryId, publishTag); int propertyDeleteOption = -1; try { // delete the properties online and offline if (offlineResource.getSiblingCount() > 1) { // there are other siblings- delete only structure property values and keep the resource property values propertyDeleteOption = CmsProperty.DELETE_OPTION_DELETE_STRUCTURE_VALUES; } else { // there are no other siblings- delete both the structure and resource property values propertyDeleteOption = CmsProperty.DELETE_OPTION_DELETE_STRUCTURE_AND_RESOURCE_VALUES; } if (existsOnline) { m_driverManager.getVfsDriver(dbc).deletePropertyObjects( dbc, onlineProject.getUuid(), onlineResource, propertyDeleteOption); } m_driverManager.getVfsDriver(dbc).deletePropertyObjects( dbc, dbc.currentProject().getUuid(), offlineResource, propertyDeleteOption); // if the offline file has a resource ID different from the online file // (probably because a (deleted) file was replaced by a new file with the // same name), the properties with the "old" resource ID have to be // deleted also offline if (existsOnline && (onlineResource != null) && !onlineResource.getResourceId().equals(offlineResource.getResourceId())) { m_driverManager.getVfsDriver(dbc).deletePropertyObjects( dbc, dbc.currentProject().getUuid(), onlineResource, CmsProperty.DELETE_OPTION_DELETE_STRUCTURE_AND_RESOURCE_VALUES); } } catch (CmsDataAccessException e) { if (LOG.isErrorEnabled()) { LOG.error( Messages.get().getBundle().key(Messages.LOG_DELETING_PROPERTIES_1, offlineResource.getRootPath()), e); } throw e; } try { // remove the file online and offline m_driverManager.getVfsDriver(dbc).removeFile(dbc, dbc.currentProject().getUuid(), offlineResource); if (existsOnline && (onlineResource != null)) { m_driverManager.getVfsDriver(dbc).removeFile(dbc, onlineProject.getUuid(), onlineResource); } } catch (CmsDataAccessException e) { if (LOG.isErrorEnabled()) { LOG.error( Messages.get().getBundle().key(Messages.LOG_REMOVING_RESOURCE_1, offlineResource.getRootPath()), e); } throw e; } // delete the ACL online and offline try { if (existsOnline && (onlineResource != null) && (onlineResource.getSiblingCount() == 1)) { // only if no siblings left m_driverManager.getUserDriver(dbc).removeAccessControlEntries( dbc, onlineProject, onlineResource.getResourceId()); } if (offlineResource.getSiblingCount() == 1) { // only if no siblings left m_driverManager.getUserDriver(dbc).removeAccessControlEntries( dbc, dbc.currentProject(), offlineResource.getResourceId()); } } catch (CmsDataAccessException e) { if (LOG.isErrorEnabled()) { LOG.error(Messages.get().getBundle().key(Messages.LOG_REMOVING_ACL_1, offlineResource.toString()), e); } throw e; } try { // delete relations online and offline m_driverManager.getVfsDriver(dbc).deleteRelations( dbc, onlineProject.getUuid(), offlineResource, CmsRelationFilter.TARGETS); m_driverManager.getVfsDriver(dbc).deleteRelations( dbc, dbc.currentProject().getUuid(), offlineResource, CmsRelationFilter.TARGETS); } catch (CmsDataAccessException e) { if (LOG.isErrorEnabled()) { LOG.error( Messages.get().getBundle().key(Messages.LOG_REMOVING_RELATIONS_1, offlineResource.toString()), e); } throw e; } if (OpenCms.getSubscriptionManager().isEnabled()) { try { // delete visited information for resource from log CmsVisitEntryFilter filter = CmsVisitEntryFilter.ALL.filterResource(offlineResource.getStructureId()); m_driverManager.getSubscriptionDriver().deleteVisits( dbc, OpenCms.getSubscriptionManager().getPoolName(), filter); } catch (CmsDataAccessException e) { if (LOG.isErrorEnabled()) { LOG.error( Messages.get().getBundle().key(Messages.LOG_REMOVING_VISITEDLOG_1, offlineResource.toString()), e); } throw e; } try { // mark the subscribed resource as deleted /* changed to subscription driver */ // m_driverManager.getUserDriver(dbc).setSubscribedResourceAsDeleted( // dbc, // OpenCms.getSubscriptionManager().getPoolName(), // offlineResource); m_driverManager.getSubscriptionDriver().setSubscribedResourceAsDeleted( dbc, OpenCms.getSubscriptionManager().getPoolName(), offlineResource); } catch (CmsDataAccessException e) { if (LOG.isErrorEnabled()) { LOG.error( Messages.get().getBundle().key( Messages.LOG_REMOVING_SUBSCRIPTIONS_1, offlineResource.toString()), e); } throw e; } } } }
public class class_name { protected void publishDeletedFile( CmsDbContext dbc, CmsProject onlineProject, CmsResource offlineResource, CmsUUID publishHistoryId, int publishTag) throws CmsDataAccessException { CmsResourceState resourceState = fixMovedResource( dbc, onlineProject, offlineResource, publishHistoryId, publishTag); boolean existsOnline = m_driverManager.getVfsDriver(dbc).validateStructureIdExists( dbc, CmsProject.ONLINE_PROJECT_ID, offlineResource.getStructureId()); CmsResource onlineResource = null; if (existsOnline) { try { // read the file header online onlineResource = m_driverManager.getVfsDriver(dbc).readResource( dbc, onlineProject.getUuid(), offlineResource.getStructureId(), true); // depends on control dependency: [try], data = [none] } catch (CmsDataAccessException e) { if (LOG.isErrorEnabled()) { LOG.error( Messages.get().getBundle().key(Messages.LOG_READING_RESOURCE_1, offlineResource.getRootPath()), e); // depends on control dependency: [if], data = [none] } throw e; } // depends on control dependency: [catch], data = [none] } if (offlineResource.isLabeled() && !m_driverManager.labelResource(dbc, offlineResource, null, 2)) { // update the resource flags to "unlabeled" of the siblings of the offline resource int flags = offlineResource.getFlags(); flags &= ~CmsResource.FLAG_LABELED; offlineResource.setFlags(flags); } // write history before deleting CmsFile offlineFile = new CmsFile(offlineResource); offlineFile.setContents( m_driverManager.getVfsDriver(dbc).readContent( dbc, dbc.currentProject().getUuid(), offlineFile.getResourceId())); internalWriteHistory(dbc, offlineFile, resourceState, null, publishHistoryId, publishTag); int propertyDeleteOption = -1; try { // delete the properties online and offline if (offlineResource.getSiblingCount() > 1) { // there are other siblings- delete only structure property values and keep the resource property values propertyDeleteOption = CmsProperty.DELETE_OPTION_DELETE_STRUCTURE_VALUES; } else { // there are no other siblings- delete both the structure and resource property values propertyDeleteOption = CmsProperty.DELETE_OPTION_DELETE_STRUCTURE_AND_RESOURCE_VALUES; } if (existsOnline) { m_driverManager.getVfsDriver(dbc).deletePropertyObjects( dbc, onlineProject.getUuid(), onlineResource, propertyDeleteOption); } m_driverManager.getVfsDriver(dbc).deletePropertyObjects( dbc, dbc.currentProject().getUuid(), offlineResource, propertyDeleteOption); // if the offline file has a resource ID different from the online file // (probably because a (deleted) file was replaced by a new file with the // same name), the properties with the "old" resource ID have to be // deleted also offline if (existsOnline && (onlineResource != null) && !onlineResource.getResourceId().equals(offlineResource.getResourceId())) { m_driverManager.getVfsDriver(dbc).deletePropertyObjects( dbc, dbc.currentProject().getUuid(), onlineResource, CmsProperty.DELETE_OPTION_DELETE_STRUCTURE_AND_RESOURCE_VALUES); } } catch (CmsDataAccessException e) { if (LOG.isErrorEnabled()) { LOG.error( Messages.get().getBundle().key(Messages.LOG_DELETING_PROPERTIES_1, offlineResource.getRootPath()), e); // depends on control dependency: [if], data = [none] } throw e; } try { // remove the file online and offline m_driverManager.getVfsDriver(dbc).removeFile(dbc, dbc.currentProject().getUuid(), offlineResource); if (existsOnline && (onlineResource != null)) { m_driverManager.getVfsDriver(dbc).removeFile(dbc, onlineProject.getUuid(), onlineResource); // depends on control dependency: [if], data = [none] } } catch (CmsDataAccessException e) { if (LOG.isErrorEnabled()) { LOG.error( Messages.get().getBundle().key(Messages.LOG_REMOVING_RESOURCE_1, offlineResource.getRootPath()), e); // depends on control dependency: [if], data = [none] } throw e; } // delete the ACL online and offline try { if (existsOnline && (onlineResource != null) && (onlineResource.getSiblingCount() == 1)) { // only if no siblings left m_driverManager.getUserDriver(dbc).removeAccessControlEntries( dbc, onlineProject, onlineResource.getResourceId()); // depends on control dependency: [if], data = [none] } if (offlineResource.getSiblingCount() == 1) { // only if no siblings left m_driverManager.getUserDriver(dbc).removeAccessControlEntries( dbc, dbc.currentProject(), offlineResource.getResourceId()); // depends on control dependency: [if], data = [none] } } catch (CmsDataAccessException e) { if (LOG.isErrorEnabled()) { LOG.error(Messages.get().getBundle().key(Messages.LOG_REMOVING_ACL_1, offlineResource.toString()), e); // depends on control dependency: [if], data = [none] } throw e; } try { // delete relations online and offline m_driverManager.getVfsDriver(dbc).deleteRelations( dbc, onlineProject.getUuid(), offlineResource, CmsRelationFilter.TARGETS); m_driverManager.getVfsDriver(dbc).deleteRelations( dbc, dbc.currentProject().getUuid(), offlineResource, CmsRelationFilter.TARGETS); } catch (CmsDataAccessException e) { if (LOG.isErrorEnabled()) { LOG.error( Messages.get().getBundle().key(Messages.LOG_REMOVING_RELATIONS_1, offlineResource.toString()), e); // depends on control dependency: [if], data = [none] } throw e; } if (OpenCms.getSubscriptionManager().isEnabled()) { try { // delete visited information for resource from log CmsVisitEntryFilter filter = CmsVisitEntryFilter.ALL.filterResource(offlineResource.getStructureId()); m_driverManager.getSubscriptionDriver().deleteVisits( dbc, OpenCms.getSubscriptionManager().getPoolName(), filter); } catch (CmsDataAccessException e) { if (LOG.isErrorEnabled()) { LOG.error( Messages.get().getBundle().key(Messages.LOG_REMOVING_VISITEDLOG_1, offlineResource.toString()), e); // depends on control dependency: [if], data = [none] } throw e; } try { // mark the subscribed resource as deleted /* changed to subscription driver */ // m_driverManager.getUserDriver(dbc).setSubscribedResourceAsDeleted( // dbc, // OpenCms.getSubscriptionManager().getPoolName(), // offlineResource); m_driverManager.getSubscriptionDriver().setSubscribedResourceAsDeleted( dbc, OpenCms.getSubscriptionManager().getPoolName(), offlineResource); } catch (CmsDataAccessException e) { if (LOG.isErrorEnabled()) { LOG.error( Messages.get().getBundle().key( Messages.LOG_REMOVING_SUBSCRIPTIONS_1, offlineResource.toString()), e); // depends on control dependency: [if], data = [none] } throw e; } } } }
public class class_name { private double[][] calculateTotalKinematic( double[][] ampikinesurface, double[][] ampisubsurface, double delta_sup, double delta_sub, double vc, double tcorr, double area_sub, double area_super ) { double[][] totalKinematic = null; if (ampisubsurface == null) { totalKinematic = new double[ampikinesurface.length][3]; totalKinematic = ampikinesurface; } else { /* * calculate how many rows are in ampi_sub after ampi_sup has finished */ int rowinampisubwhereampisupfinishes = 0; for( int i = 0; i < ampisubsurface.length; i++ ) { if (ampisubsurface[i][0] >= ampikinesurface[ampikinesurface.length - 1][0]) { rowinampisubwhereampisupfinishes = i; break; } } int totallength = ampikinesurface.length + ampisubsurface.length - rowinampisubwhereampisupfinishes; totalKinematic = new double[totallength][3]; double intsub = 0f; double intsup = 0f; for( int i = 0; i < ampikinesurface.length; i++ ) { totalKinematic[i][0] = ampikinesurface[i][0]; intsub = (double) ModelsEngine.width_interpolate(ampisubsurface, ampikinesurface[i][0], 0, 1); intsup = ampikinesurface[i][1]; totalKinematic[i][1] = intsup + intsub; } for( int i = ampikinesurface.length, j = rowinampisubwhereampisupfinishes; i < totallength; i++, j++ ) { totalKinematic[i][0] = ampisubsurface[j][0]; totalKinematic[i][1] = ampisubsurface[j][1]; } /* * calculation of the third column = cumulated The normalization occurs by means of the * superficial delta in the first part of the hydrogram, i.e. until the superficial * contributes, after that the delta is the one of the subsuperficial. */ double cum = 0f; for( int i = 0; i < ampikinesurface.length; i++ ) { cum = cum + (totalKinematic[i][1] * delta_sup) / ((area_super + area_sub) * vc); totalKinematic[i][2] = cum; } for( int i = ampikinesurface.length, j = rowinampisubwhereampisupfinishes; i < totallength; i++, j++ ) { cum = cum + (totalKinematic[i][1] * delta_sub) / ((area_super + area_sub) * vc); totalKinematic[i][2] = cum; } } return totalKinematic; } }
public class class_name { private double[][] calculateTotalKinematic( double[][] ampikinesurface, double[][] ampisubsurface, double delta_sup, double delta_sub, double vc, double tcorr, double area_sub, double area_super ) { double[][] totalKinematic = null; if (ampisubsurface == null) { totalKinematic = new double[ampikinesurface.length][3]; // depends on control dependency: [if], data = [none] totalKinematic = ampikinesurface; // depends on control dependency: [if], data = [none] } else { /* * calculate how many rows are in ampi_sub after ampi_sup has finished */ int rowinampisubwhereampisupfinishes = 0; for( int i = 0; i < ampisubsurface.length; i++ ) { if (ampisubsurface[i][0] >= ampikinesurface[ampikinesurface.length - 1][0]) { rowinampisubwhereampisupfinishes = i; // depends on control dependency: [if], data = [none] break; } } int totallength = ampikinesurface.length + ampisubsurface.length - rowinampisubwhereampisupfinishes; totalKinematic = new double[totallength][3]; // depends on control dependency: [if], data = [none] double intsub = 0f; double intsup = 0f; for( int i = 0; i < ampikinesurface.length; i++ ) { totalKinematic[i][0] = ampikinesurface[i][0]; // depends on control dependency: [for], data = [i] intsub = (double) ModelsEngine.width_interpolate(ampisubsurface, ampikinesurface[i][0], 0, 1); // depends on control dependency: [for], data = [i] intsup = ampikinesurface[i][1]; // depends on control dependency: [for], data = [i] totalKinematic[i][1] = intsup + intsub; // depends on control dependency: [for], data = [i] } for( int i = ampikinesurface.length, j = rowinampisubwhereampisupfinishes; i < totallength; i++, j++ ) { totalKinematic[i][0] = ampisubsurface[j][0]; // depends on control dependency: [for], data = [i] totalKinematic[i][1] = ampisubsurface[j][1]; // depends on control dependency: [for], data = [i] } /* * calculation of the third column = cumulated The normalization occurs by means of the * superficial delta in the first part of the hydrogram, i.e. until the superficial * contributes, after that the delta is the one of the subsuperficial. */ double cum = 0f; for( int i = 0; i < ampikinesurface.length; i++ ) { cum = cum + (totalKinematic[i][1] * delta_sup) / ((area_super + area_sub) * vc); // depends on control dependency: [for], data = [i] totalKinematic[i][2] = cum; // depends on control dependency: [for], data = [i] } for( int i = ampikinesurface.length, j = rowinampisubwhereampisupfinishes; i < totallength; i++, j++ ) { cum = cum + (totalKinematic[i][1] * delta_sub) / ((area_super + area_sub) * vc); // depends on control dependency: [for], data = [i] totalKinematic[i][2] = cum; // depends on control dependency: [for], data = [i] } } return totalKinematic; } }
public class class_name { public static String toLowerCase(CharSequence chars) { if (chars instanceof String) { return toLowerCase((String) chars); } int length = chars.length(); StringBuilder builder = new StringBuilder(length); for (int i = 0; i < length; i++) { builder.append(toLowerCase(chars.charAt(i))); } return builder.toString(); } }
public class class_name { public static String toLowerCase(CharSequence chars) { if (chars instanceof String) { return toLowerCase((String) chars); // depends on control dependency: [if], data = [none] } int length = chars.length(); StringBuilder builder = new StringBuilder(length); for (int i = 0; i < length; i++) { builder.append(toLowerCase(chars.charAt(i))); // depends on control dependency: [for], data = [i] } return builder.toString(); } }
public class class_name { public DateTimeFormatter withLocale(Locale locale) { if (locale == getLocale() || (locale != null && locale.equals(getLocale()))) { return this; } return new DateTimeFormatter(iPrinter, iParser, locale, iOffsetParsed, iChrono, iZone, iPivotYear, iDefaultYear); } }
public class class_name { public DateTimeFormatter withLocale(Locale locale) { if (locale == getLocale() || (locale != null && locale.equals(getLocale()))) { return this; // depends on control dependency: [if], data = [none] } return new DateTimeFormatter(iPrinter, iParser, locale, iOffsetParsed, iChrono, iZone, iPivotYear, iDefaultYear); } }
public class class_name { public static File getTempDirectory() { if (tempFile != null) return tempFile; final String tmpStr = System.getProperty("java.io.tmpdir"); if (tmpStr != null) { tempFile = new File(tmpStr); if (tempFile.exists()) { tempFile = getCanonicalFileEL(tempFile); return tempFile; } } try { final File tmp = File.createTempFile("a", "a"); tempFile = tmp.getParentFile(); tempFile = getCanonicalFileEL(tempFile); tmp.delete(); } catch (final IOException ioe) {} return tempFile; } }
public class class_name { public static File getTempDirectory() { if (tempFile != null) return tempFile; final String tmpStr = System.getProperty("java.io.tmpdir"); if (tmpStr != null) { tempFile = new File(tmpStr); // depends on control dependency: [if], data = [(tmpStr] if (tempFile.exists()) { tempFile = getCanonicalFileEL(tempFile); // depends on control dependency: [if], data = [none] return tempFile; // depends on control dependency: [if], data = [none] } } try { final File tmp = File.createTempFile("a", "a"); tempFile = tmp.getParentFile(); // depends on control dependency: [try], data = [none] tempFile = getCanonicalFileEL(tempFile); // depends on control dependency: [try], data = [none] tmp.delete(); // depends on control dependency: [try], data = [none] } catch (final IOException ioe) {} // depends on control dependency: [catch], data = [none] return tempFile; } }
public class class_name { public static String addsPfad(String pfad1, String pfad2) { String ret = ""; if (pfad1 != null && pfad2 != null) { if (pfad1.isEmpty()) { ret = pfad2; } else if (pfad2.isEmpty()) { ret = pfad1; } else if (!pfad1.isEmpty() && !pfad2.isEmpty()) { if (pfad1.endsWith(File.separator)) { ret = pfad1.substring(0, pfad1.length() - 1); } else { ret = pfad1; } if (pfad2.charAt(0) == File.separatorChar) { ret += pfad2; } else { ret += File.separator + pfad2; } } } if (ret.isEmpty()) { Log.errorLog(283946015, pfad1 + " - " + pfad2); } return ret; } }
public class class_name { public static String addsPfad(String pfad1, String pfad2) { String ret = ""; if (pfad1 != null && pfad2 != null) { if (pfad1.isEmpty()) { ret = pfad2; // depends on control dependency: [if], data = [none] } else if (pfad2.isEmpty()) { ret = pfad1; // depends on control dependency: [if], data = [none] } else if (!pfad1.isEmpty() && !pfad2.isEmpty()) { if (pfad1.endsWith(File.separator)) { ret = pfad1.substring(0, pfad1.length() - 1); // depends on control dependency: [if], data = [none] } else { ret = pfad1; // depends on control dependency: [if], data = [none] } if (pfad2.charAt(0) == File.separatorChar) { ret += pfad2; // depends on control dependency: [if], data = [none] } else { ret += File.separator + pfad2; // depends on control dependency: [if], data = [none] } } } if (ret.isEmpty()) { Log.errorLog(283946015, pfad1 + " - " + pfad2); // depends on control dependency: [if], data = [none] } return ret; } }
public class class_name { public FavoriteResources favoriteResources() { if (favorites.get() == null) { favorites.compareAndSet(null, new FavoriteResourcesImpl(this)); } return favorites.get(); } }
public class class_name { public FavoriteResources favoriteResources() { if (favorites.get() == null) { favorites.compareAndSet(null, new FavoriteResourcesImpl(this)); // depends on control dependency: [if], data = [none] } return favorites.get(); } }
public class class_name { private final SearchQuery parseQueryString(final HttpQuery query, final SearchType type) { final SearchQuery search_query = new SearchQuery(); if (type == SearchType.LOOKUP) { final String query_string = query.getRequiredQueryStringParam("m"); search_query.setTags(new ArrayList<Pair<String, String>>()); try { search_query.setMetric(Tags.parseWithMetric(query_string, search_query.getTags())); } catch (IllegalArgumentException e) { throw new BadRequestException("Unable to parse query", e); } if (query.hasQueryStringParam("limit")) { final String limit = query.getQueryStringParam("limit"); try { search_query.setLimit(Integer.parseInt(limit)); } catch (NumberFormatException e) { throw new BadRequestException( "Unable to convert 'limit' to a valid number"); } } return search_query; } // process a regular search query search_query.setQuery(query.getRequiredQueryStringParam("query")); if (query.hasQueryStringParam("limit")) { final String limit = query.getQueryStringParam("limit"); try { search_query.setLimit(Integer.parseInt(limit)); } catch (NumberFormatException e) { throw new BadRequestException( "Unable to convert 'limit' to a valid number"); } } if (query.hasQueryStringParam("start_index")) { final String idx = query.getQueryStringParam("start_index"); try { search_query.setStartIndex(Integer.parseInt(idx)); } catch (NumberFormatException e) { throw new BadRequestException( "Unable to convert 'start_index' to a valid number"); } } if (query.hasQueryStringParam("use_meta")) { search_query.setUseMeta(Boolean.parseBoolean( query.getQueryStringParam("use_meta"))); } return search_query; } }
public class class_name { private final SearchQuery parseQueryString(final HttpQuery query, final SearchType type) { final SearchQuery search_query = new SearchQuery(); if (type == SearchType.LOOKUP) { final String query_string = query.getRequiredQueryStringParam("m"); search_query.setTags(new ArrayList<Pair<String, String>>()); // depends on control dependency: [if], data = [none] try { search_query.setMetric(Tags.parseWithMetric(query_string, search_query.getTags())); // depends on control dependency: [try], data = [none] } catch (IllegalArgumentException e) { throw new BadRequestException("Unable to parse query", e); } // depends on control dependency: [catch], data = [none] if (query.hasQueryStringParam("limit")) { final String limit = query.getQueryStringParam("limit"); try { search_query.setLimit(Integer.parseInt(limit)); // depends on control dependency: [try], data = [none] } catch (NumberFormatException e) { throw new BadRequestException( "Unable to convert 'limit' to a valid number"); } // depends on control dependency: [catch], data = [none] } return search_query; // depends on control dependency: [if], data = [none] } // process a regular search query search_query.setQuery(query.getRequiredQueryStringParam("query")); if (query.hasQueryStringParam("limit")) { final String limit = query.getQueryStringParam("limit"); try { search_query.setLimit(Integer.parseInt(limit)); // depends on control dependency: [try], data = [none] } catch (NumberFormatException e) { throw new BadRequestException( "Unable to convert 'limit' to a valid number"); } // depends on control dependency: [catch], data = [none] } if (query.hasQueryStringParam("start_index")) { final String idx = query.getQueryStringParam("start_index"); try { search_query.setStartIndex(Integer.parseInt(idx)); // depends on control dependency: [try], data = [none] } catch (NumberFormatException e) { throw new BadRequestException( "Unable to convert 'start_index' to a valid number"); } // depends on control dependency: [catch], data = [none] } if (query.hasQueryStringParam("use_meta")) { search_query.setUseMeta(Boolean.parseBoolean( query.getQueryStringParam("use_meta"))); // depends on control dependency: [if], data = [none] } return search_query; } }
public class class_name { public void remove(String toRemove) { if (toRemove.contains("*")) { set.clear(); defaultContains = false; } else { if (defaultContains) { set.add(toRemove); } else { set.remove(toRemove); } } } }
public class class_name { public void remove(String toRemove) { if (toRemove.contains("*")) { set.clear(); // depends on control dependency: [if], data = [none] defaultContains = false; // depends on control dependency: [if], data = [none] } else { if (defaultContains) { set.add(toRemove); // depends on control dependency: [if], data = [none] } else { set.remove(toRemove); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static InjectorImpl create(ClassLoader loader) { synchronized (loader) { if (loader instanceof DynamicClassLoader) { InjectorImpl inject = _localManager.getLevel(loader); if (inject == null) { inject = (InjectorImpl) InjectorAmp.manager(loader).get(); _localManager.set(inject, loader); } return inject; } else { SoftReference<InjectorImpl> injectRef = _loaderManagerMap.get(loader); InjectorImpl inject = null; if (injectRef != null) { inject = injectRef.get(); if (inject != null) { return inject; } } inject = (InjectorImpl) InjectorAmp.manager(loader).get(); _loaderManagerMap.put(loader, new SoftReference<>(inject)); return inject; } } } }
public class class_name { public static InjectorImpl create(ClassLoader loader) { synchronized (loader) { if (loader instanceof DynamicClassLoader) { InjectorImpl inject = _localManager.getLevel(loader); if (inject == null) { inject = (InjectorImpl) InjectorAmp.manager(loader).get(); // depends on control dependency: [if], data = [none] _localManager.set(inject, loader); // depends on control dependency: [if], data = [(inject] } return inject; // depends on control dependency: [if], data = [none] } else { SoftReference<InjectorImpl> injectRef = _loaderManagerMap.get(loader); InjectorImpl inject = null; if (injectRef != null) { inject = injectRef.get(); // depends on control dependency: [if], data = [none] if (inject != null) { return inject; // depends on control dependency: [if], data = [none] } } inject = (InjectorImpl) InjectorAmp.manager(loader).get(); // depends on control dependency: [if], data = [none] _loaderManagerMap.put(loader, new SoftReference<>(inject)); // depends on control dependency: [if], data = [none] return inject; // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static SumChartCost create(ChartCost ... filters) { List<ChartCost> nonNullFilters = Lists.newArrayList(); for (ChartCost filter : filters) { if (filter != null) { nonNullFilters.add(filter); } } if (nonNullFilters.size() > 0) { return new SumChartCost(nonNullFilters); } else { return null; } } }
public class class_name { public static SumChartCost create(ChartCost ... filters) { List<ChartCost> nonNullFilters = Lists.newArrayList(); for (ChartCost filter : filters) { if (filter != null) { nonNullFilters.add(filter); // depends on control dependency: [if], data = [(filter] } } if (nonNullFilters.size() > 0) { return new SumChartCost(nonNullFilters); // depends on control dependency: [if], data = [none] } else { return null; // depends on control dependency: [if], data = [none] } } }
public class class_name { private void dataBufferFlush() throws SAXException { int saveLine = line; int saveColumn = column; line = linePrev; column = columnPrev; if ((currentElementContent == CONTENT_ELEMENTS) && (dataBufferPos > 0) && !inCDATA) { // We can't just trust the buffer to be whitespace, there // are (error) cases when it isn't for (int i = 0; i < dataBufferPos; i++) { if (!isWhitespace(dataBuffer[i])) { handler.charData(dataBuffer, 0, dataBufferPos); dataBufferPos = 0; } } if (dataBufferPos > 0) { handler.ignorableWhitespace(dataBuffer, 0, dataBufferPos); dataBufferPos = 0; } } else if (dataBufferPos > 0) { handler.charData(dataBuffer, 0, dataBufferPos); dataBufferPos = 0; } line = saveLine; column = saveColumn; } }
public class class_name { private void dataBufferFlush() throws SAXException { int saveLine = line; int saveColumn = column; line = linePrev; column = columnPrev; if ((currentElementContent == CONTENT_ELEMENTS) && (dataBufferPos > 0) && !inCDATA) { // We can't just trust the buffer to be whitespace, there // are (error) cases when it isn't for (int i = 0; i < dataBufferPos; i++) { if (!isWhitespace(dataBuffer[i])) { handler.charData(dataBuffer, 0, dataBufferPos); // depends on control dependency: [if], data = [none] dataBufferPos = 0; // depends on control dependency: [if], data = [none] } } if (dataBufferPos > 0) { handler.ignorableWhitespace(dataBuffer, 0, dataBufferPos); // depends on control dependency: [if], data = [none] dataBufferPos = 0; // depends on control dependency: [if], data = [none] } } else if (dataBufferPos > 0) { handler.charData(dataBuffer, 0, dataBufferPos); dataBufferPos = 0; } line = saveLine; column = saveColumn; } }
public class class_name { public void waitForAllActivitiesDestroy(int timeOutInMillis) { synchronized (activityStack) { long start = System.currentTimeMillis(); long now = start; while (!activityStack.isEmpty() && start + timeOutInMillis > now) { try { activityStack.wait(start - now + timeOutInMillis); } catch (InterruptedException ignored) { } now = System.currentTimeMillis(); } } } }
public class class_name { public void waitForAllActivitiesDestroy(int timeOutInMillis) { synchronized (activityStack) { long start = System.currentTimeMillis(); long now = start; while (!activityStack.isEmpty() && start + timeOutInMillis > now) { try { activityStack.wait(start - now + timeOutInMillis); // depends on control dependency: [try], data = [none] } catch (InterruptedException ignored) { } // depends on control dependency: [catch], data = [none] now = System.currentTimeMillis(); // depends on control dependency: [while], data = [none] } } } }
public class class_name { @Override public void setMessageSelector(final String messageSelector) { if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) { SibTr.debug(this, TRACE, "setMessageSelector", messageSelector); } _messageSelector = messageSelector; } }
public class class_name { @Override public void setMessageSelector(final String messageSelector) { if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) { SibTr.debug(this, TRACE, "setMessageSelector", messageSelector); // depends on control dependency: [if], data = [none] } _messageSelector = messageSelector; } }
public class class_name { private static Object delegateChains(final Class<?> type) { final ReturnsEmptyValues returnsEmptyValues = new ReturnsEmptyValues(); Object result = returnsEmptyValues.returnValueFor(type); if (result == null) { Class<?> emptyValueForClass = type; while (emptyValueForClass != null && result == null) { final Class<?>[] classes = emptyValueForClass.getInterfaces(); for (Class<?> clazz : classes) { result = returnsEmptyValues.returnValueFor(clazz); if (result != null) { break; } } emptyValueForClass = emptyValueForClass.getSuperclass(); } } if (result == null) { result = new ReturnsMoreEmptyValues().returnValueFor(type); } return result; } }
public class class_name { private static Object delegateChains(final Class<?> type) { final ReturnsEmptyValues returnsEmptyValues = new ReturnsEmptyValues(); Object result = returnsEmptyValues.returnValueFor(type); if (result == null) { Class<?> emptyValueForClass = type; while (emptyValueForClass != null && result == null) { final Class<?>[] classes = emptyValueForClass.getInterfaces(); for (Class<?> clazz : classes) { result = returnsEmptyValues.returnValueFor(clazz); // depends on control dependency: [for], data = [clazz] if (result != null) { break; } } emptyValueForClass = emptyValueForClass.getSuperclass(); // depends on control dependency: [while], data = [none] } } if (result == null) { result = new ReturnsMoreEmptyValues().returnValueFor(type); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { public void write(JsonWriter json, UserDto user, Collection<String> groups, @Nullable Collection<String> fields) { json.beginObject(); json.prop(FIELD_LOGIN, user.getLogin()); writeIfNeeded(json, user.getName(), FIELD_NAME, fields); if (userSession.isLoggedIn()) { writeIfNeeded(json, user.getEmail(), FIELD_EMAIL, fields); writeIfNeeded(json, user.isActive(), FIELD_ACTIVE, fields); writeIfNeeded(json, user.isLocal(), FIELD_LOCAL, fields); writeIfNeeded(json, user.getExternalLogin(), FIELD_EXTERNAL_IDENTITY, fields); writeIfNeeded(json, user.getExternalIdentityProvider(), FIELD_EXTERNAL_PROVIDER, fields); writeGroupsIfNeeded(json, groups, fields); writeScmAccountsIfNeeded(json, fields, user); } json.endObject(); } }
public class class_name { public void write(JsonWriter json, UserDto user, Collection<String> groups, @Nullable Collection<String> fields) { json.beginObject(); json.prop(FIELD_LOGIN, user.getLogin()); writeIfNeeded(json, user.getName(), FIELD_NAME, fields); if (userSession.isLoggedIn()) { writeIfNeeded(json, user.getEmail(), FIELD_EMAIL, fields); // depends on control dependency: [if], data = [none] writeIfNeeded(json, user.isActive(), FIELD_ACTIVE, fields); // depends on control dependency: [if], data = [none] writeIfNeeded(json, user.isLocal(), FIELD_LOCAL, fields); // depends on control dependency: [if], data = [none] writeIfNeeded(json, user.getExternalLogin(), FIELD_EXTERNAL_IDENTITY, fields); // depends on control dependency: [if], data = [none] writeIfNeeded(json, user.getExternalIdentityProvider(), FIELD_EXTERNAL_PROVIDER, fields); // depends on control dependency: [if], data = [none] writeGroupsIfNeeded(json, groups, fields); // depends on control dependency: [if], data = [none] writeScmAccountsIfNeeded(json, fields, user); // depends on control dependency: [if], data = [none] } json.endObject(); } }
public class class_name { @Pure public int[] toIntArray() { final int[] tab = new int[this.size]; if (this.values != null) { int idxTab = 0; for (int idxStart = 0; idxStart < this.values.length - 1; idxStart += 2) { for (int n = this.values[idxStart]; n <= this.values[idxStart + 1]; ++n) { tab[idxTab++] = n; } } } return tab; } }
public class class_name { @Pure public int[] toIntArray() { final int[] tab = new int[this.size]; if (this.values != null) { int idxTab = 0; for (int idxStart = 0; idxStart < this.values.length - 1; idxStart += 2) { for (int n = this.values[idxStart]; n <= this.values[idxStart + 1]; ++n) { tab[idxTab++] = n; // depends on control dependency: [for], data = [n] } } } return tab; } }
public class class_name { @Override public Object replaceObject(Object object) { if (object instanceof HibernateProxy) { return ((HibernateProxy) object).getHibernateLazyInitializer().getImplementation(); } return object; } }
public class class_name { @Override public Object replaceObject(Object object) { if (object instanceof HibernateProxy) { return ((HibernateProxy) object).getHibernateLazyInitializer().getImplementation(); // depends on control dependency: [if], data = [none] } return object; } }
public class class_name { public static Document parseBodyFragment(String bodyHtml, String baseUri) { Document doc = Document.createShell(baseUri); Element body = doc.body(); List<Node> nodeList = parseFragment(bodyHtml, body, baseUri); Node[] nodes = nodeList.toArray(new Node[0]); // the node list gets modified when re-parented for (int i = nodes.length - 1; i > 0; i--) { nodes[i].remove(); } for (Node node : nodes) { body.appendChild(node); } return doc; } }
public class class_name { public static Document parseBodyFragment(String bodyHtml, String baseUri) { Document doc = Document.createShell(baseUri); Element body = doc.body(); List<Node> nodeList = parseFragment(bodyHtml, body, baseUri); Node[] nodes = nodeList.toArray(new Node[0]); // the node list gets modified when re-parented for (int i = nodes.length - 1; i > 0; i--) { nodes[i].remove(); // depends on control dependency: [for], data = [i] } for (Node node : nodes) { body.appendChild(node); // depends on control dependency: [for], data = [node] } return doc; } }
public class class_name { public static ExpectedCondition<Boolean> textToBePresentInElementValue(final By locator, final String text) { return new ExpectedCondition<Boolean>() { @Override public Boolean apply(WebDriver driver) { try { String elementText = driver.findElement(locator).getAttribute("value"); if (elementText != null) { return elementText.contains(text); } return false; } catch (StaleElementReferenceException e) { return null; } } @Override public String toString() { return String.format("text ('%s') to be the value of element located by %s", text, locator); } }; } }
public class class_name { public static ExpectedCondition<Boolean> textToBePresentInElementValue(final By locator, final String text) { return new ExpectedCondition<Boolean>() { @Override public Boolean apply(WebDriver driver) { try { String elementText = driver.findElement(locator).getAttribute("value"); if (elementText != null) { return elementText.contains(text); // depends on control dependency: [if], data = [none] } return false; // depends on control dependency: [try], data = [none] } catch (StaleElementReferenceException e) { return null; } // depends on control dependency: [catch], data = [none] } @Override public String toString() { return String.format("text ('%s') to be the value of element located by %s", text, locator); } }; } }
public class class_name { public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { // Special case methods are looked up from a map and invoked. // Do not trace because this includes some basic things like hashcode and equals. // Important special case methods will take care of tracing themselves. WSJdbcProxyMethod methImpl = WSJdbcProxyMethod.getSpecialCase(method); if (methImpl != null) return methImpl.invoke(this, proxy, method, args); // end of special cases TraceComponent tc = getTracer(); if (tc.isEntryEnabled()) Tr.entry(this, tc, toString(proxy, method), args); // Activation should be handled by the wrapper to which we are delegating. Object result = null; boolean isOperationComplete = false; // Invoke on the main wrapper if it has the method. DSConfig config = dsConfig.get(); Set<Method> vendorMethods = mcf.vendorMethods; if (!vendorMethods.contains(method)) try { // Locate the equivalent method on the main wrapper and invoke it. Method wrappedMethod = getClass().getMethod(method.getName(), method.getParameterTypes()); result = wrappedMethod.invoke(this, args); isOperationComplete = true; } catch (NoSuchMethodException methX) { // No FFDC needed. Method doesn't exist on the main wrapper. vendorMethods.add(method); } catch (SecurityException secureX) { // No FFDC needed. Method isn't accessible on the main wrapper. vendorMethods.add(method); } catch (IllegalAccessException accessX) { // No FFDC needed. Method isn't accessible on the main wrapper. vendorMethods.add(method); } catch (InvocationTargetException invokeX) { // Method exists on the main wrapper, and it failed. Throwable x = invokeX.getTargetException(); FFDCFilter.processException(x, getClass().getName() + ".invoke", "134", this); x = x instanceof SQLException ? WSJdbcUtil.mapException(this, (SQLException) x) : x; if (tc.isEntryEnabled()) Tr.exit(this, tc, toString(proxy, method), x); throw x; } // If the main wrapper does not have the method, invoke it directly on the // underlying object. if (!isOperationComplete) { if (tc.isDebugEnabled()) Tr.debug(this, tc, "Operation not found on the main wrapper."); // Filter out unsafe operations. if (!WSJdbcProxyMethod.isSafe(method) // method name || !WSJdbcProxyMethod.isSafeReturnType(method.getReturnType()) // return type && !WSJdbcProxyMethod.overrideUnsafeReturnType(method)) { // Unsafe method. Not permitted. Raise a SQL exception if possible. // Otherwise, raise a runtime exception. Throwable unsafeX = new SQLFeatureNotSupportedException( AdapterUtil.getNLSMessage("OPERATION_NOT_PERMITTED", method.getName())); Throwable x = null; for (Class<?> xType : method.getExceptionTypes()) if (xType.equals(SQLException.class) || xType.equals(SQLFeatureNotSupportedException.class)) { x = unsafeX; break; } if (x == null) x = new RuntimeException(unsafeX); if (tc.isEntryEnabled()) Tr.exit(this, tc, toString(proxy, method), unsafeX); throw x; } // Invoke the operation directly on the underlying implementation. activate(); Object implObject = dynamicWrapperToImpl.get(proxy); // A missing entry in the dynamic-wrapper-to-impl map indicates the wrapper is // either, // 1) Closed because the parent wrapper is closed. // 2) No longer valid due to handle association with a managed connection that // doesn't implement the same vendor interface. if (implObject == null) { String message = AdapterUtil.getNLSMessage("OBJECT_CLOSED", "Wrapper"); Throwable closedX = new SQLRecoverableException(message, "08003", 0); // Raise the SQLException if we can. boolean raisesSQLX = false; for (Class<?> xClass : method.getExceptionTypes()) raisesSQLX |= xClass.equals(SQLException.class); // Otherwise use RuntimeException. if (!raisesSQLX) closedX = new RuntimeException(closedX); if (tc.isEntryEnabled()) Tr.exit(this, tc, toString(proxy, method), closedX); throw closedX; } WSJdbcConnection connWrapper = null; // If configured to do so, attempt to enlist in a transaction or start a new one. if (this instanceof WSJdbcObject) { connWrapper = (WSJdbcConnection) ((WSJdbcObject) this).getConnectionWrapper(); if (connWrapper != null && (dsConfig.get().beginTranForVendorAPIs || WSJdbcProxyMethod.alwaysBeginTranMethods.contains(method.getName()))) connWrapper.beginTransactionIfNecessary(); } try { // Allow the data source to override in order to account for // dynamic configuration changes. result = invokeOperation(implObject, method, args); // If a client information setting was changed, update the managed connection // so that we know to reset the client information before pooling the connection. if (connWrapper != null && WSJdbcProxyMethod.isClientInfoSetter(method.getName())) connWrapper.managedConn.clientInfoExplicitlySet = true; } catch (InvocationTargetException invokeX) { Throwable x = invokeX.getTargetException(); FFDCFilter.processException(x, getClass().getName() + ".invoke", "171", this); x = x instanceof SQLException ? WSJdbcUtil.mapException(this, (SQLException) x) : x; if (tc.isEntryEnabled()) Tr.exit(this, tc, toString(proxy, method), x); throw x; } } // reflection error from invocation attempt on main wrapper if (tc.isEntryEnabled()) Tr.exit(this, tc, toString(proxy, method), result); return result; } }
public class class_name { public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { // Special case methods are looked up from a map and invoked. // Do not trace because this includes some basic things like hashcode and equals. // Important special case methods will take care of tracing themselves. WSJdbcProxyMethod methImpl = WSJdbcProxyMethod.getSpecialCase(method); if (methImpl != null) return methImpl.invoke(this, proxy, method, args); // end of special cases TraceComponent tc = getTracer(); if (tc.isEntryEnabled()) Tr.entry(this, tc, toString(proxy, method), args); // Activation should be handled by the wrapper to which we are delegating. Object result = null; boolean isOperationComplete = false; // Invoke on the main wrapper if it has the method. DSConfig config = dsConfig.get(); Set<Method> vendorMethods = mcf.vendorMethods; if (!vendorMethods.contains(method)) try { // Locate the equivalent method on the main wrapper and invoke it. Method wrappedMethod = getClass().getMethod(method.getName(), method.getParameterTypes()); result = wrappedMethod.invoke(this, args); isOperationComplete = true; } catch (NoSuchMethodException methX) { // No FFDC needed. Method doesn't exist on the main wrapper. vendorMethods.add(method); } catch (SecurityException secureX) { // No FFDC needed. Method isn't accessible on the main wrapper. vendorMethods.add(method); } catch (IllegalAccessException accessX) { // No FFDC needed. Method isn't accessible on the main wrapper. vendorMethods.add(method); } catch (InvocationTargetException invokeX) { // Method exists on the main wrapper, and it failed. Throwable x = invokeX.getTargetException(); FFDCFilter.processException(x, getClass().getName() + ".invoke", "134", this); x = x instanceof SQLException ? WSJdbcUtil.mapException(this, (SQLException) x) : x; if (tc.isEntryEnabled()) Tr.exit(this, tc, toString(proxy, method), x); throw x; } // If the main wrapper does not have the method, invoke it directly on the // underlying object. if (!isOperationComplete) { if (tc.isDebugEnabled()) Tr.debug(this, tc, "Operation not found on the main wrapper."); // Filter out unsafe operations. if (!WSJdbcProxyMethod.isSafe(method) // method name || !WSJdbcProxyMethod.isSafeReturnType(method.getReturnType()) // return type && !WSJdbcProxyMethod.overrideUnsafeReturnType(method)) { // Unsafe method. Not permitted. Raise a SQL exception if possible. // Otherwise, raise a runtime exception. Throwable unsafeX = new SQLFeatureNotSupportedException( AdapterUtil.getNLSMessage("OPERATION_NOT_PERMITTED", method.getName())); Throwable x = null; for (Class<?> xType : method.getExceptionTypes()) if (xType.equals(SQLException.class) || xType.equals(SQLFeatureNotSupportedException.class)) { x = unsafeX; // depends on control dependency: [if], data = [none] break; } if (x == null) x = new RuntimeException(unsafeX); if (tc.isEntryEnabled()) Tr.exit(this, tc, toString(proxy, method), unsafeX); throw x; } // Invoke the operation directly on the underlying implementation. activate(); Object implObject = dynamicWrapperToImpl.get(proxy); // A missing entry in the dynamic-wrapper-to-impl map indicates the wrapper is // either, // 1) Closed because the parent wrapper is closed. // 2) No longer valid due to handle association with a managed connection that // doesn't implement the same vendor interface. if (implObject == null) { String message = AdapterUtil.getNLSMessage("OBJECT_CLOSED", "Wrapper"); Throwable closedX = new SQLRecoverableException(message, "08003", 0); // Raise the SQLException if we can. boolean raisesSQLX = false; for (Class<?> xClass : method.getExceptionTypes()) raisesSQLX |= xClass.equals(SQLException.class); // Otherwise use RuntimeException. if (!raisesSQLX) closedX = new RuntimeException(closedX); if (tc.isEntryEnabled()) Tr.exit(this, tc, toString(proxy, method), closedX); throw closedX; } WSJdbcConnection connWrapper = null; // If configured to do so, attempt to enlist in a transaction or start a new one. if (this instanceof WSJdbcObject) { connWrapper = (WSJdbcConnection) ((WSJdbcObject) this).getConnectionWrapper(); // depends on control dependency: [if], data = [none] if (connWrapper != null && (dsConfig.get().beginTranForVendorAPIs || WSJdbcProxyMethod.alwaysBeginTranMethods.contains(method.getName()))) connWrapper.beginTransactionIfNecessary(); } try { // Allow the data source to override in order to account for // dynamic configuration changes. result = invokeOperation(implObject, method, args); // depends on control dependency: [try], data = [none] // If a client information setting was changed, update the managed connection // so that we know to reset the client information before pooling the connection. if (connWrapper != null && WSJdbcProxyMethod.isClientInfoSetter(method.getName())) connWrapper.managedConn.clientInfoExplicitlySet = true; } catch (InvocationTargetException invokeX) { Throwable x = invokeX.getTargetException(); FFDCFilter.processException(x, getClass().getName() + ".invoke", "171", this); x = x instanceof SQLException ? WSJdbcUtil.mapException(this, (SQLException) x) : x; if (tc.isEntryEnabled()) Tr.exit(this, tc, toString(proxy, method), x); throw x; } // depends on control dependency: [catch], data = [none] } // reflection error from invocation attempt on main wrapper if (tc.isEntryEnabled()) Tr.exit(this, tc, toString(proxy, method), result); return result; } }
public class class_name { public HtmlPolicyBuilder disallowUrlProtocols(String... protocols) { invalidateCompiledState(); for (String protocol : protocols) { protocol = Strings.toLowerCase(protocol); allowedProtocols.remove(protocol); } return this; } }
public class class_name { public HtmlPolicyBuilder disallowUrlProtocols(String... protocols) { invalidateCompiledState(); for (String protocol : protocols) { protocol = Strings.toLowerCase(protocol); // depends on control dependency: [for], data = [protocol] allowedProtocols.remove(protocol); // depends on control dependency: [for], data = [protocol] } return this; } }
public class class_name { protected static void filterProposalsOnPrefix(String prefix, List<ICompletionProposal> props) { if ( prefix != null && prefix.trim().length() > 0 ) { Iterator<ICompletionProposal> iterator = props.iterator(); String prefixLc = prefix.toLowerCase(); while ( iterator.hasNext() ) { ICompletionProposal item = iterator.next(); String content = item.getDisplayString().toLowerCase(); if ( !content.toLowerCase().startsWith( prefixLc ) ) { iterator.remove(); } } } } }
public class class_name { protected static void filterProposalsOnPrefix(String prefix, List<ICompletionProposal> props) { if ( prefix != null && prefix.trim().length() > 0 ) { Iterator<ICompletionProposal> iterator = props.iterator(); String prefixLc = prefix.toLowerCase(); while ( iterator.hasNext() ) { ICompletionProposal item = iterator.next(); String content = item.getDisplayString().toLowerCase(); if ( !content.toLowerCase().startsWith( prefixLc ) ) { iterator.remove(); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { protected boolean isXMLName(String s, boolean xml11Version) { if (s == null) { return false; } if (!xml11Version) return XMLChar.isValidName(s); else return XML11Char.isXML11ValidName(s); } }
public class class_name { protected boolean isXMLName(String s, boolean xml11Version) { if (s == null) { return false; // depends on control dependency: [if], data = [none] } if (!xml11Version) return XMLChar.isValidName(s); else return XML11Char.isXML11ValidName(s); } }
public class class_name { private final String bufferToString(byte[] str) { String string = null; if (str != null) { string = AMF.CHARSET.decode(ByteBuffer.wrap(str)).toString(); log.debug("String: {}", string); } else { log.warn("ByteBuffer was null attempting to read String"); } return string; } }
public class class_name { private final String bufferToString(byte[] str) { String string = null; if (str != null) { string = AMF.CHARSET.decode(ByteBuffer.wrap(str)).toString(); // depends on control dependency: [if], data = [(str] log.debug("String: {}", string); // depends on control dependency: [if], data = [none] } else { log.warn("ByteBuffer was null attempting to read String"); // depends on control dependency: [if], data = [none] } return string; } }
public class class_name { private void clearNioBuffers() { int count = nioBufferCount; if (count > 0) { nioBufferCount = 0; Arrays.fill(NIO_BUFFERS.get(), 0, count, null); } } }
public class class_name { private void clearNioBuffers() { int count = nioBufferCount; if (count > 0) { nioBufferCount = 0; // depends on control dependency: [if], data = [none] Arrays.fill(NIO_BUFFERS.get(), 0, count, null); // depends on control dependency: [if], data = [none] } } }
public class class_name { private ClusterableServer getRandomServer(final List<ServerDescription> serverDescriptions) { while (!serverDescriptions.isEmpty()) { int serverPos = getRandom().nextInt(serverDescriptions.size()); ClusterableServer server = getServer(serverDescriptions.get(serverPos).getAddress()); if (server != null) { return server; } else { serverDescriptions.remove(serverPos); } } return null; } }
public class class_name { private ClusterableServer getRandomServer(final List<ServerDescription> serverDescriptions) { while (!serverDescriptions.isEmpty()) { int serverPos = getRandom().nextInt(serverDescriptions.size()); ClusterableServer server = getServer(serverDescriptions.get(serverPos).getAddress()); if (server != null) { return server; // depends on control dependency: [if], data = [none] } else { serverDescriptions.remove(serverPos); // depends on control dependency: [if], data = [(server] } } return null; } }
public class class_name { public java.util.List<Failure> getFailures() { if (failures == null) { failures = new com.amazonaws.internal.SdkInternalList<Failure>(); } return failures; } }
public class class_name { public java.util.List<Failure> getFailures() { if (failures == null) { failures = new com.amazonaws.internal.SdkInternalList<Failure>(); // depends on control dependency: [if], data = [none] } return failures; } }
public class class_name { public ListOperationsResult withOperations(OperationSummary... operations) { if (this.operations == null) { setOperations(new com.amazonaws.internal.SdkInternalList<OperationSummary>(operations.length)); } for (OperationSummary ele : operations) { this.operations.add(ele); } return this; } }
public class class_name { public ListOperationsResult withOperations(OperationSummary... operations) { if (this.operations == null) { setOperations(new com.amazonaws.internal.SdkInternalList<OperationSummary>(operations.length)); // depends on control dependency: [if], data = [none] } for (OperationSummary ele : operations) { this.operations.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public static String resolve(WebSphereConfig14 config, String raw) { String resolved = raw; StringCharacterIterator itr = new StringCharacterIterator(resolved); int startCount = 0; //how many times have we encountered the start token (EVAL_START_TOKEN) without it being matched by the end token (EVAL_END_TOKEN) int startIndex = -1; //the index of the first start token encountered //loop through the characters in the raw string until there are no more char c = itr.first(); while (c != CharacterIterator.DONE) { //if we enounter the first char in the start token, look for the second one immediately after it if (c == Config14Constants.EVAL_START_TOKEN.charAt(0)) { c = itr.next(); //if we find the second char of the start token as well then record it if (c == Config14Constants.EVAL_START_TOKEN.charAt(1)) { //increase the start token counter startCount++; //record the index of the first start token only if (startIndex == -1) { startIndex = itr.getIndex() - 1; } } else { itr.previous(); } } else if (c == Config14Constants.EVAL_END_TOKEN.charAt(0)) { //if we encounter an end token which is matched by a start token if (startCount > 0) { //decrement the start token counter startCount--; //if all start tokens have been matched with end tokens then we can do some processing if (startCount == 0) { //record the index of the end token int endIndex = itr.getIndex(); //extract the string inbetween the start and the end tokens String propertyName = resolved.substring(startIndex + 2, endIndex); //recursively resolve the property name string to account for nested variables String resolvedPropertyName = resolve(config, propertyName); //once we have the fully resolved property name, find the string value for that property String resolvedValue = (String) config.getValue(resolvedPropertyName, //property name String.class, //conversion type false, //optional null, //default string true); //evaluate variables //extract the part of the raw string which went before and after the variable String prefix = resolved.substring(0, startIndex); String suffix = resolved.substring(endIndex + 1); //stitch it all back together resolved = prefix + resolvedValue + suffix; //work out where processing should resume from (after the variable) int index = prefix.length() + resolvedValue.length() - 1; //reset the iterator itr.setText(resolved); itr.setIndex(index); //clear the start index startIndex = -1; } } } c = itr.next(); //if we get to the end and a start was not matched, skip it and resume just after if ((c == CharacterIterator.DONE) && (startIndex > -1) && (startIndex < raw.length())) { //reset the iterator itr.setIndex(startIndex + 2); //clear the start index startIndex = -1; startCount = 0; //resume c = itr.current(); } } return resolved; } }
public class class_name { public static String resolve(WebSphereConfig14 config, String raw) { String resolved = raw; StringCharacterIterator itr = new StringCharacterIterator(resolved); int startCount = 0; //how many times have we encountered the start token (EVAL_START_TOKEN) without it being matched by the end token (EVAL_END_TOKEN) int startIndex = -1; //the index of the first start token encountered //loop through the characters in the raw string until there are no more char c = itr.first(); while (c != CharacterIterator.DONE) { //if we enounter the first char in the start token, look for the second one immediately after it if (c == Config14Constants.EVAL_START_TOKEN.charAt(0)) { c = itr.next(); // depends on control dependency: [if], data = [none] //if we find the second char of the start token as well then record it if (c == Config14Constants.EVAL_START_TOKEN.charAt(1)) { //increase the start token counter startCount++; // depends on control dependency: [if], data = [none] //record the index of the first start token only if (startIndex == -1) { startIndex = itr.getIndex() - 1; // depends on control dependency: [if], data = [none] } } else { itr.previous(); // depends on control dependency: [if], data = [none] } } else if (c == Config14Constants.EVAL_END_TOKEN.charAt(0)) { //if we encounter an end token which is matched by a start token if (startCount > 0) { //decrement the start token counter startCount--; // depends on control dependency: [if], data = [none] //if all start tokens have been matched with end tokens then we can do some processing if (startCount == 0) { //record the index of the end token int endIndex = itr.getIndex(); //extract the string inbetween the start and the end tokens String propertyName = resolved.substring(startIndex + 2, endIndex); //recursively resolve the property name string to account for nested variables String resolvedPropertyName = resolve(config, propertyName); //once we have the fully resolved property name, find the string value for that property String resolvedValue = (String) config.getValue(resolvedPropertyName, //property name String.class, //conversion type false, //optional null, //default string true); //evaluate variables //extract the part of the raw string which went before and after the variable String prefix = resolved.substring(0, startIndex); String suffix = resolved.substring(endIndex + 1); //stitch it all back together resolved = prefix + resolvedValue + suffix; // depends on control dependency: [if], data = [none] //work out where processing should resume from (after the variable) int index = prefix.length() + resolvedValue.length() - 1; //reset the iterator itr.setText(resolved); // depends on control dependency: [if], data = [none] itr.setIndex(index); // depends on control dependency: [if], data = [none] //clear the start index startIndex = -1; // depends on control dependency: [if], data = [none] } } } c = itr.next(); // depends on control dependency: [while], data = [none] //if we get to the end and a start was not matched, skip it and resume just after if ((c == CharacterIterator.DONE) && (startIndex > -1) && (startIndex < raw.length())) { //reset the iterator itr.setIndex(startIndex + 2); // depends on control dependency: [if], data = [none] //clear the start index startIndex = -1; // depends on control dependency: [if], data = [none] startCount = 0; // depends on control dependency: [if], data = [none] //resume c = itr.current(); // depends on control dependency: [if], data = [none] } } return resolved; } }
public class class_name { public String toQueryString() { StringBuilder result = new StringBuilder(); if ((null != parameters) && !parameters.isEmpty()) { result.append("?"); Iterator<Entry<String, List<String>>> iterator = parameters.entrySet().iterator(); while (iterator.hasNext()) { Entry<String, List<String>> entry = iterator.next(); String key = entry.getKey(); List<String> values = entry.getValue(); if ((key != null) && !"".equals(key)) { result.append(key); if ((values != null) && !values.isEmpty()) { for (int i = 0; i < values.size(); i++) { String value = values.get(i); if ((value != null) && !"".equals(value)) { result.append("=" + value); } else if ((value != null) && "".equals(value)) { result.append("="); } if (i < (values.size() - 1)) { result.append("&" + key); } } } } if (iterator.hasNext()) { result.append("&"); } } } return result.toString(); } }
public class class_name { public String toQueryString() { StringBuilder result = new StringBuilder(); if ((null != parameters) && !parameters.isEmpty()) { result.append("?"); // depends on control dependency: [if], data = [none] Iterator<Entry<String, List<String>>> iterator = parameters.entrySet().iterator(); while (iterator.hasNext()) { Entry<String, List<String>> entry = iterator.next(); String key = entry.getKey(); List<String> values = entry.getValue(); if ((key != null) && !"".equals(key)) { result.append(key); // depends on control dependency: [if], data = [none] if ((values != null) && !values.isEmpty()) { for (int i = 0; i < values.size(); i++) { String value = values.get(i); if ((value != null) && !"".equals(value)) { result.append("=" + value); // depends on control dependency: [if], data = [none] } else if ((value != null) && "".equals(value)) { result.append("="); // depends on control dependency: [if], data = [none] } if (i < (values.size() - 1)) { result.append("&" + key); // depends on control dependency: [if], data = [none] } } } } if (iterator.hasNext()) { result.append("&"); // depends on control dependency: [if], data = [none] } } } return result.toString(); } }
public class class_name { public Set<Object> getAllSources() { Set<Object> allSources = new LinkedHashSet<>(); if (!CollectionUtils.isEmpty(this.primarySources)) { allSources.addAll(this.primarySources); } if (!CollectionUtils.isEmpty(this.sources)) { allSources.addAll(this.sources); } return Collections.unmodifiableSet(allSources); } }
public class class_name { public Set<Object> getAllSources() { Set<Object> allSources = new LinkedHashSet<>(); if (!CollectionUtils.isEmpty(this.primarySources)) { allSources.addAll(this.primarySources); // depends on control dependency: [if], data = [none] } if (!CollectionUtils.isEmpty(this.sources)) { allSources.addAll(this.sources); // depends on control dependency: [if], data = [none] } return Collections.unmodifiableSet(allSources); } }
public class class_name { @Deprecated public void add(String route, String acceptType, Object target) { try { int singleQuoteIndex = route.indexOf(SINGLE_QUOTE); String httpMethod = route.substring(0, singleQuoteIndex).trim().toLowerCase(); // NOSONAR String url = route.substring(singleQuoteIndex + 1, route.length() - 1).trim(); // NOSONAR // Use special enum stuff to get from value HttpMethod method; try { method = HttpMethod.valueOf(httpMethod); } catch (IllegalArgumentException e) { LOG.error("The @Route value: " + route + " has an invalid HTTP method part: " + httpMethod + "."); return; } add(method, url, acceptType, target); } catch (Exception e) { LOG.error("The @Route value: " + route + " is not in the correct format", e); } } }
public class class_name { @Deprecated public void add(String route, String acceptType, Object target) { try { int singleQuoteIndex = route.indexOf(SINGLE_QUOTE); String httpMethod = route.substring(0, singleQuoteIndex).trim().toLowerCase(); // NOSONAR String url = route.substring(singleQuoteIndex + 1, route.length() - 1).trim(); // NOSONAR // Use special enum stuff to get from value HttpMethod method; try { method = HttpMethod.valueOf(httpMethod); // depends on control dependency: [try], data = [none] } catch (IllegalArgumentException e) { LOG.error("The @Route value: " + route + " has an invalid HTTP method part: " + httpMethod + "."); return; } // depends on control dependency: [catch], data = [none] add(method, url, acceptType, target); // depends on control dependency: [try], data = [none] } catch (Exception e) { LOG.error("The @Route value: " + route + " is not in the correct format", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public List<AclEntry> getEntries() { ImmutableList.Builder<AclEntry> builder = new ImmutableList.Builder<>(); for (Map.Entry<String, AclActions> kv : mNamedUserActions.entrySet()) { builder.add(new AclEntry.Builder() .setType(AclEntryType.NAMED_USER) .setSubject(kv.getKey()) .setActions(kv.getValue()) .build()); } for (Map.Entry<String, AclActions> kv : mNamedGroupActions.entrySet()) { builder.add(new AclEntry.Builder() .setType(AclEntryType.NAMED_GROUP) .setSubject(kv.getKey()) .setActions(kv.getValue()) .build()); } if (hasExtended()) { // The mask is only relevant if the ACL contains extended entries. builder.add(new AclEntry.Builder() .setType(AclEntryType.MASK) .setActions(mMaskActions) .build()); } return builder.build(); } }
public class class_name { public List<AclEntry> getEntries() { ImmutableList.Builder<AclEntry> builder = new ImmutableList.Builder<>(); for (Map.Entry<String, AclActions> kv : mNamedUserActions.entrySet()) { builder.add(new AclEntry.Builder() .setType(AclEntryType.NAMED_USER) .setSubject(kv.getKey()) .setActions(kv.getValue()) .build()); // depends on control dependency: [for], data = [none] } for (Map.Entry<String, AclActions> kv : mNamedGroupActions.entrySet()) { builder.add(new AclEntry.Builder() .setType(AclEntryType.NAMED_GROUP) .setSubject(kv.getKey()) .setActions(kv.getValue()) .build()); // depends on control dependency: [for], data = [none] } if (hasExtended()) { // The mask is only relevant if the ACL contains extended entries. builder.add(new AclEntry.Builder() .setType(AclEntryType.MASK) .setActions(mMaskActions) .build()); // depends on control dependency: [if], data = [none] } return builder.build(); } }
public class class_name { public static int nextInt(Random random, int min, int max) { Validate.isTrue(max >= min, "Start value must be smaller or equal to end value."); MoreValidate.nonNegative("min", min); if (min == max) { return min; } return min + random.nextInt(max - min); } }
public class class_name { public static int nextInt(Random random, int min, int max) { Validate.isTrue(max >= min, "Start value must be smaller or equal to end value."); MoreValidate.nonNegative("min", min); if (min == max) { return min; // depends on control dependency: [if], data = [none] } return min + random.nextInt(max - min); } }
public class class_name { @Override public Object getStatusProperty(String key) { if (key.equals(AVERAGE_EXECUTION_TIME)) { return (getAverageExecutionTime()); } else if (key.equals(MAX_QUEUE_SIZE)) { return (getMaxQueueSize()); } else if (key.equals(EXECUTION_STATUS)) { // TODO. } return null; } }
public class class_name { @Override public Object getStatusProperty(String key) { if (key.equals(AVERAGE_EXECUTION_TIME)) { return (getAverageExecutionTime()); // depends on control dependency: [if], data = [none] } else if (key.equals(MAX_QUEUE_SIZE)) { return (getMaxQueueSize()); // depends on control dependency: [if], data = [none] } else if (key.equals(EXECUTION_STATUS)) { // TODO. } return null; } }
public class class_name { @Override public boolean dateRange(Object day1, Object month1, Object year1, Object day2, Object month2, Object year2, Object gmt) { // Guess the parameter meanings. Map<String, Integer> params = new HashMap<String, Integer>(); parseDateParam(params, day1); parseDateParam(params, month1); parseDateParam(params, year1); parseDateParam(params, day2); parseDateParam(params, month2); parseDateParam(params, year2); parseDateParam(params, gmt); // Get current date boolean useGmt = params.get("gmt") != null; Calendar cal = getCurrentTime(useGmt); Date current = cal.getTime(); // Build the "from" date if (params.get("day1") != null) { cal.set(Calendar.DAY_OF_MONTH, params.get("day1")); } if (params.get("month1") != null) { cal.set(Calendar.MONTH, params.get("month1")); } if (params.get("year1") != null) { cal.set(Calendar.YEAR, params.get("year1")); } Date from = cal.getTime(); // Build the "to" date Date to; if (params.get("day2") != null) { cal.set(Calendar.DAY_OF_MONTH, params.get("day2")); } if (params.get("month2") != null) { cal.set(Calendar.MONTH, params.get("month2")); } if (params.get("year2") != null) { cal.set(Calendar.YEAR, params.get("year2")); } to = cal.getTime(); // Need to increment to the next month? if (to.before(from)) { cal.add(Calendar.MONTH, +1); to = cal.getTime(); } // Need to increment to the next year? if (to.before(from)) { cal.add(Calendar.YEAR, +1); cal.add(Calendar.MONTH, -1); to = cal.getTime(); } return current.compareTo(from) >= 0 && current.compareTo(to) <= 0; } }
public class class_name { @Override public boolean dateRange(Object day1, Object month1, Object year1, Object day2, Object month2, Object year2, Object gmt) { // Guess the parameter meanings. Map<String, Integer> params = new HashMap<String, Integer>(); parseDateParam(params, day1); parseDateParam(params, month1); parseDateParam(params, year1); parseDateParam(params, day2); parseDateParam(params, month2); parseDateParam(params, year2); parseDateParam(params, gmt); // Get current date boolean useGmt = params.get("gmt") != null; Calendar cal = getCurrentTime(useGmt); Date current = cal.getTime(); // Build the "from" date if (params.get("day1") != null) { cal.set(Calendar.DAY_OF_MONTH, params.get("day1")); // depends on control dependency: [if], data = [none] } if (params.get("month1") != null) { cal.set(Calendar.MONTH, params.get("month1")); // depends on control dependency: [if], data = [none] } if (params.get("year1") != null) { cal.set(Calendar.YEAR, params.get("year1")); // depends on control dependency: [if], data = [none] } Date from = cal.getTime(); // Build the "to" date Date to; if (params.get("day2") != null) { cal.set(Calendar.DAY_OF_MONTH, params.get("day2")); // depends on control dependency: [if], data = [none] } if (params.get("month2") != null) { cal.set(Calendar.MONTH, params.get("month2")); // depends on control dependency: [if], data = [none] } if (params.get("year2") != null) { cal.set(Calendar.YEAR, params.get("year2")); // depends on control dependency: [if], data = [none] } to = cal.getTime(); // Need to increment to the next month? if (to.before(from)) { cal.add(Calendar.MONTH, +1); // depends on control dependency: [if], data = [none] to = cal.getTime(); // depends on control dependency: [if], data = [none] } // Need to increment to the next year? if (to.before(from)) { cal.add(Calendar.YEAR, +1); // depends on control dependency: [if], data = [none] cal.add(Calendar.MONTH, -1); // depends on control dependency: [if], data = [none] to = cal.getTime(); // depends on control dependency: [if], data = [none] } return current.compareTo(from) >= 0 && current.compareTo(to) <= 0; } }
public class class_name { @Override protected void selectRectangle(Bbox selectedArea) { // we can clear here ! if (!shiftOrCtrl) { MapModel mapModel = mapWidget.getMapModel(); mapModel.clearSelectedFeatures(); } GwtCommand commandRequest = new GwtCommand(SearchByLocationRequest.COMMAND); SearchByLocationRequest request = new SearchByLocationRequest(); request.setLayerIds(getSelectionLayerIds()); for (Layer<?> layer : mapWidget.getMapModel().getLayers()) { if (layer.isShowing() && layer instanceof VectorLayer) { request.setFilter(layer.getServerLayerId(), ((VectorLayer) layer).getFilter()); } } Polygon polygon = mapWidget.getMapModel().getGeometryFactory().createPolygon(selectedArea); request.setLocation(GeometryConverter.toDto(polygon)); request.setCrs(mapWidget.getMapModel().getCrs()); request.setQueryType(SearchByLocationRequest.QUERY_INTERSECTS); request.setRatio(coverageRatio); request.setSearchType(SearchByLocationRequest.SEARCH_ALL_LAYERS); request.setFeatureIncludes(GwtCommandDispatcher.getInstance().getLazyFeatureIncludesSelect()); commandRequest.setCommandRequest(request); GwtCommandDispatcher.getInstance().execute(commandRequest, new AbstractCommandCallback<SearchByLocationResponse>() { public void execute(SearchByLocationResponse response) { Map<String, List<org.geomajas.layer.feature.Feature>> featureMap = response.getFeatureMap(); for (String layerId : featureMap.keySet()) { selectFeatures(layerId, featureMap.get(layerId)); } } }); } }
public class class_name { @Override protected void selectRectangle(Bbox selectedArea) { // we can clear here ! if (!shiftOrCtrl) { MapModel mapModel = mapWidget.getMapModel(); mapModel.clearSelectedFeatures(); // depends on control dependency: [if], data = [none] } GwtCommand commandRequest = new GwtCommand(SearchByLocationRequest.COMMAND); SearchByLocationRequest request = new SearchByLocationRequest(); request.setLayerIds(getSelectionLayerIds()); for (Layer<?> layer : mapWidget.getMapModel().getLayers()) { if (layer.isShowing() && layer instanceof VectorLayer) { request.setFilter(layer.getServerLayerId(), ((VectorLayer) layer).getFilter()); // depends on control dependency: [if], data = [none] } } Polygon polygon = mapWidget.getMapModel().getGeometryFactory().createPolygon(selectedArea); request.setLocation(GeometryConverter.toDto(polygon)); request.setCrs(mapWidget.getMapModel().getCrs()); request.setQueryType(SearchByLocationRequest.QUERY_INTERSECTS); request.setRatio(coverageRatio); request.setSearchType(SearchByLocationRequest.SEARCH_ALL_LAYERS); request.setFeatureIncludes(GwtCommandDispatcher.getInstance().getLazyFeatureIncludesSelect()); commandRequest.setCommandRequest(request); GwtCommandDispatcher.getInstance().execute(commandRequest, new AbstractCommandCallback<SearchByLocationResponse>() { public void execute(SearchByLocationResponse response) { Map<String, List<org.geomajas.layer.feature.Feature>> featureMap = response.getFeatureMap(); for (String layerId : featureMap.keySet()) { selectFeatures(layerId, featureMap.get(layerId)); // depends on control dependency: [for], data = [layerId] } } }); } }
public class class_name { public void marshall(DisassociateKmsKeyRequest disassociateKmsKeyRequest, ProtocolMarshaller protocolMarshaller) { if (disassociateKmsKeyRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(disassociateKmsKeyRequest.getLogGroupName(), LOGGROUPNAME_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DisassociateKmsKeyRequest disassociateKmsKeyRequest, ProtocolMarshaller protocolMarshaller) { if (disassociateKmsKeyRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(disassociateKmsKeyRequest.getLogGroupName(), LOGGROUPNAME_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 int getUnsignedMediumInt() { int b1 = getUnsigned(); int b2 = getUnsigned(); int b3 = getUnsigned(); if (_isBigEndian) { return (b1<<16) | (b2<<8) | b3; } else { return (b3<<16) | (b2<<8) | b1; } } }
public class class_name { public int getUnsignedMediumInt() { int b1 = getUnsigned(); int b2 = getUnsigned(); int b3 = getUnsigned(); if (_isBigEndian) { return (b1<<16) | (b2<<8) | b3; // depends on control dependency: [if], data = [none] } else { return (b3<<16) | (b2<<8) | b1; // depends on control dependency: [if], data = [none] } } }
public class class_name { protected static double luby(double y, int x) { int intX = x; int size = 1; int seq = 0; while (size < intX + 1) { seq++; size = 2 * size + 1; } while (size - 1 != intX) { size = (size - 1) >> 1; seq--; intX = intX % size; } return Math.pow(y, seq); } }
public class class_name { protected static double luby(double y, int x) { int intX = x; int size = 1; int seq = 0; while (size < intX + 1) { seq++; // depends on control dependency: [while], data = [none] size = 2 * size + 1; // depends on control dependency: [while], data = [none] } while (size - 1 != intX) { size = (size - 1) >> 1; // depends on control dependency: [while], data = [(size - 1] seq--; // depends on control dependency: [while], data = [none] intX = intX % size; // depends on control dependency: [while], data = [none] } return Math.pow(y, seq); } }
public class class_name { public void add(HpackHeaderField header) { int headerSize = header.size(); if (headerSize > capacity) { clear(); return; } while (capacity - size < headerSize) { remove(); } hpackHeaderFields[head++] = header; size += header.size(); if (head == hpackHeaderFields.length) { head = 0; } } }
public class class_name { public void add(HpackHeaderField header) { int headerSize = header.size(); if (headerSize > capacity) { clear(); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } while (capacity - size < headerSize) { remove(); // depends on control dependency: [while], data = [none] } hpackHeaderFields[head++] = header; size += header.size(); if (head == hpackHeaderFields.length) { head = 0; // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public void setNextPageID(int next_page_id) { this.nextPageID = next_page_id; while(!emptyPages.isEmpty() && emptyPages.peek() >= this.nextPageID) { emptyPages.pop(); } } }
public class class_name { @Override public void setNextPageID(int next_page_id) { this.nextPageID = next_page_id; while(!emptyPages.isEmpty() && emptyPages.peek() >= this.nextPageID) { emptyPages.pop(); // depends on control dependency: [while], data = [none] } } }
public class class_name { private Version getClusterOrNodeVersion() { if (node.getClusterService() != null && !node.getClusterService().getClusterVersion().isUnknown()) { return node.getClusterService().getClusterVersion(); } else { String overriddenClusterVersion = node.getProperties().getString(GroupProperty.INIT_CLUSTER_VERSION); return (overriddenClusterVersion != null) ? MemberVersion.of(overriddenClusterVersion).asVersion() : node.getVersion().asVersion(); } } }
public class class_name { private Version getClusterOrNodeVersion() { if (node.getClusterService() != null && !node.getClusterService().getClusterVersion().isUnknown()) { return node.getClusterService().getClusterVersion(); // depends on control dependency: [if], data = [none] } else { String overriddenClusterVersion = node.getProperties().getString(GroupProperty.INIT_CLUSTER_VERSION); return (overriddenClusterVersion != null) ? MemberVersion.of(overriddenClusterVersion).asVersion() : node.getVersion().asVersion(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void setWarnings(String warnings) { try { deprecationWarnings = CompilerOptions.DeprecationWarnings .fromString(warnings); } catch (IllegalArgumentException e) { throw new BuildException("invalid value for warnings: " + warnings); } } }
public class class_name { public void setWarnings(String warnings) { try { deprecationWarnings = CompilerOptions.DeprecationWarnings .fromString(warnings); // depends on control dependency: [try], data = [none] } catch (IllegalArgumentException e) { throw new BuildException("invalid value for warnings: " + warnings); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private IContext buildCLabs(IContext context) throws ContextPreprocessorException { int counter = 0; int total = context.getRoot().getDescendantCount() + 1; int reportInt = (total / 20) + 1;//i.e. report every 5% for (Iterator<INode> i = context.getNodes(); i.hasNext(); ) { processNode(i.next()); counter++; if ((SMatchConstants.LARGE_TREE < total) && (0 == (counter % reportInt)) && log.isEnabledFor(Level.INFO)) { log.info(100 * counter / total + "%"); } } return context; } }
public class class_name { private IContext buildCLabs(IContext context) throws ContextPreprocessorException { int counter = 0; int total = context.getRoot().getDescendantCount() + 1; int reportInt = (total / 20) + 1;//i.e. report every 5% for (Iterator<INode> i = context.getNodes(); i.hasNext(); ) { processNode(i.next()); counter++; if ((SMatchConstants.LARGE_TREE < total) && (0 == (counter % reportInt)) && log.isEnabledFor(Level.INFO)) { log.info(100 * counter / total + "%"); // depends on control dependency: [if], data = [none] } } return context; } }
public class class_name { private void deliverDeviceUpdate(final DeviceUpdate update) { for (DeviceUpdateListener listener : getUpdateListeners()) { try { listener.received(update); } catch (Throwable t) { logger.warn("Problem delivering device update to listener", t); } } } }
public class class_name { private void deliverDeviceUpdate(final DeviceUpdate update) { for (DeviceUpdateListener listener : getUpdateListeners()) { try { listener.received(update); // depends on control dependency: [try], data = [none] } catch (Throwable t) { logger.warn("Problem delivering device update to listener", t); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { @SuppressWarnings("unchecked") private <T extends Request> void resendRequest(Throwable cause, T request, BiFunction sender, Connection connection, CompletableFuture future) { // If the connection has not changed, reset it and connect to the next server. if (this.connection == connection) { LOGGER.trace("{} - Resetting connection. Reason: {}", id, cause); this.connection = null; connection.close(); } // Create a new connection and resend the request. This will force retries to piggyback on any existing // connect attempts. connect().whenComplete((c, e) -> sendRequest(request, sender, c, e, future)); } }
public class class_name { @SuppressWarnings("unchecked") private <T extends Request> void resendRequest(Throwable cause, T request, BiFunction sender, Connection connection, CompletableFuture future) { // If the connection has not changed, reset it and connect to the next server. if (this.connection == connection) { LOGGER.trace("{} - Resetting connection. Reason: {}", id, cause); // depends on control dependency: [if], data = [none] this.connection = null; // depends on control dependency: [if], data = [none] connection.close(); // depends on control dependency: [if], data = [none] } // Create a new connection and resend the request. This will force retries to piggyback on any existing // connect attempts. connect().whenComplete((c, e) -> sendRequest(request, sender, c, e, future)); } }
public class class_name { @Override public String getJwtCookieName() { // TODO Auto-generated method stub JwtSsoBuilderConfig jwtssobuilderConfig = getJwtSSOBuilderConfig(); if (jwtssobuilderConfig != null) { return jwtssobuilderConfig.getCookieName(); } return null; } }
public class class_name { @Override public String getJwtCookieName() { // TODO Auto-generated method stub JwtSsoBuilderConfig jwtssobuilderConfig = getJwtSSOBuilderConfig(); if (jwtssobuilderConfig != null) { return jwtssobuilderConfig.getCookieName(); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public Observable<ServiceResponse<Page<RoleAssignmentInner>>> listForScopeSinglePageAsync(final String scope, final String filter) { if (scope == null) { throw new IllegalArgumentException("Parameter scope is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.listForScope(scope, filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<RoleAssignmentInner>>>>() { @Override public Observable<ServiceResponse<Page<RoleAssignmentInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl<RoleAssignmentInner>> result = listForScopeDelegate(response); return Observable.just(new ServiceResponse<Page<RoleAssignmentInner>>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } } }); } }
public class class_name { public Observable<ServiceResponse<Page<RoleAssignmentInner>>> listForScopeSinglePageAsync(final String scope, final String filter) { if (scope == null) { throw new IllegalArgumentException("Parameter scope is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.listForScope(scope, filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<RoleAssignmentInner>>>>() { @Override public Observable<ServiceResponse<Page<RoleAssignmentInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl<RoleAssignmentInner>> result = listForScopeDelegate(response); return Observable.just(new ServiceResponse<Page<RoleAssignmentInner>>(result.body(), result.response())); // depends on control dependency: [try], data = [none] } catch (Throwable t) { return Observable.error(t); } // depends on control dependency: [catch], data = [none] } }); } }
public class class_name { private static String toBinaryString(int word) { String lsb = Integer.toBinaryString(word); StringBuilder pad = new StringBuilder(); for (int i = lsb.length(); i < 32; i++) { pad.append('0'); } return pad.append(lsb).toString(); } }
public class class_name { private static String toBinaryString(int word) { String lsb = Integer.toBinaryString(word); StringBuilder pad = new StringBuilder(); for (int i = lsb.length(); i < 32; i++) { pad.append('0'); // depends on control dependency: [for], data = [none] } return pad.append(lsb).toString(); } }
public class class_name { private synchronized void getAllPreviousOffsetState(SourceState state) { if (this.doneGettingAllPreviousOffsets) { return; } this.previousOffsets.clear(); this.previousLowWatermarks.clear(); this.previousExpectedHighWatermarks.clear(); this.previousOffsetFetchEpochTimes.clear(); this.previousStartFetchEpochTimes.clear(); this.previousStopFetchEpochTimes.clear(); Map<String, Iterable<WorkUnitState>> workUnitStatesByDatasetUrns = state.getPreviousWorkUnitStatesByDatasetUrns(); if (!workUnitStatesByDatasetUrns.isEmpty() && !(workUnitStatesByDatasetUrns.size() == 1 && workUnitStatesByDatasetUrns.keySet().iterator().next() .equals(""))) { this.isDatasetStateEnabled.set(true); } for (WorkUnitState workUnitState : state.getPreviousWorkUnitStates()) { List<KafkaPartition> partitions = KafkaUtils.getPartitions(workUnitState); WorkUnit workUnit = workUnitState.getWorkunit(); MultiLongWatermark watermark = workUnitState.getActualHighWatermark(MultiLongWatermark.class); MultiLongWatermark previousLowWatermark = workUnit.getLowWatermark(MultiLongWatermark.class); MultiLongWatermark previousExpectedHighWatermark = workUnit.getExpectedHighWatermark(MultiLongWatermark.class); Preconditions.checkArgument(partitions.size() == watermark.size(), String .format("Num of partitions doesn't match number of watermarks: partitions=%s, watermarks=%s", partitions, watermark)); for (int i = 0; i < partitions.size(); i++) { KafkaPartition partition = partitions.get(i); if (watermark.get(i) != ConfigurationKeys.DEFAULT_WATERMARK_VALUE) { this.previousOffsets.put(partition, watermark.get(i)); } if (previousLowWatermark.get(i) != ConfigurationKeys.DEFAULT_WATERMARK_VALUE) { this.previousLowWatermarks.put(partition, previousLowWatermark.get(i)); } if (previousExpectedHighWatermark.get(i) != ConfigurationKeys.DEFAULT_WATERMARK_VALUE) { this.previousExpectedHighWatermarks.put(partition, previousExpectedHighWatermark.get(i)); } this.previousOffsetFetchEpochTimes.put(partition, KafkaUtils.getPropAsLongFromSingleOrMultiWorkUnitState(workUnitState, OFFSET_FETCH_EPOCH_TIME, i)); this.previousStartFetchEpochTimes.put(partition, KafkaUtils.getPropAsLongFromSingleOrMultiWorkUnitState(workUnitState, START_FETCH_EPOCH_TIME, i)); this.previousStopFetchEpochTimes.put(partition, KafkaUtils.getPropAsLongFromSingleOrMultiWorkUnitState(workUnitState, STOP_FETCH_EPOCH_TIME, i)); } } this.doneGettingAllPreviousOffsets = true; } }
public class class_name { private synchronized void getAllPreviousOffsetState(SourceState state) { if (this.doneGettingAllPreviousOffsets) { return; // depends on control dependency: [if], data = [none] } this.previousOffsets.clear(); this.previousLowWatermarks.clear(); this.previousExpectedHighWatermarks.clear(); this.previousOffsetFetchEpochTimes.clear(); this.previousStartFetchEpochTimes.clear(); this.previousStopFetchEpochTimes.clear(); Map<String, Iterable<WorkUnitState>> workUnitStatesByDatasetUrns = state.getPreviousWorkUnitStatesByDatasetUrns(); if (!workUnitStatesByDatasetUrns.isEmpty() && !(workUnitStatesByDatasetUrns.size() == 1 && workUnitStatesByDatasetUrns.keySet().iterator().next() .equals(""))) { this.isDatasetStateEnabled.set(true); // depends on control dependency: [if], data = [none] } for (WorkUnitState workUnitState : state.getPreviousWorkUnitStates()) { List<KafkaPartition> partitions = KafkaUtils.getPartitions(workUnitState); WorkUnit workUnit = workUnitState.getWorkunit(); MultiLongWatermark watermark = workUnitState.getActualHighWatermark(MultiLongWatermark.class); MultiLongWatermark previousLowWatermark = workUnit.getLowWatermark(MultiLongWatermark.class); MultiLongWatermark previousExpectedHighWatermark = workUnit.getExpectedHighWatermark(MultiLongWatermark.class); Preconditions.checkArgument(partitions.size() == watermark.size(), String .format("Num of partitions doesn't match number of watermarks: partitions=%s, watermarks=%s", partitions, watermark)); // depends on control dependency: [for], data = [none] for (int i = 0; i < partitions.size(); i++) { KafkaPartition partition = partitions.get(i); if (watermark.get(i) != ConfigurationKeys.DEFAULT_WATERMARK_VALUE) { this.previousOffsets.put(partition, watermark.get(i)); // depends on control dependency: [if], data = [none] } if (previousLowWatermark.get(i) != ConfigurationKeys.DEFAULT_WATERMARK_VALUE) { this.previousLowWatermarks.put(partition, previousLowWatermark.get(i)); // depends on control dependency: [if], data = [none] } if (previousExpectedHighWatermark.get(i) != ConfigurationKeys.DEFAULT_WATERMARK_VALUE) { this.previousExpectedHighWatermarks.put(partition, previousExpectedHighWatermark.get(i)); // depends on control dependency: [if], data = [none] } this.previousOffsetFetchEpochTimes.put(partition, KafkaUtils.getPropAsLongFromSingleOrMultiWorkUnitState(workUnitState, OFFSET_FETCH_EPOCH_TIME, i)); // depends on control dependency: [for], data = [none] this.previousStartFetchEpochTimes.put(partition, KafkaUtils.getPropAsLongFromSingleOrMultiWorkUnitState(workUnitState, START_FETCH_EPOCH_TIME, i)); // depends on control dependency: [for], data = [none] this.previousStopFetchEpochTimes.put(partition, KafkaUtils.getPropAsLongFromSingleOrMultiWorkUnitState(workUnitState, STOP_FETCH_EPOCH_TIME, i)); // depends on control dependency: [for], data = [none] } } this.doneGettingAllPreviousOffsets = true; } }
public class class_name { private static String normalizeArrayNotation(String type) { int arrayDimensions = 0; while (type.endsWith("[]")) { type = type.substring(0, type.length() - 2); arrayDimensions++; } if (arrayDimensions == 0) { return type; } else { String arraySignature = Primitives.getArraySignature(type); if (arraySignature != null) { type = arraySignature; } else { type = "[L" + type + ";"; } for (int i = 1; i < arrayDimensions; i++) { type = "[" + type; } return type; } } }
public class class_name { private static String normalizeArrayNotation(String type) { int arrayDimensions = 0; while (type.endsWith("[]")) { type = type.substring(0, type.length() - 2); // depends on control dependency: [while], data = [none] arrayDimensions++; // depends on control dependency: [while], data = [none] } if (arrayDimensions == 0) { return type; // depends on control dependency: [if], data = [none] } else { String arraySignature = Primitives.getArraySignature(type); if (arraySignature != null) { type = arraySignature; // depends on control dependency: [if], data = [none] } else { type = "[L" + type + ";"; // depends on control dependency: [if], data = [none] } for (int i = 1; i < arrayDimensions; i++) { type = "[" + type; // depends on control dependency: [for], data = [none] } return type; // depends on control dependency: [if], data = [none] } } }
public class class_name { static boolean isEscaped(final String characters, final int position) { int p = position; int nbBackslash = 0; while (p > 0 && characters.charAt(--p) == '\\') { nbBackslash++; } return (nbBackslash % 2 == 1); } }
public class class_name { static boolean isEscaped(final String characters, final int position) { int p = position; int nbBackslash = 0; while (p > 0 && characters.charAt(--p) == '\\') { nbBackslash++; // depends on control dependency: [while], data = [none] } return (nbBackslash % 2 == 1); } }
public class class_name { @SafeVarargs public final static Observable<WatchService> watchService(final File file, final Kind<?>... kinds) { return Observable.defer(new Func0<Observable<WatchService>>() { @Override public Observable<WatchService> call() { try { final Path path = getBasePath(file); WatchService watchService = path.getFileSystem().newWatchService(); path.register(watchService, kinds); return Observable.just(watchService); } catch (Exception e) { return Observable.error(e); } } }); } }
public class class_name { @SafeVarargs public final static Observable<WatchService> watchService(final File file, final Kind<?>... kinds) { return Observable.defer(new Func0<Observable<WatchService>>() { @Override public Observable<WatchService> call() { try { final Path path = getBasePath(file); WatchService watchService = path.getFileSystem().newWatchService(); path.register(watchService, kinds); // depends on control dependency: [try], data = [none] return Observable.just(watchService); // depends on control dependency: [try], data = [none] } catch (Exception e) { return Observable.error(e); } // depends on control dependency: [catch], data = [none] } }); } }
public class class_name { @Override public String getRemoteAddr() { String addr = this.connection.getRemoteHostAddress(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "getRemoteAddr: " + addr); } return addr; } }
public class class_name { @Override public String getRemoteAddr() { String addr = this.connection.getRemoteHostAddress(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "getRemoteAddr: " + addr); // depends on control dependency: [if], data = [none] } return addr; } }
public class class_name { public static BitfinexOrderBookSymbol fromJSON(final JSONObject jsonObject) { BitfinexCurrencyPair symbol = BitfinexCurrencyPair.fromSymbolString(jsonObject.getString("symbol")); Precision prec = Precision.valueOf(jsonObject.getString("prec")); Frequency freq = null; Integer len = null; if (prec != Precision.R0) { freq = Frequency.valueOf(jsonObject.getString("freq")); len = jsonObject.getInt("len"); } return new BitfinexOrderBookSymbol(symbol, prec, freq, len); } }
public class class_name { public static BitfinexOrderBookSymbol fromJSON(final JSONObject jsonObject) { BitfinexCurrencyPair symbol = BitfinexCurrencyPair.fromSymbolString(jsonObject.getString("symbol")); Precision prec = Precision.valueOf(jsonObject.getString("prec")); Frequency freq = null; Integer len = null; if (prec != Precision.R0) { freq = Frequency.valueOf(jsonObject.getString("freq")); // depends on control dependency: [if], data = [none] len = jsonObject.getInt("len"); // depends on control dependency: [if], data = [none] } return new BitfinexOrderBookSymbol(symbol, prec, freq, len); } }
public class class_name { protected void renderBitmapImage( BitmapMode mode , ImageBase image ) { switch( mode ) { case UNSAFE: { if (image.getWidth() == bitmap.getWidth() && image.getHeight() == bitmap.getHeight()) ConvertBitmap.boofToBitmap(image, bitmap, bitmapTmp); } break; case DOUBLE_BUFFER: { // TODO if there are multiple processing threads bad stuff will happen here. Need one work buffer // per thread // convert the image. this can be a slow operation if (image.getWidth() == bitmapWork.getWidth() && image.getHeight() == bitmapWork.getHeight()) ConvertBitmap.boofToBitmap(image, bitmapWork, bitmapTmp); // swap the two buffers. If it's locked don't swap. This will skip a frame but will not cause // a significant slow down if( bitmapLock.tryLock() ) { try { Bitmap tmp = bitmapWork; bitmapWork = bitmap; bitmap = tmp; } finally { bitmapLock.unlock(); } } } break; } } }
public class class_name { protected void renderBitmapImage( BitmapMode mode , ImageBase image ) { switch( mode ) { case UNSAFE: { if (image.getWidth() == bitmap.getWidth() && image.getHeight() == bitmap.getHeight()) ConvertBitmap.boofToBitmap(image, bitmap, bitmapTmp); } break; case DOUBLE_BUFFER: { // TODO if there are multiple processing threads bad stuff will happen here. Need one work buffer // per thread // convert the image. this can be a slow operation if (image.getWidth() == bitmapWork.getWidth() && image.getHeight() == bitmapWork.getHeight()) ConvertBitmap.boofToBitmap(image, bitmapWork, bitmapTmp); // swap the two buffers. If it's locked don't swap. This will skip a frame but will not cause // a significant slow down if( bitmapLock.tryLock() ) { try { Bitmap tmp = bitmapWork; bitmapWork = bitmap; // depends on control dependency: [try], data = [none] bitmap = tmp; // depends on control dependency: [try], data = [none] } finally { bitmapLock.unlock(); } } } break; } } }
public class class_name { public void blockTillTerminated() { while (!runState.compareAndSet(State.IDLE, State.REMOVED)) { // wait and retry LockSupport.parkNanos(TimeUnit.MILLISECONDS.toNanos(10)); if (Thread.currentThread().isInterrupted()) { runState.set(State.REMOVED); return; } } } }
public class class_name { public void blockTillTerminated() { while (!runState.compareAndSet(State.IDLE, State.REMOVED)) { // wait and retry LockSupport.parkNanos(TimeUnit.MILLISECONDS.toNanos(10)); // depends on control dependency: [while], data = [none] if (Thread.currentThread().isInterrupted()) { runState.set(State.REMOVED); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } } } }
public class class_name { protected void showError() { if (hasError()) { m_label.getElement().getStyle().clearDisplay(); CmsFadeAnimation.fadeIn(m_label.getElement(), new Command() { /** * @see com.google.gwt.user.client.Command#execute() */ public void execute() { // noop } }, 300); } } }
public class class_name { protected void showError() { if (hasError()) { m_label.getElement().getStyle().clearDisplay(); // depends on control dependency: [if], data = [none] CmsFadeAnimation.fadeIn(m_label.getElement(), new Command() { /** * @see com.google.gwt.user.client.Command#execute() */ public void execute() { // noop } }, 300); // depends on control dependency: [if], data = [none] } } }
public class class_name { public boolean setSelectQuery(Rec recMaint, boolean bUpdateOnSelect) { if (recMaint == null) { return true; // BaseTable Set! } if (this.getMainRecord() != null) if (this.getMainRecord() != recMaint) if (this.getMainRecord().getBaseRecord().getTableNames(false).equals(recMaint.getTableNames(false))) { this.getMainRecord().addListener(new SelectOnUpdateHandler((Record)recMaint, bUpdateOnSelect)); return true; // BaseTable Set! } return false; } }
public class class_name { public boolean setSelectQuery(Rec recMaint, boolean bUpdateOnSelect) { if (recMaint == null) { return true; // BaseTable Set! // depends on control dependency: [if], data = [none] } if (this.getMainRecord() != null) if (this.getMainRecord() != recMaint) if (this.getMainRecord().getBaseRecord().getTableNames(false).equals(recMaint.getTableNames(false))) { this.getMainRecord().addListener(new SelectOnUpdateHandler((Record)recMaint, bUpdateOnSelect)); // depends on control dependency: [if], data = [none] return true; // BaseTable Set! // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public static synchronized void releaseSharedResources(long timeout, TimeUnit unit) { if (EVENT_LOOP != null) { try { EVENT_LOOP.shutdownGracefully().await(timeout, unit); } catch (InterruptedException e) { LoggerFactory.getLogger(Stack.class) .warn("Interrupted awaiting event loop shutdown.", e); } EVENT_LOOP = null; } if (SCHEDULED_EXECUTOR_SERVICE != null) { SCHEDULED_EXECUTOR_SERVICE.shutdown(); SCHEDULED_EXECUTOR_SERVICE = null; } if (EXECUTOR_SERVICE != null) { EXECUTOR_SERVICE.shutdown(); EXECUTOR_SERVICE = null; } if (WHEEL_TIMER != null) { WHEEL_TIMER.stop().forEach(Timeout::cancel); WHEEL_TIMER = null; } } }
public class class_name { public static synchronized void releaseSharedResources(long timeout, TimeUnit unit) { if (EVENT_LOOP != null) { try { EVENT_LOOP.shutdownGracefully().await(timeout, unit); // depends on control dependency: [try], data = [none] } catch (InterruptedException e) { LoggerFactory.getLogger(Stack.class) .warn("Interrupted awaiting event loop shutdown.", e); } // depends on control dependency: [catch], data = [none] EVENT_LOOP = null; // depends on control dependency: [if], data = [none] } if (SCHEDULED_EXECUTOR_SERVICE != null) { SCHEDULED_EXECUTOR_SERVICE.shutdown(); // depends on control dependency: [if], data = [none] SCHEDULED_EXECUTOR_SERVICE = null; // depends on control dependency: [if], data = [none] } if (EXECUTOR_SERVICE != null) { EXECUTOR_SERVICE.shutdown(); // depends on control dependency: [if], data = [none] EXECUTOR_SERVICE = null; // depends on control dependency: [if], data = [none] } if (WHEEL_TIMER != null) { WHEEL_TIMER.stop().forEach(Timeout::cancel); // depends on control dependency: [if], data = [none] WHEEL_TIMER = null; // depends on control dependency: [if], data = [none] } } }