code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { private MutateRowsRequest createRetryRequest(List<Integer> indiciesToRetry) { MutateRowsRequest.Builder updatedRequest = MutateRowsRequest.newBuilder() .setTableName(originalRequest.getTableName()); mapToOriginalIndex = new int[indiciesToRetry.size()]; for (int i = 0; i < indiciesToRetry.size(); i++) { mapToOriginalIndex[i] = indiciesToRetry.get(i); updatedRequest.addEntries(originalRequest.getEntries(indiciesToRetry.get(i))); } return updatedRequest.build(); } }
public class class_name { private MutateRowsRequest createRetryRequest(List<Integer> indiciesToRetry) { MutateRowsRequest.Builder updatedRequest = MutateRowsRequest.newBuilder() .setTableName(originalRequest.getTableName()); mapToOriginalIndex = new int[indiciesToRetry.size()]; for (int i = 0; i < indiciesToRetry.size(); i++) { mapToOriginalIndex[i] = indiciesToRetry.get(i); // depends on control dependency: [for], data = [i] updatedRequest.addEntries(originalRequest.getEntries(indiciesToRetry.get(i))); // depends on control dependency: [for], data = [i] } return updatedRequest.build(); } }
public class class_name { @Override public boolean cancel(boolean mayInterruptIfRunning) { if (m_isDone == true) { return false; } m_isDone = true; if (m_pendingException != null) { return false; } m_cancelResult = m_schedFuture.cancel(false); if ((m_cancelResult != true) || (m_defaultFuture != null)) { // Push the cancel call to the Default Executor Future if it has progressed that far. try { this.m_coordinationLatch.await(); } catch (InterruptedException ie) { // Try to proceed. } if (m_defaultFuture != null) { m_cancelResult = m_defaultFuture.cancel(mayInterruptIfRunning); } } if (m_cancelResult == true) { m_pendingException = new CancellationException(); m_scheduledExecutorQueue.remove(this); } // Let get() finish this.m_coordinationLatch.countDown(); return m_cancelResult; } }
public class class_name { @Override public boolean cancel(boolean mayInterruptIfRunning) { if (m_isDone == true) { return false; // depends on control dependency: [if], data = [none] } m_isDone = true; if (m_pendingException != null) { return false; // depends on control dependency: [if], data = [none] } m_cancelResult = m_schedFuture.cancel(false); if ((m_cancelResult != true) || (m_defaultFuture != null)) { // Push the cancel call to the Default Executor Future if it has progressed that far. try { this.m_coordinationLatch.await(); // depends on control dependency: [try], data = [none] } catch (InterruptedException ie) { // Try to proceed. } // depends on control dependency: [catch], data = [none] if (m_defaultFuture != null) { m_cancelResult = m_defaultFuture.cancel(mayInterruptIfRunning); // depends on control dependency: [if], data = [none] } } if (m_cancelResult == true) { m_pendingException = new CancellationException(); // depends on control dependency: [if], data = [none] m_scheduledExecutorQueue.remove(this); // depends on control dependency: [if], data = [none] } // Let get() finish this.m_coordinationLatch.countDown(); return m_cancelResult; } }
public class class_name { public void setRecordColumnUpdates(java.util.Collection<RecordColumn> recordColumnUpdates) { if (recordColumnUpdates == null) { this.recordColumnUpdates = null; return; } this.recordColumnUpdates = new java.util.ArrayList<RecordColumn>(recordColumnUpdates); } }
public class class_name { public void setRecordColumnUpdates(java.util.Collection<RecordColumn> recordColumnUpdates) { if (recordColumnUpdates == null) { this.recordColumnUpdates = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.recordColumnUpdates = new java.util.ArrayList<RecordColumn>(recordColumnUpdates); } }
public class class_name { private void addToUsedVariables(final java.util.List<VariableAndValue> usedVariables, final MethodAndParameter top, final Variable variable) { VariableAndValue variableAndValue = new VariableAndValue(variable, top.getParameter()); if (!usedVariables.contains(variableAndValue)) { usedVariables.add(variableAndValue); } else { int i = 0; do { i++; variableAndValue = new VariableAndValue( new Variable( elementUtils.getName(variable.getName().toString() + i), variable.getType() ), top.getParameter() ); } while (usedVariables.contains(variableAndValue)); usedVariables.add(variableAndValue); } } }
public class class_name { private void addToUsedVariables(final java.util.List<VariableAndValue> usedVariables, final MethodAndParameter top, final Variable variable) { VariableAndValue variableAndValue = new VariableAndValue(variable, top.getParameter()); if (!usedVariables.contains(variableAndValue)) { usedVariables.add(variableAndValue); // depends on control dependency: [if], data = [none] } else { int i = 0; do { i++; variableAndValue = new VariableAndValue( new Variable( elementUtils.getName(variable.getName().toString() + i), variable.getType() ), top.getParameter() ); } while (usedVariables.contains(variableAndValue)); usedVariables.add(variableAndValue); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void addItem(String text, T value, OptGroup optGroup) { if (!values.contains(value)) { values.add(value); optGroup.add(buildOption(text, value)); } } }
public class class_name { public void addItem(String text, T value, OptGroup optGroup) { if (!values.contains(value)) { values.add(value); // depends on control dependency: [if], data = [none] optGroup.add(buildOption(text, value)); // depends on control dependency: [if], data = [none] } } }
public class class_name { public ArrayList<Permission> getEffectivePermissions(List<Permission> permissions, String codeBase) { ArrayList<Permission> effectivePermissions = new ArrayList<Permission>(); // Add the granted permissions to an arraylist effectivePermissions.addAll(grantedPermissions); // Add the codebase specific permissions codeBase = normalize(codeBase); if (codeBasePermissionMap.containsKey(codeBase)) { effectivePermissions.addAll(codeBasePermissionMap.get(codeBase)); } // Add permissions.xml permissions if (permissionXMLPermissionMap.containsKey(codeBase)) { effectivePermissions.addAll(permissionXMLPermissionMap.get(codeBase)); } // Iterate over the permissions and only add those that are not restricted for (Permission permission : permissions) { if (!isRestricted(permission)) { effectivePermissions.add(permission); } } return effectivePermissions; } }
public class class_name { public ArrayList<Permission> getEffectivePermissions(List<Permission> permissions, String codeBase) { ArrayList<Permission> effectivePermissions = new ArrayList<Permission>(); // Add the granted permissions to an arraylist effectivePermissions.addAll(grantedPermissions); // Add the codebase specific permissions codeBase = normalize(codeBase); if (codeBasePermissionMap.containsKey(codeBase)) { effectivePermissions.addAll(codeBasePermissionMap.get(codeBase)); // depends on control dependency: [if], data = [none] } // Add permissions.xml permissions if (permissionXMLPermissionMap.containsKey(codeBase)) { effectivePermissions.addAll(permissionXMLPermissionMap.get(codeBase)); // depends on control dependency: [if], data = [none] } // Iterate over the permissions and only add those that are not restricted for (Permission permission : permissions) { if (!isRestricted(permission)) { effectivePermissions.add(permission); // depends on control dependency: [if], data = [none] } } return effectivePermissions; } }
public class class_name { public static CodeAnalysisResult countingCode(File file, CodeAnalysisConf conf) { if (!Files.isFile(file)) { throw new RuntimeException("file is not a File, can't analysis it."); } if (null == conf) { conf = CODE_INFO_JAVA; } BufferedReader br; try { br = new BufferedReader(new FileReader(file)); } catch (FileNotFoundException e) { throw Lang.wrapThrow(e); } boolean comment = false; long whiteLines = 0; long commentLines = 0; long normalLines = 0; long importLines = 0; String line = ""; try { while ((line = br.readLine()) != null) { line = line.trim(); if (line.startsWith(conf.multiLineCommentStart) && !line.endsWith(conf.multiLineCommentEnd)) { // 多行注释开始 commentLines++; comment = true; } else if (true == comment) { // 多行注释结束 commentLines++; if (line.endsWith(conf.multiLineCommentEnd)) { comment = false; } } else if (Regex.match(conf.emptyLinePattern, line)) { // 空白行(多行注解内的空白行不算在内) whiteLines++; } else if (line.startsWith(conf.singleLineCommentStart) || (line.startsWith(conf.multiLineCommentStart) && line.endsWith(conf.multiLineCommentEnd))) { // 单行注释 commentLines++; } else if (line.startsWith(conf.pakStart) || line.startsWith(conf.impStart)) { // package与import importLines++; } else { // 代码行 normalLines++; } } } catch (IOException e) { throw Lang.wrapThrow(e); } if (br != null) { try { br.close(); } catch (IOException e) { throw Lang.wrapThrow(e); } } // 记录并返回统计结果 return new CodeAnalysisResult(normalLines, commentLines, whiteLines, importLines); } }
public class class_name { public static CodeAnalysisResult countingCode(File file, CodeAnalysisConf conf) { if (!Files.isFile(file)) { throw new RuntimeException("file is not a File, can't analysis it."); } if (null == conf) { conf = CODE_INFO_JAVA; // depends on control dependency: [if], data = [none] } BufferedReader br; try { br = new BufferedReader(new FileReader(file)); // depends on control dependency: [try], data = [none] } catch (FileNotFoundException e) { throw Lang.wrapThrow(e); } // depends on control dependency: [catch], data = [none] boolean comment = false; long whiteLines = 0; long commentLines = 0; long normalLines = 0; long importLines = 0; String line = ""; try { while ((line = br.readLine()) != null) { line = line.trim(); // depends on control dependency: [while], data = [none] if (line.startsWith(conf.multiLineCommentStart) && !line.endsWith(conf.multiLineCommentEnd)) { // 多行注释开始 commentLines++; // depends on control dependency: [if], data = [none] comment = true; // depends on control dependency: [if], data = [none] } else if (true == comment) { // 多行注释结束 commentLines++; // depends on control dependency: [if], data = [none] if (line.endsWith(conf.multiLineCommentEnd)) { comment = false; // depends on control dependency: [if], data = [none] } } else if (Regex.match(conf.emptyLinePattern, line)) { // 空白行(多行注解内的空白行不算在内) whiteLines++; // depends on control dependency: [if], data = [none] } else if (line.startsWith(conf.singleLineCommentStart) || (line.startsWith(conf.multiLineCommentStart) && line.endsWith(conf.multiLineCommentEnd))) { // 单行注释 commentLines++; // depends on control dependency: [if], data = [none] } else if (line.startsWith(conf.pakStart) || line.startsWith(conf.impStart)) { // package与import importLines++; // depends on control dependency: [if], data = [none] } else { // 代码行 normalLines++; // depends on control dependency: [if], data = [none] } } } catch (IOException e) { throw Lang.wrapThrow(e); } // depends on control dependency: [catch], data = [none] if (br != null) { try { br.close(); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw Lang.wrapThrow(e); } // depends on control dependency: [catch], data = [none] } // 记录并返回统计结果 return new CodeAnalysisResult(normalLines, commentLines, whiteLines, importLines); } }
public class class_name { @Override public EClass getIfcTankType() { if (ifcTankTypeEClass == null) { ifcTankTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers() .get(699); } return ifcTankTypeEClass; } }
public class class_name { @Override public EClass getIfcTankType() { if (ifcTankTypeEClass == null) { ifcTankTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers() .get(699); // depends on control dependency: [if], data = [none] } return ifcTankTypeEClass; } }
public class class_name { @NotNull public OptionalLong findFirst() { if (iterator.hasNext()) { return OptionalLong.of(iterator.nextLong()); } return OptionalLong.empty(); } }
public class class_name { @NotNull public OptionalLong findFirst() { if (iterator.hasNext()) { return OptionalLong.of(iterator.nextLong()); // depends on control dependency: [if], data = [none] } return OptionalLong.empty(); } }
public class class_name { @Override public void startElement(String namespaceURI, String lName, String qName, Attributes attrs) throws SAXException { if (qName.equals(RULE)) { translations.clear(); id = attrs.getValue("id"); if (!(inRuleGroup && defaultOff)) { defaultOff = "off".equals(attrs.getValue("default")); } if (inRuleGroup && id == null) { id = ruleGroupId; } correctExamples = new ArrayList<>(); incorrectExamples = new ArrayList<>(); } else if (qName.equals(PATTERN)) { inPattern = true; String languageStr = attrs.getValue("lang"); if (Languages.isLanguageSupported(languageStr)) { language = Languages.getLanguageForShortCode(languageStr); } } else if (qName.equals(TOKEN)) { setToken(attrs); } else if (qName.equals(TRANSLATION)) { inTranslation = true; String languageStr = attrs.getValue("lang"); if (Languages.isLanguageSupported(languageStr)) { Language tmpLang = Languages.getLanguageForShortCode(languageStr); currentTranslationLanguage = tmpLang; if (tmpLang.equalsConsiderVariantsIfSpecified(motherTongue)) { translationLanguage = tmpLang; } } } else if (qName.equals(EXAMPLE)) { correctExample = new StringBuilder(); incorrectExample = new StringBuilder(); if (attrs.getValue(TYPE).equals("incorrect")) { inIncorrectExample = true; } else if (attrs.getValue(TYPE).equals("correct")) { inCorrectExample = true; } else if (attrs.getValue(TYPE).equals("triggers_error")) { throw new RuntimeException("'triggers_error' is not supported for false friend XML"); } } else if (qName.equals(MESSAGE)) { inMessage = true; message = new StringBuilder(); } else if (qName.equals(RULEGROUP)) { ruleGroupId = attrs.getValue("id"); inRuleGroup = true; defaultOff = "off".equals(attrs.getValue(DEFAULT)); } } }
public class class_name { @Override public void startElement(String namespaceURI, String lName, String qName, Attributes attrs) throws SAXException { if (qName.equals(RULE)) { translations.clear(); id = attrs.getValue("id"); if (!(inRuleGroup && defaultOff)) { defaultOff = "off".equals(attrs.getValue("default")); // depends on control dependency: [if], data = [none] } if (inRuleGroup && id == null) { id = ruleGroupId; // depends on control dependency: [if], data = [none] } correctExamples = new ArrayList<>(); incorrectExamples = new ArrayList<>(); } else if (qName.equals(PATTERN)) { inPattern = true; String languageStr = attrs.getValue("lang"); if (Languages.isLanguageSupported(languageStr)) { language = Languages.getLanguageForShortCode(languageStr); // depends on control dependency: [if], data = [none] } } else if (qName.equals(TOKEN)) { setToken(attrs); } else if (qName.equals(TRANSLATION)) { inTranslation = true; String languageStr = attrs.getValue("lang"); if (Languages.isLanguageSupported(languageStr)) { Language tmpLang = Languages.getLanguageForShortCode(languageStr); currentTranslationLanguage = tmpLang; // depends on control dependency: [if], data = [none] if (tmpLang.equalsConsiderVariantsIfSpecified(motherTongue)) { translationLanguage = tmpLang; // depends on control dependency: [if], data = [none] } } } else if (qName.equals(EXAMPLE)) { correctExample = new StringBuilder(); incorrectExample = new StringBuilder(); if (attrs.getValue(TYPE).equals("incorrect")) { inIncorrectExample = true; // depends on control dependency: [if], data = [none] } else if (attrs.getValue(TYPE).equals("correct")) { inCorrectExample = true; // depends on control dependency: [if], data = [none] } else if (attrs.getValue(TYPE).equals("triggers_error")) { throw new RuntimeException("'triggers_error' is not supported for false friend XML"); } } else if (qName.equals(MESSAGE)) { inMessage = true; message = new StringBuilder(); } else if (qName.equals(RULEGROUP)) { ruleGroupId = attrs.getValue("id"); inRuleGroup = true; defaultOff = "off".equals(attrs.getValue(DEFAULT)); } } }
public class class_name { private static HttpRequestBase addParamsGet(AsyncRequest asyncRequest) { HttpGet get = new HttpGet(asyncRequest.getUrl()); Parameters parameter = asyncRequest.getParameter(); if (parameter != null && parameter.getNameValuePair() != null) { try { get.setURI(new URIBuilder(get.getURI()).addParameters(parameter.getNameValuePair()).build()); } catch (URISyntaxException e) { e.printStackTrace(); } } Headers header = asyncRequest.getHeader(); if (header != null) { get.setHeaders(header.toHeaderArray()); } return get; } }
public class class_name { private static HttpRequestBase addParamsGet(AsyncRequest asyncRequest) { HttpGet get = new HttpGet(asyncRequest.getUrl()); Parameters parameter = asyncRequest.getParameter(); if (parameter != null && parameter.getNameValuePair() != null) { try { get.setURI(new URIBuilder(get.getURI()).addParameters(parameter.getNameValuePair()).build()); // depends on control dependency: [try], data = [none] } catch (URISyntaxException e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none] } Headers header = asyncRequest.getHeader(); if (header != null) { get.setHeaders(header.toHeaderArray()); // depends on control dependency: [if], data = [(header] } return get; } }
public class class_name { private ScheduledPair scheduleOneTask(long nodeWait, long rackWait) { if (!nodeManager.existRunnableNodes(type)) { return null; } Queue<PoolGroupSchedulable> poolGroupQueue = poolGroupManager.getScheduleQueue(); while (!poolGroupQueue.isEmpty()) { PoolGroupSchedulable poolGroup = poolGroupQueue.poll(); if (poolGroup.reachedMaximum()) { continue; } // Get the appropriate pool from the pool group to schedule, then // schedule the best session Queue<PoolSchedulable> poolQueue = poolGroup.getScheduleQueue(); while (!poolQueue.isEmpty()) { PoolSchedulable pool = poolQueue.poll(); if (pool.reachedMaximum()) { continue; } Queue<SessionSchedulable> sessionQueue = pool.getScheduleQueue(); while (!sessionQueue.isEmpty()) { SessionSchedulable schedulable = sessionQueue.poll(); Session session = schedulable.getSession(); long now = ClusterManager.clock.getTime(); MatchedPair pair = doMatch( schedulable, now, nodeWait, rackWait); synchronized (session) { if (session.isDeleted()) { continue; } if (pair != null) { ResourceGrant grant = commitMatchedResource(session, pair); if (grant != null) { poolGroup.incGranted(1); pool.incGranted(1); schedulable.incGranted(1); // Put back to the queue only if we scheduled successfully poolGroupQueue.add(poolGroup); poolQueue.add(pool); sessionQueue.add(schedulable); return new ScheduledPair( session.getSessionId().toString(), grant); } } } } } } return null; } }
public class class_name { private ScheduledPair scheduleOneTask(long nodeWait, long rackWait) { if (!nodeManager.existRunnableNodes(type)) { return null; // depends on control dependency: [if], data = [none] } Queue<PoolGroupSchedulable> poolGroupQueue = poolGroupManager.getScheduleQueue(); while (!poolGroupQueue.isEmpty()) { PoolGroupSchedulable poolGroup = poolGroupQueue.poll(); if (poolGroup.reachedMaximum()) { continue; } // Get the appropriate pool from the pool group to schedule, then // schedule the best session Queue<PoolSchedulable> poolQueue = poolGroup.getScheduleQueue(); while (!poolQueue.isEmpty()) { PoolSchedulable pool = poolQueue.poll(); if (pool.reachedMaximum()) { continue; } Queue<SessionSchedulable> sessionQueue = pool.getScheduleQueue(); while (!sessionQueue.isEmpty()) { SessionSchedulable schedulable = sessionQueue.poll(); Session session = schedulable.getSession(); long now = ClusterManager.clock.getTime(); MatchedPair pair = doMatch( schedulable, now, nodeWait, rackWait); synchronized (session) { // depends on control dependency: [while], data = [none] if (session.isDeleted()) { continue; } if (pair != null) { ResourceGrant grant = commitMatchedResource(session, pair); if (grant != null) { poolGroup.incGranted(1); // depends on control dependency: [if], data = [none] pool.incGranted(1); // depends on control dependency: [if], data = [none] schedulable.incGranted(1); // depends on control dependency: [if], data = [none] // Put back to the queue only if we scheduled successfully poolGroupQueue.add(poolGroup); // depends on control dependency: [if], data = [none] poolQueue.add(pool); // depends on control dependency: [if], data = [none] sessionQueue.add(schedulable); // depends on control dependency: [if], data = [none] return new ScheduledPair( session.getSessionId().toString(), grant); // depends on control dependency: [if], data = [none] } } } } } } return null; } }
public class class_name { public Summary toSummary(String query) { List<Term> parse = NlpAnalysis.parse(query).getTerms(); List<Keyword> keywords = new ArrayList<>(); for (Term term : parse) { if (FILTER_SET.contains(term.natrue().natureStr)) { continue; } keywords.add(new Keyword(term.getName(), term.termNatures().allFreq, 1)); } return toSummary(keywords); } }
public class class_name { public Summary toSummary(String query) { List<Term> parse = NlpAnalysis.parse(query).getTerms(); List<Keyword> keywords = new ArrayList<>(); for (Term term : parse) { if (FILTER_SET.contains(term.natrue().natureStr)) { continue; } keywords.add(new Keyword(term.getName(), term.termNatures().allFreq, 1)); // depends on control dependency: [for], data = [term] } return toSummary(keywords); } }
public class class_name { @Override public EClass getIfcExternallyDefinedTextFont() { if (ifcExternallyDefinedTextFontEClass == null) { ifcExternallyDefinedTextFontEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(250); } return ifcExternallyDefinedTextFontEClass; } }
public class class_name { @Override public EClass getIfcExternallyDefinedTextFont() { if (ifcExternallyDefinedTextFontEClass == null) { ifcExternallyDefinedTextFontEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(250); // depends on control dependency: [if], data = [none] } return ifcExternallyDefinedTextFontEClass; } }
public class class_name { public static String toNamedString(Object object, Object... components) { StringBuilder b = new StringBuilder(components.length * 5 + 2); if (object != null) { b.append(object.getClass().getSimpleName()).append(' '); } b.append('{'); for (int i = 0; i < components.length; i++) { if (i != 0) { b.append(", "); } b.append(components[i]); } b.append('}'); return b.toString(); } }
public class class_name { public static String toNamedString(Object object, Object... components) { StringBuilder b = new StringBuilder(components.length * 5 + 2); if (object != null) { b.append(object.getClass().getSimpleName()).append(' '); // depends on control dependency: [if], data = [(object] } b.append('{'); for (int i = 0; i < components.length; i++) { if (i != 0) { b.append(", "); // depends on control dependency: [if], data = [none] } b.append(components[i]); // depends on control dependency: [for], data = [i] } b.append('}'); return b.toString(); } }
public class class_name { public static <T> void fire(final HasSlideStartHandlers<T> source, final T value) { if (TYPE != null) { SlideStartEvent<T> event = new SlideStartEvent<T>(value); source.fireEvent(event); } } }
public class class_name { public static <T> void fire(final HasSlideStartHandlers<T> source, final T value) { if (TYPE != null) { SlideStartEvent<T> event = new SlideStartEvent<T>(value); source.fireEvent(event); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static String getRealm(ChallengeRequest challengeRequest) { String authenticationParameters = challengeRequest.getAuthenticationParameters(); if ( authenticationParameters == null) { return null; } Matcher m = REALM_PATTERN.matcher(authenticationParameters); if ( m.matches() && m.groupCount()>=3) { return m.group(3); } return null; } }
public class class_name { public static String getRealm(ChallengeRequest challengeRequest) { String authenticationParameters = challengeRequest.getAuthenticationParameters(); if ( authenticationParameters == null) { return null; // depends on control dependency: [if], data = [none] } Matcher m = REALM_PATTERN.matcher(authenticationParameters); if ( m.matches() && m.groupCount()>=3) { return m.group(3); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { private <T> T withWhiteboardDtoService(Function<WhiteboardDtoService, T> function) { final BundleContext bundleContext = serviceBundle.getBundleContext(); ServiceReference<WhiteboardDtoService> ref = bundleContext.getServiceReference(WhiteboardDtoService.class); if (ref != null) { WhiteboardDtoService service = bundleContext.getService(ref); if (service != null) { try { return function.apply(service); } finally { bundleContext.ungetService(ref); } } } throw new IllegalStateException(String.format("Service '%s' could not be retrieved!", WhiteboardDtoService.class.getName())); } }
public class class_name { private <T> T withWhiteboardDtoService(Function<WhiteboardDtoService, T> function) { final BundleContext bundleContext = serviceBundle.getBundleContext(); ServiceReference<WhiteboardDtoService> ref = bundleContext.getServiceReference(WhiteboardDtoService.class); if (ref != null) { WhiteboardDtoService service = bundleContext.getService(ref); if (service != null) { try { return function.apply(service); // depends on control dependency: [try], data = [none] } finally { bundleContext.ungetService(ref); } } } throw new IllegalStateException(String.format("Service '%s' could not be retrieved!", WhiteboardDtoService.class.getName())); } }
public class class_name { public void setExceptionProblemDestination(String value) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setExceptionProblemDestination", value); boolean wasEmpty = (getHdr2().getChoiceField(JsHdr2Access.EXCEPTION) == JsHdr2Access.IS_EXCEPTION_EMPTY); getHdr2().setField(JsHdr2Access.EXCEPTION_DETAIL_PROBLEMDESTINATION_DATA, value); if (wasEmpty) { // Need to mark the other optional exception field as empty getHdr2().setChoiceField(JsHdr2Access.EXCEPTION_DETAIL_PROBLEMSUBSCRIPTION, JsHdr2Access.IS_EXCEPTION_DETAIL_PROBLEMSUBSCRIPTION_EMPTY); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setExceptionProblemDestination"); } }
public class class_name { public void setExceptionProblemDestination(String value) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setExceptionProblemDestination", value); boolean wasEmpty = (getHdr2().getChoiceField(JsHdr2Access.EXCEPTION) == JsHdr2Access.IS_EXCEPTION_EMPTY); getHdr2().setField(JsHdr2Access.EXCEPTION_DETAIL_PROBLEMDESTINATION_DATA, value); if (wasEmpty) { // Need to mark the other optional exception field as empty getHdr2().setChoiceField(JsHdr2Access.EXCEPTION_DETAIL_PROBLEMSUBSCRIPTION, JsHdr2Access.IS_EXCEPTION_DETAIL_PROBLEMSUBSCRIPTION_EMPTY); // depends on control dependency: [if], data = [none] } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setExceptionProblemDestination"); } }
public class class_name { public java.lang.String getUploadPathRegex() { java.lang.Object ref = uploadPathRegex_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); uploadPathRegex_ = s; return s; } } }
public class class_name { public java.lang.String getUploadPathRegex() { java.lang.Object ref = uploadPathRegex_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; // depends on control dependency: [if], data = [none] } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); uploadPathRegex_ = s; // depends on control dependency: [if], data = [none] return s; // depends on control dependency: [if], data = [none] } } }
public class class_name { public synchronized boolean contains(EvidenceType type, Confidence confidence) { if (null == type) { return false; } final Set<Evidence> col; switch (type) { case VENDOR: col = vendors; break; case PRODUCT: col = products; break; case VERSION: col = versions; break; default: return false; } for (Evidence e : col) { if (e.getConfidence().equals(confidence)) { return true; } } return false; } }
public class class_name { public synchronized boolean contains(EvidenceType type, Confidence confidence) { if (null == type) { return false; // depends on control dependency: [if], data = [none] } final Set<Evidence> col; switch (type) { case VENDOR: col = vendors; break; case PRODUCT: col = products; break; case VERSION: col = versions; break; default: return false; } for (Evidence e : col) { if (e.getConfidence().equals(confidence)) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { void addClassInfo(final ClassInfo classInfo) { if (memberClassNameToClassInfo == null) { memberClassNameToClassInfo = new HashMap<>(); } memberClassNameToClassInfo.put(classInfo.getName(), classInfo); } }
public class class_name { void addClassInfo(final ClassInfo classInfo) { if (memberClassNameToClassInfo == null) { memberClassNameToClassInfo = new HashMap<>(); // depends on control dependency: [if], data = [none] } memberClassNameToClassInfo.put(classInfo.getName(), classInfo); } }
public class class_name { public void marshall(PurchaseOfferingRequest purchaseOfferingRequest, ProtocolMarshaller protocolMarshaller) { if (purchaseOfferingRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(purchaseOfferingRequest.getOfferingId(), OFFERINGID_BINDING); protocolMarshaller.marshall(purchaseOfferingRequest.getQuantity(), QUANTITY_BINDING); protocolMarshaller.marshall(purchaseOfferingRequest.getOfferingPromotionId(), OFFERINGPROMOTIONID_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(PurchaseOfferingRequest purchaseOfferingRequest, ProtocolMarshaller protocolMarshaller) { if (purchaseOfferingRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(purchaseOfferingRequest.getOfferingId(), OFFERINGID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(purchaseOfferingRequest.getQuantity(), QUANTITY_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(purchaseOfferingRequest.getOfferingPromotionId(), OFFERINGPROMOTIONID_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 Optional<Class<?>> getClassWithAnnotation(final Class<?> source, final Class<? extends Annotation> annotationClass) { Class<?> nextSource = source; while (nextSource != Object.class) { if (nextSource.isAnnotationPresent(annotationClass)) { return Optional.of(nextSource); } else { nextSource = nextSource.getSuperclass(); } } return Optional.empty(); } }
public class class_name { public static Optional<Class<?>> getClassWithAnnotation(final Class<?> source, final Class<? extends Annotation> annotationClass) { Class<?> nextSource = source; while (nextSource != Object.class) { if (nextSource.isAnnotationPresent(annotationClass)) { return Optional.of(nextSource); // depends on control dependency: [if], data = [none] } else { nextSource = nextSource.getSuperclass(); // depends on control dependency: [if], data = [none] } } return Optional.empty(); } }
public class class_name { boolean isDefault() { if (entries.size() == 1) { StartupEntry sue = entries.get(0); if (sue.isBuiltIn && sue.name.equals(DEFAULT_STARTUP_NAME)) { return true; } } return false; } }
public class class_name { boolean isDefault() { if (entries.size() == 1) { StartupEntry sue = entries.get(0); if (sue.isBuiltIn && sue.name.equals(DEFAULT_STARTUP_NAME)) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { public EventSelector withDataResources(DataResource... dataResources) { if (this.dataResources == null) { setDataResources(new com.amazonaws.internal.SdkInternalList<DataResource>(dataResources.length)); } for (DataResource ele : dataResources) { this.dataResources.add(ele); } return this; } }
public class class_name { public EventSelector withDataResources(DataResource... dataResources) { if (this.dataResources == null) { setDataResources(new com.amazonaws.internal.SdkInternalList<DataResource>(dataResources.length)); // depends on control dependency: [if], data = [none] } for (DataResource ele : dataResources) { this.dataResources.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public final <T> T getOption(String name) { if (arguments == null) { throw new IllegalStateException("setArgs not called"); } Object value = options.get(name); if (value == null) { Option opt = map.get(name); if (opt == null) { throw new IllegalArgumentException("option "+name+" not found"); } if (opt.defValue != null) { return (T) opt.defValue; } if (!opt.mandatory) { return null; } throw new IllegalArgumentException(name+" not found"); } return (T) value; } }
public class class_name { public final <T> T getOption(String name) { if (arguments == null) { throw new IllegalStateException("setArgs not called"); } Object value = options.get(name); if (value == null) { Option opt = map.get(name); if (opt == null) { throw new IllegalArgumentException("option "+name+" not found"); } if (opt.defValue != null) { return (T) opt.defValue; // depends on control dependency: [if], data = [none] } if (!opt.mandatory) { return null; // depends on control dependency: [if], data = [none] } throw new IllegalArgumentException(name+" not found"); } return (T) value; } }
public class class_name { private SortedMap<String, List<QueryResult>> splitQueryResultsByTime(Iterable<QueryResult> results) { SortedMap<String, List<QueryResult>> resultsByTime = new TreeMap<String, List<QueryResult>>(); for (QueryResult result : results) { String epoch = String.valueOf(result.getEpoch(TimeUnit.SECONDS)); if (resultsByTime.containsKey(epoch)) { List<QueryResult> current = resultsByTime.get(epoch); current.add(result); resultsByTime.put(epoch, current); } else { ArrayList<QueryResult> newQueryList = new ArrayList<QueryResult>(); newQueryList.add(result); resultsByTime.put(epoch, newQueryList); } } return resultsByTime; } }
public class class_name { private SortedMap<String, List<QueryResult>> splitQueryResultsByTime(Iterable<QueryResult> results) { SortedMap<String, List<QueryResult>> resultsByTime = new TreeMap<String, List<QueryResult>>(); for (QueryResult result : results) { String epoch = String.valueOf(result.getEpoch(TimeUnit.SECONDS)); if (resultsByTime.containsKey(epoch)) { List<QueryResult> current = resultsByTime.get(epoch); current.add(result); // depends on control dependency: [if], data = [none] resultsByTime.put(epoch, current); // depends on control dependency: [if], data = [none] } else { ArrayList<QueryResult> newQueryList = new ArrayList<QueryResult>(); newQueryList.add(result); // depends on control dependency: [if], data = [none] resultsByTime.put(epoch, newQueryList); // depends on control dependency: [if], data = [none] } } return resultsByTime; } }
public class class_name { private Set<String> parseIncludeNode(Set<String> origResult, File serverFile, Element node, List<File> updatedParsedXmls) { Set<String> result = origResult; String includeFileName = node.getAttribute("location"); if (includeFileName == null || includeFileName.trim().isEmpty()) { return result; } File includeFile = null; if (isURL(includeFileName)) { try { File tempFile = File.createTempFile("serverFromURL", ".xml"); FileUtils.copyURLToFile(new URL(includeFileName), tempFile, COPY_FILE_TIMEOUT_MILLIS, COPY_FILE_TIMEOUT_MILLIS); includeFile = tempFile; } catch (IOException e) { // skip this xml if it cannot be accessed from URL warn("The server file " + serverFile + " includes a URL " + includeFileName + " that cannot be accessed. Skipping the included features."); debug(e); return result; } } else { includeFile = new File(includeFileName); } try { if (!includeFile.isAbsolute()) { includeFile = new File(serverFile.getParentFile().getAbsolutePath(), includeFileName) .getCanonicalFile(); } else { includeFile = includeFile.getCanonicalFile(); } } catch (IOException e) { // skip this xml if its path cannot be queried warn("The server file " + serverFile + " includes a file " + includeFileName + " that cannot be accessed. Skipping the included features."); debug(e); return result; } if (!updatedParsedXmls.contains(includeFile)) { String onConflict = node.getAttribute("onConflict"); Set<String> features = getServerXmlFeatures(null, includeFile, updatedParsedXmls); result = handleOnConflict(result, onConflict, features); } return result; } }
public class class_name { private Set<String> parseIncludeNode(Set<String> origResult, File serverFile, Element node, List<File> updatedParsedXmls) { Set<String> result = origResult; String includeFileName = node.getAttribute("location"); if (includeFileName == null || includeFileName.trim().isEmpty()) { return result; // depends on control dependency: [if], data = [none] } File includeFile = null; if (isURL(includeFileName)) { try { File tempFile = File.createTempFile("serverFromURL", ".xml"); FileUtils.copyURLToFile(new URL(includeFileName), tempFile, COPY_FILE_TIMEOUT_MILLIS, COPY_FILE_TIMEOUT_MILLIS); // depends on control dependency: [try], data = [none] includeFile = tempFile; // depends on control dependency: [try], data = [none] } catch (IOException e) { // skip this xml if it cannot be accessed from URL warn("The server file " + serverFile + " includes a URL " + includeFileName + " that cannot be accessed. Skipping the included features."); debug(e); return result; } // depends on control dependency: [catch], data = [none] } else { includeFile = new File(includeFileName); // depends on control dependency: [if], data = [none] } try { if (!includeFile.isAbsolute()) { includeFile = new File(serverFile.getParentFile().getAbsolutePath(), includeFileName) .getCanonicalFile(); // depends on control dependency: [if], data = [none] } else { includeFile = includeFile.getCanonicalFile(); // depends on control dependency: [if], data = [none] } } catch (IOException e) { // skip this xml if its path cannot be queried warn("The server file " + serverFile + " includes a file " + includeFileName + " that cannot be accessed. Skipping the included features."); debug(e); return result; } // depends on control dependency: [catch], data = [none] if (!updatedParsedXmls.contains(includeFile)) { String onConflict = node.getAttribute("onConflict"); Set<String> features = getServerXmlFeatures(null, includeFile, updatedParsedXmls); result = handleOnConflict(result, onConflict, features); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { static PathFileObject createSimplePathFileObject(JavacPathFileManager fileManager, final Path path) { return new PathFileObject(fileManager, path) { @Override String inferBinaryName(Iterable<? extends Path> paths) { Path absPath = path.toAbsolutePath(); for (Path p: paths) { Path ap = p.toAbsolutePath(); if (absPath.startsWith(ap)) { try { Path rp = ap.relativize(absPath); if (rp != null) // maybe null if absPath same as ap return toBinaryName(rp); } catch (IllegalArgumentException e) { // ignore this p if cannot relativize path to p } } } return null; } }; } }
public class class_name { static PathFileObject createSimplePathFileObject(JavacPathFileManager fileManager, final Path path) { return new PathFileObject(fileManager, path) { @Override String inferBinaryName(Iterable<? extends Path> paths) { Path absPath = path.toAbsolutePath(); for (Path p: paths) { Path ap = p.toAbsolutePath(); if (absPath.startsWith(ap)) { try { Path rp = ap.relativize(absPath); if (rp != null) // maybe null if absPath same as ap return toBinaryName(rp); } catch (IllegalArgumentException e) { // ignore this p if cannot relativize path to p } // depends on control dependency: [catch], data = [none] } } return null; } }; } }
public class class_name { public String getFormattedStatus() { final StringBuilder sb = new StringBuilder(); final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss,SSS"); sb.append(format.format(new Date(timestamp))); sb.append(SPACE); sb.append(getThreadName()); sb.append(SPACE); sb.append(level.toString()); sb.append(SPACE); sb.append(msg.getFormattedMessage()); final Object[] params = msg.getParameters(); Throwable t; if (throwable == null && params != null && params[params.length - 1] instanceof Throwable) { t = (Throwable) params[params.length - 1]; } else { t = throwable; } if (t != null) { sb.append(SPACE); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); t.printStackTrace(new PrintStream(baos)); sb.append(baos.toString()); } return sb.toString(); } }
public class class_name { public String getFormattedStatus() { final StringBuilder sb = new StringBuilder(); final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss,SSS"); sb.append(format.format(new Date(timestamp))); sb.append(SPACE); sb.append(getThreadName()); sb.append(SPACE); sb.append(level.toString()); sb.append(SPACE); sb.append(msg.getFormattedMessage()); final Object[] params = msg.getParameters(); Throwable t; if (throwable == null && params != null && params[params.length - 1] instanceof Throwable) { t = (Throwable) params[params.length - 1]; // depends on control dependency: [if], data = [none] } else { t = throwable; // depends on control dependency: [if], data = [none] } if (t != null) { sb.append(SPACE); // depends on control dependency: [if], data = [none] final ByteArrayOutputStream baos = new ByteArrayOutputStream(); t.printStackTrace(new PrintStream(baos)); // depends on control dependency: [if], data = [none] sb.append(baos.toString()); // depends on control dependency: [if], data = [none] } return sb.toString(); } }
public class class_name { public static Call fromRequest(final Request request) { Call call = new Call(); call.request = request; call.method = request.getMethod(); call.authorization = request.getAuthorization(); call.uri = request.getRequestURI(); call.contentType = request.getContentType(); call.url = request.getRequestURL().toString(); for (String headerName : request.getHeaderNames()) { List<String> headers = new ArrayList<>(); request.getHeaders(headerName).forEach(headers::add); call.headers.put(headerName, headers); } call.parameters = new HashMap<>(request.getParameterMap()); try { call.postBody = request.getPostBody(999999).toStringContent(Charset.defaultCharset()); } catch (IOException e) { throw new RuntimeException("Problem reading Post Body of HTTP call"); } return call; } }
public class class_name { public static Call fromRequest(final Request request) { Call call = new Call(); call.request = request; call.method = request.getMethod(); call.authorization = request.getAuthorization(); call.uri = request.getRequestURI(); call.contentType = request.getContentType(); call.url = request.getRequestURL().toString(); for (String headerName : request.getHeaderNames()) { List<String> headers = new ArrayList<>(); request.getHeaders(headerName).forEach(headers::add); // depends on control dependency: [for], data = [headerName] call.headers.put(headerName, headers); // depends on control dependency: [for], data = [headerName] } call.parameters = new HashMap<>(request.getParameterMap()); try { call.postBody = request.getPostBody(999999).toStringContent(Charset.defaultCharset()); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new RuntimeException("Problem reading Post Body of HTTP call"); } // depends on control dependency: [catch], data = [none] return call; } }
public class class_name { public final SgField findFieldByName(final String name) { if (name == null) { throw new IllegalArgumentException("The argument 'name' cannot be null!"); } for (int i = 0; i < fields.size(); i++) { final SgField field = fields.get(i); if (field.getName().equals(name)) { return field; } } return null; } }
public class class_name { public final SgField findFieldByName(final String name) { if (name == null) { throw new IllegalArgumentException("The argument 'name' cannot be null!"); } for (int i = 0; i < fields.size(); i++) { final SgField field = fields.get(i); if (field.getName().equals(name)) { return field; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { @SuppressWarnings("unchecked") public <T extends DmnDecisionRequirementsGraph> T transformDecisionRequirementsGraph() { try { Definitions definitions = modelInstance.getDefinitions(); return (T) transformDefinitions(definitions); } catch (Exception e) { throw LOG.errorWhileTransformingDefinitions(e); } } }
public class class_name { @SuppressWarnings("unchecked") public <T extends DmnDecisionRequirementsGraph> T transformDecisionRequirementsGraph() { try { Definitions definitions = modelInstance.getDefinitions(); return (T) transformDefinitions(definitions); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw LOG.errorWhileTransformingDefinitions(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public <E extends Test> List<List<Object>> getJavaScriptConfig(final E[] tests) { final Map<String, TestBucket> buckets = getProctorResult().getBuckets(); final List<List<Object>> groups = new ArrayList<List<Object>>(tests.length); for (final E test : tests) { final String testName = test.getName(); final Integer bucketValue = getValue(testName, test.getFallbackValue()); final Object payloadValue; final TestBucket testBucket = buckets.get(testName); if (testBucket != null && testBucket.getPayload() != null) { final Payload payload = testBucket.getPayload(); payloadValue = payload.fetchAValue(); } else { payloadValue = null; } final List<Object> definition = new ArrayList<Object>(); definition.add(bucketValue); definition.add(payloadValue); groups.add(definition); } return groups; } }
public class class_name { public <E extends Test> List<List<Object>> getJavaScriptConfig(final E[] tests) { final Map<String, TestBucket> buckets = getProctorResult().getBuckets(); final List<List<Object>> groups = new ArrayList<List<Object>>(tests.length); for (final E test : tests) { final String testName = test.getName(); final Integer bucketValue = getValue(testName, test.getFallbackValue()); final Object payloadValue; final TestBucket testBucket = buckets.get(testName); if (testBucket != null && testBucket.getPayload() != null) { final Payload payload = testBucket.getPayload(); payloadValue = payload.fetchAValue(); // depends on control dependency: [if], data = [none] } else { payloadValue = null; // depends on control dependency: [if], data = [none] } final List<Object> definition = new ArrayList<Object>(); definition.add(bucketValue); // depends on control dependency: [for], data = [none] definition.add(payloadValue); // depends on control dependency: [for], data = [none] groups.add(definition); // depends on control dependency: [for], data = [none] } return groups; } }
public class class_name { public static List<FactoryModel> factories(BundleContext context) { List<FactoryModel> factories = new ArrayList<FactoryModel>(); try { for (ServiceReference ref : context.getServiceReferences(Factory.class, null)) { factories.add(new FactoryModel((Factory) context.getService(ref))); } for (ServiceReference ref : context.getServiceReferences(HandlerFactory.class, null)) { factories.add(new FactoryModel((Factory) context.getService(ref))); } } catch (InvalidSyntaxException e) { //NOSONAR // Ignore it. } return factories; } }
public class class_name { public static List<FactoryModel> factories(BundleContext context) { List<FactoryModel> factories = new ArrayList<FactoryModel>(); try { for (ServiceReference ref : context.getServiceReferences(Factory.class, null)) { factories.add(new FactoryModel((Factory) context.getService(ref))); // depends on control dependency: [for], data = [ref] } for (ServiceReference ref : context.getServiceReferences(HandlerFactory.class, null)) { factories.add(new FactoryModel((Factory) context.getService(ref))); // depends on control dependency: [for], data = [ref] } } catch (InvalidSyntaxException e) { //NOSONAR // Ignore it. } // depends on control dependency: [catch], data = [none] return factories; } }
public class class_name { @Nullable public DBObject tryNext() { if (cursor == null) { FindOperation<DBObject> operation = getQueryOperation(decoder); if (!operation.getCursorType().isTailable()) { throw new IllegalArgumentException("Can only be used with a tailable cursor"); } initializeCursor(operation); } DBObject next = cursor.tryNext(); setServerCursorOnFinalizer(cursor.getServerCursor()); return currentObject(next); } }
public class class_name { @Nullable public DBObject tryNext() { if (cursor == null) { FindOperation<DBObject> operation = getQueryOperation(decoder); if (!operation.getCursorType().isTailable()) { throw new IllegalArgumentException("Can only be used with a tailable cursor"); } initializeCursor(operation); // depends on control dependency: [if], data = [none] } DBObject next = cursor.tryNext(); setServerCursorOnFinalizer(cursor.getServerCursor()); return currentObject(next); } }
public class class_name { private String buildMessage( final ChangeSummary summary, final Collection<String> paths ) { final StringBuilder message = new StringBuilder().append( summary.getSummary() ); if ( config.isCommitFileManifestsEnabled() ) { message.append( "\n\nFiles changed:\n" ) .append( join( paths, "\n" ) ); } return message.toString(); } }
public class class_name { private String buildMessage( final ChangeSummary summary, final Collection<String> paths ) { final StringBuilder message = new StringBuilder().append( summary.getSummary() ); if ( config.isCommitFileManifestsEnabled() ) { message.append( "\n\nFiles changed:\n" ) .append( join( paths, "\n" ) ); // depends on control dependency: [if], data = [none] } return message.toString(); } }
public class class_name { public void syncPersistExistingDirectory(Supplier<JournalContext> context, InodeDirectoryView dir) throws IOException, InvalidPathException, FileDoesNotExistException { RetryPolicy retry = new ExponentialBackoffRetry(PERSIST_WAIT_BASE_SLEEP_MS, PERSIST_WAIT_MAX_SLEEP_MS, PERSIST_WAIT_MAX_RETRIES); while (retry.attempt()) { if (dir.getPersistenceState() == PersistenceState.PERSISTED) { // The directory is persisted return; } Optional<Scoped> persisting = mInodeLockManager.tryAcquirePersistingLock(dir.getId()); if (!persisting.isPresent()) { // Someone else is doing this persist. Continue and wait for them to finish. continue; } try (Scoped s = persisting.get()) { if (dir.getPersistenceState() == PersistenceState.PERSISTED) { // The directory is persisted return; } mState.applyAndJournal(context, UpdateInodeEntry.newBuilder() .setId(dir.getId()) .setPersistenceState(PersistenceState.TO_BE_PERSISTED.name()) .build()); UpdateInodeEntry.Builder entry = UpdateInodeEntry.newBuilder() .setId(dir.getId()); syncPersistDirectory(dir).ifPresent(status -> { if (isRootId(dir.getId())) { // Don't load the root dir metadata from UFS return; } entry.setOwner(status.getOwner()) .setGroup(status.getGroup()) .setMode(status.getMode()); Long lastModificationTime = status.getLastModifiedTime(); if (lastModificationTime != null) { entry.setLastModificationTimeMs(lastModificationTime) .setOverwriteModificationTime(true); } }); entry.setPersistenceState(PersistenceState.PERSISTED.name()); mState.applyAndJournal(context, entry.build()); return; } } throw new IOException(ExceptionMessage.FAILED_UFS_CREATE.getMessage(dir.getName())); } }
public class class_name { public void syncPersistExistingDirectory(Supplier<JournalContext> context, InodeDirectoryView dir) throws IOException, InvalidPathException, FileDoesNotExistException { RetryPolicy retry = new ExponentialBackoffRetry(PERSIST_WAIT_BASE_SLEEP_MS, PERSIST_WAIT_MAX_SLEEP_MS, PERSIST_WAIT_MAX_RETRIES); while (retry.attempt()) { if (dir.getPersistenceState() == PersistenceState.PERSISTED) { // The directory is persisted return; } Optional<Scoped> persisting = mInodeLockManager.tryAcquirePersistingLock(dir.getId()); if (!persisting.isPresent()) { // Someone else is doing this persist. Continue and wait for them to finish. continue; } try (Scoped s = persisting.get()) { if (dir.getPersistenceState() == PersistenceState.PERSISTED) { // The directory is persisted return; // depends on control dependency: [if], data = [none] } mState.applyAndJournal(context, UpdateInodeEntry.newBuilder() .setId(dir.getId()) .setPersistenceState(PersistenceState.TO_BE_PERSISTED.name()) .build()); UpdateInodeEntry.Builder entry = UpdateInodeEntry.newBuilder() .setId(dir.getId()); syncPersistDirectory(dir).ifPresent(status -> { if (isRootId(dir.getId())) { // Don't load the root dir metadata from UFS return; } entry.setOwner(status.getOwner()) .setGroup(status.getGroup()) .setMode(status.getMode()); Long lastModificationTime = status.getLastModifiedTime(); if (lastModificationTime != null) { entry.setLastModificationTimeMs(lastModificationTime) .setOverwriteModificationTime(true); } }); entry.setPersistenceState(PersistenceState.PERSISTED.name()); mState.applyAndJournal(context, entry.build()); return; } } throw new IOException(ExceptionMessage.FAILED_UFS_CREATE.getMessage(dir.getName())); } }
public class class_name { @SuppressWarnings("unchecked") private Map<String, Object> toMap(final Object o) { if (o instanceof Map) { return (Map<String, Object>) o; } return BeanAccessor.asMap(o); } }
public class class_name { @SuppressWarnings("unchecked") private Map<String, Object> toMap(final Object o) { if (o instanceof Map) { return (Map<String, Object>) o; // depends on control dependency: [if], data = [none] } return BeanAccessor.asMap(o); } }
public class class_name { public boolean isInstance(Object o) { Class c = rawType(); if (c.isInstance(o)) { return true; } Class p = $.primitiveTypeOf(c); if (null != p && p.isInstance(o)) { return true; } Class w = $.wrapperClassOf(c); if (null != w && w.isInstance(o)) { return true; } return false; } }
public class class_name { public boolean isInstance(Object o) { Class c = rawType(); if (c.isInstance(o)) { return true; // depends on control dependency: [if], data = [none] } Class p = $.primitiveTypeOf(c); if (null != p && p.isInstance(o)) { return true; // depends on control dependency: [if], data = [none] } Class w = $.wrapperClassOf(c); if (null != w && w.isInstance(o)) { return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public TableDescription createTable(ProvisionedThroughput throughput) { final CreateTableRequest request = mapper.generateCreateTableRequest(model.targetType()); request.setProvisionedThroughput(throughput); if (request.getGlobalSecondaryIndexes() != null) { for (final GlobalSecondaryIndex gsi : request.getGlobalSecondaryIndexes()) { gsi.setProvisionedThroughput(throughput); } } return db.createTable(request).getTableDescription(); } }
public class class_name { public TableDescription createTable(ProvisionedThroughput throughput) { final CreateTableRequest request = mapper.generateCreateTableRequest(model.targetType()); request.setProvisionedThroughput(throughput); if (request.getGlobalSecondaryIndexes() != null) { for (final GlobalSecondaryIndex gsi : request.getGlobalSecondaryIndexes()) { gsi.setProvisionedThroughput(throughput); // depends on control dependency: [for], data = [gsi] } } return db.createTable(request).getTableDescription(); } }
public class class_name { public String getProperty(String category, String key, String defaultValue) { category = (this.compressedSpaces ? category.replaceAll("\\s+", " ") : category).trim(); if (Strings.isNullOrEmpty(category)) category = "Main"; key = (this.compressedSpaces ? key.replaceAll("\\s+", " ") : key).trim().replace(" ", "_"); try { return this.categories.get(category).get(key).replace("_", " "); } catch (NullPointerException e) { return defaultValue; } } }
public class class_name { public String getProperty(String category, String key, String defaultValue) { category = (this.compressedSpaces ? category.replaceAll("\\s+", " ") : category).trim(); if (Strings.isNullOrEmpty(category)) category = "Main"; key = (this.compressedSpaces ? key.replaceAll("\\s+", " ") : key).trim().replace(" ", "_"); try { return this.categories.get(category).get(key).replace("_", " "); // depends on control dependency: [try], data = [none] } catch (NullPointerException e) { return defaultValue; } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void computeIJTable(InfoTree it, int subtreePreorder, int subtreeRevPreorder, int subtreeSize, int aStrategy, int treeSize) { int change; int[] post2pre = it.info[POST2_PRE]; int[] rpost2post = it.info[RPOST2_POST]; if (aStrategy == LEFT) { for (int x = 0; x < subtreeSize; x++) { ij[0][x] = x + subtreePreorder; } for (int x = 1; x < subtreeSize; x++) { change = post2pre[(treeSize - 1 - (x - 1 + subtreeRevPreorder))]; for (int z = 0; z < subtreeSize; z++) { if (ij[x - 1][z] >= change) { ij[x][z] = ij[x - 1][z] + 1; } else { ij[x][z] = ij[x - 1][z]; } } } } else { // if (aStrategy == RIGHT) { for (int x = 0; x < subtreeSize; x++) { ij[0][x] = x + subtreeRevPreorder; } for (int x = 1; x < subtreeSize; x++) { change = treeSize - 1 - rpost2post[(treeSize - 1 - (x - 1 + subtreePreorder))]; for (int z = 0; z < subtreeSize; z++) { if (ij[x - 1][z] >= change) { ij[x][z] = ij[x - 1][z] + 1; } else { ij[x][z] = ij[x - 1][z]; } } } } } }
public class class_name { private void computeIJTable(InfoTree it, int subtreePreorder, int subtreeRevPreorder, int subtreeSize, int aStrategy, int treeSize) { int change; int[] post2pre = it.info[POST2_PRE]; int[] rpost2post = it.info[RPOST2_POST]; if (aStrategy == LEFT) { for (int x = 0; x < subtreeSize; x++) { ij[0][x] = x + subtreePreorder; // depends on control dependency: [for], data = [x] } for (int x = 1; x < subtreeSize; x++) { change = post2pre[(treeSize - 1 - (x - 1 + subtreeRevPreorder))]; // depends on control dependency: [for], data = [x] for (int z = 0; z < subtreeSize; z++) { if (ij[x - 1][z] >= change) { ij[x][z] = ij[x - 1][z] + 1; // depends on control dependency: [if], data = [none] } else { ij[x][z] = ij[x - 1][z]; // depends on control dependency: [if], data = [none] } } } } else { // if (aStrategy == RIGHT) { for (int x = 0; x < subtreeSize; x++) { ij[0][x] = x + subtreeRevPreorder; // depends on control dependency: [for], data = [x] } for (int x = 1; x < subtreeSize; x++) { change = treeSize - 1 - rpost2post[(treeSize - 1 - (x - 1 + subtreePreorder))]; // depends on control dependency: [for], data = [none] for (int z = 0; z < subtreeSize; z++) { if (ij[x - 1][z] >= change) { ij[x][z] = ij[x - 1][z] + 1; // depends on control dependency: [if], data = [none] } else { ij[x][z] = ij[x - 1][z]; // depends on control dependency: [if], data = [none] } } } } } }
public class class_name { public void addMember(JSConsumerKey key) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "addMember", key); super.addMember(key); // superclass method does most of the work synchronized (criteriaLock) { if (allCriterias != null) { SelectionCriteria[] newCriterias = new SelectionCriteria[allCriterias.length + 1]; System.arraycopy(allCriterias, 0, newCriterias, 0, allCriterias.length); allCriterias = newCriterias; } else { allCriterias = new SelectionCriteria[1]; } allCriterias[allCriterias.length - 1] = ((RemoteQPConsumerKey) key).getSelectionCriteria()[0]; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "addMember"); } }
public class class_name { public void addMember(JSConsumerKey key) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "addMember", key); super.addMember(key); // superclass method does most of the work synchronized (criteriaLock) { if (allCriterias != null) { SelectionCriteria[] newCriterias = new SelectionCriteria[allCriterias.length + 1]; System.arraycopy(allCriterias, 0, newCriterias, 0, allCriterias.length); // depends on control dependency: [if], data = [(allCriterias] allCriterias = newCriterias; // depends on control dependency: [if], data = [none] } else { allCriterias = new SelectionCriteria[1]; // depends on control dependency: [if], data = [none] } allCriterias[allCriterias.length - 1] = ((RemoteQPConsumerKey) key).getSelectionCriteria()[0]; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "addMember"); } }
public class class_name { public void notifySipApplicationSessionListeners(SipApplicationSessionEventType sipApplicationSessionEventType) { List<SipApplicationSessionListener> listeners = sipContext.getListeners().getSipApplicationSessionListeners(); if(listeners.size() > 0) { ClassLoader oldClassLoader = java.lang.Thread.currentThread().getContextClassLoader(); sipContext.enterSipContext(); SipApplicationSessionEvent event = new SipApplicationSessionEvent(this.getFacade()); if(logger.isDebugEnabled()) { logger.debug("notifying sip application session listeners of context " + key.getApplicationName() + " of following event " + sipApplicationSessionEventType); } for (SipApplicationSessionListener sipApplicationSessionListener : listeners) { try { if(logger.isDebugEnabled()) { logger.debug("notifying sip application session listener " + sipApplicationSessionListener.getClass().getName() + " of context " + key.getApplicationName() + " of following event " + sipApplicationSessionEventType); } if(SipApplicationSessionEventType.CREATION.equals(sipApplicationSessionEventType)) { sipApplicationSessionListener.sessionCreated(event); } else if (SipApplicationSessionEventType.DELETION.equals(sipApplicationSessionEventType)) { sipApplicationSessionListener.sessionDestroyed(event); } else if (SipApplicationSessionEventType.EXPIRATION.equals(sipApplicationSessionEventType)) { sipApplicationSessionListener.sessionExpired(event); } else if (SipApplicationSessionEventType.READYTOINVALIDATE.equals(sipApplicationSessionEventType)) { sipApplicationSessionListener.sessionReadyToInvalidate(event); } } catch (Throwable t) { logger.error("SipApplicationSessionListener threw exception", t); } } sipContext.exitSipContext(oldClassLoader); } } }
public class class_name { public void notifySipApplicationSessionListeners(SipApplicationSessionEventType sipApplicationSessionEventType) { List<SipApplicationSessionListener> listeners = sipContext.getListeners().getSipApplicationSessionListeners(); if(listeners.size() > 0) { ClassLoader oldClassLoader = java.lang.Thread.currentThread().getContextClassLoader(); sipContext.enterSipContext(); // depends on control dependency: [if], data = [none] SipApplicationSessionEvent event = new SipApplicationSessionEvent(this.getFacade()); if(logger.isDebugEnabled()) { logger.debug("notifying sip application session listeners of context " + key.getApplicationName() + " of following event " + sipApplicationSessionEventType); // depends on control dependency: [if], data = [none] } for (SipApplicationSessionListener sipApplicationSessionListener : listeners) { try { if(logger.isDebugEnabled()) { logger.debug("notifying sip application session listener " + sipApplicationSessionListener.getClass().getName() + " of context " + key.getApplicationName() + " of following event " + sipApplicationSessionEventType); // depends on control dependency: [if], data = [none] } if(SipApplicationSessionEventType.CREATION.equals(sipApplicationSessionEventType)) { sipApplicationSessionListener.sessionCreated(event); // depends on control dependency: [if], data = [none] } else if (SipApplicationSessionEventType.DELETION.equals(sipApplicationSessionEventType)) { sipApplicationSessionListener.sessionDestroyed(event); // depends on control dependency: [if], data = [none] } else if (SipApplicationSessionEventType.EXPIRATION.equals(sipApplicationSessionEventType)) { sipApplicationSessionListener.sessionExpired(event); // depends on control dependency: [if], data = [none] } else if (SipApplicationSessionEventType.READYTOINVALIDATE.equals(sipApplicationSessionEventType)) { sipApplicationSessionListener.sessionReadyToInvalidate(event); // depends on control dependency: [if], data = [none] } } catch (Throwable t) { logger.error("SipApplicationSessionListener threw exception", t); } // depends on control dependency: [catch], data = [none] } sipContext.exitSipContext(oldClassLoader); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void write0(int b) throws IOException { if (this.currentChar != -1) { b &= 0xff; if (this.currentChar == b) { if (++this.runLength > 254) { writeRun(); this.currentChar = -1; this.runLength = 0; } // else nothing to do } else { writeRun(); this.runLength = 1; this.currentChar = b; } } else { this.currentChar = b & 0xff; this.runLength++; } } }
public class class_name { private void write0(int b) throws IOException { if (this.currentChar != -1) { b &= 0xff; if (this.currentChar == b) { if (++this.runLength > 254) { writeRun(); // depends on control dependency: [if], data = [none] this.currentChar = -1; // depends on control dependency: [if], data = [none] this.runLength = 0; // depends on control dependency: [if], data = [none] } // else nothing to do } else { writeRun(); this.runLength = 1; this.currentChar = b; } } else { this.currentChar = b & 0xff; this.runLength++; } } }
public class class_name { public InlineMorph with(String line) { if (scriptBuilder.length() == 0) { appendBoilerplate(line); } scriptBuilder .append(line) .append("\n"); return this; } }
public class class_name { public InlineMorph with(String line) { if (scriptBuilder.length() == 0) { appendBoilerplate(line); // depends on control dependency: [if], data = [none] } scriptBuilder .append(line) .append("\n"); return this; } }
public class class_name { private PBKey buildDefaultKey() { List descriptors = connectionRepository().getAllDescriptor(); JdbcConnectionDescriptor descriptor; PBKey result = null; for (Iterator iterator = descriptors.iterator(); iterator.hasNext();) { descriptor = (JdbcConnectionDescriptor) iterator.next(); if (descriptor.isDefaultConnection()) { if(result != null) { log.error("Found additional connection descriptor with enabled 'default-connection' " + descriptor.getPBKey() + ". This is NOT allowed. Will use the first found descriptor " + result + " as default connection"); } else { result = descriptor.getPBKey(); } } } if(result == null) { log.info("No 'default-connection' attribute set in jdbc-connection-descriptors," + " thus it's currently not possible to use 'defaultPersistenceBroker()' " + " convenience method to lookup PersistenceBroker instances. But it's possible"+ " to enable this at runtime using 'setDefaultKey' method."); } return result; } }
public class class_name { private PBKey buildDefaultKey() { List descriptors = connectionRepository().getAllDescriptor(); JdbcConnectionDescriptor descriptor; PBKey result = null; for (Iterator iterator = descriptors.iterator(); iterator.hasNext();) { descriptor = (JdbcConnectionDescriptor) iterator.next(); // depends on control dependency: [for], data = [iterator] if (descriptor.isDefaultConnection()) { if(result != null) { log.error("Found additional connection descriptor with enabled 'default-connection' " + descriptor.getPBKey() + ". This is NOT allowed. Will use the first found descriptor " + result + " as default connection"); // depends on control dependency: [if], data = [none] } else { result = descriptor.getPBKey(); // depends on control dependency: [if], data = [none] } } } if(result == null) { log.info("No 'default-connection' attribute set in jdbc-connection-descriptors," + " thus it's currently not possible to use 'defaultPersistenceBroker()' " + " convenience method to lookup PersistenceBroker instances. But it's possible"+ " to enable this at runtime using 'setDefaultKey' method."); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { protected void append(Options options, CharSequence sequence) { TextSupport textSupport = this.textSupport; if (textSupport == null || isUnescapeVariable(options)) { options.append(sequence); } else { try { textSupport.appendEscapedHtml(sequence.toString(), options.getAppendable()); } catch (IOException e) { throw new MustacheException(MustacheProblem.RENDER_IO_ERROR, e); } } } }
public class class_name { protected void append(Options options, CharSequence sequence) { TextSupport textSupport = this.textSupport; if (textSupport == null || isUnescapeVariable(options)) { options.append(sequence); // depends on control dependency: [if], data = [none] } else { try { textSupport.appendEscapedHtml(sequence.toString(), options.getAppendable()); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new MustacheException(MustacheProblem.RENDER_IO_ERROR, e); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { @SneakyThrows public static String dumps(@NonNull Map<String, ?> map) { Resource strResource = new StringResource(); try (JsonWriter writer = new JsonWriter(strResource)) { writer.beginDocument(); for (Map.Entry<String, ?> entry : map.entrySet()) { writer.property(entry.getKey(), entry.getValue()); } writer.endDocument(); } return strResource.readToString().trim(); } }
public class class_name { @SneakyThrows public static String dumps(@NonNull Map<String, ?> map) { Resource strResource = new StringResource(); try (JsonWriter writer = new JsonWriter(strResource)) { writer.beginDocument(); for (Map.Entry<String, ?> entry : map.entrySet()) { writer.property(entry.getKey(), entry.getValue()); // depends on control dependency: [for], data = [entry] } writer.endDocument(); } return strResource.readToString().trim(); } }
public class class_name { public void initialize(Context context, String appGUID, String pushClientSecret,MFPPushNotificationOptions options) { try { if (MFPPushUtils.validateString(pushClientSecret) && MFPPushUtils.validateString(appGUID)) { // Get the applicationId and backend route from core clientSecret = pushClientSecret; applicationId = appGUID; appContext = context.getApplicationContext(); isInitialized = true; validateAndroidContext(); //Storing the messages url and the client secret. //This is because when the app is not running and notification is dismissed/cleared, //there wont be applicationId and clientSecret details available to //MFPPushNotificationDismissHandler. SharedPreferences sharedPreferences = appContext.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE); MFPPushUtils.storeContentInSharedPreferences(sharedPreferences, MFPPush.PREFS_MESSAGES_URL, buildMessagesURL()); MFPPushUtils.storeContentInSharedPreferences(sharedPreferences, MFPPush.PREFS_MESSAGES_URL_CLIENT_SECRET, clientSecret); MFPPushUtils.storeContentInSharedPreferences(sharedPreferences, PREFS_BMS_REGION, BMSClient.getInstance().getBluemixRegionSuffix()); if (options != null){ setNotificationOptions(context,options); this.regId = options.getDeviceid(); } } else { logger.error("MFPPush:initialize() - An error occured while initializing MFPPush service. Add a valid ClientSecret and push service instance ID Value"); throw new MFPPushException("MFPPush:initialize() - An error occured while initializing MFPPush service. Add a valid ClientSecret and push service instance ID Value", INITIALISATION_ERROR); } } catch (Exception e) { logger.error("MFPPush:initialize() - An error occured while initializing MFPPush service."); throw new RuntimeException(e); } } }
public class class_name { public void initialize(Context context, String appGUID, String pushClientSecret,MFPPushNotificationOptions options) { try { if (MFPPushUtils.validateString(pushClientSecret) && MFPPushUtils.validateString(appGUID)) { // Get the applicationId and backend route from core clientSecret = pushClientSecret; // depends on control dependency: [if], data = [none] applicationId = appGUID; // depends on control dependency: [if], data = [none] appContext = context.getApplicationContext(); // depends on control dependency: [if], data = [none] isInitialized = true; // depends on control dependency: [if], data = [none] validateAndroidContext(); // depends on control dependency: [if], data = [none] //Storing the messages url and the client secret. //This is because when the app is not running and notification is dismissed/cleared, //there wont be applicationId and clientSecret details available to //MFPPushNotificationDismissHandler. SharedPreferences sharedPreferences = appContext.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE); MFPPushUtils.storeContentInSharedPreferences(sharedPreferences, MFPPush.PREFS_MESSAGES_URL, buildMessagesURL()); // depends on control dependency: [if], data = [none] MFPPushUtils.storeContentInSharedPreferences(sharedPreferences, MFPPush.PREFS_MESSAGES_URL_CLIENT_SECRET, clientSecret); // depends on control dependency: [if], data = [none] MFPPushUtils.storeContentInSharedPreferences(sharedPreferences, PREFS_BMS_REGION, BMSClient.getInstance().getBluemixRegionSuffix()); // depends on control dependency: [if], data = [none] if (options != null){ setNotificationOptions(context,options); // depends on control dependency: [if], data = [none] this.regId = options.getDeviceid(); // depends on control dependency: [if], data = [none] } } else { logger.error("MFPPush:initialize() - An error occured while initializing MFPPush service. Add a valid ClientSecret and push service instance ID Value"); // depends on control dependency: [if], data = [none] throw new MFPPushException("MFPPush:initialize() - An error occured while initializing MFPPush service. Add a valid ClientSecret and push service instance ID Value", INITIALISATION_ERROR); } } catch (Exception e) { logger.error("MFPPush:initialize() - An error occured while initializing MFPPush service."); throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public ZipkinRule storeSpans(List<Span> spans) { try { storage.accept(spans).execute(); } catch (IOException e) { throw Platform.get().uncheckedIOException(e); } return this; } }
public class class_name { public ZipkinRule storeSpans(List<Span> spans) { try { storage.accept(spans).execute(); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw Platform.get().uncheckedIOException(e); } // depends on control dependency: [catch], data = [none] return this; } }
public class class_name { public void initializeSession() { ApplicationSessionInitializer asi = getApplicationSessionInitializer(); if (asi != null) { asi.initializeSession(); Map<String, Object> sessionAttributes = asi.getSessionAttributes(); if (sessionAttributes != null) { setSessionAttributes(sessionAttributes); } propertyChangeSupport.firePropertyChange(SESSION_ATTRIBUTES, null, sessionAttributes); } } }
public class class_name { public void initializeSession() { ApplicationSessionInitializer asi = getApplicationSessionInitializer(); if (asi != null) { asi.initializeSession(); // depends on control dependency: [if], data = [none] Map<String, Object> sessionAttributes = asi.getSessionAttributes(); if (sessionAttributes != null) { setSessionAttributes(sessionAttributes); // depends on control dependency: [if], data = [(sessionAttributes] } propertyChangeSupport.firePropertyChange(SESSION_ATTRIBUTES, null, sessionAttributes); // depends on control dependency: [if], data = [none] } } }
public class class_name { public String readUntil(char c) throws IOException { if (lookaheadChar == UNDEFINED) { lookaheadChar = super.read(); } line.clear(); // reuse while (lookaheadChar != c && lookaheadChar != END_OF_STREAM) { line.append((char) lookaheadChar); if (lookaheadChar == '\n') { lineCounter++; } lastChar = lookaheadChar; lookaheadChar = super.read(); } return line.toString(); } }
public class class_name { public String readUntil(char c) throws IOException { if (lookaheadChar == UNDEFINED) { lookaheadChar = super.read(); } line.clear(); // reuse while (lookaheadChar != c && lookaheadChar != END_OF_STREAM) { line.append((char) lookaheadChar); if (lookaheadChar == '\n') { lineCounter++; // depends on control dependency: [if], data = [none] } lastChar = lookaheadChar; lookaheadChar = super.read(); } return line.toString(); } }
public class class_name { protected void addCancelButton() { if (m_editorDialog != null) { m_cancelButton = new CmsPushButton(); m_cancelButton.setText(Messages.get().key(Messages.GUI_BUTTON_CANCEL_TEXT_0)); m_cancelButton.setUseMinWidth(true); m_cancelButton.setButtonStyle(ButtonStyle.TEXT, ButtonColor.BLUE); m_cancelButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { cancelEdit(); } }); m_editorDialog.addButton(m_cancelButton); } } }
public class class_name { protected void addCancelButton() { if (m_editorDialog != null) { m_cancelButton = new CmsPushButton(); // depends on control dependency: [if], data = [none] m_cancelButton.setText(Messages.get().key(Messages.GUI_BUTTON_CANCEL_TEXT_0)); // depends on control dependency: [if], data = [none] m_cancelButton.setUseMinWidth(true); // depends on control dependency: [if], data = [none] m_cancelButton.setButtonStyle(ButtonStyle.TEXT, ButtonColor.BLUE); // depends on control dependency: [if], data = [none] m_cancelButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { cancelEdit(); } }); // depends on control dependency: [if], data = [none] m_editorDialog.addButton(m_cancelButton); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { filterChain.doFilter(servletRequest, new HttpServletResponseWrapper((HttpServletResponse) servletResponse) { @Override public void setHeader(String name, String value) { if (!HTTPCacheHeader.ETAG.getName().equalsIgnoreCase(name)) { super.setHeader(name, value); } } }); } }
public class class_name { @Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { filterChain.doFilter(servletRequest, new HttpServletResponseWrapper((HttpServletResponse) servletResponse) { @Override public void setHeader(String name, String value) { if (!HTTPCacheHeader.ETAG.getName().equalsIgnoreCase(name)) { super.setHeader(name, value); // depends on control dependency: [if], data = [none] } } }); } }
public class class_name { public boolean isAccessible(@Nonnull JavaModelElement e) { if (!(e instanceof JavaMethodParameterElement) && !isAccessibleByModifier(e.getDeclaringElement())) { return false; } JavaModelElement parent = e.getParent(); if (e instanceof JavaTypeElement) { return ((JavaTypeElement) e).isInAPI() && (parent == null || _isAccessible(parent)); } else { assert parent != null; return isAccessible(parent); } } }
public class class_name { public boolean isAccessible(@Nonnull JavaModelElement e) { if (!(e instanceof JavaMethodParameterElement) && !isAccessibleByModifier(e.getDeclaringElement())) { return false; // depends on control dependency: [if], data = [none] } JavaModelElement parent = e.getParent(); if (e instanceof JavaTypeElement) { return ((JavaTypeElement) e).isInAPI() && (parent == null || _isAccessible(parent)); // depends on control dependency: [if], data = [none] } else { assert parent != null; return isAccessible(parent); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static <E> Apply<E> buildAst(List<Expression<E>> rpn) { if (rpn.isEmpty()) { return null; } Stack<Apply<E>> stack = new Stack<Apply<E>>(); for (Expression<E> tok : rpn) { if (tok instanceof Arg<?>) { stack.push((Arg<E>) tok); } else if (tok instanceof Op<?>) { try { if (tok instanceof Op.Mon<?>){ Apply<E> sub = stack.pop(); Op.Mon<E> mon = (Op.Mon<E>) tok; mon.sub = sub; stack.push(mon); } if (tok instanceof Op.Bin<?>) { Apply<E> arg2 = stack.pop(); Apply<E> arg1 = stack.pop(); Op.Bin<E> bin = (Op.Bin<E>) tok; bin.left = arg1; bin.right = arg2; stack.push(bin); } } catch (EmptyStackException e) { throw new CompileLogicException( "No argument for operator (stack empty): " + tok.toString()); } } } if (stack.size() > 1) { throw new ApplyLogicException( "Stack has multiple elements after apply: " + stack.toString()); } if (stack.size() == 0) { throw new ApplyLogicException( "Stack has zero elements after apply."); } if (!(stack.peek() instanceof Apply<?>)) { throw new ApplyLogicException( "Stack contains non-appliable tokens after apply: " + stack.toString()); } return (stack.pop()); } }
public class class_name { public static <E> Apply<E> buildAst(List<Expression<E>> rpn) { if (rpn.isEmpty()) { return null; // depends on control dependency: [if], data = [none] } Stack<Apply<E>> stack = new Stack<Apply<E>>(); for (Expression<E> tok : rpn) { if (tok instanceof Arg<?>) { stack.push((Arg<E>) tok); // depends on control dependency: [if], data = [)] } else if (tok instanceof Op<?>) { try { if (tok instanceof Op.Mon<?>){ Apply<E> sub = stack.pop(); Op.Mon<E> mon = (Op.Mon<E>) tok; mon.sub = sub; // depends on control dependency: [if], data = [none] stack.push(mon); // depends on control dependency: [if], data = [)] } if (tok instanceof Op.Bin<?>) { Apply<E> arg2 = stack.pop(); Apply<E> arg1 = stack.pop(); Op.Bin<E> bin = (Op.Bin<E>) tok; bin.left = arg1; // depends on control dependency: [if], data = [none] bin.right = arg2; // depends on control dependency: [if], data = [none] stack.push(bin); // depends on control dependency: [if], data = [)] } } catch (EmptyStackException e) { throw new CompileLogicException( "No argument for operator (stack empty): " + tok.toString()); } // depends on control dependency: [catch], data = [none] } } if (stack.size() > 1) { throw new ApplyLogicException( "Stack has multiple elements after apply: " + stack.toString()); } if (stack.size() == 0) { throw new ApplyLogicException( "Stack has zero elements after apply."); } if (!(stack.peek() instanceof Apply<?>)) { throw new ApplyLogicException( "Stack contains non-appliable tokens after apply: " + stack.toString()); } return (stack.pop()); } }
public class class_name { public static <K1, V1, K2, V2> ImmutableMap<K2, V2> copyWithTransformedEntries(Map<K1, V1> input, Function<? super K1, K2> keyInjection, Function<? super V1, V2> valueFunction) { final ImmutableMap.Builder<K2, V2> ret = ImmutableMap.builder(); for (final Map.Entry<K1, V1> entry : input.entrySet()) { ret.put(keyInjection.apply(entry.getKey()), valueFunction.apply(entry.getValue())); } return ret.build(); } }
public class class_name { public static <K1, V1, K2, V2> ImmutableMap<K2, V2> copyWithTransformedEntries(Map<K1, V1> input, Function<? super K1, K2> keyInjection, Function<? super V1, V2> valueFunction) { final ImmutableMap.Builder<K2, V2> ret = ImmutableMap.builder(); for (final Map.Entry<K1, V1> entry : input.entrySet()) { ret.put(keyInjection.apply(entry.getKey()), valueFunction.apply(entry.getValue())); // depends on control dependency: [for], data = [entry] } return ret.build(); } }
public class class_name { protected Action processVariables(Action origAction, Event cause) { final ActionResource newAction = new ActionResource(); final Map<UUID, String> newParameters = new HashMap<>(); newAction.setAppliesToActionDefinition(origAction.getAppliesToActionDefinition()); for (UUID key : origAction.getAttributes().keySet()) { newParameters.put(key, processVariables(origAction.getAttributes().get(key), cause)); } newAction.setParameters(newParameters); return newAction; } }
public class class_name { protected Action processVariables(Action origAction, Event cause) { final ActionResource newAction = new ActionResource(); final Map<UUID, String> newParameters = new HashMap<>(); newAction.setAppliesToActionDefinition(origAction.getAppliesToActionDefinition()); for (UUID key : origAction.getAttributes().keySet()) { newParameters.put(key, processVariables(origAction.getAttributes().get(key), cause)); // depends on control dependency: [for], data = [key] } newAction.setParameters(newParameters); return newAction; } }
public class class_name { @Override public void messageReceived(NextFilter nextFilter, IoSession session, Object message) throws Exception { LOGGER.debug("Processing a MESSAGE_RECEIVED for session {}", session.getId()); if (!(message instanceof IoBuffer)) { nextFilter.messageReceived(session, message); return; } IoBuffer in = (IoBuffer) message; ProtocolDecoder decoder = getDecoder(session); ProtocolDecoderOutput decoderOut = getDecoderOut(session, nextFilter); IoSessionEx sessionEx = (IoSessionEx)session; Thread ioThread = sessionEx.getIoThread(); // Loop until we don't have anymore byte in the buffer, // or until the decoder throws an unrecoverable exception or // can't decoder a message, because there are not enough // data in the buffer // Note: break out to let old I/O thread unwind after deregistering while (in.hasRemaining()) { // If the session is realigned, let the new thread deal with the decoding if (sessionEx.getIoThread() != ioThread) { if (LOGGER.isTraceEnabled()) { LOGGER.trace(format("Decoding for session=%s will be continued by new thread=%s old thread=%s", session, sessionEx.getIoThread(), ioThread)); } break; } int oldPos = in.position(); try { synchronized (decoderOut) { // Call the decoder with the read bytes decoder.decode(session, in, decoderOut); // Finish decoding if no exception was thrown. decoderOut.flush(nextFilter, session); } } catch (Throwable t) { ProtocolDecoderException pde; if (t instanceof ProtocolDecoderException) { pde = (ProtocolDecoderException) t; } else { pde = new ProtocolDecoderException(t); } if (pde.getHexdump() == null) { // Generate a message hex dump int curPos = in.position(); in.position(oldPos); pde.setHexdump(in.getHexDump()); in.position(curPos); } // Fire the exceptionCaught event. synchronized (decoderOut) { decoderOut.flush(nextFilter, session); } nextFilter.exceptionCaught(session, pde); // Retry only if the type of the caught exception is // recoverable and the buffer position has changed. // We check buffer position additionally to prevent an // infinite loop. if (!(t instanceof RecoverableProtocolDecoderException) || (in.position() == oldPos)) { break; } } } } }
public class class_name { @Override public void messageReceived(NextFilter nextFilter, IoSession session, Object message) throws Exception { LOGGER.debug("Processing a MESSAGE_RECEIVED for session {}", session.getId()); if (!(message instanceof IoBuffer)) { nextFilter.messageReceived(session, message); return; } IoBuffer in = (IoBuffer) message; ProtocolDecoder decoder = getDecoder(session); ProtocolDecoderOutput decoderOut = getDecoderOut(session, nextFilter); IoSessionEx sessionEx = (IoSessionEx)session; Thread ioThread = sessionEx.getIoThread(); // Loop until we don't have anymore byte in the buffer, // or until the decoder throws an unrecoverable exception or // can't decoder a message, because there are not enough // data in the buffer // Note: break out to let old I/O thread unwind after deregistering while (in.hasRemaining()) { // If the session is realigned, let the new thread deal with the decoding if (sessionEx.getIoThread() != ioThread) { if (LOGGER.isTraceEnabled()) { LOGGER.trace(format("Decoding for session=%s will be continued by new thread=%s old thread=%s", session, sessionEx.getIoThread(), ioThread)); // depends on control dependency: [if], data = [none] } break; } int oldPos = in.position(); try { synchronized (decoderOut) { // Call the decoder with the read bytes decoder.decode(session, in, decoderOut); // Finish decoding if no exception was thrown. decoderOut.flush(nextFilter, session); } } catch (Throwable t) { ProtocolDecoderException pde; if (t instanceof ProtocolDecoderException) { pde = (ProtocolDecoderException) t; // depends on control dependency: [if], data = [none] } else { pde = new ProtocolDecoderException(t); // depends on control dependency: [if], data = [none] } if (pde.getHexdump() == null) { // Generate a message hex dump int curPos = in.position(); in.position(oldPos); // depends on control dependency: [if], data = [none] pde.setHexdump(in.getHexDump()); // depends on control dependency: [if], data = [none] in.position(curPos); // depends on control dependency: [if], data = [none] } // Fire the exceptionCaught event. synchronized (decoderOut) { decoderOut.flush(nextFilter, session); } nextFilter.exceptionCaught(session, pde); // Retry only if the type of the caught exception is // recoverable and the buffer position has changed. // We check buffer position additionally to prevent an // infinite loop. if (!(t instanceof RecoverableProtocolDecoderException) || (in.position() == oldPos)) { break; } } } } }
public class class_name { protected void setFieldNameValueSeparator(String fieldNameValueSeparator) { if (fieldNameValueSeparator == null) { fieldNameValueSeparator = StringUtils.EMPTY; } this.fieldNameValueSeparator = fieldNameValueSeparator; } }
public class class_name { protected void setFieldNameValueSeparator(String fieldNameValueSeparator) { if (fieldNameValueSeparator == null) { fieldNameValueSeparator = StringUtils.EMPTY; // depends on control dependency: [if], data = [none] } this.fieldNameValueSeparator = fieldNameValueSeparator; } }
public class class_name { @Override public CPDefinitionLocalization fetchByCPDefinitionId_Last( long CPDefinitionId, OrderByComparator<CPDefinitionLocalization> orderByComparator) { int count = countByCPDefinitionId(CPDefinitionId); if (count == 0) { return null; } List<CPDefinitionLocalization> list = findByCPDefinitionId(CPDefinitionId, count - 1, count, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } }
public class class_name { @Override public CPDefinitionLocalization fetchByCPDefinitionId_Last( long CPDefinitionId, OrderByComparator<CPDefinitionLocalization> orderByComparator) { int count = countByCPDefinitionId(CPDefinitionId); if (count == 0) { return null; // depends on control dependency: [if], data = [none] } List<CPDefinitionLocalization> list = findByCPDefinitionId(CPDefinitionId, count - 1, count, orderByComparator); if (!list.isEmpty()) { return list.get(0); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public void releaseWakeLock() { if(mWakeLock != null && mWakeLock.isHeld()) { mWakeLock.release(); mWakeLock = null; Log.d(mTag, "Wake lock released"); } } }
public class class_name { public void releaseWakeLock() { if(mWakeLock != null && mWakeLock.isHeld()) { mWakeLock.release(); // depends on control dependency: [if], data = [none] mWakeLock = null; // depends on control dependency: [if], data = [none] Log.d(mTag, "Wake lock released"); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void addCreatedSplit(List<InputSplit> splitList, List<String> locations, ArrayList<OneBlockInfo> validBlocks) { // create an input split Path[] fl = new Path[validBlocks.size()]; long[] offset = new long[validBlocks.size()]; long[] length = new long[validBlocks.size()]; for (int i = 0; i < validBlocks.size(); i++) { fl[i] = validBlocks.get(i).onepath; offset[i] = validBlocks.get(i).offset; length[i] = validBlocks.get(i).length; } // add this split to the list that is returned CombineFileSplit thissplit = new CombineFileSplit(fl, offset, length, locations.toArray(new String[0])); splitList.add(thissplit); } }
public class class_name { private void addCreatedSplit(List<InputSplit> splitList, List<String> locations, ArrayList<OneBlockInfo> validBlocks) { // create an input split Path[] fl = new Path[validBlocks.size()]; long[] offset = new long[validBlocks.size()]; long[] length = new long[validBlocks.size()]; for (int i = 0; i < validBlocks.size(); i++) { fl[i] = validBlocks.get(i).onepath; // depends on control dependency: [for], data = [i] offset[i] = validBlocks.get(i).offset; // depends on control dependency: [for], data = [i] length[i] = validBlocks.get(i).length; // depends on control dependency: [for], data = [i] } // add this split to the list that is returned CombineFileSplit thissplit = new CombineFileSplit(fl, offset, length, locations.toArray(new String[0])); splitList.add(thissplit); } }
public class class_name { public void setCredentials(@Nonnull List<ServiceClientCredentials> credentials) { credentialsProvider.clear(); for (final ServiceClientCredentials cred : credentials) { final URI uri = cred.getBaseUri(); credentialsProvider.setCredentials(new AuthScope( new HttpHost(uri.getHost(), uri.getPort(), uri.getScheme())), new UsernamePasswordCredentials(cred.getUsername(), cred.getPassword().toString())); } } }
public class class_name { public void setCredentials(@Nonnull List<ServiceClientCredentials> credentials) { credentialsProvider.clear(); for (final ServiceClientCredentials cred : credentials) { final URI uri = cred.getBaseUri(); credentialsProvider.setCredentials(new AuthScope( new HttpHost(uri.getHost(), uri.getPort(), uri.getScheme())), new UsernamePasswordCredentials(cred.getUsername(), cred.getPassword().toString())); // depends on control dependency: [for], data = [cred] } } }
public class class_name { public static List<ExecutionEntity> orderFromRootToLeaf(Collection<ExecutionEntity> executions) { List<ExecutionEntity> orderedList = new ArrayList<ExecutionEntity>(executions.size()); // Root elements HashSet<String> previousIds = new HashSet<String>(); for (ExecutionEntity execution : executions) { if (execution.getParentId() == null) { orderedList.add(execution); previousIds.add(execution.getId()); } } // Non-root elements while (orderedList.size() < executions.size()) { for (ExecutionEntity execution : executions) { if (!previousIds.contains(execution.getId()) && previousIds.contains(execution.getParentId())) { orderedList.add(execution); previousIds.add(execution.getId()); } } } return orderedList; } }
public class class_name { public static List<ExecutionEntity> orderFromRootToLeaf(Collection<ExecutionEntity> executions) { List<ExecutionEntity> orderedList = new ArrayList<ExecutionEntity>(executions.size()); // Root elements HashSet<String> previousIds = new HashSet<String>(); for (ExecutionEntity execution : executions) { if (execution.getParentId() == null) { orderedList.add(execution); // depends on control dependency: [if], data = [none] previousIds.add(execution.getId()); // depends on control dependency: [if], data = [none] } } // Non-root elements while (orderedList.size() < executions.size()) { for (ExecutionEntity execution : executions) { if (!previousIds.contains(execution.getId()) && previousIds.contains(execution.getParentId())) { orderedList.add(execution); // depends on control dependency: [if], data = [none] previousIds.add(execution.getId()); // depends on control dependency: [if], data = [none] } } } return orderedList; } }
public class class_name { @Override public List<WorkUnit> getWorkunits(SourceState state) { List<WorkUnit> workUnits = Lists.newArrayList(); Config config = ConfigUtils.propertiesToConfig(state.getProperties()); Config sourceConfig = ConfigUtils.getConfigOrEmpty(config, DATASET_CLEANER_SOURCE_PREFIX); List<String> configurationNames = ConfigUtils.getStringList(config, DATASET_CLEANER_CONFIGURATIONS); // use a dummy configuration name if none set if (configurationNames.isEmpty()) { configurationNames = ImmutableList.of("DummyConfig"); } for (String configurationName: configurationNames) { WorkUnit workUnit = WorkUnit.createEmpty(); // specific configuration prefixed by the configuration name has precedence over the source specific configuration // and the source specific configuration has precedence over the general configuration Config wuConfig = ConfigUtils.getConfigOrEmpty(sourceConfig, configurationName).withFallback(sourceConfig) .withFallback(config); workUnit.setProps(ConfigUtils.configToProperties(wuConfig), new Properties()); TaskUtils.setTaskFactoryClass(workUnit, DatasetCleanerTaskFactory.class); workUnits.add(workUnit); } return workUnits; } }
public class class_name { @Override public List<WorkUnit> getWorkunits(SourceState state) { List<WorkUnit> workUnits = Lists.newArrayList(); Config config = ConfigUtils.propertiesToConfig(state.getProperties()); Config sourceConfig = ConfigUtils.getConfigOrEmpty(config, DATASET_CLEANER_SOURCE_PREFIX); List<String> configurationNames = ConfigUtils.getStringList(config, DATASET_CLEANER_CONFIGURATIONS); // use a dummy configuration name if none set if (configurationNames.isEmpty()) { configurationNames = ImmutableList.of("DummyConfig"); // depends on control dependency: [if], data = [none] } for (String configurationName: configurationNames) { WorkUnit workUnit = WorkUnit.createEmpty(); // specific configuration prefixed by the configuration name has precedence over the source specific configuration // and the source specific configuration has precedence over the general configuration Config wuConfig = ConfigUtils.getConfigOrEmpty(sourceConfig, configurationName).withFallback(sourceConfig) .withFallback(config); workUnit.setProps(ConfigUtils.configToProperties(wuConfig), new Properties()); // depends on control dependency: [for], data = [none] TaskUtils.setTaskFactoryClass(workUnit, DatasetCleanerTaskFactory.class); // depends on control dependency: [for], data = [none] workUnits.add(workUnit); // depends on control dependency: [for], data = [none] } return workUnits; } }
public class class_name { public static void createIfNotExists( CuratorFramework curatorFramework, String path, CreateMode mode, byte[] rawBytes, int maxZnodeBytes ) throws Exception { verifySize(path, rawBytes, maxZnodeBytes); if (curatorFramework.checkExists().forPath(path) == null) { try { curatorFramework.create() .creatingParentsIfNeeded() .withMode(mode) .forPath(path, rawBytes); } catch (KeeperException.NodeExistsException e) { log.info("Skipping create path[%s], since it already exists.", path); } } } }
public class class_name { public static void createIfNotExists( CuratorFramework curatorFramework, String path, CreateMode mode, byte[] rawBytes, int maxZnodeBytes ) throws Exception { verifySize(path, rawBytes, maxZnodeBytes); if (curatorFramework.checkExists().forPath(path) == null) { try { curatorFramework.create() .creatingParentsIfNeeded() .withMode(mode) .forPath(path, rawBytes); // depends on control dependency: [try], data = [none] } catch (KeeperException.NodeExistsException e) { log.info("Skipping create path[%s], since it already exists.", path); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public void highlight(Object control) { // Manage highlighting of controls. if (this.currentControl == control) return; // same thing selected // Turn off highlight if on. if (this.currentControl != null) { this.currentControl.getAttributes().setImageOpacity(-1); // use default opacity this.currentControl = null; } // Turn on highlight if object selected. if (control != null && control instanceof ScreenAnnotation) { this.currentControl = (ScreenAnnotation) control; this.currentControl.getAttributes().setImageOpacity(1); } } }
public class class_name { public void highlight(Object control) { // Manage highlighting of controls. if (this.currentControl == control) return; // same thing selected // Turn off highlight if on. if (this.currentControl != null) { this.currentControl.getAttributes().setImageOpacity(-1); // use default opacity // depends on control dependency: [if], data = [none] this.currentControl = null; // depends on control dependency: [if], data = [none] } // Turn on highlight if object selected. if (control != null && control instanceof ScreenAnnotation) { this.currentControl = (ScreenAnnotation) control; // depends on control dependency: [if], data = [none] this.currentControl.getAttributes().setImageOpacity(1); // depends on control dependency: [if], data = [none] } } }
public class class_name { public String getEffectiveConstructorScope() { if ("smart".equals(constructorScope)) { return isTypeFinal() ? "private " : "protected "; } else if ("package".equals(constructorScope)) { return ""; } else if ("public@ConstructorProperties".equals(constructorScope)) { return "public "; } return constructorScope + " "; } }
public class class_name { public String getEffectiveConstructorScope() { if ("smart".equals(constructorScope)) { return isTypeFinal() ? "private " : "protected "; // depends on control dependency: [if], data = [none] } else if ("package".equals(constructorScope)) { return ""; // depends on control dependency: [if], data = [none] } else if ("public@ConstructorProperties".equals(constructorScope)) { return "public "; // depends on control dependency: [if], data = [none] } return constructorScope + " "; } }
public class class_name { public UpdateNFSFileShareRequest withClientList(String... clientList) { if (this.clientList == null) { setClientList(new com.amazonaws.internal.SdkInternalList<String>(clientList.length)); } for (String ele : clientList) { this.clientList.add(ele); } return this; } }
public class class_name { public UpdateNFSFileShareRequest withClientList(String... clientList) { if (this.clientList == null) { setClientList(new com.amazonaws.internal.SdkInternalList<String>(clientList.length)); // depends on control dependency: [if], data = [none] } for (String ele : clientList) { this.clientList.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public C fillLockMutation(MutationBatch m, Long time, Integer ttl) { if (lockColumn != null) { if (!lockColumn.equals(columnStrategy.generateLockColumn())) throw new IllegalStateException("Can't change prefix or lockId after acquiring the lock"); } else { lockColumn = columnStrategy.generateLockColumn(); } Long timeoutValue = (time == null) ? new Long(0) : time + TimeUnit.MICROSECONDS.convert(timeout, timeoutUnits); m.withRow(columnFamily, key).putColumn(lockColumn, generateTimeoutValue(timeoutValue), ttl); return lockColumn; } }
public class class_name { public C fillLockMutation(MutationBatch m, Long time, Integer ttl) { if (lockColumn != null) { if (!lockColumn.equals(columnStrategy.generateLockColumn())) throw new IllegalStateException("Can't change prefix or lockId after acquiring the lock"); } else { lockColumn = columnStrategy.generateLockColumn(); // depends on control dependency: [if], data = [none] } Long timeoutValue = (time == null) ? new Long(0) : time + TimeUnit.MICROSECONDS.convert(timeout, timeoutUnits); m.withRow(columnFamily, key).putColumn(lockColumn, generateTimeoutValue(timeoutValue), ttl); return lockColumn; } }
public class class_name { static boolean less(int i, int j, IAtom[] atoms, Point2d center) { Point2d a = atoms[i].getPoint2d(); Point2d b = atoms[j].getPoint2d(); if (a.x - center.x >= 0 && b.x - center.x < 0) return true; if (a.x - center.x < 0 && b.x - center.x >= 0) return false; if (a.x - center.x == 0 && b.x - center.x == 0) { if (a.y - center.y >= 0 || b.y - center.y >= 0) return a.y > b.y; return b.y > a.y; } // compute the cross product of vectors (center -> a) x (center -> b) double det = (a.x - center.x) * (b.y - center.y) - (b.x - center.x) * (a.y - center.y); if (det < 0) return true; if (det > 0) return false; // points a and b are on the same line from the center // check which point is closer to the center double d1 = (a.x - center.x) * (a.x - center.x) + (a.y - center.y) * (a.y - center.y); double d2 = (b.x - center.x) * (b.x - center.x) + (b.y - center.y) * (b.y - center.y); return d1 > d2; } }
public class class_name { static boolean less(int i, int j, IAtom[] atoms, Point2d center) { Point2d a = atoms[i].getPoint2d(); Point2d b = atoms[j].getPoint2d(); if (a.x - center.x >= 0 && b.x - center.x < 0) return true; if (a.x - center.x < 0 && b.x - center.x >= 0) return false; if (a.x - center.x == 0 && b.x - center.x == 0) { if (a.y - center.y >= 0 || b.y - center.y >= 0) return a.y > b.y; return b.y > a.y; // depends on control dependency: [if], data = [none] } // compute the cross product of vectors (center -> a) x (center -> b) double det = (a.x - center.x) * (b.y - center.y) - (b.x - center.x) * (a.y - center.y); if (det < 0) return true; if (det > 0) return false; // points a and b are on the same line from the center // check which point is closer to the center double d1 = (a.x - center.x) * (a.x - center.x) + (a.y - center.y) * (a.y - center.y); double d2 = (b.x - center.x) * (b.x - center.x) + (b.y - center.y) * (b.y - center.y); return d1 > d2; } }
public class class_name { public ApplicationDefinition refreshSchema() { try { // Send a GET request to "/_applications/{application} StringBuilder uri = new StringBuilder("/_applications/"); uri.append(Utils.urlEncode(m_appDef.getAppName())); RESTResponse response = m_restClient.sendRequest(HttpMethod.GET, uri.toString()); m_logger.debug("listApplication() response: {}", response.toString()); throwIfErrorResponse(response); m_appDef.parse(getUNodeResult(response)); return m_appDef; } catch (Exception e) { throw new RuntimeException(e); } } }
public class class_name { public ApplicationDefinition refreshSchema() { try { // Send a GET request to "/_applications/{application} StringBuilder uri = new StringBuilder("/_applications/"); uri.append(Utils.urlEncode(m_appDef.getAppName())); // depends on control dependency: [try], data = [none] RESTResponse response = m_restClient.sendRequest(HttpMethod.GET, uri.toString()); m_logger.debug("listApplication() response: {}", response.toString()); // depends on control dependency: [try], data = [none] throwIfErrorResponse(response); // depends on control dependency: [try], data = [none] m_appDef.parse(getUNodeResult(response)); // depends on control dependency: [try], data = [none] return m_appDef; // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void validate(Object submittedValue, VariableMap submittedValues, FormFieldHandler formFieldHandler, VariableScope variableScope) { try { FormFieldValidatorContext context = new DefaultFormFieldValidatorContext(variableScope, config, submittedValues, formFieldHandler); if(!validator.validate(submittedValue, context)) { throw new FormFieldValidatorException(formFieldHandler.getId(), name, config, submittedValue, "Invalid value submitted for form field '"+formFieldHandler.getId()+"': validation of "+this+" failed."); } } catch(FormFieldValidationException e) { throw new FormFieldValidatorException(formFieldHandler.getId(), name, config, submittedValue, "Invalid value submitted for form field '"+formFieldHandler.getId()+"': validation of "+this+" failed.", e); } } }
public class class_name { public void validate(Object submittedValue, VariableMap submittedValues, FormFieldHandler formFieldHandler, VariableScope variableScope) { try { FormFieldValidatorContext context = new DefaultFormFieldValidatorContext(variableScope, config, submittedValues, formFieldHandler); if(!validator.validate(submittedValue, context)) { throw new FormFieldValidatorException(formFieldHandler.getId(), name, config, submittedValue, "Invalid value submitted for form field '"+formFieldHandler.getId()+"': validation of "+this+" failed."); } } catch(FormFieldValidationException e) { throw new FormFieldValidatorException(formFieldHandler.getId(), name, config, submittedValue, "Invalid value submitted for form field '"+formFieldHandler.getId()+"': validation of "+this+" failed.", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public void onStageTransition(JobExecutionState state, String previousStage, String newStage) { if (this.filter.apply(state.getJobSpec())) { this.delegate.onStageTransition(state, previousStage, newStage); } } }
public class class_name { @Override public void onStageTransition(JobExecutionState state, String previousStage, String newStage) { if (this.filter.apply(state.getJobSpec())) { this.delegate.onStageTransition(state, previousStage, newStage); // depends on control dependency: [if], data = [none] } } }
public class class_name { public boolean apply(final Class<?> type, final Object value, final List<ValidationFailure> validationFailures) { if (getRequiredValueType().isAssignableFrom(value.getClass())) { validate(type, value, validationFailures); return true; } return false; } }
public class class_name { public boolean apply(final Class<?> type, final Object value, final List<ValidationFailure> validationFailures) { if (getRequiredValueType().isAssignableFrom(value.getClass())) { validate(type, value, validationFailures); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { private Region findRegion() { boolean regionProvided = !Validator.isBlank(this.region); if(!regionProvided) { // Determine region from where application is running, or fall back to default region Region currentRegion = Regions.getCurrentRegion(); if(currentRegion != null) { return currentRegion; } return Region.getRegion(Regions.fromName(AppenderConstants.DEFAULT_REGION)); } return Region.getRegion(Regions.fromName(this.region)); } }
public class class_name { private Region findRegion() { boolean regionProvided = !Validator.isBlank(this.region); if(!regionProvided) { // Determine region from where application is running, or fall back to default region Region currentRegion = Regions.getCurrentRegion(); if(currentRegion != null) { return currentRegion; // depends on control dependency: [if], data = [none] } return Region.getRegion(Regions.fromName(AppenderConstants.DEFAULT_REGION)); // depends on control dependency: [if], data = [none] } return Region.getRegion(Regions.fromName(this.region)); } }
public class class_name { protected void resetStickyFooterSelection() { if (mStickyFooterView instanceof LinearLayout) { for (int i = 0; i < (mStickyFooterView).getChildCount(); i++) { (mStickyFooterView).getChildAt(i).setActivated(false); (mStickyFooterView).getChildAt(i).setSelected(false); } } } }
public class class_name { protected void resetStickyFooterSelection() { if (mStickyFooterView instanceof LinearLayout) { for (int i = 0; i < (mStickyFooterView).getChildCount(); i++) { (mStickyFooterView).getChildAt(i).setActivated(false); // depends on control dependency: [for], data = [i] (mStickyFooterView).getChildAt(i).setSelected(false); // depends on control dependency: [for], data = [i] } } } }
public class class_name { @Async public Future<ImmutableSet<MarketplaceEntry>> loadMarketplaceEntriesFor( final IPerson user, final Set<PortletCategory> categories) { final IAuthorizationPrincipal principal = AuthorizationPrincipalHelper.principalFromUser(user); List<IPortletDefinition> allDisplayablePortletDefinitions = this.portletDefinitionRegistry.getAllPortletDefinitions(); if (!categories.isEmpty()) { // Indicates we plan to restrict portlets displayed in the Portlet // Marketplace to those that belong to one or more specified groups. Element portletDefinitionsElement = marketplaceCategoryCache.get(categories); if (portletDefinitionsElement == null) { /* * Collection not in cache -- need to recreate it */ // Gather the complete collection of allowable categories (specified categories & // their descendants) final Set<PortletCategory> allSpecifiedAndDecendantCategories = new HashSet<>(); for (PortletCategory pc : categories) { collectSpecifiedAndDescendantCategories(pc, allSpecifiedAndDecendantCategories); } // Filter portlets that match the criteria Set<IPortletDefinition> filteredPortletDefinitions = new HashSet<>(); for (final IPortletDefinition portletDefinition : allDisplayablePortletDefinitions) { final Set<PortletCategory> parents = portletCategoryRegistry.getParentCategories(portletDefinition); for (final PortletCategory parent : parents) { if (allSpecifiedAndDecendantCategories.contains(parent)) { filteredPortletDefinitions.add(portletDefinition); break; } } } portletDefinitionsElement = new Element(categories, new ArrayList<>(filteredPortletDefinitions)); marketplaceCategoryCache.put(portletDefinitionsElement); } allDisplayablePortletDefinitions = (List<IPortletDefinition>) portletDefinitionsElement.getObjectValue(); } final Set<MarketplaceEntry> visiblePortletDefinitions = new HashSet<>(); for (final IPortletDefinition portletDefinition : allDisplayablePortletDefinitions) { if (mayBrowsePortlet(principal, portletDefinition)) { final MarketplacePortletDefinition marketplacePortletDefinition = getOrCreateMarketplacePortletDefinition(portletDefinition); final MarketplaceEntry entry = new MarketplaceEntry(marketplacePortletDefinition, user); // flag whether this use can add the portlet... boolean canAdd = mayAddPortlet(user, portletDefinition); entry.setCanAdd(canAdd); visiblePortletDefinitions.add(entry); } } logger.trace( "These portlet definitions {} are browseable by {}.", visiblePortletDefinitions, user); Future<ImmutableSet<MarketplaceEntry>> result = new AsyncResult<>(ImmutableSet.copyOf(visiblePortletDefinitions)); Element cacheElement = new Element(user.getUserName(), result); marketplaceUserPortletDefinitionCache.put(cacheElement); return result; } }
public class class_name { @Async public Future<ImmutableSet<MarketplaceEntry>> loadMarketplaceEntriesFor( final IPerson user, final Set<PortletCategory> categories) { final IAuthorizationPrincipal principal = AuthorizationPrincipalHelper.principalFromUser(user); List<IPortletDefinition> allDisplayablePortletDefinitions = this.portletDefinitionRegistry.getAllPortletDefinitions(); if (!categories.isEmpty()) { // Indicates we plan to restrict portlets displayed in the Portlet // Marketplace to those that belong to one or more specified groups. Element portletDefinitionsElement = marketplaceCategoryCache.get(categories); if (portletDefinitionsElement == null) { /* * Collection not in cache -- need to recreate it */ // Gather the complete collection of allowable categories (specified categories & // their descendants) final Set<PortletCategory> allSpecifiedAndDecendantCategories = new HashSet<>(); for (PortletCategory pc : categories) { collectSpecifiedAndDescendantCategories(pc, allSpecifiedAndDecendantCategories); // depends on control dependency: [for], data = [pc] } // Filter portlets that match the criteria Set<IPortletDefinition> filteredPortletDefinitions = new HashSet<>(); for (final IPortletDefinition portletDefinition : allDisplayablePortletDefinitions) { final Set<PortletCategory> parents = portletCategoryRegistry.getParentCategories(portletDefinition); for (final PortletCategory parent : parents) { if (allSpecifiedAndDecendantCategories.contains(parent)) { filteredPortletDefinitions.add(portletDefinition); // depends on control dependency: [if], data = [none] break; } } } portletDefinitionsElement = new Element(categories, new ArrayList<>(filteredPortletDefinitions)); // depends on control dependency: [if], data = [none] marketplaceCategoryCache.put(portletDefinitionsElement); // depends on control dependency: [if], data = [(portletDefinitionsElement] } allDisplayablePortletDefinitions = (List<IPortletDefinition>) portletDefinitionsElement.getObjectValue(); // depends on control dependency: [if], data = [none] } final Set<MarketplaceEntry> visiblePortletDefinitions = new HashSet<>(); for (final IPortletDefinition portletDefinition : allDisplayablePortletDefinitions) { if (mayBrowsePortlet(principal, portletDefinition)) { final MarketplacePortletDefinition marketplacePortletDefinition = getOrCreateMarketplacePortletDefinition(portletDefinition); final MarketplaceEntry entry = new MarketplaceEntry(marketplacePortletDefinition, user); // flag whether this use can add the portlet... boolean canAdd = mayAddPortlet(user, portletDefinition); entry.setCanAdd(canAdd); // depends on control dependency: [if], data = [none] visiblePortletDefinitions.add(entry); // depends on control dependency: [if], data = [none] } } logger.trace( "These portlet definitions {} are browseable by {}.", visiblePortletDefinitions, user); Future<ImmutableSet<MarketplaceEntry>> result = new AsyncResult<>(ImmutableSet.copyOf(visiblePortletDefinitions)); Element cacheElement = new Element(user.getUserName(), result); marketplaceUserPortletDefinitionCache.put(cacheElement); return result; } }
public class class_name { public boolean isUnloadedAtDestination() { for (HandlingEvent event : deliveryHistory().eventsOrderedByCompletionTime()) { if (Type.UNLOAD.equals(event.getType()) && getDestination().equals(event.getLocation())) { return true; } } return false; } }
public class class_name { public boolean isUnloadedAtDestination() { for (HandlingEvent event : deliveryHistory().eventsOrderedByCompletionTime()) { if (Type.UNLOAD.equals(event.getType()) && getDestination().equals(event.getLocation())) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { @Override public IServiceReference[] getServiceReferences(String clazz, String filter) throws PlatformServicesException { final String sourceMethod = "getServiceReferences"; //$NON-NLS-1$ boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(PlatformServicesImpl.class.getName(), sourceMethod, new Object[]{clazz, filter}); } ServiceReferenceOSGi[] refs = null; try { BundleContext bundleContext = Activator.getBundleContext(); if (bundleContext != null) { ServiceReference<?>[] platformRefs = bundleContext.getServiceReferences(clazz, filter); if (platformRefs != null) { refs = new ServiceReferenceOSGi[platformRefs.length]; for (int i = 0; i < platformRefs.length; i++) { refs[i] = new ServiceReferenceOSGi(platformRefs[i]); } } } } catch (InvalidSyntaxException e) { throw new PlatformServicesException(e); } if (isTraceLogging) { log.exiting(PlatformServicesImpl.class.getName(), sourceMethod, refs != null ? Arrays.asList(new IServiceReference[refs.length]) : null); } return refs; } }
public class class_name { @Override public IServiceReference[] getServiceReferences(String clazz, String filter) throws PlatformServicesException { final String sourceMethod = "getServiceReferences"; //$NON-NLS-1$ boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(PlatformServicesImpl.class.getName(), sourceMethod, new Object[]{clazz, filter}); } ServiceReferenceOSGi[] refs = null; try { BundleContext bundleContext = Activator.getBundleContext(); if (bundleContext != null) { ServiceReference<?>[] platformRefs = bundleContext.getServiceReferences(clazz, filter); if (platformRefs != null) { refs = new ServiceReferenceOSGi[platformRefs.length]; // depends on control dependency: [if], data = [none] for (int i = 0; i < platformRefs.length; i++) { refs[i] = new ServiceReferenceOSGi(platformRefs[i]); // depends on control dependency: [for], data = [i] } } } } catch (InvalidSyntaxException e) { throw new PlatformServicesException(e); } if (isTraceLogging) { log.exiting(PlatformServicesImpl.class.getName(), sourceMethod, refs != null ? Arrays.asList(new IServiceReference[refs.length]) : null); } return refs; } }
public class class_name { private IndexType getIndexTypeFromString(String indexTypeAsString) { IndexType indexType; try { indexType = IndexType.findByValue(new Integer(indexTypeAsString)); } catch (NumberFormatException e) { try { // if this is not an integer lets try to get IndexType by name indexType = IndexType.valueOf(indexTypeAsString); } catch (IllegalArgumentException ie) { throw new RuntimeException("IndexType '" + indexTypeAsString + "' is unsupported.", ie); } } if (indexType == null) { throw new RuntimeException("IndexType '" + indexTypeAsString + "' is unsupported."); } return indexType; } }
public class class_name { private IndexType getIndexTypeFromString(String indexTypeAsString) { IndexType indexType; try { indexType = IndexType.findByValue(new Integer(indexTypeAsString)); // depends on control dependency: [try], data = [none] } catch (NumberFormatException e) { try { // if this is not an integer lets try to get IndexType by name indexType = IndexType.valueOf(indexTypeAsString); // depends on control dependency: [try], data = [none] } catch (IllegalArgumentException ie) { throw new RuntimeException("IndexType '" + indexTypeAsString + "' is unsupported.", ie); } // depends on control dependency: [catch], data = [none] } // depends on control dependency: [catch], data = [none] if (indexType == null) { throw new RuntimeException("IndexType '" + indexTypeAsString + "' is unsupported."); } return indexType; } }
public class class_name { private void sendEntireMessage(JsMessage jsMessage, List<DataSlice> messageSlices) throws UnsupportedEncodingException, MessageCopyFailedException, IncorrectMessageTypeException, MessageEncodeFailedException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "sendEntireMessage", new Object[] { jsMessage, messageSlices }); int msgLen = 0; try { CommsServerByteBuffer buffer = poolManager.allocate(); ConversationState convState = (ConversationState) conversation.getAttachment(); buffer.putShort(convState.getConnectionObjectId()); if (!mainConsumer.getUsingConnectionReceive()) { buffer.putShort(mainConsumer.getConsumerSessionId()); } // Put the message into the buffer in whatever way is suitable if (messageSlices == null) { msgLen = buffer.putMessage(jsMessage, convState.getCommsConnection(), conversation); } else { msgLen = buffer.putMessgeWithoutEncode(messageSlices); } // Decide on the segment int seg = JFapChannelConstants.SEG_RECEIVE_SESS_MSG_R; if (mainConsumer.getUsingConnectionReceive()) { seg = JFapChannelConstants.SEG_RECEIVE_CONN_MSG_R; } int jfapPriority = JFapChannelConstants.getJFAPPriority(jsMessage.getPriority()); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Sending with JFAP priority of " + jfapPriority); conversation.send(buffer, seg, requestNumber, jfapPriority, false, ThrottlingPolicy.BLOCK_THREAD, null); mainConsumer.messagesSent++; } catch (SIException e) { //No FFDC code needed //Only FFDC if we haven't received a meTerminated event. if (!((ConversationState) mainConsumer.getConversation().getAttachment()).hasMETerminated()) { FFDCFilter.processException(e, CLASS_NAME + ".sendEntireMessage", CommsConstants.CATSYNCASYNCHREADER_SEND_MSG_01, this); } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, e.getMessage(), e); SibTr.error(tc, "COMMUNICATION_ERROR_SICO2015", e); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "sendEntireMessage"); } }
public class class_name { private void sendEntireMessage(JsMessage jsMessage, List<DataSlice> messageSlices) throws UnsupportedEncodingException, MessageCopyFailedException, IncorrectMessageTypeException, MessageEncodeFailedException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "sendEntireMessage", new Object[] { jsMessage, messageSlices }); int msgLen = 0; try { CommsServerByteBuffer buffer = poolManager.allocate(); ConversationState convState = (ConversationState) conversation.getAttachment(); buffer.putShort(convState.getConnectionObjectId()); if (!mainConsumer.getUsingConnectionReceive()) { buffer.putShort(mainConsumer.getConsumerSessionId()); // depends on control dependency: [if], data = [none] } // Put the message into the buffer in whatever way is suitable if (messageSlices == null) { msgLen = buffer.putMessage(jsMessage, convState.getCommsConnection(), conversation); // depends on control dependency: [if], data = [none] } else { msgLen = buffer.putMessgeWithoutEncode(messageSlices); // depends on control dependency: [if], data = [(messageSlices] } // Decide on the segment int seg = JFapChannelConstants.SEG_RECEIVE_SESS_MSG_R; if (mainConsumer.getUsingConnectionReceive()) { seg = JFapChannelConstants.SEG_RECEIVE_CONN_MSG_R; // depends on control dependency: [if], data = [none] } int jfapPriority = JFapChannelConstants.getJFAPPriority(jsMessage.getPriority()); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Sending with JFAP priority of " + jfapPriority); conversation.send(buffer, seg, requestNumber, jfapPriority, false, ThrottlingPolicy.BLOCK_THREAD, null); mainConsumer.messagesSent++; } catch (SIException e) { //No FFDC code needed //Only FFDC if we haven't received a meTerminated event. if (!((ConversationState) mainConsumer.getConversation().getAttachment()).hasMETerminated()) { FFDCFilter.processException(e, CLASS_NAME + ".sendEntireMessage", CommsConstants.CATSYNCASYNCHREADER_SEND_MSG_01, this); // depends on control dependency: [if], data = [none] } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, e.getMessage(), e); SibTr.error(tc, "COMMUNICATION_ERROR_SICO2015", e); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "sendEntireMessage"); } }
public class class_name { synchronized public static String getOldCookieDate(long time) { if (OLD_COOKIE.getTimeZone() != GMT_TIMEZONE) { // ensure GMT is used as time zone for the header generation OLD_COOKIE.setTimeZone(GMT_TIMEZONE); } try { return OLD_COOKIE.format(new Date(time)); } catch (Throwable t) { return OLD_COOKIE.format(new Date()); } } }
public class class_name { synchronized public static String getOldCookieDate(long time) { if (OLD_COOKIE.getTimeZone() != GMT_TIMEZONE) { // ensure GMT is used as time zone for the header generation OLD_COOKIE.setTimeZone(GMT_TIMEZONE); // depends on control dependency: [if], data = [GMT_TIMEZONE)] } try { return OLD_COOKIE.format(new Date(time)); // depends on control dependency: [try], data = [none] } catch (Throwable t) { return OLD_COOKIE.format(new Date()); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void marshall(ListFleetsRequest listFleetsRequest, ProtocolMarshaller protocolMarshaller) { if (listFleetsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(listFleetsRequest.getNextToken(), NEXTTOKEN_BINDING); protocolMarshaller.marshall(listFleetsRequest.getMaxResults(), MAXRESULTS_BINDING); protocolMarshaller.marshall(listFleetsRequest.getFilters(), FILTERS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ListFleetsRequest listFleetsRequest, ProtocolMarshaller protocolMarshaller) { if (listFleetsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(listFleetsRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(listFleetsRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(listFleetsRequest.getFilters(), FILTERS_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 boolean isIdentity() { for (int i = 0; i < this.values.length; i++) { if (this.values[i] != i) { return false; } } return true; } }
public class class_name { public boolean isIdentity() { for (int i = 0; i < this.values.length; i++) { if (this.values[i] != i) { return false; // depends on control dependency: [if], data = [none] } } return true; } }
public class class_name { private static void appendAuroraCommandOptions(List<String> auroraCmd, boolean isVerbose) { // Append verbose if needed if (isVerbose) { auroraCmd.add("--verbose"); } // Append batch size. // Note that we can not use "--no-batching" since "restart" command does not accept it. // So we play a small trick here by setting batch size Integer.MAX_VALUE. auroraCmd.add("--batch-size"); auroraCmd.add(Integer.toString(Integer.MAX_VALUE)); } }
public class class_name { private static void appendAuroraCommandOptions(List<String> auroraCmd, boolean isVerbose) { // Append verbose if needed if (isVerbose) { auroraCmd.add("--verbose"); // depends on control dependency: [if], data = [none] } // Append batch size. // Note that we can not use "--no-batching" since "restart" command does not accept it. // So we play a small trick here by setting batch size Integer.MAX_VALUE. auroraCmd.add("--batch-size"); auroraCmd.add(Integer.toString(Integer.MAX_VALUE)); } }
public class class_name { private void addIndex(final Object connection, final AttributeWrapper wrapper, final String rowKey, final EntityMetadata metadata) { Indexer indexer = indexManager.getIndexer(); if (indexer != null && indexer.getClass().getSimpleName().equals("RedisIndexer")) { // Add row key to list(Required for wild search over table). wrapper.addIndex( getHashKey(metadata.getTableName(), ((AbstractAttribute) metadata.getIdAttribute()).getJPAColumnName()), getDouble(rowKey)); // Add row-key as inverted index as well needed for multiple clause // search with key and non row key. wrapper.addIndex( getHashKey(metadata.getTableName(), getHashKey(((AbstractAttribute) metadata.getIdAttribute()).getJPAColumnName(), rowKey)), getDouble(rowKey)); indexer.index(metadata.getEntityClazz(), metadata, wrapper.getIndexes(), rowKey, null); } } }
public class class_name { private void addIndex(final Object connection, final AttributeWrapper wrapper, final String rowKey, final EntityMetadata metadata) { Indexer indexer = indexManager.getIndexer(); if (indexer != null && indexer.getClass().getSimpleName().equals("RedisIndexer")) { // Add row key to list(Required for wild search over table). wrapper.addIndex( getHashKey(metadata.getTableName(), ((AbstractAttribute) metadata.getIdAttribute()).getJPAColumnName()), getDouble(rowKey)); // depends on control dependency: [if], data = [none] // Add row-key as inverted index as well needed for multiple clause // search with key and non row key. wrapper.addIndex( getHashKey(metadata.getTableName(), getHashKey(((AbstractAttribute) metadata.getIdAttribute()).getJPAColumnName(), rowKey)), getDouble(rowKey)); // depends on control dependency: [if], data = [none] indexer.index(metadata.getEntityClazz(), metadata, wrapper.getIndexes(), rowKey, null); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void setTextForNullSelection(String text) { // do nothing if there's no null option CmsLabelSelectCell cell = m_selectCells.get(""); if (cell == null) { return; } cell.setText(text); // if the null option is selected, we still need to update the opener if (CmsStringUtil.isEmptyOrWhitespaceOnly(m_selectedValue)) { selectValue(""); } } }
public class class_name { public void setTextForNullSelection(String text) { // do nothing if there's no null option CmsLabelSelectCell cell = m_selectCells.get(""); if (cell == null) { return; // depends on control dependency: [if], data = [none] } cell.setText(text); // if the null option is selected, we still need to update the opener if (CmsStringUtil.isEmptyOrWhitespaceOnly(m_selectedValue)) { selectValue(""); // depends on control dependency: [if], data = [none] } } }
public class class_name { public List<ImmutableFunctionalTerm> getBodyURIPredicates(PredicateObjectMap pom) { List<ImmutableFunctionalTerm> predicateAtoms = new ArrayList<>(); // process PREDICATEMAP for (PredicateMap pm : pom.getPredicateMaps()) { String pmConstant = pm.getConstant().toString(); if (pmConstant != null) { ImmutableFunctionalTerm bodyPredicate = termFactory.getImmutableUriTemplate(termFactory.getConstantLiteral(pmConstant)); predicateAtoms.add(bodyPredicate); } Template t = pm.getTemplate(); if (t != null) { // create uri("...",var) ImmutableFunctionalTerm predicateAtom = getURIFunction(t.toString()); predicateAtoms.add(predicateAtom); } // process column declaration String c = pm.getColumn(); if (c != null) { ImmutableFunctionalTerm predicateAtom = getURIFunction(c); predicateAtoms.add(predicateAtom); } } return predicateAtoms; } }
public class class_name { public List<ImmutableFunctionalTerm> getBodyURIPredicates(PredicateObjectMap pom) { List<ImmutableFunctionalTerm> predicateAtoms = new ArrayList<>(); // process PREDICATEMAP for (PredicateMap pm : pom.getPredicateMaps()) { String pmConstant = pm.getConstant().toString(); if (pmConstant != null) { ImmutableFunctionalTerm bodyPredicate = termFactory.getImmutableUriTemplate(termFactory.getConstantLiteral(pmConstant)); predicateAtoms.add(bodyPredicate); // depends on control dependency: [if], data = [none] } Template t = pm.getTemplate(); if (t != null) { // create uri("...",var) ImmutableFunctionalTerm predicateAtom = getURIFunction(t.toString()); predicateAtoms.add(predicateAtom); // depends on control dependency: [if], data = [none] } // process column declaration String c = pm.getColumn(); if (c != null) { ImmutableFunctionalTerm predicateAtom = getURIFunction(c); predicateAtoms.add(predicateAtom); // depends on control dependency: [if], data = [none] } } return predicateAtoms; } }
public class class_name { private long getOrInsertStyle(StyleRow style) { long styleId; if (style.hasId()) { styleId = style.getId(); } else { StyleDao styleDao = getStyleDao(); styleId = styleDao.create(style); } return styleId; } }
public class class_name { private long getOrInsertStyle(StyleRow style) { long styleId; if (style.hasId()) { styleId = style.getId(); // depends on control dependency: [if], data = [none] } else { StyleDao styleDao = getStyleDao(); styleId = styleDao.create(style); // depends on control dependency: [if], data = [none] } return styleId; } }
public class class_name { public void put(int key, Object value) { if (key < 0) Kit.codeBug(); int index = ensureIndex(key, false); if (values == null) { values = new Object[1 << power]; } values[index] = value; } }
public class class_name { public void put(int key, Object value) { if (key < 0) Kit.codeBug(); int index = ensureIndex(key, false); if (values == null) { values = new Object[1 << power]; // depends on control dependency: [if], data = [none] } values[index] = value; } }
public class class_name { @Override public void registerAttributes(ManagementResourceRegistration resourceRegistration) { for (AttributeAccess attr : attributes.values()) { resourceRegistration.registerReadOnlyAttribute(attr.getAttributeDefinition(), null); } } }
public class class_name { @Override public void registerAttributes(ManagementResourceRegistration resourceRegistration) { for (AttributeAccess attr : attributes.values()) { resourceRegistration.registerReadOnlyAttribute(attr.getAttributeDefinition(), null); // depends on control dependency: [for], data = [attr] } } }
public class class_name { private List<ConnectionFuture<StatefulRedisPubSubConnection<String, String>>> potentiallyConnectSentinels() { List<ConnectionFuture<StatefulRedisPubSubConnection<String, String>>> connectionFutures = new ArrayList<>(); for (RedisURI sentinel : sentinels) { if (pubSubConnections.containsKey(sentinel)) { continue; } ConnectionFuture<StatefulRedisPubSubConnection<String, String>> future = redisClient.connectPubSubAsync(CODEC, sentinel); pubSubConnections.put(sentinel, future); future.whenComplete((connection, throwable) -> { if (throwable != null || closed) { pubSubConnections.remove(sentinel); } if (closed) { connection.closeAsync(); } }); connectionFutures.add(future); } return connectionFutures; } }
public class class_name { private List<ConnectionFuture<StatefulRedisPubSubConnection<String, String>>> potentiallyConnectSentinels() { List<ConnectionFuture<StatefulRedisPubSubConnection<String, String>>> connectionFutures = new ArrayList<>(); for (RedisURI sentinel : sentinels) { if (pubSubConnections.containsKey(sentinel)) { continue; } ConnectionFuture<StatefulRedisPubSubConnection<String, String>> future = redisClient.connectPubSubAsync(CODEC, sentinel); pubSubConnections.put(sentinel, future); // depends on control dependency: [for], data = [sentinel] future.whenComplete((connection, throwable) -> { if (throwable != null || closed) { pubSubConnections.remove(sentinel); // depends on control dependency: [if], data = [none] } if (closed) { connection.closeAsync(); // depends on control dependency: [if], data = [none] } }); connectionFutures.add(future); // depends on control dependency: [for], data = [none] } return connectionFutures; } }
public class class_name { private StatisticsMapReduce<?> initStatisticsMapReduce(GraqlCompute.Statistics.Value query, Set<LabelId> targetTypes, AttributeType.DataType<?> targetDataType) { Graql.Token.Compute.Method method = query.method(); if (method.equals(MIN)) { return new MinMapReduce(targetTypes, targetDataType, DegreeVertexProgram.DEGREE); } else if (method.equals(MAX)) { return new MaxMapReduce(targetTypes, targetDataType, DegreeVertexProgram.DEGREE); } else if (method.equals(MEAN)) { return new MeanMapReduce(targetTypes, targetDataType, DegreeVertexProgram.DEGREE); }else if (method.equals(STD)) { return new StdMapReduce(targetTypes, targetDataType, DegreeVertexProgram.DEGREE); } else if (method.equals(SUM)) { return new SumMapReduce(targetTypes, targetDataType, DegreeVertexProgram.DEGREE); } return null; } }
public class class_name { private StatisticsMapReduce<?> initStatisticsMapReduce(GraqlCompute.Statistics.Value query, Set<LabelId> targetTypes, AttributeType.DataType<?> targetDataType) { Graql.Token.Compute.Method method = query.method(); if (method.equals(MIN)) { return new MinMapReduce(targetTypes, targetDataType, DegreeVertexProgram.DEGREE); // depends on control dependency: [if], data = [none] } else if (method.equals(MAX)) { return new MaxMapReduce(targetTypes, targetDataType, DegreeVertexProgram.DEGREE); // depends on control dependency: [if], data = [none] } else if (method.equals(MEAN)) { return new MeanMapReduce(targetTypes, targetDataType, DegreeVertexProgram.DEGREE); // depends on control dependency: [if], data = [none] }else if (method.equals(STD)) { return new StdMapReduce(targetTypes, targetDataType, DegreeVertexProgram.DEGREE); // depends on control dependency: [if], data = [none] } else if (method.equals(SUM)) { return new SumMapReduce(targetTypes, targetDataType, DegreeVertexProgram.DEGREE); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { protected List<Command> buildCommandChain(Config rootConfig, String configKey, Command finalChild, boolean ignoreNotifications) { Preconditions.checkNotNull(rootConfig); Preconditions.checkNotNull(configKey); Preconditions.checkNotNull(finalChild); List<? extends Config> commandConfigs = new Configs().getConfigList(rootConfig, configKey, Collections.<Config>emptyList()); List<Command> commands = Lists.newArrayList(); Command currentParent = this; Connector lastConnector = null; for (int i = 0; i < commandConfigs.size(); i++) { boolean isLast = (i == commandConfigs.size() - 1); Connector connector = new Connector(ignoreNotifications && isLast); if (isLast) { connector.setChild(finalChild); } Config cmdConfig = commandConfigs.get(i); Command cmd = buildCommand(cmdConfig, currentParent, connector); commands.add(cmd); if (i > 0) { lastConnector.setChild(cmd); } connector.setParent(cmd); currentParent = connector; lastConnector = connector; } return commands; } }
public class class_name { protected List<Command> buildCommandChain(Config rootConfig, String configKey, Command finalChild, boolean ignoreNotifications) { Preconditions.checkNotNull(rootConfig); Preconditions.checkNotNull(configKey); Preconditions.checkNotNull(finalChild); List<? extends Config> commandConfigs = new Configs().getConfigList(rootConfig, configKey, Collections.<Config>emptyList()); List<Command> commands = Lists.newArrayList(); Command currentParent = this; Connector lastConnector = null; for (int i = 0; i < commandConfigs.size(); i++) { boolean isLast = (i == commandConfigs.size() - 1); Connector connector = new Connector(ignoreNotifications && isLast); if (isLast) { connector.setChild(finalChild); // depends on control dependency: [if], data = [none] } Config cmdConfig = commandConfigs.get(i); Command cmd = buildCommand(cmdConfig, currentParent, connector); commands.add(cmd); // depends on control dependency: [for], data = [none] if (i > 0) { lastConnector.setChild(cmd); // depends on control dependency: [if], data = [none] } connector.setParent(cmd); // depends on control dependency: [for], data = [none] currentParent = connector; // depends on control dependency: [for], data = [none] lastConnector = connector; // depends on control dependency: [for], data = [none] } return commands; } }
public class class_name { final LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>> createRequestMap() { if (unmappedMatchers != null) { throw new IllegalStateException( "An incomplete mapping was found for " + unmappedMatchers + ". Try completing it with something like requestUrls().<something>.hasRole('USER')"); } LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>> requestMap = new LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>>(); for (UrlMapping mapping : getUrlMappings()) { RequestMatcher matcher = mapping.getRequestMatcher(); Collection<ConfigAttribute> configAttrs = mapping.getConfigAttrs(); requestMap.put(matcher, configAttrs); } return requestMap; } }
public class class_name { final LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>> createRequestMap() { if (unmappedMatchers != null) { throw new IllegalStateException( "An incomplete mapping was found for " + unmappedMatchers + ". Try completing it with something like requestUrls().<something>.hasRole('USER')"); } LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>> requestMap = new LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>>(); for (UrlMapping mapping : getUrlMappings()) { RequestMatcher matcher = mapping.getRequestMatcher(); Collection<ConfigAttribute> configAttrs = mapping.getConfigAttrs(); requestMap.put(matcher, configAttrs); // depends on control dependency: [for], data = [none] } return requestMap; } }