auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private Token obtainSnapshotTimestamp() { final AbstractTransactionalContext parentCtx = getParentContext(); final Token txnBuilderTs = getTransaction().getSnapshot(); CorfuRuntime rt = getTransaction().getRuntime(); if (parentCtx != null) { Token parentTimestamp = parentCtx.getSnapshotTimestamp(); log.trace("obtainSnapshotTimestamp: inheriting parent snapshot" + " SnapshotTimestamp[{}] {}", this, parentTimestamp); return parentTimestamp; } else if (!txnBuilderTs.equals(Token.UNINITIALIZED)) { log.trace("obtainSnapshotTimestamp: using user defined snapshot" + " SnapshotTimestamp[{}] {}", this, txnBuilderTs); return txnBuilderTs; } else { <START> Token timestamp = rt <END> .getSequencerView() .query() .getToken(); log.trace("obtainSnapshotTimestamp: sequencer SnapshotTimestamp[{}] {}", this, timestamp); return timestamp; } }</code><technical_language>need this change</technical_language>

Target:
private Token obtainSnapshotTimestamp() { final AbstractTransactionalContext parentCtx = getParentContext(); final Token txnBuilderTs = getTransaction().getSnapshot(); if (parentCtx != null) { Token parentTimestamp = parentCtx.getSnapshotTimestamp(); log.trace("obtainSnapshotTimestamp: inheriting parent snapshot" + " SnapshotTimestamp[{}] {}", this, parentTimestamp); return parentTimestamp; } else if (!txnBuilderTs.equals(Token.UNINITIALIZED)) { log.trace("obtainSnapshotTimestamp: using user defined snapshot" + " SnapshotTimestamp[{}] {}", this, txnBuilderTs); return txnBuilderTs; } else { Token timestamp = getTransaction() .getRuntime() .getSequencerView() .query() .getToken(); log.trace("obtainSnapshotTimestamp: sequencer SnapshotTimestamp[{}] {}", this, timestamp); return timestamp; } }
Source:
<code>public void theSetAdministrativeStatusRequestIsReceived() throws Throwable { <START> PROPERTIES_MAP.put(DEVICE_IDENTIFICATION_G_LABEL, this.deviceId.getDeviceIdG()); <END> PROPERTIES_MAP.put(ORGANISATION_IDENTIFICATION_LABEL, this.organisationId.getOrganisationId()); this.RequestRunner(PROPERTIES_MAP, TEST_CASE_NAME_REQUEST, TEST_CASE_XML, TEST_SUITE_XML); }</code><technical_language>SetAdministrativeStatus tested E-meter DEVICE_IDENTIFICATION_G_LABEL -> DEVICE_IDENTIFICATION_E_LABEL getDeviceIdG -> getDeviceIdE</technical_language>

Target:
public void theSetAdministrativeStatusRequestIsReceived() throws Throwable { PROPERTIES_MAP.put(DEVICE_IDENTIFICATION_E_LABEL, this.deviceId.getDeviceIdE()); PROPERTIES_MAP.put(ORGANISATION_IDENTIFICATION_LABEL, this.organisationId.getOrganisationId()); this.RequestRunner(PROPERTIES_MAP, TEST_CASE_NAME_REQUEST, TEST_CASE_XML, TEST_SUITE_XML); }
Source:
<code>private EquivalentContentIndexingGraphWorker( ContentIndex contentIndex, EquivalenceGraphUpdateResolver graphUpdateResolver, String metricPrefix, MetricRegistry metricRegistry ) { this.contentIndex = checkNotNull(contentIndex); this.graphUpdateResolver = checkNotNull(graphUpdateResolver); this.executionTimer = metricRegistry.timer(metricPrefix + "timer.execution"); this.messageReceivedMeter = metricRegistry.meter(metricPrefix + "meter.received"); this.failureMeter = metricRegistry.meter(metricPrefix + "meter.failure"); <START> this.latencyTimer = metricRegistry.timer(metricPrefix + "latency.meter"); <END> }</code><technical_language>stop pointing out now..</technical_language>

Target:
private EquivalentContentIndexingGraphWorker( ContentIndex contentIndex, EquivalenceGraphUpdateResolver graphUpdateResolver, String metricPrefix, MetricRegistry metricRegistry ) { this.contentIndex = checkNotNull(contentIndex); this.graphUpdateResolver = checkNotNull(graphUpdateResolver); this.executionTimer = metricRegistry.timer(metricPrefix + "timer.execution"); this.messageReceivedMeter = metricRegistry.meter(metricPrefix + "meter.received"); this.failureMeter = metricRegistry.meter(metricPrefix + "meter.failure"); this.latencyTimer = metricRegistry.timer(metricPrefix + "timer.latency"); }
Source:
<code>public boolean anyVisibleWhen() { if (toolbarContribution.getVisibleWhen() != null) { return true; } List<MToolBarElement> childrenToInspect; if (toolbarContribution.getTransientData().get(FACTORY) != null) { <START> childrenToInspect = toolbarModel.getChildren(); <END> } else { childrenToInspect = toolbarContribution.getChildren(); } for (MToolBarElement child : childrenToInspect) { if (child.getVisibleWhen() != null || child.getPersistedState().get( MenuManagerRenderer.VISIBILITY_IDENTIFIER) != null) { return true; } } return false; }</code><technical_language>I this org.eclipse.e4.ui.workbench.renderers.swt.ToolBarContributionRecord.generatedElements generated elements go. toolbarModel potentially children other elements</technical_language>

Target:
public boolean anyVisibleWhen() { if (toolbarContribution.getVisibleWhen() != null) { return true; } List<MToolBarElement> childrenToInspect; if (toolbarContribution.getTransientData().get(FACTORY) != null) { childrenToInspect = this.generatedElements; } else { childrenToInspect = toolbarContribution.getChildren(); } for (MToolBarElement child : childrenToInspect) { if (child.getVisibleWhen() != null || child.getPersistedState().get( MenuManagerRenderer.VISIBILITY_IDENTIFIER) != null) { return true; } } return false; }
Source:
<code>public void execute() throws MojoExecutionException, MojoFailureException { for (Merge mergeData : merges) { <START> final List<File> files = Arrays.asList(mergeData.getFiles()); <END> final Properties properties = new Properties(); InputStream is = null; OutputStream os = null; for (File propertiesFile : files) { if (!propertiesFile.exists()) throw new MojoExecutionException("File does not exist: " + propertiesFile.getAbsolutePath()); try { is = new FileInputStream(propertiesFile); properties.load(is); } catch (Exception e) { throw new MojoExecutionException("", e); } finally { if (is != null) { try { is.close(); } catch (IOException e) { throw new RuntimeException(e); } } } } File destination = mergeData.getDestination(); try { os = new FileOutputStream(destination); properties.store(os, destination.getName()); } catch (Exception e) { throw new MojoExecutionException("Exception writing in the file" + destination.getName(), e); } finally { if (os != null) { try { os.close(); } catch (IOException e) { throw new RuntimeException(e); } } } } }</code><technical_language>necessary. loop mergeData.getFiles()</technical_language>

Target:
public void execute() throws MojoExecutionException, MojoFailureException { for (Merge mergeData : merges) { final Properties properties = new Properties(); InputStream is = null; OutputStream os = null; for (File propertiesFile : mergeData.getFiles()) { if (!propertiesFile.exists()) throw new MojoExecutionException("File does not exist: " + propertiesFile.getAbsolutePath()); try { is = new FileInputStream(propertiesFile); properties.load(is); } catch (Exception e) { throw new MojoExecutionException("Exception while loading the file " + propertiesFile.getAbsolutePath(), e); } finally { if (is != null) { try { is.close(); } catch (IOException e) { throw new RuntimeException(e); } } } } File destination = mergeData.getDestination(); try { os = new FileOutputStream(destination); properties.store(os, destination.getName()); } catch (Exception e) { throw new MojoExecutionException("Exception writing in the file " + destination.getName(), e); } finally { if (os != null) { try { os.close(); } catch (IOException e) { throw new RuntimeException(e); } } } } }
Source:
<code>public static String getState(int errorCode) { switch (errorCode) { case NO_DATA_AVAILABLE: return "02000"; case INVALID_PARAMETER_COUNT_2: return "07001"; case ERROR_OPENING_DATABASE_1: return "08000"; case COLUMN_COUNT_DOES_NOT_MATCH: return "21S02"; case TABLE_OR_VIEW_ALREADY_EXISTS_1: return "42S01"; case TABLE_OR_VIEW_NOT_FOUND_1: return "42S02"; <START> case TABLE_OR_VIEW_NOT_FOUND_2: return "42S03"; case TABLE_OR_VIEW_NOT_FOUND_3: return "42S04"; <END> case INDEX_ALREADY_EXISTS_1: return "42S11"; case INDEX_NOT_FOUND_1: return "42S12"; case DUPLICATE_COLUMN_NAME_1: return "42S21"; case COLUMN_NOT_FOUND_1: return "42S22"; case IDENTICAL_EXPRESSIONS_SHOULD_BE_USED: return "42S31"; case GENERAL_ERROR_1: return "HY000"; case UNKNOWN_DATA_TYPE_1: return "HY004"; case FEATURE_NOT_SUPPORTED_1: return "HYC00"; case LOCK_TIMEOUT_1: return "HYT00"; default: return Integer.toString(errorCode); } }</code><technical_language>1. _1 suffix means error code parameter. names for exceptions. expected self-descriptive. 2. Vendor-specific codes start '0', '1', '2', '3', '4', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'. 42S here, add some plain 90*** codes instead</technical_language>

Target:
public static String getState(int errorCode) { switch (errorCode) { case NO_DATA_AVAILABLE: return "02000"; case INVALID_PARAMETER_COUNT_2: return "07001"; case ERROR_OPENING_DATABASE_1: return "08000"; case COLUMN_COUNT_DOES_NOT_MATCH: return "21S02"; case TABLE_OR_VIEW_ALREADY_EXISTS_1: return "42S01"; case TABLE_OR_VIEW_NOT_FOUND_1: return "42S02"; case TABLE_OR_VIEW_NOT_FOUND_WITH_CANDIDATES_2: return "42S03"; case TABLE_OR_VIEW_NOT_FOUND_DATABASE_EMPTY_1: return "42S04"; case INDEX_ALREADY_EXISTS_1: return "42S11"; case INDEX_NOT_FOUND_1: return "42S12"; case DUPLICATE_COLUMN_NAME_1: return "42S21"; case COLUMN_NOT_FOUND_1: return "42S22"; case IDENTICAL_EXPRESSIONS_SHOULD_BE_USED: return "42S31"; case GENERAL_ERROR_1: return "HY000"; case UNKNOWN_DATA_TYPE_1: return "HY004"; case FEATURE_NOT_SUPPORTED_1: return "HYC00"; case LOCK_TIMEOUT_1: return "HYT00"; default: return Integer.toString(errorCode); } }
Source:
<code>public void ifCantCreateTempFile() { final Environment env = Mockito.mock(Environment.class); <START> Mockito.when(env.tempdir()).thenReturn(new File("/dev/null")); <END> Mockito.when(env.excludes("findbugs")).thenReturn( Arrays.asList("org.package.Class") ); Assertions.assertThrows( IllegalStateException.class, new FindBugsExcludes(env)::asArguments, "Didn't throw an exception for invalid file" ); }</code><technical_language>@ilyakharlamov I this test run windows, fails creating files /dev/null</technical_language>

Target:
public void ifCantCreateTempFile() { final Environment env = Mockito.mock(Environment.class); Mockito.when(env.tempdir()).thenReturn(new File("/dev/null")); Mockito.when(env.excludes("findbugs")).thenReturn( new ListOf<>("org.package.Class") ); Assertions.assertThrows( IOException.class, new FindBugsExcludes(env)::asArguments, "Didn't throw an exception for invalid file" ); }
Source:
<code>public void log(LogLevel level, LogDomain domain, String message) { if(level.compareTo(_level) < 0 || (!_domains.contains(domain) <START> && !_domains.containsAll(EnumSet.allOf(LogDomain.class)))) { <END> return; } switch(level) { case DEBUG: Log.d("CouchbaseLite/" + domain.toString(), message); break; case VERBOSE: Log.v("CouchbaseLite/" + domain.toString(), message); break; case INFO: Log.i("CouchbaseLite/" + domain.toString(), message); break; case WARNING: Log.w("CouchbaseLite/" + domain.toString(), message); break; case ERROR: Log.e("CouchbaseLite/" + domain.toString(), message); break; } }</code><technical_language>I original logic is correct</technical_language>

Target:
public void log(LogLevel level, LogDomain domain, String message) { if(level.compareTo(_level) < 0 || (!_domains.contains(domain) && !_domains.contains(LogDomain.ALL))) { return; } switch(level) { case DEBUG: Log.d("CouchbaseLite/" + domain.toString(), message); break; case VERBOSE: Log.v("CouchbaseLite/" + domain.toString(), message); break; case INFO: Log.i("CouchbaseLite/" + domain.toString(), message); break; case WARNING: Log.w("CouchbaseLite/" + domain.toString(), message); break; case ERROR: Log.e("CouchbaseLite/" + domain.toString(), message); break; } }
Source:
<code>protected boolean canDoAction() { GlusterVolumeEntity glusterVolume = getGlusterVolume(); if (!super.canDoAction()) { return false; } if (!glusterVolume.getVolumeType().isDistributedType()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_NOT_DISTRIBUTED); <START> } else if (glusterVolume.getVolumeType().isDistributedType() && glusterVolume.getBricks().size() == 1) { <END> return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_DISTRIBUTED_AND_HAS_SINGLE_VOLUME); } return true; }</code><technical_language>glusterVolume.getVolumeType().isDistributedType() is redundant</technical_language>

Target:
protected boolean canDoAction() { GlusterVolumeEntity glusterVolume = getGlusterVolume(); if (!super.canDoAction()) { return false; } boolean isVolumeDistributed = glusterVolume.getVolumeType().isDistributedType(); if (!isVolumeDistributed) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_NOT_DISTRIBUTED); } else if (isVolumeDistributed && glusterVolume.getBricks().size() == 1) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_DISTRIBUTED_AND_HAS_SINGLE_VOLUME); } return true; }
Source:
<code>private List<Queue> converteQueueList(List<QueueInfo> queues) { return queues.stream() <START> .map(qi -> convert(qi)) <END> .collect(Collectors.toList()); }</code><technical_language>replace of method references. e.g.: .map(this::convert))</technical_language>

Target:
private List<Queue> converteQueueList(List<QueueInfo> queues) { return queues.stream() .map(this::convert) .collect(Collectors.toList()); }
Source:
<code>public void validateTest() throws Exception { <START> <END> final String port = System.getProperty("server.http.port", "8080"); System.out.println(""); System.out.println("==========================================="); System.out.println("Running test on port: " + port); final String urlPath1 = "http://localhost:" + port + "/WebApp1" + versionNum + "/test/"; final String urlPath2 = "http://localhost:" + port + "/WebApp2" + versionNum + "/test/"; deployer.deploy("webapp1"); int result = WebClient.create(urlPath1) .type(MediaType.APPLICATION_JSON_TYPE).post("valid").getStatus(); System.out.println(result); Assert.assertEquals(200, result); deployer.undeploy("webapp1"); deployer.deploy("webapp2"); result = WebClient.create(urlPath2) .type(MediaType.APPLICATION_JSON_TYPE).post("valid").getStatus(); System.out.println(result); Assert.assertEquals(200, result); deployer.undeploy("webapp2"); System.out.println("==========================================="); System.out.println(""); }</code><technical_language>Patter annotation, valid HTTP status 406. is test is asset that: Assert.assertEquals(406, result); result</technical_language>

Target:
public void validateTest() throws Exception { final String port = System.getProperty("server.http.port", "8080"); System.out.println(""); System.out.println("==========================================="); System.out.println("Running test on port: " + port); final String urlPath1 = "http://localhost:" + port + "/WebApp1/test/"; final String urlPath2 = "http://localhost:" + port + "/WebApp2/test/"; deployer.deploy("webapp1"); int result = WebClient.create(urlPath1) .type(MediaType.APPLICATION_JSON_TYPE).post("validd").getStatus(); System.out.println(result); Assert.assertEquals(406, result); deployer.undeploy("webapp1"); deployer.deploy("webapp2"); result = WebClient.create(urlPath2) .type(MediaType.APPLICATION_JSON_TYPE).post("validd").getStatus(); System.out.println(result); Assert.assertEquals(406, result); result = WebClient.create(urlPath2) .type(MediaType.APPLICATION_JSON_TYPE).post("valid").getStatus(); System.out.println(result); Assert.assertEquals(200, result); deployer.undeploy("webapp2"); System.out.println("==========================================="); System.out.println(""); }
Source:
<code>private static String defaultFileContent() { String result; try { Path path = Paths.get(CFGViewer.class.getResource(DEFAULT_SOURCE_CODE).toURI()); result = new String(Files.readAllBytes(path)); } catch (URISyntaxException | IOException e) { <START> result = " END> } return result; }</code><technical_language>stacktrace displayed nice</technical_language>

Target:
private static String defaultFileContent() { String result; try { Path path = Paths.get(CFGViewer.class.getResource(DEFAULT_SOURCE_CODE).toURI()); result = new String(Files.readAllBytes(path)); } catch (URISyntaxException | IOException e) { e.printStackTrace(); result = " } return result; }
Source:
<code>public static <S> S createService(Class<S> serviceClass, String username, String password) { if (username != null && password != null) { String credentials = username + ":" + password; final String basic = "Basic " + Base64.encodeToString(credentials.getBytes(), Base64.NO_WRAP); httpClient.addInterceptor(chain -> { Request original = chain.request(); Request.Builder requestBuilder = original.newBuilder() .header("Authorization", basic) <START> .header("Accept", "application/json") <END> .method(original.method(), original.body()); Request request = requestBuilder.build(); return chain.proceed(request); }); HttpLoggingInterceptor logging = new HttpLoggingInterceptor(); logging.setLevel(HttpLoggingInterceptor.Level.BODY); httpClient.addInterceptor(new SnooperInterceptor()); httpClient.addInterceptor(logging); } OkHttpClient client = httpClient.build(); Retrofit retrofit = builder.client(client).build(); return retrofit.create(serviceClass); }</code><technical_language>this added in Application Constant??</technical_language>

Target:
public static <S> S createService(Class<S> serviceClass, String username, String password) { if (username != null && password != null) { String credentials = username + ":" + password; final String basic = "Basic " + Base64.encodeToString(credentials.getBytes(), Base64.NO_WRAP); httpClient.addNetworkInterceptor(chain -> { Request original = chain.request(); Request.Builder requestBuilder = original.newBuilder() .header("Authorization", basic) .header("Accept", "application/json") .method(original.method(), original.body()); Request request = requestBuilder.build(); return chain.proceed(request); }); httpClient.addNetworkInterceptor(new ChuckInterceptor(OpenMRS.getInstance())); } OkHttpClient client = httpClient.build(); Retrofit retrofit = builder.client(client).build(); return retrofit.create(serviceClass); }
Source:
<code>private void cleanupExpiredInflightRequests() { Iterator<Map.Entry<Integer, DeleteRequestInfo>> itr = deleteRequestInfos.entrySet().iterator(); while (itr.hasNext()) { DeleteRequestInfo deleteRequestInfo = itr.next().getValue(); if (time.milliseconds() - deleteRequestInfo.startTimeMs > routerConfig.routerRequestTimeoutMs) { itr.remove(); ReplicaId replica = deleteRequestInfo.replica; DataNodeId dataNodeId = replica.getDataNodeId(); NonBlockingRouterMetrics.NodeLevelMetrics dataNodeBasedMetrics = routerMetrics.getDataNodeBasedMetrics(dataNodeId); <START> dataNodeBasedMetrics.deleteRequestTimeoutCount.inc(); <END> dataNodeBasedMetrics.deleteRequestErrorCount.inc(); dataNodeBasedMetrics.countError(RouterErrorCode.OperationTimedOut); updateOperationState(deleteRequestInfo.replica, RouterErrorCode.OperationTimedOut); } } }</code><technical_language>I metrics is unnecessary. try leaner? a case for a lot of metrics, need pick choose. I a reason this time need metrics related a specific type of request datanode. request level metrics datanodes</technical_language>

Target:
private void cleanupExpiredInflightRequests() { Iterator<Map.Entry<Integer, DeleteRequestInfo>> itr = deleteRequestInfos.entrySet().iterator(); while (itr.hasNext()) { DeleteRequestInfo deleteRequestInfo = itr.next().getValue(); if (time.milliseconds() - deleteRequestInfo.startTimeMs > routerConfig.routerRequestTimeoutMs) { itr.remove(); NonBlockingRouterMetrics.NodeLevelMetrics dataNodeBasedMetrics = routerMetrics.getDataNodeBasedMetrics(deleteRequestInfo.replica.getDataNodeId()); dataNodeBasedMetrics.deleteRequestErrorCount.inc(); updateOperationState(deleteRequestInfo.replica, RouterErrorCode.OperationTimedOut); } } }
Source:
<code>private void logDataspacesStatus(String message, DataspacesStatusLevel level) { final String eol = System.lineSeparator(); final boolean hasEol = message.endsWith(eol); if (taskLogger != null && level == DataspacesStatusLevel.ERROR) { <START> taskLogger.getErrorSink().println("[DATASPACES-ERROR] " + message + (hasEol ? "" : eol)); <END> } else if (taskLogger != null && level == DataspacesStatusLevel.WARNING) { taskLogger.getErrorSink().println("[DATASPACES-WARNING] " + message + (hasEol ? "" : eol)); } else if (taskLogger != null && level == DataspacesStatusLevel.INFO) { taskLogger.getOutputSink().println("[DATASPACES-INFO] " + message + (hasEol ? "" : eol)); } }</code><technical_language>println() EOL characters (= CR/LF/CRLF). Therefor, I bet wanted print(), println()</technical_language>

Target:
private void logDataspacesStatus(String message, DataspacesStatusLevel level) { final String eol = System.lineSeparator(); final boolean hasEol = message.endsWith(eol); if (taskLogger != null) { switch (level) { case ERROR: taskLogger.getErrorSink().print("[DATASPACES-ERROR] " + message + (hasEol ? "" : eol)); taskLogger.getErrorSink().flush(); break; case WARNING: taskLogger.getErrorSink().print("[DATASPACES-WARNING] " + message + (hasEol ? "" : eol)); taskLogger.getErrorSink().flush(); break; case INFO: taskLogger.getOutputSink().print("[DATASPACES-INFO] " + message + (hasEol ? "" : eol)); taskLogger.getOutputSink().flush(); break; } } }
Source:
<code>public void coordinateByHitIndex() { final Comparator<SAMRecord> comparator = Comparator.comparing( record -> record.getIntegerAttribute(SAMTag.HI.name()), Comparator.nullsLast(Comparator.naturalOrder()) ); firstOfPairOrFragment.sort(comparator); secondOfPair.sort(comparator); for (int i = 0; i < Math.min(firstOfPairOrFragment.size(), secondOfPair.size()); ++i) { final Integer hiTagValueOfFirst = firstOfPairOrFragment.get(i).getIntegerAttribute(SAMTag.HI.name()); final Integer hiTagValueOfSecond = secondOfPair.get(i).getIntegerAttribute(SAMTag.HI.name()); <START> if (nonNull(hiTagValueOfFirst) && nonNull(hiTagValueOfSecond)) { <END> if (hiTagValueOfFirst < hiTagValueOfSecond) secondOfPair.add(i, null); else if (hiTagValueOfSecond < hiTagValueOfFirst) firstOfPairOrFragment.add(i, null); } if (isNull(hiTagValueOfFirst) && nonNull(hiTagValueOfSecond)) firstOfPairOrFragment.add(i, null); if (isNull(hiTagValueOfFirst) && isNull(hiTagValueOfSecond)) secondOfPair.add(i, null); } renumberHitIndex(); }</code><technical_language>is rationale for functions instead of comparing null directly? understanding is methods provided convenient lambda forms for streaming operations, etc. inline this improvement me</technical_language>

Target:
public void coordinateByHitIndex() { final Comparator<SAMRecord> comparator = Comparator.comparing( record -> record.getIntegerAttribute(SAMTag.HI.name()), Comparator.nullsLast(Comparator.naturalOrder()) ); firstOfPairOrFragment.sort(comparator); secondOfPair.sort(comparator); for (int i = 0; i < Math.min(firstOfPairOrFragment.size(), secondOfPair.size()); ++i) { final Integer leftHi = firstOfPairOrFragment.get(i).getIntegerAttribute(SAMTag.HI.name()); final Integer rightHi = secondOfPair.get(i).getIntegerAttribute(SAMTag.HI.name()); if (leftHi != null) { if (rightHi != null) { if (leftHi < rightHi) secondOfPair.add(i, null); else if (rightHi < leftHi) firstOfPairOrFragment.add(i, null); } } else if (rightHi != null) { firstOfPairOrFragment.add(i, null); } else { secondOfPair.add(i, null); } } }
Source:
<code>public void should_successfully_build_city_if_user_has_enough_resources_in_main_stage() { startNewGame(12, 1); playPreparationStage(); giveResourcesToFirstPlayerForCityBuilding() .nextRandomDiceValues(asList(6, 6)) .THROW_DICE(1) .getGameDetails(1).gameUser(1).check("resources.wheat", is(2)) .getGameDetails(1).gameUser(1).check("resources.stone", is(3)) .BUILD_CITY(1).atNode(1, -1, "top").successfully() <START> .getGameDetails(1).gameUser(1).check("resources.wheat", is(0)) <END> .getGameDetails(1).gameUser(1).check("resources.stone", is(0)); }</code><technical_language>this check answer question in test case, I create another test case for it, rename test case</technical_language>

Target:
public void should_successfully_build_city_if_user_has_enough_resources_in_main_stage() { startNewGame(12, 1); playPreparationStage(); giveResourcesToFirstPlayerForCityBuilding() .nextRandomDiceValues(asList(6, 6)) .THROW_DICE(1) .getGameDetails(1).gameUser(1).check("resources.wheat", greaterThanOrEqualTo(2)) .getGameDetails(1).gameUser(1).check("resources.stone", greaterThanOrEqualTo(3)) .BUILD_CITY(1).atNode(1, -1, "top").successfully(); }
Source:
<code>Object getScript(ImplementationArtifact artifact, Operation op) { Optional<RelationshipTemplate> optionalRelationshipTemplate = Optional.fromNullable(toscaApplication.getNodeTemplate(nodeId).getRelationships().get(relationship.getRelationshipId())); if (!optionalRelationshipTemplate.isPresent()) { LOG.warn("Unsupported operation implementation for " + op.getDescription() + ": no relationship template"); <START> return null; <END> } this.relationshipTemplate = optionalRelationshipTemplate.get(); String script = getScript(artifact); return Optional.of(buildExportStatements(op, script).or(script)); }</code><technical_language>change this</technical_language>

Target:
Object getScript(ImplementationArtifact artifact, Operation op) { Optional<RelationshipTemplate> optionalRelationshipTemplate = Optional.fromNullable(toscaApplication.getNodeTemplate(nodeId).getRelationships().get(relationship.getRelationshipId())); if (!optionalRelationshipTemplate.isPresent()) { LOG.warn("Unsupported operation implementation for " + op.getDescription() + ": no relationship template"); return null; } this.relationshipTemplate = optionalRelationshipTemplate.get(); String script = getScript(artifact); return buildExportStatements(op, script).or(script); }
Source:
<code>public void shouldRemoveEmptyTagsRecursively_asPartOfMigration78() throws Exception { String configXml = "<cruise schemaVersion='77'>" +" <pipelines group='first'>" +" <authorization>" +" <view>" +" <user></user>" +" </view>" +" </authorization>" +" <pipeline name='Test' template='test_template'>" +" <materials>" +" <hg url='../manual-testing/ant_hg/dummy' />" +" </materials>" +" </pipeline>" +" </pipelines>" +"</cruise>"; String migratedXml = migrateXmlString(configXml, 77); assertThat(migratedXml, not(containsString("user"))); assertThat(migratedXml, not(containsString("view"))); <START> assertThat(migratedXml, not(containsString("authorization"))); <END> }</code><technical_language>change strings xml tags <user></technical_language>

Target:
public void shouldRemoveEmptyTagsRecursively_asPartOfMigration78() throws Exception { String configXml = "<cruise schemaVersion='77'>" +" <pipelines group='first'>" +" <authorization>" +" <view>" +" <user></user>" +" </view>" +" </authorization>" +" <pipeline name='Test' template='test_template'>" +" <materials>" +" <hg url='../manual-testing/ant_hg/dummy' />" +" </materials>" +" </pipeline>" +" </pipelines>" +"</cruise>"; String migratedXml = migrateXmlString(configXml, 77); assertThat(migratedXml, not(containsString("<user>"))); assertThat(migratedXml, not(containsString("<view>"))); assertThat(migratedXml, not(containsString("<authorization>"))); }
Source:
<code>public static ModuleDeploymentProperties createModuleDeploymentProperties( Map<String, String> deploymentProperties, ModuleDescriptor descriptor) { ModuleDeploymentProperties moduleDeploymentProperties = new ModuleDeploymentProperties(); String wildcardPrefix = "module.*."; <START> for (String key : deploymentProperties.keySet()) { <END> if (key.startsWith(wildcardPrefix)) { moduleDeploymentProperties.put(key.substring(wildcardPrefix.length()), deploymentProperties.get(key)); } } String modulePrefix = String.format("module.%s.", descriptor.getModuleName()); for (String key : deploymentProperties.keySet()) { if (key.startsWith(modulePrefix)) { moduleDeploymentProperties.put(key.substring(modulePrefix.length()), deploymentProperties.get(key)); } } return moduleDeploymentProperties; }</code><technical_language>Minor nit; iterate entrySet(); especially making passes</technical_language>

Target:
public static ModuleDeploymentProperties createModuleDeploymentProperties( Map<String, String> deploymentProperties, ModuleDescriptor descriptor) { ModuleDeploymentProperties moduleDeploymentProperties = new ModuleDeploymentProperties(); String wildcardPrefix = "module.*."; for (Map.Entry<String, String> prop : deploymentProperties.entrySet()) { String key = prop.getKey(); if (key.startsWith(wildcardPrefix)) { moduleDeploymentProperties.put(key.substring(wildcardPrefix.length()), prop.getValue()); } } String modulePrefix = String.format("module.%s.", descriptor.getModuleName()); for (Map.Entry<String, String> prop : deploymentProperties.entrySet()) { String key = prop.getKey(); if (key.startsWith(modulePrefix)) { moduleDeploymentProperties.put(key.substring(modulePrefix.length()), prop.getValue()); } } return moduleDeploymentProperties; }
Source:
<code>protected void shutdownNodeSourceServices(Client initiator) { logger.info("[" + this.name + "] Shutdown finalization"); this.activePolicy.shutdown(initiator); this.infrastructureManager.internalShutDown(); <START> this.rmcore.disconnect(Client.getId(PAActiveObject.getStubOnThis())); <END> this.finishNodeSourceShutdown(initiator); }</code><technical_language>do this finishNodeSourceShutdown</technical_language>

Target:
protected void shutdownNodeSourceServices(Client initiator) { logger.info("[" + this.name + "] Shutdown finalization"); this.activePolicy.shutdown(initiator); this.infrastructureManager.internalShutDown(); this.finishNodeSourceShutdown(initiator); }
Source:
<code>private void refresh() { <START> NetworkUtils.checkConnection(new WeakReference<>(getContext()), new NetworkUtils.NetworkStateReceiverListener() { <END> @Override public void networkAvailable() { if (AuthUtil.isUserLoggedIn()) { downloadFeedbacks(); } else { redirectToLogin(); if (swipeRefreshLayout != null) swipeRefreshLayout.setRefreshing(false); } } @Override public void networkUnavailable() { onFeedbacksDownloadDone(false); } }); }</code><technical_language>direct check, callback</technical_language>

Target:
private void refresh() { if (NetworkUtils.haveNetworkConnection(getContext())) { if (AuthUtil.isUserLoggedIn()) { downloadFeedbacks(); } else { if (swipeRefreshLayout != null) { swipeRefreshLayout.setRefreshing(true); } } } else { onFeedbacksDownloadDone(false); } }
Source:
<code>public void testNoExceptionThrownOnCallingResetLookData() { <START> <END> LookData lookData = new LookData(); boolean isExceptionThrown = false; try { lookData.resetLookData(); } catch (Exception error) { isExceptionThrown = true; } assertFalse(isExceptionThrown); }</code><technical_language>java LookData lookData = new LookData(); try { lookData.resetLookData(); } catch (Exception exception) { fail(); }</technical_language>

Target:
public void testNoExceptionThrownOnCallingResetLookData() { LookData lookData = new LookData(); try { lookData.resetLookData(); } catch (Exception error) { fail(); } }
Source:
<code>private void doAddToIndex() throws IOException { if (trace) { log.trace(String.format("Indexing object [%s]", scratchPad)); } if (enableParentChildIndex){ String parentId = this.getParentId(scratchPad.bytes(), this.settings.getParentIdPath()); <START> indexFiledWithParentValue = ("{\"index\":{ \"_parent\" : \"" + parentId + "\"}}\n").getBytes(StringUtils.UTF_8); <END> } int entrySize = enableParentChildIndex ? indexFiledWithParentValue.length + CARRIER_RETURN.length + scratchPad.size() : INDEX_DIRECTIVE.length + CARRIER_RETURN.length + scratchPad.size(); if (entrySize + bufferSize > buffer.length) { flushBatch(); } if (enableParentChildIndex) copyIntoBuffer(indexFiledWithParentValue, indexFiledWithParentValue.length); else copyIntoBuffer(INDEX_DIRECTIVE, INDEX_DIRECTIVE.length); copyIntoBuffer(scratchPad.bytes(), scratchPad.size()); copyIntoBuffer(CARRIER_RETURN, CARRIER_RETURN.length); bufferEntries++; if (bufferEntriesThreshold > 0 && bufferEntries >= bufferEntriesThreshold) { flushBatch(); } }</code><technical_language>allow user routing (next step)</technical_language>

Target:
private void doAddToIndex() throws IOException { if (trace) { log.trace(String.format("Indexing object [%s]", scratchPad)); } if (enableParentChildIndex){ String parentId = this.getParentId(scratchPad.bytes(), this.settings.getParentIdPath()); indexFiledWithParentValue = ("{\"index\":{ \"_parent\" : \"" + parentId + "\"}}\n").getBytes(StringUtils.UTF_8); } int entrySize = enableParentChildIndex ? indexFiledWithParentValue.length + CARRIER_RETURN.length + scratchPad.size() : INDEX_DIRECTIVE.length + CARRIER_RETURN.length + scratchPad.size(); if (entrySize + bufferSize > buffer.length) { flushBatch(); } if (enableParentChildIndex){ copyIntoBuffer(indexFiledWithParentValue, indexFiledWithParentValue.length); }else{ copyIntoBuffer(INDEX_DIRECTIVE, INDEX_DIRECTIVE.length); } copyIntoBuffer(scratchPad.bytes(), scratchPad.size()); copyIntoBuffer(CARRIER_RETURN, CARRIER_RETURN.length); bufferEntries++; if (bufferEntriesThreshold > 0 && bufferEntries >= bufferEntriesThreshold) { flushBatch(); } }
Source:
<code>public void run() { while (!interrupted) { try { semaphore.acquire(); } catch (InterruptedException e) { return; } semaphore.drainPermits(); for (Iterator<BlockingRunnable> iterator = blockedTasks.iterator(); iterator.hasNext(); ) { BlockingRunnable runnable = iterator.next(); if (runnable.isReady()) { iterator.remove(); readyList.add(runnable); } } if (log.isTraceEnabled()) { log.tracef("Tasks to be executed=%s, still pending=%s", readyList.size(), blockedTasks.size()); } <START> while (!readyList.isEmpty()) { <END> doExecute(readyList.pop()); } } }</code><technical_language>I recommend iterator calling remove calling pollFirst in a loop (latter me). of a difference if leave is either</technical_language>

Target:
public void run() { while (!interrupted) { try { semaphore.acquire(); } catch (InterruptedException e) { return; } semaphore.drainPermits(); int size = blockedTasks.size(); if (size == 0) { continue; } ArrayDeque<BlockingRunnable> readyList = new ArrayDeque<>(size); for (Iterator<BlockingRunnable> iterator = blockedTasks.iterator(); iterator.hasNext(); ) { BlockingRunnable runnable = iterator.next(); if (runnable.isReady()) { iterator.remove(); readyList.addLast(runnable); } } if (log.isTraceEnabled()) { log.tracef("Tasks to be executed=%s, still pending=~%s", readyList.size(), size); } BlockingRunnable runnable; while ((runnable = readyList.pollFirst()) != null) { doExecute(runnable); } } }
Source:
<code>@Override public void close() throws Exception { socket.close(); ctx.close(); zeroMqExSrv.shutdown(); <START> timeout = 1; <END> zeroMqExSrv.awaitTermination(timeout, TimeUnit.MINUTES); isStarted = false; }</code><technical_language>reassigned here</technical_language>

Target:
@Override public void close() throws Exception { isStarted = false; if (ctx != null) ctx.close(); if (zeroMqExSrv != null) { zeroMqExSrv.shutdown(); try { if (!zeroMqExSrv.awaitTermination(timeout, TimeUnit.MILLISECONDS)) log.warning("Timed out waiting for consumer threads to shut down, exiting uncleanly."); } catch (InterruptedException ignored) { zeroMqExSrv.shutdownNow(); log.error("Interrupted during shutdown, exiting uncleanly."); } } }
Source:
<code>protected void publishResults(CharSequence constraint, FilterResults results) { clear(); TextView tvStats = (TextView) findViewById(R.id.tvStats); TextView tvState = (TextView) findViewById(R.id.tvState); ProgressBar pbFilter = (ProgressBar) findViewById(R.id.pbFilter); pbFilter.setVisibility(ProgressBar.GONE); tvStats.setVisibility(TextView.VISIBLE); tvStats.setText(results.count + "/" + AppListAdapter.this.mListApp.size()); RelativeLayout.LayoutParams tvStateLayout = (RelativeLayout.LayoutParams) tvState.getLayoutParams(); tvStateLayout.addRule(RelativeLayout.LEFT_OF, R.id.tvStats); if (mProgressDialog != null) { try { <START> mProgressDialog.dismiss(); <END> mProgressDialog = null; } catch (Throwable ex) { Util.bug(null, ex); } } if (results.values == null) notifyDataSetInvalidated(); else { addAll((ArrayList<ApplicationInfoEx>) results.values); notifyDataSetChanged(); } }</code><technical_language>wondering exception handler is for ..</technical_language>

Target:
protected void publishResults(CharSequence constraint, FilterResults results) { clear(); TextView tvStats = (TextView) findViewById(R.id.tvStats); TextView tvState = (TextView) findViewById(R.id.tvState); ProgressBar pbFilter = (ProgressBar) findViewById(R.id.pbFilter); pbFilter.setVisibility(ProgressBar.GONE); tvStats.setVisibility(TextView.VISIBLE); tvStats.setText(results.count + "/" + AppListAdapter.this.mListApp.size()); setProgress(getString(R.string.title_restrict), 0, 1); RelativeLayout.LayoutParams tvStateLayout = (RelativeLayout.LayoutParams) tvState.getLayoutParams(); tvStateLayout.addRule(RelativeLayout.LEFT_OF, R.id.tvStats); if (results.values == null) notifyDataSetInvalidated(); else { addAll((ArrayList<ApplicationInfoEx>) results.values); notifyDataSetChanged(); } }
Source:
<code>public FileHeader createFileHeader(DiffEntry ent) throws IOException { ByteArrayOutputStream buf = new ByteArrayOutputStream(); <START> PrintStream ps = new PrintStream(buf, true, "UTF-8"); <END> EditList editList = new EditList(); writeDiffHeader(ps, ent); if (ent.getOldMode() == GITLINK || ent.getNewMode() == GITLINK) { if (ent.getOldMode() == GITLINK) { ps.write(encodeASCII("-Subproject commit " + ent.getOldId().name() + "\n")); } if (ent.getNewMode() == GITLINK) { ps.write(encodeASCII("+Subproject commit " + ent.getNewId().name() + "\n")); } } else { byte[] aRaw = open(ent.getOldMode(), ent.getOldId()); byte[] bRaw = open(ent.getNewMode(), ent.getNewId()); if (RawText.isBinary(aRaw) || RawText.isBinary(bRaw)) { ps.write(encodeASCII("Binary files differ\n")); } else { RawText a = rawTextFactory.create(aRaw); RawText b = rawTextFactory.create(bRaw); editList = new MyersDiff(a, b).getEdits(); } } ps.flush(); return new FileHeader(buf.toByteArray(), editList); }</code><technical_language>Instead of "UTF-8" Constants.CHARSET</technical_language>

Target:
public FileHeader createFileHeader(DiffEntry ent) throws IOException { ByteArrayOutputStream buf = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(buf, true, Constants.CHARSET.name()); final EditList editList; writeDiffHeader(ps, ent); if (ent.getOldMode() == GITLINK || ent.getNewMode() == GITLINK) { writeGitLinkDiffText(ps, ent); editList = new EditList(); } else { byte[] aRaw = open(ent.getOldMode(), ent.getOldId()); byte[] bRaw = open(ent.getNewMode(), ent.getNewId()); if (RawText.isBinary(aRaw) || RawText.isBinary(bRaw)) { ps.write(encodeASCII("Binary files differ\n")); editList = new EditList(); } else { RawText a = rawTextFactory.create(aRaw); RawText b = rawTextFactory.create(bRaw); editList = new MyersDiff(a, b).getEdits(); } } ps.flush(); return new FileHeader(buf.toByteArray(), editList); }
Source:
<code>private void parseCommandLine(final boolean isRootParse) throws ParseException, BadArgumentException { final CommandLineParser parser = new DefaultParser(); if (isRootParse) { <START> String[] roots = rootArgumentsOnly(); <END> this.cmd = parser.parse(this.options, roots); } else { this.cmd = parser.parse(this.options, this.args); } }</code><technical_language>Missing final</technical_language>

Target:
private void parseCommandLine(final boolean isRootParse) throws ParseException, BadArgumentException { final CommandLineParser parser = new DefaultParser(); if (isRootParse) { final String[] roots = rootArgumentsOnly(); this.cmd = parser.parse(this.options, roots); } else { this.cmd = parser.parse(this.options, this.args); } }
Source:
<code>private static void persistTopology(VDS vds) { InterfaceDao interfaceDAO = DbFacade.getInstance().getInterfaceDao(); List<VdsNetworkInterface> dbIfaces = interfaceDAO.getAllInterfacesForVds(vds.getId()); List<String> updatedIfaces = new ArrayList<String>(); List<VdsNetworkInterface> dbIfacesToBatch = new ArrayList<>(); for (VdsNetworkInterface dbIface : dbIfaces) { boolean found = false; for (VdsNetworkInterface vdsIface : vds.getInterfaces()) { if (dbIface.getName().equals(vdsIface.getName())) { vdsIface.setId(dbIface.getId()); dbIfacesToBatch.add(vdsIface); updatedIfaces.add(vdsIface.getName()); found = true; break; } } if (!found) { interfaceDAO.removeInterfaceFromVds(dbIface.getId()); interfaceDAO.removeStatisticsForVds(dbIface.getId()); } } <START> if (dbIfacesToBatch.size() > 0) { <END> interfaceDAO.massUpdateInterfacesForVds(dbIfacesToBatch); } for (VdsNetworkInterface vdsIface : vds.getInterfaces()) { if (!updatedIfaces.contains(vdsIface.getName())) { interfaceDAO.saveInterfaceForVds(vdsIface); interfaceDAO.saveStatisticsForVds(vdsIface.getStatistics()); } } }</code><technical_language>"if (!dbIfacesToBatch.isEmpty()) {" - clearer</technical_language>

Target:
private static void persistTopology(VDS vds) { InterfaceDao interfaceDAO = DbFacade.getInstance().getInterfaceDao(); List<VdsNetworkInterface> dbIfaces = interfaceDAO.getAllInterfacesForVds(vds.getId()); List<String> updatedIfaces = new ArrayList<String>(); List<VdsNetworkInterface> dbIfacesToBatch = new ArrayList<>(); for (VdsNetworkInterface dbIface : dbIfaces) { boolean found = false; for (VdsNetworkInterface vdsIface : vds.getInterfaces()) { if (dbIface.getName().equals(vdsIface.getName())) { vdsIface.setId(dbIface.getId()); dbIfacesToBatch.add(vdsIface); updatedIfaces.add(vdsIface.getName()); found = true; break; } } if (!found) { interfaceDAO.removeInterfaceFromVds(dbIface.getId()); interfaceDAO.removeStatisticsForVds(dbIface.getId()); } } if (!dbIfacesToBatch.isEmpty()) { interfaceDAO.massUpdateInterfacesForVds(dbIfacesToBatch); } for (VdsNetworkInterface vdsIface : vds.getInterfaces()) { if (!updatedIfaces.contains(vdsIface.getName())) { interfaceDAO.saveInterfaceForVds(vdsIface); interfaceDAO.saveStatisticsForVds(vdsIface.getStatistics()); } } }
Source:
<code>public void deliverMessagesFrom(ShardIndex index) { NodeId currentNode = ServerEnvironment.instance() .nodeId(); Optional<ShardProcessingSession> picked = workRegistry.pickUp(index, currentNode); if (!picked.isPresent()) { return; } ShardProcessingSession session = picked.get(); try { <START> <END> int deliveredMsgCount; do { deliveredMsgCount = doDeliver(session); } while (deliveredMsgCount > 0); } catch (DeliveryStoppedByMonitorException ignored) { } finally { session.complete(); } }</code><technical_language>Please kill this line</technical_language>

Target:
public void deliverMessagesFrom(ShardIndex index) { NodeId currentNode = ServerEnvironment.instance() .nodeId(); Optional<ShardProcessingSession> picked = workRegistry.pickUp(index, currentNode); if (!picked.isPresent()) { return; } ShardProcessingSession session = picked.get(); try { RunResult runResult; do { runResult = doDeliver(session); } while (runResult.shouldRunAgain()); } finally { session.complete(); } }
Source:
<code><START> public void doesNotUpdatesChangeTransactionStatusIfChargeTransactionDoesNotExist() throws Exception { <END> PaymentRequestEntity paymentRequest = mock(PaymentRequestEntity.class); when(mockPaymentRequestDao.findByExternalId(someExternalId)).thenReturn(Optional.of(paymentRequest)); when(paymentRequest.hasChargeTransaction()).thenReturn(false); ChargeStatus newChargeStatus = ChargeStatus.ENTERING_CARD_DETAILS; new StatusUpdater(mockPaymentRequestDao).updateChargeTransactionStatus(someExternalId, newChargeStatus); verify(paymentRequest).hasChargeTransaction(); verifyNoMoreInteractions(paymentRequest); }</code><technical_language>generally in agreement notion stubbing need verified, remove lines</technical_language>

Target:
public void doesNotUpdatesChangeTransactionStatusIfChargeTransactionDoesNotExist() throws Exception { PaymentRequestEntity paymentRequest = mock(PaymentRequestEntity.class); when(mockPaymentRequestDao.findByExternalId(SOME_EXTERNAL_ID)).thenReturn(Optional.of(paymentRequest)); when(paymentRequest.hasChargeTransaction()).thenReturn(false); new StatusUpdater(mockPaymentRequestDao).updateChargeTransactionStatus(SOME_EXTERNAL_ID, ENTERING_CARD_DETAILS); verify(paymentRequest).hasChargeTransaction(); verifyNoMoreInteractions(paymentRequest); }
Source:
<code>private Rectangle getPreferredInternalLocation(Rectangle proposedLocation) { Rectangle realLocation = new Rectangle(proposedLocation); IFigure compartment = getCompositeCompartmentFigure(parentFigure); Rectangle compartmentBounds; if (null != compartment) { compartmentBounds = compartment.getBounds().getCopy(); int xMin = compartmentBounds.x + borderItemOffset; int xMax = compartmentBounds.x + compartmentBounds.width - borderItemOffset - realLocation.width; int yMin = compartmentBounds.y + borderItemOffset; int yMax = compartmentBounds.y + compartmentBounds.height - borderItemOffset - realLocation.height; if (realLocation.x < xMin) { realLocation.x = xMin; } if (realLocation.x > xMax) { realLocation.x = xMax; } if (realLocation.y < yMin) { realLocation.y = yMin; } if (realLocation.y > yMax) { realLocation.y = yMax; } } <START> System.err.println("proposed: " + proposedLocation); <END> System.err.println("real: " + realLocation); return realLocation; }</code><technical_language>Please remove these</technical_language>

Target:
private Rectangle getPreferredInternalLocation(Rectangle proposedLocation) { Rectangle realLocation = new Rectangle(proposedLocation); IFigure compartment = getCompositeCompartmentFigure(parentFigure); Rectangle compartmentBounds; if (null != compartment) { compartmentBounds = compartment.getBounds().getCopy(); int xMin = compartmentBounds.x + borderItemOffset; int xMax = compartmentBounds.x + compartmentBounds.width - borderItemOffset - realLocation.width; int yMin = compartmentBounds.y + borderItemOffset; int yMax = compartmentBounds.y + compartmentBounds.height - borderItemOffset - realLocation.height; if (realLocation.x < xMin) { realLocation.x = xMin; } if (realLocation.x > xMax) { realLocation.x = xMax; } if (realLocation.y < yMin) { realLocation.y = yMin; } if (realLocation.y > yMax) { realLocation.y = yMax; } } return realLocation; }
Source:
<code>private static String getResponseAsString(HttpResponse response) { StringBuilder builder = new StringBuilder(); builder.append(response.getStatusLine().toString()); <START> builder.append("\r\n"); <END> for (Header header : response.getAllHeaders()) { builder.append(header.getName()); builder.append("="); builder.append(header.getValue()); builder.append("\r\n"); } builder.append("\r\n"); if (response.getEntity() != null) { try { builder.append(EntityUtils.toString(response.getEntity())); } catch (IOException ignore) { } } return builder.toString(); }</code><technical_language>I StringUtils for this. ("\r\n")</technical_language>

Target:
private static String getResponseAsString(HttpResponse response) { StringBuilder builder = new StringBuilder(); builder.append(response.getStatusLine().toString()); try { builder.append(StringUtils.fixLineSeparator("\r\n")); } catch (UnsupportedEncodingException e) { SoapUI.logError(e); } for (Header header : response.getAllHeaders()) { builder.append(header.getName()); builder.append("="); builder.append(header.getValue()); builder.append("\r\n"); } builder.append("\r\n"); if (response.getEntity() != null) { try { builder.append(EntityUtils.toString(response.getEntity())); } catch (IOException ignore) { } } return builder.toString(); }