code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { @Override public void validate(ValidationHelper helper, Context context, String key, Schema t) { if (t != null) { String reference = t.getRef(); if (reference != null && !reference.isEmpty()) { ValidatorUtils.referenceValidatorHelper(reference, t, helper, context, key); return; } if (t.getType() != null && "array".equals(t.getType().toString()) && t.getItems() == null) { final String message = Tr.formatMessage(tc, "schemaTypeArrayNullItems"); helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation(), message)); } if (t.getReadOnly() != null && t.getWriteOnly() != null && t.getReadOnly() && t.getWriteOnly()) { final String message = Tr.formatMessage(tc, "schemaReadOnlyOrWriteOnly"); helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation(), message)); } if (t.getMultipleOf() != null && (t.getMultipleOf().compareTo(BigDecimal.ONE) < 1)) { final String message = Tr.formatMessage(tc, "schemaMultipleOfLessThanOne"); helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation(), message)); } String type = (t.getType() != null) ? t.getType().toString() : "null"; ArrayList<String> propertiesInvalidValue = new ArrayList<String>(); ArrayList<String> propertiesNotForSchemaType = new ArrayList<String>(); if (t.getMaxLength() != null) { if (t.getMaxLength().intValue() < 0) { propertiesInvalidValue.add("maxLength"); } if (!type.equals("string")) { propertiesNotForSchemaType.add("maxLength"); } } if (t.getMinLength() != null) { if (t.getMinLength().intValue() < 0) { propertiesInvalidValue.add("minLength"); } if (!type.equals("string")) { propertiesNotForSchemaType.add("minLength"); } } if (t.getMinItems() != null) { if (t.getMinItems().intValue() < 0) { propertiesInvalidValue.add("minItems"); } if (!type.equals("array")) { propertiesNotForSchemaType.add("minItems"); } } if (t.getMaxItems() != null) { if (t.getMaxItems().intValue() < 0) { propertiesInvalidValue.add("maxItems"); } if (!type.equals("array")) { propertiesNotForSchemaType.add("maxItems"); } } if (t.getUniqueItems() != null && !type.equals("array")) { propertiesNotForSchemaType.add("uniqueItems"); } if (t.getMinProperties() != null) { if (t.getMinProperties().intValue() < 0) { propertiesInvalidValue.add("minProperties"); } if (!type.equals("object")) { propertiesNotForSchemaType.add("minProperties"); } } if (t.getMaxProperties() != null) { if (t.getMaxProperties().intValue() < 0) { propertiesInvalidValue.add("maxProperties"); } if (!type.equals("object")) { propertiesNotForSchemaType.add("maxProperties"); } } if (!propertiesInvalidValue.isEmpty()) { for (String s : propertiesInvalidValue) { final String message = Tr.formatMessage(tc, "schemaPropertyLessThanZero", s); helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation(), message)); } } if (!propertiesNotForSchemaType.isEmpty()) { for (String s : propertiesNotForSchemaType) { final String message = Tr.formatMessage(tc, "schemaTypeDoesNotMatchProperty", s, type); helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.WARNING, context.getLocation(), message)); } } } } }
public class class_name { @Override public void validate(ValidationHelper helper, Context context, String key, Schema t) { if (t != null) { String reference = t.getRef(); if (reference != null && !reference.isEmpty()) { ValidatorUtils.referenceValidatorHelper(reference, t, helper, context, key); // depends on control dependency: [if], data = [(reference] return; // depends on control dependency: [if], data = [none] } if (t.getType() != null && "array".equals(t.getType().toString()) && t.getItems() == null) { final String message = Tr.formatMessage(tc, "schemaTypeArrayNullItems"); helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation(), message)); // depends on control dependency: [if], data = [none] } if (t.getReadOnly() != null && t.getWriteOnly() != null && t.getReadOnly() && t.getWriteOnly()) { final String message = Tr.formatMessage(tc, "schemaReadOnlyOrWriteOnly"); helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation(), message)); // depends on control dependency: [if], data = [none] } if (t.getMultipleOf() != null && (t.getMultipleOf().compareTo(BigDecimal.ONE) < 1)) { final String message = Tr.formatMessage(tc, "schemaMultipleOfLessThanOne"); helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation(), message)); // depends on control dependency: [if], data = [none] } String type = (t.getType() != null) ? t.getType().toString() : "null"; ArrayList<String> propertiesInvalidValue = new ArrayList<String>(); ArrayList<String> propertiesNotForSchemaType = new ArrayList<String>(); if (t.getMaxLength() != null) { if (t.getMaxLength().intValue() < 0) { propertiesInvalidValue.add("maxLength"); // depends on control dependency: [if], data = [none] } if (!type.equals("string")) { propertiesNotForSchemaType.add("maxLength"); // depends on control dependency: [if], data = [none] } } if (t.getMinLength() != null) { if (t.getMinLength().intValue() < 0) { propertiesInvalidValue.add("minLength"); // depends on control dependency: [if], data = [none] } if (!type.equals("string")) { propertiesNotForSchemaType.add("minLength"); // depends on control dependency: [if], data = [none] } } if (t.getMinItems() != null) { if (t.getMinItems().intValue() < 0) { propertiesInvalidValue.add("minItems"); // depends on control dependency: [if], data = [none] } if (!type.equals("array")) { propertiesNotForSchemaType.add("minItems"); // depends on control dependency: [if], data = [none] } } if (t.getMaxItems() != null) { if (t.getMaxItems().intValue() < 0) { propertiesInvalidValue.add("maxItems"); // depends on control dependency: [if], data = [none] } if (!type.equals("array")) { propertiesNotForSchemaType.add("maxItems"); // depends on control dependency: [if], data = [none] } } if (t.getUniqueItems() != null && !type.equals("array")) { propertiesNotForSchemaType.add("uniqueItems"); // depends on control dependency: [if], data = [none] } if (t.getMinProperties() != null) { if (t.getMinProperties().intValue() < 0) { propertiesInvalidValue.add("minProperties"); // depends on control dependency: [if], data = [none] } if (!type.equals("object")) { propertiesNotForSchemaType.add("minProperties"); // depends on control dependency: [if], data = [none] } } if (t.getMaxProperties() != null) { if (t.getMaxProperties().intValue() < 0) { propertiesInvalidValue.add("maxProperties"); // depends on control dependency: [if], data = [none] } if (!type.equals("object")) { propertiesNotForSchemaType.add("maxProperties"); // depends on control dependency: [if], data = [none] } } if (!propertiesInvalidValue.isEmpty()) { for (String s : propertiesInvalidValue) { final String message = Tr.formatMessage(tc, "schemaPropertyLessThanZero", s); helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation(), message)); // depends on control dependency: [for], data = [s] } } if (!propertiesNotForSchemaType.isEmpty()) { for (String s : propertiesNotForSchemaType) { final String message = Tr.formatMessage(tc, "schemaTypeDoesNotMatchProperty", s, type); helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.WARNING, context.getLocation(), message)); // depends on control dependency: [for], data = [s] } } } } }
public class class_name { public boolean hasNext( int windowSize, int increment ) { if( windowSize <= 0 ) { throw new IllegalArgumentException( "Window size must be positive." ); } try { if( increment > 0 ) { return windowSize == mBounds.suffix( mPosition ).prefix( windowSize ).length(); } else { if( mPosition == 0 ) { return windowSize == mBounds.suffix( - windowSize ).length(); } else { return windowSize == mBounds.prefix( mPosition ).suffix( - windowSize ).length(); } } } catch( Exception e ) { return false; } } }
public class class_name { public boolean hasNext( int windowSize, int increment ) { if( windowSize <= 0 ) { throw new IllegalArgumentException( "Window size must be positive." ); } try { if( increment > 0 ) { return windowSize == mBounds.suffix( mPosition ).prefix( windowSize ).length(); // depends on control dependency: [if], data = [none] } else { if( mPosition == 0 ) { return windowSize == mBounds.suffix( - windowSize ).length(); // depends on control dependency: [if], data = [none] } else { return windowSize == mBounds.prefix( mPosition ).suffix( - windowSize ).length(); // depends on control dependency: [if], data = [( mPosition] } } } catch( Exception e ) { return false; } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected T getObject() { final T object; if (reusedObject != null) { // REUSE THE SAME RECORD AFTER HAVING RESETTED IT object = reusedObject; object.reset(); } else // CREATE A NEW ONE object = (T) database.newInstance(className); return object; } }
public class class_name { protected T getObject() { final T object; if (reusedObject != null) { // REUSE THE SAME RECORD AFTER HAVING RESETTED IT object = reusedObject; // depends on control dependency: [if], data = [none] object.reset(); // depends on control dependency: [if], data = [none] } else // CREATE A NEW ONE object = (T) database.newInstance(className); return object; } }
public class class_name { public boolean getValue (String name, boolean defval) { String val = _props.getProperty(name); if (val != null) { defval = !val.equalsIgnoreCase("false"); } return defval; } }
public class class_name { public boolean getValue (String name, boolean defval) { String val = _props.getProperty(name); if (val != null) { defval = !val.equalsIgnoreCase("false"); // depends on control dependency: [if], data = [none] } return defval; } }
public class class_name { public static <T> boolean hasIntersection(T[] from, T[] target) { if (isEmpty(target)) { return true; } if (isEmpty(from)) { return false; } for (int i = 0; i < from.length; i++) { for (int j = 0; j < target.length; j++) { if (from[i] == target[j]) { return true; } } } return false; } }
public class class_name { public static <T> boolean hasIntersection(T[] from, T[] target) { if (isEmpty(target)) { return true; // depends on control dependency: [if], data = [none] } if (isEmpty(from)) { return false; // depends on control dependency: [if], data = [none] } for (int i = 0; i < from.length; i++) { for (int j = 0; j < target.length; j++) { if (from[i] == target[j]) { return true; // depends on control dependency: [if], data = [none] } } } return false; } }
public class class_name { private void moveHorizontally(int offset) { if (offset < 0) { moveLeft(Math.abs(offset)); } else if (offset > 0) { moveRight(offset); } } }
public class class_name { private void moveHorizontally(int offset) { if (offset < 0) { moveLeft(Math.abs(offset)); // depends on control dependency: [if], data = [(offset] } else if (offset > 0) { moveRight(offset); // depends on control dependency: [if], data = [(offset] } } }
public class class_name { public List<EPSProjectWBSSpreadType.Period> getPeriod() { if (period == null) { period = new ArrayList<EPSProjectWBSSpreadType.Period>(); } return this.period; } }
public class class_name { public List<EPSProjectWBSSpreadType.Period> getPeriod() { if (period == null) { period = new ArrayList<EPSProjectWBSSpreadType.Period>(); // depends on control dependency: [if], data = [none] } return this.period; } }
public class class_name { public void pinVisiblePanels() { if (layout == Layout.FULL) { getTabbedFull().pinVisibleTabs(); } else { getTabbedSelect().pinVisibleTabs(); getTabbedWork().pinVisibleTabs(); getTabbedStatus().pinVisibleTabs(); } } }
public class class_name { public void pinVisiblePanels() { if (layout == Layout.FULL) { getTabbedFull().pinVisibleTabs(); // depends on control dependency: [if], data = [none] } else { getTabbedSelect().pinVisibleTabs(); // depends on control dependency: [if], data = [none] getTabbedWork().pinVisibleTabs(); // depends on control dependency: [if], data = [none] getTabbedStatus().pinVisibleTabs(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public int getAutowireMode(String attValue) { String att = attValue; int autowire = AbstractBeanDefinition.AUTOWIRE_NO; if (AUTOWIRE_BY_NAME_VALUE.equals(att)) { autowire = AbstractBeanDefinition.AUTOWIRE_BY_NAME; } else if (AUTOWIRE_BY_TYPE_VALUE.equals(att)) { autowire = AbstractBeanDefinition.AUTOWIRE_BY_TYPE; } else if (AUTOWIRE_CONSTRUCTOR_VALUE.equals(att)) { autowire = AbstractBeanDefinition.AUTOWIRE_CONSTRUCTOR; } // Else leave default value. return autowire; } }
public class class_name { public int getAutowireMode(String attValue) { String att = attValue; int autowire = AbstractBeanDefinition.AUTOWIRE_NO; if (AUTOWIRE_BY_NAME_VALUE.equals(att)) { autowire = AbstractBeanDefinition.AUTOWIRE_BY_NAME; // depends on control dependency: [if], data = [none] } else if (AUTOWIRE_BY_TYPE_VALUE.equals(att)) { autowire = AbstractBeanDefinition.AUTOWIRE_BY_TYPE; // depends on control dependency: [if], data = [none] } else if (AUTOWIRE_CONSTRUCTOR_VALUE.equals(att)) { autowire = AbstractBeanDefinition.AUTOWIRE_CONSTRUCTOR; // depends on control dependency: [if], data = [none] } // Else leave default value. return autowire; } }
public class class_name { public void initialize(final MetricContext metricContext, final Class<E> enumClass, final Class<?> instrumentedClass) { Builder<E, Counter> builder = ImmutableMap.builder(); for (E e : Arrays.asList(enumClass.getEnumConstants())) { builder.put(e, metricContext.counter(MetricRegistry.name(instrumentedClass, e.name()))); } counters = builder.build(); } }
public class class_name { public void initialize(final MetricContext metricContext, final Class<E> enumClass, final Class<?> instrumentedClass) { Builder<E, Counter> builder = ImmutableMap.builder(); for (E e : Arrays.asList(enumClass.getEnumConstants())) { builder.put(e, metricContext.counter(MetricRegistry.name(instrumentedClass, e.name()))); // depends on control dependency: [for], data = [e] } counters = builder.build(); } }
public class class_name { public void destroy() { for (int i = 0; i < rules.size(); i++) { final Rule rule = (Rule) rules.get(i); rule.destroy(); } } }
public class class_name { public void destroy() { for (int i = 0; i < rules.size(); i++) { final Rule rule = (Rule) rules.get(i); rule.destroy(); // depends on control dependency: [for], data = [none] } } }
public class class_name { public Set<Instance> runOnceOn(InetAddress localhost) throws IOException { logger.debug("Running query on {}", localhost); initialQuestion = new Question(service, domain); instances = Collections.synchronizedSet(new HashSet<>()); try { Thread listener = null; if (localhost != TEST_SUITE_ADDRESS) { openSocket(localhost); listener = listenForResponses(); while (!isServerIsListening()) { logger.debug("Server is not yet listening"); } } ask(initialQuestion); if (listener != null) { try { listener.join(); } catch (InterruptedException e) { logger.error("InterruptedException while listening for mDNS responses: ", e); } } } finally { closeSocket(); } return instances; } }
public class class_name { public Set<Instance> runOnceOn(InetAddress localhost) throws IOException { logger.debug("Running query on {}", localhost); initialQuestion = new Question(service, domain); instances = Collections.synchronizedSet(new HashSet<>()); try { Thread listener = null; if (localhost != TEST_SUITE_ADDRESS) { openSocket(localhost); // depends on control dependency: [if], data = [(localhost] listener = listenForResponses(); // depends on control dependency: [if], data = [none] while (!isServerIsListening()) { logger.debug("Server is not yet listening"); // depends on control dependency: [while], data = [none] } } ask(initialQuestion); if (listener != null) { try { listener.join(); // depends on control dependency: [try], data = [none] } catch (InterruptedException e) { logger.error("InterruptedException while listening for mDNS responses: ", e); } // depends on control dependency: [catch], data = [none] } } finally { closeSocket(); } return instances; } }
public class class_name { private <K, V, T extends RedisChannelHandler<K, V>, S> ConnectionFuture<S> connectStatefulAsync(T connection, RedisCodec<K, V> codec, DefaultEndpoint endpoint, RedisURI connectionSettings, Mono<SocketAddress> socketAddressSupplier, Supplier<CommandHandler> commandHandlerSupplier) { ConnectionBuilder connectionBuilder = createConnectionBuilder(connection, endpoint, connectionSettings, socketAddressSupplier, commandHandlerSupplier); if (clientOptions.isPingBeforeActivateConnection()) { if (hasPassword(connectionSettings)) { connectionBuilder.enableAuthPingBeforeConnect(); } else { connectionBuilder.enablePingBeforeConnect(); } } ConnectionFuture<RedisChannelHandler<K, V>> future = initializeChannelAsync(connectionBuilder); ConnectionFuture<?> sync = future; if (!clientOptions.isPingBeforeActivateConnection() && hasPassword(connectionSettings)) { sync = sync.thenCompose(channelHandler -> { CommandArgs<K, V> args = new CommandArgs<>(codec).add(connectionSettings.getPassword()); AsyncCommand<K, V, String> command = new AsyncCommand<>(new Command<>(CommandType.AUTH, new StatusOutput<>( codec), args)); if (connection instanceof StatefulRedisClusterConnectionImpl) { ((StatefulRedisClusterConnectionImpl) connection).dispatch(command); } if (connection instanceof StatefulRedisConnectionImpl) { ((StatefulRedisConnectionImpl) connection).dispatch(command); } return command; }); } if (LettuceStrings.isNotEmpty(connectionSettings.getClientName())) { sync = sync.thenApply(channelHandler -> { if (connection instanceof StatefulRedisClusterConnectionImpl) { ((StatefulRedisClusterConnectionImpl) connection).setClientName(connectionSettings.getClientName()); } if (connection instanceof StatefulRedisConnectionImpl) { ((StatefulRedisConnectionImpl) connection).setClientName(connectionSettings.getClientName()); } return channelHandler; }); } return sync.thenApply(channelHandler -> (S) connection); } }
public class class_name { private <K, V, T extends RedisChannelHandler<K, V>, S> ConnectionFuture<S> connectStatefulAsync(T connection, RedisCodec<K, V> codec, DefaultEndpoint endpoint, RedisURI connectionSettings, Mono<SocketAddress> socketAddressSupplier, Supplier<CommandHandler> commandHandlerSupplier) { ConnectionBuilder connectionBuilder = createConnectionBuilder(connection, endpoint, connectionSettings, socketAddressSupplier, commandHandlerSupplier); if (clientOptions.isPingBeforeActivateConnection()) { if (hasPassword(connectionSettings)) { connectionBuilder.enableAuthPingBeforeConnect(); // depends on control dependency: [if], data = [none] } else { connectionBuilder.enablePingBeforeConnect(); // depends on control dependency: [if], data = [none] } } ConnectionFuture<RedisChannelHandler<K, V>> future = initializeChannelAsync(connectionBuilder); ConnectionFuture<?> sync = future; if (!clientOptions.isPingBeforeActivateConnection() && hasPassword(connectionSettings)) { sync = sync.thenCompose(channelHandler -> { CommandArgs<K, V> args = new CommandArgs<>(codec).add(connectionSettings.getPassword()); // depends on control dependency: [if], data = [none] AsyncCommand<K, V, String> command = new AsyncCommand<>(new Command<>(CommandType.AUTH, new StatusOutput<>( codec), args)); if (connection instanceof StatefulRedisClusterConnectionImpl) { ((StatefulRedisClusterConnectionImpl) connection).dispatch(command); // depends on control dependency: [if], data = [none] } if (connection instanceof StatefulRedisConnectionImpl) { ((StatefulRedisConnectionImpl) connection).dispatch(command); // depends on control dependency: [if], data = [none] } return command; // depends on control dependency: [if], data = [none] }); } if (LettuceStrings.isNotEmpty(connectionSettings.getClientName())) { sync = sync.thenApply(channelHandler -> { if (connection instanceof StatefulRedisClusterConnectionImpl) { ((StatefulRedisClusterConnectionImpl) connection).setClientName(connectionSettings.getClientName()); } if (connection instanceof StatefulRedisConnectionImpl) { ((StatefulRedisConnectionImpl) connection).setClientName(connectionSettings.getClientName()); } return channelHandler; }); } return sync.thenApply(channelHandler -> (S) connection); } }
public class class_name { public void failed(Throwable failureCause) { Map<ClientTransport.PingCallback, Executor> callbacks; synchronized (this) { if (completed) { return; } completed = true; this.failureCause = failureCause; callbacks = this.callbacks; this.callbacks = null; } for (Map.Entry<ClientTransport.PingCallback, Executor> entry : callbacks.entrySet()) { notifyFailed(entry.getKey(), entry.getValue(), failureCause); } } }
public class class_name { public void failed(Throwable failureCause) { Map<ClientTransport.PingCallback, Executor> callbacks; synchronized (this) { if (completed) { return; // depends on control dependency: [if], data = [none] } completed = true; this.failureCause = failureCause; callbacks = this.callbacks; this.callbacks = null; } for (Map.Entry<ClientTransport.PingCallback, Executor> entry : callbacks.entrySet()) { notifyFailed(entry.getKey(), entry.getValue(), failureCause); // depends on control dependency: [for], data = [entry] } } }
public class class_name { public static Expression createExpressionForField(FieldExtension fieldExtension) { if (StringUtils.isNotEmpty(fieldExtension.getExpression())) { ExpressionManager expressionManager = Context.getProcessEngineConfiguration().getExpressionManager(); return expressionManager.createExpression(fieldExtension.getExpression()); } else { return new FixedValue(fieldExtension.getStringValue()); } } }
public class class_name { public static Expression createExpressionForField(FieldExtension fieldExtension) { if (StringUtils.isNotEmpty(fieldExtension.getExpression())) { ExpressionManager expressionManager = Context.getProcessEngineConfiguration().getExpressionManager(); return expressionManager.createExpression(fieldExtension.getExpression()); // depends on control dependency: [if], data = [none] } else { return new FixedValue(fieldExtension.getStringValue()); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected GoogleJsonError getDetails(IOException e) { if (e instanceof GoogleJsonResponseException) { return ((GoogleJsonResponseException) e).getDetails(); } return null; } }
public class class_name { protected GoogleJsonError getDetails(IOException e) { if (e instanceof GoogleJsonResponseException) { return ((GoogleJsonResponseException) e).getDetails(); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { private String getErrorCode(SQLException ex) { String result = null; SQLException nestedEx = null; if (ex.getErrorCode() != 0) { result = Integer.toString(ex.getErrorCode()); } if (result == null) { nestedEx = ex.getNextException(); if (nestedEx != null) { result = Integer.toString(nestedEx.getErrorCode()); } } return result; } }
public class class_name { private String getErrorCode(SQLException ex) { String result = null; SQLException nestedEx = null; if (ex.getErrorCode() != 0) { result = Integer.toString(ex.getErrorCode()); // depends on control dependency: [if], data = [(ex.getErrorCode()] } if (result == null) { nestedEx = ex.getNextException(); // depends on control dependency: [if], data = [none] if (nestedEx != null) { result = Integer.toString(nestedEx.getErrorCode()); // depends on control dependency: [if], data = [(nestedEx] } } return result; } }
public class class_name { void unregisterOutputStream(OutStream stream) { lock.lock(); try { // only decrement if we actually remove the stream if (openOutputStreams.remove(stream)) { numReservedOutputStreams--; available.signalAll(); } } finally { lock.unlock(); } } }
public class class_name { void unregisterOutputStream(OutStream stream) { lock.lock(); try { // only decrement if we actually remove the stream if (openOutputStreams.remove(stream)) { numReservedOutputStreams--; // depends on control dependency: [if], data = [none] available.signalAll(); // depends on control dependency: [if], data = [none] } } finally { lock.unlock(); } } }
public class class_name { public static <MSG extends Message> MSG read(File file, Parser<MSG> parser) { InputStream input = null; try { input = new BufferedInputStream(new FileInputStream(file)); return parser.parseFrom(input); } catch (Exception e) { throw ContextException.of("Unable to read message", e).addContext("file", file); } finally { IOUtils.closeQuietly(input); } } }
public class class_name { public static <MSG extends Message> MSG read(File file, Parser<MSG> parser) { InputStream input = null; try { input = new BufferedInputStream(new FileInputStream(file)); // depends on control dependency: [try], data = [none] return parser.parseFrom(input); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw ContextException.of("Unable to read message", e).addContext("file", file); } finally { // depends on control dependency: [catch], data = [none] IOUtils.closeQuietly(input); } } }
public class class_name { public static String prettyPrint(String unformattedJsonString) { StringBuilder sb = new StringBuilder(); int indentLevel = 0; boolean inQuote = false; for (char charFromUnformattedJson : unformattedJsonString.toCharArray()) { switch (charFromUnformattedJson) { case '"': // switch the quoting status inQuote = !inQuote; sb.append(charFromUnformattedJson); break; case ' ': // For space: ignore the space if it is not being quoted. if (inQuote) { sb.append(charFromUnformattedJson); } break; case '{': case '[': // Starting a new block: increase the indent level sb.append(charFromUnformattedJson); indentLevel++; appendIndentedNewLine(indentLevel, sb); break; case '}': case ']': // Ending a new block; decrese the indent level indentLevel--; appendIndentedNewLine(indentLevel, sb); sb.append(charFromUnformattedJson); break; case ',': // Ending a json item; create a new line after sb.append(charFromUnformattedJson); if (!inQuote) { appendIndentedNewLine(indentLevel, sb); } break; default: sb.append(charFromUnformattedJson); } } return sb.toString(); } }
public class class_name { public static String prettyPrint(String unformattedJsonString) { StringBuilder sb = new StringBuilder(); int indentLevel = 0; boolean inQuote = false; for (char charFromUnformattedJson : unformattedJsonString.toCharArray()) { switch (charFromUnformattedJson) { case '"': // switch the quoting status inQuote = !inQuote; sb.append(charFromUnformattedJson); break; case ' ': // For space: ignore the space if it is not being quoted. if (inQuote) { sb.append(charFromUnformattedJson); // depends on control dependency: [if], data = [none] } break; case '{': case '[': // Starting a new block: increase the indent level sb.append(charFromUnformattedJson); indentLevel++; appendIndentedNewLine(indentLevel, sb); break; case '}': case ']': // Ending a new block; decrese the indent level indentLevel--; appendIndentedNewLine(indentLevel, sb); sb.append(charFromUnformattedJson); break; case ',': // Ending a json item; create a new line after sb.append(charFromUnformattedJson); if (!inQuote) { appendIndentedNewLine(indentLevel, sb); // depends on control dependency: [if], data = [none] } break; default: sb.append(charFromUnformattedJson); } } return sb.toString(); } }
public class class_name { private void triggerEvents(WebElement element, WebDriver driver) { if ("input".equalsIgnoreCase(element.getTagName())) { driver.findElement(By.tagName("body")).click(); } } }
public class class_name { private void triggerEvents(WebElement element, WebDriver driver) { if ("input".equalsIgnoreCase(element.getTagName())) { driver.findElement(By.tagName("body")).click(); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void addPostParams(final Request request) { if (body != null) { request.addPostParam("Body", body); } if (attributes != null) { request.addPostParam("Attributes", attributes); } } }
public class class_name { private void addPostParams(final Request request) { if (body != null) { request.addPostParam("Body", body); // depends on control dependency: [if], data = [none] } if (attributes != null) { request.addPostParam("Attributes", attributes); // depends on control dependency: [if], data = [none] } } }
public class class_name { public int parseNaturalIntAscii(final int index, final int length) { boundsCheck0(index, length); final int end = index + length; int tally = 0; for (int i = index; i < end; i++) { tally = (tally * 10) + AsciiEncoding.getDigit(i, byteArray[i]); } return tally; } }
public class class_name { public int parseNaturalIntAscii(final int index, final int length) { boundsCheck0(index, length); final int end = index + length; int tally = 0; for (int i = index; i < end; i++) { tally = (tally * 10) + AsciiEncoding.getDigit(i, byteArray[i]); // depends on control dependency: [for], data = [i] } return tally; } }
public class class_name { public static ALasDataManager getDataManager( File dataFile, GridCoverage2D inDem, double elevThreshold, CoordinateReferenceSystem inCrs ) { String lcName = dataFile.getName().toLowerCase(); if (lcName.endsWith(".las")) { return new LasFileDataManager(dataFile, inDem, elevThreshold, inCrs); } else if (lcName.equals(LasIndexer.INDEX_LASFOLDER)) { return new LasFolderIndexDataManager(dataFile, inDem, elevThreshold, inCrs); } else { try { EDb edb = EDb.fromFileDesktop(dataFile); if (edb != null && edb.isSpatial()) { return new DatabaseLasDataManager(dataFile, inDem, elevThreshold, inCrs); } } catch (Exception e) { // ignore, will be handled } throw new IllegalArgumentException("Can only read .las and " + LasIndexer.INDEX_LASFOLDER + " files."); } } }
public class class_name { public static ALasDataManager getDataManager( File dataFile, GridCoverage2D inDem, double elevThreshold, CoordinateReferenceSystem inCrs ) { String lcName = dataFile.getName().toLowerCase(); if (lcName.endsWith(".las")) { return new LasFileDataManager(dataFile, inDem, elevThreshold, inCrs); // depends on control dependency: [if], data = [none] } else if (lcName.equals(LasIndexer.INDEX_LASFOLDER)) { return new LasFolderIndexDataManager(dataFile, inDem, elevThreshold, inCrs); // depends on control dependency: [if], data = [none] } else { try { EDb edb = EDb.fromFileDesktop(dataFile); if (edb != null && edb.isSpatial()) { return new DatabaseLasDataManager(dataFile, inDem, elevThreshold, inCrs); // depends on control dependency: [if], data = [none] } } catch (Exception e) { // ignore, will be handled } // depends on control dependency: [catch], data = [none] throw new IllegalArgumentException("Can only read .las and " + LasIndexer.INDEX_LASFOLDER + " files."); } } }
public class class_name { Chronology getEffectiveChronology() { Chronology chrono = currentParsed().chrono; if (chrono == null) { chrono = formatter.getChronology(); if (chrono == null) { chrono = IsoChronology.INSTANCE; } } return chrono; } }
public class class_name { Chronology getEffectiveChronology() { Chronology chrono = currentParsed().chrono; if (chrono == null) { chrono = formatter.getChronology(); // depends on control dependency: [if], data = [none] if (chrono == null) { chrono = IsoChronology.INSTANCE; // depends on control dependency: [if], data = [none] } } return chrono; } }
public class class_name { private int getTotalLandscapePointsInPage(CriterionBidLandscapePage page) { int totalLandscapePointsInPage = 0; for (CriterionBidLandscape criterionBidLandscape : page.getEntries()) { totalLandscapePointsInPage += criterionBidLandscape.getLandscapePoints().size(); } return totalLandscapePointsInPage; } }
public class class_name { private int getTotalLandscapePointsInPage(CriterionBidLandscapePage page) { int totalLandscapePointsInPage = 0; for (CriterionBidLandscape criterionBidLandscape : page.getEntries()) { totalLandscapePointsInPage += criterionBidLandscape.getLandscapePoints().size(); // depends on control dependency: [for], data = [criterionBidLandscape] } return totalLandscapePointsInPage; } }
public class class_name { private void trimToSize(int maxSize) { while (true) { String key; Bitmap value; synchronized (this) { if (size < 0 || (map.isEmpty() && size != 0)) { throw new IllegalStateException(getClass().getName() + ".sizeOf() is reporting inconsistent results!"); } if (size <= maxSize || map.isEmpty()) { break; } Map.Entry<String, Bitmap> toEvict = map.entrySet().iterator().next(); if (toEvict == null) { break; } key = toEvict.getKey(); value = toEvict.getValue(); map.remove(key); size -= sizeOf(key, value); } } } }
public class class_name { private void trimToSize(int maxSize) { while (true) { String key; Bitmap value; synchronized (this) { // depends on control dependency: [while], data = [none] if (size < 0 || (map.isEmpty() && size != 0)) { throw new IllegalStateException(getClass().getName() + ".sizeOf() is reporting inconsistent results!"); } if (size <= maxSize || map.isEmpty()) { break; } Map.Entry<String, Bitmap> toEvict = map.entrySet().iterator().next(); if (toEvict == null) { break; } key = toEvict.getKey(); value = toEvict.getValue(); map.remove(key); size -= sizeOf(key, value); } } } }
public class class_name { @Override public List<List<O>> finish(Collection<? extends OutputWriter<O>> writers) { ImmutableList.Builder<List<O>> out = ImmutableList.builder(); for (OutputWriter<O> w : writers) { InMemoryOutputWriter<O> writer = (InMemoryOutputWriter<O>) w; out.add(ImmutableList.copyOf(writer.getResult())); } return out.build(); } }
public class class_name { @Override public List<List<O>> finish(Collection<? extends OutputWriter<O>> writers) { ImmutableList.Builder<List<O>> out = ImmutableList.builder(); for (OutputWriter<O> w : writers) { InMemoryOutputWriter<O> writer = (InMemoryOutputWriter<O>) w; out.add(ImmutableList.copyOf(writer.getResult())); // depends on control dependency: [for], data = [w] } return out.build(); } }
public class class_name { void retriggerSubpartitionRequest(Timer timer, final int subpartitionIndex) { synchronized (requestLock) { checkState(subpartitionView == null, "already requested partition"); timer.schedule(new TimerTask() { @Override public void run() { try { requestSubpartition(subpartitionIndex); } catch (Throwable t) { setError(t); } } }, getCurrentBackoff()); } } }
public class class_name { void retriggerSubpartitionRequest(Timer timer, final int subpartitionIndex) { synchronized (requestLock) { checkState(subpartitionView == null, "already requested partition"); timer.schedule(new TimerTask() { @Override public void run() { try { requestSubpartition(subpartitionIndex); // depends on control dependency: [try], data = [none] } catch (Throwable t) { setError(t); } // depends on control dependency: [catch], data = [none] } }, getCurrentBackoff()); } } }
public class class_name { public KVStore toKVStore() { KVStore store = new KVStore(); store.putValue("status", statusCode()); store.putValue("message", getLocalizedMessage()); store.putValue("timestamp", timestamp()); Integer code = errorCode(); if (null != code) { store.putValue("code", code); } Object payload = attachment(); if (null != payload) { store.putValue("payload", payload); } return store; } }
public class class_name { public KVStore toKVStore() { KVStore store = new KVStore(); store.putValue("status", statusCode()); store.putValue("message", getLocalizedMessage()); store.putValue("timestamp", timestamp()); Integer code = errorCode(); if (null != code) { store.putValue("code", code); // depends on control dependency: [if], data = [code)] } Object payload = attachment(); if (null != payload) { store.putValue("payload", payload); // depends on control dependency: [if], data = [payload)] } return store; } }
public class class_name { protected void closeDatabase(Database database) { try { if(database != null) { database.close(); } } catch (DatabaseException e) { log("Error closing the database connection.", e, Project.MSG_WARN); } } }
public class class_name { protected void closeDatabase(Database database) { try { if(database != null) { database.close(); // depends on control dependency: [if], data = [none] } } catch (DatabaseException e) { log("Error closing the database connection.", e, Project.MSG_WARN); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void incRunningTasks(String poolName, TaskType type, int inc) { Map<String, Integer> runningMap = (type == TaskType.MAP ? poolRunningMaps : poolRunningReduces); if (!runningMap.containsKey(poolName)) { runningMap.put(poolName, 0); } int runningTasks = runningMap.get(poolName) + inc; runningMap.put(poolName, runningTasks); } }
public class class_name { public void incRunningTasks(String poolName, TaskType type, int inc) { Map<String, Integer> runningMap = (type == TaskType.MAP ? poolRunningMaps : poolRunningReduces); if (!runningMap.containsKey(poolName)) { runningMap.put(poolName, 0); // depends on control dependency: [if], data = [none] } int runningTasks = runningMap.get(poolName) + inc; runningMap.put(poolName, runningTasks); } }
public class class_name { @SuppressWarnings({ "rawtypes", "unchecked" }) // Using correct types, but wildcards fail to see that. private void processType(final Object component, final Context context, final ContextDestroyer contextDestroyer) { final com.badlogic.gdx.utils.reflect.Annotation[] annotations = getAnnotations(component.getClass()); if (annotations == null || annotations.length == 0) { return; } for (final com.badlogic.gdx.utils.reflect.Annotation annotation : annotations) { if (typeProcessors.containsKey(annotation.getAnnotationType())) { final Array<AnnotationProcessor<?>> typeProcessorsForAnnotation = typeProcessors .get(annotation.getAnnotationType()); // This might get resized in the process, so we're not using an iterator or assigning size. for (int index = 0; index < typeProcessorsForAnnotation.size; index++) { final AnnotationProcessor processor = typeProcessorsForAnnotation.get(index); processor.processType(component.getClass(), annotation.getAnnotation(annotation.getAnnotationType()), component, context, this, contextDestroyer); } } } } }
public class class_name { @SuppressWarnings({ "rawtypes", "unchecked" }) // Using correct types, but wildcards fail to see that. private void processType(final Object component, final Context context, final ContextDestroyer contextDestroyer) { final com.badlogic.gdx.utils.reflect.Annotation[] annotations = getAnnotations(component.getClass()); if (annotations == null || annotations.length == 0) { return; // depends on control dependency: [if], data = [none] } for (final com.badlogic.gdx.utils.reflect.Annotation annotation : annotations) { if (typeProcessors.containsKey(annotation.getAnnotationType())) { final Array<AnnotationProcessor<?>> typeProcessorsForAnnotation = typeProcessors .get(annotation.getAnnotationType()); // This might get resized in the process, so we're not using an iterator or assigning size. for (int index = 0; index < typeProcessorsForAnnotation.size; index++) { final AnnotationProcessor processor = typeProcessorsForAnnotation.get(index); processor.processType(component.getClass(), annotation.getAnnotation(annotation.getAnnotationType()), component, context, this, contextDestroyer); // depends on control dependency: [for], data = [none] } } } } }
public class class_name { public ListByteMatchSetsResult withByteMatchSets(ByteMatchSetSummary... byteMatchSets) { if (this.byteMatchSets == null) { setByteMatchSets(new java.util.ArrayList<ByteMatchSetSummary>(byteMatchSets.length)); } for (ByteMatchSetSummary ele : byteMatchSets) { this.byteMatchSets.add(ele); } return this; } }
public class class_name { public ListByteMatchSetsResult withByteMatchSets(ByteMatchSetSummary... byteMatchSets) { if (this.byteMatchSets == null) { setByteMatchSets(new java.util.ArrayList<ByteMatchSetSummary>(byteMatchSets.length)); // depends on control dependency: [if], data = [none] } for (ByteMatchSetSummary ele : byteMatchSets) { this.byteMatchSets.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public javax.slee.profile.ProfileSpecificationDescriptor getSpecsDescriptor() { if (specsDescriptor == null) { final LibraryID[] libraryIDs = descriptor.getLibraryRefs().toArray(new LibraryID[descriptor.getLibraryRefs().size()]); final ProfileSpecificationID[] profileSpecs = new ProfileSpecificationID[descriptor.getProfileSpecRefs().size()]; for (int i = 0; i < profileSpecs.length; i++) { profileSpecs[i] = descriptor.getProfileSpecRefs().get(i).getComponentID(); } specsDescriptor = new javax.slee.profile.ProfileSpecificationDescriptor(getProfileSpecificationID(), getDeployableUnit().getDeployableUnitID(), getDeploymentUnitSource(), libraryIDs, profileSpecs, getDescriptor().getProfileCMPInterface().getProfileCmpInterfaceName()); } return specsDescriptor; } }
public class class_name { public javax.slee.profile.ProfileSpecificationDescriptor getSpecsDescriptor() { if (specsDescriptor == null) { final LibraryID[] libraryIDs = descriptor.getLibraryRefs().toArray(new LibraryID[descriptor.getLibraryRefs().size()]); final ProfileSpecificationID[] profileSpecs = new ProfileSpecificationID[descriptor.getProfileSpecRefs().size()]; for (int i = 0; i < profileSpecs.length; i++) { profileSpecs[i] = descriptor.getProfileSpecRefs().get(i).getComponentID(); // depends on control dependency: [for], data = [i] } specsDescriptor = new javax.slee.profile.ProfileSpecificationDescriptor(getProfileSpecificationID(), getDeployableUnit().getDeployableUnitID(), getDeploymentUnitSource(), libraryIDs, profileSpecs, getDescriptor().getProfileCMPInterface().getProfileCmpInterfaceName()); // depends on control dependency: [if], data = [none] } return specsDescriptor; } }
public class class_name { @GuardedBy("evictionLock") void drainWriteBuffer() { if (!buffersWrites()) { return; } for (int i = 0; i < WRITE_BUFFER_MAX; i++) { Runnable task = writeBuffer().poll(); if (task == null) { return; } task.run(); } lazySetDrainStatus(PROCESSING_TO_REQUIRED); } }
public class class_name { @GuardedBy("evictionLock") void drainWriteBuffer() { if (!buffersWrites()) { return; // depends on control dependency: [if], data = [none] } for (int i = 0; i < WRITE_BUFFER_MAX; i++) { Runnable task = writeBuffer().poll(); if (task == null) { return; // depends on control dependency: [if], data = [none] } task.run(); // depends on control dependency: [for], data = [none] } lazySetDrainStatus(PROCESSING_TO_REQUIRED); } }
public class class_name { private Object toMBean(Object object) throws IllegalArgumentException, NotCompliantMBeanException { JmxBean jmxBean = AnnotationUtils.getAnnotation(object.getClass(), JmxBean.class); if (DynamicMBean.class.isAssignableFrom(object.getClass())) { return object; } ClassIntrospector classIntrospector = new ClassIntrospectorImpl(object.getClass()); Class<?> mBeanInterface = classIntrospector.getInterface(new ClassFilterBuilder().name(object.getClass().getName().replace(".", "\\.") + "MBean").build()); if (mBeanInterface != null) { return new AnnotatedStandardMBean(object, mBeanInterface); } Class<?> mxBeanInterface = classIntrospector.getInterface(new ClassFilterBuilder().name(".*MXBean").or().annotated(MXBean.class).build()); if (mxBeanInterface!= null) { return new AnnotatedStandardMBean(object, mxBeanInterface, true); } // Interface set on JmxBean annotation if (!jmxBean.managedInterface().equals(EmptyInterface.class)) { if (implementsInterface(object, jmxBean.managedInterface())) { return new AnnotatedStandardMBean(object, jmxBean.managedInterface()); } else { throw new IllegalArgumentException(JmxBean.class + " attribute managedInterface is set to " + jmxBean.managedInterface() + " but " + object.getClass() + " does not implement that interface"); } } // Search for an implemented interface annotated with JmxInterface Class<?> annotatedInterface = classIntrospector.getInterface(new ClassFilterBuilder().annotated(JmxInterface.class).build()); if (annotatedInterface != null) { return new AnnotatedStandardMBean(object, jmxBean.managedInterface()); } // Create DynamicMBean by using reflection and inspecting annotations return dynamicBeanFactory.getMBeanFor(object); } }
public class class_name { private Object toMBean(Object object) throws IllegalArgumentException, NotCompliantMBeanException { JmxBean jmxBean = AnnotationUtils.getAnnotation(object.getClass(), JmxBean.class); if (DynamicMBean.class.isAssignableFrom(object.getClass())) { return object; } ClassIntrospector classIntrospector = new ClassIntrospectorImpl(object.getClass()); Class<?> mBeanInterface = classIntrospector.getInterface(new ClassFilterBuilder().name(object.getClass().getName().replace(".", "\\.") + "MBean").build()); if (mBeanInterface != null) { return new AnnotatedStandardMBean(object, mBeanInterface); } Class<?> mxBeanInterface = classIntrospector.getInterface(new ClassFilterBuilder().name(".*MXBean").or().annotated(MXBean.class).build()); if (mxBeanInterface!= null) { return new AnnotatedStandardMBean(object, mxBeanInterface, true); } // Interface set on JmxBean annotation if (!jmxBean.managedInterface().equals(EmptyInterface.class)) { if (implementsInterface(object, jmxBean.managedInterface())) { return new AnnotatedStandardMBean(object, jmxBean.managedInterface()); // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException(JmxBean.class + " attribute managedInterface is set to " + jmxBean.managedInterface() + " but " + object.getClass() + " does not implement that interface"); } } // Search for an implemented interface annotated with JmxInterface Class<?> annotatedInterface = classIntrospector.getInterface(new ClassFilterBuilder().annotated(JmxInterface.class).build()); if (annotatedInterface != null) { return new AnnotatedStandardMBean(object, jmxBean.managedInterface()); } // Create DynamicMBean by using reflection and inspecting annotations return dynamicBeanFactory.getMBeanFor(object); } }
public class class_name { public boolean insertAfter(final AbstractHtml... abstractHtmls) { if (parent == null) { throw new NoParentException("There must be a parent for this tag."); } final Lock lock = sharedObject.getLock(ACCESS_OBJECT).writeLock(); boolean result = false; try { lock.lock(); final AbstractHtml[] childrenOfParent = parent.children .toArray(new AbstractHtml[parent.children.size()]); for (int i = 0; i < childrenOfParent.length; i++) { if (equals(childrenOfParent[i])) { if (i < (childrenOfParent.length - 1)) { return childrenOfParent[i + 1] .insertBefore(childrenOfParent, abstractHtmls); } else { parent.appendChildrenLockless(abstractHtmls); } result = true; } } } finally { lock.unlock(); } final PushQueue pushQueue = sharedObject.getPushQueue(ACCESS_OBJECT); if (pushQueue != null) { pushQueue.push(); } return result; } }
public class class_name { public boolean insertAfter(final AbstractHtml... abstractHtmls) { if (parent == null) { throw new NoParentException("There must be a parent for this tag."); } final Lock lock = sharedObject.getLock(ACCESS_OBJECT).writeLock(); boolean result = false; try { lock.lock(); // depends on control dependency: [try], data = [none] final AbstractHtml[] childrenOfParent = parent.children .toArray(new AbstractHtml[parent.children.size()]); for (int i = 0; i < childrenOfParent.length; i++) { if (equals(childrenOfParent[i])) { if (i < (childrenOfParent.length - 1)) { return childrenOfParent[i + 1] .insertBefore(childrenOfParent, abstractHtmls); // depends on control dependency: [if], data = [none] } else { parent.appendChildrenLockless(abstractHtmls); // depends on control dependency: [if], data = [none] } result = true; // depends on control dependency: [if], data = [none] } } } finally { lock.unlock(); } final PushQueue pushQueue = sharedObject.getPushQueue(ACCESS_OBJECT); if (pushQueue != null) { pushQueue.push(); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { @Override public int enqueue(JobRequest jd) { try { return target.path("ji").request().post(Entity.entity(jd, MediaType.APPLICATION_XML), JobInstance.class).getId(); } catch (BadRequestException e) { throw new JqmInvalidRequestException(e.getResponse().readEntity(String.class), e); } catch (Exception e) { throw new JqmClientException(e); } } }
public class class_name { @Override public int enqueue(JobRequest jd) { try { return target.path("ji").request().post(Entity.entity(jd, MediaType.APPLICATION_XML), JobInstance.class).getId(); // depends on control dependency: [try], data = [none] } catch (BadRequestException e) { throw new JqmInvalidRequestException(e.getResponse().readEntity(String.class), e); } // depends on control dependency: [catch], data = [none] catch (Exception e) { throw new JqmClientException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void storeData(Job key, TileBitmap bitmap) { OutputStream outputStream = null; try { File file = getOutputFile(key); if (file == null) { // if the file cannot be written, silently return return; } outputStream = new FileOutputStream(file); bitmap.compress(outputStream); try { lock.writeLock().lock(); if (this.lruCache.put(key.getKey(), file) != null) { LOGGER.warning("overwriting cached entry: " + key.getKey()); } } finally { lock.writeLock().unlock(); } } catch (Exception e) { // we are catching now any exception and then disable the file cache // this should ensure that no exception in the storage thread will // ever crash the main app. If there is a runtime exception, the thread // will exit (via destroy). LOGGER.log(Level.SEVERE, "Disabling filesystem cache", e); // most likely cause is that the disk is full, just disable the // cache otherwise // more and more exceptions will be thrown. this.destroy(); try { lock.writeLock().lock(); this.lruCache = new FileWorkingSetCache<String>(0); } finally { lock.writeLock().unlock(); } } finally { IOUtils.closeQuietly(outputStream); } } }
public class class_name { private void storeData(Job key, TileBitmap bitmap) { OutputStream outputStream = null; try { File file = getOutputFile(key); if (file == null) { // if the file cannot be written, silently return return; // depends on control dependency: [if], data = [none] } outputStream = new FileOutputStream(file); // depends on control dependency: [try], data = [none] bitmap.compress(outputStream); // depends on control dependency: [try], data = [none] try { lock.writeLock().lock(); // depends on control dependency: [try], data = [none] if (this.lruCache.put(key.getKey(), file) != null) { LOGGER.warning("overwriting cached entry: " + key.getKey()); // depends on control dependency: [if], data = [none] } } finally { lock.writeLock().unlock(); } } catch (Exception e) { // we are catching now any exception and then disable the file cache // this should ensure that no exception in the storage thread will // ever crash the main app. If there is a runtime exception, the thread // will exit (via destroy). LOGGER.log(Level.SEVERE, "Disabling filesystem cache", e); // most likely cause is that the disk is full, just disable the // cache otherwise // more and more exceptions will be thrown. this.destroy(); try { lock.writeLock().lock(); // depends on control dependency: [try], data = [none] this.lruCache = new FileWorkingSetCache<String>(0); // depends on control dependency: [try], data = [none] } finally { lock.writeLock().unlock(); } } finally { // depends on control dependency: [catch], data = [none] IOUtils.closeQuietly(outputStream); } } }
public class class_name { private void visitNonMethodMember(Node member, ClassDeclarationMetadata metadata) { if (member.isComputedProp() && member.isStaticMember()) { cannotConvertYet(compiler, member, "Static computed property"); return; } if (member.isComputedProp() && !member.getFirstChild().isQualifiedName()) { cannotConvert( compiler, member.getFirstChild(), "Computed property with non-qualified-name key"); return; } JSTypeExpression typeExpr = getTypeFromGetterOrSetter(member); addToDefinePropertiesObject(metadata, member); Map<String, ClassProperty> membersToDeclare = member.isStaticMember() ? metadata.getClassMembersToDeclare() : metadata.getPrototypeMembersToDeclare(); ClassProperty.Builder builder = ClassProperty.builder(); String memberName; if (member.isComputedProp()) { checkState(!member.isStaticMember()); memberName = member.getFirstChild().getQualifiedName(); builder.kind(ClassProperty.PropertyKind.COMPUTED_PROPERTY); } else if (member.isQuotedString()) { memberName = member.getString(); builder.kind(ClassProperty.PropertyKind.QUOTED_PROPERTY); } else { memberName = member.getString(); builder.kind(ClassProperty.PropertyKind.NORMAL_PROPERTY); } builder.propertyKey(memberName); ClassProperty existingProperty = membersToDeclare.get(memberName); JSTypeExpression existingType = existingProperty == null ? null : existingProperty.jsDocInfo().getType(); if (existingProperty != null && typeExpr != null && !existingType.equals(typeExpr)) { compiler.report(JSError.make(member, CONFLICTING_GETTER_SETTER_TYPE, memberName)); } else { JSDocInfoBuilder jsDoc = new JSDocInfoBuilder(false); if (member.getJSDocInfo() != null && member.getJSDocInfo().isExport()) { jsDoc.recordExport(); jsDoc.recordVisibility(Visibility.PUBLIC); } if (member.getJSDocInfo() != null && member.getJSDocInfo().isOverride()) { jsDoc.recordOverride(); } else if (typeExpr == null) { typeExpr = new JSTypeExpression(new Node(Token.QMARK), member.getSourceFileName()); } if (typeExpr != null) { jsDoc.recordType(typeExpr.copy()); } if (member.isStaticMember() && !member.isComputedProp()) { jsDoc.recordNoCollapse(); } builder.jsDocInfo(jsDoc.build()); membersToDeclare.put(memberName, builder.build()); } } }
public class class_name { private void visitNonMethodMember(Node member, ClassDeclarationMetadata metadata) { if (member.isComputedProp() && member.isStaticMember()) { cannotConvertYet(compiler, member, "Static computed property"); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (member.isComputedProp() && !member.getFirstChild().isQualifiedName()) { cannotConvert( compiler, member.getFirstChild(), "Computed property with non-qualified-name key"); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } JSTypeExpression typeExpr = getTypeFromGetterOrSetter(member); addToDefinePropertiesObject(metadata, member); Map<String, ClassProperty> membersToDeclare = member.isStaticMember() ? metadata.getClassMembersToDeclare() : metadata.getPrototypeMembersToDeclare(); ClassProperty.Builder builder = ClassProperty.builder(); String memberName; if (member.isComputedProp()) { checkState(!member.isStaticMember()); // depends on control dependency: [if], data = [none] memberName = member.getFirstChild().getQualifiedName(); // depends on control dependency: [if], data = [none] builder.kind(ClassProperty.PropertyKind.COMPUTED_PROPERTY); // depends on control dependency: [if], data = [none] } else if (member.isQuotedString()) { memberName = member.getString(); // depends on control dependency: [if], data = [none] builder.kind(ClassProperty.PropertyKind.QUOTED_PROPERTY); // depends on control dependency: [if], data = [none] } else { memberName = member.getString(); // depends on control dependency: [if], data = [none] builder.kind(ClassProperty.PropertyKind.NORMAL_PROPERTY); // depends on control dependency: [if], data = [none] } builder.propertyKey(memberName); ClassProperty existingProperty = membersToDeclare.get(memberName); JSTypeExpression existingType = existingProperty == null ? null : existingProperty.jsDocInfo().getType(); if (existingProperty != null && typeExpr != null && !existingType.equals(typeExpr)) { compiler.report(JSError.make(member, CONFLICTING_GETTER_SETTER_TYPE, memberName)); // depends on control dependency: [if], data = [none] } else { JSDocInfoBuilder jsDoc = new JSDocInfoBuilder(false); if (member.getJSDocInfo() != null && member.getJSDocInfo().isExport()) { jsDoc.recordExport(); // depends on control dependency: [if], data = [none] jsDoc.recordVisibility(Visibility.PUBLIC); // depends on control dependency: [if], data = [none] } if (member.getJSDocInfo() != null && member.getJSDocInfo().isOverride()) { jsDoc.recordOverride(); // depends on control dependency: [if], data = [none] } else if (typeExpr == null) { typeExpr = new JSTypeExpression(new Node(Token.QMARK), member.getSourceFileName()); // depends on control dependency: [if], data = [none] } if (typeExpr != null) { jsDoc.recordType(typeExpr.copy()); // depends on control dependency: [if], data = [(typeExpr] } if (member.isStaticMember() && !member.isComputedProp()) { jsDoc.recordNoCollapse(); // depends on control dependency: [if], data = [none] } builder.jsDocInfo(jsDoc.build()); // depends on control dependency: [if], data = [none] membersToDeclare.put(memberName, builder.build()); // depends on control dependency: [if], data = [none] } } }
public class class_name { void reschedule(long delay, TimeUnit timeUnit) { long delayNanos = timeUnit.toNanos(delay); long newRunAtNanos = nanoTime() + delayNanos; enabled = true; if (newRunAtNanos - runAtNanos < 0 || wakeUp == null) { if (wakeUp != null) { wakeUp.cancel(false); } wakeUp = scheduler.schedule(new FutureRunnable(), delayNanos, TimeUnit.NANOSECONDS); } runAtNanos = newRunAtNanos; } }
public class class_name { void reschedule(long delay, TimeUnit timeUnit) { long delayNanos = timeUnit.toNanos(delay); long newRunAtNanos = nanoTime() + delayNanos; enabled = true; if (newRunAtNanos - runAtNanos < 0 || wakeUp == null) { if (wakeUp != null) { wakeUp.cancel(false); // depends on control dependency: [if], data = [none] } wakeUp = scheduler.schedule(new FutureRunnable(), delayNanos, TimeUnit.NANOSECONDS); // depends on control dependency: [if], data = [none] } runAtNanos = newRunAtNanos; } }
public class class_name { public long getMS(String methodName, FacadeOperation op, Type type) { String cacheKey = type + "-" + methodName; if (methodTimeouts.containsKey(cacheKey)) { return methodTimeouts.get(cacheKey); } String configurationKeyPrefix = CONFIG_PREFIX+type+"."+beanName; String timeoutPropValue = properties.getProperty(configurationKeyPrefix + "." + methodName); if (timeoutPropValue == null && op != null) { if (log.isDebugEnabled()) { log.debug("{} config not found for method {}, trying default for {} operations for this bean", type, methodName, op); } timeoutPropValue = properties.getProperty(configurationKeyPrefix + "." + op); } if (timeoutPropValue == null) { if (log.isDebugEnabled()) { log.debug("{} config not found for method {}, trying default for this bean", type, methodName); } timeoutPropValue = properties.getProperty(configurationKeyPrefix); } Long timeout; if (timeoutPropValue == null) { if (log.isDebugEnabled()) { log.debug("{} config not found for bean {} using global timeout", type, beanName); } switch (type) { case timeout: { timeout = defaultTimeoutMS; break; } case slowwarning: { timeout = defaultSlowwarnMS; break; } default: throw new IllegalArgumentException("Type " + type + " not known!"); } } else { timeout = Long.parseLong(timeoutPropValue); } if (log.isDebugEnabled()) { log.debug("Setting {} for {}.{} to {}ms", type, beanName, methodName, timeout); } methodTimeouts.put(cacheKey, timeout); return timeout; } }
public class class_name { public long getMS(String methodName, FacadeOperation op, Type type) { String cacheKey = type + "-" + methodName; if (methodTimeouts.containsKey(cacheKey)) { return methodTimeouts.get(cacheKey); // depends on control dependency: [if], data = [none] } String configurationKeyPrefix = CONFIG_PREFIX+type+"."+beanName; String timeoutPropValue = properties.getProperty(configurationKeyPrefix + "." + methodName); if (timeoutPropValue == null && op != null) { if (log.isDebugEnabled()) { log.debug("{} config not found for method {}, trying default for {} operations for this bean", type, methodName, op); // depends on control dependency: [if], data = [none] } timeoutPropValue = properties.getProperty(configurationKeyPrefix + "." + op); // depends on control dependency: [if], data = [none] } if (timeoutPropValue == null) { if (log.isDebugEnabled()) { log.debug("{} config not found for method {}, trying default for this bean", type, methodName); // depends on control dependency: [if], data = [none] } timeoutPropValue = properties.getProperty(configurationKeyPrefix); // depends on control dependency: [if], data = [none] } Long timeout; if (timeoutPropValue == null) { if (log.isDebugEnabled()) { log.debug("{} config not found for bean {} using global timeout", type, beanName); // depends on control dependency: [if], data = [none] } switch (type) { case timeout: { timeout = defaultTimeoutMS; break; } case slowwarning: { timeout = defaultSlowwarnMS; break; } default: throw new IllegalArgumentException("Type " + type + " not known!"); } } else { timeout = Long.parseLong(timeoutPropValue); } if (log.isDebugEnabled()) { log.debug("Setting {} for {}.{} to {}ms", type, beanName, methodName, timeout); } methodTimeouts.put(cacheKey, timeout); return timeout; } }
public class class_name { @Override protected String doBuildColumnString(String dm) { StringBuilder sb = new StringBuilder(); sb.append(dm).append(createdAt); sb.append(dm).append(docId); sb.append(dm).append(queryId); sb.append(dm).append(url); sb.append(dm).append(userInfoId); if (sb.length() > dm.length()) { sb.delete(0, dm.length()); } sb.insert(0, "{").append("}"); return sb.toString(); } }
public class class_name { @Override protected String doBuildColumnString(String dm) { StringBuilder sb = new StringBuilder(); sb.append(dm).append(createdAt); sb.append(dm).append(docId); sb.append(dm).append(queryId); sb.append(dm).append(url); sb.append(dm).append(userInfoId); if (sb.length() > dm.length()) { sb.delete(0, dm.length()); // depends on control dependency: [if], data = [dm.length())] } sb.insert(0, "{").append("}"); return sb.toString(); } }
public class class_name { public double Function1D(double x) { double frequency = initFrequency; double amplitude = initAmplitude; double sum = 0; // octaves for (int i = 0; i < octaves; i++) { sum += SmoothedNoise(x * frequency) * amplitude; frequency *= 2; amplitude *= persistence; } return sum; } }
public class class_name { public double Function1D(double x) { double frequency = initFrequency; double amplitude = initAmplitude; double sum = 0; // octaves for (int i = 0; i < octaves; i++) { sum += SmoothedNoise(x * frequency) * amplitude; // depends on control dependency: [for], data = [none] frequency *= 2; // depends on control dependency: [for], data = [none] amplitude *= persistence; // depends on control dependency: [for], data = [none] } return sum; } }
public class class_name { private static List<AnnotationValidator> getAllAnnotationValidators(Registry registry, Class<?> clazz) { List<AnnotationValidator> annotationValidators = CollectionUtil.createArrayList(); Field[] fields = ReflectionUtil.getAnnotationFields(clazz, FluentValidate.class); for (int i = 0; i < fields.length; i++) { Field field = fields[i]; FluentValidate fluentValidateAnnt = ReflectionUtil.getAnnotation(field, FluentValidate.class); Class<? extends Validator>[] validatorClasses = fluentValidateAnnt.value(); Class<?>[] groups = fluentValidateAnnt.groups(); if (validatorClasses == null || validatorClasses.length == 0) { LOGGER.debug(String.format("No validator annotation bound %s#%s", clazz.getSimpleName(), field.getName())); continue; } List<Validator> validators = CollectionUtil.createArrayList(4); for (Class<? extends Validator> validatorClass : validatorClasses) { if (!Validator.class.isAssignableFrom(validatorClass)) { LOGGER.warn(String.format("Validator annotation class %s is not assignable from %s", validatorClass.getSimpleName(), Validator.class.getSimpleName())); continue; } if (!VALIDATOR_MAP.containsKey(validatorClass)) { List<? extends Validator> validatorsFound = registry.findByType(validatorClass); if (CollectionUtil.isEmpty(validatorsFound)) { LOGGER.warn(String.format("Validator annotation class %s not found or init failed for " + "%s#%s", validatorClass.getSimpleName(), clazz.getSimpleName(), field.getName())); continue; } if (validatorsFound.size() > 1) { LOGGER.warn(String.format( "Validator annotation class %s found multiple instances for %s#%s, so the first " + "one will be used", validatorClass.getSimpleName(), clazz.getSimpleName(), field.getName())); } VALIDATOR_MAP.putIfAbsent(validatorClass, validatorsFound.get(0)); LOGGER.info(String.format("Cached validator %s", validatorClass.getSimpleName())); } validators.add(VALIDATOR_MAP.get(validatorClass)); } if (CollectionUtil.isEmpty(validators)) { LOGGER.debug(String.format("Annotation-based validation enabled but none of the validators is " + "applicable for %s#%s", clazz.getSimpleName(), field.getName())); continue; } AnnotationValidator av = new AnnotationValidator(); av.setField(field); av.setMethod(ReflectionUtil.getGetterMethod(clazz, field)); av.setValidators(validators); av.setGroups(groups); annotationValidators.add(av); LOGGER.trace("Annotation-based validation added " + av); } fields = ReflectionUtil.getAnnotationFields(clazz, FluentValid.class); for (int i = 0; i < fields.length; i++) { Field field = fields[i]; FluentValid cascadeAnnt = ReflectionUtil.getAnnotation(field, FluentValid.class); AnnotationValidator av = new AnnotationValidator(); av.setField(field); av.setMethod(ReflectionUtil.getGetterMethod(clazz, field)); av.setValidators(null); av.setGroups(null); av.setIsCascade(cascadeAnnt != null); annotationValidators.add(av); LOGGER.trace("Cascade annotation-based validation added " + av); } return annotationValidators; } }
public class class_name { private static List<AnnotationValidator> getAllAnnotationValidators(Registry registry, Class<?> clazz) { List<AnnotationValidator> annotationValidators = CollectionUtil.createArrayList(); Field[] fields = ReflectionUtil.getAnnotationFields(clazz, FluentValidate.class); for (int i = 0; i < fields.length; i++) { Field field = fields[i]; FluentValidate fluentValidateAnnt = ReflectionUtil.getAnnotation(field, FluentValidate.class); Class<? extends Validator>[] validatorClasses = fluentValidateAnnt.value(); Class<?>[] groups = fluentValidateAnnt.groups(); if (validatorClasses == null || validatorClasses.length == 0) { LOGGER.debug(String.format("No validator annotation bound %s#%s", clazz.getSimpleName(), field.getName())); continue; } List<Validator> validators = CollectionUtil.createArrayList(4); for (Class<? extends Validator> validatorClass : validatorClasses) { if (!Validator.class.isAssignableFrom(validatorClass)) { LOGGER.warn(String.format("Validator annotation class %s is not assignable from %s", validatorClass.getSimpleName(), Validator.class.getSimpleName())); // depends on control dependency: [if], data = [none] continue; } if (!VALIDATOR_MAP.containsKey(validatorClass)) { List<? extends Validator> validatorsFound = registry.findByType(validatorClass); // depends on control dependency: [if], data = [none] if (CollectionUtil.isEmpty(validatorsFound)) { LOGGER.warn(String.format("Validator annotation class %s not found or init failed for " + "%s#%s", validatorClass.getSimpleName(), clazz.getSimpleName(), field.getName())); // depends on control dependency: [if], data = [none] continue; } if (validatorsFound.size() > 1) { LOGGER.warn(String.format( "Validator annotation class %s found multiple instances for %s#%s, so the first " + "one will be used", validatorClass.getSimpleName(), clazz.getSimpleName(), field.getName())); // depends on control dependency: [if], data = [none] } VALIDATOR_MAP.putIfAbsent(validatorClass, validatorsFound.get(0)); // depends on control dependency: [if], data = [none] LOGGER.info(String.format("Cached validator %s", validatorClass.getSimpleName())); // depends on control dependency: [if], data = [none] } validators.add(VALIDATOR_MAP.get(validatorClass)); } if (CollectionUtil.isEmpty(validators)) { LOGGER.debug(String.format("Annotation-based validation enabled but none of the validators is " + "applicable for %s#%s", clazz.getSimpleName(), field.getName())); // depends on control dependency: [if], data = [none] continue; } AnnotationValidator av = new AnnotationValidator(); av.setField(field); // depends on control dependency: [for], data = [none] av.setMethod(ReflectionUtil.getGetterMethod(clazz, field)); // depends on control dependency: [for], data = [none] av.setValidators(validators); // depends on control dependency: [for], data = [none] av.setGroups(groups); // depends on control dependency: [for], data = [none] annotationValidators.add(av); // depends on control dependency: [for], data = [none] LOGGER.trace("Annotation-based validation added " + av); // depends on control dependency: [for], data = [none] } fields = ReflectionUtil.getAnnotationFields(clazz, FluentValid.class); for (int i = 0; i < fields.length; i++) { Field field = fields[i]; FluentValid cascadeAnnt = ReflectionUtil.getAnnotation(field, FluentValid.class); AnnotationValidator av = new AnnotationValidator(); av.setField(field); // depends on control dependency: [for], data = [none] av.setMethod(ReflectionUtil.getGetterMethod(clazz, field)); // depends on control dependency: [for], data = [none] av.setValidators(null); // depends on control dependency: [for], data = [none] av.setGroups(null); // depends on control dependency: [for], data = [none] av.setIsCascade(cascadeAnnt != null); // depends on control dependency: [for], data = [none] annotationValidators.add(av); // depends on control dependency: [for], data = [none] LOGGER.trace("Cascade annotation-based validation added " + av); // depends on control dependency: [for], data = [none] } return annotationValidators; } }
public class class_name { public List<T> apply(List<T> selectedCandidates, Random rng) { List<T> population = selectedCandidates; for (EvolutionaryOperator<T> operator : pipeline) { population = operator.apply(population, rng); } return population; } }
public class class_name { public List<T> apply(List<T> selectedCandidates, Random rng) { List<T> population = selectedCandidates; for (EvolutionaryOperator<T> operator : pipeline) { population = operator.apply(population, rng); // depends on control dependency: [for], data = [operator] } return population; } }
public class class_name { public synchronized void unlockExclusive() { if (tc.isEntryEnabled()) SibTr.entry(tc, "unlockExclusive", this); // Synchronize on the locking Mutex. synchronized (iMutex) { // Only release the lock if the holder is the current thread. if (Thread.currentThread() == iExclusiveLockHolder) { if (tc.isDebugEnabled()) SibTr.debug(tc, "Unlocking current thread " + (iExclusiveLockCount - 1)); // Decrement the exclusive lock count, // if the count reaches 0 then we know that // we can safely remove the exclusive lock if (--iExclusiveLockCount == 0) { // Set the flag to indicate that the exclusive lock // has been released. iExclusivelyLocked = false; // Set the exclusive lock holder thread to be null iExclusiveLockHolder = null; // Notify any threads waiting for this lock. notifyAll(); } } else if (tc.isDebugEnabled()) SibTr.debug(tc, "Thread not the current thread to unlock exclusively"); } if (tc.isEntryEnabled()) SibTr.exit(tc, "unlockExclusive"); } }
public class class_name { public synchronized void unlockExclusive() { if (tc.isEntryEnabled()) SibTr.entry(tc, "unlockExclusive", this); // Synchronize on the locking Mutex. synchronized (iMutex) { // Only release the lock if the holder is the current thread. if (Thread.currentThread() == iExclusiveLockHolder) { if (tc.isDebugEnabled()) SibTr.debug(tc, "Unlocking current thread " + (iExclusiveLockCount - 1)); // Decrement the exclusive lock count, // if the count reaches 0 then we know that // we can safely remove the exclusive lock if (--iExclusiveLockCount == 0) { // Set the flag to indicate that the exclusive lock // has been released. iExclusivelyLocked = false; // depends on control dependency: [if], data = [none] // Set the exclusive lock holder thread to be null iExclusiveLockHolder = null; // depends on control dependency: [if], data = [none] // Notify any threads waiting for this lock. notifyAll(); // depends on control dependency: [if], data = [none] } } else if (tc.isDebugEnabled()) SibTr.debug(tc, "Thread not the current thread to unlock exclusively"); } if (tc.isEntryEnabled()) SibTr.exit(tc, "unlockExclusive"); } }
public class class_name { public void smoothOpenMenu(int position, @DirectionMode int direction, int duration) { if (mOldSwipedLayout != null) { if (mOldSwipedLayout.isMenuOpen()) { mOldSwipedLayout.smoothCloseMenu(); } } position += getHeaderCount(); ViewHolder vh = findViewHolderForAdapterPosition(position); if (vh != null) { View itemView = getSwipeMenuView(vh.itemView); if (itemView instanceof SwipeMenuLayout) { mOldSwipedLayout = (SwipeMenuLayout)itemView; if (direction == RIGHT_DIRECTION) { mOldTouchedPosition = position; mOldSwipedLayout.smoothOpenRightMenu(duration); } else if (direction == LEFT_DIRECTION) { mOldTouchedPosition = position; mOldSwipedLayout.smoothOpenLeftMenu(duration); } } } } }
public class class_name { public void smoothOpenMenu(int position, @DirectionMode int direction, int duration) { if (mOldSwipedLayout != null) { if (mOldSwipedLayout.isMenuOpen()) { mOldSwipedLayout.smoothCloseMenu(); // depends on control dependency: [if], data = [none] } } position += getHeaderCount(); ViewHolder vh = findViewHolderForAdapterPosition(position); if (vh != null) { View itemView = getSwipeMenuView(vh.itemView); if (itemView instanceof SwipeMenuLayout) { mOldSwipedLayout = (SwipeMenuLayout)itemView; // depends on control dependency: [if], data = [none] if (direction == RIGHT_DIRECTION) { mOldTouchedPosition = position; // depends on control dependency: [if], data = [none] mOldSwipedLayout.smoothOpenRightMenu(duration); // depends on control dependency: [if], data = [none] } else if (direction == LEFT_DIRECTION) { mOldTouchedPosition = position; // depends on control dependency: [if], data = [none] mOldSwipedLayout.smoothOpenLeftMenu(duration); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public static MediaInfo parseMediaInfo(String url) { if (StringUtils.isEmpty(url)) { return null; } Matcher matcher = PATTERN.matcher(url.trim()); if (!matcher.matches()) { return null; } if (matcher.groupCount() < 1) { throw new IllegalArgumentException(url + " is a media push datasource but have no enough info for groupKey."); } return new MediaInfo(matcher.group(1)); } }
public class class_name { public static MediaInfo parseMediaInfo(String url) { if (StringUtils.isEmpty(url)) { return null; // depends on control dependency: [if], data = [none] } Matcher matcher = PATTERN.matcher(url.trim()); if (!matcher.matches()) { return null; // depends on control dependency: [if], data = [none] } if (matcher.groupCount() < 1) { throw new IllegalArgumentException(url + " is a media push datasource but have no enough info for groupKey."); } return new MediaInfo(matcher.group(1)); } }
public class class_name { private void updateStreamState(Map<TaskStream, WindowState> state) { for (Map.Entry<TaskStream, WindowState> entry : state.entrySet()) { TaskStream taskStream = entry.getKey(); WindowState newState = entry.getValue(); WindowState curState = streamState.get(taskStream); if (curState == null) { streamState.put(taskStream, newState); } else { WindowState updatedState = new WindowState(Math.max(newState.lastExpired, curState.lastExpired), Math.max(newState.lastEvaluated, curState.lastEvaluated)); LOG.debug("Update window state, taskStream {}, curState {}, newState {}", taskStream, curState, updatedState); streamState.put(taskStream, updatedState); } } } }
public class class_name { private void updateStreamState(Map<TaskStream, WindowState> state) { for (Map.Entry<TaskStream, WindowState> entry : state.entrySet()) { TaskStream taskStream = entry.getKey(); WindowState newState = entry.getValue(); WindowState curState = streamState.get(taskStream); if (curState == null) { streamState.put(taskStream, newState); // depends on control dependency: [if], data = [none] } else { WindowState updatedState = new WindowState(Math.max(newState.lastExpired, curState.lastExpired), Math.max(newState.lastEvaluated, curState.lastEvaluated)); LOG.debug("Update window state, taskStream {}, curState {}, newState {}", taskStream, curState, updatedState); // depends on control dependency: [if], data = [none] streamState.put(taskStream, updatedState); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void removeAStarListener(AStarListener<ST, PT> listener) { if (this.listeners != null) { this.listeners.remove(listener); if (this.listeners.isEmpty()) { this.listeners = null; } } } }
public class class_name { public void removeAStarListener(AStarListener<ST, PT> listener) { if (this.listeners != null) { this.listeners.remove(listener); // depends on control dependency: [if], data = [none] if (this.listeners.isEmpty()) { this.listeners = null; // depends on control dependency: [if], data = [none] } } } }
public class class_name { private void readInternalSubset() throws IOException, KriptonRuntimeException { read('['); while (true) { skip(); if (peekCharacter() == ']') { position++; return; } int declarationType = peekType(true); switch (declarationType) { case ELEMENTDECL: readElementDeclaration(); break; case ATTLISTDECL: readAttributeListDeclaration(); break; case ENTITYDECL: readEntityDeclaration(); break; case NOTATIONDECL: readNotationDeclaration(); break; case PROCESSING_INSTRUCTION: read(START_PROCESSING_INSTRUCTION); readUntil(END_PROCESSING_INSTRUCTION, false); break; case COMMENT: readComment(false); break; case PARAMETER_ENTITY_REF: throw new KriptonRuntimeException("Parameter entity references are not supported", true, this.getLineNumber(), this.getColumnNumber(), getPositionDescription(), null); default: throw new KriptonRuntimeException("Unexpected token", true, this.getLineNumber(), this.getColumnNumber(), getPositionDescription(), null); } } } }
public class class_name { private void readInternalSubset() throws IOException, KriptonRuntimeException { read('['); while (true) { skip(); if (peekCharacter() == ']') { position++; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } int declarationType = peekType(true); switch (declarationType) { case ELEMENTDECL: readElementDeclaration(); break; case ATTLISTDECL: readAttributeListDeclaration(); break; case ENTITYDECL: readEntityDeclaration(); break; case NOTATIONDECL: readNotationDeclaration(); break; case PROCESSING_INSTRUCTION: read(START_PROCESSING_INSTRUCTION); readUntil(END_PROCESSING_INSTRUCTION, false); break; case COMMENT: readComment(false); break; case PARAMETER_ENTITY_REF: throw new KriptonRuntimeException("Parameter entity references are not supported", true, this.getLineNumber(), this.getColumnNumber(), getPositionDescription(), null); default: throw new KriptonRuntimeException("Unexpected token", true, this.getLineNumber(), this.getColumnNumber(), getPositionDescription(), null); } } } }
public class class_name { protected void initialize() { this.mappedFields = new HashMap<String, PropertyDescriptor>(); PropertyDescriptor[] pds = BeanUtils.getPropertyDescriptors(mappedClass); if (checkProperties) { mappedProperties = new HashSet<String>(); } for (int i = 0; i < pds.length; i++) { PropertyDescriptor pd = pds[i]; if (pd.getWriteMethod() != null) { if (checkProperties) { this.mappedProperties.add(pd.getName()); } this.mappedFields.put(pd.getName().toLowerCase(), pd); for (String underscoredName : underscoreName(pd.getName())) { if (underscoredName != null && !pd.getName().toLowerCase().equals(underscoredName)) { this.mappedFields.put(underscoredName, pd); } } } } } }
public class class_name { protected void initialize() { this.mappedFields = new HashMap<String, PropertyDescriptor>(); PropertyDescriptor[] pds = BeanUtils.getPropertyDescriptors(mappedClass); if (checkProperties) { mappedProperties = new HashSet<String>(); // depends on control dependency: [if], data = [none] } for (int i = 0; i < pds.length; i++) { PropertyDescriptor pd = pds[i]; if (pd.getWriteMethod() != null) { if (checkProperties) { this.mappedProperties.add(pd.getName()); // depends on control dependency: [if], data = [none] } this.mappedFields.put(pd.getName().toLowerCase(), pd); // depends on control dependency: [if], data = [none] for (String underscoredName : underscoreName(pd.getName())) { if (underscoredName != null && !pd.getName().toLowerCase().equals(underscoredName)) { this.mappedFields.put(underscoredName, pd); // depends on control dependency: [if], data = [(underscoredName] } } } } } }
public class class_name { protected void startPurge() { final boolean bTrace = TraceComponent.isAnyTracingEnabled(); if (bTrace && tc.isEventEnabled()) { Tr.event(tc, "Running purge of expired sessions"); } try { List<SessionImpl> toPurge = new ArrayList<SessionImpl>(); for (Map<String, SessionImpl> sessions : this.groupings.values()) { synchronized (sessions) { // scan for all expired sessions for (SessionImpl session : sessions.values()) { if (session.checkExpiration(false)) { toPurge.add(session); } } // now remove those sessions from the map (outside the // iteration loop) for (SessionImpl session : toPurge) { sessions.remove(session.getId()); } } // end-sync // now iterate that list outside the lock (involves calling // session listeners) for (SessionImpl session : toPurge) { // if the session is still "valid" then we need to call // invalidate now if (bTrace && tc.isDebugEnabled()) { Tr.debug(tc, "Purging session; " + session); } if (!session.isInvalid()) { session.invalidate(); } } toPurge.clear(); } // end-grouping-loop } catch (Throwable t) { FFDCFilter.processException(t, getClass().getName(), "purge"); if (bTrace && tc.isDebugEnabled()) { Tr.debug(tc, "Error while running purge scan; " + t); } } } }
public class class_name { protected void startPurge() { final boolean bTrace = TraceComponent.isAnyTracingEnabled(); if (bTrace && tc.isEventEnabled()) { Tr.event(tc, "Running purge of expired sessions"); // depends on control dependency: [if], data = [none] } try { List<SessionImpl> toPurge = new ArrayList<SessionImpl>(); for (Map<String, SessionImpl> sessions : this.groupings.values()) { synchronized (sessions) { // depends on control dependency: [for], data = [sessions] // scan for all expired sessions for (SessionImpl session : sessions.values()) { if (session.checkExpiration(false)) { toPurge.add(session); // depends on control dependency: [if], data = [none] } } // now remove those sessions from the map (outside the // iteration loop) for (SessionImpl session : toPurge) { sessions.remove(session.getId()); // depends on control dependency: [for], data = [session] } } // end-sync // now iterate that list outside the lock (involves calling // session listeners) for (SessionImpl session : toPurge) { // if the session is still "valid" then we need to call // invalidate now if (bTrace && tc.isDebugEnabled()) { Tr.debug(tc, "Purging session; " + session); // depends on control dependency: [if], data = [none] } if (!session.isInvalid()) { session.invalidate(); // depends on control dependency: [if], data = [none] } } toPurge.clear(); // depends on control dependency: [for], data = [none] } // end-grouping-loop } catch (Throwable t) { FFDCFilter.processException(t, getClass().getName(), "purge"); if (bTrace && tc.isDebugEnabled()) { Tr.debug(tc, "Error while running purge scan; " + t); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void readOpBits(ImageInputStream pStream, boolean hasRegion) throws IOException { // Get rowBytes int rowBytesRaw = pStream.readUnsignedShort(); int rowBytes = rowBytesRaw & 0x7FFF; boolean isPixMap = (rowBytesRaw & 0x8000) > 0; if (DEBUG) { System.out.print(hasRegion ? "bitsRgn" : "bitsRect"); System.out.print(", rowBytes: " + rowBytes); if (isPixMap) { System.out.print(", it is a PixMap"); } else { System.out.print(", it is a BitMap"); } } // Get bounds rectangle. THIS IS NOT TO BE SCALED BY THE RESOLUTION! Rectangle bounds = new Rectangle(); int y = pStream.readUnsignedShort(); int x = pStream.readUnsignedShort(); bounds.setLocation(x, y); y = pStream.readUnsignedShort(); x = pStream.readUnsignedShort(); bounds.setSize(x - bounds.x, y - bounds.y); ColorModel colorModel; int cmpSize; if (isPixMap) { // Get PixMap record version number int pmVersion = pStream.readUnsignedShort(); if (DEBUG) { System.out.print(", pmVersion: " + pmVersion); } // Get packing format int packType = pStream.readUnsignedShort(); if (DEBUG) { System.out.print(", packType: " + packType); } // Get size of packed data (not used for v2) int packSize = pStream.readInt(); if (DEBUG) { System.out.println(", packSize: " + packSize); } // Get resolution info double hRes = PICTUtil.readFixedPoint(pStream); double vRes = PICTUtil.readFixedPoint(pStream); if (DEBUG) { System.out.print("hRes: " + hRes + ", vRes: " + vRes); } // Get pixel type int pixelType = pStream.readUnsignedShort(); if (DEBUG) { if (pixelType == 0) { System.out.print(", indexed pixels"); } else { System.out.print(", RGBDirect"); } } // Get pixel size int pixelSize = pStream.readUnsignedShort(); if (DEBUG) { System.out.print(", pixelSize:" + pixelSize); } // Get pixel component count int cmpCount = pStream.readUnsignedShort(); if (DEBUG) { System.out.print(", cmpCount:" + cmpCount); } // Get pixel component size cmpSize = pStream.readUnsignedShort(); if (DEBUG) { System.out.print(", cmpSize:" + cmpSize); } // planeBytes (ignored) int planeBytes = pStream.readInt(); if (DEBUG) { System.out.print(", planeBytes:" + planeBytes); } // Handle to ColorTable record int clutId = pStream.readInt(); if (DEBUG) { System.out.print(", clutId:" + clutId); } // Reserved pStream.readInt(); // Color table colorModel = PICTUtil.readColorTable(pStream, pixelSize); } else { // Old style BitMap record colorModel = QuickDraw.MONOCHROME; cmpSize = 1; } Rectangle srcRect = new Rectangle(); readRectangle(pStream, srcRect); Rectangle dstRect = new Rectangle(); readRectangle(pStream, dstRect); // Get transfer mode int mode = pStream.readUnsignedShort(); Area region = hasRegion ? readRegion(pStream, new Rectangle()) : null; if (DEBUG) { System.out.print(", bounds: " + bounds); System.out.print(", srcRect: " + srcRect); System.out.print(", dstRect: " + dstRect); System.out.print(", mode: " + mode); System.out.print(hasRegion ? ", region: " + region : ""); System.out.println(); } byte[] data = new byte[rowBytes * bounds.height]; // Read pixel data for (int i = 0; i < bounds.height; i++) { pStream.readFully(data, i * rowBytes, rowBytes); } DataBuffer db = new DataBufferByte(data, data.length); WritableRaster raster = Raster.createPackedRaster(db, (rowBytes * 8) / cmpSize, srcRect.height, cmpSize, null); BufferedImage image = new BufferedImage(colorModel, raster, colorModel.isAlphaPremultiplied(), null); // Draw pixel data srcRect.setLocation(0, 0); // Raster always start at 0,0 context.copyBits(image, srcRect, dstRect, mode, region); } }
public class class_name { private void readOpBits(ImageInputStream pStream, boolean hasRegion) throws IOException { // Get rowBytes int rowBytesRaw = pStream.readUnsignedShort(); int rowBytes = rowBytesRaw & 0x7FFF; boolean isPixMap = (rowBytesRaw & 0x8000) > 0; if (DEBUG) { System.out.print(hasRegion ? "bitsRgn" : "bitsRect"); System.out.print(", rowBytes: " + rowBytes); if (isPixMap) { System.out.print(", it is a PixMap"); // depends on control dependency: [if], data = [none] } else { System.out.print(", it is a BitMap"); // depends on control dependency: [if], data = [none] } } // Get bounds rectangle. THIS IS NOT TO BE SCALED BY THE RESOLUTION! Rectangle bounds = new Rectangle(); int y = pStream.readUnsignedShort(); int x = pStream.readUnsignedShort(); bounds.setLocation(x, y); y = pStream.readUnsignedShort(); x = pStream.readUnsignedShort(); bounds.setSize(x - bounds.x, y - bounds.y); ColorModel colorModel; int cmpSize; if (isPixMap) { // Get PixMap record version number int pmVersion = pStream.readUnsignedShort(); if (DEBUG) { System.out.print(", pmVersion: " + pmVersion); // depends on control dependency: [if], data = [none] } // Get packing format int packType = pStream.readUnsignedShort(); if (DEBUG) { System.out.print(", packType: " + packType); // depends on control dependency: [if], data = [none] } // Get size of packed data (not used for v2) int packSize = pStream.readInt(); if (DEBUG) { System.out.println(", packSize: " + packSize); // depends on control dependency: [if], data = [none] } // Get resolution info double hRes = PICTUtil.readFixedPoint(pStream); double vRes = PICTUtil.readFixedPoint(pStream); if (DEBUG) { System.out.print("hRes: " + hRes + ", vRes: " + vRes); // depends on control dependency: [if], data = [none] } // Get pixel type int pixelType = pStream.readUnsignedShort(); if (DEBUG) { if (pixelType == 0) { System.out.print(", indexed pixels"); // depends on control dependency: [if], data = [none] } else { System.out.print(", RGBDirect"); // depends on control dependency: [if], data = [none] } } // Get pixel size int pixelSize = pStream.readUnsignedShort(); if (DEBUG) { System.out.print(", pixelSize:" + pixelSize); // depends on control dependency: [if], data = [none] } // Get pixel component count int cmpCount = pStream.readUnsignedShort(); if (DEBUG) { System.out.print(", cmpCount:" + cmpCount); // depends on control dependency: [if], data = [none] } // Get pixel component size cmpSize = pStream.readUnsignedShort(); if (DEBUG) { System.out.print(", cmpSize:" + cmpSize); // depends on control dependency: [if], data = [none] } // planeBytes (ignored) int planeBytes = pStream.readInt(); if (DEBUG) { System.out.print(", planeBytes:" + planeBytes); // depends on control dependency: [if], data = [none] } // Handle to ColorTable record int clutId = pStream.readInt(); if (DEBUG) { System.out.print(", clutId:" + clutId); // depends on control dependency: [if], data = [none] } // Reserved pStream.readInt(); // Color table colorModel = PICTUtil.readColorTable(pStream, pixelSize); } else { // Old style BitMap record colorModel = QuickDraw.MONOCHROME; cmpSize = 1; } Rectangle srcRect = new Rectangle(); readRectangle(pStream, srcRect); Rectangle dstRect = new Rectangle(); readRectangle(pStream, dstRect); // Get transfer mode int mode = pStream.readUnsignedShort(); Area region = hasRegion ? readRegion(pStream, new Rectangle()) : null; if (DEBUG) { System.out.print(", bounds: " + bounds); System.out.print(", srcRect: " + srcRect); System.out.print(", dstRect: " + dstRect); System.out.print(", mode: " + mode); System.out.print(hasRegion ? ", region: " + region : ""); System.out.println(); } byte[] data = new byte[rowBytes * bounds.height]; // Read pixel data for (int i = 0; i < bounds.height; i++) { pStream.readFully(data, i * rowBytes, rowBytes); } DataBuffer db = new DataBufferByte(data, data.length); WritableRaster raster = Raster.createPackedRaster(db, (rowBytes * 8) / cmpSize, srcRect.height, cmpSize, null); BufferedImage image = new BufferedImage(colorModel, raster, colorModel.isAlphaPremultiplied(), null); // Draw pixel data srcRect.setLocation(0, 0); // Raster always start at 0,0 context.copyBits(image, srcRect, dstRect, mode, region); } }
public class class_name { public DescribeAggregateComplianceByConfigRulesResult withAggregateComplianceByConfigRules( AggregateComplianceByConfigRule... aggregateComplianceByConfigRules) { if (this.aggregateComplianceByConfigRules == null) { setAggregateComplianceByConfigRules(new com.amazonaws.internal.SdkInternalList<AggregateComplianceByConfigRule>( aggregateComplianceByConfigRules.length)); } for (AggregateComplianceByConfigRule ele : aggregateComplianceByConfigRules) { this.aggregateComplianceByConfigRules.add(ele); } return this; } }
public class class_name { public DescribeAggregateComplianceByConfigRulesResult withAggregateComplianceByConfigRules( AggregateComplianceByConfigRule... aggregateComplianceByConfigRules) { if (this.aggregateComplianceByConfigRules == null) { setAggregateComplianceByConfigRules(new com.amazonaws.internal.SdkInternalList<AggregateComplianceByConfigRule>( aggregateComplianceByConfigRules.length)); // depends on control dependency: [if], data = [none] } for (AggregateComplianceByConfigRule ele : aggregateComplianceByConfigRules) { this.aggregateComplianceByConfigRules.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public static String jpaFetch(PackageImportAdder adder, FetchTypeGetter... fetchTypeGetters) { Assert.notNull(adder); if (fetchTypeGetters == null) { return ""; } // we look for the first non empty conf. // not that it could be a NONE conf => user does not want any fetch type. for (FetchTypeGetter fetchTypeGetter : fetchTypeGetters) { if (fetchTypeGetter != null) { if (fetchTypeGetter.getFetch() != null) { if (fetchTypeGetter.getFetch().isJpaType()) { FetchType fetchType = fetchTypeGetter.getFetch().asJpaType(); adder.addImport("static javax.persistence.FetchType." + fetchType.name()); return "fetch = " + fetchType.name(); } else { // NONE return ""; // user explicitly said he does not want any fetch type. } } } } return ""; } }
public class class_name { public static String jpaFetch(PackageImportAdder adder, FetchTypeGetter... fetchTypeGetters) { Assert.notNull(adder); if (fetchTypeGetters == null) { return ""; // depends on control dependency: [if], data = [none] } // we look for the first non empty conf. // not that it could be a NONE conf => user does not want any fetch type. for (FetchTypeGetter fetchTypeGetter : fetchTypeGetters) { if (fetchTypeGetter != null) { if (fetchTypeGetter.getFetch() != null) { if (fetchTypeGetter.getFetch().isJpaType()) { FetchType fetchType = fetchTypeGetter.getFetch().asJpaType(); adder.addImport("static javax.persistence.FetchType." + fetchType.name()); // depends on control dependency: [if], data = [none] return "fetch = " + fetchType.name(); // depends on control dependency: [if], data = [none] } else { // NONE return ""; // user explicitly said he does not want any fetch type. // depends on control dependency: [if], data = [none] } } } } return ""; } }
public class class_name { public static List<LineParametric2D_F32> pruneSimilarLines( List<LineParametric2D_F32> lines , float intensity[] , float toleranceAngle , float toleranceDist , int imgWidth , int imgHeight ) { int indexSort[] = new int[ intensity.length ]; QuickSort_F32 sort = new QuickSort_F32(); sort.sort(intensity,0, lines.size(), indexSort); float theta[] = new float[ lines.size() ]; List<LineSegment2D_F32> segments = new ArrayList<>(lines.size()); for( int i = 0; i < lines.size(); i++ ) { LineParametric2D_F32 l = lines.get(i); theta[i] = UtilAngle.atanSafe(l.getSlopeY(),l.getSlopeX()); segments.add( convert(l,imgWidth,imgHeight)); } for( int i = segments.size()-1; i >= 0; i-- ) { LineSegment2D_F32 a = segments.get(indexSort[i]); if( a == null ) continue; for( int j = i-1; j >= 0; j-- ) { LineSegment2D_F32 b = segments.get(indexSort[j]); if( b == null ) continue; if( UtilAngle.distHalf(theta[indexSort[i]],theta[indexSort[j]]) > toleranceAngle ) continue; Point2D_F32 p = Intersection2D_F32.intersection(a,b,null); if( p != null && p.x >= 0 && p.y >= 0 && p.x < imgWidth && p.y < imgHeight ) { segments.set(indexSort[j],null); } else { float distA = Distance2D_F32.distance(a,b.a); float distB = Distance2D_F32.distance(a,b.b); if( distA <= toleranceDist || distB < toleranceDist ) { segments.set(indexSort[j],null); } } } } List<LineParametric2D_F32> ret = new ArrayList<>(); for( int i = 0; i < segments.size(); i++ ) { if( segments.get(i) != null ) { ret.add( lines.get(i)); } } return ret; } }
public class class_name { public static List<LineParametric2D_F32> pruneSimilarLines( List<LineParametric2D_F32> lines , float intensity[] , float toleranceAngle , float toleranceDist , int imgWidth , int imgHeight ) { int indexSort[] = new int[ intensity.length ]; QuickSort_F32 sort = new QuickSort_F32(); sort.sort(intensity,0, lines.size(), indexSort); float theta[] = new float[ lines.size() ]; List<LineSegment2D_F32> segments = new ArrayList<>(lines.size()); for( int i = 0; i < lines.size(); i++ ) { LineParametric2D_F32 l = lines.get(i); theta[i] = UtilAngle.atanSafe(l.getSlopeY(),l.getSlopeX()); // depends on control dependency: [for], data = [i] segments.add( convert(l,imgWidth,imgHeight)); // depends on control dependency: [for], data = [none] } for( int i = segments.size()-1; i >= 0; i-- ) { LineSegment2D_F32 a = segments.get(indexSort[i]); if( a == null ) continue; for( int j = i-1; j >= 0; j-- ) { LineSegment2D_F32 b = segments.get(indexSort[j]); if( b == null ) continue; if( UtilAngle.distHalf(theta[indexSort[i]],theta[indexSort[j]]) > toleranceAngle ) continue; Point2D_F32 p = Intersection2D_F32.intersection(a,b,null); if( p != null && p.x >= 0 && p.y >= 0 && p.x < imgWidth && p.y < imgHeight ) { segments.set(indexSort[j],null); // depends on control dependency: [if], data = [none] } else { float distA = Distance2D_F32.distance(a,b.a); float distB = Distance2D_F32.distance(a,b.b); if( distA <= toleranceDist || distB < toleranceDist ) { segments.set(indexSort[j],null); // depends on control dependency: [if], data = [none] } } } } List<LineParametric2D_F32> ret = new ArrayList<>(); for( int i = 0; i < segments.size(); i++ ) { if( segments.get(i) != null ) { ret.add( lines.get(i)); // depends on control dependency: [if], data = [none] } } return ret; } }
public class class_name { public String remainder() { StringBuilder accum = new StringBuilder(); while (!isEmpty()) { accum.append(consume()); } return accum.toString(); } }
public class class_name { public String remainder() { StringBuilder accum = new StringBuilder(); while (!isEmpty()) { accum.append(consume()); // depends on control dependency: [while], data = [none] } return accum.toString(); } }
public class class_name { private synchronized void waitForCommands(final ActiveContext context) { while (!scheduler.hasPendingTasks()) { // Wait until any command enters in the queue try { wait(); } catch (final InterruptedException e) { LOG.log(Level.WARNING, "InterruptedException occurred in SchedulerDriver", e); } } // When wakes up, run the first command from the queue. state = State.RUNNING; scheduler.submitTask(context); } }
public class class_name { private synchronized void waitForCommands(final ActiveContext context) { while (!scheduler.hasPendingTasks()) { // Wait until any command enters in the queue try { wait(); // depends on control dependency: [try], data = [none] } catch (final InterruptedException e) { LOG.log(Level.WARNING, "InterruptedException occurred in SchedulerDriver", e); } // depends on control dependency: [catch], data = [none] } // When wakes up, run the first command from the queue. state = State.RUNNING; scheduler.submitTask(context); } }
public class class_name { public void notifyDataSetChanged() { mIconsLayout.removeAllViews(); IconPagerAdapter iconAdapter = (IconPagerAdapter) mRecyclerView.getAdapter(); int count = mRecyclerView.getAdapter().getItemCount(); for (int i = 0; i < count; i++) { ImageView view = new ImageView(getContext(), null, R.attr.vpiIconPageIndicatorStyle); view.setImageResource(iconAdapter.getIconResId(i)); mIconsLayout.addView(view); } if (mSelectedIndex > count) { mSelectedIndex = count - 1; } requestLayout(); } }
public class class_name { public void notifyDataSetChanged() { mIconsLayout.removeAllViews(); IconPagerAdapter iconAdapter = (IconPagerAdapter) mRecyclerView.getAdapter(); int count = mRecyclerView.getAdapter().getItemCount(); for (int i = 0; i < count; i++) { ImageView view = new ImageView(getContext(), null, R.attr.vpiIconPageIndicatorStyle); view.setImageResource(iconAdapter.getIconResId(i)); // depends on control dependency: [for], data = [i] mIconsLayout.addView(view); // depends on control dependency: [for], data = [none] } if (mSelectedIndex > count) { mSelectedIndex = count - 1; // depends on control dependency: [if], data = [none] } requestLayout(); } }
public class class_name { public static int getInteger( Object value) { if (value == null) { return 0; } if (value instanceof Number) { return ((Number) value).intValue(); } return Integer.valueOf(value.toString()).intValue(); } }
public class class_name { public static int getInteger( Object value) { if (value == null) { return 0; // depends on control dependency: [if], data = [none] } if (value instanceof Number) { return ((Number) value).intValue(); // depends on control dependency: [if], data = [none] } return Integer.valueOf(value.toString()).intValue(); } }
public class class_name { public static boolean needsQuoting(String str) { if (str == null) { return false; } byte[] bytes = str.getBytes(); return needsQuoting(bytes, 0 , bytes.length); } }
public class class_name { public static boolean needsQuoting(String str) { if (str == null) { return false; // depends on control dependency: [if], data = [none] } byte[] bytes = str.getBytes(); return needsQuoting(bytes, 0 , bytes.length); } }
public class class_name { boolean canCastToTypeAndMatchesConstraints( JcrSession session, JcrPropertyDefinition propertyDefinition, Value value ) { try { assert value instanceof JcrValue : "Illegal implementation of Value interface"; ((JcrValue)value).asType(propertyDefinition.getRequiredType()); // throws ValueFormatException if there's a problem return propertyDefinition.satisfiesConstraints(value, session); } catch (javax.jcr.ValueFormatException vfe) { // Cast failed return false; } } }
public class class_name { boolean canCastToTypeAndMatchesConstraints( JcrSession session, JcrPropertyDefinition propertyDefinition, Value value ) { try { assert value instanceof JcrValue : "Illegal implementation of Value interface"; ((JcrValue)value).asType(propertyDefinition.getRequiredType()); // throws ValueFormatException if there's a problem // depends on control dependency: [try], data = [none] return propertyDefinition.satisfiesConstraints(value, session); // depends on control dependency: [try], data = [none] } catch (javax.jcr.ValueFormatException vfe) { // Cast failed return false; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public User setEnabled(String userName, boolean enabled, boolean broadcast) throws Exception, UnsupportedOperationException { User foundUser = findUserByName(userName, UserStatus.ANY); if (foundUser == null || foundUser.isEnabled() == enabled) { return foundUser; } synchronized (foundUser.getUserName()) { Session session = service.getStorageSession(); try { ((UserImpl)foundUser).setEnabled(enabled); if (broadcast) preSetEnabled(foundUser); Node node = getUserNode(session, (UserImpl)foundUser); if (enabled) { if (!node.canAddMixin(JCROrganizationServiceImpl.JOS_DISABLED)) { node.removeMixin(JCROrganizationServiceImpl.JOS_DISABLED); PropertyIterator pi = node.getReferences(); while (pi.hasNext()) { Node n = pi.nextProperty().getParent(); if (!n.canAddMixin(JCROrganizationServiceImpl.JOS_DISABLED)) { n.removeMixin(JCROrganizationServiceImpl.JOS_DISABLED); } } } } else { if (node.canAddMixin(JCROrganizationServiceImpl.JOS_DISABLED)) { node.addMixin(JCROrganizationServiceImpl.JOS_DISABLED); PropertyIterator pi = node.getReferences(); while (pi.hasNext()) { Node n = pi.nextProperty().getParent(); if (n.canAddMixin(JCROrganizationServiceImpl.JOS_DISABLED)) { n.addMixin(JCROrganizationServiceImpl.JOS_DISABLED); } } } } session.save(); if (broadcast) postSetEnabled(foundUser); putInCache(foundUser); } finally { session.logout(); } return foundUser; } } }
public class class_name { public User setEnabled(String userName, boolean enabled, boolean broadcast) throws Exception, UnsupportedOperationException { User foundUser = findUserByName(userName, UserStatus.ANY); if (foundUser == null || foundUser.isEnabled() == enabled) { return foundUser; } synchronized (foundUser.getUserName()) { Session session = service.getStorageSession(); try { ((UserImpl)foundUser).setEnabled(enabled); if (broadcast) preSetEnabled(foundUser); Node node = getUserNode(session, (UserImpl)foundUser); if (enabled) { if (!node.canAddMixin(JCROrganizationServiceImpl.JOS_DISABLED)) { node.removeMixin(JCROrganizationServiceImpl.JOS_DISABLED); // depends on control dependency: [if], data = [none] PropertyIterator pi = node.getReferences(); while (pi.hasNext()) { Node n = pi.nextProperty().getParent(); if (!n.canAddMixin(JCROrganizationServiceImpl.JOS_DISABLED)) { n.removeMixin(JCROrganizationServiceImpl.JOS_DISABLED); // depends on control dependency: [if], data = [none] } } } } else { if (node.canAddMixin(JCROrganizationServiceImpl.JOS_DISABLED)) { node.addMixin(JCROrganizationServiceImpl.JOS_DISABLED); // depends on control dependency: [if], data = [none] PropertyIterator pi = node.getReferences(); while (pi.hasNext()) { Node n = pi.nextProperty().getParent(); if (n.canAddMixin(JCROrganizationServiceImpl.JOS_DISABLED)) { n.addMixin(JCROrganizationServiceImpl.JOS_DISABLED); // depends on control dependency: [if], data = [none] } } } } session.save(); if (broadcast) postSetEnabled(foundUser); putInCache(foundUser); } finally { session.logout(); } return foundUser; } } }
public class class_name { @SuppressWarnings("unchecked") public static boolean isRunnable(Class cl, String methodName, String[] filters) { try { Method m = cl.getMethod(methodName); return isRunnable(m, filters); } catch (NoSuchMethodException | SecurityException e) { return true; } } }
public class class_name { @SuppressWarnings("unchecked") public static boolean isRunnable(Class cl, String methodName, String[] filters) { try { Method m = cl.getMethod(methodName); return isRunnable(m, filters); // depends on control dependency: [try], data = [none] } catch (NoSuchMethodException | SecurityException e) { return true; } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected IMessagePublication addAsynchronousPublication(MessagePublication publication, long timeout, TimeUnit unit) { try { return pendingMessages.offer(publication, timeout, unit) ? publication.markScheduled() : publication; } catch (InterruptedException e) { handlePublicationError(new InternalPublicationError(e, "Error while adding an asynchronous message publication", publication)); return publication; } } }
public class class_name { protected IMessagePublication addAsynchronousPublication(MessagePublication publication, long timeout, TimeUnit unit) { try { return pendingMessages.offer(publication, timeout, unit) ? publication.markScheduled() : publication; // depends on control dependency: [try], data = [none] } catch (InterruptedException e) { handlePublicationError(new InternalPublicationError(e, "Error while adding an asynchronous message publication", publication)); return publication; } // depends on control dependency: [catch], data = [none] } }
public class class_name { private int getOxygenCount(IAtomContainer ac, IAtom atom) { List<IAtom> neighbours = ac.getConnectedAtomsList(atom); int ocounter = 0; for (IAtom neighbour : neighbours) { if (neighbour.getSymbol().equals("O")) { if (!neighbour.getFlag(CDKConstants.ISAROMATIC)) { ocounter += 1; } } } return ocounter; } }
public class class_name { private int getOxygenCount(IAtomContainer ac, IAtom atom) { List<IAtom> neighbours = ac.getConnectedAtomsList(atom); int ocounter = 0; for (IAtom neighbour : neighbours) { if (neighbour.getSymbol().equals("O")) { if (!neighbour.getFlag(CDKConstants.ISAROMATIC)) { ocounter += 1; // depends on control dependency: [if], data = [none] } } } return ocounter; } }
public class class_name { @SafeVarargs public static <T extends Comparable<? super T>> T min(final T... values) { T result = null; if (values != null) { for (final T value : values) { if (compare(value, result, true) < 0) { result = value; } } } return result; } }
public class class_name { @SafeVarargs public static <T extends Comparable<? super T>> T min(final T... values) { T result = null; if (values != null) { for (final T value : values) { if (compare(value, result, true) < 0) { result = value; // depends on control dependency: [if], data = [none] } } } return result; } }
public class class_name { @Override public void decode(final FacesContext context, final UIComponent component) { final Sheet sheet = (Sheet) component; // update Sheet references to work around issue with getParent sometimes // being null for (final SheetColumn column : sheet.getColumns()) { column.setSheet(sheet); } // clear updates from previous decode sheet.getUpdates().clear(); // get parameters // we'll need the request parameters final Map<String, String> params = context.getExternalContext().getRequestParameterMap(); final String clientId = sheet.getClientId(context); // get our input fields final String jsonUpdates = params.get(clientId + "_input"); final String jsonSelection = params.get(clientId + "_selection"); // decode into submitted values on the Sheet decodeSubmittedValues(context, sheet, jsonUpdates); // decode the selected range so we can puke it back decodeSelection(context, sheet, jsonSelection); // decode client behaviors decodeBehaviors(context, sheet); // decode filters decodeFilters(context, sheet, params, clientId); final String sortBy = params.get(clientId + "_sortby"); final String sortOrder = params.get(clientId + "_sortorder"); if (sortBy != null) { int col = Integer.valueOf(sortBy); if (col >= 0) { col = sheet.getMappedColumn(col); sheet.setSortByValueExpression(sheet.getColumns().get(col).getValueExpression("sortBy")); } } if (sortOrder != null) { sheet.setSortOrder(sortOrder); } final String focus = params.get(clientId + "_focus"); sheet.setFocusId(focus); } }
public class class_name { @Override public void decode(final FacesContext context, final UIComponent component) { final Sheet sheet = (Sheet) component; // update Sheet references to work around issue with getParent sometimes // being null for (final SheetColumn column : sheet.getColumns()) { column.setSheet(sheet); // depends on control dependency: [for], data = [column] } // clear updates from previous decode sheet.getUpdates().clear(); // get parameters // we'll need the request parameters final Map<String, String> params = context.getExternalContext().getRequestParameterMap(); final String clientId = sheet.getClientId(context); // get our input fields final String jsonUpdates = params.get(clientId + "_input"); final String jsonSelection = params.get(clientId + "_selection"); // decode into submitted values on the Sheet decodeSubmittedValues(context, sheet, jsonUpdates); // decode the selected range so we can puke it back decodeSelection(context, sheet, jsonSelection); // decode client behaviors decodeBehaviors(context, sheet); // decode filters decodeFilters(context, sheet, params, clientId); final String sortBy = params.get(clientId + "_sortby"); final String sortOrder = params.get(clientId + "_sortorder"); if (sortBy != null) { int col = Integer.valueOf(sortBy); if (col >= 0) { col = sheet.getMappedColumn(col); // depends on control dependency: [if], data = [(col] sheet.setSortByValueExpression(sheet.getColumns().get(col).getValueExpression("sortBy")); // depends on control dependency: [if], data = [(col] } } if (sortOrder != null) { sheet.setSortOrder(sortOrder); // depends on control dependency: [if], data = [(sortOrder] } final String focus = params.get(clientId + "_focus"); sheet.setFocusId(focus); } }
public class class_name { public UnicodeSet compact() { checkFrozen(); if (len != list.length) { int[] temp = new int[len]; System.arraycopy(list, 0, temp, 0, len); list = temp; } rangeList = null; buffer = null; return this; } }
public class class_name { public UnicodeSet compact() { checkFrozen(); if (len != list.length) { int[] temp = new int[len]; System.arraycopy(list, 0, temp, 0, len); // depends on control dependency: [if], data = [none] list = temp; // depends on control dependency: [if], data = [none] } rangeList = null; buffer = null; return this; } }
public class class_name { private ListenerToken addDatabaseChangeListener(Executor executor, DatabaseChangeListener listener) { // NOTE: caller method is synchronized. if (dbChangeNotifier == null) { dbChangeNotifier = new ChangeNotifier<>(); registerC4DBObserver(); } return dbChangeNotifier.addChangeListener(executor, listener); } }
public class class_name { private ListenerToken addDatabaseChangeListener(Executor executor, DatabaseChangeListener listener) { // NOTE: caller method is synchronized. if (dbChangeNotifier == null) { dbChangeNotifier = new ChangeNotifier<>(); // depends on control dependency: [if], data = [none] registerC4DBObserver(); // depends on control dependency: [if], data = [none] } return dbChangeNotifier.addChangeListener(executor, listener); } }
public class class_name { public void marshall(ModerationLabel moderationLabel, ProtocolMarshaller protocolMarshaller) { if (moderationLabel == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(moderationLabel.getConfidence(), CONFIDENCE_BINDING); protocolMarshaller.marshall(moderationLabel.getName(), NAME_BINDING); protocolMarshaller.marshall(moderationLabel.getParentName(), PARENTNAME_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ModerationLabel moderationLabel, ProtocolMarshaller protocolMarshaller) { if (moderationLabel == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(moderationLabel.getConfidence(), CONFIDENCE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(moderationLabel.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(moderationLabel.getParentName(), PARENTNAME_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 { protected static InternetAddress[] add(InternetAddress[] oldArr, InternetAddress newValue) { if (oldArr == null) return new InternetAddress[] { newValue }; // else { InternetAddress[] tmp = new InternetAddress[oldArr.length + 1]; for (int i = 0; i < oldArr.length; i++) { tmp[i] = oldArr[i]; } tmp[oldArr.length] = newValue; return tmp; // } } }
public class class_name { protected static InternetAddress[] add(InternetAddress[] oldArr, InternetAddress newValue) { if (oldArr == null) return new InternetAddress[] { newValue }; // else { InternetAddress[] tmp = new InternetAddress[oldArr.length + 1]; for (int i = 0; i < oldArr.length; i++) { tmp[i] = oldArr[i]; // depends on control dependency: [for], data = [i] } tmp[oldArr.length] = newValue; return tmp; // } } }
public class class_name { public static SamlEndpoint ofHttpRedirect(String uri) { requireNonNull(uri, "uri"); try { return ofHttpRedirect(new URI(uri)); } catch (URISyntaxException e) { return Exceptions.throwUnsafely(e); } } }
public class class_name { public static SamlEndpoint ofHttpRedirect(String uri) { requireNonNull(uri, "uri"); try { return ofHttpRedirect(new URI(uri)); // depends on control dependency: [try], data = [none] } catch (URISyntaxException e) { return Exceptions.throwUnsafely(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { long getPrimaryBefore(long p, boolean isCompressible) { int index = findPrimary(p); int step; long q = elements[index]; if(p == (q & 0xffffff00L)) { // Found p itself. Return the previous primary. // See if p is at the end of a previous range. step = (int)q & PRIMARY_STEP_MASK; if(step == 0) { // p is not at the end of a range. Look for the previous primary. do { p = elements[--index]; } while((p & SEC_TER_DELTA_FLAG) != 0); return p & 0xffffff00L; } } else { // p is in a range, and not at the start. long nextElement = elements[index + 1]; assert(isEndOfPrimaryRange(nextElement)); step = (int)nextElement & PRIMARY_STEP_MASK; } // Return the previous range primary. if((p & 0xffff) == 0) { return Collation.decTwoBytePrimaryByOneStep(p, isCompressible, step); } else { return Collation.decThreeBytePrimaryByOneStep(p, isCompressible, step); } } }
public class class_name { long getPrimaryBefore(long p, boolean isCompressible) { int index = findPrimary(p); int step; long q = elements[index]; if(p == (q & 0xffffff00L)) { // Found p itself. Return the previous primary. // See if p is at the end of a previous range. step = (int)q & PRIMARY_STEP_MASK; // depends on control dependency: [if], data = [none] if(step == 0) { // p is not at the end of a range. Look for the previous primary. do { p = elements[--index]; } while((p & SEC_TER_DELTA_FLAG) != 0); return p & 0xffffff00L; // depends on control dependency: [if], data = [none] } } else { // p is in a range, and not at the start. long nextElement = elements[index + 1]; assert(isEndOfPrimaryRange(nextElement)); // depends on control dependency: [if], data = [none] step = (int)nextElement & PRIMARY_STEP_MASK; // depends on control dependency: [if], data = [none] } // Return the previous range primary. if((p & 0xffff) == 0) { return Collation.decTwoBytePrimaryByOneStep(p, isCompressible, step); // depends on control dependency: [if], data = [none] } else { return Collation.decThreeBytePrimaryByOneStep(p, isCompressible, step); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public void removeActiveMessages(int messages) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "removeActiveMessages", new Object[] { Integer.valueOf(messages), Integer.valueOf(_currentActiveMessages), Integer.valueOf(_maxActiveMessages), Boolean.valueOf(_consumerSuspended), Boolean.valueOf(_bifurcatable) }); // First we decrement the message count for any ConsumerSet we happen to be // a part of. If this happens to take us below the max for the set then we // will resume any consumers in the set (where appropriate). We then // handle any resuming of this consumer in this method (as it has to take // account of any maxActiveMessage setting for this consumer. _consumerKey.removeActiveMessages(messages); // Need to check maxActiveMessages for this consumer if (_bifurcatable && (_maxActiveMessages != 0)) { boolean threasholdCrossed = false; // Lock the active message counter synchronized (_maxActiveMessageLock) { _currentActiveMessages -= messages; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "_currentActiveMessages: " + _currentActiveMessages); // See if we've gone below the active limit we therefore need to // resume the consumer (resumeConsumer() checks that the set is also // resumed) if ((_currentActiveMessages == (_maxActiveMessages - messages))) { // Remember to resume the consumer once we've released the maxActiveMessage // lock threasholdCrossed = true; } // We should never go negative, if we do something has gone wrong - FFDC if (_currentActiveMessages < 0) { SIErrorException e = new SIErrorException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.impl.JSLocalConsumerPoint.removeActiveMessages", "1:4657:1.22.5.1", Integer.valueOf(_currentActiveMessages) }, null)); FFDCFilter.processException( e, "com.ibm.ws.sib.processor.impl.JSLocalConsumerPoint.removeActiveMessages", "1:4664:1.22.5.1", this); SibTr.exception(tc, e); SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.impl.JSLocalConsumerPoint.removeActiveMessages", "1:4671:1.22.5.1" }); } } // synchronized // The threashold was crossed, first take the LCP lock then the maxActiveMessage // lock again and re-check the current state before resuming the consumer. if (threasholdCrossed) { this.lock(); try { synchronized (_maxActiveMessageLock) { // Re-check to make sure someone else hasn't got in between the // above release of the maxActiveMessage lock and this point and // added more active messages - suspending us again. // The count could be less than the threashold because someone else // also released a message - in this case we still need to be the // one to resume the consumer as the other release wouldn't have crossed // the threashold and therefore not be in this bit of code. if (_currentActiveMessages < _maxActiveMessages) { resumeConsumer(SUSPEND_FLAG_ACTIVE_MSGS); // (F001731) // If we have an alarm registered to warn of long pauses then cancel it now // (this will issue an all-clear message is the pause has already been reported) if (_activeMsgBlockAlarm != null) _activeMsgBlockAlarm.cancelAlarm(); } } } finally { this.unlock(); } } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "removeActiveMessages"); } }
public class class_name { @Override public void removeActiveMessages(int messages) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "removeActiveMessages", new Object[] { Integer.valueOf(messages), Integer.valueOf(_currentActiveMessages), Integer.valueOf(_maxActiveMessages), Boolean.valueOf(_consumerSuspended), Boolean.valueOf(_bifurcatable) }); // First we decrement the message count for any ConsumerSet we happen to be // a part of. If this happens to take us below the max for the set then we // will resume any consumers in the set (where appropriate). We then // handle any resuming of this consumer in this method (as it has to take // account of any maxActiveMessage setting for this consumer. _consumerKey.removeActiveMessages(messages); // Need to check maxActiveMessages for this consumer if (_bifurcatable && (_maxActiveMessages != 0)) { boolean threasholdCrossed = false; // Lock the active message counter synchronized (_maxActiveMessageLock) // depends on control dependency: [if], data = [none] { _currentActiveMessages -= messages; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "_currentActiveMessages: " + _currentActiveMessages); // See if we've gone below the active limit we therefore need to // resume the consumer (resumeConsumer() checks that the set is also // resumed) if ((_currentActiveMessages == (_maxActiveMessages - messages))) { // Remember to resume the consumer once we've released the maxActiveMessage // lock threasholdCrossed = true; // depends on control dependency: [if], data = [none] } // We should never go negative, if we do something has gone wrong - FFDC if (_currentActiveMessages < 0) { SIErrorException e = new SIErrorException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.impl.JSLocalConsumerPoint.removeActiveMessages", "1:4657:1.22.5.1", Integer.valueOf(_currentActiveMessages) }, null)); FFDCFilter.processException( e, "com.ibm.ws.sib.processor.impl.JSLocalConsumerPoint.removeActiveMessages", "1:4664:1.22.5.1", this); // depends on control dependency: [if], data = [none] SibTr.exception(tc, e); // depends on control dependency: [if], data = [none] SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.impl.JSLocalConsumerPoint.removeActiveMessages", "1:4671:1.22.5.1" }); // depends on control dependency: [if], data = [none] } } // synchronized // The threashold was crossed, first take the LCP lock then the maxActiveMessage // lock again and re-check the current state before resuming the consumer. if (threasholdCrossed) { this.lock(); // depends on control dependency: [if], data = [none] try { synchronized (_maxActiveMessageLock) // depends on control dependency: [try], data = [none] { // Re-check to make sure someone else hasn't got in between the // above release of the maxActiveMessage lock and this point and // added more active messages - suspending us again. // The count could be less than the threashold because someone else // also released a message - in this case we still need to be the // one to resume the consumer as the other release wouldn't have crossed // the threashold and therefore not be in this bit of code. if (_currentActiveMessages < _maxActiveMessages) { resumeConsumer(SUSPEND_FLAG_ACTIVE_MSGS); // depends on control dependency: [if], data = [none] // (F001731) // If we have an alarm registered to warn of long pauses then cancel it now // (this will issue an all-clear message is the pause has already been reported) if (_activeMsgBlockAlarm != null) _activeMsgBlockAlarm.cancelAlarm(); } } } finally { this.unlock(); } } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "removeActiveMessages"); } }
public class class_name { public static boolean isSuperType(Type superType, Type subType) { if (superType instanceof ParameterizedType || superType instanceof Class || superType instanceof GenericArrayType) { Class<?> superClass = erase(superType); Type mappedSubType = getExactSuperType(capture(subType), superClass); if (mappedSubType == null) { return false; } else if (superType instanceof Class<?>) { return true; } else if (mappedSubType instanceof Class<?>) { // TODO treat supertype by being raw type differently ("supertype, but with warnings") return true; // class has no parameters, or it's a raw type } else if (mappedSubType instanceof GenericArrayType) { Type superComponentType = getArrayComponentType(superType); assert superComponentType != null; Type mappedSubComponentType = getArrayComponentType(mappedSubType); assert mappedSubComponentType != null; return isSuperType(superComponentType, mappedSubComponentType); } else { assert mappedSubType instanceof ParameterizedType; ParameterizedType pMappedSubType = (ParameterizedType) mappedSubType; assert pMappedSubType.getRawType() == superClass; ParameterizedType pSuperType = (ParameterizedType)superType; Type[] superTypeArgs = pSuperType.getActualTypeArguments(); Type[] subTypeArgs = pMappedSubType.getActualTypeArguments(); assert superTypeArgs.length == subTypeArgs.length; for (int i = 0; i < superTypeArgs.length; i++) { if (! contains(superTypeArgs[i], subTypeArgs[i])) { return false; } } // params of the class itself match, so if the owner types are supertypes too, it's a supertype. return pSuperType.getOwnerType() == null || isSuperType(pSuperType.getOwnerType(), pMappedSubType.getOwnerType()); } } else if (superType instanceof CaptureType) { if (superType.equals(subType)) return true; for (Type lowerBound : ((CaptureType) superType).getLowerBounds()) { if (isSuperType(lowerBound, subType)) { return true; } } return false; } else if (superType instanceof GenericArrayType) { return isArraySupertype(superType, subType); } else { throw new RuntimeException("not implemented: " + superType.getClass()); } } }
public class class_name { public static boolean isSuperType(Type superType, Type subType) { if (superType instanceof ParameterizedType || superType instanceof Class || superType instanceof GenericArrayType) { Class<?> superClass = erase(superType); Type mappedSubType = getExactSuperType(capture(subType), superClass); if (mappedSubType == null) { return false; // depends on control dependency: [if], data = [none] } else if (superType instanceof Class<?>) { return true; // depends on control dependency: [if], data = [none] } else if (mappedSubType instanceof Class<?>) { // TODO treat supertype by being raw type differently ("supertype, but with warnings") return true; // class has no parameters, or it's a raw type // depends on control dependency: [if], data = [none] } else if (mappedSubType instanceof GenericArrayType) { Type superComponentType = getArrayComponentType(superType); assert superComponentType != null; Type mappedSubComponentType = getArrayComponentType(mappedSubType); assert mappedSubComponentType != null; return isSuperType(superComponentType, mappedSubComponentType); // depends on control dependency: [if], data = [none] } else { assert mappedSubType instanceof ParameterizedType; ParameterizedType pMappedSubType = (ParameterizedType) mappedSubType; assert pMappedSubType.getRawType() == superClass; ParameterizedType pSuperType = (ParameterizedType)superType; Type[] superTypeArgs = pSuperType.getActualTypeArguments(); Type[] subTypeArgs = pMappedSubType.getActualTypeArguments(); assert superTypeArgs.length == subTypeArgs.length; for (int i = 0; i < superTypeArgs.length; i++) { if (! contains(superTypeArgs[i], subTypeArgs[i])) { return false; // depends on control dependency: [if], data = [none] } } // params of the class itself match, so if the owner types are supertypes too, it's a supertype. return pSuperType.getOwnerType() == null || isSuperType(pSuperType.getOwnerType(), pMappedSubType.getOwnerType()); // depends on control dependency: [if], data = [none] } } else if (superType instanceof CaptureType) { if (superType.equals(subType)) return true; for (Type lowerBound : ((CaptureType) superType).getLowerBounds()) { if (isSuperType(lowerBound, subType)) { return true; // depends on control dependency: [if], data = [none] } } return false; // depends on control dependency: [if], data = [none] } else if (superType instanceof GenericArrayType) { return isArraySupertype(superType, subType); // depends on control dependency: [if], data = [none] } else { throw new RuntimeException("not implemented: " + superType.getClass()); } } }
public class class_name { public void marshall(ListBackupPlansRequest listBackupPlansRequest, ProtocolMarshaller protocolMarshaller) { if (listBackupPlansRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(listBackupPlansRequest.getNextToken(), NEXTTOKEN_BINDING); protocolMarshaller.marshall(listBackupPlansRequest.getMaxResults(), MAXRESULTS_BINDING); protocolMarshaller.marshall(listBackupPlansRequest.getIncludeDeleted(), INCLUDEDELETED_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ListBackupPlansRequest listBackupPlansRequest, ProtocolMarshaller protocolMarshaller) { if (listBackupPlansRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(listBackupPlansRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(listBackupPlansRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(listBackupPlansRequest.getIncludeDeleted(), INCLUDEDELETED_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 Person getMother() { if (!isSet()) { return new Person(); } final Person mother = (Person) find(getToString()); if (mother == null) { return new Person(); } else { return mother; } } }
public class class_name { public Person getMother() { if (!isSet()) { return new Person(); // depends on control dependency: [if], data = [none] } final Person mother = (Person) find(getToString()); if (mother == null) { return new Person(); // depends on control dependency: [if], data = [none] } else { return mother; // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public Optional<Cache> getCache(final String name) { try { return Optional.fromNullable(objectMapper.readValue( requestFactory.buildGetRequest(new CacheUrl(hostName, projectId, name)).execute().getContent(), Cache.class)); } catch (final HTTPException e) { if (e.getStatusCode() == 404) { return Optional.absent(); } throw Throwables.propagate(e); } catch (final Exception e) { throw Throwables.propagate(e); } } }
public class class_name { @Override public Optional<Cache> getCache(final String name) { try { return Optional.fromNullable(objectMapper.readValue( requestFactory.buildGetRequest(new CacheUrl(hostName, projectId, name)).execute().getContent(), Cache.class)); // depends on control dependency: [try], data = [none] } catch (final HTTPException e) { if (e.getStatusCode() == 404) { return Optional.absent(); // depends on control dependency: [if], data = [none] } throw Throwables.propagate(e); } catch (final Exception e) { // depends on control dependency: [catch], data = [none] throw Throwables.propagate(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public EClass getIfcRelDefinesByProperties() { if (ifcRelDefinesByPropertiesEClass == null) { ifcRelDefinesByPropertiesEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(549); } return ifcRelDefinesByPropertiesEClass; } }
public class class_name { @Override public EClass getIfcRelDefinesByProperties() { if (ifcRelDefinesByPropertiesEClass == null) { ifcRelDefinesByPropertiesEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(549); // depends on control dependency: [if], data = [none] } return ifcRelDefinesByPropertiesEClass; } }
public class class_name { private static <T extends Enum<T>> T getSystemOption(final String name, T defaultValue, T secureValue) { Class<T> enumType = defaultValue.getDeclaringClass(); String value = null; try { value = AccessController.doPrivileged( new PrivilegedAction<String>() { @Override public String run() { return System.getProperty(name); } }); return (value != null && value.length() > 0) ? Enum.valueOf(enumType, value) : defaultValue; } catch (SecurityException e) { return secureValue; } catch (IllegalArgumentException e) { logger.warning(value + " is not a valid flag value for " + name + ". " + " Values must be one of " + Arrays.asList(enumType.getEnumConstants())); return defaultValue; } } }
public class class_name { private static <T extends Enum<T>> T getSystemOption(final String name, T defaultValue, T secureValue) { Class<T> enumType = defaultValue.getDeclaringClass(); String value = null; try { value = AccessController.doPrivileged( new PrivilegedAction<String>() { @Override public String run() { return System.getProperty(name); } }); // depends on control dependency: [try], data = [none] return (value != null && value.length() > 0) ? Enum.valueOf(enumType, value) : defaultValue; // depends on control dependency: [try], data = [none] } catch (SecurityException e) { return secureValue; } catch (IllegalArgumentException e) { // depends on control dependency: [catch], data = [none] logger.warning(value + " is not a valid flag value for " + name + ". " + " Values must be one of " + Arrays.asList(enumType.getEnumConstants())); return defaultValue; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public Object saveState(FacesContext context) { if (context == null) { throw new NullPointerException(); } if (!initialStateMarked()) { Object values[] = new Object[1]; values[0] = validationGroups; return values; } return null; } }
public class class_name { public Object saveState(FacesContext context) { if (context == null) { throw new NullPointerException(); } if (!initialStateMarked()) { Object values[] = new Object[1]; values[0] = validationGroups; // depends on control dependency: [if], data = [none] return values; // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { void doTransform(String text) { try { final StringReader reader = new StringReader(text); final NetcdfDataset ncd = NcMLReader.readNcML(reader, null); final StringWriter sw = new StringWriter(10000); ncd.writeNcML(sw, null); editor.setText(sw.toString()); editor.setCaretPosition(0); JOptionPane.showMessageDialog(this, "File successfully transformed"); } catch (IOException ioe) { JOptionPane.showMessageDialog(this, "ERROR: " + ioe.getMessage()); ioe.printStackTrace(); } } }
public class class_name { void doTransform(String text) { try { final StringReader reader = new StringReader(text); final NetcdfDataset ncd = NcMLReader.readNcML(reader, null); final StringWriter sw = new StringWriter(10000); ncd.writeNcML(sw, null); // depends on control dependency: [try], data = [none] editor.setText(sw.toString()); // depends on control dependency: [try], data = [none] editor.setCaretPosition(0); // depends on control dependency: [try], data = [none] JOptionPane.showMessageDialog(this, "File successfully transformed"); // depends on control dependency: [try], data = [none] } catch (IOException ioe) { JOptionPane.showMessageDialog(this, "ERROR: " + ioe.getMessage()); ioe.printStackTrace(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public final void ruleXEqualityExpression() throws RecognitionException { int stackSize = keepStackSize(); try { // InternalXbase.g:271:2: ( ( ( rule__XEqualityExpression__Group__0 ) ) ) // InternalXbase.g:272:2: ( ( rule__XEqualityExpression__Group__0 ) ) { // InternalXbase.g:272:2: ( ( rule__XEqualityExpression__Group__0 ) ) // InternalXbase.g:273:3: ( rule__XEqualityExpression__Group__0 ) { if ( state.backtracking==0 ) { before(grammarAccess.getXEqualityExpressionAccess().getGroup()); } // InternalXbase.g:274:3: ( rule__XEqualityExpression__Group__0 ) // InternalXbase.g:274:4: rule__XEqualityExpression__Group__0 { pushFollow(FOLLOW_2); rule__XEqualityExpression__Group__0(); state._fsp--; if (state.failed) return ; } if ( state.backtracking==0 ) { after(grammarAccess.getXEqualityExpressionAccess().getGroup()); } } } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { restoreStackSize(stackSize); } return ; } }
public class class_name { public final void ruleXEqualityExpression() throws RecognitionException { int stackSize = keepStackSize(); try { // InternalXbase.g:271:2: ( ( ( rule__XEqualityExpression__Group__0 ) ) ) // InternalXbase.g:272:2: ( ( rule__XEqualityExpression__Group__0 ) ) { // InternalXbase.g:272:2: ( ( rule__XEqualityExpression__Group__0 ) ) // InternalXbase.g:273:3: ( rule__XEqualityExpression__Group__0 ) { if ( state.backtracking==0 ) { before(grammarAccess.getXEqualityExpressionAccess().getGroup()); // depends on control dependency: [if], data = [none] } // InternalXbase.g:274:3: ( rule__XEqualityExpression__Group__0 ) // InternalXbase.g:274:4: rule__XEqualityExpression__Group__0 { pushFollow(FOLLOW_2); rule__XEqualityExpression__Group__0(); state._fsp--; if (state.failed) return ; } if ( state.backtracking==0 ) { after(grammarAccess.getXEqualityExpressionAccess().getGroup()); // depends on control dependency: [if], data = [none] } } } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { restoreStackSize(stackSize); } return ; } }
public class class_name { public static Iterable<String> getParameterNames (HttpServletRequest req) { List<String> params = new ArrayList<String>(); Enumeration<?> iter = req.getParameterNames(); while (iter.hasMoreElements()) { params.add((String)iter.nextElement()); } return params; } }
public class class_name { public static Iterable<String> getParameterNames (HttpServletRequest req) { List<String> params = new ArrayList<String>(); Enumeration<?> iter = req.getParameterNames(); while (iter.hasMoreElements()) { params.add((String)iter.nextElement()); // depends on control dependency: [while], data = [none] } return params; } }
public class class_name { List<Language> getLanguages() throws IllegalAccessException, InstantiationException { List<Language> languages = new ArrayList<>(); for (File ruleFile : ruleFiles) { if (ruleFile != null) { Language newLanguage = LanguageBuilder.makeAdditionalLanguage(ruleFile); languages.add(newLanguage); } } return languages; } }
public class class_name { List<Language> getLanguages() throws IllegalAccessException, InstantiationException { List<Language> languages = new ArrayList<>(); for (File ruleFile : ruleFiles) { if (ruleFile != null) { Language newLanguage = LanguageBuilder.makeAdditionalLanguage(ruleFile); languages.add(newLanguage); // depends on control dependency: [if], data = [none] } } return languages; } }
public class class_name { protected void failAttempt(RaftMemberContext member, RaftRequest request, Throwable error) { // If any append error occurred, increment the failure count for the member. Log the first three failures, // and thereafter log 1% of the failures. This keeps the log from filling up with annoying error messages // when attempting to send entries to down followers. int failures = member.incrementFailureCount(); if (failures <= 3 || failures % 100 == 0) { log.debug("{} to {} failed: {}", request, member.getMember().memberId(), error.getMessage()); } } }
public class class_name { protected void failAttempt(RaftMemberContext member, RaftRequest request, Throwable error) { // If any append error occurred, increment the failure count for the member. Log the first three failures, // and thereafter log 1% of the failures. This keeps the log from filling up with annoying error messages // when attempting to send entries to down followers. int failures = member.incrementFailureCount(); if (failures <= 3 || failures % 100 == 0) { log.debug("{} to {} failed: {}", request, member.getMember().memberId(), error.getMessage()); // depends on control dependency: [if], data = [none] } } }
public class class_name { public Boolean validate(String token, JwtUserDetail userDetails) { if (StringUtils.isBlank(token) || userDetails == null) { return false; } String key = jwtProperties.getPrefix() + Md5Utils.digestMD5(token); JwtToken jwtToken = cacheService.get(key); // 判断是否在黑名单中 if (jwtToken != null) { //销毁状态 if (JwtToken.Operation.destroy.getValue() == jwtToken.getType()) { return false; } Long refreshTime = jwtToken.getRefreshTime(); if (refreshTime != null && jwtToken.getType() == JwtToken.Operation.refresh.getValue()) { // 刷新token二分钟内可以使用 return Instant.now().toEpochMilli() - refreshTime < 1000 * 60 * 2; } } final Instant created = jwtBuilder.getCreatedTimeFromToken(token); final String loginName = jwtBuilder.getLoginNameFromToken(token); LocalDateTime modifyPasswordTime = userDetails.getModifyPasswordTime(); if (Objects.isNull(modifyPasswordTime)) { return Objects.equals(loginName, userDetails.getUsername()) && !jwtBuilder.isExpired(token); } return Objects.equals(loginName, userDetails.getUsername()) && !jwtBuilder.isExpired(token) && validate(created, modifyPasswordTime); } }
public class class_name { public Boolean validate(String token, JwtUserDetail userDetails) { if (StringUtils.isBlank(token) || userDetails == null) { return false; // depends on control dependency: [if], data = [none] } String key = jwtProperties.getPrefix() + Md5Utils.digestMD5(token); JwtToken jwtToken = cacheService.get(key); // 判断是否在黑名单中 if (jwtToken != null) { //销毁状态 if (JwtToken.Operation.destroy.getValue() == jwtToken.getType()) { return false; // depends on control dependency: [if], data = [none] } Long refreshTime = jwtToken.getRefreshTime(); if (refreshTime != null && jwtToken.getType() == JwtToken.Operation.refresh.getValue()) { // 刷新token二分钟内可以使用 return Instant.now().toEpochMilli() - refreshTime < 1000 * 60 * 2; // depends on control dependency: [if], data = [none] } } final Instant created = jwtBuilder.getCreatedTimeFromToken(token); final String loginName = jwtBuilder.getLoginNameFromToken(token); LocalDateTime modifyPasswordTime = userDetails.getModifyPasswordTime(); if (Objects.isNull(modifyPasswordTime)) { return Objects.equals(loginName, userDetails.getUsername()) && !jwtBuilder.isExpired(token); // depends on control dependency: [if], data = [none] } return Objects.equals(loginName, userDetails.getUsername()) && !jwtBuilder.isExpired(token) && validate(created, modifyPasswordTime); } }
public class class_name { private Formatter createFormatter(Method method, Class<?>[] sig, int prio) { if (method.getReturnType() != Component.class) { throw new InvalidFormatMethodException(getClass(), method, "Format methods must return Component!"); } final Invoker invoker; if (sig.length == 1) { invoker = new InputOnly(); } else if (sig.length == 2) { if (sig[1] == Context.class) { invoker = new ContextOnly(); } else if (sig[1] == Arguments.class) { invoker = new ArgsOnly(); } else { throw new InvalidFormatMethodException(getClass(), method, "Format methods may only take Context and Arguments parameters!"); } } else if (sig.length == 3) { if (sig[1] == Context.class && sig[2] == Arguments.class) { invoker = new CompleteContextFirst(); } else if (sig[1] == Arguments.class && sig[2] == Context.class) { invoker = new CompleteArgsFirst(); } else { throw new InvalidFormatMethodException(getClass(), method, "Format methods may only take Context and Arguments parameters!"); } } else { throw new InvalidFormatMethodException(getClass(), method, "Format methods must take at most 3 parameters!"); } return new Formatter(this, method, prio, invoker); } }
public class class_name { private Formatter createFormatter(Method method, Class<?>[] sig, int prio) { if (method.getReturnType() != Component.class) { throw new InvalidFormatMethodException(getClass(), method, "Format methods must return Component!"); } final Invoker invoker; if (sig.length == 1) { invoker = new InputOnly(); // depends on control dependency: [if], data = [none] } else if (sig.length == 2) { if (sig[1] == Context.class) { invoker = new ContextOnly(); // depends on control dependency: [if], data = [none] } else if (sig[1] == Arguments.class) { invoker = new ArgsOnly(); // depends on control dependency: [if], data = [none] } else { throw new InvalidFormatMethodException(getClass(), method, "Format methods may only take Context and Arguments parameters!"); } } else if (sig.length == 3) { if (sig[1] == Context.class && sig[2] == Arguments.class) { invoker = new CompleteContextFirst(); // depends on control dependency: [if], data = [none] } else if (sig[1] == Arguments.class && sig[2] == Context.class) { invoker = new CompleteArgsFirst(); // depends on control dependency: [if], data = [none] } else { throw new InvalidFormatMethodException(getClass(), method, "Format methods may only take Context and Arguments parameters!"); } } else { throw new InvalidFormatMethodException(getClass(), method, "Format methods must take at most 3 parameters!"); } return new Formatter(this, method, prio, invoker); } }
public class class_name { public final VEvent getOccurrence(final Date date) throws IOException, URISyntaxException, ParseException { final PeriodList consumedTime = getConsumedTime(date, date); for (final Period p : consumedTime) { if (p.getStart().equals(date)) { final VEvent occurrence = (VEvent) this.copy(); occurrence.getProperties().add(new RecurrenceId(date)); return occurrence; } } return null; } }
public class class_name { public final VEvent getOccurrence(final Date date) throws IOException, URISyntaxException, ParseException { final PeriodList consumedTime = getConsumedTime(date, date); for (final Period p : consumedTime) { if (p.getStart().equals(date)) { final VEvent occurrence = (VEvent) this.copy(); occurrence.getProperties().add(new RecurrenceId(date)); // depends on control dependency: [if], data = [none] return occurrence; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { @Override public EClass getIfcBendingParameterSelect() { if (ifcBendingParameterSelectEClass == null) { ifcBendingParameterSelectEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(1118); } return ifcBendingParameterSelectEClass; } }
public class class_name { @Override public EClass getIfcBendingParameterSelect() { if (ifcBendingParameterSelectEClass == null) { ifcBendingParameterSelectEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(1118); // depends on control dependency: [if], data = [none] } return ifcBendingParameterSelectEClass; } }
public class class_name { public void marshall(DescribeJobFlowsRequest describeJobFlowsRequest, ProtocolMarshaller protocolMarshaller) { if (describeJobFlowsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(describeJobFlowsRequest.getCreatedAfter(), CREATEDAFTER_BINDING); protocolMarshaller.marshall(describeJobFlowsRequest.getCreatedBefore(), CREATEDBEFORE_BINDING); protocolMarshaller.marshall(describeJobFlowsRequest.getJobFlowIds(), JOBFLOWIDS_BINDING); protocolMarshaller.marshall(describeJobFlowsRequest.getJobFlowStates(), JOBFLOWSTATES_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DescribeJobFlowsRequest describeJobFlowsRequest, ProtocolMarshaller protocolMarshaller) { if (describeJobFlowsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(describeJobFlowsRequest.getCreatedAfter(), CREATEDAFTER_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(describeJobFlowsRequest.getCreatedBefore(), CREATEDBEFORE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(describeJobFlowsRequest.getJobFlowIds(), JOBFLOWIDS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(describeJobFlowsRequest.getJobFlowStates(), JOBFLOWSTATES_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 { @Override public void encodeBegin(FacesContext context, UIComponent component) throws IOException { if (!component.isRendered()) { return; } RemoteCommand remoteCommand = (RemoteCommand) component; ResponseWriter rw = context.getResponseWriter(); String clientId = remoteCommand.getClientId(); String parameters=remoteCommand.getParameters(); String parametersAsJson=null; if (null != parameters && parameters.length()>0) { parametersAsJson = ""; String[] params = parameters.split(","); for (String p: params) { p=p.trim(); parametersAsJson += "'" + p + "':" + p + ","; } parametersAsJson=parametersAsJson.substring(0, parametersAsJson.length()-1); } StringBuilder call = AJAXRenderer.generateAJAXCall(context, remoteCommand, null, parametersAsJson); String name = remoteCommand.getName(); if (null == name) { throw new FacesException("b:remoteCommand: Please define the name of the JavaScript function calling the Java backend."); } rw.startElement("script", component); rw.writeAttribute("id", clientId, null); String c = call.toString().replace("callAjax(this,", "callAjax(document.getElementById('" + clientId + "'),"); if (parameters!=null) { rw.append("function " + name + "(" + parameters + ", event){" + c + "}"); } else { rw.append("function " + name + "(event){" + c + "}"); } rw.endElement("script"); } }
public class class_name { @Override public void encodeBegin(FacesContext context, UIComponent component) throws IOException { if (!component.isRendered()) { return; } RemoteCommand remoteCommand = (RemoteCommand) component; ResponseWriter rw = context.getResponseWriter(); String clientId = remoteCommand.getClientId(); String parameters=remoteCommand.getParameters(); String parametersAsJson=null; if (null != parameters && parameters.length()>0) { parametersAsJson = ""; String[] params = parameters.split(","); for (String p: params) { p=p.trim(); // depends on control dependency: [for], data = [p] parametersAsJson += "'" + p + "':" + p + ","; // depends on control dependency: [for], data = [p] } parametersAsJson=parametersAsJson.substring(0, parametersAsJson.length()-1); } StringBuilder call = AJAXRenderer.generateAJAXCall(context, remoteCommand, null, parametersAsJson); String name = remoteCommand.getName(); if (null == name) { throw new FacesException("b:remoteCommand: Please define the name of the JavaScript function calling the Java backend."); } rw.startElement("script", component); rw.writeAttribute("id", clientId, null); String c = call.toString().replace("callAjax(this,", "callAjax(document.getElementById('" + clientId + "'),"); if (parameters!=null) { rw.append("function " + name + "(" + parameters + ", event){" + c + "}"); } else { rw.append("function " + name + "(event){" + c + "}"); } rw.endElement("script"); } }
public class class_name { public final void merge(final Properties properties) { for (Map.Entry<Object, Object> entry : properties.entrySet()) { setProperty(entry.getKey().toString(), entry.getValue().toString()); } } }
public class class_name { public final void merge(final Properties properties) { for (Map.Entry<Object, Object> entry : properties.entrySet()) { setProperty(entry.getKey().toString(), entry.getValue().toString()); // depends on control dependency: [for], data = [entry] } } }
public class class_name { public void setForegroundPaint(final Paint PAINT) { if (null == foregroundPaint) { _foregroundPaint = PAINT; fireUpdateEvent(REDRAW_EVENT); } else { foregroundPaint.set(PAINT); } } }
public class class_name { public void setForegroundPaint(final Paint PAINT) { if (null == foregroundPaint) { _foregroundPaint = PAINT; // depends on control dependency: [if], data = [none] fireUpdateEvent(REDRAW_EVENT); // depends on control dependency: [if], data = [none] } else { foregroundPaint.set(PAINT); // depends on control dependency: [if], data = [none] } } }
public class class_name { public GetAggregateDiscoveredResourceCountsResult withGroupedResourceCounts(GroupedResourceCount... groupedResourceCounts) { if (this.groupedResourceCounts == null) { setGroupedResourceCounts(new com.amazonaws.internal.SdkInternalList<GroupedResourceCount>(groupedResourceCounts.length)); } for (GroupedResourceCount ele : groupedResourceCounts) { this.groupedResourceCounts.add(ele); } return this; } }
public class class_name { public GetAggregateDiscoveredResourceCountsResult withGroupedResourceCounts(GroupedResourceCount... groupedResourceCounts) { if (this.groupedResourceCounts == null) { setGroupedResourceCounts(new com.amazonaws.internal.SdkInternalList<GroupedResourceCount>(groupedResourceCounts.length)); // depends on control dependency: [if], data = [none] } for (GroupedResourceCount ele : groupedResourceCounts) { this.groupedResourceCounts.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public void removeTarget(final ImageConsumer consumer) { if (imagesManager.debug) { Log.d(TAG, "Cancel request: " + request.getKey() + "\nLoader: " + this); } consumer.onCancel(request.url); synchronized (targets) { targets.remove(consumer); if (targets.isEmpty()) { if (!future.cancel(true)) { if (imagesManager.debug) { Log.d(TAG, "Can't cancel task so let's try to remove loader manually"); } imagesManager.currentLoads.remove(request.getKey(), this); } } } } }
public class class_name { public void removeTarget(final ImageConsumer consumer) { if (imagesManager.debug) { Log.d(TAG, "Cancel request: " + request.getKey() + "\nLoader: " + this); } // depends on control dependency: [if], data = [none] consumer.onCancel(request.url); synchronized (targets) { targets.remove(consumer); if (targets.isEmpty()) { if (!future.cancel(true)) { if (imagesManager.debug) { Log.d(TAG, "Can't cancel task so let's try to remove loader manually"); } // depends on control dependency: [if], data = [none] imagesManager.currentLoads.remove(request.getKey(), this); // depends on control dependency: [if], data = [none] } } } } }