code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public static boolean exists(String URLName) { try { HttpURLConnection.setFollowRedirects(false); // note : you may also need // HttpURLConnection.setInstanceFollowRedirects(false) HttpURLConnection con = (HttpURLConnection) new URL(URLName).openConnection(); con.setRequestMethod("HEAD"); return (con.getResponseCode() == HttpURLConnection.HTTP_OK); } catch (Exception e) { e.printStackTrace(); return false; } } }
public class class_name { public static boolean exists(String URLName) { try { HttpURLConnection.setFollowRedirects(false); // depends on control dependency: [try], data = [none] // note : you may also need // HttpURLConnection.setInstanceFollowRedirects(false) HttpURLConnection con = (HttpURLConnection) new URL(URLName).openConnection(); con.setRequestMethod("HEAD"); // depends on control dependency: [try], data = [none] return (con.getResponseCode() == HttpURLConnection.HTTP_OK); // depends on control dependency: [try], data = [none] } catch (Exception e) { e.printStackTrace(); return false; } // depends on control dependency: [catch], data = [none] } }
public class class_name { void forcedUndeployScan() { if (acquireScanLock()) { try { ROOT_LOGGER.tracef("Performing a post-boot forced undeploy scan for scan directory %s", deploymentDir.getAbsolutePath()); ScanContext scanContext = new ScanContext(deploymentOperations); // Add remove actions to the plan for anything we count as // deployed that we didn't find on the scan for (Map.Entry<String, DeploymentMarker> missing : scanContext.toRemove.entrySet()) { // remove successful deployment and left will be removed if (scanContext.registeredDeployments.containsKey(missing.getKey())) { scanContext.registeredDeployments.remove(missing.getKey()); } } Set<String> scannedDeployments = new HashSet<String>(scanContext.registeredDeployments.keySet()); scannedDeployments.removeAll(scanContext.persistentDeployments); List<ScannerTask> scannerTasks = scanContext.scannerTasks; for (String toUndeploy : scannedDeployments) { scannerTasks.add(new UndeployTask(toUndeploy, deploymentDir, scanContext.scanStartTime, true)); } try { executeScannerTasks(scannerTasks, deploymentOperations, true); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } ROOT_LOGGER.tracef("Forced undeploy scan complete"); } catch (Exception e) { ROOT_LOGGER.scanException(e, deploymentDir.getAbsolutePath()); } finally { releaseScanLock(); } } } }
public class class_name { void forcedUndeployScan() { if (acquireScanLock()) { try { ROOT_LOGGER.tracef("Performing a post-boot forced undeploy scan for scan directory %s", deploymentDir.getAbsolutePath()); // depends on control dependency: [try], data = [none] ScanContext scanContext = new ScanContext(deploymentOperations); // Add remove actions to the plan for anything we count as // deployed that we didn't find on the scan for (Map.Entry<String, DeploymentMarker> missing : scanContext.toRemove.entrySet()) { // remove successful deployment and left will be removed if (scanContext.registeredDeployments.containsKey(missing.getKey())) { scanContext.registeredDeployments.remove(missing.getKey()); // depends on control dependency: [if], data = [none] } } Set<String> scannedDeployments = new HashSet<String>(scanContext.registeredDeployments.keySet()); scannedDeployments.removeAll(scanContext.persistentDeployments); // depends on control dependency: [try], data = [none] List<ScannerTask> scannerTasks = scanContext.scannerTasks; for (String toUndeploy : scannedDeployments) { scannerTasks.add(new UndeployTask(toUndeploy, deploymentDir, scanContext.scanStartTime, true)); // depends on control dependency: [for], data = [toUndeploy] } try { executeScannerTasks(scannerTasks, deploymentOperations, true); // depends on control dependency: [try], data = [none] } catch (InterruptedException e) { Thread.currentThread().interrupt(); } // depends on control dependency: [catch], data = [none] ROOT_LOGGER.tracef("Forced undeploy scan complete"); // depends on control dependency: [try], data = [none] } catch (Exception e) { ROOT_LOGGER.scanException(e, deploymentDir.getAbsolutePath()); } finally { // depends on control dependency: [catch], data = [none] releaseScanLock(); } } } }
public class class_name { public ServiceCall<Intent> createIntent(CreateIntentOptions createIntentOptions) { Validator.notNull(createIntentOptions, "createIntentOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "intents" }; String[] pathParameters = { createIntentOptions.workspaceId() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters)); builder.query("version", versionDate); Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "createIntent"); for (Entry<String, String> header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); final JsonObject contentJson = new JsonObject(); contentJson.addProperty("intent", createIntentOptions.intent()); if (createIntentOptions.description() != null) { contentJson.addProperty("description", createIntentOptions.description()); } if (createIntentOptions.examples() != null) { contentJson.add("examples", GsonSingleton.getGson().toJsonTree(createIntentOptions.examples())); } builder.bodyJson(contentJson); return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Intent.class)); } }
public class class_name { public ServiceCall<Intent> createIntent(CreateIntentOptions createIntentOptions) { Validator.notNull(createIntentOptions, "createIntentOptions cannot be null"); String[] pathSegments = { "v1/workspaces", "intents" }; String[] pathParameters = { createIntentOptions.workspaceId() }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters)); builder.query("version", versionDate); Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "createIntent"); for (Entry<String, String> header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); // depends on control dependency: [for], data = [header] } builder.header("Accept", "application/json"); final JsonObject contentJson = new JsonObject(); contentJson.addProperty("intent", createIntentOptions.intent()); if (createIntentOptions.description() != null) { contentJson.addProperty("description", createIntentOptions.description()); // depends on control dependency: [if], data = [none] } if (createIntentOptions.examples() != null) { contentJson.add("examples", GsonSingleton.getGson().toJsonTree(createIntentOptions.examples())); // depends on control dependency: [if], data = [(createIntentOptions.examples()] } builder.bodyJson(contentJson); return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Intent.class)); } }
public class class_name { @Deprecated public MultiValueMap<String, Object> toRequestParameters() { MultiValueMap<String, Object> tweetParameters = toTweetParameters(); if (mediaResource != null) { tweetParameters.set("media", mediaResource); } return tweetParameters; } }
public class class_name { @Deprecated public MultiValueMap<String, Object> toRequestParameters() { MultiValueMap<String, Object> tweetParameters = toTweetParameters(); if (mediaResource != null) { tweetParameters.set("media", mediaResource); // depends on control dependency: [if], data = [none] } return tweetParameters; } }
public class class_name { public static synchronized File extractTessResources(String resourceName) { File targetPath = null; try { targetPath = new File(TESS4J_TEMP_DIR, resourceName); Enumeration<URL> resources = LoadLibs.class.getClassLoader().getResources(resourceName); while (resources.hasMoreElements()) { URL resourceUrl = resources.nextElement(); copyResources(resourceUrl, targetPath); } } catch (IOException | URISyntaxException e) { logger.warn(e.getMessage(), e); } return targetPath; } }
public class class_name { public static synchronized File extractTessResources(String resourceName) { File targetPath = null; try { targetPath = new File(TESS4J_TEMP_DIR, resourceName); // depends on control dependency: [try], data = [none] Enumeration<URL> resources = LoadLibs.class.getClassLoader().getResources(resourceName); while (resources.hasMoreElements()) { URL resourceUrl = resources.nextElement(); copyResources(resourceUrl, targetPath); // depends on control dependency: [while], data = [none] } } catch (IOException | URISyntaxException e) { logger.warn(e.getMessage(), e); } // depends on control dependency: [catch], data = [none] return targetPath; } }
public class class_name { public WebhookDefinition withFilters(WebhookFilterRule... filters) { if (this.filters == null) { setFilters(new java.util.ArrayList<WebhookFilterRule>(filters.length)); } for (WebhookFilterRule ele : filters) { this.filters.add(ele); } return this; } }
public class class_name { public WebhookDefinition withFilters(WebhookFilterRule... filters) { if (this.filters == null) { setFilters(new java.util.ArrayList<WebhookFilterRule>(filters.length)); // depends on control dependency: [if], data = [none] } for (WebhookFilterRule ele : filters) { this.filters.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public static Context getOrCreate(NetworkParameters params) { Context context; try { context = get(); } catch (IllegalStateException e) { log.warn("Implicitly creating context. This is a migration step and this message will eventually go away."); context = new Context(params); return context; } if (context.getParams() != params) throw new IllegalStateException("Context does not match implicit network params: " + context.getParams() + " vs " + params); return context; } }
public class class_name { public static Context getOrCreate(NetworkParameters params) { Context context; try { context = get(); // depends on control dependency: [try], data = [none] } catch (IllegalStateException e) { log.warn("Implicitly creating context. This is a migration step and this message will eventually go away."); context = new Context(params); return context; } // depends on control dependency: [catch], data = [none] if (context.getParams() != params) throw new IllegalStateException("Context does not match implicit network params: " + context.getParams() + " vs " + params); return context; } }
public class class_name { public void setScheduledUpdateGroupActions(java.util.Collection<ScheduledUpdateGroupActionRequest> scheduledUpdateGroupActions) { if (scheduledUpdateGroupActions == null) { this.scheduledUpdateGroupActions = null; return; } this.scheduledUpdateGroupActions = new com.amazonaws.internal.SdkInternalList<ScheduledUpdateGroupActionRequest>(scheduledUpdateGroupActions); } }
public class class_name { public void setScheduledUpdateGroupActions(java.util.Collection<ScheduledUpdateGroupActionRequest> scheduledUpdateGroupActions) { if (scheduledUpdateGroupActions == null) { this.scheduledUpdateGroupActions = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.scheduledUpdateGroupActions = new com.amazonaws.internal.SdkInternalList<ScheduledUpdateGroupActionRequest>(scheduledUpdateGroupActions); } }
public class class_name { @Override public EClass getIfcCircleHollowProfileDef() { if (ifcCircleHollowProfileDefEClass == null) { ifcCircleHollowProfileDefEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(92); } return ifcCircleHollowProfileDefEClass; } }
public class class_name { @Override public EClass getIfcCircleHollowProfileDef() { if (ifcCircleHollowProfileDefEClass == null) { ifcCircleHollowProfileDefEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(92); // depends on control dependency: [if], data = [none] } return ifcCircleHollowProfileDefEClass; } }
public class class_name { @Override public List<CPAttachmentFileEntry> findByC_C_LtD_S(long classNameId, long classPK, Date displayDate, int status, int start, int end, OrderByComparator<CPAttachmentFileEntry> orderByComparator, boolean retrieveFromCache) { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_C_LTD_S; finderArgs = new Object[] { classNameId, classPK, _getTime(displayDate), status, start, end, orderByComparator }; List<CPAttachmentFileEntry> list = null; if (retrieveFromCache) { list = (List<CPAttachmentFileEntry>)finderCache.getResult(finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (CPAttachmentFileEntry cpAttachmentFileEntry : list) { if ((classNameId != cpAttachmentFileEntry.getClassNameId()) || (classPK != cpAttachmentFileEntry.getClassPK()) || (displayDate.getTime() <= cpAttachmentFileEntry.getDisplayDate() .getTime()) || (status != cpAttachmentFileEntry.getStatus())) { list = null; break; } } } } if (list == null) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler(6 + (orderByComparator.getOrderByFields().length * 2)); } else { query = new StringBundler(6); } query.append(_SQL_SELECT_CPATTACHMENTFILEENTRY_WHERE); query.append(_FINDER_COLUMN_C_C_LTD_S_CLASSNAMEID_2); query.append(_FINDER_COLUMN_C_C_LTD_S_CLASSPK_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_C_C_LTD_S_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_C_C_LTD_S_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_C_C_LTD_S_STATUS_2); if (orderByComparator != null) { appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(CPAttachmentFileEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(classNameId); qPos.add(classPK); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); if (!pagination) { list = (List<CPAttachmentFileEntry>)QueryUtil.list(q, getDialect(), start, end, false); Collections.sort(list); list = Collections.unmodifiableList(list); } else { list = (List<CPAttachmentFileEntry>)QueryUtil.list(q, getDialect(), start, end); } cacheResult(list); finderCache.putResult(finderPath, finderArgs, list); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; } }
public class class_name { @Override public List<CPAttachmentFileEntry> findByC_C_LtD_S(long classNameId, long classPK, Date displayDate, int status, int start, int end, OrderByComparator<CPAttachmentFileEntry> orderByComparator, boolean retrieveFromCache) { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_C_LTD_S; finderArgs = new Object[] { classNameId, classPK, _getTime(displayDate), status, start, end, orderByComparator }; List<CPAttachmentFileEntry> list = null; if (retrieveFromCache) { list = (List<CPAttachmentFileEntry>)finderCache.getResult(finderPath, finderArgs, this); // depends on control dependency: [if], data = [none] if ((list != null) && !list.isEmpty()) { for (CPAttachmentFileEntry cpAttachmentFileEntry : list) { if ((classNameId != cpAttachmentFileEntry.getClassNameId()) || (classPK != cpAttachmentFileEntry.getClassPK()) || (displayDate.getTime() <= cpAttachmentFileEntry.getDisplayDate() .getTime()) || (status != cpAttachmentFileEntry.getStatus())) { list = null; // depends on control dependency: [if], data = [none] break; } } } } if (list == null) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler(6 + (orderByComparator.getOrderByFields().length * 2)); // depends on control dependency: [if], data = [none] } else { query = new StringBundler(6); // depends on control dependency: [if], data = [none] } query.append(_SQL_SELECT_CPATTACHMENTFILEENTRY_WHERE); // depends on control dependency: [if], data = [none] query.append(_FINDER_COLUMN_C_C_LTD_S_CLASSNAMEID_2); // depends on control dependency: [if], data = [none] query.append(_FINDER_COLUMN_C_C_LTD_S_CLASSPK_2); // depends on control dependency: [if], data = [none] boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_C_C_LTD_S_DISPLAYDATE_1); // depends on control dependency: [if], data = [none] } else { bindDisplayDate = true; // depends on control dependency: [if], data = [none] query.append(_FINDER_COLUMN_C_C_LTD_S_DISPLAYDATE_2); // depends on control dependency: [if], data = [none] } query.append(_FINDER_COLUMN_C_C_LTD_S_STATUS_2); // depends on control dependency: [if], data = [none] if (orderByComparator != null) { appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); // depends on control dependency: [if], data = [none] } else if (pagination) { query.append(CPAttachmentFileEntryModelImpl.ORDER_BY_JPQL); // depends on control dependency: [if], data = [none] } String sql = query.toString(); Session session = null; try { session = openSession(); // depends on control dependency: [try], data = [none] Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(classNameId); // depends on control dependency: [try], data = [none] qPos.add(classPK); // depends on control dependency: [try], data = [none] if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); // depends on control dependency: [if], data = [none] } qPos.add(status); // depends on control dependency: [try], data = [none] if (!pagination) { list = (List<CPAttachmentFileEntry>)QueryUtil.list(q, getDialect(), start, end, false); // depends on control dependency: [if], data = [none] Collections.sort(list); // depends on control dependency: [if], data = [none] list = Collections.unmodifiableList(list); // depends on control dependency: [if], data = [none] } else { list = (List<CPAttachmentFileEntry>)QueryUtil.list(q, getDialect(), start, end); // depends on control dependency: [if], data = [none] } cacheResult(list); // depends on control dependency: [try], data = [none] finderCache.putResult(finderPath, finderArgs, list); // depends on control dependency: [try], data = [none] } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } // depends on control dependency: [catch], data = [none] finally { closeSession(session); } } return list; } }
public class class_name { protected int nextEscapeIndex(CharSequence csq, int start, int end) { int index = start; while (index < end) { int cp = codePointAt(csq, index, end); if (cp < 0 || escape(cp) != null) { break; } index += Character.isSupplementaryCodePoint(cp) ? 2 : 1; } return index; } }
public class class_name { protected int nextEscapeIndex(CharSequence csq, int start, int end) { int index = start; while (index < end) { int cp = codePointAt(csq, index, end); if (cp < 0 || escape(cp) != null) { break; } index += Character.isSupplementaryCodePoint(cp) ? 2 : 1; // depends on control dependency: [while], data = [none] } return index; } }
public class class_name { public DescribeEnvironmentsRequest withEnvironmentNames(String... environmentNames) { if (this.environmentNames == null) { setEnvironmentNames(new com.amazonaws.internal.SdkInternalList<String>(environmentNames.length)); } for (String ele : environmentNames) { this.environmentNames.add(ele); } return this; } }
public class class_name { public DescribeEnvironmentsRequest withEnvironmentNames(String... environmentNames) { if (this.environmentNames == null) { setEnvironmentNames(new com.amazonaws.internal.SdkInternalList<String>(environmentNames.length)); // depends on control dependency: [if], data = [none] } for (String ele : environmentNames) { this.environmentNames.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public static List<StackLine> getStackLines(SrcTree srcTree, StackTraceElement[] elements, LineReplacer replacer) { List<StackLine> stackLines = new ArrayList<>(elements.length); for (StackTraceElement element : elements) { StackLine stackLine = getStackLine(srcTree, element, replacer); if (stackLine != null) { stackLines.add(stackLine); } } return stackLines; } }
public class class_name { public static List<StackLine> getStackLines(SrcTree srcTree, StackTraceElement[] elements, LineReplacer replacer) { List<StackLine> stackLines = new ArrayList<>(elements.length); for (StackTraceElement element : elements) { StackLine stackLine = getStackLine(srcTree, element, replacer); if (stackLine != null) { stackLines.add(stackLine); // depends on control dependency: [if], data = [(stackLine] } } return stackLines; } }
public class class_name { public MoneyAmountStyle withExtendedGroupingSize(Integer extendedGroupingSize) { int sizeVal = (extendedGroupingSize == null ? -1 : extendedGroupingSize); if (extendedGroupingSize != null && sizeVal < 0) { throw new IllegalArgumentException("Extended grouping size must not be negative"); } if (sizeVal == this.extendedGroupingSize) { return this; } return new MoneyAmountStyle( zeroCharacter, positiveCharacter, negativeCharacter, decimalPointCharacter, groupingStyle, groupingCharacter, groupingSize, sizeVal, forceDecimalPoint, absValue); } }
public class class_name { public MoneyAmountStyle withExtendedGroupingSize(Integer extendedGroupingSize) { int sizeVal = (extendedGroupingSize == null ? -1 : extendedGroupingSize); if (extendedGroupingSize != null && sizeVal < 0) { throw new IllegalArgumentException("Extended grouping size must not be negative"); } if (sizeVal == this.extendedGroupingSize) { return this; // depends on control dependency: [if], data = [none] } return new MoneyAmountStyle( zeroCharacter, positiveCharacter, negativeCharacter, decimalPointCharacter, groupingStyle, groupingCharacter, groupingSize, sizeVal, forceDecimalPoint, absValue); } }
public class class_name { public String render() { StringBuilder builder = new StringBuilder(column); if (order != null) { builder.append(" ").append(getOrder().name()); } return builder.toString(); } }
public class class_name { public String render() { StringBuilder builder = new StringBuilder(column); if (order != null) { builder.append(" ").append(getOrder().name()); // depends on control dependency: [if], data = [none] } return builder.toString(); } }
public class class_name { public BoundingBox getBoundingBox(Projection projection) { BoundingBox boundingBox = null; List<String> tables = null; try { tables = getTables(); } catch (SQLException e) { throw new GeoPackageException( "Failed to query for contents tables", e); } for (String table : tables) { BoundingBox tableBoundingBox = getBoundingBox(projection, table); if (tableBoundingBox != null) { if (boundingBox != null) { boundingBox = boundingBox.union(tableBoundingBox); } else { boundingBox = tableBoundingBox; } } } return boundingBox; } }
public class class_name { public BoundingBox getBoundingBox(Projection projection) { BoundingBox boundingBox = null; List<String> tables = null; try { tables = getTables(); // depends on control dependency: [try], data = [none] } catch (SQLException e) { throw new GeoPackageException( "Failed to query for contents tables", e); } // depends on control dependency: [catch], data = [none] for (String table : tables) { BoundingBox tableBoundingBox = getBoundingBox(projection, table); if (tableBoundingBox != null) { if (boundingBox != null) { boundingBox = boundingBox.union(tableBoundingBox); // depends on control dependency: [if], data = [none] } else { boundingBox = tableBoundingBox; // depends on control dependency: [if], data = [none] } } } return boundingBox; } }
public class class_name { public static String getText(){ Transferable contents = clipboard().getContents(null); try{ if(contents!=null && contents.isDataFlavorSupported(DataFlavor.stringFlavor)) return (String)contents.getTransferData(DataFlavor.stringFlavor); else return null; }catch(UnsupportedFlavorException ex){ throw new ImpossibleException(ex); }catch(IOException ex){ throw new RuntimeException(ex); } } }
public class class_name { public static String getText(){ Transferable contents = clipboard().getContents(null); try{ if(contents!=null && contents.isDataFlavorSupported(DataFlavor.stringFlavor)) return (String)contents.getTransferData(DataFlavor.stringFlavor); else return null; }catch(UnsupportedFlavorException ex){ throw new ImpossibleException(ex); }catch(IOException ex){ // depends on control dependency: [catch], data = [none] throw new RuntimeException(ex); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private final boolean matchChildBlock(int bufferIndex) { // // Match the pattern we see at the start of the child block // int index = 0; for (byte b : CHILD_BLOCK_PATTERN) { if (b != m_buffer[bufferIndex + index]) { return false; } ++index; } // // The first step will produce false positives. To handle this, we should find // the name of the block next, and check to ensure that the length // of the name makes sense. // int nameLength = FastTrackUtility.getInt(m_buffer, bufferIndex + index); // System.out.println("Name length: " + nameLength); // // if (nameLength > 0 && nameLength < 100) // { // String name = new String(m_buffer, bufferIndex+index+4, nameLength, CharsetHelper.UTF16LE); // System.out.println("Name: " + name); // } return nameLength > 0 && nameLength < 100; } }
public class class_name { private final boolean matchChildBlock(int bufferIndex) { // // Match the pattern we see at the start of the child block // int index = 0; for (byte b : CHILD_BLOCK_PATTERN) { if (b != m_buffer[bufferIndex + index]) { return false; // depends on control dependency: [if], data = [none] } ++index; // depends on control dependency: [for], data = [none] } // // The first step will produce false positives. To handle this, we should find // the name of the block next, and check to ensure that the length // of the name makes sense. // int nameLength = FastTrackUtility.getInt(m_buffer, bufferIndex + index); // System.out.println("Name length: " + nameLength); // // if (nameLength > 0 && nameLength < 100) // { // String name = new String(m_buffer, bufferIndex+index+4, nameLength, CharsetHelper.UTF16LE); // System.out.println("Name: " + name); // } return nameLength > 0 && nameLength < 100; } }
public class class_name { public char match(String str1, String str2) { if (null == str1 || null == str2 || 0 == str1.length() || 0 == str2.length()) { return IMappingElement.IDK; } float sim = 1 - (float) getLevenshteinDistance(str1, str2) / java.lang.Math.max(str1.length(), str2.length()); if (threshold <= sim) { return IMappingElement.EQUIVALENCE; } else { return IMappingElement.IDK; } } }
public class class_name { public char match(String str1, String str2) { if (null == str1 || null == str2 || 0 == str1.length() || 0 == str2.length()) { return IMappingElement.IDK; // depends on control dependency: [if], data = [none] } float sim = 1 - (float) getLevenshteinDistance(str1, str2) / java.lang.Math.max(str1.length(), str2.length()); if (threshold <= sim) { return IMappingElement.EQUIVALENCE; // depends on control dependency: [if], data = [none] } else { return IMappingElement.IDK; // depends on control dependency: [if], data = [none] } } }
public class class_name { protected Set<URI> getValidDatasetURIs(Path datasetCommonRoot) { Collection<URI> allDatasetURIs; Set<URI> disabledURISet = new HashSet(); // This try block basically populate the Valid dataset URI set. try { allDatasetURIs = configClient.getImportedBy(new URI(whitelistTag.toString()), true); enhanceDisabledURIsWithBlackListTag(disabledURISet); } catch ( ConfigStoreFactoryDoesNotExistsException | ConfigStoreCreationException | URISyntaxException e) { log.error("Caught error while getting all the datasets URIs " + e.getMessage()); throw new RuntimeException(e); } return getValidDatasetURIsHelper(allDatasetURIs, disabledURISet, datasetCommonRoot); } }
public class class_name { protected Set<URI> getValidDatasetURIs(Path datasetCommonRoot) { Collection<URI> allDatasetURIs; Set<URI> disabledURISet = new HashSet(); // This try block basically populate the Valid dataset URI set. try { allDatasetURIs = configClient.getImportedBy(new URI(whitelistTag.toString()), true); // depends on control dependency: [try], data = [none] enhanceDisabledURIsWithBlackListTag(disabledURISet); // depends on control dependency: [try], data = [none] } catch ( ConfigStoreFactoryDoesNotExistsException | ConfigStoreCreationException | URISyntaxException e) { log.error("Caught error while getting all the datasets URIs " + e.getMessage()); throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] return getValidDatasetURIsHelper(allDatasetURIs, disabledURISet, datasetCommonRoot); } }
public class class_name { public List<JAXBElement<Object>> get_GenericApplicationPropertyOfTunnelFurniture() { if (_GenericApplicationPropertyOfTunnelFurniture == null) { _GenericApplicationPropertyOfTunnelFurniture = new ArrayList<JAXBElement<Object>>(); } return this._GenericApplicationPropertyOfTunnelFurniture; } }
public class class_name { public List<JAXBElement<Object>> get_GenericApplicationPropertyOfTunnelFurniture() { if (_GenericApplicationPropertyOfTunnelFurniture == null) { _GenericApplicationPropertyOfTunnelFurniture = new ArrayList<JAXBElement<Object>>(); // depends on control dependency: [if], data = [none] } return this._GenericApplicationPropertyOfTunnelFurniture; } }
public class class_name { @Override public void connect(String ip, int port) { network.connect(ip, port); for (final ConnectionListener listener : listeners) { network.addListener(listener); } network.addListener(this); } }
public class class_name { @Override public void connect(String ip, int port) { network.connect(ip, port); for (final ConnectionListener listener : listeners) { network.addListener(listener); // depends on control dependency: [for], data = [listener] } network.addListener(this); } }
public class class_name { public CmsLoginManager getLoginManager() { if (m_loginManager == null) { // no login manager configured, create default m_loginManager = new CmsLoginManager( CmsLoginManager.DISABLE_MINUTES_DEFAULT, CmsLoginManager.MAX_BAD_ATTEMPTS_DEFAULT, CmsLoginManager.ENABLE_SECURITY_DEFAULT, null, null, null, null); } return m_loginManager; } }
public class class_name { public CmsLoginManager getLoginManager() { if (m_loginManager == null) { // no login manager configured, create default m_loginManager = new CmsLoginManager( CmsLoginManager.DISABLE_MINUTES_DEFAULT, CmsLoginManager.MAX_BAD_ATTEMPTS_DEFAULT, CmsLoginManager.ENABLE_SECURITY_DEFAULT, null, null, null, null); // depends on control dependency: [if], data = [none] } return m_loginManager; } }
public class class_name { @CanIgnoreReturnValue @Override public final int add(@NullableDecl E element, int occurrences) { if (occurrences == 0) { return count(element); } checkArgument(occurrences > 0, "occurrences cannot be negative: %s", occurrences); int entryIndex = backingMap.indexOf(element); if (entryIndex == -1) { backingMap.put(element, occurrences); size += occurrences; return 0; } int oldCount = backingMap.getValue(entryIndex); long newCount = (long) oldCount + (long) occurrences; checkArgument(newCount <= Integer.MAX_VALUE, "too many occurrences: %s", newCount); backingMap.setValue(entryIndex, (int) newCount); size += occurrences; return oldCount; } }
public class class_name { @CanIgnoreReturnValue @Override public final int add(@NullableDecl E element, int occurrences) { if (occurrences == 0) { return count(element); // depends on control dependency: [if], data = [none] } checkArgument(occurrences > 0, "occurrences cannot be negative: %s", occurrences); int entryIndex = backingMap.indexOf(element); if (entryIndex == -1) { backingMap.put(element, occurrences); // depends on control dependency: [if], data = [none] size += occurrences; // depends on control dependency: [if], data = [none] return 0; // depends on control dependency: [if], data = [none] } int oldCount = backingMap.getValue(entryIndex); long newCount = (long) oldCount + (long) occurrences; checkArgument(newCount <= Integer.MAX_VALUE, "too many occurrences: %s", newCount); backingMap.setValue(entryIndex, (int) newCount); size += occurrences; return oldCount; } }
public class class_name { private void matchEndLine() { // First, parse all whitespace characters except for new lines index = skipLineSpace(index); // Second, check whether we've reached the end-of-file (as signaled by // running out of tokens), or we've encountered some token which not a // newline. if (index >= tokens.size()) { return; // EOF } else if (tokens.get(index).kind != NewLine) { syntaxError("expected end-of-line", tokens.get(index)); } else { index = index + 1; } } }
public class class_name { private void matchEndLine() { // First, parse all whitespace characters except for new lines index = skipLineSpace(index); // Second, check whether we've reached the end-of-file (as signaled by // running out of tokens), or we've encountered some token which not a // newline. if (index >= tokens.size()) { return; // EOF // depends on control dependency: [if], data = [none] } else if (tokens.get(index).kind != NewLine) { syntaxError("expected end-of-line", tokens.get(index)); // depends on control dependency: [if], data = [none] } else { index = index + 1; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static <T> Observable<T> from(final ListenableFuture<T> future, final Scheduler scheduler) { final Worker worker = scheduler.createWorker(); return from(future, new Executor() { @Override public void execute(final Runnable command) { worker.schedule(new Action0() { @Override public void call() { try { command.run(); } finally { worker.unsubscribe(); } } }); } }); } }
public class class_name { public static <T> Observable<T> from(final ListenableFuture<T> future, final Scheduler scheduler) { final Worker worker = scheduler.createWorker(); return from(future, new Executor() { @Override public void execute(final Runnable command) { worker.schedule(new Action0() { @Override public void call() { try { command.run(); // depends on control dependency: [try], data = [none] } finally { worker.unsubscribe(); } } }); } }); } }
public class class_name { public final void setScheduledExecutor(ScheduledExecutorService scheduledExecutor) { if (scheduledExecutor != null) { this.scheduledExecutor = scheduledExecutor; this.enterpriseConcurrentScheduler = managedScheduledExecutorServiceClass != null && managedScheduledExecutorServiceClass .isInstance(scheduledExecutor); } else { this.scheduledExecutor = Executors.newSingleThreadScheduledExecutor(); this.enterpriseConcurrentScheduler = false; } } }
public class class_name { public final void setScheduledExecutor(ScheduledExecutorService scheduledExecutor) { if (scheduledExecutor != null) { this.scheduledExecutor = scheduledExecutor; // depends on control dependency: [if], data = [none] this.enterpriseConcurrentScheduler = managedScheduledExecutorServiceClass != null && managedScheduledExecutorServiceClass .isInstance(scheduledExecutor); // depends on control dependency: [if], data = [none] } else { this.scheduledExecutor = Executors.newSingleThreadScheduledExecutor(); // depends on control dependency: [if], data = [none] this.enterpriseConcurrentScheduler = false; // depends on control dependency: [if], data = [none] } } }
public class class_name { @SuppressWarnings("unchecked") public <T extends BaseTopicWrapper<T>> List<T> getAllTopics(boolean ignoreRevisions) { final List<T> topics = new ArrayList<T>(); for (final Entry<Integer, List<ITopicNode>> entry : this.topics.entrySet()) { final Integer topicId = entry.getKey(); if (!this.topics.get(topicId).isEmpty()) { if (ignoreRevisions) { topics.add((T) entry.getValue().get(0).getTopic()); } else { final List<T> specTopicTopics = getUniqueTopicsFromSpecTopics(entry.getValue()); topics.addAll(specTopicTopics); } } } return topics; } }
public class class_name { @SuppressWarnings("unchecked") public <T extends BaseTopicWrapper<T>> List<T> getAllTopics(boolean ignoreRevisions) { final List<T> topics = new ArrayList<T>(); for (final Entry<Integer, List<ITopicNode>> entry : this.topics.entrySet()) { final Integer topicId = entry.getKey(); if (!this.topics.get(topicId).isEmpty()) { if (ignoreRevisions) { topics.add((T) entry.getValue().get(0).getTopic()); // depends on control dependency: [if], data = [none] } else { final List<T> specTopicTopics = getUniqueTopicsFromSpecTopics(entry.getValue()); topics.addAll(specTopicTopics); // depends on control dependency: [if], data = [none] } } } return topics; } }
public class class_name { public Collection<EntityAnnotation> getEntityAnnotations(TextAnnotation ta) { Collection<EntityAnnotation> eas = getEntityAnnotations(); Collection<EntityAnnotation> result = Sets.newHashSet(); for (EntityAnnotation ea : eas) { if (ea.getRelations() != null && ea.getRelations().contains(ta)) { result.add(ea); } } return result; } }
public class class_name { public Collection<EntityAnnotation> getEntityAnnotations(TextAnnotation ta) { Collection<EntityAnnotation> eas = getEntityAnnotations(); Collection<EntityAnnotation> result = Sets.newHashSet(); for (EntityAnnotation ea : eas) { if (ea.getRelations() != null && ea.getRelations().contains(ta)) { result.add(ea); // depends on control dependency: [if], data = [none] } } return result; } }
public class class_name { private String exportCloseLink() { String closeLink = null; if (getRequest().getAttribute(I_CmsDialogConstants.ATTR_CLOSE_LINK) != null) { closeLink = (String)getRequest().getAttribute(I_CmsDialogConstants.ATTR_CLOSE_LINK); } if (CmsStringUtil.isEmptyOrWhitespaceOnly(closeLink)) { closeLink = CmsWorkplace.FILE_EXPLORER_FILELIST; } StringBuffer sb = new StringBuffer(); // var closeLink = '/system/workplace/views/explorer/explorer_files.jsp'; sb.append(wrapScript("var ", I_CmsDialogConstants.ATTR_CLOSE_LINK, " = \'", closeLink, "\';")); return sb.toString(); } }
public class class_name { private String exportCloseLink() { String closeLink = null; if (getRequest().getAttribute(I_CmsDialogConstants.ATTR_CLOSE_LINK) != null) { closeLink = (String)getRequest().getAttribute(I_CmsDialogConstants.ATTR_CLOSE_LINK); // depends on control dependency: [if], data = [none] } if (CmsStringUtil.isEmptyOrWhitespaceOnly(closeLink)) { closeLink = CmsWorkplace.FILE_EXPLORER_FILELIST; // depends on control dependency: [if], data = [none] } StringBuffer sb = new StringBuffer(); // var closeLink = '/system/workplace/views/explorer/explorer_files.jsp'; sb.append(wrapScript("var ", I_CmsDialogConstants.ATTR_CLOSE_LINK, " = \'", closeLink, "\';")); return sb.toString(); } }
public class class_name { @Override public void addURL(URL url, boolean isScanned) { if (containsURL(url)) { return; } super.addURL(url, isScanned); if (isScanned) _pendingScanRoots.add(new ScanRoot(url, null)); } }
public class class_name { @Override public void addURL(URL url, boolean isScanned) { if (containsURL(url)) { return; // depends on control dependency: [if], data = [none] } super.addURL(url, isScanned); if (isScanned) _pendingScanRoots.add(new ScanRoot(url, null)); } }
public class class_name { public static final byte[] toAsciiBytes(final String value) { byte[] result = new byte[value.length()]; for (int i = 0; i < value.length(); i++) { result[i] = (byte) value.charAt(i); } return result; } }
public class class_name { public static final byte[] toAsciiBytes(final String value) { byte[] result = new byte[value.length()]; for (int i = 0; i < value.length(); i++) { result[i] = (byte) value.charAt(i); // depends on control dependency: [for], data = [i] } return result; } }
public class class_name { public static Class<?> resolveCaller() { Class<?> callerClass = null; StackTraceElement[] stackTraces = Thread.currentThread().getStackTrace(); int stackSize = stackTraces.length; // StackTrace is below. So check from 3rd element. // 1st:java.lang.Thread // 2nd:ResourceResolver#resolveCaller(this method) for (int stackIndex = 2; stackIndex < stackSize; stackIndex++) { StackTraceElement stackTrace = stackTraces[stackIndex]; String callerClassName = stackTrace.getClassName(); if (StringUtils.equals(ResourceResolver.class.getName(), callerClassName) == false) { try { callerClass = Class.forName(callerClassName); break; } catch (ClassNotFoundException ex) { return null; } } } return callerClass; } }
public class class_name { public static Class<?> resolveCaller() { Class<?> callerClass = null; StackTraceElement[] stackTraces = Thread.currentThread().getStackTrace(); int stackSize = stackTraces.length; // StackTrace is below. So check from 3rd element. // 1st:java.lang.Thread // 2nd:ResourceResolver#resolveCaller(this method) for (int stackIndex = 2; stackIndex < stackSize; stackIndex++) { StackTraceElement stackTrace = stackTraces[stackIndex]; String callerClassName = stackTrace.getClassName(); if (StringUtils.equals(ResourceResolver.class.getName(), callerClassName) == false) { try { callerClass = Class.forName(callerClassName); // depends on control dependency: [try], data = [none] break; } catch (ClassNotFoundException ex) { return null; } // depends on control dependency: [catch], data = [none] } } return callerClass; } }
public class class_name { private void replyError() { Error error = Preconditions.checkNotNull(mContext.getError()); if (error.isNotifyClient()) { mResponseObserver.onError(error.getCause().toGrpcStatusException()); } } }
public class class_name { private void replyError() { Error error = Preconditions.checkNotNull(mContext.getError()); if (error.isNotifyClient()) { mResponseObserver.onError(error.getCause().toGrpcStatusException()); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void appendFieldCriteria(TableAlias alias, PathInfo pathInfo, FieldCriteria c, StringBuffer buf) { appendColName(alias, pathInfo, c.isTranslateAttribute(), buf); buf.append(c.getClause()); if (c.isTranslateField()) { appendColName((String) c.getValue(), false, c.getUserAlias(), buf); } else { buf.append(c.getValue()); } } }
public class class_name { private void appendFieldCriteria(TableAlias alias, PathInfo pathInfo, FieldCriteria c, StringBuffer buf) { appendColName(alias, pathInfo, c.isTranslateAttribute(), buf); buf.append(c.getClause()); if (c.isTranslateField()) { appendColName((String) c.getValue(), false, c.getUserAlias(), buf); // depends on control dependency: [if], data = [none] } else { buf.append(c.getValue()); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void shutDownSqlDrivers() { // This manually deregisters JDBC driver, which prevents Tomcat 7 from complaining about memory leaks Enumeration<Driver> drivers = DriverManager.getDrivers(); while (drivers.hasMoreElements()) { Driver driver = drivers.nextElement(); try { DriverManager.deregisterDriver(driver); } catch (Throwable e) { System.out.println( Messages.get().getBundle().key( Messages.ERR_DEREGISTERING_JDBC_DRIVER_1, driver.getClass().getName())); e.printStackTrace(System.out); } } try { Class<?> cls = Class.forName("com.mysql.jdbc.AbandonedConnectionCleanupThread"); Method shutdownMethod = (cls == null ? null : cls.getMethod("shutdown")); if (shutdownMethod != null) { shutdownMethod.invoke(null); } } catch (Throwable e) { System.out.println("Failed to shutdown MySQL connection cleanup thread: " + e.getMessage()); } } }
public class class_name { private void shutDownSqlDrivers() { // This manually deregisters JDBC driver, which prevents Tomcat 7 from complaining about memory leaks Enumeration<Driver> drivers = DriverManager.getDrivers(); while (drivers.hasMoreElements()) { Driver driver = drivers.nextElement(); try { DriverManager.deregisterDriver(driver); // depends on control dependency: [try], data = [none] } catch (Throwable e) { System.out.println( Messages.get().getBundle().key( Messages.ERR_DEREGISTERING_JDBC_DRIVER_1, driver.getClass().getName())); e.printStackTrace(System.out); } // depends on control dependency: [catch], data = [none] } try { Class<?> cls = Class.forName("com.mysql.jdbc.AbandonedConnectionCleanupThread"); Method shutdownMethod = (cls == null ? null : cls.getMethod("shutdown")); // depends on control dependency: [try], data = [none] if (shutdownMethod != null) { shutdownMethod.invoke(null); // depends on control dependency: [if], data = [null)] } } catch (Throwable e) { System.out.println("Failed to shutdown MySQL connection cleanup thread: " + e.getMessage()); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public EClass getIfcBoundaryCurve() { if (ifcBoundaryCurveEClass == null) { ifcBoundaryCurveEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(48); } return ifcBoundaryCurveEClass; } }
public class class_name { @Override public EClass getIfcBoundaryCurve() { if (ifcBoundaryCurveEClass == null) { ifcBoundaryCurveEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(48); // depends on control dependency: [if], data = [none] } return ifcBoundaryCurveEClass; } }
public class class_name { public static Duration add(Duration a, Duration b, ProjectProperties defaults) { if (a == null && b == null) { return null; } if (a == null) { return b; } if (b == null) { return a; } TimeUnit unit = a.getUnits(); if (b.getUnits() != unit) { b = b.convertUnits(unit, defaults); } return Duration.getInstance(a.getDuration() + b.getDuration(), unit); } }
public class class_name { public static Duration add(Duration a, Duration b, ProjectProperties defaults) { if (a == null && b == null) { return null; // depends on control dependency: [if], data = [none] } if (a == null) { return b; // depends on control dependency: [if], data = [none] } if (b == null) { return a; // depends on control dependency: [if], data = [none] } TimeUnit unit = a.getUnits(); if (b.getUnits() != unit) { b = b.convertUnits(unit, defaults); // depends on control dependency: [if], data = [none] } return Duration.getInstance(a.getDuration() + b.getDuration(), unit); } }
public class class_name { public void marshall(PutMethodRequest putMethodRequest, ProtocolMarshaller protocolMarshaller) { if (putMethodRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(putMethodRequest.getRestApiId(), RESTAPIID_BINDING); protocolMarshaller.marshall(putMethodRequest.getResourceId(), RESOURCEID_BINDING); protocolMarshaller.marshall(putMethodRequest.getHttpMethod(), HTTPMETHOD_BINDING); protocolMarshaller.marshall(putMethodRequest.getAuthorizationType(), AUTHORIZATIONTYPE_BINDING); protocolMarshaller.marshall(putMethodRequest.getAuthorizerId(), AUTHORIZERID_BINDING); protocolMarshaller.marshall(putMethodRequest.getApiKeyRequired(), APIKEYREQUIRED_BINDING); protocolMarshaller.marshall(putMethodRequest.getOperationName(), OPERATIONNAME_BINDING); protocolMarshaller.marshall(putMethodRequest.getRequestParameters(), REQUESTPARAMETERS_BINDING); protocolMarshaller.marshall(putMethodRequest.getRequestModels(), REQUESTMODELS_BINDING); protocolMarshaller.marshall(putMethodRequest.getRequestValidatorId(), REQUESTVALIDATORID_BINDING); protocolMarshaller.marshall(putMethodRequest.getAuthorizationScopes(), AUTHORIZATIONSCOPES_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(PutMethodRequest putMethodRequest, ProtocolMarshaller protocolMarshaller) { if (putMethodRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(putMethodRequest.getRestApiId(), RESTAPIID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(putMethodRequest.getResourceId(), RESOURCEID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(putMethodRequest.getHttpMethod(), HTTPMETHOD_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(putMethodRequest.getAuthorizationType(), AUTHORIZATIONTYPE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(putMethodRequest.getAuthorizerId(), AUTHORIZERID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(putMethodRequest.getApiKeyRequired(), APIKEYREQUIRED_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(putMethodRequest.getOperationName(), OPERATIONNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(putMethodRequest.getRequestParameters(), REQUESTPARAMETERS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(putMethodRequest.getRequestModels(), REQUESTMODELS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(putMethodRequest.getRequestValidatorId(), REQUESTVALIDATORID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(putMethodRequest.getAuthorizationScopes(), AUTHORIZATIONSCOPES_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 final MobicentsSipSession getSipSession() { if(logger.isDebugEnabled()) { logger.debug("getSipSession"); } if(sipSession == null && sessionKey == null) { sessionKey = getSipSessionKey(); if(logger.isDebugEnabled()) { logger.debug("sessionKey is " + sessionKey); } if(sessionKey == null) { if(sipSession == null) { if(transactionApplicationData != null) { this.sessionKey = transactionApplicationData.getSipSessionKey(); if(logger.isDebugEnabled()) { logger.debug("session Key is " + sessionKey + ", retrieved from the txAppData " + transactionApplicationData); } } else if (transaction != null && transaction.getApplicationData() != null) { this.sessionKey = ((TransactionApplicationData)transaction.getApplicationData()).getSipSessionKey(); if(logger.isDebugEnabled()) { logger.debug("session Key is " + sessionKey + ", retrieved from the transaction txAppData " + (TransactionApplicationData)transaction.getApplicationData()); } } else { if(logger.isDebugEnabled()) { logger.debug("txAppData and transaction txAppData are both null, there is no wya to retrieve the sessionKey anymore"); } } } else { this.sessionKey = sipSession.getKey(); } } if(logger.isDebugEnabled()) { logger.debug("sessionKey is " + sessionKey); } } if(sipSession == null && sessionKey != null) { if(logger.isDebugEnabled()) { logger.debug("session is null, trying to load the session from the sessionKey " + sessionKey); } final String applicationName = sessionKey.getApplicationName(); final SipContext sipContext = sipFactoryImpl.getSipApplicationDispatcher().findSipApplication(applicationName); SipApplicationSessionKey sipApplicationSessionKey = new SipApplicationSessionKey(sessionKey.getApplicationSessionId(), sessionKey.getApplicationName(), null); MobicentsSipApplicationSession sipApplicationSession = sipContext.getSipManager().getSipApplicationSession(sipApplicationSessionKey, false); sipSession = sipContext.getSipManager().getSipSession(sessionKey, false, sipFactoryImpl, sipApplicationSession); if(logger.isDebugEnabled()) { if(sipSession == null) { logger.debug("couldn't find any session with sessionKey " + sessionKey); } else { logger.debug("reloaded session session " + sipSession + " with sessionKey " + sessionKey); } } } return sipSession; } }
public class class_name { public final MobicentsSipSession getSipSession() { if(logger.isDebugEnabled()) { logger.debug("getSipSession"); // depends on control dependency: [if], data = [none] } if(sipSession == null && sessionKey == null) { sessionKey = getSipSessionKey(); // depends on control dependency: [if], data = [none] if(logger.isDebugEnabled()) { logger.debug("sessionKey is " + sessionKey); // depends on control dependency: [if], data = [none] } if(sessionKey == null) { if(sipSession == null) { if(transactionApplicationData != null) { this.sessionKey = transactionApplicationData.getSipSessionKey(); // depends on control dependency: [if], data = [none] if(logger.isDebugEnabled()) { logger.debug("session Key is " + sessionKey + ", retrieved from the txAppData " + transactionApplicationData); // depends on control dependency: [if], data = [none] } } else if (transaction != null && transaction.getApplicationData() != null) { this.sessionKey = ((TransactionApplicationData)transaction.getApplicationData()).getSipSessionKey(); // depends on control dependency: [if], data = [none] if(logger.isDebugEnabled()) { logger.debug("session Key is " + sessionKey + ", retrieved from the transaction txAppData " + (TransactionApplicationData)transaction.getApplicationData()); // depends on control dependency: [if], data = [none] } } else { if(logger.isDebugEnabled()) { logger.debug("txAppData and transaction txAppData are both null, there is no wya to retrieve the sessionKey anymore"); // depends on control dependency: [if], data = [none] } } } else { this.sessionKey = sipSession.getKey(); // depends on control dependency: [if], data = [none] } } if(logger.isDebugEnabled()) { logger.debug("sessionKey is " + sessionKey); // depends on control dependency: [if], data = [none] } } if(sipSession == null && sessionKey != null) { if(logger.isDebugEnabled()) { logger.debug("session is null, trying to load the session from the sessionKey " + sessionKey); // depends on control dependency: [if], data = [none] } final String applicationName = sessionKey.getApplicationName(); final SipContext sipContext = sipFactoryImpl.getSipApplicationDispatcher().findSipApplication(applicationName); SipApplicationSessionKey sipApplicationSessionKey = new SipApplicationSessionKey(sessionKey.getApplicationSessionId(), sessionKey.getApplicationName(), null); MobicentsSipApplicationSession sipApplicationSession = sipContext.getSipManager().getSipApplicationSession(sipApplicationSessionKey, false); sipSession = sipContext.getSipManager().getSipSession(sessionKey, false, sipFactoryImpl, sipApplicationSession); // depends on control dependency: [if], data = [none] if(logger.isDebugEnabled()) { if(sipSession == null) { logger.debug("couldn't find any session with sessionKey " + sessionKey); // depends on control dependency: [if], data = [none] } else { logger.debug("reloaded session session " + sipSession + " with sessionKey " + sessionKey); // depends on control dependency: [if], data = [none] } } } return sipSession; } }
public class class_name { public void clearErrors() { errorLabel.setText(StringUtils.EMPTY); errorLabel.getElement().getStyle().setDisplay(Display.NONE); if (contents.getWidget() != null) { contents.getWidget().removeStyleName(decoratorStyle.errorInputStyle()); contents.getWidget().removeStyleName(decoratorStyle.validInputStyle()); } } }
public class class_name { public void clearErrors() { errorLabel.setText(StringUtils.EMPTY); errorLabel.getElement().getStyle().setDisplay(Display.NONE); if (contents.getWidget() != null) { contents.getWidget().removeStyleName(decoratorStyle.errorInputStyle()); // depends on control dependency: [if], data = [none] contents.getWidget().removeStyleName(decoratorStyle.validInputStyle()); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void clear() { Entry tab[] = mTable; mModCount++; for (int index = tab.length; --index >= 0; ) { tab[index] = null; } mCount = 0; } }
public class class_name { public void clear() { Entry tab[] = mTable; mModCount++; for (int index = tab.length; --index >= 0; ) { tab[index] = null; // depends on control dependency: [for], data = [index] } mCount = 0; } }
public class class_name { public static boolean adjustProtonation(IMolecularFormula mf, int hcnt) { if (mf == null) throw new NullPointerException("No formula provided"); if (hcnt == 0) return false; // no protons to add final IChemObjectBuilder bldr = mf.getBuilder(); final int chg = mf.getCharge() != null ? mf.getCharge() : 0; IIsotope proton = null; int pcount = 0; for (IIsotope iso : mf.isotopes()) { if ("H".equals(iso.getSymbol())) { final int count = mf.getIsotopeCount(iso); if (count < hcnt) continue; // acceptable if (proton == null && (iso.getMassNumber() == null || iso.getMassNumber() == 1)) { proton = iso; pcount = count; } // better else if (proton != null && iso.getMassNumber() != null && iso.getMassNumber() == 1 && proton.getMassNumber() == null) { proton = iso; pcount = count; } } } if (proton == null && hcnt < 0) { return false; } else if (proton == null && hcnt > 0) { proton = bldr.newInstance(IIsotope.class, "H"); proton.setMassNumber(1); } mf.removeIsotope(proton); if (pcount + hcnt > 0) mf.addIsotope(proton, pcount + hcnt); mf.setCharge(chg + hcnt); return true; } }
public class class_name { public static boolean adjustProtonation(IMolecularFormula mf, int hcnt) { if (mf == null) throw new NullPointerException("No formula provided"); if (hcnt == 0) return false; // no protons to add final IChemObjectBuilder bldr = mf.getBuilder(); final int chg = mf.getCharge() != null ? mf.getCharge() : 0; IIsotope proton = null; int pcount = 0; for (IIsotope iso : mf.isotopes()) { if ("H".equals(iso.getSymbol())) { final int count = mf.getIsotopeCount(iso); if (count < hcnt) continue; // acceptable if (proton == null && (iso.getMassNumber() == null || iso.getMassNumber() == 1)) { proton = iso; // depends on control dependency: [if], data = [none] pcount = count; // depends on control dependency: [if], data = [none] } // better else if (proton != null && iso.getMassNumber() != null && iso.getMassNumber() == 1 && proton.getMassNumber() == null) { proton = iso; // depends on control dependency: [if], data = [none] pcount = count; // depends on control dependency: [if], data = [none] } } } if (proton == null && hcnt < 0) { return false; // depends on control dependency: [if], data = [none] } else if (proton == null && hcnt > 0) { proton = bldr.newInstance(IIsotope.class, "H"); // depends on control dependency: [if], data = [none] proton.setMassNumber(1); // depends on control dependency: [if], data = [none] } mf.removeIsotope(proton); if (pcount + hcnt > 0) mf.addIsotope(proton, pcount + hcnt); mf.setCharge(chg + hcnt); return true; } }
public class class_name { protected CmsParameterConfiguration getComponentsProperties(String location) throws FileNotFoundException, CmsConfigurationException { InputStream stream = null; ZipFile zipFile = null; try { // try to interpret the fileName as a folder File folder = new File(location); // if it is a file it must be a zip-file if (folder.isFile()) { zipFile = new ZipFile(location); ZipEntry entry = zipFile.getEntry(COMPONENTS_PROPERTIES); // path to file might be relative, too if ((entry == null) && location.startsWith("/")) { entry = zipFile.getEntry(location.substring(1)); } if (entry == null) { zipFile.close(); throw new FileNotFoundException( org.opencms.importexport.Messages.get().getBundle().key( org.opencms.importexport.Messages.LOG_IMPORTEXPORT_FILE_NOT_FOUND_IN_ZIP_1, location + "/" + COMPONENTS_PROPERTIES)); } stream = zipFile.getInputStream(entry); } else { // it is a folder File file = new File(folder, COMPONENTS_PROPERTIES); stream = new FileInputStream(file); } return new CmsParameterConfiguration(stream); } catch (Throwable ioe) { if (stream != null) { try { stream.close(); } catch (IOException e) { if (LOG.isDebugEnabled()) { LOG.debug(e.getLocalizedMessage(), e); } } } if (zipFile != null) { try { zipFile.close(); } catch (IOException e) { if (LOG.isDebugEnabled()) { LOG.debug(e.getLocalizedMessage(), e); } } } if (ioe instanceof FileNotFoundException) { throw (FileNotFoundException)ioe; } CmsMessageContainer msg = org.opencms.importexport.Messages.get().container( org.opencms.importexport.Messages.ERR_IMPORTEXPORT_ERROR_READING_FILE_1, location + "/" + COMPONENTS_PROPERTIES); if (LOG.isErrorEnabled()) { LOG.error(msg.key(), ioe); } throw new CmsConfigurationException(msg, ioe); } } }
public class class_name { protected CmsParameterConfiguration getComponentsProperties(String location) throws FileNotFoundException, CmsConfigurationException { InputStream stream = null; ZipFile zipFile = null; try { // try to interpret the fileName as a folder File folder = new File(location); // if it is a file it must be a zip-file if (folder.isFile()) { zipFile = new ZipFile(location); // depends on control dependency: [if], data = [none] ZipEntry entry = zipFile.getEntry(COMPONENTS_PROPERTIES); // path to file might be relative, too if ((entry == null) && location.startsWith("/")) { entry = zipFile.getEntry(location.substring(1)); // depends on control dependency: [if], data = [none] } if (entry == null) { zipFile.close(); // depends on control dependency: [if], data = [none] throw new FileNotFoundException( org.opencms.importexport.Messages.get().getBundle().key( org.opencms.importexport.Messages.LOG_IMPORTEXPORT_FILE_NOT_FOUND_IN_ZIP_1, location + "/" + COMPONENTS_PROPERTIES)); } stream = zipFile.getInputStream(entry); // depends on control dependency: [if], data = [none] } else { // it is a folder File file = new File(folder, COMPONENTS_PROPERTIES); stream = new FileInputStream(file); // depends on control dependency: [if], data = [none] } return new CmsParameterConfiguration(stream); } catch (Throwable ioe) { if (stream != null) { try { stream.close(); // depends on control dependency: [try], data = [none] } catch (IOException e) { if (LOG.isDebugEnabled()) { LOG.debug(e.getLocalizedMessage(), e); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } if (zipFile != null) { try { zipFile.close(); // depends on control dependency: [try], data = [none] } catch (IOException e) { if (LOG.isDebugEnabled()) { LOG.debug(e.getLocalizedMessage(), e); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } if (ioe instanceof FileNotFoundException) { throw (FileNotFoundException)ioe; } CmsMessageContainer msg = org.opencms.importexport.Messages.get().container( org.opencms.importexport.Messages.ERR_IMPORTEXPORT_ERROR_READING_FILE_1, location + "/" + COMPONENTS_PROPERTIES); if (LOG.isErrorEnabled()) { LOG.error(msg.key(), ioe); // depends on control dependency: [if], data = [none] } throw new CmsConfigurationException(msg, ioe); } } }
public class class_name { private PHS398Checklist13Document getPHS398Checklist() { PHS398Checklist13Document phsChecklistDocument = PHS398Checklist13Document.Factory .newInstance(); PHS398Checklist13 phsChecklist = PHS398Checklist13.Factory.newInstance(); answerHeaders = getPropDevQuestionAnswerService().getQuestionnaireAnswerHeaders(pdDoc.getDevelopmentProposal().getProposalNumber()); setPhsCheckListBasicProperties(phsChecklist); setFormerPDNameAndIsChangeOfPDPI(phsChecklist); setFormerInstitutionNameAndChangeOfInstitution(phsChecklist); setIsInventionsAndPatentsAndIsPreviouslyReported(phsChecklist); ProposalDevelopmentBudgetExtContract budget = s2SCommonBudgetService.getBudget(pdDoc.getDevelopmentProposal()); if (budget != null) { int numPeriods = budget.getBudgetPeriods().size(); setIncomeBudgetPeriods(phsChecklist, budget.getBudgetProjectIncomes()); } else { phsChecklist.setProgramIncome(YesNoDataType.N_NO); } ynqAnswer = getYNQAnswer(YNQANSWER_121); phsChecklist.setDisclosurePermission(ynqAnswer); phsChecklistDocument.setPHS398Checklist13(phsChecklist); return phsChecklistDocument; } }
public class class_name { private PHS398Checklist13Document getPHS398Checklist() { PHS398Checklist13Document phsChecklistDocument = PHS398Checklist13Document.Factory .newInstance(); PHS398Checklist13 phsChecklist = PHS398Checklist13.Factory.newInstance(); answerHeaders = getPropDevQuestionAnswerService().getQuestionnaireAnswerHeaders(pdDoc.getDevelopmentProposal().getProposalNumber()); setPhsCheckListBasicProperties(phsChecklist); setFormerPDNameAndIsChangeOfPDPI(phsChecklist); setFormerInstitutionNameAndChangeOfInstitution(phsChecklist); setIsInventionsAndPatentsAndIsPreviouslyReported(phsChecklist); ProposalDevelopmentBudgetExtContract budget = s2SCommonBudgetService.getBudget(pdDoc.getDevelopmentProposal()); if (budget != null) { int numPeriods = budget.getBudgetPeriods().size(); setIncomeBudgetPeriods(phsChecklist, budget.getBudgetProjectIncomes()); // depends on control dependency: [if], data = [none] } else { phsChecklist.setProgramIncome(YesNoDataType.N_NO); // depends on control dependency: [if], data = [none] } ynqAnswer = getYNQAnswer(YNQANSWER_121); phsChecklist.setDisclosurePermission(ynqAnswer); phsChecklistDocument.setPHS398Checklist13(phsChecklist); return phsChecklistDocument; } }
public class class_name { public void addGLL( GLLSentence gll ) { try { if (gll.isValid()) position = gll.getPosition(); } catch (Exception e) { // ignore it, this should be handled in the isValid, // if an exception is thrown, we can't deal with it here. } } }
public class class_name { public void addGLL( GLLSentence gll ) { try { if (gll.isValid()) position = gll.getPosition(); } catch (Exception e) { // ignore it, this should be handled in the isValid, // if an exception is thrown, we can't deal with it here. } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Pure public boolean isContainerColorUsed() { final AttributeValue val = getAttributeCollection().getAttribute(ATTR_USE_CONTAINER_COLOR); if (val != null) { try { return val.getBoolean(); } catch (AttributeException e) { // } } return false; } }
public class class_name { @Pure public boolean isContainerColorUsed() { final AttributeValue val = getAttributeCollection().getAttribute(ATTR_USE_CONTAINER_COLOR); if (val != null) { try { return val.getBoolean(); // depends on control dependency: [try], data = [none] } catch (AttributeException e) { // } // depends on control dependency: [catch], data = [none] } return false; } }
public class class_name { @CommandArgument public void stat(int index) { if (this.jobProgressStates == null) { System.err.println("Server not running"); return; } if (index == 0) { List<ProgressState> progress = new ArrayList<ProgressState>(this.jobProgressStates); if (progress != null) { System.out.println(" # Title Progress Status "); System.out.println("------------------------------------------------------------------------"); for (int i = 0, n = progress.size(); i < n; i++) { ProgressState state = progress.get(i); char flag = ' '; if (state.isComplete()) { flag = '*'; } else if (state.isCancelled()) { flag = 'X'; } else if (state.isCancelPending()) { flag = 'C'; } String title = state.getTitle(); if (title.length() > 25) { title = title.substring(0, 24) + ">"; } String status = state.getStatus(); if (status.length() > 32) { status = status.substring(0, 31) + ">"; } String progStr = (state.isIndeterminant() ? "????????" : String.format(" % 6.2f%%", 100.0 * state.getProgress())); System.out.printf("%c% 3d %-25s %s %-33s\n", flag, i + 1, title, progStr, status); } } } else if (index > 0 && index <= this.jobProgressStates.size()) { ProgressState state = this.jobProgressStates.get(index - 1); System.out.printf("Job #%d", index); if (state.isComplete()) { System.out.print(" [COMPLETE]"); } else if (state.isCancelled()) { System.out.print(" [CANCELLED]"); } else if (state.isCancelPending()) { System.out.print(" [CANCEL PENDING]"); } System.out.println(); System.out.printf("Title : %s\n", state.getTitle()); if (state.isIndeterminant()) { System.out.print("Progress : ???"); } else { System.out.printf("Progress : %.2f%%", 100.0 * state.getProgress()); } int maximum = state.getMaximum(); int value = state.getValue(); if (maximum > 0) { System.out.printf(" (%d/%d)", value, maximum); } System.out.println(); System.out.printf("Status : %s\n", state.getStatus()); } else { System.err.println("Invalid job number"); } } }
public class class_name { @CommandArgument public void stat(int index) { if (this.jobProgressStates == null) { System.err.println("Server not running"); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (index == 0) { List<ProgressState> progress = new ArrayList<ProgressState>(this.jobProgressStates); if (progress != null) { System.out.println(" # Title Progress Status "); // depends on control dependency: [if], data = [none] System.out.println("------------------------------------------------------------------------"); for (int i = 0, n = progress.size(); i < n; i++) { ProgressState state = progress.get(i); char flag = ' '; if (state.isComplete()) { flag = '*'; } else if (state.isCancelled()) { flag = 'X'; } else if (state.isCancelPending()) { flag = 'C'; } String title = state.getTitle(); if (title.length() > 25) { title = title.substring(0, 24) + ">"; } String status = state.getStatus(); if (status.length() > 32) { status = status.substring(0, 31) + ">"; } String progStr = (state.isIndeterminant() ? "????????" : String.format(" % 6.2f%%", 100.0 * state.getProgress())); // depends on control dependency: [if], data = [none] System.out.printf("%c% 3d %-25s %s %-33s\n", flag, i + 1, title, progStr, status); } } } else if (index > 0 && index <= this.jobProgressStates.size()) { ProgressState state = this.jobProgressStates.get(index - 1); System.out.printf("Job #%d", index); if (state.isComplete()) { System.out.print(" [COMPLETE]"); // depends on control dependency: [if], data = [none] } else if (state.isCancelled()) { System.out.print(" [CANCELLED]"); // depends on control dependency: [if], data = [none] } else if (state.isCancelPending()) { System.out.print(" [CANCEL PENDING]"); // depends on control dependency: [if], data = [none] } System.out.println(); System.out.printf("Title : %s\n", state.getTitle()); if (state.isIndeterminant()) { System.out.print("Progress : ???"); // depends on control dependency: [if], data = [none] } else { System.out.printf("Progress : %.2f%%", 100.0 * state.getProgress()); // depends on control dependency: [if], data = [none] } int maximum = state.getMaximum(); int value = state.getValue(); if (maximum > 0) { System.out.printf(" (%d/%d)", value, maximum); // depends on control dependency: [if], data = [none] } System.out.println(); System.out.printf("Status : %s\n", state.getStatus()); } else { System.err.println("Invalid job number"); } } }
public class class_name { public void addTrackPositionListener(int player, TrackPositionListener listener) { listenerPlayerNumbers.put(listener, player); TrackPositionUpdate currentPosition = positions.get(player); if (currentPosition != null) { listener.movementChanged(currentPosition); trackPositionListeners.put(listener, currentPosition); } else { trackPositionListeners.put(listener, NO_INFORMATION); } } }
public class class_name { public void addTrackPositionListener(int player, TrackPositionListener listener) { listenerPlayerNumbers.put(listener, player); TrackPositionUpdate currentPosition = positions.get(player); if (currentPosition != null) { listener.movementChanged(currentPosition); // depends on control dependency: [if], data = [(currentPosition] trackPositionListeners.put(listener, currentPosition); // depends on control dependency: [if], data = [none] } else { trackPositionListeners.put(listener, NO_INFORMATION); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected List<String> idsList() { if (!isForAll()) { return CmsStringUtil.splitAsList(getParamSessionids(), CmsHtmlList.ITEM_SEPARATOR); } List<CmsUser> manageableUsers = new ArrayList<CmsUser>(); try { manageableUsers = OpenCms.getRoleManager().getManageableUsers(getCms(), "", true); } catch (CmsException e) { if (LOG.isErrorEnabled()) { LOG.error(e.getLocalizedMessage(), e); } } List<String> ids = new ArrayList<String>(); Iterator<CmsSessionInfo> itSessions = OpenCms.getSessionManager().getSessionInfos().iterator(); while (itSessions.hasNext()) { CmsSessionInfo sessionInfo = itSessions.next(); CmsUser user; try { user = getCms().readUser(sessionInfo.getUserId()); } catch (CmsException e) { if (LOG.isWarnEnabled()) { LOG.warn(e.getLocalizedMessage(), e); } continue; } if (!manageableUsers.contains(user)) { continue; } ids.add(sessionInfo.getSessionId().toString()); } return ids; } }
public class class_name { protected List<String> idsList() { if (!isForAll()) { return CmsStringUtil.splitAsList(getParamSessionids(), CmsHtmlList.ITEM_SEPARATOR); // depends on control dependency: [if], data = [none] } List<CmsUser> manageableUsers = new ArrayList<CmsUser>(); try { manageableUsers = OpenCms.getRoleManager().getManageableUsers(getCms(), "", true); // depends on control dependency: [try], data = [none] } catch (CmsException e) { if (LOG.isErrorEnabled()) { LOG.error(e.getLocalizedMessage(), e); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] List<String> ids = new ArrayList<String>(); Iterator<CmsSessionInfo> itSessions = OpenCms.getSessionManager().getSessionInfos().iterator(); while (itSessions.hasNext()) { CmsSessionInfo sessionInfo = itSessions.next(); CmsUser user; try { user = getCms().readUser(sessionInfo.getUserId()); // depends on control dependency: [try], data = [none] } catch (CmsException e) { if (LOG.isWarnEnabled()) { LOG.warn(e.getLocalizedMessage(), e); // depends on control dependency: [if], data = [none] } continue; } // depends on control dependency: [catch], data = [none] if (!manageableUsers.contains(user)) { continue; } ids.add(sessionInfo.getSessionId().toString()); // depends on control dependency: [while], data = [none] } return ids; } }
public class class_name { public @NotNull StringAssert contains(String expected) { isNotNull(); if (actual.indexOf(expected) != -1) { return this; } failIfCustomMessageIsSet(); throw failure(format("<%s> should contain the String:<%s>", actual, expected)); } }
public class class_name { public @NotNull StringAssert contains(String expected) { isNotNull(); if (actual.indexOf(expected) != -1) { return this; // depends on control dependency: [if], data = [none] } failIfCustomMessageIsSet(); throw failure(format("<%s> should contain the String:<%s>", actual, expected)); } }
public class class_name { private float[] nGroups0(int bitmap_flag, float ref, float mv1) { float[] data = new float[totalNPoints]; if (bitmap_flag == 255) { for (int i = 0; i < totalNPoints; i++) { data[i] = ref; } } else if (bitmap_flag == 0 || bitmap_flag == 254) { int mask = 0; int mask_pointer = 0; for (int i = 0; i < totalNPoints; i++) { if ((i & 7) == 0) { mask = bitmap[mask_pointer]; mask_pointer++; } data[i] = ((mask & 128) == 0) ? ref : mv1; mask <<= 1; } } else { throw new IllegalArgumentException("unknown bitmap type =" + bitmap_flag); } return data; } }
public class class_name { private float[] nGroups0(int bitmap_flag, float ref, float mv1) { float[] data = new float[totalNPoints]; if (bitmap_flag == 255) { for (int i = 0; i < totalNPoints; i++) { data[i] = ref; // depends on control dependency: [for], data = [i] } } else if (bitmap_flag == 0 || bitmap_flag == 254) { int mask = 0; int mask_pointer = 0; for (int i = 0; i < totalNPoints; i++) { if ((i & 7) == 0) { mask = bitmap[mask_pointer]; // depends on control dependency: [if], data = [none] mask_pointer++; // depends on control dependency: [if], data = [none] } data[i] = ((mask & 128) == 0) ? ref : mv1; // depends on control dependency: [for], data = [i] mask <<= 1; // depends on control dependency: [for], data = [none] } } else { throw new IllegalArgumentException("unknown bitmap type =" + bitmap_flag); } return data; } }
public class class_name { protected void setAuditMessageElements(EventIdentificationType eventId, ActiveParticipantType[] participants, AuditSourceIdentificationType[] sourceIds, ParticipantObjectIdentificationType[] objectIds) { AuditMessage auditMessage = getAuditMessage(); auditMessage.setEventIdentification(eventId); // Reset active participants auditMessage.getActiveParticipant().clear(); if (!EventUtils.isEmptyOrNull(participants, true)) { auditMessage.getActiveParticipant().addAll(Arrays.asList(participants)); } // reset audit source ids auditMessage.getAuditSourceIdentification().clear(); if (!EventUtils.isEmptyOrNull(sourceIds, true)) { auditMessage.getAuditSourceIdentification().addAll(Arrays.asList(sourceIds)); } // Reset participant object ids auditMessage.getParticipantObjectIdentification().clear(); if (!EventUtils.isEmptyOrNull(objectIds, true)) { auditMessage.getParticipantObjectIdentification().addAll(Arrays.asList(objectIds)); } } }
public class class_name { protected void setAuditMessageElements(EventIdentificationType eventId, ActiveParticipantType[] participants, AuditSourceIdentificationType[] sourceIds, ParticipantObjectIdentificationType[] objectIds) { AuditMessage auditMessage = getAuditMessage(); auditMessage.setEventIdentification(eventId); // Reset active participants auditMessage.getActiveParticipant().clear(); if (!EventUtils.isEmptyOrNull(participants, true)) { auditMessage.getActiveParticipant().addAll(Arrays.asList(participants)); // depends on control dependency: [if], data = [none] } // reset audit source ids auditMessage.getAuditSourceIdentification().clear(); if (!EventUtils.isEmptyOrNull(sourceIds, true)) { auditMessage.getAuditSourceIdentification().addAll(Arrays.asList(sourceIds)); // depends on control dependency: [if], data = [none] } // Reset participant object ids auditMessage.getParticipantObjectIdentification().clear(); if (!EventUtils.isEmptyOrNull(objectIds, true)) { auditMessage.getParticipantObjectIdentification().addAll(Arrays.asList(objectIds)); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static List<ChannelBuilder> builders(ClassLoader classLoader, ServiceDomain serviceDomain, KnowledgeComponentImplementationModel implementationModel) { List<ChannelBuilder> builders = new ArrayList<ChannelBuilder>(); if (implementationModel != null) { ChannelsModel channelsModel = implementationModel.getChannels(); if (channelsModel != null) { for (ChannelModel channelModel : channelsModel.getChannels()) { if (channelModel != null) { builders.add(new ChannelBuilder(classLoader, serviceDomain, channelModel)); } } } } return builders; } }
public class class_name { public static List<ChannelBuilder> builders(ClassLoader classLoader, ServiceDomain serviceDomain, KnowledgeComponentImplementationModel implementationModel) { List<ChannelBuilder> builders = new ArrayList<ChannelBuilder>(); if (implementationModel != null) { ChannelsModel channelsModel = implementationModel.getChannels(); if (channelsModel != null) { for (ChannelModel channelModel : channelsModel.getChannels()) { if (channelModel != null) { builders.add(new ChannelBuilder(classLoader, serviceDomain, channelModel)); // depends on control dependency: [if], data = [none] } } } } return builders; } }
public class class_name { public HttpRequest path(String path) { // this must be the only place that sets the path if (!path.startsWith(StringPool.SLASH)) { path = StringPool.SLASH + path; } int ndx = path.indexOf('?'); if (ndx != -1) { String queryString = path.substring(ndx + 1); path = path.substring(0, ndx); query = HttpUtil.parseQuery(queryString, true); } else { query = HttpMultiMap.newCaseInsensitiveMap(); } this.path = path; return this; } }
public class class_name { public HttpRequest path(String path) { // this must be the only place that sets the path if (!path.startsWith(StringPool.SLASH)) { path = StringPool.SLASH + path; // depends on control dependency: [if], data = [none] } int ndx = path.indexOf('?'); if (ndx != -1) { String queryString = path.substring(ndx + 1); path = path.substring(0, ndx); // depends on control dependency: [if], data = [none] query = HttpUtil.parseQuery(queryString, true); // depends on control dependency: [if], data = [none] } else { query = HttpMultiMap.newCaseInsensitiveMap(); // depends on control dependency: [if], data = [none] } this.path = path; return this; } }
public class class_name { private void addPostParams(final Request request) { if (actions != null) { request.addPostParam("Actions", Converter.mapToJson(actions)); } } }
public class class_name { private void addPostParams(final Request request) { if (actions != null) { request.addPostParam("Actions", Converter.mapToJson(actions)); // depends on control dependency: [if], data = [(actions] } } }
public class class_name { public List<Integer> searchBigBytes(byte[] srcBytes, byte[] searchBytes) { int numOfThreadsOptimized = (srcBytes.length / analyzeByteArrayUnitSize); if (numOfThreadsOptimized == 0) { numOfThreadsOptimized = 1; } return searchBigBytes(srcBytes, searchBytes, numOfThreadsOptimized); } }
public class class_name { public List<Integer> searchBigBytes(byte[] srcBytes, byte[] searchBytes) { int numOfThreadsOptimized = (srcBytes.length / analyzeByteArrayUnitSize); if (numOfThreadsOptimized == 0) { numOfThreadsOptimized = 1; // depends on control dependency: [if], data = [none] } return searchBigBytes(srcBytes, searchBytes, numOfThreadsOptimized); } }
public class class_name { public RegexPatternSet withRegexPatternStrings(String... regexPatternStrings) { if (this.regexPatternStrings == null) { setRegexPatternStrings(new java.util.ArrayList<String>(regexPatternStrings.length)); } for (String ele : regexPatternStrings) { this.regexPatternStrings.add(ele); } return this; } }
public class class_name { public RegexPatternSet withRegexPatternStrings(String... regexPatternStrings) { if (this.regexPatternStrings == null) { setRegexPatternStrings(new java.util.ArrayList<String>(regexPatternStrings.length)); // depends on control dependency: [if], data = [none] } for (String ele : regexPatternStrings) { this.regexPatternStrings.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public static byte[] compressByGzip(byte[] sourceBytes) { ByteArrayOutputStream out = new ByteArrayOutputStream(); try { GZIPOutputStream gzip = null; try { gzip = new GZIPOutputStream(out); gzip.write(sourceBytes); gzip.close(); } catch (IOException ex) { return null; } finally { try { if (gzip != null) { gzip.close(); } } catch (IOException ex) { } } return out.toByteArray(); } finally { try { out.close(); } catch (IOException ex) { } } } }
public class class_name { public static byte[] compressByGzip(byte[] sourceBytes) { ByteArrayOutputStream out = new ByteArrayOutputStream(); try { GZIPOutputStream gzip = null; try { gzip = new GZIPOutputStream(out); // depends on control dependency: [try], data = [none] gzip.write(sourceBytes); // depends on control dependency: [try], data = [none] gzip.close(); // depends on control dependency: [try], data = [none] } catch (IOException ex) { return null; } finally { // depends on control dependency: [catch], data = [none] try { if (gzip != null) { gzip.close(); // depends on control dependency: [if], data = [none] } } catch (IOException ex) { } // depends on control dependency: [catch], data = [none] } return out.toByteArray(); // depends on control dependency: [try], data = [none] } finally { try { out.close(); // depends on control dependency: [try], data = [none] } catch (IOException ex) { } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public java.lang.String getTypeHint() { java.lang.Object ref = typeHint_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); typeHint_ = s; return s; } } }
public class class_name { public java.lang.String getTypeHint() { java.lang.Object ref = typeHint_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; // depends on control dependency: [if], data = [none] } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); typeHint_ = s; // depends on control dependency: [if], data = [none] return s; // depends on control dependency: [if], data = [none] } } }
public class class_name { protected void checkAccess() throws EFapsException { for (final Instance instance : getInstances()) { if (!instance.getType().hasAccess(instance, AccessTypeEnums.DELETE.getAccessType(), null)) { LOG.error("Delete not permitted for Person: {} on Instance: {}", Context.getThreadContext().getPerson(), instance); throw new EFapsException(getClass(), "execute.NoAccess", instance); } } } }
public class class_name { protected void checkAccess() throws EFapsException { for (final Instance instance : getInstances()) { if (!instance.getType().hasAccess(instance, AccessTypeEnums.DELETE.getAccessType(), null)) { LOG.error("Delete not permitted for Person: {} on Instance: {}", Context.getThreadContext().getPerson(), instance); // depends on control dependency: [if], data = [none] throw new EFapsException(getClass(), "execute.NoAccess", instance); } } } }
public class class_name { public void marshall(HadoopJarStepConfig hadoopJarStepConfig, ProtocolMarshaller protocolMarshaller) { if (hadoopJarStepConfig == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(hadoopJarStepConfig.getProperties(), PROPERTIES_BINDING); protocolMarshaller.marshall(hadoopJarStepConfig.getJar(), JAR_BINDING); protocolMarshaller.marshall(hadoopJarStepConfig.getMainClass(), MAINCLASS_BINDING); protocolMarshaller.marshall(hadoopJarStepConfig.getArgs(), ARGS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(HadoopJarStepConfig hadoopJarStepConfig, ProtocolMarshaller protocolMarshaller) { if (hadoopJarStepConfig == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(hadoopJarStepConfig.getProperties(), PROPERTIES_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hadoopJarStepConfig.getJar(), JAR_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hadoopJarStepConfig.getMainClass(), MAINCLASS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(hadoopJarStepConfig.getArgs(), ARGS_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void runEDBPostHooks(EDBCommit commit) { for (EDBPostCommitHook hook : postCommitHooks) { try { hook.onPostCommit(commit); } catch (ServiceUnavailableException e) { // Ignore } catch (Exception e) { logger.error("Error while performing EDBPostCommitHook", e); } } } }
public class class_name { private void runEDBPostHooks(EDBCommit commit) { for (EDBPostCommitHook hook : postCommitHooks) { try { hook.onPostCommit(commit); // depends on control dependency: [try], data = [none] } catch (ServiceUnavailableException e) { // Ignore } catch (Exception e) { // depends on control dependency: [catch], data = [none] logger.error("Error while performing EDBPostCommitHook", e); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public void negotiateInitialValueTypes() { // Either of the function result type or parameter type could be null or a specific supported value type, or a generic // NUMERIC. Replace any "generic" type (null or NUMERIC) with the more specific type without over-specifying // -- the BEST type might only become clear later when the context/caller of this function is parsed, so don't // risk guessing wrong here just for the sake of specificity. // There will be a "finalize" pass over the completed expression tree to finish specifying any remaining "generics". // DO use the type chosen by HSQL for the parameterized function as a specific type hint // for numeric constant arguments that could either go decimal or float. AbstractExpression typing_arg = m_args.get(m_resultTypeParameterIndex); VoltType param_type = typing_arg.getValueType(); VoltType value_type = getValueType(); // The heuristic for which type to change is that any type (parameter type or return type) specified so far, // including NUMERIC is better than nothing. And that anything else is better than NUMERIC. if (value_type != param_type) { if (value_type == null) { value_type = param_type; } else if (value_type == VoltType.NUMERIC) { if (param_type != null) { value_type = param_type; } // Pushing a type DOWN to the argument is a lot like work, and not worth it just to // propagate down a known NUMERIC return type, // since it will just have to be re-specialized when a more specific type is inferred from // the context or finalized when the expression is complete. } else if ((param_type == null) || (param_type == VoltType.NUMERIC)) { // The only purpose of refining the parameter argument's type is to force a more specific // refinement than NUMERIC as implied by HSQL, in case that might be more specific than // what can be inferred later from the function call context. typing_arg.refineValueType(value_type, value_type.getMaxLengthInBytes()); } } if (value_type != null) { setValueType(value_type); if (value_type != VoltType.INVALID && value_type != VoltType.NUMERIC) { int size = value_type.getMaxLengthInBytes(); setValueSize(size); } } } }
public class class_name { public void negotiateInitialValueTypes() { // Either of the function result type or parameter type could be null or a specific supported value type, or a generic // NUMERIC. Replace any "generic" type (null or NUMERIC) with the more specific type without over-specifying // -- the BEST type might only become clear later when the context/caller of this function is parsed, so don't // risk guessing wrong here just for the sake of specificity. // There will be a "finalize" pass over the completed expression tree to finish specifying any remaining "generics". // DO use the type chosen by HSQL for the parameterized function as a specific type hint // for numeric constant arguments that could either go decimal or float. AbstractExpression typing_arg = m_args.get(m_resultTypeParameterIndex); VoltType param_type = typing_arg.getValueType(); VoltType value_type = getValueType(); // The heuristic for which type to change is that any type (parameter type or return type) specified so far, // including NUMERIC is better than nothing. And that anything else is better than NUMERIC. if (value_type != param_type) { if (value_type == null) { value_type = param_type; // depends on control dependency: [if], data = [none] } else if (value_type == VoltType.NUMERIC) { if (param_type != null) { value_type = param_type; // depends on control dependency: [if], data = [none] } // Pushing a type DOWN to the argument is a lot like work, and not worth it just to // propagate down a known NUMERIC return type, // since it will just have to be re-specialized when a more specific type is inferred from // the context or finalized when the expression is complete. } else if ((param_type == null) || (param_type == VoltType.NUMERIC)) { // The only purpose of refining the parameter argument's type is to force a more specific // refinement than NUMERIC as implied by HSQL, in case that might be more specific than // what can be inferred later from the function call context. typing_arg.refineValueType(value_type, value_type.getMaxLengthInBytes()); // depends on control dependency: [if], data = [none] } } if (value_type != null) { setValueType(value_type); // depends on control dependency: [if], data = [(value_type] if (value_type != VoltType.INVALID && value_type != VoltType.NUMERIC) { int size = value_type.getMaxLengthInBytes(); setValueSize(size); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public AuthorizingCallbackHandler getCallbackHandler(final String mechanismName, final Map<String, String> mechanismProperties) { return new AuthorizingCallbackHandler() { Subject subject = new Subject(); Principal userPrincipal; public void handle(final Callback[] callbacks) throws IOException, UnsupportedCallbackException { String userName = null; String realmName = null; for (Callback callback : callbacks) { if (callback instanceof NameCallback) { final NameCallback nameCallback = (NameCallback) callback; final String defaultName = nameCallback.getDefaultName(); userName = defaultName.toLowerCase().trim(); nameCallback.setName(userName); userPrincipal = new SimpleUserPrincipal(userName); subject.getPrincipals().add(userPrincipal); } else if (callback instanceof RealmCallback) { final RealmCallback realmCallback = (RealmCallback) callback; final String defaultRealm = realmCallback.getDefaultText(); if (defaultRealm != null) { realmName = defaultRealm.toLowerCase().trim(); realmCallback.setText(realmName); } } else if (callback instanceof PasswordCallback) { final PasswordCallback passwordCallback = (PasswordCallback) callback; // retrieve the record based on user and realm (if any) Entry entry = null; if (realmName == null) { // scan all realms synchronized (map) { for (Map<String, Entry> realmMap : map.values()) { if (realmMap.containsKey(userName)) { entry = realmMap.get(userName); break; } } } } else { synchronized (map) { final Map<String, Entry> realmMap = map.get(realmName); if (realmMap != null) { entry = realmMap.get(userName); } } } if (entry == null) { throw new AuthenticationException("No matching user found"); } for (String group : entry.getGroups()) { subject.getPrincipals().add(new SimpleGroupPrincipal(group)); } passwordCallback.setPassword(entry.getPassword()); } else if (callback instanceof AuthorizeCallback) { final AuthorizeCallback authorizeCallback = (AuthorizeCallback) callback; authorizeCallback.setAuthorized(authorizeCallback.getAuthenticationID().equals( authorizeCallback.getAuthorizationID())); } else { throw new UnsupportedCallbackException(callback, "Callback not supported: " + callback); } } } @Override public SubjectUserInfo getSubjectUserInfo(Collection<Principal> principals) { if (principals != null) { subject.getPrincipals().addAll(principals); } if (userPrincipal != null) { return new SimpleSubjectUserInfo(userPrincipal.getName(), subject); } else { return new SimpleSubjectUserInfo(subject); } } }; } }
public class class_name { public AuthorizingCallbackHandler getCallbackHandler(final String mechanismName, final Map<String, String> mechanismProperties) { return new AuthorizingCallbackHandler() { Subject subject = new Subject(); Principal userPrincipal; public void handle(final Callback[] callbacks) throws IOException, UnsupportedCallbackException { String userName = null; String realmName = null; for (Callback callback : callbacks) { if (callback instanceof NameCallback) { final NameCallback nameCallback = (NameCallback) callback; final String defaultName = nameCallback.getDefaultName(); userName = defaultName.toLowerCase().trim(); // depends on control dependency: [if], data = [none] nameCallback.setName(userName); // depends on control dependency: [if], data = [none] userPrincipal = new SimpleUserPrincipal(userName); // depends on control dependency: [if], data = [none] subject.getPrincipals().add(userPrincipal); // depends on control dependency: [if], data = [none] } else if (callback instanceof RealmCallback) { final RealmCallback realmCallback = (RealmCallback) callback; final String defaultRealm = realmCallback.getDefaultText(); if (defaultRealm != null) { realmName = defaultRealm.toLowerCase().trim(); // depends on control dependency: [if], data = [none] realmCallback.setText(realmName); // depends on control dependency: [if], data = [none] } } else if (callback instanceof PasswordCallback) { final PasswordCallback passwordCallback = (PasswordCallback) callback; // retrieve the record based on user and realm (if any) Entry entry = null; if (realmName == null) { // scan all realms synchronized (map) { // depends on control dependency: [if], data = [none] for (Map<String, Entry> realmMap : map.values()) { if (realmMap.containsKey(userName)) { entry = realmMap.get(userName); // depends on control dependency: [if], data = [none] break; } } } } else { synchronized (map) { // depends on control dependency: [if], data = [none] final Map<String, Entry> realmMap = map.get(realmName); if (realmMap != null) { entry = realmMap.get(userName); // depends on control dependency: [if], data = [none] } } } if (entry == null) { throw new AuthenticationException("No matching user found"); } for (String group : entry.getGroups()) { subject.getPrincipals().add(new SimpleGroupPrincipal(group)); // depends on control dependency: [for], data = [group] } passwordCallback.setPassword(entry.getPassword()); // depends on control dependency: [if], data = [none] } else if (callback instanceof AuthorizeCallback) { final AuthorizeCallback authorizeCallback = (AuthorizeCallback) callback; authorizeCallback.setAuthorized(authorizeCallback.getAuthenticationID().equals( authorizeCallback.getAuthorizationID())); // depends on control dependency: [if], data = [none] } else { throw new UnsupportedCallbackException(callback, "Callback not supported: " + callback); } } } @Override public SubjectUserInfo getSubjectUserInfo(Collection<Principal> principals) { if (principals != null) { subject.getPrincipals().addAll(principals); // depends on control dependency: [if], data = [(principals] } if (userPrincipal != null) { return new SimpleSubjectUserInfo(userPrincipal.getName(), subject); // depends on control dependency: [if], data = [(userPrincipal] } else { return new SimpleSubjectUserInfo(subject); // depends on control dependency: [if], data = [none] } } }; } }
public class class_name { private static Float parseOpacity(String val) { try { float o = parseFloat(val); return (o < 0f) ? 0f : (o > 1f) ? 1f : o; } catch (SVGParseException e) { return null; } } }
public class class_name { private static Float parseOpacity(String val) { try { float o = parseFloat(val); return (o < 0f) ? 0f : (o > 1f) ? 1f : o; // depends on control dependency: [try], data = [none] } catch (SVGParseException e) { return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected void moveUp(int pos) { // if (tc.isEntryEnabled()) // SibTr.entry(tc, "moveUp", new Integer(pos)); PriorityQueueNode node = elements[pos]; long priority = node.priority; while ((pos > 0) && (elements[parent(pos)].priority > priority)) { setElement(elements[parent(pos)], pos); pos = parent(pos); } setElement(node, pos); // if (tc.isEntryEnabled()) // SibTr.exit(tc, "moveUp"); } }
public class class_name { protected void moveUp(int pos) { // if (tc.isEntryEnabled()) // SibTr.entry(tc, "moveUp", new Integer(pos)); PriorityQueueNode node = elements[pos]; long priority = node.priority; while ((pos > 0) && (elements[parent(pos)].priority > priority)) { setElement(elements[parent(pos)], pos); // depends on control dependency: [while], data = [none] pos = parent(pos); // depends on control dependency: [while], data = [none] } setElement(node, pos); // if (tc.isEntryEnabled()) // SibTr.exit(tc, "moveUp"); } }
public class class_name { @Override public <T> T createMockComponent(final Class<T> type) { if (Modifier.isFinal(type.getModifiers()) || type.isPrimitive()) { LOG.warn("Skipping creation of a mock : {} as it is final or primitive type.", type.getSimpleName()); return null; } T mock = createNiceMock(type); return mock; } }
public class class_name { @Override public <T> T createMockComponent(final Class<T> type) { if (Modifier.isFinal(type.getModifiers()) || type.isPrimitive()) { LOG.warn("Skipping creation of a mock : {} as it is final or primitive type.", type.getSimpleName()); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } T mock = createNiceMock(type); return mock; } }
public class class_name { public JSONArray names() { JSONArray ja = new JSONArray(); Iterator<String> keys = keys(); while (keys.hasNext()) { ja.put(keys.next()); } return ja.length() == 0 ? null : ja; } }
public class class_name { public JSONArray names() { JSONArray ja = new JSONArray(); Iterator<String> keys = keys(); while (keys.hasNext()) { ja.put(keys.next()); // depends on control dependency: [while], data = [none] } return ja.length() == 0 ? null : ja; } }
public class class_name { @Override public FileEntry next () { FileEntry n = this.next; try { FileEntry ne = advance(); if ( ne == null ) { doClose(); return n; } this.next = ne; } catch ( CIFSException e ) { log.warn("Enumeration failed", e); this.next = null; } return n; } }
public class class_name { @Override public FileEntry next () { FileEntry n = this.next; try { FileEntry ne = advance(); if ( ne == null ) { doClose(); // depends on control dependency: [if], data = [none] return n; // depends on control dependency: [if], data = [none] } this.next = ne; // depends on control dependency: [try], data = [none] } catch ( CIFSException e ) { log.warn("Enumeration failed", e); this.next = null; } // depends on control dependency: [catch], data = [none] return n; } }
public class class_name { private Set<String> determineReturnTypes(final MethodResult result) { final List<Instruction> visitedInstructions = interpretRelevantInstructions(result.getInstructions()); // find project defined methods in invoke occurrences final Set<ProjectMethod> projectMethods = findProjectMethods(visitedInstructions); // add project methods to global method pool projectMethods.forEach(MethodPool.getInstance()::addProjectMethod); final Element returnedElement = simulator.simulate(visitedInstructions); if (returnedElement == null) { // happens for abstract methods or if there is no return return singleton(result.getOriginalMethodSignature().getReturnType()); } return returnedElement.getTypes(); } }
public class class_name { private Set<String> determineReturnTypes(final MethodResult result) { final List<Instruction> visitedInstructions = interpretRelevantInstructions(result.getInstructions()); // find project defined methods in invoke occurrences final Set<ProjectMethod> projectMethods = findProjectMethods(visitedInstructions); // add project methods to global method pool projectMethods.forEach(MethodPool.getInstance()::addProjectMethod); final Element returnedElement = simulator.simulate(visitedInstructions); if (returnedElement == null) { // happens for abstract methods or if there is no return return singleton(result.getOriginalMethodSignature().getReturnType()); // depends on control dependency: [if], data = [none] } return returnedElement.getTypes(); } }
public class class_name { protected List<?> prepareObjectList(VirtualForm virtualForm, Object bean, String name, Object value, StringBuilder pathSb, FormMappingOption option, PropertyDesc pd) { final List<?> mappedValue; if (isJsonParameterProperty(pd)) { // e.g. public List<SeaJsonBean> jsonList; final Object scalar = prepareObjectScalar(value); mappedValue = parseJsonParameterAsList(virtualForm, bean, name, adjustAsJsonString(scalar), pd); } else { // e.g. List<String>, List<CDef.MemberStatus> mappedValue = prepareSimpleElementList(virtualForm, bean, name, value, pd, pathSb, option); } return mappedValue; } }
public class class_name { protected List<?> prepareObjectList(VirtualForm virtualForm, Object bean, String name, Object value, StringBuilder pathSb, FormMappingOption option, PropertyDesc pd) { final List<?> mappedValue; if (isJsonParameterProperty(pd)) { // e.g. public List<SeaJsonBean> jsonList; final Object scalar = prepareObjectScalar(value); mappedValue = parseJsonParameterAsList(virtualForm, bean, name, adjustAsJsonString(scalar), pd); // depends on control dependency: [if], data = [none] } else { // e.g. List<String>, List<CDef.MemberStatus> mappedValue = prepareSimpleElementList(virtualForm, bean, name, value, pd, pathSb, option); // depends on control dependency: [if], data = [none] } return mappedValue; } }
public class class_name { public <T> JsonReaderI<T> getMapper(Class<T> type) { // look for cached Mapper @SuppressWarnings("unchecked") JsonReaderI<T> map = (JsonReaderI<T>) cache.get(type); if (map != null) return map; /* * Special handle */ if (type instanceof Class) { if (Map.class.isAssignableFrom(type)) map = new DefaultMapperCollection<T>(this, type); else if (List.class.isAssignableFrom(type)) map = new DefaultMapperCollection<T>(this, type); if (map != null) { cache.put(type, map); return map; } } if (type.isArray()) map = new ArraysMapper.GenericMapper<T>(this, type); else if (List.class.isAssignableFrom(type)) map = new CollectionMapper.ListClass<T>(this, type); else if (Map.class.isAssignableFrom(type)) map = new CollectionMapper.MapClass<T>(this, type); else // use bean class map = new BeansMapper.Bean<T>(this, type); cache.putIfAbsent(type, map); return map; } }
public class class_name { public <T> JsonReaderI<T> getMapper(Class<T> type) { // look for cached Mapper @SuppressWarnings("unchecked") JsonReaderI<T> map = (JsonReaderI<T>) cache.get(type); if (map != null) return map; /* * Special handle */ if (type instanceof Class) { if (Map.class.isAssignableFrom(type)) map = new DefaultMapperCollection<T>(this, type); else if (List.class.isAssignableFrom(type)) map = new DefaultMapperCollection<T>(this, type); if (map != null) { cache.put(type, map); // depends on control dependency: [if], data = [none] return map; // depends on control dependency: [if], data = [none] } } if (type.isArray()) map = new ArraysMapper.GenericMapper<T>(this, type); else if (List.class.isAssignableFrom(type)) map = new CollectionMapper.ListClass<T>(this, type); else if (Map.class.isAssignableFrom(type)) map = new CollectionMapper.MapClass<T>(this, type); else // use bean class map = new BeansMapper.Bean<T>(this, type); cache.putIfAbsent(type, map); return map; } }
public class class_name { public static final int getDynamicStoreInitialCapacity(int initialLevel) { // Compute maxLevel LinearHashing h = new LinearHashing(DynamicConstants.SUB_ARRAY_SIZE); h.reinit(Integer.MAX_VALUE); int maxLevel = h.getLevel(); // Compute initialCapacity int initialCapacity = DynamicConstants.SUB_ARRAY_SIZE; if(initialLevel > 0) { if(initialLevel > maxLevel) { initialLevel = maxLevel; } initialCapacity = DynamicConstants.SUB_ARRAY_SIZE << initialLevel; } return initialCapacity; } }
public class class_name { public static final int getDynamicStoreInitialCapacity(int initialLevel) { // Compute maxLevel LinearHashing h = new LinearHashing(DynamicConstants.SUB_ARRAY_SIZE); h.reinit(Integer.MAX_VALUE); int maxLevel = h.getLevel(); // Compute initialCapacity int initialCapacity = DynamicConstants.SUB_ARRAY_SIZE; if(initialLevel > 0) { if(initialLevel > maxLevel) { initialLevel = maxLevel; // depends on control dependency: [if], data = [none] } initialCapacity = DynamicConstants.SUB_ARRAY_SIZE << initialLevel; // depends on control dependency: [if], data = [none] } return initialCapacity; } }
public class class_name { public static String sanitize(final String input, final Policy policy) { if (policy == null) { throw new SystemException("AntiSamy policy cannot be null"); } if (Util.empty(input)) { return input; } try { CleanResults results = ANTISAMY.scan(input, policy); String result = results.getCleanHTML(); // Escape brackets for handlebars result = WebUtilities.encodeBrackets(result); return result; } catch (ScanException | PolicyException ex) { throw new SystemException("Cannot sanitize " + ex.getMessage(), ex); } } }
public class class_name { public static String sanitize(final String input, final Policy policy) { if (policy == null) { throw new SystemException("AntiSamy policy cannot be null"); } if (Util.empty(input)) { return input; // depends on control dependency: [if], data = [none] } try { CleanResults results = ANTISAMY.scan(input, policy); String result = results.getCleanHTML(); // Escape brackets for handlebars result = WebUtilities.encodeBrackets(result); // depends on control dependency: [try], data = [none] return result; // depends on control dependency: [try], data = [none] } catch (ScanException | PolicyException ex) { throw new SystemException("Cannot sanitize " + ex.getMessage(), ex); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public Set<String> setUnCapitalize(final Set<?> target) { if (target == null) { return null; } final Set<String> result = new LinkedHashSet<String>(target.size() + 2); for (final Object element : target) { result.add(unCapitalize(element)); } return result; } }
public class class_name { public Set<String> setUnCapitalize(final Set<?> target) { if (target == null) { return null; // depends on control dependency: [if], data = [none] } final Set<String> result = new LinkedHashSet<String>(target.size() + 2); for (final Object element : target) { result.add(unCapitalize(element)); // depends on control dependency: [for], data = [element] } return result; } }
public class class_name { public static int getContentLengthValue(H2HeaderField header) { if ("content-length".equalsIgnoreCase(header.getName())) { return Integer.parseInt(header.getValue()); } return -1; } }
public class class_name { public static int getContentLengthValue(H2HeaderField header) { if ("content-length".equalsIgnoreCase(header.getName())) { return Integer.parseInt(header.getValue()); // depends on control dependency: [if], data = [none] } return -1; } }
public class class_name { private static SymbolTable readOneImport(IonReader ionRep, IonCatalog catalog) { assert (ionRep.getType() == IonType.STRUCT); String name = null; int version = -1; int maxid = -1; ionRep.stepIn(); IonType t; while ((t = ionRep.next()) != null) { if (ionRep.isNullValue()) continue; SymbolToken symTok = ionRep.getFieldNameSymbol(); int field_id = symTok.getSid(); if (field_id == UNKNOWN_SYMBOL_ID) { // this is a user defined reader or a pure DOM // we fall back to text here final String fieldName = ionRep.getFieldName(); field_id = getSidForSymbolTableField(fieldName); } switch(field_id) { case NAME_SID: if (t == IonType.STRING) { name = ionRep.stringValue(); } break; case VERSION_SID: if (t == IonType.INT) { version = ionRep.intValue(); } break; case MAX_ID_SID: if (t == IonType.INT) { maxid = ionRep.intValue(); } break; default: // we just ignore anything else as "open content" break; } } ionRep.stepOut(); // Ignore import clauses with malformed name field. if (name == null || name.length() == 0 || name.equals(ION)) { return null; } if (version < 1) { version = 1; } SymbolTable itab = null; if (catalog != null) { itab = catalog.getTable(name, version); } if (maxid < 0) { if (itab == null || version != itab.getVersion()) { String message = "Import of shared table " + IonTextUtils.printString(name) + " lacks a valid max_id field, but an exact match was not" + " found in the catalog"; if (itab != null) { message += " (found version " + itab.getVersion() + ")"; } // TODO custom exception throw new IonException(message); } // Exact match is found, but max_id is undefined in import // declaration, set max_id to largest sid of shared symtab maxid = itab.getMaxId(); } if (itab == null) { assert maxid >= 0; // Construct substitute table with max_id undefined symbols itab = new SubstituteSymbolTable(name, version, maxid); } else if (itab.getVersion() != version || itab.getMaxId() != maxid) { // A match was found BUT specs are not an exact match // Construct a substitute with correct specs, containing the // original import table that was found itab = new SubstituteSymbolTable(itab, version, maxid); } return itab; } }
public class class_name { private static SymbolTable readOneImport(IonReader ionRep, IonCatalog catalog) { assert (ionRep.getType() == IonType.STRUCT); String name = null; int version = -1; int maxid = -1; ionRep.stepIn(); IonType t; while ((t = ionRep.next()) != null) { if (ionRep.isNullValue()) continue; SymbolToken symTok = ionRep.getFieldNameSymbol(); int field_id = symTok.getSid(); if (field_id == UNKNOWN_SYMBOL_ID) { // this is a user defined reader or a pure DOM // we fall back to text here final String fieldName = ionRep.getFieldName(); field_id = getSidForSymbolTableField(fieldName); // depends on control dependency: [if], data = [none] } switch(field_id) { case NAME_SID: if (t == IonType.STRING) { name = ionRep.stringValue(); // depends on control dependency: [if], data = [none] } break; case VERSION_SID: if (t == IonType.INT) { version = ionRep.intValue(); // depends on control dependency: [if], data = [none] } break; case MAX_ID_SID: if (t == IonType.INT) { maxid = ionRep.intValue(); // depends on control dependency: [if], data = [none] } break; default: // we just ignore anything else as "open content" break; } } ionRep.stepOut(); // Ignore import clauses with malformed name field. if (name == null || name.length() == 0 || name.equals(ION)) { return null; // depends on control dependency: [if], data = [none] } if (version < 1) { version = 1; // depends on control dependency: [if], data = [none] } SymbolTable itab = null; if (catalog != null) { itab = catalog.getTable(name, version); // depends on control dependency: [if], data = [none] } if (maxid < 0) { if (itab == null || version != itab.getVersion()) { String message = "Import of shared table " + IonTextUtils.printString(name) + " lacks a valid max_id field, but an exact match was not" // depends on control dependency: [if], data = [none] + " found in the catalog"; if (itab != null) { message += " (found version " + itab.getVersion() + ")"; // depends on control dependency: [if], data = [none] } // TODO custom exception throw new IonException(message); } // Exact match is found, but max_id is undefined in import // declaration, set max_id to largest sid of shared symtab maxid = itab.getMaxId(); // depends on control dependency: [if], data = [none] } if (itab == null) { assert maxid >= 0; // Construct substitute table with max_id undefined symbols itab = new SubstituteSymbolTable(name, version, maxid); // depends on control dependency: [if], data = [none] } else if (itab.getVersion() != version || itab.getMaxId() != maxid) { // A match was found BUT specs are not an exact match // Construct a substitute with correct specs, containing the // original import table that was found itab = new SubstituteSymbolTable(itab, version, maxid); // depends on control dependency: [if], data = [none] } return itab; } }
public class class_name { public static String insert(final String src, final String insert, int offset) { if (offset < 0) { offset = 0; } if (offset > src.length()) { offset = src.length(); } StringBuilder sb = new StringBuilder(src); sb.insert(offset, insert); return sb.toString(); } }
public class class_name { public static String insert(final String src, final String insert, int offset) { if (offset < 0) { offset = 0; // depends on control dependency: [if], data = [none] } if (offset > src.length()) { offset = src.length(); // depends on control dependency: [if], data = [none] } StringBuilder sb = new StringBuilder(src); sb.insert(offset, insert); return sb.toString(); } }
public class class_name { protected String getETag( final StoredObject so ) { String resourceLength = ""; String lastModified = ""; if ( so != null && so.isResource() ) { resourceLength = new Long( so.getResourceLength() ).toString(); lastModified = new Long( so.getLastModified() .getTime() ).toString(); } return "W/\"" + resourceLength + "-" + lastModified + "\""; } }
public class class_name { protected String getETag( final StoredObject so ) { String resourceLength = ""; String lastModified = ""; if ( so != null && so.isResource() ) { resourceLength = new Long( so.getResourceLength() ).toString(); // depends on control dependency: [if], data = [( so] lastModified = new Long( so.getLastModified() .getTime() ).toString(); // depends on control dependency: [if], data = [( so] } return "W/\"" + resourceLength + "-" + lastModified + "\""; } }
public class class_name { public static int getOptions(CollationData data, CollationSettings settings, char[] primaries) { char[] header = data.fastLatinTableHeader; if(header == null) { return -1; } assert((header[0] >> 8) == VERSION); if(primaries.length != LATIN_LIMIT) { assert false; return -1; } int miniVarTop; if((settings.options & CollationSettings.ALTERNATE_MASK) == 0) { // No mini primaries are variable, set a variableTop just below the // lowest long mini primary. miniVarTop = MIN_LONG - 1; } else { int headerLength = header[0] & 0xff; int i = 1 + settings.getMaxVariable(); if(i >= headerLength) { return -1; // variableTop >= digits, should not occur } miniVarTop = header[i]; } boolean digitsAreReordered = false; if(settings.hasReordering()) { long prevStart = 0; long beforeDigitStart = 0; long digitStart = 0; long afterDigitStart = 0; for(int group = Collator.ReorderCodes.FIRST; group < Collator.ReorderCodes.FIRST + CollationData.MAX_NUM_SPECIAL_REORDER_CODES; ++group) { long start = data.getFirstPrimaryForGroup(group); start = settings.reorder(start); if(group == Collator.ReorderCodes.DIGIT) { beforeDigitStart = prevStart; digitStart = start; } else if(start != 0) { if(start < prevStart) { // The permutation affects the groups up to Latin. return -1; } // In the future, there might be a special group between digits & Latin. if(digitStart != 0 && afterDigitStart == 0 && prevStart == beforeDigitStart) { afterDigitStart = start; } prevStart = start; } } long latinStart = data.getFirstPrimaryForGroup(UScript.LATIN); latinStart = settings.reorder(latinStart); if(latinStart < prevStart) { return -1; } if(afterDigitStart == 0) { afterDigitStart = latinStart; } if(!(beforeDigitStart < digitStart && digitStart < afterDigitStart)) { digitsAreReordered = true; } } char[] table = data.fastLatinTable; // skip the header for(int c = 0; c < LATIN_LIMIT; ++c) { int p = table[c]; if(p >= MIN_SHORT) { p &= SHORT_PRIMARY_MASK; } else if(p > miniVarTop) { p &= LONG_PRIMARY_MASK; } else { p = 0; } primaries[c] = (char)p; } if(digitsAreReordered || (settings.options & CollationSettings.NUMERIC) != 0) { // Bail out for digits. for(int c = 0x30; c <= 0x39; ++c) { primaries[c] = 0; } } // Shift the miniVarTop above other options. return (miniVarTop << 16) | settings.options; } }
public class class_name { public static int getOptions(CollationData data, CollationSettings settings, char[] primaries) { char[] header = data.fastLatinTableHeader; if(header == null) { return -1; } // depends on control dependency: [if], data = [none] assert((header[0] >> 8) == VERSION); if(primaries.length != LATIN_LIMIT) { assert false; return -1; // depends on control dependency: [if], data = [none] } int miniVarTop; if((settings.options & CollationSettings.ALTERNATE_MASK) == 0) { // No mini primaries are variable, set a variableTop just below the // lowest long mini primary. miniVarTop = MIN_LONG - 1; // depends on control dependency: [if], data = [none] } else { int headerLength = header[0] & 0xff; int i = 1 + settings.getMaxVariable(); if(i >= headerLength) { return -1; // variableTop >= digits, should not occur // depends on control dependency: [if], data = [none] } miniVarTop = header[i]; // depends on control dependency: [if], data = [none] } boolean digitsAreReordered = false; if(settings.hasReordering()) { long prevStart = 0; long beforeDigitStart = 0; long digitStart = 0; long afterDigitStart = 0; for(int group = Collator.ReorderCodes.FIRST; group < Collator.ReorderCodes.FIRST + CollationData.MAX_NUM_SPECIAL_REORDER_CODES; ++group) { long start = data.getFirstPrimaryForGroup(group); start = settings.reorder(start); // depends on control dependency: [for], data = [none] if(group == Collator.ReorderCodes.DIGIT) { beforeDigitStart = prevStart; // depends on control dependency: [if], data = [none] digitStart = start; // depends on control dependency: [if], data = [none] } else if(start != 0) { if(start < prevStart) { // The permutation affects the groups up to Latin. return -1; // depends on control dependency: [if], data = [none] } // In the future, there might be a special group between digits & Latin. if(digitStart != 0 && afterDigitStart == 0 && prevStart == beforeDigitStart) { afterDigitStart = start; // depends on control dependency: [if], data = [none] } prevStart = start; // depends on control dependency: [if], data = [none] } } long latinStart = data.getFirstPrimaryForGroup(UScript.LATIN); latinStart = settings.reorder(latinStart); // depends on control dependency: [if], data = [none] if(latinStart < prevStart) { return -1; // depends on control dependency: [if], data = [none] } if(afterDigitStart == 0) { afterDigitStart = latinStart; // depends on control dependency: [if], data = [none] } if(!(beforeDigitStart < digitStart && digitStart < afterDigitStart)) { digitsAreReordered = true; // depends on control dependency: [if], data = [none] } } char[] table = data.fastLatinTable; // skip the header for(int c = 0; c < LATIN_LIMIT; ++c) { int p = table[c]; if(p >= MIN_SHORT) { p &= SHORT_PRIMARY_MASK; // depends on control dependency: [if], data = [none] } else if(p > miniVarTop) { p &= LONG_PRIMARY_MASK; // depends on control dependency: [if], data = [none] } else { p = 0; // depends on control dependency: [if], data = [none] } primaries[c] = (char)p; // depends on control dependency: [for], data = [c] } if(digitsAreReordered || (settings.options & CollationSettings.NUMERIC) != 0) { // Bail out for digits. for(int c = 0x30; c <= 0x39; ++c) { primaries[c] = 0; } // depends on control dependency: [for], data = [c] } // Shift the miniVarTop above other options. return (miniVarTop << 16) | settings.options; } }
public class class_name { @Override public boolean hasNext() { resetToLastKey(); long key = mNextKey; if (key != NULL_NODE) { moveTo(mNextKey); while (((ITreeStructData)getNode()).hasFirstChild() && key != mLastParent.peek()) { mLastParent.push(key); key = ((ITreeStructData)getNode()).getFirstChildKey(); moveTo(((ITreeStructData)getNode()).getFirstChildKey()); } if (key == mLastParent.peek()) { mLastParent.pop(); } if (((ITreeStructData)getNode()).hasRightSibling()) { mNextKey = ((ITreeStructData)getNode()).getRightSiblingKey(); } else { mNextKey = mLastParent.peek(); } return true; } else { resetToStartKey(); return false; } } }
public class class_name { @Override public boolean hasNext() { resetToLastKey(); long key = mNextKey; if (key != NULL_NODE) { moveTo(mNextKey); // depends on control dependency: [if], data = [none] while (((ITreeStructData)getNode()).hasFirstChild() && key != mLastParent.peek()) { mLastParent.push(key); // depends on control dependency: [while], data = [none] key = ((ITreeStructData)getNode()).getFirstChildKey(); // depends on control dependency: [while], data = [none] moveTo(((ITreeStructData)getNode()).getFirstChildKey()); // depends on control dependency: [while], data = [none] } if (key == mLastParent.peek()) { mLastParent.pop(); // depends on control dependency: [if], data = [none] } if (((ITreeStructData)getNode()).hasRightSibling()) { mNextKey = ((ITreeStructData)getNode()).getRightSiblingKey(); // depends on control dependency: [if], data = [none] } else { mNextKey = mLastParent.peek(); // depends on control dependency: [if], data = [none] } return true; // depends on control dependency: [if], data = [none] } else { resetToStartKey(); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } } }
public class class_name { public boolean cancel(SipApplicationSessionTimerTask expirationTimerTask) { boolean cancelled = ((StandardSasTimerTask)expirationTimerTask).cancel(); // Purge is expensive when called frequently, only call it every now and then. // We do not sync the numCancelled variable. We dont care about correctness of // the number, and we will still call purge rought once on every 25 cancels. numCancelled++; if(numCancelled % 100 == 0) { super.purge(); } return cancelled; } }
public class class_name { public boolean cancel(SipApplicationSessionTimerTask expirationTimerTask) { boolean cancelled = ((StandardSasTimerTask)expirationTimerTask).cancel(); // Purge is expensive when called frequently, only call it every now and then. // We do not sync the numCancelled variable. We dont care about correctness of // the number, and we will still call purge rought once on every 25 cancels. numCancelled++; if(numCancelled % 100 == 0) { super.purge(); // depends on control dependency: [if], data = [none] } return cancelled; } }
public class class_name { public Entry findLastTerm() { for (int i = entries.size() - 1; i >= 0; i--) { final Entry entry = entries.get(i); if (ENTRY_TYPE_TERM == entry.type) { return entry; } } return null; } }
public class class_name { public Entry findLastTerm() { for (int i = entries.size() - 1; i >= 0; i--) { final Entry entry = entries.get(i); if (ENTRY_TYPE_TERM == entry.type) { return entry; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { public String decorateTagAction(String content, String configFile, String locale, ServletRequest req) { try { Locale loc = null; CmsFlexController controller = CmsFlexController.getController(req); if (CmsStringUtil.isEmpty(locale)) { loc = controller.getCmsObject().getRequestContext().getLocale(); } else { loc = CmsLocaleManager.getLocale(locale); } // read the decorator configurator class CmsProperty decoratorClass = controller.getCmsObject().readPropertyObject( configFile, PROPERTY_CATEGORY, false); String decoratorClassName = decoratorClass.getValue(); if (CmsStringUtil.isEmpty(decoratorClassName)) { decoratorClassName = DEFAULT_DECORATOR_CONFIGURATION; } String encoding = controller.getCmsObject().getRequestContext().getEncoding(); // use the correct decorator configurator and initialize it I_CmsDecoratorConfiguration config = (I_CmsDecoratorConfiguration)Class.forName( decoratorClassName).newInstance(); config.init(controller.getCmsObject(), configFile, loc); CmsHtmlDecorator decorator = new CmsHtmlDecorator(controller.getCmsObject(), config); decorator.setNoAutoCloseTags(m_noAutoCloseTags); return decorator.doDecoration(content, encoding); } catch (Exception e) { if (LOG.isErrorEnabled()) { LOG.error(Messages.get().getBundle().key(Messages.ERR_PROCESS_TAG_1, "decoration"), e); } return content; } } }
public class class_name { public String decorateTagAction(String content, String configFile, String locale, ServletRequest req) { try { Locale loc = null; CmsFlexController controller = CmsFlexController.getController(req); if (CmsStringUtil.isEmpty(locale)) { loc = controller.getCmsObject().getRequestContext().getLocale(); // depends on control dependency: [if], data = [none] } else { loc = CmsLocaleManager.getLocale(locale); // depends on control dependency: [if], data = [none] } // read the decorator configurator class CmsProperty decoratorClass = controller.getCmsObject().readPropertyObject( configFile, PROPERTY_CATEGORY, false); String decoratorClassName = decoratorClass.getValue(); if (CmsStringUtil.isEmpty(decoratorClassName)) { decoratorClassName = DEFAULT_DECORATOR_CONFIGURATION; // depends on control dependency: [if], data = [none] } String encoding = controller.getCmsObject().getRequestContext().getEncoding(); // use the correct decorator configurator and initialize it I_CmsDecoratorConfiguration config = (I_CmsDecoratorConfiguration)Class.forName( decoratorClassName).newInstance(); config.init(controller.getCmsObject(), configFile, loc); // depends on control dependency: [try], data = [none] CmsHtmlDecorator decorator = new CmsHtmlDecorator(controller.getCmsObject(), config); decorator.setNoAutoCloseTags(m_noAutoCloseTags); // depends on control dependency: [try], data = [none] return decorator.doDecoration(content, encoding); // depends on control dependency: [try], data = [none] } catch (Exception e) { if (LOG.isErrorEnabled()) { LOG.error(Messages.get().getBundle().key(Messages.ERR_PROCESS_TAG_1, "decoration"), e); // depends on control dependency: [if], data = [none] } return content; } // depends on control dependency: [catch], data = [none] } }
public class class_name { private static OtpTransport r4_publish(final OtpLocalNode node) throws IOException { OtpTransport s = null; try { @SuppressWarnings("resource") final OtpOutputStream obuf = new OtpOutputStream(); s = node.createTransport((String) null, EpmdPort.get()); obuf.write2BE(node.alive().length() + 13); obuf.write1(publish4req); obuf.write2BE(node.port()); obuf.write1(node.type()); obuf.write1(node.proto()); obuf.write2BE(node.distHigh()); obuf.write2BE(node.distLow()); obuf.write2BE(node.alive().length()); obuf.writeN(node.alive().getBytes()); obuf.write2BE(0); // No extra // send request obuf.writeToAndFlush(s.getOutputStream()); if (traceLevel >= traceThreshold) { System.out.println("-> PUBLISH (r4) " + node + " port=" + node.port()); } // get reply final byte[] tmpbuf = new byte[100]; final int n = s.getInputStream().read(tmpbuf); if (n < 0) { s.close(); throw new IOException("Nameserver not responding on " + node.host() + " when publishing " + node.alive()); } @SuppressWarnings("resource") final OtpInputStream ibuf = new OtpInputStream(tmpbuf, 0); final int response = ibuf.read1(); if (response == publish4resp) { final int result = ibuf.read1(); if (result == 0) { node.creation = ibuf.read2BE(); if (traceLevel >= traceThreshold) { System.out.println("<- OK"); } return s; // success } } } catch (final IOException e) { // epmd closed the connection = fail if (s != null) { s.close(); } if (traceLevel >= traceThreshold) { System.out.println("<- (no response)"); } throw new IOException("Nameserver not responding on " + node.host() + " when publishing " + node.alive()); } catch (final OtpErlangDecodeException e) { s.close(); if (traceLevel >= traceThreshold) { System.out.println("<- (invalid response)"); } throw new IOException("Nameserver not responding on " + node.host() + " when publishing " + node.alive()); } s.close(); return null; } }
public class class_name { private static OtpTransport r4_publish(final OtpLocalNode node) throws IOException { OtpTransport s = null; try { @SuppressWarnings("resource") final OtpOutputStream obuf = new OtpOutputStream(); s = node.createTransport((String) null, EpmdPort.get()); obuf.write2BE(node.alive().length() + 13); obuf.write1(publish4req); obuf.write2BE(node.port()); obuf.write1(node.type()); obuf.write1(node.proto()); obuf.write2BE(node.distHigh()); obuf.write2BE(node.distLow()); obuf.write2BE(node.alive().length()); obuf.writeN(node.alive().getBytes()); obuf.write2BE(0); // No extra // send request obuf.writeToAndFlush(s.getOutputStream()); if (traceLevel >= traceThreshold) { System.out.println("-> PUBLISH (r4) " + node + " port=" + node.port()); // depends on control dependency: [if], data = [none] } // get reply final byte[] tmpbuf = new byte[100]; final int n = s.getInputStream().read(tmpbuf); if (n < 0) { s.close(); // depends on control dependency: [if], data = [none] throw new IOException("Nameserver not responding on " + node.host() + " when publishing " + node.alive()); } @SuppressWarnings("resource") final OtpInputStream ibuf = new OtpInputStream(tmpbuf, 0); final int response = ibuf.read1(); if (response == publish4resp) { final int result = ibuf.read1(); if (result == 0) { node.creation = ibuf.read2BE(); // depends on control dependency: [if], data = [none] if (traceLevel >= traceThreshold) { System.out.println("<- OK"); // depends on control dependency: [if], data = [none] } return s; // success // depends on control dependency: [if], data = [none] } } } catch (final IOException e) { // epmd closed the connection = fail if (s != null) { s.close(); // depends on control dependency: [if], data = [none] } if (traceLevel >= traceThreshold) { System.out.println("<- (no response)"); // depends on control dependency: [if], data = [none] } throw new IOException("Nameserver not responding on " + node.host() + " when publishing " + node.alive()); } catch (final OtpErlangDecodeException e) { s.close(); if (traceLevel >= traceThreshold) { System.out.println("<- (invalid response)"); // depends on control dependency: [if], data = [none] } throw new IOException("Nameserver not responding on " + node.host() + " when publishing " + node.alive()); } s.close(); return null; } }
public class class_name { private TableModel createTableModel(Object object, Set<String> excludedMethods) { List<Method> methods = new ArrayList<Method>(); for (Method method : object.getClass().getMethods()) { if ((method.getParameterTypes().length == 0) || (method.getParameterTypes().length == 1 && method.getParameterTypes()[0] == int.class)) { String name = method.getName(); if (!excludedMethods.contains(name) && (name.startsWith("get") || name.startsWith("is"))) { methods.add(method); } } } Map<String, String> map = new TreeMap<String, String>(); for (Method method : methods) { if (method.getParameterTypes().length == 0) { getSingleValue(method, object, map); } else { getMultipleValues(method, object, map); } } String[] headings = new String[] { "Property", "Value" }; String[][] data = new String[map.size()][2]; int rowIndex = 0; for (Entry<String, String> entry : map.entrySet()) { data[rowIndex][0] = entry.getKey(); data[rowIndex][1] = entry.getValue(); ++rowIndex; } TableModel tableModel = new DefaultTableModel(data, headings) { @Override public boolean isCellEditable(int r, int c) { return false; } }; return tableModel; } }
public class class_name { private TableModel createTableModel(Object object, Set<String> excludedMethods) { List<Method> methods = new ArrayList<Method>(); for (Method method : object.getClass().getMethods()) { if ((method.getParameterTypes().length == 0) || (method.getParameterTypes().length == 1 && method.getParameterTypes()[0] == int.class)) { String name = method.getName(); if (!excludedMethods.contains(name) && (name.startsWith("get") || name.startsWith("is"))) { methods.add(method); // depends on control dependency: [if], data = [none] } } } Map<String, String> map = new TreeMap<String, String>(); for (Method method : methods) { if (method.getParameterTypes().length == 0) { getSingleValue(method, object, map); // depends on control dependency: [if], data = [none] } else { getMultipleValues(method, object, map); // depends on control dependency: [if], data = [none] } } String[] headings = new String[] { "Property", "Value" }; String[][] data = new String[map.size()][2]; int rowIndex = 0; for (Entry<String, String> entry : map.entrySet()) { data[rowIndex][0] = entry.getKey(); // depends on control dependency: [for], data = [entry] data[rowIndex][1] = entry.getValue(); // depends on control dependency: [for], data = [entry] ++rowIndex; // depends on control dependency: [for], data = [none] } TableModel tableModel = new DefaultTableModel(data, headings) { @Override public boolean isCellEditable(int r, int c) { return false; } }; return tableModel; } }
public class class_name { private static String[] getHttpMethodAndPath(Method method) { if(null == method){ return null; } String[] httpMethodAndPath; Route routeAnnotation = method.getAnnotation(Route.class); if(null != routeAnnotation){//从Annotation中获取HttpMethod和路径 httpMethodAndPath = getHttpMethodAndPath(routeAnnotation); if(null != httpMethodAndPath[0] && StrUtil.isBlank(httpMethodAndPath[1])){ //对于"post:"这类Route,依旧使用方法名做为路径一部分 httpMethodAndPath[1] = method.getName(); } }else{ httpMethodAndPath = new String[]{null, method.getName()}; } return httpMethodAndPath; } }
public class class_name { private static String[] getHttpMethodAndPath(Method method) { if(null == method){ return null; // depends on control dependency: [if], data = [none] } String[] httpMethodAndPath; Route routeAnnotation = method.getAnnotation(Route.class); if(null != routeAnnotation){//从Annotation中获取HttpMethod和路径 httpMethodAndPath = getHttpMethodAndPath(routeAnnotation); // depends on control dependency: [if], data = [routeAnnotation)] if(null != httpMethodAndPath[0] && StrUtil.isBlank(httpMethodAndPath[1])){ //对于"post:"这类Route,依旧使用方法名做为路径一部分 httpMethodAndPath[1] = method.getName(); // depends on control dependency: [if], data = [none] } }else{ httpMethodAndPath = new String[]{null, method.getName()}; // depends on control dependency: [if], data = [none] } return httpMethodAndPath; } }
public class class_name { private String getInfoFormat(List<WorkerInfo> workerInfoList, boolean isShort) { int maxWorkerNameLength = workerInfoList.stream().map(w -> w.getAddress().getHost().length()) .max(Comparator.comparing(Integer::intValue)).get(); int firstIndent = 16; if (firstIndent <= maxWorkerNameLength) { // extend first indent according to the longest worker name by default 5 firstIndent = maxWorkerNameLength + 5; } if (isShort) { return "%-" + firstIndent + "s %-16s %-13s %s"; } return "%-" + firstIndent + "s %-16s %-13s %-16s %s"; } }
public class class_name { private String getInfoFormat(List<WorkerInfo> workerInfoList, boolean isShort) { int maxWorkerNameLength = workerInfoList.stream().map(w -> w.getAddress().getHost().length()) .max(Comparator.comparing(Integer::intValue)).get(); int firstIndent = 16; if (firstIndent <= maxWorkerNameLength) { // extend first indent according to the longest worker name by default 5 firstIndent = maxWorkerNameLength + 5; // depends on control dependency: [if], data = [none] } if (isShort) { return "%-" + firstIndent + "s %-16s %-13s %s"; // depends on control dependency: [if], data = [none] } return "%-" + firstIndent + "s %-16s %-13s %-16s %s"; } }
public class class_name { public int getWidth() { try { return ((RemoteWebElement) getElement()).getSize().width; } catch (NumberFormatException e) { throw new WebElementException("Attribute " + WIDTH + " not found for Image " + getLocator(), e); } } }
public class class_name { public int getWidth() { try { return ((RemoteWebElement) getElement()).getSize().width; // depends on control dependency: [try], data = [none] } catch (NumberFormatException e) { throw new WebElementException("Attribute " + WIDTH + " not found for Image " + getLocator(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static String bareMIME(final String pMIME) { int idx; if (pMIME != null && (idx = pMIME.indexOf(';')) >= 0) { return pMIME.substring(0, idx); } return pMIME; } }
public class class_name { public static String bareMIME(final String pMIME) { int idx; if (pMIME != null && (idx = pMIME.indexOf(';')) >= 0) { return pMIME.substring(0, idx); // depends on control dependency: [if], data = [none] } return pMIME; } }
public class class_name { @javax.annotation.Nonnull public static double[] op(@javax.annotation.Nonnull final double[] a, @javax.annotation.Nonnull final DoubleUnaryOperator fn) { @javax.annotation.Nonnull final double[] c = new double[a.length]; for (int j = 0; j < a.length; j++) { c[j] = fn.applyAsDouble(a[j]); } return c; } }
public class class_name { @javax.annotation.Nonnull public static double[] op(@javax.annotation.Nonnull final double[] a, @javax.annotation.Nonnull final DoubleUnaryOperator fn) { @javax.annotation.Nonnull final double[] c = new double[a.length]; for (int j = 0; j < a.length; j++) { c[j] = fn.applyAsDouble(a[j]); // depends on control dependency: [for], data = [j] } return c; } }
public class class_name { private AuthToken parseAuthorizationToken(String authHeader) { try { String tokenEncoded = authHeader.substring(11); return AuthTokenUtil.consumeToken(tokenEncoded); } catch (IllegalArgumentException e) { // TODO log this error return null; } } }
public class class_name { private AuthToken parseAuthorizationToken(String authHeader) { try { String tokenEncoded = authHeader.substring(11); return AuthTokenUtil.consumeToken(tokenEncoded); // depends on control dependency: [try], data = [none] } catch (IllegalArgumentException e) { // TODO log this error return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { private TreeNode apportion(TreeNode v, TreeNode defaultAncestor, TreeNode leftSibling, TreeNode parentOfV) { TreeNode w = leftSibling; if (w == null) { // v has no left sibling return defaultAncestor; } // v has left sibling w // The following variables "v..." are used to traverse the contours to // the subtrees. "Minus" refers to the left, "Plus" to the right // subtree. "I" refers to the "inside" and "O" to the outside contour. TreeNode vOPlus = v; TreeNode vIPlus = v; TreeNode vIMinus = w; // get leftmost sibling of vIPlus, i.e. get the leftmost sibling of // v, i.e. the leftmost child of the parent of v (which is passed // in) TreeNode vOMinus = tree.getFirstChild(parentOfV); Double sIPlus = getMod(vIPlus); Double sOPlus = getMod(vOPlus); Double sIMinus = getMod(vIMinus); Double sOMinus = getMod(vOMinus); TreeNode nextRightVIMinus = nextRight(vIMinus); TreeNode nextLeftVIPlus = nextLeft(vIPlus); while (nextRightVIMinus != null && nextLeftVIPlus != null) { vIMinus = nextRightVIMinus; vIPlus = nextLeftVIPlus; vOMinus = nextLeft(vOMinus); vOPlus = nextRight(vOPlus); setAncestor(vOPlus, v); double shift = (getPrelim(vIMinus) + sIMinus) - (getPrelim(vIPlus) + sIPlus) + getDistance(vIMinus, vIPlus); if (shift > 0) { moveSubtree(ancestor(vIMinus, v, parentOfV, defaultAncestor), v, parentOfV, shift); sIPlus = sIPlus + shift; sOPlus = sOPlus + shift; } sIMinus = sIMinus + getMod(vIMinus); sIPlus = sIPlus + getMod(vIPlus); sOMinus = sOMinus + getMod(vOMinus); sOPlus = sOPlus + getMod(vOPlus); nextRightVIMinus = nextRight(vIMinus); nextLeftVIPlus = nextLeft(vIPlus); } if (nextRightVIMinus != null && nextRight(vOPlus) == null) { setThread(vOPlus, nextRightVIMinus); setMod(vOPlus, getMod(vOPlus) + sIMinus - sOPlus); } if (nextLeftVIPlus != null && nextLeft(vOMinus) == null) { setThread(vOMinus, nextLeftVIPlus); setMod(vOMinus, getMod(vOMinus) + sIPlus - sOMinus); defaultAncestor = v; } return defaultAncestor; } }
public class class_name { private TreeNode apportion(TreeNode v, TreeNode defaultAncestor, TreeNode leftSibling, TreeNode parentOfV) { TreeNode w = leftSibling; if (w == null) { // v has no left sibling return defaultAncestor; // depends on control dependency: [if], data = [none] } // v has left sibling w // The following variables "v..." are used to traverse the contours to // the subtrees. "Minus" refers to the left, "Plus" to the right // subtree. "I" refers to the "inside" and "O" to the outside contour. TreeNode vOPlus = v; TreeNode vIPlus = v; TreeNode vIMinus = w; // get leftmost sibling of vIPlus, i.e. get the leftmost sibling of // v, i.e. the leftmost child of the parent of v (which is passed // in) TreeNode vOMinus = tree.getFirstChild(parentOfV); Double sIPlus = getMod(vIPlus); Double sOPlus = getMod(vOPlus); Double sIMinus = getMod(vIMinus); Double sOMinus = getMod(vOMinus); TreeNode nextRightVIMinus = nextRight(vIMinus); TreeNode nextLeftVIPlus = nextLeft(vIPlus); while (nextRightVIMinus != null && nextLeftVIPlus != null) { vIMinus = nextRightVIMinus; // depends on control dependency: [while], data = [none] vIPlus = nextLeftVIPlus; // depends on control dependency: [while], data = [none] vOMinus = nextLeft(vOMinus); // depends on control dependency: [while], data = [none] vOPlus = nextRight(vOPlus); // depends on control dependency: [while], data = [none] setAncestor(vOPlus, v); // depends on control dependency: [while], data = [none] double shift = (getPrelim(vIMinus) + sIMinus) - (getPrelim(vIPlus) + sIPlus) + getDistance(vIMinus, vIPlus); if (shift > 0) { moveSubtree(ancestor(vIMinus, v, parentOfV, defaultAncestor), v, parentOfV, shift); // depends on control dependency: [if], data = [none] sIPlus = sIPlus + shift; // depends on control dependency: [if], data = [none] sOPlus = sOPlus + shift; // depends on control dependency: [if], data = [none] } sIMinus = sIMinus + getMod(vIMinus); // depends on control dependency: [while], data = [none] sIPlus = sIPlus + getMod(vIPlus); // depends on control dependency: [while], data = [none] sOMinus = sOMinus + getMod(vOMinus); // depends on control dependency: [while], data = [none] sOPlus = sOPlus + getMod(vOPlus); // depends on control dependency: [while], data = [none] nextRightVIMinus = nextRight(vIMinus); // depends on control dependency: [while], data = [none] nextLeftVIPlus = nextLeft(vIPlus); // depends on control dependency: [while], data = [none] } if (nextRightVIMinus != null && nextRight(vOPlus) == null) { setThread(vOPlus, nextRightVIMinus); // depends on control dependency: [if], data = [none] setMod(vOPlus, getMod(vOPlus) + sIMinus - sOPlus); // depends on control dependency: [if], data = [none] } if (nextLeftVIPlus != null && nextLeft(vOMinus) == null) { setThread(vOMinus, nextLeftVIPlus); // depends on control dependency: [if], data = [none] setMod(vOMinus, getMod(vOMinus) + sIPlus - sOMinus); // depends on control dependency: [if], data = [none] defaultAncestor = v; // depends on control dependency: [if], data = [none] } return defaultAncestor; } }
public class class_name { public static String getTableNameForAppid(String appIdentifier) { if (StringUtils.isBlank(appIdentifier)) { return null; } else { if (isSharedAppid(appIdentifier)) { // app is sharing a table with other apps appIdentifier = SHARED_TABLE; } return (App.isRoot(appIdentifier) || appIdentifier.startsWith(Config.PARA.concat("-"))) ? appIdentifier : Config.PARA + "-" + appIdentifier; } } }
public class class_name { public static String getTableNameForAppid(String appIdentifier) { if (StringUtils.isBlank(appIdentifier)) { return null; // depends on control dependency: [if], data = [none] } else { if (isSharedAppid(appIdentifier)) { // app is sharing a table with other apps appIdentifier = SHARED_TABLE; // depends on control dependency: [if], data = [none] } return (App.isRoot(appIdentifier) || appIdentifier.startsWith(Config.PARA.concat("-"))) ? appIdentifier : Config.PARA + "-" + appIdentifier; // depends on control dependency: [if], data = [none] } } }
public class class_name { private static String escapeKeyword(String symbol, EscapeStrategy strategy) { if (tsKeywords.contains(symbol)) { if (strategy.equals(EscapeStrategy.MANGLE)) { return symbol + "$"; } else { return "\"" + symbol + "\""; } } else { return symbol; } } }
public class class_name { private static String escapeKeyword(String symbol, EscapeStrategy strategy) { if (tsKeywords.contains(symbol)) { if (strategy.equals(EscapeStrategy.MANGLE)) { return symbol + "$"; // depends on control dependency: [if], data = [none] } else { return "\"" + symbol + "\""; // depends on control dependency: [if], data = [none] } } else { return symbol; // depends on control dependency: [if], data = [none] } } }
public class class_name { public List<BitcoinTransactionInput> parseTransactionInputs(ByteBuffer rawByteBuffer, long noOfTransactionInputs) { ArrayList<BitcoinTransactionInput> currentTransactionInput = new ArrayList<>((int)noOfTransactionInputs); for (int i=0;i<noOfTransactionInputs;i++) { // read previous Hash of Transaction byte[] currentTransactionInputPrevTransactionHash=new byte[32]; rawByteBuffer.get(currentTransactionInputPrevTransactionHash,0,32); // read previousTxOutIndex long currentTransactionInputPrevTxOutIdx=BitcoinUtil.convertSignedIntToUnsigned(rawByteBuffer.getInt()); // read InScript length (Potential Internal Exceed Java Type) byte[] currentTransactionTxInScriptLengthVarInt=BitcoinUtil.convertVarIntByteBufferToByteArray(rawByteBuffer); long currentTransactionTxInScriptSize=BitcoinUtil.getVarInt(currentTransactionTxInScriptLengthVarInt); // read inScript int currentTransactionTxInScriptSizeInt=(int)currentTransactionTxInScriptSize; byte[] currentTransactionInScript=new byte[currentTransactionTxInScriptSizeInt]; rawByteBuffer.get(currentTransactionInScript,0,currentTransactionTxInScriptSizeInt); // read sequence no long currentTransactionInputSeqNo=BitcoinUtil.convertSignedIntToUnsigned(rawByteBuffer.getInt()); // add input currentTransactionInput.add(new BitcoinTransactionInput(currentTransactionInputPrevTransactionHash,currentTransactionInputPrevTxOutIdx,currentTransactionTxInScriptLengthVarInt,currentTransactionInScript,currentTransactionInputSeqNo)); } return currentTransactionInput; } }
public class class_name { public List<BitcoinTransactionInput> parseTransactionInputs(ByteBuffer rawByteBuffer, long noOfTransactionInputs) { ArrayList<BitcoinTransactionInput> currentTransactionInput = new ArrayList<>((int)noOfTransactionInputs); for (int i=0;i<noOfTransactionInputs;i++) { // read previous Hash of Transaction byte[] currentTransactionInputPrevTransactionHash=new byte[32]; rawByteBuffer.get(currentTransactionInputPrevTransactionHash,0,32); // depends on control dependency: [for], data = [none] // read previousTxOutIndex long currentTransactionInputPrevTxOutIdx=BitcoinUtil.convertSignedIntToUnsigned(rawByteBuffer.getInt()); // read InScript length (Potential Internal Exceed Java Type) byte[] currentTransactionTxInScriptLengthVarInt=BitcoinUtil.convertVarIntByteBufferToByteArray(rawByteBuffer); long currentTransactionTxInScriptSize=BitcoinUtil.getVarInt(currentTransactionTxInScriptLengthVarInt); // read inScript int currentTransactionTxInScriptSizeInt=(int)currentTransactionTxInScriptSize; byte[] currentTransactionInScript=new byte[currentTransactionTxInScriptSizeInt]; rawByteBuffer.get(currentTransactionInScript,0,currentTransactionTxInScriptSizeInt); // depends on control dependency: [for], data = [none] // read sequence no long currentTransactionInputSeqNo=BitcoinUtil.convertSignedIntToUnsigned(rawByteBuffer.getInt()); // add input currentTransactionInput.add(new BitcoinTransactionInput(currentTransactionInputPrevTransactionHash,currentTransactionInputPrevTxOutIdx,currentTransactionTxInScriptLengthVarInt,currentTransactionInScript,currentTransactionInputSeqNo)); // depends on control dependency: [for], data = [none] } return currentTransactionInput; } }
public class class_name { public void warning (String msg) { StackTraceElement caller = StackTraceUtils.getCallerStackTraceElement (); if (caller != null) { logger.logp (Level.WARNING, caller.getClassName (), caller.getMethodName () + "():" + caller.getLineNumber (), msg); } else { logger.logp (Level.WARNING, "(UnknownSourceClass)", "(unknownSourceMethod)", msg); } } }
public class class_name { public void warning (String msg) { StackTraceElement caller = StackTraceUtils.getCallerStackTraceElement (); if (caller != null) { logger.logp (Level.WARNING, caller.getClassName (), caller.getMethodName () + "():" + caller.getLineNumber (), msg); } else { logger.logp (Level.WARNING, "(UnknownSourceClass)", "(unknownSourceMethod)", msg); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static @Nonnull JsonArray toJsonJLineString(@Nonnull double[][] lineString) { JsonArray points = array(); for (double[] values : lineString) { JsonArray subArray = array(); for (double value : values) { subArray.add(primitive(value)); } points.add(subArray); } return points; } }
public class class_name { public static @Nonnull JsonArray toJsonJLineString(@Nonnull double[][] lineString) { JsonArray points = array(); for (double[] values : lineString) { JsonArray subArray = array(); for (double value : values) { subArray.add(primitive(value)); // depends on control dependency: [for], data = [value] } points.add(subArray); // depends on control dependency: [for], data = [none] } return points; } }
public class class_name { @Override protected void initGraphics() { // Set initial size if (Double.compare(clock.getPrefWidth(), 0.0) <= 0 || Double.compare(clock.getPrefHeight(), 0.0) <= 0 || Double.compare(clock.getWidth(), 0.0) <= 0 || Double.compare(clock.getHeight(), 0.0) <= 0) { if (clock.getPrefWidth() > 0 && clock.getPrefHeight() > 0) { clock.setPrefSize(clock.getPrefWidth(), clock.getPrefHeight()); } else { clock.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); } } sectionsAndAreasCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); sectionsAndAreasCtx = sectionsAndAreasCanvas.getGraphicsContext2D(); tickCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); tickCtx = tickCanvas.getGraphicsContext2D(); alarmPane = new Pane(); hour = new Path(); hour.setFillRule(FillRule.EVEN_ODD); hour.setStroke(null); hour.getTransforms().setAll(hourRotate); minute = new Path(); minute.setFillRule(FillRule.EVEN_ODD); minute.setStroke(null); minute.getTransforms().setAll(minuteRotate); second = new Path(); second.setFillRule(FillRule.EVEN_ODD); second.setStroke(null); second.getTransforms().setAll(secondRotate); second.setVisible(clock.isSecondsVisible()); second.setManaged(clock.isSecondsVisible()); centerDot = new Circle(); centerDot.setFill(Color.WHITE); dropShadow = new DropShadow(); dropShadow.setColor(Color.rgb(0, 0, 0, 0.25)); dropShadow.setBlurType(BlurType.TWO_PASS_BOX); dropShadow.setRadius(0.015 * PREFERRED_WIDTH); dropShadow.setOffsetY(0.015 * PREFERRED_WIDTH); shadowGroupHour = new Group(hour); shadowGroupMinute = new Group(minute); shadowGroupSecond = new Group(second); shadowGroupHour.setEffect(clock.getShadowsEnabled() ? dropShadow : null); shadowGroupMinute.setEffect(clock.getShadowsEnabled() ? dropShadow : null); shadowGroupSecond.setEffect(clock.getShadowsEnabled() ? dropShadow : null); title = new Text(""); title.setVisible(clock.isTitleVisible()); title.setManaged(clock.isTitleVisible()); dateText = new Text(""); dateText.setVisible(clock.isDateVisible()); dateText.setManaged(clock.isDateVisible()); dateNumber = new Text(""); dateNumber.setVisible(clock.isDateVisible()); dateNumber.setManaged(clock.isDateVisible()); text = new Text(""); text.setVisible(clock.isTextVisible()); text.setManaged(clock.isTextVisible()); pane = new Pane(sectionsAndAreasCanvas, tickCanvas, alarmPane, title, dateText, dateNumber, text, shadowGroupMinute, shadowGroupHour, shadowGroupSecond, centerDot); pane.setBorder(new Border(new BorderStroke(clock.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(clock.getBorderWidth())))); pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY))); getChildren().setAll(pane); } }
public class class_name { @Override protected void initGraphics() { // Set initial size if (Double.compare(clock.getPrefWidth(), 0.0) <= 0 || Double.compare(clock.getPrefHeight(), 0.0) <= 0 || Double.compare(clock.getWidth(), 0.0) <= 0 || Double.compare(clock.getHeight(), 0.0) <= 0) { if (clock.getPrefWidth() > 0 && clock.getPrefHeight() > 0) { clock.setPrefSize(clock.getPrefWidth(), clock.getPrefHeight()); // depends on control dependency: [if], data = [(clock.getPrefWidth()] } else { clock.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); // depends on control dependency: [if], data = [none] } } sectionsAndAreasCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); sectionsAndAreasCtx = sectionsAndAreasCanvas.getGraphicsContext2D(); tickCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); tickCtx = tickCanvas.getGraphicsContext2D(); alarmPane = new Pane(); hour = new Path(); hour.setFillRule(FillRule.EVEN_ODD); hour.setStroke(null); hour.getTransforms().setAll(hourRotate); minute = new Path(); minute.setFillRule(FillRule.EVEN_ODD); minute.setStroke(null); minute.getTransforms().setAll(minuteRotate); second = new Path(); second.setFillRule(FillRule.EVEN_ODD); second.setStroke(null); second.getTransforms().setAll(secondRotate); second.setVisible(clock.isSecondsVisible()); second.setManaged(clock.isSecondsVisible()); centerDot = new Circle(); centerDot.setFill(Color.WHITE); dropShadow = new DropShadow(); dropShadow.setColor(Color.rgb(0, 0, 0, 0.25)); dropShadow.setBlurType(BlurType.TWO_PASS_BOX); dropShadow.setRadius(0.015 * PREFERRED_WIDTH); dropShadow.setOffsetY(0.015 * PREFERRED_WIDTH); shadowGroupHour = new Group(hour); shadowGroupMinute = new Group(minute); shadowGroupSecond = new Group(second); shadowGroupHour.setEffect(clock.getShadowsEnabled() ? dropShadow : null); shadowGroupMinute.setEffect(clock.getShadowsEnabled() ? dropShadow : null); shadowGroupSecond.setEffect(clock.getShadowsEnabled() ? dropShadow : null); title = new Text(""); title.setVisible(clock.isTitleVisible()); title.setManaged(clock.isTitleVisible()); dateText = new Text(""); dateText.setVisible(clock.isDateVisible()); dateText.setManaged(clock.isDateVisible()); dateNumber = new Text(""); dateNumber.setVisible(clock.isDateVisible()); dateNumber.setManaged(clock.isDateVisible()); text = new Text(""); text.setVisible(clock.isTextVisible()); text.setManaged(clock.isTextVisible()); pane = new Pane(sectionsAndAreasCanvas, tickCanvas, alarmPane, title, dateText, dateNumber, text, shadowGroupMinute, shadowGroupHour, shadowGroupSecond, centerDot); pane.setBorder(new Border(new BorderStroke(clock.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(clock.getBorderWidth())))); pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY))); getChildren().setAll(pane); } }