auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private Project fetchProjectByName(Connection connection, String name) throws ProjectManagerException { QueryRunner runner = new QueryRunner(); Project project = null; ProjectResultHandler handler = new ProjectResultHandler(); try { List<Project> projects = runner.query(connection, ProjectResultHandler.SELECT_PROJECT_BY_NAME, handler, name); if (projects.isEmpty()) { throw new ProjectManagerException( "No active project with name " + name + " exists in db."); } project = projects.get(0); } catch (SQLException e) { logger.error(ProjectResultHandler.SELECT_PROJECT_BY_NAME + " failed."); throw new ProjectManagerException( "Query for existing project failed. Project " + name, e); } List<Triple<String, Boolean, Permission>> permissions = fetchPermissionsForProject(connection, project); for (Triple<String, Boolean, Permission> perm : permissions) { if (perm.getThird().toFlags() != 0) { if (perm.getSecond()) { project .setGroupPermission(perm.getFirst(), perm.getThird()); } else { project.setUserPermission(perm.getFirst(), perm.getThird()); } } } return project; }

Target:
private Project fetchProjectByName(Connection connection, String name) throws ProjectManagerException { QueryRunner runner = new QueryRunner(); Project project = null; ProjectResultHandler handler = new ProjectResultHandler(); try { List<Project> projects = runner.query(connection, ProjectResultHandler.SELECT_PROJECT_BY_NAME, handler, name); if (projects.isEmpty()) { throw new ProjectManagerException( "No project with name " + name + " exists in db."); } project = projects.get(0); } catch (SQLException e) { logger.error(ProjectResultHandler.SELECT_PROJECT_BY_NAME + " failed."); throw new ProjectManagerException( "Query for existing project failed. Project " + name, e); } List<Triple<String, Boolean, Permission>> permissions = fetchPermissionsForProject(connection, project); for (Triple<String, Boolean, Permission> perm : permissions) { if (perm.getThird().toFlags() != 0) { if (perm.getSecond()) { project .setGroupPermission(perm.getFirst(), perm.getThird()); } else { project.setUserPermission(perm.getFirst(), perm.getThird()); } } } return project; }
Source:
public void performSingleTenantMultipleUserQueueTestCase() { int sendMessageCount = 200; int runTime = 40; int expectedMessageCount = 200; AndesClient adminReceivingClient = new AndesClient("receive", "127.0.0.1:5672", "queue:topictenant1.com/tenantTopic", "100", "false", Integer.toString(runTime), Integer.toString(expectedMessageCount), "1", "listener=true,ackMode=1,delayBetweenMsg=0,stopAfter=" + expectedMessageCount, "", "admin!topictenant1.com", "admin"); adminReceivingClient.startWorking(); AndesClient tenant1SendingClient = new AndesClient("send", "127.0.0.1:5672", "queue:topictenant1.com/tenantTopic", "100", "false", Integer.toString(runTime), Integer.toString(sendMessageCount), "1", "ackMode=1,delayBetweenMsg=0,stopAfter=" + sendMessageCount, "", "topictenantuser1!topictenant1.com", "topictenantuser1"); tenant1SendingClient.startWorking(); boolean adminReceiveSuccess = AndesClientUtils.waitUntilMessagesAreReceived(adminReceivingClient, expectedMessageCount, runTime); boolean tenant1SendSuccess = AndesClientUtils.getIfSenderIsSuccess(tenant1SendingClient, sendMessageCount); Assert.assertTrue(tenant1SendSuccess, "Sending failed for tenant 1 user 1."); Assert.assertEquals(expectedMessageCount, adminReceivingClient.getReceivedTopicMessagecount()); Assert.assertTrue(adminReceiveSuccess, "Message receiving failed for admin of tenant 1."); }

Target:
public void performSingleTenantMultipleUserQueueTestCase() { int sendMessageCount = 200; int runTime = 40; int expectedMessageCount = 200; AndesClient adminReceivingClient = new AndesClient("receive", "127.0.0.1:5672", "queue:topictenant1.com/tenantTopic", "100", "false", Integer.toString(runTime), Integer.toString(expectedMessageCount), "1", "listener=true,ackMode=1,delayBetweenMsg=0,stopAfter=" + expectedMessageCount, "", "admin!topictenant1.com", "admin"); adminReceivingClient.startWorking(); AndesClient tenant1SendingClient = new AndesClient("send", "127.0.0.1:5672", "queue:topictenant1.com/tenantTopic", "100", "false", Integer.toString(runTime), Integer.toString(sendMessageCount), "1", "ackMode=1,delayBetweenMsg=0,stopAfter=" + sendMessageCount, "", "topictenantuser1!topictenant1.com", "topictenantuser1"); tenant1SendingClient.startWorking(); boolean adminReceiveSuccess = AndesClientUtils.waitUntilMessagesAreReceived(adminReceivingClient, expectedMessageCount, runTime); boolean tenant1SendSuccess = AndesClientUtils.getIfSenderIsSuccess(tenant1SendingClient, sendMessageCount); Assert.assertTrue(tenant1SendSuccess, "Sending failed for tenant 1 user 1."); Assert.assertEquals(adminReceivingClient.getReceivedqueueMessagecount(),expectedMessageCount); Assert.assertTrue(adminReceiveSuccess, "Message receiving failed for admin of tenant 1. Received message count : " + adminReceivingClient.getReceivedqueueMessagecount()); }
Source:
public int getToolTipDisplayDelayTime(Object object_p) { return 100; }

Target:
public int getToolTipDisplayDelayTime(Object object_p) { return TOOLTIP_DISPLAY_DELAY_TIME; }
Source:
private String initializeServerInstance(String id) { try { LOG.debug("Initializing of a language server instance for server '{}': started", id); synchronized (idRegistry.get(id)) { if (serverCapabilitiesRegistry.contains(id)) { LOG.debug("Already initialized"); return id; } LanguageServer languageServer = languageServerRegistry.get(id); InitializeParams initializeParams = initializeParamsProvider.get(id); InitializeResult initializeResult = languageServer.initialize(initializeParams).get(5, SECONDS); LanguageServerInitializedEvent event = new LanguageServerInitializedEvent(id, languageServer); eventService.publish(event); LOG.debug("Published a corresponding event: {}", event); LOG.debug("Initializing of a language server instance for server '{}': finished", id); LOG.info("Initialized language server '{}'", id); return serverCapabilitiesRegistry.add(id, initializeResult.getCapabilities()); } } catch (LanguageServerException | InterruptedException | ExecutionException | TimeoutException e) { LOG.error("Can't initialize language server for '{}'", id, e); } return null; }

Target:
private String initializeServerInstance(String id) { try { LOG.debug("Initializing of a language server instance for server '{}': started", id); synchronized (idRegistry.get(id)) { if (serverCapabilitiesRegistry.contains(id)) { LOG.debug("Already initialized"); return id; } LanguageServer languageServer = languageServerRegistry.get(id); InitializeParams initializeParams = initializeParamsProvider.get(id); InitializeResult initializeResult = languageServer.initialize(initializeParams).get(30, SECONDS); LanguageServerInitializedEvent event = new LanguageServerInitializedEvent(id, languageServer); eventService.publish(event); LOG.debug("Published a corresponding event: {}", event); LOG.debug("Initializing of a language server instance for server '{}': finished", id); LOG.info("Initialized language server '{}'", id); return serverCapabilitiesRegistry.add(id, initializeResult.getCapabilities()); } } catch (LanguageServerException | InterruptedException | ExecutionException | TimeoutException e) { LOG.error("Can't initialize language server for '{}'", id, e); } return null; }
Source:
public void startArrayOrObjects(int count) { if (valueSeq != null && !this.arrayCounters.isEmpty()) { boolean addCounter = levelArray - count < this.keysOrMembers.size() ? this.keysOrMembers.get(levelArray - count) : true; if (itemStack.get(itemStack.size() - 1) == itemType.ARRAY) { if (addCounter) { this.arrayCounters.set(levelArray - count, this.arrayCounters.get(levelArray - count) + 1); this.allKeys.add(this.toBytes(this.arrayCounters.get(levelArray - count))); } else { Byte[] bool = { (byte) 0x2B, 0x01 }; this.allKeys.add(bool); } } } if (count == 2 && valueSeq != null) { this.arrayCounters.add(Integer.valueOf(0)); } }

Target:
public void startArrayOrObjects(int count) { if (valueSeq != null && !this.arrayCounters.isEmpty()) { boolean addCounter = levelArray - count < this.keysOrMembers.size() ? this.keysOrMembers.get(levelArray - count) : true; if (itemStack.get(itemStack.size() - 1) == itemType.ARRAY) { if (addCounter) { this.arrayCounters.set(levelArray - count, this.arrayCounters.get(levelArray - count) + 1); this.allKeys.add(this.toBytes(this.arrayCounters.get(levelArray - count))); } else { XDMConstants.setTrue(bp); this.allKeys.add(ArrayUtils.toObject(bp.getByteArray())); } } } if (count == 2 && valueSeq != null) { this.arrayCounters.add(Integer.valueOf(0)); } }
Source:
private static Map<String, String> buildSimpleReplacements(Set<DativePluralsEntry> datives) { Map<String, String> out = new HashMap<>(); for(DativePluralsEntry entry : datives) { out.put(entry.getForm(), entry.getStandard()); String lenited_form = Utils.lenite(entry.getForm()); String lenited_repl = Utils.lenite(entry.getStandard()); if(!lenited_form.equals(entry.getForm())) { out.put(lenited_form, lenited_repl); } String eclipsed_form = Utils.eclipse(entry.getForm()); String eclipsed_repl = Utils.eclipse(entry.getStandard()); if(!eclipsed_form.equals(entry.getForm())) { out.put(eclipsed_form, eclipsed_repl); } if(Utils.isVowel(entry.getForm().charAt(0))) { out.put("h" + entry.getForm(), "h" + entry.getStandard()); out.put("h-" + entry.getForm(), "h" + entry.getStandard()); } if(entry.hasModernised()) { out.put(entry.getModern(), entry.getStandard()); lenited_form = Utils.lenite(entry.getModern()); lenited_repl = Utils.lenite(entry.getStandard()); if(!lenited_form.equals(entry.getModern())) { out.put(lenited_form, lenited_repl); } eclipsed_form = Utils.eclipse(entry.getModern()); eclipsed_repl = Utils.eclipse(entry.getStandard()); if(!eclipsed_form.equals(entry.getModern())) { out.put(eclipsed_form, eclipsed_repl); } if(Utils.isVowel(entry.getModern().charAt(0))) { out.put("h" + entry.getModern(), "h" + entry.getStandard()); out.put("h-" + entry.getModern(), "h" + entry.getStandard()); } } } return out; }

Target:
private static Map<String, String> buildSimpleReplacements(Set<DativePluralsEntry> datives) { Map<String, String> out = new HashMap<>(); for(DativePluralsEntry entry : datives) { out.put(entry.getForm(), entry.getStandard()); String lenitedForm = Utils.lenite(entry.getForm()); String lenitedRepl = Utils.lenite(entry.getStandard()); if(!lenitedForm.equals(entry.getForm())) { out.put(lenitedForm, lenitedRepl); } String eclipsedForm = Utils.eclipse(entry.getForm()); String eclipsedRepl = Utils.eclipse(entry.getStandard()); if(!eclipsedForm.equals(entry.getForm())) { out.put(eclipsedForm, eclipsedRepl); } if(Utils.isVowel(entry.getForm().charAt(0))) { out.put("h" + entry.getForm(), "h" + entry.getStandard()); out.put("h-" + entry.getForm(), "h" + entry.getStandard()); } if(entry.hasModernised()) { out.put(entry.getModern(), entry.getStandard()); lenitedForm = Utils.lenite(entry.getModern()); lenitedRepl = Utils.lenite(entry.getStandard()); if(!lenitedForm.equals(entry.getModern())) { out.put(lenitedForm, lenitedRepl); } eclipsedForm = Utils.eclipse(entry.getModern()); eclipsedRepl = Utils.eclipse(entry.getStandard()); if(!eclipsedForm.equals(entry.getModern())) { out.put(eclipsedForm, eclipsedRepl); } if(Utils.isVowel(entry.getModern().charAt(0))) { out.put("h" + entry.getModern(), "h" + entry.getStandard()); out.put("h-" + entry.getModern(), "h" + entry.getStandard()); } } } return out; }
Source:
public void testNonStandardPort() throws Exception { redis = app.createAndManageChild(EntitySpec.create(RedisStore.class) .configure(RedisStore.REDIS_PORT, PortRanges.fromString("10000+"))); app.start(ImmutableList.of(loc)); EntityTestUtils.assertAttributeEqualsEventually(redis, Startable.SERVICE_UP, true); JedisSupport support = new JedisSupport(redis); support.redisTest(); EntityTestUtils.assertPredicateEventuallyTrue(redis, new Predicate<RedisStore>() { @Override public boolean apply(@Nullable RedisStore input) { return input != null && input.getAttribute(RedisStore.UPTIME) > 0; } }); }

Target:
public void testNonStandardPort() throws Exception { redis = app.createAndManageChild(EntitySpec.create(RedisStore.class) .configure(RedisStore.REDIS_PORT, PortRanges.fromString("10000+"))); app.start(ImmutableList.of(loc)); EntityTestUtils.assertAttributeEqualsEventually(redis, Startable.SERVICE_UP, true); JedisSupport support = new JedisSupport(redis); support.redisTest(); EntityTestUtils.assertPredicateEventuallyTrue(redis, new Predicate<RedisStore>() { @Override public boolean apply(@Nullable RedisStore input) { return input != null && input.getAttribute(RedisStore.UPTIME) > 0 && input.getAttribute(RedisStore.TOTAL_COMMANDS_PROCESSED) >= 0 && input.getAttribute(RedisStore.TOTAL_CONNECTIONS_RECEIVED) >= 0 && input.getAttribute(RedisStore.EXPIRED_KEYS) >= 0 && input.getAttribute(RedisStore.EVICTED_KEYS) >= 0 && input.getAttribute(RedisStore.KEYSPACE_HITS) >= 0 && input.getAttribute(RedisStore.KEYSPACE_MISSES) >= 0; } }); }
Source:
public Boolean getspacingCompliesPDFA() { logger.warn("Current feature not supported yet. Result is always true."); return true; }

Target:
public Boolean getspacingCompliesPDFA() { return ((COSStream) baseObject).getEndStreamSpacingsComplyPDFA() == null && ((COSStream) baseObject).getStreamSpacingsComplyPDFA() == null; }
Source:
public List<User> call(ApiCaller ac, Deserializer parms) throws PerunException { if(parms.contains("role")) { String roleName = parms.readString("role"); if (roleName == null) { throw new RpcException(RpcException.Type.WRONG_PARAMETER, "wrong parameter in role, cannot be null."); } else { roleName = roleName.toUpperCase(); } return ac.getVosManager().getAdmins(ac.getSession(), ac.getVoById(parms.readInt("vo")), roleName, parms.readBoolean("onlyDirectAdmins")); } else { return ac.getVosManager().getAdmins(ac.getSession(), ac.getVoById(parms.readInt("vo"))); } }

Target:
public List<Vo> call(ApiCaller ac, Deserializer parms) throws PerunException { return ac.getVosManager().getVos(ac.getSession()); }
Source:
protected final void execute() { getReturnValue().setCanDoAction(true); getReturnValue().setIsSyncronious(true); getParameters().setTaskStartTime(System.currentTimeMillis()); ExecutionHandler.addStep(getExecutionContext(), StepEnum.EXECUTING, null); try { handleTransactivity(); TransactionSupport.executeInScope(scope, this); } catch (TransactionRolledbackLocalException e) { log.infoFormat("Transaction was aborted in {0}", this.getClass().getName()); compensate(); } finally { try { freeLock(); if (getCommandShouldBeLogged()) { logCommand(); } if (getSucceeded()) { startPollingAsyncTasks(); } } finally { if (!hasTasks() && !ExecutionHandler.checkIfJobHasTasks(getExecutionContext())) { ExecutionHandler.endJob(getExecutionContext(), getSucceeded()); } } } }

Target:
protected final void execute() { getReturnValue().setCanDoAction(true); getReturnValue().setIsSyncronious(true); ExecutionHandler.addStep(getExecutionContext(), StepEnum.EXECUTING, null); try { handleTransactivity(); TransactionSupport.executeInScope(scope, this); } catch (TransactionRolledbackLocalException e) { log.infoFormat("Transaction was aborted in {0}", this.getClass().getName()); compensate(); } finally { try { freeLock(); if (getCommandShouldBeLogged()) { logCommand(); } if (getSucceeded()) { startPollingAsyncTasks(); } } finally { if (!hasTasks() && !ExecutionHandler.checkIfJobHasTasks(getExecutionContext())) { ExecutionHandler.endJob(getExecutionContext(), getSucceeded()); } } } }
Source:
private Response afterPostBrokerLoginFlowSuccess(AuthenticationSessionModel authSession, BrokeredIdentityContext context, boolean wasFirstBrokerLogin, ClientSessionCode<AuthenticationSessionModel> clientSessionCode) { String providerId = context.getIdpConfig().getAlias(); UserModel federatedUser = authSession.getAuthenticatedUser(); if (wasFirstBrokerLogin) { return finishBrokerAuthentication(context, federatedUser, authSession, providerId); } else { boolean firstBrokerLoginInProgress = (authSession.getAuthNote(AbstractIdpAuthenticator.BROKERED_CONTEXT_NOTE) != null); if (firstBrokerLoginInProgress) { logger.debugf("Reauthenticated with broker '%s' when linking user '%s' with other broker", context.getIdpConfig().getAlias(), federatedUser.getUsername()); try { UserModel linkingUser = AbstractIdpAuthenticator.getExistingUser(session, realmModel, authSession); if (!linkingUser.getId().equals(federatedUser.getId())) { return redirectToErrorPage(authSession, Response.Status.BAD_REQUEST, Messages.IDENTITY_PROVIDER_DIFFERENT_USER_MESSAGE, federatedUser.getUsername(), linkingUser.getUsername()); } } catch (AuthenticationFlowException e) { logger.debug("No existing user in authSession", e); } SerializedBrokeredIdentityContext serializedCtx = SerializedBrokeredIdentityContext.readFromAuthenticationSession(authSession, AbstractIdpAuthenticator.BROKERED_CONTEXT_NOTE); authSession.setAuthNote(AbstractIdpAuthenticator.FIRST_BROKER_LOGIN_SUCCESS, serializedCtx.getIdentityProviderId()); return afterFirstBrokerLogin(clientSessionCode); } else { return finishBrokerAuthentication(context, federatedUser, authSession, providerId); } } }

Target:
private Response afterPostBrokerLoginFlowSuccess(AuthenticationSessionModel authSession, BrokeredIdentityContext context, boolean wasFirstBrokerLogin, ClientSessionCode<AuthenticationSessionModel> clientSessionCode) { String providerId = context.getIdpConfig().getAlias(); UserModel federatedUser = authSession.getAuthenticatedUser(); if (wasFirstBrokerLogin) { return finishBrokerAuthentication(context, federatedUser, authSession, providerId); } else { boolean firstBrokerLoginInProgress = (authSession.getAuthNote(AbstractIdpAuthenticator.BROKERED_CONTEXT_NOTE) != null); if (firstBrokerLoginInProgress) { logger.debugf("Reauthenticated with broker '%s' when linking user '%s' with other broker", context.getIdpConfig().getAlias(), federatedUser.getUsername()); SerializedBrokeredIdentityContext serializedCtx = SerializedBrokeredIdentityContext.readFromAuthenticationSession(authSession, AbstractIdpAuthenticator.BROKERED_CONTEXT_NOTE); authSession.setAuthNote(AbstractIdpAuthenticator.FIRST_BROKER_LOGIN_SUCCESS, serializedCtx.getIdentityProviderId()); return afterFirstBrokerLogin(clientSessionCode); } else { return finishBrokerAuthentication(context, federatedUser, authSession, providerId); } } }
Source:
public CompletionStage<?> applyState(Address sender, int topologyId, boolean pushTransfer, Collection<StateChunk> stateChunks) { expectLatch.countDown(); try { assertTrue(blockLatch.await(10, TimeUnit.SECONDS)); } catch (InterruptedException e) { throw new RuntimeException(e); } super.applyState(sender, topologyId, pushTransfer, stateChunks); return null; }

Target:
public CompletionStage<?> applyState(Address sender, int topologyId, boolean pushTransfer, Collection<StateChunk> stateChunks) { expectLatch.countDown(); try { assertTrue(blockLatch.await(10, TimeUnit.SECONDS)); } catch (InterruptedException e) { throw new RuntimeException(e); } return super.applyState(sender, topologyId, pushTransfer, stateChunks); }
Source:
public Stream<PageInfo> getPages() throws IOException { try { byte[] confData = mDb.get(CONF_KEY); Cache.PRocksPageStoreOptions pOptions = mOptions.toProto(); if (confData != null) { Cache.PRocksPageStoreOptions persistedOptions = Cache.PRocksPageStoreOptions.parseFrom(confData); if (!persistedOptions.equals(pOptions)) { mDb.close(); throw new IOException("Inconsistent configuration for RocksPageStore"); } } mDb.put(CONF_KEY, pOptions.toByteArray()); return Streams.stream(new PageIterator(mDb.newIterator())); } catch (RocksDBException e) { mDb.close(); throw new IOException("Failed to restore RocksPageStore:", e); } }

Target:
public Stream<PageInfo> getPages() { RocksIterator iter = mDb.newIterator(); iter.seekToFirst(); return Streams.stream(new PageIterator(iter)).onClose(iter::close); }
Source:
public MaxwellKafkaProducer(MaxwellContext context, Properties kafkaProperties, String kafkaTopic) { super(context); this.topic = kafkaTopic; if ( this.topic == null ) { this.topic = "maxwell"; } this.setDefaults(kafkaProperties); this.kafka = new KafkaProducer<>(kafkaProperties, new StringSerializer(), new StringSerializer()); this.numPartitions = kafka.partitionsFor(topic).size(); String partitionParams = this.context.getConfig().kafkaPartitionHash + "|" + this.context.getConfig().kafkaPartitionKey; switch (partitionParams) { case "murmur3|database": this.partitioner = new Murmur3KafkaDatabasePartitioner(this.context.getConfig().murmur3Seed); break; case "murmur3|table": this.partitioner = new Murmur3KafkaTablePartitioner(this.context.getConfig().murmur3Seed); break; case "murmur3|primary_key": this.partitioner = new Murmur3KafkaPrimaryKeyPartitioner(this.context.getConfig().murmur3Seed); break; case "default|primary_key": this.partitioner = new MaxwellKafkaPrimaryKeyPartitioner(); break; case "default|table": this.partitioner = new MaxwellKafkaTablePartitioner(); break; case "default|database": default: this.partitioner = new MaxwellKafkaDatabasePartitioner(); break; } }

Target:
public MaxwellKafkaProducer(MaxwellContext context, Properties kafkaProperties, String kafkaTopic) { super(context); this.topic = kafkaTopic; if ( this.topic == null ) { this.topic = "maxwell"; } this.setDefaults(kafkaProperties); this.kafka = new KafkaProducer<>(kafkaProperties, new StringSerializer(), new StringSerializer()); this.numPartitions = kafka.partitionsFor(topic).size(); String hash = context.getConfig().kafkaPartitionHash; String partitionKey = context.getConfig().kafkaPartitionKey; this.partitioner = new MaxwellKafkaPartitioner(hash, partitionKey); }
Source:
protected void prepareConfigFile() { String catUrl = CATALOG_URL.get(); File configFile = new File("repo.json"); try { ConfigFileFields configCatalogEntries = jsonMapper.readValue(catUrl, ConfigFileFields.class); FileOutputStream fos = new FileOutputStream(configFile.getAbsoluteFile()); jsonMapper.writeValue(fos, configCatalogEntries); } catch (IOException e) { e.printStackTrace(); } }

Target:
protected void prepareConfigFile() throws IOException { File configFile = new File("repo.json"); String catUrl = CATALOG_URL.get(); ConfigFileFields configCatalogEntries = new ConfigFileFields(); FileOutputStream fos; if(catUrl.startsWith("{")) { configCatalogEntries = jsonMapper.readValue(catUrl, ConfigFileFields.class); fos = new FileOutputStream(configFile.getAbsoluteFile()); jsonMapper.writeValue(fos, configCatalogEntries); } else { String []catalogs = catUrl.split(","); List<CatalogEntry> catalogEntryList = new ArrayList<>(); for (String catalog: catalogs) { CatalogEntry entry = new CatalogEntry(); String[]splitted = catalog.split("="); entry.setName(splitted[0]); entry.setRepoURL(splitted[1]); entry.setBranch("master"); catalogEntryList.add(entry); } configCatalogEntries.setCatalogs(catalogEntryList); fos = new FileOutputStream(configFile.getAbsoluteFile()); jsonMapper.writeValue(fos, configCatalogEntries); } }
Source:
public void close() { if (holder != null) { try { if (invalidateOnClose) { log.trace("Invalidating CAS [{}]@[{}]({})", username, documentName, documentId); exclusiveAccessPool.invalidateObject(key, holder); exclusiveAccessHolders.remove(holder); } else { log.trace("Returning briefly borrowed CAS [{}]@[{}]({})", username, documentName, documentId); exclusiveAccessPool.returnObject(key, holder); } } catch (Exception e) { log.error("Unable to return CAS to exclusive access pool", e); } } }

Target:
public void close() { if (holder != null) { log.trace("Returning briefly borrowed CAS [{}]@[{}]({})", username, documentName, documentId); exclusiveAccessPool.returnObject(key, holder); } }
Source:
public Collection<ByteArrayWrapper> spop( ByteArrayWrapper key, int popCount) { RedisSet redisSet = get(key); Collection<ByteArrayWrapper> byteArrayWrappers = redisSet.spop(key, popCount); if (get(key).scard(key) == 0) { region.remove(key); } else { region.put(key, get(key)); } return byteArrayWrappers; }

Target:
public Collection<ByteArrayWrapper> spop( ByteArrayWrapper key, int popCount) { return getRedisSet(key).spop(region, key, popCount); }
Source:
@Override protected void executeQueryCommand() { if (getParameters().getStorageType() != null) { getQueryReturnValue().setReturnValue( WipeAfterDeleteUtils.getDefaultWipeAfterDeleteFlag(getParameters().getStorageType())); } }

Target:
protected void executeQueryCommand() { if (getParameters().getStorageType() != null) { getQueryReturnValue().setReturnValue( WipeAfterDeleteUtils.getDefaultWipeAfterDeleteFlag(getParameters().getStorageType())); } }
Source:
private static void extraTarGzSource(File folder, URL url) throws IOException { HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.connect(); try (TarArchiveInputStream inputStream = new TarArchiveInputStream(new GzipCompressorInputStream(connection.getInputStream()))) { TarArchiveEntry entry; while ((entry = inputStream.getNextTarEntry()) != null) { if (entry.isDirectory()) { continue; } File file = new File(folder, entry.getName()); File parent = file.getParentFile(); if (!parent.exists()) { parent.mkdirs(); } try (OutputStream outputStream = new FileOutputStream(file)) { IOUtils.copy(inputStream, outputStream); } } } connection.disconnect(); }

Target:
private static void extraTarGzSource(File folder, URL url) throws IOException { HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.connect(); try (TarArchiveInputStream inputStream = new TarArchiveInputStream(new GzipCompressorInputStream(connection.getInputStream()))) { TarArchiveEntry entry; while ((entry = inputStream.getNextTarEntry()) != null) { if (entry.isDirectory()) { continue; } File file = new File(folder, entry.getName()); File parent = file.getParentFile(); if (parent.exists() || parent.mkdirs()) { try (OutputStream outputStream = new FileOutputStream(file)) { IOUtils.copy(inputStream, outputStream); } } else { throw new IllegalStateException("Cannot create directory: " + parent.getAbsolutePath()); } } } finally { connection.disconnect(); } }
Source:
public void shouldThrowIllegalArgumentExceptionIfRetentionIsNegative() { Materialized.as("valid-name").withRetention(Duration.of(-1, ChronoUnit.DAYS)); }

Target:
public void shouldThrowIllegalArgumentExceptionIfRetentionIsNegative() { final IllegalArgumentException e = assertThrows(IllegalArgumentException.class, () -> Materialized.as("valid-name").withRetention(Duration.of(-1, ChronoUnit.DAYS))); assertEquals(e.getMessage(), "Retention must not be negative."); }
Source:
public static String consumeNextRecordedEvent() { try { return concurrentStack.removeFirst(); } catch (java.util.NoSuchElementException nse) { throw new IllegalStateException( "Attempted to consume an event, while no events were recorded. Check if the Byteman ruless actually triggered?" ); } }

Target:
public static String consumeNextRecordedEvent() { try { return concurrentStack.removeFirst(); } catch (java.util.NoSuchElementException nse) { throw new IllegalStateException( "Attempted to consume an event, while no events are left on the stack. If it is the first call to this method, check if the Byteman rules are actually being triggered?" ); } }
Source:
private void toTelemetryTable(TelemetryRow telemetryRow) { final TableWriter.Row row = writer.newRow(); row.putDate(0, telemetryRow.ts); row.putStr(1, id); row.putShort(2, telemetryRow.event); row.append(); }

Target:
private void toTelemetryTable(TelemetryRow telemetryRow) { final TableWriter.Row row = writer.newRow(); row.putDate(0, telemetryRow.ts); row.putShort(1, telemetryRow.event); row.append(); }
Source:
public final void gauge(final String metricName, final JSONObject builddata, final String key, final HashMap<String,String> extraTags) { String builddataKey = nullSafeGetString(builddata, key); logger.fine(String.format("Sending metric '%s' with value %s", metricName, builddataKey)); JSONArray points = new JSONArray(); JSONArray point = new JSONArray(); long currentTime = System.currentTimeMillis() / DatadogBuildListener.THOUSAND_LONG; point.add(currentTime); point.add(builddata.get(key)); points.add(point); JSONObject metric = new JSONObject(); metric.put("metric", metricName); metric.put("points", points); metric.put("type", "gauge"); metric.put("host", builddata.get("hostname")); metric.put("tags", assembleTags(builddata, extraTags)); JSONArray series = new JSONArray(); series.add(metric); JSONObject payload = new JSONObject(); payload.put("series", series); logger.fine(String.format("Resulting payload: %s", payload.toString() )); try { post(payload, DatadogBuildListener.METRIC); } catch (Exception e) { logger.severe(e.toString()); } }

Target:
public final void gauge(final String metricName, final JSONObject builddata, final String key, final HashMap<String,String> extraTags) { String builddataKey = DatadogUtilities.nullSafeGetString(builddata, key); logger.fine(String.format("Sending metric '%s' with value %s", metricName, builddataKey)); JSONArray points = new JSONArray(); JSONArray point = new JSONArray(); long currentTime = System.currentTimeMillis() / DatadogBuildListener.THOUSAND_LONG; point.add(currentTime); point.add(builddata.get(key)); points.add(point); JSONObject metric = new JSONObject(); metric.put("metric", metricName); metric.put("points", points); metric.put("type", "gauge"); metric.put("host", builddata.get("hostname")); metric.put("tags", DatadogUtilities.assembleTags(builddata, extraTags)); JSONArray series = new JSONArray(); series.add(metric); JSONObject payload = new JSONObject(); payload.put("series", series); logger.fine(String.format("Resulting payload: %s", payload.toString() )); try { DatadogHttpRequests.post(payload, METRIC); } catch (Exception e) { logger.severe(e.toString()); } }
Source:
public DockerConnectorProvider(Map<String, DockerConnector> connectors, @Named("che.docker.connector") String property) { if (connectors.containsKey(property)) { this.connector = connectors.get(property); } else { LOG.warn("Property 'che.docker_connector.provider' did not match any bound implementation of DockerConnector. Using default."); LOG.warn("\t Value of che.docker_connector.provider: {}", property); LOG.warn("\t Bound implementations: {}", connectors.toString()); this.connector = connectors.get("default"); } }

Target:
public DockerConnectorProvider(Map<String, DockerConnector> connectors, @Named("che.docker.connector") String property) { if (connectors.containsKey(property)) { this.connector = connectors.get(property); } else { LOG.warn("Property 'che.docker.connector' did not match any bound implementation of DockerConnector. Using default."); LOG.warn("\t Value of 'che.docker.connector': {}", property); LOG.warn("\t Bound implementations: {}", connectors.toString()); this.connector = connectors.get("default"); } }
Source:
public static QuotaModeType fromValue(String value) { try { return valueOf(value.toUpperCase()); } catch (IllegalArgumentException e) { return null; } }

Target:
public static QuotaModeType fromValue(String value) { try { return valueOf(value.toUpperCase()); } catch (IllegalArgumentException e) { log.error("missing value: " + value, e); return null; } }
Source:
protected List<Map<String, Object>> read(final List<String> names, final String key, final String value) { logger.debug("Reading key / value: / {}", key, value); final List<Map<String, Object>> listAttributes = new ArrayList<>(); final TypeReference<HashMap<String,Object>> typeRef = new TypeReference<HashMap<String,Object>>() {}; if (key.equals(COUCH_ID)) { try { final InputStream oldDocStream = couchDbConnector.getAsStream(value); final Map<String, Object> res = objectMapper.readValue(oldDocStream, typeRef); final Map<String, Object> newAttributes = new HashMap<>(); for (final Map.Entry<String, Object> entry : res.entrySet()) { final String name = entry.getKey(); if (names == null || names.contains(name)) { newAttributes.put(name, entry.getValue()); } } listAttributes.add(newAttributes); } catch (DocumentNotFoundException e) { } catch (IOException e) { logger.error("", e); } } else { final ViewQuery query = new ViewQuery() .designDocId("_design/pac4j") .viewName("by_"+key) .key(value); final ViewResult result = couchDbConnector.queryView(query); for (ViewResult.Row row : result.getRows()) { final String stringValue = row.getValue(); Map<String, Object> res = null; try { res = objectMapper.readValue(stringValue, typeRef); final Map<String, Object> newAttributes = new HashMap<>(); for (final Map.Entry<String, Object> entry : res.entrySet()) { final String name = entry.getKey(); if (names == null || names.contains(name)) { newAttributes.put(name, entry.getValue()); } } listAttributes.add(newAttributes); } catch (IOException e) { logger.error("", e); } } } logger.debug("Found: {}", listAttributes); return listAttributes; }

Target:
protected List<Map<String, Object>> read(final List<String> names, final String key, final String value) { logger.debug("Reading key / value: / {}", key, value); final List<Map<String, Object>> listAttributes = new ArrayList<>(); final TypeReference<HashMap<String,Object>> typeRef = new TypeReference<HashMap<String,Object>>() {}; if (key.equals(COUCH_ID)) { try { final InputStream oldDocStream = couchDbConnector.getAsStream(value); final Map<String, Object> res = objectMapper.readValue(oldDocStream, typeRef); listAttributes.add(populateAttributes(res, names)); } catch (DocumentNotFoundException e) { logger.debug("Document id not found", value); } catch (IOException e) { logger.error("Unexpected IO CouchDB Exception", e); } } else { final ViewQuery query = new ViewQuery() .designDocId("_design/pac4j") .viewName("by_"+key) .key(value); final ViewResult result = couchDbConnector.queryView(query); for (ViewResult.Row row : result.getRows()) { final String stringValue = row.getValue(); Map<String, Object> res = null; try { res = objectMapper.readValue(stringValue, typeRef); listAttributes.add(populateAttributes(res, names)); } catch (IOException e) { logger.error("Unexpected IO CouchDB Exception", e); } } } logger.debug("Found: {}", listAttributes); return listAttributes; }
Source:
public void setUp() throws IOException { queryRunner = new MemoryLocalQueryRunner(ImmutableMap.of(SystemSessionProperties.DISTRIBUTED_JOIN, "false")); queryRunner.installPlugin(new GeoPlugin()); List<String> polygonValues = new ArrayList<>(); Path path = Paths.get(BenchmarkSpatialJoin.class.getClassLoader().getResource("us-states.tsv").getPath()); for (String line : Files.readAllLines(path)) { String[] parts = line.split("\t"); String name = parts[0]; String wkt = parts[1]; polygonValues.add(format("('%s', '%s')", name, wkt)); } queryRunner.execute(format("CREATE TABLE memory.default.polygons AS SELECT * FROM (VALUES %s) as t (name, wkt)", Joiner.on(",").join(polygonValues))); queryRunner.execute(format("CREATE TABLE memory.default.points AS SELECT 'p' || cast(elem AS VARCHAR) as name, xMin + (xMax - xMin) * random() as longitude, yMin + (yMax - yMin) * random() as latitude " + "FROM (SELECT -124 AS xMin, -65 AS xMax, 27 AS yMin, 49 AS yMax) CROSS JOIN UNNEST(sequence(1, %s)) AS t(elem)", pointCount)); }

Target:
public void setUp() throws IOException { queryRunner = new MemoryLocalQueryRunner(); queryRunner.installPlugin(new GeoPlugin()); Path path = Paths.get(BenchmarkSpatialJoin.class.getClassLoader().getResource("us-states.tsv").getPath()); String polygonValues = Files.lines(path) .map(line -> line.split("\t")) .map(parts -> format("('%s', '%s')", parts[0], parts[1])) .collect(Collectors.joining(",")); queryRunner.execute(format("CREATE TABLE memory.default.polygons AS SELECT * FROM (VALUES %s) as t (name, wkt)", polygonValues)); }
Source:
public void testListWithOption() { GenericQueryOptions options = new GenericQueryOptions(); options.options(0, 0, null, "test", null); List<Server> serversWithQuery = serverApi().getList(options); assertNotNull(serversWithQuery); assertFalse(serversWithQuery.isEmpty()); Assert.assertTrue(serversWithQuery.size() > 0); }

Target:
public void testListWithOption() { GenericQueryOptions options = new GenericQueryOptions(); options.options(0, 0, null, "test", null); List<Server> serversWithQuery = serverApi().list(options); assertNotNull(serversWithQuery); Assert.assertTrue(serversWithQuery.size() > 0); }
Source:
private static ExportPackageDescription[] getExportsWiredTo(ResolverBundle rb, Map<String, List<StateWire>> stateWires) { ResolverImport[] imports = rb.getImportPackages(); List<ExportPackageDescription> exportsWiredTo = new ArrayList<>(imports.length); List<StateWire> importWires = new ArrayList<>(imports.length); for (ResolverImport import1 : imports) { if (import1.getSelectedSupplier() != null) { ExportPackageDescription supplier = (ExportPackageDescription) import1.getSelectedSupplier().getBaseDescription(); exportsWiredTo.add(supplier); StateWire wire = newStateWire(rb.getBundleDescription(), import1.getVersionConstraint(), supplier.getExporter(), supplier); importWires.add(wire); } } if (stateWires != null && !importWires.isEmpty()) stateWires.put(BundleRevision.PACKAGE_NAMESPACE, importWires); return exportsWiredTo.toArray(new ExportPackageDescription[exportsWiredTo.size()]); }

Target:
private static ExportPackageDescription[] getExportsWiredTo(ResolverBundle rb, Map<String, List<StateWire>> stateWires) { ResolverImport[] imports = rb.getImportPackages(); List<ExportPackageDescription> exportsWiredTo = new ArrayList<>(imports.length); List<StateWire> importWires = new ArrayList<>(imports.length); for (ResolverImport resolverImport : imports) { if (resolverImport.getSelectedSupplier() != null) { ExportPackageDescription supplier = (ExportPackageDescription) resolverImport.getSelectedSupplier().getBaseDescription(); exportsWiredTo.add(supplier); StateWire wire = newStateWire(rb.getBundleDescription(), resolverImport.getVersionConstraint(), supplier.getExporter(), supplier); importWires.add(wire); } } if (stateWires != null && !importWires.isEmpty()) stateWires.put(BundleRevision.PACKAGE_NAMESPACE, importWires); return exportsWiredTo.toArray(new ExportPackageDescription[exportsWiredTo.size()]); }
Source:
public EmailWrapper generateUserCourseRegisterEmail(AccountAttributes user, CourseAttributes course) { String emailBody = Templates.populateTemplate(EmailTemplates.USER_COURSE_REGISTER, "${userName}", SanitizationHelper.sanitizeForHtml(user.getName()), "${courseId}", SanitizationHelper.sanitizeForHtml(course.getId()), "${courseName}", SanitizationHelper.sanitizeForHtml(course.getName()), "${googleId}", SanitizationHelper.sanitizeForHtml(user.getGoogleId()), "${supportEmail}", Config.SUPPORT_EMAIL); EmailWrapper email = getEmptyEmailAddressedToEmail(user.getEmail()); email.setSubject(String.format(EmailType.USER_COURSE_REGISTER.getSubject(), course.getId(), course.getName())); email.setContent(emailBody); return email; }

Target:
public EmailWrapper generateUserCourseRegisterEmail(AccountAttributes user, CourseAttributes course) { String emailBody = Templates.populateTemplate(EmailTemplates.USER_COURSE_REGISTER, "${userName}", SanitizationHelper.sanitizeForHtml(user.getName()), "${userType}", user.isInstructor() ? "an instructor" : "a student", "${courseId}", SanitizationHelper.sanitizeForHtml(course.getId()), "${courseName}", SanitizationHelper.sanitizeForHtml(course.getName()), "${googleId}", SanitizationHelper.sanitizeForHtml(user.getGoogleId()), "${supportEmail}", Config.SUPPORT_EMAIL); EmailWrapper email = getEmptyEmailAddressedToEmail(user.getEmail()); email.setSubject(String.format(EmailType.USER_COURSE_REGISTER.getSubject(), course.getName(), course.getId())); email.setContent(emailBody); return email; }
Source:
public void setTrustStoreConfigFromDefault() { String trustStore = System.getProperty("java.home") + File.separator + "lib" + File.separator + "security" + File.separator + "cacerts"; String trustStorePassword = "changeit"; m_sslConfig = new SSLConfiguration.SslConfig(null, null, trustStore, trustStorePassword); }

Target:
public void setTrustStoreConfigFromDefault() { String trustStore = Constants.DEFAULT_TRUSTSTORE_RESOURCE; String trustStorePassword = Constants.DEFAULT_TRUSTSTORE_PASSWD; m_sslConfig = new SSLConfiguration.SslConfig(null, null, trustStore, trustStorePassword); }
Source:
public void waitForSlotCollapsed(WebElement slot) { wait.until(CommonExpectedConditions.elementHasSize(slot, 0, 0)); }

Target:
public void waitForSlotCollapsed(WebElement slot) { changeImplicitWait(250, TimeUnit.MILLISECONDS); try { wait.until(CommonExpectedConditions.elementHasSize(slot, 0, 0)); } finally { restoreDeaultImplicitWait(); } }
Source:
public void ProcessPartitionExpVariableTest_OptionalCompulsaryPartition() throws Exception { String startTime = TimeUtil.getTimeWrtSystemTime(-4); String endTime = TimeUtil.getTimeWrtSystemTime(30); bundles[0] = bundles[0].getRequiredBundle(bundles[0], 1, 2, 1, baseTestDir, 1, startTime, endTime); bundles[0].setProcessData(bundles[0] .setProcessInputNames(bundles[0].getProcessData(), "inputData0", "inputData")); Property p = new Property(); p.setName("var1"); p.setValue("hardCoded"); bundles[0].setProcessData(bundles[0].addProcessProperty(bundles[0].getProcessData(), p)); bundles[0].setProcessData(bundles[0] .setProcessInputPartition(bundles[0].getProcessData(), "${var1}", "${fileTime}")); for (int i = 0; i < bundles[0].getDataSets().size(); i++) logger.info(Util.prettyPrintXml(bundles[0].getDataSets().get(i))); logger.info((bundles[0].getProcessData())); createDataWithinDatesAndPrefix(cluster, TimeUtil.oozieDateToDate(TimeUtil.addMinsToTime(startTime, -25)), TimeUtil.oozieDateToDate(TimeUtil.addMinsToTime(endTime, 25)), baseTestDir + "/input1/", 1); bundles[0].submitAndScheduleBundle(bundles[0], prism, false); TimeUnit.SECONDS.sleep(20); InstanceUtil.waitTillInstanceReachState(clusterOC, Util.getProcessName(bundles[0].getProcessData()), 2, CoordinatorAction.Status.SUCCEEDED, 20, ENTITY_TYPE.PROCESS); }

Target:
public void ProcessPartitionExpVariableTest_OptionalCompulsaryPartition() throws Exception { String startTime = TimeUtil.getTimeWrtSystemTime(-4); String endTime = TimeUtil.getTimeWrtSystemTime(30); bundles[0] = bundles[0].getRequiredBundle(bundles[0], 1, 2, 1, baseTestDir, 1, startTime, endTime); bundles[0].setProcessData(bundles[0] .setProcessInputNames(bundles[0].getProcessData(), "inputData0", "inputData")); Property p = new Property(); p.setName("var1"); p.setValue("hardCoded"); bundles[0].setProcessData(bundles[0].addProcessProperty(bundles[0].getProcessData(), p)); bundles[0].setProcessData(bundles[0] .setProcessInputPartition(bundles[0].getProcessData(), "${var1}", "${fileTime}")); for (int i = 0; i < bundles[0].getDataSets().size(); i++) logger.info(Util.prettyPrintXml(bundles[0].getDataSets().get(i))); logger.info(Util.prettyPrintXml(bundles[0].getProcessData())); createDataWithinDatesAndPrefix(cluster, TimeUtil.oozieDateToDate(TimeUtil.addMinsToTime(startTime, -25)), TimeUtil.oozieDateToDate(TimeUtil.addMinsToTime(endTime, 25)), baseTestDir + "/input1/", 1); bundles[0].submitAndScheduleBundle(bundles[0], prism, false); TimeUnit.SECONDS.sleep(20); InstanceUtil.waitTillInstanceReachState(clusterOC, Util.getProcessName(bundles[0].getProcessData()), 2, CoordinatorAction.Status.SUCCEEDED, 20, ENTITY_TYPE.PROCESS); }
Source:
public void HeroModuleTests_001_VerifyImageVisibilityAfterRefresh() { ModularMainPageObject mom = new ModularMainPageObject(driver); mom.logInCookie(credentials.userNameStaff, credentials.passwordStaff, wikiURL); String prevMoMSrc = mom.getMoMSrc(); mom.selectFileToUpload(PageContent.FILE); mom.verifyDragToRepositionText(); mom.clickPublishButton(); String newMoMSrc = mom.getMoMSrc(); mom.verifySrcTxtAreDifferent(prevMoMSrc, newMoMSrc); mom.refreshPage(); mom.verifySrcTxtAreDifferent(prevMoMSrc, newMoMSrc); }

Target:
public void HeroModuleTests_001_VerifyImageVisibilityAfterRefresh() { ModularMainPageObject mom = new ModularMainPageObject(driver); mom.openWikiPage(wikiURL); mom.logInCookie(credentials.userNameStaff, credentials.passwordStaff, wikiURL); String prevMoMSrc = mom.getMoMSrc(); mom.selectFileToUpload(PageContent.FILE); mom.verifyDragToRepositionText(); mom.clickPublishButton(); String newMoMSrc = mom.getMoMSrc(); mom.verifySrcTxtAreDifferent(prevMoMSrc, newMoMSrc); mom.refreshPage(); mom.verifySrcTxtAreDifferent(prevMoMSrc, newMoMSrc); }
Source:
public void onResponse(Call<ApiMeasurement> call, Response<ApiMeasurement> response) { if (response.isSuccessful() && response.body() != null && response.body().results != null && response.body().results.size() == 1 && response.body().results.get(0).measurement_url != null) { onSuccess(response.body().results.get(0)); } else { onError(Integer.toString(response.code())); } }

Target:
public void onResponse(Call<ApiMeasurement> call, Response<ApiMeasurement> response) { if (response.isSuccessful() && response.body() != null && response.body().results != null && response.body().results.size() == 1 && response.body().results.get(0).measurement_url != null) { onSuccess(response.body().results.get(0)); } else { onError(Integer.toString(R.string.Modal_Error_JsonEmpty)); } }
Source:
public void createEncounter(DateTime encounterDatetime, String encounterType, String locationName, String patientUuid, String providerUuid, Map<String, String> observations) { Location location = getLocationByName(locationName); Patient patient = patientService.getPatientByUuid(null, patientUuid); Provider provider = providerService.getProviderByUuid(null, providerUuid); List<Observation> observationList = convertObservationMapToList(observations, encounterDatetime); EncounterType type = new EncounterType(encounterType); Encounter encounter = new Encounter(location, type, encounterDatetime.toDate(), patient, provider.getPerson(), observationList); encounterService.createEncounter(null, encounter); }

Target:
public void createEncounter(DateTime encounterDatetime, String encounterType, String locationName, String patientUuid, String providerUuid, Map<String, String> observations) { Location location = getLocationByName(locationName); Patient patient = patientService.getPatientByUuid(null, patientUuid); Provider provider = providerService.getProviderByUuid(null, providerUuid); List<Observation> observationList = MapUtils.isNotEmpty(observations) ? convertObservationMapToList(observations, encounterDatetime) : null; EncounterType type = new EncounterType(encounterType); Encounter encounter = new Encounter(location, type, encounterDatetime.toDate(), patient, provider.getPerson(), observationList); encounterService.createEncounter(null, encounter); }
Source:
public void onNext(final AllocatedEvaluator allocatedEvaluator) { final int evalCount = activeEvaluatorCount.getAndIncrement(); final Configuration partialContextConf = ContextConfiguration.CONF .set(ContextConfiguration.IDENTIFIER, CONTEXT_ID_PREFIX + evalCount) .build(); final Configuration contextConf = Configurations.merge( partialContextConf, emConf.getContextConfiguration()); final Configuration serviceConf = emConf.getServiceConfiguration(); allocatedEvaluator.submitContextAndService(contextConf, serviceConf); LOG.info((evalCount + 1) + " evaluators active!"); }

Target:
public void onNext(final AllocatedEvaluator allocatedEvaluator) { final Configuration partialContextConf = ContextConfiguration.CONF .set(ContextConfiguration.IDENTIFIER, CONTEXT_ID_PREFIX + activeEvaluatorCount.getAndIncrement()) .build(); final Configuration contextConf = Configurations.merge( partialContextConf, emConf.getContextConfiguration()); final Configuration serviceConf = emConf.getServiceConfiguration(); allocatedEvaluator.submitContextAndService(contextConf, serviceConf); LOG.info(activeEvaluatorCount.get() + " evaluators active!"); }