code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { private static List<DAType> computeExtendedInterfaces(List<DAInterface> interfaces) { Optional<DAType> functionInterface = from(interfaces) .filter(DAInterfacePredicates.isGuavaFunction()) .transform(toDAType()) .filter(notNull()) .first(); if (functionInterface.isPresent()) { return Collections.singletonList(functionInterface.get()); } return Collections.emptyList(); } }
public class class_name { private static List<DAType> computeExtendedInterfaces(List<DAInterface> interfaces) { Optional<DAType> functionInterface = from(interfaces) .filter(DAInterfacePredicates.isGuavaFunction()) .transform(toDAType()) .filter(notNull()) .first(); if (functionInterface.isPresent()) { return Collections.singletonList(functionInterface.get()); // depends on control dependency: [if], data = [none] } return Collections.emptyList(); } }
public class class_name { public void setClusterParameterStatusList(java.util.Collection<ClusterParameterStatus> clusterParameterStatusList) { if (clusterParameterStatusList == null) { this.clusterParameterStatusList = null; return; } this.clusterParameterStatusList = new com.amazonaws.internal.SdkInternalList<ClusterParameterStatus>(clusterParameterStatusList); } }
public class class_name { public void setClusterParameterStatusList(java.util.Collection<ClusterParameterStatus> clusterParameterStatusList) { if (clusterParameterStatusList == null) { this.clusterParameterStatusList = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.clusterParameterStatusList = new com.amazonaws.internal.SdkInternalList<ClusterParameterStatus>(clusterParameterStatusList); } }
public class class_name { public QProfileDto getProfile(DbSession dbSession, QProfileReference ref) { QProfileDto profile; if (ref.hasKey()) { profile = dbClient.qualityProfileDao().selectByUuid(dbSession, ref.getKey()); checkFound(profile, "Quality Profile with key '%s' does not exist", ref.getKey()); // Load organization to execute various checks (existence, membership if paid organization, etc.) getOrganization(dbSession, profile); } else { OrganizationDto org = getOrganizationByKey(dbSession, ref.getOrganizationKey().orElse(null)); profile = dbClient.qualityProfileDao().selectByNameAndLanguage(dbSession, org, ref.getName(), ref.getLanguage()); checkFound(profile, "Quality Profile for language '%s' and name '%s' does not exist%s", ref.getLanguage(), ref.getName(), ref.getOrganizationKey().map(o -> " in organization '" + o + "'").orElse("")); } return profile; } }
public class class_name { public QProfileDto getProfile(DbSession dbSession, QProfileReference ref) { QProfileDto profile; if (ref.hasKey()) { profile = dbClient.qualityProfileDao().selectByUuid(dbSession, ref.getKey()); // depends on control dependency: [if], data = [none] checkFound(profile, "Quality Profile with key '%s' does not exist", ref.getKey()); // depends on control dependency: [if], data = [none] // Load organization to execute various checks (existence, membership if paid organization, etc.) getOrganization(dbSession, profile); // depends on control dependency: [if], data = [none] } else { OrganizationDto org = getOrganizationByKey(dbSession, ref.getOrganizationKey().orElse(null)); profile = dbClient.qualityProfileDao().selectByNameAndLanguage(dbSession, org, ref.getName(), ref.getLanguage()); // depends on control dependency: [if], data = [none] checkFound(profile, "Quality Profile for language '%s' and name '%s' does not exist%s", ref.getLanguage(), ref.getName(), ref.getOrganizationKey().map(o -> " in organization '" + o + "'").orElse("")); // depends on control dependency: [if], data = [none] } return profile; } }
public class class_name { public static String trimWhitespace(final String s) { if (s == null || s.length() == 0) { return s; } final int length = s.length(); int end = length; int start = 0; while (start < end && Character.isWhitespace(s.charAt(start))) { start++; } while (start < end && Character.isWhitespace(s.charAt(end - 1))) { end--; } return start > 0 || end < length ? s.substring(start, end) : s; } }
public class class_name { public static String trimWhitespace(final String s) { if (s == null || s.length() == 0) { return s; // depends on control dependency: [if], data = [none] } final int length = s.length(); int end = length; int start = 0; while (start < end && Character.isWhitespace(s.charAt(start))) { start++; // depends on control dependency: [while], data = [none] } while (start < end && Character.isWhitespace(s.charAt(end - 1))) { end--; // depends on control dependency: [while], data = [none] } return start > 0 || end < length ? s.substring(start, end) : s; } }
public class class_name { private void onStartElement(QName name, XMLAttributes atts) { if (detecting) { detecting = false; loadDefaults(); } if (defaults != null) { checkAndAddDefaults(name, atts); } } }
public class class_name { private void onStartElement(QName name, XMLAttributes atts) { if (detecting) { detecting = false; // depends on control dependency: [if], data = [none] loadDefaults(); // depends on control dependency: [if], data = [none] } if (defaults != null) { checkAndAddDefaults(name, atts); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected static void onActivityResult(final BraintreeFragment fragment, int resultCode, Intent data) { Request request = getPersistedRequest(fragment.getApplicationContext()); String paymentType = paymentTypeForRequest(request); String switchType = switchTypeForIntent(data); String eventPrefix = paymentType + "." + switchType; if (resultCode == AppCompatActivity.RESULT_OK && data != null && request != null) { Result result = PayPalOneTouchCore.parseResponse(fragment.getApplicationContext(), request, data); switch (result.getResultType()) { case Error: fragment.postCallback(new BrowserSwitchException(result.getError().getMessage())); fragment.sendAnalyticsEvent(eventPrefix + ".failed"); break; case Cancel: fragment.postCancelCallback(BraintreeRequestCodes.PAYPAL); fragment.sendAnalyticsEvent(eventPrefix + ".canceled"); break; case Success: onSuccess(fragment, data, request, result); fragment.sendAnalyticsEvent(eventPrefix + ".succeeded"); break; } } else { fragment.sendAnalyticsEvent(eventPrefix + ".canceled"); if (resultCode != AppCompatActivity.RESULT_CANCELED) { fragment.postCancelCallback(BraintreeRequestCodes.PAYPAL); } } } }
public class class_name { protected static void onActivityResult(final BraintreeFragment fragment, int resultCode, Intent data) { Request request = getPersistedRequest(fragment.getApplicationContext()); String paymentType = paymentTypeForRequest(request); String switchType = switchTypeForIntent(data); String eventPrefix = paymentType + "." + switchType; if (resultCode == AppCompatActivity.RESULT_OK && data != null && request != null) { Result result = PayPalOneTouchCore.parseResponse(fragment.getApplicationContext(), request, data); switch (result.getResultType()) { case Error: fragment.postCallback(new BrowserSwitchException(result.getError().getMessage())); // depends on control dependency: [if], data = [none] fragment.sendAnalyticsEvent(eventPrefix + ".failed"); // depends on control dependency: [if], data = [none] break; case Cancel: fragment.postCancelCallback(BraintreeRequestCodes.PAYPAL); // depends on control dependency: [if], data = [none] fragment.sendAnalyticsEvent(eventPrefix + ".canceled"); // depends on control dependency: [if], data = [none] break; case Success: onSuccess(fragment, data, request, result); fragment.sendAnalyticsEvent(eventPrefix + ".succeeded"); // depends on control dependency: [if], data = [none] break; } } else { fragment.sendAnalyticsEvent(eventPrefix + ".canceled"); if (resultCode != AppCompatActivity.RESULT_CANCELED) { fragment.postCancelCallback(BraintreeRequestCodes.PAYPAL); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private void readResources() { for (MapRow row : m_tables.get("RLB")) { Resource resource = m_projectFile.addResource(); setFields(RESOURCE_FIELDS, row, resource); m_resourceMap.put(resource.getCode(), resource); } } }
public class class_name { private void readResources() { for (MapRow row : m_tables.get("RLB")) { Resource resource = m_projectFile.addResource(); setFields(RESOURCE_FIELDS, row, resource); // depends on control dependency: [for], data = [row] m_resourceMap.put(resource.getCode(), resource); // depends on control dependency: [for], data = [none] } } }
public class class_name { public long getDifferenceAsLong(long minuendInstant, long subtrahendInstant) { if (minuendInstant < subtrahendInstant) { return -getDifferenceAsLong(subtrahendInstant, minuendInstant); } long difference = (minuendInstant - subtrahendInstant) / iUnitMillis; if (add(subtrahendInstant, difference) < minuendInstant) { do { difference++; } while (add(subtrahendInstant, difference) <= minuendInstant); difference--; } else if (add(subtrahendInstant, difference) > minuendInstant) { do { difference--; } while (add(subtrahendInstant, difference) > minuendInstant); } return difference; } }
public class class_name { public long getDifferenceAsLong(long minuendInstant, long subtrahendInstant) { if (minuendInstant < subtrahendInstant) { return -getDifferenceAsLong(subtrahendInstant, minuendInstant); // depends on control dependency: [if], data = [none] } long difference = (minuendInstant - subtrahendInstant) / iUnitMillis; if (add(subtrahendInstant, difference) < minuendInstant) { do { difference++; } while (add(subtrahendInstant, difference) <= minuendInstant); difference--; // depends on control dependency: [if], data = [none] } else if (add(subtrahendInstant, difference) > minuendInstant) { do { difference--; } while (add(subtrahendInstant, difference) > minuendInstant); } return difference; } }
public class class_name { public void marshall(EntityAggregate entityAggregate, ProtocolMarshaller protocolMarshaller) { if (entityAggregate == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(entityAggregate.getEventArn(), EVENTARN_BINDING); protocolMarshaller.marshall(entityAggregate.getCount(), COUNT_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(EntityAggregate entityAggregate, ProtocolMarshaller protocolMarshaller) { if (entityAggregate == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(entityAggregate.getEventArn(), EVENTARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(entityAggregate.getCount(), COUNT_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 HttpRequest withBody(String body, Charset charset) { if (body != null) { this.body = new StringBody(body, charset); } return this; } }
public class class_name { public HttpRequest withBody(String body, Charset charset) { if (body != null) { this.body = new StringBody(body, charset); // depends on control dependency: [if], data = [(body] } return this; } }
public class class_name { public String getMimeType(final String fileId) { FileWidgetUpload fileWidget = getFile(fileId); if (fileWidget != null) { return FileUtil.getFileMimeType(fileWidget.getFile()); } return null; } }
public class class_name { public String getMimeType(final String fileId) { FileWidgetUpload fileWidget = getFile(fileId); if (fileWidget != null) { return FileUtil.getFileMimeType(fileWidget.getFile()); // depends on control dependency: [if], data = [(fileWidget] } return null; } }
public class class_name { public static String encodePath(String path) { StringBuffer encodedPathBuf = new StringBuffer(); for (String pathSegment : path.split("/")) { if (!pathSegment.isEmpty()) { if (encodedPathBuf.length() > 0) { encodedPathBuf.append("/"); } encodedPathBuf.append(S3Escaper.encode(pathSegment)); } } if (path.startsWith("/")) { encodedPathBuf.insert(0, "/"); } if (path.endsWith("/")) { encodedPathBuf.append("/"); } return encodedPathBuf.toString(); } }
public class class_name { public static String encodePath(String path) { StringBuffer encodedPathBuf = new StringBuffer(); for (String pathSegment : path.split("/")) { if (!pathSegment.isEmpty()) { if (encodedPathBuf.length() > 0) { encodedPathBuf.append("/"); // depends on control dependency: [if], data = [none] } encodedPathBuf.append(S3Escaper.encode(pathSegment)); // depends on control dependency: [if], data = [none] } } if (path.startsWith("/")) { encodedPathBuf.insert(0, "/"); // depends on control dependency: [if], data = [none] } if (path.endsWith("/")) { encodedPathBuf.append("/"); // depends on control dependency: [if], data = [none] } return encodedPathBuf.toString(); } }
public class class_name { private void processPredecessors(Gantt gantt) { for (Gantt.Tasks.Task ganttTask : gantt.getTasks().getTask()) { String predecessors = ganttTask.getP(); if (predecessors != null && !predecessors.isEmpty()) { String wbs = ganttTask.getID(); Task task = m_taskMap.get(wbs); for (String predecessor : predecessors.split(";")) { Task predecessorTask = m_projectFile.getTaskByID(Integer.valueOf(predecessor)); task.addPredecessor(predecessorTask, RelationType.FINISH_START, ganttTask.getL()); } } } } }
public class class_name { private void processPredecessors(Gantt gantt) { for (Gantt.Tasks.Task ganttTask : gantt.getTasks().getTask()) { String predecessors = ganttTask.getP(); if (predecessors != null && !predecessors.isEmpty()) { String wbs = ganttTask.getID(); Task task = m_taskMap.get(wbs); for (String predecessor : predecessors.split(";")) { Task predecessorTask = m_projectFile.getTaskByID(Integer.valueOf(predecessor)); task.addPredecessor(predecessorTask, RelationType.FINISH_START, ganttTask.getL()); // depends on control dependency: [for], data = [predecessor] } } } } }
public class class_name { @Override public void destroy() { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Destroying OSC: " + this); } // 291714 - clean up the VC statemap getVC().getStateMap().remove(CallbackIDs.CALLBACK_HTTPOSC); super.destroy(); this.myLink = null; this.readException = null; } }
public class class_name { @Override public void destroy() { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Destroying OSC: " + this); // depends on control dependency: [if], data = [none] } // 291714 - clean up the VC statemap getVC().getStateMap().remove(CallbackIDs.CALLBACK_HTTPOSC); super.destroy(); this.myLink = null; this.readException = null; } }
public class class_name { public VarDefBuilder varDefAtPath( String[] path) { VarDefBuilder varDefBuilder = null; if( path != null && path.length > 0) { String varDefName = path[ path.length - 1]; VarSetBuilder parentBuilder = varSetAtPath( Arrays.copyOfRange( path, 0, path.length - 1)); if( parentBuilder != null) { varDefBuilder = parentBuilder.varDefAtPath( varDefName); } else { VarDef varDef = new VarDef( varDefName); varSet_.addMember( varDef); varDefBuilder = new VarDefBuilder( varDef); } } return varDefBuilder; } }
public class class_name { public VarDefBuilder varDefAtPath( String[] path) { VarDefBuilder varDefBuilder = null; if( path != null && path.length > 0) { String varDefName = path[ path.length - 1]; VarSetBuilder parentBuilder = varSetAtPath( Arrays.copyOfRange( path, 0, path.length - 1)); if( parentBuilder != null) { varDefBuilder = parentBuilder.varDefAtPath( varDefName); // depends on control dependency: [if], data = [none] } else { VarDef varDef = new VarDef( varDefName); varSet_.addMember( varDef); // depends on control dependency: [if], data = [none] varDefBuilder = new VarDefBuilder( varDef); // depends on control dependency: [if], data = [none] } } return varDefBuilder; } }
public class class_name { protected boolean executeOneCompleteStmt(final String _complStmt) throws EFapsException { final boolean ret = false; ConnectionResource con = null; try { con = Context.getThreadContext().getConnectionResource(); if (AbstractObjectQuery.LOG.isDebugEnabled()) { AbstractObjectQuery.LOG.debug(_complStmt.toString()); } final Statement stmt = con.createStatement(); final ResultSet rs = stmt.executeQuery(_complStmt.toString()); new ArrayList<Instance>(); while (rs.next()) { getValues().add(rs.getObject(1)); } rs.close(); stmt.close(); } catch (final SQLException e) { throw new EFapsException(AttributeQuery.class, "executeOneCompleteStmt", e); } return ret; } }
public class class_name { protected boolean executeOneCompleteStmt(final String _complStmt) throws EFapsException { final boolean ret = false; ConnectionResource con = null; try { con = Context.getThreadContext().getConnectionResource(); if (AbstractObjectQuery.LOG.isDebugEnabled()) { AbstractObjectQuery.LOG.debug(_complStmt.toString()); // depends on control dependency: [if], data = [none] } final Statement stmt = con.createStatement(); final ResultSet rs = stmt.executeQuery(_complStmt.toString()); new ArrayList<Instance>(); while (rs.next()) { getValues().add(rs.getObject(1)); // depends on control dependency: [while], data = [none] } rs.close(); stmt.close(); } catch (final SQLException e) { throw new EFapsException(AttributeQuery.class, "executeOneCompleteStmt", e); } return ret; } }
public class class_name { @Override public INDArray get(T key) { try { if (emulateIsAbsent) lock.readLock().lock(); if (containsKey(key)) { INDArray result = compressedEntries.get(key); // TODO: we don't save decompressed entries here, but something like LRU might be good idea return compressor.decompress(result); } else { return null; } } finally { if (emulateIsAbsent) lock.readLock().unlock(); } } }
public class class_name { @Override public INDArray get(T key) { try { if (emulateIsAbsent) lock.readLock().lock(); if (containsKey(key)) { INDArray result = compressedEntries.get(key); // TODO: we don't save decompressed entries here, but something like LRU might be good idea return compressor.decompress(result); // depends on control dependency: [if], data = [none] } else { return null; // depends on control dependency: [if], data = [none] } } finally { if (emulateIsAbsent) lock.readLock().unlock(); } } }
public class class_name { public UserDetails getUserFromCache(String username) { Cache.ValueWrapper element = username != null ? cache.get(username) : null; if (logger.isDebugEnabled()) { logger.debug("Cache hit: " + (element != null) + "; username: " + username); } if (element == null) { return null; } else { return (UserDetails) element.get(); } } }
public class class_name { public UserDetails getUserFromCache(String username) { Cache.ValueWrapper element = username != null ? cache.get(username) : null; if (logger.isDebugEnabled()) { logger.debug("Cache hit: " + (element != null) + "; username: " + username); // depends on control dependency: [if], data = [none] } if (element == null) { return null; // depends on control dependency: [if], data = [none] } else { return (UserDetails) element.get(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void add(int position) { if (mtasPositionType.equals(POSITION_SINGLE)) { if (position != mtasPositionStart) { if (position == (mtasPositionStart + 1)) { mtasPositionType = POSITION_RANGE; mtasPositionEnd = position; } else if (position == (mtasPositionStart - 1)) { mtasPositionType = POSITION_RANGE; mtasPositionEnd = mtasPositionStart; mtasPositionStart = position; } else { mtasPositionType = POSITION_SET; SortedSet<Integer> list = new TreeSet<>(); list.add(position); list.add(mtasPositionStart); mtasPositionList = ArrayUtils .toPrimitive(list.toArray(new Integer[list.size()])); mtasPositionStart = list.first(); mtasPositionEnd = list.last(); } } } else { SortedSet<Integer> list = new TreeSet<>(); if (mtasPositionType.equals(POSITION_RANGE)) { mtasPositionType = POSITION_SET; for (int i = mtasPositionStart; i <= mtasPositionEnd; i++) { list.add(i); } list.add(position); } else if (mtasPositionType.equals(POSITION_SET)) { for (int p : mtasPositionList) { list.add(p); } list.add(position); } mtasPositionList = ArrayUtils .toPrimitive(list.toArray(new Integer[list.size()])); mtasPositionStart = list.first(); mtasPositionEnd = list.last(); if (list.size() == (1 + mtasPositionEnd - mtasPositionStart)) { mtasPositionType = POSITION_RANGE; mtasPositionList = null; } } } }
public class class_name { public void add(int position) { if (mtasPositionType.equals(POSITION_SINGLE)) { if (position != mtasPositionStart) { if (position == (mtasPositionStart + 1)) { mtasPositionType = POSITION_RANGE; // depends on control dependency: [if], data = [none] mtasPositionEnd = position; // depends on control dependency: [if], data = [none] } else if (position == (mtasPositionStart - 1)) { mtasPositionType = POSITION_RANGE; // depends on control dependency: [if], data = [none] mtasPositionEnd = mtasPositionStart; // depends on control dependency: [if], data = [none] mtasPositionStart = position; // depends on control dependency: [if], data = [none] } else { mtasPositionType = POSITION_SET; // depends on control dependency: [if], data = [none] SortedSet<Integer> list = new TreeSet<>(); list.add(position); // depends on control dependency: [if], data = [(position] list.add(mtasPositionStart); // depends on control dependency: [if], data = [none] mtasPositionList = ArrayUtils .toPrimitive(list.toArray(new Integer[list.size()])); // depends on control dependency: [if], data = [none] mtasPositionStart = list.first(); // depends on control dependency: [if], data = [none] mtasPositionEnd = list.last(); // depends on control dependency: [if], data = [none] } } } else { SortedSet<Integer> list = new TreeSet<>(); if (mtasPositionType.equals(POSITION_RANGE)) { mtasPositionType = POSITION_SET; // depends on control dependency: [if], data = [none] for (int i = mtasPositionStart; i <= mtasPositionEnd; i++) { list.add(i); // depends on control dependency: [for], data = [i] } list.add(position); // depends on control dependency: [if], data = [none] } else if (mtasPositionType.equals(POSITION_SET)) { for (int p : mtasPositionList) { list.add(p); // depends on control dependency: [for], data = [p] } list.add(position); // depends on control dependency: [if], data = [none] } mtasPositionList = ArrayUtils .toPrimitive(list.toArray(new Integer[list.size()])); // depends on control dependency: [if], data = [none] mtasPositionStart = list.first(); // depends on control dependency: [if], data = [none] mtasPositionEnd = list.last(); // depends on control dependency: [if], data = [none] if (list.size() == (1 + mtasPositionEnd - mtasPositionStart)) { mtasPositionType = POSITION_RANGE; // depends on control dependency: [if], data = [none] mtasPositionList = null; // depends on control dependency: [if], data = [none] } } } }
public class class_name { public final boolean parse(InputStream stream) { Dap2Parser parser = new Dap2Parser(new DefaultFactory()); String text; try { text = DConnect2.captureStream(stream); if(parser.errparse(text, this) != Dap2Parser.DapERR) return false; } catch (ParseException pe) { this.initCause(pe); } catch (IOException pe) { this.initCause(pe); } return true; } }
public class class_name { public final boolean parse(InputStream stream) { Dap2Parser parser = new Dap2Parser(new DefaultFactory()); String text; try { text = DConnect2.captureStream(stream); // depends on control dependency: [try], data = [none] if(parser.errparse(text, this) != Dap2Parser.DapERR) return false; } catch (ParseException pe) { this.initCause(pe); } catch (IOException pe) { // depends on control dependency: [catch], data = [none] this.initCause(pe); } // depends on control dependency: [catch], data = [none] return true; } }
public class class_name { @Override public void addValidator(final FieldValidator validator) { InputModel model = getOrCreateComponentModel(); if (model.validators == null) { model.validators = new ArrayList<>(); } validator.setInputField(this); model.validators.add(validator); // possible source of memory leaks MemoryUtil.checkSize(model.validators.size(), this.getClass().getSimpleName()); } }
public class class_name { @Override public void addValidator(final FieldValidator validator) { InputModel model = getOrCreateComponentModel(); if (model.validators == null) { model.validators = new ArrayList<>(); // depends on control dependency: [if], data = [none] } validator.setInputField(this); model.validators.add(validator); // possible source of memory leaks MemoryUtil.checkSize(model.validators.size(), this.getClass().getSimpleName()); } }
public class class_name { private void parseLimitNumberResponses(Map<Object, Object> props) { Object value = props.get(HttpConfigConstants.PROPNAME_LIMIT_NUMBER_RESPONSES); if (null != value) { try { int size = convertInteger(value); if (HttpConfigConstants.UNLIMITED == size) { this.limitNumResponses = HttpConfigConstants.MAX_LIMIT_NUMRESPONSES; } else { this.limitNumResponses = rangeLimit(size, 1, HttpConfigConstants.MAX_LIMIT_NUMRESPONSES); } if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Num responses limit is " + getLimitOnNumberOfResponses()); } } catch (NumberFormatException nfe) { FFDCFilter.processException(nfe, getClass().getName() + ".parseLimitNumberResponses", "1"); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Invalid max number of responses; " + value); } } } } }
public class class_name { private void parseLimitNumberResponses(Map<Object, Object> props) { Object value = props.get(HttpConfigConstants.PROPNAME_LIMIT_NUMBER_RESPONSES); if (null != value) { try { int size = convertInteger(value); if (HttpConfigConstants.UNLIMITED == size) { this.limitNumResponses = HttpConfigConstants.MAX_LIMIT_NUMRESPONSES; // depends on control dependency: [if], data = [none] } else { this.limitNumResponses = rangeLimit(size, 1, HttpConfigConstants.MAX_LIMIT_NUMRESPONSES); // depends on control dependency: [if], data = [none] } if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Num responses limit is " + getLimitOnNumberOfResponses()); // depends on control dependency: [if], data = [none] } } catch (NumberFormatException nfe) { FFDCFilter.processException(nfe, getClass().getName() + ".parseLimitNumberResponses", "1"); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Invalid max number of responses; " + value); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public static Plugin getPlugin(MavenProject project, String groupId, String artifactId) { if (artifactId == null) { throw new IllegalArgumentException("artifactId cannot be null"); } List<Plugin> plugins = project.getBuildPlugins(); if (plugins != null) { for (Plugin plugin : plugins) { boolean matchesArtifactId = artifactId.equals(plugin.getArtifactId()); boolean matchesGroupId = groupId == null || groupId.equals(plugin.getGroupId()); if (matchesGroupId && matchesArtifactId) { return plugin; } } } return null; } }
public class class_name { public static Plugin getPlugin(MavenProject project, String groupId, String artifactId) { if (artifactId == null) { throw new IllegalArgumentException("artifactId cannot be null"); } List<Plugin> plugins = project.getBuildPlugins(); if (plugins != null) { for (Plugin plugin : plugins) { boolean matchesArtifactId = artifactId.equals(plugin.getArtifactId()); boolean matchesGroupId = groupId == null || groupId.equals(plugin.getGroupId()); if (matchesGroupId && matchesArtifactId) { return plugin; // depends on control dependency: [if], data = [none] } } } return null; } }
public class class_name { protected Set<Event> handleAuthenticationTransactionAndGrantTicketGrantingTicket(final RequestContext context) { val response = WebUtils.getHttpServletResponseFromExternalWebflowContext(context); try { val credential = getCredentialFromContext(context); val builderResult = WebUtils.getAuthenticationResultBuilder(context); LOGGER.debug("Handling authentication transaction for credential [{}]", credential); val service = WebUtils.getService(context); val builder = webflowEventResolutionConfigurationContext.getAuthenticationSystemSupport() .handleAuthenticationTransaction(service, builderResult, credential); LOGGER.debug("Issuing ticket-granting tickets for service [{}]", service); return CollectionUtils.wrapSet(grantTicketGrantingTicketToAuthenticationResult(context, builder, service)); } catch (final Exception e) { LOGGER.error(e.getMessage(), e); val messageContext = context.getMessageContext(); messageContext.addMessage(new MessageBuilder() .error() .code(DEFAULT_MESSAGE_BUNDLE_PREFIX.concat(e.getClass().getSimpleName())) .build()); response.setStatus(HttpStatus.UNAUTHORIZED.value()); return CollectionUtils.wrapSet(getAuthenticationFailureErrorEvent(context)); } } }
public class class_name { protected Set<Event> handleAuthenticationTransactionAndGrantTicketGrantingTicket(final RequestContext context) { val response = WebUtils.getHttpServletResponseFromExternalWebflowContext(context); try { val credential = getCredentialFromContext(context); val builderResult = WebUtils.getAuthenticationResultBuilder(context); LOGGER.debug("Handling authentication transaction for credential [{}]", credential); val service = WebUtils.getService(context); // depends on control dependency: [try], data = [none] val builder = webflowEventResolutionConfigurationContext.getAuthenticationSystemSupport() .handleAuthenticationTransaction(service, builderResult, credential); LOGGER.debug("Issuing ticket-granting tickets for service [{}]", service); return CollectionUtils.wrapSet(grantTicketGrantingTicketToAuthenticationResult(context, builder, service)); // depends on control dependency: [try], data = [none] } catch (final Exception e) { LOGGER.error(e.getMessage(), e); val messageContext = context.getMessageContext(); messageContext.addMessage(new MessageBuilder() .error() .code(DEFAULT_MESSAGE_BUNDLE_PREFIX.concat(e.getClass().getSimpleName())) .build()); response.setStatus(HttpStatus.UNAUTHORIZED.value()); return CollectionUtils.wrapSet(getAuthenticationFailureErrorEvent(context)); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private static ExtensionInfo exploreExtensions(ByteBuffer input) throws SSLException { List<SNIServerName> sni = Collections.emptyList(); List<String> alpn = Collections.emptyList(); int length = getInt16(input); // length of extensions while (length > 0) { int extType = getInt16(input); // extension type int extLen = getInt16(input); // length of extension data if (extType == 0x00) { // 0x00: type of server name indication sni = exploreSNIExt(input, extLen); } else if (extType == 0x10) { // 0x10: type of alpn alpn = exploreALPN(input, extLen); } else { // ignore other extensions ignoreByteVector(input, extLen); } length -= extLen + 4; } return new ExtensionInfo(sni, alpn); } }
public class class_name { private static ExtensionInfo exploreExtensions(ByteBuffer input) throws SSLException { List<SNIServerName> sni = Collections.emptyList(); List<String> alpn = Collections.emptyList(); int length = getInt16(input); // length of extensions while (length > 0) { int extType = getInt16(input); // extension type int extLen = getInt16(input); // length of extension data if (extType == 0x00) { // 0x00: type of server name indication sni = exploreSNIExt(input, extLen); // depends on control dependency: [if], data = [none] } else if (extType == 0x10) { // 0x10: type of alpn alpn = exploreALPN(input, extLen); // depends on control dependency: [if], data = [none] } else { // ignore other extensions ignoreByteVector(input, extLen); // depends on control dependency: [if], data = [none] } length -= extLen + 4; } return new ExtensionInfo(sni, alpn); } }
public class class_name { private List<Path> checkDirectories(List<Path> pathList) { List<Path> result = new ArrayList<>(); for (Path path : pathList) { if (!Files.exists(path)) { LOGGER.debug("'{}' does not exist", path); } else if (!Files.isDirectory(path)) { LOGGER.warn("'{}' is not directory", path); } // todo: should we use not existing paths? this behavior is copied from 'protoc' - it just shows warning result.add(path); } return result; } }
public class class_name { private List<Path> checkDirectories(List<Path> pathList) { List<Path> result = new ArrayList<>(); for (Path path : pathList) { if (!Files.exists(path)) { LOGGER.debug("'{}' does not exist", path); // depends on control dependency: [if], data = [none] } else if (!Files.isDirectory(path)) { LOGGER.warn("'{}' is not directory", path); // depends on control dependency: [if], data = [none] } // todo: should we use not existing paths? this behavior is copied from 'protoc' - it just shows warning result.add(path); // depends on control dependency: [for], data = [path] } return result; } }
public class class_name { public static long getContentLength(PutObjectRequest putObjectRequest) { File file = getRequestFile(putObjectRequest); if (file != null) return file.length(); if (putObjectRequest.getInputStream() != null) { if (putObjectRequest.getMetadata().getContentLength() > 0) { return putObjectRequest.getMetadata().getContentLength(); } } return -1; } }
public class class_name { public static long getContentLength(PutObjectRequest putObjectRequest) { File file = getRequestFile(putObjectRequest); if (file != null) return file.length(); if (putObjectRequest.getInputStream() != null) { if (putObjectRequest.getMetadata().getContentLength() > 0) { return putObjectRequest.getMetadata().getContentLength(); // depends on control dependency: [if], data = [none] } } return -1; } }
public class class_name { public UpdateFleetRequest withAttributesToDelete(FleetAttribute... attributesToDelete) { java.util.ArrayList<String> attributesToDeleteCopy = new java.util.ArrayList<String>(attributesToDelete.length); for (FleetAttribute value : attributesToDelete) { attributesToDeleteCopy.add(value.toString()); } if (getAttributesToDelete() == null) { setAttributesToDelete(attributesToDeleteCopy); } else { getAttributesToDelete().addAll(attributesToDeleteCopy); } return this; } }
public class class_name { public UpdateFleetRequest withAttributesToDelete(FleetAttribute... attributesToDelete) { java.util.ArrayList<String> attributesToDeleteCopy = new java.util.ArrayList<String>(attributesToDelete.length); for (FleetAttribute value : attributesToDelete) { attributesToDeleteCopy.add(value.toString()); // depends on control dependency: [for], data = [value] } if (getAttributesToDelete() == null) { setAttributesToDelete(attributesToDeleteCopy); // depends on control dependency: [if], data = [none] } else { getAttributesToDelete().addAll(attributesToDeleteCopy); // depends on control dependency: [if], data = [none] } return this; } }
public class class_name { public JSONObject getJobDetails(String mcUrl, String proxyAddress, String proxyUserName, String proxyPassword){ if(StringUtils.isBlank(fsUserName) || StringUtils.isBlank(fsPassword.getPlainText())){ return null; } return JobConfigurationProxy.getInstance().getJobById(mcUrl, fsUserName, fsPassword.getPlainText(), proxyAddress, proxyUserName, proxyPassword, fsJobId); } }
public class class_name { public JSONObject getJobDetails(String mcUrl, String proxyAddress, String proxyUserName, String proxyPassword){ if(StringUtils.isBlank(fsUserName) || StringUtils.isBlank(fsPassword.getPlainText())){ return null; // depends on control dependency: [if], data = [none] } return JobConfigurationProxy.getInstance().getJobById(mcUrl, fsUserName, fsPassword.getPlainText(), proxyAddress, proxyUserName, proxyPassword, fsJobId); } }
public class class_name { public static long generate(long crc, String value) { if (value == null) { return crc; } int len = value.length(); for (int i = 0; i < len; i++) { char ch = value.charAt(i); if (ch > 0xff) { crc = next(crc, (ch >> 8)); } crc = next(crc, ch); } return crc; } }
public class class_name { public static long generate(long crc, String value) { if (value == null) { return crc; // depends on control dependency: [if], data = [none] } int len = value.length(); for (int i = 0; i < len; i++) { char ch = value.charAt(i); if (ch > 0xff) { crc = next(crc, (ch >> 8)); // depends on control dependency: [if], data = [(ch] } crc = next(crc, ch); // depends on control dependency: [for], data = [none] } return crc; } }
public class class_name { public void clearPassword() { for (char pw[] : this.secrets) { for (int i = 0; i < pw.length; i++) { pw[i] = 0; } } /* Now discard the list. */ this.secrets = new ArrayList<char []>(); } }
public class class_name { public void clearPassword() { for (char pw[] : this.secrets) { for (int i = 0; i < pw.length; i++) { pw[i] = 0; // depends on control dependency: [for], data = [i] } } /* Now discard the list. */ this.secrets = new ArrayList<char []>(); } }
public class class_name { HttpParameter[] asHttpParameterArray() { ArrayList<HttpParameter> params = new ArrayList<HttpParameter>(); if (location != null) { appendParameter("lat", location.getLatitude(), params); appendParameter("long", location.getLongitude(), params); } if (ip != null) { appendParameter("ip", ip, params); } appendParameter("accuracy", accuracy, params); appendParameter("query", query, params); appendParameter("granularity", granularity, params); appendParameter("max_results", maxResults, params); HttpParameter[] paramArray = new HttpParameter[params.size()]; return params.toArray(paramArray); } }
public class class_name { HttpParameter[] asHttpParameterArray() { ArrayList<HttpParameter> params = new ArrayList<HttpParameter>(); if (location != null) { appendParameter("lat", location.getLatitude(), params); // depends on control dependency: [if], data = [none] appendParameter("long", location.getLongitude(), params); // depends on control dependency: [if], data = [none] } if (ip != null) { appendParameter("ip", ip, params); // depends on control dependency: [if], data = [none] } appendParameter("accuracy", accuracy, params); appendParameter("query", query, params); appendParameter("granularity", granularity, params); appendParameter("max_results", maxResults, params); HttpParameter[] paramArray = new HttpParameter[params.size()]; return params.toArray(paramArray); } }
public class class_name { @Override protected void handleEvents(final String EVENT_TYPE) { super.handleEvents(EVENT_TYPE); if ("VISIBILITY".equals(EVENT_TYPE)) { Helper.enableNode(titleText, !tile.getTitle().isEmpty()); Helper.enableNode(valueText, tile.isValueVisible()); Helper.enableNode(timeSpanText, !tile.isTextVisible()); redraw(); } else if ("VALUE".equals(EVENT_TYPE)) { if(tile.isAnimated()) { tile.setAnimated(false); } if (!tile.isAveragingEnabled()) { tile.setAveragingEnabled(true); } double value = clamp(minValue, maxValue, tile.getValue()); addData(value); handleCurrentValue(value); } else if ("AVERAGING".equals(EVENT_TYPE)) { noOfDatapoints = tile.getAveragingPeriod(); // To get smooth lines in the chart we need at least 4 values if (noOfDatapoints < 4) throw new IllegalArgumentException("Please increase the averaging period to a value larger than 3."); for (int i = 0; i < noOfDatapoints; i++) { dataList.add(minValue); } pathElements.clear(); pathElements.add(0, new MoveTo()); for (int i = 1 ; i < noOfDatapoints ; i++) { pathElements.add(i, new LineTo()); } sparkLine.getElements().setAll(pathElements); redraw(); } } }
public class class_name { @Override protected void handleEvents(final String EVENT_TYPE) { super.handleEvents(EVENT_TYPE); if ("VISIBILITY".equals(EVENT_TYPE)) { Helper.enableNode(titleText, !tile.getTitle().isEmpty()); // depends on control dependency: [if], data = [none] Helper.enableNode(valueText, tile.isValueVisible()); // depends on control dependency: [if], data = [none] Helper.enableNode(timeSpanText, !tile.isTextVisible()); // depends on control dependency: [if], data = [none] redraw(); // depends on control dependency: [if], data = [none] } else if ("VALUE".equals(EVENT_TYPE)) { if(tile.isAnimated()) { tile.setAnimated(false); } // depends on control dependency: [if], data = [none] if (!tile.isAveragingEnabled()) { tile.setAveragingEnabled(true); } // depends on control dependency: [if], data = [none] double value = clamp(minValue, maxValue, tile.getValue()); addData(value); // depends on control dependency: [if], data = [none] handleCurrentValue(value); // depends on control dependency: [if], data = [none] } else if ("AVERAGING".equals(EVENT_TYPE)) { noOfDatapoints = tile.getAveragingPeriod(); // depends on control dependency: [if], data = [none] // To get smooth lines in the chart we need at least 4 values if (noOfDatapoints < 4) throw new IllegalArgumentException("Please increase the averaging period to a value larger than 3."); for (int i = 0; i < noOfDatapoints; i++) { dataList.add(minValue); } // depends on control dependency: [for], data = [none] pathElements.clear(); // depends on control dependency: [if], data = [none] pathElements.add(0, new MoveTo()); // depends on control dependency: [if], data = [none] for (int i = 1 ; i < noOfDatapoints ; i++) { pathElements.add(i, new LineTo()); } // depends on control dependency: [for], data = [i] sparkLine.getElements().setAll(pathElements); // depends on control dependency: [if], data = [none] redraw(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public Object parseObject() { Map map = new SimpleBindings(); advance(); if(T.getType() == TokenType.STRING) { parseMember(map); while(T.getType() == TokenType.COMMA) { advance(); parseMember(map); } } checkAndSkip(TokenType.RCURLY, "}"); return map; } }
public class class_name { public Object parseObject() { Map map = new SimpleBindings(); advance(); if(T.getType() == TokenType.STRING) { parseMember(map); // depends on control dependency: [if], data = [none] while(T.getType() == TokenType.COMMA) { advance(); // depends on control dependency: [while], data = [none] parseMember(map); // depends on control dependency: [while], data = [none] } } checkAndSkip(TokenType.RCURLY, "}"); return map; } }
public class class_name { public static void main(final String[] args) throws Exception { if (args.length < 1) { printUsage(); return; } for (int i = 0; i < args.length; i++) { String s = args[i]; if (s.equals("--db")) { db = args[i + 1]; i++; continue; } if (s.equals("--host")) { host = args[i + 1]; i++; continue; } if (s.equals("help")) { printUsage(); return; } if (s.equals("list")) { GridFS fs = getGridFS(); System.out.printf("%-60s %-10s%n", "Filename", "Length"); DBCursor fileListCursor = fs.getFileList(); try { while (fileListCursor.hasNext()) { DBObject o = fileListCursor.next(); System.out.printf("%-60s %-10d%n", o.get("filename"), ((Number) o.get("length")).longValue()); } } finally { fileListCursor.close(); } return; } if (s.equals("get")) { GridFS fs = getGridFS(); String fn = args[i + 1]; GridFSDBFile f = fs.findOne(fn); if (f == null) { System.err.println("can't find file: " + fn); return; } f.writeTo(f.getFilename()); return; } if (s.equals("put")) { GridFS fs = getGridFS(); String fn = args[i + 1]; GridFSInputFile f = fs.createFile(new File(fn)); f.save(); f.validate(); return; } if (s.equals("md5")) { GridFS fs = getGridFS(); String fn = args[i + 1]; GridFSDBFile f = fs.findOne(fn); if (f == null) { System.err.println("can't find file: " + fn); return; } MessageDigest md5 = MessageDigest.getInstance("MD5"); md5.reset(); int read = 0; DigestInputStream is = new DigestInputStream(f.getInputStream(), md5); try { while (is.read() >= 0) { read++; int r = is.read(new byte[17]); if (r < 0) { break; } read += r; } } finally { is.close(); } byte[] digest = md5.digest(); System.out.println("length: " + read + " md5: " + Util.toHex(digest)); return; } System.err.println("unknown option: " + s); return; } } }
public class class_name { public static void main(final String[] args) throws Exception { if (args.length < 1) { printUsage(); return; } for (int i = 0; i < args.length; i++) { String s = args[i]; if (s.equals("--db")) { db = args[i + 1]; i++; continue; } if (s.equals("--host")) { host = args[i + 1]; i++; continue; } if (s.equals("help")) { printUsage(); return; } if (s.equals("list")) { GridFS fs = getGridFS(); System.out.printf("%-60s %-10s%n", "Filename", "Length"); DBCursor fileListCursor = fs.getFileList(); try { while (fileListCursor.hasNext()) { DBObject o = fileListCursor.next(); System.out.printf("%-60s %-10d%n", o.get("filename"), ((Number) o.get("length")).longValue()); // depends on control dependency: [while], data = [none] } } finally { fileListCursor.close(); } return; } if (s.equals("get")) { GridFS fs = getGridFS(); String fn = args[i + 1]; GridFSDBFile f = fs.findOne(fn); if (f == null) { System.err.println("can't find file: " + fn); return; } f.writeTo(f.getFilename()); return; } if (s.equals("put")) { GridFS fs = getGridFS(); String fn = args[i + 1]; GridFSInputFile f = fs.createFile(new File(fn)); f.save(); f.validate(); return; } if (s.equals("md5")) { GridFS fs = getGridFS(); String fn = args[i + 1]; GridFSDBFile f = fs.findOne(fn); if (f == null) { System.err.println("can't find file: " + fn); return; } MessageDigest md5 = MessageDigest.getInstance("MD5"); md5.reset(); int read = 0; DigestInputStream is = new DigestInputStream(f.getInputStream(), md5); try { while (is.read() >= 0) { read++; int r = is.read(new byte[17]); if (r < 0) { break; } read += r; } } finally { is.close(); } byte[] digest = md5.digest(); System.out.println("length: " + read + " md5: " + Util.toHex(digest)); return; } System.err.println("unknown option: " + s); return; } } }
public class class_name { public DeletionTaskFailureReasonType withRoleUsageList(RoleUsageType... roleUsageList) { if (this.roleUsageList == null) { setRoleUsageList(new com.amazonaws.internal.SdkInternalList<RoleUsageType>(roleUsageList.length)); } for (RoleUsageType ele : roleUsageList) { this.roleUsageList.add(ele); } return this; } }
public class class_name { public DeletionTaskFailureReasonType withRoleUsageList(RoleUsageType... roleUsageList) { if (this.roleUsageList == null) { setRoleUsageList(new com.amazonaws.internal.SdkInternalList<RoleUsageType>(roleUsageList.length)); // depends on control dependency: [if], data = [none] } for (RoleUsageType ele : roleUsageList) { this.roleUsageList.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public void setMaxSize(long maxSize) { // if the new maxSize is <= 0, clear keyLRUList if (maxSize <= 0) { keyLRUList.clear(); } else if (maxSize > 0 && this.maxSize <= 0) { // if the new maxSize > 0 and the old is <= 0, fill in LRU list - // order will be meaningless for now Iterator keys = cacheLineTable.keySet().iterator(); while (keys.hasNext()) { keyLRUList.add(keys.next()); } } // if the new maxSize is less than the current cache size, shrink the // cache. if (maxSize > 0 && cacheLineTable.size() > maxSize) { while (cacheLineTable.size() > maxSize) { Object lastKey = keyLRUList.getLast(); removeObject(lastKey); } } this.maxSize = maxSize; } }
public class class_name { public void setMaxSize(long maxSize) { // if the new maxSize is <= 0, clear keyLRUList if (maxSize <= 0) { keyLRUList.clear(); // depends on control dependency: [if], data = [none] } else if (maxSize > 0 && this.maxSize <= 0) { // if the new maxSize > 0 and the old is <= 0, fill in LRU list - // order will be meaningless for now Iterator keys = cacheLineTable.keySet().iterator(); while (keys.hasNext()) { keyLRUList.add(keys.next()); // depends on control dependency: [while], data = [none] } } // if the new maxSize is less than the current cache size, shrink the // cache. if (maxSize > 0 && cacheLineTable.size() > maxSize) { while (cacheLineTable.size() > maxSize) { Object lastKey = keyLRUList.getLast(); removeObject(lastKey); // depends on control dependency: [while], data = [none] } } this.maxSize = maxSize; } }
public class class_name { protected String resolveAlias(final String value) { final StringBuilder result = new StringBuilder(value.length()); int i = 0; int len = value.length(); while (i < len) { int ndx = value.indexOf('<', i); if (ndx == -1) { // alias markers not found if (i == 0) { // try whole string as an alias String alias = lookupAlias(value); return (alias != null ? alias : value); } else { result.append(value.substring(i)); } break; } // alias marked found result.append(value.substring(i, ndx)); ndx++; int ndx2 = value.indexOf('>', ndx); String aliasName = (ndx2 == -1 ? value.substring(ndx) : value.substring(ndx, ndx2)); // process alias String alias = lookupAlias(aliasName); if (alias != null) { result.append(alias); } else { // alias not found if (log.isWarnEnabled()) { log.warn("Alias not found: " + aliasName); } } i = ndx2 + 1; } // fix prefix '//' - may happened when aliases are used i = 0; len = result.length(); while (i < len) { if (result.charAt(i) != '/') { break; } i++; } if (i > 1) { return result.substring(i - 1, len); } return result.toString(); } }
public class class_name { protected String resolveAlias(final String value) { final StringBuilder result = new StringBuilder(value.length()); int i = 0; int len = value.length(); while (i < len) { int ndx = value.indexOf('<', i); if (ndx == -1) { // alias markers not found if (i == 0) { // try whole string as an alias String alias = lookupAlias(value); return (alias != null ? alias : value); // depends on control dependency: [if], data = [none] } else { result.append(value.substring(i)); // depends on control dependency: [if], data = [(i] } break; } // alias marked found result.append(value.substring(i, ndx)); // depends on control dependency: [while], data = [(i] ndx++; // depends on control dependency: [while], data = [none] int ndx2 = value.indexOf('>', ndx); String aliasName = (ndx2 == -1 ? value.substring(ndx) : value.substring(ndx, ndx2)); // process alias String alias = lookupAlias(aliasName); if (alias != null) { result.append(alias); // depends on control dependency: [if], data = [(alias] } else { // alias not found if (log.isWarnEnabled()) { log.warn("Alias not found: " + aliasName); // depends on control dependency: [if], data = [none] } } i = ndx2 + 1; // depends on control dependency: [while], data = [none] } // fix prefix '//' - may happened when aliases are used i = 0; len = result.length(); while (i < len) { if (result.charAt(i) != '/') { break; } i++; // depends on control dependency: [while], data = [none] } if (i > 1) { return result.substring(i - 1, len); // depends on control dependency: [if], data = [(i] } return result.toString(); } }
public class class_name { private void checkTypeDepth(Feature feature, Class<?> current) { for (final Class<?> type : current.getInterfaces()) { if (type.isAnnotationPresent(FeatureInterface.class)) { final Feature old; // CHECKSTYLE IGNORE LINE: InnerAssignment if ((old = typeToFeature.put(type.asSubclass(Feature.class), feature)) != null) { throw new LionEngineException(ERROR_FEATURE_EXISTS + feature.getClass() + AS + type + WITH + old.getClass()); } checkTypeDepth(feature, type); } } final Class<?> parent = current.getSuperclass(); if (parent != null) { checkTypeDepth(feature, parent); } } }
public class class_name { private void checkTypeDepth(Feature feature, Class<?> current) { for (final Class<?> type : current.getInterfaces()) { if (type.isAnnotationPresent(FeatureInterface.class)) { final Feature old; // CHECKSTYLE IGNORE LINE: InnerAssignment if ((old = typeToFeature.put(type.asSubclass(Feature.class), feature)) != null) { throw new LionEngineException(ERROR_FEATURE_EXISTS + feature.getClass() + AS + type + WITH + old.getClass()); } checkTypeDepth(feature, type); // depends on control dependency: [if], data = [none] } } final Class<?> parent = current.getSuperclass(); if (parent != null) { checkTypeDepth(feature, parent); // depends on control dependency: [if], data = [none] } } }
public class class_name { public String getConfigFilePath(CmsObject cms, String configFile) { String path = CmsStringUtil.joinPaths(VFS_CONFIG_OVERRIDE_FOLDER, configFile); if (!cms.existsResource(path)) { path = CmsStringUtil.joinPaths(VFS_CONFIG_FOLDER, configFile); } return path; } }
public class class_name { public String getConfigFilePath(CmsObject cms, String configFile) { String path = CmsStringUtil.joinPaths(VFS_CONFIG_OVERRIDE_FOLDER, configFile); if (!cms.existsResource(path)) { path = CmsStringUtil.joinPaths(VFS_CONFIG_FOLDER, configFile); // depends on control dependency: [if], data = [none] } return path; } }
public class class_name { private static void setViewFields(final Object object, final ViewFinder viewFinder) { Field[] fields = object.getClass().getDeclaredFields(); for (Field field : fields) { if (field.isAnnotationPresent(ViewId.class)) { field.setAccessible(true); ViewId viewIdAnnotation = field.getAnnotation(ViewId.class); try { field.set(object, field.getType().cast(viewFinder.findViewById(viewIdAnnotation.value()))); } catch (IllegalAccessException e) { e.printStackTrace(); } } } } }
public class class_name { private static void setViewFields(final Object object, final ViewFinder viewFinder) { Field[] fields = object.getClass().getDeclaredFields(); for (Field field : fields) { if (field.isAnnotationPresent(ViewId.class)) { field.setAccessible(true); // depends on control dependency: [if], data = [none] ViewId viewIdAnnotation = field.getAnnotation(ViewId.class); try { field.set(object, field.getType().cast(viewFinder.findViewById(viewIdAnnotation.value()))); // depends on control dependency: [try], data = [none] } catch (IllegalAccessException e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none] } } } }
public class class_name { protected UUID translateUserId(User user) { if (user == null) { return null; } return userController.getUserKeycloakId(user); } }
public class class_name { protected UUID translateUserId(User user) { if (user == null) { return null; // depends on control dependency: [if], data = [none] } return userController.getUserKeycloakId(user); } }
public class class_name { public static List<String> getDeployed(String url, String token) throws Exception { List<String> deployed = new ArrayList<String> (); HttpClient client = httpClient(); HttpGet get = new HttpGet(url + "/system/deployment/list"); addAuthHeader(token, get); HttpResponse resp = client.execute(get); if(resp.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { List<String> respList = new Gson().fromJson(EntityUtils.toString(resp.getEntity()), new TypeToken<List<String>>() {}.getType()); if(respList != null) { deployed.addAll(respList); } } return deployed; } }
public class class_name { public static List<String> getDeployed(String url, String token) throws Exception { List<String> deployed = new ArrayList<String> (); HttpClient client = httpClient(); HttpGet get = new HttpGet(url + "/system/deployment/list"); addAuthHeader(token, get); HttpResponse resp = client.execute(get); if(resp.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { List<String> respList = new Gson().fromJson(EntityUtils.toString(resp.getEntity()), new TypeToken<List<String>>() {}.getType()); if(respList != null) { deployed.addAll(respList); // depends on control dependency: [if], data = [(respList] } } return deployed; } }
public class class_name { public void setRange(double A, double B) { if(A == B) throw new RuntimeException("Values must be different"); else if(B > A) { double tmp = A; A = B; B = tmp; } this.A = A; this.B = B; } }
public class class_name { public void setRange(double A, double B) { if(A == B) throw new RuntimeException("Values must be different"); else if(B > A) { double tmp = A; A = B; // depends on control dependency: [if], data = [none] B = tmp; // depends on control dependency: [if], data = [none] } this.A = A; this.B = B; } }
public class class_name { void zApplyAllowKeyboardEditing() { if (parentDatePicker == null) { return; } // Set the editability of the date picker text field. parentDatePicker.getComponentDateTextField().setEditable(allowKeyboardEditing); // Set the text field border color based on whether the text field is editable. Color textFieldBorderColor = (allowKeyboardEditing) ? InternalConstants.colorEditableTextFieldBorder : InternalConstants.colorNotEditableTextFieldBorder; parentDatePicker.getComponentDateTextField().setBorder(new CompoundBorder( new MatteBorder(1, 1, 1, 1, textFieldBorderColor), new EmptyBorder(1, 3, 2, 2))); } }
public class class_name { void zApplyAllowKeyboardEditing() { if (parentDatePicker == null) { return; // depends on control dependency: [if], data = [none] } // Set the editability of the date picker text field. parentDatePicker.getComponentDateTextField().setEditable(allowKeyboardEditing); // Set the text field border color based on whether the text field is editable. Color textFieldBorderColor = (allowKeyboardEditing) ? InternalConstants.colorEditableTextFieldBorder : InternalConstants.colorNotEditableTextFieldBorder; parentDatePicker.getComponentDateTextField().setBorder(new CompoundBorder( new MatteBorder(1, 1, 1, 1, textFieldBorderColor), new EmptyBorder(1, 3, 2, 2))); } }
public class class_name { private String getSingleSize(CmsObject cms, CmsResource res) { try { BufferedImage img = Simapi.read(cms.readFile(res).getContents()); return "" + img.getWidth() + " x " + img.getHeight() + "px"; } catch (CmsException | IOException e) { return ""; } } }
public class class_name { private String getSingleSize(CmsObject cms, CmsResource res) { try { BufferedImage img = Simapi.read(cms.readFile(res).getContents()); return "" + img.getWidth() + " x " + img.getHeight() + "px"; // depends on control dependency: [try], data = [none] } catch (CmsException | IOException e) { return ""; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public Boolean save(@NotNull V entity) { Timer saveAsyncTimer = METRICS.getTimer(MetricsType.DATA_PROVIDER_SAVE.name()); Insert insert = QueryBuilder.insertInto(getEntityMetadata().getTableName()); List<ColumnMetadata> columns = getEntityMetadata().getFieldMetaData(); columns.forEach(column -> insert.value(column.getName(), QueryBuilder.bindMarker())); try { String keyspace = getEntityMetadata().getKeyspace(); PreparedStatement prepare = getCassandraClient().prepare(keyspace, insert.getQueryString()); prepare.setConsistencyLevel(getWriteConsistencyLevel()); BoundStatement boundStatement = createBoundStatement(prepare, entity, columns); ResultSet input = getCassandraClient().execute(keyspace, boundStatement); return input.wasApplied(); } catch (SyntaxError e) { LOGGER.warn("Can't prepare query: " + insert.getQueryString(), e); } finally { saveAsyncTimer.stop(); } return false; } }
public class class_name { public Boolean save(@NotNull V entity) { Timer saveAsyncTimer = METRICS.getTimer(MetricsType.DATA_PROVIDER_SAVE.name()); Insert insert = QueryBuilder.insertInto(getEntityMetadata().getTableName()); List<ColumnMetadata> columns = getEntityMetadata().getFieldMetaData(); columns.forEach(column -> insert.value(column.getName(), QueryBuilder.bindMarker())); try { String keyspace = getEntityMetadata().getKeyspace(); PreparedStatement prepare = getCassandraClient().prepare(keyspace, insert.getQueryString()); prepare.setConsistencyLevel(getWriteConsistencyLevel()); // depends on control dependency: [try], data = [none] BoundStatement boundStatement = createBoundStatement(prepare, entity, columns); ResultSet input = getCassandraClient().execute(keyspace, boundStatement); return input.wasApplied(); // depends on control dependency: [try], data = [none] } catch (SyntaxError e) { LOGGER.warn("Can't prepare query: " + insert.getQueryString(), e); } finally { // depends on control dependency: [catch], data = [none] saveAsyncTimer.stop(); } return false; } }
public class class_name { public final int loadWorkbook(final InputStream fis, final Map<String, Object> dataContext) { try { Workbook wb = WorkbookFactory.create(fis); int ireturn = loadWorkbook(wb, dataContext); fis.close(); return ireturn; } catch (Exception e) { LOG.log(Level.SEVERE, "Web Form loadWorkbook Error Exception = " + e.getLocalizedMessage(), e); return -1; } } }
public class class_name { public final int loadWorkbook(final InputStream fis, final Map<String, Object> dataContext) { try { Workbook wb = WorkbookFactory.create(fis); int ireturn = loadWorkbook(wb, dataContext); fis.close(); // depends on control dependency: [try], data = [none] return ireturn; // depends on control dependency: [try], data = [none] } catch (Exception e) { LOG.log(Level.SEVERE, "Web Form loadWorkbook Error Exception = " + e.getLocalizedMessage(), e); return -1; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void paint(Paintable paintable, Object group, MapContext context) { if (paintable != null) { Feature feature = (Feature) paintable; WorldViewTransformer worldViewTransformer = feature.getLayer().getMapModel().getMapView() .getWorldViewTransformer(); Geometry geometry = worldViewTransformer.worldToPan(feature.getGeometry()); ShapeStyle style = createStyleForFeature(feature); PaintableGroup selectionGroup = feature.getLayer().getSelectionGroup(); context.getVectorContext().drawGroup(selectionGroup, feature); String name = feature.getLayer().getId() + "-" + feature.getId(); switch (geometry.getLayerType()) { case LINESTRING: context.getVectorContext().drawLine(feature, name, (LineString) geometry, style); break; case MULTILINESTRING: MultiLineString mls = (MultiLineString) geometry; for (int i = 0; i < mls.getNumGeometries(); i++) { context.getVectorContext().drawLine(feature, name + "." + i, (LineString) mls.getGeometryN(i), style); } break; case POLYGON: context.getVectorContext().drawPolygon(feature, name, (Polygon) geometry, style); break; case MULTIPOLYGON: MultiPolygon mp = (MultiPolygon) geometry; for (int i = 0; i < mp.getNumGeometries(); i++) { context.getVectorContext().drawPolygon(feature, name + "." + i, (Polygon) mp.getGeometryN(i), style); } break; case POINT: if (hasImageSymbol(feature)) { context.getVectorContext().drawSymbol(feature, name, geometry.getCoordinate(), null, feature.getStyleId() + "-selection"); } else { context.getVectorContext().drawSymbol(feature, name, geometry.getCoordinate(), style, feature.getStyleId()); } break; case MULTIPOINT: Coordinate[] coordinates = geometry.getCoordinates(); if (hasImageSymbol(feature)) { for (int i = 0; i < coordinates.length; i++) { context.getVectorContext().drawSymbol(feature, name + "." + i, coordinates[i], null, feature.getStyleId() + "-selection"); } } else { for (int i = 0; i < coordinates.length; i++) { context.getVectorContext().drawSymbol(feature, name + "." + i, coordinates[i], style, feature.getStyleId()); } } break; default: throw new IllegalStateException("Cannot draw feature with Geometry type " + geometry.getLayerType()); } } } }
public class class_name { public void paint(Paintable paintable, Object group, MapContext context) { if (paintable != null) { Feature feature = (Feature) paintable; WorldViewTransformer worldViewTransformer = feature.getLayer().getMapModel().getMapView() .getWorldViewTransformer(); Geometry geometry = worldViewTransformer.worldToPan(feature.getGeometry()); ShapeStyle style = createStyleForFeature(feature); PaintableGroup selectionGroup = feature.getLayer().getSelectionGroup(); context.getVectorContext().drawGroup(selectionGroup, feature); // depends on control dependency: [if], data = [none] String name = feature.getLayer().getId() + "-" + feature.getId(); switch (geometry.getLayerType()) { case LINESTRING: context.getVectorContext().drawLine(feature, name, (LineString) geometry, style); // depends on control dependency: [if], data = [none] break; case MULTILINESTRING: MultiLineString mls = (MultiLineString) geometry; for (int i = 0; i < mls.getNumGeometries(); i++) { context.getVectorContext().drawLine(feature, name + "." + i, (LineString) mls.getGeometryN(i), style); // depends on control dependency: [for], data = [none] } break; case POLYGON: context.getVectorContext().drawPolygon(feature, name, (Polygon) geometry, style); break; case MULTIPOLYGON: MultiPolygon mp = (MultiPolygon) geometry; for (int i = 0; i < mp.getNumGeometries(); i++) { context.getVectorContext().drawPolygon(feature, name + "." + i, (Polygon) mp.getGeometryN(i), style); // depends on control dependency: [for], data = [none] } break; case POINT: if (hasImageSymbol(feature)) { context.getVectorContext().drawSymbol(feature, name, geometry.getCoordinate(), null, feature.getStyleId() + "-selection"); // depends on control dependency: [if], data = [none] } else { context.getVectorContext().drawSymbol(feature, name, geometry.getCoordinate(), style, feature.getStyleId()); // depends on control dependency: [if], data = [none] } break; case MULTIPOINT: Coordinate[] coordinates = geometry.getCoordinates(); if (hasImageSymbol(feature)) { for (int i = 0; i < coordinates.length; i++) { context.getVectorContext().drawSymbol(feature, name + "." + i, coordinates[i], null, feature.getStyleId() + "-selection"); // depends on control dependency: [for], data = [none] } } else { for (int i = 0; i < coordinates.length; i++) { context.getVectorContext().drawSymbol(feature, name + "." + i, coordinates[i], style, feature.getStyleId()); // depends on control dependency: [for], data = [none] } } break; default: throw new IllegalStateException("Cannot draw feature with Geometry type " + geometry.getLayerType()); } } } }
public class class_name { public String extract(Object target) { if (target == null) { return null; } Document sourceDoc = (Document) target; Element sourceElement = sourceDoc.getDocumentElement(); String nsUri = namespace == null ? sourceElement.getNamespaceURI() : namespace; if (sourceElement.hasAttributeNS(nsUri, nodeName)) { return sourceElement.getAttributeNS(nsUri, nodeName); } else { NodeList candidates = sourceElement.getElementsByTagNameNS(nsUri, nodeName); if (candidates.getLength() > 0) { return candidates.item(0).getTextContent(); } } return null; } }
public class class_name { public String extract(Object target) { if (target == null) { return null; // depends on control dependency: [if], data = [none] } Document sourceDoc = (Document) target; Element sourceElement = sourceDoc.getDocumentElement(); String nsUri = namespace == null ? sourceElement.getNamespaceURI() : namespace; if (sourceElement.hasAttributeNS(nsUri, nodeName)) { return sourceElement.getAttributeNS(nsUri, nodeName); // depends on control dependency: [if], data = [none] } else { NodeList candidates = sourceElement.getElementsByTagNameNS(nsUri, nodeName); if (candidates.getLength() > 0) { return candidates.item(0).getTextContent(); // depends on control dependency: [if], data = [0)] } } return null; } }
public class class_name { @Deprecated public static void setEnableAcking(Map<String, Object> conf, boolean acking) { if (acking) { setTopologyReliabilityMode(conf, Config.TopologyReliabilityMode.ATLEAST_ONCE); } else { setTopologyReliabilityMode(conf, Config.TopologyReliabilityMode.ATMOST_ONCE); } } }
public class class_name { @Deprecated public static void setEnableAcking(Map<String, Object> conf, boolean acking) { if (acking) { setTopologyReliabilityMode(conf, Config.TopologyReliabilityMode.ATLEAST_ONCE); // depends on control dependency: [if], data = [none] } else { setTopologyReliabilityMode(conf, Config.TopologyReliabilityMode.ATMOST_ONCE); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void marshall(Scte35SegmentationDescriptor scte35SegmentationDescriptor, ProtocolMarshaller protocolMarshaller) { if (scte35SegmentationDescriptor == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(scte35SegmentationDescriptor.getDeliveryRestrictions(), DELIVERYRESTRICTIONS_BINDING); protocolMarshaller.marshall(scte35SegmentationDescriptor.getSegmentNum(), SEGMENTNUM_BINDING); protocolMarshaller.marshall(scte35SegmentationDescriptor.getSegmentationCancelIndicator(), SEGMENTATIONCANCELINDICATOR_BINDING); protocolMarshaller.marshall(scte35SegmentationDescriptor.getSegmentationDuration(), SEGMENTATIONDURATION_BINDING); protocolMarshaller.marshall(scte35SegmentationDescriptor.getSegmentationEventId(), SEGMENTATIONEVENTID_BINDING); protocolMarshaller.marshall(scte35SegmentationDescriptor.getSegmentationTypeId(), SEGMENTATIONTYPEID_BINDING); protocolMarshaller.marshall(scte35SegmentationDescriptor.getSegmentationUpid(), SEGMENTATIONUPID_BINDING); protocolMarshaller.marshall(scte35SegmentationDescriptor.getSegmentationUpidType(), SEGMENTATIONUPIDTYPE_BINDING); protocolMarshaller.marshall(scte35SegmentationDescriptor.getSegmentsExpected(), SEGMENTSEXPECTED_BINDING); protocolMarshaller.marshall(scte35SegmentationDescriptor.getSubSegmentNum(), SUBSEGMENTNUM_BINDING); protocolMarshaller.marshall(scte35SegmentationDescriptor.getSubSegmentsExpected(), SUBSEGMENTSEXPECTED_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(Scte35SegmentationDescriptor scte35SegmentationDescriptor, ProtocolMarshaller protocolMarshaller) { if (scte35SegmentationDescriptor == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(scte35SegmentationDescriptor.getDeliveryRestrictions(), DELIVERYRESTRICTIONS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(scte35SegmentationDescriptor.getSegmentNum(), SEGMENTNUM_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(scte35SegmentationDescriptor.getSegmentationCancelIndicator(), SEGMENTATIONCANCELINDICATOR_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(scte35SegmentationDescriptor.getSegmentationDuration(), SEGMENTATIONDURATION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(scte35SegmentationDescriptor.getSegmentationEventId(), SEGMENTATIONEVENTID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(scte35SegmentationDescriptor.getSegmentationTypeId(), SEGMENTATIONTYPEID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(scte35SegmentationDescriptor.getSegmentationUpid(), SEGMENTATIONUPID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(scte35SegmentationDescriptor.getSegmentationUpidType(), SEGMENTATIONUPIDTYPE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(scte35SegmentationDescriptor.getSegmentsExpected(), SEGMENTSEXPECTED_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(scte35SegmentationDescriptor.getSubSegmentNum(), SUBSEGMENTNUM_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(scte35SegmentationDescriptor.getSubSegmentsExpected(), SUBSEGMENTSEXPECTED_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void clear() { requests.clear(); rootCurrentContextsByThreadId.clear(); if (errors != null) { synchronized (errors) { errors.clear(); } } startDate = new Date(); } }
public class class_name { public void clear() { requests.clear(); rootCurrentContextsByThreadId.clear(); if (errors != null) { synchronized (errors) { // depends on control dependency: [if], data = [(errors] errors.clear(); } } startDate = new Date(); } }
public class class_name { public void setExposeHeaders(java.util.Collection<String> exposeHeaders) { if (exposeHeaders == null) { this.exposeHeaders = null; return; } this.exposeHeaders = new java.util.ArrayList<String>(exposeHeaders); } }
public class class_name { public void setExposeHeaders(java.util.Collection<String> exposeHeaders) { if (exposeHeaders == null) { this.exposeHeaders = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.exposeHeaders = new java.util.ArrayList<String>(exposeHeaders); } }
public class class_name { public void marshall(GameSessionQueue gameSessionQueue, ProtocolMarshaller protocolMarshaller) { if (gameSessionQueue == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(gameSessionQueue.getName(), NAME_BINDING); protocolMarshaller.marshall(gameSessionQueue.getGameSessionQueueArn(), GAMESESSIONQUEUEARN_BINDING); protocolMarshaller.marshall(gameSessionQueue.getTimeoutInSeconds(), TIMEOUTINSECONDS_BINDING); protocolMarshaller.marshall(gameSessionQueue.getPlayerLatencyPolicies(), PLAYERLATENCYPOLICIES_BINDING); protocolMarshaller.marshall(gameSessionQueue.getDestinations(), DESTINATIONS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(GameSessionQueue gameSessionQueue, ProtocolMarshaller protocolMarshaller) { if (gameSessionQueue == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(gameSessionQueue.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(gameSessionQueue.getGameSessionQueueArn(), GAMESESSIONQUEUEARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(gameSessionQueue.getTimeoutInSeconds(), TIMEOUTINSECONDS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(gameSessionQueue.getPlayerLatencyPolicies(), PLAYERLATENCYPOLICIES_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(gameSessionQueue.getDestinations(), DESTINATIONS_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public int strId2IdxAdd(Map fmap) { strId2Idx(fmap); if (idx < 0) { idx = fmap.size(); fmap.put(strId, new Integer(idx)); } return idx; } }
public class class_name { public int strId2IdxAdd(Map fmap) { strId2Idx(fmap); if (idx < 0) { idx = fmap.size(); // depends on control dependency: [if], data = [none] fmap.put(strId, new Integer(idx)); // depends on control dependency: [if], data = [(idx] } return idx; } }
public class class_name { private String placeLayerBelow() { if (belowLayer == null || belowLayer.isEmpty()) { List<Layer> styleLayers = style.getLayers(); Layer layer; for (int i = styleLayers.size() - 1; i >= 0; i--) { layer = styleLayers.get(i); if (!(layer instanceof SymbolLayer)) { return layer.getId(); } } } return belowLayer; } }
public class class_name { private String placeLayerBelow() { if (belowLayer == null || belowLayer.isEmpty()) { List<Layer> styleLayers = style.getLayers(); Layer layer; for (int i = styleLayers.size() - 1; i >= 0; i--) { layer = styleLayers.get(i); // depends on control dependency: [for], data = [i] if (!(layer instanceof SymbolLayer)) { return layer.getId(); // depends on control dependency: [if], data = [none] } } } return belowLayer; } }
public class class_name { public static Set<URL> getBootstrappedLibraries() { final String name = PREFIX + SREBootstrap.class.getName(); final Set<URL> result = new TreeSet<>(); try { final Enumeration<URL> enumr = ClassLoader.getSystemResources(name); while (enumr.hasMoreElements()) { final URL url = enumr.nextElement(); if (url != null) { result.add(url); } } } catch (Exception exception) { // } return result; } }
public class class_name { public static Set<URL> getBootstrappedLibraries() { final String name = PREFIX + SREBootstrap.class.getName(); final Set<URL> result = new TreeSet<>(); try { final Enumeration<URL> enumr = ClassLoader.getSystemResources(name); while (enumr.hasMoreElements()) { final URL url = enumr.nextElement(); if (url != null) { result.add(url); // depends on control dependency: [if], data = [(url] } } } catch (Exception exception) { // } // depends on control dependency: [catch], data = [none] return result; } }
public class class_name { public void deltaEnd(long time) { endCount.incrementAndGet(); if (time > 0) { endTotalTime.addAndGet(time); if (time > endMaxTime.get()) endMaxTime.set(time); } } }
public class class_name { public void deltaEnd(long time) { endCount.incrementAndGet(); if (time > 0) { endTotalTime.addAndGet(time); // depends on control dependency: [if], data = [(time] if (time > endMaxTime.get()) endMaxTime.set(time); } } }
public class class_name { public static boolean isAssignableFrom(Class<?> assignedCls, Class<?> assigningCls){ if(isNativeNumberType(assigningCls) && isNativeNumberType(assignedCls)){ return isNumberImplicitlyCastableFrom(assignedCls, assigningCls); } return assignedCls.isAssignableFrom(assigningCls); } }
public class class_name { public static boolean isAssignableFrom(Class<?> assignedCls, Class<?> assigningCls){ if(isNativeNumberType(assigningCls) && isNativeNumberType(assignedCls)){ return isNumberImplicitlyCastableFrom(assignedCls, assigningCls); // depends on control dependency: [if], data = [none] } return assignedCls.isAssignableFrom(assigningCls); } }
public class class_name { public static byte[] encode(final byte[] input, final boolean urlSafeEncoding) { final int lenInput = input.length; final int lenOutput = roundOut(lenInput * 8, BITS_PER_B64_BYTE); final int padding = (urlSafeEncoding ? 0 : paddingOut(lenOutput, BYTES_PER_BLOCK_OF_6_BITS)); final byte[] output = new byte[lenOutput + padding]; final byte[] transTable = (urlSafeEncoding ? ENCODE_TABLE_URL_SAFE : ENCODE_TABLE_STD); for (int i = 0, j = 0; i < lenInput; i += BYTES_PER_BLOCK_OF_8_BITS) { final int b1 = getByte(input, i); final int b2 = getByte(input, i + 1); final int b3 = getByte(input, i + 2); final long block = (b1 << 16 | b2 << 8 | b3) & 0x00FFFFFF; setByte(output, j++, lenOutput, transTable[(int) ((block >> 18) & 0x3F)]); setByte(output, j++, lenOutput, transTable[(int) ((block >> 12) & 0x3F)]); setByte(output, j++, lenOutput, transTable[(int) ((block >> 6) & 0x3F)]); setByte(output, j++, lenOutput, transTable[(int) (block & 0x3F)]); } if (padding > 0) { int j = output.length - padding; while (j < output.length) { output[j++] = (byte) PADDING_CHAR_STD; } } return output; } }
public class class_name { public static byte[] encode(final byte[] input, final boolean urlSafeEncoding) { final int lenInput = input.length; final int lenOutput = roundOut(lenInput * 8, BITS_PER_B64_BYTE); final int padding = (urlSafeEncoding ? 0 : paddingOut(lenOutput, BYTES_PER_BLOCK_OF_6_BITS)); final byte[] output = new byte[lenOutput + padding]; final byte[] transTable = (urlSafeEncoding ? ENCODE_TABLE_URL_SAFE : ENCODE_TABLE_STD); for (int i = 0, j = 0; i < lenInput; i += BYTES_PER_BLOCK_OF_8_BITS) { final int b1 = getByte(input, i); final int b2 = getByte(input, i + 1); final int b3 = getByte(input, i + 2); final long block = (b1 << 16 | b2 << 8 | b3) & 0x00FFFFFF; setByte(output, j++, lenOutput, transTable[(int) ((block >> 18) & 0x3F)]); // depends on control dependency: [for], data = [none] setByte(output, j++, lenOutput, transTable[(int) ((block >> 12) & 0x3F)]); // depends on control dependency: [for], data = [none] setByte(output, j++, lenOutput, transTable[(int) ((block >> 6) & 0x3F)]); // depends on control dependency: [for], data = [none] setByte(output, j++, lenOutput, transTable[(int) (block & 0x3F)]); // depends on control dependency: [for], data = [none] } if (padding > 0) { int j = output.length - padding; while (j < output.length) { output[j++] = (byte) PADDING_CHAR_STD; // depends on control dependency: [while], data = [none] } } return output; } }
public class class_name { private static String jarFileName() { // do this first so we can access extractor, ok to invoke more than once createExtractor(); // get <name> from path/<name>.jar String fullyQualifiedFileName = extractor.container.getName(); int lastSeparator = fullyQualifiedFileName.lastIndexOf(File.separatorChar); String simpleFileName = fullyQualifiedFileName.substring(lastSeparator + 1); int dotIdx = simpleFileName.lastIndexOf('.'); if (dotIdx != -1) { return simpleFileName.substring(0, simpleFileName.lastIndexOf('.')); } return simpleFileName; } }
public class class_name { private static String jarFileName() { // do this first so we can access extractor, ok to invoke more than once createExtractor(); // get <name> from path/<name>.jar String fullyQualifiedFileName = extractor.container.getName(); int lastSeparator = fullyQualifiedFileName.lastIndexOf(File.separatorChar); String simpleFileName = fullyQualifiedFileName.substring(lastSeparator + 1); int dotIdx = simpleFileName.lastIndexOf('.'); if (dotIdx != -1) { return simpleFileName.substring(0, simpleFileName.lastIndexOf('.')); // depends on control dependency: [if], data = [none] } return simpleFileName; } }
public class class_name { public static Class<?> toClass(ClassFile ct, ClassLoader loader, ProtectionDomain domain) { try { byte[] b = ct.toBytecode(); java.lang.reflect.Method method; Object[] args; if (domain == null) { method = defineClass1; args = new Object[] { ct.getName(), b, 0, b.length }; } else { method = defineClass2; args = new Object[] { ct.getName(), b, 0, b.length, domain }; } return toClass2(method, loader, args); } catch (RuntimeException e) { throw e; } catch (java.lang.reflect.InvocationTargetException e) { throw new RuntimeException(e.getTargetException()); } catch (Exception e) { throw new RuntimeException(e); } } }
public class class_name { public static Class<?> toClass(ClassFile ct, ClassLoader loader, ProtectionDomain domain) { try { byte[] b = ct.toBytecode(); java.lang.reflect.Method method; Object[] args; if (domain == null) { method = defineClass1; // depends on control dependency: [if], data = [none] args = new Object[] { ct.getName(), b, 0, b.length }; // depends on control dependency: [if], data = [none] } else { method = defineClass2; // depends on control dependency: [if], data = [none] args = new Object[] { ct.getName(), b, 0, b.length, domain }; // depends on control dependency: [if], data = [none] } return toClass2(method, loader, args); } catch (RuntimeException e) { throw e; } catch (java.lang.reflect.InvocationTargetException e) { throw new RuntimeException(e.getTargetException()); } catch (Exception e) { throw new RuntimeException(e); } } }
public class class_name { @Pure public IExpressionBuilder getDefaultValue() { if (this.defaultValue == null) { this.defaultValue = this.expressionProvider.get(); this.defaultValue.eInit(this.parameter, new Procedures.Procedure1<XExpression>() { public void apply(XExpression it) { getSarlFormalParameter().setDefaultValue(it); } }, getTypeResolutionContext()); } return this.defaultValue; } }
public class class_name { @Pure public IExpressionBuilder getDefaultValue() { if (this.defaultValue == null) { this.defaultValue = this.expressionProvider.get(); // depends on control dependency: [if], data = [none] this.defaultValue.eInit(this.parameter, new Procedures.Procedure1<XExpression>() { public void apply(XExpression it) { getSarlFormalParameter().setDefaultValue(it); } }, getTypeResolutionContext()); // depends on control dependency: [if], data = [none] } return this.defaultValue; } }
public class class_name { protected boolean setException(Throwable throwable) { boolean result = sync.setException(checkNotNull(throwable)); if (result) { executionList.execute(); } return result; } }
public class class_name { protected boolean setException(Throwable throwable) { boolean result = sync.setException(checkNotNull(throwable)); if (result) { executionList.execute(); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { public void shutdownNow() { logger.warn("Shutting down FlowRunnerManager now..."); if (this.azkabanProps.getBoolean(ConfigurationKeys.AZKABAN_POLL_MODEL, false)) { this.pollingService.shutdown(); } this.executorService.shutdownNow(); this.triggerManager.shutdown(); } }
public class class_name { public void shutdownNow() { logger.warn("Shutting down FlowRunnerManager now..."); if (this.azkabanProps.getBoolean(ConfigurationKeys.AZKABAN_POLL_MODEL, false)) { this.pollingService.shutdown(); // depends on control dependency: [if], data = [none] } this.executorService.shutdownNow(); this.triggerManager.shutdown(); } }
public class class_name { protected boolean isInvalidPath(String path) { if (path.contains("WEB-INF") || path.contains("META-INF")) { if (logger.isWarnEnabled()) { logger.warn("Path with \"WEB-INF\" or \"META-INF\": [" + path + "]"); } return true; } if (path.contains(":/")) { String relativePath = (path.charAt(0) == '/' ? path.substring(1) : path); if (ResourceUtils.isUrl(relativePath) || relativePath.startsWith("url:")) { if (logger.isWarnEnabled()) { logger.warn( "Path represents URL or has \"url:\" prefix: [" + path + "]"); } return true; } } if (path.contains("..") && StringUtils.cleanPath(path).contains("../")) { if (logger.isWarnEnabled()) { logger.warn("Path contains \"../\" after call to StringUtils#cleanPath: [" + path + "]"); } return true; } return false; } }
public class class_name { protected boolean isInvalidPath(String path) { if (path.contains("WEB-INF") || path.contains("META-INF")) { if (logger.isWarnEnabled()) { logger.warn("Path with \"WEB-INF\" or \"META-INF\": [" + path + "]"); // depends on control dependency: [if], data = [none] } return true; // depends on control dependency: [if], data = [none] } if (path.contains(":/")) { String relativePath = (path.charAt(0) == '/' ? path.substring(1) : path); if (ResourceUtils.isUrl(relativePath) || relativePath.startsWith("url:")) { if (logger.isWarnEnabled()) { logger.warn( "Path represents URL or has \"url:\" prefix: [" + path + "]"); // depends on control dependency: [if], data = [none] } return true; // depends on control dependency: [if], data = [none] } } if (path.contains("..") && StringUtils.cleanPath(path).contains("../")) { if (logger.isWarnEnabled()) { logger.warn("Path contains \"../\" after call to StringUtils#cleanPath: [" + path + "]"); } return true; } return false; } }
public class class_name { public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { final ModelNode userMap = this.userDomain; List<Callback> toRespondTo = new LinkedList<Callback>(); String userName = null; ModelNode user = null; ExceptionSupplier<CredentialSource, Exception> userCredentialSourceSupplier = null; // A single pass may be sufficient but by using a two pass approach the Callbackhandler will not // fail if an unexpected order is encountered. // First Pass - is to double check no unsupported callbacks and to retrieve // information from the callbacks passing in information. for (Callback current : callbacks) { if (current instanceof AuthorizeCallback) { toRespondTo.add(current); } else if (current instanceof NameCallback) { NameCallback nameCallback = (NameCallback) current; userName = nameCallback.getDefaultName(); if (userMap.get(USER).hasDefined(userName)) { user = userMap.get(USER, userName); } userCredentialSourceSupplier = getUserCredentialSourceSupplier(userName); } else if (current instanceof PasswordCallback) { toRespondTo.add(current); } else if (current instanceof RealmCallback) { String realm = ((RealmCallback) current).getDefaultText(); if (this.realm.equals(realm) == false) { // TODO - Check if this needs a real error or of just an unexpected internal error. throw DomainManagementLogger.ROOT_LOGGER.invalidRealm(realm, this.realm); } } else { throw new UnsupportedCallbackException(current); } } // Second Pass - Now iterate the Callback(s) requiring a response. for (Callback current : toRespondTo) { if (current instanceof AuthorizeCallback) { AuthorizeCallback acb = (AuthorizeCallback) current; boolean authorized = acb.getAuthenticationID().equals(acb.getAuthorizationID()); if (authorized == false) { SECURITY_LOGGER.tracef( "Checking 'AuthorizeCallback', authorized=false, authenticationID=%s, authorizationID=%s.", acb.getAuthenticationID(), acb.getAuthorizationID()); } acb.setAuthorized(authorized); } else if (current instanceof PasswordCallback) { if (user == null) { SECURITY_LOGGER.tracef("User '%s' not found.", userName); throw new UserNotFoundException(userName); } char[] password =EMPTY_PASSWORD; if (user.hasDefined(PASSWORD)) { password = user.require(PASSWORD).asString().toCharArray(); } ((PasswordCallback) current).setPassword(resolvePassword(userCredentialSourceSupplier, password)); } } } }
public class class_name { public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { final ModelNode userMap = this.userDomain; List<Callback> toRespondTo = new LinkedList<Callback>(); String userName = null; ModelNode user = null; ExceptionSupplier<CredentialSource, Exception> userCredentialSourceSupplier = null; // A single pass may be sufficient but by using a two pass approach the Callbackhandler will not // fail if an unexpected order is encountered. // First Pass - is to double check no unsupported callbacks and to retrieve // information from the callbacks passing in information. for (Callback current : callbacks) { if (current instanceof AuthorizeCallback) { toRespondTo.add(current); // depends on control dependency: [if], data = [none] } else if (current instanceof NameCallback) { NameCallback nameCallback = (NameCallback) current; userName = nameCallback.getDefaultName(); // depends on control dependency: [if], data = [none] if (userMap.get(USER).hasDefined(userName)) { user = userMap.get(USER, userName); // depends on control dependency: [if], data = [none] } userCredentialSourceSupplier = getUserCredentialSourceSupplier(userName); // depends on control dependency: [if], data = [none] } else if (current instanceof PasswordCallback) { toRespondTo.add(current); // depends on control dependency: [if], data = [none] } else if (current instanceof RealmCallback) { String realm = ((RealmCallback) current).getDefaultText(); if (this.realm.equals(realm) == false) { // TODO - Check if this needs a real error or of just an unexpected internal error. throw DomainManagementLogger.ROOT_LOGGER.invalidRealm(realm, this.realm); } } else { throw new UnsupportedCallbackException(current); } } // Second Pass - Now iterate the Callback(s) requiring a response. for (Callback current : toRespondTo) { if (current instanceof AuthorizeCallback) { AuthorizeCallback acb = (AuthorizeCallback) current; boolean authorized = acb.getAuthenticationID().equals(acb.getAuthorizationID()); if (authorized == false) { SECURITY_LOGGER.tracef( "Checking 'AuthorizeCallback', authorized=false, authenticationID=%s, authorizationID=%s.", acb.getAuthenticationID(), acb.getAuthorizationID()); // depends on control dependency: [if], data = [none] } acb.setAuthorized(authorized); // depends on control dependency: [if], data = [none] } else if (current instanceof PasswordCallback) { if (user == null) { SECURITY_LOGGER.tracef("User '%s' not found.", userName); // depends on control dependency: [if], data = [none] throw new UserNotFoundException(userName); } char[] password =EMPTY_PASSWORD; if (user.hasDefined(PASSWORD)) { password = user.require(PASSWORD).asString().toCharArray(); // depends on control dependency: [if], data = [none] } ((PasswordCallback) current).setPassword(resolvePassword(userCredentialSourceSupplier, password)); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public Type resolve(String fullyQualifiedName) { Type local = symbolTable.get(fullyQualifiedName); if (local != null) { return local; } for (ProtoContext importedContext : publicImports) { Type imported = importedContext.resolve(fullyQualifiedName); if (imported != null) { return imported; } } for (ProtoContext importedContext : imports) { Type imported = importedContext.resolveImport(fullyQualifiedName); if (imported != null) { return imported; } } return null; } }
public class class_name { public Type resolve(String fullyQualifiedName) { Type local = symbolTable.get(fullyQualifiedName); if (local != null) { return local; // depends on control dependency: [if], data = [none] } for (ProtoContext importedContext : publicImports) { Type imported = importedContext.resolve(fullyQualifiedName); if (imported != null) { return imported; // depends on control dependency: [if], data = [none] } } for (ProtoContext importedContext : imports) { Type imported = importedContext.resolveImport(fullyQualifiedName); if (imported != null) { return imported; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { private void setupA( List<DMatrixRMaj> homographies ) { A.reshape(2*homographies.size(),6, false); DMatrixRMaj h1 = new DMatrixRMaj(3,1); DMatrixRMaj h2 = new DMatrixRMaj(3,1); DMatrixRMaj v12 = new DMatrixRMaj(1,6); DMatrixRMaj v11 = new DMatrixRMaj(1,6); DMatrixRMaj v22 = new DMatrixRMaj(1,6); DMatrixRMaj v11m22 = new DMatrixRMaj(1,6); for( int i = 0; i < homographies.size(); i++ ) { DMatrixRMaj H = homographies.get(i); CommonOps_DDRM.extract(H,0,3,0,1,h1,0,0); CommonOps_DDRM.extract(H,0,3,1,2,h2,0,0); // normalize H by the max value to reduce numerical error when computing A // several numbers are multiplied against each other and could become quite large/small double max1 = CommonOps_DDRM.elementMaxAbs(h1); double max2 = CommonOps_DDRM.elementMaxAbs(h2); double max = Math.max(max1,max2); CommonOps_DDRM.divide(h1,max); CommonOps_DDRM.divide(h2,max); // compute elements of A computeV(h1, h2, v12); computeV(h1, h1, v11); computeV(h2, h2, v22); CommonOps_DDRM.subtract(v11, v22, v11m22); CommonOps_DDRM.insert( v12 , A, i*2 , 0); CommonOps_DDRM.insert( v11m22 , A, i*2+1 , 0); } } }
public class class_name { private void setupA( List<DMatrixRMaj> homographies ) { A.reshape(2*homographies.size(),6, false); DMatrixRMaj h1 = new DMatrixRMaj(3,1); DMatrixRMaj h2 = new DMatrixRMaj(3,1); DMatrixRMaj v12 = new DMatrixRMaj(1,6); DMatrixRMaj v11 = new DMatrixRMaj(1,6); DMatrixRMaj v22 = new DMatrixRMaj(1,6); DMatrixRMaj v11m22 = new DMatrixRMaj(1,6); for( int i = 0; i < homographies.size(); i++ ) { DMatrixRMaj H = homographies.get(i); CommonOps_DDRM.extract(H,0,3,0,1,h1,0,0); // depends on control dependency: [for], data = [none] CommonOps_DDRM.extract(H,0,3,1,2,h2,0,0); // depends on control dependency: [for], data = [none] // normalize H by the max value to reduce numerical error when computing A // several numbers are multiplied against each other and could become quite large/small double max1 = CommonOps_DDRM.elementMaxAbs(h1); double max2 = CommonOps_DDRM.elementMaxAbs(h2); double max = Math.max(max1,max2); CommonOps_DDRM.divide(h1,max); // depends on control dependency: [for], data = [none] CommonOps_DDRM.divide(h2,max); // depends on control dependency: [for], data = [none] // compute elements of A computeV(h1, h2, v12); // depends on control dependency: [for], data = [none] computeV(h1, h1, v11); // depends on control dependency: [for], data = [none] computeV(h2, h2, v22); // depends on control dependency: [for], data = [none] CommonOps_DDRM.subtract(v11, v22, v11m22); // depends on control dependency: [for], data = [none] CommonOps_DDRM.insert( v12 , A, i*2 , 0); // depends on control dependency: [for], data = [i] CommonOps_DDRM.insert( v11m22 , A, i*2+1 , 0); // depends on control dependency: [for], data = [i] } } }
public class class_name { public static byte[] getMD5(byte[] src) { assert src != null; try { return MessageDigest.getInstance("MD5").digest(src); } catch (NoSuchAlgorithmException ex) { throw new IllegalArgumentException("Missing 'MD5' algorithm", ex); } } }
public class class_name { public static byte[] getMD5(byte[] src) { assert src != null; try { return MessageDigest.getInstance("MD5").digest(src); // depends on control dependency: [try], data = [none] } catch (NoSuchAlgorithmException ex) { throw new IllegalArgumentException("Missing 'MD5' algorithm", ex); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void openSession(SocketAddress endpoint) { synchronized (lock) { // Submit a reconnect task for this address if one is not already present if (!pendingConnections.containsKey(endpoint)) { final ReconnectTask task = new ReconnectTask(endpoint); pendingConnections.put(endpoint, task); this.reconnectExecutor.submit(task); } } } }
public class class_name { public void openSession(SocketAddress endpoint) { synchronized (lock) { // Submit a reconnect task for this address if one is not already present if (!pendingConnections.containsKey(endpoint)) { final ReconnectTask task = new ReconnectTask(endpoint); pendingConnections.put(endpoint, task); // depends on control dependency: [if], data = [none] this.reconnectExecutor.submit(task); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private List<XMLFilter> getProcessingPipe(final FileInfo fi) { final URI fileToParse = job.tempDirURI.resolve(fi.uri); assert fileToParse.isAbsolute(); final List<XMLFilter> res = new ArrayList<>(); for (final FilterPair p: filters) { if (p.predicate.test(fi)) { final AbstractXMLFilter f = p.filter; logger.debug("Configure filter " + f.getClass().getCanonicalName()); f.setCurrentFile(fileToParse); f.setJob(job); f.setLogger(logger); res.add(f); } } return res; } }
public class class_name { private List<XMLFilter> getProcessingPipe(final FileInfo fi) { final URI fileToParse = job.tempDirURI.resolve(fi.uri); assert fileToParse.isAbsolute(); final List<XMLFilter> res = new ArrayList<>(); for (final FilterPair p: filters) { if (p.predicate.test(fi)) { final AbstractXMLFilter f = p.filter; logger.debug("Configure filter " + f.getClass().getCanonicalName()); // depends on control dependency: [if], data = [none] f.setCurrentFile(fileToParse); // depends on control dependency: [if], data = [none] f.setJob(job); // depends on control dependency: [if], data = [none] f.setLogger(logger); // depends on control dependency: [if], data = [none] res.add(f); // depends on control dependency: [if], data = [none] } } return res; } }
public class class_name { public static PortletApplicationContext getPortletApplicationContext(PortletContext pc, String attrName) { Assert.notNull(pc, "PortletContext must not be null"); Object attr = pc.getAttribute(attrName); if (attr == null) { return null; } if (attr instanceof RuntimeException) { throw (RuntimeException) attr; } if (attr instanceof Error) { throw (Error) attr; } if (attr instanceof Exception) { throw new IllegalStateException((Exception) attr); } if (!(attr instanceof PortletApplicationContext)) { throw new IllegalStateException("Context attribute is not of type PortletApplicationContext: " + attr.getClass() + " - " + attr); } return (PortletApplicationContext) attr; } }
public class class_name { public static PortletApplicationContext getPortletApplicationContext(PortletContext pc, String attrName) { Assert.notNull(pc, "PortletContext must not be null"); Object attr = pc.getAttribute(attrName); if (attr == null) { return null; // depends on control dependency: [if], data = [none] } if (attr instanceof RuntimeException) { throw (RuntimeException) attr; } if (attr instanceof Error) { throw (Error) attr; } if (attr instanceof Exception) { throw new IllegalStateException((Exception) attr); } if (!(attr instanceof PortletApplicationContext)) { throw new IllegalStateException("Context attribute is not of type PortletApplicationContext: " + attr.getClass() + " - " + attr); } return (PortletApplicationContext) attr; } }
public class class_name { private EJBException mapCSIException(EJSDeployedSupport s, CSIException e, Exception rootEx) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "mapCSIException: " + e); } String message = " "; EJBException ejbex; if (e instanceof CSITransactionRolledbackException) { //445903 start: We must look for a HeuristicMixedException nested in the CSITransactionRolledbackException //and if found, make sure it is nested in a RemoteException so the user will see the HeuristicMixedException. //If we throw a TransactionRolledbackException with the HeuristicMixedException nested within it, or if we //throw only the TransactionRolledbackException (pre-d445903), this will give the impression that the transaction //has been rolledback. However, by its definition, a HeuristicMixedException indicates that some updates/resources //have been committed and other may have been committed. As such, throwing only a TransactionRolledbackException //or TransactionRolledbackException + HeuristicMixedException can be misleading. // //PK87857 note: When this APAR was put in earlier releases, the 'instanceof' check for HME was included in the //same 'if' check as is included in the 'else if' block to follow. However, in v7.0 dev, the following 'if' //block was added via d445903. As such, we must leave this code 'as-is' so as not to regress anyone. It //should also be noted that this 'if' block is a potential spec violation. That is, if the HME is caused by //a component other than the Tx 'beginner', the EJBException + HME will flow back up stream rather than the //spec mandated TransactionRolledbackLocalException; needless to say this causes a spec violation. if (e.detail instanceof HeuristicMixedException) { //Nest the HeuristicMixedException in an EJBException. ejbex = ExceptionUtil.EJBException(message, rootEx); } //PK87857: We must look for a HeuristicRollbackException nested in the //CSITransactionRolledbackException and if found, we must make sure it is nested in an //EJBException so the user will see the Heuristic Exception. Let me explain why this should be done: // If we throw a TransactionRolledbackLocalException with the HeuristicRollbackException nested within // it, or if we throw only the TransactionRolledbackLocalException (pre-PK87857), this will give the // impression that the transaction has been rolledback. In the case of a HeuristicRollbackException, the // transaction has been rolledback so a TransactionRolledbackLocalException is valid, however, it may be // important for the user to know that a Heuristic decision was made to rollback the transaction. else if (IncludeNestedExceptionsExtended && (s.began || AllowSpecViolationOnRollback) && (e.detail instanceof HeuristicRollbackException)) { //Nest the Heuristic Exception in an EJBException. ejbex = ExceptionUtil.EJBException(message, rootEx); } else { ejbex = new TransactionRolledbackLocalException(message, rootEx); } //445903 end } else if (e instanceof CSIAccessException) { ejbex = new AccessLocalException(message, rootEx); } else if (e instanceof CSIInvalidTransactionException) { ejbex = new InvalidTransactionLocalException(message, rootEx); } else if (e instanceof CSINoSuchObjectException) { ejbex = new NoSuchObjectLocalException(message, rootEx); } else if (e instanceof CSITransactionRequiredException) { ejbex = new TransactionRequiredLocalException(message); } // else if (e instanceof CSIInvalidActivityException) // { // ejbex = new InvalidActivityLocalException(message, rootEx); // } // else if (e instanceof CSIActivityRequiredException) // { // ejbex = new ActivityRequiredLocalException(message, rootEx); // } // else if (e instanceof CSIActivityCompletedException) // { // ejbex = new ActivityCompletedLocalException(message, rootEx); // } else if (rootEx instanceof EJBException) { ejbex = (EJBException) rootEx; } else { // Spec requires an EJBException; there is no longer any value add in // using the deprecated nested exception interface. F71894.1 ejbex = ExceptionUtil.EJBException(rootEx); } // EJBException doesn't normally set the cause on Throwable, so // let's do that to be nice :-) d354591 // Geronimo EJBException.getCause returns getCausedbyException, so // we do not expect this code to be used. F53643 if (rootEx != null && rootEx != ejbex && ejbex.getCause() == null) { ejbex.initCause(rootEx); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "mapCSIException returning: " + ejbex); } return ejbex; } }
public class class_name { private EJBException mapCSIException(EJSDeployedSupport s, CSIException e, Exception rootEx) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "mapCSIException: " + e); // depends on control dependency: [if], data = [none] } String message = " "; EJBException ejbex; if (e instanceof CSITransactionRolledbackException) { //445903 start: We must look for a HeuristicMixedException nested in the CSITransactionRolledbackException //and if found, make sure it is nested in a RemoteException so the user will see the HeuristicMixedException. //If we throw a TransactionRolledbackException with the HeuristicMixedException nested within it, or if we //throw only the TransactionRolledbackException (pre-d445903), this will give the impression that the transaction //has been rolledback. However, by its definition, a HeuristicMixedException indicates that some updates/resources //have been committed and other may have been committed. As such, throwing only a TransactionRolledbackException //or TransactionRolledbackException + HeuristicMixedException can be misleading. // //PK87857 note: When this APAR was put in earlier releases, the 'instanceof' check for HME was included in the //same 'if' check as is included in the 'else if' block to follow. However, in v7.0 dev, the following 'if' //block was added via d445903. As such, we must leave this code 'as-is' so as not to regress anyone. It //should also be noted that this 'if' block is a potential spec violation. That is, if the HME is caused by //a component other than the Tx 'beginner', the EJBException + HME will flow back up stream rather than the //spec mandated TransactionRolledbackLocalException; needless to say this causes a spec violation. if (e.detail instanceof HeuristicMixedException) { //Nest the HeuristicMixedException in an EJBException. ejbex = ExceptionUtil.EJBException(message, rootEx); // depends on control dependency: [if], data = [none] } //PK87857: We must look for a HeuristicRollbackException nested in the //CSITransactionRolledbackException and if found, we must make sure it is nested in an //EJBException so the user will see the Heuristic Exception. Let me explain why this should be done: // If we throw a TransactionRolledbackLocalException with the HeuristicRollbackException nested within // it, or if we throw only the TransactionRolledbackLocalException (pre-PK87857), this will give the // impression that the transaction has been rolledback. In the case of a HeuristicRollbackException, the // transaction has been rolledback so a TransactionRolledbackLocalException is valid, however, it may be // important for the user to know that a Heuristic decision was made to rollback the transaction. else if (IncludeNestedExceptionsExtended && (s.began || AllowSpecViolationOnRollback) && (e.detail instanceof HeuristicRollbackException)) { //Nest the Heuristic Exception in an EJBException. ejbex = ExceptionUtil.EJBException(message, rootEx); // depends on control dependency: [if], data = [none] } else { ejbex = new TransactionRolledbackLocalException(message, rootEx); // depends on control dependency: [if], data = [none] } //445903 end } else if (e instanceof CSIAccessException) { ejbex = new AccessLocalException(message, rootEx); // depends on control dependency: [if], data = [none] } else if (e instanceof CSIInvalidTransactionException) { ejbex = new InvalidTransactionLocalException(message, rootEx); // depends on control dependency: [if], data = [none] } else if (e instanceof CSINoSuchObjectException) { ejbex = new NoSuchObjectLocalException(message, rootEx); // depends on control dependency: [if], data = [none] } else if (e instanceof CSITransactionRequiredException) { ejbex = new TransactionRequiredLocalException(message); // depends on control dependency: [if], data = [none] } // else if (e instanceof CSIInvalidActivityException) // { // ejbex = new InvalidActivityLocalException(message, rootEx); // } // else if (e instanceof CSIActivityRequiredException) // { // ejbex = new ActivityRequiredLocalException(message, rootEx); // } // else if (e instanceof CSIActivityCompletedException) // { // ejbex = new ActivityCompletedLocalException(message, rootEx); // } else if (rootEx instanceof EJBException) { ejbex = (EJBException) rootEx; // depends on control dependency: [if], data = [none] } else { // Spec requires an EJBException; there is no longer any value add in // using the deprecated nested exception interface. F71894.1 ejbex = ExceptionUtil.EJBException(rootEx); // depends on control dependency: [if], data = [none] } // EJBException doesn't normally set the cause on Throwable, so // let's do that to be nice :-) d354591 // Geronimo EJBException.getCause returns getCausedbyException, so // we do not expect this code to be used. F53643 if (rootEx != null && rootEx != ejbex && ejbex.getCause() == null) { ejbex.initCause(rootEx); // depends on control dependency: [if], data = [(rootEx] } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "mapCSIException returning: " + ejbex); // depends on control dependency: [if], data = [none] } return ejbex; } }
public class class_name { public Element toRootElement() { Document doc = null; try { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); DocumentBuilder db = dbf.newDocumentBuilder(); doc = db.newDocument(); } catch (Exception e) { jlogger.log(Level.SEVERE, "validate", e); e.printStackTrace(); // Fortify Mod: if we get here then there is no point in going further return null; } Element root = doc.createElement("errors"); doc.appendChild(root); ErrorIterator errIterator = iterator(); while (errIterator.hasNext()) { ValidationError err = errIterator.next(); Element elem = doc.createElement("error"); elem.setTextContent(err.getMessage()); root.appendChild(elem); } return root; } }
public class class_name { public Element toRootElement() { Document doc = null; try { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); // depends on control dependency: [try], data = [none] DocumentBuilder db = dbf.newDocumentBuilder(); doc = db.newDocument(); // depends on control dependency: [try], data = [none] } catch (Exception e) { jlogger.log(Level.SEVERE, "validate", e); e.printStackTrace(); // Fortify Mod: if we get here then there is no point in going further return null; } // depends on control dependency: [catch], data = [none] Element root = doc.createElement("errors"); doc.appendChild(root); ErrorIterator errIterator = iterator(); while (errIterator.hasNext()) { ValidationError err = errIterator.next(); Element elem = doc.createElement("error"); elem.setTextContent(err.getMessage()); // depends on control dependency: [while], data = [none] root.appendChild(elem); // depends on control dependency: [while], data = [none] } return root; } }
public class class_name { public Observable<ServiceResponse<Page<FileInner>>> listOutputFilesNextWithServiceResponseAsync(final String nextPageLink) { return listOutputFilesNextSinglePageAsync(nextPageLink) .concatMap(new Func1<ServiceResponse<Page<FileInner>>, Observable<ServiceResponse<Page<FileInner>>>>() { @Override public Observable<ServiceResponse<Page<FileInner>>> call(ServiceResponse<Page<FileInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listOutputFilesNextWithServiceResponseAsync(nextPageLink)); } }); } }
public class class_name { public Observable<ServiceResponse<Page<FileInner>>> listOutputFilesNextWithServiceResponseAsync(final String nextPageLink) { return listOutputFilesNextSinglePageAsync(nextPageLink) .concatMap(new Func1<ServiceResponse<Page<FileInner>>, Observable<ServiceResponse<Page<FileInner>>>>() { @Override public Observable<ServiceResponse<Page<FileInner>>> call(ServiceResponse<Page<FileInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); // depends on control dependency: [if], data = [none] } return Observable.just(page).concatWith(listOutputFilesNextWithServiceResponseAsync(nextPageLink)); } }); } }
public class class_name { @Override protected boolean prepare(final Context2D context, final Attributes attr, final double alpha) { final double rx = attr.getRadiusX(); final double ry = attr.getRadiusY(); if ((rx > 0) && (ry > 0)) { context.beginPath(); context.ellipse(0, 0, rx, ry, 0, attr.getStartAngle(), attr.getEndAngle(), attr.isCounterClockwise()); return true; } return false; } }
public class class_name { @Override protected boolean prepare(final Context2D context, final Attributes attr, final double alpha) { final double rx = attr.getRadiusX(); final double ry = attr.getRadiusY(); if ((rx > 0) && (ry > 0)) { context.beginPath(); // depends on control dependency: [if], data = [none] context.ellipse(0, 0, rx, ry, 0, attr.getStartAngle(), attr.getEndAngle(), attr.isCounterClockwise()); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public static boolean isEqualOrNull( List s1, List s2 ) { if ( s1 == null && s2 == null ) { return true; } else if ( s1 != null && s2 != null && s1.size() == s2.size() ) { return true; } return false; } }
public class class_name { public static boolean isEqualOrNull( List s1, List s2 ) { if ( s1 == null && s2 == null ) { return true; // depends on control dependency: [if], data = [none] } else if ( s1 != null && s2 != null && s1.size() == s2.size() ) { return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public void initialize(CmsObject cms) { if (!m_availableLocales.contains(Locale.ENGLISH)) { throw new RuntimeException("The locale 'en' must be configured in opencms-system.xml."); } // init the locale handler m_localeHandler.initHandler(cms); // set default locale m_defaultLocale = m_defaultLocales.get(0); initLanguageDetection(); // set initialized status m_initialized = true; if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_I18N_CONFIG_VFSACCESS_0)); } } }
public class class_name { public void initialize(CmsObject cms) { if (!m_availableLocales.contains(Locale.ENGLISH)) { throw new RuntimeException("The locale 'en' must be configured in opencms-system.xml."); } // init the locale handler m_localeHandler.initHandler(cms); // set default locale m_defaultLocale = m_defaultLocales.get(0); initLanguageDetection(); // depends on control dependency: [if], data = [none] // set initialized status m_initialized = true; // depends on control dependency: [if], data = [none] if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_I18N_CONFIG_VFSACCESS_0)); // depends on control dependency: [if], data = [none] } } }
public class class_name { public Observable<ServiceResponse<RuntimeScriptActionDetailInner>> getExecutionDetailWithServiceResponseAsync(String resourceGroupName, String clusterName, String scriptExecutionId) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (clusterName == null) { throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); } if (scriptExecutionId == null) { throw new IllegalArgumentException("Parameter scriptExecutionId is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.getExecutionDetail(this.client.subscriptionId(), resourceGroupName, clusterName, scriptExecutionId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<RuntimeScriptActionDetailInner>>>() { @Override public Observable<ServiceResponse<RuntimeScriptActionDetailInner>> call(Response<ResponseBody> response) { try { ServiceResponse<RuntimeScriptActionDetailInner> clientResponse = getExecutionDetailDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } }
public class class_name { public Observable<ServiceResponse<RuntimeScriptActionDetailInner>> getExecutionDetailWithServiceResponseAsync(String resourceGroupName, String clusterName, String scriptExecutionId) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (clusterName == null) { throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); } if (scriptExecutionId == null) { throw new IllegalArgumentException("Parameter scriptExecutionId is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.getExecutionDetail(this.client.subscriptionId(), resourceGroupName, clusterName, scriptExecutionId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<RuntimeScriptActionDetailInner>>>() { @Override public Observable<ServiceResponse<RuntimeScriptActionDetailInner>> call(Response<ResponseBody> response) { try { ServiceResponse<RuntimeScriptActionDetailInner> clientResponse = getExecutionDetailDelegate(response); return Observable.just(clientResponse); // depends on control dependency: [try], data = [none] } catch (Throwable t) { return Observable.error(t); } // depends on control dependency: [catch], data = [none] } }); } }
public class class_name { public static Criteria createCriteriaFromClass(String name, Class<?> cls, Operator operator, List<?> values) { if (operator == Operator.AND) { return new Group.And(cls, values); } else if (operator == Operator.OR) { return new Group.Or(cls, values); } else { FieldAccess fieldAccess = BeanUtils.idxField(cls, name); return createCriteria(name, operator, fieldAccess.typeEnum(), (Class<Object>) fieldAccess.type(), values); } } }
public class class_name { public static Criteria createCriteriaFromClass(String name, Class<?> cls, Operator operator, List<?> values) { if (operator == Operator.AND) { return new Group.And(cls, values); // depends on control dependency: [if], data = [none] } else if (operator == Operator.OR) { return new Group.Or(cls, values); // depends on control dependency: [if], data = [none] } else { FieldAccess fieldAccess = BeanUtils.idxField(cls, name); return createCriteria(name, operator, fieldAccess.typeEnum(), (Class<Object>) fieldAccess.type(), values); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static void sort(char[] charArray) { int index = 0; char value = 0; for(int i = 1; i < charArray.length; i++) { index = i; value = charArray[index]; while(index > 0 && value < charArray[index - 1]) { charArray[index] = charArray[index - 1]; index--; } charArray[index] = value; } } }
public class class_name { public static void sort(char[] charArray) { int index = 0; char value = 0; for(int i = 1; i < charArray.length; i++) { index = i; // depends on control dependency: [for], data = [i] value = charArray[index]; // depends on control dependency: [for], data = [none] while(index > 0 && value < charArray[index - 1]) { charArray[index] = charArray[index - 1]; // depends on control dependency: [while], data = [none] index--; // depends on control dependency: [while], data = [none] } charArray[index] = value; // depends on control dependency: [for], data = [none] } } }
public class class_name { protected Event grantServiceTicket(final RequestContext context) { val ticketGrantingTicketId = WebUtils.getTicketGrantingTicketId(context); val credential = getCredentialFromContext(context); try { val service = WebUtils.getService(context); val authn = getWebflowEventResolutionConfigurationContext().getTicketRegistrySupport().getAuthenticationFrom(ticketGrantingTicketId); val registeredService = getWebflowEventResolutionConfigurationContext().getServicesManager().findServiceBy(service); if (authn != null && registeredService != null) { LOGGER.debug("Enforcing access strategy policies for registered service [{}] and principal [{}]", registeredService, authn.getPrincipal()); val audit = AuditableContext.builder().service(service) .authentication(authn) .registeredService(registeredService) .retrievePrincipalAttributesFromReleasePolicy(Boolean.TRUE) .build(); val accessResult = getWebflowEventResolutionConfigurationContext().getRegisteredServiceAccessStrategyEnforcer().execute(audit); accessResult.throwExceptionIfNeeded(); } val authenticationResult = getWebflowEventResolutionConfigurationContext().getAuthenticationSystemSupport() .handleAndFinalizeSingleAuthenticationTransaction(service, credential); val serviceTicketId = getWebflowEventResolutionConfigurationContext().getCentralAuthenticationService() .grantServiceTicket(ticketGrantingTicketId, service, authenticationResult); WebUtils.putServiceTicketInRequestScope(context, serviceTicketId); WebUtils.putWarnCookieIfRequestParameterPresent(getWebflowEventResolutionConfigurationContext().getWarnCookieGenerator(), context); return newEvent(CasWebflowConstants.TRANSITION_ID_WARN); } catch (final AuthenticationException | AbstractTicketException e) { return newEvent(CasWebflowConstants.TRANSITION_ID_AUTHENTICATION_FAILURE, e); } } }
public class class_name { protected Event grantServiceTicket(final RequestContext context) { val ticketGrantingTicketId = WebUtils.getTicketGrantingTicketId(context); val credential = getCredentialFromContext(context); try { val service = WebUtils.getService(context); val authn = getWebflowEventResolutionConfigurationContext().getTicketRegistrySupport().getAuthenticationFrom(ticketGrantingTicketId); val registeredService = getWebflowEventResolutionConfigurationContext().getServicesManager().findServiceBy(service); if (authn != null && registeredService != null) { LOGGER.debug("Enforcing access strategy policies for registered service [{}] and principal [{}]", registeredService, authn.getPrincipal()); // depends on control dependency: [if], data = [none] val audit = AuditableContext.builder().service(service) .authentication(authn) .registeredService(registeredService) .retrievePrincipalAttributesFromReleasePolicy(Boolean.TRUE) .build(); val accessResult = getWebflowEventResolutionConfigurationContext().getRegisteredServiceAccessStrategyEnforcer().execute(audit); accessResult.throwExceptionIfNeeded(); // depends on control dependency: [if], data = [none] } val authenticationResult = getWebflowEventResolutionConfigurationContext().getAuthenticationSystemSupport() .handleAndFinalizeSingleAuthenticationTransaction(service, credential); val serviceTicketId = getWebflowEventResolutionConfigurationContext().getCentralAuthenticationService() .grantServiceTicket(ticketGrantingTicketId, service, authenticationResult); WebUtils.putServiceTicketInRequestScope(context, serviceTicketId); // depends on control dependency: [try], data = [none] WebUtils.putWarnCookieIfRequestParameterPresent(getWebflowEventResolutionConfigurationContext().getWarnCookieGenerator(), context); // depends on control dependency: [try], data = [none] return newEvent(CasWebflowConstants.TRANSITION_ID_WARN); // depends on control dependency: [try], data = [none] } catch (final AuthenticationException | AbstractTicketException e) { return newEvent(CasWebflowConstants.TRANSITION_ID_AUTHENTICATION_FAILURE, e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void notifyComponentEvent(Event event, ComponentDescriptor<?> descriptor, ComponentManager componentManager) { if (this.shouldStack) { synchronized (this) { this.events.push(new ComponentEventEntry(event, descriptor, componentManager)); } } else { sendEvent(event, descriptor, componentManager); } } }
public class class_name { private void notifyComponentEvent(Event event, ComponentDescriptor<?> descriptor, ComponentManager componentManager) { if (this.shouldStack) { synchronized (this) { // depends on control dependency: [if], data = [none] this.events.push(new ComponentEventEntry(event, descriptor, componentManager)); } } else { sendEvent(event, descriptor, componentManager); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static <E extends Exception> ImmutableSet<ExecutableElement> methodsOn( TypeElement type, Elements elements, ErrorTypeHandling<E> errorTypeHandling) throws E { TypeElement objectType = elements.getTypeElement(Object.class.getCanonicalName()); Map<Signature, ExecutableElement> objectMethods = Maps.uniqueIndex( methodsIn(objectType.getEnclosedElements()), Signature::new); SetMultimap<Signature, ExecutableElement> methods = LinkedHashMultimap.create(); for (TypeElement supertype : getSupertypes(type, errorTypeHandling)) { for (ExecutableElement method : methodsIn(supertype.getEnclosedElements())) { Signature signature = new Signature(method); if (method.getEnclosingElement().equals(objectType)) { continue; // Skip methods specified by Object. } if (objectMethods.containsKey(signature) && method.getEnclosingElement().getKind() == ElementKind.INTERFACE && method.getModifiers().contains(Modifier.ABSTRACT) && elements.overrides(method, objectMethods.get(signature), type)) { continue; // Skip abstract methods on interfaces redelaring Object methods. } Iterator<ExecutableElement> iterator = methods.get(signature).iterator(); while (iterator.hasNext()) { ExecutableElement otherMethod = iterator.next(); if (elements.overrides(method, otherMethod, type) || method.getParameters().equals(otherMethod.getParameters())) { iterator.remove(); } } methods.put(signature, method); } } return ImmutableSet.copyOf(methods.values()); } }
public class class_name { public static <E extends Exception> ImmutableSet<ExecutableElement> methodsOn( TypeElement type, Elements elements, ErrorTypeHandling<E> errorTypeHandling) throws E { TypeElement objectType = elements.getTypeElement(Object.class.getCanonicalName()); Map<Signature, ExecutableElement> objectMethods = Maps.uniqueIndex( methodsIn(objectType.getEnclosedElements()), Signature::new); SetMultimap<Signature, ExecutableElement> methods = LinkedHashMultimap.create(); for (TypeElement supertype : getSupertypes(type, errorTypeHandling)) { for (ExecutableElement method : methodsIn(supertype.getEnclosedElements())) { Signature signature = new Signature(method); if (method.getEnclosingElement().equals(objectType)) { continue; // Skip methods specified by Object. } if (objectMethods.containsKey(signature) && method.getEnclosingElement().getKind() == ElementKind.INTERFACE && method.getModifiers().contains(Modifier.ABSTRACT) && elements.overrides(method, objectMethods.get(signature), type)) { continue; // Skip abstract methods on interfaces redelaring Object methods. } Iterator<ExecutableElement> iterator = methods.get(signature).iterator(); while (iterator.hasNext()) { ExecutableElement otherMethod = iterator.next(); if (elements.overrides(method, otherMethod, type) || method.getParameters().equals(otherMethod.getParameters())) { iterator.remove(); // depends on control dependency: [if], data = [none] } } methods.put(signature, method); // depends on control dependency: [for], data = [method] } } return ImmutableSet.copyOf(methods.values()); } }
public class class_name { public static void apply(Program program, TreeGP manager) { int iMaxProgramDepth = manager.getMaxProgramDepth(); TGPMutationStrategy method = manager.getMutationStrategy(); RandEngine randEngine = manager.getRandEngine(); if (method == TGPMutationStrategy.MUTATION_SUBTREE || method == TGPMutationStrategy.MUTATION_SUBTREE_KINNEAR) { TreeNode node = program.anyNode(randEngine)._1(); int depth = program.calcDepth(); TreeNode root = program.getRoot(); if (method == TGPMutationStrategy.MUTATION_SUBTREE) { int node_depth = root.depth2Node(node); node.getChildren().clear(); node.setPrimitive(program.anyPrimitive(randEngine)); if (!node.getPrimitive().isTerminal()) { int max_depth = iMaxProgramDepth - node_depth; TreeGenerator.createWithDepth(program, node, max_depth, TGPInitializationStrategy.INITIALIZATION_METHOD_GROW, randEngine); } } else { int subtree_depth = root.depth2Node(node); int current_depth = depth - subtree_depth; int max_depth = (int)(depth * 1.15) - current_depth; node.getChildren().clear(); node.setPrimitive(program.anyPrimitive(randEngine)); if (!node.getPrimitive().isTerminal()) { TreeGenerator.createWithDepth(program, node, max_depth, TGPInitializationStrategy.INITIALIZATION_METHOD_GROW, randEngine); } } } else if (method == TGPMutationStrategy.MUTATION_HOIST) { TreeNode node = program.anyNode(randEngine)._1(); if (node != program.getRoot()) { program.setRoot(node); } } else if (method == TGPMutationStrategy.MUTATION_SHRINK) { TreeNode node = program.anyNode(randEngine)._1(); node.getChildren().clear(); node.setPrimitive(program.anyTerminal(randEngine)); } program.calcDepth(); program.calcLength(); } }
public class class_name { public static void apply(Program program, TreeGP manager) { int iMaxProgramDepth = manager.getMaxProgramDepth(); TGPMutationStrategy method = manager.getMutationStrategy(); RandEngine randEngine = manager.getRandEngine(); if (method == TGPMutationStrategy.MUTATION_SUBTREE || method == TGPMutationStrategy.MUTATION_SUBTREE_KINNEAR) { TreeNode node = program.anyNode(randEngine)._1(); int depth = program.calcDepth(); TreeNode root = program.getRoot(); if (method == TGPMutationStrategy.MUTATION_SUBTREE) { int node_depth = root.depth2Node(node); node.getChildren().clear(); // depends on control dependency: [if], data = [none] node.setPrimitive(program.anyPrimitive(randEngine)); // depends on control dependency: [if], data = [none] if (!node.getPrimitive().isTerminal()) { int max_depth = iMaxProgramDepth - node_depth; TreeGenerator.createWithDepth(program, node, max_depth, TGPInitializationStrategy.INITIALIZATION_METHOD_GROW, randEngine); // depends on control dependency: [if], data = [none] } } else { int subtree_depth = root.depth2Node(node); int current_depth = depth - subtree_depth; int max_depth = (int)(depth * 1.15) - current_depth; node.getChildren().clear(); // depends on control dependency: [if], data = [none] node.setPrimitive(program.anyPrimitive(randEngine)); // depends on control dependency: [if], data = [none] if (!node.getPrimitive().isTerminal()) { TreeGenerator.createWithDepth(program, node, max_depth, TGPInitializationStrategy.INITIALIZATION_METHOD_GROW, randEngine); // depends on control dependency: [if], data = [none] } } } else if (method == TGPMutationStrategy.MUTATION_HOIST) { TreeNode node = program.anyNode(randEngine)._1(); if (node != program.getRoot()) { program.setRoot(node); // depends on control dependency: [if], data = [(node] } } else if (method == TGPMutationStrategy.MUTATION_SHRINK) { TreeNode node = program.anyNode(randEngine)._1(); node.getChildren().clear(); // depends on control dependency: [if], data = [none] node.setPrimitive(program.anyTerminal(randEngine)); // depends on control dependency: [if], data = [none] } program.calcDepth(); program.calcLength(); } }
public class class_name { private void repairBrokenSessionWithPreKeyMessage(OmemoManager.LoggedInOmemoManager managerGuard, OmemoDevice brokenDevice) { LOGGER.log(Level.WARNING, "Attempt to repair the session by sending a fresh preKey message to " + brokenDevice); OmemoManager manager = managerGuard.get(); try { // Create fresh session and send new preKeyMessage. buildFreshSessionWithDevice(manager.getConnection(), manager.getOwnDevice(), brokenDevice); sendRatchetUpdate(managerGuard, brokenDevice); } catch (CannotEstablishOmemoSessionException | CorruptedOmemoKeyException e) { LOGGER.log(Level.WARNING, "Unable to repair session with " + brokenDevice, e); } catch (SmackException.NotConnectedException | InterruptedException | SmackException.NoResponseException e) { LOGGER.log(Level.WARNING, "Could not fetch fresh bundle for " + brokenDevice, e); } catch (CryptoFailedException | NoSuchAlgorithmException e) { LOGGER.log(Level.WARNING, "Could not create PreKeyMessage", e); } } }
public class class_name { private void repairBrokenSessionWithPreKeyMessage(OmemoManager.LoggedInOmemoManager managerGuard, OmemoDevice brokenDevice) { LOGGER.log(Level.WARNING, "Attempt to repair the session by sending a fresh preKey message to " + brokenDevice); OmemoManager manager = managerGuard.get(); try { // Create fresh session and send new preKeyMessage. buildFreshSessionWithDevice(manager.getConnection(), manager.getOwnDevice(), brokenDevice); // depends on control dependency: [try], data = [none] sendRatchetUpdate(managerGuard, brokenDevice); // depends on control dependency: [try], data = [none] } catch (CannotEstablishOmemoSessionException | CorruptedOmemoKeyException e) { LOGGER.log(Level.WARNING, "Unable to repair session with " + brokenDevice, e); } catch (SmackException.NotConnectedException | InterruptedException | SmackException.NoResponseException e) { // depends on control dependency: [catch], data = [none] LOGGER.log(Level.WARNING, "Could not fetch fresh bundle for " + brokenDevice, e); } catch (CryptoFailedException | NoSuchAlgorithmException e) { // depends on control dependency: [catch], data = [none] LOGGER.log(Level.WARNING, "Could not create PreKeyMessage", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public Bundle saveInstanceState(Bundle savedInstanceState) { if (savedInstanceState != null) { savedInstanceState.putInt(BUNDLE_SELECTION_HEADER, mAccountHeaderBuilder.getCurrentSelection()); } return savedInstanceState; } }
public class class_name { public Bundle saveInstanceState(Bundle savedInstanceState) { if (savedInstanceState != null) { savedInstanceState.putInt(BUNDLE_SELECTION_HEADER, mAccountHeaderBuilder.getCurrentSelection()); // depends on control dependency: [if], data = [none] } return savedInstanceState; } }
public class class_name { public static byte[] copyBytesFrom(ByteBuffer bb) { if (bb == null) { return null; } if (bb.hasArray()) { return Arrays.copyOfRange( bb.array(), bb.arrayOffset() + bb.position(), bb.arrayOffset() + bb.limit()); } byte[] dst = new byte[bb.remaining()]; bb.asReadOnlyBuffer().get(dst); return dst; } }
public class class_name { public static byte[] copyBytesFrom(ByteBuffer bb) { if (bb == null) { return null; // depends on control dependency: [if], data = [none] } if (bb.hasArray()) { return Arrays.copyOfRange( bb.array(), bb.arrayOffset() + bb.position(), bb.arrayOffset() + bb.limit()); // depends on control dependency: [if], data = [none] } byte[] dst = new byte[bb.remaining()]; bb.asReadOnlyBuffer().get(dst); return dst; } }
public class class_name { public static int findNot(int[] array, int value) { for (int i = 0; i < array.length; i++) { if (array[i] != value) { return i; } } return -1; } }
public class class_name { public static int findNot(int[] array, int value) { for (int i = 0; i < array.length; i++) { if (array[i] != value) { return i; // depends on control dependency: [if], data = [none] } } return -1; } }
public class class_name { private synchronized boolean maybeAddToExclusives(Entry<K, V> entry) { if (!entry.isOrphan && entry.clientCount == 0) { mExclusiveEntries.put(entry.key, entry); return true; } return false; } }
public class class_name { private synchronized boolean maybeAddToExclusives(Entry<K, V> entry) { if (!entry.isOrphan && entry.clientCount == 0) { mExclusiveEntries.put(entry.key, entry); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public List<Filter> getAllFiltersForField(String field) { List<Filter> foundFilters = new ArrayList<>(); for (Filter filter : this.filters) { if (filter.getField().equals(field)) { foundFilters.add(filter); } } return Collections.unmodifiableList(foundFilters); } }
public class class_name { public List<Filter> getAllFiltersForField(String field) { List<Filter> foundFilters = new ArrayList<>(); for (Filter filter : this.filters) { if (filter.getField().equals(field)) { foundFilters.add(filter); // depends on control dependency: [if], data = [none] } } return Collections.unmodifiableList(foundFilters); } }
public class class_name { protected void createDefaultAuthorizations(DeploymentEntity deployment) { if(isAuthorizationEnabled()) { ResourceAuthorizationProvider provider = getResourceAuthorizationProvider(); AuthorizationEntity[] authorizations = provider.newDeployment(deployment); saveDefaultAuthorizations(authorizations); } } }
public class class_name { protected void createDefaultAuthorizations(DeploymentEntity deployment) { if(isAuthorizationEnabled()) { ResourceAuthorizationProvider provider = getResourceAuthorizationProvider(); AuthorizationEntity[] authorizations = provider.newDeployment(deployment); saveDefaultAuthorizations(authorizations); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void flush() { // Get flush stack from Flush Manager Deque<Node> fs = flushManager.getFlushStack(); // Flush each node in flush stack from top to bottom unit it's empty if (log.isDebugEnabled()) { log.debug("Flushing following flush stack to database(s) (showing stack objects from top to bottom):\n" + fs); } if (fs != null) { boolean isBatch = false; while (!fs.isEmpty()) { Node node = fs.pop(); // Only nodes in Managed and Removed state are flushed, rest // are ignored if (node.isInState(ManagedState.class) || node.isInState(RemovedState.class)) { EntityMetadata metadata = getMetadata(node.getDataClass()); node.setClient(getClient(metadata)); // if batch size is defined. if ((node.getClient() instanceof Batcher) && ((Batcher) (node.getClient())).getBatchSize() > 0) { isBatch = true; ((Batcher) (node.getClient())).addBatch(node); } else if (isTransactionInProgress && MetadataUtils .defaultTransactionSupported(metadata.getPersistenceUnit(), kunderaMetadata)) { onSynchronization(node, metadata); } else { node.flush(); } } } if (!isBatch) { // TODO : This needs to be look for different // permutation/combination // Flush Join Table data into database flushJoinTableData(); // performed, } } } }
public class class_name { private void flush() { // Get flush stack from Flush Manager Deque<Node> fs = flushManager.getFlushStack(); // Flush each node in flush stack from top to bottom unit it's empty if (log.isDebugEnabled()) { log.debug("Flushing following flush stack to database(s) (showing stack objects from top to bottom):\n" + fs); // depends on control dependency: [if], data = [none] } if (fs != null) { boolean isBatch = false; while (!fs.isEmpty()) { Node node = fs.pop(); // Only nodes in Managed and Removed state are flushed, rest // are ignored if (node.isInState(ManagedState.class) || node.isInState(RemovedState.class)) { EntityMetadata metadata = getMetadata(node.getDataClass()); node.setClient(getClient(metadata)); // depends on control dependency: [if], data = [none] // if batch size is defined. if ((node.getClient() instanceof Batcher) && ((Batcher) (node.getClient())).getBatchSize() > 0) { isBatch = true; // depends on control dependency: [if], data = [none] ((Batcher) (node.getClient())).addBatch(node); // depends on control dependency: [if], data = [none] } else if (isTransactionInProgress && MetadataUtils .defaultTransactionSupported(metadata.getPersistenceUnit(), kunderaMetadata)) { onSynchronization(node, metadata); // depends on control dependency: [if], data = [none] } else { node.flush(); // depends on control dependency: [if], data = [none] } } } if (!isBatch) { // TODO : This needs to be look for different // permutation/combination // Flush Join Table data into database flushJoinTableData(); // depends on control dependency: [if], data = [none] // performed, } } } }
public class class_name { private static Terminal createDefaultTerminal() { try { return TerminalBuilder.builder() .name(CliStrings.CLI_NAME) .build(); } catch (IOException e) { throw new SqlClientException("Error opening command line interface.", e); } } }
public class class_name { private static Terminal createDefaultTerminal() { try { return TerminalBuilder.builder() .name(CliStrings.CLI_NAME) .build(); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new SqlClientException("Error opening command line interface.", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @SuppressWarnings("checkstyle:npathcomplexity") protected Package definePackage(String name, Manifest man, URL url) throws IllegalArgumentException { final String path = name.replace('.', '/').concat("/"); //$NON-NLS-1$ String specTitle = null; String specVersion = null; String specVendor = null; String implTitle = null; String implVersion = null; String implVendor = null; String sealed = null; URL sealBase = null; Attributes attr = man.getAttributes(path); if (attr != null) { specTitle = attr.getValue(Name.SPECIFICATION_TITLE); specVersion = attr.getValue(Name.SPECIFICATION_VERSION); specVendor = attr.getValue(Name.SPECIFICATION_VENDOR); implTitle = attr.getValue(Name.IMPLEMENTATION_TITLE); implVersion = attr.getValue(Name.IMPLEMENTATION_VERSION); implVendor = attr.getValue(Name.IMPLEMENTATION_VENDOR); sealed = attr.getValue(Name.SEALED); } attr = man.getMainAttributes(); if (attr != null) { if (specTitle == null) { specTitle = attr.getValue(Name.SPECIFICATION_TITLE); } if (specVersion == null) { specVersion = attr.getValue(Name.SPECIFICATION_VERSION); } if (specVendor == null) { specVendor = attr.getValue(Name.SPECIFICATION_VENDOR); } if (implTitle == null) { implTitle = attr.getValue(Name.IMPLEMENTATION_TITLE); } if (implVersion == null) { implVersion = attr.getValue(Name.IMPLEMENTATION_VERSION); } if (implVendor == null) { implVendor = attr.getValue(Name.IMPLEMENTATION_VENDOR); } if (sealed == null) { sealed = attr.getValue(Name.SEALED); } } if ("true".equalsIgnoreCase(sealed)) { //$NON-NLS-1$ sealBase = url; } return definePackage(name, specTitle, specVersion, specVendor, implTitle, implVersion, implVendor, sealBase); } }
public class class_name { @SuppressWarnings("checkstyle:npathcomplexity") protected Package definePackage(String name, Manifest man, URL url) throws IllegalArgumentException { final String path = name.replace('.', '/').concat("/"); //$NON-NLS-1$ String specTitle = null; String specVersion = null; String specVendor = null; String implTitle = null; String implVersion = null; String implVendor = null; String sealed = null; URL sealBase = null; Attributes attr = man.getAttributes(path); if (attr != null) { specTitle = attr.getValue(Name.SPECIFICATION_TITLE); specVersion = attr.getValue(Name.SPECIFICATION_VERSION); specVendor = attr.getValue(Name.SPECIFICATION_VENDOR); implTitle = attr.getValue(Name.IMPLEMENTATION_TITLE); implVersion = attr.getValue(Name.IMPLEMENTATION_VERSION); implVendor = attr.getValue(Name.IMPLEMENTATION_VENDOR); sealed = attr.getValue(Name.SEALED); } attr = man.getMainAttributes(); if (attr != null) { if (specTitle == null) { specTitle = attr.getValue(Name.SPECIFICATION_TITLE); // depends on control dependency: [if], data = [none] } if (specVersion == null) { specVersion = attr.getValue(Name.SPECIFICATION_VERSION); // depends on control dependency: [if], data = [none] } if (specVendor == null) { specVendor = attr.getValue(Name.SPECIFICATION_VENDOR); // depends on control dependency: [if], data = [none] } if (implTitle == null) { implTitle = attr.getValue(Name.IMPLEMENTATION_TITLE); // depends on control dependency: [if], data = [none] } if (implVersion == null) { implVersion = attr.getValue(Name.IMPLEMENTATION_VERSION); // depends on control dependency: [if], data = [none] } if (implVendor == null) { implVendor = attr.getValue(Name.IMPLEMENTATION_VENDOR); // depends on control dependency: [if], data = [none] } if (sealed == null) { sealed = attr.getValue(Name.SEALED); // depends on control dependency: [if], data = [none] } } if ("true".equalsIgnoreCase(sealed)) { //$NON-NLS-1$ sealBase = url; } return definePackage(name, specTitle, specVersion, specVendor, implTitle, implVersion, implVendor, sealBase); } }
public class class_name { public ZipFileData addLast(ZipFileData newLastData, int maximumSize) { String newLastPath = newLastData.path; Cell dupCell = cells.get(newLastPath); if ( dupCell != null ) { throw new IllegalArgumentException("Path [ " + newLastPath + " ] is already stored"); } int size = size(); if ( (maximumSize == -1) || (size < maximumSize) ) { @SuppressWarnings("unused") ZipFileData oldLastData = addLast(newLastData); return null; } Cell oldFirstCell = anchor.next; ZipFileData oldFirstData = oldFirstCell.data; String oldFirstPath = oldFirstData.path; if ( oldFirstCell != cells.remove(oldFirstPath) ) { throw new IllegalStateException("Bad cell alignment on path [ " + oldFirstPath + " ]"); } oldFirstCell.data = newLastData; cells.put(newLastPath, oldFirstCell); if ( size != 1 ) { oldFirstCell.excise(); oldFirstCell.putBetween(anchor.prev, anchor); } return oldFirstData; } }
public class class_name { public ZipFileData addLast(ZipFileData newLastData, int maximumSize) { String newLastPath = newLastData.path; Cell dupCell = cells.get(newLastPath); if ( dupCell != null ) { throw new IllegalArgumentException("Path [ " + newLastPath + " ] is already stored"); } int size = size(); if ( (maximumSize == -1) || (size < maximumSize) ) { @SuppressWarnings("unused") ZipFileData oldLastData = addLast(newLastData); return null; // depends on control dependency: [if], data = [none] } Cell oldFirstCell = anchor.next; ZipFileData oldFirstData = oldFirstCell.data; String oldFirstPath = oldFirstData.path; if ( oldFirstCell != cells.remove(oldFirstPath) ) { throw new IllegalStateException("Bad cell alignment on path [ " + oldFirstPath + " ]"); } oldFirstCell.data = newLastData; cells.put(newLastPath, oldFirstCell); if ( size != 1 ) { oldFirstCell.excise(); // depends on control dependency: [if], data = [none] oldFirstCell.putBetween(anchor.prev, anchor); // depends on control dependency: [if], data = [none] } return oldFirstData; } }
public class class_name { public void setFundamental( DMatrixRMaj F , Point3D_F64 e2 ) { this.F = F; if( e2 != null ) this.e2.set(e2); else { MultiViewOps.extractEpipoles(F,new Point3D_F64(),this.e2); } } }
public class class_name { public void setFundamental( DMatrixRMaj F , Point3D_F64 e2 ) { this.F = F; if( e2 != null ) this.e2.set(e2); else { MultiViewOps.extractEpipoles(F,new Point3D_F64(),this.e2); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public URLStreamHandler createURLStreamHandler(String protocol) { if(SCHEME.equals(protocol)) { return new URLHandler(); } return null; } }
public class class_name { @Override public URLStreamHandler createURLStreamHandler(String protocol) { if(SCHEME.equals(protocol)) { return new URLHandler(); // depends on control dependency: [if], data = [none] } return null; } }