auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private Void handleConfiguration(Peer peer, VersionMessage versionMessage) { var wellConfigured = isWellConfigured(versionMessage); if (wellConfigured) { log.info("Peer well configured: {}", peer); } else { log.error("Peer _badly_ configured (pruning and/or bloom filters disabled): {}", peer); var usingLocalNode = localBitcoinNode.shouldBeUsed(); var usingCustomNodes = BtcNodes.BitcoinNodesOption.CUSTOM.ordinal() == preferences.getBitcoinNodesOptionOrdinal(); if (usingLocalNode || usingCustomNodes) { displayUserBtcNodeMisconfigurationHandler.accept(peer.toString()); } } return null; }

Target:
private void handleConfiguration(Peer peer, VersionMessage versionMessage) { var wellConfigured = isWellConfigured(versionMessage); if (wellConfigured) { log.info("Peer well configured: {}", peer); } else { log.error("Peer _badly_ configured (pruning and/or bloom filters disabled): {}", peer); var usingLocalNode = localBitcoinNode.shouldBeUsed(); var usingCustomNodes = BtcNodes.BitcoinNodesOption.CUSTOM.ordinal() == preferences.getBitcoinNodesOptionOrdinal(); if (usingLocalNode || usingCustomNodes) { displayUserBtcNodeMisconfigurationHandler.accept(peer.toString()); } } }
Source:
private CredentialHandlerResourceDefinition(SimpleAttributeDefinition... attributes) { super(ModelElement.IDENTITY_STORE_CREDENTIAL_HANDLER, new IDMConfigAddStepHandler( getModelValidators(), attributes), null, attributes); }

Target:
private CredentialHandlerResourceDefinition(SimpleAttributeDefinition... attributes) { super(ModelElement.IDENTITY_STORE_CREDENTIAL_HANDLER, new IDMConfigAddStepHandler( getModelValidators(), attributes), attributes); }
Source:
public void testInputValidation() { ______TS("client-side input validation"); EvaluationAttributes eval = newEval; WebDriverWait wait = new WebDriverWait(browser.driver, 15); wait.until(presenceOfElementLocated(By.id("button_submit"))); evalsPage.clickSubmitButton(); assertEquals(Const.StatusMessages.FIELDS_EMPTY, evalsPage.getStatus()); evalsPage.fillEvalName("Some value"); evalsPage.clickSubmitButton(); assertEquals(Const.StatusMessages.FIELDS_EMPTY, evalsPage.getStatus()); evalsPage.addEvaluation(eval.courseId, "", eval.startTime, eval.endTime, eval.p2pEnabled, eval.instructions.getValue(), eval.gracePeriod, eval.timeZone); assertEquals(Const.StatusMessages.FIELDS_EMPTY, evalsPage.getStatus()); evalsPage.addEvaluation(eval.courseId, eval.name, eval.startTime, eval.endTime, eval.p2pEnabled, "", eval.gracePeriod, eval.timeZone); assertEquals(Const.StatusMessages.FIELDS_EMPTY, evalsPage.getStatus()); evalsPage.addEvaluation(eval.courseId, eval.name+"!@#$%^&*()_+", eval.startTime, eval.endTime, eval.p2pEnabled, eval.instructions.getValue(), eval.gracePeriod, eval.timeZone); assertEquals(Const.StatusMessages.EVALUATION_NAMEINVALID, evalsPage.getStatus()); evalsPage.addEvaluation(eval.courseId, eval.name, eval.endTime, eval.startTime, eval.p2pEnabled, eval.instructions.getValue(), eval.gracePeriod, eval.timeZone); assertEquals(Const.StatusMessages.EVALUATION_SCHEDULEINVALID.replace("<br />", "\n"), evalsPage.getStatus()); }

Target:
public void testInputValidation() { ______TS("client-side input validation"); EvaluationAttributes eval = newEval; waitForElementPresent(browser.driver, By.id("button_submit"), 15); evalsPage.clickSubmitButton(); assertEquals(Const.StatusMessages.FIELDS_EMPTY, evalsPage.getStatus()); evalsPage.fillEvalName("Some value"); evalsPage.clickSubmitButton(); assertEquals(Const.StatusMessages.FIELDS_EMPTY, evalsPage.getStatus()); evalsPage.addEvaluation(eval.courseId, "", eval.startTime, eval.endTime, eval.p2pEnabled, eval.instructions.getValue(), eval.gracePeriod, eval.timeZone); assertEquals(Const.StatusMessages.FIELDS_EMPTY, evalsPage.getStatus()); evalsPage.addEvaluation(eval.courseId, eval.name, eval.startTime, eval.endTime, eval.p2pEnabled, "", eval.gracePeriod, eval.timeZone); assertEquals(Const.StatusMessages.FIELDS_EMPTY, evalsPage.getStatus()); evalsPage.addEvaluation(eval.courseId, eval.name+"!@#$%^&*()_+", eval.startTime, eval.endTime, eval.p2pEnabled, eval.instructions.getValue(), eval.gracePeriod, eval.timeZone); assertEquals(Const.StatusMessages.EVALUATION_NAMEINVALID, evalsPage.getStatus()); evalsPage.addEvaluation(eval.courseId, eval.name, eval.endTime, eval.startTime, eval.p2pEnabled, eval.instructions.getValue(), eval.gracePeriod, eval.timeZone); assertEquals(Const.StatusMessages.EVALUATION_SCHEDULEINVALID.replace("<br />", "\n"), evalsPage.getStatus()); }
Source:
public TestOrder cloneForDiscontinuing() { TestOrder newOrder = new TestOrder(); newOrder.setCareSetting(getCareSetting()); newOrder.setConcept(getConcept()); newOrder.setAction(Action.DISCONTINUE); newOrder.setPreviousOrder(this); newOrder.setPatient(getPatient()); newOrder.setOrderType(getOrderType()); newOrder.setOrderGroup(null); newOrder.setSequenceNumber(null); return newOrder; }

Target:
public TestOrder cloneForDiscontinuing() { TestOrder newOrder = new TestOrder(); newOrder.setCareSetting(getCareSetting()); newOrder.setConcept(getConcept()); newOrder.setAction(Action.DISCONTINUE); newOrder.setPreviousOrder(this); newOrder.setPatient(getPatient()); newOrder.setOrderType(getOrderType()); return newOrder; }
Source:
public Map<String, String> getInstitutionLoginUrls(final String target) { final List<OpenScienceFrameworkInstitution> institutionList = openScienceFrameworkDao.findAllInstitutions(); final Map<String, String> institutionLogin = new HashMap<>(); for (final OpenScienceFrameworkInstitution institution: institutionList) { if (institution.getDelegationProtocol().equalsIgnoreCase( OpenScienceFrameworkInstitution.DelegationProtocols.SAML_SHIB.name())) { institutionLogin.put(institution.getLoginUrl() + "&target=" + target, institution.getName()); } else if (institution.getDelegationProtocol().equalsIgnoreCase( OpenScienceFrameworkInstitution.DelegationProtocols.CAS_PAC4J.name())) { institutionLogin.put(institution.getId(), institution.getName()); } } return institutionLogin; }

Target:
public Map<String, String> getInstitutionLoginUrls(final String target) { final List<OpenScienceFrameworkInstitution> institutionList = openScienceFrameworkDao.findAllInstitutions(); final Map<String, String> institutionLogin = new HashMap<>(); for (final OpenScienceFrameworkInstitution institution: institutionList) { final DelegationProtocol delegationProtocol = institution.getDelegationProtocol(); if (DelegationProtocol.SAML_SHIB.equals(delegationProtocol)) { institutionLogin.put(institution.getLoginUrl() + "&target=" + target, institution.getName()); } else if (DelegationProtocol.CAS_PAC4J.equals(delegationProtocol)) { institutionLogin.put(institution.getId(), institution.getName()); } } return institutionLogin; }
Source:
private List<VmTemplate> filterOutBlank(List<VmTemplate> templates) { final ArrayList<VmTemplate> result = new ArrayList<>(); for (VmTemplate template : templates) { if (!template.isBlank()) { result.add(template); } } return result; }

Target:
private List<VmTemplate> filterOutBlank(List<VmTemplate> templates) { final List<VmTemplate> result = new ArrayList<>(); for (VmTemplate template : templates) { if (!template.isBlank()) { result.add(template); } } return result; }
Source:
protected Integer doTaskBackground(Void... params) { Log.d(TAG, "Doing UnzipTask"); try { String zipPath = toBeZippedPath; File nf = new File(zipPath); if (nf.exists()) { nf.delete(); } zipParentFolder(nf, zipFilePath); File toBeZippedDir = new File(toBeZippedPath); FileUtil.deleteFileOrDir(toBeZippedDir); } catch (IOException ioe) { Log.d(TAG, "IOException: " + ioe.getMessage()); return RESULT_FAILURE; } return RESULT_SUCCESS; }

Target:
protected ZipTaskResult doTaskBackground(Void... params) { Log.d(TAG, "Doing UnzipTask"); try { FileUtil.deleteFileOrDir(toBeZippedFile); zipParentFolder(toBeZippedFile, zipFilePath); FileUtil.deleteFileOrDir(toBeZippedFile); } catch (IOException ioe) { Log.d(TAG, "IOException: " + ioe.getMessage()); return ZipTaskResult.Failure; } return ZipTaskResult.Success; }
Source:
protected void notifyOf(T newValue) { Observer<T>[] observersCopy; synchronized (this) { if (hasNotChanged()) { return; } observersCopy = observers.toArray(new Observer[observers.size()]); clearChanged(); } for (int i = observersCopy.length - 1; i >= 0; i--) { observersCopy[i].update(newValue); } }

Target:
protected synchronized void notifyOf(T newValue) { for (int i = observers.size() - 1; i >= 0; i--) { observers.get(i).update(newValue); } }
Source:
public void process() { PerformanceMonitor.startActivity("rendering/applyDeferredLighting"); FBO sceneOpaquePingPongFbo = displayResolutionDependentFBOs.get(new ResourceUrn("engine:sceneOpaquePingPong")); sceneOpaquePingPongFbo.bind(); sceneOpaquePingPongFbo.setRenderBufferMask(true, true, true); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); renderFullscreenQuad(); displayResolutionDependentFBOs.swapReadWriteBuffers(); displayResolutionDependentFBOs.get(new ResourceUrn("engine:sceneOpaque")).attachDepthBufferTo(displayResolutionDependentFBOs.get(REFRACTIVE_REFLECTIVE)); PerformanceMonitor.endActivity(); }

Target:
public void process() { PerformanceMonitor.startActivity("rendering/applyDeferredLighting"); sceneOpaquePingPongFbo.bind(); sceneOpaquePingPongFbo.setRenderBufferMask(true, true, true); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); renderFullscreenQuad(); displayResolutionDependentFBOs.swapReadWriteBuffers(); PerformanceMonitor.endActivity(); }
Source:
private void writeAndFlush(final Channel channel, final CompletionKey key, final Object request) { if (channel == null) { errorOut(key); return; } try { final long startTime = MathUtils.nowInNano(); ChannelFuture future = channel.writeAndFlush(request, channel.voidPromise()); future.addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) throws Exception { if (future.isSuccess()) { nettyOpLogger.registerSuccessfulEvent(MathUtils.elapsedNanos(startTime), TimeUnit.NANOSECONDS); completionObjects.get(key).setOutstanding(); } else { nettyOpLogger.registerFailedEvent(MathUtils.elapsedNanos(startTime), TimeUnit.NANOSECONDS); } } }); } catch (Throwable e) { LOG.warn("Operation failed", requestToString(request), e); errorOut(key); } }

Target:
private void writeAndFlush(final Channel channel, final CompletionKey key, final Object request) { if (channel == null) { errorOut(key); return; } try { final long startTime = MathUtils.nowInNano(); ChannelFuture future = channel.writeAndFlush(request); future.addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) throws Exception { if (future.isSuccess()) { nettyOpLogger.registerSuccessfulEvent(MathUtils.elapsedNanos(startTime), TimeUnit.NANOSECONDS); completionObjects.get(key).setOutstanding(); } else { nettyOpLogger.registerFailedEvent(MathUtils.elapsedNanos(startTime), TimeUnit.NANOSECONDS); } } }); } catch (Throwable e) { LOG.warn("Operation failed", requestToString(request), e); errorOut(key); } }
Source:
public int getFlushInterval(Context context) { boolean isDebuggable = context != null && ( 0 != ( context.getApplicationInfo().flags &= ApplicationInfo.FLAG_INSTALLED ) ); if (isDebuggable) { return 1000; } else { return mFlushInterval; } }

Target:
public int getFlushInterval(Context context) { boolean isDebuggable = context != null && ( 0 != ( context.getApplicationInfo().flags &= ApplicationInfo.FLAG_DEBUGGABLE ) ); if (isDebuggable) { return mDebugFlushInterval; } else { return mFlushInterval; } }
Source:
public void edit(final IscsiStorageModel object) { driver.edit(object); initLists(object); object.getPropertyChangedEvent().addListener((ev, sender, args) -> { String propName = args.propertyName; if (propName.equals("IsValid")) { onIsValidPropertyChange(object); } else if (propName.equals("IsGrouppedByTarget")) { updateListByGropping(object); } }); iscsiTargetToLunView.edit(object); iscsiLunToTargetView.edit(object); targetsToLunTab.addClickHandler(event -> { iscsiLunToTargetView.disableItemsUpdate(); object.setIsGrouppedByTarget(true); }); lunToTargetsTab.addClickHandler(event -> { iscsiTargetToLunView.disableItemsUpdate(); object.setIsGrouppedByTarget(false); }); dialogTabPanel.switchTab(object.getIsGrouppedByTarget() ? targetsToLunTab : lunToTargetsTab); updateListByGropping(object); if (!object.getContainer().isNewStorage()) { if (object.getContainer().getStorage().getStatus() == StorageDomainStatus.Maintenance) { mainLabel.setText(constants.storageIscsiRemoveLUNsLabel()); subLabel.setText(constants.storageIscsiAvailableActionsOnMaintenanceLabel()); } else if (object.getContainer().getStorage().getStatus() == StorageDomainStatus.Active) { mainLabel.setText(constants.storageIscsiActionsLabel()); subLabel.setText(constants.storageIscsiAvailableActionsForActiveDomainsLabel()); } } }

Target:
public void edit(final IscsiStorageModel object) { driver.edit(object); initLists(object); object.getPropertyChangedEvent().addListener((ev, sender, args) -> { String propName = args.propertyName; if (propName.equals("IsValid")) { onIsValidPropertyChange(object); } else if (propName.equals("IsGrouppedByTarget")) { updateListByGropping(object); } }); iscsiTargetToLunView.edit(object); iscsiLunToTargetView.edit(object); targetsToLunTab.addClickHandler(event -> { iscsiLunToTargetView.disableItemsUpdate(); object.setIsGrouppedByTarget(true); }); lunToTargetsTab.addClickHandler(event -> { iscsiTargetToLunView.disableItemsUpdate(); object.setIsGrouppedByTarget(false); }); dialogTabPanel.switchTab(object.getIsGrouppedByTarget() ? targetsToLunTab : lunToTargetsTab); updateListByGropping(object); if (!object.getContainer().isNewStorage()) { switch (object.getContainer().getStorage().getStatus()){ case Maintenance: mainLabel.setText(constants.storageIscsiRemoveLUNsLabel()); subLabel.setText(constants.storageIscsiAvailableActionsOnMaintenanceLabel()); case Active: mainLabel.setText(constants.storageIscsiActionsLabel()); subLabel.setText(constants.storageIscsiAvailableActionsForActiveDomainsLabel()); } } }
Source:
public void schedule(Work work, Scheduling scheduling, boolean afterCommit) { String queueId = getStreamForCategory(work.getCategory()); if (log.isDebugEnabled()) { log.debug(String.format( "Scheduling: workId: %s, category: %s, queue: %s, scheduling: %s, afterCommit: %s, work: %s", work.getId(), work.getCategory(), queueId, scheduling, afterCommit, work)); } if (!isQueuingEnabled(queueId)) { log.info("Queue disabled, scheduling canceled: " + queueId); return; } if (CANCEL_SCHEDULED.equals(scheduling)) { log.warn("Canceling a work is not supported by this impl, skipping work: " + work); return; } if (afterCommit && scheduleAfterCommit(work, scheduling)) { return; } WorkSchedulePath.newInstance(work); LogAppender<Record> appender = logManager.getAppender(getStreamForCategory(work.getCategory())); if (appender == null) { log.error(String.format("Not scheduled work, unknown category: %s, mapped to %s", work.getCategory(), getStreamForCategory(work.getCategory()))); return; } String key = work.getPartitionKey(); appender.append(key, Record.of(key, WorkComputation.serialize(work))); KeyValueStore kvStore = Framework.getService(KeyValueService.class).getKeyValueStore(KV_NAME); kvStore.put(work.getId() + STATE, Work.State.SCHEDULED.toString(), 60 * 60L); }

Target:
public void schedule(Work work, Scheduling scheduling, boolean afterCommit) { String queueId = getStreamForCategory(work.getCategory()); if (log.isDebugEnabled()) { log.debug(String.format( "Scheduling: workId: %s, category: %s, queue: %s, scheduling: %s, afterCommit: %s, work: %s", work.getId(), work.getCategory(), queueId, scheduling, afterCommit, work)); } if (!isQueuingEnabled(queueId)) { log.info("Queue disabled, scheduling canceled: " + queueId); return; } if (CANCEL_SCHEDULED.equals(scheduling)) { log.warn("Canceling a work is not supported by this impl, skipping work: " + work); return; } if (afterCommit && scheduleAfterCommit(work, scheduling)) { return; } WorkSchedulePath.newInstance(work); LogAppender<Record> appender = logManager.getAppender(getStreamForCategory(work.getCategory())); if (appender == null) { log.error(String.format("Not scheduled work, unknown category: %s, mapped to %s", work.getCategory(), getStreamForCategory(work.getCategory()))); return; } String key = work.getPartitionKey(); appender.append(key, Record.of(key, WorkComputation.serialize(work))); if (storeState) { setState(work.getId(), Work.State.SCHEDULED.toString(), stateTTL); } }
Source:
public Context(Query query, QueryBuilder qbuilder) { if (qbuilder == null) { throw new IllegalArgumentException("`qbuilder' is null"); } this.query = query; this.qbuilder = qbuilder; QueryMatchers qm = new QueryMatchers(); m = qm.getMatchers(query, TOKEN_FIELDS); if (m != null) { buildQueryAsURI(qbuilder.getQueries()); buffer = new char[MAXFILEREAD]; tokens = new PlainLineTokenizer((Reader) null); } }

Target:
public Context(Query query, QueryBuilder qbuilder) { if (qbuilder == null) { throw new IllegalArgumentException("qbuilder is null"); } this.query = query; this.qbuilder = qbuilder; QueryMatchers qm = new QueryMatchers(); m = qm.getMatchers(query, TOKEN_FIELDS); if (m != null) { buildQueryAsURI(qbuilder.getQueries()); buffer = new char[MAXFILEREAD]; tokens = new PlainLineTokenizer((Reader) null); } }
Source:
public PagedIterable<ManagementLock> listForResource(String resourceId) { return wrapList(this.manager().managementLockClient().getManagementLocks().listAtResourceLevel( ResourceUtils.groupFromResourceId(resourceId), ResourceUtils.resourceProviderFromResourceId(resourceId), ResourceUtils.parentRelativePathFromResourceId(resourceId), ResourceUtils.resourceTypeFromResourceId(resourceId), ResourceUtils.nameFromResourceId(resourceId))); }

Target:
public PagedIterable<ManagementLock> listForResource(String resourceId) { return wrapList(this.manager().managementLockClient().getManagementLocks().listByScope(resourceId)); }
Source:
private void createIndex(Connection conn, String dataTable, String indexTable) throws Exception { conn.createStatement().execute("CREATE INDEX " + indexTable + " on " + dataTable + " (val1) include (val2, val3)"); conn.commit(); TestUtil.waitForIndexState(conn, indexTable, PIndexState.ACTIVE); }

Target:
private void createIndex(Connection conn, String dataTable, String indexTable) throws Exception { String ddl = "CREATE INDEX " + indexTable + " on " + dataTable + " (val1) include (val2, val3)"; conn.createStatement().execute(ddl); conn.commit(); TestUtil.waitForIndexState(conn, indexTable, PIndexState.ACTIVE); }
Source:
private void setSelected(WebElement option, boolean select) { if ((!option.isSelected() && select) || (option.isSelected() && !select)) { option.click(); } }

Target:
private void setSelected(WebElement option, boolean select) { boolean isSelected=option.isSelected(); if ((!isSelected && select) || (isSelected && !select)) { option.click(); } }
Source:
public static GameData loadGame(final InputStream is) throws IOException { checkNotNull(is); final ObjectInputStream input = new ObjectInputStream(new GZIPInputStream(is)); try { final Object version = input.readObject(); if (version instanceof games.strategy.util.Version) { throw new IOException( String.format( "Incompatible engine versions. We are: %s<br/>" + "Trying to load incompatible save game version: %s<br/>" + "To download an older version of TripleA,<br/>" + "please visit: <a href=%s>%s</a>", ClientContext.engineVersion(), ((games.strategy.util.Version) version).getExactVersion(), UrlConstants.OLD_DOWNLOADS_WEBSITE, UrlConstants.OLD_DOWNLOADS_WEBSITE)); } else if (!(version instanceof Version)) { throw new IOException( "Incompatible engine version with save game, " + "unable to determine version of the save game"); } else if (!ClientContext.engineVersion().isCompatibleWithEngineVersion((Version) version)) { throw new IOException( String.format( "Incompatible engine versions. We are: %s<br/>" + "Trying to load game created with: %s<br/>" + "To download the latest version of TripleA,<br/>" + "please visit: <a href=%s>%s</a>", ClientContext.engineVersion(), version, UrlConstants.DOWNLOAD_WEBSITE, UrlConstants.DOWNLOAD_WEBSITE)); } final GameData data = (GameData) input.readObject(); data.postDeSerialize(); loadDelegates(input, data); return data; } catch (final ClassNotFoundException cnfe) { throw new IOException(cnfe.getMessage()); } }

Target:
public static GameData loadGame(final InputStream is) throws IOException { checkNotNull(is); final ObjectInputStream input = new ObjectInputStream(new GZIPInputStream(is)); try { final Object version = input.readObject(); if (version instanceof games.strategy.util.Version) { throw new IOException( String.format( "Incompatible engine versions. We are: %s<br>" + "Trying to load incompatible save game version: %s<br>" + "To download an older version of TripleA,<br>" + "please visit: <a href=\"%s\">%s</a>", ClientContext.engineVersion(), ((games.strategy.util.Version) version).getExactVersion(), UrlConstants.OLD_DOWNLOADS_WEBSITE, UrlConstants.OLD_DOWNLOADS_WEBSITE)); } else if (!(version instanceof Version)) { throw new IOException( "Incompatible engine version with save game, " + "unable to determine version of the save game"); } else if (!ClientContext.engineVersion().isCompatibleWithEngineVersion((Version) version)) { throw new IOException( String.format( "Incompatible engine versions. We are: %s<br>" + "Trying to load game created with: %s<br>" + "To download the latest version of TripleA,<br>" + "please visit: <a href=\"%s\">%s</a>", ClientContext.engineVersion(), version, UrlConstants.DOWNLOAD_WEBSITE, UrlConstants.DOWNLOAD_WEBSITE)); } final GameData data = (GameData) input.readObject(); data.postDeSerialize(); loadDelegates(input, data); return data; } catch (final ClassNotFoundException cnfe) { throw new IOException(cnfe.getMessage()); } }
Source:
public String printMatchingStats() { String stats = ""; final String cr = System.getProperty("line.separator"); stats += "Number of matches found: " + fMatches.getMatches().size() + cr; for (int i = 0; i<fTraces.length; i++) { stats += "" + "Trace " + i + ":" + cr + " " + countEvents(fUnmatchedIn[i]) + " unmatched incoming events" + cr + " " + countEvents(fUnmatchedOut[i]) + " unmatched outgoing events" + cr; } return stats; }

Target:
public String printMatchingStats() { final String cr = System.getProperty("line.separator"); StringBuilder b = new StringBuilder(); b.append("Number of matches found: " + fMatches.getMatches().size() + cr); for (int i = 0; i < fTraces.length; i++) { b.append("" + "Trace " + i + ":" + cr + " " + countEvents(fUnmatchedIn[i]) + " unmatched incoming events" + cr + " " + countEvents(fUnmatchedOut[i]) + " unmatched outgoing events" + cr); } return b.toString(); }
Source:
public void testParentRelationshipQuery() throws Exception { final QueryRecordsContact queryRecords = template().requestBody("direct:parentRelationshipQuery", null, QueryRecordsContact.class); Account account = queryRecords.getRecords().get(0).getAccount(); assertNotNull("Account was null", account); }

Target:
public void testParentRelationshipQuery() throws Exception { try { createAccountAndContact(); final QueryRecordsContact queryRecords = template().requestBody("direct:parentRelationshipQuery", null, QueryRecordsContact.class); Account account = queryRecords.getRecords().get(0).getAccount(); assertNotNull("Account was null", account); } finally { deleteAccountAndContact(); } }
Source:
public HttpMethod httpMethod() { return HttpMethod.valueOf(request.method().toUpperCase(Locale.ENGLISH)); }

Target:
public HttpMethod httpMethod() { return method; }
Source:
private void addWatchdogModels(VersionCaps version, WatchdogModel[] values) { if (VersionUtils.greaterOrEqual(version, VERSION_3_2)) { version.setWatchdogModels(new WatchdogModels()); for (WatchdogModel watchdogModel : values) { version.getWatchdogModels().getWatchdogModels().add(watchdogModel.value()); } } }

Target:
private void addWatchdogModels(VersionCaps version, WatchdogModel[] values) { if (VersionUtils.greaterOrEqual(version, VERSION_3_3)) { version.setWatchdogModels(new WatchdogModels()); for (WatchdogModel watchdogModel : values) { version.getWatchdogModels().getWatchdogModels().add(watchdogModel.value()); } } }
Source:
private void enablePhiro() { SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); if (!sharedPreferences.getBoolean(Constants.PHIRO_INITIALIZED, false)) { BaseSettingsActivity.setPhiroSharedPreferenceEnabled(this, true); sharedPreferences.edit().putBoolean(Constants.PHIRO_INITIALIZED, true).apply(); } }

Target:
private void enablePhiro() { SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); if (!sharedPreferences.getBoolean(PHIRO_INITIALIZED, false)) { BaseSettingsActivity.setPhiroSharedPreferenceEnabled(this, true); sharedPreferences.edit().putBoolean(PHIRO_INITIALIZED, true).apply(); } }
Source:
Builder networkPolicy(@NonNull NetworkPolicy policy, @NonNull NetworkPolicy... additional) { if (policy == null) { throw new IllegalArgumentException("Network policy cannot be null."); } this.networkPolicy |= policy.index; if (additional == null) { throw new IllegalArgumentException("Network policy cannot be null."); } if (additional.length > 0) { for (NetworkPolicy networkPolicy : additional) { if (networkPolicy == null) { throw new IllegalArgumentException("Network policy cannot be null."); } this.networkPolicy |= networkPolicy.index; } } return this; }

Target:
Builder networkPolicy(@NonNull NetworkPolicy policy, @NonNull NetworkPolicy... additional) { if (policy == null) { throw new NullPointerException("policy == null"); } if (additional == null) { throw new NullPointerException("additional == null"); } this.networkPolicy |= policy.index; for (NetworkPolicy networkPolicy : additional) { if (networkPolicy == null) { throw new NullPointerException("networkPolicy == null"); } this.networkPolicy |= networkPolicy.index; } return this; }
Source:
public Date getDate() { return Stream.of(this.getLastBuilt(), this.getDbCreateDate()).filter(Objects::nonNull).findFirst().orElse(null); }

Target:
public Date getDate() { return ObjectUtils.firstNonNull(this.getLastBuilt(), this.getDbCreateDate()); }
Source:
public void setUp() throws Exception { IEclipseContext context = E4Application.createDefaultContext(); modelService = context.get(EModelService.class); editor = modelService.createModelElement(MPart.class); editor.setElementId(DUMMY_EDITOR_ID); editor.getTags().add("Editor"); }

Target:
public void setUp() throws Exception { editor = modelService.createModelElement(MPart.class); editor.setElementId(DUMMY_EDITOR_ID); editor.getTags().add("Editor"); }
Source:
public static void reportException(@Nonnull Throwable e) { String name = e.getMessage(); if (name == null || name.length() == 0) { LOGGER.log(Level.INFO, "No class name could be extracted from the throwable to determine if it's reportable", e); } else { reportException(name, e); } }

Target:
private static void reportException(@Nonnull Throwable e) { if (enabled()) { String name = e.getMessage(); if (name == null || name.trim().isEmpty()) { LOGGER.log(Level.INFO, "No class name could be extracted from the throwable to determine if it's reportable", e); } else { reportException(name, e); } } }
Source:
void does_not_print_duplicate_snippets() { bus.send(new SnippetsSuggestedEvent( bus.getInstant(), URI.create("classpath:com/example.feature"), 12, 13, singletonList("snippet") )); bus.send(new SnippetsSuggestedEvent( bus.getInstant(), URI.create("classpath:com/example.feature"), 12, 14, singletonList("snippet") )); bus.send(new TestRunFinished( bus.getInstant() )); assertThat(new String(out.toByteArray(), UTF_8), is("" + LINE_ENDING + "0 Scenarios" + LINE_ENDING + "0 Steps" + LINE_ENDING + "0m0.000s" + LINE_ENDING + LINE_ENDING + LINE_ENDING + "You can implement missing steps with the snippets below:" + LINE_ENDING + LINE_ENDING + "snippet" + LINE_ENDING + LINE_ENDING + LINE_ENDING )); }

Target:
void does_not_print_duplicate_snippets() { bus.send(new SnippetsSuggestedEvent( bus.getInstant(), URI.create("classpath:com/example.feature"), 12, 13, singletonList("snippet") )); bus.send(new SnippetsSuggestedEvent( bus.getInstant(), URI.create("classpath:com/example.feature"), 12, 14, singletonList("snippet") )); bus.send(new TestRunFinished( bus.getInstant() )); assertThat(new String(out.toByteArray(), UTF_8), equalToCompressingWhiteSpace("" + "\n" + "0 Scenarios\n" + "0 Steps\n" + "0m0.000s\n" + "\n" + "\n" + "You can implement missing steps with the snippets below:\n" + "\n" + "snippet\n" + "\n" + "\n" )); }
Source:
public List<String> getColumnsCopy() { List<String> list = new ArrayList<String>(); for (String string : m_columns) { if (StringConstants.UNICODE_NULL.equals(string)) { list.add(null); } else { list.add(string); } } return list; }

Target:
public List<String> getColumnsCopy() { List<String> list = new ArrayList<String>(getColumnCount()); for (String string : getColumns()) { if (StringConstants.UNICODE_NULL.equals(string)) { list.add(null); } else { list.add(string); } } return list; }
Source:
public void partDeactivated(IWorkbenchPart part) { fTraceSelected = false; }

Target:
public void partDeactivated(IWorkbenchPart part) { }
Source:
public Image selectById(UUID id) { Image image = sqlConnection.createQuery(ImageQueries.selectById) .setAutoDeriveColumnNames(true) .addParameter("id", id) .executeAndFetchFirst(Image.class); if(image != null && image.getImageContent() != null) { image.setHash(GuavaHashGenerator.calculateHash(image.getImageContent())); } return image; }

Target:
public Image selectById(UUID id) { Image image = sqlConnection.createQuery(ImageQueries.selectById) .setAutoDeriveColumnNames(true) .addParameter("id", id) .executeAndFetchFirst(Image.class); if(imageIsHashable(image)) { image.setHash(GuavaHashGenerator.calculateHash(image.getImageContent())); } return image; }
Source:
public XWikiAttachment addAttachment(XWikiDocument doc, byte[] data, String filename, String username, String comment) throws AttachmentToBigException, AddingAttachmentContentFailedException, DocumentSaveException { ByteArrayInputStream in = null; try { in = new ByteArrayInputStream(data); return addAttachment(doc, in, filename, username, comment); } finally { if(in != null) { try { in.close(); } catch (IOException ioe) { _LOGGER.error("Exception in byte[] to InputStream", ioe); } } } }

Target:
public XWikiAttachment addAttachment(XWikiDocument doc, byte[] data, String filename, String username, String comment) throws AttachmentToBigException, AddingAttachmentContentFailedException, DocumentSaveException { ByteArrayInputStream dataStream = null; try { dataStream = new ByteArrayInputStream(data); return addAttachment(doc, dataStream, filename, username, comment); } finally { IOUtils.closeQuietly(dataStream); } }
Source:
public JsonNode getUserSettings() { JsonNode output = null; String homeDir = System.getProperty("user.home"); String settingsPath = ""; ObjectMapper mapper = new ObjectMapper(); try { if (Platform.isWindows()) { settingsPath = Paths.get(System.getenv("APPDATA"), "Code", "User", "settings.json") .toString(); } else if (Platform.isMac()) { settingsPath = Paths.get(homeDir, "Library", "Application Support", "Code", "User", "settings.json").toString(); } else if (Platform.isLinux()) { settingsPath = Paths.get(homeDir, ".config", "Code", "User", "settings.json") .toString(); } File settingsFile = new File(settingsPath); output = mapper.readTree(settingsFile); } catch (Exception e) { return output; } return output; }

Target:
private JsonNode getUserSettings() { JsonNode output = null; String homeDir = System.getProperty("user.home"); String settingsPath = ""; ObjectMapper mapper = new ObjectMapper(); try { if (Platform.isWindows()) { settingsPath = Paths.get(System.getenv("APPDATA"), "Code", "User", "settings.json") .toString(); } else if (Platform.isMac()) { settingsPath = Paths.get(homeDir, "Library", "Application Support", "Code", "User", "settings.json").toString(); } else if (Platform.isLinux()) { settingsPath = Paths.get(homeDir, ".config", "Code", "User", "settings.json") .toString(); } else { throw logger.logExceptionAsError( new CredentialUnavailableException(PLATFORM_NOT_SUPPORTED_ERROR)); } File settingsFile = new File(settingsPath); output = mapper.readTree(settingsFile); } catch (Exception e) { return null; } return output; }
Source:
private void addOrUpdateNewActivityCategories(Set<ActivityCategoryDto> activityCategoryDtos, Set<ActivityCategory> activityCategoriesInRepository) { Map<UUID, ActivityCategory> activityCategoriesInRepositoryMap = activityCategoriesInRepository.stream() .collect(Collectors.toMap(ActivityCategory::getId, ac -> ac)); activityCategoryDtos.stream() .forEach(actCat -> addOrUpdateNewActivityCategory(actCat, activityCategoriesInRepositoryMap)); }

Target:
private void addOrUpdateNewActivityCategories(Set<ActivityCategoryDto> activityCategoryDtos, Set<ActivityCategory> activityCategoriesInRepository) { Map<UUID, ActivityCategory> activityCategoriesInRepositoryMap = activityCategoriesInRepository.stream() .collect(Collectors.toMap(ActivityCategory::getId, ac -> ac)); activityCategoryDtos.stream().forEach(a -> addOrUpdateNewActivityCategory(a, activityCategoriesInRepositoryMap)); }
Source:
public void testCreateSymlinkOverrideExisting() throws IOException { FS fs = FS.DETECTED; Assume.assumeTrue(fs.supportsSymlinks()); File file = new File(trash, "x"); fs.createSymLink(file, "y"); assertTrue(fs.supportsSymlinks()); String target = fs.readSymLink(file); assertEquals("y", target); fs.createSymLink(file, "z"); target = fs.readSymLink(file); assertEquals("z", target); }

Target:
public void testCreateSymlinkOverrideExisting() throws IOException { FS fs = FS.DETECTED; Assume.assumeTrue(fs.supportsSymlinks()); File file = new File(trash, "x"); fs.createSymLink(file, "y"); String target = fs.readSymLink(file); assertEquals("y", target); fs.createSymLink(file, "z"); target = fs.readSymLink(file); assertEquals("z", target); }
Source:
public void write(StreamsDatum streamsDatum) { if(streamsDatum == null || streamsDatum.getDocument() == null) return; checkForBackOff(); String index = Optional.fromNullable( (String) streamsDatum.getMetadata().get("index")) .or(""); String type = Optional.fromNullable( (String) streamsDatum.getMetadata().get("type")) .or(config.getType()); String id = Optional.fromNullable( (String) streamsDatum.getMetadata().get("id")) .or(streamsDatum.getId()); if(config.getForceUseConfig()) { index = config.getIndex(); type = config.getType(); } try { add(index, type, id, streamsDatum.getTimestamp() == null ? Long.toString(DateTime.now().getMillis()) : Long.toString(streamsDatum.getTimestamp().getMillis()), convertAndAppendMetadata(streamsDatum)); } catch (Throwable e) { LOGGER.warn("Unable to Write Datum to ElasticSearch: {}", e.getMessage()); } }

Target:
public void write(StreamsDatum streamsDatum) { if(streamsDatum == null || streamsDatum.getDocument() == null) return; checkForBackOff(); String index = (String) streamsDatum.getMetadata().get("index"); String type = (String) streamsDatum.getMetadata().get("type"); String id = Optional.fromNullable( (String) streamsDatum.getMetadata().get("id")) .or(streamsDatum.getId()); if(index == null || (config.getForceUseConfig() != null && config.getForceUseConfig())) { index = config.getIndex(); } if(type == null || (config.getForceUseConfig() != null && config.getForceUseConfig())) { type = config.getType(); } try { add(index, type, id, streamsDatum.getTimestamp() == null ? Long.toString(DateTime.now().getMillis()) : Long.toString(streamsDatum.getTimestamp().getMillis()), convertAndAppendMetadata(streamsDatum)); } catch (Throwable e) { LOGGER.warn("Unable to Write Datum to ElasticSearch: {}", e.getMessage()); } }
Source:
protected IStatus run(final IProgressMonitor monitor) { try { Logger.trace(Activator.PLUGIN_ID, TRACE_SCRIPT_ENGINE, "Engine started: " + getName()); if (!setupEngine()) { throw new ScriptEngineException("Unknown setup failure"); } fSetupDone = true; for (final Entry<String, Object> entry : fBufferedVariables.entrySet()) { setVariable(entry.getKey(), entry.getValue()); } fBufferedVariables.clear(); fStackTrace.clear(); notifyExecutionListeners(null, IExecutionListener.ENGINE_START); while ((!monitor.isCanceled()) && (!isTerminated())) { if (!fCodePieces.isEmpty()) { final Script piece = fCodePieces.remove(0); inject(piece, true, false); } else { synchronized (this) { if (!isTerminated()) { try { Logger.trace(Activator.PLUGIN_ID, TRACE_SCRIPT_ENGINE, "Engine idle: " + getName()); wait(); } catch (final InterruptedException e) { } } } } } discardCodePieces(); notifyExecutionListeners(null, IExecutionListener.ENGINE_END); teardownEngine(); fTerminated = true; synchronized (this) { notifyAll(); } if (isTerminated()) return Status.OK_STATUS; return Status.CANCEL_STATUS; } catch (ScriptEngineException e) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Could not setup script engine", e); } finally { discardCodePieces(); closeStreams(); Logger.trace(Activator.PLUGIN_ID, TRACE_SCRIPT_ENGINE, "Engine terminated: " + getName()); } }

Target:
protected IStatus run(final IProgressMonitor monitor) { IStatus returnStatus = Status.OK_STATUS; try { Logger.trace(Activator.PLUGIN_ID, TRACE_SCRIPT_ENGINE, "Engine started: " + getName()); setupEngine(); fSetupDone = true; for (final Entry<String, Object> entry : fBufferedVariables.entrySet()) { setVariable(entry.getKey(), entry.getValue()); } fBufferedVariables.clear(); fStackTrace.clear(); notifyExecutionListeners(null, IExecutionListener.ENGINE_START); while ((!monitor.isCanceled()) && (!isTerminated())) { if (!fCodePieces.isEmpty()) { final Script piece = fCodePieces.remove(0); inject(piece, true, false); } else { synchronized (this) { if (!isTerminated()) { try { Logger.trace(Activator.PLUGIN_ID, TRACE_SCRIPT_ENGINE, "Engine idle: " + getName()); wait(); } catch (final InterruptedException e) { } } } } } if (!isTerminated()){ returnStatus = Status.OK_STATUS; } else { returnStatus = Status.CANCEL_STATUS; } } catch (ScriptEngineException e) { returnStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Could not setup script engine", e); } finally { synchronized (fCodePieces) { for (final Script script : fCodePieces) script.setException(new ExitException()); } fCodePieces.clear(); notifyExecutionListeners(null, IExecutionListener.ENGINE_END); try { teardownEngine(); } catch (ScriptEngineException e) { if (returnStatus.getSeverity() < IStatus.ERROR) { returnStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Could not teardown script engine", e); } } finally { fTerminated = true; synchronized (this) { notifyAll(); } synchronized (fCodePieces) { for (final Script script : fCodePieces) script.setException(new ExitException()); fCodePieces.clear(); } closeStreams(); Logger.trace(Activator.PLUGIN_ID, TRACE_SCRIPT_ENGINE, "Engine terminated: " + getName()); } } return returnStatus; }
Source:
CacheProvider(final boolean disk, CacheModule module, TypeLiteral<Cache<K, V>> typeLiteral) { this.disk = disk; this.module = module; memoryLimit(1024); maxAge(90, DAYS); evictionPolicy(LFU); Type[] tmp = ((ParameterizedType) typeLiteral.getType()).getActualTypeArguments(); keyClass = (Class<K>) tmp[0]; valueClass = (Class<V>) tmp[1]; for (Constructor c : valueClass.getDeclaredConstructors()) { if (c.getAnnotation(Inject.class) != null) { valueProvider = module.getValueProvider(valueClass); } } ProtobufCodec<K> keyCodec = CodecFactory.encoder(keyClass); K k = keyCodec.decode(new byte[0]); if (k == null) { throw new IllegalStateException("Cannot support " + keyClass + " on protobuf"); } if (valueProvider == null) { ProtobufCodec<V> valueCodec = CodecFactory.encoder(valueClass); V v = valueCodec.decode(new byte[0]); if (v == null) { throw new IllegalStateException("Cannot support " + valueClass + " on protobuf"); } } if (disk) { diskLimit(16384); } }

Target:
CacheProvider(final boolean disk, CacheModule module, TypeLiteral<Cache<K, V>> typeLiteral) { this.disk = disk; this.module = module; memoryLimit(1024); maxAge(90, DAYS); evictionPolicy(LFU); Type[] tmp = ((ParameterizedType) typeLiteral.getType()).getActualTypeArguments(); keyClass = (Class<K>) tmp[0]; valueClass = (Class<V>) tmp[1]; for (Constructor c : valueClass.getDeclaredConstructors()) { if (c.getAnnotation(Inject.class) != null) { valueProvider = module.getValueProvider(valueClass); } } try { ProtobufCodec<K> keyCodec = CodecFactory.encoder(keyClass); keyCodec.decode(new byte[0]); } catch (RuntimeException err) { throw new IllegalStateException("Cannot support " + keyClass + " in protobuf format", err); } if (valueProvider == null) { try { ProtobufCodec<V> valueCodec = CodecFactory.encoder(valueClass); valueCodec.decode(new byte[0]); } catch (RuntimeException err) { throw new IllegalStateException("Cannot support " + valueClass + " in protobuf format", err); } } if (disk) { diskLimit(16384); } }
Source:
final public void execute() { if (isSafe()) { executeIfSafe(); return; } cancel(); if (reasonUnsafe == null) { reasonUnsafe = "the required safety conditions haven't been met"; } LogKitten.e("SafetyCommand " + getName() + " cannot run because " + reasonUnsafe + ". Cancelling..."); }

Target:
public final void execute() { if (isSafe()) { executeIfSafe(); return; } cancel(); if (reasonUnsafe == null) { reasonUnsafe = "the required safety conditions haven't been met"; } LogKitten.e("SafetyCommand " + getName() + " cannot run because " + reasonUnsafe + ". Cancelling..."); }
Source:
public LocalMemoryContext localUserMemoryContext() { return new UncloseableLocalMemoryContext(new InternalLocalMemoryContext(operatorMemoryContext.localUserMemoryContext(), memoryFuture)); }

Target:
public LocalMemoryContext localUserMemoryContext() { return new InternalLocalMemoryContext(operatorMemoryContext.localUserMemoryContext(), memoryFuture, this::updatePeakMemoryReservations, false); }
Source:
public boolean isSupported() { return version.compareTo(MINIMUM_SUPPORTED_VERSION) >= 0 && version.compareTo(MAXIMUM_SUPPORTED_VERSION) < 0; }

Target:
public boolean isSupported() { return version.compareTo(MINIMUM_SUPPORTED_VERSION) >= 0 && version.compareTo(MAXIMUM_SUPPORTED_VERSION) <= 0; }
Source:
private boolean rowsAreEqual(SearchRow rowOne, SearchRow rowTwo) { if (rowOne == rowTwo) { return true; } for (int index : columnIds) { Value v1 = rowOne.getValue(index); Value v2 = rowTwo.getValue(index); if (v1 == null ? v2 != null : !v1.equals(v2)) { break; } } return rowOne.getKey() == rowTwo.getKey(); }

Target:
private boolean rowsAreEqual(SearchRow rowOne, SearchRow rowTwo) { if (rowOne == rowTwo) { return true; } for (int index : columnIds) { Value v1 = rowOne.getValue(index); Value v2 = rowTwo.getValue(index); if (v1 == null ? v2 != null : !v1.equals(v2)) { return false; } } return rowOne.getKey() == rowTwo.getKey(); }
Source:
public boolean recoverOne(int hostId, Integer portOffset, String rejoinHost, boolean liveRejoin) { if (isNewCli) { return recoverOne( false, 0, hostId, portOffset, rejoinHost, StartAction.PROBE); } else { return recoverOne( false, 0, hostId, portOffset, rejoinHost, liveRejoin ? StartAction.LIVE_REJOIN : StartAction.REJOIN); } }

Target:
public boolean recoverOne(int hostId, Integer portOffset, String rejoinHost, boolean liveRejoin) { StartAction startAction = isNewCli ? StartAction.PROBE : (liveRejoin ? StartAction.LIVE_REJOIN : StartAction.REJOIN); return recoverOne( false, 0, hostId, portOffset, rejoinHost, startAction); }
Source:
public void setDelay(int delay) { this.delayExpression = new SupplierExpression<>(() -> delay); }

Target:
public void setDelay(int delay) { this.delayExpression = new ValueExpression<>(delay); }
Source:
private void setDataView(Content content) { if (content == null) { this.resetComponent(); return; } this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (content.getSize() == 0) { return; } byte[] data = new byte[(int) content.getSize()]; try { content.read(data, 0x0, content.getSize()); } catch (TskCoreException ex) { logger.log(Level.WARNING, "Failed to read file content.", ex); } ByteBuffer buf = ByteBuffer.wrap(data); RegistryHive h = new RegistryHiveBuffer(buf); this.regview = new RejView(h); this.add(this.regview, BorderLayout.CENTER); this.setCursor(null); }

Target:
private void setDataView(Content content) { if (content == null) { this.resetComponent(); return; } this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (content.getSize() == 0) { return; } byte[] data = new byte[(int) content.getSize()]; try { content.read(data, 0x0, content.getSize()); } catch (TskCoreException ex) { logger.log(Level.WARNING, "Failed to read file content.", ex); return; } ByteBuffer buf = ByteBuffer.wrap(data); RegistryHive h = new RegistryHiveBuffer(buf); this.regview = new RejView(h); this.add(this.regview, BorderLayout.CENTER); this.setCursor(null); }
Source:
public static void waitSuccessCondition( BooleanSupplier condition, long timeout, long delayBetweenAttemptsInMilliseconds, TimeUnit timeoutTimeUnit) throws InterruptedException { final long waitingTime = timeoutTimeUnit.toMillis(timeout); final long startingTime = System.currentTimeMillis(); final long finishTime = startingTime + waitingTime; Callable<Boolean> waitTrueState = () -> { while (System.currentTimeMillis() <= finishTime) { if (condition.getAsBoolean()) { return true; } sleepQuietly(delayBetweenAttemptsInMilliseconds, TimeUnit.MILLISECONDS); } throw new TimeoutException( "The condition has not being in \"true\" state during timeout"); }; List<Future<Boolean>> result = Executors.newSingleThreadScheduledExecutor() .invokeAll(asList(waitTrueState), timeout, timeoutTimeUnit); if (result.get(0).isCancelled()) { throw new TimeoutException("The condition has not being in \"true\" state during timeout"); } }

Target:
public static void waitSuccessCondition( BooleanSupplier condition, long timeout, long delayBetweenAttemptsInMilliseconds, TimeUnit timeoutTimeUnit) throws InterruptedException, TimeoutException { ExecutorService executor = Executors.newSingleThreadExecutor(); executor.submit( () -> { while (!condition.getAsBoolean()) { sleepQuietly(delayBetweenAttemptsInMilliseconds, TimeUnit.MILLISECONDS); } }); executor.shutdown(); if (!executor.awaitTermination(timeout, timeoutTimeUnit)) { throw new TimeoutException( String.format( "Expected condition failed: waiting for %s %s with %s MILLISECONDS interval", timeout, timeoutTimeUnit, delayBetweenAttemptsInMilliseconds)); } }
Source:
public ReaderWebView(Context context, AttributeSet attrs) { super(context, attrs); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.BoundedWidth); mBoundedWidth = a.getDimensionPixelSize(R.styleable.BoundedWidth_bounded_width, 0); a.recycle(); init(); }

Target:
public ReaderWebView(Context context, AttributeSet attrs) { super(context, attrs); init(); }
Source:
protected boolean checkLevelExists(int level) { return !(level < levelQuarks.size() || level >= 0); }

Target:
protected boolean checkLevelExists(int level) { return !(level >= levelQuarks.size() || level < 0); }
Source:
public void setAndInitZkEventThreadMonitor(ZkEventThread zkEventThread) { if (_zkEventThreadMetric == null) { _zkEventThreadMetric = new ZkThreadMetric(zkEventThread); } }

Target:
public synchronized boolean setAndInitZkEventThreadMonitor(ZkEventThread zkEventThread) { if (_zkEventThreadMetric == null) { _zkEventThreadMetric = new ZkThreadMetric(zkEventThread); return true; } return false; }
Source:
@Override protected void onStart() { super.onStart(); adapter.setLogs(lumberYard.bufferedLogs()); subscriptions = new CompositeSubscription(); subscriptions.add(lumberYard.logs() .subscribeOn(AndroidSchedulers.mainThread()) .subscribe(adapter)); }

Target:
@Override protected void onStart() { super.onStart(); adapter.setLogs(lumberYard.bufferedLogs()); subscriptions = new CompositeSubscription(); subscriptions.add(lumberYard.logs() .observeOn(AndroidSchedulers.mainThread()) .subscribe(adapter)); }