auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void setVmLeasesAvailability() { TModel model = getModel(); Version compVer = model.getSelectedCluster().getCompatibilityVersion(); if (model.getCustomCompatibilityVersion().getSelectedItem() != null) { compVer = model.getCustomCompatibilityVersion().getSelectedItem(); } boolean vmLeasesSupported = AsyncDataProvider.getInstance().isVmLeasesFeatureSupported(compVer); if (!vmLeasesSupported) { model.getLease().setIsChangeable(false, constants.vmLeasesSupported()); } else { <START> model.getLease().setIsChangeable(model.getIsHighlyAvailable().getEntity()); <END> } }</code><technical_language>please put a reason is supported</technical_language>

Target:
private void setVmLeasesAvailability() { TModel model = getModel(); Version compVer = model.getSelectedCluster().getCompatibilityVersion(); if (model.getCustomCompatibilityVersion().getSelectedItem() != null) { compVer = model.getCustomCompatibilityVersion().getSelectedItem(); } boolean vmLeasesSupported = AsyncDataProvider.getInstance().isVmLeasesFeatureSupported(compVer); if (!vmLeasesSupported) { model.getLease().setIsChangeable(false, constants.vmLeasesSupported()); } else { model.getLease().setIsChangeable(model.getIsHighlyAvailable().getEntity()); if (!model.getIsHighlyAvailable().getEntity()) { model.getLease().setChangeProhibitionReason(constants.vmLeasesNotSupportedWithoutHA()); } } }
Source:
<code>public boolean contains(Integer patientId) { return getMembers() != null && getMembers().stream() <START> .anyMatch(m -> m.getPatient().getPatientId().equals(patientId)); <END> }</code><technical_language>here, assume of methods needs delegate another centralize avoid duplication of code. earlier I is delegate this comparing patientIds</technical_language>

Target:
public boolean contains(Integer patientId) { return getMembers() != null && getMembers().stream() .anyMatch(m -> m.getPatient().getPatientId().equals(patientId) && m.isMemberActive()); }
Source:
<code>public ObjectProperty<ContainersFilter> filterProperty() { <START> return filter; <END> }</code><technical_language>this (also below)</technical_language>

Target:
public ObjectProperty<ContainersFilter> filterProperty() { return this.filter; }
Source:
<code>public void testFetchUnreachableBlobWithBitmap() throws Exception { RevBlob blob = remote.blob("foo"); RevCommit commit = remote.commit(remote.tree(remote.file("foo", blob))); generateBitmaps(server); testProtocol = generateReachableCommitUploadPackProtocol(); uri = testProtocol.register(ctx, server); assertFalse(client.hasObject(blob.toObjectId())); <START> thrown.expect(TransportException.class); thrown.expectMessage(Matchers.containsString("want " + blob.name() + " not valid")); <END> try (Transport tn = testProtocol.open(uri, client, "server")) { tn.fetch(NullProgressMonitor.INSTANCE, Collections.singletonList(new RefSpec(blob.name()))); } }</code><technical_language>move this right statement is expected throw</technical_language>

Target:
public void testFetchUnreachableBlobWithBitmap() throws Exception { RevBlob blob = remote.blob("foo"); RevCommit commit = remote.commit(remote.tree(remote.file("foo", blob))); generateBitmaps(server); testProtocol = generateReachableCommitUploadPackProtocol(); uri = testProtocol.register(ctx, server); assertFalse(client.hasObject(blob.toObjectId())); try (Transport tn = testProtocol.open(uri, client, "server")) { thrown.expect(TransportException.class); thrown.expectMessage(Matchers.containsString( "want " + blob.name() + " not valid")); tn.fetch(NullProgressMonitor.INSTANCE, Collections.singletonList(new RefSpec(blob.name()))); } }
Source:
<code>public void expireDynamicConfig() throws Exception { HeisenbergExtension config = invokeDynamicConfig("dynamic", "heisenberg", "Walt"); <START> Thread.sleep(6000); <END> HeisenbergExtension anotherConfig = invokeDynamicConfig("dynamic", "heisenberg", "Walt"); assertExpired(config, 5000, 1000); assertInitialised(config); }</code><technical_language>a probe instead of thread sleep</technical_language>

Target:
public void expireDynamicConfig() throws Exception { HeisenbergExtension config = invokeDynamicConfig("dynamic", "heisenberg", "Walt"); try { assertExpired(config, 5000, 1000); } catch (AssertionError e) { HeisenbergExtension anotherConfig = invokeDynamicConfig("dynamic", "heisenberg", "Walt"); } assertExpired(config, 5000, 1000); assertInitialised(config); }
Source:
<code>public void developerOptionsEnabled() throws Exception { Instrumentation instrumentation = testFramework.getInstrumentation(); AppLauncher.launch(instrumentation, "Settings"); UiScrollable itemList = new UiScrollable( new UiSelector().resourceIdMatches(Res.SETTINGS_LIST_CONTAINER_RES)); itemList.setAsVerticalList(); <START> if (!itemList.getChildByText( new UiSelector().className(WIDGET_TEXT_VIEW_CLASS), "Developer options").exists()) { <END> DeveloperOptionsManager.enableDeveloperOptions(testFramework.getInstrumentation()); } AppLauncher.launch(instrumentation, "Settings"); itemList.getChildByText( new UiSelector().className(WIDGET_TEXT_VIEW_CLASS), "Developer options"); }</code><technical_language>is isDeveloperOptionsEnabled in fixture</technical_language>

Target:
public void developerOptionsEnabled() throws Exception { Instrumentation instrumentation = testFramework.getInstrumentation(); AppLauncher.launch(instrumentation, "Settings"); UiScrollable itemList = new UiScrollable( new UiSelector().resourceIdMatches(Res.SETTINGS_LIST_CONTAINER_RES)); itemList.setAsVerticalList(); if (!itemList.getChildByText( new UiSelector().className(WIDGET_TEXT_VIEW_CLASS), "Developer options").exists()) { DeveloperOptionsManager.enableDeveloperOptions(instrumentation); } AppLauncher.launch(instrumentation, "Settings"); itemList.getChildByText( new UiSelector().className(WIDGET_TEXT_VIEW_CLASS), "Developer options"); }
Source:
<code>private String taskArgsAsCmd() { StringBuilder result = new StringBuilder(); if (!F.isEmpty(taskArg.getCaches())) { for (String cache : taskArg.getCaches()) { result.append(cache); result.append(" "); } } if (taskArg.getCacheFilterEnum() != null) { result.append(CACHE_FILTER); result.append(" "); <START> result.append(taskArg.getCacheFilterEnum().toString()); <END> result.append(" "); } if (!F.isEmpty(taskArg.getExcludeCaches())) { result.append(EXCLUDE_CACHES + " "); for (String excluded : taskArg.getExcludeCaches()) { result.append(excluded); result.append(" "); } } return result.toString(); }</code><technical_language>toString() invocation is redudant here</technical_language>

Target:
private String taskArgsAsCmd() { StringBuilder result = new StringBuilder(); if (!F.isEmpty(taskArg.getCaches())) { for (String cache : taskArg.getCaches()) { result.append(cache); result.append(" "); } } if (taskArg.getCacheFilterEnum() != null) { result.append(CACHE_FILTER); result.append(" "); result.append(taskArg.getCacheFilterEnum()); result.append(" "); } if (!F.isEmpty(taskArg.getExcludeCaches())) { result.append(EXCLUDE_CACHES + " "); for (String excluded : taskArg.getExcludeCaches()) { result.append(excluded); result.append(" "); } } return result.toString(); }
Source:
<code>public RouterConfig(VerifiableProperties verifiableProperties) { <START> routerScalingUnitCount = verifiableProperties.getIntInRange("router.scaling.unit.count", 1, 0, 200); <END> routerHostname = verifiableProperties.getString("router.hostname"); routerDatacenterName = verifiableProperties.getString("router.datacenter.name"); routerScalingUnitMaxConnectionsPerPortPlainText = verifiableProperties.getIntInRange("router.scaling.unit.max.connections.per.port.plain.text", 5, 1, 20); routerScalingUnitMaxConnectionsPerPortSsl = verifiableProperties.getIntInRange("router.scaling.unit.max.connections.per.port.ssl", 2, 1, 20); routerConnectionCheckoutTimeoutMs = verifiableProperties.getIntInRange("router.connection.checkout.timeout.ms", 1000, 1, 5000); routerRequestTimeoutMs = verifiableProperties.getInt("router.request.timeout.ms", 2000); routerMaxPutChunkSizeBytes = verifiableProperties.getInt("router.max.put.chunk.size.bytes", 4 * 1024 * 1024); routerPutRequestParallelism = verifiableProperties.getInt("router.put.request.parallelism", 3); routerPutSuccessTarget = verifiableProperties.getInt("router.put.success.target", 2); routerMaxSlippedPutAttempts = verifiableProperties.getInt("router.max.slipped.put.attempts", 1); routerDeleteRequestParallelism = verifiableProperties.getInt("router.delete.request.parallelism", 12); routerDeleteSuccessTarget = verifiableProperties.getInt("router.delete.success.target", 2); }</code><technical_language>is bound 0? 1</technical_language>

Target:
public RouterConfig(VerifiableProperties verifiableProperties) { routerScalingUnitCount = verifiableProperties.getIntInRange("router.scaling.unit.count", 1, 1, 200); routerHostname = verifiableProperties.getString("router.hostname"); routerDatacenterName = verifiableProperties.getString("router.datacenter.name"); routerScalingUnitMaxConnectionsPerPortPlainText = verifiableProperties.getIntInRange("router.scaling.unit.max.connections.per.port.plain.text", 5, 1, 20); routerScalingUnitMaxConnectionsPerPortSsl = verifiableProperties.getIntInRange("router.scaling.unit.max.connections.per.port.ssl", 2, 1, 20); routerConnectionCheckoutTimeoutMs = verifiableProperties.getIntInRange("router.connection.checkout.timeout.ms", 1000, 1, 5000); routerRequestTimeoutMs = verifiableProperties.getInt("router.request.timeout.ms", 2000); routerMaxPutChunkSizeBytes = verifiableProperties.getInt("router.max.put.chunk.size.bytes", 4 * 1024 * 1024); routerPutRequestParallelism = verifiableProperties.getInt("router.put.request.parallelism", 3); routerPutSuccessTarget = verifiableProperties.getInt("router.put.success.target", 2); routerMaxSlippedPutAttempts = verifiableProperties.getInt("router.max.slipped.put.attempts", 1); routerDeleteRequestParallelism = verifiableProperties.getInt("router.delete.request.parallelism", 12); routerDeleteSuccessTarget = verifiableProperties.getInt("router.delete.success.target", 2); }
Source:
<code>public void testConvertcaptureObjectDto() { final CaptureObject result = this.mapper.map(this.captureObjectDto(), CaptureObject.class); <START> Assert.assertTrue(result != null && result instanceof CaptureObject); <END> }</code><technical_language>use: import static org.hamcrest.CoreMatchers.instanceOf; ... assertNotNull(result); assertThat(result, instanceOf(ClassName.class));</technical_language>

Target:
public void testConvertcaptureObjectDto() { final CaptureObject result = this.mapper.map(this.captureObjectDto(), CaptureObject.class); assertNotNull("mapping CaptureObjectDto should not return null", result); assertThat("mapping CaptureObjectDto should return correct type", result, instanceOf(CaptureObject.class)); }
Source:
<code>private void doReleaseMessage(Message<?> message) { if (this.messageStore instanceof SimpleMessageStore || ((MessageStore) this.messageStore).removeMessage(message.getHeaders().getId()) != null) { this.messageStore.removeMessageFromGroup(this.messageGroupId, message); <START> this.delayTasks.remove(message.getHeaders().getId()); <END> this.handleMessageInternal(message); } else { if (logger.isDebugEnabled()) { logger.debug("No message in the Message Store to release: " + message + ". Likely another instance has already released it."); } } }</code><technical_language>This remove occur if group store removal fails scheduled future is "spent". need reschedule in event. delay</technical_language>

Target:
private void doReleaseMessage(Message<?> message) { if (removeDelayedMessageFromMessageStore(message)) { this.messageStore.removeMessageFromGroup(this.messageGroupId, message); this.handleMessageInternal(message); } else { if (logger.isDebugEnabled()) { logger.debug("No message in the Message Store to release: " + message + ". Likely another instance has already released it."); } } }
Source:
<code>public synchronized void setMessageCompression(boolean enable) { <START> call.setMessageCompression(enable); <END> }</code><technical_language>I this needs sync called init. I this throw UnsupportedException setting lost retry</technical_language>

Target:
public void setMessageCompression(boolean enable) { throw new UnsupportedOperationException("setMessageCompression()"); }
Source:
<code>public ITmfContext seekEvent(ITmfLocation location) { if (fFile == null) { return INVALID_CONTEXT; } final TmfContext context = new TmfContext(NULL_LOCATION, ITmfContext.UNKNOWN_RANK); if (NULL_LOCATION.equals(location)) { return context; } try { if (location == null) { fFileInput.seek(0); long lineStartOffset = fFileInput.getFilePointer(); <START> @Nullable String line = fFileInput.readLine(); <END> Matcher matcher = IGenericFtraceConstants.FTRACE_PATTERN.matcher(line); while (line != null && !matcher.matches()) { lineStartOffset = fFileInput.getFilePointer(); line = fFileInput.readLine(); if (line == null) { break; } matcher = IGenericFtraceConstants.FTRACE_PATTERN.matcher(line); } fFileInput.seek(lineStartOffset); } else if (location.getLocationInfo() instanceof Long) { fFileInput.seek((Long) location.getLocationInfo()); } context.setLocation(new TmfLongLocation(fFileInput.getFilePointer())); context.setRank(0); return context; } catch (final FileNotFoundException e) { Activator.getInstance().logError("Error seeking event. File not found: " + getPath(), e); return context; } catch (final IOException e) { Activator.getInstance().logError("Error seeking event. File: " + getPath(), e); return context; } }</code><technical_language>I put matcher line this one, if null here, get a NPE right after. if null here..</technical_language>

Target:
public ITmfContext seekEvent(ITmfLocation location) { if (fFile == null) { return INVALID_CONTEXT; } final TmfContext context = new TmfContext(NULL_LOCATION, ITmfContext.UNKNOWN_RANK); if (NULL_LOCATION.equals(location)) { return context; } try { if (location == null) { fFileInput.seek(0); long lineStartOffset = fFileInput.getFilePointer(); @Nullable String line = fFileInput.readLine(); if(line == null) { return context; } Matcher matcher = IGenericFtraceConstants.FTRACE_PATTERN.matcher(line); while (!matcher.matches()) { lineStartOffset = fFileInput.getFilePointer(); line = fFileInput.readLine(); if (line == null) { break; } matcher = IGenericFtraceConstants.FTRACE_PATTERN.matcher(line); } fFileInput.seek(lineStartOffset); } else if (location.getLocationInfo() instanceof Long) { fFileInput.seek((Long) location.getLocationInfo()); } context.setLocation(new TmfLongLocation(fFileInput.getFilePointer())); context.setRank(0); return context; } catch (final FileNotFoundException e) { Activator.getInstance().logError("Error seeking event. File not found: " + getPath(), e); return context; } catch (final IOException e) { Activator.getInstance().logError("Error seeking event. File: " + getPath(), e); return context; } }
Source:
<code>public void setUp() throws Exception { super.setUp(); copyFileToTestProject(Activator.PLUGIN_ID, PATH, ODESIGN_EXT_RESOURCE_NAME); copyFileToTestProject(Activator.PLUGIN_ID, PATH, SEMANTIC_INTERACTIONS_RESOURCE_NAME); copyFileToTestProject(Activator.PLUGIN_ID, PATH, AIRD_RESOURCE_NAME); changeDiagramUIPreference(SiriusDiagramUiPreferencesKeys.PREF_OLD_UI.name(), true); changeDiagramPreference(SiriusDiagramPreferencesKeys.PREF_DISPLAY_HEADER_SECTION.name(), false); sessionAirdResource = new UIResource(designerProject, "/", AIRD_RESOURCE_NAME); localSession = designerPerspective.openSessionFromFile(sessionAirdResource, true); editor = (SWTBotSiriusDiagramEditor) openRepresentation(localSession.getOpenedSession(), "Sequence Diagram on Interaction", "Sequence Diagram on 455443", DDiagram.class); <START> arrangeAll(); <END> maximizeEditor(editor); refreshLayoutScopeAsserter = new RefreshLayoutScopeAsserter(localSession.getOpenedSession().getTransactionalEditingDomain()); }</code><technical_language>Is arrangeAll necessary</technical_language>

Target:
public void setUp() throws Exception { super.setUp(); copyFileToTestProject(Activator.PLUGIN_ID, PATH, ODESIGN_EXT_RESOURCE_NAME); copyFileToTestProject(Activator.PLUGIN_ID, PATH, SEMANTIC_INTERACTIONS_RESOURCE_NAME); copyFileToTestProject(Activator.PLUGIN_ID, PATH, AIRD_RESOURCE_NAME); changeDiagramUIPreference(SiriusDiagramUiPreferencesKeys.PREF_OLD_UI.name(), true); changeDiagramPreference(SiriusDiagramPreferencesKeys.PREF_DISPLAY_HEADER_SECTION.name(), false); sessionAirdResource = new UIResource(designerProject, "/", AIRD_RESOURCE_NAME); localSession = designerPerspective.openSessionFromFile(sessionAirdResource, true); editor = (SWTBotSiriusDiagramEditor) openRepresentation(localSession.getOpenedSession(), "Sequence Diagram on Interaction", "Sequence Diagram on 455443", DDiagram.class); maximizeEditor(editor); refreshLayoutScopeAsserter = new RefreshLayoutScopeAsserter(localSession.getOpenedSession().getTransactionalEditingDomain()); }
Source:
<code>void runTest(String name) { name = name.replace('/', '.'); System.out.println("Running " + name); Form form = new Form(name); Display display = Display.getDisplay(this); Harness harness = new Harness(name, display); harness.setScreenAndWait(form); Class c = null; try { c = Class.forName(name); } catch (Exception e) { System.err.println(e); harness.fail("Can't load test"); } Object obj = null; try { obj = c.newInstance(); } catch (Exception e) { System.err.println(e); harness.fail("Can't instantiate test"); } Testlet t = (Testlet) obj; try { t.test(harness); } catch (Exception e) { System.err.println(e); harness.fail("Test threw an unexpected exception"); } harness.report(); boolean classPassed = true; if (harness.passed() != t.getExpectedPass()) { classPassed = false; System.err.println(name + ": test expected " + t.getExpectedPass() + " passes, got " + harness.passed()); } if (harness.failed() != t.getExpectedFail()) { classPassed = false; System.err.println(name + ": test expected " + t.getExpectedFail() + " failures, got " + harness.failed()); } if (harness.knownFailed() != t.getExpectedKnownFail()) { classPassed = false; System.err.println(name + ": test expected " + t.getExpectedKnownFail() + " known failures, got " + harness.knownFailed()); } if (classPassed) { classPass++; } else { classFail++; System.err.println(name + ": class fail"); } pass += harness.passed(); fail += harness.failed(); knownFail += harness.knownFailed(); unknownPass += harness.unknownPassed(); <START> System.out.println("Completed " + name); <END> }</code><technical_language>Nit: this is redundant harness.report()</technical_language>

Target:
void runTest(String name) { name = name.replace('/', '.'); System.out.println("Running " + name); Form form = new Form(name); Display display = Display.getDisplay(this); Harness harness = new Harness(name, display); harness.setScreenAndWait(form); Class c = null; try { c = Class.forName(name); } catch (Exception e) { System.err.println(e); harness.fail("Can't load test"); } Object obj = null; try { obj = c.newInstance(); } catch (Exception e) { System.err.println(e); harness.fail("Can't instantiate test"); } Testlet t = (Testlet) obj; try { t.test(harness); } catch (Exception e) { System.err.println(e); harness.fail("Test threw an unexpected exception"); } harness.report(); boolean classPassed = true; if (harness.passed() != t.getExpectedPass()) { classPassed = false; System.err.println(name + ": test expected " + t.getExpectedPass() + " passes, got " + harness.passed()); } if (harness.failed() != t.getExpectedFail()) { classPassed = false; System.err.println(name + ": test expected " + t.getExpectedFail() + " failures, got " + harness.failed()); } if (harness.knownFailed() != t.getExpectedKnownFail()) { classPassed = false; System.err.println(name + ": test expected " + t.getExpectedKnownFail() + " known failures, got " + harness.knownFailed()); } if (classPassed) { classPass++; } else { classFail++; System.err.println(name + ": class fail"); } pass += harness.passed(); fail += harness.failed(); knownFail += harness.knownFailed(); unknownPass += harness.unknownPassed(); }
Source:
<code>public D getDiagramByPath(final org.uberfire.backend.vfs.Path file) { if (accepts(file)) { DefinitionSetService services = getServiceByPath(file); if (null != services) { final String defSetId = getDefinitionSetId(services); final String name = parseFileName(file, services); M metadata = obtainMetadata(services, file, defSetId, name); if (null == metadata) { metadata = (M) buildMetadataInstance(file, defSetId, name); } metadata.setPath(file); final InputStream is = loadPath(file); try { final MarshallingResponse<Graph<DefinitionSet, ?>> marshallingResponse = services.getDiagramMarshaller().unmarshallWithValidation(MarshallingRequest.builder() .metadata(metadata) .input(is) .mode(MarshallingRequest.Mode.AUTO) .build()); final Graph<DefinitionSet, ?> graph = marshallingResponse.getResult() .orElseThrow(() -> new RuntimeException(marshallingResponse.getMessages().toString())); final DiagramFactory<M, ?> factory = factoryManager.registry().getDiagramFactory(graph.getContent().getDefinition(), getMetadataType()); <START> D diagram = (D) factory.build(name, <END> metadata, graph); return diagram; } catch (Exception e) { LOG.error("Cannot unmarshall diagram for diagram's path [" + file + "]", e); final String xml = getIoService().readAllString(Paths.convert(file)); throw new DiagramParsingException(metadata, xml); } } } throw new UnsupportedOperationException("Diagram format not supported [" + file + "]"); }</code><technical_language>D diagram variable needed</technical_language>

Target:
public D getDiagramByPath(final org.uberfire.backend.vfs.Path file) { if (accepts(file)) { DefinitionSetService services = getServiceByPath(file); if (null != services) { final String defSetId = getDefinitionSetId(services); final String name = parseFileName(file, services); M metadata = obtainMetadata(services, file, defSetId, name); if (null == metadata) { metadata = (M) buildMetadataInstance(file, defSetId, name); } metadata.setPath(file); final InputStream is = loadPath(file); try { final MarshallingResponse<Graph<DefinitionSet, ?>> marshallingResponse = services.getDiagramMarshaller().unmarshallWithValidation(MarshallingRequest.builder() .metadata(metadata) .input(is) .mode(MarshallingRequest.Mode.AUTO) .build()); final Graph<DefinitionSet, ?> graph = Optional.ofNullable(marshallingResponse.getResult()) .orElseThrow(() -> new RuntimeException(marshallingResponse.getMessages().toString())); final DiagramFactory<M, ?> factory = factoryManager.registry().getDiagramFactory(graph.getContent().getDefinition(), getMetadataType()); return (D) factory.build(name, metadata, graph); } catch (Exception e) { LOG.error("Cannot unmarshall diagram for diagram's path [" + file + "]", e); final String xml = getIoService().readAllString(Paths.convert(file)); throw new DiagramParsingException(metadata, xml); } } } throw new UnsupportedOperationException("Diagram format not supported [" + file + "]"); }
Source:
<code>public void build(String target) { Path projectRoot = InProject.findProjectRoot(); if (!Files.exists(projectRoot.resolve("Rakefile"))) { return; } if (target == null || "".equals(target)) { throw new IllegalStateException("No targets specified"); } <START> log.finest("\nBuilding " + target + " ..."); <END> ImmutableList.Builder<String> builder = ImmutableList.builder(); builder.add("bazel", "build", target); ImmutableList<String> command = builder.build(); CommandLine commandLine = new CommandLine(command.toArray(new String[0])); commandLine.setWorkingDirectory(projectRoot.toAbsolutePath().toString()); commandLine.copyOutputTo(System.err); commandLine.execute(); if (!commandLine.isSuccessful()) { throw new WebDriverException("Build failed! " + target + "\n" + commandLine.getStdOut()); } }</code><technical_language>This is people tooling is a build. Please leave</technical_language>

Target:
public void build(String target) { Path projectRoot = InProject.findProjectRoot(); if (!Files.exists(projectRoot.resolve("Rakefile"))) { return; } if (target == null || "".equals(target)) { throw new IllegalStateException("No targets specified"); } log.info("\nBuilding " + target + " ..."); ImmutableList.Builder<String> builder = ImmutableList.builder(); builder.add("bazel", "build", target); ImmutableList<String> command = builder.build(); CommandLine commandLine = new CommandLine(command.toArray(new String[0])); commandLine.setWorkingDirectory(projectRoot.toAbsolutePath().toString()); commandLine.copyOutputTo(System.err); commandLine.execute(); if (!commandLine.isSuccessful()) { throw new WebDriverException("Build failed! " + target + "\n" + commandLine.getStdOut()); } }
Source:
<code>public static ConfigurationTransition of( ConfigurationTransition transition1, ConfigurationTransition transition2) { Preconditions.checkNotNull(transition1); Preconditions.checkNotNull(transition2); <START> if (transition1 == NullTransition.INSTANCE || transition1.isHostTransition()) { <END> return transition1; } else if (transition1 == NoTransition.INSTANCE) { return transition2; } if (transition2 == NoTransition.INSTANCE) { return transition1; } else if (transition2 == NullTransition.INSTANCE || transition2.isHostTransition()) { return transition2; } return new ComposingTransition(transition1, transition2); }</code><technical_language>Is some a single source of truth for isFinal()? i.e. if isFinal() is changed for some TransitionFactory this logic get updated? strongly, isFinal method in explicitly calling out NullTransition HostTransition twice</technical_language>

Target:
public static ConfigurationTransition of( ConfigurationTransition transition1, ConfigurationTransition transition2) { Preconditions.checkNotNull(transition1); Preconditions.checkNotNull(transition2); if (isFinal(transition1)) { return transition1; } else if (transition1 == NoTransition.INSTANCE) { return transition2; } if (transition2 == NoTransition.INSTANCE) { return transition1; } else if (isFinal(transition2)) { return transition2; } return new ComposingTransition(transition1, transition2); }
Source:
<code>public void testSplit() throws Exception { long bamFileSize = LARGE_BAM_FILE.length(); SBIIndex index = fromBAMFile(LARGE_BAM_FILE, 100); List<Chunk> chunks = index.split(bamFileSize / 10); Assert.assertTrue(chunks.size() > 1); SamReader samReader = SamReaderFactory.makeDefault() .validationStringency(ValidationStringency.SILENT) .enable(SamReaderFactory.Option.INCLUDE_SOURCE_IN_RECORDS).open(LARGE_BAM_FILE); List<SAMRecord> allReads = Iterables.slurp(samReader); List<SAMRecord> allReadsFromChunks = new ArrayList<>(); <START> for (Chunk chunk : chunks) { <END> allReadsFromChunks.addAll(getReadsInChunk(LARGE_BAM_FILE, chunk)); } Assert.assertEquals(allReadsFromChunks, allReads); List<Chunk> optimizedChunks = Chunk.optimizeChunkList(chunks, 0); Assert.assertEquals(optimizedChunks.size(), 1); List<SAMRecord> allReadsFromOneChunk = getReadsInChunk(LARGE_BAM_FILE, optimizedChunks.get(0)); Assert.assertEquals(allReadsFromOneChunk, allReads); }</code><technical_language>final chunk</technical_language>

Target:
public void testSplit() throws Exception { final long bamFileSize = LARGE_BAM_FILE.length(); final SBIIndex index = fromBAMFile(LARGE_BAM_FILE, 100); final List<Chunk> chunks = index.split(bamFileSize / 10); Assert.assertTrue(chunks.size() > 1); final List<SAMRecord> allReads = getReads(LARGE_BAM_FILE); final List<SAMRecord> allReadsFromChunks = new ArrayList<>(); for (final Chunk chunk : chunks) { allReadsFromChunks.addAll(getReadsInChunk(LARGE_BAM_FILE, chunk)); } Assert.assertEquals(allReadsFromChunks, allReads); final List<Chunk> optimizedChunks = Chunk.optimizeChunkList(chunks, 0); Assert.assertEquals(optimizedChunks.size(), 1); final List<SAMRecord> allReadsFromOneChunk = getReadsInChunk(LARGE_BAM_FILE, optimizedChunks.get(0)); Assert.assertEquals(allReadsFromOneChunk, allReads); }
Source:
<code>public HostLocation getHostLocation() { String hostname = Parameter.value("minion.localhost"); <START> <END> Pattern adMatcher = Pattern.compile(Parameter.value("adPattern", "(ad[0-9]+)")); Pattern rackMatcher = Pattern.compile(Parameter.value("rackPattern", "(rack[0-9]+)")); Pattern physicalHostMatcher = Pattern.compile(Parameter.value("physicalHostPattern", "(physicalHost[0-9]+)")); String ad = match(hostname, adMatcher); String rack = match(hostname, rackMatcher); String physicalHost = match(hostname, physicalHostMatcher); return new HostLocation(ad, rack, physicalHost); }</code><technical_language>comfortable regex sufficient. discuss better</technical_language>

Target:
public HostLocation getHostLocation() { String hostname = Parameter.value("minion.localhost"); String dataCenterPattern = Parameter.value("minion.datacenterPattern", ""); String rackPattern = Parameter.value("minion.rackPattern", ""); String physicalHostMatcher = Parameter.value("minion.physicalHostPattern", ""); String ad = match(hostname, dataCenterPattern); String rack = match(hostname, rackPattern); String physicalHost = match(hostname, physicalHostMatcher); return new HostLocation(ad, rack, physicalHost); }
Source:
<code>private static boolean generatesPrivateAccess(ClassTree tree) { <START> if (usesAnnotation(tree, Collections.singletonList("lombok.Value"))) { <END> return true; } return Optional.ofNullable(tree.symbol().metadata().valuesForAnnotation("lombok.experimental.FieldDefaults")) .map(List::stream) .map(s -> s.filter(Objects::nonNull) .anyMatch(av -> "level".equals(av.name()) && "PRIVATE".equals(getAccessLevelValue(av.value()))) ).orElse(false); }</code><technical_language>Trigger S1192: "Define a constant instead of duplicating this literal "lombok.Value" 3 times." SonarLint?</technical_language>

Target:
private static boolean generatesPrivateAccess(ClassTree tree) { if (usesAnnotation(tree, Collections.singletonList(LOMBOK_VALUE))) { return true; } return Optional.ofNullable(tree.symbol().metadata().valuesForAnnotation(LOMBOK_FIELD_DEFAULTS)) .map(List::stream) .map(s -> s.filter(Objects::nonNull) .anyMatch(av -> "level".equals(av.name()) && "PRIVATE".equals(getAccessLevelValue(av.value()))) ).orElse(false); }
Source:
<code>ValidationResult validateRemovedLabels(VdsNetworkInterface unmgmtNic, Set<String> removedLabels) { if (unmgmtNic.getLabels() != null && !Collections.disjoint(unmgmtNic.getLabels(), removedLabels)){ <START> return new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_HOST_NETWORK_REMOVE_LABEL_FROM_UNMANAGED_NETWORK, <END> ReplacementUtils.createSetVariableString(NIC, unmgmtNic.getName())); } return ValidationResult.VALID; }</code><technical_language>if familiar this construct - conditional builder for ValidationResult: ValidationResult.failWith().when(). relieve need explicitely write if return ValidationResult.VALID</technical_language>

Target:
ValidationResult validateRemovedLabels(VdsNetworkInterface unmgmtNic, Set<String> removedLabels) { return ValidationResult.failWith(EngineMessage.ACTION_TYPE_FAILED_HOST_NETWORK_REMOVE_LABEL_FROM_UNMANAGED_NETWORK, ReplacementUtils.createSetVariableString(NIC, unmgmtNic.getName())). when(unmgmtNic.getLabels() != null && !Collections.disjoint(unmgmtNic.getLabels(), removedLabels)); }
Source:
<code>public void onPlayerJoin(PlayerJoinEvent event) { if (plugin.al.isAdmin(event.getPlayer())) { if (plugin.al.isCommandSpyActive(event.getPlayer())) { FPlayer playerdata = plugin.pl.getPlayer(event.getPlayer()); playerdata.setCommandSpy(playerdata.cmdspyEnabled() == true); <START> } else <END> { FPlayer playerdata = plugin.pl.getPlayer(event.getPlayer()); playerdata.setCommandSpy(playerdata.cmdspyEnabled() == false); } } else { FPlayer playerdata = plugin.pl.getPlayer(event.getPlayer()); playerdata.setCommandSpy(playerdata.cmdspyEnabled() == false); } }</code><technical_language>Formatting</technical_language>

Target:
public void onPlayerJoin(PlayerJoinEvent event) { Admin admin = getAdmin((Player) event.getPlayer()); FPlayer playerdata = plugin.pl.getPlayer(event.getPlayer()); if (plugin.al.isAdmin(event.getPlayer())) { if (admin.hasCommandSpy()) { playerdata.setCommandSpy(playerdata.cmdspyEnabled() == true); } else { playerdata.setCommandSpy(playerdata.cmdspyEnabled() == false); } } else { playerdata.setCommandSpy(playerdata.cmdspyEnabled() == false); } }
Source:
<code>public static VmPool map(org.ovirt.engine.core.common.businessentities.VmPool entity, VmPool template) { VmPool model = template != null ? template : new VmPool(); model.setId(entity.getVmPoolId().toString()); model.setName(entity.getName()); model.setDescription(entity.getVmPoolDescription()); model.setComment(entity.getComment()); model.setSize(entity.getAssignedVmsCount()); model.setPrestartedVms(entity.getPrestartedVms()); if (entity.getVdsGroupId() != null || entity.getVdsGroupName() != null) { model.setCluster(new Cluster()); model.getCluster().setId(entity.getVdsGroupId().toString()); } model.setMaxUserVms(entity.getMaxAssignedVmsPerUser()); if (StringUtils.isNotBlank(entity.getSpiceProxy())) { Display display = new Display(); display.setProxy(entity.getSpiceProxy()); model.setDisplay(display); } <START> model.setType(entity.getVmPoolType().name().toLowerCase()); <END> return model; }</code><technical_language>here, rely name, write equivalent enum in API map values explicitly, example other enum in API</technical_language>

Target:
public static VmPool map(org.ovirt.engine.core.common.businessentities.VmPool entity, VmPool template) { VmPool model = template != null ? template : new VmPool(); model.setId(entity.getVmPoolId().toString()); model.setName(entity.getName()); model.setDescription(entity.getVmPoolDescription()); model.setComment(entity.getComment()); model.setSize(entity.getAssignedVmsCount()); model.setPrestartedVms(entity.getPrestartedVms()); if (entity.getVdsGroupId() != null || entity.getVdsGroupName() != null) { model.setCluster(new Cluster()); model.getCluster().setId(entity.getVdsGroupId().toString()); } model.setMaxUserVms(entity.getMaxAssignedVmsPerUser()); if (StringUtils.isNotBlank(entity.getSpiceProxy())) { Display display = new Display(); display.setProxy(entity.getSpiceProxy()); model.setDisplay(display); } model.setType(map(entity.getVmPoolType(), null)); return model; }
Source:
<code>private Collection<FeedbackResponseComment> getFeedbackResponseCommentEntitiesForSessionInSection( String courseId, String feedbackSessionName, String section) { Map<Long, FeedbackResponseComment> comments = new HashMap<Long, FeedbackResponseComment>(); for (FeedbackResponseComment comment : load() .filter("courseId =", courseId) .filter("feedbackSessionName =", feedbackSessionName) .filter("giverSection =", section) <START> .list()) { <END> comments.put(comment.getFeedbackResponseCommentId(), comment); } for (FeedbackResponseComment comment : load() .filter("courseId =", courseId) .filter("feedbackSessionName =", feedbackSessionName) .filter("receiverSection =", section) .list()) { comments.put(comment.getFeedbackResponseCommentId(), comment); } return comments.values(); }</code><technical_language>Extract list a variable for readability :p</technical_language>

Target:
private Collection<FeedbackResponseComment> getFeedbackResponseCommentEntitiesForSessionInSection( String courseId, String feedbackSessionName, String section) { Map<Long, FeedbackResponseComment> comments = new HashMap<>(); List<FeedbackResponseComment> firstQueryResponseComments = load() .filter("courseId =", courseId) .filter("feedbackSessionName =", feedbackSessionName) .filter("giverSection =", section) .list(); for (FeedbackResponseComment comment : firstQueryResponseComments) { comments.put(comment.getFeedbackResponseCommentId(), comment); } List<FeedbackResponseComment> secondQueryResponseComments = load() .filter("courseId =", courseId) .filter("feedbackSessionName =", feedbackSessionName) .filter("receiverSection =", section) .list(); for (FeedbackResponseComment comment : secondQueryResponseComments) { comments.put(comment.getFeedbackResponseCommentId(), comment); } return comments.values(); }
Source:
<code>public void setClass(String name, String groups, String engines) { if (name != null) { this.nameField.setValue(name); this.nameField.setDisabled(true); <START> this.enginesPickList.setValues(engines.split(", ")); <END> this.groupsPickList.setValues(groups.split(", ")); this.newClass = false; this.removeButton.setDisabled(false); } else { this.nameField.setValue(""); this.nameField.setDisabled(false); this.enginesPickList.setValues(new String[]{}); this.groupsPickList.setValues(new String[]{}); this.newClass = true; this.removeButton.setDisabled(true); } }</code><technical_language>split "," only, trim result. in case..</technical_language>

Target:
public void setClass(String name, String groups, String engines) { if (name != null) { this.nameField.setValue(name); this.nameField.setDisabled(true); this.enginesPickList.setValues(engines.split("\\s*,\\s*")); this.groupsPickList.setValues(groups.split("\\s*,\\s*")); this.newClass = false; this.removeButton.setDisabled(false); } else { this.nameField.setValue(""); this.nameField.setDisabled(false); this.enginesPickList.setValues(new String[]{}); this.groupsPickList.setValues(new String[]{}); this.newClass = true; this.removeButton.setDisabled(true); } }
Source:
<code>public int hashCode() { return HashUtil.combineHashCodes(super.hashCode(), <START> onEntryAction.hashCode(), <END> onExitAction.hashCode(), isAsync.hashCode()); }</code><technical_language>Objects.hashCode</technical_language>

Target:
public int hashCode() { return HashUtil.combineHashCodes(super.hashCode(), Objects.hashCode(onEntryAction), Objects.hashCode(onExitAction), Objects.hashCode(isAsync)); }
Source:
<code>protected void onRestoreInstanceState(final Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); usernameEdit.setText(savedInstanceState.getString(Save_username)); passwordEdit.setText(savedInstanceState.getString(Save_password)); <START> <END> if(savedInstanceState.getBoolean(Save_progressDailog)){ performLogin(); } String errorMessage=savedInstanceState.getString(Save_errorMessage); if(sessionManager.isUserLoggedIn()){ showMessage(R.string.login_success, R.color.primaryDarkColor); }else{ showMessage(errorMessage, R.color.secondaryDarkColor); } }</code><technical_language>formatting please? random whitespaces exist</technical_language>

Target:
protected void onRestoreInstanceState(final Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); usernameEdit.setText(savedInstanceState.getString(saveUsername)); passwordEdit.setText(savedInstanceState.getString(savePassword)); if(savedInstanceState.getBoolean(saveProgressDailog)) { performLogin(); } String errorMessage=savedInstanceState.getString(saveErrorMessage); if(sessionManager.isUserLoggedIn()) { showMessage(R.string.login_success, R.color.primaryDarkColor); } else { showMessage(errorMessage, R.color.secondaryDarkColor); } }
Source:
<code>public INDArray createFromNpyFile(File file) { byte[] pathBytes = file.getAbsolutePath().getBytes(Charset.forName("UTF-8" )); String otherBytes = new String(pathBytes); System.out.println(otherBytes); ByteBuffer directBuffer = ByteBuffer.allocateDirect(pathBytes.length).order(ByteOrder.nativeOrder()); directBuffer.put(pathBytes); <START> directBuffer.put(pathBytes); <END> directBuffer.rewind(); directBuffer.position(0); Pointer pointer = nativeOps.numpyFromFile(new BytePointer(directBuffer)); return createFromNpyPointer(pointer); }</code><technical_language>reason this twice</technical_language>

Target:
public INDArray createFromNpyFile(File file) { byte[] pathBytes = file.getAbsolutePath().getBytes(Charset.forName("UTF-8" )); String otherBytes = new String(pathBytes); System.out.println(otherBytes); ByteBuffer directBuffer = ByteBuffer.allocateDirect(pathBytes.length).order(ByteOrder.nativeOrder()); directBuffer.put(pathBytes); directBuffer.rewind(); directBuffer.position(0); Pointer pointer = nativeOps.numpyFromFile(new BytePointer(directBuffer)); INDArray result = createFromNpyPointer(pointer); nativeOps.releaseNumpy(pointer); return result; }
Source:
<code>public Iterable<? extends String> getAllKeys() throws OseeCoreException { Set<String> userIds = new LinkedHashSet<String>(); <START> List<Artifact> artifacts = ArtifactQuery.getArtifactListFromType(CoreArtifactTypes.User, CoreBranches.COMMON); <END> for (Artifact artifact : artifacts) { User user = (User) artifact; userIds.add(user.getUserId()); } return userIds; }</code><technical_language>Iterate return value, variable needed</technical_language>

Target:
public Iterable<? extends String> getAllKeys() throws OseeCoreException { return get(); }
Source:
<code>public void testAudioTrackInfoOp() { if (!Utils.hasTvInputFramework(getContext())) { return; } Bundle bundle = new Bundle(); TvTrackInfo info = new TvTrackInfo.Builder(TvTrackInfo.TYPE_AUDIO, <START> "id") <END> .setAudioChannelCount(2) .setAudioSampleRate(48000) .setLanguage("eng") .setExtra(bundle) .build(); assertEquals(TvTrackInfo.TYPE_AUDIO, info.getType()); assertEquals("id", info.getId()); assertEquals(2, info.getAudioChannelCount()); assertEquals(48000, info.getAudioSampleRate()); assertEquals("eng", info.getLanguage()); assertEquals(bundle, info.getExtra()); assertEquals(0, info.describeContents()); Parcel p = Parcel.obtain(); info.writeToParcel(p, 0); p.setDataPosition(0); TvTrackInfo infoFromParcel = TvTrackInfo.CREATOR.createFromParcel(p); assertEquals(TvTrackInfo.TYPE_AUDIO, infoFromParcel.getType()); assertEquals("id", infoFromParcel.getId()); assertEquals(2, infoFromParcel.getAudioChannelCount()); assertEquals(48000, infoFromParcel.getAudioSampleRate()); assertEquals("eng", infoFromParcel.getLanguage()); assertEquals(bundle, infoFromParcel.getExtra()); assertEquals(0, infoFromParcel.describeContents()); p.recycle(); }</code><technical_language>define final constants for constants multiple times</technical_language>

Target:
public void testAudioTrackInfoOp() { if (!Utils.hasTvInputFramework(getContext())) { return; } final Bundle bundle = new Bundle(); final TvTrackInfo info = new TvTrackInfo.Builder(TvTrackInfo.TYPE_AUDIO, "id_audio") .setAudioChannelCount(2) .setAudioSampleRate(48000) .setLanguage("eng") .setExtra(bundle) .build(); assertEquals(TvTrackInfo.TYPE_AUDIO, info.getType()); assertEquals("id_audio", info.getId()); assertEquals(2, info.getAudioChannelCount()); assertEquals(48000, info.getAudioSampleRate()); assertEquals("eng", info.getLanguage()); assertEquals(bundle.get("testTrue"), info.getExtra().get("testTrue")); assertEquals(0, info.describeContents()); Parcel p = Parcel.obtain(); info.writeToParcel(p, 0); p.setDataPosition(0); TvTrackInfo infoFromParcel = TvTrackInfo.CREATOR.createFromParcel(p); assertEquals(TvTrackInfo.TYPE_AUDIO, infoFromParcel.getType()); assertEquals("id_audio", infoFromParcel.getId()); assertEquals(2, infoFromParcel.getAudioChannelCount()); assertEquals(48000, infoFromParcel.getAudioSampleRate()); assertEquals("eng", infoFromParcel.getLanguage()); assertEquals(bundle.get("testTrue"), infoFromParcel.getExtra().get("testTrue")); assertEquals(0, infoFromParcel.describeContents()); p.recycle(); }
Source:
<code>static long nanoToMicro(long nano) { <START> return Math.max(1, (long) Math.ceil(nano / (double) 1000)); <END> }</code><technical_language>this double math is 3x slower return (nano + 1000) / 1000L;</technical_language>

Target:
static long nanoToMicro(long nano) { return (nano + 1000) / 1000L; }
Source:
<code>public void writeStartPage(Page page) throws IOException { XmlWriter writer = this.writer; writer.openElement("page"); writer.textElement("title", page.Title.toString()); writer.textElement("ns", Integer.toString(page.Ns)); <START> writer.textElement("id", Integer.toString(page.Id)); <END> if (page.Redirect != null) { writer.emptyElement("redirect", new String[][] { {"title", page.Redirect.toString()} }); } if (page.Restrictions != null && page.Restrictions.length() != 0) writer.textElement("restrictions", page.Restrictions); }</code><technical_language>this needs fixing..</technical_language>

Target:
public void writeStartPage(Page page) throws IOException { XmlWriter writer = this.writer; writer.openElement("page"); writer.textElement("title", page.Title.toString()); writer.textElement("ns", Integer.toString(page.Ns)); if (page.Id != 0) { writer.textElement("id", Integer.toString(page.Id)); } if (page.Redirect != null) { writer.emptyElement("redirect", new String[][] { {"title", page.Redirect.toString()} }); } if (page.Restrictions != null && page.Restrictions.length() != 0) writer.textElement("restrictions", page.Restrictions); }
Source:
<code>public UserDto updateUserPhoto(UUID id, Optional<UUID> userPhotoId) { User userEntity = getUserEntityById(id); UserDto originalUser = createUserDtoWithPrivateData(userEntity); userEntity.setUserPhotoId(userPhotoId); User savedUserEntity = userRepository.save(userEntity); UserDto userDto = createUserDtoWithPrivateData(savedUserEntity); <START> logger.info("Updated user photo for user with mobile number '{}' and ID '{}'", userDto.getMobileNumber(), <END> userDto.getId()); buddyService.broadcastUserInfoChangeToBuddies(savedUserEntity, originalUser); return userDto; }</code><technical_language>helpful user updated photo removed it</technical_language>

Target:
public UserDto updateUserPhoto(UUID id, Optional<UUID> userPhotoId) { User userEntity = getUserEntityById(id); UserDto originalUser = createUserDtoWithPrivateData(userEntity); userEntity.setUserPhotoId(userPhotoId); User savedUserEntity = userRepository.save(userEntity); UserDto userDto = createUserDtoWithPrivateData(savedUserEntity); if (userPhotoId.isPresent()) { logger.info("Updated user photo for user with mobile number '{}' and ID '{}'", userDto.getMobileNumber(), userDto.getId()); } else { logger.info("Deleted user photo for user with mobile number '{}' and ID '{}'", userDto.getMobileNumber(), userDto.getId()); } buddyService.broadcastUserInfoChangeToBuddies(savedUserEntity, originalUser); return userDto; }
Source:
<code>public void assertCanDelete(Project project) throws CannotDeleteProjectException { final Connection conn = ((JdbcSchema) db).getConnection(); final String projectName = project.getName(); try { if (conn.createStatement().executeQuery("SELECT * FROM submodule_subscriptions WHERE " + "super_project_project_name = '" + projectName + "'").first()) { throw new CannotDeleteProjectException("Project has subscribed submodules."); } if (conn.createStatement().executeQuery("SELECT * FROM submodule_subscriptions WHERE " + "submodule_project_name = '" + projectName + "'").first()) { throw new CannotDeleteProjectException("Project is subscribed by other projects."); } } catch (SQLException e) { <START> throw new CannotDeleteProjectException(e); <END> } }</code><technical_language>I SQLException wrapped a CannotDeleteProjectException OrmException. I understood CannotDeleteProjectException: Means project deleted some preconditions for deletion fulfilled. For REST endpoint this mapped 409 Conflict. OrmException: error occurred while accessing database. For REST endpoint this mapped 500 Internal Server Error</technical_language>

Target:
public void assertCanDelete(Project project) throws CannotDeleteProjectException, OrmException { final Connection conn = ((JdbcSchema) db).getConnection(); final String projectName = project.getName(); try { if (conn.createStatement().executeQuery("SELECT * FROM submodule_subscriptions WHERE " + "super_project_project_name = '" + projectName + "'").first()) { throw new CannotDeleteProjectException("Project has subscribed submodules."); } if (conn.createStatement().executeQuery("SELECT * FROM submodule_subscriptions WHERE " + "submodule_project_name = '" + projectName + "'").first()) { throw new CannotDeleteProjectException("Project is subscribed by other projects."); } } catch (SQLException e) { throw new OrmException(e); } }