auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void showSuccessToast(String wikiItemName) { <START> String title = wikiItemName; <END> String successStringTemplate = context.getString(R.string.successful_wikidata_edit); String successMessage = String.format(Locale.getDefault(), successStringTemplate, title); ViewUtil.showLongToast(context, successMessage); }</code><technical_language>need assign this a variable</technical_language>

Target:
private void showSuccessToast(String wikiItemName) { String successStringTemplate = context.getString(R.string.successful_wikidata_edit); String successMessage = String.format(Locale.getDefault(), successStringTemplate, wikiItemName); ViewUtil.showLongToast(context, successMessage); }
Source:
<code>public DirectoryProperty getOutputLocation() { <START> return null; <END> }</code><technical_language>this return null outputLocation</technical_language>

Target:
public DirectoryProperty getOutputLocation() { return outputLocation; }
Source:
<code>public InputStream getContents() throws CoreException { try { return open(); } catch (IOException e) { throw new CoreException(new Status(IStatus.ERROR, path, NLS.bind( CoreText.BlobStorage_errorReadingBlob, blobId), e)); <START> } <END> }</code><technical_language>parameter of Status is pluginId. pass path here</technical_language>

Target:
public InputStream getContents() throws CoreException { try { return open(); } catch (IOException e) { throw new CoreException(Activator.error( NLS.bind(CoreText.BlobStorage_errorReadingBlob, blobId .name(), path), e)); } }
Source:
<code>public void testRemoveSessionByUserId() throws Exception { UserSession session = createUserSession(); String ser = BridgeObjectMapper.get().writeValueAsString(session); when(jedisOps.get(USER_ID_TO_SESSION.toString())).thenReturn(ser); cacheProvider.removeSessionByUserId(USER_ID); verify(transaction).del(TOKEN_TO_USER_ID.toString()); <START> verify(transaction).del(USER_ID_TO_SESSION.toString()); <END> verify(transaction).exec(); }</code><technical_language>Similarly, this verify delete 4 keys</technical_language>

Target:
public void testRemoveSessionByUserId() throws Exception { UserSession session = createUserSession(); String ser = BridgeObjectMapper.get().writeValueAsString(session); when(jedisOps.get(USER_ID_TO_SESSION.toString())).thenReturn(ser); cacheProvider.removeSessionByUserId(USER_ID); verify(transaction).del(TOKEN_TO_USER_ID.toString()); verify(transaction).del(USER_ID_TO_SESSION.toString()); verify(transaction).del(CacheKey.session(DECRYPTED_SESSION_TOKEN).toString()); verify(transaction).del(CacheKey.sessionByUserId(USER_ID).toString()); verify(transaction).exec(); }
Source:
<code>public static IBinding findEnclosingFunction(IASTNode node) { IASTFunctionDefinition functionDefinition = <START> findEnclosingFunctionDefinition(node); <END> if (functionDefinition == null) return null; IASTDeclarator dtor= findInnermostDeclarator(functionDefinition.getDeclarator()); if (dtor != null) { IASTName name= dtor.getName(); if (name != null) { return name.resolveBinding(); } } return null; }</code><technical_language>CPPVisitor.findAncestorWithType(IASTNode, Class<T>), moved ASTQueries</technical_language>

Target:
public static IBinding findEnclosingFunction(IASTNode node) { IASTFunctionDefinition functionDefinition = findAncestorWithType(node, IASTFunctionDefinition.class); if (functionDefinition == null) return null; IASTDeclarator dtor= findInnermostDeclarator(functionDefinition.getDeclarator()); if (dtor != null) { IASTName name= dtor.getName(); if (name != null) { return name.resolveBinding(); } } return null; }
Source:
<code>public void close() throws ConnectException { try { if (writer != null) { writer.close(); writer = null; } if (reader != null) { reader.close(); reader = null; } } catch (IOException e) { throw new ConnectException("Error closing " + logFile, e); } finally { <START> writer = null; <END> reader = null; } }</code><technical_language>I point actual lines, nullifying reader writer above, is redundant done finally block</technical_language>

Target:
public void close() throws ConnectException { try { if (writer != null) { writer.close(); } if (reader != null) { reader.close(); } } catch (IOException e) { throw new DataException("Error closing " + logFile, e); } finally { writer = null; reader = null; } }
Source:
<code>private static void assertRootCause(Exception exception, Class<?> type, String message) { Throwable root = exception; while ( root.getCause() != null ) { root = root.getCause(); } assertTyping( type, root ); <START> assertEquals( root.getMessage(), message ); <END> }</code><technical_language>swap method parametrr orders above</technical_language>

Target:
private static void assertRootCause(Exception exception, Class<?> type, String message) { Throwable root = exception; while ( root.getCause() != null ) { root = root.getCause(); } assertTyping( type, root ); assertEquals( message, root.getMessage() ); }
Source:
<code>private JLabel getSizeMemoryLabel() { if (sizeMemoryLabel == null) { sizeMemoryLabel = new JLabel(); <START> updateMemoryLabel(sizeMemoryLabel, "jvm.options.memory.size", Runtime.getRuntime().totalMemory()); <END> } return sizeMemoryLabel; }</code><technical_language>I guess remove these, initParam is called showing panel, wdyt</technical_language>

Target:
private ZapLabel getSizeMemoryLabel() { if (sizeMemoryLabel == null) { sizeMemoryLabel = new ZapLabel(); } return sizeMemoryLabel; }
Source:
<code>public SkuDetails(JSONObject source) throws JSONException { String responseType = source.optString(Constants.RESPONSE_TYPE); if (responseType == null) { responseType = Constants.PRODUCT_TYPE_MANAGED; } productId = source.optString(Constants.RESPONSE_PRODUCT_ID); title = source.optString(Constants.RESPONSE_TITLE); description = source.optString(Constants.RESPONSE_DESCRIPTION); isSubscription = responseType.equalsIgnoreCase(Constants.PRODUCT_TYPE_SUBSCRIPTION); currency = source.optString(Constants.RESPONSE_PRICE_CURRENCY); priceLong = source.optLong(Constants.RESPONSE_PRICE_MICROS); priceValue = priceLong / 1000000d; priceText = source.optString(Constants.RESPONSE_PRICE); <START> subscriptionPeriod = source.optString(Constants.RESPONSE_SUBSCRIPTION_PERIOD, "P"); <END> subscriptionFreeTrialPeriod = source.optString(Constants.RESPONSE_FREE_TRIAL_PERIOD, "P"); introductoryPriceLong = source.optLong(Constants.RESPONSE_INTRODUCTORY_PRICE_MICROS); introductoryPriceValue = introductoryPriceLong / 1000000d; introductoryPriceText = source.optString(Constants.RESPONSE_INTRODUCTORY_PRICE); introductoryPricePeriod = source.optString(Constants.RESPONSE_INTRODUCTORY_PRICE_PERIOD, "P"); introductoryPriceCycles = source.optInt(Constants.RESPONSE_INTRODUCTORY_PRICE_CYCLES); }</code><technical_language>"P" here</technical_language>

Target:
public SkuDetails(JSONObject source) throws JSONException { String responseType = source.optString(Constants.RESPONSE_TYPE); if (responseType == null) { responseType = Constants.PRODUCT_TYPE_MANAGED; } productId = source.optString(Constants.RESPONSE_PRODUCT_ID); title = source.optString(Constants.RESPONSE_TITLE); description = source.optString(Constants.RESPONSE_DESCRIPTION); isSubscription = responseType.equalsIgnoreCase(Constants.PRODUCT_TYPE_SUBSCRIPTION); currency = source.optString(Constants.RESPONSE_PRICE_CURRENCY); priceLong = source.optLong(Constants.RESPONSE_PRICE_MICROS); priceValue = priceLong / 1000000d; priceText = source.optString(Constants.RESPONSE_PRICE); subscriptionPeriod = source.optString(Constants.RESPONSE_SUBSCRIPTION_PERIOD); subscriptionFreeTrialPeriod = source.optString(Constants.RESPONSE_FREE_TRIAL_PERIOD); haveTrialPeriod = !TextUtils.isEmpty(subscriptionFreeTrialPeriod); introductoryPriceLong = source.optLong(Constants.RESPONSE_INTRODUCTORY_PRICE_MICROS); introductoryPriceValue = introductoryPriceLong / 1000000d; introductoryPriceText = source.optString(Constants.RESPONSE_INTRODUCTORY_PRICE); introductoryPricePeriod = source.optString(Constants.RESPONSE_INTRODUCTORY_PRICE_PERIOD); haveIntroductoryPeriod = !TextUtils.isEmpty(introductoryPricePeriod); introductoryPriceCycles = source.optInt(Constants.RESPONSE_INTRODUCTORY_PRICE_CYCLES); }
Source:
<code>public DatasetDefinition create(String datasetName, String displayName, DatasetQuery query, Collection<String> indexBy) throws IOException { <START> if (isBlank(datasetName)) { <END> throw new IllegalArgumentException("Dataset name cannot be blank"); } if (isBlank(displayName)) { throw new IllegalArgumentException("Display name cannot be blank"); } if (query == null) { throw new IllegalArgumentException("Dataset query is required"); } if (indexBy == null || indexBy.isEmpty()) { throw new IllegalArgumentException("At least one index property is required"); } KeenQueryRequest request = CachedDatasetRequest.creationRequest(datasetName, displayName, query, indexBy); return DatasetDefinition.fromMap(keenQueryClient.getMapResponse(request)); }</code><technical_language>org.apache.commons.lang3.Validate#notBlank(T, java.lang.String, java.lang.Object...)</technical_language>

Target:
public DatasetDefinition create(String datasetName, String displayName, DatasetQuery query, Collection<String> indexBy) throws IOException { Validate.notBlank(datasetName, "Dataset name cannot be blank"); Validate.notBlank(displayName, "Display name cannot be blank"); Validate.notNull(query, "Dataset query is required"); Validate.notEmpty(indexBy, "At least one index property is required"); KeenQueryRequest request = CachedDatasetRequest.creationRequest(datasetName, displayName, query, indexBy); return DatasetDefinition.fromMap(keenQueryClient.getMapResponse(request)); }
Source:
<code>public void getOutput_ReturnsOutput() { Step step = features.get(1).getElements()[0].getSteps()[7]; Output[] outputs = step.getOutput(); ArrayList<String> messages = new ArrayList<>(); for(Output output : outputs) { messages.addAll(Arrays.asList(output.getMessages())); } <START> assertThat(messages.toArray(new String[messages.size()])).containsOnlyOnce( <END> "Could not connect to the server @Rocky@", "Could not connect to the server @Mike@"); }</code><technical_language>why</technical_language>

Target:
public void getOutput_ReturnsOutput() { Step step = features.get(1).getElements()[0].getSteps()[7]; Output[] outputs = step.getOutput(); assertThat(getMessages(outputs)).containsOnlyOnce( "Could not connect to the server @Rocky@", "Could not connect to the server @Mike@"); }
Source:
<code>public void aiMover() { this.players = this.level.getPlayers(); this.units = this.level.getUnits(); <START> for(Unit u:units) <END> { if (u instanceof Enemy) { this.enemies.add((Enemy) u); } } if(players.size() > 0) { this.player = this.players.get(0); movementsX = PathCalculation.calculateXPath((Mover) player, enemies, this.level); movementsY = PathCalculation.calculateYPath((Mover) player, enemies, this.level); for(int i = 0; i < enemies.size(); i++) { Enemy enemy = enemies.get(i); int moveToX = movementsX.get(i); int moveToY = movementsY.get(i); randomizer(enemy); doMoves(enemy, moveToX, moveToY); } } }</code><technical_language>Please add spaces : < layout</technical_language>

Target:
public void aiMover() { this.players = this.level.getPlayers(); this.units = this.level.getUnits(); for(Unit u : units) { if (u instanceof Enemy) { this.enemies.add((Enemy) u); } } if(players.size() > 0) { this.player = this.players.get(0); for(int i = 0; i < enemies.size(); i++) { Enemy enemy = enemies.get(i); int moveToX = PathCalculation.calculateXPath((Mover) player, enemy, this.level); int moveToY = PathCalculation.calculateYPath((Mover) player, enemy, this.level); randomizer(enemy); doMoves(enemy, moveToX, moveToY); } } }
Source:
<code>static public CloseModelDefaultAction getCurrentCloseModelDefaultAction() { String defaultCloseActionString="Prompt"; <START> String saved = TheApp.getCurrentVersionPreferences().get("DefaultCloseAction", defaultCloseActionString); <END> if (saved.equalsIgnoreCase("discard")) currentCloseModelDefaultAction=CloseModelDefaultAction.DISCARD; else if (saved.equalsIgnoreCase("save")) currentCloseModelDefaultAction=CloseModelDefaultAction.SAVE; else currentCloseModelDefaultAction=CloseModelDefaultAction.PROMPT; return currentCloseModelDefaultAction; }</code><technical_language>I this preference is user-facing not. If not, "Internal.DefaultCloseAction"; if so, "Default Close Action"</technical_language>

Target:
static public CloseModelDefaultAction getCurrentCloseModelDefaultAction() { String defaultCloseActionString="Prompt"; String saved = TheApp.getCurrentVersionPreferences().get("Internal.DefaultCloseAction", defaultCloseActionString); if (saved.equalsIgnoreCase("discard")) currentCloseModelDefaultAction=CloseModelDefaultAction.DISCARD; else if (saved.equalsIgnoreCase("save")) currentCloseModelDefaultAction=CloseModelDefaultAction.SAVE; else currentCloseModelDefaultAction=CloseModelDefaultAction.PROMPT; return currentCloseModelDefaultAction; }
Source:
<code>int memSize() { <START> return BASE_NODE_SIZE + 2 * 4; <END> }</code><technical_language>more - this 3</technical_language>

Target:
int memSize() { return BASE_NODE_SIZE + 3 * 4; }
Source:
<code>private void verifySignatureName(Question question, String questionValue) { Signature signature = SignatureValue.deserialize(questionValue); ViewInteraction name = onView(allOf(withId(R.id.signature_name), withQuestionViewParent(question, SignatureQuestionView.class))) .perform(scrollTo()); <START> name.check(matches(allOf(isDisplayed(), withText(signature.getName())))); <END> }</code><technical_language>This subview need a check enabled not</technical_language>

Target:
private void verifySignatureName(Question question, String questionValue) { Signature signature = SignatureValue.deserialize(questionValue); ViewInteraction name = onView(allOf(withId(R.id.signature_name), withQuestionViewParent(question, SignatureQuestionView.class))) .perform(scrollTo()); name.check(matches(allOf(isDisplayed(), withText(signature.getName()), not(isEnabled())))); }
Source:
<code>private static AddDiskParameters createParameters() { DiskImage image = new DiskImage(); DiskVmElement dve = new DiskVmElement(null, vmId); dve.setDiskInterface(DiskInterface.IDE); <START> dve.setUsingScsiReservation(true); <END> return new AddDiskParameters(dve, image); }</code><technical_language>Why? set in of tests changed here. I this line removed</technical_language>

Target:
private static AddDiskParameters createParameters() { DiskImage image = new DiskImage(); DiskVmElement dve = new DiskVmElement(null, vmId); dve.setDiskInterface(DiskInterface.IDE); return new AddDiskParameters(dve, image); }
Source:
<code>public static boolean exists(WebDriver webDriver, By context, By by) { webDriver.manage().timeouts().implicitlyWait(0, TimeUnit.MILLISECONDS); boolean exists = (null == context ? webDriver : webDriver.findElement(context)).findElements(by).size() != 0; webDriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); return exists; <START> } <END></code><technical_language>want wait a bit check if exists? this method is in assertFalse() statements verify element exist, more sense change this method notExists()</technical_language>

Target:
public static boolean exists(WebDriver webDriver, By context, By by) { webDriver.manage().timeouts().implicitlyWait(1, TimeUnit.MILLISECONDS); boolean exists = (null == context ? webDriver : webDriver.findElement(context)).findElements(by).size() != 0; webDriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); return exists; }
Source:
<code>protected void close() throws IOException { synchronized(fdLock) { if (fd != null && fd.valid()) { if (!stream) { ResourceManager.afterUdpClose(); } if (fdUseCount == 0) { if (closePending) { return; } <START> if (!closePending) { <END> SocketTagger.get().untag(fd); } closePending = true; socketClose(); return; } else { if (!closePending) { closePending = true; fdUseCount--; SocketTagger.get().untag(fd); socketPreClose(); } } } } }</code><technical_language>difficult meet this condition considering "if (closePending) {return;}" in a line before</technical_language>

Target:
protected void close() throws IOException { synchronized(fdLock) { if (fd != null && fd.valid()) { if (!stream) { ResourceManager.afterUdpClose(); } if (!closePending) { SocketTagger.get().untag(fd); } if (fdUseCount == 0) { if (closePending) { return; } closePending = true; try { socketPreClose(); } finally { socketClose(); } fd = null; return; } else { if (!closePending) { closePending = true; fdUseCount--; socketPreClose(); } } } } }
Source:
<code>private void commitFiles(String commiitMess) { projectExplorer.waitAndSelectItem(PROJECT_NAME); <START> menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.COMMIT); <END> git.waitAndRunCommit(commiitMess); git.waitGitStatusBarWithMess(TestGitConstants.COMMIT_MESSAGE_SUCCESS); }</code><technical_language>Static imports of constants this code more readable</technical_language>

Target:
private void commitFiles(String commiitMess) { projectExplorer.waitAndSelectItem(PROJECT_NAME); menu.runCommand(GIT, COMMIT); git.waitAndRunCommit(commiitMess); git.waitGitStatusBarWithMess(TestGitConstants.COMMIT_MESSAGE_SUCCESS); }
Source:
<code>protected org.kuali.kfs.fp.businessobject.DisbursementVoucherNonEmployeeExpense buildNonEmployeeExpense() { org.kuali.kfs.fp.businessobject.DisbursementVoucherNonEmployeeExpense nonEmployeeExpense = new org.kuali.kfs.fp.businessobject.DisbursementVoucherNonEmployeeExpense(); <START> return nonEmployeeExpense; <END> }</code><technical_language>shorten this return new org.kuali.kfs.fp.businessobject.DisbursementVoucherNonEmployeeExpense() in line</technical_language>

Target:
protected DisbursementVoucherNonEmployeeExpense buildNonEmployeeExpense() { return new DisbursementVoucherNonEmployeeExpense(); }
Source:
<code>private String wrapSegs(String segmentsLocalStorage) { <START> if (segmentsLocalStorage.equals("")) { <END> return "[]"; } String ksgmnt = "["; String[] segments = segmentsLocalStorage.split(","); if (segments.length > MAX_SEGS_NUMBER_GPT) { segments = Arrays.copyOfRange(segmentsLocalStorage.split(","), 0, MAX_SEGS_NUMBER_GPT); } for (String segment : segments) { ksgmnt += String.format("\"%s\",", segment); } ksgmnt = ksgmnt.substring(0, ksgmnt.length() - 1) + "]"; return ksgmnt; }</code><technical_language>isEmpty</technical_language>

Target:
private String wrapSegs(String segmentsLocalStorage) { if ("".equals(segmentsLocalStorage)) { return "[]"; } String ksgmnt = "["; String[] segments = segmentsLocalStorage.split(","); if (segments.length > MAX_SEGS_NUMBER_GPT) { segments = Arrays.copyOfRange(segmentsLocalStorage.split(","), 0, MAX_SEGS_NUMBER_GPT); } for (String segment : segments) { ksgmnt += String.format("\"%s\",", segment); } ksgmnt = ksgmnt.substring(0, ksgmnt.length() - 1) + "]"; return ksgmnt; }
Source:
<code>public void testFreestyleWithExceptionPublisher() throws IOException, ExecutionException, InterruptedException { FreeStyleProject p = j.createFreeStyleProject(); p.getPublishersList().add(new TrueFalsePublisher(true)); p.getPublishersList().add(new AbortExceptionPublisher()); p.getPublishersList().add(new ResultWriterPublisher("result.txt")); p.getPublishersList().add(new ArtifactArchiver("result.txt", "", false)); FreeStyleBuild b = p.scheduleBuild2(0).get(); <START> assertEquals("Build must fail, because we used FalsePublisher", b.getResult(), Result.FAILURE); <END> File file = new File(b.getArtifactsDir(), "result.txt"); assertTrue("ArtifactArchiver is executed even prior publisher fails.", file.exists()); assertTrue("Second publisher must see FAILURE status", FileUtils.readFileToString(file).equals(Result.FAILURE.toString())); }</code><technical_language>FalsePublisher -> AbortExceptionPublisher</technical_language>

Target:
public void testFreestyleWithExceptionPublisher() throws Exception { FreeStyleProject p = j.createFreeStyleProject(); p.getPublishersList().add(new TrueFalsePublisher(true)); p.getPublishersList().add(new AbortExceptionPublisher()); p.getPublishersList().add(new ResultWriterPublisher("result.txt")); final ArtifactArchiver artifactArchiver = new ArtifactArchiver("result.txt"); artifactArchiver.setOnlyIfSuccessful(false); p.getPublishersList().add(artifactArchiver); FreeStyleBuild b = p.scheduleBuild2(0).get(); assertEquals("Build must fail, because we used AbortExceptionPublisher", b.getResult(), Result.FAILURE); j.assertLogNotContains("\tat", b); j.assertLogContains("Threw AbortException from publisher!", b); File file = new File(b.getArtifactsDir(), "result.txt"); assertTrue("ArtifactArchiver is executed even prior publisher fails", file.exists()); assertTrue("Third publisher must see FAILURE status", FileUtils.readFileToString(file).equals(Result.FAILURE.toString())); }
Source:
<code>public void testWriteJobWithZeroLengthObject() throws Exception { <START> final Ds3Client client = Ds3ClientBuilder.fromEnv() <END> .withHttps(false) .build(); final Path tempDirectory = Files.createTempDirectory(Paths.get("."), null); final Path tempFile = Files.createTempFile(tempDirectory, "EmptyFile", null); final String fileName = tempFile.getFileName().toString(); try { final Ds3ClientHelpers ds3ClientHelpers = Ds3ClientHelpers.wrap(client); final ImmutableList<Ds3Object> objects = ImmutableList.of(new Ds3Object(fileName, 0)); final Ds3ClientHelpers.Job writeJob = ds3ClientHelpers.startWriteJob(BUCKET_NAME, objects); writeJob.transfer(new FileObjectPutter(tempDirectory)); final GetBucketResponse request = client.getBucket(new GetBucketRequest(BUCKET_NAME)); final ListBucketResult result = request.getListBucketResult(); assertThat(result.getObjects().size(), is(1)); final Contents contents = result.getObjects().get(0); assertThat(contents.getKey(), is(fileName)); assertThat(contents.getSize(), is((long) 0)); } finally { FileUtils.deleteDirectory(tempDirectory.toFile()); deleteAllContents(client, BUCKET_NAME); } }</code><technical_language>client created for integration tests</technical_language>

Target:
public void testWriteJobWithZeroLengthObject() throws Exception { final Path tempDirectory = Files.createTempDirectory(Paths.get("."), null); final Path tempFile = Files.createTempFile(tempDirectory, "EmptyFile", null); final String fileName = tempFile.getFileName().toString(); try { final Ds3ClientHelpers ds3ClientHelpers = Ds3ClientHelpers.wrap(client); final ImmutableList<Ds3Object> objects = ImmutableList.of(new Ds3Object(fileName, 0)); final Ds3ClientHelpers.Job writeJob = ds3ClientHelpers.startWriteJob(BUCKET_NAME, objects); writeJob.transfer(new FileObjectPutter(tempDirectory)); final GetBucketResponse request = client.getBucket(new GetBucketRequest(BUCKET_NAME)); final ListBucketResult result = request.getListBucketResult(); assertThat(result.getObjects().size(), is(1)); final Contents contents = result.getObjects().get(0); assertThat(contents.getKey(), is(fileName)); assertThat(contents.getSize(), is((long) 0)); } finally { FileUtils.deleteDirectory(tempDirectory.toFile()); deleteAllContents(client, BUCKET_NAME); } }
Source:
<code>public static Slice stConvexHull(@SqlType(GEOMETRY_TYPE_NAME) Slice input) { OGCGeometry geometry = deserialize(input); if (geometry.isEmpty()) { <START> throw new PrestoException(INVALID_FUNCTION_ARGUMENT, format("The input geometry should not be empty")); <END> } OGCGeometry convexHull = geometry.convexHull(); if (!isGeometrySimple(convexHull)) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, format("Unable to construct a convex hull based on input")); } return serialize(convexHull); }</code><technical_language>return input geometry in case is empty. Failing a query if a handful of records empty values is user friendly. return input;</technical_language>

Target:
public static Slice stConvexHull(@SqlType(GEOMETRY_TYPE_NAME) Slice input) { OGCGeometry geometry = deserialize(input); validateType("ST_ConvexHull", geometry, EnumSet.of(POINT, MULTI_POINT, LINE_STRING, MULTI_LINE_STRING, POLYGON, MULTI_POLYGON)); if (geometry.isEmpty()) { return input; } if (GeometryType.getForEsriGeometryType(geometry.geometryType()) == POINT) { return input; } OGCGeometry convexHull = geometry.convexHull(); if (convexHull.isEmpty()) { return serialize(createFromEsriGeometry(((MultiVertexGeometry) geometry.getEsriGeometry()).getPoint(0), null)); } if (GeometryType.getForEsriGeometryType(convexHull.geometryType()) == MULTI_POLYGON) { MultiVertexGeometry multiVertex = (MultiVertexGeometry) convexHull.getEsriGeometry(); if (multiVertex.getPointCount() == 2) { OGCGeometry linestring = createFromEsriGeometry(new Polyline(multiVertex.getPoint(0), multiVertex.getPoint(1)), null); return serialize(linestring); } } return serialize(convexHull); }
Source:
<code>public void shutdownServer() throws Exception { try (ManagementClient managementClient = getManagementClient()) { long timeout = SHUTDOWN_WAITING_TIME + System.currentTimeMillis(); managementClient.executeForResult(Operations.createOperation(SHUTDOWN, new ModelNode().setEmptyList())); while (System.currentTimeMillis() < timeout) { Thread.sleep(FREQUENCY); try { controller.getClient().isServerInRunningState(); } catch (RuntimeException ex) { <START> ex.printStackTrace(); <END> break; } } Assert.assertFalse(System.currentTimeMillis() < timeout); Assert.assertFalse(controller.getClient().isServerInRunningState()); } Assert.assertFalse(controller.getClient().isServerInRunningState()); try { controller.stop(); } catch (RuntimeException ex) { } controller.start(); }</code><technical_language>Do need this stack trace printed fail</technical_language>

Target:
public void shutdownServer() throws Exception { try (ManagementClient managementClient = getManagementClient()) { long timeout = SHUTDOWN_WAITING_TIME + System.currentTimeMillis(); managementClient.executeForResult(Operations.createOperation(SHUTDOWN, new ModelNode().setEmptyList())); while (System.currentTimeMillis() < timeout) { Thread.sleep(FREQUENCY); try { controller.getClient().isServerInRunningState(); } catch (RuntimeException ex) { break; } } Assert.assertFalse(System.currentTimeMillis() < timeout); Assert.assertFalse(controller.getClient().isServerInRunningState()); } Assert.assertFalse(controller.getClient().isServerInRunningState()); try { controller.stop(); } catch (RuntimeException ex) { } controller.start(); }
Source:
<code>public synchronized void start() throws Exception { LOG.info("Try to start Directory Polling Service..."); if (running) { <START> throw new IllegalStateException("Monitor is already running"); <END> } running = true; thread = new Thread(this); thread.start(); LOG.info("Successfully start of Directory Polling Service."); }</code><technical_language>I start thread, this case happen</technical_language>

Target:
public synchronized void start() throws Exception { LOG.info("Try to start Directory Polling Service..."); running = true; thread = new Thread(this); thread.start(); LOG.info("Successfully start of Directory Polling Service."); }
Source:
<code>private String getBambooBaseUrl() { <START> return getAdministrationConfiguration().getBaseUrl(); <END> }</code><technical_language>this returns non-null correct value</technical_language>

Target:
private String getBambooBaseUrl() { if (this.adminConfiguration != null) { return StringUtils.isNoneBlank(this.adminConfiguration.getBaseUrl()) ? this.adminConfiguration.getBaseUrl() : ""; } return ""; }
Source:
<code>public void loadApps() { this.view.showWait(); appsSource.fetchInstallableApplications( this.view::populate, e -> this.view.showFailure() ); this.view.setOnRetryButtonClicked(event -> { this.view.showWait(); appsSource.fetchInstallableApplications( this.view::populate, e -> this.view.showFailure() ); }); this.view.setOnSelectCategory(categoryDTO -> this.view.populateApps( <START> new ArrayList<ApplicationDTO>(categoryDTO.getApplications().values()))); <END> this.view.setOnSelectScript(scriptDTO -> scriptInterpreter.runScript( scriptDTO.getScript(), e -> Platform.runLater(() -> new ErrorMessage("The script ended unexpectedly", e)) )); onAppLoaded.run(); }</code><technical_language>Please diamond operator</technical_language>

Target:
public void loadApps() { this.view.showWait(); appsSource.fetchInstallableApplications( this.view::populate, e -> this.view.showFailure() ); this.view.setOnRetryButtonClicked(event -> { this.view.showWait(); appsSource.fetchInstallableApplications( this.view::populate, e -> this.view.showFailure() ); }); this.view.setOnSelectCategory(categoryDTO -> this.view.populateApps( new ArrayList<>(categoryDTO.getApplications().values()))); this.view.setOnSelectScript(scriptDTO -> scriptInterpreter.runScript( scriptDTO.getScript(), e -> Platform.runLater(() -> new ErrorMessage("The script ended unexpectedly", e)) )); onAppLoaded.run(); }
Source:
<code>public void waitForNodesToShutdown() { if (m_cluster != null) { for (Process proc : m_cluster) { if (proc == null) continue; int retval = 0; try { retval = proc.waitFor(); } catch (InterruptedException e) { log.error("Unable to wait for Localcluster process to die: " + proc.toString(), e); } if (retval != 0 && retval != 143) { log.error("External VoltDB process terminated abnormally with return: " + retval); } } } if (m_cluster != null) m_cluster.clear(); for (EEProcess proc : m_eeProcs) { File valgrindOutputFile = null; try { valgrindOutputFile = proc.waitForShutdown(); } catch (InterruptedException e) { log.error("Unable to wait for EEProcess to die: " + proc.toString(), e); } failIfValgrindErrors(valgrindOutputFile); } <START> if (templateCmdLine.target() == BackendTarget.NATIVE_EE_VALGRIND_IPC) { <END> if (!EEProcess.m_valgrindErrors.isEmpty()) { StringBuilder failString = new StringBuilder(); final Iterator<String> iter = EEProcess.m_valgrindErrors.iterator(); while (iter.hasNext()) { failString.append("\n" + iter.next()); } org.junit.Assert.fail(failString.toString()); } } m_eeProcs.clear(); m_running = false; }</code><technical_language>OK remove this part now. failIfValgrindErrors()</technical_language>

Target:
public void waitForNodesToShutdown() { if (m_cluster != null) { for (Process proc : m_cluster) { if (proc == null) continue; int retval = 0; try { retval = proc.waitFor(); } catch (InterruptedException e) { log.error("Unable to wait for Localcluster process to die: " + proc.toString(), e); } if (retval != 0 && retval != 143) { log.error("External VoltDB process terminated abnormally with return: " + retval); } } } if (m_cluster != null) m_cluster.clear(); for (EEProcess proc : m_eeProcs) { File valgrindOutputFile = null; try { valgrindOutputFile = proc.waitForShutdown(); } catch (InterruptedException e) { log.error("Unable to wait for EEProcess to die: " + proc.toString(), e); } failIfValgrindErrors(valgrindOutputFile); } m_eeProcs.clear(); m_running = false; }
Source:
<code>public String toString() { <START> final StringBuffer sb = new StringBuffer("BulkheadConfig{"); <END> sb.append("maxConcurrentCalls=").append(maxConcurrentCalls); sb.append(", maxWaitDuration=").append(maxWaitDuration); sb.append(", writableStackTraceEnabled=").append(writableStackTraceEnabled); sb.append(", fairCallHandlingEnabled=").append(fairCallHandlingEnabled); sb.append('}'); return sb.toString(); }</code><technical_language>Please StringBuilder instead</technical_language>

Target:
public String toString() { final StringBuilder sb = new StringBuilder("BulkheadConfig{"); sb.append("maxConcurrentCalls=").append(maxConcurrentCalls); sb.append(", maxWaitDuration=").append(maxWaitDuration); sb.append(", writableStackTraceEnabled=").append(writableStackTraceEnabled); sb.append(", fairCallHandlingEnabled=").append(fairCallHandlingEnabled); sb.append('}'); return sb.toString(); }
Source:
<code>public void onUpdate(String instanceId, JsonObject data) { ThingUID bridge = handler.getThing().getUID(); try { if (data.has(INSTANCE_ID)) { int id = data.get(INSTANCE_ID).getAsInt(); String type = data.get(TYPE).getAsString(); ThingUID thingId = null; if (type.equals(TYPE_LIGHT) && data.has(LIGHT)) { JsonObject state = data.get(LIGHT).getAsJsonArray().get(0).getAsJsonObject(); if (state.has(COLOR)) { thingId = new ThingUID(THING_TYPE_COLOR_TEMP_LIGHT, bridge, Integer.toString(id)); } else { thingId = new ThingUID(THING_TYPE_DIMMABLE_LIGHT, bridge, Integer.toString(id)); } } if (thingId == null) { return; } String label = "Unknown device"; try { label = data.get(NAME).getAsString(); } catch (JsonSyntaxException e) { <START> logger.error("JSON error: {}", e.getMessage()); <END> } Map<String, Object> properties = new HashMap<>(1); properties.put("id", id); logger.debug("Adding device to inbox", thingId); DiscoveryResult discoveryResult = DiscoveryResultBuilder.create(thingId).withBridge(bridge) .withLabel(label).withProperties(properties).withRepresentationProperty("id").build(); thingDiscovered(discoveryResult); } } catch (JsonSyntaxException e) { logger.error("JSON error: {}", e.getMessage()); } }</code><technical_language>this error</technical_language>

Target:
public void onUpdate(String instanceId, JsonObject data) { ThingUID bridge = handler.getThing().getUID(); try { if (data.has(INSTANCE_ID)) { int id = data.get(INSTANCE_ID).getAsInt(); String type = data.get(TYPE).getAsString(); JsonObject deviceInfo = data.get(DEVICE).getAsJsonObject(); String model = deviceInfo.get(DEVICE_MODEL).getAsString(); ThingUID thingId = null; if (type.equals(TYPE_LIGHT) && data.has(LIGHT)) { JsonObject state = data.get(LIGHT).getAsJsonArray().get(0).getAsJsonObject(); if (state.has(COLOR) || (model != null && Arrays.asList(COLOR_TEMP_MODELS).contains(model))) { thingId = new ThingUID(THING_TYPE_COLOR_TEMP_LIGHT, bridge, Integer.toString(id)); } else { thingId = new ThingUID(THING_TYPE_DIMMABLE_LIGHT, bridge, Integer.toString(id)); } } if (thingId == null) { return; } String label = data.get(NAME).getAsString(); Map<String, Object> properties = new HashMap<>(1); properties.put("id", id); if (deviceInfo.get(DEVICE_VENDOR) != null) { properties.put("vendor", deviceInfo.get(DEVICE_VENDOR)); } logger.debug("Adding device to inbox", thingId); DiscoveryResult discoveryResult = DiscoveryResultBuilder.create(thingId).withBridge(bridge) .withLabel(label).withProperties(properties).withRepresentationProperty("id").build(); thingDiscovered(discoveryResult); } } catch (JsonSyntaxException e) { logger.debug("JSON error during discovery: {}", e.getMessage()); } }
Source:
<code>public void testFormatStringForBubbleBricks() { String testFirstCharWhitespace = " abcdefabcdefabcdefabcdef abcdef abcdefabcdefabcdef"; <START> String[] expectedResult = {"abcdefabcdefabcd", "efabcdef abcdef", "abcdefabcdefabcd", "ef"}; <END> List<String> expectedResultList = Arrays.asList(expectedResult); List<String> resultList = Utils.formatStringForBubbleBricks(testFirstCharWhitespace); assertNotNull(resultList); assertEquals(expectedResultList, resultList); }</code><technical_language>if changed to: String testFirstCharWhitespace = " ThisIsAReallyLongishWord toTest TheWordWrapperFunc"; String[] expectedResult = {"ThisIsAReallyLon", "gishWord toTest", "TheWordWrapperFu", "nc"}; clear this function is supposed work glance</technical_language>

Target:
public void testFormatStringForBubbleBricks() { String testFirstCharWhitespace = " ThisIsAReallyLongishWord toTest TheWordWrapperFunc"; String[] expectedResult = {"ThisIsAReallyLon", "gishWord toTest", "TheWordWrapperFu", "nc"}; List<String> expectedResultList = Arrays.asList(expectedResult); List<String> resultList = ShowBubbleActor.formatStringForBubbleBricks(testFirstCharWhitespace); assertNotNull(resultList); assertEquals(expectedResultList, resultList); }
Source:
<code>public abstract void write(@Nonnull OutputVFS outputVDir) throws DexWritingException; protected void finishMerge(@Nonnull JackMerger merger, @Nonnull OutputVFile out) throws DexWritingException { OutputStream os = null; try { try { os = new BufferedOutputStream(out.getOutputStream()); merger.finish(os); } finally { if (os != null) { os.close(); } } } catch (WrongPermissionException e) { throw new DexWritingException(e); } catch <START> (IOException e) { <END> throw new DexWritingException(e); } }</code><technical_language>Multi catch</technical_language>

Target:
public abstract void write(@Nonnull OutputVFS outputVDir) throws DexWritingException; protected void finishMerge(@Nonnull JackMerger merger, @Nonnull OutputVFile out) throws DexWritingException { OutputStream os = null; try { try { os = new BufferedOutputStream(out.getOutputStream()); merger.finish(os); } finally { if (os != null) { os.close(); } } } catch (IOException | WrongPermissionException e) { throw new DexWritingException(e); } }
Source:
<code>public void testReadAll() throws Exception { ByteBuffer bb = ByteBuffer.allocate(1024); struct.encoder() .string("name", "joe") <START> .int64s("ids") <END> .value(4L) .value(5L) .value(6L) .end() .string("address", "my street") .strings("colors") .value("blue") .value("green") .end() .int64("age", 30) .encode(bb); bb.rewind(); StructDecoder decoder = struct.decoder(bb); assertThat(decoder.string("name"), is("joe")); ArrayDecoder<Long> adi = decoder.int64s("ids"); assertThat(adi.size(), is(3)); assertThat(adi.value(), is(4L)); assertThat(adi.value(), is(5L)); assertThat(adi.value(), is(6L)); adi.end(); assertThat(decoder.string("address"), is("my street")); ArrayDecoder<String> ads = decoder.strings("colors"); assertThat(ads.size(), is(2)); assertThat(ads.value(), is("blue")); assertThat(ads.value(), is("green")); ads.end(); assertThat(decoder.int64("age"), is(30L)); }</code><technical_language>I prefer" .int64s("ids", 1, 2, 3, 4), strings("colors", "red", "green", "blue") => shorter build read</technical_language>

Target:
public void testReadAll() throws Exception { ByteBuffer bb = ByteBuffer.allocate(1024); struct.encoder() .string("name", "joe") .int64s("ids") .value(4L) .value(5L) .value(6L) .end() .string("address", "my street") .strings("colors") .value("blue") .value("green") .end() .int64("age", 30) .encode(bb); bb.rewind(); StructDecoder decoder = struct.decoder(bb); assertThat(decoder.string("name"), is("joe")); ArrayDecoder<Long> adi = decoder.int64s("ids"); assertThat(adi.length(), is(3)); assertThat(adi.value(), is(4L)); assertThat(adi.value(), is(5L)); assertThat(adi.value(), is(6L)); adi.end(); assertThat(decoder.string("address"), is("my street")); ArrayDecoder<String> ads = decoder.strings("colors"); assertThat(ads.length(), is(2)); assertThat(ads.value(), is("blue")); assertThat(ads.value(), is("green")); ads.end(); assertThat(decoder.int64("age"), is(30L)); }
Source:
<code>private void verifyResult(final List<KeyValue<Integer, Integer>> expected) { final ConsumerRecordFactory<Integer, Integer> recordFactory = new ConsumerRecordFactory<>(new IntegerSerializer(), new IntegerSerializer()); final Properties props = StreamsTestUtils.getStreamsConfig(Serdes.Integer(), Serdes.Integer()); try (final TopologyTestDriver driver = new TopologyTestDriver(builder.build(), props)) { driver.pipeInput(recordFactory.create(topic, Arrays.asList(new KeyValue<>(1, 1), <START> new KeyValue<>(2, 2), <END> new KeyValue<>(3, 3), new KeyValue<>(2, 1), new KeyValue<>(2, 3), new KeyValue<>(1, 3)))); } assertThat(results, equalTo(expected)); }</code><technical_language>If change indention, move new KeyValue(1, 1) line</technical_language>

Target:
private void verifyResult(final List<KeyValue<Integer, Integer>> expected) { final Properties props = StreamsTestUtils.getStreamsConfig(Serdes.Integer(), Serdes.Integer()); try (final TopologyTestDriver driver = new TopologyTestDriver(builder.build(), props)) { final TestInputTopic<Integer, Integer> inputTopic = driver.createInputTopic(topic, new IntegerSerializer(), new IntegerSerializer()); inputTopic.pipeKeyValueList(Arrays.asList( new KeyValue<>(1, 1), new KeyValue<>(2, 2), new KeyValue<>(3, 3), new KeyValue<>(2, 1), new KeyValue<>(2, 3), new KeyValue<>(1, 3))); } assertThat(results, equalTo(expected)); }
Source:
<code>public Optional<Principal> provide() { final Principal principal = getContainerRequest().getSecurityContext().getUserPrincipal(); <START> if (principal == null) { <END> return Optional.empty(); } else { return Optional.of(principal); } }</code><technical_language>this simplified return Optional.ofNullable(principal);</technical_language>

Target:
public Optional<Principal> provide() { return Optional.ofNullable(getContainerRequest().getSecurityContext().getUserPrincipal()); }
Source:
<code>public Object execute(ExecutionEvent event) throws ExecutionException { final Shell shell = HandlerUtil.getActiveShellChecked(event); final SpecfileParser specparser = new SpecfileParser(); final IResource resource = RPMHandlerUtils.getResource(event); final RPMProject rpj = RPMHandlerUtils.getRPMProject(resource); final IFile workFile = (IFile) rpj.getSpecFile(); final Specfile specfile = specparser.parse(workFile); if (!DownloadFile(shell, rpj, specfile)) return null; Job job = new Job("Preparing sources") { @Override protected IStatus run(IProgressMonitor monitor) { monitor.beginTask( <START> "Preparing sources for " + rpj.getSpecFile().getName(), IProgressMonitor.UNKNOWN); END> int offset = rpj.getSpecFile().getName().toString() .lastIndexOf("."); MessageConsoleStream out = getConsole( rpj.getSpecFile().getName().toString() .substring(0, offset)).newMessageStream(); IStatus is = null; try { is = rpj.buildPrep(out); } catch (CoreException e) { SpecfileLog.logError(Messages.PrepareSources_coreException, e); RPMUtils.showErrorDialog(shell, Messages.PrepareSources_error, Messages.PrepareSources_coreException); return is; } finally { monitor.done(); } return is; } }; job.setUser(true); job.schedule(); return null; }</code><technical_language>String externalized</technical_language>

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { final Shell shell = HandlerUtil.getActiveShellChecked(event); final SpecfileParser specparser = new SpecfileParser(); final IResource resource = RPMHandlerUtils.getResource(event); final RPMProject rpj = RPMHandlerUtils.getRPMProject(resource); final IFile workFile = (IFile) rpj.getSpecFile(); final Specfile specfile = specparser.parse(workFile); if (!DownloadFile(shell, rpj, specfile)) return null; Job job = new Job("Preparing sources") { @Override protected IStatus run(IProgressMonitor monitor) { monitor.beginTask( NLS.bind(Messages.PrepareSources_prepareSources, rpj.getSpecFile().getName()), IProgressMonitor.UNKNOWN); int offset = rpj.getSpecFile().getName().toString() .lastIndexOf("."); MessageConsoleStream out = getConsole( rpj.getSpecFile().getName().toString() .substring(0, offset)).newMessageStream(); IStatus is = null; try { is = rpj.buildPrep(out); } catch (CoreException e) { SpecfileLog.logError(Messages.PrepareSources_coreException, e); RPMUtils.showErrorDialog(shell, Messages.PrepareSources_error, Messages.PrepareSources_coreException); return is; } finally { monitor.done(); } return is; } }; job.setUser(true); job.schedule(); return null; }
Source:
<code>public void handle(EventMessage<?> message, Segment segment) throws Exception { <START> logger.trace("Received event {}. Segment Id {}. Thread {}.", <END> message.getIdentifier(), segment.getSegmentId(), Thread.currentThread().getName()); if (sequencingPolicyMatchesSegment(message, segment)) { for (EventMessageHandler handler : wrappedEventHandlers) { try { handler.handle(message); } catch (Exception e) { listenerInvocationErrorHandler.onError(e, message, handler); } } } }</code><technical_language>Please add logger.isTraceEnabled() prevent invocation of getters log level is low</technical_language>

Target:
public void handle(EventMessage<?> message, Segment segment) throws Exception { if (logger.isTraceEnabled()) { logger.trace("Received event {}. Segment Id {}. Thread {}.", message.getIdentifier(), segment.getSegmentId(), Thread.currentThread().getName()); } if (sequencingPolicyMatchesSegment(message, segment)) { for (EventMessageHandler handler : wrappedEventHandlers) { try { handler.handle(message); } catch (Exception e) { listenerInvocationErrorHandler.onError(e, message, handler); } } } }
Source:
<code>private void checkPermissions() { for (String permission : REQUIRED_PERMISSIONS) { <START> if (mContext.checkCallingOrSelfPermission(permission) == PackageManager.PERMISSION_GRANTED) { <END> continue; } if (Build.VERSION.SDK_INT < 23) { throw new RuntimeException("We need " + permission + " permission for screenshot tests"); } Context targetContext = Registry.getRegistry().instrumentation.getTargetContext(); grantPermission(targetContext, permission); grantPermission(mContext, permission); } }</code><technical_language>READ_EXTERNAL_STORAGE added in API level 16, this check fail in < 16. check this ice cream sandwich</technical_language>

Target:
private void checkPermissions() { for (String permission : REQUIRED_PERMISSIONS) { if ((permission.equals(READ_PERMISSION) && Build.VERSION.SDK_INT < 16) || mContext.checkCallingOrSelfPermission(permission) == PackageManager.PERMISSION_GRANTED) { continue; } if (Build.VERSION.SDK_INT < 23) { throw new RuntimeException("We need " + permission + " permission for screenshot tests"); } Context targetContext = Registry.getRegistry().instrumentation.getTargetContext(); grantPermission(targetContext, permission); grantPermission(mContext, permission); } }
Source:
<code>public ListenableFuture<?> isBlocked() { switch (state) { case CONSUMING_INPUT: return NOT_BLOCKED; case SPILLING_INPUT: return spillInProgress; case LOOKUP_SOURCE_BUILT: return lookupSourceNotNeeded.orElseThrow(() -> new IllegalStateException("Lookup source built, but disposal future not set")); case INPUT_SPILLED: return spilledLookupSourceHandle.getUnspillingOrDisposeRequested(); case INPUT_UNSPILLING: <START> return unspillInProgress.orElseThrow(() -> new IllegalStateException("Unspilling in progress, but unspilling future not set")); <END> case INPUT_UNSPILLED_AND_BUILT: return spilledLookupSourceHandle.getDisposeRequested(); case DISPOSED: case CLOSED: return lookupSourceFactoryDestroyed; } throw new IllegalStateException("Unhandled state: " + state); }</code><technical_language>close return NOT_BLOCKED... in fact, I problem recalling i return lookupSourceFactoryDestroyed in DISPOSED state.. this describes is actual control components, necessary anyway</technical_language>

Target:
public ListenableFuture<?> isBlocked() { switch (state) { case CONSUMING_INPUT: return NOT_BLOCKED; case SPILLING_INPUT: return spillInProgress; case LOOKUP_SOURCE_BUILT: return lookupSourceNotNeeded.orElseThrow(() -> new IllegalStateException("Lookup source built, but disposal future not set")); case INPUT_SPILLED: return spilledLookupSourceHandle.getUnspillingOrDisposeRequested(); case INPUT_UNSPILLING: return unspillInProgress.orElseThrow(() -> new IllegalStateException("Unspilling in progress, but unspilling future not set")); case INPUT_UNSPILLED_AND_BUILT: return spilledLookupSourceHandle.getDisposeRequested(); case CLOSED: return NOT_BLOCKED; } throw new IllegalStateException("Unhandled state: " + state); }
Source:
<code>public boolean repair(Resource resource, EPackage profileDefinition, Collection<? extends EObject> stereotypeApplications, DiagnosticChain diagnostics, IProgressMonitor monitor) { boolean result = false; Iterator<Profile> profilesIterator = previousProfilesSet.iterator(); while (!result && profilesIterator.hasNext()) { <START> result = applySelectedProfile(resource, stereotypeApplications, diagnostics, monitor, profilesIterator.next()); <END> } if (!result) { appliedProfile = profileSupplier.get(); if (appliedProfile != null) { result = applySelectedProfile(resource, stereotypeApplications, diagnostics, monitor, appliedProfile); } } return result; }</code><technical_language>This reuses progress monitor repeatedly in a loop, potentially more loop. Consequently, monitor completed time loop progress reporting. This needs more sub-monitor nesting, a new child monitor time applySelectedProfile(...) is called</technical_language>

Target:
public boolean repair(Resource resource, EPackage profileDefinition, Collection<? extends EObject> stereotypeApplications, DiagnosticChain diagnostics, IProgressMonitor monitor) { boolean result = false; SubMonitor repairMonitor = SubMonitor.convert(monitor, 2); if (previousProfile != null) { result = applySelectedProfile(resource, stereotypeApplications, diagnostics, repairMonitor.newChild(1, SubMonitor.SUPPRESS_NONE), previousProfile); } if (!result) { appliedProfile = profileSupplier.get(); if (appliedProfile != null) { result = applySelectedProfile(resource, stereotypeApplications, diagnostics, repairMonitor.newChild(1, SubMonitor.SUPPRESS_NONE), appliedProfile); } } repairMonitor.done(); return result; }