code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public static String handleLuceneSpecialChars(String condition){ if(condition == null || condition.equals("")){ return condition; } condition = condition.replace(":","/:"); condition = condition.replace("-","/-"); condition = condition.replace("+","/+"); condition = condition.replace("&","/&"); condition = condition.replace("!","/!"); condition = condition.replace("{","/{"); condition = condition.replace("}","/}"); condition = condition.replace("(","/("); condition = condition.replace(")","/)"); condition = condition.replace("|","/|"); condition = condition.replace("~","/~"); condition = condition.replace("*","/*"); condition = condition.replace("?","/?"); condition = condition.replace("/","//"); // condition = condition.replace("\"","/\""); return condition; } }
public class class_name { public static String handleLuceneSpecialChars(String condition){ if(condition == null || condition.equals("")){ return condition; // depends on control dependency: [if], data = [none] } condition = condition.replace(":","/:"); condition = condition.replace("-","/-"); condition = condition.replace("+","/+"); condition = condition.replace("&","/&"); condition = condition.replace("!","/!"); condition = condition.replace("{","/{"); condition = condition.replace("}","/}"); condition = condition.replace("(","/("); condition = condition.replace(")","/)"); condition = condition.replace("|","/|"); condition = condition.replace("~","/~"); condition = condition.replace("*","/*"); condition = condition.replace("?","/?"); condition = condition.replace("/","//"); // condition = condition.replace("\"","/\""); return condition; } }
public class class_name { private static void createLanguageAliases(TypeSpec.Builder type, Map<String, String> languageAliases) { MethodSpec.Builder method = MethodSpec.methodBuilder("registerLanguageAliases") .addModifiers(PRIVATE, STATIC); for (Map.Entry<String, String> entry : languageAliases.entrySet()) { method.addStatement("addLanguageAlias($S, $S)", entry.getKey(), entry.getValue()); } type.addMethod(method.build()); } }
public class class_name { private static void createLanguageAliases(TypeSpec.Builder type, Map<String, String> languageAliases) { MethodSpec.Builder method = MethodSpec.methodBuilder("registerLanguageAliases") .addModifiers(PRIVATE, STATIC); for (Map.Entry<String, String> entry : languageAliases.entrySet()) { method.addStatement("addLanguageAlias($S, $S)", entry.getKey(), entry.getValue()); // depends on control dependency: [for], data = [none] } type.addMethod(method.build()); } }
public class class_name { public static VCProjectHolder getVCProjectHolder( File inputFile, boolean isSolution ) { VCProjectHolder vcProjectHolder = VCPROJECT_HOLDERS.get( inputFile ); if ( vcProjectHolder == null ) { vcProjectHolder = new VCProjectHolder( inputFile, isSolution, new HashMap<String, String>() ); VCPROJECT_HOLDERS.put( inputFile, vcProjectHolder ); } return vcProjectHolder; } }
public class class_name { public static VCProjectHolder getVCProjectHolder( File inputFile, boolean isSolution ) { VCProjectHolder vcProjectHolder = VCPROJECT_HOLDERS.get( inputFile ); if ( vcProjectHolder == null ) { vcProjectHolder = new VCProjectHolder( inputFile, isSolution, new HashMap<String, String>() ); // depends on control dependency: [if], data = [none] VCPROJECT_HOLDERS.put( inputFile, vcProjectHolder ); // depends on control dependency: [if], data = [none] } return vcProjectHolder; } }
public class class_name { public ScreenComponent setupDefaultView(ScreenLoc itsLocation, ComponentParent targetScreen, Convert convert, int iDisplayFieldDesc, Map<String, Object> properties) { ScreenComponent sField = null; Converter converter = this.getNextConverter(); if (converter != null) sField = converter.setupDefaultView(itsLocation, targetScreen, convert, iDisplayFieldDesc, properties); else sField = super.setupDefaultView(itsLocation, targetScreen, converter, iDisplayFieldDesc, properties); if (sField != null) { // Get rid of any and all links to/from field/converter converter.removeComponent(sField); // Have the field add me to its list for display sField.setConverter(this); } return sField; } }
public class class_name { public ScreenComponent setupDefaultView(ScreenLoc itsLocation, ComponentParent targetScreen, Convert convert, int iDisplayFieldDesc, Map<String, Object> properties) { ScreenComponent sField = null; Converter converter = this.getNextConverter(); if (converter != null) sField = converter.setupDefaultView(itsLocation, targetScreen, convert, iDisplayFieldDesc, properties); else sField = super.setupDefaultView(itsLocation, targetScreen, converter, iDisplayFieldDesc, properties); if (sField != null) { // Get rid of any and all links to/from field/converter converter.removeComponent(sField); // Have the field add me to its list for display // depends on control dependency: [if], data = [(sField] sField.setConverter(this); // depends on control dependency: [if], data = [none] } return sField; } }
public class class_name { private static boolean isCallToFail(StatementTree then, VisitorState state) { while (then.getKind() == BLOCK) { List<? extends StatementTree> statements = ((BlockTree) then).getStatements(); if (statements.size() != 1) { return false; } then = getOnlyElement(statements); } if (then.getKind() != EXPRESSION_STATEMENT) { return false; } ExpressionTree thenExpr = ((ExpressionStatementTree) then).getExpression(); if (thenExpr.getKind() != METHOD_INVOCATION) { return false; } MethodInvocationTree thenCall = (MethodInvocationTree) thenExpr; ExpressionTree methodSelect = thenCall.getMethodSelect(); if (methodSelect.getKind() != IDENTIFIER) { return false; // TODO(cpovirk): Handle "this.fail(...)," etc. } // TODO(cpovirk): Support *all* fail methods. return LEGACY_FAIL_METHOD.matches(methodSelect, state); } }
public class class_name { private static boolean isCallToFail(StatementTree then, VisitorState state) { while (then.getKind() == BLOCK) { List<? extends StatementTree> statements = ((BlockTree) then).getStatements(); // depends on control dependency: [while], data = [none] if (statements.size() != 1) { return false; // depends on control dependency: [if], data = [none] } then = getOnlyElement(statements); // depends on control dependency: [while], data = [none] } if (then.getKind() != EXPRESSION_STATEMENT) { return false; // depends on control dependency: [if], data = [none] } ExpressionTree thenExpr = ((ExpressionStatementTree) then).getExpression(); if (thenExpr.getKind() != METHOD_INVOCATION) { return false; // depends on control dependency: [if], data = [none] } MethodInvocationTree thenCall = (MethodInvocationTree) thenExpr; ExpressionTree methodSelect = thenCall.getMethodSelect(); if (methodSelect.getKind() != IDENTIFIER) { return false; // depends on control dependency: [if], data = [none] // TODO(cpovirk): Handle "this.fail(...)," etc. } // TODO(cpovirk): Support *all* fail methods. return LEGACY_FAIL_METHOD.matches(methodSelect, state); } }
public class class_name { protected void rehash(final int newN) { final char key[] = this.key; final char value[] = this.value; final int mask = newN - 1; // Note that this is used by the hashing macro final char newKey[] = new char[newN + 1]; final char newValue[] = new char[newN + 1]; int i = n, pos; for (int j = realSize(); j-- != 0; ) { while (((key[--i]) == ((char) 0))) ; if (!((newKey[pos = (HashCommon.mix((key[i]))) & mask]) == ((char) 0))) while (!((newKey[pos = (pos + 1) & mask]) == ((char) 0))) ; newKey[pos] = key[i]; newValue[pos] = value[i]; } newValue[newN] = value[n]; n = newN; this.mask = mask; maxFill = maxFill(n, f); this.key = newKey; this.value = newValue; } }
public class class_name { protected void rehash(final int newN) { final char key[] = this.key; final char value[] = this.value; final int mask = newN - 1; // Note that this is used by the hashing macro final char newKey[] = new char[newN + 1]; final char newValue[] = new char[newN + 1]; int i = n, pos; for (int j = realSize(); j-- != 0; ) { while (((key[--i]) == ((char) 0))) ; if (!((newKey[pos = (HashCommon.mix((key[i]))) & mask]) == ((char) 0))) while (!((newKey[pos = (pos + 1) & mask]) == ((char) 0))) ; newKey[pos] = key[i]; // depends on control dependency: [for], data = [none] newValue[pos] = value[i]; // depends on control dependency: [for], data = [none] } newValue[newN] = value[n]; n = newN; this.mask = mask; maxFill = maxFill(n, f); this.key = newKey; this.value = newValue; } }
public class class_name { protected void writeNull(Type type) { if (logMode == MODE_DELETE) { write(BYTES_IS); } else if (isWritten) { write(','); } isWritten = true; write(BYTES_NULL); } }
public class class_name { protected void writeNull(Type type) { if (logMode == MODE_DELETE) { write(BYTES_IS); // depends on control dependency: [if], data = [none] } else if (isWritten) { write(','); // depends on control dependency: [if], data = [none] } isWritten = true; write(BYTES_NULL); } }
public class class_name { @Override public void setValue(ELContext context, Object base, Object property, Object value) { if (context == null) { throw new NullPointerException(); } if (base == null && property instanceof String) { String beanName = (String) property; if (beanNameResolver.isNameResolved(beanName) || beanNameResolver.canCreateBean(beanName)) { beanNameResolver.setBeanValue(beanName, value); context.setPropertyResolved(base, property); } } } }
public class class_name { @Override public void setValue(ELContext context, Object base, Object property, Object value) { if (context == null) { throw new NullPointerException(); } if (base == null && property instanceof String) { String beanName = (String) property; if (beanNameResolver.isNameResolved(beanName) || beanNameResolver.canCreateBean(beanName)) { beanNameResolver.setBeanValue(beanName, value); // depends on control dependency: [if], data = [none] context.setPropertyResolved(base, property); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void setIpSets(java.util.Collection<IpSet> ipSets) { if (ipSets == null) { this.ipSets = null; return; } this.ipSets = new java.util.ArrayList<IpSet>(ipSets); } }
public class class_name { public void setIpSets(java.util.Collection<IpSet> ipSets) { if (ipSets == null) { this.ipSets = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.ipSets = new java.util.ArrayList<IpSet>(ipSets); } }
public class class_name { static <T> Callable<T> threadRenaming(final Callable<T> callable, final Supplier<String> nameSupplier) { checkNotNull(nameSupplier); checkNotNull(callable); return new Callable<T>() { @Override public T call() throws Exception { Thread currentThread = Thread.currentThread(); String oldName = currentThread.getName(); boolean restoreName = trySetName(nameSupplier.get(), currentThread); try { return callable.call(); } finally { if (restoreName) { trySetName(oldName, currentThread); } } } }; } }
public class class_name { static <T> Callable<T> threadRenaming(final Callable<T> callable, final Supplier<String> nameSupplier) { checkNotNull(nameSupplier); checkNotNull(callable); return new Callable<T>() { @Override public T call() throws Exception { Thread currentThread = Thread.currentThread(); String oldName = currentThread.getName(); boolean restoreName = trySetName(nameSupplier.get(), currentThread); try { return callable.call(); } finally { if (restoreName) { trySetName(oldName, currentThread); // depends on control dependency: [if], data = [none] } } } }; } }
public class class_name { public static Resource create(File root, String path) { FileResourceProvider frp = null; try { frp = new FileResourceProvider(root); } catch(IOException e) { throw new RuntimeException(e); } return frp.createResource(path); } }
public class class_name { public static Resource create(File root, String path) { FileResourceProvider frp = null; try { frp = new FileResourceProvider(root); // depends on control dependency: [try], data = [none] } catch(IOException e) { throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] return frp.createResource(path); } }
public class class_name { public int getAge() { int ret = 0; Date now = new Date(System.currentTimeMillis()); Date filmDate = getAgeAsDate(); if (filmDate != null) { ret = Math.round((now.getTime() - filmDate.getTime()) / (1000)); if (ret < 0) { ret = 0; } } return ret; } }
public class class_name { public int getAge() { int ret = 0; Date now = new Date(System.currentTimeMillis()); Date filmDate = getAgeAsDate(); if (filmDate != null) { ret = Math.round((now.getTime() - filmDate.getTime()) / (1000)); // depends on control dependency: [if], data = [none] if (ret < 0) { ret = 0; // depends on control dependency: [if], data = [none] } } return ret; } }
public class class_name { private String getGroupAccessId(String groupName) { try { SecurityService securityService = securityServiceRef.getService(); UserRegistryService userRegistryService = securityService.getUserRegistryService(); UserRegistry userRegistry = userRegistryService.getUserRegistry(); String realm = userRegistry.getRealm(); String groupUniqueId = userRegistry.getUniqueGroupId(groupName); return AccessIdUtil.createAccessId(AccessIdUtil.TYPE_GROUP, realm, groupUniqueId); } catch (EntryNotFoundException e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Caught exception getting the access id for " + groupName + ": " + e); } } catch (RegistryException e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Caught exception getting the access id for " + groupName + ": " + e); } } return null; } }
public class class_name { private String getGroupAccessId(String groupName) { try { SecurityService securityService = securityServiceRef.getService(); UserRegistryService userRegistryService = securityService.getUserRegistryService(); UserRegistry userRegistry = userRegistryService.getUserRegistry(); String realm = userRegistry.getRealm(); String groupUniqueId = userRegistry.getUniqueGroupId(groupName); return AccessIdUtil.createAccessId(AccessIdUtil.TYPE_GROUP, realm, groupUniqueId); // depends on control dependency: [try], data = [none] } catch (EntryNotFoundException e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Caught exception getting the access id for " + groupName + ": " + e); // depends on control dependency: [if], data = [none] } } catch (RegistryException e) { // depends on control dependency: [catch], data = [none] if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Caught exception getting the access id for " + groupName + ": " + e); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] return null; } }
public class class_name { @Override public boolean isVisible() { if (!super.isVisible()) { return false; } Video[] video = getVideo(); return video != null && video.length > 0; } }
public class class_name { @Override public boolean isVisible() { if (!super.isVisible()) { return false; // depends on control dependency: [if], data = [none] } Video[] video = getVideo(); return video != null && video.length > 0; } }
public class class_name { @Override protected void onPersist(EntityMetadata entityMetadata, Object entity, Object id, List<RelationHolder> rlHolders) { JsonDocument doc = handler.getDocumentFromEntity(entityMetadata, entity, kunderaMetadata); if (!isUpdate) { bucket.insert(doc); LOGGER.debug("Inserted document with ID : " + doc.id() + " in the " + bucket.name() + " Bucket"); } else { bucket.upsert(doc); LOGGER.debug("Updated document with ID : " + doc.id() + " in the " + bucket.name() + " Bucket"); } } }
public class class_name { @Override protected void onPersist(EntityMetadata entityMetadata, Object entity, Object id, List<RelationHolder> rlHolders) { JsonDocument doc = handler.getDocumentFromEntity(entityMetadata, entity, kunderaMetadata); if (!isUpdate) { bucket.insert(doc); // depends on control dependency: [if], data = [none] LOGGER.debug("Inserted document with ID : " + doc.id() + " in the " + bucket.name() + " Bucket"); // depends on control dependency: [if], data = [none] } else { bucket.upsert(doc); // depends on control dependency: [if], data = [none] LOGGER.debug("Updated document with ID : " + doc.id() + " in the " + bucket.name() + " Bucket"); // depends on control dependency: [if], data = [none] } } }
public class class_name { public final void mRULE_INT() throws RecognitionException { try { int _type = RULE_INT; int _channel = DEFAULT_TOKEN_CHANNEL; // InternalSimpleAntlr.g:1734:10: ( ( '0' .. '9' )+ ) // InternalSimpleAntlr.g:1734:12: ( '0' .. '9' )+ { // InternalSimpleAntlr.g:1734:12: ( '0' .. '9' )+ int cnt4=0; loop4: do { int alt4=2; int LA4_0 = input.LA(1); if ( ((LA4_0>='0' && LA4_0<='9')) ) { alt4=1; } switch (alt4) { case 1 : // InternalSimpleAntlr.g:1734:13: '0' .. '9' { matchRange('0','9'); } break; default : if ( cnt4 >= 1 ) break loop4; EarlyExitException eee = new EarlyExitException(4, input); throw eee; } cnt4++; } while (true); } state.type = _type; state.channel = _channel; } finally { } } }
public class class_name { public final void mRULE_INT() throws RecognitionException { try { int _type = RULE_INT; int _channel = DEFAULT_TOKEN_CHANNEL; // InternalSimpleAntlr.g:1734:10: ( ( '0' .. '9' )+ ) // InternalSimpleAntlr.g:1734:12: ( '0' .. '9' )+ { // InternalSimpleAntlr.g:1734:12: ( '0' .. '9' )+ int cnt4=0; loop4: do { int alt4=2; int LA4_0 = input.LA(1); if ( ((LA4_0>='0' && LA4_0<='9')) ) { alt4=1; // depends on control dependency: [if], data = [none] } switch (alt4) { case 1 : // InternalSimpleAntlr.g:1734:13: '0' .. '9' { matchRange('0','9'); } break; default : if ( cnt4 >= 1 ) break loop4; EarlyExitException eee = new EarlyExitException(4, input); throw eee; } cnt4++; } while (true); } state.type = _type; state.channel = _channel; } finally { } } }
public class class_name { public static void addLibraryPath(String pathToAdd) throws Exception { Field usrPathsField = ClassLoader.class.getDeclaredField("usr_paths"); usrPathsField.setAccessible(true); // get array of paths final String[] paths = (String[]) usrPathsField.get(null); // check if the path to add is already present for (String path : paths) { if (path.equals(pathToAdd)) { return; } } // add the new path final String[] newPaths = Arrays.copyOf(paths, paths.length + 1); newPaths[newPaths.length - 1] = pathToAdd; usrPathsField.set(null, newPaths); } }
public class class_name { public static void addLibraryPath(String pathToAdd) throws Exception { Field usrPathsField = ClassLoader.class.getDeclaredField("usr_paths"); usrPathsField.setAccessible(true); // get array of paths final String[] paths = (String[]) usrPathsField.get(null); // check if the path to add is already present for (String path : paths) { if (path.equals(pathToAdd)) { return; // depends on control dependency: [if], data = [none] } } // add the new path final String[] newPaths = Arrays.copyOf(paths, paths.length + 1); newPaths[newPaths.length - 1] = pathToAdd; usrPathsField.set(null, newPaths); } }
public class class_name { private void checkSelection() { m_okButton.disable(Messages.get().key(Messages.GUI_UPLOAD_BUTTON_OK_DISABLE_CHECKING_0)); if (!m_selectionDone) { m_firstContentHeight = CmsDomUtil.getCurrentStyleInt(m_scrollPanel.getElement(), CmsDomUtil.Style.height); m_firstInfoHeight = m_dialogInfo.getOffsetHeight(); m_firstSummaryHeight = m_selectionSummary.getOffsetHeight(); } CmsRpcAction<CmsUploadFileBean> callback = new CmsRpcAction<CmsUploadFileBean>() { /** * @see org.opencms.gwt.client.rpc.CmsRpcAction#execute() */ @Override public void execute() { List<String> filesToCheck = new ArrayList<String>(getFilesToUpload().keySet()); filesToCheck.removeAll(getFilesToUnzip(false)); getUploadService().checkUploadFiles(filesToCheck, getTargetFolder(), m_isTargetRootPath, this); } /** * @see org.opencms.gwt.client.rpc.CmsRpcAction#onResponse(java.lang.Object) */ @Override protected void onResponse(CmsUploadFileBean result) { proceedWorkflow(result); } }; callback.execute(); } }
public class class_name { private void checkSelection() { m_okButton.disable(Messages.get().key(Messages.GUI_UPLOAD_BUTTON_OK_DISABLE_CHECKING_0)); if (!m_selectionDone) { m_firstContentHeight = CmsDomUtil.getCurrentStyleInt(m_scrollPanel.getElement(), CmsDomUtil.Style.height); // depends on control dependency: [if], data = [none] m_firstInfoHeight = m_dialogInfo.getOffsetHeight(); // depends on control dependency: [if], data = [none] m_firstSummaryHeight = m_selectionSummary.getOffsetHeight(); // depends on control dependency: [if], data = [none] } CmsRpcAction<CmsUploadFileBean> callback = new CmsRpcAction<CmsUploadFileBean>() { /** * @see org.opencms.gwt.client.rpc.CmsRpcAction#execute() */ @Override public void execute() { List<String> filesToCheck = new ArrayList<String>(getFilesToUpload().keySet()); filesToCheck.removeAll(getFilesToUnzip(false)); getUploadService().checkUploadFiles(filesToCheck, getTargetFolder(), m_isTargetRootPath, this); } /** * @see org.opencms.gwt.client.rpc.CmsRpcAction#onResponse(java.lang.Object) */ @Override protected void onResponse(CmsUploadFileBean result) { proceedWorkflow(result); } }; callback.execute(); } }
public class class_name { public Set<CoreDocumentSynchronizationConfig> getSynchronizedDocuments( final MongoNamespace namespace ) { this.waitUntilInitialized(); try { ongoingOperationsGroup.enter(); return this.syncConfig.getSynchronizedDocuments(namespace); } finally { ongoingOperationsGroup.exit(); } } }
public class class_name { public Set<CoreDocumentSynchronizationConfig> getSynchronizedDocuments( final MongoNamespace namespace ) { this.waitUntilInitialized(); try { ongoingOperationsGroup.enter(); // depends on control dependency: [try], data = [none] return this.syncConfig.getSynchronizedDocuments(namespace); // depends on control dependency: [try], data = [none] } finally { ongoingOperationsGroup.exit(); } } }
public class class_name { public void marshall(DeleteRepositoryPolicyRequest deleteRepositoryPolicyRequest, ProtocolMarshaller protocolMarshaller) { if (deleteRepositoryPolicyRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteRepositoryPolicyRequest.getRegistryId(), REGISTRYID_BINDING); protocolMarshaller.marshall(deleteRepositoryPolicyRequest.getRepositoryName(), REPOSITORYNAME_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DeleteRepositoryPolicyRequest deleteRepositoryPolicyRequest, ProtocolMarshaller protocolMarshaller) { if (deleteRepositoryPolicyRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteRepositoryPolicyRequest.getRegistryId(), REGISTRYID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(deleteRepositoryPolicyRequest.getRepositoryName(), REPOSITORYNAME_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static boolean isClassOrInterface(Type type) { if (!(type instanceof Class)) { return false; } Class clazz = (Class) type; return !clazz.isPrimitive() && !clazz.isAnnotation() && !clazz.isArray() && !clazz.isEnum() && !clazz.isAnonymousClass(); } }
public class class_name { public static boolean isClassOrInterface(Type type) { if (!(type instanceof Class)) { return false; // depends on control dependency: [if], data = [none] } Class clazz = (Class) type; return !clazz.isPrimitive() && !clazz.isAnnotation() && !clazz.isArray() && !clazz.isEnum() && !clazz.isAnonymousClass(); } }
public class class_name { static ExecutionStatus updatedFlowExecutionStatus(ExecutionStatus jobExecutionStatus, ExecutionStatus currentFlowExecutionStatus) { // if any job failed or flow has failed then return failed status if (currentFlowExecutionStatus == ExecutionStatus.FAILED || jobExecutionStatus == ExecutionStatus.FAILED) { return ExecutionStatus.FAILED; } // if any job is cancelled or flow has failed then return failed status if (currentFlowExecutionStatus == ExecutionStatus.CANCELLED || jobExecutionStatus == ExecutionStatus.CANCELLED) { return ExecutionStatus.CANCELLED; } if (currentFlowExecutionStatus == ExecutionStatus.RUNNING || jobExecutionStatus == ExecutionStatus.RUNNING || jobExecutionStatus == ExecutionStatus.ORCHESTRATED || jobExecutionStatus == ExecutionStatus.COMPILED) { return ExecutionStatus.RUNNING; } return currentFlowExecutionStatus; } }
public class class_name { static ExecutionStatus updatedFlowExecutionStatus(ExecutionStatus jobExecutionStatus, ExecutionStatus currentFlowExecutionStatus) { // if any job failed or flow has failed then return failed status if (currentFlowExecutionStatus == ExecutionStatus.FAILED || jobExecutionStatus == ExecutionStatus.FAILED) { return ExecutionStatus.FAILED; // depends on control dependency: [if], data = [ExecutionStatus] } // if any job is cancelled or flow has failed then return failed status if (currentFlowExecutionStatus == ExecutionStatus.CANCELLED || jobExecutionStatus == ExecutionStatus.CANCELLED) { return ExecutionStatus.CANCELLED; // depends on control dependency: [if], data = [ExecutionStatus.CA] } if (currentFlowExecutionStatus == ExecutionStatus.RUNNING || jobExecutionStatus == ExecutionStatus.RUNNING || jobExecutionStatus == ExecutionStatus.ORCHESTRATED || jobExecutionStatus == ExecutionStatus.COMPILED) { return ExecutionStatus.RUNNING; // depends on control dependency: [if], data = [ExecutionStatus.R] } return currentFlowExecutionStatus; } }
public class class_name { private boolean runQueuedTask(boolean hasPermit) { if (!hasPermit && beginRequest(paused) == RunResult.REJECTED) { return false; } QueuedTask task = null; if (!paused) { task = taskQueue.poll(); } else { //the container is suspended, but we still need to run any force queued tasks task = findForcedTask(); } if (task != null) { if(!task.runRequest()) { decrementRequestCount(); } return true; } else { decrementRequestCount(); return false; } } }
public class class_name { private boolean runQueuedTask(boolean hasPermit) { if (!hasPermit && beginRequest(paused) == RunResult.REJECTED) { return false; // depends on control dependency: [if], data = [none] } QueuedTask task = null; if (!paused) { task = taskQueue.poll(); // depends on control dependency: [if], data = [none] } else { //the container is suspended, but we still need to run any force queued tasks task = findForcedTask(); // depends on control dependency: [if], data = [none] } if (task != null) { if(!task.runRequest()) { decrementRequestCount(); // depends on control dependency: [if], data = [none] } return true; // depends on control dependency: [if], data = [none] } else { decrementRequestCount(); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static byte[] readStream(InputStream stream) { ByteArrayOutputStream ostream = null; try { ostream = new ByteArrayOutputStream(stream.available()); byte data[] = new byte[BUFFER_SIZE]; int count; while ((count = stream.read(data)) != -1) { ostream.write(data, 0, count); } return ostream.toByteArray(); } catch (IOException e) { return null; } finally { if (stream != null) { try { stream.close(); } catch (IOException e) { } } if (ostream != null) { try { ostream.close(); } catch (IOException e) { } } } } }
public class class_name { public static byte[] readStream(InputStream stream) { ByteArrayOutputStream ostream = null; try { ostream = new ByteArrayOutputStream(stream.available()); // depends on control dependency: [try], data = [none] byte data[] = new byte[BUFFER_SIZE]; int count; while ((count = stream.read(data)) != -1) { ostream.write(data, 0, count); // depends on control dependency: [while], data = [none] } return ostream.toByteArray(); // depends on control dependency: [try], data = [none] } catch (IOException e) { return null; } finally { // depends on control dependency: [catch], data = [none] if (stream != null) { try { stream.close(); // depends on control dependency: [try], data = [none] } catch (IOException e) { } // depends on control dependency: [catch], data = [none] } if (ostream != null) { try { ostream.close(); // depends on control dependency: [try], data = [none] } catch (IOException e) { } // depends on control dependency: [catch], data = [none] } } } }
public class class_name { @Override public void onReceive(final Object message) throws Exception { final Class<?> klass = message.getClass(); final State state = fsm.state(); if (logger.isInfoEnabled()) { logger.info(" ********** Connection Current State: " + state.toString()); logger.info(" ********** Connection Processing Message: " + klass.getName()); } if (Observe.class.equals(klass)) { observe(message); } else if (StopObserving.class.equals(klass)) { stopObserving(message); } else if (InitializeConnection.class.equals(klass)) { fsm.transition(message, initializing); } else if (EndpointCredentials.class.equals(klass)) { fsm.transition(message, closed); } else if (OpenConnection.class.equals(klass)) { final OpenConnection request = (OpenConnection) message; if (request.descriptor() == null) { this.webrtc = request.isWebrtc(); fsm.transition(message, openingHalfWay); } else { // TODO check based on descriptor if connection is webrtc fsm.transition(message, opening); } } else if (UpdateConnection.class.equals(klass)) { fsm.transition(message, modifying); } else if (CloseConnection.class.equals(klass)) { fsm.transition(message, closing); } else if (message instanceof JainMgcpResponseEvent) { final JainMgcpResponseEvent response = (JainMgcpResponseEvent) message; final int code = response.getReturnCode().getValue(); if (code == ReturnCode.TRANSACTION_BEING_EXECUTED) { return; } else if (code == ReturnCode.TRANSACTION_EXECUTED_NORMALLY) { if (openingHalfWay.equals(state)) { fsm.transition(message, halfOpen); } else if (opening.equals(state)) { fsm.transition(message, open); } else if (closing.equals(state)) { fsm.transition(message, closed); } else if (modifying.equals(state)) { fsm.transition(message, open); } } else { String err = String.format( "MGCP Transaction did not executed normally: session: %s | endpointId: %s | requestedConnId: %s | connId: %s", session.id() + "", endpointId == null ? "null" : endpointId.getLocalEndpointName(), requestedConnId, connId); logger.error(err); if (modifying.equals(state)) { fsm.transition(message, closing); } else { fsm.transition(message, closed); } } } else if (message instanceof ReceiveTimeout) { fsm.transition(message, closed); } } }
public class class_name { @Override public void onReceive(final Object message) throws Exception { final Class<?> klass = message.getClass(); final State state = fsm.state(); if (logger.isInfoEnabled()) { logger.info(" ********** Connection Current State: " + state.toString()); logger.info(" ********** Connection Processing Message: " + klass.getName()); } if (Observe.class.equals(klass)) { observe(message); } else if (StopObserving.class.equals(klass)) { stopObserving(message); } else if (InitializeConnection.class.equals(klass)) { fsm.transition(message, initializing); } else if (EndpointCredentials.class.equals(klass)) { fsm.transition(message, closed); } else if (OpenConnection.class.equals(klass)) { final OpenConnection request = (OpenConnection) message; if (request.descriptor() == null) { this.webrtc = request.isWebrtc(); // depends on control dependency: [if], data = [none] fsm.transition(message, openingHalfWay); // depends on control dependency: [if], data = [none] } else { // TODO check based on descriptor if connection is webrtc fsm.transition(message, opening); // depends on control dependency: [if], data = [none] } } else if (UpdateConnection.class.equals(klass)) { fsm.transition(message, modifying); } else if (CloseConnection.class.equals(klass)) { fsm.transition(message, closing); } else if (message instanceof JainMgcpResponseEvent) { final JainMgcpResponseEvent response = (JainMgcpResponseEvent) message; final int code = response.getReturnCode().getValue(); if (code == ReturnCode.TRANSACTION_BEING_EXECUTED) { return; // depends on control dependency: [if], data = [none] } else if (code == ReturnCode.TRANSACTION_EXECUTED_NORMALLY) { if (openingHalfWay.equals(state)) { fsm.transition(message, halfOpen); // depends on control dependency: [if], data = [none] } else if (opening.equals(state)) { fsm.transition(message, open); // depends on control dependency: [if], data = [none] } else if (closing.equals(state)) { fsm.transition(message, closed); // depends on control dependency: [if], data = [none] } else if (modifying.equals(state)) { fsm.transition(message, open); // depends on control dependency: [if], data = [none] } } else { String err = String.format( "MGCP Transaction did not executed normally: session: %s | endpointId: %s | requestedConnId: %s | connId: %s", session.id() + "", endpointId == null ? "null" : endpointId.getLocalEndpointName(), requestedConnId, connId); logger.error(err); // depends on control dependency: [if], data = [none] if (modifying.equals(state)) { fsm.transition(message, closing); // depends on control dependency: [if], data = [none] } else { fsm.transition(message, closed); // depends on control dependency: [if], data = [none] } } } else if (message instanceof ReceiveTimeout) { fsm.transition(message, closed); } } }
public class class_name { public static DoubleVector addUnmodified(DoubleVector vector1, DoubleVector vector2) { if (vector2.length() != vector1.length()) throw new IllegalArgumentException( "Vectors of different sizes cannot be added"); DoubleVector finalVector = Vectors.copyOf(vector1); // If vector is a sparse vector, simply get the non zero values and // add them to this instance. if (vector2 instanceof SparseVector) addSparseValues(finalVector, vector2); else { // Otherwise, inspect all values of vector, and only add the non // zero values. int length = vector2.length(); for (int i = 0; i < length; ++i) { double value = vector2.get(i); finalVector.add(i, value); } } return finalVector; } }
public class class_name { public static DoubleVector addUnmodified(DoubleVector vector1, DoubleVector vector2) { if (vector2.length() != vector1.length()) throw new IllegalArgumentException( "Vectors of different sizes cannot be added"); DoubleVector finalVector = Vectors.copyOf(vector1); // If vector is a sparse vector, simply get the non zero values and // add them to this instance. if (vector2 instanceof SparseVector) addSparseValues(finalVector, vector2); else { // Otherwise, inspect all values of vector, and only add the non // zero values. int length = vector2.length(); for (int i = 0; i < length; ++i) { double value = vector2.get(i); finalVector.add(i, value); // depends on control dependency: [for], data = [i] } } return finalVector; } }
public class class_name { public void setOptionGroupsList(java.util.Collection<OptionGroup> optionGroupsList) { if (optionGroupsList == null) { this.optionGroupsList = null; return; } this.optionGroupsList = new com.amazonaws.internal.SdkInternalList<OptionGroup>(optionGroupsList); } }
public class class_name { public void setOptionGroupsList(java.util.Collection<OptionGroup> optionGroupsList) { if (optionGroupsList == null) { this.optionGroupsList = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.optionGroupsList = new com.amazonaws.internal.SdkInternalList<OptionGroup>(optionGroupsList); } }
public class class_name { public void setAttributeNames(java.util.Collection<String> attributeNames) { if (attributeNames == null) { this.attributeNames = null; return; } this.attributeNames = new com.amazonaws.internal.SdkInternalList<String>(attributeNames); } }
public class class_name { public void setAttributeNames(java.util.Collection<String> attributeNames) { if (attributeNames == null) { this.attributeNames = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.attributeNames = new com.amazonaws.internal.SdkInternalList<String>(attributeNames); } }
public class class_name { void replaceArgsWithArray(String desc) { Type[] methodArgs = Type.getArgumentTypes(desc); createObjectArray(methodArgs.length); // [target] args... array for (int i = methodArgs.length - 1; i >= 0; i--) { if (methodArgs[i].getSize() == 2) { visitInsn(DUP_X2); // [target] args... array arg_arg array visitLdcInsn(Integer.valueOf(i)); // [target] args... array arg_arg array idx visitInsn(DUP2_X2); // [target] args... array array idx arg_arg array idx visitInsn(POP2); // [target] args... array array idx arg_arg } else { visitInsn(DUP_X1); // [target] args... array arg array visitInsn(SWAP); // [target] args... array array arg visitLdcInsn(Integer.valueOf(i)); // [target] args... array array arg idx visitInsn(SWAP); // [target] args... array array idx arg } box(methodArgs[i]); // [target] args... array array idx boxed visitInsn(AASTORE); // [target] args... array } // [target] array } }
public class class_name { void replaceArgsWithArray(String desc) { Type[] methodArgs = Type.getArgumentTypes(desc); createObjectArray(methodArgs.length); // [target] args... array for (int i = methodArgs.length - 1; i >= 0; i--) { if (methodArgs[i].getSize() == 2) { visitInsn(DUP_X2); // [target] args... array arg_arg array // depends on control dependency: [if], data = [2)] visitLdcInsn(Integer.valueOf(i)); // [target] args... array arg_arg array idx // depends on control dependency: [if], data = [none] visitInsn(DUP2_X2); // [target] args... array array idx arg_arg array idx // depends on control dependency: [if], data = [2)] visitInsn(POP2); // [target] args... array array idx arg_arg // depends on control dependency: [if], data = [2)] } else { visitInsn(DUP_X1); // [target] args... array arg array // depends on control dependency: [if], data = [none] visitInsn(SWAP); // [target] args... array array arg // depends on control dependency: [if], data = [none] visitLdcInsn(Integer.valueOf(i)); // [target] args... array array arg idx // depends on control dependency: [if], data = [none] visitInsn(SWAP); // [target] args... array array idx arg // depends on control dependency: [if], data = [none] } box(methodArgs[i]); // [target] args... array array idx boxed // depends on control dependency: [for], data = [i] visitInsn(AASTORE); // [target] args... array // depends on control dependency: [for], data = [none] } // [target] array } }
public class class_name { synchronized public void setEnabledProtocols(String[] protocols) { enabledProtocols = new ProtocolList(protocols); if ((handshaker != null) && !handshaker.activated()) { handshaker.setEnabledProtocols(enabledProtocols); } } }
public class class_name { synchronized public void setEnabledProtocols(String[] protocols) { enabledProtocols = new ProtocolList(protocols); if ((handshaker != null) && !handshaker.activated()) { handshaker.setEnabledProtocols(enabledProtocols); // depends on control dependency: [if], data = [none] } } }
public class class_name { public List<java.lang.Object> getStartPageOrEndPageOrMedlinePgn() { if (startPageOrEndPageOrMedlinePgn == null) { startPageOrEndPageOrMedlinePgn = new ArrayList<java.lang.Object>(); } return this.startPageOrEndPageOrMedlinePgn; } }
public class class_name { public List<java.lang.Object> getStartPageOrEndPageOrMedlinePgn() { if (startPageOrEndPageOrMedlinePgn == null) { startPageOrEndPageOrMedlinePgn = new ArrayList<java.lang.Object>(); // depends on control dependency: [if], data = [none] } return this.startPageOrEndPageOrMedlinePgn; } }
public class class_name { private void performClearOperation(ModelElementInstanceImpl modelElement, Collection<DomElement> elementsToRemove) { Collection<ModelElementInstance> modelElements = ModelUtil.getModelElementCollection(elementsToRemove, modelElement.getModelInstance()); for (ModelElementInstance element : modelElements) { modelElement.removeChildElement(element); } } }
public class class_name { private void performClearOperation(ModelElementInstanceImpl modelElement, Collection<DomElement> elementsToRemove) { Collection<ModelElementInstance> modelElements = ModelUtil.getModelElementCollection(elementsToRemove, modelElement.getModelInstance()); for (ModelElementInstance element : modelElements) { modelElement.removeChildElement(element); // depends on control dependency: [for], data = [element] } } }
public class class_name { synchronized void unlink(final OtpErlangPid from, final OtpErlangPid to) { links.removeLink(from, to); try { super.sendUnlink(from, to); } catch (final IOException e) { } } }
public class class_name { synchronized void unlink(final OtpErlangPid from, final OtpErlangPid to) { links.removeLink(from, to); try { super.sendUnlink(from, to); // depends on control dependency: [try], data = [none] } catch (final IOException e) { } // depends on control dependency: [catch], data = [none] } }
public class class_name { public Snapshot load( InputStream load ) throws IOException { final BufferedReader reader = new BufferedReader( new InputStreamReader( load ) ); final List<SnapshotElement> elements = new ArrayList<SnapshotElement>(); try { String line = null; while( ( line = reader.readLine() ) != null ) { String[] parts = line.split( "\\" + LINE_DELIM ); String name = parts[ 0 ]; String checksum = parts[ 1 ]; String uri = parts[ 2 ]; String type = parts[ 3 ]; elements.add( new DefaultSnapshotElement( name, new URI( uri ), QType.valueOf( type ), checksum ) ); } } catch( URISyntaxException e ) { throw new IOException( "At least one URI is not valid. Check snapshot export", e ); } finally { reader.close(); } return new DefaultSnapshot( elements ); } }
public class class_name { public Snapshot load( InputStream load ) throws IOException { final BufferedReader reader = new BufferedReader( new InputStreamReader( load ) ); final List<SnapshotElement> elements = new ArrayList<SnapshotElement>(); try { String line = null; while( ( line = reader.readLine() ) != null ) { String[] parts = line.split( "\\" + LINE_DELIM ); String name = parts[ 0 ]; String checksum = parts[ 1 ]; String uri = parts[ 2 ]; String type = parts[ 3 ]; elements.add( new DefaultSnapshotElement( name, new URI( uri ), QType.valueOf( type ), checksum ) ); // depends on control dependency: [while], data = [none] } } catch( URISyntaxException e ) { throw new IOException( "At least one URI is not valid. Check snapshot export", e ); } finally { reader.close(); } return new DefaultSnapshot( elements ); } }
public class class_name { private int getColIndex(String colName, String tabName) { int ordPos = 0; try { if (cConn == null) { return -1; } if (dbmeta == null) { dbmeta = cConn.getMetaData(); } ResultSet colList = dbmeta.getColumns(null, null, tabName, colName); colList.next(); ordPos = colList.getInt("ORDINAL_POSITION"); colList.close(); } catch (SQLException e) { System.out.println("SQL Exception: " + e.getMessage()); } return ordPos - 1; } }
public class class_name { private int getColIndex(String colName, String tabName) { int ordPos = 0; try { if (cConn == null) { return -1; // depends on control dependency: [if], data = [none] } if (dbmeta == null) { dbmeta = cConn.getMetaData(); // depends on control dependency: [if], data = [none] } ResultSet colList = dbmeta.getColumns(null, null, tabName, colName); colList.next(); // depends on control dependency: [try], data = [none] ordPos = colList.getInt("ORDINAL_POSITION"); // depends on control dependency: [try], data = [none] colList.close(); // depends on control dependency: [try], data = [none] } catch (SQLException e) { System.out.println("SQL Exception: " + e.getMessage()); } // depends on control dependency: [catch], data = [none] return ordPos - 1; } }
public class class_name { @Override public boolean sendImg(String toUserName, String filePath) { DateUtils.sendSleep(); String mediaId = this.uploadMedia(toUserName, filePath).getMediaId(); if (StringUtils.isEmpty(mediaId)) { log.warn("Media为空"); return false; } String url = String.format("%s/webwxsendmsgimg?fun=async&f=json&pass_ticket=%s", bot.session().getUrl(), bot.session().getPassTicket()); String msgId = System.currentTimeMillis() / 1000 + StringUtils.random(6); Map<String, Object> msg = new HashMap<>(); msg.put("Type", 3); msg.put("MediaId", mediaId); msg.put("FromUserName", bot.session().getUserName()); msg.put("ToUserName", toUserName); msg.put("LocalID", msgId); msg.put("ClientMsgId", msgId); JsonResponse response = this.client.send(new JsonRequest(url).post().jsonBody() .add("BaseRequest", bot.session().getBaseRequest()) .add("Msg", msg) ); return null != response && response.success(); } }
public class class_name { @Override public boolean sendImg(String toUserName, String filePath) { DateUtils.sendSleep(); String mediaId = this.uploadMedia(toUserName, filePath).getMediaId(); if (StringUtils.isEmpty(mediaId)) { log.warn("Media为空"); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } String url = String.format("%s/webwxsendmsgimg?fun=async&f=json&pass_ticket=%s", bot.session().getUrl(), bot.session().getPassTicket()); String msgId = System.currentTimeMillis() / 1000 + StringUtils.random(6); Map<String, Object> msg = new HashMap<>(); msg.put("Type", 3); msg.put("MediaId", mediaId); msg.put("FromUserName", bot.session().getUserName()); msg.put("ToUserName", toUserName); msg.put("LocalID", msgId); msg.put("ClientMsgId", msgId); JsonResponse response = this.client.send(new JsonRequest(url).post().jsonBody() .add("BaseRequest", bot.session().getBaseRequest()) .add("Msg", msg) ); return null != response && response.success(); } }
public class class_name { private void removeViewHolders(@Nullable Collection<ViewHolder> toRemove) { if (toRemove != null) { for (ViewHolder holder : toRemove) { mViewHolders.remove(holder.getRowIndex(), holder.getColumnIndex()); } } } }
public class class_name { private void removeViewHolders(@Nullable Collection<ViewHolder> toRemove) { if (toRemove != null) { for (ViewHolder holder : toRemove) { mViewHolders.remove(holder.getRowIndex(), holder.getColumnIndex()); // depends on control dependency: [for], data = [holder] } } } }
public class class_name { @Override public EClass getIfcMaterialSelect() { if (ifcMaterialSelectEClass == null) { ifcMaterialSelectEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(1140); } return ifcMaterialSelectEClass; } }
public class class_name { @Override public EClass getIfcMaterialSelect() { if (ifcMaterialSelectEClass == null) { ifcMaterialSelectEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(1140); // depends on control dependency: [if], data = [none] } return ifcMaterialSelectEClass; } }
public class class_name { public int min() { int min = Integer.MAX_VALUE; for (E key : map.keySet()) { min = Math.min(min, getIntCount(key)); } return min; } }
public class class_name { public int min() { int min = Integer.MAX_VALUE; for (E key : map.keySet()) { min = Math.min(min, getIntCount(key)); // depends on control dependency: [for], data = [key] } return min; } }
public class class_name { protected Query buildPrefetchQuery(Collection ids) { CollectionDescriptor cds = getCollectionDescriptor(); QueryByCriteria query = buildPrefetchQuery(ids, cds.getForeignKeyFieldDescriptors(getItemClassDescriptor())); // check if collection must be ordered if (!cds.getOrderBy().isEmpty()) { Iterator iter = cds.getOrderBy().iterator(); while (iter.hasNext()) { query.addOrderBy((FieldHelper) iter.next()); } } return query; } }
public class class_name { protected Query buildPrefetchQuery(Collection ids) { CollectionDescriptor cds = getCollectionDescriptor(); QueryByCriteria query = buildPrefetchQuery(ids, cds.getForeignKeyFieldDescriptors(getItemClassDescriptor())); // check if collection must be ordered if (!cds.getOrderBy().isEmpty()) { Iterator iter = cds.getOrderBy().iterator(); while (iter.hasNext()) { query.addOrderBy((FieldHelper) iter.next()); // depends on control dependency: [while], data = [none] } } return query; } }
public class class_name { @Override public int get(TemporalField field) { if (field instanceof ChronoField) { switch ((ChronoField) field) { case INSTANT_SECONDS: throw new UnsupportedTemporalTypeException("Invalid field 'InstantSeconds' for get() method, use getLong() instead"); case OFFSET_SECONDS: return getOffset().getTotalSeconds(); } return dateTime.get(field); } return Temporal.super.get(field); } }
public class class_name { @Override public int get(TemporalField field) { if (field instanceof ChronoField) { switch ((ChronoField) field) { case INSTANT_SECONDS: throw new UnsupportedTemporalTypeException("Invalid field 'InstantSeconds' for get() method, use getLong() instead"); case OFFSET_SECONDS: return getOffset().getTotalSeconds(); } return dateTime.get(field); // depends on control dependency: [if], data = [none] } return Temporal.super.get(field); } }
public class class_name { public static CRLReason getRevocationReason(X509CRLEntry crlEntry) { try { byte[] ext = crlEntry.getExtensionValue("2.5.29.21"); if (ext == null) { return null; } DerValue val = new DerValue(ext); byte[] data = val.getOctetString(); CRLReasonCodeExtension rcExt = new CRLReasonCodeExtension(Boolean.FALSE, data); return rcExt.getReasonCode(); } catch (IOException ioe) { return null; } } }
public class class_name { public static CRLReason getRevocationReason(X509CRLEntry crlEntry) { try { byte[] ext = crlEntry.getExtensionValue("2.5.29.21"); if (ext == null) { return null; // depends on control dependency: [if], data = [none] } DerValue val = new DerValue(ext); byte[] data = val.getOctetString(); CRLReasonCodeExtension rcExt = new CRLReasonCodeExtension(Boolean.FALSE, data); return rcExt.getReasonCode(); // depends on control dependency: [try], data = [none] } catch (IOException ioe) { return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public void endElement(String uri, String localName, String name) throws SAXException { if ("name".equals(name)) { final String itemName = this.chars.toString().trim(); if (this.currentTable == null) { this.currentTable = itemName; } else if (this.currentColumn == null) { this.currentColumn = itemName; } } else if ("value".equals(name)) { this.currentValue = this.chars.toString().trim(); } else if ("column".equals(name)) { this.rowData.put(this.currentColumn, this.currentValue); this.currentColumn = null; this.currentValue = null; } else if ("row".equals(name)) { this.doInsert(); this.rowData = null; } else if ("table".equals(name)) { this.currentTable = null; } this.chars = null; } }
public class class_name { @Override public void endElement(String uri, String localName, String name) throws SAXException { if ("name".equals(name)) { final String itemName = this.chars.toString().trim(); if (this.currentTable == null) { this.currentTable = itemName; // depends on control dependency: [if], data = [none] } else if (this.currentColumn == null) { this.currentColumn = itemName; // depends on control dependency: [if], data = [none] } } else if ("value".equals(name)) { this.currentValue = this.chars.toString().trim(); } else if ("column".equals(name)) { this.rowData.put(this.currentColumn, this.currentValue); this.currentColumn = null; this.currentValue = null; } else if ("row".equals(name)) { this.doInsert(); this.rowData = null; } else if ("table".equals(name)) { this.currentTable = null; } this.chars = null; } }
public class class_name { @SuppressWarnings("unchecked") private static Map<String, Boolean> getRenderedScriptResources(FacesContext facesContext) { Map<String, Boolean> map = (Map<String, Boolean>) facesContext.getAttributes().get( RENDERED_SCRIPT_RESOURCES_SET); if (map == null) { map = new HashMap<String, Boolean>(); facesContext.getAttributes().put(RENDERED_SCRIPT_RESOURCES_SET,map); } return map; } }
public class class_name { @SuppressWarnings("unchecked") private static Map<String, Boolean> getRenderedScriptResources(FacesContext facesContext) { Map<String, Boolean> map = (Map<String, Boolean>) facesContext.getAttributes().get( RENDERED_SCRIPT_RESOURCES_SET); if (map == null) { map = new HashMap<String, Boolean>(); // depends on control dependency: [if], data = [none] facesContext.getAttributes().put(RENDERED_SCRIPT_RESOURCES_SET,map); // depends on control dependency: [if], data = [none] } return map; } }
public class class_name { public void setAlias(String alias) { if (alias == null || alias.trim().equals("")) { m_alias = null; } else { m_alias = alias; } // propagate to SelectionCriteria,not to Criteria for (int i = 0; i < m_criteria.size(); i++) { if (!(m_criteria.elementAt(i) instanceof Criteria)) { ((SelectionCriteria) m_criteria.elementAt(i)).setAlias(m_alias); } } } }
public class class_name { public void setAlias(String alias) { if (alias == null || alias.trim().equals("")) { m_alias = null; // depends on control dependency: [if], data = [none] } else { m_alias = alias; // depends on control dependency: [if], data = [none] } // propagate to SelectionCriteria,not to Criteria for (int i = 0; i < m_criteria.size(); i++) { if (!(m_criteria.elementAt(i) instanceof Criteria)) { ((SelectionCriteria) m_criteria.elementAt(i)).setAlias(m_alias); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public int getColumnIndex(final String name) { for (int i = 0; i < this.columnsValues.size(); i++) { final JKTableColumnValue value = this.columnsValues.get(i); if (value.getTableColumn().getName().toLowerCase().equals(name.toLowerCase())) { return i; } } return -1; } }
public class class_name { public int getColumnIndex(final String name) { for (int i = 0; i < this.columnsValues.size(); i++) { final JKTableColumnValue value = this.columnsValues.get(i); if (value.getTableColumn().getName().toLowerCase().equals(name.toLowerCase())) { return i; // depends on control dependency: [if], data = [none] } } return -1; } }
public class class_name { public void runIntoJTP(final JRebirthRunnable runnable) { if (getFacade().executorService().checkAvailability(runnable.priority())) { getFacade().executorService().execute(runnable); LOGGER.log(JTP_QUEUED, runnable.toString()); } else { getFacade().highPriorityExecutorService().execute(runnable); LOGGER.log(HPTP_QUEUED, runnable.toString()); } } }
public class class_name { public void runIntoJTP(final JRebirthRunnable runnable) { if (getFacade().executorService().checkAvailability(runnable.priority())) { getFacade().executorService().execute(runnable); // depends on control dependency: [if], data = [none] LOGGER.log(JTP_QUEUED, runnable.toString()); // depends on control dependency: [if], data = [none] } else { getFacade().highPriorityExecutorService().execute(runnable); // depends on control dependency: [if], data = [none] LOGGER.log(HPTP_QUEUED, runnable.toString()); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void setAttributes (Attributes atts) { int length = atts.getLength (); super.setAttributes (atts); declared = new boolean [length]; specified = new boolean [length]; if (atts instanceof Attributes2) { Attributes2 a2 = (Attributes2) atts; for (int i = 0; i < length; i++) { declared [i] = a2.isDeclared (i); specified [i] = a2.isSpecified (i); } } else { for (int i = 0; i < length; i++) { declared [i] = !"CDATA".equals (atts.getType (i)); specified [i] = true; } } } }
public class class_name { public void setAttributes (Attributes atts) { int length = atts.getLength (); super.setAttributes (atts); declared = new boolean [length]; specified = new boolean [length]; if (atts instanceof Attributes2) { Attributes2 a2 = (Attributes2) atts; for (int i = 0; i < length; i++) { declared [i] = a2.isDeclared (i); // depends on control dependency: [for], data = [i] specified [i] = a2.isSpecified (i); // depends on control dependency: [for], data = [i] } } else { for (int i = 0; i < length; i++) { declared [i] = !"CDATA".equals (atts.getType (i)); // depends on control dependency: [for], data = [i] specified [i] = true; // depends on control dependency: [for], data = [i] } } } }
public class class_name { @Override public boolean showCarbon(IAtom atom, IAtomContainer container, RendererModel model) { Integer massNumber = atom.getMassNumber(); if (massNumber != null) { try { Integer expectedMassNumber = Isotopes.getInstance().getMajorIsotope(atom.getSymbol()).getMassNumber(); if (!massNumber.equals(expectedMassNumber)) return true; } catch (IOException e) { logger.warn(e); } } return super.showCarbon(atom, container, model); } }
public class class_name { @Override public boolean showCarbon(IAtom atom, IAtomContainer container, RendererModel model) { Integer massNumber = atom.getMassNumber(); if (massNumber != null) { try { Integer expectedMassNumber = Isotopes.getInstance().getMajorIsotope(atom.getSymbol()).getMassNumber(); if (!massNumber.equals(expectedMassNumber)) return true; } catch (IOException e) { logger.warn(e); } // depends on control dependency: [catch], data = [none] } return super.showCarbon(atom, container, model); } }
public class class_name { private <T> void renderSoapHeader(final Marshallable<T> marshallable, final Map<String, String> context, T xmlContext) { try { final Marshaller marshaller = jaxbContext.createMarshaller(); marshallable.marshal(marshaller, TpicMap.wrap(context), xmlContext); } catch (JAXBException e) { logger.warn("Unable to render TPIC header: {}", e.getMessage()); logger.debug("WithStack: Unable to render TPIC header: {}", e.getMessage(), e); } } }
public class class_name { private <T> void renderSoapHeader(final Marshallable<T> marshallable, final Map<String, String> context, T xmlContext) { try { final Marshaller marshaller = jaxbContext.createMarshaller(); marshallable.marshal(marshaller, TpicMap.wrap(context), xmlContext); // depends on control dependency: [try], data = [none] } catch (JAXBException e) { logger.warn("Unable to render TPIC header: {}", e.getMessage()); logger.debug("WithStack: Unable to render TPIC header: {}", e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private static void convertVals(final Object[] convertedVals, final Set<ReferenceEqualityKey<Object>> visitedOnPath, final Set<ReferenceEqualityKey<Object>> standardObjectVisited, final ClassFieldCache classFieldCache, final Map<ReferenceEqualityKey<Object>, JSONObject> objToJSONVal, final boolean onlySerializePublicFields) { // Pass 1: find standard objects (objects that are not of basic value type or collections/arrays/maps) // that have not yet been visited, and mark them as visited. Place a JSONReference placeholder in // convertedVals[i] to signify this. This first pass is non-recursive, so that objects are visited // as high up the tree as possible, since it is only the first visit of an object that shows in the // final JSON doc, and the rest are turned into references. final ReferenceEqualityKey<?>[] valKeys = new ReferenceEqualityKey<?>[convertedVals.length]; final boolean[] needToConvert = new boolean[convertedVals.length]; for (int i = 0; i < convertedVals.length; i++) { final Object val = convertedVals[i]; // By default (for basic value types), don't convert vals needToConvert[i] = !JSONUtils.isBasicValueType(val); if (needToConvert[i] && !JSONUtils.isCollectionOrArray(val)) { // If this object is a standard object or a map, check if it has already been visited // elsewhere in the tree. If so, use a JSONReference instead, and mark the object // as visited. final ReferenceEqualityKey<Object> valKey = new ReferenceEqualityKey<>(val); valKeys[i] = valKey; final boolean alreadyVisited = !standardObjectVisited.add(valKey); if (alreadyVisited) { convertedVals[i] = new JSONReference(val); needToConvert[i] = false; } } } // Pass 2: Recursively convert items in standard objects, maps, collections and arrays to JSON objects. for (int i = 0; i < convertedVals.length; i++) { if (needToConvert[i]) { // Recursively convert standard objects (if it is the first time they have been visited) // and maps to JSON objects, and convert collections and arrays to JSON arrays. final Object val = convertedVals[i]; convertedVals[i] = toJSONGraph(val, visitedOnPath, standardObjectVisited, classFieldCache, objToJSONVal, onlySerializePublicFields); if (!JSONUtils.isCollectionOrArray(val)) { // If this object is a standard object or map, then it has not been visited before, // so save the mapping between original object and converted object @SuppressWarnings("unchecked") final ReferenceEqualityKey<Object> valKey = (ReferenceEqualityKey<Object>) valKeys[i]; objToJSONVal.put(valKey, (JSONObject) convertedVals[i]); } } } } }
public class class_name { private static void convertVals(final Object[] convertedVals, final Set<ReferenceEqualityKey<Object>> visitedOnPath, final Set<ReferenceEqualityKey<Object>> standardObjectVisited, final ClassFieldCache classFieldCache, final Map<ReferenceEqualityKey<Object>, JSONObject> objToJSONVal, final boolean onlySerializePublicFields) { // Pass 1: find standard objects (objects that are not of basic value type or collections/arrays/maps) // that have not yet been visited, and mark them as visited. Place a JSONReference placeholder in // convertedVals[i] to signify this. This first pass is non-recursive, so that objects are visited // as high up the tree as possible, since it is only the first visit of an object that shows in the // final JSON doc, and the rest are turned into references. final ReferenceEqualityKey<?>[] valKeys = new ReferenceEqualityKey<?>[convertedVals.length]; final boolean[] needToConvert = new boolean[convertedVals.length]; for (int i = 0; i < convertedVals.length; i++) { final Object val = convertedVals[i]; // By default (for basic value types), don't convert vals needToConvert[i] = !JSONUtils.isBasicValueType(val); // depends on control dependency: [for], data = [i] if (needToConvert[i] && !JSONUtils.isCollectionOrArray(val)) { // If this object is a standard object or a map, check if it has already been visited // elsewhere in the tree. If so, use a JSONReference instead, and mark the object // as visited. final ReferenceEqualityKey<Object> valKey = new ReferenceEqualityKey<>(val); valKeys[i] = valKey; // depends on control dependency: [if], data = [none] final boolean alreadyVisited = !standardObjectVisited.add(valKey); if (alreadyVisited) { convertedVals[i] = new JSONReference(val); // depends on control dependency: [if], data = [none] needToConvert[i] = false; // depends on control dependency: [if], data = [none] } } } // Pass 2: Recursively convert items in standard objects, maps, collections and arrays to JSON objects. for (int i = 0; i < convertedVals.length; i++) { if (needToConvert[i]) { // Recursively convert standard objects (if it is the first time they have been visited) // and maps to JSON objects, and convert collections and arrays to JSON arrays. final Object val = convertedVals[i]; convertedVals[i] = toJSONGraph(val, visitedOnPath, standardObjectVisited, classFieldCache, objToJSONVal, onlySerializePublicFields); // depends on control dependency: [if], data = [none] if (!JSONUtils.isCollectionOrArray(val)) { // If this object is a standard object or map, then it has not been visited before, // so save the mapping between original object and converted object @SuppressWarnings("unchecked") final ReferenceEqualityKey<Object> valKey = (ReferenceEqualityKey<Object>) valKeys[i]; objToJSONVal.put(valKey, (JSONObject) convertedVals[i]); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public static void writeState(String fname) { try { persData.store(new FileOutputStream(fname), Calendar.getInstance().getTime().toString()); } catch (FileNotFoundException e1) { e1.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }
public class class_name { public static void writeState(String fname) { try { persData.store(new FileOutputStream(fname), Calendar.getInstance().getTime().toString()); // depends on control dependency: [try], data = [none] } catch (FileNotFoundException e1) { e1.printStackTrace(); } catch (IOException e) { // depends on control dependency: [catch], data = [none] e.printStackTrace(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public AuthorizationHeader createAuthorizationHeader() throws HawkException { String hmac = this.generateHmac(); AuthorizationBuilder headerBuilder = AuthorizationHeader .authorization().ts(ts).nonce(nonce).id(getId()).mac(hmac); if (hasExt()) { headerBuilder.ext(getExt()); } if (hasApp()) { headerBuilder.app(getApp()); if (hasDlg()) { headerBuilder.dlg(getDlg()); } } if (hasHash()) { headerBuilder.hash(getHash()); } return headerBuilder.build(); } }
public class class_name { public AuthorizationHeader createAuthorizationHeader() throws HawkException { String hmac = this.generateHmac(); AuthorizationBuilder headerBuilder = AuthorizationHeader .authorization().ts(ts).nonce(nonce).id(getId()).mac(hmac); if (hasExt()) { headerBuilder.ext(getExt()); } if (hasApp()) { headerBuilder.app(getApp()); if (hasDlg()) { headerBuilder.dlg(getDlg()); // depends on control dependency: [if], data = [none] } } if (hasHash()) { headerBuilder.hash(getHash()); } return headerBuilder.build(); } }
public class class_name { protected Method findGetter(Object data, String property) throws IntrospectionException { Class<?> clazz = getClass(data); String key = clazz.getName() + ":" + property; Method method = methods.get(key); if (method == null) { Method newMethod = null; PropertyDescriptor[] props = Introspector.getBeanInfo(clazz).getPropertyDescriptors(); for (PropertyDescriptor prop : props) { if (prop.getName().equalsIgnoreCase(property)) { newMethod = prop.getReadMethod(); } } method = methods.putIfAbsent(key, newMethod); if (method == null) { // put succeeded, use new value method = newMethod; } } return method; } }
public class class_name { protected Method findGetter(Object data, String property) throws IntrospectionException { Class<?> clazz = getClass(data); String key = clazz.getName() + ":" + property; Method method = methods.get(key); if (method == null) { Method newMethod = null; PropertyDescriptor[] props = Introspector.getBeanInfo(clazz).getPropertyDescriptors(); for (PropertyDescriptor prop : props) { if (prop.getName().equalsIgnoreCase(property)) { newMethod = prop.getReadMethod(); // depends on control dependency: [if], data = [none] } } method = methods.putIfAbsent(key, newMethod); if (method == null) { // put succeeded, use new value method = newMethod; } } return method; } }
public class class_name { public void addNextValue(Object val) { String valCountStr = val.toString(); int pos = valCountStr.lastIndexOf("\t"); String valStr = valCountStr; String countStr = "1"; if (pos >= 0) { valStr = valCountStr.substring(0, pos); countStr = valCountStr.substring(pos + 1); } Long count = (Long) this.items.get(valStr); long inc = Long.parseLong(countStr); if (count == null) { count = inc; } else { count = count.longValue() + inc; } items.put(valStr, count); } }
public class class_name { public void addNextValue(Object val) { String valCountStr = val.toString(); int pos = valCountStr.lastIndexOf("\t"); String valStr = valCountStr; String countStr = "1"; if (pos >= 0) { valStr = valCountStr.substring(0, pos); // depends on control dependency: [if], data = [none] countStr = valCountStr.substring(pos + 1); // depends on control dependency: [if], data = [(pos] } Long count = (Long) this.items.get(valStr); long inc = Long.parseLong(countStr); if (count == null) { count = inc; // depends on control dependency: [if], data = [none] } else { count = count.longValue() + inc; // depends on control dependency: [if], data = [none] } items.put(valStr, count); } }
public class class_name { public static ArrayList<String> listBucketNames(Map<String, Object> m) { ArrayList<String> acc = new ArrayList<String>(); for(Map.Entry<String, Object> entry : m.entrySet()) { if( isValidBucket(entry.getValue()) ) { acc.add(entry.getKey()); } } return acc; } }
public class class_name { public static ArrayList<String> listBucketNames(Map<String, Object> m) { ArrayList<String> acc = new ArrayList<String>(); for(Map.Entry<String, Object> entry : m.entrySet()) { if( isValidBucket(entry.getValue()) ) { acc.add(entry.getKey()); // depends on control dependency: [if], data = [none] } } return acc; } }
public class class_name { private String[] parseClassNames(String propertyName) { String hands = getProperty(propertyName); if (hands == null) { return new String[0]; } hands = hands.trim(); int ix = 0; Vector<String> result = new Vector<>(); while (ix < hands.length()) { int end = ix; while (end < hands.length()) { if (Character.isWhitespace(hands.charAt(end))) { break; } if (hands.charAt(end) == ',') { break; } end++; } String word = hands.substring(ix, end); ix = end+1; word = word.trim(); if (word.length() == 0) { continue; } result.add(word); } return result.toArray(new String[result.size()]); } }
public class class_name { private String[] parseClassNames(String propertyName) { String hands = getProperty(propertyName); if (hands == null) { return new String[0]; // depends on control dependency: [if], data = [none] } hands = hands.trim(); int ix = 0; Vector<String> result = new Vector<>(); while (ix < hands.length()) { int end = ix; while (end < hands.length()) { if (Character.isWhitespace(hands.charAt(end))) { break; } if (hands.charAt(end) == ',') { break; } end++; // depends on control dependency: [while], data = [none] } String word = hands.substring(ix, end); ix = end+1; // depends on control dependency: [while], data = [none] word = word.trim(); // depends on control dependency: [while], data = [none] if (word.length() == 0) { continue; } result.add(word); // depends on control dependency: [while], data = [none] } return result.toArray(new String[result.size()]); } }
public class class_name { private static void splitRowsOnGaps(Row row, final SDocumentGraph graph, long startTokenIndex, long endTokenIndex) { ListIterator<GridEvent> itEvents = row.getEvents().listIterator(); while (itEvents.hasNext()) { GridEvent event = itEvents.next(); int lastTokenIndex = -1; // sort the coveredIDs LinkedList<String> sortedCoveredToken = new LinkedList<>(event. getCoveredIDs()); Collections.sort(sortedCoveredToken, new Comparator<String>() { @Override public int compare(String o1, String o2) { SNode node1 = graph.getNode(o1); SNode node2 = graph.getNode(o2); if (node1 == node2) { return 0; } if (node1 == null) { return -1; } if (node2 == null) { return +1; } RelannisNodeFeature feat1 = (RelannisNodeFeature) node1.getFeature( ANNIS_NS, FEAT_RELANNIS_NODE).getValue(); RelannisNodeFeature feat2 = (RelannisNodeFeature) node2.getFeature( ANNIS_NS, FEAT_RELANNIS_NODE).getValue(); long tokenIndex1 = feat1.getTokenIndex(); long tokenIndex2 = feat2.getTokenIndex(); return Long.compare(tokenIndex1, tokenIndex2); } }); // first calculate all gaps List<GridEvent> gaps = new LinkedList<>(); for (String id : sortedCoveredToken) { SNode node = graph.getNode(id); RelannisNodeFeature feat = (RelannisNodeFeature) node.getFeature( ANNIS_NS, FEAT_RELANNIS_NODE).getValue(); long tokenIndexRaw = feat.getTokenIndex(); tokenIndexRaw = clip(tokenIndexRaw, startTokenIndex, endTokenIndex); int tokenIndex = (int) (tokenIndexRaw - startTokenIndex); // sanity check if(tokenIndex >= event.getLeft() && tokenIndex <= event.getRight()) { int diff = tokenIndex - lastTokenIndex; if (lastTokenIndex >= 0 && diff > 1) { // we detected a gap GridEvent gap = new GridEvent(event.getId() + "_gap_" + gaps.size(), lastTokenIndex + 1, tokenIndex - 1, ""); gap.setGap(true); gaps.add(gap); } lastTokenIndex = tokenIndex; } else { // reset gap search when discovered there were token we use for // hightlighting but do not actually cover lastTokenIndex = -1; } } // end for each covered token id ListIterator<GridEvent> itGaps = gaps.listIterator(); // remember the old right value int oldRight = event.getRight(); int gapNr = 0; while(itGaps.hasNext()) { GridEvent gap = itGaps.next(); if(gapNr == 0) { // shorten original event event.setRight(gap.getLeft() - 1); } // insert the real gap itEvents.add(gap); int rightBorder = oldRight; if(itGaps.hasNext()) { // don't use the old event right border since the gap should only go until // the next event GridEvent nextGap = itGaps.next(); itGaps.previous(); rightBorder = nextGap.getLeft()-1; } // insert a new event node that covers the rest of the event GridEvent after = new GridEvent(event); after.setId(event.getId() + "_after_" + gapNr); after.setLeft(gap.getRight() + 1); after.setRight(rightBorder); itEvents.add(after); gapNr++; } } } }
public class class_name { private static void splitRowsOnGaps(Row row, final SDocumentGraph graph, long startTokenIndex, long endTokenIndex) { ListIterator<GridEvent> itEvents = row.getEvents().listIterator(); while (itEvents.hasNext()) { GridEvent event = itEvents.next(); int lastTokenIndex = -1; // sort the coveredIDs LinkedList<String> sortedCoveredToken = new LinkedList<>(event. getCoveredIDs()); Collections.sort(sortedCoveredToken, new Comparator<String>() { @Override public int compare(String o1, String o2) { SNode node1 = graph.getNode(o1); SNode node2 = graph.getNode(o2); if (node1 == node2) { return 0; // depends on control dependency: [if], data = [none] } if (node1 == null) { return -1; // depends on control dependency: [if], data = [none] } if (node2 == null) { return +1; // depends on control dependency: [if], data = [none] } RelannisNodeFeature feat1 = (RelannisNodeFeature) node1.getFeature( ANNIS_NS, FEAT_RELANNIS_NODE).getValue(); RelannisNodeFeature feat2 = (RelannisNodeFeature) node2.getFeature( ANNIS_NS, FEAT_RELANNIS_NODE).getValue(); long tokenIndex1 = feat1.getTokenIndex(); long tokenIndex2 = feat2.getTokenIndex(); return Long.compare(tokenIndex1, tokenIndex2); } }); // depends on control dependency: [while], data = [none] // first calculate all gaps List<GridEvent> gaps = new LinkedList<>(); for (String id : sortedCoveredToken) { SNode node = graph.getNode(id); RelannisNodeFeature feat = (RelannisNodeFeature) node.getFeature( ANNIS_NS, FEAT_RELANNIS_NODE).getValue(); long tokenIndexRaw = feat.getTokenIndex(); tokenIndexRaw = clip(tokenIndexRaw, startTokenIndex, endTokenIndex); // depends on control dependency: [for], data = [none] int tokenIndex = (int) (tokenIndexRaw - startTokenIndex); // sanity check if(tokenIndex >= event.getLeft() && tokenIndex <= event.getRight()) { int diff = tokenIndex - lastTokenIndex; if (lastTokenIndex >= 0 && diff > 1) { // we detected a gap GridEvent gap = new GridEvent(event.getId() + "_gap_" + gaps.size(), lastTokenIndex + 1, tokenIndex - 1, ""); gap.setGap(true); // depends on control dependency: [if], data = [none] gaps.add(gap); // depends on control dependency: [if], data = [none] } lastTokenIndex = tokenIndex; // depends on control dependency: [if], data = [none] } else { // reset gap search when discovered there were token we use for // hightlighting but do not actually cover lastTokenIndex = -1; // depends on control dependency: [if], data = [none] } } // end for each covered token id ListIterator<GridEvent> itGaps = gaps.listIterator(); // remember the old right value int oldRight = event.getRight(); int gapNr = 0; while(itGaps.hasNext()) { GridEvent gap = itGaps.next(); if(gapNr == 0) { // shorten original event event.setRight(gap.getLeft() - 1); // depends on control dependency: [if], data = [none] } // insert the real gap itEvents.add(gap); // depends on control dependency: [while], data = [none] int rightBorder = oldRight; if(itGaps.hasNext()) { // don't use the old event right border since the gap should only go until // the next event GridEvent nextGap = itGaps.next(); itGaps.previous(); // depends on control dependency: [if], data = [none] rightBorder = nextGap.getLeft()-1; // depends on control dependency: [if], data = [none] } // insert a new event node that covers the rest of the event GridEvent after = new GridEvent(event); after.setId(event.getId() + "_after_" + gapNr); // depends on control dependency: [while], data = [none] after.setLeft(gap.getRight() + 1); // depends on control dependency: [while], data = [none] after.setRight(rightBorder); // depends on control dependency: [while], data = [none] itEvents.add(after); // depends on control dependency: [while], data = [none] gapNr++; // depends on control dependency: [while], data = [none] } } } }
public class class_name { private void extractXPathValidateExpressions( Element validateElement, Map<String, Object> validateXpathExpressions) { //check for xpath validation - old style with direct attribute String pathExpression = validateElement.getAttribute("path"); if (StringUtils.hasText(pathExpression) && !JsonPathMessageValidationContext.isJsonPathExpression(pathExpression)) { //construct pathExpression with explicit result-type, like boolean:/TestMessage/Value if (validateElement.hasAttribute("result-type")) { pathExpression = validateElement.getAttribute("result-type") + ":" + pathExpression; } validateXpathExpressions.put(pathExpression, validateElement.getAttribute("value")); } //check for xpath validation elements - new style preferred List<?> xpathElements = DomUtils.getChildElementsByTagName(validateElement, "xpath"); if (xpathElements.size() > 0) { for (Iterator<?> xpathIterator = xpathElements.iterator(); xpathIterator.hasNext();) { Element xpathElement = (Element) xpathIterator.next(); String expression = xpathElement.getAttribute("expression"); if (StringUtils.hasText(expression)) { //construct expression with explicit result-type, like boolean:/TestMessage/Value if (xpathElement.hasAttribute("result-type")) { expression = xpathElement.getAttribute("result-type") + ":" + expression; } validateXpathExpressions.put(expression, xpathElement.getAttribute("value")); } } } } }
public class class_name { private void extractXPathValidateExpressions( Element validateElement, Map<String, Object> validateXpathExpressions) { //check for xpath validation - old style with direct attribute String pathExpression = validateElement.getAttribute("path"); if (StringUtils.hasText(pathExpression) && !JsonPathMessageValidationContext.isJsonPathExpression(pathExpression)) { //construct pathExpression with explicit result-type, like boolean:/TestMessage/Value if (validateElement.hasAttribute("result-type")) { pathExpression = validateElement.getAttribute("result-type") + ":" + pathExpression; // depends on control dependency: [if], data = [none] } validateXpathExpressions.put(pathExpression, validateElement.getAttribute("value")); // depends on control dependency: [if], data = [none] } //check for xpath validation elements - new style preferred List<?> xpathElements = DomUtils.getChildElementsByTagName(validateElement, "xpath"); if (xpathElements.size() > 0) { for (Iterator<?> xpathIterator = xpathElements.iterator(); xpathIterator.hasNext();) { Element xpathElement = (Element) xpathIterator.next(); String expression = xpathElement.getAttribute("expression"); if (StringUtils.hasText(expression)) { //construct expression with explicit result-type, like boolean:/TestMessage/Value if (xpathElement.hasAttribute("result-type")) { expression = xpathElement.getAttribute("result-type") + ":" + expression; // depends on control dependency: [if], data = [none] } validateXpathExpressions.put(expression, xpathElement.getAttribute("value")); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public void insertRule(final String rule, final int index) throws DOMException { try { final CSSOMParser parser = new CSSOMParser(); parser.setParentStyleSheet(this); parser.setErrorHandler(ThrowCssExceptionErrorHandler.INSTANCE); final AbstractCSSRuleImpl r = parser.parseRule(rule); if (r == null) { // this should neven happen because of the ThrowCssExceptionErrorHandler throw new DOMExceptionImpl( DOMException.SYNTAX_ERR, DOMExceptionImpl.SYNTAX_ERROR, "Parsing rule '" + rule + "' failed."); } if (getCssRules().getLength() > 0) { // We need to check that this type of rule can legally go into // the requested position. int msg = -1; if (r instanceof CSSCharsetRuleImpl) { // Index must be 0, and there can be only one charset rule if (index != 0) { msg = DOMExceptionImpl.CHARSET_NOT_FIRST; } else if (getCssRules().getRules().get(0) instanceof CSSCharsetRuleImpl) { msg = DOMExceptionImpl.CHARSET_NOT_UNIQUE; } } else if (r instanceof CSSImportRuleImpl) { // Import rules must preceed all other rules (except // charset rules) if (index <= getCssRules().getLength()) { for (int i = 0; i < index; i++) { final AbstractCSSRuleImpl ri = getCssRules().getRules().get(i); if (!(ri instanceof CSSCharsetRuleImpl) && !(ri instanceof CSSImportRuleImpl)) { msg = DOMExceptionImpl.IMPORT_NOT_FIRST; break; } } } } else { if (index <= getCssRules().getLength()) { for (int i = index; i < getCssRules().getLength(); i++) { final AbstractCSSRuleImpl ri = getCssRules().getRules().get(i); if ((ri instanceof CSSCharsetRuleImpl) || (ri instanceof CSSImportRuleImpl)) { msg = DOMExceptionImpl.INSERT_BEFORE_IMPORT; break; } } } } if (msg > -1) { throw new DOMExceptionImpl(DOMException.HIERARCHY_REQUEST_ERR, msg); } } // Insert the rule into the list of rules getCssRules().insert(r, index); } catch (final IndexOutOfBoundsException e) { throw new DOMExceptionImpl( DOMException.INDEX_SIZE_ERR, DOMExceptionImpl.INDEX_OUT_OF_BOUNDS, e.getMessage()); } catch (final CSSException e) { throw new DOMExceptionImpl( DOMException.SYNTAX_ERR, DOMExceptionImpl.SYNTAX_ERROR, e.getMessage()); } catch (final IOException e) { throw new DOMExceptionImpl( DOMException.SYNTAX_ERR, DOMExceptionImpl.SYNTAX_ERROR, e.getMessage()); } } }
public class class_name { public void insertRule(final String rule, final int index) throws DOMException { try { final CSSOMParser parser = new CSSOMParser(); parser.setParentStyleSheet(this); parser.setErrorHandler(ThrowCssExceptionErrorHandler.INSTANCE); final AbstractCSSRuleImpl r = parser.parseRule(rule); if (r == null) { // this should neven happen because of the ThrowCssExceptionErrorHandler throw new DOMExceptionImpl( DOMException.SYNTAX_ERR, DOMExceptionImpl.SYNTAX_ERROR, "Parsing rule '" + rule + "' failed."); } if (getCssRules().getLength() > 0) { // We need to check that this type of rule can legally go into // the requested position. int msg = -1; if (r instanceof CSSCharsetRuleImpl) { // Index must be 0, and there can be only one charset rule if (index != 0) { msg = DOMExceptionImpl.CHARSET_NOT_FIRST; // depends on control dependency: [if], data = [none] } else if (getCssRules().getRules().get(0) instanceof CSSCharsetRuleImpl) { msg = DOMExceptionImpl.CHARSET_NOT_UNIQUE; // depends on control dependency: [if], data = [none] } } else if (r instanceof CSSImportRuleImpl) { // Import rules must preceed all other rules (except // charset rules) if (index <= getCssRules().getLength()) { for (int i = 0; i < index; i++) { final AbstractCSSRuleImpl ri = getCssRules().getRules().get(i); if (!(ri instanceof CSSCharsetRuleImpl) && !(ri instanceof CSSImportRuleImpl)) { msg = DOMExceptionImpl.IMPORT_NOT_FIRST; // depends on control dependency: [if], data = [none] break; } } } } else { if (index <= getCssRules().getLength()) { for (int i = index; i < getCssRules().getLength(); i++) { final AbstractCSSRuleImpl ri = getCssRules().getRules().get(i); if ((ri instanceof CSSCharsetRuleImpl) || (ri instanceof CSSImportRuleImpl)) { msg = DOMExceptionImpl.INSERT_BEFORE_IMPORT; // depends on control dependency: [if], data = [none] break; } } } } if (msg > -1) { throw new DOMExceptionImpl(DOMException.HIERARCHY_REQUEST_ERR, msg); } } // Insert the rule into the list of rules getCssRules().insert(r, index); } catch (final IndexOutOfBoundsException e) { throw new DOMExceptionImpl( DOMException.INDEX_SIZE_ERR, DOMExceptionImpl.INDEX_OUT_OF_BOUNDS, e.getMessage()); } catch (final CSSException e) { throw new DOMExceptionImpl( DOMException.SYNTAX_ERR, DOMExceptionImpl.SYNTAX_ERROR, e.getMessage()); } catch (final IOException e) { throw new DOMExceptionImpl( DOMException.SYNTAX_ERR, DOMExceptionImpl.SYNTAX_ERROR, e.getMessage()); } } }
public class class_name { @Override public void changeTriggerState(String groupName, String jobName, final String triggerGroup, final String triggerName) throws SchedulerException { if (!config.isChangetTriggerStateAllowed()) { LOGGER.warn("not allowed to change any trigger state"); return; } Trigger triggerFound = findTrigger(groupName, jobName, triggerGroup, triggerName); if (null != triggerFound) { // pause only the one trigger of job changeTriggerState(triggerFound); if (LOGGER.isDebugEnabled()) LOGGER.debug(String.format("pausing trigger for group: %s, job: %s, trigger: %s ", groupName, jobName, triggerName)); } else { if (LOGGER.isDebugEnabled()) LOGGER.debug(String.format("pausing all triggers for group: %s, job: %s", groupName, jobName)); List<? extends Trigger> triggers = scheduler.getTriggersOfJob(new JobKey(jobName, groupName)); for (Trigger trigger : triggers) { // pause all triggers of job changeTriggerState(trigger); } } } }
public class class_name { @Override public void changeTriggerState(String groupName, String jobName, final String triggerGroup, final String triggerName) throws SchedulerException { if (!config.isChangetTriggerStateAllowed()) { LOGGER.warn("not allowed to change any trigger state"); return; } Trigger triggerFound = findTrigger(groupName, jobName, triggerGroup, triggerName); if (null != triggerFound) { // pause only the one trigger of job changeTriggerState(triggerFound); if (LOGGER.isDebugEnabled()) LOGGER.debug(String.format("pausing trigger for group: %s, job: %s, trigger: %s ", groupName, jobName, triggerName)); } else { if (LOGGER.isDebugEnabled()) LOGGER.debug(String.format("pausing all triggers for group: %s, job: %s", groupName, jobName)); List<? extends Trigger> triggers = scheduler.getTriggersOfJob(new JobKey(jobName, groupName)); for (Trigger trigger : triggers) { // pause all triggers of job changeTriggerState(trigger); // depends on control dependency: [for], data = [trigger] } } } }
public class class_name { static int getAndCheckPreLongs(final Memory mem) { final long cap = mem.getCapacity(); if (cap < 8) { throwNotBigEnough(cap, 8); } final int preLongs = mem.getByte(0) & 0x3F; final int required = Math.max(preLongs << 3, 8); if (cap < required) { throwNotBigEnough(cap, required); } return preLongs; } }
public class class_name { static int getAndCheckPreLongs(final Memory mem) { final long cap = mem.getCapacity(); if (cap < 8) { throwNotBigEnough(cap, 8); } // depends on control dependency: [if], data = [(cap] final int preLongs = mem.getByte(0) & 0x3F; final int required = Math.max(preLongs << 3, 8); if (cap < required) { throwNotBigEnough(cap, required); } // depends on control dependency: [if], data = [(cap] return preLongs; } }
public class class_name { public static PricingService getPricingService() { if (pricingService == null) { try { Class clazz = Class.forName(PRICING_SERVICE); pricingService = (PricingService) clazz.newInstance(); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { LOGGER.warn("Cannot instanciate util: {}", e.getMessage()); throw new IllegalStateException(e); } } return pricingService; } }
public class class_name { public static PricingService getPricingService() { if (pricingService == null) { try { Class clazz = Class.forName(PRICING_SERVICE); pricingService = (PricingService) clazz.newInstance(); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { LOGGER.warn("Cannot instanciate util: {}", e.getMessage()); throw new IllegalStateException(e); } // depends on control dependency: [catch], data = [none] } return pricingService; } }
public class class_name { public static String unresolvedHostToNormalizedString(String host) { // Return loopback interface address if host is null // This represents the behavior of {@code InetAddress.getByName } and RFC 3330 if (host == null) { host = InetAddress.getLoopbackAddress().getHostAddress(); } else { host = host.trim().toLowerCase(); } // normalize and valid address if (IPAddressUtil.isIPv6LiteralAddress(host)) { byte[] ipV6Address = IPAddressUtil.textToNumericFormatV6(host); host = getIPv6UrlRepresentation(ipV6Address); } else if (!IPAddressUtil.isIPv4LiteralAddress(host)) { try { // We don't allow these in hostnames Preconditions.checkArgument(!host.startsWith(".")); Preconditions.checkArgument(!host.endsWith(".")); Preconditions.checkArgument(!host.contains(":")); } catch (Exception e) { throw new IllegalConfigurationException("The configured hostname is not valid", e); } } return host; } }
public class class_name { public static String unresolvedHostToNormalizedString(String host) { // Return loopback interface address if host is null // This represents the behavior of {@code InetAddress.getByName } and RFC 3330 if (host == null) { host = InetAddress.getLoopbackAddress().getHostAddress(); // depends on control dependency: [if], data = [none] } else { host = host.trim().toLowerCase(); // depends on control dependency: [if], data = [none] } // normalize and valid address if (IPAddressUtil.isIPv6LiteralAddress(host)) { byte[] ipV6Address = IPAddressUtil.textToNumericFormatV6(host); host = getIPv6UrlRepresentation(ipV6Address); // depends on control dependency: [if], data = [none] } else if (!IPAddressUtil.isIPv4LiteralAddress(host)) { try { // We don't allow these in hostnames Preconditions.checkArgument(!host.startsWith(".")); // depends on control dependency: [try], data = [none] Preconditions.checkArgument(!host.endsWith(".")); // depends on control dependency: [try], data = [none] Preconditions.checkArgument(!host.contains(":")); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new IllegalConfigurationException("The configured hostname is not valid", e); } // depends on control dependency: [catch], data = [none] } return host; } }
public class class_name { public static StringPool readStringPool(ByteBuffer buffer, StringPoolHeader stringPoolHeader) { long beginPos = buffer.position(); int[] offsets = new int[stringPoolHeader.getStringCount()]; // read strings offset if (stringPoolHeader.getStringCount() > 0) { for (int idx = 0; idx < stringPoolHeader.getStringCount(); idx++) { offsets[idx] = Unsigned.toUInt(Buffers.readUInt(buffer)); } } // read flag // the string index is sorted by the string values if true boolean sorted = (stringPoolHeader.getFlags() & StringPoolHeader.SORTED_FLAG) != 0; // string use utf-8 format if true, otherwise utf-16 boolean utf8 = (stringPoolHeader.getFlags() & StringPoolHeader.UTF8_FLAG) != 0; // read strings. the head and metas have 28 bytes long stringPos = beginPos + stringPoolHeader.getStringsStart() - stringPoolHeader.getHeaderSize(); Buffers.position(buffer, stringPos); StringPoolEntry[] entries = new StringPoolEntry[offsets.length]; for (int i = 0; i < offsets.length; i++) { entries[i] = new StringPoolEntry(i, stringPos + Unsigned.toLong(offsets[i])); } String lastStr = null; long lastOffset = -1; StringPool stringPool = new StringPool(stringPoolHeader.getStringCount()); for (StringPoolEntry entry : entries) { if (entry.getOffset() == lastOffset) { stringPool.set(entry.getIdx(), lastStr); continue; } Buffers.position(buffer, entry.getOffset()); lastOffset = entry.getOffset(); String str = ParseUtils.readString(buffer, utf8); lastStr = str; stringPool.set(entry.getIdx(), str); } // read styles if (stringPoolHeader.getStyleCount() > 0) { // now we just skip it } Buffers.position(buffer, beginPos + stringPoolHeader.getBodySize()); return stringPool; } }
public class class_name { public static StringPool readStringPool(ByteBuffer buffer, StringPoolHeader stringPoolHeader) { long beginPos = buffer.position(); int[] offsets = new int[stringPoolHeader.getStringCount()]; // read strings offset if (stringPoolHeader.getStringCount() > 0) { for (int idx = 0; idx < stringPoolHeader.getStringCount(); idx++) { offsets[idx] = Unsigned.toUInt(Buffers.readUInt(buffer)); // depends on control dependency: [for], data = [idx] } } // read flag // the string index is sorted by the string values if true boolean sorted = (stringPoolHeader.getFlags() & StringPoolHeader.SORTED_FLAG) != 0; // string use utf-8 format if true, otherwise utf-16 boolean utf8 = (stringPoolHeader.getFlags() & StringPoolHeader.UTF8_FLAG) != 0; // read strings. the head and metas have 28 bytes long stringPos = beginPos + stringPoolHeader.getStringsStart() - stringPoolHeader.getHeaderSize(); Buffers.position(buffer, stringPos); StringPoolEntry[] entries = new StringPoolEntry[offsets.length]; for (int i = 0; i < offsets.length; i++) { entries[i] = new StringPoolEntry(i, stringPos + Unsigned.toLong(offsets[i])); // depends on control dependency: [for], data = [i] } String lastStr = null; long lastOffset = -1; StringPool stringPool = new StringPool(stringPoolHeader.getStringCount()); for (StringPoolEntry entry : entries) { if (entry.getOffset() == lastOffset) { stringPool.set(entry.getIdx(), lastStr); // depends on control dependency: [if], data = [none] continue; } Buffers.position(buffer, entry.getOffset()); // depends on control dependency: [for], data = [entry] lastOffset = entry.getOffset(); // depends on control dependency: [for], data = [entry] String str = ParseUtils.readString(buffer, utf8); lastStr = str; // depends on control dependency: [for], data = [none] stringPool.set(entry.getIdx(), str); // depends on control dependency: [for], data = [entry] } // read styles if (stringPoolHeader.getStyleCount() > 0) { // now we just skip it } Buffers.position(buffer, beginPos + stringPoolHeader.getBodySize()); return stringPool; } }
public class class_name { private void setRowAttribute(AttributeSet attributes, int r) { if (r >= rowAttributes.size()) { for (int i = rowAttributes.size(); i <= r; i++) { rowAttributes.add(null); } } rowAttributes.set(r, attributes); } }
public class class_name { private void setRowAttribute(AttributeSet attributes, int r) { if (r >= rowAttributes.size()) { for (int i = rowAttributes.size(); i <= r; i++) { rowAttributes.add(null); // depends on control dependency: [for], data = [none] } } rowAttributes.set(r, attributes); } }
public class class_name { @XmlTransient public static List<Role> convertToObjects(String roleListingParam) { if(roleListingParam == null || roleListingParam.trim().isEmpty()) { return null; } String[] listOfRoles = roleListingParam.split(UtilGlobal.REG_EX_COMMA); List<Role> returnVal = new ArrayList<>(); for(String roleName : listOfRoles) { Role roleToAdd = new Role(); roleToAdd.setName(roleName.trim()); returnVal.add(roleToAdd); } return returnVal; } }
public class class_name { @XmlTransient public static List<Role> convertToObjects(String roleListingParam) { if(roleListingParam == null || roleListingParam.trim().isEmpty()) { return null; // depends on control dependency: [if], data = [none] } String[] listOfRoles = roleListingParam.split(UtilGlobal.REG_EX_COMMA); List<Role> returnVal = new ArrayList<>(); for(String roleName : listOfRoles) { Role roleToAdd = new Role(); roleToAdd.setName(roleName.trim()); // depends on control dependency: [for], data = [roleName] returnVal.add(roleToAdd); // depends on control dependency: [for], data = [none] } return returnVal; } }
public class class_name { String scanForDriver(String url) { try { // already registered Driver driver; if ((driver = findRegisteredDriver(url)) != null) { return driver.getClass().getCanonicalName(); } scanDrivers(); if ((driver = findRegisteredDriver(url)) != null) { return driver.getClass().getCanonicalName(); } return null; } catch (Exception e) { e.printStackTrace(); debug(e.toString()); return null; } } }
public class class_name { String scanForDriver(String url) { try { // already registered Driver driver; if ((driver = findRegisteredDriver(url)) != null) { return driver.getClass().getCanonicalName(); // depends on control dependency: [if], data = [none] } scanDrivers(); // depends on control dependency: [try], data = [none] if ((driver = findRegisteredDriver(url)) != null) { return driver.getClass().getCanonicalName(); // depends on control dependency: [if], data = [none] } return null; // depends on control dependency: [try], data = [none] } catch (Exception e) { e.printStackTrace(); debug(e.toString()); return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public boolean isSet(String propName) { if (propName.equals("nickName")) { return isSetNickName(); } if (propName.equals("street")) { return isSetStreet(); } if (propName.equals("city")) { return isSetCity(); } if (propName.equals("stateOrProvinceName")) { return isSetStateOrProvinceName(); } if (propName.equals("postalCode")) { return isSetPostalCode(); } if (propName.equals("countryName")) { return isSetCountryName(); } return false; } }
public class class_name { public boolean isSet(String propName) { if (propName.equals("nickName")) { return isSetNickName(); // depends on control dependency: [if], data = [none] } if (propName.equals("street")) { return isSetStreet(); // depends on control dependency: [if], data = [none] } if (propName.equals("city")) { return isSetCity(); // depends on control dependency: [if], data = [none] } if (propName.equals("stateOrProvinceName")) { return isSetStateOrProvinceName(); // depends on control dependency: [if], data = [none] } if (propName.equals("postalCode")) { return isSetPostalCode(); // depends on control dependency: [if], data = [none] } if (propName.equals("countryName")) { return isSetCountryName(); // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { protected boolean excluded(String url) { for (final Pattern urlPattern : this.excludedUrls) { final Matcher matcher = urlPattern.matcher(url); if (matcher.matches()) { if (this.logger.isDebugEnabled()) { this.logger.debug("Exclude pattern " + urlPattern.pattern() + " matches " + url); } return true; } } return false; } }
public class class_name { protected boolean excluded(String url) { for (final Pattern urlPattern : this.excludedUrls) { final Matcher matcher = urlPattern.matcher(url); if (matcher.matches()) { if (this.logger.isDebugEnabled()) { this.logger.debug("Exclude pattern " + urlPattern.pattern() + " matches " + url); // depends on control dependency: [if], data = [none] } return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { public void add(double value, double weight) { writeLock.lock(); try { average.addDeg(value, weight); double fast = average.averageDeg(); stats.accept(fast); check(); } finally { writeLock.unlock(); } } }
public class class_name { public void add(double value, double weight) { writeLock.lock(); try { average.addDeg(value, weight); // depends on control dependency: [try], data = [none] double fast = average.averageDeg(); stats.accept(fast); // depends on control dependency: [try], data = [none] check(); // depends on control dependency: [try], data = [none] } finally { writeLock.unlock(); } } }
public class class_name { private boolean checkDeadLoop(Object value) { int n = 0; Object obj = value; while (obj != null) { Record rec = objRecordMap.get(obj); if (rec != null && rec.exp != null) { obj = rec.exp.getTarget(); } else { break; } if (obj != null && (obj.getClass().isAssignableFrom(value.getClass())) && obj.equals(value)) { n++; if (n >= DEADLOCK_THRESHOLD) { // System.out.println("Dead loop hit!"); return true; } } } return false; } }
public class class_name { private boolean checkDeadLoop(Object value) { int n = 0; Object obj = value; while (obj != null) { Record rec = objRecordMap.get(obj); if (rec != null && rec.exp != null) { obj = rec.exp.getTarget(); // depends on control dependency: [if], data = [none] } else { break; } if (obj != null && (obj.getClass().isAssignableFrom(value.getClass())) && obj.equals(value)) { n++; // depends on control dependency: [if], data = [none] if (n >= DEADLOCK_THRESHOLD) { // System.out.println("Dead loop hit!"); return true; // depends on control dependency: [if], data = [none] } } } return false; } }
public class class_name { @Nonnull private BallColor calculateBallColor() { if (owner instanceof TemplateDrivenMultiBranchProject && ((TemplateDrivenMultiBranchProject) owner).isDisabled()) { return BallColor.DISABLED; } BallColor c = BallColor.DISABLED; boolean animated = false; StringTokenizer tokens = new StringTokenizer(Util.fixNull(jobs), ","); while (tokens.hasMoreTokens()) { String jobName = tokens.nextToken().trim(); TopLevelItem item = owner.getItem(jobName); if (item != null && item instanceof Job) { BallColor d = ((Job) item).getIconColor(); animated |= d.isAnimated(); d = d.noAnime(); if (d.compareTo(c) < 0) { c = d; } } } if (animated) { c = c.anime(); } return c; } }
public class class_name { @Nonnull private BallColor calculateBallColor() { if (owner instanceof TemplateDrivenMultiBranchProject && ((TemplateDrivenMultiBranchProject) owner).isDisabled()) { return BallColor.DISABLED; // depends on control dependency: [if], data = [none] } BallColor c = BallColor.DISABLED; boolean animated = false; StringTokenizer tokens = new StringTokenizer(Util.fixNull(jobs), ","); while (tokens.hasMoreTokens()) { String jobName = tokens.nextToken().trim(); TopLevelItem item = owner.getItem(jobName); if (item != null && item instanceof Job) { BallColor d = ((Job) item).getIconColor(); animated |= d.isAnimated(); // depends on control dependency: [if], data = [none] d = d.noAnime(); // depends on control dependency: [if], data = [none] if (d.compareTo(c) < 0) { c = d; // depends on control dependency: [if], data = [none] } } } if (animated) { c = c.anime(); // depends on control dependency: [if], data = [none] } return c; } }
public class class_name { public Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>> listWorkerPoolInstanceMetricDefinitionsNextWithServiceResponseAsync(final String nextPageLink) { return listWorkerPoolInstanceMetricDefinitionsNextSinglePageAsync(nextPageLink) .concatMap(new Func1<ServiceResponse<Page<ResourceMetricDefinitionInner>>, Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>>>() { @Override public Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>> call(ServiceResponse<Page<ResourceMetricDefinitionInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listWorkerPoolInstanceMetricDefinitionsNextWithServiceResponseAsync(nextPageLink)); } }); } }
public class class_name { public Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>> listWorkerPoolInstanceMetricDefinitionsNextWithServiceResponseAsync(final String nextPageLink) { return listWorkerPoolInstanceMetricDefinitionsNextSinglePageAsync(nextPageLink) .concatMap(new Func1<ServiceResponse<Page<ResourceMetricDefinitionInner>>, Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>>>() { @Override public Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>> call(ServiceResponse<Page<ResourceMetricDefinitionInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); // depends on control dependency: [if], data = [none] } return Observable.just(page).concatWith(listWorkerPoolInstanceMetricDefinitionsNextWithServiceResponseAsync(nextPageLink)); } }); } }
public class class_name { public static Selector selectAs( final String propName, final String alias, final Function transform) { return new Selector( propName, alias ) { @Override public void handleRow( int index, Map<String, Object> row, Object item, Map<String, FieldAccess> fields ) { if (!path && fields!=null) { row.put( this.name, transform.apply(fields.get( this.name ).getValue( item )) ); } else { row.put( alias, transform.apply(BeanUtils.atIndex( item, propName )) ); } } @Override public void handleStart( Collection<?> results ) { } @Override public void handleComplete( List<Map<String, Object>> rows ) { } }; } }
public class class_name { public static Selector selectAs( final String propName, final String alias, final Function transform) { return new Selector( propName, alias ) { @Override public void handleRow( int index, Map<String, Object> row, Object item, Map<String, FieldAccess> fields ) { if (!path && fields!=null) { row.put( this.name, transform.apply(fields.get( this.name ).getValue( item )) ); // depends on control dependency: [if], data = [none] } else { row.put( alias, transform.apply(BeanUtils.atIndex( item, propName )) ); // depends on control dependency: [if], data = [none] } } @Override public void handleStart( Collection<?> results ) { } @Override public void handleComplete( List<Map<String, Object>> rows ) { } }; } }
public class class_name { public static void setModel(IRubyObject p, IRubyObject input, IRubyObject model) { Ruby runtime = p.getRuntime(); Parser parser = (Parser)p.dataGetStructChecked(); parser.handler(new RubyLoadHandler(runtime, ((YAMLExtra)runtime.getModule("YAML").dataGetStruct()))); if(model == runtime.newSymbol("Generic")) { p.callMethod(runtime.getCurrentContext(), "set_resolver", ((RubyModule)((RubyModule)runtime.getModule("YAML")).getConstant("Yecht")).getConstant("GenericResolver")); } parser.implicitTyping(true); parser.taguriExpansion(true); if(input.isNil()) { input = (IRubyObject)((RubyObject)p).fastGetInstanceVariable("@input"); } if(input == runtime.newSymbol("bytecode")) { parser.setInputType(ParserInput.Bytecode_UTF8); } else { parser.setInputType(ParserInput.YAML_UTF8); } parser.errorHandler(new RubyErrHandler(runtime)); parser.badAnchorHandler(new RubyBadAnchorHandler(runtime)); } }
public class class_name { public static void setModel(IRubyObject p, IRubyObject input, IRubyObject model) { Ruby runtime = p.getRuntime(); Parser parser = (Parser)p.dataGetStructChecked(); parser.handler(new RubyLoadHandler(runtime, ((YAMLExtra)runtime.getModule("YAML").dataGetStruct()))); if(model == runtime.newSymbol("Generic")) { p.callMethod(runtime.getCurrentContext(), "set_resolver", ((RubyModule)((RubyModule)runtime.getModule("YAML")).getConstant("Yecht")).getConstant("GenericResolver")); // depends on control dependency: [if], data = [none] } parser.implicitTyping(true); parser.taguriExpansion(true); if(input.isNil()) { input = (IRubyObject)((RubyObject)p).fastGetInstanceVariable("@input"); // depends on control dependency: [if], data = [none] } if(input == runtime.newSymbol("bytecode")) { parser.setInputType(ParserInput.Bytecode_UTF8); // depends on control dependency: [if], data = [none] } else { parser.setInputType(ParserInput.YAML_UTF8); // depends on control dependency: [if], data = [none] } parser.errorHandler(new RubyErrHandler(runtime)); parser.badAnchorHandler(new RubyBadAnchorHandler(runtime)); } }
public class class_name { public void setVal(String val) { if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(val)) { m_value = val.trim(); } else { m_value = val; } } }
public class class_name { public void setVal(String val) { if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(val)) { m_value = val.trim(); // depends on control dependency: [if], data = [none] } else { m_value = val; // depends on control dependency: [if], data = [none] } } }
public class class_name { private void waitForInstances(String flowletId, int expectedInstances) throws InterruptedException, TimeoutException { int numRunningFlowlets = getNumberOfProvisionedInstances(flowletId); int secondsWaited = 0; while (numRunningFlowlets != expectedInstances) { LOG.debug("waiting for {} instances of {} before suspending flowlets", expectedInstances, flowletId); TimeUnit.SECONDS.sleep(SECONDS_PER_WAIT); secondsWaited += SECONDS_PER_WAIT; if (secondsWaited > MAX_WAIT_SECONDS) { String errmsg = String.format("waited %d seconds for instances of %s to reach expected count of %d, but %d are running", secondsWaited, flowletId, expectedInstances, numRunningFlowlets); LOG.error(errmsg); throw new TimeoutException(errmsg); } numRunningFlowlets = getNumberOfProvisionedInstances(flowletId); } } }
public class class_name { private void waitForInstances(String flowletId, int expectedInstances) throws InterruptedException, TimeoutException { int numRunningFlowlets = getNumberOfProvisionedInstances(flowletId); int secondsWaited = 0; while (numRunningFlowlets != expectedInstances) { LOG.debug("waiting for {} instances of {} before suspending flowlets", expectedInstances, flowletId); TimeUnit.SECONDS.sleep(SECONDS_PER_WAIT); secondsWaited += SECONDS_PER_WAIT; if (secondsWaited > MAX_WAIT_SECONDS) { String errmsg = String.format("waited %d seconds for instances of %s to reach expected count of %d, but %d are running", secondsWaited, flowletId, expectedInstances, numRunningFlowlets); LOG.error(errmsg); // depends on control dependency: [if], data = [none] throw new TimeoutException(errmsg); } numRunningFlowlets = getNumberOfProvisionedInstances(flowletId); } } }
public class class_name { void initializeFromRectIsotropic(Envelope2D src, Envelope2D dest) { if (src.isEmpty() || dest.isEmpty() || 0 == src.getWidth() || 0 == src.getHeight()) setZero(); else { yx = 0; xy = 0; xx = dest.getWidth() / src.getWidth(); yy = dest.getHeight() / src.getHeight(); if (xx > yy) xx = yy; else yy = xx; Point2D destCenter = dest.getCenter(); Point2D srcCenter = src.getCenter(); xd = destCenter.x - srcCenter.x * xx; yd = destCenter.y - srcCenter.y * yy; } } }
public class class_name { void initializeFromRectIsotropic(Envelope2D src, Envelope2D dest) { if (src.isEmpty() || dest.isEmpty() || 0 == src.getWidth() || 0 == src.getHeight()) setZero(); else { yx = 0; // depends on control dependency: [if], data = [none] xy = 0; // depends on control dependency: [if], data = [none] xx = dest.getWidth() / src.getWidth(); // depends on control dependency: [if], data = [dest.] yy = dest.getHeight() / src.getHeight(); // depends on control dependency: [if], data = [dest.] if (xx > yy) xx = yy; else yy = xx; Point2D destCenter = dest.getCenter(); Point2D srcCenter = src.getCenter(); xd = destCenter.x - srcCenter.x * xx; // depends on control dependency: [if], data = [none] yd = destCenter.y - srcCenter.y * yy; // depends on control dependency: [if], data = [none] } } }
public class class_name { public StyleSet setBackgroundColor(IndexedColors backgroundColor, boolean withHeadCell) { if (withHeadCell) { StyleUtil.setColor(this.headCellStyle, backgroundColor, FillPatternType.SOLID_FOREGROUND); } StyleUtil.setColor(this.cellStyle, backgroundColor, FillPatternType.SOLID_FOREGROUND); StyleUtil.setColor(this.cellStyleForNumber, backgroundColor, FillPatternType.SOLID_FOREGROUND); StyleUtil.setColor(this.cellStyleForDate, backgroundColor, FillPatternType.SOLID_FOREGROUND); return this; } }
public class class_name { public StyleSet setBackgroundColor(IndexedColors backgroundColor, boolean withHeadCell) { if (withHeadCell) { StyleUtil.setColor(this.headCellStyle, backgroundColor, FillPatternType.SOLID_FOREGROUND); // depends on control dependency: [if], data = [none] } StyleUtil.setColor(this.cellStyle, backgroundColor, FillPatternType.SOLID_FOREGROUND); StyleUtil.setColor(this.cellStyleForNumber, backgroundColor, FillPatternType.SOLID_FOREGROUND); StyleUtil.setColor(this.cellStyleForDate, backgroundColor, FillPatternType.SOLID_FOREGROUND); return this; } }
public class class_name { public void addControls( final Model model ) { final URIBuilder pagedURL; try { pagedURL = new URIBuilder( fragmentURL ); } catch ( URISyntaxException e ) { throw new IllegalArgumentException( e ); } final Resource fragmentId = model.createResource( fragmentURL ); final Resource firstPageId = model.createResource( pagedURL.setParameter(ILinkedDataFragmentRequest.PARAMETERNAME_PAGE, "1").toString() ); fragmentId.addProperty( CommonResources.HYDRA_FIRSTPAGE, firstPageId ); if ( pageNumber > 1) { final String prevPageNumber = Long.toString( pageNumber - 1 ); final Resource prevPageId = model.createResource( pagedURL.setParameter(ILinkedDataFragmentRequest.PARAMETERNAME_PAGE, prevPageNumber).toString() ); fragmentId.addProperty( CommonResources.HYDRA_PREVIOUSPAGE, prevPageId ); } if ( ! isLastPage ) { final String nextPageNumber = Long.toString( pageNumber + 1 ); final Resource nextPageId = model.createResource( pagedURL.setParameter(ILinkedDataFragmentRequest.PARAMETERNAME_PAGE, nextPageNumber).toString() ); fragmentId.addProperty( CommonResources.HYDRA_NEXTPAGE, nextPageId ); } } }
public class class_name { public void addControls( final Model model ) { final URIBuilder pagedURL; try { pagedURL = new URIBuilder( fragmentURL ); // depends on control dependency: [try], data = [none] } catch ( URISyntaxException e ) { throw new IllegalArgumentException( e ); } // depends on control dependency: [catch], data = [none] final Resource fragmentId = model.createResource( fragmentURL ); final Resource firstPageId = model.createResource( pagedURL.setParameter(ILinkedDataFragmentRequest.PARAMETERNAME_PAGE, "1").toString() ); fragmentId.addProperty( CommonResources.HYDRA_FIRSTPAGE, firstPageId ); if ( pageNumber > 1) { final String prevPageNumber = Long.toString( pageNumber - 1 ); final Resource prevPageId = model.createResource( pagedURL.setParameter(ILinkedDataFragmentRequest.PARAMETERNAME_PAGE, prevPageNumber).toString() ); fragmentId.addProperty( CommonResources.HYDRA_PREVIOUSPAGE, prevPageId ); // depends on control dependency: [if], data = [none] } if ( ! isLastPage ) { final String nextPageNumber = Long.toString( pageNumber + 1 ); final Resource nextPageId = model.createResource( pagedURL.setParameter(ILinkedDataFragmentRequest.PARAMETERNAME_PAGE, nextPageNumber).toString() ); fragmentId.addProperty( CommonResources.HYDRA_NEXTPAGE, nextPageId ); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void introspectPathParams() throws DeploymentException { //Section 4.3 JSR 356 - The allowed types for the @PathParam parameters are String, any Java primitive type, or boxed version thereof. Class<?>[] pathParamTypesAllowed = { String.class, char.class, Character.class, byte.class, Byte.class, short.class, Short.class, int.class, Integer.class, long.class, Long.class, float.class, Float.class, double.class, Double.class, boolean.class, Boolean.class }; List<Class<?>> pathParamTypeList = Arrays.asList(pathParamTypesAllowed); Class<?>[] paramTypes = method.getParameterTypes(); Annotation[][] paramAnnotations = method.getParameterAnnotations(); boolean uriSegmentMatched = true; for (int i = 0; i < paramAnnotations.length; i++) { for (Annotation annotation : paramAnnotations[i]) { if (annotation.annotationType() == javax.websocket.server.PathParam.class) { if (pathParamTypeList.contains(paramTypes[i])) { String pathParamValue = ((PathParam) annotation).value(); if (pathParamValue != null && !(pathParamValue.isEmpty())) { //check if user has defined @PathParam variable on a method,but there is no corresponding matching path segment in endpoint path //for e.g user might have defined "@PathParam("Boolean-var") Boolean BooleanVar" on onOpen() and the server endpoint path //is /somePath/{Integer-var}/{Long-var} List<String> segments = Arrays.asList(endpointPath.split("/")); if (!(segments.contains("{" + pathParamValue + "}")) && !(segments.contains(pathParamValue))) { //error case: @PathParam does not match any path segment in the uri if (tc.isDebugEnabled()) { String msg = "@PathParam parameter " + pathParamValue + " defined on the method " + method.getName() + " does not have corresponding path segment in @ServerEndpoint URI in Annotated endpoint " + method.getDeclaringClass().getName(); Tr.debug(tc, msg); } //set the parameter to null. This is needed for String type of param. uriSegmentMatched = false; } //create PathParamData with annotation, the parameter index which has @PathParam declared, type of the parameter. PathParamData paramData = new PathParamDataImpl(pathParamValue, i, paramTypes[i], uriSegmentMatched); //use key for the hashmap as parameter index which has @PathParam declared, so that we can retrieve the correct PathParamData //during parameter value substitution methodData.getPathParams().put(Integer.valueOf(i), paramData); } else { //section 4.3 jsr 356. The value attribute of this annotation must be present otherwise the implementation must throw an error. [WSC-4.3-2] String msg = Tr.formatMessage(tc, "missing.pathparam.value", ((PathParam) annotation).value(), method.getName(), method.getDeclaringClass().getName()); Tr.error(tc, "missing.pathparam.value", ((PathParam) annotation).value(), method.getName(), method.getDeclaringClass().getName()); throw new DeploymentException(msg); } } else { //section 4.3 jsr 356. "The allowed types for the @PathParam parameters are String, any Java primitive type, or boxed version thereof. Any other type //annotated with this annotation is an error that the implementation must report at deployment time. [WSC-4.3-1]" String msg = Tr.formatMessage(tc, "invalid.pathparam.type", ((PathParam) annotation).value(), method.getName(), method.getDeclaringClass().getName()); Tr.error(tc, "invalid.pathparam.type", ((PathParam) annotation).value(), method.getName(), method.getDeclaringClass().getName()); throw new DeploymentException(msg); } } } } } }
public class class_name { public void introspectPathParams() throws DeploymentException { //Section 4.3 JSR 356 - The allowed types for the @PathParam parameters are String, any Java primitive type, or boxed version thereof. Class<?>[] pathParamTypesAllowed = { String.class, char.class, Character.class, byte.class, Byte.class, short.class, Short.class, int.class, Integer.class, long.class, Long.class, float.class, Float.class, double.class, Double.class, boolean.class, Boolean.class }; List<Class<?>> pathParamTypeList = Arrays.asList(pathParamTypesAllowed); Class<?>[] paramTypes = method.getParameterTypes(); Annotation[][] paramAnnotations = method.getParameterAnnotations(); boolean uriSegmentMatched = true; for (int i = 0; i < paramAnnotations.length; i++) { for (Annotation annotation : paramAnnotations[i]) { if (annotation.annotationType() == javax.websocket.server.PathParam.class) { if (pathParamTypeList.contains(paramTypes[i])) { String pathParamValue = ((PathParam) annotation).value(); if (pathParamValue != null && !(pathParamValue.isEmpty())) { //check if user has defined @PathParam variable on a method,but there is no corresponding matching path segment in endpoint path //for e.g user might have defined "@PathParam("Boolean-var") Boolean BooleanVar" on onOpen() and the server endpoint path //is /somePath/{Integer-var}/{Long-var} List<String> segments = Arrays.asList(endpointPath.split("/")); if (!(segments.contains("{" + pathParamValue + "}")) && !(segments.contains(pathParamValue))) { //error case: @PathParam does not match any path segment in the uri if (tc.isDebugEnabled()) { String msg = "@PathParam parameter " + pathParamValue + " defined on the method " + method.getName() + " does not have corresponding path segment in @ServerEndpoint URI in Annotated endpoint " + method.getDeclaringClass().getName(); // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] Tr.debug(tc, msg); // depends on control dependency: [if], data = [none] } //set the parameter to null. This is needed for String type of param. uriSegmentMatched = false; // depends on control dependency: [if], data = [none] } //create PathParamData with annotation, the parameter index which has @PathParam declared, type of the parameter. PathParamData paramData = new PathParamDataImpl(pathParamValue, i, paramTypes[i], uriSegmentMatched); //use key for the hashmap as parameter index which has @PathParam declared, so that we can retrieve the correct PathParamData //during parameter value substitution methodData.getPathParams().put(Integer.valueOf(i), paramData); // depends on control dependency: [if], data = [none] } else { //section 4.3 jsr 356. The value attribute of this annotation must be present otherwise the implementation must throw an error. [WSC-4.3-2] String msg = Tr.formatMessage(tc, "missing.pathparam.value", ((PathParam) annotation).value(), method.getName(), method.getDeclaringClass().getName()); Tr.error(tc, "missing.pathparam.value", ((PathParam) annotation).value(), method.getName(), method.getDeclaringClass().getName()); // depends on control dependency: [if], data = [none] throw new DeploymentException(msg); } } else { //section 4.3 jsr 356. "The allowed types for the @PathParam parameters are String, any Java primitive type, or boxed version thereof. Any other type //annotated with this annotation is an error that the implementation must report at deployment time. [WSC-4.3-1]" String msg = Tr.formatMessage(tc, "invalid.pathparam.type", ((PathParam) annotation).value(), method.getName(), method.getDeclaringClass().getName()); Tr.error(tc, "invalid.pathparam.type", ((PathParam) annotation).value(), method.getName(), method.getDeclaringClass().getName()); // depends on control dependency: [if], data = [none] throw new DeploymentException(msg); } } } } } }
public class class_name { @Override public String format(LogRecord record) { String msg = record.getMessage(); if(msg.length() > 0) { if (record instanceof ProgressLogRecord) { return msg; } if(msg.endsWith(OutputStreamLogger.NEWLINE)) { return msg; } } return msg + OutputStreamLogger.NEWLINE; } }
public class class_name { @Override public String format(LogRecord record) { String msg = record.getMessage(); if(msg.length() > 0) { if (record instanceof ProgressLogRecord) { return msg; // depends on control dependency: [if], data = [none] } if(msg.endsWith(OutputStreamLogger.NEWLINE)) { return msg; // depends on control dependency: [if], data = [none] } } return msg + OutputStreamLogger.NEWLINE; } }
public class class_name { static Matcher convertEmptyCharClassToFalse(Matcher matcher) { if (matcher instanceof CharClassMatcher) { return matcher.<CharClassMatcher>as().set().isEmpty() ? FalseMatcher.INSTANCE : matcher; } return matcher; } }
public class class_name { static Matcher convertEmptyCharClassToFalse(Matcher matcher) { if (matcher instanceof CharClassMatcher) { return matcher.<CharClassMatcher>as().set().isEmpty() ? FalseMatcher.INSTANCE : matcher; // depends on control dependency: [if], data = [none] } return matcher; } }
public class class_name { private List<Triplet<URI, URI, Object>> parseSpoUpdates(JsonElement jsonSpoEntries) { if (jsonSpoEntries == null || jsonSpoEntries.isJsonNull()) { return ImmutableList.of(); } ImmutableList.Builder<Triplet<URI, URI, Object>> result = ImmutableList.builder(); JsonObject request = jsonSpoEntries.getAsJsonObject(); JsonArray updates = request.getAsJsonArray("updates"); JsonObject update; URI subject; URI property; Object object = null; for (JsonElement updateEntry : updates) { update = updateEntry.getAsJsonObject(); if (update.has("subject") && update.has("property") && update.has("object")) { try { subject = new URI(update.get("subject").getAsString()); property = new URI(update.get("property").getAsString()); JsonPrimitive objectElmt = update.get("object").getAsJsonPrimitive(); if (objectElmt.isNumber()) { object = (Double) objectElmt.getAsDouble(); } else if (objectElmt.isString()) { // Try with a URL and fallback to String if it is not object = new URI(objectElmt.getAsString()); if (!((URI)object).isAbsolute()) { object = objectElmt.getAsString(); } } result.add(new Triplet(subject, property, object)); } catch (URISyntaxException e) { log.warn("Skipping entry..."); e.printStackTrace(); } } } // Build the result return result.build(); } }
public class class_name { private List<Triplet<URI, URI, Object>> parseSpoUpdates(JsonElement jsonSpoEntries) { if (jsonSpoEntries == null || jsonSpoEntries.isJsonNull()) { return ImmutableList.of(); // depends on control dependency: [if], data = [none] } ImmutableList.Builder<Triplet<URI, URI, Object>> result = ImmutableList.builder(); JsonObject request = jsonSpoEntries.getAsJsonObject(); JsonArray updates = request.getAsJsonArray("updates"); JsonObject update; URI subject; URI property; Object object = null; for (JsonElement updateEntry : updates) { update = updateEntry.getAsJsonObject(); // depends on control dependency: [for], data = [updateEntry] if (update.has("subject") && update.has("property") && update.has("object")) { try { subject = new URI(update.get("subject").getAsString()); // depends on control dependency: [try], data = [none] property = new URI(update.get("property").getAsString()); // depends on control dependency: [try], data = [none] JsonPrimitive objectElmt = update.get("object").getAsJsonPrimitive(); if (objectElmt.isNumber()) { object = (Double) objectElmt.getAsDouble(); // depends on control dependency: [if], data = [none] } else if (objectElmt.isString()) { // Try with a URL and fallback to String if it is not object = new URI(objectElmt.getAsString()); // depends on control dependency: [if], data = [none] if (!((URI)object).isAbsolute()) { object = objectElmt.getAsString(); // depends on control dependency: [if], data = [none] } } result.add(new Triplet(subject, property, object)); // depends on control dependency: [try], data = [none] } catch (URISyntaxException e) { log.warn("Skipping entry..."); e.printStackTrace(); } // depends on control dependency: [catch], data = [none] } } // Build the result return result.build(); } }
public class class_name { public static <T> List<List<T>> divideAsList(List<T> coll) { List<List<T>> result = new ArrayList<>(); for (T t : coll) { List<T> list = new ArrayList<>(); list.add(t); result.add(list); } return result; } }
public class class_name { public static <T> List<List<T>> divideAsList(List<T> coll) { List<List<T>> result = new ArrayList<>(); for (T t : coll) { List<T> list = new ArrayList<>(); list.add(t); // depends on control dependency: [for], data = [t] result.add(list); // depends on control dependency: [for], data = [t] } return result; } }
public class class_name { public static void runIntoJTPSync(final JRebirthRunnable runnable, final long... timeout) { final SyncRunnable sync = new SyncRunnable(runnable); if (JRebirth.isJTPSlot()) { // We are into a JTP slot so just run it synchronously sync.run(); // Be careful in this case no timeout protection is achieved } else { // The runnable will be run into the JTP slot during the next round JRebirthThread.getThread().runIntoJTP(sync); // Wait the end of the runnable execution sync.waitEnd(timeout); } } }
public class class_name { public static void runIntoJTPSync(final JRebirthRunnable runnable, final long... timeout) { final SyncRunnable sync = new SyncRunnable(runnable); if (JRebirth.isJTPSlot()) { // We are into a JTP slot so just run it synchronously sync.run(); // depends on control dependency: [if], data = [none] // Be careful in this case no timeout protection is achieved } else { // The runnable will be run into the JTP slot during the next round JRebirthThread.getThread().runIntoJTP(sync); // depends on control dependency: [if], data = [none] // Wait the end of the runnable execution sync.waitEnd(timeout); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected void parseColumnsAndConstraints( DdlTokenStream tokens, AstNode tableNode ) throws ParsingException { assert tokens != null; assert tableNode != null; if (!tokens.matches(L_PAREN)) { return; } String tableElementString = getTableElementsString(tokens, false); DdlTokenStream localTokens = new DdlTokenStream(tableElementString, DdlTokenStream.ddlTokenizer(false), false); localTokens.start(); StringBuilder unusedTokensSB = new StringBuilder(); do { if (isTableConstraint(localTokens)) { parseTableConstraint(localTokens, tableNode, false); } else if (isColumnDefinitionStart(localTokens)) { parseColumnDefinition(localTokens, tableNode, false); } else { unusedTokensSB.append(SPACE).append(localTokens.consume()); } } while (localTokens.canConsume(COMMA)); if (unusedTokensSB.length() > 0) { String msg = DdlSequencerI18n.unusedTokensParsingColumnsAndConstraints.text(tableNode.getName()); DdlParserProblem problem = new DdlParserProblem(DdlConstants.Problems.WARNING, Position.EMPTY_CONTENT_POSITION, msg); problem.setUnusedSource(unusedTokensSB.toString()); addProblem(problem, tableNode); } } }
public class class_name { protected void parseColumnsAndConstraints( DdlTokenStream tokens, AstNode tableNode ) throws ParsingException { assert tokens != null; assert tableNode != null; if (!tokens.matches(L_PAREN)) { return; } String tableElementString = getTableElementsString(tokens, false); DdlTokenStream localTokens = new DdlTokenStream(tableElementString, DdlTokenStream.ddlTokenizer(false), false); localTokens.start(); StringBuilder unusedTokensSB = new StringBuilder(); do { if (isTableConstraint(localTokens)) { parseTableConstraint(localTokens, tableNode, false); // depends on control dependency: [if], data = [none] } else if (isColumnDefinitionStart(localTokens)) { parseColumnDefinition(localTokens, tableNode, false); // depends on control dependency: [if], data = [none] } else { unusedTokensSB.append(SPACE).append(localTokens.consume()); // depends on control dependency: [if], data = [none] } } while (localTokens.canConsume(COMMA)); if (unusedTokensSB.length() > 0) { String msg = DdlSequencerI18n.unusedTokensParsingColumnsAndConstraints.text(tableNode.getName()); DdlParserProblem problem = new DdlParserProblem(DdlConstants.Problems.WARNING, Position.EMPTY_CONTENT_POSITION, msg); problem.setUnusedSource(unusedTokensSB.toString()); addProblem(problem, tableNode); } } }
public class class_name { @Override public void renderTile(Graphic g, MapTile map, Tile tile, int x, int y) { final int tx = tile.getInTileX(); final int ty = tile.getInTileY(); final Tile fogTile = mapFogged.getTile(tx, ty); if (fogMap && fogTile != null && fogTile.getNumber() != MapTileFog.NO_FOG) { fogTiles.setLocation(x, y); fogTiles.setTile(fogTile.getNumber()); fogTiles.render(g); } final Tile hideTile = mapHidden.getTile(tx, ty); if (hideMap && hideTile != null && hideTile.getNumber() != MapTileFog.NO_FOG) { hideTiles.setTile(hideTile.getNumber()); hideTiles.setLocation(x, y); hideTiles.render(g); } } }
public class class_name { @Override public void renderTile(Graphic g, MapTile map, Tile tile, int x, int y) { final int tx = tile.getInTileX(); final int ty = tile.getInTileY(); final Tile fogTile = mapFogged.getTile(tx, ty); if (fogMap && fogTile != null && fogTile.getNumber() != MapTileFog.NO_FOG) { fogTiles.setLocation(x, y); // depends on control dependency: [if], data = [none] fogTiles.setTile(fogTile.getNumber()); // depends on control dependency: [if], data = [none] fogTiles.render(g); // depends on control dependency: [if], data = [none] } final Tile hideTile = mapHidden.getTile(tx, ty); if (hideMap && hideTile != null && hideTile.getNumber() != MapTileFog.NO_FOG) { hideTiles.setTile(hideTile.getNumber()); // depends on control dependency: [if], data = [none] hideTiles.setLocation(x, y); // depends on control dependency: [if], data = [none] hideTiles.render(g); // depends on control dependency: [if], data = [none] } } }
public class class_name { public boolean isInvite() { if (message == null) { return false; } return (((Request) message).getMethod().equals(Request.INVITE)); } }
public class class_name { public boolean isInvite() { if (message == null) { return false; // depends on control dependency: [if], data = [none] } return (((Request) message).getMethod().equals(Request.INVITE)); } }
public class class_name { public Version getDetailedVersion(String version) { prepareDetailedVersions(); if (detailedVersions.containsKey(version)) { return detailedVersions.get(version); } return null; } }
public class class_name { public Version getDetailedVersion(String version) { prepareDetailedVersions(); if (detailedVersions.containsKey(version)) { return detailedVersions.get(version); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public ListProvisionedProductPlansResult withProvisionedProductPlans(ProvisionedProductPlanSummary... provisionedProductPlans) { if (this.provisionedProductPlans == null) { setProvisionedProductPlans(new java.util.ArrayList<ProvisionedProductPlanSummary>(provisionedProductPlans.length)); } for (ProvisionedProductPlanSummary ele : provisionedProductPlans) { this.provisionedProductPlans.add(ele); } return this; } }
public class class_name { public ListProvisionedProductPlansResult withProvisionedProductPlans(ProvisionedProductPlanSummary... provisionedProductPlans) { if (this.provisionedProductPlans == null) { setProvisionedProductPlans(new java.util.ArrayList<ProvisionedProductPlanSummary>(provisionedProductPlans.length)); // depends on control dependency: [if], data = [none] } for (ProvisionedProductPlanSummary ele : provisionedProductPlans) { this.provisionedProductPlans.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { private SslContext getSslContext() { final SslContext sslCtx; if (clientConfig.isEnableTls()) { try { SslContextBuilder clientSslCtxBuilder = SslContextBuilder.forClient(); if (Strings.isNullOrEmpty(clientConfig.getTrustStore())) { clientSslCtxBuilder = clientSslCtxBuilder.trustManager(FingerprintTrustManagerFactory .getInstance(FingerprintTrustManagerFactory.getDefaultAlgorithm())); log.debug("SslContextBuilder was set to an instance of {}", FingerprintTrustManagerFactory.class); } else { clientSslCtxBuilder = SslContextBuilder.forClient() .trustManager(new File(clientConfig.getTrustStore())); } sslCtx = clientSslCtxBuilder.build(); } catch (SSLException | NoSuchAlgorithmException e) { throw new RuntimeException(e); } } else { sslCtx = null; } return sslCtx; } }
public class class_name { private SslContext getSslContext() { final SslContext sslCtx; if (clientConfig.isEnableTls()) { try { SslContextBuilder clientSslCtxBuilder = SslContextBuilder.forClient(); if (Strings.isNullOrEmpty(clientConfig.getTrustStore())) { clientSslCtxBuilder = clientSslCtxBuilder.trustManager(FingerprintTrustManagerFactory .getInstance(FingerprintTrustManagerFactory.getDefaultAlgorithm())); // depends on control dependency: [if], data = [none] log.debug("SslContextBuilder was set to an instance of {}", FingerprintTrustManagerFactory.class); // depends on control dependency: [if], data = [none] } else { clientSslCtxBuilder = SslContextBuilder.forClient() .trustManager(new File(clientConfig.getTrustStore())); // depends on control dependency: [if], data = [none] } sslCtx = clientSslCtxBuilder.build(); // depends on control dependency: [try], data = [none] } catch (SSLException | NoSuchAlgorithmException e) { throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] } else { sslCtx = null; // depends on control dependency: [if], data = [none] } return sslCtx; } }
public class class_name { @Weight(value = Weight.Unit.VARIABLE, comment = "Depends on the current call stack depth") public static void checkPoints() { final long time = System.currentTimeMillis(); final int stackDepth = ThreadUtils.stackDepth(); final List<TimeData> list = REGISTRY.get(); final Iterator<TimeData> iterator = list.iterator(); while (iterator.hasNext()) { final TimeData timeWatchItem = iterator.next(); if (timeWatchItem.isTimePoint() && timeWatchItem.getDetectedStackDepth() >= stackDepth) { final long detectedDelay = time - timeWatchItem.getCreationTimeInMilliseconds(); try { timeWatchItem.getAlertListener().onTimeAlert(detectedDelay, timeWatchItem); } catch (Exception ex) { final UnexpectedProcessingError error = new UnexpectedProcessingError("Error during time point processing", ex); MetaErrorListeners.fireError(error.getMessage(), error); } finally { iterator.remove(); } } } } }
public class class_name { @Weight(value = Weight.Unit.VARIABLE, comment = "Depends on the current call stack depth") public static void checkPoints() { final long time = System.currentTimeMillis(); final int stackDepth = ThreadUtils.stackDepth(); final List<TimeData> list = REGISTRY.get(); final Iterator<TimeData> iterator = list.iterator(); while (iterator.hasNext()) { final TimeData timeWatchItem = iterator.next(); if (timeWatchItem.isTimePoint() && timeWatchItem.getDetectedStackDepth() >= stackDepth) { final long detectedDelay = time - timeWatchItem.getCreationTimeInMilliseconds(); try { timeWatchItem.getAlertListener().onTimeAlert(detectedDelay, timeWatchItem); // depends on control dependency: [try], data = [none] } catch (Exception ex) { final UnexpectedProcessingError error = new UnexpectedProcessingError("Error during time point processing", ex); MetaErrorListeners.fireError(error.getMessage(), error); } finally { // depends on control dependency: [catch], data = [none] iterator.remove(); } } } } }
public class class_name { public Type wildLowerBound(Type t) { if (t.hasTag(WILDCARD)) { WildcardType w = (WildcardType) t; return w.isExtendsBound() ? syms.botType : wildLowerBound(w.type); } else return t; } }
public class class_name { public Type wildLowerBound(Type t) { if (t.hasTag(WILDCARD)) { WildcardType w = (WildcardType) t; return w.isExtendsBound() ? syms.botType : wildLowerBound(w.type); // depends on control dependency: [if], data = [none] } else return t; } }
public class class_name { public void setAllowSelection(boolean allowSelection) { if (this.allowSelection == allowSelection) { return; } this.allowSelection = allowSelection; setCaretInternal(); firePropertyChange("allowSelection", !allowSelection, allowSelection); } }
public class class_name { public void setAllowSelection(boolean allowSelection) { if (this.allowSelection == allowSelection) { return; // depends on control dependency: [if], data = [none] } this.allowSelection = allowSelection; setCaretInternal(); firePropertyChange("allowSelection", !allowSelection, allowSelection); } }
public class class_name { public static void initialiseAcceptListenerFactory(AcceptListenerFactory _acceptListenerFactory) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "initialiseAcceptListenerFactory", _acceptListenerFactory); Class clientImpl = instance.getClass(); Method initialiseAcceptListenerFactoryMethod; try { initialiseAcceptListenerFactoryMethod = clientImpl.getMethod("initialiseAcceptListenerFactory", new Class[] { AcceptListenerFactory.class }); initialiseAcceptListenerFactoryMethod.invoke(clientImpl, new Object[] { _acceptListenerFactory }); } catch (Exception e) { FFDCFilter.processException(e, "com.ibm.ws.sib.jfapchannel.ServerConnectionManager.initialiseAcceptListenerFactory", JFapChannelConstants.SRVRCONNMGR_INITIALISE_ALF_01); //Make sure we allow for the fact this could be an InvocationTargetException Throwable displayedException = e; if (e instanceof InvocationTargetException) displayedException = e.getCause(); SibTr.error(tc, "EXCP_DURING_INIT_SICJ0081", new Object[] { clientImpl, displayedException }); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.exception(tc, e); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "initialiseAcceptListenerFactory"); } }
public class class_name { public static void initialiseAcceptListenerFactory(AcceptListenerFactory _acceptListenerFactory) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "initialiseAcceptListenerFactory", _acceptListenerFactory); Class clientImpl = instance.getClass(); Method initialiseAcceptListenerFactoryMethod; try { initialiseAcceptListenerFactoryMethod = clientImpl.getMethod("initialiseAcceptListenerFactory", new Class[] { AcceptListenerFactory.class }); // depends on control dependency: [try], data = [none] initialiseAcceptListenerFactoryMethod.invoke(clientImpl, new Object[] { _acceptListenerFactory }); // depends on control dependency: [try], data = [none] } catch (Exception e) { FFDCFilter.processException(e, "com.ibm.ws.sib.jfapchannel.ServerConnectionManager.initialiseAcceptListenerFactory", JFapChannelConstants.SRVRCONNMGR_INITIALISE_ALF_01); //Make sure we allow for the fact this could be an InvocationTargetException Throwable displayedException = e; if (e instanceof InvocationTargetException) displayedException = e.getCause(); SibTr.error(tc, "EXCP_DURING_INIT_SICJ0081", new Object[] { clientImpl, displayedException }); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.exception(tc, e); } // depends on control dependency: [catch], data = [none] if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "initialiseAcceptListenerFactory"); } }
public class class_name { public java.util.List<ParameterStringFilter> getParameterFilters() { if (parameterFilters == null) { parameterFilters = new com.amazonaws.internal.SdkInternalList<ParameterStringFilter>(); } return parameterFilters; } }
public class class_name { public java.util.List<ParameterStringFilter> getParameterFilters() { if (parameterFilters == null) { parameterFilters = new com.amazonaws.internal.SdkInternalList<ParameterStringFilter>(); // depends on control dependency: [if], data = [none] } return parameterFilters; } }
public class class_name { private final boolean checkRef(ComponentTag tag) { boolean ok = false; if (!tag.getName().equals("a")) { IValueMap attributes = tag.getAttributes(); String ref = attributes.getString("href"); if (ref == null) { ref = attributes.getString("src"); } if ((ref != null) && (isJawrImageTag(tag) || (ref.indexOf(":") == -1))) { ok = true; } } return ok; } }
public class class_name { private final boolean checkRef(ComponentTag tag) { boolean ok = false; if (!tag.getName().equals("a")) { IValueMap attributes = tag.getAttributes(); String ref = attributes.getString("href"); if (ref == null) { ref = attributes.getString("src"); // depends on control dependency: [if], data = [none] } if ((ref != null) && (isJawrImageTag(tag) || (ref.indexOf(":") == -1))) { ok = true; // depends on control dependency: [if], data = [none] } } return ok; } }
public class class_name { public String convert(Long theMoney, Long theKopeiki) { if (theMoney == null) { throw new IllegalArgumentException("theMoney is null"); } if (theKopeiki == null) { throw new IllegalArgumentException("theKopeiki is null"); } StringBuilder money2str = new StringBuilder(); Long triadNum = 0L; Long theTriad; Long intPart = theMoney; if (intPart == 0) { money2str.append(messages.get("0")[0] + " "); } do { theTriad = intPart % NUM1000; money2str.insert(0, triad2Word(theTriad, triadNum, rubSex)); if (triadNum == 0) { if ((theTriad % NUM100) / NUM10 == NUM1) { money2str.append(rubFiveUnit); } else { switch (Long.valueOf(theTriad % NUM10).byteValue()) { case NUM1: money2str.append(rubOneUnit); break; case NUM2: case NUM3: case NUM4: money2str.append(rubTwoUnit); break; default: money2str.append(rubFiveUnit); break; } } } intPart /= NUM1000; triadNum++; } while (intPart > 0); if (pennies == Pennies.TEXT) { money2str.append(language == Language.ENG ? " and " : " ").append( theKopeiki == 0 ? messages.get("0")[0] + " " : triad2Word(theKopeiki, 0L, kopSex)); } else { money2str.append(" " + (theKopeiki < 10 ? "0" + theKopeiki : theKopeiki) + " "); } if (theKopeiki >= NUM11 && theKopeiki <= NUM14) { money2str.append(kopFiveUnit); } else { switch ((byte) (theKopeiki % NUM10)) { case NUM1: money2str.append(kopOneUnit); break; case NUM2: case NUM3: case NUM4: money2str.append(kopTwoUnit); break; default: money2str.append(kopFiveUnit); break; } } return money2str.toString().trim(); } }
public class class_name { public String convert(Long theMoney, Long theKopeiki) { if (theMoney == null) { throw new IllegalArgumentException("theMoney is null"); } if (theKopeiki == null) { throw new IllegalArgumentException("theKopeiki is null"); } StringBuilder money2str = new StringBuilder(); Long triadNum = 0L; Long theTriad; Long intPart = theMoney; if (intPart == 0) { money2str.append(messages.get("0")[0] + " "); // depends on control dependency: [if], data = [none] } do { theTriad = intPart % NUM1000; money2str.insert(0, triad2Word(theTriad, triadNum, rubSex)); if (triadNum == 0) { if ((theTriad % NUM100) / NUM10 == NUM1) { money2str.append(rubFiveUnit); // depends on control dependency: [if], data = [none] } else { switch (Long.valueOf(theTriad % NUM10).byteValue()) { case NUM1: money2str.append(rubOneUnit); break; case NUM2: case NUM3: case NUM4: money2str.append(rubTwoUnit); break; default: money2str.append(rubFiveUnit); break; } } } intPart /= NUM1000; triadNum++; } while (intPart > 0); if (pennies == Pennies.TEXT) { money2str.append(language == Language.ENG ? " and " : " ").append( theKopeiki == 0 ? messages.get("0")[0] + " " : triad2Word(theKopeiki, 0L, kopSex)); // depends on control dependency: [if], data = [none] } else { money2str.append(" " + (theKopeiki < 10 ? "0" + theKopeiki : theKopeiki) + " "); // depends on control dependency: [if], data = [none] } if (theKopeiki >= NUM11 && theKopeiki <= NUM14) { money2str.append(kopFiveUnit); // depends on control dependency: [if], data = [none] } else { switch ((byte) (theKopeiki % NUM10)) { case NUM1: money2str.append(kopOneUnit); break; case NUM2: case NUM3: case NUM4: money2str.append(kopTwoUnit); break; default: money2str.append(kopFiveUnit); break; } } return money2str.toString().trim(); } }