auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private Broadcast setCommonDetails(ProgData progData, Channel channel, DateTimeZone zone, Item episode, Timestamp updatedAt) { if (episode.getTitle() == null || (!channel.getUri().contains("wales"))) { if (progData.getEpisodeTitle() != null) { episode.setTitle(progData.getEpisodeTitle()); } else { episode.setTitle(progData.getTitle()); } } setDescription(progData, episode, channel); episode.setMediaType(channel.getMediaType()); episode.setSpecialization(specialization(progData, channel)); setGenres(progData, episode); if (progData.getCountry() != null) { episode.setCountriesOfOrigin(countryMap.parseCountries(progData.getCountry())); } if (progData.getAttr() != null) { episode.setBlackAndWhite(getBooleanValue(progData.getAttr().getBw())); } selectImages(progData.getPictures(), episode, PA_PICTURE_TYPE_EPISODE, PA_PICTURE_TYPE_SERIES, Maybe.just(PA_PICTURE_TYPE_BRAND)); episode.setPeople(people(progData)); Version version = findBestVersion(episode.getVersions()); version.set3d(getBooleanValue(progData.getAttr().getThreeD())); Duration duration = Duration.standardMinutes(Long.valueOf(progData.getDuration())); version.setDuration(duration); setCertificate(progData, episode); Broadcast broadcast = broadcast(progData, channel, zone, updatedAt); addBroadcast(version, broadcast); return broadcast; }

Target:
private Broadcast setCommonDetails(ProgData progData, Channel channel, DateTimeZone zone, Item episode, Timestamp updatedAt) { if (episode.getTitle() == null || !channel.getUri().contains("wales")) { if (progData.getEpisodeTitle() != null) { episode.setTitle(progData.getEpisodeTitle()); } else { episode.setTitle(progData.getTitle()); } } setDescription(progData, episode, channel); episode.setMediaType(channel.getMediaType()); episode.setSpecialization(specialization(progData, channel)); setGenres(progData, episode); if (progData.getCountry() != null) { episode.setCountriesOfOrigin(countryMap.parseCountries(progData.getCountry())); } if (progData.getAttr() != null) { episode.setBlackAndWhite(getBooleanValue(progData.getAttr().getBw())); } selectImages(progData.getPictures(), episode, PA_PICTURE_TYPE_EPISODE, PA_PICTURE_TYPE_SERIES, Maybe.just(PA_PICTURE_TYPE_BRAND)); episode.setPeople(people(progData)); Version version = findBestVersion(episode.getVersions()); version.set3d(getBooleanValue(progData.getAttr().getThreeD())); Duration duration = Duration.standardMinutes(Long.valueOf(progData.getDuration())); version.setDuration(duration); setCertificate(progData, episode); Broadcast broadcast = broadcast(progData, channel, zone, updatedAt); addBroadcast(version, broadcast); return broadcast; }
Source:
public void tearDown() throws Exception { super.tearDown(); }

Target:
public void tearDown() throws Exception { System.clearProperty(ServerCnxnFactory.ZOOKEEPER_SERVER_CNXN_FACTORY); for (ZooKeeper zk : zks) { zk.close(); } super.tearDown(); }
Source:
private void displayNav() { DiffApi.diff(idSideB, patchKey.getFileName()).base(idSideA) .get(new GerritCallback<DiffInfo>() { @Override public void onSuccess(DiffInfo diffInfo) { topNav.display(patchIndex, getPatchScreenType(), fileList, getLinks(), getWebLinks(diffInfo)); bottomNav.display(patchIndex, getPatchScreenType(), fileList, getLinks(), getWebLinks(diffInfo)); } }); }

Target:
private void displayNav() { DiffApi.diff(idSideB, patchKey.getFileName()) .base(idSideA) .webLinksOnly() .get(new GerritCallback<DiffInfo>() { @Override public void onSuccess(DiffInfo diffInfo) { topNav.display(patchIndex, getPatchScreenType(), fileList, getLinks(), getWebLinks(diffInfo)); bottomNav.display(patchIndex, getPatchScreenType(), fileList, getLinks(), getWebLinks(diffInfo)); } }); }
Source:
void enableAutoRow(final TargetEnvironment env) { final GroupRow autoGroupRow = new GroupRow(true, true, 0, env.getGuideEnvironment().automaticGroup(), Collections.emptyList()); rows.set(1, autoGroupRow); fireTableRowsUpdated(1, 1); }

Target:
void enableAutoRow(final TargetEnvironment env) { final GroupRow autoGroupRow = new GroupRow(true, false, 0, env.getGuideEnvironment().automaticGroup(), Collections.emptyList()); rows.set(1, autoGroupRow); fireTableRowsUpdated(1, 1); }
Source:
private void checkAlignment(String errorMessage, int expectedAlignment, int actualAlignment) { switch (expectedAlignment) { case PositionConstants.LEFT: assertEquals("wrong text wrap alignment.", PositionConstants.LEFT, actualAlignment); break; case PositionConstants.RIGHT: assertEquals("wrong text wrap alignment.", PositionConstants.RIGHT, actualAlignment); break; case PositionConstants.CENTER: assertEquals("wrong text wrap alignment.", PositionConstants.CENTER, actualAlignment); break; default: break; }; }

Target:
private void checkAlignment(String errorMessage, int expectedAlignment, int actualAlignment) { switch (expectedAlignment) { case PositionConstants.LEFT: assertEquals(errorMessage, PositionConstants.LEFT, actualAlignment); break; case PositionConstants.RIGHT: assertEquals(errorMessage, PositionConstants.RIGHT, actualAlignment); break; case PositionConstants.CENTER: assertEquals(errorMessage, PositionConstants.CENTER, actualAlignment); break; default: break; }; }
Source:
public void OriginAtCenter(boolean b) { originAtCenter = b; }

Target:
protected void OriginAtCenter(boolean b) { originAtCenter = b; }
Source:
private Widget prepareWorlflowInformationWidget() { String widgetIcon = "Please add an icon to the workflow <br>"; String widgetDocumentation = "Please add a documentation link to the workflow <br>"; String widgetBucketName = "Please add a bucket name to the workflow"; if (icon != null) { widgetIcon = "<img src=" + icon + " height=40px width=40px> <br>"; } if (documentation != null) { widgetDocumentation = "<b>Documentation :</b> <a href=" + documentation + " target=_blank>" + documentation + " </a><br>"; } if (bucketNameGI != null) { widgetBucketName = "<b> Bucket name :</b> " + bucketNameGI; } return new HTML("<center> " + widgetIcon + widgetDocumentation + widgetBucketName + " </center>"); }

Target:
private Widget prepareWorlflowInformationWidget() { String widgetIcon = "No icone <br>"; String widgetDocumentation = "No documentation <br>"; String widgetBucketName = "No bucket name"; if (icon != null) { widgetIcon = "<img src=" + icon + " height=40px width=40px> <br>"; } if (documentation != null) { widgetDocumentation = "<b>Documentation :</b> <a href=" + documentation + " target=_blank>" + documentation + " </a><br>"; } if (bucketNameGI != null) { widgetBucketName = "<b> Bucket name :</b> " + bucketNameGI; } return new HTML("<center> " + widgetIcon + widgetDocumentation + widgetBucketName + " </center>"); }
Source:
public void testBindingsAreBoundOnlyWhenEvaluation() { GroovyScriptEngine groovyScriptEngine = new GroovyScriptEngine(); String groovyExpression = "temperature > 10 && humidity < 30"; GroovyScript<Boolean> groovyScript = new GroovyScript<Boolean>(groovyExpression, groovyScriptEngine); HashMap<String, Object> fieldsAndValue = new HashMap<>(); fieldsAndValue.put("temperature", 20); fieldsAndValue.put("humidity", 10); try { groovyScript.evaluate(new IotasEventImpl(fieldsAndValue, "1")); } catch (ScriptException e) { e.printStackTrace(); Assert.fail("It shouldn't throw ScriptException"); } fieldsAndValue.clear(); fieldsAndValue.put("no_related_field", 3); try { groovyScript.evaluate(new IotasEventImpl(fieldsAndValue, "1")); Assert.fail("It should not evaluate correctly"); } catch (ScriptException e) { } }

Target:
public void testBindingsAreBoundOnlyWhenEvaluation() { GroovyScriptEngine groovyScriptEngine = new GroovyScriptEngine(); String groovyExpression = "temperature > 10 && humidity < 30"; GroovyScript<Boolean> groovyScript = new GroovyScript<Boolean>(groovyExpression, groovyScriptEngine); HashMap<String, Object> fieldsAndValue = new HashMap<>(); fieldsAndValue.put("temperature", 20); fieldsAndValue.put("humidity", 10); try { assertTrue(groovyScript.evaluate(new IotasEventImpl(fieldsAndValue, "1"))); } catch (ScriptException e) { e.printStackTrace(); Assert.fail("It shouldn't throw ScriptException"); } fieldsAndValue.clear(); fieldsAndValue.put("no_related_field", 3); try { groovyScript.evaluate(new IotasEventImpl(fieldsAndValue, "1")); Assert.fail("It should not evaluate correctly"); } catch (ScriptException e) { } }
Source:
public boolean ShouldEndAction() { synchronized (_listTasks) { java.util.ArrayList<EntityAsyncTask> CurrentActionTypeTasks = GetCurrentActionTypeTasks(); for (EntityAsyncTask task : CurrentActionTypeTasks) { if (task.getState() != AsyncTaskState.Ended) { log.infoFormat("Task ID: '{0}' is in state {1}. End action for entity {2} will be procceeded when all the tasks will be in end state.", task.getTaskID(), task.getState(), getContainerId()); return false; } } } return true; }

Target:
public boolean ShouldEndAction() { synchronized (_listTasks) { java.util.ArrayList<EntityAsyncTask> CurrentActionTypeTasks = GetCurrentActionTypeTasks(); for (EntityAsyncTask task : CurrentActionTypeTasks) { if (task.getState() != AsyncTaskState.Ended) { log.infoFormat("Task ID: '{0}' is in state {1}. End action for entity {2} will proceed when all the entity tasks will be completed.", task.getTaskID(), task.getState(), getContainerId()); return false; } } } return true; }
Source:
public void testGetQuery() { ParseQuery query = ParseRole.getQuery(); assertEquals(ParseCorePlugins.getInstance().getSubclassingController().getClassName(ParseRole.class), query.getBuilder().getClassName()); }

Target:
public void testGetQuery() { ParseQuery<?> query = ParseRole.getQuery(); assertEquals(ParseCorePlugins.getInstance().getSubclassingController().getClassName(ParseRole.class), query.getBuilder().getClassName()); }
Source:
private void triggerFlushInPrimaryRegion(final HRegion region) { if (ServerRegionReplicaUtil.isDefaultReplica(region.getRegionInfo())) { return; } TableName tn = region.getTableDescriptor().getTableName(); if (!ServerRegionReplicaUtil.isRegionReplicaReplicationEnabled(region.conf, tn) || !ServerRegionReplicaUtil.isRegionReplicaWaitForPrimaryFlushEnabled(region.conf)) { region.setReadsEnabled(true); return; } region.setReadsEnabled(false); if (this.executorService != null) { EventHandler eh = new RegionReplicaFlushHandler(this, clusterConnection, rpcRetryingCallerFactory, rpcControllerFactory, operationTimeout, region); if (this.executorService.hasExecutor(eh.getEventType())) { this.executorService.submit(eh); } else { Threads.setDaemonThreadRunning(new Thread(() -> eh.run()), "FlushRegionReplicaPrimary." + region.getRegionInfo().getEncodedName(), new UncaughtExceptionHandler() { @Override public void uncaughtException(Thread t, Throwable e) { LOG.warn("{}", t.getName(), e); } }); } } else { LOG.info("Executor is null; not running flush of primary region replica for {}", region.getRegionInfo()); } }

Target:
private void triggerFlushInPrimaryRegion(final HRegion region) { if (ServerRegionReplicaUtil.isDefaultReplica(region.getRegionInfo())) { return; } TableName tn = region.getTableDescriptor().getTableName(); if (!ServerRegionReplicaUtil.isRegionReplicaReplicationEnabled(region.conf, tn) || !ServerRegionReplicaUtil.isRegionReplicaWaitForPrimaryFlushEnabled(region.conf)) { region.setReadsEnabled(true); return; } region.setReadsEnabled(false); if (this.executorService != null) { this.executorService.submit(new RegionReplicaFlushHandler(this, clusterConnection, rpcRetryingCallerFactory, rpcControllerFactory, operationTimeout, region)); } else { LOG.info("Executor is null; not running flush of primary region replica for {}", region.getRegionInfo()); } }
Source:
private Map<VmDevice, Integer> vmDeviceUnitMapForController(VmDevice vmDevice, Map<Integer, Map<VmDevice, Integer>> vmDeviceUnitMap) { int numOfDisks = getVm().getDiskMap() != null ? getVm().getDiskMap().values().size() : 0; int controllerId = vmInfoBuildUtils.getControllerForScsiDisk(vmDevice, getVm(), numOfDisks); if (!vmDeviceUnitMap.containsKey(controllerId)) { return new HashMap<>(); } return vmDeviceUnitMap.get(controllerId); }

Target:
private Map<VmDevice, Integer> vmDeviceUnitMapForController(VmDevice vmDevice, Map<Integer, Map<VmDevice, Integer>> vmDeviceUnitMap) { int numOfDisks = getVm().getDiskMap().values().size(); int controllerId = vmInfoBuildUtils.getControllerForScsiDisk(vmDevice, getVm(), numOfDisks); if (!vmDeviceUnitMap.containsKey(controllerId)) { return new HashMap<>(); } return vmDeviceUnitMap.get(controllerId); }
Source:
public <T, K, V> void onPreExecute(Callable<T> task, Cache<K, V> inputDataCache) { try { BeanManager bm = CDIHelper.getBeanManager(); if (bm == null) return; ContextInputCache.set(inputDataCache); preInject(bm, task); if (task instanceof RunnableAdapter) { preInject(bm, ((RunnableAdapter) task).getTask()); } } catch (Exception e) { throw new IllegalStateException("Injcting input caches failed. This may result in NullPointerExceptions in client code", e); } finally { ContextInputCache.clean(); } }

Target:
public <T, K, V> void onPreExecute(Callable<T> task, Cache<K, V> inputDataCache) { BeanManager bm = CDIHelper.getBeanManager(); if (bm == null) return; ContextInputCache.set(inputDataCache); preInject(bm, task); if (task instanceof RunnableAdapter) { preInject(bm, ((RunnableAdapter) task).getTask()); } }
Source:
public Mono<PagedResponse<ListContainerItemInner>> listSinglePageAsync( String resourceGroupName, String accountName, String maxpagesize, String filter, ListSharesExpand include) { if (this.client.getHost() == null) { return Mono .error(new IllegalArgumentException("Parameter this.client.getHost() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (accountName == null) { return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } return FluxUtil .withContext( context -> service .list( this.client.getHost(), resourceGroupName, accountName, this.client.getApiVersion(), this.client.getSubscriptionId(), maxpagesize, filter, include, context)) .<PagedResponse<ListContainerItemInner>>map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); }

Target:
public Mono<PagedResponse<ListContainerItemInner>> listSinglePageAsync( String resourceGroupName, String accountName, String maxpagesize, String filter, ListSharesExpand include) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (accountName == null) { return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } return FluxUtil .withContext( context -> service .list( this.client.getEndpoint(), resourceGroupName, accountName, this.client.getApiVersion(), this.client.getSubscriptionId(), maxpagesize, filter, include, context)) .<PagedResponse<ListContainerItemInner>>map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); }
Source:
private boolean actuallyFits(int powerTwo, RandomAccessFile headerFile) throws IOException { long lastValueOffset = 0; long currentValueOffset = 0; long valueBytesWritten = valuesOut.getCount(); long headerIndex = 0; long bagSize = 1L << powerTwo; while (lastValueOffset < valueBytesWritten) { if (headerIndex + bagSize <= numWritten) { headerFile.seek((headerIndex + bagSize - 1) * Longs.BYTES); currentValueOffset = headerFile.readLong(); } else if (headerIndex < numWritten && numWritten < (headerIndex + bagSize)) { headerFile.seek((numWritten - 1) * Longs.BYTES); currentValueOffset = headerFile.readLong(); } if (currentValueOffset - lastValueOffset <= fileSizeLimit) { lastValueOffset = currentValueOffset; headerIndex = headerIndex + bagSize; } else { return false; } } return true; }

Target:
private boolean actuallyFits(int powerTwo, RandomAccessFile headerFile) throws IOException { long lastValueOffset = 0; long currentValueOffset = 0; long valueBytesWritten = valuesOut.getCount(); long headerIndex = 0; long bagSize = 1L << powerTwo; while (lastValueOffset < valueBytesWritten) { if (headerIndex >= numWritten) { return true; } else if (headerIndex + bagSize <= numWritten) { headerFile.seek((headerIndex + bagSize - 1) * Longs.BYTES); currentValueOffset = Long.reverseBytes(headerFile.readLong()); } else if (numWritten < headerIndex + bagSize) { headerFile.seek((numWritten - 1) * Longs.BYTES); currentValueOffset = Long.reverseBytes(headerFile.readLong()); } if (currentValueOffset - lastValueOffset <= fileSizeLimit) { lastValueOffset = currentValueOffset; headerIndex = headerIndex + bagSize; } else { return false; } } return true; }
Source:
public void testDecisionTableWithCalculatedResult_parallel() throws Throwable { final DMNRuntime runtime = DMNRuntimeUtil.createRuntime( "calculation1.dmn", this.getClass() ); Runnable task = () -> { final DMNModel dmnModel = runtime.getModel( "<LINK_0>", "Calculation1" ); assertThat( dmnModel, notNullValue() ); final DMNContext context = DMNFactory.newContext(); context.set( "MonthlyDeptPmt", BigDecimal.valueOf( 200 ) ); context.set( "MonthlyPmt", BigDecimal.valueOf( 100 ) ); context.set( "MonthlyIncome", BigDecimal.valueOf( 600 ) ); final DMNResult dmnResult = runtime.evaluateAll( dmnModel, context ); assertThat( dmnResult.hasErrors(), is( false ) ); final DMNContext result = dmnResult.getContext(); assertThat( ((BigDecimal) result.get( "Logique de décision 1" )).setScale( 1, RoundingMode.CEILING ), is( BigDecimal.valueOf( 0.5 ) ) ); }; List<Throwable> problems = new ArrayList<>(); List<CompletableFuture<Void>> tasks = new ArrayList<>(); for ( int i=0 ; i<10_000; i++) { CompletableFuture<Void> newtask = CompletableFuture.runAsync(task).exceptionally(t -> {problems.add(t); return null;}); tasks.add( newtask ); } CompletableFuture.allOf(tasks.toArray(new CompletableFuture<?>[]{})).get(10, TimeUnit.SECONDS); for ( Throwable t : problems ) { throw t; } }

Target:
public void testDecisionTableWithCalculatedResult_parallel() throws Throwable { final DMNRuntime runtime = DMNRuntimeUtil.createRuntime( "calculation1.dmn", this.getClass() ); Runnable task = () -> { checkDecisionTableWithCalculatedResult(runtime); }; List<Throwable> problems = Collections.synchronizedList(new ArrayList<>()); List<CompletableFuture<Void>> tasks = new ArrayList<>(); for ( int i=0 ; i<10_000; i++) { CompletableFuture<Void> newtask = CompletableFuture.runAsync(task).exceptionally(t -> {problems.add(t); return null;}); tasks.add( newtask ); } CompletableFuture.allOf(tasks.toArray(new CompletableFuture<?>[]{})).get(10, TimeUnit.SECONDS); for ( Throwable t : problems ) { throw t; } }
Source:
public void testIpAddressToVarcharCast() { assertFunction("CAST(IPADDRESS'::ffff:1.2.3.4' AS VARCHAR)", VARCHAR, "1.2.3.4"); assertFunction("CAST(IPADDRESS'::ffff:102:304' AS VARCHAR)", VARCHAR, "1.2.3.4"); assertFunction("CAST(IPADDRESS'2001:0db8:0000:0000:0000:ff00:0042:8329' AS VARCHAR)", VARCHAR, "2001:db8:0:0:0:ff00:42:8329"); assertFunction("CAST(IPADDRESS'2001:db8::ff00:42:8329' AS VARCHAR)", VARCHAR, "2001:db8:0:0:0:ff00:42:8329"); assertFunction("CAST(CAST('1.2.3.4' AS IPADDRESS) AS VARCHAR)", VARCHAR, "1.2.3.4"); }

Target:
public void testIpAddressToVarcharCast() { assertFunction("CAST(IPADDRESS '::ffff:1.2.3.4' AS VARCHAR)", VARCHAR, "1.2.3.4"); assertFunction("CAST(IPADDRESS '::ffff:102:304' AS VARCHAR)", VARCHAR, "1.2.3.4"); assertFunction("CAST(IPADDRESS '2001:0db8:0000:0000:0000:ff00:0042:8329' AS VARCHAR)", VARCHAR, "2001:db8::ff00:42:8329"); assertFunction("CAST(IPADDRESS '2001:db8::ff00:42:8329' AS VARCHAR)", VARCHAR, "2001:db8::ff00:42:8329"); assertFunction("CAST(IPADDRESS '2001:db8:0:0:1:0:0:1' AS VARCHAR)", VARCHAR, "2001:db8::1:0:0:1"); assertFunction("CAST(CAST('1.2.3.4' AS IPADDRESS) AS VARCHAR)", VARCHAR, "1.2.3.4"); assertFunction("CAST(CAST('2001:db8:0:0:1::1' AS IPADDRESS) AS VARCHAR)", VARCHAR, "2001:db8::1:0:0:1"); assertFunction("CAST(CAST('64:ff9b::10.0.0.0' AS IPADDRESS) AS VARCHAR)", VARCHAR, "64:ff9b::a00:0"); }
Source:
public static String languageCodeToWikiLanguageCode(String code) { switch (code) { case "iw": return "he"; case "in": return "id"; case "ji": return "yi"; case "zh": if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { String script = Locale.getDefault().getScript(); return "Hant".equals(script) ? AppLanguageLookUpTable.TRADITIONAL_CHINESE_LANGUAGE_CODE : AppLanguageLookUpTable.SIMPLIFIED_CHINESE_LANGUAGE_CODE; } return isTraditionalChinesePredominantInCountry(Locale.getDefault().getCountry()) ? AppLanguageLookUpTable.TRADITIONAL_CHINESE_LANGUAGE_CODE : AppLanguageLookUpTable.SIMPLIFIED_CHINESE_LANGUAGE_CODE; default: return code; } }

Target:
public static String languageCodeToWikiLanguageCode(String code) { switch (code) { case "iw": return "he"; case "in": return "id"; case "ji": return "yi"; case "zh": return chineseLanguageCodeToWikiLanguageCode(); default: return code; } }
Source:
public void dispose() { super.dispose(); for (Resource disposable : this.disposables) { disposable.dispose(); } }

Target:
public void dispose() { super.dispose(); for (Resource disposable : this.disposables) disposable.dispose(); }
Source:
public ConnectedChannel checkOutConnection(String host, Port port, long timeout) throws IOException, InterruptedException, ConnectionPoolTimeoutException { if (port.getPortType() == PortType.PLAINTEXT) { return new MockConnection(host, port.getPortNo(), messageInfoList.get(host + port.getPortNo()), byteBufferList.get(host + port.getPortNo()), maxEntriesToReturn); } else { return new MockSSLConnection(host, port.getPortNo(), messageInfoList.get(host + port.getPortNo()), byteBufferList.get(host + port.getPortNo()), maxEntriesToReturn); } }

Target:
public ConnectedChannel checkOutConnection(String host, Port port, long timeout) throws IOException, InterruptedException, ConnectionPoolTimeoutException { return new MockConnection(host, port.getPort(), messageInfoList.get(host + port), byteBufferList.get(host + port), maxEntriesToReturn); }
Source:
public static boolean downloadAvailablePlansForSite(boolean force, final Blog blog, final AvailablePlansListener listener) { if (!PlansUtils.isPlanFeatureAvailableForBlog(blog)) { return false; } if (!force && PlansUtils.getAvailablePlansForSite(blog) != null) { return false; } Map<String, String> params = getDefaultRestCallParameters(); WordPress.getRestClientUtils().get("sites/" + blog.getDotComBlogId() + "/plans", params, null, new RestRequest.Listener() { @Override public void onResponse(JSONObject response) { if (response != null) { AppLog.d(AppLog.T.PLANS, response.toString()); List<SitePlan> plans = new ArrayList<>(); try { JSONArray planIDs = response.names(); if (planIDs != null) { for (int i=0; i < planIDs.length(); i ++) { String currentKey = planIDs.getString(i); JSONObject currentPlanJSON = response.getJSONObject(currentKey); SitePlan currentPlan = new SitePlan(Long.valueOf(currentKey), currentPlanJSON, blog); plans.add(currentPlan); } } availablePlansForSites.put(blog.getLocalTableBlogId(), plans); if (listener!= null) { listener.onResponse(plans); } } catch (JSONException e) { AppLog.e(AppLog.T.PLANS, "Can't parse the plans list returned from the server", e); if (listener!= null) { listener.onError(e); } } } } }, new RestRequest.ErrorListener() { @Override public void onErrorResponse(VolleyError volleyError) { AppLog.e(AppLog.T.UTILS, "Error", volleyError); if (listener!= null) { listener.onError(volleyError); } } }); return true; }

Target:
public static boolean downloadAvailablePlansForSite(boolean force, final Blog blog, final AvailablePlansListener listener) { if (blog == null || !PlansUtils.isPlanFeatureAvailableForBlog(blog)) { return false; } if (!force && PlansUtils.getAvailablePlansForSite(blog) != null) { return false; } Map<String, String> params = getDefaultRestCallParameters(); WordPress.getRestClientUtils().get("sites/" + blog.getDotComBlogId() + "/plans", params, null, new RestRequest.Listener() { @Override public void onResponse(JSONObject response) { if (response != null) { AppLog.d(AppLog.T.PLANS, response.toString()); List<SitePlan> plans = new ArrayList<>(); try { JSONArray planIDs = response.names(); if (planIDs != null) { for (int i=0; i < planIDs.length(); i ++) { String currentKey = planIDs.getString(i); JSONObject currentPlanJSON = response.getJSONObject(currentKey); SitePlan currentPlan = new SitePlan(Long.valueOf(currentKey), currentPlanJSON, blog); plans.add(currentPlan); } } availablePlansForSites.put(blog.getLocalTableBlogId(), plans); if (listener!= null) { listener.onResponse(plans); } } catch (JSONException e) { AppLog.e(AppLog.T.PLANS, "Can't parse the plans list returned from the server", e); if (listener!= null) { listener.onError(e); } } } } }, new RestRequest.ErrorListener() { @Override public void onErrorResponse(VolleyError volleyError) { AppLog.e(AppLog.T.UTILS, "Error", volleyError); if (listener!= null) { listener.onError(volleyError); } } }); return true; }
Source:
protected void completeNode() { if (nodeBuilder == null) { return; } nodeBuilder.setOperation(getOperationName()); nodeBuilder.setDuration(Duration.between(getStart(), Instant.now()).toMillis()); traceContext.getNodeProcessors().forEach( np -> np.process(this, nodeBuilder)); traceContext.endProcessingNode(); nodeBuilder = null; }

Target:
private void completeNode() { if (nodeBuilder == null) { return; } nodeBuilder.setOperation(getOperationName()); nodeBuilder.setDuration(Duration.between(getStart(), Instant.now()).toNanos()); traceContext.getNodeProcessors().forEach( np -> np.process(traceContext, this, nodeBuilder)); traceContext.endProcessingNode(); nodeBuilder = null; }
Source:
private Document makeEnhancementOperationBody(String userid, String filePath, String mimeType, Boolean force) { Document msg = new Document(); Element entry = new Element("entry", ATOM_NS); entry.addContent(new Element("author", ATOM_NS) .addContent(new Element("name", ATOM_NS).setText(userid))); entry.addContent(new Element("pid", ATOM_NS).setText(filePath)); entry.addContent(new Element("mimeType", ATOM_NS).setText(mimeType)); if (force) { Element paramForce = new Element("force", CDR_MESSAGE_NS); paramForce.setText("force"); } msg.addContent(entry); return msg; }

Target:
private Document makeEnhancementOperationBody(String userid, String filePath, String mimeType, Boolean force) { Document msg = new Document(); Element entry = new Element("entry", ATOM_NS); entry.addContent(new Element("author", ATOM_NS) .addContent(new Element("name", ATOM_NS).setText(userid))); entry.addContent(new Element("pid", ATOM_NS).setText(filePath)); entry.addContent(new Element("mimeType", ATOM_NS).setText(mimeType)); if (force) { Element paramForce = new Element("force", CDR_MESSAGE_NS); paramForce.setText("true"); } msg.addContent(entry); return msg; }
Source:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((getArtUuid() == null) ? 0 : getArtUuid().hashCode()); result = prime * result + ((getBranchId().isInvalid()) ? 0 : getBranchId().hashCode()); return result; }

Target:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((getArtUuid() == null) ? 0 : getArtUuid().hashCode()); result = prime * result + getBranchId().hashCode(); return result; }
Source:
public void setDecoderResult(DecoderResult decoderResult) { ObjectUtil.checkNotNull(decoderResult, "decoderResult"); this.decoderResult = decoderResult; }

Target:
public void setDecoderResult(DecoderResult decoderResult) { this.decoderResult = ObjectUtil.checkNotNull(decoderResult, "decoderResult"); }
Source:
public static boolean treatAsClick(MouseEvent downEvent, MouseEvent upEvent) { if ((upEvent.time - downEvent.time) < 150) { return true; } else if (((upEvent.x > (downEvent.x + 5)) || (upEvent.x < (downEvent.x - 5))) || ((upEvent.y > (downEvent.y + 5)) || (upEvent.y < (downEvent.y - 5)))) { return false; } return true; }

Target:
public static boolean treatAsClick(MouseEvent downEvent, MouseEvent upEvent) { if (((upEvent.x > (downEvent.x + 5)) || (upEvent.x < (downEvent.x - 5))) || ((upEvent.y > (downEvent.y + 5)) || (upEvent.y < (downEvent.y - 5)))) { return false; } return true; }
Source:
String[] getExecutorCommand() { String topologyDefFile = getTopologyDefnFile(); Topology topology = getTopology(topologyDefFile); Config config = SchedulerConfigUtils.loadConfig(cluster, role, env, topologyJar, topologyDefFile, verboseMode, topology, "0", "20"); List<Integer> freePorts = new ArrayList<>(SchedulerUtils.PORTS_REQUIRED_FOR_EXECUTOR); for (int i = 0; i < SchedulerUtils.PORTS_REQUIRED_FOR_EXECUTOR; i++) { freePorts.add(SysUtils.getFreePort()); } Config runtime = Config.newBuilder() .put(Key.COMPONENT_RAMMAP, componentRamMap) .put(Key.TOPOLOGY_DEFINITION, topology) .build(); String[] executorCmd = SchedulerUtils.executorCommand(config, runtime, heronExecutorId, freePorts); LOG.info("Executor command line: " + Arrays.toString(executorCmd)); return executorCmd; }

Target:
String[] getExecutorCommand() { String topologyDefFile = getTopologyDefnFile(); Topology topology = getTopology(topologyDefFile); Config config = SchedulerConfigUtils.loadConfig(cluster, role, env, topologyJar, topologyDefFile, verboseMode, topology); List<Integer> freePorts = new ArrayList<>(SchedulerUtils.PORTS_REQUIRED_FOR_EXECUTOR); for (int i = 0; i < SchedulerUtils.PORTS_REQUIRED_FOR_EXECUTOR; i++) { freePorts.add(SysUtils.getFreePort()); } Config runtime = Config.newBuilder() .put(Key.COMPONENT_RAMMAP, componentRamMap) .put(Key.TOPOLOGY_DEFINITION, topology) .build(); String[] executorCmd = SchedulerUtils.executorCommand(config, runtime, heronExecutorId, freePorts); LOG.info("Executor command line: " + Arrays.toString(executorCmd)); return executorCmd; }
Source:
public void onTextChanged(CharSequence s, int start, int before, int count) { _after = String.valueOf(s.subSequence(start, start + count)); _afterlen = _after.length(); currentMessageMillis = System.currentTimeMillis(); if (lastMessageMillis == 0) { lastMessageMillis = currentMessageMillis; } if (_afterlen > _beforelen) { if (_after.startsWith(_before)) { String changedPart = String.valueOf(_after.subSequence(_before.length(), _after.length())); addTextEvent(changedPart, start + _before.length()); } else if (_after.endsWith(_before)) { String changedPart = String.valueOf(_after.subSequence(0, _after.length() - _before.length())); addTextEvent(changedPart, start); } else { addEraseEvent(before, start + before); addTextEvent(_after, start); } } else if (_afterlen == _beforelen) { addEraseEvent(before, start + before); addTextEvent(_after, start); } else { if (_before.startsWith(_after)) { addEraseEvent(_beforelen - _afterlen, start + _beforelen); } else if (_before.endsWith(_after)) { addEraseEvent(_beforelen - _afterlen, start + _beforelen - _afterlen); } else { addEraseEvent(before, start + before); addTextEvent(_after, start); } } }

Target:
public void onTextChanged(CharSequence s, int start, int before, int count) { if (!conversationFragment.ignoreOneEvent.get()) { int position; _after = String.valueOf(s.subSequence(start, start + count)); currentMessageMillis = SystemClock.elapsedRealtime(); if (lastMessageMillis == 0) { lastMessageMillis = currentMessageMillis; } if (_after.length() > _before.length()) { if (_after.startsWith(_before)) { String changedPart = String.valueOf(_after.subSequence(_before.length(), _after.length())); position = start + _before.length(); addTextEvent(changedPart, position == length_before ? null : position); } else if (_after.endsWith(_before)) { String changedPart = String.valueOf(_after.subSequence(0, _after.length() - _before.length())); position = start; addTextEvent(changedPart, position == length_before ? null : position); } else { position = start + before; addEraseEvent(before, position == length_before ? null : position); addTextEvent(_after, start); } } else if (_after.length() == _before.length()) { position = start + before; addEraseEvent(before, position == length_before ? null : position); addTextEvent(_after, start); } else { if (_before.startsWith(_after)) { position = start + _before.length(); addEraseEvent(_before.length() - _after.length(), position == length_before ? null : position); } else if (_before.endsWith(_after)) { position = start + _before.length() - _after.length(); addEraseEvent(_before.length() - _after.length(), position == length_before ? null : position); } else { position = start + before; addEraseEvent(before, position == length_before ? null : position); addTextEvent(_after, start); } } } }
Source:
public Result<Void> deleteStorage(final String id) { if (!storageDbRepository.getStorage(id).isPresent()) { return Result.notFound("No storage with ID " + id); } if (storageDbRepository.isStorageUsed(id)) { return Result.forbidden("Storage " + id + " is in use"); } try { storageDbRepository.deleteStorage(id); } catch (DataAccessException e) { return Result.problem(Problem.valueOf(Response.Status.INTERNAL_SERVER_ERROR, e.getMessage())); } return Result.ok(); }

Target:
public Result<Void> deleteStorage(final String id) { try { if (!storageDbRepository.getStorage(id).isPresent()) { return Result.notFound("No storage with ID " + id); } if (storageDbRepository.isStorageUsed(id)) { return Result.forbidden("Storage " + id + " is in use"); } storageDbRepository.deleteStorage(id); } catch (InternalNakadiException e) { return Result.problem(Problem.valueOf(INTERNAL_SERVER_ERROR, e.getMessage())); } return Result.ok(); }
Source:
public default NodalCurve shiftedBy(List<ValueAdjustment> adjustments) { double[] yValues = getYValues(); double[] shifted = new double[yValues.length]; int minSize = Math.min(yValues.length, adjustments.size()); for (int i = 0; i < minSize; i++) { shifted[i] = adjustments.get(i).adjust(yValues[i]); } return withYValues(shifted); }

Target:
public default NodalCurve shiftedBy(List<ValueAdjustment> adjustments) { double[] yValues = getYValues(); double[] shifted = yValues.clone(); int minSize = Math.min(yValues.length, adjustments.size()); for (int i = 0; i < minSize; i++) { shifted[i] = adjustments.get(i).adjust(yValues[i]); } return withYValues(shifted); }
Source:
private Map<String, String> getVars(@Nonnull String content, @Nonnull Map<String, String> currentEnvVars) throws EnvInjectException { String escapedContent = content; escapedContent = escapedContent.replaceAll("(?<=[^\\\\])\\\\(?=[^n])(?=[^\\\\])(?=[^\n])", "\\\\\\\\"); Map<String, String> result = new LinkedHashMap<String, String>(); StringReader stringReader = new StringReader(escapedContent); Properties properties = new Properties(); try { properties.load(stringReader); } catch (IOException ioe) { throw new EnvInjectException("Problem occurs on loading content", ioe); } finally { stringReader.close(); } for (Map.Entry<Object, Object> entry : properties.entrySet()) { result.put(processElement(entry.getKey(), currentEnvVars), processElement(entry.getValue(), currentEnvVars)); } return result; }

Target:
private Map<String, String> getVars(@Nonnull String content, @Nonnull Map<String, String> currentEnvVars) throws EnvInjectException { String escapedContent = content; escapedContent = escapedContent.replaceAll("(?<=[^\\\\])\\\\(?![n|:|*|?|\"|<|>|\\||\\/])(?![\\\\])(?![\n])", "\\\\\\\\"); Map<String, String> result = new LinkedHashMap<String, String>(); StringReader stringReader = new StringReader(escapedContent); Properties properties = new Properties(); try { properties.load(stringReader); } catch (IOException ioe) { throw new EnvInjectException("Problem occurs on loading content", ioe); } finally { stringReader.close(); } for (Map.Entry<Object, Object> entry : properties.entrySet()) { result.put(processElement(entry.getKey(), currentEnvVars), processElement(entry.getValue(), currentEnvVars)); } return result; }
Source:
public String[] getFileSuffixes() { String[] suffixes = configuration.getStringArray(FILE_SUFFIXES_KEY); if (suffixes == null || suffixes.length == 0) { suffixes = StringUtils.split(FILE_SUFFIXES_DEFVALUE, ","); } return suffixes; }

Target:
public String[] getFileSuffixes() { return configuration.getStringArray(FILE_SUFFIXES_KEY); }
Source:
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) { this.className = name; super.visit(version, access, name, signature, superName, interfaces); if(class_out != null) class_out.println(className + " References:"); }

Target:
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) { this.className = name; super.visit(version, access, name, signature, superName, interfaces); if(class_out != null) { class_out.println(className + " References:"); } }
Source:
public void throwsWhenNullValueInResponse() { assertThrows(AzureException.class, () -> { final String eventHubName = "event-hub-name-test"; final Date createdAtAsDate = new Date(1569275540L); final Map<String, Object> values = new HashMap<>(); values.put(ManagementChannel.MANAGEMENT_ENTITY_NAME_KEY, eventHubName); values.put(ManagementChannel.MANAGEMENT_RESULT_CREATED_AT, createdAtAsDate); values.put(ManagementChannel.MANAGEMENT_RESULT_PARTITION_IDS, null); final AmqpValue amqpValue = new AmqpValue(values); final Message message = Proton.message(); message.setBody(amqpValue); serializer.deserialize(message, EventHubProperties.class); }); }

Target:
public void throwsWhenNullValueInResponse() { final String eventHubName = "event-hub-name-test"; final Date createdAtAsDate = new Date(1569275540L); final Map<String, Object> values = new HashMap<>(); values.put(ManagementChannel.MANAGEMENT_ENTITY_NAME_KEY, eventHubName); values.put(ManagementChannel.MANAGEMENT_RESULT_CREATED_AT, createdAtAsDate); values.put(ManagementChannel.MANAGEMENT_RESULT_PARTITION_IDS, null); final AmqpValue amqpValue = new AmqpValue(values); final Message message = Proton.message(); message.setBody(amqpValue); assertThrows(AzureException.class, () -> { serializer.deserialize(message, EventHubProperties.class); }); }
Source:
public void init() { String remoteHost = String.format(EVENTHUB_REMOTE_HOST_FORMAT, eventHubNamespace); try { ConnectionStringBuilder connectionStringBuilder = new ConnectionStringBuilder() .setNamespaceName(eventHubNamespace) .setEventHubName(entityPath) .setSasKeyName(sasKeyName) .setSasKey(sasKey); eventHubClient = EventHubClient.createSync(connectionStringBuilder.toString(), retryPolicy, Executors.newFixedThreadPool(numClientThreads)); } catch (IOException | EventHubException e) { String msg = String.format("Creation of EventHub client failed for eventHub EntityPath: %s on remote host %s:%d", entityPath, remoteHost, ClientConstants.AMQPS_PORT); LOG.error(msg, e); throw new SamzaException(msg, e); } }

Target:
public void init() { String remoteHost = String.format(EVENTHUB_REMOTE_HOST_FORMAT, eventHubNamespace); try { ConnectionStringBuilder connectionStringBuilder = new ConnectionStringBuilder() .setNamespaceName(eventHubNamespace) .setEventHubName(entityPath) .setSasKeyName(sasKeyName) .setSasKey(sasKey); ThreadFactoryBuilder threadFactoryBuilder = new ThreadFactoryBuilder().setNameFormat("Samza EventHubClient Thread-%d"); eventHubClientExecutor = Executors.newFixedThreadPool(numClientThreads, threadFactoryBuilder.build()); eventHubClient = EventHubClient.createSync(connectionStringBuilder.toString(), retryPolicy, eventHubClientExecutor); } catch (IOException | EventHubException e) { String msg = String.format("Creation of EventHub client failed for eventHub EntityPath: %s on remote host %s:%d", entityPath, remoteHost, ClientConstants.AMQPS_PORT); LOG.error(msg, e); throw new SamzaException(msg, e); } }
Source:
public void endElement(String uri, String localName, String qName) throws SAXException { if ("link".equals(localName)) { setLocURL(); } else if ("guid".equals(localName)) { if (locURL == null) { setLocURL(); } resetCharacterBuffer(); } else if ("item".equals(localName)) { maybeAddSiteMapUrl(); } else if ("rss".equals(localName)) { sitemap.setProcessed(true); } else if ("pubDate".equals(localName)) { String value = getAndResetCharacterBuffer(); if (value != null) { lastMod = AbstractSiteMap.parseRSSTimestamp(value); if (lastMod != null && "channel".equals(super.currentElementParent())) { sitemap.setLastModified(lastMod); } } } }

Target:
public void endElement(String uri, String localName, String qName) throws SAXException { if ("link".equals(localName)) { setLocURL(); } else if ("guid".equals(localName)) { if (locURL == null) { setLocURL(); } resetCharacterBuffer(); } else if ("item".equals(localName)) { maybeAddSiteMapUrl(); } else if ("rss".equals(localName)) { sitemap.setProcessed(true); } else if ("pubDate".equals(localName)) { String value = getAndResetCharacterBuffer(); lastMod = AbstractSiteMap.parseRSSTimestamp(value); if (lastMod != null && "channel".equals(super.currentElementParent())) { sitemap.setLastModified(lastMod); } } }
Source:
public void setAbsoluteBounds(Node<? extends View, ?> node) { Bound ul = node.getContent().getBounds().getUpperLeft(); setDockerInfo(Point2D.create(ul.getX(), ul.getY())); Node dockSourceNode = getDockSourceNode(node); if (dockSourceNode != null) { @SuppressWarnings("unchecked") Bounds dockSourceNodeBounds = absoluteBounds(dockSourceNode); Bounds nodeBounds = node.getContent().getBounds(); double x = dockSourceNodeBounds.getX() + nodeBounds.getUpperLeft().getX(); double y = dockSourceNodeBounds.getY() + nodeBounds.getUpperLeft().getY(); super.setBounds(Bounds.create(x, y, x + nodeBounds.getWidth(), y + nodeBounds.getHeight())); } else { super.setAbsoluteBounds(node); } }

Target:
public void setAbsoluteBounds(Node<? extends View, ?> node) { Bound ul = node.getContent().getBounds().getUpperLeft(); setDockerInfo(Point2D.create(ul.getX(), ul.getY())); Optional<Node<View, Edge>> dockSourceNode = getDockSourceNode(node); if (dockSourceNode.isPresent()) { Bounds dockSourceNodeBounds = absoluteBounds(dockSourceNode.get()); Bounds nodeBounds = node.getContent().getBounds(); double x = dockSourceNodeBounds.getX() + nodeBounds.getUpperLeft().getX(); double y = dockSourceNodeBounds.getY() + nodeBounds.getUpperLeft().getY(); super.setBounds(Bounds.create(x, y, x + nodeBounds.getWidth(), y + nodeBounds.getHeight())); } else { super.setAbsoluteBounds(node); } }
Source:
public boolean addAll(int index, @Nonnull Collection<? extends T> elements) { boolean changed = delegate.addAll(index, elements); if (changed) { ModContainer modContainer = Loader.instance().activeModContainer(); if (modContainer != null) { for (T element : elements) { modContainerMap.put(element, modContainer); } } } return changed; }

Target:
public boolean addAll(int index, @Nonnull Collection<? extends T> elements) { boolean changed = delegate.addAll(index, elements); if (changed) { trackModContainer(elements); } return changed; }
Source:
public void formatXNodeToString() { XPathParser parser = new XPathParser("<users><user><id>100</id><name>Tom</name><age>30</age><cars><car>BMW</car><car>Audi</car><car>Benz</car></cars></user></users>"); String usersNodeToString = parser.evalNode("/users").toString(); String userNodeToString = parser.evalNode("/users/user").toString(); String carsNodeToString = parser.evalNode("/users/user/cars").toString(); String usersNodeToStringExpect = "<users>\n" + " <user>\n" + " <id>100</id>\n" + " <name>Tom</name>\n" + " <age>30</age>\n" + " <cars>\n" + " <car>BMW</car>\n" + " <car>Audi</car>\n" + " <car>Benz</car>\n" + " </cars>\n" + " </user>\n" + "</users>\n"; String userNodeToStringExpect = "<user>\n" + " <id>100</id>\n" + " <name>Tom</name>\n" + " <age>30</age>\n" + " <cars>\n" + " <car>BMW</car>\n" + " <car>Audi</car>\n" + " <car>Benz</car>\n" + " </cars>\n" + "</user>\n"; String carsNodeToStringExpect = "<cars>\n" + " <car>BMW</car>\n" + " <car>Audi</car>\n" + " <car>Benz</car>\n" + "</cars>\n"; assertEquals(usersNodeToString, usersNodeToStringExpect); assertEquals(userNodeToString, userNodeToStringExpect); assertEquals(carsNodeToString, carsNodeToStringExpect); }

Target:
public void formatXNodeToString() { XPathParser parser = new XPathParser("<users><user><id>100</id><name>Tom</name><age>30</age><cars><car>BMW</car><car>Audi</car><car>Benz</car></cars></user></users>"); String usersNodeToString = parser.evalNode("/users").toString(); String userNodeToString = parser.evalNode("/users/user").toString(); String carsNodeToString = parser.evalNode("/users/user/cars").toString(); String usersNodeToStringExpect = "<users>\n" + " <user>\n" + " <id>100</id>\n" + " <name>Tom</name>\n" + " <age>30</age>\n" + " <cars>\n" + " <car>BMW</car>\n" + " <car>Audi</car>\n" + " <car>Benz</car>\n" + " </cars>\n" + " </user>\n" + "</users>\n"; String userNodeToStringExpect = "<user>\n" + " <id>100</id>\n" + " <name>Tom</name>\n" + " <age>30</age>\n" + " <cars>\n" + " <car>BMW</car>\n" + " <car>Audi</car>\n" + " <car>Benz</car>\n" + " </cars>\n" + "</user>\n"; String carsNodeToStringExpect = "<cars>\n" + " <car>BMW</car>\n" + " <car>Audi</car>\n" + " <car>Benz</car>\n" + "</cars>\n"; assertEquals(usersNodeToStringExpect, usersNodeToString); assertEquals(userNodeToStringExpect, userNodeToString); assertEquals(carsNodeToStringExpect, carsNodeToString); }
Source:
protected void run() { long timerFdDeadline = Long.MAX_VALUE; for (;;) { try { int strategy = selectStrategy.calculateStrategy(selectNowSupplier, hasTasks()); switch (strategy) { case SelectStrategy.CONTINUE: continue; case SelectStrategy.BUSY_WAIT: strategy = epollBusyWait(); break; case SelectStrategy.SELECT: if (wakenUp.get() == 1) { wakenUp.set(0); } if (!hasTasks()) { timerFdDeadline = checkScheduleTaskQueueForNewDelay(timerFdDeadline); try { strategy = epollWait(); } finally { timerFdDeadline = nextDeadlineNanos.getAndAdd(Long.MAX_VALUE + 1); } } default: } try { boolean timerFdFired = processReady(events, strategy); if (timerFdFired) { timerFdDeadline = Long.MAX_VALUE; } } finally { runAllTasks(); } if (allowGrowing && strategy == events.length()) { events.increase(); } } catch (Throwable t) { handleLoopException(t); } try { if (isShuttingDown()) { closeAll(); if (confirmShutdown()) { break; } } } catch (Throwable t) { handleLoopException(t); } } }

Target:
protected void run() { long timerFdDeadline = Long.MAX_VALUE; for (;;) { try { processPendingChannelFlags(); int strategy = selectStrategy.calculateStrategy(selectNowSupplier, hasTasks()); switch (strategy) { case SelectStrategy.CONTINUE: continue; case SelectStrategy.BUSY_WAIT: strategy = epollBusyWait(); break; case SelectStrategy.SELECT: if (wakenUp.get() == 1) { wakenUp.set(0); } if (!hasTasks()) { timerFdDeadline = checkScheduleTaskQueueForNewDelay(timerFdDeadline); try { strategy = epollWait(); } finally { timerFdDeadline = nextDeadlineNanos.getAndAdd(Long.MAX_VALUE + 1); } } default: } try { if (processReady(events, strategy)) { timerFdDeadline = Long.MAX_VALUE; } } finally { runAllTasks(); } if (allowGrowing && strategy == events.length()) { events.increase(); } } catch (Throwable t) { handleLoopException(t); } try { if (isShuttingDown()) { closeAll(); if (confirmShutdown()) { break; } } } catch (Throwable t) { handleLoopException(t); } } }