auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
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) try { test("dir", TableId.of("2a"), "", ""); fail("Failed to throw error on bad path"); } catch (NullPointerException e) }

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:
public void removeOffScreenBullets() { Iterator iteralien = ConcreteAggregate.createIterator(alienBullets); 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()); } } }

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:
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(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(id3.length(), 38); Assert.assertEquals("Unique IDs with the same name should be the same", id3, id3Again); }

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:
public int getTotalAvailableCapacity() { return laneRegistry.getConfiguration(TOTAL) .map(config -> laneRegistry.bulkhead(TOTAL, config).getMetrics().getAvailableConcurrentCalls()) .orElse(-1); }

Target:
int getTotalAvailableCapacity() { return laneRegistry.getConfiguration(TOTAL) .map(config -> laneRegistry.bulkhead(TOTAL, config).getMetrics().getAvailableConcurrentCalls()) .orElse(NO_CAPACITY); }
Source:
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()) { 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; } }

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:
private Iterable<NitroItemSource<Episode>> toItemSources(Iterable<Episode> episodes) throws GlycerinException, NitroException { return new PaginatedNitroItemSources( episodes, NITRO_BATCH_SIZE, pageSize, executor, glycerin ); }

Target:
private Iterable<NitroItemSource<Episode>> toItemSources(Iterable<Episode> episodes) throws GlycerinException, NitroException { return new PaginatedNitroItemSources( episodes, pageSize, executor, glycerin ); }
Source:
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 exists.", 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); }

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:
private boolean registryExists(HttpClient client) throws Exception{ ContentResponse response = client.newRequest(DEFAULT_DOCKER_REGISTRY).send(); return (response.getStatus() == STATUS_UNAUTHORIZED || response.getStatus() == STATUS_OK); }

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:
public void init(){ log.info("Getting all patient records ..."); updatePatientList(); log.info("Finish intialization ..."); }

Target:
public void init(){ log.info("Getting all patient records ..."); updatePatientList(); log.info("Finished initialization ..."); }
Source:
public synchronized boolean add(DiscoveryResult result) throws IllegalStateException { if (result != null) { ThingUID thingUID = result.getThingUID(); Thing thing = getExistingThingForDiscoveryResult(result); if (thing == null) { DiscoveryResult inboxResult = get(thingUID); if (inboxResult == null) { discoveryResultStorage.put(result.getThingUID().toString(), result); notifyListeners(result, EventType.added); logger.info("Added new thing '{}' to inbox.", thingUID); return true; } else { if (inboxResult instanceof DiscoveryResultImpl) { DiscoveryResultImpl resultImpl = (DiscoveryResultImpl) inboxResult; resultImpl.synchronize(result); discoveryResultStorage.put(result.getThingUID().toString(), resultImpl); notifyListeners(resultImpl, EventType.updated); logger.debug("Updated discovery result for '{}'.", thingUID); return true; } else { logger.warn("Cannot synchronize result with implementation class '{}'.", inboxResult.getClass().getName()); } } } else { logger.debug("Discovery result with thing '{}' not added as inbox entry." + " It is already present as thing in the ThingRegistry.", thingUID); boolean updated = synchronizeConfiguration(result.getThingTypeUID(), result.getProperties(), thing.getConfiguration()); if (updated) { logger.debug("The configuration for thing '{}' is updated...", thingUID); this.managedThingProvider.update(thing); } } } return false; }

Target:
public synchronized boolean add(DiscoveryResult result) throws IllegalStateException { if (result != null) { ThingUID thingUID = result.getThingUID(); Thing thing = this.thingRegistry.get(thingUID); if (thing == null) { DiscoveryResult inboxResult = get(thingUID); if (inboxResult == null) { discoveryResultStorage.put(result.getThingUID().toString(), result); notifyListeners(result, EventType.added); logger.info("Added new thing '{}' to inbox.", thingUID); return true; } else { if (inboxResult instanceof DiscoveryResultImpl) { DiscoveryResultImpl resultImpl = (DiscoveryResultImpl) inboxResult; resultImpl.synchronize(result); discoveryResultStorage.put(result.getThingUID().toString(), resultImpl); notifyListeners(resultImpl, EventType.updated); logger.debug("Updated discovery result for '{}'.", thingUID); return true; } else { logger.warn("Cannot synchronize result with implementation class '{}'.", inboxResult.getClass().getName()); } } } else { logger.debug("Discovery result with thing '{}' not added as inbox entry." + " It is already present as thing in the ThingRegistry.", thingUID); boolean updated = synchronizeConfiguration(result.getThingTypeUID(), result.getProperties(), thing.getConfiguration()); if (updated) { logger.debug("The configuration for thing '{}' is updated...", thingUID); this.managedThingProvider.update(thing); } } } return false; }
Source:
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)); SacrificeSourceCost cost = new SacrificeSourceCost(); cost.setText("Sacrifice this artifact"); ability.addCost(cost); this.addAbility(ability); }

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:
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"}}, }); }

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:
public boolean canMove(MapLocation loc, RobotType type) { return false; }

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:
protected 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); } } }

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:
private void initializeHistograms() { TmfTimeRange fullRange = updateTraceTimeRange(); 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); } }

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:
public void testInterruptFailingTries() throws Exception { Future<Client> result = executorService.submit(() -> { RetryCallback<Client, RuntimeException> fail = c -> { throw new IndexInternalException(""); }; 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()); }

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:
static String toNwbibNamespace(String id) { return id .replace("<LINK_0>", "<LINK_1>") .replace("<LINK_5>", "<LINK_3>") .replace("<LINK_2>", "<LINK_4>"); }

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:
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 (Exception | Error e) { try { handle.rollback(); } catch (Exception rollback) { e.addSuppressed(rollback); } throw e; } didTxnRollback.remove(); return returnValue; }

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:
public DDF updateInplace(DDF newddf) throws DDFException { DDF curDDF = this.getDDF(); if(curDDF.isCache()) { newddf.cache(); } curDDF.getRepresentationHandler().reset(); curDDF.getRepresentationHandler().setRepresentations(newddf.getRepresentationHandler().getAllRepresentations()); newddf.getMetaDataHandler().copyFactor(this.getDDF()); curDDF.getSchemaHandler().setSchema(newddf.getSchema()); return curDDF; }

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:
public String getHref() { return "/products/" + this.getUuid(); }

Target:
public String getHref() { Owner owner = ResteasyProviderFactory.getContextData(Owner.class); return this.getHref(owner); }
Source:
public PaymentWorksBatchReportVendorItem createBatchReportVendorItem(PaymentWorksVendor pmwVendorWithErrors, String errorMessage) { List<String> errorMessages = new ArrayList<String>(); errorMessages.add(errorMessage); return new PaymentWorksBatchReportVendorItem(pmwVendorWithErrors.getPmwVendorRequestId(), pmwVendorWithErrors.getProcessTimestamp(), pmwVendorWithErrors.getVendorType(), pmwVendorWithErrors.getRequestingCompanyLegalName(), pmwVendorWithErrors.getRequestingCompanyLegalFirstName(), pmwVendorWithErrors.getRequestingCompanyLegalLastName(), pmwVendorWithErrors.getRequestingCompanyTinType(), pmwVendorWithErrors.getRequestingCompanyCorporateEmail(), pmwVendorWithErrors.getInitiatorNetId(), errorMessages); }

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

Target:
public void verifyLightboxClosed() { waitForElementNotVisibleByElement(lightBoxModal); PageObjectLogging.log("verifyShareScreenClosed", "share lightbox is closed", true); }
Source:
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())) { closedParts.remove(closedEditorPart); } } }

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:
private void preservePasswordForAuthentication(Object password) { if ((isRemote() ==false || isSSL()) && prop.containsKey("AUTHREALM") && password!=null) { prop.put("_PASSWORD",password); } }

Target:
private void preservePasswordForAuthentication(Object password) { if ((!isRemote() || isSSL()) && prop.containsKey("AUTHREALM") && password!=null) { prop.put("AUTHZPWD",password); } }
Source:
public String getStringData() { try { final String data = IOUtils.toString( this.stream, Charset.forName("UTF-8") ); this.stream.close(); return data; } catch (final IOException exception) { throw new IllegalArgumentException( "Unable to read input", exception ); } }

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:
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); } if (!Util.isEmptyString(syncServerCertificateAssetName)) { String syncServerCertificateFilePath = ObjectServerFacade.getFacade( configuration.isSyncConfiguration()).getSyncServerCertificateFilePath(configuration); File certificateFile = new File(syncServerCertificateFilePath); copyFileIfNeeded(syncServerCertificateAssetName, certificateFile); } } }); } }

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:
public Text getTableId() { return new Text(ke.getTableId().getUtf8Bytes()); }

Target:
public Text getTableId() { return new Text(ke.getTableId().getUtf8()); }
Source:
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 (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; }

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:
private static boolean isValidBackupDir(Path backupDir) { String backupDirName = backupDir.toFile().getName(); try { DateUtil.getDate(backupDirName); return true; } catch (Exception e) { return false; } }

Target:
private static boolean isValidBackupDir(Path backupDir) { String backupDirName = backupDir.toFile().getName(); return (DateUtil.getDate(backupDirName) != null); }
Source:
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)); } 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)); }

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:
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 : 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; }

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:
public String getName() { return "Comment on Workflow"; }

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:
protected UnweightedDoubleReservoirSample(UnweightedDoubleReservoirSample other) { this.maxSamples = other.maxSamples; checkArguments(); this.count = other.count; this.elements = new double[other.elements.length]; System.arraycopy(other.elements, 0, elements, 0, elements.length); }

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:
public void giveV3() throws Exception { String json = createJson("{'name':'Jack Aubrey','birthdate':'1970-10-10',"+ "'imageData':'data:asdf','imageMimeType':'image/png','scope':'no_sharing'}"); 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); }

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:
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"); assertEquals("GMT+0", setPropertyDesc.getMeta().getOption("timezone")); }

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:
public void startAtlasdbTransactionResponseHasCorrectLeasedLock() { 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()); }

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:
public Definitions doCtags(String file) throws IOException, InterruptedException { if (file.length() < 1 || "\n".equals(file)) { return null; } if (ctags != null) { try { int exitValue = ctags.exitValue(); LOGGER.log(Level.WARNING, "Ctags process exited with exit value {0}", exitValue); throw new InterruptedException("ctags process died"); } catch (IllegalThreadStateException exp) { } } else { initialize(); } CtagsReader rdr = new CtagsReader(); rdr.setSplitterSupplier(() -> trySplitSource(file)); rdr.setTabSize(tabSize); Definitions ret; try { ctagsIn.write(file + "\n"); if (Thread.interrupted()) { throw new InterruptedException("write()"); } ctagsIn.flush(); if (Thread.interrupted()) { throw new InterruptedException("flush()"); } int timeout = this.timeout * 1000; Timer timer = null; if (timeout != 0) { timer = new Timer(); timer.schedule(new TimerTask() { @Override public void run() { LOGGER.log(Level.WARNING, String.format("Terminating ctags process for file '%s' " + "due to timeout %d seconds", file, timeout / 1000)); try { close(); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to terminate overly long ctags command"); } } }, timeout); } readTags(rdr); if (timer != null) { timer.cancel(); } ret = rdr.getDefinitions(); } catch (IOException ex) { if (Thread.interrupted()) { throw new InterruptedException("I/O"); } throw ex; } return ret; }

Target:
public Definitions doCtags(String file) throws IOException, InterruptedException { if (file.length() < 1 || "\n".equals(file)) { return null; } if (ctags != null) { try { int exitValue = ctags.exitValue(); LOGGER.log(Level.WARNING, "Ctags process exited with exit value {0}", exitValue); throw new InterruptedException("ctags process died"); } catch (IllegalThreadStateException exp) { } } else { initialize(); } CtagsReader rdr = new CtagsReader(); rdr.setSplitterSupplier(() -> trySplitSource(file)); rdr.setTabSize(tabSize); Definitions ret = null; try { ctagsIn.write(file + "\n"); if (Thread.interrupted()) { throw new InterruptedException("write()"); } ctagsIn.flush(); if (Thread.interrupted()) { throw new InterruptedException("flush()"); } IndexerParallelizer parallelizer = RuntimeEnvironment.getInstance().getIndexerParallelizer(); ExecutorService executor = parallelizer.getCtagsWatcherExecutor(); Future<Definitions> future = executor.submit(() -> { readTags(rdr); return rdr.getDefinitions(); }); try { ret = future.get(getTimeout(), TimeUnit.SECONDS); } catch (ExecutionException ex) { LOGGER.log(Level.WARNING, "execution exception", ex); } catch (TimeoutException ex) { LOGGER.log(Level.WARNING, String.format("Terminating ctags process for file '%s' " + "due to timeout %d seconds", file, getTimeout())); try { close(); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to terminate overly long ctags command"); } throw new InterruptedException("ctags timeout"); } } catch (IOException ex) { if (Thread.interrupted()) { throw new InterruptedException("I/O"); } throw ex; } return ret; }
Source:
public CompletableFuture<Object> execute() { return this.call().thenCompose((req) -> { 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()); }); }

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:
private static String getTags(EntityType entityType) { return StringUtils.join( StreamSupport.stream(entityType.getTags().spliterator(), false) .map(Tag::getId) .collect(Collectors.toList()), ","); }

Target:
private static String getTags(EntityType entityType) { return Streams.stream(entityType.getTags()).map(Tag::getId).collect(joining(",")); }
Source:
public static 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(); }

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(); }
Source:
private void run(final long iterationDurationNanos, final long ttlNanos) throws Throwable { final Supplier<Long> s = new Supplier<Long>() { private long value; @Override public Long get() { return ++value; } }; final Supplier<Long> m = memoize(s, ttlNanos); final Collection<Future<Void>> results = new ArrayList<>(); final long beginNanos = System.nanoTime(); for (int tid = 0; tid < numberOfThreads; tid++) { results.add(ex.submit(() -> { Long previousValue = m.get(); assertNotNull(previousValue); assertTrue(previousValue > 0); final long firstSupplierCallNanos = System.nanoTime(); boolean guaranteedIteration = false; long now; while ((now = System.nanoTime()) < beginNanos + iterationDurationNanos || now < firstSupplierCallNanos + ttlNanos || (guaranteedIteration = !guaranteedIteration)) { if (Thread.currentThread().isInterrupted()) { throw new InterruptedException(); } final Long newValue = m.get(); assertNotNull(newValue); assertTrue(String.format("newValue=%s, previousValue=%s", newValue, previousValue), newValue >= previousValue); previousValue = newValue; } return null; })); } finishAllThreads(results); final long actualNumberOfIncrements = s.get() - 1; testIncrementCounts(actualNumberOfIncrements, iterationDurationNanos, ttlNanos); }

Target:
private void run(final long iterationDurationNanos, final long ttlNanos) throws Throwable { final Supplier<Long> s = new Supplier<Long>() { private long value; @Override public Long get() { return ++value; } }; final Supplier<Long> m = memoize(s, ttlNanos); final Collection<Future<Void>> results = new ArrayList<>(); final long beginNanos = System.nanoTime(); for (int tid = 0; tid < numberOfThreads; tid++) { results.add(ex.submit(() -> { Long previousValue = m.get(); assertNotNull(previousValue); assertTrue(previousValue > 0); final long firstSupplierCallNanos = System.nanoTime(); boolean guaranteedIteration = false; long now; while ((now = System.nanoTime()) - beginNanos < iterationDurationNanos || now - firstSupplierCallNanos < ttlNanos || (guaranteedIteration = !guaranteedIteration)) { if (Thread.currentThread().isInterrupted()) { throw new InterruptedException(); } final Long newValue = m.get(); assertNotNull(newValue); assertTrue(String.format("newValue=%s, previousValue=%s", newValue, previousValue), newValue >= previousValue); previousValue = newValue; } return null; })); } finishAllThreads(results); final long actualNumberOfIncrements = s.get() - 1; testIncrementCounts(actualNumberOfIncrements, iterationDurationNanos, ttlNanos); }
Source:
public IndexOrder[] orderCapability( ValueGroup... valueGroups ) { if ( support( valueGroups ) ) { return new IndexOrder[]{IndexOrder.ASCENDING}; } return new IndexOrder[0]; }

Target:
public IndexOrder[] orderCapability( ValueGroup... valueGroups ) { if ( support( valueGroups ) ) { return SUPPORTED_ORDER; } return EMPTY_ORDER; }