auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void moveMigratedFiles( File migrationDir, File storeDir, String versionToUpgradeFrom, String versionToMigrateTo ) throws IOException { if ( deleteObsoleteIndexes ) { deleteIndexes( schemaIndexDirectory ); } deleteIndexes( LuceneLabelScanDirectory.getLuceneStoreDirectory( storeDir ) ); }

Target:
public void moveMigratedFiles( File migrationDir, File storeDir, String versionToUpgradeFrom, String versionToMigrateTo ) throws IOException { if ( deleteObsoleteIndexes ) { deleteIndexes( schemaIndexDirectory ); } deleteIndexes( getLuceneStoreDirectory( storeDir ) ); }
Source:
public static State getState(String stateString) { if(stateString.equalsIgnoreCase(MachineStates.IN_USE)) return IN_USE; if(stateString.equalsIgnoreCase(MachineStates.AVAILABLE)) return AVAILABLE; if(stateString.equalsIgnoreCase(MachineStates.ALMOST_DONE)) return ALMOST_DONE; if(stateString.equalsIgnoreCase(MachineStates.END_CYCLE)) return END_CYCLE; if(stateString.equalsIgnoreCase(MachineStates.READY)) return READY; return null; }

Target:
public static State getState(String stateString) { for(State state : values()) { if(stateString.equalsIgnoreCase(state.toString())) return state; } return null; }
Source:
public void setCarrier(Context context) { String carrier = Util.getCarrier(context); if (carrier != null) { putToMobile(Parameters.CARRIER, carrier); } }

Target:
public void setCarrier(Context context) { String carrier = Util.getCarrier(context); if (carrier != null) { addToMobileContext(Parameters.CARRIER, carrier); } }
Source:
public void validate(JsonValue value) { super.validate(value); Id testId = new Id(value.asString()); boolean isValueExist = ids.contains(testId); if (!isValueExist) { throw new IllegalArgumentException(testId + " is not exist in next rule id list: " + ids + "."); } }

Target:
public void validate(JsonValue value) { super.validate(value); Id testId = new Id(value.asString()); if (!searchIds.contains(testId)) { throw new IllegalArgumentException(testId + " is not a valid Id"); } }
Source:
void pushGradients(final int inputSize, final LayerParameter[] parameterGradients) { for (int i = 0; i < parameterGradients.length; ++i) { parameterGradients[i].getWeightParam().divi(inputSize); parameterGradients[i].getBiasParam().divi(inputSize); if (layers[i].isLearnable()) { parameterWorker.push(i, parameterGradients[i]); } } }

Target:
void pushGradients(final int inputSize, final LayerParameter[] parameterGradients) { for (int i = 0; i < parameterGradients.length; ++i) { if (layers[i].isLearnable()) { parameterGradients[i].getWeightParam().divi(inputSize); parameterGradients[i].getBiasParam().divi(inputSize); parameterWorker.push(i, parameterGradients[i]); } } }
Source:
public void testDoesNotCreateJoinWhenPartitionedOnCrossJoin() { PlanNodeIdAllocator idAllocator = new PlanNodeIdAllocator(); PlanBuilder planBuilder = new PlanBuilder(idAllocator, queryRunner.getMetadata()); Symbol a1 = planBuilder.symbol("A1", BIGINT); Symbol b1 = planBuilder.symbol("B1", BIGINT); MultiJoinNode multiJoinNode = new MultiJoinNode( new LinkedHashSet<>(ImmutableList.of(planBuilder.values(a1), planBuilder.values(b1))), TRUE_LITERAL, ImmutableList.of(a1, b1)); SymbolAllocator symbolAllocator = new SymbolAllocator(); CachingStatsProvider statsProvider = new CachingStatsProvider( queryRunner.getStatsCalculator(), Optional.empty(), noLookup(), queryRunner.getDefaultSession(), symbolAllocator::getTypes); CachingCostProvider costProvider = new CachingCostProvider( queryRunner.getCostCalculator(), statsProvider, Optional.empty(), noLookup(), queryRunner.getDefaultSession(), symbolAllocator::getTypes); ReorderJoins.JoinEnumerator joinEnumerator = new ReorderJoins.JoinEnumerator( queryRunner.getDefaultSession(), costProvider, new CostComparator(1, 1, 1), idAllocator, multiJoinNode.getFilter(), noLookup()); JoinEnumerationResult actual = joinEnumerator.createJoinAccordingToPartitioning(multiJoinNode.getSources(), multiJoinNode.getOutputSymbols(), ImmutableSet.of(0)); assertFalse(actual.getPlanNode().isPresent()); }

Target:
public void testDoesNotCreateJoinWhenPartitionedOnCrossJoin() { PlanNodeIdAllocator idAllocator = new PlanNodeIdAllocator(); PlanBuilder planBuilder = new PlanBuilder(idAllocator, queryRunner.getMetadata()); Symbol a1 = planBuilder.symbol("A1", BIGINT); Symbol b1 = planBuilder.symbol("B1", BIGINT); MultiJoinNode multiJoinNode = new MultiJoinNode( new LinkedHashSet<>(ImmutableList.of(planBuilder.values(a1), planBuilder.values(b1))), TRUE_LITERAL, ImmutableList.of(a1, b1)); SymbolAllocator symbolAllocator = new SymbolAllocator(); CachingStatsProvider statsProvider = new CachingStatsProvider( queryRunner.getStatsCalculator(), Optional.empty(), noLookup(), queryRunner.getDefaultSession(), symbolAllocator::getTypes); CachingCostProvider costProvider = new CachingCostProvider( queryRunner.getCostCalculator(), statsProvider, Optional.empty(), noLookup(), queryRunner.getDefaultSession(), symbolAllocator::getTypes); ReorderJoins.JoinEnumerator joinEnumerator = new ReorderJoins.JoinEnumerator( queryRunner.getDefaultSession(), costProvider, new CostComparator(1, 1, 1), idAllocator, multiJoinNode.getFilter(), noLookup(), new Rule.Context() { @Override public Lookup getLookup() { return null; } @Override public PlanNodeIdAllocator getIdAllocator() { return null; } @Override public SymbolAllocator getSymbolAllocator() { return null; } @Override public Session getSession() { return null; } @Override public StatsProvider getStatsProvider() { return null; } @Override public CostProvider getCostProvider() { return null; } @Override public void checkTimeoutNotExhausted() }); JoinEnumerationResult actual = joinEnumerator.createJoinAccordingToPartitioning(multiJoinNode.getSources(), multiJoinNode.getOutputSymbols(), ImmutableSet.of(0)); assertFalse(actual.getPlanNode().isPresent()); }
Source:
public void resume() { super.resume(); currentFailureStartTime = null; currentRecoveryStartTime = null; lastPublished = LastPublished.NONE; executorQueued.set(false); executorTime = 0; ScheduledTask task = new ScheduledTask(MutableMap.of("period", getConfig(POLL_PERIOD)), pollingTaskFactory); scheduledTask = ((EntityInternal)entity).getExecutionContext().submit(task); }

Target:
public void resume() { currentFailureStartTime = null; currentRecoveryStartTime = null; lastPublished = LastPublished.NONE; executorQueued.set(false); executorTime = 0; super.resume(); doStartPolling(); }
Source:
public static void setQueries(List<String> queries, Configuration conf) throws IOException { Preconditions.checkNotNull(queries); Preconditions.checkArgument(!queries.isEmpty()); conf.set(QUERIES_KEY, JSONArray.toJSONString(queries)); }

Target:
public static void setQueries(List<String> queries, Configuration conf) throws IOException { Preconditions.checkNotNull(queries); Preconditions.checkArgument(!queries.isEmpty()); HadoopUtils.writeStringListToConfAsJson(QUERIES_KEY, queries, conf); }
Source:
public void run(TransformContext context, GtfsMutableRelationalDao dao) { int removed = 0; int total = 0; for (Trip trip : dao.getAllTrips()) { List<StopTime> stopTimes = dao.getStopTimesForTrip(trip); int tripLength = stopTimes.size(); for (int i =1; i < tripLength; i++) { total++; StopTime stopTime = stopTimes.get(i); if (isNonRevenue(stopTime) && !isFirstOrLast(i, tripLength)){ dao.removeEntity(stopTime); removed++; } } } _log.info("removed=" + removed + " total=" + total); UpdateLibrary.clearDaoCache(dao); }

Target:
public void run(TransformContext context, GtfsMutableRelationalDao dao) { int removedStopTimeCount = 0; int totalStopTimeCount = 0; for (Trip trip : dao.getAllTrips()) { List<StopTime> stopTimes = dao.getStopTimesForTrip(trip); int tripLength = stopTimes.size(); for (int i =0; i < tripLength; i++) { totalStopTimeCount++; StopTime stopTime = stopTimes.get(i); if (isNonRevenue(stopTime) && !isFirstOrLast(i, tripLength)) { dao.removeEntity(stopTime); removedStopTimeCount++; } } } _log.info("removed=" + removedStopTimeCount + " total=" + totalStopTimeCount); UpdateLibrary.clearDaoCache(dao); }
Source:
public void testQueryAllElementsWithAttribute() throws Exception { final String xpath = " final DetailAST rootAst = getRootAst("InputXpathMapperAst.java"); final RootNode rootNode = new RootNode(rootAst); final List<Item> nodes = getXpathItems(xpath, rootNode); assertEquals(17, nodes.size()); }

Target:
public void testQueryAllElementsWithAttribute() throws Exception { final String xpath = " final RootNode rootNode = getRootNode("InputXpathMapperAst.java"); final List<Item> nodes = getXpathItems(xpath, rootNode); assertEquals("Invalid number of nodes", 17, nodes.size()); }
Source:
public WorkflowAction findAction(final String id, final User user) throws DotDataException, DotSecurityException { final WorkflowAction workflowAction = this.workFlowFactory.findAction(id); if(null != workflowAction){ if (!SYSTEM_WORKFLOW_ID.equals(workflowAction.getSchemeId())) { if (!hasValidLicense() && !this.getFriendClass().isFriend()) { throw new DotSecurityException( "You must have a valid license to see any available action."); } } } return workflowAction; }

Target:
public WorkflowAction findAction(final String id, final User user) throws DotDataException, DotSecurityException { final WorkflowAction workflowAction = this.workFlowFactory.findAction(id); if(null != workflowAction){ if (!SYSTEM_WORKFLOW_ID.equals(workflowAction.getSchemeId())) { if (!hasValidLicense() && !this.getFriendClass().isFriend()) { throw new DotSecurityException("Workflow-Actions-License-required"); } } } return workflowAction; }
Source:
public void TestGameStarLogo_001_gameStarLogoPresentOnBigResolution() { String url = urlBuilder.getUrlForPath(wikiName, ""); GlobalNavigationPageObject globalNavigation = new GlobalNavigationPageObject(driver); globalNavigation.getUrl(url); globalNavigation.resizeWindow(bigResolution); Assertion.assertTrue(globalNavigation.GameStarLinkDisplay(), "GameStar Logo should be visible"); }

Target:
public void TestGameStarLogo_001_gameStarLogoPresentOnBigResolution() { HomePageObject homePage = new HomePageObject(driver); VenusGlobalNavPageObject globalNav = new VenusGlobalNavPageObject(driver); homePage.openWikiPage(urlBuilder.getUrlForWiki(deWikiName)); homePage.resizeWindow(SHOW_LOGO_RESOLUTION); Assertion.assertTrue(globalNav.isGameStarLogoDisplayed(), "GameStar Logo should be visible"); }
Source:
public String toString() { return "EmailAddress{" + "value='" + value + '\'' + '}'; }

Target:
public String toString() { return "EmailAddress{" + value + "}"; }
Source:
@Config(reportSdk = GINGERBREAD) @Test public void responseSourceHeaderSetsResponseValue() throws Exception { server.enqueue(new MockResponse()); Downloader.Response response1 = loader.load(URL, false); assertThat(response1.cached).isFalse(); server.enqueue(new MockResponse().addHeader(RESPONSE_SOURCE, "CACHE 200")); Downloader.Response response2 = loader.load(URL, true); assertThat(response2.cached).isTrue(); }

Target:
@Test public void responseSourceHeaderSetsResponseValue() throws Exception { server.enqueue(new MockResponse()); Downloader.Response response1 = loader.load(URL, false); assertThat(response1.cached).isFalse(); server.enqueue(new MockResponse().addHeader(RESPONSE_SOURCE, "CACHE 200")); Downloader.Response response2 = loader.load(URL, true); assertThat(response2.cached).isTrue(); }
Source:
public void testSetGetDeleteField() { final String uuid = UUID.randomUUID().toString(); factory.set(uuid, DepositField.contactName, "Boxy"); factory.set(uuid, DepositField.fileName, "boxys_file.txt"); Map<String,String> status = factory.get(uuid); assertTrue(status.size() == 2); assertEquals("Boxy", status.get(DepositField.contactName.toString())); assertEquals("boxys_file.txt", status.get(DepositField.fileName.toString())); factory.deleteField(uuid, DepositField.fileName); status = factory.get(uuid); assertNull(status.get(DepositField.fileName.toString())); assertTrue(status.size() == 1); final String uuid2 = UUID.randomUUID().toString(); factory.set(uuid2, DepositField.depositorName, "FriendOfBoxy"); Set<Map<String,String>> statuses = factory.getAll(); assertEquals(statuses.size(), 2); }

Target:
public void testSetGetDeleteField() { final String uuid = UUID.randomUUID().toString(); factory.set(uuid, DepositField.contactName, "Boxy"); factory.set(uuid, DepositField.fileName, "boxys_file.txt"); Map<String,String> status = factory.get(uuid); assertEquals(status.size(), 2); assertEquals("Boxy", status.get(DepositField.contactName.toString())); assertEquals("boxys_file.txt", status.get(DepositField.fileName.toString())); factory.deleteField(uuid, DepositField.fileName); status = factory.get(uuid); assertNull(status.get(DepositField.fileName.toString())); assertEquals(status.size(), 1); final String uuid2 = UUID.randomUUID().toString(); factory.set(uuid2, DepositField.depositorName, "FriendOfBoxy"); Set<Map<String,String>> statuses = factory.getAll(); assertEquals(statuses.size(), 2); }
Source:
private void updateActionAvailability() { boolean allowRestore = false; boolean allowDelete = true; boolean allowDeleteAll = true; boolean allowActivate = false; boolean allowDeactivate = false; boolean allowCreateSnapshot = true; boolean allowEditSnapshotSchedule = false; if (getSelectedItems() == null || getSelectedItems().size() == 0) { allowDelete = false; } else { List<GlusterVolumeSnapshotEntity> snapshots = Linq.<GlusterVolumeSnapshotEntity> cast(getSelectedItems()); if (snapshots.size() == 1) { allowRestore = true; allowActivate = snapshots.get(0).getStatus() == GlusterSnapshotStatus.DEACTIVATED; allowDeactivate = snapshots.get(0).getStatus() == GlusterSnapshotStatus.ACTIVATED; } } if (getEntity() == null || getEntity().getStatus() != GlusterStatus.UP) { allowCreateSnapshot = false; } if (getEntity() != null && getEntity().getStatus() == GlusterStatus.UP && getEntity().getSnapshotScheduled()) { allowEditSnapshotSchedule = true; } getRestoreSnapshotCommand().setIsExecutionAllowed(allowRestore); getDeleteSnapshotCommand().setIsExecutionAllowed(allowDelete); getDeleteAllSnapshotsCommand().setIsExecutionAllowed(allowDeleteAll); getActivateSnapshotCommand().setIsExecutionAllowed(allowActivate); getDeactivateSnapshotCommand().setIsExecutionAllowed(allowDeactivate); getCreateSnapshotCommand().setIsExecutionAllowed(allowCreateSnapshot); getEditSnapshotScheduleCommand().setIsExecutionAllowed(allowEditSnapshotSchedule); }

Target:
private void updateActionAvailability() { boolean allowRestore = false; boolean allowDelete = true; boolean allowDeleteAll = true; boolean allowActivate = false; boolean allowDeactivate = false; boolean allowCreateSnapshot = true; boolean allowEditSnapshotSchedule = false; if (getSelectedItems() == null || getSelectedItems().size() == 0) { allowDelete = false; } else { List<GlusterVolumeSnapshotEntity> snapshots = Linq.<GlusterVolumeSnapshotEntity> cast(getSelectedItems()); if (snapshots.size() == 1) { allowRestore = true; allowActivate = snapshots.get(0).getStatus() == GlusterSnapshotStatus.DEACTIVATED; allowDeactivate = snapshots.get(0).getStatus() == GlusterSnapshotStatus.ACTIVATED; } } if (getEntity() == null || getEntity().getStatus() == GlusterStatus.DOWN) { allowCreateSnapshot = false; } if (getEntity() != null && getEntity().getStatus() == GlusterStatus.UP && getEntity().getSnapshotScheduled()) { allowEditSnapshotSchedule = true; } getRestoreSnapshotCommand().setIsExecutionAllowed(allowRestore); getDeleteSnapshotCommand().setIsExecutionAllowed(allowDelete); getDeleteAllSnapshotsCommand().setIsExecutionAllowed(allowDeleteAll); getActivateSnapshotCommand().setIsExecutionAllowed(allowActivate); getDeactivateSnapshotCommand().setIsExecutionAllowed(allowDeactivate); getCreateSnapshotCommand().setIsExecutionAllowed(allowCreateSnapshot); getEditSnapshotScheduleCommand().setIsExecutionAllowed(allowEditSnapshotSchedule); }
Source:
private void updateIrisListeningState() { boolean screenOn = isScreenOn(); mHandler.removeCallbacks(mRetryIrisAuthentication); boolean shouldListenForIris = shouldListenForIris(); if (shouldListenForIris && mIrisRunningState != IRIS_STATE_RUNNING) { startListeningForIris(); } else if (!shouldListenForIris && mIrisRunningState == IRIS_STATE_RUNNING) { stopListeningForIris(); } }

Target:
private void updateIrisListeningState() { mHandler.removeCallbacks(mRetryIrisAuthentication); boolean shouldListenForIris = shouldListenForIris(); Log.e(TAG, "updateIrisListeningState: shouldListenForIris: " + shouldListenForIris); if (shouldListenForIris && mIrisRunningState != IRIS_STATE_RUNNING) { startListeningForIris(); } else if (!shouldListenForIris && mIrisRunningState == IRIS_STATE_RUNNING) { stopListeningForIris(); } }
Source:
public void update() throws CTFException { Set<CTFStreamInputReader> readers = new HashSet<>(); for (ICTFStream stream : fTrace.getStreams()) { Set<CTFStreamInput> streamInputs = stream.getStreamInputs(); for (CTFStreamInput streamInput : streamInputs) { try (CTFStreamInputReader streamInputReader = new CTFStreamInputReader(checkNotNull(streamInput))) { if (!fStreamInputReaders.contains(streamInputReader)) { CTFStreamInputReader streamInputReaderToAdd = new CTFStreamInputReader(checkNotNull(streamInput)); streamInputReaderToAdd.readNextEvent(); fStreamInputReaders.add(streamInputReaderToAdd); readers.add(streamInputReaderToAdd); } } catch (IOException e) { Activator.logError(e.getMessage(), e); } } } long[] temp = fEventCountPerTraceFile; fEventCountPerTraceFile = new long[readers.size() + temp.length]; for (CTFStreamInputReader reader : readers) { fPrio.add(reader); } for (int i = 0; i < temp.length; i++) { fEventCountPerTraceFile[i] = temp[i]; } System.arraycopy(temp,0,fEventCountPerTraceFile,0,temp.length); }

Target:
public void update() throws CTFException { Set<CTFStreamInputReader> readers = new HashSet<>(); for (ICTFStream stream : fTrace.getStreams()) { Set<CTFStreamInput> streamInputs = stream.getStreamInputs(); for (CTFStreamInput streamInput : streamInputs) { try (CTFStreamInputReader streamInputReader = new CTFStreamInputReader(checkNotNull(streamInput))) { if (!fStreamInputReaders.contains(streamInputReader)) { CTFStreamInputReader streamInputReaderToAdd = new CTFStreamInputReader(checkNotNull(streamInput)); streamInputReaderToAdd.readNextEvent(); fStreamInputReaders.add(streamInputReaderToAdd); readers.add(streamInputReaderToAdd); } } catch (IOException e) { Activator.logError(e.getMessage(), e); } } } long[] temp = fEventCountPerTraceFile; fEventCountPerTraceFile = new long[readers.size() + temp.length]; for (CTFStreamInputReader reader : readers) { fPrio.add(reader); } System.arraycopy(temp, 0, fEventCountPerTraceFile, 0, temp.length); }
Source:
public ServiceOfferingVO findServiceOffering(final Long vmId, final long serviceOfferingId) { final short opendb = TransactionLegacy.currentTxn().getDatabaseId(); ServiceOfferingVO result = null; try (TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB)) { result = findById(vmId, serviceOfferingId); } catch (Exception e) { s_logger.error("Quota ServiceOfferingDaoImpl::findServiceOffering() failed due to: " + e.getMessage()); throw new CloudRuntimeException("Unable to find service offering for quota calculations"); } finally { TransactionLegacy.open(opendb).close(); } return result; }

Target:
public ServiceOfferingVO findServiceOffering(final Long vmId, final long serviceOfferingId) { return Transaction.execute(TransactionLegacy.CLOUD_DB, new TransactionCallback<ServiceOfferingVO>() { @Override public ServiceOfferingVO doInTransaction(final TransactionStatus status) { ServiceOfferingVO offering = findById(serviceOfferingId); if (offering.isDynamic()) { if (vmId == null) { throw new CloudRuntimeException("missing argument vmId"); } offering.setDynamicFlag(true); Map<String, String> dynamicOffering = userVmDetailsDao.listDetailsKeyPairs(vmId); return getcomputeOffering(offering, dynamicOffering); } return offering; } }); }
Source:
DeploymentToNodeMetadata(@Memoized Supplier<Set<? extends Location>> locations, GroupNamingConvention.Factory namingConvention, OSImageToImage osImageToImage, RoleSizeToHardware roleSizeToHardware, Map<String, Credentials> credentialStore) { this.nodeNamingConvention = checkNotNull(namingConvention, "namingConvention").createWithoutPrefix(); this.locations = checkNotNull(locations, "locations"); this.osImageToImage = checkNotNull(osImageToImage, "osImageToImage"); this.roleSizeToHardware = checkNotNull(roleSizeToHardware, "roleSizeToHardware"); this.credentialStore = checkNotNull(credentialStore, "credentialStore cannot be null"); }

Target:
DeploymentToNodeMetadata(@Memoized Supplier<Set<? extends Location>> locations, GroupNamingConvention.Factory namingConvention, OSImageToImage osImageToImage, RoleSizeToHardware roleSizeToHardware, Map<String, Credentials> credentialStore) { this.nodeNamingConvention = namingConvention.createWithoutPrefix(); this.locations = locations; this.osImageToImage = osImageToImage; this.roleSizeToHardware = roleSizeToHardware; this.credentialStore = credentialStore; }
Source:
List<T> newInstancesFromHeteroList(StaplerRequest req, Object formData, Collection<? extends Descriptor<T>> descriptors) throws FormException { List<T> items = new ArrayList<T>(); if (formData!=null) { for (Object o : JSONArray.fromObject(formData)) { JSONObject jo = (JSONObject)o; String kind = jo.optString("$class", null); if (kind == null) { kind = jo.getString("kind"); } Descriptor<T> d = find(descriptors, kind); if (d != null) { items.add(d.newInstance(req, jo)); } LOGGER.warning("Received unexpected formData for descriptor " + kind); } } return items; }

Target:
List<T> newInstancesFromHeteroList(StaplerRequest req, Object formData, Collection<? extends Descriptor<T>> descriptors) throws FormException { List<T> items = new ArrayList<T>(); if (formData!=null) { for (Object o : JSONArray.fromObject(formData)) { JSONObject jo = (JSONObject)o; Descriptor<T> d = null; String kind = jo.optString("kind", null); if (kind != null) { d = findById(descriptors, kind); } if (d == null) { kind = jo.getString("$class"); d = findByDescribableClassName(descriptors, kind); if (d == null) d = findByClassName(descriptors, kind); } if (d != null) { items.add(d.newInstance(req, jo)); } else { LOGGER.warning("Received unexpected formData for descriptor " + kind); } } } return items; }
Source:
public String init(String jsonData) { JSONObject enabledJsApi = new JSONObject(); JSONObject data = new JSONObject(jsonData); mCardSuppliedApiVersion = data.getString("version"); mCardSuppliedDeveloperContact = data.getString("developer"); if (TextUtils.isEmpty(mCardSuppliedApiVersion) && TextUtils.isEmpty(mCardSuppliedDeveloperContact )) { enabledJsApi.put("toggleFlag", "disabled"); enabledJsApi.put("markCard", "disabled"); } else if (requireApiVersion(mCardSuppliedApiVersion)) { enabledJsApi.put("toggleFlag", "enabled"); enabledJsApi.put("markCard", "enabled"); } else { enabledJsApi.put("toggleFlag", "disabled"); enabledJsApi.put("markCard", "disabled"); } return String.valueOf(enabledJsApi); }

Target:
public String init(String jsonData) { JSONObject enabledJsApi = new JSONObject(); JSONObject data = new JSONObject(); try { data = new JSONObject(jsonData); if (!(data == JSONObject.NULL)) { mCardSuppliedApiVersion = data.optString("version", ""); mCardSuppliedDeveloperContact = data.optString("developer", ""); } } catch (JSONException j) { UIUtils.showThemedToast(AbstractFlashcardViewer.this, getString(R.string.invalid_json_data, j.getLocalizedMessage()), false); } if (TextUtils.isEmpty(mCardSuppliedApiVersion) && TextUtils.isEmpty(mCardSuppliedDeveloperContact)) { enabledJsApi.put("toggleFlag", "disabled"); enabledJsApi.put("markCard", "disabled"); } else if (requireApiVersion(mCardSuppliedApiVersion)) { enabledJsApi.put("toggleFlag", "enabled"); enabledJsApi.put("markCard", "enabled"); } else { enabledJsApi.put("toggleFlag", "disabled"); enabledJsApi.put("markCard", "disabled"); } return String.valueOf(enabledJsApi); }
Source:
protected Boolean getIsReadonlyFromXMLNode(Element elem) { return elem.attribute("readonly") != null ? Boolean.parseBoolean(elem.attribute("readonly").getValue()) : null; }

Target:
protected Boolean getIsReadonlyFromXMLNode(Element elem) { Attribute readonly = elem.attribute("readonly"); return readonly != null ? Boolean.parseBoolean(readonly.getValue()) : null; }
Source:
public static Object item(Object object, Object index) { if (object instanceof Map) { return mapItem((Map) object, index); } if (object instanceof List && index instanceof Number) { return arrayItem((List) object, ((Number) index).intValue()); } if (index instanceof Number) { return structAccess(object, ((Number) index).intValue() - 1, ""); } if (index instanceof String) { String indexAsStr = index.toString(); try { return structAccess(object, Integer.parseInt(indexAsStr) - 1, ""); } catch (NumberFormatException e) { return structAccess(object, -1, indexAsStr); } } return null; }

Target:
public static Object item(Object object, Object index) { if (object instanceof Map) { return mapItem((Map) object, index); } if (object instanceof List && index instanceof Number) { return arrayItem((List) object, ((Number) index).intValue()); } if (index instanceof Number) { return structAccess(object, ((Number) index).intValue() - 1, null); } if (index instanceof String) { return structAccess(object, -1, index.toString()); } return null; }
Source:
public static GerritTableView getActiveView() { IViewPart viewPart = null; if (rtv != null) { return rtv; } else { IWorkbench workbench = GerritUi.getDefault().getWorkbench(); IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); IWorkbenchPage page = null; if (window != null ) { page = workbench.getActiveWorkbenchWindow() .getActivePage(); } if (page != null) { viewPart = page.findView(VIEW_ID); if (viewPart == null) { try { viewPart = page.showView(VIEW_ID, null, org.eclipse.ui.IWorkbenchPage.VIEW_CREATE); } catch (PartInitException e) { StatusHandler.log(new Status(IStatus.WARNING, GerritCorePlugin.PLUGIN_ID, NLS.bind( "PartInitException: ''{0}'' ", e.getLocalizedMessage()))); } GerritUi.Ftracer.traceWarning("getActiveView() SHOULD (JUST) CREATED A NEW Table:" + viewPart ); } } return (GerritTableView) viewPart; } }

Target:
public static GerritTableView getActiveView() { IViewPart viewPart = null; if (rtv != null) { return rtv; } else { IWorkbench workbench = GerritUi.getDefault().getWorkbench(); IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); IWorkbenchPage page = null; if (window != null ) { page = workbench.getActiveWorkbenchWindow() .getActivePage(); } if (page != null) { viewPart = page.findView(VIEW_ID); if (viewPart == null) { try { viewPart = page.showView(VIEW_ID, null, org.eclipse.ui.IWorkbenchPage.VIEW_CREATE); } catch (PartInitException e) { StatusHandler.log(new Status(IStatus.WARNING, GerritCorePlugin.PLUGIN_ID, NLS.bind( "PartInitException: ''{0}'' ", e))); } GerritUi.Ftracer.traceWarning("getActiveView() SHOULD (JUST) CREATED A NEW Table:" + viewPart ); } } return (GerritTableView) viewPart; } }
Source:
public AdvancedCache<K, V> withFlags(final Flag... flags) { if (flags == null || flags.length == 0) return this; else { boolean containsAll = false; if (this.flags != null) { containsAll = true; for (Flag flag : flags) { if (!this.flags.contains(flag)) { containsAll = false; } } } if (containsAll) { return this; } else { EnumSet<Flag> newFlags = this.flags != null ? EnumSet.copyOf(this.flags) : EnumSet.noneOf(Flag.class); Collections.addAll(newFlags, flags); return new DecoratedCache<K, V>(this.cacheImplementation, this.classLoader.get(), newFlags); } } }

Target:
public AdvancedCache<K, V> withFlags(final Flag... flags) { if (flags == null || flags.length == 0) return this; else { boolean containsAll; if (this.flags != null) { containsAll = true; for (Flag flag : flags) { if (!this.flags.contains(flag)) { containsAll = false; } } } else { containsAll = false; } if (containsAll) { return this; } else { EnumSet<Flag> newFlags = this.flags != null ? EnumSet.copyOf(this.flags) : EnumSet.noneOf(Flag.class); Collections.addAll(newFlags, flags); return new DecoratedCache<K, V>(this.cacheImplementation, this.classLoader.get(), newFlags); } } }
Source:
public BlobProperties getBlobProperties(BlobId blobId, ClusterMap map, boolean expiredBlobs) { List<ReplicaId> replicas = blobId.getPartition().getReplicaIds(); BlobProperties blobProperties = null; for (ReplicaId replicaId : replicas) { try { blobProperties = getBlobProperties(blobId, map, replicaId.getDataNodeId().getHostname(), replicaId.getDataNodeId().getPort(), expiredBlobs); break; } catch (MessageFormatException e) { } catch (IOException e) { } } return blobProperties; }

Target:
public BlobProperties getBlobProperties(BlobId blobId, ClusterMap map, boolean expiredBlobs) { List<ReplicaId> replicas = blobId.getPartition().getReplicaIds(); BlobProperties blobProperties = null; for (ReplicaId replicaId : replicas) { try { blobProperties = getBlobProperties(blobId, map, replicaId.getDataNodeId().getHostname(), replicaId.getDataNodeId().getPort(), expiredBlobs); break; } catch (Exception e) { } } return blobProperties; }
Source:
private TestingSlotPoolImpl createAndSetUpSlotPoolWithoutResourceManager() throws Exception { final TestingSlotPoolImpl slotPool = new TestingSlotPoolImpl(new JobID()); slotPool.start(JobMasterId.generate(), "foobar", mainThreadExecutor); return slotPool; }

Target:
private TestingSlotPoolImpl createAndSetUpSlotPoolWithoutResourceManager() throws Exception { return SlotPoolUtils.createAndSetUpSlotPool(null); }
Source:
public static void main(String[] args) { String connectionString = "Endpoint={fully-qualified-namespace};SharedAccessKeyName={policy-name};" + "SharedAccessKey={key}"; ServiceBusReceiverAsyncClient receiverAsyncClient = new ServiceBusClientBuilder() .connectionString(connectionString) .receiver() .receiveMode(ReceiveMode.PEEK_LOCK) .queueName("<<queue-name>>") .buildAsyncClient(); final ReceiveAsyncOptions options = new ReceiveAsyncOptions() .setEnableAutoComplete(false) .setMaxAutoRenewDuration(Duration.ofSeconds(2)); Disposable subscription = receiverAsyncClient.receive(options) .flatMap(message -> { boolean messageProcessed = false; if (messageProcessed) { return receiverAsyncClient.complete(message).then(); } else { return receiverAsyncClient.abandon(message).then(); } }).subscribe(); try { Thread.sleep(Duration.ofSeconds(60).toMillis()); } catch (InterruptedException ignored) { } subscription.dispose(); receiverAsyncClient.close(); try { Thread.sleep(30000); } catch (Exception ee ) }

Target:
public static void main(String[] args) { String connectionString = "Endpoint={fully-qualified-namespace};SharedAccessKeyName={policy-name};" + "SharedAccessKey={key}"; ServiceBusReceiverAsyncClient receiverAsyncClient = new ServiceBusClientBuilder() .connectionString(connectionString) .receiver() .receiveMode(ReceiveMode.PEEK_LOCK) .queueName("<<queue-name>>") .buildAsyncClient(); final ReceiveAsyncOptions options = new ReceiveAsyncOptions() .setEnableAutoComplete(false) .setMaxAutoRenewDuration(Duration.ofSeconds(2)); Disposable subscription = receiverAsyncClient.receive(options) .flatMap(message -> { boolean messageProcessed = false; if (messageProcessed) { return receiverAsyncClient.complete(message).then(); } else { return receiverAsyncClient.abandon(message).then(); } }).subscribe(); try { Thread.sleep(Duration.ofSeconds(60).toMillis()); } catch (InterruptedException ignored) { } subscription.dispose(); receiverAsyncClient.close(); }
Source:
private static Object getErrorResult(final Cell cell) { String errorResult; try { errorResult = FormulaError.forInt(cell.getErrorCellValue()).getString(); } catch (final RuntimeException e) { logger .debug("Getting error code for ({},{}) failed!: {}", cell.getRowIndex(), cell.getColumnIndex(), e .getMessage()); if (cell instanceof XSSFCell) { errorResult = ((XSSFCell) cell).getErrorCellString(); } else { logger .error("Couldn't handle unexpected error scenario in cell: ({},{})", cell.getRowIndex(), cell .getColumnIndex()); throw e; } } return errorResult; }

Target:
private static String getErrorResult(final Cell cell) { try { return FormulaError.forInt(cell.getErrorCellValue()).getString(); } catch (final RuntimeException e) { logger .debug("Getting error code for ({},{}) failed!: {}", cell.getRowIndex(), cell.getColumnIndex(), e .getMessage()); if (cell instanceof XSSFCell) { return ((XSSFCell) cell).getErrorCellString(); } else { logger .error("Couldn't handle unexpected error scenario in cell: ({},{})", cell.getRowIndex(), cell .getColumnIndex()); throw e; } } }
Source:
public int hashCode() { return Objects.hash(this.allowedOrigins.hashCode(), this.allowedMethodsRaw, this.allowedHeadersRaw); }

Target:
public int hashCode() { return Objects.hash(this.allowedOrigins, this.allowedMethodsRaw, this.allowedHeadersRaw); }
Source:
public ConfigurationService(ServerConfiguration conf) { assert conf != null; this.conf = conf; }

Target:
public ConfigurationService(ServerConfiguration conf) { Preconditions.checkNotNull(conf); this.conf = conf; }
Source:
@Override public void registerWorldGen(ICubicWorldServer world, GeneratorPipeline pipeline) { ServerCubeCache cubeCache = world.getCubeCache(); GeneratorStage terrain = new IndependentGeneratorStage("terrain"); DependentGeneratorStage features = new DependentGeneratorStage("features", null); features.setCubeDependency(new RegionDependency(features, new Vec3i(0, -1, 0), new Vec3i(0, 0, 0))); DependentGeneratorStage lighting = new DependentGeneratorStage("lighting", null); lighting.setCubeDependency(new RegionDependency(lighting, 2)); GeneratorStage population = new IndependentGeneratorStage("population"); pipeline.addStage(terrain, new CustomTerrainProcessor(world, 5)); pipeline.addStage(features, new CustomFeatureProcessor(features, "Features", cubeCache, 10)); pipeline.addStage(lighting, new FirstLightProcessor(lighting, "Lighting", cubeCache, 5)); pipeline.addStage(population, new CustomPopulationProcessor(population, "Population", world, 100)); }

Target:
@Override public void registerWorldGen(ICubicWorldServer world, GeneratorPipeline pipeline) { ServerCubeCache cubeCache = world.getCubeCache(); GeneratorStage terrain = new IndependentGeneratorStage("terrain"); GeneratorStage features = new IndependentGeneratorStage("features"); DependentGeneratorStage lighting = new DependentGeneratorStage("lighting", null); lighting.setCubeDependency(new RegionDependency(lighting, 2)); GeneratorStage population = new IndependentGeneratorStage("population"); pipeline.addStage(terrain, new CustomTerrainProcessor(world, 5)); pipeline.addStage(features, new CustomFeatureProcessor(features, "Features", cubeCache, 10)); pipeline.addStage(lighting, new FirstLightProcessor(lighting, "Lighting", cubeCache, 5)); pipeline.addStage(population, new CustomPopulationProcessor(population, "Population", world, 100)); }
Source:
public ExtensionBean getDetail(String extensionName) { EntityManager entityManager = getEntityManager(); beginTransaction(entityManager); Query q = entityManager.createNamedQuery(PersistenceConstants.GET_EXTENSION); q.setParameter(EXTENSION_NAME, extensionName); try { List resultList = q.getResultList(); if (resultList.size()>0) { return (ExtensionBean)resultList.get(0); } else { return null; } } finally { commitAndCloseTransaction(entityManager); } }

Target:
public ExtensionBean getDetail(String extensionName) { EntityManager entityManager = getEntityManager(); beginTransaction(entityManager); Query q = entityManager.createNamedQuery(PersistenceConstants.GET_EXTENSION); q.setParameter(EXTENSION_NAME, extensionName); try { List resultList = q.getResultList(); if (!resultList.isEmpty()) { return (ExtensionBean)resultList.get(0); } else { return null; } } finally { commitAndCloseTransaction(entityManager); } }
Source:
private void buildSwitchExpression(SwitchExpressionTree switchExpressionTree, Tree terminator) { if (terminator.is(Tree.Kind.SWITCH_EXPRESSION)) { currentBlock.elements.add(terminator); } Block switchSuccessor = currentBlock; currentBlock = createBlock(); currentBlock.terminator = terminator; switches.addLast(currentBlock); build(switchExpressionTree.expression()); Block conditionBlock = currentBlock; currentBlock = createBlock(switchSuccessor); breakTargets.addLast(switchSuccessor); boolean hasDefaultCase = false; if (!switchExpressionTree.cases().isEmpty()) { boolean withoutFallTrough = switchWithoutFallThrough(switchExpressionTree); CaseGroupTree firstCase = switchExpressionTree.cases().get(0); for (CaseGroupTree caseGroupTree : Lists.reverse(switchExpressionTree.cases())) { if (withoutFallTrough) { currentBlock.successors().clear(); currentBlock.addSuccessor(switchSuccessor); } build(caseGroupTree.body()); List<CaseLabelTree> labels = caseGroupTree.labels(); Lists.reverse(labels).stream() .map(CaseLabelTree::expressions) .map(Lists::reverse) .flatMap(Collection::stream) .forEach(this::build); if (!withoutFallTrough) { } if (!hasDefaultCase) { hasDefaultCase = containsDefaultCase(labels); } currentBlock.setCaseGroup(caseGroupTree); switches.getLast().addSuccessor(currentBlock); if (!caseGroupTree.equals(firstCase)) { currentBlock = createBlock(currentBlock); } } } breakTargets.removeLast(); currentBlock = switches.removeLast(); if (!hasDefaultCase) { currentBlock.addSuccessor(switchSuccessor); } currentBlock = conditionBlock; }

Target:
private void buildSwitchExpression(SwitchExpressionTree switchExpressionTree, Tree terminator) { if (terminator.is(Tree.Kind.SWITCH_EXPRESSION)) { currentBlock.elements.add(terminator); } Block switchSuccessor = currentBlock; currentBlock = createBlock(); currentBlock.terminator = terminator; switches.addLast(currentBlock); build(switchExpressionTree.expression()); Block conditionBlock = currentBlock; currentBlock = createBlock(switchSuccessor); breakTargets.addLast(switchSuccessor); boolean hasDefaultCase = false; if (!switchExpressionTree.cases().isEmpty()) { boolean withoutFallTrough = switchWithoutFallThrough(switchExpressionTree); CaseGroupTree firstCase = switchExpressionTree.cases().get(0); for (CaseGroupTree caseGroupTree : Lists.reverse(switchExpressionTree.cases())) { if (withoutFallTrough) { currentBlock.successors().clear(); currentBlock.addSuccessor(switchSuccessor); } build(caseGroupTree.body()); List<CaseLabelTree> labels = caseGroupTree.labels(); Lists.reverse(labels).stream() .map(CaseLabelTree::expressions) .map(Lists::reverse) .flatMap(Collection::stream) .forEach(this::build); if (!hasDefaultCase) { hasDefaultCase = containsDefaultCase(labels); } currentBlock.setCaseGroup(caseGroupTree); switches.getLast().addSuccessor(currentBlock); if (!caseGroupTree.equals(firstCase)) { currentBlock = createBlock(currentBlock); } } } breakTargets.removeLast(); currentBlock = switches.removeLast(); if (!hasDefaultCase) { currentBlock.addSuccessor(switchSuccessor); } currentBlock = conditionBlock; }
Source:
public void linkConfiguration(PolicyConfiguration link) throws PolicyContextException { checkNotNullParam("link", link); checkIfInOpenState(); synchronized (this.linkedPolicies) { if (getContextID().equals(link.getContextID())) { throw log.authzLinkSamePolicyConfiguration(getContextID()); } this.linkedPolicies.add(this); if (!this.linkedPolicies.add(link)) { return; } ElytronPolicyConfiguration linkedPolicyConfiguration = (ElytronPolicyConfiguration) link; linkedPolicyConfiguration.linkConfiguration(this); this.linkedPolicies = linkedPolicyConfiguration.getLinkedPolicies(); } }

Target:
public void linkConfiguration(PolicyConfiguration link) throws PolicyContextException { checkNotNullParam("link", link); synchronized (this) { checkIfInOpenState(); if (getContextID().equals(link.getContextID())) { throw log.authzLinkSamePolicyConfiguration(getContextID()); } this.linkedPolicies.add(this); if (!this.linkedPolicies.add(link)) { return; } ElytronPolicyConfiguration linkedPolicyConfiguration = (ElytronPolicyConfiguration) link; linkedPolicyConfiguration.linkConfiguration(this); this.linkedPolicies = linkedPolicyConfiguration.getLinkedPolicies(); } }
Source:
public void testRawToken() throws Exception { String rawToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikp" + "vaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"; JsonWebSignature jws = JsonWebSignature.parse(new MockJsonFactory(), rawToken); assertEquals(jws.getRawToken(), rawToken); }

Target:
public void testRawToken() throws Exception { String rawToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikp" + "vaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"; JsonWebSignature signature = JsonWebSignature.parse(new MockJsonFactory(), rawToken); assertEquals(signature.getRawToken(), rawToken); }
Source:
public int hashCode() { return action.hashCode() + Boolean.valueOf(force).hashCode() + Integer.valueOf(min).hashCode() + Integer.valueOf(max).hashCode() + group.hashCode(); }

Target:
public int hashCode() { return group.hashCode(); }
Source:
private boolean isLowRamDevice() { return ((ActivityManager) getContext().getSystemService(Context.ACTIVITY_SERVICE)) .isLowRamDevice(); }

Target:
private boolean isLowRamDevice() { return ((ActivityManager)mContext.getSystemService(Context.ACTIVITY_SERVICE)). isLowRamDevice(); }
Source:
public List<SlimAssertion> getAssertions() { String tableName = getTableName(); List<SlimAssertion> setSymbolsAssertions = new ArrayList<SlimAssertion>(); int rows = table.getRowCount(); for (int row = 1; row < rows; row++) { int cols = table.getColumnCountInRow(row); for (int col = 0; col < cols; col++) { String match; if ((match = ifSymbolAssignment(col, row)) != null) { Instruction instruction = callAndAssign(match, tableName + "_EXTRACT", "getValue", String.valueOf(row - 1), String.valueOf(col)); setSymbolsAssertions.add(makeAssertion(instruction, SlimExpectation.NOOP_EXPECTATION)); } } } List<SlimAssertion> assertions = new ArrayList<SlimAssertion>(); assertions.add(constructFixture(getFixtureName())); if (setSymbolsAssertions.size() > 0) { assertions.add(makeAssertion(callAndAssign(tableName, tableName, "doTable", tableAsList()), new TableTableExpectation())); assertions.add(makeAssertion(new MakeInstruction(makeInstructionTag(), tableName + "_EXTRACT", TableTableExtractSymbol.class.getCanonicalName(), new Object[] { "$" + tableName }), SlimExpectation.NOOP_EXPECTATION)); assertions.addAll(setSymbolsAssertions); } else { assertions.add(makeAssertion(callFunction(tableName, "doTable", tableAsList()), new TableTableExpectation())); } return assertions; }

Target:
public List<SlimAssertion> getAssertions() { String tableName = getTableName(); List<SlimAssertion> setSymbolsAssertions = new ArrayList<SlimAssertion>(); int rows = table.getRowCount(); for (int row = 1; row < rows; row++) { int cols = table.getColumnCountInRow(row); for (int col = 0; col < cols; col++) { String match; if ((match = ifSymbolAssignment(col, row)) != null) { Instruction instruction = callAndAssign(match, tableName + "_EXTRACT", "getValue", String.valueOf(row - 1), String.valueOf(col)); setSymbolsAssertions.add(makeAssertion(instruction, SlimExpectation.NOOP_EXPECTATION)); } } } List<SlimAssertion> assertions = new ArrayList<SlimAssertion>(); assertions.add(constructFixture(getFixtureName())); if (setSymbolsAssertions.size() > 0) { assertions.add(makeAssertion(callAndAssign(tableName, tableName, "doTable", tableAsList()), new TableTableExpectation())); assertions.add(makeAssertion(new MakeInstruction(makeInstructionTag(), tableName + "_EXTRACT", RegexpExtractSymbolValue.class.getCanonicalName(), new Object[] { "$" + tableName , EXTRACT_REGEXP}), SlimExpectation.NOOP_EXPECTATION)); assertions.addAll(setSymbolsAssertions); } else { assertions.add(makeAssertion(callFunction(tableName, "doTable", tableAsList()), new TableTableExpectation())); } return assertions; }
Source:
public boolean isAcceptable(Response response, Address address) { if (targets.contains(address)) { missingResponses--; if (response instanceof SuccessfulResponse || response instanceof ExceptionResponse) { validResponses++; return true; } } return false; }

Target:
public boolean isAcceptable(Response response, Address address) { if (targets.contains(address)) { missingResponses--; if (response instanceof SuccessfulResponse || response instanceof ExceptionResponse) { acceptableResponses++; return true; } } return false; }
Source:
public boolean isNameVisibleToUser( FeedbackQuestionAttributes question, FeedbackResponseAttributes response, String userEmail, UserRole role, boolean isGiverName, CourseRoster roster) { if (question == null) { return false; } if (question.giverType == FeedbackParticipantType.TEAMS) { if (roster.isStudentInTeam(userEmail, response.giver)) { return true; } } else { if (response.giver.equals(userEmail)) { return true; } } return isFeedbackParticipantNameVisibleToUser(question, response, userEmail, role, isGiverName, roster); }

Target:
public boolean isNameVisibleToUser( FeedbackQuestionAttributes question, FeedbackResponseAttributes response, String userEmail, UserRole role, boolean isGiverName, CourseRoster roster) { if (question == null) { return false; } if (question.giverType == FeedbackParticipantType.TEAMS) { if (roster.isStudentInTeam(userEmail, response.giver) || roster.isStudentsInSameTeam(userEmail, response.giver)) { return true; } } else { if (response.giver.equals(userEmail)) { return true; } } return isFeedbackParticipantNameVisibleToUser(question, response, userEmail, role, isGiverName, roster); }
Source:
private Expiration<SocketPoolable> createSocketExpiration() { if (socketExpirationMs <= 0) { return new SocketExpiration(); } else { return new TimeExpiration<SocketPoolable>(socketExpirationMs, MILLISECONDS); } }

Target:
private Expiration<SocketPoolable> createSocketExpiration() { if (socketExpirationMs <= 0) { return new SocketExpiration(); } else { return new CompoundExpiration<>( new TimeExpiration<SocketPoolable>(socketExpirationMs, MILLISECONDS), new SocketExpiration()); } }
Source:
public synchronized void write(@Nonnull char[] cbuf, int off, int len) throws IOException { while (len > 0) { if (!buf.hasRemaining()) filterFlushLines(); if (!buf.hasRemaining()) { buf = CharBuffer.allocate(buf.capacity() + DEFAULT_BUFFER_CAPACITY).put(buf); } int toCopy = Math.min(buf.remaining(), len); if (toCopy == 0) throw new IllegalStateException(); buf.put(cbuf, off, toCopy); filterFlushLines(); len -= toCopy; off += toCopy; } filterFlushLines(); }

Target:
public synchronized void write(@Nonnull char[] cbuf, int off, int len) throws IOException { ensureOpen(); while (len > 0) { if (!buf.hasRemaining()) filterFlushLines(); if (!buf.hasRemaining()) { buf = CharBuffer.allocate(buf.capacity() * 2).put(buf); } int toCopy = Math.min(buf.remaining(), len); if (toCopy == 0) throw new IllegalStateException(); buf.put(cbuf, off, toCopy); filterFlushLines(); len -= toCopy; off += toCopy; } filterFlushLines(); }