auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void updateWorkflowsTable(List<Workflow> data) { this.workflowsTable.clear(); this.workflowsSearchInProgressMessage.setVisible(false); if (data != null && data.size() > 0) { for (Workflow workflowBean : data) { this.workflowsTable.addRow(workflowBean); <START> } <END> this.workflowsTable.setVisible(true); } else { this.workflowsNoDataMessage.setVisible(true); } }</code><technical_language>This call "setValue()" workflowsTable. reason for widget implement HasValue interface with. addRow() method visible called. need call "clear()" - method this: protected void updateWorkflowsTable(List<Workflow> data) { this.workflowsSearchInProgressMessage.setVisible(false); if (data != null && data.size() > 0) { this.workflowsTable.setValue(data); this.workflowsTable.setVisible(true); } else { this.workflowsNoDataMessage.setVisible(true); } }</technical_language>

Target:
protected void updateWorkflowsTable(List<Workflow> data) { this.workflowsTable.clear(); this.workflowsSearchInProgressMessage.setVisible(false); if (data != null && data.size() > 0) { this.workflowsTable.setValue(data); this.workflowsTable.setVisible(true); } else { this.workflowsNoDataMessage.setVisible(true); } }
Source:
<code>private boolean doesAlertExist(String citationNumber, String phoneNumber){ Map<String, Object> parameterMap = new HashMap<String, Object>(); parameterMap.put("citationNumber", citationNumber); parameterMap.put("phoneNumber", phoneNumber); <START> String sql = "SELECT * FROM sms_alerts WHERE citation_number = :citationNumber AND phone_number = :phoneNumber"; <END> try{ jdbcTemplate.queryForObject(sql, parameterMap, new SMSAlertSQLMapper()); return true; }catch(IncorrectResultSizeDataAccessException irsdae){ return false; }catch(Exception e){ LogSystem.LogDBException(e); return false; } }</code><technical_language>great if put this query in sql file started in other areas. code separate sql</technical_language>

Target:
private boolean doesAlertExist(String citationNumber, String phoneNumber){ Map<String, Object> parameterMap = new HashMap<String, Object>(); parameterMap.put("citationNumber", citationNumber); parameterMap.put("phoneNumber", phoneNumber); try{ jdbcTemplate.queryForObject(getSql("SMSAlert/check-for-existing-SMSAlert.sql"), parameterMap, new SMSAlertSQLMapper()); return true; }catch(IncorrectResultSizeDataAccessException irsdae){ return false; }catch(Exception e){ LogSystem.LogDBException(e); return false; } }
Source:
<code>protected ILogData read(final long address, long readStartTime) { try { if (System.currentTimeMillis() - readStartTime < runtime.getParameters().getHoleFillTimeout().toMillis()) { return runtime.getAddressSpaceView().read(address); } return runtime.getAddressSpaceView() <START> .read(Collections.singleton(address)) <END> .get(address); } catch (TrimmedException te) { processTrimmedException(te); throw te; } }</code><technical_language>is this behavior changed? waitForWrite, waits instead. Is true</technical_language>

Target:
protected ILogData read(final long address, long readStartTime) { try { if (System.currentTimeMillis() - readStartTime < runtime.getParameters().getHoleFillTimeout().toMillis()) { return runtime.getAddressSpaceView().read(address); } return runtime.getAddressSpaceView() .read(Collections.singleton(address), false, false) .get(address); } catch (TrimmedException te) { processTrimmedException(te); throw te; } }
Source:
<code>protected boolean isMavenBuild(final AbstractBuild<?, ?> build) { AbstractBuild aBuild = (AbstractBuild) build; if (aBuild.getProject() instanceof Project) { <START> Project<?, ?> project = (Project<?, ?>) aBuild.getProject(); <END> for (Builder builder : project.getBuilders()) { if (builder instanceof Maven) { return true; } } } return false; }</code><technical_language>sense. this method untouched (other deprecation)</technical_language>

Target:
protected boolean isMavenBuild(final AbstractBuild<?, ?> build) { if (build.getProject() instanceof Project) { Project<?, ?> project = (Project<?, ?>)build.getProject(); for (Builder builder : project.getBuilders()) { if (builder instanceof Maven) { return true; } } } return false; }
Source:
<code>public void start() { LOG.info("Start TaskScheduler"); isLeaf = stage.getMasterPlan().isLeaf(stage.getBlock()); <START> if (!isLeaf) { <END> candidateWorkers.addAll(getWorkerIds(getLeafTaskHosts())); } else { List<ExecutionBlock> executionBlockList = stage.getMasterPlan().getChilds(stage.getBlock()); for (ExecutionBlock executionBlock : executionBlockList) { Stage childStage = stage.getContext().getStage(executionBlock.getId()); candidateWorkers.addAll(childStage.getAssignedWorkerMap().keySet()); } } this.schedulingThread = new Thread() { public void run() { while (!isStopped && !Thread.currentThread().isInterrupted()) { try { schedule(); } catch (Throwable e) { LOG.fatal(e.getMessage(), e); stage.abort(StageState.ERROR); break; } } LOG.info("TaskScheduler schedulingThread stopped"); } }; this.schedulingThread.start(); super.start(); }</code><technical_language>Please fix this condition</technical_language>

Target:
public void start() { LOG.info("Start TaskScheduler"); maximumRequestContainer = tajoConf.getInt(REQUEST_MAX_NUM, stage.getContext().getWorkerMap().size() * 2); isLeaf = stage.getMasterPlan().isLeaf(stage.getBlock()); if (isLeaf) { candidateWorkers.addAll(getWorkerIds(getLeafTaskHosts())); } else { List<ExecutionBlock> executionBlockList = stage.getMasterPlan().getChilds(stage.getBlock()); for (ExecutionBlock executionBlock : executionBlockList) { Stage childStage = stage.getContext().getStage(executionBlock.getId()); candidateWorkers.addAll(childStage.getAssignedWorkerMap().keySet()); } } this.schedulingThread = new Thread() { public void run() { while (!isStopped && !Thread.currentThread().isInterrupted()) { try { schedule(); } catch (InterruptedException e) { if (isStopped) { break; } else { LOG.fatal(e.getMessage(), e); stage.abort(StageState.ERROR); } } catch (Throwable e) { LOG.fatal(e.getMessage(), e); stage.abort(StageState.ERROR); break; } } LOG.info("TaskScheduler schedulingThread stopped"); } }; this.schedulingThread.start(); super.start(); }
Source:
<code>protected void decorateIdentity(List<Object> identifiers) { identifiers.add(columnNameLineNumber); identifiers.add(skipEmptyLines); identifiers.add(skipEmptyColumns); <START> identifiers.add(detectColumnTypes); <END> }</code><technical_language>add numberOfLinesToScan identifiers</technical_language>

Target:
protected void decorateIdentity(List<Object> identifiers) { identifiers.add(columnNameLineNumber); identifiers.add(skipEmptyLines); identifiers.add(skipEmptyColumns); identifiers.add(detectColumnTypes); identifiers.add(numberOfLinesToScan); }
Source:
<code>public void replaceAtHead(K key, Chain expected, Chain replacement) { final Lock lock = heads.writeLock(); lock.lock(); try { while (true) { InternalChain chain = heads.get(key); if (chain == null) { <START> if (expected.iterator().hasNext()) { <END> return; } else { throw new IllegalArgumentException("Empty expected sequence"); } } else { try { if (chain.replace(expected, replacement)) { return; } else { evict(); } } finally { chain.close(); } } } } finally { lock.unlock(); } }</code><technical_language>!expected.isEmpty() ? a waste create Iterator used</technical_language>

Target:
public void replaceAtHead(K key, Chain expected, Chain replacement) { final Lock lock = heads.writeLock(); lock.lock(); try { while (true) { InternalChain chain = heads.get(key); if (chain == null) { if (expected.isEmpty()) { throw new IllegalArgumentException("Empty expected sequence"); } else { return; } } else { try { if (chain.replace(expected, replacement)) { return; } else { evict(); } } finally { chain.close(); } } } } finally { lock.unlock(); } }
Source:
<code>private TimeUnit validate(TimeUnit timeUnit) { switch (timeUnit) { case MICROSECOND: <START> case MILLISECOND: <END> case SECOND: case MINUTE: case HOUR: case DAY: case WEEK: case MONTH: case QUARTER: case YEAR: case ISOYEAR: return timeUnit; default: throw new RuntimeException(" Time unit " + timeUnit + "is not supported now."); } }</code><technical_language>"not supported" -> "not supported for BigQuery"</technical_language>

Target:
private TimeUnit validate(TimeUnit timeUnit) { switch (timeUnit) { case MICROSECOND: case MILLISECOND: case SECOND: case MINUTE: case HOUR: case DAY: case WEEK: case MONTH: case QUARTER: case YEAR: case ISOYEAR: return timeUnit; default: throw new RuntimeException("Time unit " + timeUnit + " is not supported for BigQuery."); } }
Source:
<code>public void deleteBucket(String name) throws RepoException { Lock writeLock = this.rwLocks.get(name).writeLock(); writeLock.lock(); boolean rollback = false; <START> boolean bucketDeletetion = false; <END> Bucket bucket = new Bucket(name); try { sqlService.getConnection(); rollback = true; if (sqlService.getBucket(name) == null) throw new RepoException(RepoException.Type.BucketNotFound); if (Boolean.FALSE.equals(objectStore.bucketExists(bucket))) throw new RepoException("Bucket exists in database but not in object store: " + name); if (sqlService.listObjects(name, 0, 1, true, null).size() != 0) throw new RepoException(RepoException.Type.CantDeleteNonEmptyBucket); bucketDeletetion = objectStore.deleteBucket(bucket); if (Boolean.FALSE.equals(bucketDeletetion)) throw new RepoException("Unable to delete bucket in object store: " + name); if (sqlService.deleteBucket(name) == 0) throw new RepoException("Unable to delete bucket in database: " + name); sqlService.transactionCommit(); rollback = false; } catch (SQLException e) { throw new RepoException(e); } finally { if (rollback) { sqlRollback("bucket " + name); if (bucketDeletetion) { objectStore.createBucket(bucket); } } sqlReleaseConnection(); writeLock.unlock(); } }</code><technical_language>bucketDeletion</technical_language>

Target:
public void deleteBucket(String name) throws RepoException { Lock writeLock = this.rwLocks.get(name).writeLock(); writeLock.lock(); boolean rollback = false; boolean bucketDeletion = false; Bucket bucket = new Bucket(name); try { sqlService.getConnection(); rollback = true; if (sqlService.getBucket(name) == null) throw new RepoException(RepoException.Type.BucketNotFound); if (Boolean.FALSE.equals(objectStore.bucketExists(bucket))) throw new RepoException("Bucket exists in database but not in object store: " + name); if (sqlService.listObjects(name, 0, 1, true, null).size() != 0) throw new RepoException(RepoException.Type.CantDeleteNonEmptyBucket); bucketDeletion = objectStore.deleteBucket(bucket); if (Boolean.FALSE.equals(bucketDeletion)) throw new RepoException("Unable to delete bucket in object store: " + name); if (sqlService.deleteBucket(name) == 0) throw new RepoException("Unable to delete bucket in database: " + name); sqlService.transactionCommit(); rollback = false; } catch (SQLException e) { throw new RepoException(e); } finally { if (rollback) { sqlRollback("bucket " + name); if (bucketDeletion) { objectStore.createBucket(bucket); } } sqlReleaseConnection(); writeLock.unlock(); } }
Source:
<code>String escapedJson(final User user) { <START> final LookupTranslator translator = new LookupTranslator(new String[][]{{"\"", "\\\""}}); <END> final String rawJson = ServerMarshalling.toJSON(user); return translator.translate(rawJson); }</code><technical_language>protecting of double-quotes in User's Roles/Groups; protecting \ too? Also, a String.replaceAll(...) sufficient? LookupTranslator bring new table!!</technical_language>

Target:
String escapedJson(final User user) { final String rawJson = ServerMarshalling.toJSON(user); return rawJson.replaceAll("\\\\\"","\\\\\\\\\"").replaceAll("\"","\\\\\""); }
Source:
<code>protected boolean checkContractsAndGrantsSetupForNonEmptyNewAccountsList(SubAccountGlobal subAccountGlobal) { boolean success = true; boolean allAccountsAreForContractsAndGrants = true; boolean atLeastOneAccountIsForContractsAndGrants = false; for (SubAccountGlobalNewAccountDetail newAccountDetail : subAccountGlobal.getSubAccountGlobalNewAccountDetails()) { boolean currentAccountIsForContractsAndGrants = accountIsForContractsAndGrants(newAccountDetail); allAccountsAreForContractsAndGrants &= currentAccountIsForContractsAndGrants; <START> atLeastOneAccountIsForContractsAndGrants |= currentAccountIsForContractsAndGrants; <END> } if (!allAccountsAreForContractsAndGrants && atLeastOneAccountIsForContractsAndGrants) { putGlobalError(CUKFSKeyConstants.ERROR_DOCUMENT_SUB_ACCOUNT_GLOBAL_CG_AND_NON_CG_MIX); success = false; } else if (allAccountsAreForContractsAndGrants) { if (StringUtils.equals(KFSConstants.SubAccountType.COST_SHARE, subAccountGlobal.getNewSubAccountTypeCode())) { success &= checkCgCostSharingForNewAccounts(subAccountGlobal); } else if (StringUtils.equals(KFSConstants.SubAccountType.EXPENSE, subAccountGlobal.getNewSubAccountTypeCode())) { success &= checkIndirectCostRecoveryFieldsHaveValuesForCgExpenseAccounts(subAccountGlobal); success &= checkCgIcrRules(subAccountGlobal.getNewSubAccountTypeCode()); } } else { success &= checkCgFieldsAreEmptyForNonCgAccounts(subAccountGlobal); } return success; }</code><technical_language>concerned this is confusing. creating integers for cgAccountCount nonCgAccountCount. In for loop increment counters appropriate. check if integers gerater zero, if so, error. in else statement do currently coded</technical_language>

Target:
protected boolean checkContractsAndGrantsSetupForNonEmptyNewAccountsList(SubAccountGlobal subAccountGlobal) { boolean success = true; List<SubAccountGlobalNewAccountDetail> newAccountDetails = subAccountGlobal.getSubAccountGlobalNewAccountDetails(); int numberOfAccountsForContractsAndGrants = (int) newAccountDetails.stream() .filter(this::accountIsForContractsAndGrants) .count(); boolean allAccountsAreForContractsAndGrants = (numberOfAccountsForContractsAndGrants == newAccountDetails.size()); boolean noneOfAccountsAreForContractsAndGrants = (numberOfAccountsForContractsAndGrants == 0); if (allAccountsAreForContractsAndGrants) { if (StringUtils.equals(KFSConstants.SubAccountType.COST_SHARE, subAccountGlobal.getNewSubAccountTypeCode())) { success &= checkCgCostSharingForNewAccounts(subAccountGlobal); } else if (StringUtils.equals(KFSConstants.SubAccountType.EXPENSE, subAccountGlobal.getNewSubAccountTypeCode())) { success &= checkIndirectCostRecoveryFieldsHaveValuesForCgExpenseAccounts(subAccountGlobal); success &= checkCgIcrRules(subAccountGlobal.getNewSubAccountTypeCode()); } } else if (noneOfAccountsAreForContractsAndGrants) { success &= checkCgFieldsAreEmptyForNonCgAccounts(subAccountGlobal); } else { putGlobalError(CUKFSKeyConstants.ERROR_DOCUMENT_SUB_ACCOUNT_GLOBAL_CG_AND_NON_CG_MIX); success = false; } return success; }
Source:
<code>protected void executeCommand() { <START> AtomicInteger count <END> = new AtomicInteger(1); List<ActionParametersBase> params = vdsIds.stream() .map(id -> new PersistentHostSetupNetworksParameters(id, vdsIds.size(), count.getAndIncrement())) .collect(Collectors.toList()); runInternalMultipleActions(ActionType.SyncAllHostNetworks, params); setSucceeded(true); }</code><technical_language>AtomicInteger instead of int</technical_language>

Target:
protected void executeCommand() { if (outOfSyncHostsExist()) { AtomicInteger count = new AtomicInteger(1); List<ActionParametersBase> params = vdsIds.stream() .map(id -> new PersistentHostSetupNetworksParameters(id, vdsIds.size(), count.getAndIncrement())) .collect(Collectors.toList()); runInternalMultipleActions(ActionType.SyncAllHostNetworks, params); } setSucceeded(true); }
Source:
<code>@Test public void testUnionPlan2() { CalciteAssert.model(JdbcTest.FOODMART_SCOTT_MODEL) <START> .query("select \"store_name\" from \"foodmart\".\"store\"\n" <END> + "union all\n" + "select ename from SCOTT.emp") .explainContains("PLAN=EnumerableUnion(all=[true])\n" + " JdbcToEnumerableConverter\n" + " JdbcProject(store_name=[$3])\n" + " JdbcTableScan(table=[[foodmart, store]])\n" + " JdbcToEnumerableConverter\n" + " JdbcProject(ENAME=[$1])\n" + " JdbcTableScan(table=[[SCOTT, EMP]])\n") .runs() .enable(CalciteAssert.DB == CalciteAssert.DatabaseInstance.HSQLDB) .planHasSql("SELECT \"store_name\"\n" + "FROM \"foodmart\".\"store\"") .planHasSql("SELECT \"ENAME\"\n" + "FROM \"SCOTT\".\"EMP\""); }</code><technical_language>query (adding some filter) slightly more complicated show effect of more rules. For instance "select \"store_name\" \"foodmart\".\"store\"\n" + "where \"store_name\" = 'Store 1'\n" + "union all\n" + "select ename SCOTT.emp sal > 0"</technical_language>

Target:
@Test public void testUnionPlan2() { CalciteAssert.model(JdbcTest.FOODMART_SCOTT_MODEL) .query("select \"store_name\" from \"foodmart\".\"store\" where \"store_id\" < 10\n" + "union all\n" + "select ename from SCOTT.emp where empno > 10") .explainContains("PLAN=EnumerableUnion(all=[true])\n" + " JdbcToEnumerableConverter\n" + " JdbcProject(store_name=[$3])\n" + " JdbcFilter(condition=[<($0, 10)])\n" + " JdbcTableScan(table=[[foodmart, store]])\n" + " JdbcToEnumerableConverter\n" + " JdbcProject(ENAME=[$1])\n" + " JdbcFilter(condition=[>($0, 10)])\n" + " JdbcTableScan(table=[[SCOTT, EMP]])") .runs() .enable(CalciteAssert.DB == CalciteAssert.DatabaseInstance.HSQLDB) .planHasSql("SELECT \"store_name\"\n" + "FROM \"foodmart\".\"store\"\n" + "WHERE \"store_id\" < 10") .planHasSql("SELECT \"ENAME\"\n" + "FROM \"SCOTT\".\"EMP\"\n" + "WHERE \"EMPNO\" > 10"); }
Source:
<code>public ControlFlowEntry(int quark, LttngKernelTrace trace, String execName, int threadId, int parentThreadId, long startTime, long endTime) { <START> super(quark, trace, execName, startTime, endTime); <END> fThreadId = threadId; fParentThreadId = parentThreadId; }</code><technical_language>prefer store quark a member of this class getThreadQuark method</technical_language>

Target:
public ControlFlowEntry(int quark, LttngKernelTrace trace, String execName, int threadId, int parentThreadId, long startTime, long endTime) { super(quark, trace, execName, startTime, endTime); fThreadId = threadId; fParentThreadId = parentThreadId; fThreadQuark = quark; }
Source:
<code>static DownloadError createNetworkError(String networkErrorCause) { String networkErrorMessage = String.format( "Network error, cannot download file. Cause: %s", networkErrorCause ); return new DownloadError(DownloadError.Type.NETWORK_ERROR_CANNOT_DOWNLOAD_FILE, networkErrorMessage); <START> } <END></code><technical_language>trivial errors produced in millions (hopefully) I thought mention format is efficient standard concatenation: <LINK_0></technical_language>

Target:
static DownloadError createNetworkError(String networkErrorCause) { String networkErrorMessage = "Network error, cannot download file. Cause: " + networkErrorCause; return new DownloadError(DownloadError.Type.NETWORK_ERROR_CANNOT_DOWNLOAD_FILE, networkErrorMessage); }
Source:
<code>public void checkSyncUpstreamsState(LoadBalancerRequestId loadBalancerRequestId, String singularityRequestId) { Retryer<BaragonRequestState> syncingRetryer = RetryerBuilder.<BaragonRequestState>newBuilder() .retryIfException() .withWaitStrategy(WaitStrategies.fixedWait(1, TimeUnit.SECONDS)) .retryIfResult(baragonRequestStateIsWaiting) .build(); try { BaragonRequestState syncUpstreamsState = syncingRetryer.call(() -> lbClient.getState(loadBalancerRequestId).getLoadBalancerState()); if (syncUpstreamsState == BaragonRequestState.SUCCESS){ LOG.info("Syncing upstreams for singularity request is {}. Load balancer request id is {}.", singularityRequestId, syncUpstreamsState.name(), loadBalancerRequestId.toString()); } else { LOG.error("Syncing upstreams for singularity request is {}. Load balancer request id is {}.", singularityRequestId, syncUpstreamsState.name(), loadBalancerRequestId.toString()); } } catch (Exception e) { <START> LOG.error("message", e); <END> } }</code><technical_language>Note update logging eventually, e.g. 'Could sync state for request id {}', requestid, e</technical_language>

Target:
private void checkSyncUpstreamsState(LoadBalancerRequestId loadBalancerRequestId, String singularityRequestId) { Retryer<SingularityLoadBalancerUpdate> syncingRetryer = RetryerBuilder.<SingularityLoadBalancerUpdate>newBuilder() .retryIfException() .withWaitStrategy(WaitStrategies.fixedWait(1, TimeUnit.SECONDS)) .retryIfResult(IS_WAITING_STATE) .build(); try { LOG.info("Checking load balancer request to sync upstreams for service using a retryer until the request state is no longer waiting.", singularityRequestId); SingularityLoadBalancerUpdate syncUpstreamsState = syncingRetryer.call(() -> lbClient.getState(loadBalancerRequestId)); if (syncUpstreamsState.getLoadBalancerState() == BaragonRequestState.SUCCESS){ LOG.debug("Syncing upstreams for singularity request is {}.", singularityRequestId, syncUpstreamsState); } else { LOG.error("Syncing upstreams for singularity request is {}.", singularityRequestId, syncUpstreamsState); } } catch (Exception e) { LOG.error("Could not check sync upstream state for singularity request {}. ", singularityRequestId, e); } }
Source:
<code>public boolean isIdentifiedBy(String variant) { <START> return variant == null && this.variant == null || Objects.nonNull(this.variant) && this.variant.equals(variant); <END> }</code><technical_language>comparing null replaced Objects.isNull Objects.nonNull</technical_language>

Target:
public boolean isIdentifiedBy(String variant) { return Objects.isNull(variant) && Objects.isNull(this.variant) || Objects.nonNull(this.variant) && this.variant.equals(variant); }
Source:
<code>public void testDefaults() { <START> assertRecordedDefaults(ConfigAssertions.recordDefaults(FileSessionPropertyManagerConfig.class) <END> .setConfigFile(null)); }</code><technical_language>Nit: static import recordDefaults</technical_language>

Target:
public void testDefaults() { assertRecordedDefaults(recordDefaults(FileSessionPropertyManagerConfig.class) .setConfigFile(null)); }
Source:
<code>private HttpServiceResponse handlePutStatus(HttpServiceRequest request, LedgerUnderreplicationManager ledgerUnderreplicationManager) throws Exception { Map<String, String> params = ObjectUtils.defaultIfNull(request.getParams(), Collections.emptyMap()); String enabled = params.get("enabled"); <START> if (enabled == null) { <END> return new HttpServiceResponse("Param 'enabled' not found in " + params, HttpServer.StatusCode.INTERNAL_ERROR); } if (Boolean.parseBoolean(enabled)) { if (!ledgerUnderreplicationManager.isLedgerReplicationEnabled()) { ledgerUnderreplicationManager.enableLedgerReplication(); } } else { if (ledgerUnderreplicationManager.isLedgerReplicationEnabled()) { ledgerUnderreplicationManager.disableLedgerReplication(); } } String body = JsonUtil.toJson(ImmutableMap.of("enabled", ledgerUnderreplicationManager.isLedgerReplicationEnabled())); return new HttpServiceResponse(body, HttpServer.StatusCode.OK); }</code><technical_language>Extra check if equals "true" "false"</technical_language>

Target:
private HttpServiceResponse handlePutStatus(HttpServiceRequest request, LedgerUnderreplicationManager ledgerUnderreplicationManager) throws Exception { Map<String, String> params = ObjectUtils.defaultIfNull(request.getParams(), Collections.emptyMap()); String enabled = params.get("enabled"); if (enabled == null) { return new HttpServiceResponse("Param 'enabled' not found in " + params, HttpServer.StatusCode.BAD_REQUEST); } if (Boolean.parseBoolean(enabled)) { if (!ledgerUnderreplicationManager.isLedgerReplicationEnabled()) { ledgerUnderreplicationManager.enableLedgerReplication(); } } else { if (ledgerUnderreplicationManager.isLedgerReplicationEnabled()) { ledgerUnderreplicationManager.disableLedgerReplication(); } } String body = JsonUtil.toJson(ImmutableMap.of("enabled", ledgerUnderreplicationManager.isLedgerReplicationEnabled())); return new HttpServiceResponse(body, HttpServer.StatusCode.OK); }
Source:
<code>private void assureVectorSize() { int requiredVectorLength = min(nextBatchSize, MAX_BATCH_SIZE); if (secondsVector.length < requiredVectorLength) { secondsVector = new long[requiredVectorLength]; nanosVector = new long[requiredVectorLength]; <START> systemMemoryContext.setBytes(requiredVectorLength * 16); <END> } }</code><technical_language>constants in airlift SizeOf</technical_language>

Target:
private void assureVectorSize() { int requiredVectorLength = min(nextBatchSize, MAX_BATCH_SIZE); if (secondsVector.length < requiredVectorLength) { secondsVector = new long[requiredVectorLength]; nanosVector = new long[requiredVectorLength]; systemMemoryContext.setBytes(getRetainedSizeInBytes()); } }
Source:
<code><START> protected void setConsumerBatchEnabled(boolean consumerBatchEnabled) { <END> this.consumerBatchEnabled = consumerBatchEnabled; }</code><technical_language>is this protected ? detect this option internally @RabbitListener(Handler) method signature</technical_language>

Target:
public void setConsumerBatchEnabled(boolean consumerBatchEnabled) { this.consumerBatchEnabled = consumerBatchEnabled; }
Source:
<code>private String decodeAlarm(String value) { <START> if (value == "tracker") { <END> return null; } else if (value == "help me") { return Position.ALARM_SOS; } else if (value == "low battery") { return Position.ALARM_LOW_BATTERY; } else if (value == "stockade") { return Position.ALARM_GEOFENCE; } else if (value == "move") { return Position.ALARM_MOVEMENT; } else if (value == "speed") { return Position.ALARM_OVERSPEED; } return null; }</code><technical_language>Do switch instead of ifs. Also, compare strings in Java</technical_language>

Target:
private String decodeAlarm(String value) { switch (value) { case "tracker": return null; case "help me": return Position.ALARM_SOS; case "low battery": return Position.ALARM_LOW_BATTERY; case "stockade": return Position.ALARM_GEOFENCE; case "move": return Position.ALARM_MOVEMENT; case "speed": return Position.ALARM_OVERSPEED; default: return null; } }
Source:
<code>public void deleteProjects(List<Project> projects) { EKBCommit commit = getEKBCommit(); preparePersistenceAccess(); for (Project project : projects) { <START> List<Project> result = queryService.queryByString(Project.class, "name:\"" + project.getName() + "\""); <END> if (result.size() == 0) { LOGGER.warn("Project {1} does not exist.", project.getName()); } else { commit.addDelete(project); } deleteAllAssignmentsForProject(project); } persistService.commit(commit); revokePersistenceAccess(); }</code><technical_language>query(QueryRequest) method</technical_language>

Target:
public void deleteProjects(List<Project> projects) { EKBCommit commit = getEKBCommit(); preparePersistenceAccess(); for (Project project : projects) { List<Project> result = queryService.query(Project.class, QueryRequest.query("name", project.getName())); if (result.size() == 0) { LOGGER.warn("Project {1} does not exist.", project.getName()); } else { commit.addDelete(project); } deleteAllAssignmentsForProject(project); } persistService.commit(commit); revokePersistenceAccess(); }
Source:
<code>public void scan() { for (HiddenFile file : hfList) { if (isStop()) { if (LOG.isDebugEnabled()) { LOG.debug("Scanner " + getName() + " stopping."); } return; } HttpMessage testMsg = sendHiddenFileRequest(file); if (testMsg == null) { continue; } int statusCode = testMsg.getResponseHeader().getStatusCode(); <START> String responseBody = testMsg.getResponseBody().toString(); <END> if (statusCode == HttpStatusCode.OK) { boolean matches = doesNotMatch(responseBody, file.getNotContent()) && doesMatch(responseBody, file.getContent()) && doesBinRegexMatch(responseBody, file.getBinRegex()); if (matches) { raiseAlert(testMsg, Alert.CONFIDENCE_HIGH, getRisk(), file); } if (!matches) { raiseAlert(testMsg, Alert.CONFIDENCE_LOW, getRisk(), file); } } else if (statusCode == HttpStatusCode.UNAUTHORIZED || statusCode == HttpStatusCode.FORBIDDEN) { raiseAlert(testMsg, Alert.CONFIDENCE_LOW, Alert.RISK_INFO, file); } } }</code><technical_language>if statement</technical_language>

Target:
public void scan() { for (HiddenFile file : hfList) { if (isStop()) { if (LOG.isDebugEnabled()) { LOG.debug("Scanner " + getName() + " stopping."); } return; } HttpMessage testMsg = sendHiddenFileRequest(file); if (testMsg == null) { continue; } int statusCode = testMsg.getResponseHeader().getStatusCode(); if (statusCode == HttpStatusCode.OK) { String responseBody = testMsg.getResponseBody().toString(); boolean matches = doesNotMatch(responseBody, file.getNotContent()) && doesMatch(responseBody, file.getContent()) && doesBinaryMatch(responseBody, file.getBinary()); raiseAlert( testMsg, matches ? Alert.CONFIDENCE_HIGH : Alert.CONFIDENCE_LOW, getRisk(), file); } else if (statusCode == HttpStatusCode.UNAUTHORIZED || statusCode == HttpStatusCode.FORBIDDEN) { raiseAlert(testMsg, Alert.CONFIDENCE_LOW, Alert.RISK_INFO, file); } } }
Source:
<code>public void fetchEndOffsetsShouldRethrowRuntimeExceptionAsStreamsException() { final Admin adminClient = EasyMock.createMock(AdminClient.class); EasyMock.expect(adminClient.listOffsets(EasyMock.anyObject())).andThrow(new RuntimeException()); replay(adminClient); <START> assertThrows(StreamsException.class, () -> fetchEndOffsets(emptyList(), adminClient, 60_000L)); <END> verify(adminClient); }</code><technical_language>pass in MAX_VALUE avoid introducing test flakyness</technical_language>

Target:
public void fetchEndOffsetsShouldRethrowRuntimeExceptionAsStreamsException() { final Admin adminClient = EasyMock.createMock(AdminClient.class); EasyMock.expect(adminClient.listOffsets(EasyMock.anyObject())).andThrow(new RuntimeException()); replay(adminClient); assertThrows(StreamsException.class, () -> fetchEndOffsets(emptyList(), adminClient)); verify(adminClient); }
Source:
<code>public String getStatus(String sessionId, String jobId) throws TException { if (interpreterGroup == null) { return Status.UNKNOWN.name(); } synchronized (interpreterGroup) { List<Interpreter> interpreters = interpreterGroup.get(sessionId); if (interpreters == null) { return Status.UNKNOWN.name(); } for (Interpreter intp : interpreters) { <START> if (((LazyOpenInterpreter) intp).isOpen()) { <END> Job job = intp.getScheduler().getJob(jobId); if (job != null) { return job.getStatus().name(); } } } } return Status.UNKNOWN.name(); }</code><technical_language>moment I view source code. A instanceof avoid a ClassCastException</technical_language>

Target:
public String getStatus(String sessionId, String jobId) throws TException { if (interpreterGroup == null) { return Status.UNKNOWN.name(); } synchronized (interpreterGroup) { List<Interpreter> interpreters = interpreterGroup.get(sessionId); if (interpreters == null) { return Status.UNKNOWN.name(); } for (Interpreter intp : interpreters) { Scheduler scheduler = intp.getScheduler(); if (scheduler != null) { Job job = scheduler.getJob(jobId); if (job != null) { return job.getStatus().name(); } } } } return Status.UNKNOWN.name(); }
Source:
<code>public boolean isEmpty() { <START> return size - toRemove.size() == 0; <END> }</code><technical_language>want add assert size - toRemove.size() >= 0; (my genIntellijRuns task enables assertions default)</technical_language>

Target:
public boolean isEmpty() { int amount = size - toRemove.size(); assert (amount >= 0); return amount == 0; }
Source:
<code>public static void loadClasses(ClassLoader classLoader, String pathToJar) throws IOException, ClassNotFoundException { final URLClassLoader cl = ClassLoaderUtils.getURLClassLoader(classLoader); ClassLoaderUtils.addURLToURLClassLoader(cl, new URL[]{ new URL("jar:file:" + pathToJar + "!/") }); <START> final JarFile jarFile = new JarFile(pathToJar); <END> final Enumeration<JarEntry> e = jarFile.entries(); while (e.hasMoreElements()) { final JarEntry je = e.nextElement(); if (je.isDirectory() || !je.getName().endsWith(".class")) { continue; } String className = je.getName().substring(0, je.getName().length() - 6); className = className.replace('/', '.'); cl.loadClass(className); } }</code><technical_language>@fuss86 : I another this stream closed properly, leak resources gradually OutOfMemoryError</technical_language>

Target:
public static void loadClasses(ClassLoader classLoader, String pathToJar) throws IOException, ClassNotFoundException { final URLClassLoader cl = ClassLoaderUtils.getURLClassLoader(classLoader); ClassLoaderUtils.addURLToURLClassLoader(cl, new URL[]{ new URL("jar:file:" + pathToJar + "!/") }); try (final JarFile jarFile = new JarFile(pathToJar)) { final Enumeration<JarEntry> e = jarFile.entries(); while (e.hasMoreElements()) { final JarEntry je = e.nextElement(); if (je.isDirectory() || !je.getName().endsWith(".class")) { continue; } String className = je.getName().substring(0, je.getName().length() - 6); className = className.replace('/', '.'); cl.loadClass(className); } } }
Source:
<code>public void onBlockBreak(BlockBreakEvent e) { <START> Talisman.checkFor(e, SlimefunItems.TALISMAN_CAVEMAN); <END> }</code><technical_language>For redundancy foremost for performance reasons, a check Player a Haste effect running</technical_language>

Target:
public void onBlockBreak(BlockBreakEvent e) { if (e.getBlock().getType().name().endsWith("_ORE")) { Talisman.checkFor(e, SlimefunItems.TALISMAN_CAVEMAN); } }
Source:
<code>private List<Project.NameKey> getAllParents(final Project.NameKey projectName) { final List<Project.NameKey> parents = new ArrayList<Project.NameKey>(); final ProjectState e = projectCache.get(projectName); if (e != null) { final Project.NameKey parentName = getParentName(e.getProject()); if (parentName != null) { parents.add(parentName); <START> parents.addAll(getAllParents(parentName)); <END> } } return parents; }</code><technical_language>I implemented this method non-recursive simple while loop. parent line is linear simple. In addition, non-recursive implementation avoid creation of a new ArrayList for level in parent line</technical_language>

Target:
private List<Project.NameKey> getAllParents(final Project.NameKey projectName) { final List<Project.NameKey> parents = new ArrayList<Project.NameKey>(); Project.NameKey p = projectName; while (p != null) { final ProjectState e = projectCache.get(p); if (e == null) { break; } final Project.NameKey parentName = getParentName(e.getProject()); if (parentName != null) { parents.add(parentName); } p = parentName; } return parents; }
Source:
<code>public void log(Event event) { if (System.nanoTime() - lastMCEventsPollNanos > MC_EVENTS_WINDOW_NANOS) { <START> mcEvents.clear(); <END> } else { mcEvents.offer(event); } if (eventListener != null) { eventListener.onEventLogged(event); } }</code><technical_language>this loose WAN (or other if exists) events if is a >30s hiccup</technical_language>

Target:
public void log(Event event) { if (System.nanoTime() - lastMCEventsPollNanos > MC_EVENTS_WINDOW_NANOS) { onMCEventWindowExceeded(); } else { mcEvents.offer(event); } if (eventListener != null) { eventListener.onEventLogged(event); } }
Source:
<code>public void request(long n) { long _c; if (n == Long.MAX_VALUE) { _c = REQUESTED_UPDATER.getAndSet(this, Long.MAX_VALUE); } else { for (;;) { _c = requested; if (_c == Long.MAX_VALUE) { return; } <START> if (REQUESTED_UPDATER.compareAndSet(this, _c, _c + n)) { <END> break; } } } if (!emittingStarted) { return; } emit(_c); }</code><technical_language>This getAndAdd CAS retry loop</technical_language>

Target:
public void request(long n) { if (requested == Long.MAX_VALUE) { return; } long _c; if (n == Long.MAX_VALUE) { _c = REQUESTED_UPDATER.getAndSet(this, Long.MAX_VALUE); } else { _c = REQUESTED_UPDATER.getAndAdd(this, n); } if (!emittingStarted) { return; } emit(_c); }
Source:
<code>@Override protected void onHandleWork(@NonNull Intent intent) { List<ReadingListPage> pagesToSave = ReadingListDbHelper.instance().getAllPagesToBeSaved(); List<ReadingListPage> pagesToUnsave = ReadingListDbHelper.instance().getAllPagesToBeUnsaved(); List<ReadingListPage> pagesToDelete = ReadingListDbHelper.instance().getAllPagesToBeDeleted(); boolean shouldSendSyncEvent = false; <START> if (ReadingListSyncAdapter.inProgress()) { return; } <END> try { for (ReadingListPage page : pagesToDelete) { deletePageContents(page); } for (ReadingListPage page : pagesToUnsave) { deletePageContents(page); } } catch (Exception e) { L.e("Error while deleting page: " + e.getMessage()); } finally { if (!pagesToDelete.isEmpty()) { ReadingListDbHelper.instance().purgeDeletedPages(); shouldSendSyncEvent = true; } if (!pagesToUnsave.isEmpty()) { ReadingListDbHelper.instance().resetUnsavedPageStatus(); shouldSendSyncEvent = true; } } int itemsTotal = pagesToSave.size(); if (itemsTotal > 0) { shouldSendSyncEvent = true; } int itemsSaved = 0; try { itemsSaved = savePages(pagesToSave); } finally { if (savedPageSyncNotification.isSyncPaused()) { savedPageSyncNotification.setNotificationPaused(getApplicationContext(), itemsTotal, itemsSaved); } else { savedPageSyncNotification.cancelNotification(getApplicationContext()); savedPageSyncNotification.setSyncCanceled(false); if (shouldSendSyncEvent) { sendSyncEvent(); } } } }</code><technical_language>if move this top of line 75</technical_language>

Target:
@Override protected void onHandleWork(@NonNull Intent intent) { if (ReadingListSyncAdapter.inProgress()) { return; } List<ReadingListPage> pagesToSave = ReadingListDbHelper.instance().getAllPagesToBeSaved(); List<ReadingListPage> pagesToUnsave = ReadingListDbHelper.instance().getAllPagesToBeUnsaved(); List<ReadingListPage> pagesToDelete = ReadingListDbHelper.instance().getAllPagesToBeDeleted(); boolean shouldSendSyncEvent = false; try { for (ReadingListPage page : pagesToDelete) { deletePageContents(page); } for (ReadingListPage page : pagesToUnsave) { deletePageContents(page); } } catch (Exception e) { L.e("Error while deleting page: " + e.getMessage()); } finally { if (!pagesToDelete.isEmpty()) { ReadingListDbHelper.instance().purgeDeletedPages(); shouldSendSyncEvent = true; } if (!pagesToUnsave.isEmpty()) { ReadingListDbHelper.instance().resetUnsavedPageStatus(); shouldSendSyncEvent = true; } } int itemsTotal = pagesToSave.size(); if (itemsTotal > 0) { shouldSendSyncEvent = true; } int itemsSaved = 0; try { itemsSaved = savePages(pagesToSave); } finally { if (savedPageSyncNotification.isSyncPaused()) { savedPageSyncNotification.setNotificationPaused(getApplicationContext(), itemsTotal, itemsSaved); } else { savedPageSyncNotification.cancelNotification(getApplicationContext()); savedPageSyncNotification.setSyncCanceled(false); if (shouldSendSyncEvent) { sendSyncEvent(); } } } }
Source:
<code>public ClusterBasedJobCoordinator(Config coordinatorSystemConfig) { metrics = new MetricsRegistryMap(); CoordinatorStreamSystemConsumer coordinatorSystemConsumer = new CoordinatorStreamSystemConsumer(coordinatorSystemConfig, metrics); CoordinatorStreamSystemProducer coordinatorSystemProducer = new CoordinatorStreamSystemProducer(coordinatorSystemConfig, metrics); CoordinatorStream coordinatorStream = new CoordinatorStream(coordinatorSystemConfig, metrics, COORDINATOR_STREAM_SOURCE); <START> coordinatorStream.startConsumer(); <END> coordinatorStream.startProducer(); changelogPartitionManager = new ChangelogPartitionManager(coordinatorStream); jobModelManager = JobModelManager.apply(coordinatorStream, changelogPartitionManager.readPartitionMapping()); config = jobModelManager.jobModel().getConfig(); hasDurableStores = new StorageConfig(config).hasDurableStores(); state = new SamzaApplicationState(jobModelManager); systemAdmins = new SystemAdmins(config); partitionMonitor = getPartitionCountMonitor(config, systemAdmins); clusterManagerConfig = new ClusterManagerConfig(config); isJmxEnabled = clusterManagerConfig.getJmxEnabled(); jobCoordinatorSleepInterval = clusterManagerConfig.getJobCoordinatorSleepInterval(); containerProcessManager = new ContainerProcessManager(config, state, metrics); }</code><technical_language>a coordinatorStream#start stop</technical_language>

Target:
public ClusterBasedJobCoordinator(Config coordinatorSystemConfig) { metrics = new MetricsRegistryMap(); coordinatorStreamManager = new CoordinatorStreamManager(coordinatorSystemConfig, metrics); coordinatorStreamManager.register(getClass().getSimpleName()); coordinatorStreamManager.start(); coordinatorStreamManager.bootstrap(); changelogStreamManager = new ChangelogStreamManager(coordinatorStreamManager); jobModelManager = JobModelManager.apply(coordinatorStreamManager, changelogStreamManager.readPartitionMapping()); config = jobModelManager.jobModel().getConfig(); hasDurableStores = new StorageConfig(config).hasDurableStores(); state = new SamzaApplicationState(jobModelManager); systemAdmins = new SystemAdmins(config); partitionMonitor = getPartitionCountMonitor(config, systemAdmins); clusterManagerConfig = new ClusterManagerConfig(config); isJmxEnabled = clusterManagerConfig.getJmxEnabled(); jobCoordinatorSleepInterval = clusterManagerConfig.getJobCoordinatorSleepInterval(); containerProcessManager = new ContainerProcessManager(config, state, metrics); }
Source:
<code>public void signal(String sessionId, SignalProperties props) throws OpenTokException , RequestException, InvalidArgumentException { <START> if (sessionId == null || sessionId == "" ) { <END> throw new InvalidArgumentException("Session string null or empty"); } try { this.client.signal(sessionId,null,props); } catch (Exception e) { throw e; } }</code><technical_language>isEmpty() instead of empty string comparison</technical_language>

Target:
public void signal(String sessionId, SignalProperties props) throws OpenTokException , RequestException, InvalidArgumentException { if (sessionId == null || sessionId.isEmpty() ) { throw new InvalidArgumentException("Session string null or empty"); } try { this.client.signal(sessionId,null,props); } catch (Exception e) { throw e; } }
Source:
<code>public VDS findProxyHost(boolean withRetries, Guid excludedHostId) { PMProxyOptions proxyOption = null; <START> final Guid NO_VDS = Guid.Empty; <END> int count; int retries = Math.max(Config.<Integer> getValue(ConfigValues.FindFenceProxyRetries), 1); int delayInMs = 1000 * Config.<Integer> getValue(ConfigValues.FindFenceProxyDelayBetweenRetriesInSec); VDS proxyHost = null; String pmProxyPreferences = (StringUtils.isEmpty(_vds.getPmProxyPreferences())) ? Config.<String> getValue(ConfigValues.FenceProxyDefaultPreferences) : _vds.getPmProxyPreferences(); String[] pmProxyOptions = pmProxyPreferences.split(","); for (String pmProxyOption : pmProxyOptions) { count = 0; proxyOption = getProxyOption(pmProxyOption); if (proxyOption == null) { log.error("Illegal value in PM Proxy Preferences string {}, skipped.", pmProxyOption); continue; } if (_vds.getId().equals(NO_VDS)) { proxyHost = getFenceProxy(true, false, proxyOption, excludedHostId); if (proxyHost == null) { proxyHost = getFenceProxy(false, false, proxyOption, excludedHostId); } } else { while (count < retries) { proxyHost = getFenceProxy(true, true, proxyOption, excludedHostId); if (proxyHost == null) { proxyHost = getFenceProxy(false, true, proxyOption, excludedHostId); } if (proxyHost != null) { break; } if (!withRetries) break; log.info("Attempt to find fence proxy host failed...", ++count); try { Thread.sleep(delayInMs); } catch (Exception e) { log.error(e.getMessage()); break; } } } if (proxyHost != null) { break; } } if (proxyHost == null) { log.error("Failed to run Power Management command on Host {}, no running proxy Host was found.", _vds.getName()); } else { logProxySelection(proxyHost.getName(), proxyOption.createLogEntry(proxyHost)); } return proxyHost; }</code><technical_language>Please Guid.Empty</technical_language>

Target:
public VDS findProxyHost(boolean withRetries, Guid excludedHostId) { int retries = Math.max(Config.<Integer> getValue(ConfigValues.FindFenceProxyRetries), 1); int delayInMs = 1000 * Config.<Integer> getValue(ConfigValues.FindFenceProxyDelayBetweenRetriesInSec); VDS proxyHost = null; for (PMProxyOptions proxyOption : getPmProxyPreferences()) { proxyHost = getFenceProxy(false, proxyOption, excludedHostId); int count = 0; while (proxyHost == null && withRetries && count < retries) { log.info("Attempt to find fence proxy host failed...", ++count); try { Thread.sleep(delayInMs); } catch (Exception e) { log.error(e.getMessage()); } proxyHost = getFenceProxy(true, proxyOption, excludedHostId); if (proxyHost != null) { logProxySelection(proxyHost.getName(), proxyOption.createLogEntry(proxyHost)); } } } if (proxyHost == null) { log.error("Failed to run Power Management command on Host {}, no running proxy Host was found.", _vds.getName()); } return proxyHost; }
Source:
<code>public RemoteServiceInstance(ICluster cluster, ServiceReference serviceReference) { this.serviceName = serviceReference.serviceName(); this.cluster = cluster; this.address = serviceReference.address(); this.memberId = serviceReference.memberId(); this.futures = new ConcurrentHashMap<>(); <START> this.cluster.listen().subscribe(message -> handleReply(message)); <END> }</code><technical_language>do need separate subscription for separate RemoteServiceInstance separate future map for service instance. Single future map subscription totally enough for system</technical_language>

Target:
public RemoteServiceInstance(ICluster cluster, ServiceReference serviceReference) { this.serviceName = serviceReference.serviceName(); this.cluster = cluster; this.address = serviceReference.address(); this.memberId = serviceReference.memberId(); }
Source:
<code>public void sweepStrategyNothingDoesNotPersistAntything() { <START> sweepQueue.enqueue(writeToDefaultCell(TABLE_NOTHING, TS), TS); <END> sweepQueue.enqueue(writeToDefaultCell(TABLE_NOTHING, TS2), TS2); verify(kvs, times(0)).put(eq(TargetedSweepTableFactory.of().getSweepableCellsTable(null).getTableRef()), anyMap(), anyLong()); verify(kvs, times(0)).put(eq(TargetedSweepTableFactory.of().getSweepableTimestampsTable(null).getTableRef()), anyMap(), anyLong()); verify(kvs, times(0)).put(eq(TargetedSweepTableFactory.of().getSweepShardProgressTable(null).getTableRef()), anyMap(), anyLong()); }</code><technical_language>TS superfluous here</technical_language>

Target:
public void sweepStrategyNothingDoesNotPersistAntything() { enqueueWrite(TABLE_NOTHING, TS); enqueueWrite(TABLE_NOTHING, TS2); verify(kvs, times(2)).put(any(TableReference.class), anyMap(), anyLong()); }
Source:
<code><START> private void _setVdsmId(String vdsmid) { <END> if (vdsmid == null) { throw new SoftError("Cannot acquire node id"); } log.infoFormat( "Host {0} reports unique id {1}", _vds.gethost_name(), vdsmid ); List<VDS> list = LinqUtils.filter( DbFacade.getInstance().getVdsDao().getAllWithUniqueId(vdsmid), new Predicate<VDS>() { @Override public boolean eval(VDS vds) { return !vds.getId().equals(_vds.getId()); } } ); if (!list.isEmpty()) { StringBuffer hosts = new StringBuffer(1024); for (VDS v : list) { if (hosts.length() > 0) { hosts.append(", "); } hosts.append(v.getvds_name()); } log.errorFormat( "Host {0} reports duplicate unique id {1} of following hosts {2}", _vds.gethost_name(), vdsmid, hosts ); throw new SoftError( String.format( "Host %1$s reports unique id which already registered for %2$s", _vds.gethost_name(), hosts ) ); } log.infoFormat("Assigning unique id {0} to Host {1}", _vds.gethost_name(), vdsmid); _vds.setUniqueId(vdsmid); TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { DbFacade.getInstance().getVdsStaticDao().update(_vds.getStaticData()); return null; } }); }</code><technical_language>If this public this _ break JavaBeans specification</technical_language>

Target:
private void _setVdsmId(String vdsmid) { if (vdsmid == null) { throw new SoftError("Cannot acquire node id"); } log.infoFormat( "Host {0} reports unique id {1}", _vds.gethost_name(), vdsmid ); final List<VDS> list = LinqUtils.filter( DbFacade.getInstance().getVdsDao().getAllWithUniqueId(vdsmid), new Predicate<VDS>() { @Override public boolean eval(VDS vds) { return !vds.getId().equals(_vds.getId()); } } ); if (!list.isEmpty()) { final StringBuilder hosts = new StringBuilder(1024); for (VDS v : list) { if (hosts.length() > 0) { hosts.append(", "); } hosts.append(v.getvds_name()); } log.errorFormat( "Host {0} reports duplicate unique id {1} of following hosts {2}", _vds.gethost_name(), vdsmid, hosts ); throw new SoftError( String.format( "Host %1$s reports unique id which already registered for %2$s", _vds.gethost_name(), hosts ) ); } log.infoFormat("Assigning unique id {0} to Host {1}", _vds.gethost_name(), vdsmid); _vds.setUniqueId(vdsmid); TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { DbFacade.getInstance().getVdsStaticDao().update(_vds.getStaticData()); return null; } }); }