auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testBadPaths() { try { test("C0004.rf", TableId.of("2a"), "t-0003", "C0004.rf"); fail("Failed to throw error on bad path"); } catch (NullPointerException e) <START> <END> try { test("dir", TableId.of("2a"), "", ""); fail("Failed to throw error on bad path"); } catch (NullPointerException e) }</code><technical_language>some additional bad paths nice check. hdfs://localhost:8020/accumulo/tablets/2a/default_tablet/F0000070.rf hdfs://localhost:8020/accumulo/2a/default_tablet/F0000070.rf /accumulo/tables/2a/default_tablet/F0000070.rf hdfs://localhost:8020/accumulo/tables/2a/F0000070.rf hdfs://localhost:8020/accumulo/tables/F0000070.rf</technical_language>

Target:
public void testBadPaths() { try { test("C0004.rf", "", "2a", "t-0003", "C0004.rf"); fail("Failed to throw error on bad path"); } catch (NullPointerException e) try { test("dir", "", "2a", "", ""); fail("Failed to throw error on bad path"); } catch (NullPointerException e) try { test("hdfs://localhost:8020/accumulo/tablets/2a/default_tablet/F0000070.rf", "hdfs://localhost:8020/accumulo", "2a", "default_tablet", "F0000070.rf"); fail("Failed to throw error on bad path"); } catch (IllegalArgumentException e) try { test("hdfs://localhost:8020/accumulo/2a/default_tablet/F0000070.rf", " hdfs://localhost:8020/accumulo", "2a", "default_tablet", " F0000070.rf"); fail("Failed to throw error on bad path"); } catch (IllegalArgumentException e) try { test("/accumulo/tables/2a/default_tablet/F0000070.rf", "", "2a", "default_tablet", "F0000070.rf"); fail("Failed to throw error on bad path"); } catch (IllegalArgumentException e) try { test("hdfs://localhost:8020/accumulo/tables/2a/F0000070.rf", "hdfs://localhost:8020/accumulo", "2a", "", "F0000070.rf"); fail("Failed to throw error on bad path"); } catch (IllegalArgumentException e) try { test("hdfs://localhost:8020/accumulo/tables/F0000070.rf", "hdfs://localhost:8020/accumulo", null, "", "F0000070.rf"); fail("Failed to throw error on bad path"); } catch (IllegalArgumentException e) }
Source:
<code>public void removeOffScreenBullets() { <START> Iterator iteralien = ConcreteAggregate.createIterator(alienBullets); <END> while (iteralien.hasNext()) { Bullet bullet = (Bullet) iteralien.next(); if (bullet.reachedY(450)) { Game.logfile.writeOffscreen("Alien", bullet.getX()); alienBullets.removeElementAt(iteralien.position()); } } Iterator itership = ConcreteAggregate.createIterator(shipBullets); while (itership.hasNext()) { Bullet bullet = (Bullet) itership.next(); if (bullet.reachedY(450)) { Game.logfile.writeOffscreen("Spaceship", bullet.getX()); alienBullets.removeElementAt(itership.position()); } } }</code><technical_language>iteralien -> iterAlienBullets</technical_language>

Target:
public void removeOffScreenBullets() { Iterator iterAlienBullets = ConcreteAggregate .createIterator(alienBullets); while (iterAlienBullets.hasNext()) { Bullet bullet = (Bullet) iterAlienBullets.next(); if (bullet.reachedY(450)) { Game.logfile.writeOffscreen("Alien", bullet.getX()); alienBullets.removeElementAt(iterAlienBullets.position()); } } Iterator iterShipBullets = ConcreteAggregate .createIterator(shipBullets); while (iterShipBullets.hasNext()) { Bullet bullet = (Bullet) iterShipBullets.next(); if (bullet.reachedY(450)) { Game.logfile.writeOffscreen("Spaceship", bullet.getX()); alienBullets.removeElementAt(iterShipBullets.position()); } } }
Source:
<code>public void testGetUniqueId() { final String id1 = SalesforceKeyGenerator.getUniqueId(KEY_1); final String id1Again = SalesforceKeyGenerator.getUniqueId(KEY_1); final String id2 = SalesforceKeyGenerator.getUniqueId(KEY_2); <START> Assert.assertEquals(id1.length(), 58); <END> Assert.assertEquals("Unique IDs with the same name should be the same", id1, id1Again); Assert.assertNotSame("Unique IDs with different names should be different", id1, id2); final String id3 = SalesforceKeyGenerator.getUniqueId(KEY_3, 128); final String id3Again = SalesforceKeyGenerator.getUniqueId(KEY_3, 128); Assert.assertEquals(id3.length(), 38); Assert.assertEquals("Unique IDs with the same name should be the same", id3, id3Again); }</code><technical_language>Add a message if fails</technical_language>

Target:
public void testGetUniqueId() { final String id1 = SalesforceKeyGenerator.getUniqueId(KEY_1); final String id1Again = SalesforceKeyGenerator.getUniqueId(KEY_1); final String id2 = SalesforceKeyGenerator.getUniqueId(KEY_2); Assert.assertEquals("The encoded string based on an AES-256 key should have 58 characters", id1.length(), 58); Assert.assertEquals("Unique IDs with the same name should be the same", id1, id1Again); Assert.assertNotSame("Unique IDs with different names should be different", id1, id2); final String id3 = SalesforceKeyGenerator.getUniqueId(KEY_3, 128); final String id3Again = SalesforceKeyGenerator.getUniqueId(KEY_3, 128); Assert.assertEquals("The encoded string based on an AES-128 key should have 38 characters", id3.length(), 38); Assert.assertEquals("Unique IDs with the same name should be the same", id3, id3Again); }
Source:
<code>public int getTotalAvailableCapacity() { return laneRegistry.getConfiguration(TOTAL) .map(config -> laneRegistry.bulkhead(TOTAL, config).getMetrics().getAvailableConcurrentCalls()) <START> .orElse(-1); <END> }</code><technical_language>Consider adding a named constant for -1 (similar for getLaneAvailableCapacity)</technical_language>

Target:
int getTotalAvailableCapacity() { return laneRegistry.getConfiguration(TOTAL) .map(config -> laneRegistry.bulkhead(TOTAL, config).getMetrics().getAvailableConcurrentCalls()) .orElse(NO_CAPACITY); }
Source:
<code>static <T> void executeBlocking(ContextInternal context, Handler<Promise<T>> blockingCodeHandler, Handler<AsyncResult<T>> resultHandler, WorkerPool workerPool, TaskQueue queue) { PoolMetrics metrics = workerPool.metrics(); Object queueMetric = metrics != null ? metrics.submitted() : null; try { Runnable command = () -> { Object execMetric = null; if (metrics != null) { execMetric = metrics.begin(queueMetric); } Promise<T> res = Promise.promise(); Future<T> fut = res.future(); context.dispatch(res, f -> { try { blockingCodeHandler.handle(res); } catch (Throwable e) { res.tryFail(e); } }); if (metrics != null) { metrics.end(execMetric, fut.succeeded()); } <START> fut.setHandler(ar -> { <END> if (resultHandler != null) { context.runOnContext(v -> resultHandler.handle(ar)); } else if (ar.failed()) { Throwable cause = ar.cause(); Handler<Throwable> ctxExceptionHandler = context.exceptionHandler(); if (ctxExceptionHandler != null) { context.runOnContext(v -> ctxExceptionHandler.handle(cause)); } else { Handler<Throwable> exceptionHandler = context.owner().exceptionHandler(); if (exceptionHandler != null) { exceptionHandler.handle(cause); } else if (cause instanceof Error) { log.error("Unhandled error", cause); } else if (log.isDebugEnabled()) { log.debug("Unhandled throwable", cause); } } } }); }; Executor exec = workerPool.executor(); if (queue != null) { queue.execute(command, exec); } else { exec.execute(command); } } catch (RejectedExecutionException e) { if (metrics != null) { metrics.rejected(queueMetric); } throw e; } }</code><technical_language>resultHandler is null, instead provide a default task log error context, like: java if (resultHandler == null) { resultHandler = ar -> { if (ar.failed) { context.reportException(ar.cause()); } } }</technical_language>

Target:
static <T> void executeBlocking(ContextInternal context, Handler<Promise<T>> blockingCodeHandler, Handler<AsyncResult<T>> resultHandler, WorkerPool workerPool, TaskQueue queue) { PoolMetrics metrics = workerPool.metrics(); Object queueMetric = metrics != null ? metrics.submitted() : null; try { Runnable command = () -> { Object execMetric = null; if (metrics != null) { execMetric = metrics.begin(queueMetric); } Promise<T> res = Promise.promise(); Future<T> fut = res.future(); context.dispatch(res, f -> { try { blockingCodeHandler.handle(res); } catch (Throwable e) { res.tryFail(e); } }); if (metrics != null) { metrics.end(execMetric, fut.succeeded()); } fut.setHandler(ar -> { if (resultHandler != null) { context.runOnContext(v -> resultHandler.handle(ar)); } else if (ar.failed()) { context.reportException(ar.cause()); } }); }; Executor exec = workerPool.executor(); if (queue != null) { queue.execute(command, exec); } else { exec.execute(command); } } catch (RejectedExecutionException e) { if (metrics != null) { metrics.rejected(queueMetric); } throw e; } }
Source:
<code>private Iterable<NitroItemSource<Episode>> toItemSources(Iterable<Episode> episodes) throws GlycerinException, NitroException { return new PaginatedNitroItemSources( episodes, <START> NITRO_BATCH_SIZE, <END> pageSize, executor, glycerin ); }</code><technical_language>This unused member it, is this left here</technical_language>

Target:
private Iterable<NitroItemSource<Episode>> toItemSources(Iterable<Episode> episodes) throws GlycerinException, NitroException { return new PaginatedNitroItemSources( episodes, pageSize, executor, glycerin ); }
Source:
<code>public void cancelPushState(String siteName) throws Throwable { if (!siteCollector.containsKey(siteName)) { if (log.isTraceEnabled()) { <START> log.tracef("Tried to cancel push state to '%s' but it does not exists.", siteName); <END> } return; } final XSiteBackup xSiteBackup = findSite(siteName); if (xSiteBackup == null) { throw new IllegalArgumentException("Site " + siteName + " not found!"); } controlStateTransferOnLocalSite(CANCEL_SEND, siteName); controlStateTransferOnRemoteSite(xSiteBackup, FINISH_RECEIVE, null); siteCollector.remove(siteName); status.put(siteName, STATUS_CANCELED); }</code><technical_language>Grammar: exists -> exist</technical_language>

Target:
public void cancelPushState(String siteName) throws Throwable { if (!siteCollector.containsKey(siteName)) { if (log.isTraceEnabled()) { log.tracef("Tried to cancel push state to '%s' but it does not exist.", siteName); } return; } final XSiteBackup xSiteBackup = findSite(siteName); if (xSiteBackup == null) { throw new IllegalArgumentException("Site " + siteName + " not found!"); } controlStateTransferOnLocalSite(CANCEL_SEND, siteName); controlStateTransferOnRemoteSite(xSiteBackup, FINISH_RECEIVE, null); siteCollector.remove(siteName); status.put(siteName, STATUS_CANCELED); }
Source:
<code>private boolean registryExists(HttpClient client) throws Exception{ ContentResponse response = client.newRequest(DEFAULT_DOCKER_REGISTRY).send(); <START> return (response.getStatus() == STATUS_UNAUTHORIZED || response.getStatus() == STATUS_OK); <END> }</code><technical_language>response null? ex. if completely listening answering</technical_language>

Target:
private boolean registryExists(HttpClient client) throws Exception{ ContentResponse response = client.newRequest(DEFAULT_DOCKER_REGISTRY).send(); if(response == null) return false; return (response.getStatus() == STATUS_UNAUTHORIZED || response.getStatus() == STATUS_OK); }
Source:
<code>public void init(){ log.info("Getting all patient records ..."); updatePatientList(); <START> log.info("Finish intialization ..."); <END> }</code><technical_language>Assuming this is noting completion of initialization, "Finished initialization."</technical_language>

Target:
public void init(){ log.info("Getting all patient records ..."); updatePatientList(); log.info("Finished initialization ..."); }
Source:
<code>public FoodToken(String setCode, int tokenType) { super("Food", "Food token"); availableImageSetCodes = tokenImageSets; setOriginalExpansionSetCode(setCode); cardType.add(CardType.ARTIFACT); subtype.add(SubType.FOOD); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainLifeEffect(3), new GenericManaCost(2)); <START> SacrificeSourceCost cost = new SacrificeSourceCost(); <END> cost.setText("Sacrifice this artifact"); ability.addCost(cost); this.addAbility(ability); }</code><technical_language>Needs a {T} cost</technical_language>

Target:
public FoodToken(String setCode, int tokenType) { super("Food", "Food token"); availableImageSetCodes = tokenImageSets; setOriginalExpansionSetCode(setCode); cardType.add(CardType.ARTIFACT); subtype.add(SubType.FOOD); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainLifeEffect(3), new GenericManaCost(2)); ability.addCost(new TapSourceCost()); SacrificeSourceCost cost = new SacrificeSourceCost(); cost.setText("Sacrifice this artifact"); ability.addCost(cost); this.addAbility(ability); }
Source:
<code>public static Collection<Object[]> homoglyphCases() { return Arrays.asList(new Object[][]{ {"cаt", new String[]{"cаt", "cat"}}, {"LOL", new String[]{"LOL"}}, {"ЛОЛ", new String[]{"ЛОЛ"}}, {"KOЯN", new String[]{"KOЯN"}}, {"Лa", new String[]{"Лa", "Ла"}}, {"aа", new String[]{"aа", "аа", "aa"}}, {"33", new String[]{"33"}}, {"3aа3", new String[]{"3aа3", "3аа3", "3aa3"}}, {"Мoscow", new String[]{"Мoscow", "Moscow"}}, <START> {"Аk", new String[]{"Аk", "Ак", "Ak"}}, END> }); }</code><technical_language>a test involves multiple tokens (an input a space) properly test position increments</technical_language>

Target:
public static Collection<Object[]> homoglyphCases() { return Arrays.asList(new Object[][]{ {"cаt", new String[]{"cаt", "cat"}}, {"LOL", new String[]{"LOL"}}, {"ЛОЛ", new String[]{"ЛОЛ"}}, {"KOЯN", new String[]{"KOЯN"}}, {"Лa", new String[]{"Лa", "Ла"}}, {"aа", new String[]{"aа", "аа", "aa"}}, {"33", new String[]{"33"}}, {"3aа3", new String[]{"3aа3", "3аа3", "3aa3"}}, {"Мoscow", new String[]{"Мoscow", "Moscow"}}, {"Аk", new String[]{"Аk", "Ак", "Ak"}}, {"іs", new String[]{"іs", "іѕ", "is"}} }); }
Source:
<code>public boolean canMove(MapLocation loc, RobotType type) { <START> return false; <END> }</code><technical_language>java return true; a slightly option for testing here</technical_language>

Target:
public boolean canMove(MapLocation loc, RobotType type) { return (gameMap.onTheMap(loc) && (!rubbleMap.containsKey(loc) || rubbleMap.get(loc) < GameConstants.RUBBLE_OBSTRUCTION_THRESH || type == RobotType.SCOUT) && gameObjectsByLoc.get(loc) == null); }
Source:
<code><START> protected boolean pingConnection(final Connection conn) { <END> Statement s = null; try { s = conn.createStatement(); s.executeQuery("SELECT 1 FROM sysibm.sysdummy1"); return true; } catch (final SQLException e) { logger.debug("Connection is down.", e); return false; } finally { try { if (s != null) { s.close(); } } catch (final Exception e) { logger.trace("Error closing statement.", e); } } }</code><technical_language>do this method here? this PostgreSqlEngine</technical_language>

Target:
private boolean pingConnection(final Connection conn) { Statement s = null; try { s = conn.createStatement(); s.executeQuery("SELECT 1 FROM sysibm.sysdummy1"); return true; } catch (final SQLException e) { logger.debug("Connection is down.", e); return false; } finally { try { if (s != null) { s.close(); } } catch (final Exception e) { logger.trace("Error closing statement.", e); } } }
Source:
<code>private void initializeHistograms() { TmfTimeRange fullRange = updateTraceTimeRange(); <START> <END> fTimeRangeHistogram.clear(); fTimeRangeHistogram.setFullRange(fTraceStartTime, fTraceEndTime); fTimeRangeHistogram.setTimeRange(fTraceStartTime, INITIAL_WINDOW_SPAN); fTimeRangeHistogram.setCurrentEvent(fTraceStartTime); fFullTraceHistogram.clear(); fFullTraceHistogram.setFullRange(fTraceStartTime, fTraceEndTime); fFullTraceHistogram.setTimeRange(fTraceStartTime, INITIAL_WINDOW_SPAN); fFullTraceHistogram.setCurrentEvent(fTraceStartTime); fWindowStartTime = fTraceStartTime; fWindowSpan = INITIAL_WINDOW_SPAN; fWindowEndTime = fWindowStartTime + fWindowSpan; fCurrentEventTimeControl.setValue(fTraceStartTime); fTimeSpanControl.setValue(fWindowSpan); if (!fullRange.equals(TmfTimeRange.NULL_RANGE)) { sendTimeRangeRequest(fTraceStartTime, fTraceStartTime + fWindowSpan); sendFullRangeRequest(fullRange); } }</code><technical_language>a concurrency problem exists. initializeHistogram() is called for traceSelected signal. a request for big histogram (the small) histogram is ongoing, clear in of models problems models updated request(s). requests cancelled clearing models</technical_language>

Target:
private void initializeHistograms() { TmfTimeRange fullRange = updateTraceTimeRange(); if ((fTimeRangeRequest != null) && !fTimeRangeRequest.isCompleted()) { fTimeRangeRequest.cancel(); } fTimeRangeHistogram.clear(); fTimeRangeHistogram.setFullRange(fTraceStartTime, fTraceEndTime); fTimeRangeHistogram.setTimeRange(fTraceStartTime, INITIAL_WINDOW_SPAN); fTimeRangeHistogram.setCurrentEvent(fTraceStartTime); if ((fFullTraceRequest != null) && !fFullTraceRequest.isCompleted()) { fFullTraceRequest.cancel(); } fFullTraceHistogram.clear(); fFullTraceHistogram.setFullRange(fTraceStartTime, fTraceEndTime); fFullTraceHistogram.setTimeRange(fTraceStartTime, INITIAL_WINDOW_SPAN); fFullTraceHistogram.setCurrentEvent(fTraceStartTime); fWindowStartTime = fTraceStartTime; fWindowSpan = INITIAL_WINDOW_SPAN; fWindowEndTime = fWindowStartTime + fWindowSpan; fCurrentEventTimeControl.setValue(fTraceStartTime); fTimeSpanControl.setValue(fWindowSpan); if (!fullRange.equals(TmfTimeRange.NULL_RANGE)) { sendTimeRangeRequest(fTraceStartTime, fTraceStartTime + fWindowSpan); sendFullRangeRequest(fullRange); } }
Source:
<code>public void testInterruptFailingTries() throws Exception { Future<Client> result = executorService.submit(() -> { RetryCallback<Client, RuntimeException> fail = c -> { <START> throw new IndexInternalException(""); <END> }; return retryTemplate.execute(fail); }); result.cancel(true); try { result.get(100, TimeUnit.MILLISECONDS); fail("Should throw cancellation exception!"); } catch (CancellationException ignore) { } assertTrue(result.isDone()); assertTrue(result.isCancelled()); }</code><technical_language>assign</technical_language>

Target:
public void testInterruptFailingTries() throws Exception { Future<Client> result = executorService.submit(() -> { RetryCallback<Client, RuntimeException> fail = c -> { throw new IndexInternalException("Fail for test."); }; return retryTemplate.execute(fail); }); result.cancel(true); try { result.get(100, TimeUnit.MILLISECONDS); fail("Should throw cancellation exception!"); } catch (CancellationException ignore) { } assertTrue(result.isDone()); assertTrue(result.isCancelled()); }
Source:
<code>static String toNwbibNamespace(String id) { <START> return id END> .replace("<LINK_0>", "<LINK_1>") .replace("<LINK_5>", "<LINK_3>") .replace("<LINK_2>", "<LINK_4>"); }</code><technical_language>Hm, do left somwhere a "<LINK_6>" namespace? I thought obsolete now</technical_language>

Target:
static String toNwbibNamespace(String id) { return id .replace("<LINK_0>", NWBIB_SPATIAL + "N") .replace("<LINK_5>", NWBIB_SUBJECTS + "N") .replace("<LINK_2>", NWBIB_SPATIAL + "Q"); }
Source:
<code>public <R, X extends Exception> R inTransaction(Handle handle, HandleCallback<R, X> callback) throws X { if (isInTransaction(handle)) { throw new IllegalStateException("Already in transaction"); } didTxnRollback.set(false); final R returnValue; try { handle.begin(); returnValue = callback.withHandle(handle); if (!didTxnRollback.get()) { handle.commit(); } <START> } catch (Exception | Error e) { <END> try { handle.rollback(); } catch (Exception rollback) { e.addSuppressed(rollback); } throw e; } didTxnRollback.remove(); return returnValue; }</code><technical_language>@stevenschlansker, I this Throwable (_the father of errors_). Error case is specific I assume provided in #1405 example demonstrate problem, in a wild is a bunch of Throwable monsters (especially in Scala) Exception Error extends Throwable easily flip stack trace upside down. Therefore, if other reasons limit a range of throwables caught here, I this changed to: java } catch (Throwable t) { Error Exception instances of Throwable, Error is **not** instance of X extends Exception. I guess this works IDE compiler pick up, generics erased in compile time X extends Exception disappears, maybe, hypothetically, Error is a magical monster cast other exception (but aware of magical Error properties)</technical_language>

Target:
public <R, X extends Exception> R inTransaction(Handle handle, HandleCallback<R, X> callback) throws X { if (isInTransaction(handle)) { throw new IllegalStateException("Already in transaction"); } didTxnRollback.set(false); final R returnValue; try { handle.begin(); returnValue = callback.withHandle(handle); if (!didTxnRollback.get()) { handle.commit(); } } catch (Throwable e) { try { handle.rollback(); } catch (Exception rollback) { e.addSuppressed(rollback); } throw e; } didTxnRollback.remove(); return returnValue; }
Source:
<code>public DDF updateInplace(DDF newddf) throws DDFException { DDF curDDF = this.getDDF(); <START> if(curDDF.isCache()) { <END> newddf.cache(); } curDDF.getRepresentationHandler().reset(); curDDF.getRepresentationHandler().setRepresentations(newddf.getRepresentationHandler().getAllRepresentations()); newddf.getMetaDataHandler().copyFactor(this.getDDF()); curDDF.getSchemaHandler().setSchema(newddf.getSchema()); return curDDF; }</code><technical_language>cache new DDF, do need uncache DDF claim some memory</technical_language>

Target:
public DDF updateInplace(DDF newddf) throws DDFException { DDF curDDF = this.getDDF(); if(curDDF.getRepresentationHandler().isCached()) { newddf.getRepresentationHandler().cache(false); } curDDF.getRepresentationHandler().reset(); curDDF.getRepresentationHandler().setRepresentations(newddf.getRepresentationHandler().getAllRepresentations()); newddf.getMetaDataHandler().copyFactor(this.getDDF()); curDDF.getSchemaHandler().setSchema(newddf.getSchema()); return curDDF; }
Source:
<code>public String getHref() { <START> <END> return "/products/" + this.getUuid(); }</code><technical_language>IMO getHref() point this exact product -- uuid do -- based context of current Owner. Permissions GET /product/:uuid modified check Principal's Owner product's owners in order view ProductResource</technical_language>

Target:
public String getHref() { Owner owner = ResteasyProviderFactory.getContextData(Owner.class); return this.getHref(owner); }
Source:
<code>public PaymentWorksBatchReportVendorItem createBatchReportVendorItem(PaymentWorksVendor pmwVendorWithErrors, String errorMessage) { List<String> errorMessages = new ArrayList<String>(); errorMessages.add(errorMessage); <START> return new PaymentWorksBatchReportVendorItem(pmwVendorWithErrors.getPmwVendorRequestId(), <END> pmwVendorWithErrors.getProcessTimestamp(), pmwVendorWithErrors.getVendorType(), pmwVendorWithErrors.getRequestingCompanyLegalName(), pmwVendorWithErrors.getRequestingCompanyLegalFirstName(), pmwVendorWithErrors.getRequestingCompanyLegalLastName(), pmwVendorWithErrors.getRequestingCompanyTinType(), pmwVendorWithErrors.getRequestingCompanyCorporateEmail(), pmwVendorWithErrors.getInitiatorNetId(), errorMessages); }</code><technical_language>Another method simplified call two-arg method takes a list arg, constructor need called here</technical_language>

Target:
public PaymentWorksBatchReportVendorItem createBatchReportVendorItem(PaymentWorksVendor pmwVendorWithErrors, String errorMessage) { List<String> errorMessages = new ArrayList<String>(); errorMessages.add(errorMessage); return createBatchReportVendorItem(pmwVendorWithErrors, errorMessages); }
Source:
<code>public void verifyLightboxClosed() { waitForElementNotVisibleByElement(lightBoxModal); <START> PageObjectLogging.log("verifyShareScreenClosed", "share screen is closed", true); <END> }</code><technical_language>description for logging is verifyShareScreenClosed. description is "Lightbox is closed"</technical_language>

Target:
public void verifyLightboxClosed() { waitForElementNotVisibleByElement(lightBoxModal); PageObjectLogging.log("verifyShareScreenClosed", "share lightbox is closed", true); }
Source:
<code>private void updateListClosedParts(VirtualFile file) { if (closedParts.isEmpty()) { return; } for (PartPresenter closedEditorPart : closedParts) { Path path = ((EditorPartPresenter)closedEditorPart).getEditorInput().getFile().getLocation(); if (path.equals(file.getLocation())) { <START> closedParts.remove(closedEditorPart); <END> } } }</code><technical_language>break loop removing looked for</technical_language>

Target:
private void updateListClosedParts(VirtualFile file) { if (closedParts.isEmpty()) { return; } for (EditorPartPresenter closedEditorPart : closedParts) { Path path = closedEditorPart.getEditorInput().getFile().getLocation(); if (path.equals(file.getLocation())) { closedParts.remove(closedEditorPart); return; } } }
Source:
<code>private void preservePasswordForAuthentication(Object password) { <START> if ((isRemote() ==false || isSSL()) && prop.containsKey("AUTHREALM") && password!=null) { <END> prop.put("_PASSWORD",password); } }</code><technical_language>!isRemote(). other places strange comparisons false</technical_language>

Target:
private void preservePasswordForAuthentication(Object password) { if ((!isRemote() || isSSL()) && prop.containsKey("AUTHREALM") && password!=null) { prop.put("AUTHZPWD",password); } }
Source:
<code>public String getStringData() { try { final String data = IOUtils.toString( this.stream, Charset.forName("UTF-8") ); <START> this.stream.close(); <END> return data; } catch (final IOException exception) { throw new IllegalArgumentException( "Unable to read input", exception ); } }</code><technical_language>@amihaiemil I doubts closing stream right here. Usually, client's responsibility close stream if stream provided him</technical_language>

Target:
public String getStringData() { final InputStream stream = getClass() .getResourceAsStream(this.systemid); if (stream == null) { throw new IllegalArgumentException( String.format( "Systemid %s resource does not exist or can't be opened.", this.systemid ) ); } try { final String data = IOUtils.toString( stream, Charset.forName("UTF-8") ); return data; } catch (final IOException exception) { throw new IllegalArgumentException( String.format( "Unable to read input stream of systemid %s", this.systemid ), exception ); } finally { IOUtils.closeQuietly(stream); } }
Source:
<code>private static void copyAssetFileIfNeeded(final RealmConfiguration configuration) { final File realmFileFromAsset = configuration.hasAssetFile() ? new File(configuration.getRealmDirectory(), configuration.getRealmFileName()) : null; final String syncServerCertificateAssetName = ObjectServerFacade.getFacade( configuration.isSyncConfiguration()).getSyncServerCertificateAssetName(configuration); if (realmFileFromAsset!= null || !Util.isEmptyString(syncServerCertificateAssetName)) { OsObjectStore.callWithLock(configuration, new Runnable() { @Override public void run() { if (realmFileFromAsset != null) { copyFileIfNeeded(configuration.getAssetFilePath(), realmFileFromAsset); } <START> if (!Util.isEmptyString(syncServerCertificateAssetName)) { <END> String syncServerCertificateFilePath = ObjectServerFacade.getFacade( configuration.isSyncConfiguration()).getSyncServerCertificateFilePath(configuration); File certificateFile = new File(syncServerCertificateFilePath); copyFileIfNeeded(syncServerCertificateAssetName, certificateFile); } } }); } }</code><technical_language>a final boolean in <LINK_0> redundant check</technical_language>

Target:
private static void copyAssetFileIfNeeded(final RealmConfiguration configuration) { final File realmFileFromAsset = configuration.hasAssetFile() ? new File(configuration.getRealmDirectory(), configuration.getRealmFileName()) : null; final String syncServerCertificateAssetName = ObjectServerFacade.getFacade( configuration.isSyncConfiguration()).getSyncServerCertificateAssetName(configuration); final boolean certFileExists = !Util.isEmptyString(syncServerCertificateAssetName); if (realmFileFromAsset!= null || certFileExists) { OsObjectStore.callWithLock(configuration, new Runnable() { @Override public void run() { if (realmFileFromAsset != null) { copyFileIfNeeded(configuration.getAssetFilePath(), realmFileFromAsset); } if (certFileExists) { String syncServerCertificateFilePath = ObjectServerFacade.getFacade( configuration.isSyncConfiguration()).getSyncServerCertificateFilePath(configuration); File certificateFile = new File(syncServerCertificateFilePath); copyFileIfNeeded(syncServerCertificateAssetName, certificateFile); } } }); } }
Source:
<code>public Text getTableId() { <START> return new Text(ke.getTableId().getUtf8Bytes()); <END> }</code><technical_language>rely string constructor for Text here. UTF8 bytes internally</technical_language>

Target:
public Text getTableId() { return new Text(ke.getTableId().getUtf8()); }
Source:
<code>private int writeLocationSection(final int currentRowNum, final HSSFWorkbook xlsBook, final HSSFSheet xlsSheet, final List<LocationDto> locations) { final CellStyle backgroundStyle = xlsBook.createCellStyle(); final HSSFFont blackFont = xlsBook.createFont(); blackFont.setFontName("calibri"); blackFont.setColor(HSSFColor.HSSFColorPredefined.BLACK.getIndex()); blackFont.setFontHeightInPoints((short) 11); backgroundStyle.setFont(blackFont); int rowNumIndex = currentRowNum; int count = locations.size(); <START> for (LocationDto locationDto : locations) { <END> final HSSFRow row = xlsSheet.createRow(rowNumIndex++); row.setHeightInPoints(16); this.writeCell(LotExcelTemplateGenerator.CODES_SHEET_FIRST_COLUMN_INDEX, locationDto.getAbbreviation(), count, xlsBook,row); this.writeCell(LotExcelTemplateGenerator.CODES_SHEET_SECOND_COLUMN_INDEX, locationDto.getName(), count, xlsBook,row); count--; } return rowNumIndex; }</code><technical_language>add final</technical_language>

Target:
private int writeLocationSection(final int currentRowNum, final HSSFWorkbook xlsBook, final HSSFSheet xlsSheet, final List<LocationDto> locations) { final CellStyle backgroundStyle = xlsBook.createCellStyle(); final HSSFFont blackFont = xlsBook.createFont(); blackFont.setFontName("calibri"); blackFont.setColor(HSSFColor.HSSFColorPredefined.BLACK.getIndex()); blackFont.setFontHeightInPoints((short) 11); backgroundStyle.setFont(blackFont); int rowNumIndex = currentRowNum; int count = locations.size(); for (final LocationDto locationDto : locations) { final HSSFRow row = xlsSheet.createRow(rowNumIndex++); row.setHeightInPoints(16); this.writeCell(LotExcelTemplateGenerator.CODES_SHEET_FIRST_COLUMN_INDEX, locationDto.getAbbreviation(), count, xlsBook,row); this.writeCell(LotExcelTemplateGenerator.CODES_SHEET_SECOND_COLUMN_INDEX, locationDto.getName(), count, xlsBook,row); count--; } return rowNumIndex; }
Source:
<code>private static boolean isValidBackupDir(Path backupDir) { String backupDirName = backupDir.toFile().getName(); try { DateUtil.getDate(backupDirName); return true; } catch (Exception e) { <START> return false; <END> } }</code><technical_language>want add debug if want debug whey backup name is validated (could special characters etc.,)</technical_language>

Target:
private static boolean isValidBackupDir(Path backupDir) { String backupDirName = backupDir.toFile().getName(); return (DateUtil.getDate(backupDirName) != null); }
Source:
<code>public void testFormatDateFromInteger() { Formatter formatter = new Formatter(); for (int i = 17897; i < 18262; i++) { Assert.assertEquals( LocalDate.ofEpochDay(i).format(DateTimeFormatter.ISO_LOCAL_DATE), formatter.formatDate(i)); <START> } <END> Assert.assertEquals("2017-09-30", formatter.formatDate(17439)); Assert.assertEquals("2017-10-01", formatter.formatDate(17440)); Assert.assertEquals("1988-05-07", formatter.formatDate(6701)); Assert.assertEquals("1988-05-08", formatter.formatDate(6702)); }</code><technical_language>This assert in for loop body is useless. checks formatter.formatDate(i) works LocalDate.ofEpochDay(i).format(DateTimeFormatter.ISO_LOCAL_DATE), does, code is formatter.formatDate(i) I suggest remove this for loop leave asserts</technical_language>

Target:
public void testFormatDateFromInteger() { Formatter formatter = new Formatter(); Assert.assertEquals("2017-09-30", formatter.formatDate(17439)); Assert.assertEquals("2017-10-01", formatter.formatDate(17440)); Assert.assertEquals("1988-05-07", formatter.formatDate(6701)); Assert.assertEquals("1988-05-08", formatter.formatDate(6702)); }
Source:
<code><START> public Table<Locator, Long, BluefloodEnumRollup> getEnumRollupsForLocators(final List<Locator> locators, String columnFamily, Range range) { <END> Timer.Context ctx = Instrumentation.getReadTimerContext(columnFamily); Session session = DatastaxIO.getSession(); Table<Locator, Long, BluefloodEnumRollup> locatorHashRollup = HashBasedTable.create(); List<ResultSetFuture> resultsFuture = new ArrayList<ResultSetFuture>(); try { for (String locatorStr : Locators.toStringList(locators)) { PreparedStatement statement = cfNameToSelectStatement.get(columnFamily); statement.bind(locatorStr, range.getStart(), range.getStop()); resultsFuture.add(session.executeAsync(statement.bind(locatorStr, range.getStart(), range.getStop()))); } for (ResultSetFuture future : resultsFuture) { try { List<Row> results = future.get().all(); for (Row row : results) { String key = row.getString(AbstractMetricsIO.KEY); Locator locator = Locator.createLocatorFromDbKey(key); locatorHashRollup.put(locator, row.getLong(AbstractMetricsIO.COLUMN1), serDes.deserialize(row.getBytes(AbstractMetricsIO.VALUE))); } } catch (InterruptedException ex) { Instrumentation.markReadError(); LOG.error("Interrupted error querying enum from " + columnFamily, ex); } catch (ExecutionException ex) { Instrumentation.markReadError(); LOG.error("Execution error querying enum from " + columnFamily, ex); } } } finally { ctx.stop(); } return locatorHashRollup; }</code><technical_language>@Override</technical_language>

Target:
public Table<Locator, Long, BluefloodEnumRollup> getEnumRollupsForLocators(final List<Locator> locators, String columnFamily, Range range) { Timer.Context ctx = Instrumentation.getReadTimerContext(columnFamily); Session session = DatastaxIO.getSession(); Table<Locator, Long, BluefloodEnumRollup> locatorHashRollup = HashBasedTable.create(); List<ResultSetFuture> resultsFuture = new ArrayList<ResultSetFuture>(); try { for (String locatorStr : LocatorsUtils.toStringList(locators)) { PreparedStatement statement = cfNameToSelectStatement.get(columnFamily); statement.bind(locatorStr, range.getStart(), range.getStop()); resultsFuture.add(session.executeAsync(statement.bind(locatorStr, range.getStart(), range.getStop()))); } for (ResultSetFuture future : resultsFuture) { try { List<Row> results = future.get().all(); for (Row row : results) { String key = row.getString(AbstractMetricsRW.KEY); Locator locator = Locator.createLocatorFromDbKey(key); locatorHashRollup.put(locator, row.getLong(AbstractMetricsRW.COLUMN1), serDes.deserialize(row.getBytes(AbstractMetricsRW.VALUE))); } } catch (InterruptedException ex) { Instrumentation.markReadError(); LOG.error("Interrupted error querying enum from " + columnFamily, ex); } catch (ExecutionException ex) { Instrumentation.markReadError(); LOG.error("Execution error querying enum from " + columnFamily, ex); } } } finally { ctx.stop(); } return locatorHashRollup; }
Source:
<code>public String getName() { <START> return "Comment on Workflow"; <END> }</code><technical_language>Shouldb't this i18m</technical_language>

Target:
public String getName() { String name = "Comment on Workflow"; try { name = LanguageUtil.get("Workflow-Comment-on-workflow"); } catch (LanguageException e) { name = "Comment on Workflow"; } return name; }
Source:
<code>protected UnweightedDoubleReservoirSample(UnweightedDoubleReservoirSample other) { <START> this.maxSamples = other.maxSamples; <END> checkArguments(); this.count = other.count; this.elements = new double[other.elements.length]; System.arraycopy(other.elements, 0, elements, 0, elements.length); }</code><technical_language>is this needed? - replace a clone() private UnweightedDoubleReservoirSample(int maxSamples, long count, double[] elements) { this.maxSamples = maxSamples; this.count = count; this.elements = elements; } public UnweightedDoubleReservoirSample clone() { double[] elementsCopy = new double[elements.length]; System.arraycopy(elements, 0, elementsCopy, 0, elements.length); return new UnweightedDoubleReservoirSample(this.maxSamples, this.count, elementsCopy); }</technical_language>

Target:
protected UnweightedDoubleReservoirSample(UnweightedDoubleReservoirSample other) { this.count = other.count; this.count = other.count; this.samples = new double[other.samples.length]; System.arraycopy(other.samples, 0, samples, 0, samples.length); }
Source:
<code>public void giveV3() throws Exception { String json = createJson("{'name':'Jack Aubrey','birthdate':'1970-10-10',"+ <START> "'imageData':'data:asdf','imageMimeType':'image/png','scope':'no_sharing'}"); <END> TestUtils.mockPlay().withJsonBody(json).withMockResponse().mock(); when(authenticationService.getSession(any(), any())).thenReturn(updatedSession); session.setConsentStatuses(TestConstants.UNCONSENTED_STATUS_MAP); doReturn(session).when(controller).getAuthenticatedSession(); Result result = controller.giveV3(SUBPOP_GUID.getGuid()); assertEquals(201, result.status()); UserSession retrievedSession = TestUtils.getResponsePayload(result, UserSession.class); assertEquals(UPDATED_SESSION_TOKEN, retrievedSession.getSessionToken()); verify(consentService).consentToResearch(study, SUBPOP_GUID, session.getParticipant(), SIGNATURE, SharingScope.NO_SHARING, true); verify(cacheProvider).setUserSession(updatedSession); }</code><technical_language>giveV1() giveV2() need unit tests</technical_language>

Target:
public void giveV3() throws Exception { DateTime badSignedOn = new DateTime(UNIX_TIMESTAMP).minusHours(1); String json = createJson("{'name':'Jack Aubrey','birthdate':'1970-10-10',"+ "'imageData':'data:asdf','imageMimeType':'image/png','scope':'no_sharing',"+ "'signedOn': '" + badSignedOn.toString() + "'}"); TestUtils.mockPlay().withJsonBody(json).withMockResponse().mock(); when(authenticationService.getSession(any(), any())).thenReturn(updatedSession); doReturn(session).when(controller).getAuthenticatedSession(); when(consentService.getConsentStatuses(any())).thenReturn(TestConstants.UNCONSENTED_STATUS_MAP); Result result = controller.giveV3(SUBPOP_GUID.getGuid()); assertEquals(201, result.status()); UserSession retrievedSession = TestUtils.getResponsePayload(result, UserSession.class); assertEquals(UPDATED_SESSION_TOKEN, retrievedSession.getSessionToken()); verify(consentService).consentToResearch(study, SUBPOP_GUID, session.getParticipant(), SIGNATURE, SharingScope.NO_SHARING, true); verify(cacheProvider).setUserSession(updatedSession); }
Source:
<code>public void testAlterTableName () throws Exception { TableDesc tableRenameTestDesc = createMockupTable("default", "mycooltable") ; catalog.createTable(tableRenameTestDesc); catalog.alterTable(createMockAlterTableName()); assertTrue(catalog.existsTable("default", "mynewcooltable")); catalog.alterTable(createMockAlterTableRenameColumn()); TableDesc columnRenameDesc = catalog.getTableDesc("default","mynewcooltable"); assertTrue(columnRenameDesc.getSchema().containsByName("ren"+FieldName1)); catalog.alterTable(createMockAlterTableAddColumn()); TableDesc addColumnDesc = catalog.getTableDesc("default","mynewcooltable"); assertTrue(addColumnDesc.getSchema().containsByName("mynewcol")); catalog.alterTable(createMockAlterTableSetProperty()); TableDesc setPropertyDesc = catalog.getTableDesc("default","mynewcooltable"); <START> assertEquals("GMT+0", setPropertyDesc.getMeta().getOption("timezone")); <END> }</code><technical_language>implemented unit test case for this feature. I suggest for implement more unit test cases mockup table. more valuable if verify change status of TableDesc. Unit test cases for partitioned table for implement this</technical_language>

Target:
public void testAlterTableName () throws Exception { TableDesc tableRenameTestDesc = createMockupTable("default", "mycooltable") ; catalog.createTable(tableRenameTestDesc); catalog.alterTable(createMockAlterTableName()); assertTrue(catalog.existsTable("default", "mynewcooltable")); catalog.alterTable(createMockAlterTableRenameColumn()); TableDesc columnRenameDesc = catalog.getTableDesc("default","mynewcooltable"); assertTrue(columnRenameDesc.getSchema().containsByName("ren"+FieldName1)); catalog.alterTable(createMockAlterTableAddColumn()); TableDesc addColumnDesc = catalog.getTableDesc("default","mynewcooltable"); assertTrue(addColumnDesc.getSchema().containsByName("mynewcol")); TableDesc setPropertyDesc = catalog.getTableDesc("default","mynewcooltable"); KeyValueSet options = new KeyValueSet(); options.set("timezone", "GMT+9"); setPropertyDesc.setMeta(new TableMeta(StoreType.CSV, options)); String prevTimeZone = setPropertyDesc.getMeta().getOption("timezone"); String newTimeZone = "GMT-7"; catalog.alterTable(createMockAlterTableSetProperty(newTimeZone)); setPropertyDesc = catalog.getTableDesc("default","mynewcooltable"); assertNotEquals(prevTimeZone, setPropertyDesc.getMeta().getOption("timezone")); assertEquals(newTimeZone, setPropertyDesc.getMeta().getOption("timezone")); }
Source:
<code><START> public void startAtlasdbTransactionResponseHasCorrectLeasedLock() { <END> StartIdentifiedAtlasDbTransactionRequest request = mock(StartIdentifiedAtlasDbTransactionRequest.class); StartIdentifiedAtlasDbTransactionResponse response = startTransactionResponseWith(LOCK_TOKEN); Lease lease = getLease(); when(timelockService.leasableStartIdentifiedAtlasDbTransaction(request)).thenReturn( LeasableStartIdentifiedAtlasDbTransactionResponse.of(response, lease)); StartIdentifiedAtlasDbTransactionResponse clientResponse = timelockClient.startIdentifiedAtlasDbTransaction(request); LeasedLockToken leasedLock = (LeasedLockToken) clientResponse.immutableTimestamp().getLock(); assertEquals(leasedLock.serverToken(), LOCK_TOKEN); assertEquals(lease, leasedLock.getLease()); }</code><technical_language>this test test redundant (delegatesStartAtlasdbTransactionRequest pointless if this test)</technical_language>

Target:
public void startAtlasdbTransactionResponseHasCorrectLeasedLock() { StartIdentifiedAtlasDbTransactionResponse response = startTransactionResponseWith(LOCK_TOKEN); Lease lease = getLease(); when(timelockRpcClient.startAtlasDbTransactionV3(startTxnRequest)).thenReturn( LeasableStartIdentifiedAtlasDbTransactionResponse.of(response, lease)); StartIdentifiedAtlasDbTransactionResponse clientResponse = timelockService.startIdentifiedAtlasDbTransaction(startTxnRequest); verify(timelockRpcClient).startAtlasDbTransactionV3(startTxnRequest); LeasedLockToken leasedLock = (LeasedLockToken) clientResponse.immutableTimestamp().getLock(); assertThat(leasedLock.serverToken()).isEqualTo(LOCK_TOKEN); assertThat(leasedLock.getLease()).isEqualTo(lease); }
Source:
<code>public CompletableFuture<Object> execute() { <START> return this.call().thenCompose((req) -> { <END> if (req.getStatus() == HttpStatus.SC_ACCEPTED) { String location = req.getHeader("location"); return poll(location, Duration.ofSeconds(1), Duration.ofSeconds(30)); } return CompletableFuture.completedFuture(req.getResult()); }); }</code><technical_language>Remove redundant this</technical_language>

Target:
public CompletableFuture<Object> execute() { return call().thenCompose((req) -> { if (req.getStatus() == HttpStatus.SC_ACCEPTED) { String location = req.getHeader(HttpHeaders.LOCATION); return poll(location, Duration.ofSeconds(1), Duration.ofSeconds(30)); } return CompletableFuture.completedFuture(req.getResult()); }); }
Source:
<code>private static String getTags(EntityType entityType) { <START> return StringUtils.join( <END> StreamSupport.stream(entityType.getTags().spliterator(), false) .map(Tag::getId) .collect(Collectors.toList()), ","); }</code><technical_language>Java 8 String.join instead of a party library</technical_language>

Target:
private static String getTags(EntityType entityType) { return Streams.stream(entityType.getTags()).map(Tag::getId).collect(joining(",")); }
Source:
<code><START> public static String getAuthorizationUrl(String authorizationEndpoint, String clientId, <END> @Nullable String redirectURI, @Nullable String state, @Nullable String scope) { StringBuilder authorizationUrl = new StringBuilder(authorizationEndpoint); if (authorizationUrl.indexOf("?") == -1) { authorizationUrl.append('?'); } else { authorizationUrl.append('&'); } try { authorizationUrl.append("response_type=code"); authorizationUrl.append("&client_id=").append(URLEncoder.encode(clientId, StandardCharsets.UTF_8.name())); if (state != null) { authorizationUrl.append("&state=").append(URLEncoder.encode(state, StandardCharsets.UTF_8.name())); } if (redirectURI != null) { authorizationUrl.append("&redirect_uri=") .append(URLEncoder.encode(redirectURI, StandardCharsets.UTF_8.name())); } if (scope != null) { authorizationUrl.append("&scope=").append(URLEncoder.encode(scope, StandardCharsets.UTF_8.name())); } } catch (UnsupportedEncodingException e) { logger.error("Unknown encoding {}", e.getMessage(), e); } return authorizationUrl.toString(); }</code><technical_language>This static methods wrong place - OAuthConnector is internal class API is instance. I see, this method is called OAuthClientServiceImpl - claim moving this method class cleaner (and logger non-static, this is I noticed this here...)</technical_language>

Target:
public String getAuthorizationUrl(String authorizationEndpoint, String clientId, @Nullable String redirectURI, @Nullable String state, @Nullable String scope) { StringBuilder authorizationUrl = new StringBuilder(authorizationEndpoint); if (authorizationUrl.indexOf("?") == -1) { authorizationUrl.append('?'); } else { authorizationUrl.append('&'); } try { authorizationUrl.append("response_type=code"); authorizationUrl.append("&client_id=").append(URLEncoder.encode(clientId, StandardCharsets.UTF_8.name())); if (state != null) { authorizationUrl.append("&state=").append(URLEncoder.encode(state, StandardCharsets.UTF_8.name())); } if (redirectURI != null) { authorizationUrl.append("&redirect_uri=") .append(URLEncoder.encode(redirectURI, StandardCharsets.UTF_8.name())); } if (scope != null) { authorizationUrl.append("&scope=").append(URLEncoder.encode(scope, StandardCharsets.UTF_8.name())); } } catch (UnsupportedEncodingException e) { logger.error("Unknown encoding {}", e.getMessage(), e); } return authorizationUrl.toString(); }