auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public @NonNull Map<@NonNull String, @NonNull String> getWorkerInformation(long t) { int tid = fHostTid.getTid(); if (tid == -1) { return Collections.emptyMap(); } <START> Map<String, String> workerInfo = new HashMap<>(); workerInfo.put(OsStrings.tid(), String.valueOf(tid)); END> Optional<@Nullable KernelAnalysisModule> kam = TmfTraceManager.getInstance().getActiveTraceSet() .stream() .filter(trace -> trace.getHostId().equals(getHostId())) .map(trace -> TmfTraceUtils.getAnalysisModuleOfClass(trace, KernelAnalysisModule.class, KernelAnalysisModule.ID)) .filter(Objects::nonNull) .findFirst(); if (!kam.isPresent()) { return Collections.emptyMap(); } KernelAnalysisModule module = kam.get(); int priority = KernelThreadInformationProvider.getThreadPriority(module, tid, t); if (priority != -1) { String execName = KernelThreadInformationProvider.getExecutableName(module, tid, t); if (execName != null) { return ImmutableMap.of(NonNullUtils.nullToEmptyString(Messages.OsWorker_threadPriority), Integer.toString(priority), OsStrings.execName(), execName, OsStrings.tid(), Integer.toString(tid)); } return Collections.singletonMap(NonNullUtils.nullToEmptyString(Messages.OsWorker_threadPriority), Integer.toString(priority)); } return Collections.emptyMap(); }</code><technical_language>is this variable is completely useless? I this meant filled returned happened..</technical_language>

Target:
public @NonNull Map<@NonNull String, @NonNull String> getWorkerInformation(long t) { int tid = fHostTid.getTid(); if (tid == -1) { return Collections.emptyMap(); } ImmutableMap.Builder<String, String> workerInfo = new Builder<>(); workerInfo.put(OsStrings.tid(), String.valueOf(tid)); Optional<@Nullable KernelAnalysisModule> kam = TmfTraceManager.getInstance().getActiveTraceSet() .stream() .filter(trace -> trace.getHostId().equals(getHostId())) .map(trace -> TmfTraceUtils.getAnalysisModuleOfClass(trace, KernelAnalysisModule.class, KernelAnalysisModule.ID)) .filter(Objects::nonNull) .findFirst(); if (!kam.isPresent()) { return workerInfo.build(); } KernelAnalysisModule module = kam.get(); int priority = KernelThreadInformationProvider.getThreadPriority(module, tid, t); if (priority != -1) { workerInfo.put(NonNullUtils.nullToEmptyString(Messages.OsWorker_threadPriority), Integer.toString(priority)); } String execName = KernelThreadInformationProvider.getExecutableName(module, tid, t); if (execName != null) { workerInfo.put(OsStrings.execName(), execName); } return workerInfo.build(); }
Source:
<code>public void validate() throws JobConfigValidationException { super.validate(); try { final JobArguments arguments = this.getJobArguments(); <START> final String ownerKey = arguments.getAsString(OWNER_KEY); <END> final String consumerUuid = arguments.getAsString(CONSUMER_UUID_KEY); final String[] prodIds = arguments.getAs(PROD_IDS_KEY, String[].class); final String[] pools = arguments.getAs(FROM_POOLS_KEY, String[].class); if (ownerKey == null || ownerKey.isEmpty()) { final String errmsg = "Owner has not been set!"; throw new JobConfigValidationException(errmsg); } if (consumerUuid == null || consumerUuid.isEmpty()) { final String errmsg = "Consumer UUID has not been set!"; throw new JobConfigValidationException(errmsg); } if (prodIds == null || prodIds.length == 0) { final String errmsg = "Product ids has not been set!"; throw new JobConfigValidationException(errmsg); } if (pools == null) { final String errmsg = "Pools has not been set!"; throw new JobConfigValidationException(errmsg); } } catch (ArgumentConversionException e) { final String errmsg = "One or more required arguments are of the wrong type"; throw new JobConfigValidationException(errmsg, e); } }</code><technical_language>owner key is argument of this job's execution, need validate existence here</technical_language>

Target:
public void validate() throws JobConfigValidationException { super.validate(); try { final JobArguments arguments = this.getJobArguments(); final String consumerUuid = arguments.getAsString(CONSUMER_UUID_KEY); final String[] prodIds = arguments.getAs(PROD_IDS_KEY, String[].class); final String[] pools = arguments.getAs(FROM_POOLS_KEY, String[].class); if (consumerUuid == null || consumerUuid.isEmpty()) { final String errmsg = "Consumer UUID has not been set!"; throw new JobConfigValidationException(errmsg); } if (prodIds == null || prodIds.length == 0) { final String errmsg = "Product ids has not been set!"; throw new JobConfigValidationException(errmsg); } if (pools == null) { final String errmsg = "Pools has not been set!"; throw new JobConfigValidationException(errmsg); } } catch (ArgumentConversionException e) { final String errmsg = "One or more required arguments are of the wrong type"; throw new JobConfigValidationException(errmsg, e); } }
Source:
<code>public void testWithSideEffect() throws InterruptedException { Task<?> task = value("value1Task", "value1").withSideEffect("delayed sideEffect", <START> v -> delayedValue("value2", 5, TimeUnit.SECONDS)); <END> runAndWait(task); Assert.assertFalse(_traceCaptureListener.isDone()); Assert.assertTrue(_traceCaptureListener.await(30, TimeUnit.SECONDS)); Trace trace = _traceCaptureListener.getTrace(); Assert.assertNotNull(trace); Optional<ShallowTrace> sideEffectTrace = findTraceByName(trace, "delayed sideEffect"); Assert.assertTrue(sideEffectTrace.isPresent()); Assert.assertEquals(sideEffectTrace.get().getResultType(), ResultType.SUCCESS); Optional<ShallowTrace> valueTrace = findTraceByName(trace, "value2 delayed"); Assert.assertTrue(valueTrace.isPresent()); Assert.assertEquals(valueTrace.get().getResultType(), ResultType.SUCCESS); }</code><technical_language>change this delay smaller, e.g. 100ms</technical_language>

Target:
public void testWithSideEffect() throws InterruptedException { Task<?> task = value("value1Task", "value1").withSideEffect("delayed sideEffect", v -> delayedValue("value2", 100, TimeUnit.MILLISECONDS)); runAndWait(task); Assert.assertTrue(_traceCaptureListener.await(30, TimeUnit.SECONDS)); Trace trace = _traceCaptureListener.getTrace(); Assert.assertNotNull(trace); Optional<ShallowTrace> sideEffectTrace = findTraceByName(trace, "delayed sideEffect"); Assert.assertTrue(sideEffectTrace.isPresent()); Assert.assertEquals(sideEffectTrace.get().getResultType(), ResultType.SUCCESS); Optional<ShallowTrace> valueTrace = findTraceByName(trace, "value2 delayed"); Assert.assertTrue(valueTrace.isPresent()); Assert.assertEquals(valueTrace.get().getResultType(), ResultType.SUCCESS); }
Source:
<code><START> public void rollbackQuota(storage_pool storagePool, List<Guid> quotaList) { <END> synchronized (storagePoolQuotaMap.get(storagePool.getId())) { if (storagePoolQuotaMap.get(storagePool.getId()) == null) { return; } Map<Guid, Quota> map = storagePoolQuotaMap.get(storagePool.getId()); for (Guid quotaId : quotaList) { map.remove(quotaId); } } }</code><technical_language>code is thread safe, NullPointerException if remove sententiously</technical_language>

Target:
public void rollbackQuota(storage_pool storagePool, List<Guid> quotaList) { lock.readLock().lock(); try { if (!storagePoolQuotaMap.containsKey(storagePool.getId())) { return; } synchronized (storagePoolQuotaMap.get(storagePool.getId())) { Map<Guid, Quota> map = storagePoolQuotaMap.get(storagePool.getId()); for (Guid quotaId : quotaList) { map.remove(quotaId); } } } finally { lock.readLock().unlock(); } }
Source:
<code>public void suspend() { log.trace("No-op suspend with state {}", state()); switch (state()) { case CREATED: case RUNNING: case SUSPENDED: transitionTo(State.SUSPENDED); break; <START> case RESTORING: <END> case CLOSED: throw new IllegalStateException("Illegal state " + state() + " while suspending standby task " + id); default: throw new IllegalStateException("Unknown state " + state() + " while suspending standby task " + id); } }</code><technical_language>I get standbys in RESTORING state, philosophically more illegal suspend RESTORING is RUNNING. vote legalize RESTORING here. a useful sanity check for CLOSED illegal, though</technical_language>

Target:
public void suspend() { switch (state()) { case CREATED: case RUNNING: transitionTo(State.SUSPENDED); log.info("Suspended {}", state()); break; case SUSPENDED: log.info("Skip suspending since state is {}", state()); break; case RESTORING: case CLOSED: throw new IllegalStateException("Illegal state " + state() + " while suspending standby task " + id); default: throw new IllegalStateException("Unknown state " + state() + " while suspending standby task " + id); } }
Source:
<code>public void review(PendingCertifiedProductDTO listing) { <START> for (PendingCertificationResultDTO cert : listing.getCertificationCriterion()) { <END> if (cert.getMeetsCriteria() != null && cert.getMeetsCriteria().equals(Boolean.TRUE)) { if (cert.getTestStandards() != null && cert.getTestStandards().size() > 0) { Iterator<PendingCertificationResultTestStandardDTO> testStandardIter = cert.getTestStandards().iterator(); while (testStandardIter.hasNext()) { PendingCertificationResultTestStandardDTO testStandard = testStandardIter.next(); if (StringUtils.isEmpty(testStandard.getName())) { listing.getErrorMessages().add( msgUtil.getMessage("listing.criteria.missingTestStandardName", Util.formatCriteriaNumber(cert.getCriterion()))); } else { TestStandardDTO foundTestStandard = testStandardDao.getByNumberAndEdition(testStandard.getName(), listing.getCertificationEditionId()); if (foundTestStandard == null) { listing.getWarningMessages().add( msgUtil.getMessage("listing.criteria.testStandardNotFound", Util.formatCriteriaNumber(cert.getCriterion()), testStandard.getName(), listing.getCertificationEdition())); } } } } } } }</code><technical_language>This kind of done streams, positive</technical_language>

Target:
public void review(PendingCertifiedProductDTO listing) { listing.getCertificationCriterion().stream() .filter(cert -> (cert.getMeetsCriteria() != null && cert.getMeetsCriteria().equals(Boolean.TRUE))) .filter(cert -> (cert.getTestStandards() != null && cert.getTestStandards().size() > 0)) .forEach(certResult -> certResult.getTestStandards().stream() .forEach(testStandard -> reviewTestStandard(listing, certResult, testStandard))); }
Source:
<code>private void cleanupProfileRegistry() { IProfileRegistry registry = ProvisioningUI.getDefaultUI().getSession().getProvisioningAgent() .getService(IProfileRegistry.class); long[] history = registry.listProfileTimestamps(toImportFrom.getProfileId()); for (long <START> element : <END> history) { if (element < toImportFrom.getTimestamp()) try { registry.removeProfile(toImportFrom.getProfileId(), element); } catch (ProvisionException e) { } } }</code><technical_language>rename timestamp</technical_language>

Target:
private void cleanupProfileRegistry() { IProfileRegistry registry = ProvisioningUI.getDefaultUI().getSession().getProvisioningAgent() .getService(IProfileRegistry.class); for (long timestamp : registry.listProfileTimestamps(toImportFrom.getProfileId())) { if (timestamp < toImportFrom.getTimestamp()) try { registry.removeProfile(toImportFrom.getProfileId(), timestamp); } catch (ProvisionException e) { } } }
Source:
<code>public Subscription subscribe() { return storIOContentResolver .observeChangesOfUri(Uri.parse(UserMeta.CONTENT_URI)) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) <START> .subscribe(new Observer<Changes>() { <END> @Override public void onError(Throwable e) { fail("Error occurred: " + e); } @Override public void onNext(Changes changes) { onNextObtained(changes); } @Override public void onCompleted() { } }); }</code><technical_language>overload of subscribe java .subscribe(new Action1<ResultType> { }); Instead of monstrous Observer methods. RxJava throw exception if onError handled -> test fail, onComplete is required for tests :)</technical_language>

Target:
public Subscription subscribe() { return storIOContentResolver .observeChangesOfUri(Uri.parse(UserMeta.CONTENT_URI)) .subscribeOn(Schedulers.io()) .subscribe(new Action1<Changes>() { @Override public void call(Changes changes) { onNextObtained(changes); } }); }
Source:
<code>public void testConsistentIdNotConfiguredWithPersistence() throws Exception { persistenceEnabled = true; Ignite ignite = startGrid(0); assertNull(ignite.configuration().getConsistentId()); assertTrue(UUID_PATTERN.matcher(ignite.cluster().localNode().consistentId().toString()).find()); <START> info("Consistent id in that case: " + ignite.cluster().localNode().consistentId()); <END> }</code><technical_language>suggestion info("Consistent ID: " + ignite.cluster().localNode().consistentId());</technical_language>

Target:
public void testConsistentIdNotConfiguredWithPersistence() throws Exception { persistenceEnabled = true; Ignite ignite = startGrid(0); assertNull(ignite.configuration().getConsistentId()); assertTrue(UUID_PATTERN.matcher(ignite.cluster().localNode().consistentId().toString()).find()); info("Consistent ID: " + ignite.cluster().localNode().consistentId()); }
Source:
<code>public static void readFileToByteBuffer(FileChannel fileChannel, long offset, ByteBuffer buffer) throws IOException { int read = 0; int expectedRead = buffer.remaining(); while (buffer.hasRemaining()) { int sizeRead = fileChannel.read(buffer, offset); <START> if (sizeRead == 0 || sizeRead == -1) { <END> throw new IOException("Total size read " + read + " is less than the size to be read " + expectedRead); } read += sizeRead; offset += sizeRead; } }</code><technical_language>Is size == 0 is exception scenario? (as in, is FileChannel necessarily blocking)</technical_language>

Target:
public static void readFileToByteBuffer(FileChannel fileChannel, long offset, ByteBuffer buffer) throws IOException { int read = 0; int expectedRead = buffer.remaining(); while (buffer.hasRemaining()) { int sizeRead = fileChannel.read(buffer, offset); if (sizeRead == 0 || sizeRead == -1) { throw new IOException( "Total size read " + read + " is less than the size to be read " + expectedRead + ". sizeRead is " + sizeRead); } read += sizeRead; offset += sizeRead; } }
Source:
<code>private Map<String, List<String>> freshMap() throws IOException { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); new RqPrint(this.req).printBody(baos); final String body = new Utf8String(baos.toByteArray()).string(); final Map<String, List<String>> map = new HashMap<>(1); for (final String pair : body.split("&")) { if (pair.isEmpty()) { continue; } final String[] parts = pair.split("=", 2); if (parts.length < 2) { throw new HttpException( HttpURLConnection.HTTP_BAD_REQUEST, String.format( "invalid form body pair: %s", pair ) ); } final String key = decode( <START> new Utf8String(parts[0].trim()).englishLowerCase() <END> ); if (!map.containsKey(key)) { map.put(key, new LinkedList<String>()); } map.get(key).add(decode(parts[1].trim())); } return map; }</code><technical_language>@dalifreire changes ways of creating lowercase strings - dedicated class Utf8String..</technical_language>

Target:
private Map<String, List<String>> freshMap() throws IOException { final String body = new RqPrint(this.req).printBody(); final Map<String, List<String>> map = new HashMap<>(1); for (final String pair : body.split("&")) { if (pair.isEmpty()) { continue; } final String[] parts = pair.split("=", 2); if (parts.length < 2) { throw new HttpException( HttpURLConnection.HTTP_BAD_REQUEST, String.format( "invalid form body pair: %s", pair ) ); } final String key = decode( new EnglishLowerCase(parts[0].trim()).string() ); if (!map.containsKey(key)) { map.put(key, new LinkedList<String>()); } map.get(key).add(decode(parts[1].trim())); } return map; }
Source:
<code>private void primaryAction() { switch (getPrimaryAction()) { case UPDATE: showUpdateConfirmationDialogAndUploadPost(); return; case PUBLISH_NOW: showPublishConfirmationDialogAndPublishPost(); return; case SCHEDULE: <START> uploadPost(false); <END> return; case SUBMIT_FOR_REVIEW: case SAVE: uploadPost(false); break; } }</code><technical_language>move this "other cases" below: java // In other cases, upload post changing status case SCHEDULE: case SUBMIT_FOR_REVIEW: case SAVE: uploadPost(false); break;</technical_language>

Target:
private void primaryAction() { switch (getPrimaryAction()) { case UPDATE: showUpdateConfirmationDialogAndUploadPost(); return; case PUBLISH_NOW: showPublishConfirmationDialogAndPublishPost(); return; case SCHEDULE: case SUBMIT_FOR_REVIEW: case SAVE: uploadPost(false); break; } }
Source:
<code>public void activate() { seedWordsValid.addListener(seedWordsValidChangeListener); seedWordsTextArea.textProperty().addListener(seedWordsTextAreaChangeListener); restoreButton.disableProperty().bind(createBooleanBinding(() -> !seedWordsValid.get() || !seedWordsEdited.get(), seedWordsValid, seedWordsEdited)); restoreButton.setOnAction(e -> { new Popup().information(Res.get("account.seed.restore.info")) .closeButtonText(Res.get("shared.cancel")) .actionButtonText(Res.get("account.seed.restore.ok")) .onAction(this::onRestore) .show(); }); seedWordsTextArea.getStyleClass().remove("validation-error"); restoreDatePicker.getStyleClass().remove("validation-error"); new Popup().warning(Res.get("account.seed.backup.warning")) .onAction(() -> { <START> activatePartTwo(); <END> }) .actionButtonText(Res.get("shared.iUnderstand")) .useIUnderstandButton() .hideCloseButton() .show(); }</code><technical_language>this more verbose. e.g. suggestion showSeedPhrase();</technical_language>

Target:
public void activate() { seedWordsValid.addListener(seedWordsValidChangeListener); seedWordsTextArea.textProperty().addListener(seedWordsTextAreaChangeListener); restoreButton.disableProperty().bind(createBooleanBinding(() -> !seedWordsValid.get() || !seedWordsEdited.get(), seedWordsValid, seedWordsEdited)); restoreButton.setOnAction(e -> { new Popup().information(Res.get("account.seed.restore.info")) .closeButtonText(Res.get("shared.cancel")) .actionButtonText(Res.get("account.seed.restore.ok")) .onAction(this::onRestore) .show(); }); seedWordsTextArea.getStyleClass().remove("validation-error"); restoreDatePicker.getStyleClass().remove("validation-error"); String key = "showBackupWarningAtSeedPhrase"; if (DontShowAgainLookup.showAgain(key)) { new Popup().warning(Res.get("account.seed.backup.warning")) .onAction(() -> { showSeedPhrase(); }) .actionButtonText(Res.get("shared.iUnderstand")) .useIUnderstandButton() .dontShowAgainId(key) .hideCloseButton() .show(); } else { showSeedPhrase(); } }
Source:
<code>public String asSummaryString() { <START> return name; <END> }</code><technical_language>return "JDBC:" + dialectName</technical_language>

Target:
public String asSummaryString() { return "JDBC:" + dialectName; }
Source:
<code>public ClusterSearchShardsResponse getSearchShards(String index, ElasticsearchTableDescription tableDescription) { TransportClient client = clients.get(tableDescription.getClusterName()); <START> verify(client != null, "TransportClient is null"); <END> ClusterSearchShardsRequest request = new ClusterSearchShardsRequest(index); return client.admin() .cluster() .searchShards(request) .actionGet(timeout.toMillis()); }</code><technical_language>verify(client != null, "client is null");</technical_language>

Target:
public ClusterSearchShardsResponse getSearchShards(String index, ElasticsearchTableDescription tableDescription) { TransportClient client = clients.get(tableDescription.getClusterName()); verify(client != null, "client is null"); ClusterSearchShardsRequest request = new ClusterSearchShardsRequest(index); return client.admin() .cluster() .searchShards(request) .actionGet(timeout.toMillis()); }
Source:
<code>protected void initListeners() { super.initListeners(); itemListAdapter.setSelectedListener(new OnClickGesture<LocalItem>() { @Override public void selected(LocalItem selectedItem) { FragmentManager fragmentManager; if (getParentFragment() == null) <START> { <END> fragmentManager = getFragmentManager(); } else { fragmentManager = getParentFragment().getFragmentManager(); } if (selectedItem instanceof PlaylistMetadataEntry) { final PlaylistMetadataEntry entry = ((PlaylistMetadataEntry) selectedItem); NavigationHelper.openLocalPlaylistFragment(fragmentManager, entry.uid, entry.name); } else if (selectedItem instanceof PlaylistRemoteEntity) { final PlaylistRemoteEntity entry = ((PlaylistRemoteEntity) selectedItem); NavigationHelper.openPlaylistFragment(fragmentManager, entry.getServiceId(), entry.getUrl(), entry.getName()); } } @Override public void held(LocalItem selectedItem) { if (selectedItem instanceof PlaylistMetadataEntry) { showLocalDeleteDialog((PlaylistMetadataEntry) selectedItem); } else if (selectedItem instanceof PlaylistRemoteEntity) { showRemoteDeleteDialog((PlaylistRemoteEntity) selectedItem); } } }); }</code><technical_language>Please stick java design guidelines, put braked in line 104</technical_language>

Target:
protected void initListeners() { super.initListeners(); itemListAdapter.setSelectedListener(new OnClickGesture<LocalItem>() { @Override public void selected(LocalItem selectedItem) { FragmentManager fragmentManager = getFM(); if (selectedItem instanceof PlaylistMetadataEntry) { final PlaylistMetadataEntry entry = ((PlaylistMetadataEntry) selectedItem); NavigationHelper.openLocalPlaylistFragment(fragmentManager, entry.uid, entry.name); } else if (selectedItem instanceof PlaylistRemoteEntity) { final PlaylistRemoteEntity entry = ((PlaylistRemoteEntity) selectedItem); NavigationHelper.openPlaylistFragment(fragmentManager, entry.getServiceId(), entry.getUrl(), entry.getName()); } } @Override public void held(LocalItem selectedItem) { if (selectedItem instanceof PlaylistMetadataEntry) { showLocalDeleteDialog((PlaylistMetadataEntry) selectedItem); } else if (selectedItem instanceof PlaylistRemoteEntity) { showRemoteDeleteDialog((PlaylistRemoteEntity) selectedItem); } } }); }
Source:
<code>public int hashCode() { <START> return value == null ? 0 : value.hashCode(); <END> }</code><technical_language>is null</technical_language>

Target:
public int hashCode() { return value.hashCode(); }
Source:
<code>public void addTeam() { String teamName = con.readLine(msgEnterTeamName); try { tm.begin(); teams.putIfAbsent(teamName, new Team(teamName)); <START> tm.commit(); <END> } catch (Exception e) { con.printf("Exception message %s", e.getMessage()); } }</code><technical_language>I move tm.commit() a finally block</technical_language>

Target:
public void addTeam() { String teamName = con.readLine(msgEnterTeamName); try { tm.begin(); teams.putIfAbsent(teamName, new Team(teamName)); } catch (Exception e) { markForRollback(e); } finally { endTransaction(); } }
Source:
<code><START> public AgentInstances agents() { <END> return agentInstances.allAgents(); }</code><technical_language>this method controller is deleted a part of this PR. get rid of method</technical_language>

Target:
AgentInstances agents() { return agentInstances; }
Source:
<code>public String getClassName() { <START> String className = ctClass.getName().replace('$', '.'); <END> if (getPackageName() != null) { return className.substring(getPackageName().length() + 1, className.length()); } return className; }</code><technical_language>Do need a utility for this? I get this logic happen in places. start making a call getQualifiedName</technical_language>

Target:
public String getClassName() { String qualifiedName = getQualifiedName(); if(qualifiedName.contains(".")) { return qualifiedName.substring(qualifiedName.lastIndexOf(".") + 1, qualifiedName.length()); } else { return qualifiedName; } }
Source:
<code>public DecisionTableAnalyzer getAnalyser( final GuidedDecisionTable52 table52 ) { if ( checkRunner == null ) { checkRunner = new CheckRunner() { @Override protected void doRun( final CancellableRepeatingCommand command ) { while ( command.execute() ) { } } }; } final UpdateManager updateManager = getUpdateManager( checkRunner, table52 ); final DecisionTableAnalyzer analyzer = new DecisionTableAnalyzer( new AnalysisReporter( mock( PlaceRequest.class ), mock( AnalysisReportScreen.class ) ) { @Override public void sendReport( final AnalysisReport report ) { analysisReport = report; } @Override public void sendStatus( final Status _status ) { status = _status; } }, table52, cache, updateManager, <START> checkRunner ) { <END> }; return analyzer; }</code><technical_language>Is this meant empty block? originally override something</technical_language>

Target:
public DecisionTableAnalyzer getAnalyser( final GuidedDecisionTable52 table52 ) { final DecisionTableAnalyzerBuilder builder = getDecisionTableAnalyzerBuilder() .withPlaceRequest( mock( PlaceRequest.class ) ) .withReportScreen( mock( AnalysisReportScreen.class ) ) .withOracle( oracle ) .withModel( table52 ); return builder.build(); }
Source:
<code>public String toString() { final String greaterThan = "> " + min; final String lessThan = "< " + max; final String between = min + " ~ " + max; if (clazz == Byte.class) if (max.equals(Byte.MAX_VALUE)) return greaterThan; else if (min.equals(Byte.MIN_VALUE)) return lessThan; else return between; if (clazz == Short.class) if (max.equals(Short.MAX_VALUE)) return greaterThan; else if (min.equals(Short.MIN_VALUE)) return lessThan; else return between; if (clazz == Integer.class) if (max.equals(Integer.MAX_VALUE)) return greaterThan; else if (min.equals(Integer.MIN_VALUE)) return lessThan; else return between; if (clazz == Long.class) if (max.equals(Long.MAX_VALUE)) return greaterThan; else if (min.equals(Long.MIN_VALUE)) return lessThan; else return between; else if (clazz == Float.class) if (max.equals(Float.MAX_VALUE)) return greaterThan; <START> else if (min.equals(Float.MIN_VALUE)) return lessThan; <END> else return between; else if (clazz == Double.class) if (max.equals(Double.MAX_VALUE)) return greaterThan; else if (min.equals(Double.MIN_VALUE)) return lessThan; else return between; return between; }</code><technical_language>I this -Float.MAX_VALUE I discovered is Float.MIN_VALUE represents smallest positive a float represent, smallest fits in a float (which is represented -Float.MAX_VALUE)</technical_language>

Target:
public String toString() { final String greaterThan = "> " + min; final String lessThan = "< " + max; final String between = min + " ~ " + max; if (clazz == Byte.class) if (max.equals(Byte.MAX_VALUE)) return greaterThan; else if (min.equals(Byte.MIN_VALUE)) return lessThan; else return between; if (clazz == Short.class) if (max.equals(Short.MAX_VALUE)) return greaterThan; else if (min.equals(Short.MIN_VALUE)) return lessThan; else return between; if (clazz == Integer.class) if (max.equals(Integer.MAX_VALUE)) return greaterThan; else if (min.equals(Integer.MIN_VALUE)) return lessThan; else return between; if (clazz == Long.class) if (max.equals(Long.MAX_VALUE)) return greaterThan; else if (min.equals(Long.MIN_VALUE)) return lessThan; else return between; else if (clazz == Float.class) if (max.equals(Float.MAX_VALUE)) return greaterThan; else if (min.equals(-Float.MAX_VALUE)) return lessThan; else return between; else if (clazz == Double.class) if (max.equals(Double.MAX_VALUE)) return greaterThan; else if (min.equals(-Double.MAX_VALUE)) return lessThan; else return between; return between; }
Source:
<code>public boolean awaitVdsmResponse() { HostSetupNetworkPoller poller = new HostSetupNetworkPoller(); boolean success = poller.pollWithDefaultTimeout(host.getId()); if (success) { log.info("Engine managed to communicate with VDSM agent on host '{}' ('{}')", host.getName(), host.getId()); return true; } else { <START> log.warn("Engine <END> failed to communicate with VDSM agent on host '{}' ('{}')", host.getName(), host.getId()); return false; } }</code><technical_language>this stage I error</technical_language>

Target:
public boolean awaitVdsmResponse() { HostSetupNetworkPoller poller = new HostSetupNetworkPoller(); boolean success = poller.pollWithDefaultTimeout(host.getId()); if (success) { log.info("Engine managed to communicate with VDSM agent on host '{}' ('{}')", host.getName(), host.getId()); } return success; }
Source:
<code>public TSQueueLock(File queueDirectoryPath, Supplier<Pauser> pauser) { final File storeFilePath; if ("".equals(queueDirectoryPath.getPath())) { storeFilePath = new File(QUEUE_LOCK_FILE); } else { storeFilePath = new File(queueDirectoryPath, QUEUE_LOCK_FILE); queueDirectoryPath.mkdirs(); } <START> TableStore tableStore = SingleTableBuilder.binary(storeFilePath).build(); <END> this.lock = tableStore.acquireValueFor(LOCK_KEY); this.pauser = pauser.get(); }</code><technical_language>I this is prone concurrent threads creating multiple instances of LOCK_KEY reference in table. I file locking get this for directory listing: <LINK_0></technical_language>

Target:
public TSQueueLock(File queueDirectoryPath, Supplier<Pauser> pauser) { final File storeFilePath; if ("".equals(queueDirectoryPath.getPath())) { storeFilePath = new File(QUEUE_LOCK_FILE); } else { storeFilePath = new File(queueDirectoryPath, QUEUE_LOCK_FILE); queueDirectoryPath.mkdirs(); } TableStore tableStore = SingleTableBuilder.binary(storeFilePath).build(); this.lock = tableStore.doWithExclusiveLock(ts -> ts.acquireValueFor(LOCK_KEY)); this.pauser = pauser.get(); }
Source:
<code>public RunningSplitInfo(long startTime, String threadId, Thread thread, PrioritizedSplitRunner split) { this.startTime = startTime; this.threadId = threadId; this.thread = thread; <START> this.printed = false; <END> this.split = split; }</code><technical_language>move this this.printed = false; align stack order</technical_language>

Target:
public RunningSplitInfo(long startTime, String threadId, Thread thread, PrioritizedSplitRunner split) { this.startTime = startTime; this.threadId = threadId; this.thread = thread; this.split = split; this.printed = false; }
Source:
<code>public CompositeEnvironmentRepositoryBeanFactoryPostProcessor compositeEnvironmentRepositoryBeanFactoryPostProcessor( Environment environment) { <START> return new CompositeEnvironmentRepositoryBeanFactoryPostProcessor(environment); <END> }</code><technical_language>This is unusual</technical_language>

Target:
public static CompositeEnvironmentBeanFactoryPostProcessor compositeEnvironmentRepositoryBeanFactoryPostProcessor( Environment environment) { return new CompositeEnvironmentBeanFactoryPostProcessor(environment); }
Source:
<code><START> public InstallBuiltinLfsCommand setRepository(Repository repo) { <END> this.repository = repo; return this; }</code><technical_language>I this return instance of interface</technical_language>

Target:
public LfsInstallCommand setRepository(Repository repo) { this.repository = repo; return this; }
Source:
<code>protected void createGoogleApiClient() { GoogleApiClient.Builder builder = new GoogleApiClient.Builder(this) .addApiIfAvailable(AppStateManager.API); if (PrefUtils.isSignedIn(this)) { <START> builder.addApiIfAvailable(Plus.API, Plus.SCOPE_PLUS_LOGIN, Plus.SCOPE_PLUS_PROFILE) <END> .addApiIfAvailable(Games.API, Games.SCOPE_GAMES); } else { builder.addApiIfAvailable(Plus.API) .addApiIfAvailable(Games.API); } mGoogleApiClient = builder.build(); }</code><technical_language>do need this? I understand</technical_language>

Target:
protected GoogleApiClient createGoogleApiClient() { GoogleApiClient.Builder builder = new GoogleApiClient.Builder(this) .addApiIfAvailable(AppStateManager.API); if (PrefUtils.isSignedIn(this)) { builder.addApiIfAvailable(Plus.API, Plus.SCOPE_PLUS_LOGIN, Plus.SCOPE_PLUS_PROFILE) .addApiIfAvailable(Games.API, Games.SCOPE_GAMES); } else { builder.addApiIfAvailable(Plus.API) .addApiIfAvailable(Games.API); } return builder.build(); }
Source:
<code>public List<Metric> getMetrics(List<String> expressions, long relativeTo) { requireNotDisposed(); SystemAssert.requireArgument(MetricReader.isValid(expressions), "Illegal metric expression found: " + expressions); MetricReader<Metric> reader = _metricReaderProviderForMetrics.get(); List<Metric> metrics = new ArrayList<>(expressions.size()); try { numDiscoveryResults = 0; numDiscoveryQueries = 0; for (String expression : expressions) { _logger.debug("Reading metric for expression {}", expression); metrics.addAll(reader.parse(expression, relativeTo, Metric.class)); expandedTimeSeriesRange = reader.getExpandedTimeSeriesRange(); queryTimeWindow = reader.getQueryTimeWindow(); <START> numDiscoveryResults += getNumDiscoveryResults(); END> numDiscoveryQueries += getNumDiscoveryQueries(); } } catch (ParseException ex) { throw new SystemException("Failed to parse the given expression", ex); } catch(Exception ex) { _logger.error("Exception occured when evaluating metric expressions - {}" , Arrays.toString(expressions.toArray()), ExceptionUtils.getFullStackTrace(ex)); throw ex; } _monitorService.modifyCounter(Counter.DATAPOINT_READS, _getDatapointsAcrossMetrics(metrics), null); return metrics; }</code><technical_language>This change removed get populated results reader object</technical_language>

Target:
public List<Metric> getMetrics(List<String> expressions, long relativeTo) { requireNotDisposed(); SystemAssert.requireArgument(MetricReader.isValid(expressions), "Illegal metric expression found: " + expressions); MetricReader<Metric> reader = _metricReaderProviderForMetrics.get(); List<Metric> metrics = new ArrayList<>(expressions.size()); try { numDiscoveryResults = 0; numDiscoveryQueries = 0; for (String expression : expressions) { _logger.debug("Reading metric for expression {}", expression); metrics.addAll(reader.parse(expression, relativeTo, Metric.class)); expandedTimeSeriesRange = reader.getExpandedTimeSeriesRange(); queryTimeWindow = reader.getQueryTimeWindow(); numDiscoveryResults += reader.getNumDiscoveryResults(); numDiscoveryQueries += reader.getNumDiscoveryQueries(); } } catch (ParseException ex) { throw new SystemException("Failed to parse the given expression", ex); } catch(Exception ex) { _logger.error("Exception occured when evaluating metric expressions - {}" , Arrays.toString(expressions.toArray()), ExceptionUtils.getFullStackTrace(ex)); throw ex; } _monitorService.modifyCounter(Counter.DATAPOINT_READS, _getDatapointsAcrossMetrics(metrics), null); return metrics; }
Source:
<code>public void confirmLeadership(UUID leaderSessionID, String leaderAddress) { if (LOG.isDebugEnabled()) { LOG.debug( "Confirm leader session ID for leader {}.", leaderSessionID, leaderAddress); } Preconditions.checkNotNull(leaderSessionID); synchronized (lock) { if (hasLeadership(leaderSessionID)) { if (running) { confirmLeaderInformation(leaderSessionID, leaderAddress); <START> leaderElectionDriver.writeLeaderInformation(confirmedLeaderSessionID, confirmedLeaderAddress); <END> } else { LOG.debug("Ignoring the leader session Id confirmation, since the " + "LeaderElectionService has already been stopped.", leaderSessionID); } } else { if (!leaderSessionID.equals(this.issuedLeaderSessionID)) { LOG.debug("Receive an old confirmation call of leader session ID {}, " + "current issued session ID is {}", leaderSessionID, issuedLeaderSessionID); } else { LOG.warn("The leader session ID was confirmed even though the " + "corresponding JobManager was not elected as the leader.", leaderSessionID); } } } }</code><technical_language>This call moved confirmLeaderInformation</technical_language>

Target:
public void confirmLeadership(UUID leaderSessionID, String leaderAddress) { if (LOG.isDebugEnabled()) { LOG.debug( "Confirm leader session ID for leader {}.", leaderSessionID, leaderAddress); } checkNotNull(leaderSessionID); synchronized (lock) { if (hasLeadership(leaderSessionID)) { if (running) { confirmLeaderInformation(leaderSessionID, leaderAddress); } else { if (LOG.isDebugEnabled()) { LOG.debug("Ignoring the leader session Id confirmation, since the " + "LeaderElectionService has already been stopped.", leaderSessionID); } } } else { if (!leaderSessionID.equals(this.issuedLeaderSessionID)) { if (LOG.isDebugEnabled()) { LOG.debug("Receive an old confirmation call of leader session ID {}, " + "current issued session ID is {}", leaderSessionID, issuedLeaderSessionID); } } else { LOG.warn("The leader session ID was confirmed even though the " + "corresponding JobManager was not elected as the leader.", leaderSessionID); } } } }
Source:
<code>public Object getKey(Row value) throws Exception { if (this.unpickler == null) { unpickler = new Unpickler(); } Object key = value.getField(0); <START> if (key instanceof byte[]) { <END> Object unpickledKey = this.unpickler.loads((byte[]) key); return unpickledKey; } return null; }</code><technical_language>key other types if key_by type information. For example, ds.key_by(MyKeySelector(), Types.INT())</technical_language>

Target:
public Object getKey(Row value) throws Exception { Object key = value.getField(0); if (!isPickledByteArray){ return key; } else { if (this.unpickler == null) { unpickler = new Unpickler(); } return this.unpickler.loads((byte[]) key); } }
Source:
<code>public CompletionStage<Void> wrapEntryForWriting(InvocationContext ctx, Object key, int segment, boolean isOwner, boolean isRead) { CacheEntry contextEntry = getFromContext(ctx, key); CompletionStage<Void> returnedStage = CompletableFutures.completedNull(); if (contextEntry instanceof MVCCEntry) { } else if (contextEntry != null) { MVCCEntry mvccEntry = createWrappedEntry(key, contextEntry); ctx.putLookedUpEntry(key, mvccEntry); if (trace) log.tracef("Updated context entry %s -> %s", contextEntry, mvccEntry); } else { InternalCacheEntry ice = getFromContainer(key, segment); if (isOwner) { if (ice == null) { addWriteEntryToContext(ctx, NullCacheEntry.getInstance(), key, isRead); } else { CompletionStage<Boolean> expiredStage = handlePossibleExpiredEntry(ice, true); if (expiredStage != null) { <START> returnedStage = expiredStage.thenApply(expired -> { <END> if (expired == Boolean.FALSE) { addWriteEntryToContext(ctx, ice, key, isRead); } else { if (trace) { log.tracef("Entry retrieved for key %s was expired, returning null entry", key); } addWriteEntryToContext(ctx, NullCacheEntry.getInstance(), key, isRead); } return null; }); } else { addWriteEntryToContext(ctx, ice, key, isRead); } } } else if (isL1Enabled && ice != null && !ice.isL1Entry()) { addWriteEntryToContext(ctx, ice, key, isRead); } } return returnedStage; }</code><technical_language>checking if expiredStage is completed in wrapEntryForReading()</technical_language>

Target:
public CompletionStage<Void> wrapEntryForWriting(InvocationContext ctx, Object key, int segment, boolean isOwner, boolean isRead) { CacheEntry contextEntry = getFromContext(ctx, key); CompletionStage<Void> returnedStage = CompletableFutures.completedNull(); if (contextEntry instanceof MVCCEntry) { } else if (contextEntry != null) { MVCCEntry mvccEntry = createWrappedEntry(key, contextEntry); ctx.putLookedUpEntry(key, mvccEntry); if (trace) log.tracef("Updated context entry %s -> %s", contextEntry, mvccEntry); } else { InternalCacheEntry ice = getFromContainer(key, segment); if (isOwner) { if (ice == null) { addWriteEntryToContext(ctx, NullCacheEntry.getInstance(), key, isRead); } else { CompletionStage<Boolean> expiredStage = handlePossibleExpiredEntry(ice, true); if (expiredStage != null) { if (CompletionStages.isCompletedSuccessfully(expiredStage)) { Boolean expired = CompletionStages.join(expiredStage); handleWriteExpiredEntryContextAddition(expired, ctx, ice, key, isRead); } else { returnedStage = expiredStage.thenApply(expired -> { handleWriteExpiredEntryContextAddition(expired, ctx, ice, key, isRead); return null; }); } } else { addWriteEntryToContext(ctx, ice, key, isRead); } } } else if (isL1Enabled && ice != null && !ice.isL1Entry()) { addWriteEntryToContext(ctx, ice, key, isRead); } } return returnedStage; }
Source:
<code>private void setAppLastOpenedDateIfNewer(User userEntity, UserDevice deviceEntity) { <START> LocalDate currentDate = userEntity.getDateInUserTimezone(TimeUtil.utcNow()); <END> LocalDate appLastOpenedDate = deviceEntity.getAppLastOpenedDate(); if (appLastOpenedDate.isBefore(currentDate)) { deviceEntity.setAppLastOpenedDateToNow(userEntity); } }</code><technical_language>currentDate -></technical_language>

Target:
private void setAppLastOpenedDateIfNewer(User userEntity, UserDevice deviceEntity) { LocalDate today = userEntity.getDateInUserTimezone(TimeUtil.utcNow()); LocalDate appLastOpenedDate = deviceEntity.getAppLastOpenedDate(); if (appLastOpenedDate.isBefore(today)) { deviceEntity.setAppLastOpenedDateToNow(userEntity); } }
Source:
<code>public void workingWithInstallers() { dashboardWorkspace.selectTabInWorspaceMenu(INSTALLERS); Assert.assertTrue(dashboardWorkspace.getInstallerState("Workspace API", "1.0.1")); Assert.assertFalse(dashboardWorkspace.getInstallerState("Workspace API", "1.0.0")); <START> dashboardWorkspace.switchInstallerState("Workspace API", "1.0.1"); <END> dashboardWorkspace.switchInstallerState("Workspace API", "1.0.0"); Assert.assertTrue(dashboardWorkspace.getInstallerState("Workspace API", "1.0.1")); Assert.assertFalse(dashboardWorkspace.getInstallerState("Workspace API", "1.0.0")); dashboardWorkspace.selectMachine("Workspace Installers", "dev-machine"); installers.forEach( (name, value) -> { dashboardWorkspace.checkInstallerExists(name); }); installers.forEach( (name, value) -> { Assert.assertEquals(dashboardWorkspace.getInstallerState(name), value); dashboardWorkspace.switchInstallerState(name); WaitUtils.sleepQuietly(1); }); clickOnSaveButton(); installers.forEach( (name, value) -> { dashboardWorkspace.switchInstallerState(name); loader.waitOnClosed(); }); clickOnSaveButton(); installers.forEach( (name, value) -> { Assert.assertEquals(dashboardWorkspace.getInstallerState(name), value); }); }</code><technical_language>in mind states of _Installer State_ column in **Installers** tab of workspace configuration in Dashboard: ![screenshot 2017-12-04 15-41-49](<LINK_0> I suggest test states of in UI: - boolean isInstallerStateTurnedOn() - boolean isInstallerStateChangeable()</technical_language>

Target:
public void workingWithInstallers() { workspaceDetails.selectTabInWorkspaceMenu(INSTALLERS); assertTrue(workspaceInstallers.isInstallerStateTurnedOn("Workspace API", "1.0.1")); assertFalse(workspaceInstallers.isInstallerStateTurnedOn("Workspace API", "1.0.0")); assertTrue(workspaceInstallers.isInstallerStateNotChangeable("Workspace API", "1.0.1")); assertTrue(workspaceInstallers.isInstallerStateNotChangeable("Workspace API", "1.0.0")); workspaceMachines.selectMachine("Workspace Installers", "dev-machine"); installers.forEach( (name, value) -> { workspaceInstallers.checkInstallerExists(name); }); installers.forEach( (name, value) -> { Assert.assertEquals(workspaceInstallers.isInstallerStateTurnedOn(name), value); workspaceInstallers.switchInstallerState(name); WaitUtils.sleepQuietly(1); }); clickOnSaveButton(); installers.forEach( (name, value) -> { workspaceInstallers.switchInstallerState(name); loader.waitOnClosed(); }); clickOnSaveButton(); installers.forEach( (name, value) -> { Assert.assertEquals(workspaceInstallers.isInstallerStateTurnedOn(name), value); }); }
Source:
<code>public <R, D> void registerView(String name, String desc, Class<R> rowCls, Supplier<Collection<D>> dataSupplier, Function<D, R> rowFunc) { <START> SystemView sysView = new SystemViewAdapter<>(name, desc, rowCls, (SystemViewRowAttributeWalker<R>)walkers.get(rowCls), dataSupplier, rowFunc); SystemView<?> old = systemViews.putIfAbsent(name, sysView); assert old == null; notifyListeners(sysView, viewCreationLsnrs, log); <END> }</code><technical_language>code duplication</technical_language>

Target:
public <R, D> void registerView(String name, String desc, Class<R> rowCls, Supplier<Collection<D>> dataSupplier, Function<D, R> rowFunc) { registerView0(name, new SystemViewAdapter<>(name, desc, rowCls, (SystemViewRowAttributeWalker<R>)walkers.get(rowCls), dataSupplier, rowFunc)); }
Source:
<code>private String getNextGreaterString(String volumeName, String bucketName, String keyPrefix) { String nextPrefix = keyPrefix.substring(0, keyPrefix.length() - 1) + <START> String.valueOf((char) (keyPrefix.charAt(keyPrefix.length() - 1) + 1)); <END> return metadataManager.getOzoneKey(volumeName, bucketName, nextPrefix); }</code><technical_language>This is a great optimization. this point character in ASCII table ? lets verify this for UTF-8 encoding well</technical_language>

Target:
private String getNextGreaterString(String volumeName, String bucketName, String keyPrefix) throws IOException { Preconditions.checkArgument(!Strings.isNullOrEmpty(keyPrefix), "Key prefix is null or empty"); CodecRegistry codecRegistry = ((RDBStore) metadataManager.getStore()).getCodecRegistry(); byte[] keyPrefixInBytes = codecRegistry.asRawData(keyPrefix); keyPrefixInBytes[keyPrefixInBytes.length - 1]++; String nextPrefix = codecRegistry.asObject(keyPrefixInBytes, String.class); return metadataManager.getOzoneKey(volumeName, bucketName, nextPrefix); }
Source:
<code>protected Boolean doInBackground(String... strings) { String replayData = strings[0]; try { JSONObject jsonObject = new JSONObject(replayData); roomId = jsonObject.getString("id"); String postData = "log=" + jsonObject.getString("log") + "&id=" + jsonObject.getString("id"); URL url = new URL(REPLAY_EXPORT_URL); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setDoInput(true); conn.setDoOutput(true); DataOutputStream outStream = new DataOutputStream(conn.getOutputStream()); outStream.writeBytes(postData); outStream.flush(); outStream.close(); InputStream inputStream = conn.getInputStream(); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader((inputStream))); String output = bufferedReader.readLine(); inputStream.close(); <START> if (output.equals("success")) { <END> return true; } else { return false; } } catch (Exception e) { this.e = e; return false; } }</code><technical_language>return output.equals("success");</technical_language>

Target:
protected Boolean doInBackground(String... strings) { String replayData = strings[0]; try { JSONObject jsonObject = new JSONObject(replayData); roomId = jsonObject.getString("id"); String postData = "log=" + jsonObject.getString("log") + "&id=" + jsonObject.getString("id"); URL url = new URL(REPLAY_EXPORT_URL); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setDoInput(true); conn.setDoOutput(true); DataOutputStream outStream = new DataOutputStream(conn.getOutputStream()); outStream.writeBytes(postData); outStream.flush(); outStream.close(); InputStream inputStream = conn.getInputStream(); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader((inputStream))); String output = bufferedReader.readLine(); inputStream.close(); return output.equals("success"); } catch (Exception e) { this.e = e; return false; } }
Source:
<code>public V remove (K key) { int loc = locateKey(key); if (loc == -1) { return null; } V oldValue = valueTable[loc]; <START> while ((key = keyTable[loc + 1 & mask]) != null && (loc + 1 & mask) != place(key)) { <END> keyTable[loc] = key; valueTable[loc] = valueTable[++loc & mask]; } keyTable[loc] = null; valueTable[loc] = null; --size; return oldValue; }</code><technical_language>avoid doubled calculations (loc + 1 & mask) => a variable calc index</technical_language>

Target:
public V remove (K key) { int loc = locateKey(key); if (loc == -1) { return null; } V oldValue = valueTable[loc]; int nl = (loc + 1 & mask); while ((key = keyTable[nl]) != null && nl != place(key)) { keyTable[loc] = key; valueTable[loc] = valueTable[nl]; loc = nl; nl = loc + 1 & mask; } keyTable[loc] = null; valueTable[loc] = null; --size; return oldValue; }