auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public User getUserByArtId(int userArtifactId) throws OseeCoreException { User toReturn = null; if (userArtifactId <= 0) { toReturn = getUser(SystemUser.OseeSystem); } else { for (User tempUser : getUsersAll()) { if (userArtifactId == tempUser.getArtId()) { <START> toReturn = tempUser; <END> } } } return toReturn; }</code><technical_language>break out if find user</technical_language>

Target:
public User getUserByArtId(int userArtifactId) throws OseeCoreException { User toReturn = null; if (userArtifactId <= 0) { toReturn = getUser(SystemUser.OseeSystem); } else { for (User tempUser : getUsersAll()) { if (userArtifactId == tempUser.getArtId()) { toReturn = tempUser; break; } } } return toReturn; }
Source:
<code>public void testSummaryOutputWithQuantiles() throws IOException { Summary labelsAndQuantiles = Summary.build() .quantile(0.5, 0.05).quantile(0.9, 0.01).quantile(0.99, 0.001) .labelNames("l").name("labelsAndQuantiles").help("help").register(registry); labelsAndQuantiles.labels("a").observe(2); writer = new StringWriter(); TextFormat.write004(writer, registry.metricFamilySamples()); assertEquals("# HELP labelsAndQuantiles help\n" + "# TYPE labelsAndQuantiles summary\n" + "labelsAndQuantiles{l=\"a\",quantile=\"0.5\",} 2.0\n" + "labelsAndQuantiles{l=\"a\",quantile=\"0.9\",} 2.0\n" + "labelsAndQuantiles{l=\"a\",quantile=\"0.99\",} 2.0\n" <START> + "labelsAndQuantiles_min{l=\"a\",} 2.0\n" <END> + "labelsAndQuantiles_max{l=\"a\",} 2.0\n" + "labelsAndQuantiles_count{l=\"a\",} 1.0\n" + "labelsAndQuantiles_sum{l=\"a\",} 2.0\n", writer.toString()); }</code><technical_language>This is invalid output</technical_language>

Target:
public void testSummaryOutputWithQuantiles() throws IOException { Summary labelsAndQuantiles = Summary.build() .quantile(0.5, 0.05).quantile(0.9, 0.01).quantile(0.99, 0.001) .labelNames("l").name("labelsAndQuantiles").help("help").register(registry); labelsAndQuantiles.labels("a").observe(2); writer = new StringWriter(); TextFormat.write004(writer, registry.metricFamilySamples()); assertEquals("# HELP labelsAndQuantiles help\n" + "# TYPE labelsAndQuantiles summary\n" + "labelsAndQuantiles{l=\"a\",quantile=\"0.5\",} 2.0\n" + "labelsAndQuantiles{l=\"a\",quantile=\"0.9\",} 2.0\n" + "labelsAndQuantiles{l=\"a\",quantile=\"0.99\",} 2.0\n" + "labelsAndQuantiles_count{l=\"a\",} 1.0\n" + "labelsAndQuantiles_sum{l=\"a\",} 2.0\n", writer.toString()); }
Source:
<code>private boolean executeSshSoftFencingCommand(String version) { boolean result = true; EngineSSHClient sshClient = null; ByteArrayOutputStream cmdOut = null, cmdErr = null; try { sshClient = new EngineSSHClient(); sshClient.setVds(getVds()); sshClient.useDefaultKeyPair(); sshClient.connect(); sshClient.authenticate(); cmdOut = new ByteArrayOutputStream(); <START> cmdErr = new ByteArrayOutputStream(); <END> sshClient.executeCommand(Config.<String> GetValue(ConfigValues.SshSoftFencingCommand, version), null, cmdOut, cmdErr); log.infoFormat("SSH Soft Fencing command executed on host {0}", getVds().getHostName()); } catch (Exception ex) { log.errorFormat("SSH Soft Fencing command failed on host {0}: {1}", getVds().getHostName(), ex); logCommandOutput(cmdOut, "SSH Soft Fencing command standard output: {0}"); logCommandOutput(cmdErr, "SSH Soft Fencing command error output: {0}"); result = false; } finally { closeSshConnection(sshClient); } return result; }</code><technical_language>I split try scopes, for ssh connection for command, this more detailed log, print null if exception set cmdOut cmdErr.</technical_language>

Target:
private boolean executeSshSoftFencingCommand(String version) { boolean result = true; EngineSSHClient sshClient = null; ByteArrayOutputStream cmdOut = null, cmdErr = null; try { sshClient = new EngineSSHClient(); sshClient.setVds(getVds()); sshClient.useDefaultKeyPair(); sshClient.connect(); sshClient.authenticate(); cmdOut = new ByteArrayOutputStream(); cmdErr = new ByteArrayOutputStream(); sshClient.executeCommand(Config.<String> GetValue(ConfigValues.SshSoftFencingCommand, version), null, cmdOut, cmdErr); log.infoFormat("SSH Soft Fencing command executed on host {0}", getVds().getHostName()); } catch (Exception ex) { log.errorFormat("SSH Soft Fencing command failed on host {0}: {1}\nStdout: {2}\nStderr: {3}\nStacktrace: {4}", getVds().getHostName(), ex.getMessage(), getCommandOutput(cmdOut), getCommandOutput(cmdErr), ex); result = false; } finally { closeSshConnection(sshClient); } return result; }
Source:
<code>public SqlStatements defineMap(final Map<String, ?> values) { if (values != null) { <START> synchronized (this) { <END> attributes.putAll(values); } } return this; }</code><technical_language>Ditto for mutex</technical_language>

Target:
public SqlStatements defineMap(final Map<String, ?> values) { if (values != null) { attributes.putAll(values); } return this; }
Source:
<code>public void matchesIdenticalTypes() throws IOException { MatcherAssert.assertThat( new FkContentType( FkContentTypeTest.CTYPE, FkContentTypeTest.createTakeWithEmptyResponse() <START> ).route( <END> new RqWithHeader( new RqFake(), FkContentTypeTest.CONTENT_TYPE, FkContentTypeTest.CTYPE ) ).has(), Matchers.is(true) ); }</code><technical_language>@dalifreire please move this line 4 spaces</technical_language>

Target:
public void matchesIdenticalTypes() throws IOException { MatcherAssert.assertThat( new FkContentType( FkContentTypeTest.CTYPE, FkContentTypeTest.emptyResponse() ).route( new RqWithHeader( new RqFake(), FkContentTypeTest.CONTENT_TYPE, FkContentTypeTest.CTYPE ) ).has(), Matchers.is(true) ); }
Source:
<code>public void visitNode(Tree tree) { <START> if (!hasSemantic()) { return; } <END> String qualifiedName = ((AnnotationTree) tree).annotationType().symbolType().fullyQualifiedName(); if (OLD_NEW_ANNOTATIONS_MAP.containsKey(qualifiedName)) { reportIssue(tree, String.format("Change this JUnit4 %s to the equivalent JUnit5 %s annotation.", qualifiedName, OLD_NEW_ANNOTATIONS_MAP.get(qualifiedName))); } }</code><technical_language>needs discussed clarified point, case semantic is missing happen, removed this check for rules. I remove this (and test)</technical_language>

Target:
public void visitNode(Tree tree) { String qualifiedName = ((AnnotationTree) tree).annotationType().symbolType().fullyQualifiedName(); if (OLD_NEW_ANNOTATIONS_MAP.containsKey(qualifiedName)) { reportIssue(tree, String.format("Change this JUnit4 %s to the equivalent JUnit5 %s annotation.", qualifiedName, OLD_NEW_ANNOTATIONS_MAP.get(qualifiedName))); } }
Source:
<code>static List<Arguments> testWhatIsValid() { return List.of( Arguments.of( "Defender has air units and no destroyers vs Attacker subs", <START> givenBattleState() <END> .attackingUnits(List.of(givenUnitCanNotBeTargetedBy(mock(UnitType.class)))) .defendingUnits(List.of(givenUnit(), givenUnitIsAir())) .build(), true), Arguments.of( "Defender has air units and destroyers", givenBattleState() .attackingUnits(List.of(mock(Unit.class))) .defendingUnits(List.of(givenUnitDestroyer(), givenUnitIsAir())) .build(), false), Arguments.of( "Defender has air units but no destroyers vs Attacker with no subs", givenBattleState() .attackingUnits(List.of(givenUnit())) .defendingUnits(List.of(givenUnit(), givenUnitIsAir())) .build(), false)); }</code><technical_language>givenBattleState is odd, return a builder(). list values non-file @Builder.Default initialize empty lists. consider @Singular I default empty list if specified. @Singular attacking defending units properties, instead write: MockBattleState.builder() .attackingUnit(givenUnitCanNotBeTargetedBy(mock(UnitType.class))) .defendingUnit(givenUnit()) .defendingUnit(givenUnitIsAir()) .build();</technical_language>

Target:
static List<Arguments> testWhatIsValid() { return List.of( Arguments.of( "Defender has air units and no destroyers vs Attacker subs", givenBattleStateBuilder() .attackingUnits(List.of(givenUnitCanNotBeTargetedBy(mock(UnitType.class)))) .defendingUnits(List.of(givenAnyUnit(), givenUnitIsAir())) .build(), true), Arguments.of( "Defender has air units and destroyers", givenBattleStateBuilder() .attackingUnits(List.of(mock(Unit.class))) .defendingUnits(List.of(givenUnitDestroyer(), givenUnitIsAir())) .build(), false), Arguments.of( "Defender has air units but no destroyers vs Attacker with no subs", givenBattleStateBuilder() .attackingUnits(List.of(givenAnyUnit())) .defendingUnits(List.of(givenAnyUnit(), givenUnitIsAir())) .build(), false)); }
Source:
<code>public RowFilter adapt(FilterAdapterContext context, org.apache.hadoop.hbase.filter.RowFilter filter) throws IOException { if (filter.getOperator() != CompareFilter.CompareOp.EQUAL) { throw new IllegalStateException(String.format("Cannot adapt operator %s", filter <START> .getOperator().getClass().getCanonicalName())); <END> } ByteArrayComparable comparator = filter.getComparator(); Builder builder = RowFilter.newBuilder(); if (comparator == null) { throw new IllegalStateException("Comparator cannot be null"); } else if (comparator instanceof RegexStringComparator) { ByteString rawValue = ByteString.copyFrom(comparator.getValue()); builder.setRowKeyRegexFilter(rawValue); } else if (comparator instanceof BinaryComparator) { byte[] quotedRegularExpression = ReaderExpressionHelper.quoteRegularExpression(comparator.getValue()); builder.setRowKeyRegexFilter(ByteString.copyFrom(quotedRegularExpression)); } else { throw new IllegalStateException(String.format("Cannot adapt comparator %s", comparator .getClass().getCanonicalName())); } return builder.build(); }</code><technical_language>operator null, no</technical_language>

Target:
public RowFilter adapt(FilterAdapterContext context, org.apache.hadoop.hbase.filter.RowFilter filter) throws IOException { CompareOp compareOp = filter.getOperator(); if (compareOp != CompareFilter.CompareOp.EQUAL) { throw new IllegalStateException(String.format("Cannot adapt operator %s", compareOp == null ? null : compareOp.getClass().getCanonicalName())); } ByteArrayComparable comparator = filter.getComparator(); Builder builder = RowFilter.newBuilder(); if (comparator == null) { throw new IllegalStateException("Comparator cannot be null"); } else if (comparator instanceof RegexStringComparator) { ByteString rawValue = ByteString.copyFrom(comparator.getValue()); builder.setRowKeyRegexFilter(rawValue); } else if (comparator instanceof BinaryComparator) { byte[] quotedRegularExpression = ReaderExpressionHelper.quoteRegularExpression(comparator.getValue()); builder.setRowKeyRegexFilter(ByteString.copyFrom(quotedRegularExpression)); } else { throw new IllegalStateException(String.format("Cannot adapt comparator %s", comparator .getClass().getCanonicalName())); } return builder.build(); }
Source:
<code>public WSClaimManager(String serverUrl, String cookie, ConfigurationContext configCtxt) throws UserStoreException { try { stub = new RemoteClaimManagerServiceStub(configCtxt, serverUrl + SERVICE_NAME); ServiceClient client = stub._getServiceClient(); Options option = client.getOptions(); option.setManageSession(true); option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie); } catch (AxisFault e) { if (log.isDebugEnabled()) { log.debug(CONNECTION_ERROR_MESSAGE, e); } <START> throw new UserStoreException(); <END> } }</code><technical_language>add some message throwing exception</technical_language>

Target:
public WSClaimManager(String serverUrl, String cookie, ConfigurationContext configCtxt) throws UserStoreException { try { stub = new RemoteClaimManagerServiceStub(configCtxt, serverUrl + SERVICE_NAME); ServiceClient client = stub._getServiceClient(); Options option = client.getOptions(); option.setManageSession(true); option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie); } catch (AxisFault e) { throw new UserStoreException("Axis error occurred while creating service client stub", e); } }
Source:
<code>private static boolean isTable(TagNode node) { <START> return "TABLE".equalsIgnoreCase(node.getNodeName()); <END> }</code><technical_language>TagNode#equalsElementName</technical_language>

Target:
private static boolean isTable(TagNode node) { return node.equalsElementName("TABLE"); }
Source:
<code>private void populateResultFromRemote(int currentSize, List<Object> resultingKeyValuePairs, Map<Object, Long> reservations, Map<Data, Object> reverseKeyMap) { for (int i = currentSize; i < resultingKeyValuePairs.size(); i += 2) { Data keyData = (Data) resultingKeyValuePairs.get(i); Data valueData = (Data) resultingKeyValuePairs.get(i + 1); <START> Object ncKey = useObjectKey ? (K) reverseKeyMap.get(keyData) : keyData; <END> if (useObjectKey) { resultingKeyValuePairs.set(i, ncKey); } Long reservationId = reservations.get(ncKey); if (reservationId != null) { Object cachedValue = tryPublishReserved(ncKey, valueData, reservationId); resultingKeyValuePairs.set(i + 1, cachedValue); reservations.remove(ncKey); } } }</code><technical_language>Minor: do need cast here</technical_language>

Target:
private void populateResultFromRemote(int currentSize, List<Object> resultingKeyValuePairs, Map<Object, Long> reservations, Map<Data, Object> reverseKeyMap) { for (int i = currentSize; i < resultingKeyValuePairs.size(); i += 2) { Data keyData = (Data) resultingKeyValuePairs.get(i); Data valueData = (Data) resultingKeyValuePairs.get(i + 1); Object ncKey = useObjectKey ? reverseKeyMap.get(keyData) : keyData; if (useObjectKey) { resultingKeyValuePairs.set(i, ncKey); } Long reservationId = reservations.get(ncKey); if (reservationId != null) { Object cachedValue = tryPublishReserved(ncKey, valueData, reservationId); resultingKeyValuePairs.set(i + 1, cachedValue); reservations.remove(ncKey); } } }
Source:
<code>public void start() { BenchmarkSuite benchmarkSuite = benchmarkSuiteSupplier.get(); BenchmarkSuiteInfo benchmarkSuiteInfo = benchmarkSuite.getSuiteInfo(); List<PhaseSpecification> phases = benchmarkSuiteInfo.getPhases(); <START> int successfulPhases = 0; <END> try { for (PhaseSpecification phase : phases) { PhaseExecutor phaseExecutor = phaseExecutorFactory.get(phase, benchmarkSuite); try { phaseExecutor.run(proceedWithFailures); postEvent(BenchmarkPhaseEvent.succeeded(phase.getName())); successfulPhases++; } catch (PhaseExecutionException e) { postEvent(BenchmarkPhaseEvent.failed(phase.getName(), e.toString())); if (!proceedWithFailures) { throw new SuiteExecutionException(); } } } if (successfulPhases < phases.size()) { postEvent(BenchmarkSuiteEvent.completedWithFailures(benchmarkSuite.getName(), format("%s Phases out of %s succeeded", successfulPhases, phases.size()))); } else { postEvent(BenchmarkSuiteEvent.succeeded(benchmarkSuite.getName())); } } catch (SuiteExecutionException e) { postEvent(BenchmarkSuiteEvent.failed(benchmarkSuite.getName(), e.toString())); } }</code><technical_language>Remove</technical_language>

Target:
public void start() { BenchmarkSuite benchmarkSuite = benchmarkSuiteSupplier.get(); BenchmarkSuiteInfo benchmarkSuiteInfo = benchmarkSuite.getSuiteInfo(); List<PhaseSpecification> phases = benchmarkSuiteInfo.getPhases(); int successfulPhases = 0; for (PhaseSpecification phase : phases) { PhaseExecutor phaseExecutor = phaseExecutorFactory.get(phase, benchmarkSuite); BenchmarkPhaseEvent phaseEvent = phaseExecutor.run(continueOnFailure); if (phaseEvent.getEventStatus() == SUCCEEDED) { successfulPhases++; } else if (phaseEvent.getEventStatus() == FAILED && !continueOnFailure) { postEvent(BenchmarkSuiteEvent.failed(benchmarkSuite.getName())); break; } } if (successfulPhases < phases.size()) { postEvent(BenchmarkSuiteEvent.completedWithFailures(benchmarkSuite.getName())); } else { postEvent(BenchmarkSuiteEvent.succeeded(benchmarkSuite.getName())); } }
Source:
<code>public JavaType getParametrizedTypeType(JavaSymbol.TypeJavaSymbol symbol, TypeSubstitution typeSubstitution) { if (symbol.getType().isUnknown()) { return symbol.getType(); } if (typeCache.get(symbol) == null) { Map<TypeSubstitution, ParametrizedTypeJavaType> map = Maps.newHashMap(); typeCache.put(symbol, map); } TypeSubstitution newSubstitution = typeSubstitution; if (newSubstitution.size() == 0) { <START> newSubstitution = symbol.identitySubstitution(); <END> } if (typeCache.get(symbol).get(newSubstitution) == null) { typeCache.get(symbol).put(newSubstitution, new ParametrizedTypeJavaType(symbol, newSubstitution)); } return typeCache.get(symbol).get(newSubstitution); }</code><technical_language>This method defined in this class</technical_language>

Target:
public JavaType getParametrizedTypeType(JavaSymbol.TypeJavaSymbol symbol, TypeSubstitution typeSubstitution) { if (symbol.getType().isUnknown()) { return symbol.getType(); } if (typeCache.get(symbol) == null) { Map<TypeSubstitution, ParametrizedTypeJavaType> map = Maps.newHashMap(); typeCache.put(symbol, map); } TypeSubstitution newSubstitution = typeSubstitution; if (newSubstitution.size() == 0) { newSubstitution = identitySubstitution(symbol.typeVariableTypes); } if (typeCache.get(symbol).get(newSubstitution) == null) { typeCache.get(symbol).put(newSubstitution, new ParametrizedTypeJavaType(symbol, newSubstitution)); } return typeCache.get(symbol).get(newSubstitution); }
Source:
<code>public static void main(String[] args) { TemptoRunnerCommandLineParser parser = TemptoRunnerCommandLineParser <START> .builder("presto product tests") <END> .setTestsPackage("com.facebook.presto.tests.*", false) .setExcludedGroups("quarantine", true) .build(); TemptoRunner.runTempto(parser, args); }</code><technical_language>Unrelated move .builder previous line. I bet more valid code style</technical_language>

Target:
public static void main(String[] args) { TemptoRunnerCommandLineParser parser = TemptoRunnerCommandLineParser.builder("Presto product tests") .setTestsPackage("com.facebook.presto.tests.*", false) .setExcludedGroups("quarantine", true) .build(); TemptoRunner.runTempto(parser, args); }
Source:
<code><START> public DescriptorImpl getDescriptor() { <END> Jenkins jenkins = Jenkins.getInstance(); if(jenkins != null){ return (DescriptorImpl)jenkins.getDescriptorOrDie(getClass()); } return null; }</code><technical_language>Descriptor null. throw exception</technical_language>

Target:
public DescriptorImpl getDescriptor() { return (DescriptorImpl)Jenkins.getInstance().getDescriptorOrDie(getClass()); }
Source:
<code>public void t(Object o1, Object o2) { if (!(o1 instanceof String STRING) && (o2 instanceof Integer INTEGER)) ArrayList<Integer> arrayList = new ArrayList<Integer>(); if (arrayList instanceof ArrayList<Integer> aXML) { System.out.println("Blah"); } boolean result = (o1 instanceof String a1) ? (o1 instanceof String aTXT) : (!(o1 instanceof String ssSTRING)); String formatted; if (o1 instanceof Integer XMLHTTP) formatted = <START> String.format("int %d", XMLHTTP); <END> else if (o1 instanceof Byte bYT) formatted = String.format("byte %d", bYT); else formatted = String.format("Something else "+ o1.toString()); }</code><technical_language>violation</technical_language>

Target:
public void t(Object o1, Object o2) { if (!(o1 instanceof String STRING) && (o2 instanceof Integer INTEGER)) ArrayList<Integer> arrayList = new ArrayList<Integer>(); if (arrayList instanceof ArrayList<Integer> aXML) { System.out.println("BlahBlah"); } boolean result = (o1 instanceof String a1) ? (o1 instanceof String aTXT) : (!(o1 instanceof String ssSTRING)); String formatted; if (o1 instanceof Integer XMLHTTP) formatted = String.format("int %d", XMLHTTP); else if (o1 instanceof Byte bYT) formatted = String.format("byte %d", bYT); else formatted = String.format("Something else "+ o1.toString()); }
Source:
<code>private void add(SuiteResult suiteResultToAdd) { for (SuiteResult suiteResult : suites) { if(suiteResult.getName().equals(suiteResultToAdd.getName()) && nullSafeEq(suiteResult.getId(), suiteResultToAdd.getId())) { for (CaseResult caseResult: suiteResultToAdd.getCases()) { if (!suiteResult.caseAlreadyExists(caseResult)) { <START> suiteResult.addCase(caseResult); <END> caseResult.replaceParent(suiteResult); duration += caseResult.getDuration(); } } return; } } suites.add(suiteResultToAdd); duration += suiteResultToAdd.getDuration(); }</code><technical_language>IMO <code> caseAlreadyExists</code> called addCase() method avoid misusages</technical_language>

Target:
private void add(SuiteResult suiteResultToAdd) { for (SuiteResult suiteResult : suites) { if(suiteResult.getName().equals(suiteResultToAdd.getName()) && nullSafeEq(suiteResult.getId(), suiteResultToAdd.getId())) { for (CaseResult caseResult: suiteResultToAdd.getCases()) { if (suiteResult.addCase(caseResult)) { caseResult.replaceParent(suiteResult); duration += caseResult.getDuration(); } } return; } } suites.add(suiteResultToAdd); duration += suiteResultToAdd.getDuration(); }
Source:
<code>private void validateArgs() { if (!SUPPORTED_REQUEST_TYPES.contains(requestType)) { throw new IllegalArgumentException("Unsupported request type: " + requestType); } else if (requestType.equals(POST)) { if (postBlobTotalSize == null || postBlobTotalSize <= 0 || postBlobChunkSize == null || postBlobChunkSize <= 0) { throw new IllegalArgumentException( "Total size to be posted and size of each chunk need to be specified with POST and have to be > 0"); <START> } else if (targerAccountName == null || targetContainerName == null) { <END> throw new IllegalArgumentException( "TargetAccountName and TargetContainerName need to be specified with POST"); } } }</code><technical_language>service id check</technical_language>

Target:
private void validateArgs() { if (!SUPPORTED_REQUEST_TYPES.contains(requestType)) { throw new IllegalArgumentException("Unsupported request type: " + requestType); } else if (requestType.equals(POST)) { if (postBlobTotalSize == null || postBlobTotalSize <= 0 || postBlobChunkSize == null || postBlobChunkSize <= 0) { throw new IllegalArgumentException( "Total size to be posted and size of each chunk need to be specified with POST and have to be > 0"); } else if (targetAccountName == null || targetAccountName.isEmpty() || targetContainerName == null || targetContainerName.isEmpty()) { throw new IllegalArgumentException("TargetAccountName and TargetContainerName cannot be empty with POST"); } } if (serviceId == null || serviceId.isEmpty()) { throw new IllegalArgumentException("serviceId cannot be empty"); } }
Source:
<code>public void shouldSendCorrelationId() throws ExecutionException, InterruptedException { final String projectKey = "my-project"; when: { when(sphereApiConfig.getProjectKey()).thenReturn(projectKey); when(sphereApiConfig.getApiUrl()).thenReturn("<LINK_0>"); when(httpClient.getUserAgent()).thenReturn("user-agent"); when(sphereAccessTokenSupplier.get()).thenReturn(CompletableFutureUtils.successful("token")); when(httpClient.execute(httpRequestArgumentCaptor.capture())) .thenReturn(CompletableFuture.completedFuture(HttpResponse.of(200, "ok"))); } then: { final SphereClient sphereClient = SphereClient.of(sphereApiConfig, httpClient, sphereAccessTokenSupplier); final DummySphereRequest sphereRequest = DummySphereRequest.of(); final CompletableFuture<String> completionStage = (CompletableFuture<String>) sphereClient.execute(sphereRequest); final String response = completionStage.get(); <START> assertThat(response).isEqualTo(DummySphereRequest.DEFAULT_RESPONSE_OBJECT); <END> final HttpHeaders headers = httpRequestArgumentCaptor.getValue().getHeaders(); final Optional<String> correlationId = headers.findFlatHeader(HttpHeaders.X_CORRELATION_ID); assertThat(correlationId.isPresent()).isTrue(); final List<String> correlationIdParts = Arrays.asList(correlationId.get().split("/")); assertThat(correlationIdParts).hasSize(2); assertThat(correlationIdParts.get(0)).isEqualTo(projectKey); final UUID uuid = UUID.fromString(correlationIdParts.get(1)); assertThat(uuid).isNotNull(); } }</code><technical_language>New too, a needed assertion! :D</technical_language>

Target:
public void shouldSendCorrelationId() throws ExecutionException, InterruptedException { final String projectKey = "my-project"; when: { when(sphereApiConfig.getProjectKey()).thenReturn(projectKey); when(sphereApiConfig.getApiUrl()).thenReturn("<LINK_0>"); when(httpClient.getUserAgent()).thenReturn("user-agent"); when(sphereAccessTokenSupplier.get()).thenReturn(CompletableFutureUtils.successful("token")); when(httpClient.execute(httpRequestArgumentCaptor.capture())) .thenReturn(CompletableFuture.completedFuture(HttpResponse.of(200, "ok"))); } then: { final SphereClient sphereClient = SphereClient.of(sphereApiConfig, httpClient, sphereAccessTokenSupplier); final DummySphereRequest sphereRequest = DummySphereRequest.of(); final CompletableFuture<String> completionStage = (CompletableFuture<String>) sphereClient.execute(sphereRequest); final String response = completionStage.get(); assertThat(response).isEqualTo(DummySphereRequest.DEFAULT_RESPONSE_OBJECT); final HttpHeaders headers = httpRequestArgumentCaptor.getValue().getHeaders(); final Optional<String> correlationId = headers.findFlatHeader(HttpHeaders.X_CORRELATION_ID); assertThat(correlationId).isPresent(); final List<String> correlationIdParts = Arrays.asList(correlationId.get().split("/")); assertThat(correlationIdParts).hasSize(2); assertThat(correlationIdParts.get(0)).isEqualTo(projectKey); final UUID uuid = UUID.fromString(correlationIdParts.get(1)); assertThat(uuid).isNotNull(); } }
Source:
<code>private void fireUpdateEvent() { <START> for (int i = 0; i < listeners.size(); i++) <END> listeners.get(i).handleUpdateEvent(); }</code><technical_language>A for loop listeners instead</technical_language>

Target:
private void fireUpdateEvent() { for (IUpdateListener listener : listeners) { listener.handleUpdateEvent(); } }
Source:
<code>public <T extends Enum<?>> void setEnum(final String section, final String subsection, final String name, final T value) { <START> String n = null; <END> if (value instanceof ConfigEnum) { n = ((ConfigEnum) value).toConfigValue(); } else { n = value.name().toLowerCase().replace('_', ' '); } setString(section, subsection, name, n); }</code><technical_language>Do assign n. compiler verify set n in branches below</technical_language>

Target:
public <T extends Enum<?>> void setEnum(final String section, final String subsection, final String name, final T value) { String n; if (value instanceof ConfigEnum) n = ((ConfigEnum) value).toConfigValue(); else n = value.name().toLowerCase().replace('_', ' '); setString(section, subsection, name, n); }
Source:
<code>public void testLogEntryDoesntLogWhenLogLevelInactive() throws Exception { Log log = mock(Log.class); LoggedUtils.logEntry(log, "", new LoggedOverridingSubclass()); <START> verify(log, never()).traceFormat(any(String.class), any()); <END> verify(log, never()).debugFormat(any(String.class), any()); verify(log, never()).infoFormat(any(String.class), any()); verify(log, never()).warnFormat(any(String.class), any()); verify(log, never()).errorFormat(any(String.class), any()); verify(log, never()).fatalFormat(any(String.class), any()); }</code><technical_language>more simply verify isLogLevelOn is called more interactions :) This work also, is copy pasted a lot sense extract (though important).</technical_language>

Target:
public void testLogEntryDoesntLogWhenLogLevelInactive() throws Exception { Log log = mock(Log.class); LoggedUtils.logEntry(log, "", new LoggedOverridingSubclass()); verifyNoLogging(log); }
Source:
<code>private void runOrganization(long tableId) { Set<ShardMetadata> shardMetadatas = shardManager.getNodeShardsOnly(currentNodeIdentifier, tableId); Table tableInfo = metadataDao.getTableInformation(tableId); Set<ShardMetadata> filteredShards = shardMetadatas.stream() .filter(shard -> !organizer.inProgress(shard.getShardUuid())) .collect(toSet()); Collection<ShardIndexInfo> indexInfos = getOrganizationEligibleShards(dbi, metadataDao, tableInfo, filteredShards, true); Set<OrganizationSet> organizationSets = createOrganizationSets(temporalFunction, tableInfo, indexInfos); if (organizationSets.isEmpty()) { return; } log.info("Created %s organization set(s) from %s shards for table ID %s", organizationSets.size(), filteredShards.size(), tableId); long lastStartTime = System.currentTimeMillis(); tablesInProgress.add(tableId); ImmutableList.Builder<ListenableFuture<?>> futures = ImmutableList.builder(); for (OrganizationSet organizationSet : organizationSets) { futures.add(organizer.enqueue(organizationSet)); } <START> futures.build().forEach(listenableFuture -> { <END> listenableFuture.addListener( () -> { tablesInProgress.remove(tableId); organizerDao.updateLastStartTime(currentNodeIdentifier, tableId, lastStartTime); }, MoreExecutors.directExecutor()); }); }</code><technical_language>nit: ...listenableFuture -> listenableFuture.addListener(</technical_language>

Target:
private void runOrganization(long tableId) { Set<ShardMetadata> shardMetadatas = shardManager.getNodeShards(currentNodeIdentifier, tableId); Table tableInfo = metadataDao.getTableInformation(tableId); Set<ShardMetadata> filteredShards = shardMetadatas.stream() .filter(shard -> !organizer.inProgress(shard.getShardUuid())) .collect(toSet()); Collection<ShardIndexInfo> indexInfos = getOrganizationEligibleShards(dbi, metadataDao, tableInfo, filteredShards, true); Set<OrganizationSet> organizationSets = createOrganizationSets(temporalFunction, tableInfo, indexInfos); if (organizationSets.isEmpty()) { return; } log.info("Created %s organization set(s) from %s shards for table ID %s", organizationSets.size(), filteredShards.size(), tableId); long lastStartTime = System.currentTimeMillis(); tablesInProgress.add(tableId); ImmutableList.Builder<ListenableFuture<?>> futures = ImmutableList.builder(); for (OrganizationSet organizationSet : organizationSets) { futures.add(organizer.enqueue(organizationSet)); } futures.build().forEach(listenableFuture -> listenableFuture.addListener( () -> { tablesInProgress.remove(tableId); organizerDao.updateLastStartTime(currentNodeIdentifier, tableId, lastStartTime); }, MoreExecutors.directExecutor())); }
Source:
<code>public void before() throws Exception { synchronized ( running ) { if ( running.compareAndSet( false, true ) ) { <START> RemoteHotRodServerHelper.beforeRun(); <END> StandaloneCommandBuilder builder = StandaloneCommandBuilder .of( "target/infinispan-server" ); builder .setServerReadOnlyConfiguration( DEFAULT_CONFIG_PATH ); if ( portOffset != 0 ) { builder.addJavaOption( "-Djboss.socket.binding.port-offset=" + portOffset ); } Launcher launcher = Launcher.of( builder ); hotRodServer = launcher.inherit().launch(); waitForRunning(); } } }</code><technical_language>this class is in integration tests module, server is in a file system position</technical_language>

Target:
public void before() throws Exception { synchronized ( running ) { if ( running.compareAndSet( false, true ) ) { StandaloneCommandBuilder builder = StandaloneCommandBuilder .of( "target/infinispan-server" ); builder .setServerReadOnlyConfiguration( DEFAULT_CONFIG_PATH ); if ( portOffset != 0 ) { builder.addJavaOption( "-Djboss.socket.binding.port-offset=" + portOffset ); } Launcher launcher = Launcher.of( builder ); hotRodServer = launcher.launch(); waitForRunning(); } } }
Source:
<code><START> public static List<BrooklinMetricInfo> getPartitionSpecificMetrics(String prefix) { <END> List<BrooklinMetricInfo> metrics = new ArrayList<>(); prefix = Strings.nullToEmpty(prefix); metrics.add(new BrooklinMeterInfo(prefix + REBALANCE_RATE)); metrics.add(new BrooklinMeterInfo(prefix + STUCK_PARTITIONS)); return metrics; }</code><technical_language>cleaner wrap return val in Collections.unmodifiableList();</technical_language>

Target:
public static List<BrooklinMetricInfo> getPartitionSpecificMetrics(String prefix) { List<BrooklinMetricInfo> metrics = new ArrayList<>(); prefix = Strings.nullToEmpty(prefix); metrics.add(new BrooklinMeterInfo(prefix + REBALANCE_RATE, Optional.of(Arrays.asList(BrooklinMeterInfo.COUNT, BrooklinMeterInfo.ONE_MINUTE_RATE)))); metrics.add(new BrooklinMeterInfo(prefix + STUCK_PARTITIONS)); return Collections.unmodifiableList(metrics); }
Source:
<code>private void uploadPhoto(Uri uri) { hideDownloadUI(); Toast.makeText(this, "Uploading...", Toast.LENGTH_SHORT).show(); String uuid = UUID.randomUUID().toString(); mImageRef = FirebaseStorage.getInstance().getReference(uuid); mImageRef.putFile(uri) .addOnSuccessListener(this, new OnSuccessListener<UploadTask.TaskSnapshot>() { @Override public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) { if (BuildConfig.DEBUG) { <START> Log.d(TAG, "uploadPhoto:onEmailPromptSuccess:" + <END> taskSnapshot.getMetadata().getReference().getPath()); } Toast.makeText(ImageActivity.this, "Image uploaded", Toast.LENGTH_SHORT).show(); showDownloadUI(); } }) .addOnFailureListener(this, new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { Log.w(TAG, "uploadPhoto:onError", e); Toast.makeText(ImageActivity.this, "Upload failed", Toast.LENGTH_SHORT).show(); } }); }</code><technical_language>Refactor mistake</technical_language>

Target:
private void uploadPhoto(Uri uri) { hideDownloadUI(); Toast.makeText(this, "Uploading...", Toast.LENGTH_SHORT).show(); String uuid = UUID.randomUUID().toString(); mImageRef = FirebaseStorage.getInstance().getReference(uuid); mImageRef.putFile(uri) .addOnSuccessListener(this, new OnSuccessListener<UploadTask.TaskSnapshot>() { @Override public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) { if (BuildConfig.DEBUG) { Log.d(TAG, "uploadPhoto:onSuccess:" + taskSnapshot.getMetadata().getReference().getPath()); } Toast.makeText(ImageActivity.this, "Image uploaded", Toast.LENGTH_SHORT).show(); showDownloadUI(); } }) .addOnFailureListener(this, new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { Log.w(TAG, "uploadPhoto:onError", e); Toast.makeText(ImageActivity.this, "Upload failed", Toast.LENGTH_SHORT).show(); } }); }
Source:
<code>Mono<Response<AnalyzeSentimentResult>> analyzeSentimentWithResponse(String text, String language, Context context) { return analyzeBatchSentimentWithResponse( <START> Arrays.asList(new TextDocumentInput(Integer.toString(0), text, language)), null, context) <END> .flatMap(response -> { Iterator<AnalyzeSentimentResult> responseItem = response.getValue().iterator(); return Mono.just(new SimpleResponse<>(response, responseItem.next())); }); }</code><technical_language>"0"</technical_language>

Target:
Mono<Response<AnalyzeSentimentResult>> analyzeSentimentWithResponse(String text, String language, Context context) { Objects.requireNonNull(text, "'text' cannot be null."); return analyzeBatchSentimentWithResponse( Collections.singletonList(new TextDocumentInput("0", text, language)), null, context) .map(response -> new SimpleResponse<>(response, response.getValue().iterator().next())); }
Source:
<code>public void run() { for(; shouldRunMonitor && fsnamesystem.isRunning(); ) { boolean needSync = false; try { Thread.sleep(fsnamesystem.getLeaseRecheckIntervalMs()); Collection<Lease> candidates = getExpiredCandidateLeases(); if (candidates.isEmpty()) { continue; } fsnamesystem.writeLockInterruptibly(); try { if (!fsnamesystem.isInSafeMode()) { needSync = checkLeases(candidates); } } finally { fsnamesystem.writeUnlock("leaseManager"); if (needSync) { fsnamesystem.getEditLog().logSync(); } } } catch(InterruptedException ie) { <START> if (LOG.isDebugEnabled()) { <END> LOG.debug("{} is interrupted", name, ie); } } catch(Throwable e) { LOG.warn("Unexpected throwable: ", e); } } }</code><technical_language>This LOG.isDebugEnabled() check is needed anymore</technical_language>

Target:
public void run() { for(; shouldRunMonitor && fsnamesystem.isRunning(); ) { boolean needSync = false; try { Thread.sleep(fsnamesystem.getLeaseRecheckIntervalMs()); Collection<Lease> candidates = getExpiredCandidateLeases(); if (candidates.isEmpty()) { continue; } fsnamesystem.writeLockInterruptibly(); try { if (!fsnamesystem.isInSafeMode()) { needSync = checkLeases(candidates); } } finally { fsnamesystem.writeUnlock("leaseManager"); if (needSync) { fsnamesystem.getEditLog().logSync(); } } } catch(InterruptedException ie) { LOG.debug("{} is interrupted", name, ie); } catch(Throwable e) { LOG.warn("Unexpected throwable: ", e); } } }
Source:
<code>public void theAdministrativeStatusShouldBeSetOnTheDevice(final Map<String, String> settings) throws Throwable { final SetAdministrativeStatusAsyncRequest setAdministrativeStatusAsyncRequest = SetAdministrativeStatusRequestFactory .fromScenarioContext(); final SetAdministrativeStatusResponse setAdministrativeStatusResponse = this.smartMeteringConfigurationClient .retrieveSetAdministrativeStatusResponse(setAdministrativeStatusAsyncRequest); LOGGER.info("The administrative status result is: {}", setAdministrativeStatusResponse.getResult()); <START> assertNotNull("Administrative status type result is null", setAdministrativeStatusResponse.getResult()); <END> }</code><technical_language>I check if response is OK? a OK is valid for a assertNotNull</technical_language>

Target:
public void theAdministrativeStatusShouldBeSetOnTheDevice(final Map<String, String> settings) throws Throwable { final SetAdministrativeStatusAsyncRequest setAdministrativeStatusAsyncRequest = SetAdministrativeStatusRequestFactory .fromScenarioContext(); final SetAdministrativeStatusResponse setAdministrativeStatusResponse = this.smartMeteringConfigurationClient .retrieveSetAdministrativeStatusResponse(setAdministrativeStatusAsyncRequest); LOGGER.info("The administrative status result is: {}", setAdministrativeStatusResponse.getResult()); assertNotNull("Administrative status type result is null", setAdministrativeStatusResponse.getResult()); assertEquals("Administrative status type should be OK", OsgpResultType.OK, setAdministrativeStatusResponse.getResult()); }
Source:
<code>private static int runTestCommand(TestCommandArgs testArgs, JCommander jc) { <START> int returnCode = 131; <END> try { ModuleTester tester = new ModuleTester(); returnCode = tester.runTests(testArgs.methodStoreUrl, testArgs.skipValidation, testArgs.allowSyncMethods); } catch (Exception e) { if (testArgs.verbose) e.printStackTrace(); showError("Error while testing module", e.getMessage()); return returnCode; } return returnCode; }</code><technical_language>PR good mysterious 131 exit code. This code default if KB_SDK run test process all. token authentication failed. file system host machine allow put token/config files in place. exit code reference do here</technical_language>

Target:
private static int runTestCommand(TestCommandArgs testArgs, JCommander jc) { int returnCode = 1; try { ModuleTester tester = new ModuleTester(); returnCode = tester.runTests(testArgs.methodStoreUrl, testArgs.skipValidation, testArgs.allowSyncMethods); } catch (Exception e) { if (testArgs.verbose) e.printStackTrace(); showError("Error while testing module", e.getMessage()); return returnCode; } return returnCode; }
Source:
<code>public GetTablePartitionKeysResponse getAllPartitionKeys(RpcController controller, NullProto request) throws <START> ServiceException { <END> rlock.lock(); try { return GetTablePartitionKeysResponse.newBuilder() .setState(OK) .addAllPartKey(store.getAllPartitionKeys()) .build(); } catch (Throwable t) { printStackTraceIfError(LOG, t); return GetTablePartitionKeysResponse.newBuilder() .setState(returnError(t)) .build(); } finally { rlock.unlock(); } }</code><technical_language>Please fix indent throws ServiceException</technical_language>

Target:
public GetTablePartitionKeysResponse getAllPartitionKeys(RpcController controller, NullProto request) { rlock.lock(); try { return GetTablePartitionKeysResponse.newBuilder() .setState(OK) .addAllPartitionKey(store.getAllPartitionKeys()) .build(); } catch (Throwable t) { printStackTraceIfError(LOG, t); return GetTablePartitionKeysResponse.newBuilder() .setState(returnError(t)) .build(); } finally { rlock.unlock(); } }
Source:
<code>void addActiveCircuit(CircuitImpl circuit) { synchronized (activeCircuits) { activeCircuits.add(circuit); activeCircuits.notifyAll(); } lock.lock(); try { if (!isBuilding) { <START> circuit.destroyCircuit(); <END> } } finally { lock.unlock(); } }</code><technical_language>Is OK/desired call circuit lock held</technical_language>

Target:
void addActiveCircuit(CircuitImpl circuit) { synchronized (activeCircuits) { activeCircuits.add(circuit); activeCircuits.notifyAll(); } boolean doDestroy; lock.lock(); try { doDestroy = !isBuilding; } finally { lock.unlock(); } if (doDestroy) { circuit.destroyCircuit(); } }
Source:
<code>public void setPrivateForRootComponentUuid(DbSession session, String projectUuid, boolean isPrivate) { mapper(session).setPrivateForRootComponentUuid(projectUuid, isPrivate); <START> session.getMapper(BranchMapper.class).selectByProjectUuid(projectUuid) <END> .stream() .filter(branch -> !projectUuid.equals(branch.getUuid())) .forEach(branch -> mapper(session).setPrivateForRootComponentUuid(branch.getUuid(), isPrivate)); }</code><technical_language>I thought move WS</technical_language>

Target:
public void setPrivateForRootComponentUuid(DbSession session, String projectUuid, boolean isPrivate) { mapper(session).setPrivateForRootComponentUuid(projectUuid, isPrivate); }
Source:
<code>private void updateProjectDaoDependencies() { if (studyDao != null) studyDao.setProjectDAO(projectDao); if (sampleNumberPerProjectService != null) sampleNumberPerProjectService.setSqlProjectDAO(projectDao); <START> if (referenceGenomeService != null) referenceGenomeService.setReferenceGenomeDao(referenceGenomeDao); <END> }</code><technical_language>This method is for updating other objects' dependencies Project DAO, this belong here. updateReferenceGenomeDaoDependencies method sets referenceGenomeDao for projectDao referenceGenomeService</technical_language>

Target:
private void updateProjectDaoDependencies() { if (studyDao != null) studyDao.setProjectDAO(projectDao); if (sampleNumberPerProjectService != null) sampleNumberPerProjectService.setSqlProjectDAO(projectDao); }
Source:
<code>public void removeTagFromImage(String imageName, String tagToBeRemoved) { selectImage(imageName); new ContextMenu("Remove Tag").select(); String fullTag = ""; Combo combo = new DefaultCombo(); List<String> comboItems = combo.getItems(); for (String item : comboItems) { if (item.contains(tagToBeRemoved)) { fullTag = item; break; } } combo.setSelection(fullTag); <START> ; <END> new FinishButton().click(); }</code><technical_language>This is pretty lonely semicolon :wink:</technical_language>

Target:
public void removeTagFromImage(String imageName, String tagToBeRemoved) { selectImage(imageName); new ContextMenu("Remove Tag").select(); String fullTag = ""; Combo combo = new DefaultCombo(); List<String> comboItems = combo.getItems(); for (String item : comboItems) { if (item.contains(tagToBeRemoved)) { fullTag = item; break; } } combo.setSelection(fullTag); new FinishButton().click(); }
Source:
<code><START> public void deleteFailOnNoIndexName() throws QueryException { <END> im.ensureIndexed(Arrays.<FieldSort>asList(new FieldSort("name"), new FieldSort("address")), "basic"); assertThat(im.listIndexes(), contains(getIndexNameMatcher("basic"))); try { im.deleteIndex(null); Assert.fail("Expected deleteIndex to throw a QueryException"); } catch (QueryException qe) { ; } assertThat(im.listIndexes(), contains(getIndexNameMatcher("basic"))); try { im.deleteIndex(""); Assert.fail("Expected deleteIndex to throw a QueryException"); } catch (QueryException qe) { ; } assertThat(im.listIndexes(), contains(getIndexNameMatcher("basic"))); }</code><technical_language>This test split</technical_language>

Target:
public void deleteFailOnNoIndexName() throws QueryException { im.ensureIndexed(Arrays.<FieldSort>asList(new FieldSort("name"), new FieldSort("address")), "basic"); assertThat(im.listIndexes(), contains(getIndexNameMatcher("basic"))); try { im.deleteIndex(null); Assert.fail("Expected deleteIndex to throw a IllegalArgumentException"); } catch (IllegalArgumentException iae) { ; } assertThat(im.listIndexes(), contains(getIndexNameMatcher("basic"))); try { im.deleteIndex(""); Assert.fail("Expected deleteIndex to throw a IllegalArgumentException"); } catch (IllegalArgumentException iae) { ; } assertThat(im.listIndexes(), contains(getIndexNameMatcher("basic"))); }
Source:
<code>public void init() throws InitializationException { try { Set<Version> versions = getSupportedClusterLevels(); String devicePropertiesStr; deviceProperties = new HashMap<>(); for (Version version : versions) { devicePropertiesStr = getCustomDeviceProperties(version); if (FeatureSupported.deviceCustomProperties(version)) { deviceProperties.put(version, new EnumMap<VmDeviceGeneralType, Map<String, Pattern>>(VmDeviceGeneralType.class)); Matcher typeMatcher = devicePropSplitPattern.matcher(devicePropertiesStr); while (typeMatcher.find()) { String dcpStr = typeMatcher.group(); int start = TYPE_PREFIX_LEN; int end = dcpStr.length() - 1; if (dcpStr.endsWith(PROPERTIES_DELIMETER)) { end--; } dcpStr = dcpStr.substring(start, end); int idx = dcpStr.indexOf(PROPERTIES_DELIMETER); VmDeviceGeneralType type = VmDeviceGeneralType.forValue(dcpStr.substring(0, idx)); String propStr = dcpStr.substring(idx + PROP_PREFIX_LEN, dcpStr.length() - 1); Map<String, Pattern> props = new HashMap<String, Pattern>(); parsePropertiesRegex(propStr, props); deviceProperties.get(version).put(type, props); } } } <START> } catch (Throwable ex) { <END> throw new InitializationException(ex); } }</code><technical_language>mind replacing Throwable Exception treat Error exceptions manner while reflected of scope of this</technical_language>

Target:
public void init() throws InitializationException { try { Set<Version> versions = getSupportedClusterLevels(); String devicePropertiesStr; deviceProperties = new HashMap<>(); for (Version version : versions) { devicePropertiesStr = getCustomDeviceProperties(version); if (FeatureSupported.deviceCustomProperties(version)) { deviceProperties.put(version, new EnumMap<VmDeviceGeneralType, Map<String, Pattern>>(VmDeviceGeneralType.class)); Matcher typeMatcher = devicePropSplitPattern.matcher(devicePropertiesStr); while (typeMatcher.find()) { String dcpStr = typeMatcher.group(); int start = TYPE_PREFIX_LEN; int end = dcpStr.length() - 1; if (dcpStr.endsWith(PROPERTIES_DELIMETER)) { end--; } dcpStr = dcpStr.substring(start, end); int idx = dcpStr.indexOf(PROPERTIES_DELIMETER); VmDeviceGeneralType type = VmDeviceGeneralType.forValue(dcpStr.substring(0, idx)); String propStr = dcpStr.substring(idx + PROP_PREFIX_LEN, dcpStr.length() - 1); Map<String, Pattern> props = new HashMap<String, Pattern>(); parsePropertiesRegex(propStr, props); deviceProperties.get(version).put(type, props); } } } } catch (Exception ex) { throw new InitializationException(ex); } }
Source:
<code>private T handleClasspath(CompilationRequest req, T res) { T t; Map<String,Object> kieMap = req.getMap(); String classpathKey = req.getRequestUUID() + "." + STRING_CLASSPATH_KEY; Object o = kieMap.get(classpathKey); if(o != null){ Set<String> depsModules = (Set<String>) o; List<String> deps =CompilerClassloaderUtils.readItemsFromClasspathString(depsModules); t = (T) new DefaultCompilationResponse(res.isSuccessful(), res.getMavenOutput(), <START> res.getWorkingDir().orElse(null), <END> deps); }else{ t = (T) new DefaultCompilationResponse(res.isSuccessful(), res.getMavenOutput(), res.getWorkingDir().orElse(null)); } return t; }</code><technical_language>i trouble read orElse(null); smarter? :)</technical_language>

Target:
private T handleClasspath(CompilationRequest req, T res) { T t; Map<String,Object> kieMap = req.getMap(); String classpathKey = req.getRequestUUID() + "." + STRING_CLASSPATH_KEY; Object o = kieMap.get(classpathKey); if(o != null){ Set<String> depsModules = (Set<String>) o; List<String> deps =CompilerClassloaderUtils.readItemsFromClasspathString(depsModules); t = (T) new DefaultCompilationResponse(res.isSuccessful(), res.getMavenOutput(), req.getInfo().getPrjPath(), deps); }else{ t = (T) new DefaultCompilationResponse(res.isSuccessful(), res.getMavenOutput(), req.getInfo().getPrjPath()); } return t; }