auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public <T> DefaultSerializationProviderConfiguration addSerializerFor(Class<T> serializableClass, Class<? extends Serializer<T>> serializerClass) { if (serializableClass == null) { throw new NullPointerException("Serializable class cannot be null"); } if (serializerClass == null) { throw new NullPointerException("Serializer class cannot be null"); } String alias = serializableClass.getName(); Constructor<? extends Serializer<T>> transientConstructor = null; Constructor<? extends Serializer<T>> persistentConstructor = null; try { transientConstructor = serializerClass.getConstructor(ClassLoader.class); if (transientSerializers.containsKey(alias)) { throw new IllegalArgumentException("Duplicate transient serializer for class : " + alias); } else { transientSerializers.put(alias, serializerClass); } } catch (NoSuchMethodException e) { } try { persistentConstructor = serializerClass.getConstructor(ClassLoader.class, FileBasedPersistenceContext.class); if (persistentSerializers.containsKey(alias)) { throw new IllegalArgumentException("Duplicate persistent serializer for class : " + alias); } else { persistentSerializers.put(alias, serializerClass); } } catch (NoSuchMethodException e) { } if(transientConstructor == null && persistentConstructor == null) { throw new IllegalArgumentException("The serializer: " + serializerClass.getName() + " does not meet the constructor requirements for either transient or persistent caches."); } return this; }

Target:
public <T> DefaultSerializationProviderConfiguration addSerializerFor(Class<T> serializableClass, Class<? extends Serializer<T>> serializerClass) { if (serializableClass == null) { throw new NullPointerException("Serializable class cannot be null"); } if (serializerClass == null) { throw new NullPointerException("Serializer class cannot be null"); } String alias = serializableClass.getName(); boolean transientConstructorPresent = false; boolean persistentConstructorPresent = false; if(transientConstructorPresent = isConstructorPresent(serializerClass, ClassLoader.class)) { if (transientSerializers.containsKey(alias)) { throw new IllegalArgumentException("Duplicate transient serializer for class : " + alias); } else { transientSerializers.put(alias, serializerClass); } } if(persistentConstructorPresent = isConstructorPresent(serializerClass, ClassLoader.class, FileBasedPersistenceContext.class)) { if (persistentSerializers.containsKey(alias)) { throw new IllegalArgumentException("Duplicate persistent serializer for class : " + alias); } else { persistentSerializers.put(alias, serializerClass); } } if(!transientConstructorPresent && !persistentConstructorPresent) { throw new IllegalArgumentException("The serializer: " + serializerClass.getName() + " does not meet the constructor requirements for either transient or persistent caches."); } return this; }
Source:
private Builder(Cursor cursor) throws Exception { mId = cursor.getInt(cursor.getColumnIndex(JobStorage.COLUMN_ID)); mJobClass = (Class<? extends Job>) Class.forName(cursor.getString(cursor.getColumnIndex(JobStorage.COLUMN_JOB_CLASS))); mStartMs = cursor.getLong(cursor.getColumnIndex(JobStorage.COLUMN_START_MS)); mEndMs = cursor.getLong(cursor.getColumnIndex(JobStorage.COLUMN_END_MS)); mBackoffMs = cursor.getLong(cursor.getColumnIndex(JobStorage.COLUMN_BACKOFF_MS)); mBackoffPolicy = BackoffPolicy.valueOf(cursor.getString(cursor.getColumnIndex(JobStorage.COLUMN_BACKOFF_POLICY))); mIntervalMs = cursor.getLong(cursor.getColumnIndex(JobStorage.COLUMN_INTERVAL_MS)); mRequirementsEnforced = cursor.getInt(cursor.getColumnIndex(JobStorage.COLUMN_REQUIREMENTS_ENFORCED)) > 0; mRequiresCharging = cursor.getInt(cursor.getColumnIndex(JobStorage.COLUMN_REQUIRES_CHARGING)) > 0; mRequiresDeviceIdle = cursor.getInt(cursor.getColumnIndex(JobStorage.COLUMN_REQUIRES_DEVICE_IDLE)) > 0; mExact = cursor.getInt(cursor.getColumnIndex(JobStorage.COLUMN_EXACT)) > 0; mNetworkType = NetworkType.valueOf(cursor.getString(cursor.getColumnIndex(JobStorage.COLUMN_NETWORK_TYPE))); String xml = cursor.getString(cursor.getColumnIndex(JobStorage.COLUMN_EXTRAS)); if (!TextUtils.isEmpty(xml)) { mExtras = PersistableBundleCompat.fromXml(xml); } mPersisted = cursor.getInt(cursor.getColumnIndex(JobStorage.COLUMN_PERSISTED)) > 0; mTag = cursor.getString(cursor.getColumnIndex(JobStorage.COLUMN_TAG)); }

Target:
private Builder(Cursor cursor) throws Exception { mId = cursor.getInt(cursor.getColumnIndex(JobStorage.COLUMN_ID)); mJobClass = (Class<? extends Job>) Class.forName(cursor.getString(cursor.getColumnIndex(JobStorage.COLUMN_JOB_CLASS))); mStartMs = cursor.getLong(cursor.getColumnIndex(JobStorage.COLUMN_START_MS)); mEndMs = cursor.getLong(cursor.getColumnIndex(JobStorage.COLUMN_END_MS)); mBackoffMs = cursor.getLong(cursor.getColumnIndex(JobStorage.COLUMN_BACKOFF_MS)); mBackoffPolicy = BackoffPolicy.valueOf(cursor.getString(cursor.getColumnIndex(JobStorage.COLUMN_BACKOFF_POLICY))); mIntervalMs = cursor.getLong(cursor.getColumnIndex(JobStorage.COLUMN_INTERVAL_MS)); mRequirementsEnforced = cursor.getInt(cursor.getColumnIndex(JobStorage.COLUMN_REQUIREMENTS_ENFORCED)) > 0; mRequiresCharging = cursor.getInt(cursor.getColumnIndex(JobStorage.COLUMN_REQUIRES_CHARGING)) > 0; mRequiresDeviceIdle = cursor.getInt(cursor.getColumnIndex(JobStorage.COLUMN_REQUIRES_DEVICE_IDLE)) > 0; mExact = cursor.getInt(cursor.getColumnIndex(JobStorage.COLUMN_EXACT)) > 0; mNetworkType = NetworkType.valueOf(cursor.getString(cursor.getColumnIndex(JobStorage.COLUMN_NETWORK_TYPE))); mExtrasXml = cursor.getString(cursor.getColumnIndex(JobStorage.COLUMN_EXTRAS)); mPersisted = cursor.getInt(cursor.getColumnIndex(JobStorage.COLUMN_PERSISTED)) > 0; mTag = cursor.getString(cursor.getColumnIndex(JobStorage.COLUMN_TAG)); }
Source:
private <R> GridClientFutureAdapter<R> makeAuthRequest() throws GridClientConnectionResetException { TcpClientFuture<R> fut = new TcpClientFuture<>(); fut.retryState(TcpClientFuture.STATE_REQUEST_RETRY); GridClientAuthenticationRequest req = buildAuthRequest(); pendingReqs.putIfAbsent(req.requestId(), fut); GridNioFuture<?> sndFut = ses.send(req); try { sndFut.get(); } catch (Exception e) { throw new GridClientConnectionResetException("Failed to send message over connection " + "(will try to reconnect): " + serverAddress(), e); } return fut; }

Target:
private <R> GridClientFutureAdapter<R> makeAuthRequest() throws GridClientConnectionResetException, GridClientClosedException { TcpClientFuture<R> fut = new TcpClientFuture<>(); fut.retryState(TcpClientFuture.STATE_REQUEST_RETRY); GridClientAuthenticationRequest req = buildAuthRequest(); return makeRequest(req, fut, false); }
Source:
protected void finalize() throws Throwable { if( isOpen ) { System.err.println( "WARNING: Neo4j Session object leaked, please ensure that your application calls the `close` method on Sessions before disposing of the objects." ); if( currentTransaction != null ) { connection.forceClose(); } else { connection.close(); } } }

Target:
protected void finalize() throws Throwable { if( isOpen ) { logger.error( "Neo4j Session object leaked, please ensure that your application calls the `close` " + "method on Sessions before disposing of the objects.", null ); connection.close(); } }
Source:
protected boolean matchesSafely(Column item) { if (!qualifier.matches(item.getQualifier())) return false; if (item.getCellsCount() != cells.size()) return false; for (int i = 0; i < cells.size(); ++i) { if (!cells.get(i).matches(item.getCells(i))) { return false; } } return true; }

Target:
protected boolean matchesSafely(Column item) { if (!qualifier.matches(item.getQualifier())) { return false; } if (item.getCellsCount() != cells.size()) { return false; } for (int i = 0; i < cells.size(); ++i) { if (!cells.get(i).matches(item.getCells(i))) { return false; } } return true; }
Source:
protected <R> EurekaHttpResponse<R> execute(RequestExecutor<R> requestExecutor) { List<EurekaEndpoint> candidateHosts = null; int endpointIdx = 0; for (int retry = 0; retry < numberOfRetries; retry++) { EurekaHttpClient currentHttpClient = delegate.get(); EurekaEndpoint currentEndpoint = null; if (currentHttpClient == null) { if (candidateHosts == null) { candidateHosts = getHostCandidates(); if (candidateHosts.isEmpty()) { throw new TransportException("There is no known eureka server; cluster server list is empty"); } } if (endpointIdx >= candidateHosts.size()) { throw new TransportException("Cannot execute request on any known server"); } currentEndpoint = candidateHosts.get(endpointIdx++); currentHttpClient = clientFactory.newClient(currentEndpoint); } try { EurekaHttpResponse<R> response = requestExecutor.execute(currentHttpClient); if (serverStatusEvaluator.accept(response.getStatusCode(), requestExecutor.getRequestType())) { delegate.set(currentHttpClient); if (retry > 0) { logger.info("Request execution succeeded on retry #{}", retry); } return response; } logger.warn("Request execution failure with status code {}; retrying on another server if available", response.getStatusCode()); } catch (Exception e) { logger.warn("Request execution failured with message: {}", e.getMessage()); } delegate.compareAndSet(currentHttpClient, null); if (currentEndpoint != null) { quarantineSet.add(currentEndpoint); } } throw new TransportException("Retry limit reached; giving up on completing the request"); }

Target:
protected <R> EurekaHttpResponse<R> execute(RequestExecutor<R> requestExecutor) { List<EurekaEndpoint> candidateHosts = null; int endpointIdx = 0; for (int retry = 0; retry < numberOfRetries; retry++) { EurekaHttpClient currentHttpClient = delegate.get(); EurekaEndpoint currentEndpoint = null; if (currentHttpClient == null) { if (candidateHosts == null) { candidateHosts = getHostCandidates(); if (candidateHosts.isEmpty()) { throw new TransportException("There is no known eureka server; cluster server list is empty"); } } if (endpointIdx >= candidateHosts.size()) { throw new TransportException("Cannot execute request on any known server"); } currentEndpoint = candidateHosts.get(endpointIdx++); currentHttpClient = clientFactory.newClient(currentEndpoint); } try { EurekaHttpResponse<R> response = requestExecutor.execute(currentHttpClient); if (serverStatusEvaluator.accept(response.getStatusCode(), requestExecutor.getRequestType())) { delegate.set(currentHttpClient); if (retry > 0) { logger.info("Request execution succeeded on retry #{}", retry); } return response; } logger.warn("Request execution failure with status code {}; retrying on another server if available", response.getStatusCode()); } catch (Exception e) { logger.warn("Request execution failed with message: {}", e.getMessage()); } delegate.compareAndSet(currentHttpClient, null); if (currentEndpoint != null) { quarantineSet.add(currentEndpoint); } } throw new TransportException("Retry limit reached; giving up on completing the request"); }
Source:
public void shouldNotParseUUID() throws Exception { SurefireMasterProcessChannelProcessorFactory factory = new SurefireMasterProcessChannelProcessorFactory(); UUID uuid = UUID.randomUUID(); URI uri = new URI( "tcp://127.0.0.1:12345?xxx=" + uuid ); UUID parsed = invokeMethod( factory, "parseAuth", uri ); assertThat( parsed ) .isNull(); }

Target:
public void shouldNotParseUUID() throws Exception { UUID uuid = UUID.randomUUID(); URI uri = new URI( "tcp://localhost:12345?xxx=" + uuid ); String parsed = invokeMethod( SurefireMasterProcessChannelProcessorFactory.class, "extractSessionId", uri ); assertThat( parsed ) .isNull(); }
Source:
public void connect() throws Exception { super.connect(); if (vdsClient != null) { String hostfp = getHostFingerprint(); if (!vdsClient.getSSHKeyFingerprint().equals(hostfp)) { throw new GeneralSecurityException("Invalid fingerprint got " + vdsClient.getSSHKeyFingerprint() + " exected " + hostfp); } } }

Target:
public void connect() throws Exception { super.connect(); if (_vds != null) { String actual = getHostFingerprint(); String expected = _vds.getSSHKeyFingerprint(); if (!actual.equals(expected)) { throw new GeneralSecurityException( String.format( "Invalid fingerprint %s, expected %s", actual, expected ) ); } } }
Source:
public boolean checkMessages(String deletingMessageID, String queueName) { boolean isSuccessful = true; if (isElementPresent(UIElementMapper.getInstance() .getElement("mb.dlc.browse.content.table"))) { WebElement queueTable = driver.findElement(By.xpath(UIElementMapper.getInstance(). getElement("mb.dlc.browse.content.table"))); List<WebElement> rowElementList = queueTable.findElements(By.tagName("tr")); for (WebElement row : rowElementList) { List<WebElement> columnList = row.findElements(By.tagName("td")); if ((columnList.size() == COLUMN_LIST_SIZE) && columnList.get(MESSAGE_ID_COLUMN) .getText().equals(deletingMessageID)) { isSuccessful = false; break; } } } else { Assert.fail("No messages in Queue" + queueName + "after deleting"); } return isSuccessful; }

Target:
private boolean checkMessages(String deletingMessageID, String queueName) { boolean isSuccessful = true; if (isElementPresent(UIElementMapper.getInstance() .getElement("mb.dlc.browse.content.table"))) { WebElement queueTable = driver.findElement(By.xpath(UIElementMapper.getInstance(). getElement("mb.dlc.browse.content.table"))); List<WebElement> rowElementList = queueTable.findElements(By.tagName("tr")); for (WebElement row : rowElementList) { List<WebElement> columnList = row.findElements(By.tagName("td")); if ((COLUMN_LIST_SIZE == columnList.size()) && columnList.get(MESSAGE_ID_COLUMN) .getText().equals(deletingMessageID)) { isSuccessful = false; break; } } } else { Assert.fail("No messages in Queue" + queueName + "after deleting"); } return isSuccessful; }
Source:
public AsyncRabbitTemplate(ConnectionFactory connectionFactory, String exchange, String routingKey, String replyQueue, String replyAddress) { Assert.notNull(connectionFactory, "'connectionFactory' cannot be null"); Assert.notNull(routingKey, "'routingKey' cannot be null"); Assert.notNull(replyQueue, "'replyQueue' cannot be null"); this.template = new RabbitTemplate(connectionFactory); this.template.setExchange(exchange == null ? "" : exchange); this.template.setRoutingKey(routingKey); this.container = new SimpleMessageListenerContainer(connectionFactory); Collection<MessagePostProcessor> afterReceivePostProcessors = this.template.getAfterReceivePostProcessors(); if (afterReceivePostProcessors != null) { this.container.setAfterReceivePostProcessors( afterReceivePostProcessors.toArray(new MessagePostProcessor[0])); } this.container.setQueueNames(replyQueue); this.container.setMessageListener(this); this.container.afterPropertiesSet(); this.directReplyToContainer = null; if (replyAddress == null) { this.replyAddress = replyQueue; } else { this.replyAddress = replyAddress; } }

Target:
public AsyncRabbitTemplate(ConnectionFactory connectionFactory, String exchange, String routingKey, String replyQueue, String replyAddress) { Assert.notNull(connectionFactory, "'connectionFactory' cannot be null"); Assert.notNull(routingKey, "'routingKey' cannot be null"); Assert.notNull(replyQueue, "'replyQueue' cannot be null"); this.template = new RabbitTemplate(connectionFactory); this.template.setExchange(exchange == null ? "" : exchange); this.template.setRoutingKey(routingKey); this.container = new SimpleMessageListenerContainer(connectionFactory); JavaUtils.INSTANCE .acceptIfNotNull(this.template.getAfterReceivePostProcessors(), (value) -> this.container.setAfterReceivePostProcessors( value.toArray(new MessagePostProcessor[0]))); this.container.setQueueNames(replyQueue); this.container.setMessageListener(this); this.container.afterPropertiesSet(); this.directReplyToContainer = null; if (replyAddress == null) { this.replyAddress = replyQueue; } else { this.replyAddress = replyAddress; } }
Source:
public static Charset parseEncoding(final byte[] b) { final int enc = encoding(b, 0); if (enc < 0) return Constants.CHARSET; final int lf = nextLF(b, enc); String decoded = decode(Constants.CHARSET, b, enc, lf - 1); try { return Charset.forName(decoded); } catch (IllegalCharsetNameException badName) { Charset aliased = encodingAliases.get(StringUtils .toLowerCase(decoded)); if (aliased != null) return aliased; throw badName; } catch (UnsupportedCharsetException badName) { Charset aliased = encodingAliases.get(StringUtils .toLowerCase(decoded)); if (aliased != null) return aliased; throw badName; } }

Target:
public static Charset parseEncoding(final byte[] b) { final int enc = encoding(b, 0); if (enc < 0) return Constants.CHARSET; final int lf = nextLF(b, enc); String decoded = decode(Constants.CHARSET, b, enc, lf - 1); try { return Charset.forName(decoded); } catch (IllegalCharsetNameException badName) { Charset aliased = charsetForAlias(decoded); if (aliased != null) return aliased; throw badName; } catch (UnsupportedCharsetException badName) { Charset aliased = charsetForAlias(decoded); if (aliased != null) return aliased; throw badName; } }
Source:
public MultiSourceTrackingToken createHeadToken() { Map<String, TrackingToken> tokenMap = new HashMap<>(); eventStreams.forEach((k, v) -> tokenMap.put(k, v.createHeadToken())); return new MultiSourceTrackingToken(tokenMap); }

Target:
public MultiSourceTrackingToken createHeadToken() { Map<String, TrackingToken> tokenMap = new HashMap<>(); eventStreams.forEach(streamableMessageSource -> tokenMap.put(streamableMessageSource.sourceId(), streamableMessageSource.createHeadToken())); return new MultiSourceTrackingToken(tokenMap); }
Source:
public static ReplicationFactor fromString(String s) { if (s.contains("/")) { List<String> parts = Splitter.on('/').splitToList(s); Preconditions.checkArgument( parts.size() == 2, "Replication factor format is <replicas> or <replicas>/<transient>"); return new ReplicationFactor(Integer.valueOf(parts.get(0)), Integer.valueOf(parts.get(1))); } else { return new ReplicationFactor(Integer.valueOf(s), 0); } }

Target:
public static ReplicationFactor fromString(String s) { if (s.contains("/")) { int slash = s.indexOf('/'); String allPart = s.substring(0, slash); String transientPart = s.substring(slash + 1); Preconditions.checkArgument( allPart != null && transientPart != null, "Replication factor format is <replicas> or <replicas>/<transient>"); return new ReplicationFactor(Integer.parseInt(allPart), Integer.parseInt(transientPart)); } else { return new ReplicationFactor(Integer.parseInt(s), 0); } }
Source:
public void testGetPath() throws Exception { String aut = "p b r;\n" + "q a r;\n" + "r b p;\n" + "r a q;\n" + "q a t;\n" + "p;\n" + "t;\n"; PAutomaton auto = PAutomaton.of(aut); PAutomatonState p = PAutomatonState.ofString("p"); PAutomatonState t = PAutomatonState.ofString("t"); Collection<Transition> path = auto.getPath(p, t); System.err.println("One shortest path from p to t is: " + path); org.junit.Assert.assertEquals("Path from p to t should have size 3", 3, path.size()); }

Target:
public void testGetPath() throws Exception { String aut = "p b r;\n" + "q a r;\n" + "r b p;\n" + "r a q;\n" + "q a t;\n" + "p;\n" + "t;\n"; PAutomaton<PAutomatonState<String, String>, String> auto = PAutomaton.of(aut); PAutomatonState<String, String> p = PAutomatonState.ofString("p"); PAutomatonState<String, String> t = PAutomatonState.ofString("t"); Collection<Transition<PAutomatonState<String, String>, String>> path = auto.getPath(p, t); org.junit.Assert.assertEquals("Path from p to t should have size 3", 3, path.size()); org.junit.Assert.assertEquals("Shortest path","[p b r, r a q, q a t]",path.toString()); }
Source:
public void testQueryTaskByVariablesWithOwners() { Map<String, Object> variables = emptyMap(); Map<String, Object> attributes = emptyMap(); List<String> potOwners = Collections.singletonList("katy"); List<UserTaskInstanceWithPotOwnerDesc> data = advanceVariableDataService.queryUserTasksByVariables(attributes, variables, emptyMap(), potOwners, new QueryContext(0, 2)); Assert.assertEquals(2, data.size()); for (UserTaskInstanceWithPotOwnerDesc p : data) { Assert.assertTrue(p.getPotentialOwners().contains("katy")); } }

Target:
public void testQueryTaskByVariablesWithOwners() { List<String> potOwners = Collections.singletonList("katy"); List<UserTaskInstanceWithPotOwnerDesc> data = advanceVariableDataService.queryUserTasksByVariables(emptyList(), emptyList(), emptyList(), potOwners, queryContext); if (queryContext.getCount() > 0) { Assert.assertThat(data.size(), is(queryContext.getCount())); } for (UserTaskInstanceWithPotOwnerDesc p : data) { Assert.assertTrue(p.getPotentialOwners().contains("katy")); } }
Source:
public void initialize(FrameAnimation schemaObject) { function = gameLoop.getFactory().getEngineObject( schemaObject.getNextframe() != null ? schemaObject .getNextframe() : new Linear()); frames = new ArrayList<TimedRenderer>(); if (schemaObject.getFrames() != null) { for (Timed f : schemaObject.getFrames()) { if (f != null) frames.add((TimedRenderer) gameLoop.getFactory() .getEngineObject(f)); else frames.add(null); } } setCurrentFrame(function.getInitialFrameIndex(frames.size())); }

Target:
public void initialize(FrameAnimation schemaObject) { function = gameLoop.getFactory().getEngineObject( schemaObject.getNextframe() != null ? schemaObject .getNextframe() : new Linear()); frames = new ArrayList<TimedRenderer>(); for (Timed f : schemaObject.getFrames()) { frames.add((TimedRenderer) gameLoop.getFactory().getEngineObject(f)); } setCurrentFrame(function.getInitialFrameIndex(frames.size())); }
Source:
public String toString() { return "App{" + "Description='" + Description + '\'' + ", Name='" + Name + '\'' + ", Downloads=" + Downloads + ", RedirectUris=" + Arrays.toString(RedirectUris) + ", Image=" + Image + '}'; }

Target:
public String toString() { return "App{" + "Description='" + Description + '\'' + ", Name='" + Name + '\'' + ", Downloads=" + Downloads + ", RedirectUris=" + Arrays.toString(RedirectUris) + ", Image=" + Image + ", Tags=" + Arrays.toString(Tags) + "} " + super.toString(); }
Source:
public PipelineEventReader<CharacterEventReader, CharacterEvent> getEventReader( HttpServletRequest request, HttpServletResponse response) { if (this.wrappedComponent != null) { final PipelineEventReader<CharacterEventReader, CharacterEvent> pipelineEventReader = this.wrappedComponent.getEventReader(request, response); final CharacterEventReader eventReader = pipelineEventReader.getEventReader(); final JsonWrapperFilteringCharacterEventReader jsonWrapperFilteringCharacterEventReader = new JsonWrapperFilteringCharacterEventReader(eventReader); final Map<String, String> outputProperties = pipelineEventReader.getOutputProperties(); return new PipelineEventReaderImpl<CharacterEventReader, CharacterEvent>( jsonWrapperFilteringCharacterEventReader, outputProperties); } else return null; }

Target:
public PipelineEventReader<CharacterEventReader, CharacterEvent> getEventReader( HttpServletRequest request, HttpServletResponse response) throws IllegalStateException { if (this.wrappedComponent != null) { final PipelineEventReader<CharacterEventReader, CharacterEvent> pipelineEventReader = this.wrappedComponent.getEventReader(request, response); final CharacterEventReader eventReader = pipelineEventReader.getEventReader(); final JsonWrapperFilteringCharacterEventReader jsonWrapperFilteringCharacterEventReader = new JsonWrapperFilteringCharacterEventReader(eventReader); final Map<String, String> outputProperties = pipelineEventReader.getOutputProperties(); return new PipelineEventReaderImpl<CharacterEventReader, CharacterEvent>( jsonWrapperFilteringCharacterEventReader, outputProperties); } else { logger.warn("PipelineComponentWrapper.wrapperComponent is null"); throw new IllegalStateException("PipelineComponentWrapper.wrapperComponent is null"); } }
Source:
public DataTransactionResult clearPassengers() { this.removePassengers(); final ImmutableList.Builder<EntitySnapshot> passengerSnapshotsBuilder = ImmutableList.builder(); final DataTransactionResult.Builder builder = DataTransactionResult.builder(); return builder.result(DataTransactionResult.Type.SUCCESS).success(new ImmutableSpongeListValue<>(Keys.PASSENGERS, passengerSnapshotsBuilder .build())).build(); }

Target:
public void clearPassengers() { this.removePassengers(); }
Source:
public ChatComponent setStrikethrough(boolean strikethrough) { $lock.writeLock().lock(); if (this.strikethrough == null) this.strikethrough = new AtomicBoolean(strikethrough); else this.strikethrough.set(strikethrough); $lock.writeLock().unlock(); return this; }

Target:
public ChatComponent setStrikethrough(boolean strikethrough) { if (this.strikethrough == null) this.strikethrough = new AtomicBoolean(strikethrough); else this.strikethrough.set(strikethrough); return this; }
Source:
protected void configure() { bind(AmazonAutoScaling.class).toProvider(AmazonAutoScalingProvider.class); bind(AmazonS3Client.class).toProvider(AmazonS3ClientProvider.class); bind(InstanceStatusOverridesView.class).to(AsgStatusOverridesView.class); bind(InstanceStatusOverridesView.class).to(S3StatusOverridesRegistry.class); bind(InstanceStatusOverridesSource.class).to(S3StatusOverridesRegistry.class); MapBinder<Integer, OverridesService> mapbinder = MapBinder.newMapBinder(binder(), Integer.class, OverridesService.class); mapbinder.addBinding(0).to(AsgStatusOverridesService.class); mapbinder.addBinding(1).to(S3StatusOverridesService.class); }

Target:
protected void configure() { bind(AmazonAutoScaling.class).toProvider(AmazonAutoScalingProvider.class); bind(AmazonS3Client.class).toProvider(AmazonS3ClientProvider.class); bind(AsgStatusOverridesView.class).in(Scopes.SINGLETON); bind(S3StatusOverridesRegistry.class).in(Scopes.SINGLETON); bind(OverridesService.class).to(CompositeOverridesService.class).in(Scopes.SINGLETON); Multibinder<OverridesService> multibinder = Multibinder.newSetBinder(binder(), OverridesService.class); multibinder.addBinding().to(AsgStatusOverridesService.class); multibinder.addBinding().to(S3StatusOverridesService.class); }
Source:
public boolean contains(@Nullable ServiceId serviceId) { return serviceId != null && serviceId.equals(serviceIdMap.get(serviceId.getId())); }

Target:
public boolean contains(@Nullable ServiceId serviceId) { return serviceId != null && serviceIdMap.get(serviceId.getId()).contains(serviceId); }
Source:
public PsFacebook(final com.jcabi.http.Request frequest, final WebRequestor frequestor, final String fapp, final String fkey) { this.request = frequest; this.requestor = frequestor; this.app = fapp; this.key = fkey; }

Target:
PsFacebook(final com.jcabi.http.Request frequest, final WebRequestor frequestor, final String fapp, final String fkey) { this.request = frequest; this.requestor = frequestor; this.app = fapp; this.key = fkey; }
Source:
public String addHiddenContent(String spaceId, String contentId, String contentMimeType, InputStream content) { log.debug("addContent(" + spaceId + ", " + contentId + ", " + contentMimeType + ")"); String bucketName = getBucketName(spaceId); if (contentMimeType == null || contentMimeType.equals("")) { contentMimeType = DEFAULT_MIMETYPE; } ObjectMetadata objMetadata = new ObjectMetadata(); objMetadata.setContentType(contentMimeType); PutObjectRequest putRequest = new PutObjectRequest(bucketName, contentId, content, objMetadata); putRequest.setStorageClass(DEFAULT_STORAGE_CLASS); putRequest.setCannedAcl(CannedAccessControlList.Private); try { PutObjectResult putResult = s3Client.putObject(putRequest); return putResult.getETag(); } catch (AmazonClientException e) { String err = "Could not add content " + contentId + " with type " + contentMimeType + " to S3 bucket " + bucketName + " due to error: " + e.getMessage(); throw new StorageException(err, e, NO_RETRY); } }

Target:
public String addHiddenContent(String spaceId, String contentId, String contentMimeType, InputStream content) { log.debug("addHiddenContent(" + spaceId + ", " + contentId + ", " + contentMimeType + ")"); String bucketName = getBucketName(spaceId); if (contentMimeType == null || contentMimeType.equals("")) { contentMimeType = DEFAULT_MIMETYPE; } ObjectMetadata objMetadata = new ObjectMetadata(); objMetadata.setContentType(contentMimeType); PutObjectRequest putRequest = new PutObjectRequest(bucketName, contentId, content, objMetadata); putRequest.setStorageClass(DEFAULT_STORAGE_CLASS); putRequest.setCannedAcl(CannedAccessControlList.Private); try { PutObjectResult putResult = s3Client.putObject(putRequest); return putResult.getETag(); } catch (AmazonClientException e) { String err = "Could not add content " + contentId + " with type " + contentMimeType + " to S3 bucket " + bucketName + " due to error: " + e.getMessage(); throw new StorageException(err, e, NO_RETRY); } }
Source:
public static String extractValue(String input, String xpath) { if (input == null || xpath == null) { return null; } try { XPathExpression xpathExpression = XPATH_FACTORY.newXPath().compile(xpath); try { NodeList nodes = (NodeList) xpathExpression .evaluate(new InputSource(new StringReader(input)), XPathConstants.NODESET); List<String> result = new ArrayList<>(); for (int i = 0; i < nodes.getLength(); i++) { result.add(nodes.item(i).getFirstChild().getTextContent()); } return StringUtils.join(result, " "); } catch (Exception e) { return xpathExpression.evaluate(new InputSource(new StringReader(input))); } } catch (Exception ex) { throw RESOURCE.illegalBehaviorInExtractValueFunc(ex.toString(), input, xpath).ex(); } }

Target:
public static String extractValue(String input, String xpath) { if (input == null || xpath == null) { return null; } try { XPathExpression xpathExpression = XPATH_FACTORY.get().newXPath().compile(xpath); try { NodeList nodes = (NodeList) xpathExpression .evaluate(new InputSource(new StringReader(input)), XPathConstants.NODESET); List<String> result = new ArrayList<>(); for (int i = 0; i < nodes.getLength(); i++) { result.add(nodes.item(i).getFirstChild().getTextContent()); } return StringUtils.join(result, " "); } catch (XPathExpressionException e) { return xpathExpression.evaluate(new InputSource(new StringReader(input))); } } catch (XPathExpressionException ex) { throw RESOURCE.illegalBehaviorInExtractValueFunc(ex.toString(), input, xpath).ex(); } }
Source:
protected Object handleRequestMessage(Message<?> requestMessage) { Assert.notNull(this.connectionFactory, this.getClass().getName() + " requires a client connection factory"); boolean haveSemaphore = false; TcpConnection connection = null; String connectionId = null; try { haveSemaphore = acquireSemaphoreIfNeeded(requestMessage); connection = this.connectionFactory.getConnection(); Long remoteTimeout = getRemoteTimeout(requestMessage); AsyncReply reply = new AsyncReply(remoteTimeout, connection, haveSemaphore, requestMessage); connectionId = connection.getConnectionId(); this.pendingReplies.put(connectionId, reply); if (logger.isDebugEnabled()) { logger.debug("Added pending reply " + connectionId); } connection.send(requestMessage); if (this.closeStreamAfterSend) { connection.shutdownOutput(); } if (isAsync()) { return reply.getFuture(); } else { return getReply(requestMessage, connection, connectionId, reply); } } catch (RuntimeException | IOException e) { logger.error("Tcp Gateway exception", e); if (e instanceof MessagingException) { throw (MessagingException) e; } throw new MessagingException("Failed to send or receive", e); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new MessageHandlingException(requestMessage, "Interrupted in the [" + this + ']', e); } finally { if (!isAsync()) { cleanUp(haveSemaphore, connection, connectionId); } } }

Target:
protected Object handleRequestMessage(Message<?> requestMessage) { Assert.notNull(this.connectionFactory, this.getClass().getName() + " requires a client connection factory"); boolean haveSemaphore = false; TcpConnection connection = null; String connectionId = null; boolean async = isAsync(); try { haveSemaphore = acquireSemaphoreIfNeeded(requestMessage); connection = this.connectionFactory.getConnection(); Long remoteTimeout = getRemoteTimeout(requestMessage); AsyncReply reply = new AsyncReply(remoteTimeout, connection, haveSemaphore, requestMessage, async); connectionId = connection.getConnectionId(); this.pendingReplies.put(connectionId, reply); if (logger.isDebugEnabled()) { logger.debug("Added pending reply " + connectionId); } connection.send(requestMessage); if (this.closeStreamAfterSend) { connection.shutdownOutput(); } if (async) { return reply.getFuture(); } else { return getReply(requestMessage, connection, connectionId, reply); } } catch (RuntimeException | IOException e) { logger.error("Tcp Gateway exception", e); if (e instanceof MessagingException) { throw (MessagingException) e; } throw new MessagingException("Failed to send or receive", e); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new MessageHandlingException(requestMessage, "Interrupted in the [" + this + ']', e); } finally { if (!async) { cleanUp(haveSemaphore, connection, connectionId); } } }
Source:
public Aggregator factorize(final ColumnSelectorFactory metricFactory) { final ColumnValueSelector<BloomKFilter> selector = metricFactory.makeColumnValueSelector(fieldName); if (selector instanceof NilColumnValueSelector) { return NoopAggregator.instance(); } return new BloomFilterMergeAggregator(selector, getMaxNumEntries()); }

Target:
public Aggregator factorize(final ColumnSelectorFactory metricFactory) { final BaseNullableColumnValueSelector selector = metricFactory.makeColumnValueSelector(fieldName); if (selector instanceof NilColumnValueSelector) { throw new ISE("WTF?! Unexpected NilColumnValueSelector"); } return new BloomFilterMergeAggregator((ColumnValueSelector<Object>) selector, new BloomKFilter(getMaxNumEntries())); }
Source:
public void buildAndSkipDepsNonExistentProject() throws Exception{ AFCompilerService service = new DefaultKieCompilerService(); CompletableFuture<KieCompilationResponse> futureRes = service.build(tmpRoot, mavenRepo.toString(), Boolean.FALSE); KieCompilationResponse res = futureRes.get(); assertThat(res.isSuccessful()).isFalse(); assertThat(res.getDependencies().isEmpty()).isTrue(); assertThat(res.getDependencies().size()).isEqualTo(0); }

Target:
public void buildAndSkipDepsNonExistentProject() throws Exception{ AFCompilerService service = new DefaultKieCompilerService(); CompletableFuture<KieCompilationResponse> futureRes = service.build(tmpRoot, mavenRepo.toString(), Boolean.FALSE); KieCompilationResponse res = futureRes.get(); assertThat(res.isSuccessful()).isFalse(); assertThat(res.getDependencies()).isEmpty(); }
Source:
default <K extends Comparable<? super K>, V> Map<K, V> toLinkedMap( Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends V> valueMapper, BiFunction<? super V, ? super V, ? extends V> merge) { return LinkedHashMap.ofEntries(toMap(keyMapper, valueMapper, merge)); }

Target:
default <K extends Comparable<? super K>, V> Map<K, V> toLinkedMap( Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends V> valueMapper, BiFunction<? super V, ? super V, ? extends V> merge) { final Map<K, V> map = toMap(keyMapper, valueMapper, merge); final Iterator<Tuple2<K, V>> entries = iterator() .map(keyMapper) .distinct() .map(key -> { V value = map.getOrElse(key, null); return Tuple.of(key, value); }); return LinkedHashMap.ofEntries(entries); }
Source:
public int doStartTag() throws JspException { JspWriter jspWriter = pageContext.getOut(); namespace = getNamespace(); StringBuilder display = new StringBuilder(); try { if (licenseIds != null && !licenseIds.isEmpty()) { printLicenses(display, licenseIds); } else { printEmptyLicenses(display); } display.append(String.format("<script>$(document).ready(function () { showLicenseDialogWrapper('%s'); })</script>", id)); jspWriter.print(display.toString()); } catch (Exception e) { throw new JspException(e); } return SKIP_BODY; }

Target:
public int doStartTag() throws JspException { JspWriter jspWriter = pageContext.getOut(); namespace = getNamespace(); StringBuilder display = new StringBuilder(); try { String licenseIdsString = (licenseIds != null && !licenseIds.isEmpty()) ? Joiner.on(", ").join(licenseIds) : ""; printHtmlElements(display, licenseIdsString); jspWriter.print(display.toString()); } catch (Exception e) { throw new JspException(e); } return SKIP_BODY; }
Source:
public Boolean getValue(ClusterNetworkModel clusterNetworkModel) { return clusterNetworkModel.isAttached() && clusterNetworkModel.isRequired(); }

Target:
public Boolean getValue(ClusterNetworkModel clusterNetworkModel) { return clusterNetworkModel.isRequired(); }
Source:
public JSONArray getInstallablesJson() throws IOException { JSONObject d = Downloadable.get(getId()).getData(); return d == null ? new JSONArray() : d.getJSONArray("list"); }

Target:
public JSONArray getInstallablesJson() throws IOException { JSONArray tools = new JSONArray(); final Downloadable d = Downloadable.get(getId()); if (d != null) { final JSONObject data = d.getData(); if (data != null) tools = data.getJSONArray("list"); } return tools; }
Source:
public CosemObisCodeDto(final int[] code) { if (code.length != 6) { throw new IllegalArgumentException("ObisCode must have 6 values: " + code.length); } this.a = code[0]; this.b = code[1]; this.c = code[2]; this.d = code[3]; this.e = code[4]; this.f = code[5]; this.checkValues(); }

Target:
public CosemObisCodeDto(final int[] code) { if (code.length != 6) { throw new IllegalArgumentException("ObisCode must have 6 values: " + code.length); } this.a = code[0]; this.b = code[1]; this.c = code[2]; this.d = code[3]; this.e = code[4]; this.f = code[5]; this.checkValues(this.a, this.b, this.c, this.d, this.e, this.f); }
Source:
public void start(BundleContext context) throws Exception { super.start(context); IExtensionRegistry registry = Platform.getExtensionRegistry(); this.descriptionConverterRegistry = new ItemRegistry<>(); this.descriptionConverterListener = new DescriptorRegistryEventListener<>(PLUGIN_ID, DESCRIPTION_CONVERTER_EXTENSION_POINT, this.descriptionConverterRegistry); registry.addListener(this.descriptionConverterListener, PLUGIN_ID + '.' + DESCRIPTION_CONVERTER_EXTENSION_POINT); this.descriptionConverterListener.readRegistry(registry); this.descriptionLinkResolverRegistry = new ItemRegistry<>(); this.descriptionLinkResolverListener = new DescriptorRegistryEventListener<>(PLUGIN_ID, DESCRIPTION_LINK_RESOLVER_EXTENSION_POINT, this.descriptionLinkResolverRegistry); registry.addListener(this.descriptionLinkResolverListener, PLUGIN_ID + '.' + DESCRIPTION_LINK_RESOLVER_EXTENSION_POINT); this.descriptionLinkResolverListener.readRegistry(registry); INSTANCE.startPropertiesPreferencesManagement(); }

Target:
public void start(BundleContext context) throws Exception { super.start(context); IExtensionRegistry registry = Platform.getExtensionRegistry(); this.descriptionConverterRegistry = new ItemRegistry<>(); this.descriptionConverterListener = new DescriptorRegistryEventListener<>(PLUGIN_ID, DESCRIPTION_CONVERTER_EXTENSION_POINT, this.descriptionConverterRegistry); registry.addListener(this.descriptionConverterListener, PLUGIN_ID + '.' + DESCRIPTION_CONVERTER_EXTENSION_POINT); this.descriptionConverterListener.readRegistry(registry); this.descriptionLinkResolverRegistry = new ItemRegistry<>(); this.descriptionLinkResolverListener = new DescriptorRegistryEventListener<>(PLUGIN_ID, DESCRIPTION_LINK_RESOLVER_EXTENSION_POINT, this.descriptionLinkResolverRegistry); registry.addListener(this.descriptionLinkResolverListener, PLUGIN_ID + '.' + DESCRIPTION_LINK_RESOLVER_EXTENSION_POINT); this.descriptionLinkResolverListener.readRegistry(registry); }
Source:
public static List<AndroidEmulator> listAvailableAvds() throws AndroidDeviceException { List<AndroidEmulator> avds = Lists.newArrayList(); String avdParam = "avds"; File clu = null; if(AndroidSdk.getAndroidVersionNumber() >= SDK_VERSION_FOR_AVD_MANAGER ){ clu = AndroidSdk.avdManager(); avdParam = "avd"; } else { clu = AndroidSdk.android(); } CommandLine getAVDCommand = new CommandLine(clu); getAVDCommand.addArgument("list", false); getAVDCommand.addArgument(avdParam, false); log.info("Executing command for avd: "+getAVDCommand.toString()); String output = null; try { output = ShellCommand.exec(getAVDCommand, 20000); } catch (ShellCommandException e) { throw new AndroidDeviceException(e); } Map<String, Integer> startedDevices = mapDeviceNamesToSerial(); String[] avdsOutput = StringUtils.splitByWholeSeparator(output, "---------"); if (avdsOutput != null && avdsOutput.length > 0) { for (String element : avdsOutput) { if (!element.contains("Name:")) { continue; } DefaultAndroidEmulator emulator = new DefaultAndroidEmulator(element); if (startedDevices.containsKey(emulator.getAvdName())) { emulator.setSerial(startedDevices.get(emulator.getAvdName())); } avds.add(emulator); } } return avds; }

Target:
public static List<AndroidEmulator> listAvailableAvds() throws AndroidDeviceException { List<AndroidEmulator> avds = Lists.newArrayList(); File clu = null; if (AndroidSdk.getAndroidVersionNumber() >= SDK_VERSION_FOR_AVD_MANAGER ) { clu = AndroidSdk.avdManager(); } else { clu = AndroidSdk.android(); } CommandLine getAVDCommand = new CommandLine(clu); getAVDCommand.addArgument("list", false); getAVDCommand.addArgument("avd", false); String output = null; try { output = ShellCommand.exec(getAVDCommand, 20000); } catch (ShellCommandException e) { throw new AndroidDeviceException(e); } Map<String, Integer> startedDevices = mapDeviceNamesToSerial(); String[] avdsOutput = StringUtils.splitByWholeSeparator(output, "---------"); if (avdsOutput != null && avdsOutput.length > 0) { for (String element : avdsOutput) { if (!element.contains("Name:")) { continue; } DefaultAndroidEmulator emulator = new DefaultAndroidEmulator(element); if (startedDevices.containsKey(emulator.getAvdName())) { emulator.setSerial(startedDevices.get(emulator.getAvdName())); } avds.add(emulator); } } return avds; }
Source:
private void initMigrationMode() { ArrayList<EntityModel> migrationModes = new ArrayList<EntityModel>(); Constants constants = ConstantsManager.getInstance().getConstants(); MIGRATABLE_ENTITY.setTitle(constants.autoAndManMigration()); IMPLICITLY_NON_MIGRATABLE_ENTITY.setTitle(constants.manualMigrationOnly()); PINNED_TO_HOST_ENTITY.setTitle(constants.noMigration()); migrationModes.add(MIGRATABLE_ENTITY); migrationModes.add(IMPLICITLY_NON_MIGRATABLE_ENTITY); migrationModes.add(PINNED_TO_HOST_ENTITY); getMigrationMode().setItems(migrationModes); }

Target:
private void initMigrationMode() { getMigrationMode().setItems(Arrays.asList(MigrationSupport.values())); }
Source:
public void startCluster() throws IOException { conf = new Configuration(); conf.set(String.format(FS_IMPL_PATTERN_KEY, HDFS_SCHEME), ViewFsOverloadScheme.class.getName()); conf.set(String.format( FsConstants.FS_VIEWFS_OVERLOAD_SCHEME_TARGET_ABSTRACTFS_IMPL_PATTERN, HDFS_SCHEME), Hdfs.class.getName()); cluster = new MiniDFSCluster.Builder(conf).numDataNodes(2).build(); cluster.waitClusterUp(); defaultFSURI = URI.create(conf.get(CommonConfigurationKeys.FS_DEFAULT_NAME_KEY)); localTargetDir = new File(TEST_ROOT_DIR, "/root/"); Assert.assertEquals(HDFS_SCHEME, defaultFSURI.getScheme()); }

Target:
public void startCluster() throws IOException { conf = new Configuration(cluster.getConfiguration(0)); conf.set(String.format(FS_IMPL_PATTERN_KEY, HDFS_SCHEME), ViewFsOverloadScheme.class.getName()); conf.set(String.format( FsConstants.FS_VIEWFS_OVERLOAD_SCHEME_TARGET_ABSTRACTFS_IMPL_PATTERN, HDFS_SCHEME), Hdfs.class.getName()); defaultFSURI = URI.create(conf.get(CommonConfigurationKeys.FS_DEFAULT_NAME_KEY)); localTargetDir = new File(TEST_ROOT_DIR, "/root/"); Assert.assertEquals(HDFS_SCHEME, defaultFSURI.getScheme()); }
Source:
public void createsInstance() throws Exception { final MultiSelectFacet<String> facet = MultiSelectFacetBuilder.of(KEY, LABEL, OPTIONS, true) .setThreshold(3L) .setLimit(10L) .build(); assertThat(facet.getKey()).isEqualTo(KEY); assertThat(facet.getLabel()).isEqualTo(LABEL); assertThat(facet.getAllOptions()).isEqualTo(OPTIONS); assertThat(facet.matchesAll()).isTrue(); assertThat(facet.getThreshold()).contains(3L); assertThat(facet.getLimit()).contains(10L); }

Target:
public void createsInstance() throws Exception { final MultiSelectFacet<String> facet = MultiSelectFacetBuilder.of(KEY, LABEL, OPTIONS, true) .threshold(3L) .limit(10L) .build(); assertThat(facet.getKey()).isEqualTo(KEY); assertThat(facet.getLabel()).isEqualTo(LABEL); assertThat(facet.getAllOptions()).isEqualTo(OPTIONS); assertThat(facet.matchesAll()).isTrue(); assertThat(facet.getThreshold()).contains(3L); assertThat(facet.getLimit()).contains(10L); }
Source:
public boolean updateHaLocalMaintenanceMode(VDS vds, boolean localMaintenance){ boolean setHaMaintenanceFailed; SetHaMaintenanceModeVDSCommandParameters param = new SetHaMaintenanceModeVDSCommandParameters(vds, HaMaintenanceMode.LOCAL, localMaintenance); setHaMaintenanceFailed = !vdsBroker.runVdsCommand(VDSCommandType.SetHaMaintenanceMode, param).getSucceeded(); return setHaMaintenanceFailed; }

Target:
public boolean updateHaLocalMaintenanceMode(VDS vds, boolean localMaintenance){ boolean setHaMaintenanceSucceeds; SetHaMaintenanceModeVDSCommandParameters param = new SetHaMaintenanceModeVDSCommandParameters(vds, HaMaintenanceMode.LOCAL, localMaintenance); setHaMaintenanceSucceeds = vdsBroker.runVdsCommand(VDSCommandType.SetHaMaintenanceMode, param).getSucceeded(); return setHaMaintenanceSucceeds; }
Source:
public void init(KieServerImpl kieServer, KieServerRegistry registry) { KieServerExtension droolsExtension = registry.getServerExtension( "Drools" ); if ( droolsExtension == null ) { logger.warn( "No Drools extension available, quiting..." ); return; } this.registry = registry; this.threadPool = new ThreadPoolExecutor(2, Runtime.getRuntime().availableProcessors(), 120, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(Runtime.getRuntime().availableProcessors())); this.solverServiceBase = new SolverServiceBase( registry, threadPool ); this.services.add( solverServiceBase ); }

Target:
public void init(KieServerImpl kieServer, KieServerRegistry registry) { KieServerExtension droolsExtension = registry.getServerExtension( "Drools" ); if ( droolsExtension == null ) { logger.warn( "No Drools extension available, quiting..." ); return; } this.registry = registry; int poolSize = Runtime.getRuntime().availableProcessors(); if (poolSize >= 4) { poolSize--; } this.threadPool = new ThreadPoolExecutor(2, poolSize, 120, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(poolSize)); this.solverServiceBase = new SolverServiceBase( registry, threadPool ); this.services.add( solverServiceBase ); }
Source:
private Set<DataObject> findDataObjects() { Iterable<Node> nodes = canvasSessionManager.getCurrentSession() .getCanvasHandler() .getDiagram() .getGraph() .nodes(); final Set<String> parentIds = getParentIds(); return StreamSupport.stream(nodes.spliterator(), false) .filter(this::isBPMNDefinition) .map(elm -> (Node<View<BPMNDefinition>, Edge>) elm) .filter(elm -> { if (elm.getContent().getDefinition() instanceof DataObject) { final Element parent = getParentElement(elm); if (parent == null) { return true; } return parentIds.contains(parent.getUUID()); } return false; }) .map(elm -> ((DataObject) elm.getContent().getDefinition())) .collect(Collectors.toSet()); }

Target:
private Set<DataObject> findDataObjects() { Iterable<Node> nodes = canvasSessionManager.getCurrentSession() .getCanvasHandler() .getDiagram() .getGraph() .nodes(); final Set<String> parentIds = getParentIds(); return StreamSupport.stream(nodes.spliterator(), false) .filter(this::isBPMNDefinition) .map(elm -> (Node<View<BPMNDefinition>, Edge>) elm) .filter(elm -> { if (elm.getContent().getDefinition() instanceof DataObject) { final Element parent = graphUtils.getParent(elm); if (parent == null) { return true; } return parentIds.contains(parent.getUUID()); } return false; }) .map(elm -> ((DataObject) elm.getContent().getDefinition())) .collect(Collectors.toSet()); }