auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private String translateInSet(List<RexNode> disjunctions) { RexNode firstNode = disjunctions.get(0); RexCall firstCall = (RexCall) firstNode; final RexNode left = firstCall.operands.get(0); String name = getLeftNodeFieldName(left); Set<String> rightLiteralValueList = new HashSet<>(); disjunctions.forEach(node -> { RexCall call = (RexCall) node; RexLiteral rightLiteral = (RexLiteral) call.operands.get(1); rightLiteralValueList.add(quoteCharLiteral(rightLiteral)); }); final StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(name); stringBuilder.append(" IN SET("); stringBuilder.append(Util.toString(rightLiteralValueList, "", ", ", "")); stringBuilder.append(")"); return stringBuilder.toString(); }

Target:
private String translateInSet(List<RexNode> disjunctions) { RexNode firstNode = disjunctions.get(0); RexCall firstCall = (RexCall) firstNode; final RexNode left = firstCall.operands.get(0); String name = getLeftNodeFieldName(left); Set<String> rightLiteralValueList = new HashSet<>(); disjunctions.forEach(node -> { RexCall call = (RexCall) node; RexLiteral rightLiteral = (RexLiteral) call.operands.get(1); rightLiteralValueList.add(quoteCharLiteral(rightLiteral)); }); final StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(name); stringBuilder.append(" IN SET("); stringBuilder.append(String.join(", ", rightLiteralValueList)); stringBuilder.append(")"); return stringBuilder.toString(); }
Source:
public static Builder builder() { return new AutoValue_CreateFirewallPolicy.Builder(); }

Target:
public static Builder builder() { return new AutoValue_CreateFirewallPolicy.Builder().shared(false).audited(false); }
Source:
private static void cleanShutdown() { log.info("CleanShutdown: Starting Cleanup."); shutdownServer = true; try { CorfuServerNode current = activeServer; if (current != null) { activeServer.close(); } } catch (Throwable th) { log.error("cleanShutdown: failed during shutdown", th); } LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory(); loggerContext.stop(); }

Target:
private static void cleanShutdown() { log.info("CleanShutdown: Starting Cleanup."); shutdownServer = true; try { CorfuServerNode current = activeServer; if (current != null) { current.close(); } } catch (Throwable th) { log.error("cleanShutdown: failed during shutdown", th); } LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory(); loggerContext.stop(); }
Source:
public void spec104_mustSignalOnErrorWhenFails() throws Throwable { try { errorPublisherTest(new PublisherTestRun<T>() { @Override public void run(final Publisher<T> pub) throws InterruptedException { final Latch latch = new Latch(env); pub.subscribe(new TestEnvironment.TestSubscriber<T>(env) { @Override public void onError(Throwable cause) { latch.assertOpen(String.format("Error-state Publisher %s called `onError` twice on new Subscriber", pub)); latch.close(); } }); latch.expectClose(String.format("Error-state Publisher %s did not call `onError` on new Subscriber", pub)); Thread.sleep(env.defaultTimeoutMillis()); env.verifyNoAsyncErrors(); } }); } catch (Throwable ex) { throw new RuntimeException("Publisher threw exception ("+ex+") instead of signalling error via onError!", ex); } }

Target:
public void spec104_mustSignalOnErrorWhenFails() throws Throwable { try { errorPublisherTest(new PublisherTestRun<T>() { @Override public void run(final Publisher<T> pub) throws InterruptedException { final Latch latch = new Latch(env); pub.subscribe(new TestEnvironment.TestSubscriber<T>(env) { @Override public void onError(Throwable cause) { latch.assertOpen(String.format("Error-state Publisher %s called `onError` twice on new Subscriber", pub)); latch.close(); } }); latch.expectClose(String.format("Error-state Publisher %s did not call `onError` on new Subscriber", pub)); env.verifyNoAsyncErrors(env.defaultTimeoutMillis()); } }); } catch (Throwable ex) { throw new RuntimeException(String.format("Publisher threw exception (%s) instead of signalling error via onError!", ex.getMessage()), ex); } }
Source:
public final Result process(Conveyor conveyor) { Map<DispatchingId, InboxMessage> seen = new HashMap<>(); for (InboxMessage message : conveyor) { InboxMessageStatus status = message.getStatus(); if (status == InboxMessageStatus.TO_DELIVER) { DispatchingId dispatchingId = new DispatchingId(message); if (seen.containsKey(dispatchingId)) { conveyor.markDuplicateAndRemove(message); } else { seen.put(dispatchingId, message); if (idempotenceWindow != null) { conveyor.keepForLonger(message, idempotenceWindow); } } } } if (!seen.isEmpty()) { Collection<InboxMessage> toDeliver = seen.values(); List<InboxMessage> toDispatch = deduplicateAndSort(toDeliver, conveyor); DeliveryErrors errors = action.executeFor(toDispatch); conveyor.markDelivered(toDispatch); Result result = new Result(toDispatch.size(), errors); return result; } else { return emptyResult(); } }

Target:
public final Result process(Conveyor conveyor) { FilterToDeliver filter = new FilterToDeliver(conveyor); Collection<InboxMessage> filtered = filter.messagesToDispatch(); if (filtered.isEmpty()) { return emptyResult(); } List<InboxMessage> toDispatch = deduplicateAndSort(filtered, conveyor); DeliveryErrors errors = action.executeFor(toDispatch); conveyor.markDelivered(toDispatch); Result result = new Result(toDispatch.size(), errors); return result; }
Source:
public void update() { super.update(); if (Game.isClient(getWorld())) { return; } ItemStack feed = getStackInSlot(0); if (clock % (MIN_FEED_INTERVAL / 4) == 0 && (feed == null || sizeOf(feed) < feed.getMaxStackSize())) { InventoryComposite chests = InvTools.getAdjacentInventories(worldObj, getPos()); InvTools.moveOneItem(chests, feedInv, StandardStackFilters.FEED); } feed = getStackInSlot(0); feedTime--; if (!powered && feed != null && sizeOf(feed) > 0 && feedTime <= 0) { feedTime = MIN_FEED_INTERVAL + rand.nextInt(FEED_VARIANCE); AxisAlignedBB box = AABBFactory.start().createBoxForTileAt(getPos()).raiseFloor(-1).raiseCeiling(2).expandHorizontally(AREA).build(); List<EntityAnimal> animals = worldObj.getEntitiesWithinAABB(EntityAnimal.class, box); for (EntityAnimal target : animals) { if (target.isBreedingItem(getStackInSlot(0)) && feedAnimal(target)) { if (feedCounter <= 0) { setInventorySlotContents(0, InvTools.depleteItem(feed)); feedCounter = ANIMALS_PER_FOOD; } feedCounter--; sendFeedPacket(target); break; } } } }

Target:
public void update() { super.update(); if (Game.isClient(getWorld())) { return; } ItemStack feed = getStackInSlot(0); if (clock % (MIN_FEED_INTERVAL / 4) == 0 && (feed == null || sizeOf(feed) < feed.getMaxStackSize())) { InventoryComposite chests = InvTools.getAdjacentInventories(worldObj, getPos()); InvTools.moveOneItem(chests, feedInv, StandardStackFilters.FEED); } feed = getStackInSlot(0); feedTime--; if (!powered && !isEmpty(feed) && feedTime <= 0) { feedTime = MIN_FEED_INTERVAL + rand.nextInt(FEED_VARIANCE); AxisAlignedBB box = AABBFactory.start().createBoxForTileAt(getPos()).raiseFloor(-1).raiseCeiling(2).expandHorizontally(AREA).build(); List<EntityAnimal> animals = worldObj.getEntitiesWithinAABB(EntityAnimal.class, box); for (EntityAnimal target : animals) { if (target.isBreedingItem(getStackInSlot(0)) && feedAnimal(target)) { if (feedCounter <= 0) { setInventorySlotContents(0, InvTools.depleteItem(feed)); feedCounter = ANIMALS_PER_FOOD; } feedCounter--; sendFeedPacket(target); break; } } } }
Source:
public void testStringWithDefaultSet() { Version v = null; String formatString = "format(sds):"; String one = "abc"; String two = "def"; for (char element : s_delim) { StringBuilder buf = new StringBuilder(); buf.append(formatString); buf.append(one); buf.append(element); buf.append(two); v = Version.parseVersion(buf.toString()); assertNotNull(v); assertEquals(one, v.getSegment(0)); assertEquals(two, v.getSegment(1)); } }

Target:
public void testStringWithDefaultSet() { Version v = null; String formatString = "format(sds):"; String one = "abc"; String two = "def"; for (char delim : s_delim) { StringBuilder buf = new StringBuilder(); buf.append(formatString); buf.append(one); buf.append(delim); buf.append(two); v = Version.parseVersion(buf.toString()); assertNotNull(v); assertEquals(one, v.getSegment(0)); assertEquals(two, v.getSegment(1)); } }
Source:
public void testDeadWatcherMetrics() { MyDeadWatcherListener listener = new MyDeadWatcherListener(); WatcherCleaner cleaner = new WatcherCleaner(listener, 1, 1, 1, 1); listener.setDelayMs(20); cleaner.start(); listener.setCountDownLatch(new CountDownLatch(3)); cleaner.addDeadWatcher(1); cleaner.addDeadWatcher(2); cleaner.addDeadWatcher(3); Assert.assertTrue(listener.wait(5000)); Map<String, Object> values = ServerMetrics.getAllValues(); Assert.assertTrue("Adding dead watcher should be stalled twice", (Long)values.get("add_dead_watcher_stall_time") > 0L); Assert.assertEquals("Total dead watchers added to the queue should be 3", 3L, values.get("dead_watchers_queued")); Assert.assertEquals("Total dead watchers cleared should be 3", 3L, values.get("dead_watchers_cleared")); Assert.assertEquals(3L, values.get("cnt_dead_watchers_cleaner_latency")); Assert.assertEquals(20D, (Double)values.get("avg_dead_watchers_cleaner_latency"), 5); Assert.assertEquals(20D, ((Long)values.get("min_dead_watchers_cleaner_latency")).doubleValue(), 5); Assert.assertEquals(20D, ((Long)values.get("max_dead_watchers_cleaner_latency")).doubleValue(), 5); Assert.assertEquals(20D, ((Long)values.get("p50_dead_watchers_cleaner_latency")).doubleValue(), 5); Assert.assertEquals(20D, ((Long)values.get("p95_dead_watchers_cleaner_latency")).doubleValue(), 5); Assert.assertEquals(20D, ((Long)values.get("p99_dead_watchers_cleaner_latency")).doubleValue(), 5); }

Target:
public void testDeadWatcherMetrics() { MyDeadWatcherListener listener = new MyDeadWatcherListener(); WatcherCleaner cleaner = new WatcherCleaner(listener, 1, 1, 1, 1); listener.setDelayMs(20); cleaner.start(); listener.setCountDownLatch(new CountDownLatch(3)); cleaner.addDeadWatcher(1); cleaner.addDeadWatcher(2); cleaner.addDeadWatcher(3); Assert.assertTrue(listener.wait(5000)); Map<String, Object> values = ServerMetrics.getAllValues(); Assert.assertThat("Adding dead watcher should be stalled twice", (Long)values.get("add_dead_watcher_stall_time"), greaterThan(0L)); Assert.assertEquals("Total dead watchers added to the queue should be 3", 3L, values.get("dead_watchers_queued")); Assert.assertEquals("Total dead watchers cleared should be 3", 3L, values.get("dead_watchers_cleared")); Assert.assertEquals(3L, values.get("cnt_dead_watchers_cleaner_latency")); Assert.assertEquals(20D, (Double)values.get("avg_dead_watchers_cleaner_latency"), 5); Assert.assertEquals(20D, ((Long)values.get("min_dead_watchers_cleaner_latency")).doubleValue(), 5); Assert.assertEquals(20D, ((Long)values.get("max_dead_watchers_cleaner_latency")).doubleValue(), 5); Assert.assertEquals(20D, ((Long)values.get("p50_dead_watchers_cleaner_latency")).doubleValue(), 5); Assert.assertEquals(20D, ((Long)values.get("p95_dead_watchers_cleaner_latency")).doubleValue(), 5); Assert.assertEquals(20D, ((Long)values.get("p99_dead_watchers_cleaner_latency")).doubleValue(), 5); }
Source:
public Collection<ResourceLocation> getTextures() { ImmutableSet.Builder<ResourceLocation> builder = ImmutableSet.builder(); try { ResourceLocation loc = interior; loc = new ResourceLocation(loc.getResourceDomain(), "textures/" + loc.getResourcePath() + ".png"); Minecraft.getMinecraft().getResourceManager().getAllResources(loc); loc = front; loc = new ResourceLocation(loc.getResourceDomain(), "textures/" + loc.getResourcePath() + ".png"); Minecraft.getMinecraft().getResourceManager().getAllResources(loc); builder.add(interior); builder.add(front); hasTextures = true; } catch(IOException e) { hasTextures = false; } return builder.build(); }

Target:
public Collection<ResourceLocation> getTextures() { ImmutableSet.Builder<ResourceLocation> builder = ImmutableSet.builder(); if(baseLocation != null) builder.add(baseLocation); if(liquidLocation != null) builder.add(liquidLocation); if(coverLocation != null) builder.add(coverLocation); return builder.build(); }
Source:
public void startServer(Integer timeout) throws Exception { if (server != null) { fail("Server already started"); } server = SshServer.setUpDefaultServer(); if (timeout != null) { server.getProperties().put(FactoryManager.AUTH_TIMEOUT, timeout.toString()); } server.setPort(5000); server.setKeyPairProvider(new SimpleGeneratorHostKeyProvider(new File("hostkey.ser").toPath())); server.setPasswordAuthenticator((username, password, session) -> authenticator.authenticate(username, password, session)); server.setShellFactory(new EchoShellFactory()); server.start(); }

Target:
public void startServer(Integer timeout) throws Exception { if (server != null) { fail("Server already started"); } server = SshServer.setUpDefaultServer(); if (timeout != null) { server.getProperties().put(FactoryManager.AUTH_TIMEOUT, timeout.toString()); } server.setKeyPairProvider(new SimpleGeneratorHostKeyProvider(new File("hostkey.ser").toPath())); server.setPasswordAuthenticator((username, password, session) -> authenticator.authenticate(username, password, session)); server.setShellFactory(new EchoShellFactory()); server.start(); port = server.getPort(); }
Source:
protected void setupContent(ViewGroup rootView) { mEmailInput = (WPLoginInputRow) rootView.findViewById(R.id.login_email_row); autoFillFromBuildConfig("DEBUG_DOTCOM_LOGIN_EMAIL", mEmailInput.getEditText()); mEmailInput.addTextChangedListener(this); mEmailInput.setOnEditorCommitListener(this); LinearLayout googleLoginButton = (LinearLayout) rootView.findViewById(R.id.login_google_button); googleLoginButton.setOnClickListener(new OnClickListener() { @SuppressWarnings("PrivateMemberAccessBetweenOuterAndInnerClass") @Override public void onClick(View view) { AnalyticsTracker.track(AnalyticsTracker.Stat.LOGIN_SOCIAL_BUTTON_CLICK); AnalyticsTracker.track(AnalyticsTracker.Stat.LOGIN_GOOGLE_TAPPED); WPActivityUtils.hideKeyboard(getActivity().getCurrentFocus()); if (NetworkUtils.checkConnection(getActivity())) { mOldSitesIDs = SiteUtils.getCurrentSiteIds(mSiteStore, false); isSocialLogin = true; addGoogleFragment(); } } }); }

Target:
protected void setupContent(ViewGroup rootView) { mEmailInput = (WPLoginInputRow) rootView.findViewById(R.id.login_email_row); autoFillFromBuildConfig("DEBUG_DOTCOM_LOGIN_EMAIL", mEmailInput.getEditText()); mEmailInput.addTextChangedListener(this); mEmailInput.setOnEditorCommitListener(this); LinearLayout googleLoginButton = (LinearLayout) rootView.findViewById(R.id.login_google_button); googleLoginButton.setOnClickListener(new OnClickListener() { @SuppressWarnings("PrivateMemberAccessBetweenOuterAndInnerClass") @Override public void onClick(View view) { AnalyticsTracker.track(AnalyticsTracker.Stat.LOGIN_SOCIAL_BUTTON_CLICK); WPActivityUtils.hideKeyboard(getActivity().getCurrentFocus()); if (NetworkUtils.checkConnection(getActivity())) { mOldSitesIDs = SiteUtils.getCurrentSiteIds(mSiteStore, false); isSocialLogin = true; addGoogleFragment(); } } }); }
Source:
public void create_two_qprofiles_in_different_organizations_with_same_name_and_language() { logInAsQProfileAdministrator(); String profileName = "Profile123"; OrganizationDto organization1 = dbTester.organizations().insert(); TestRequest request1 = wsTester.newRequest() .setMediaType(MediaTypes.PROTOBUF) .setParam("organization", organization1.getKey()) .setParam("name", profileName) .setParam("language", XOO_LANGUAGE) .setParam("backup_with_messages", "<xml/>"); assertThat(executeRequest(request1).getProfile().getOrganization()) .isEqualTo(organization1.getKey()); OrganizationDto organization2 = dbTester.organizations().insert(); TestRequest request2 = wsTester.newRequest() .setMediaType(MediaTypes.PROTOBUF) .setParam("organization", organization2.getKey()) .setParam("name", profileName) .setParam("language", XOO_LANGUAGE) .setParam("backup_with_messages", "<xml/>"); assertThat(executeRequest(request2).getProfile().getOrganization()) .isEqualTo(organization2.getKey()); }

Target:
public void create_two_qprofiles_in_different_organizations_with_same_name_and_language() { logInAsQProfileAdministrator(); String profileName = "Profile123"; OrganizationDto organization1 = dbTester.organizations().insert(); TestRequest request1 = wsTester.newRequest() .setMediaType(MediaTypes.PROTOBUF) .setParam("organization", organization1.getKey()) .setParam("name", profileName) .setParam("language", XOO_LANGUAGE); assertThat(executeRequest(request1).getProfile().getOrganization()) .isEqualTo(organization1.getKey()); OrganizationDto organization2 = dbTester.organizations().insert(); TestRequest request2 = wsTester.newRequest() .setMediaType(MediaTypes.PROTOBUF) .setParam("organization", organization2.getKey()) .setParam("name", profileName) .setParam("language", XOO_LANGUAGE); assertThat(executeRequest(request2).getProfile().getOrganization()) .isEqualTo(organization2.getKey()); }
Source:
private Set<LfsPointer> findObjectsToPush() throws IOException, MissingObjectException, IncorrectObjectTypeException { Set<LfsPointer> toPush = new TreeSet<>(); for (RemoteRefUpdate up : refs) { try (ObjectWalk walk = new ObjectWalk(getRepository())) { walk.setRewriteParents(false); excludeAllRemoteRefs(walk); walk.markStart(walk.parseCommit(up.getNewObjectId())); for (;;) { if (walk.next() == null) { break; } } findAllLfsPointers(toPush, walk); } } return toPush; }

Target:
private Set<LfsPointer> findObjectsToPush() throws IOException, MissingObjectException, IncorrectObjectTypeException { Set<LfsPointer> toPush = new TreeSet<>(); try (ObjectWalk walk = new ObjectWalk(getRepository())) { for (RemoteRefUpdate up : refs) { walk.setRewriteParents(false); excludeRemoteRefs(walk); walk.markStart(walk.parseCommit(up.getNewObjectId())); while (walk.next() != null) { } findLfsPointers(toPush, walk); } } return toPush; }
Source:
int weightToWeightFlags(long edgePointer, double weight) { if (weight < 0) throw new IllegalArgumentException("weight cannot be negative but was " + weight); int weightInt; if (weight < MIN_WEIGHT) { NodeAccess nodeAccess = getNodeAccess(); int edgeId = -1; LOGGER.warn("Setting weights smaller than " + MIN_WEIGHT + " is not allowed in CHGraphImpl#setWeight. " + "You passed: " + weight + " for the edge " + edgeId + " nodeA " + nodeAccess.getLat(getNodeA(edgePointer)) + "," + nodeAccess.getLon(getNodeA(edgePointer)) + " nodeB " + nodeAccess.getLat(getNodeB(edgePointer)) + "," + nodeAccess.getLon(getNodeB(edgePointer))); weight = MIN_WEIGHT; } if (weight > MAX_WEIGHT) weightInt = MAX_WEIGHT_31; else weightInt = Math.round((float) (weight * WEIGHT_FACTOR)) << 2; return weightInt; }

Target:
int weightToWeightFlags(long edgePointer, double weight) { if (weight < 0) throw new IllegalArgumentException("weight cannot be negative but was " + weight); int weightInt; if (weight < MIN_WEIGHT) { NodeAccess nodeAccess = getNodeAccess(); int edgeId = -1; LOGGER.warn("Setting weights smaller than " + MIN_WEIGHT + " is not allowed in CHGraphImpl#setWeight. " + "You passed: " + weight + " for the edge " + edgeId + " nodeA " + nodeAccess.getLat(getNodeA(edgePointer)) + "," + nodeAccess.getLon(getNodeA(edgePointer)) + " nodeB " + nodeAccess.getLat(getNodeB(edgePointer)) + "," + nodeAccess.getLon(getNodeB(edgePointer))); weight = MIN_WEIGHT; } if (weight > MAX_WEIGHT) weightInt = MAX_WEIGHT_31; else weightInt = ((int) Math.round(weight * WEIGHT_FACTOR)) << 2; return weightInt; }
Source:
public ServiceBuilder<CacheContainer> build(ServiceTarget target) { Function<EmbeddedCacheManager, CacheContainer> mapper = manager -> new DefaultCacheContainer(this.name, manager, this.defaultCache, this.batcherFactory); Supplier<EmbeddedCacheManager> supplier = () -> { GlobalConfiguration config = this.configuration.getValue(); EmbeddedCacheManager manager = new DefaultCacheManager(config, null, false); manager.addListener(this); manager.start(); InfinispanLogger.ROOT_LOGGER.debugf("%s cache container started", this.name); return manager; }; Consumer<EmbeddedCacheManager> destroyer = manager -> { manager.stop(); manager.removeListener(this); InfinispanLogger.ROOT_LOGGER.debugf("%s cache container stopped", this.name); }; Service<CacheContainer> service = new SuppliedValueService<>(mapper, supplier, destroyer); List<ServiceName> list = new ArrayList<>(); for (ServiceName alias : this.aliases) { list.add(alias); } ServiceBuilder<CacheContainer> builder = target.addService(this.getServiceName(), service) .addAliases(list.toArray(new ServiceName[0])) ; return this.configuration.register(builder); }

Target:
public ServiceBuilder<CacheContainer> build(ServiceTarget target) { Function<EmbeddedCacheManager, CacheContainer> mapper = manager -> new DefaultCacheContainer(this.name, manager, this.defaultCache, this.batcherFactory); Supplier<EmbeddedCacheManager> supplier = () -> { GlobalConfiguration config = this.configuration.getValue(); EmbeddedCacheManager manager = new DefaultCacheManager(config, null, false); manager.addListener(this); manager.start(); InfinispanLogger.ROOT_LOGGER.debugf("%s cache container started", this.name); return manager; }; Consumer<EmbeddedCacheManager> destroyer = manager -> { manager.stop(); manager.removeListener(this); InfinispanLogger.ROOT_LOGGER.debugf("%s cache container stopped", this.name); }; Service<CacheContainer> service = new SuppliedValueService<>(mapper, supplier, destroyer); ServiceBuilder<CacheContainer> builder = target.addService(this.getServiceName(), service) .addAliases(aliases.toArray(NO_SERVICE_NAMES)); return this.configuration.register(builder); }
Source:
public boolean keyPressed(KeyEvent event) { switch (event.keyCode) { case SWT.ARROW_DOWN: getViewer().scrollByOffset(0, 400); return true; case SWT.ARROW_UP: getViewer().scrollByOffset(0, -400); return true; case SWT.ARROW_RIGHT: getViewer().scrollByOffset(400, 0); return true; case SWT.ARROW_LEFT: getViewer().scrollByOffset(-400, 0); return true; case SWT.PAGE_DOWN: if ((event.stateMask & SWT.MODIFIER_MASK) == 0) { getViewer().scrollByOffset(0, getViewer().getFigureCanvasSize().y); } else { getViewer().scrollByOffset(getViewer().getFigureCanvasSize().x, 0); } return true; case SWT.PAGE_UP: if ((event.stateMask & SWT.MODIFIER_MASK) == 0) { getViewer().scrollByOffset(0, -getViewer().getFigureCanvasSize().y); } else { getViewer().scrollByOffset(-getViewer().getFigureCanvasSize().x, 0); } return true; default: return super.keyPressed(event); } }

Target:
public boolean keyPressed(KeyEvent event) { switch (event.keyCode) { case SWT.ARROW_DOWN: getViewer().scrollByOffset(0, SCROLL_SPEED); return true; case SWT.ARROW_UP: getViewer().scrollByOffset(0, -SCROLL_SPEED); return true; case SWT.ARROW_RIGHT: getViewer().scrollByOffset(SCROLL_SPEED, 0); return true; case SWT.ARROW_LEFT: getViewer().scrollByOffset(-SCROLL_SPEED, 0); return true; case SWT.PAGE_DOWN: if ((event.stateMask & SWT.MODIFIER_MASK) == 0) { getViewer().scrollByOffset(0, getViewer().getFigureCanvasSize().y); } else { getViewer().scrollByOffset(getViewer().getFigureCanvasSize().x, 0); } return true; case SWT.PAGE_UP: if ((event.stateMask & SWT.MODIFIER_MASK) == 0) { getViewer().scrollByOffset(0, -getViewer().getFigureCanvasSize().y); } else { getViewer().scrollByOffset(-getViewer().getFigureCanvasSize().x, 0); } return true; default: return super.keyPressed(event); } }
Source:
public List<CommentOutputView> getCommentsCreatedOn(LocalDate fromDate, LocalDate toDate) { return hibernateTemplate.execute(session -> { Query query = session.createQuery("FROM Comment " + "WHERE created >= :fromDate AND created <= :toDate "); query.setParameter("fromDate", java.sql.Date.valueOf(fromDate)); query.setParameter("toDate", java.sql.Date.valueOf(toDate)); List<Comment> comments = query.list(); CommentOutputView.Factory viewFactory = new CommentOutputView.Factory(runtimeConfiguration); return comments.stream().map(viewFactory::buildView).collect(Collectors.toList()); }); }

Target:
public List<CommentNodeView> getCommentsCreatedOn(LocalDate fromDate, LocalDate toDate) { return hibernateTemplate.execute(session -> { Query query = session.createQuery("FROM Comment " + "WHERE created >= :fromDate AND created <= :toDate "); query.setParameter("fromDate", java.sql.Date.valueOf(fromDate)); query.setParameter("toDate", java.sql.Date.valueOf(toDate)); List<Comment> comments = query.list(); return comments.stream().map(commentNodeViewFactory::create).collect(Collectors.toList()); }); }
Source:
public void getFailedLRAs(Map<URI, Transaction> lras) { InputObjectState aa_uids = new InputObjectState(); try { if (getUids(aa_uids)) { boolean moreUids = true; while (moreUids) { try { Uid uid = UidHelper.unpackFrom(aa_uids); if (uid.equals(Uid.nullUid())) { moreUids = false; } else { Transaction lra = new Transaction(lraService, new Uid(uid)); lra.activate(); lras.put(lra.getId(), lra); } } catch (Exception ex) { moreUids = false; } } } } catch (ObjectStoreException e) { if (LRALogger.logger.isInfoEnabled()) { LRALogger.logger.infof("LRARecoverModule: Object store exception: %s", e.getMessage()); } } }

Target:
public void getFailedLRAs(Map<URI, Transaction> lras) { InputObjectState aa_uids = new InputObjectState(); Consumer<Uid> failedLRACreator = uid -> { Transaction lra = new Transaction(lraService, new Uid(uid)); lra.activate(); lras.put(lra.getId(), lra); }; if (getUids(aa_uids)) { forEach(aa_uids, failedLRACreator); } }
Source:
private CompletionStage<Collection<ClusterListenerReplicateCallable<Object, Object>>> getClusterListeners( int topologyId, List<Address> sources) { if (sources.isEmpty()) { if (trace) log.trace("Unable to acquire cluster listeners from other members, assuming none are present"); return CompletableFuture.completedFuture(Collections.emptySet()); } Address source = sources.get(0); if (sources.get(0).equals(rpcManager.getAddress())) { return getClusterListeners(topologyId, sources.subList(1, sources.size())); } if (trace) log.tracef("Requesting cluster listeners of cache %s from node %s", cacheName, sources); TopologyAffectedCommand cmd = commandsFactory.buildStateTransferGetListenersCommand(topologyId); CompletionStage<ValidResponse> remoteStage = rpcManager.invokeCommand(source, cmd, SingleResponseCollector.validOnly(), rpcOptions); return handleAndCompose(remoteStage, (response, throwable) -> { if (throwable != null) { log.exceptionDuringClusterListenerRetrieval(source, throwable); } if (response instanceof SuccessfulResponse) { return CompletableFuture.completedFuture( (Collection<ClusterListenerReplicateCallable<Object, Object>>) response.getResponseValue()); } else { log.unsuccessfulResponseForClusterListeners(source, response); return getClusterListeners(topologyId, sources.subList(1, sources.size())); } }); }

Target:
private CompletionStage<Collection<ClusterListenerReplicateCallable<Object, Object>>> getClusterListeners( int topologyId, List<Address> sources) { if (sources.isEmpty()) { if (trace) log.trace("Unable to acquire cluster listeners from other members, assuming none are present"); return CompletableFuture.completedFuture(Collections.emptySet()); } Address source = sources.get(0); if (sources.get(0).equals(rpcManager.getAddress())) { return getClusterListeners(topologyId, sources.subList(1, sources.size())); } if (trace) log.tracef("Requesting cluster listeners of cache %s from node %s", cacheName, sources); CacheRpcCommand cmd = commandsFactory.buildStateTransferGetListenersCommand(topologyId); CompletionStage<ValidResponse> remoteStage = rpcManager.invokeCommand(source, cmd, SingleResponseCollector.validOnly(), rpcOptions); return handleAndCompose(remoteStage, (response, throwable) -> { if (throwable != null) { log.exceptionDuringClusterListenerRetrieval(source, throwable); } if (response instanceof SuccessfulResponse) { return CompletableFuture.completedFuture( (Collection<ClusterListenerReplicateCallable<Object, Object>>) response.getResponseValue()); } else { log.unsuccessfulResponseForClusterListeners(source, response); return getClusterListeners(topologyId, sources.subList(1, sources.size())); } }); }
Source:
private String genUnique() { long timePart = (System.currentTimeMillis() << 5) | (msCounter++ & 31); long ipPart = 0; try { byte[] address = InetAddress.getLocalHost().getAddress(); for (byte addres : address) ipPart = ((ipPart << 8) | (addres & 0xff)); } catch (UnknownHostException e) { } int port = 0; try { socket = new ServerSocket(0, 1, InetAddress.getByName("127.0.0.1")); port = socket.getLocalPort(); } catch (IOException e) { try { if (socket != null) socket.close(); } catch (IOException e1) { } port = new Random().nextInt() & 0xffff; } long aPart = (ipPart << 16) | (port & 0xffff); return Long.toHexString(timePart) + "_" + Long.toHexString(aPart); }

Target:
private String genUnique() { long timePart = (System.currentTimeMillis() << 5) | (msCounter++ & 31); long ipPart = 0; try { for (byte addr : InetAddress.getLocalHost().getAddress()) ipPart = ((ipPart << 8) | (addr & 0xff)); } catch (UnknownHostException e) { } int port = 0; try { socket = new ServerSocket(0, 1, InetAddress.getByName("127.0.0.1")); port = socket.getLocalPort(); } catch (IOException e) { try { if (socket != null) socket.close(); } catch (IOException e1) { } port = new Random().nextInt() & 0xffff; } long aPart = (ipPart << 16) | (port & 0xffff); return Long.toHexString(timePart) + "_" + Long.toHexString(aPart); }
Source:
private List<Content> getContentForExplicitEquivFromRequest(HttpServletRequest req) throws InvalidApiKeyException { Application application = getAndValidateApplication(req); List<String> uris = parseList(req.getParameter(URIS)); List<String> ids = parseList(req.getParameter(IDS)); if (uris.size() + ids.size() != 2) { throw new IllegalArgumentException("Must specify exactly two " + URIS + " or " + IDS); } List<Content> contents = resolveContent(uris, ids); if (contents.size() != 2 || contents.get(0).equals(contents.get(1))) { throw new IllegalArgumentException("Must specify exactly two distinct pieces of content"); } for (Content content : contents) { validateApplicationForExplicitEquiv(content.getPublisher(), application); } return contents; }

Target:
private List<Content> getContentForExplicitEquivFromRequest(HttpServletRequest req) throws InvalidApiKeyException { Application application = getAndValidateApplication(req); List<String> uris = parseList(req.getParameter(URIS)); List<String> ids = parseList(req.getParameter(IDS)); if (uris.size() + ids.size() != 2) { throw new IllegalArgumentException("Must specify exactly a distinct sum of two of " + URIS + " or " + IDS); } List<Content> contents = resolveContent(uris, ids); if (contents.size() != 2 || contents.get(0).equals(contents.get(1))) { throw new IllegalArgumentException("Must specify exactly a distinct sum of two of " + URIS + " or " + IDS); } for (Content content : contents) { validateApplicationForExplicitEquiv(content.getPublisher(), application); } return contents; }
Source:
private void buildComputeEngineObject() throws IOException, GeneralSecurityException { try { if (log.isDebugEnabled()) { log.debug("Authorizing and building the compute engine object"); } HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport(); JsonFactory jsonFactory = JacksonFactory.getDefaultInstance(); GoogleCredential credential = new GoogleCredential.Builder().setTransport(httpTransport) .setJsonFactory(jsonFactory) .setServiceAccountId(ACCOUNT_ID) .setServiceAccountScopes(Collections.singleton(ComputeScopes.COMPUTE)) .setServiceAccountPrivateKeyFromP12File(new File(KEY_FILE_PATH)) .build(); compute = new Compute.Builder( httpTransport, jsonFactory, null).setApplicationName(PROJECT_NAME) .setHttpRequestInitializer(credential).build(); if (log.isDebugEnabled()) { log.debug("Successfully built the compute engine object"); } } catch (GeneralSecurityException e) { log.error("Could not authenticate and build compute object"); throw new GeneralSecurityException(e); } catch (IOException e) { log.error("Could not authenticate and build compute object"); throw new IOException(e); } }

Target:
private void buildComputeEngineObject() throws IOException, GeneralSecurityException { try { if (log.isDebugEnabled()) { log.debug("Authorizing and building the compute engine object"); } HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport(); JsonFactory jsonFactory = JacksonFactory.getDefaultInstance(); GoogleCredential credential = new GoogleCredential.Builder().setTransport(httpTransport) .setJsonFactory(jsonFactory) .setServiceAccountId(ACCOUNT_ID) .setServiceAccountScopes(Collections.singleton(ComputeScopes.COMPUTE)) .setServiceAccountPrivateKeyFromP12File(new File(KEY_FILE_PATH)) .build(); compute = new Compute.Builder( httpTransport, jsonFactory, null).setApplicationName(PROJECT_NAME) .setHttpRequestInitializer(credential).build(); if (log.isDebugEnabled()) { log.debug("Successfully built the compute engine object"); } } catch (GeneralSecurityException e) { log.error("Could not authenticate and build compute object", e); throw new GeneralSecurityException(e); } catch (IOException e) { log.error("Could not authenticate and build compute object", e); throw new IOException(e); } }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Mapbox.getInstance(this, getString(R.string.access_token)); setContentView(R.layout.activity_traffic_plugin); mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(MapboxMap mapboxMap) { TrafficPluginActivity.this.map = mapboxMap; TrafficPluginActivity.this.trafficPlugin = new TrafficPlugin(mapView, mapboxMap); TrafficPluginActivity.this.trafficPlugin.toggle(); } }); FloatingActionButton trafficToggleButton = (FloatingActionButton) findViewById(R.id.traffic_toggle_fab); trafficToggleButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (map != null) { trafficPlugin.toggle(); } } }); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Mapbox.getInstance(this, getString(R.string.access_token)); setContentView(R.layout.activity_traffic_plugin); mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(MapboxMap mapboxMap) { map = mapboxMap; trafficPlugin = new TrafficPlugin(mapView, mapboxMap); TrafficPluginActivity.this.trafficPlugin.toggle(); } }); findViewById(R.id.traffic_toggle_fab).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (map != null) { trafficPlugin.toggle(); } } }); }
Source:
public void validateWhatsNewItems(List<WhatsNewItemModel> whatsNewItems) { for (WhatsNewItemModel item : whatsNewItems) { assertThat(item).isNotNull(); assertThat(item.getTitle()).isNotEmpty(); assertThat(item.getMessage()).isNotEmpty(); assertThat(item.getImage()).isNotEmpty(); if (item.isAndroidMessage()) { assertThat(item.getImage().matches(IMAGE_NAME_REGEX)).isTrue(); @DrawableRes final int imageRes = UiUtil.getDrawable(RuntimeEnvironment.application, item.getImage()); assertThat(imageRes).isNotEqualTo(0); } final List<String> platforms = item.getPlatforms(); assertThat(platforms).isNotEmpty(); for (String platform : platforms) { assertThat(platform.toLowerCase()).isIn(WhatsNewItemModel.PLATFORM_ANDROID, WhatsNewItemModel.PLATFORM_IOS); } } }

Target:
public void validateWhatsNewItems(List<WhatsNewItemModel> whatsNewItems) { for (WhatsNewItemModel item : whatsNewItems) { assertThat(item).isNotNull(); assertThat(item.getTitle()).isNotEmpty(); assertThat(item.getMessage()).isNotEmpty(); assertThat(item.getImage()).isNotEmpty(); if (item.isAndroidMessage()) { assertThat(item.getImage().matches(IMAGE_NAME_REGEX)).isTrue(); } final List<String> platforms = item.getPlatforms(); assertThat(platforms).isNotEmpty(); for (String platform : platforms) { assertThat(WhatsNewItemModel.Platform.isSupportedPlatform(platform)).isTrue(); } } }
Source:
public void onRemoved(Iterable<CacheEntryEvent<? extends K, ? extends V>> events) throws CacheEntryListenerException { for (Object event1 : events) { CacheEntryEvent event = (CacheEntryEvent) event1; Assert.assertEquals(EventType.REMOVED, event.getEventType()); this.removed.incrementAndGet(); event.getKey(); if (event.isOldValueAvailable()) { event.getOldValue(); } } }

Target:
public void onRemoved(Iterable<CacheEntryEvent<? extends K, ? extends V>> events) throws CacheEntryListenerException { for (CacheEntryEvent<? extends K, ? extends V> event : events) { Assert.assertEquals(EventType.REMOVED, event.getEventType()); this.removed.incrementAndGet(); if (event.isOldValueAvailable()) { event.getOldValue(); } } }
Source:
protected void handleSpecificCommandActions() { return; }

Target:
protected void handleSpecificCommandActions() { }
Source:
private Actuate(String name) { this.name = name; }

Target:
Actuate(String name) { this.name = name; }
Source:
private void reportEndHostLog(ILogSaver saver) { LogRegistry registry = (LogRegistry) LogRegistry.getLogRegistry(); try (InputStreamSource source = registry.getLogger().getLog(); InputStream stream = source.createInputStream()) { saver.saveLogData(TestInvocation.TRADEFED_END_HOST_LOG, LogDataType.TEXT, stream); if (SystemUtil.isRemoteEnvironment()) { System.out.println("===== Result Reporters ====="); System.out.println(StreamUtil.getStringFromStream(stream)); } } catch (IOException e) { CLog.e(e); } }

Target:
private void reportEndHostLog(ILogSaver saver) { LogRegistry registry = (LogRegistry) LogRegistry.getLogRegistry(); try (InputStreamSource source = registry.getLogger().getLog()) { if (source == null) { CLog.e("%s stream was null, skip saving it.", TestInvocation.TRADEFED_END_HOST_LOG); return; } try (InputStream stream = source.createInputStream()) { saver.saveLogData(TestInvocation.TRADEFED_END_HOST_LOG, LogDataType.TEXT, stream); if (SystemUtil.isRemoteEnvironment()) { System.out.println( String.format( "===== Result Reporters =====\n%s", StreamUtil.getStringFromStream(stream))); } } } catch (IOException e) { CLog.e(e); } }
Source:
public String toString() { return "PvaluefromZscorePostAggregator{" + "name'" + name + '\'' + ", field=" + field + "}"; }

Target:
public String toString() { return "PvaluefromZscorePostAggregator{" + "name='" + name + '\'' + ", zScore=" + zScore + '}'; }
Source:
public Object[] getElements(Object inputElement) { ArrayList<IConnectionProvider> providers = new ArrayList<IConnectionProvider>(); HashMap<String, ConnectionProviderUI> map = UIExtensionManager.getConnectionUIElements(); Set<String> keys = map.keySet(); Iterator<String> i = keys.iterator(); while (i.hasNext()) { String id = i.next(); if (ExtensionManager.getProvider(id) != null && ExtensionManager.getProvider(id).canCreate()) providers.add(ExtensionManager.getProvider(id)); } return providers.toArray(new IConnectionProvider[providers.size()]); }

Target:
public Object[] getElements(Object inputElement) { List<IConnectionProvider> providers = new ArrayList<>(); Map<String, ConnectionProviderUI> map = UIExtensionManager.getConnectionUIElements(); Set<String> keys = map.keySet(); Iterator<String> i = keys.iterator(); while (i.hasNext()) { String id = i.next(); if (ExtensionManager.getProvider(id) != null && ExtensionManager.getProvider(id).canCreate()) providers.add(ExtensionManager.getProvider(id)); } return providers.toArray(new IConnectionProvider[providers.size()]); }
Source:
public List<MLModelField> getModelOutputFields(MLModelInfo modelInfo) throws IOException, SAXException, JAXBException { final List<MLModelField> fieldNames = doGetOutputFieldsForPMMLStream(modelInfo.getPmml()); return fieldNames; }

Target:
public List<MLModelField> getModelOutputFields(MLModelInfo modelInfo) throws IOException, SAXException, JAXBException { return doGetOutputFieldsForPMMLStream(modelInfo.getPmml()); }
Source:
static boolean isColumnDelete(Cell cell) { return cell.getTypeByte() == KeyValue.Type.DeleteColumn.getCode() || cell.getTypeByte() == KeyValue.Type.Delete.getCode(); }

Target:
static boolean isColumnDelete(Cell cell) { return cell.getTypeByte() == KeyValue.Type.DeleteColumn.getCode(); }
Source:
private String decodeAlarm(int value) { switch (value) { case 1: return Position.ALARM_SOS; case 2: return null; case 3: return Position.ALARM_GEOFENCE; case 4: return Position.ALARM_POWER_CUT; case 5: return null; case 6: return null; default: return null; } }

Target:
private String decodeAlarm(int value) { switch (value) { case 1: return Position.ALARM_SOS; case 3: return Position.ALARM_GEOFENCE; case 4: return Position.ALARM_POWER_CUT; default: return null; } }
Source:
private void refineType(AbstractTypedTree expression, JavaType expressionType, JavaType capturedReturnType, JavaType refinedReturnType) { if (refinedReturnType != capturedReturnType && expressionType.isParameterized()) { TypeSubstitution typeSubstitution = ((ParametrizedTypeJavaType) expressionType).typeSubstitution; for (Map.Entry<TypeVariableJavaType, JavaType> entry : typeSubstitution.substitutionEntries()) { if (entry.getValue() == capturedReturnType) { TypeSubstitution refinedSubstitution = new TypeSubstitution(typeSubstitution).add(entry.getKey(), refinedReturnType); JavaType refinedType = parametrizedTypeCache.getParametrizedTypeType(expressionType.symbol, refinedSubstitution); expression.setType(refinedType); break; } } } }

Target:
private void refineType(AbstractTypedTree expression, JavaType expressionType, JavaType capturedReturnType, JavaType refinedReturnType) { if (refinedReturnType != capturedReturnType && expressionType.isParameterized()) { TypeSubstitution typeSubstitution = ((ParametrizedTypeJavaType) expressionType).typeSubstitution; typeSubstitution.substitutionEntries().stream() .filter(e -> e.getValue() == capturedReturnType) .findFirst() .ifPresent(e -> { TypeSubstitution refinedSubstitution = new TypeSubstitution(typeSubstitution).add(e.getKey(), refinedReturnType); JavaType refinedType = parametrizedTypeCache.getParametrizedTypeType(expressionType.symbol, refinedSubstitution); expression.setType(refinedType); }); } }
Source:
public HTNode getNodeAt(int pos) { List<HTNode> latest = getLatestBranch(); if (pos >= latest.size()) { throw new IndexOutOfBoundsException(); } return NonNullUtils.checkNotNull(latest.get(pos)); }

Target:
public HTNode getNodeAt(int pos) { List<HTNode> latest = getLatestBranch(); return NonNullUtils.checkNotNull(latest.get(pos)); }
Source:
private List<FormattedExpression> interpolatedExpressions(StringElementImpl se) { String literalValue = se.trimmedQuotesValue(); Token token = se.firstToken(); int startOfLiteral = token.value().indexOf(literalValue); LineOffsetCounter lineOffsetCounter = new LineOffsetCounter(literalValue); List<FormattedExpression> res = new ArrayList<>(); parser.setRootRule(parser.getGrammar().rule(PythonGrammar.FORMATTED_EXPR)); Matcher matcher = INTERPOLATED_EXPR_START_PATTERN.matcher(literalValue); int index = 0; while (matcher.find(index)) { int end = matcher.end(); AstNode parse = parser.parse(literalValue.substring(end)); Expression exp = expression(parse.getFirstChild(PythonGrammar.EXPR)); Token equalToken = parse.getFirstChild(PythonPunctuator.ASSIGN) == null ? null : toPyToken(parse.getFirstChild(PythonPunctuator.ASSIGN).getToken()); FormattedExpression formattedExpression = new FormattedExpressionImpl(exp, equalToken); setParents(formattedExpression); updateTokensLineAndColumn(token, startOfLiteral, lineOffsetCounter, exp, end); res.add(formattedExpression); com.sonar.sslr.api.Token lastToken = parse.getLastToken(); index = end + lastToken.getColumn() + lastToken.getValue().length(); } return res; }

Target:
private List<FormattedExpression> interpolatedExpressions(StringElementImpl se) { String literalValue = se.trimmedQuotesValue(); Token token = se.firstToken(); int startOfLiteral = token.value().indexOf(literalValue); LineOffsetCounter lineOffsetCounter = new LineOffsetCounter(literalValue); List<FormattedExpression> res = new ArrayList<>(); parser.setRootRule(parser.getGrammar().rule(PythonGrammar.FORMATTED_EXPR)); Matcher matcher = INTERPOLATED_EXPR_START_PATTERN.matcher(literalValue); int index = 0; while (matcher.find(index)) { int end = matcher.end(); AstNode parse = parser.parse(literalValue.substring(end)); Expression exp = expression(parse.getFirstChild(PythonGrammar.EXPR)); AstNode equalNode = parse.getFirstChild(PythonPunctuator.ASSIGN); Token equalToken = equalNode == null ? null : toPyToken(equalNode.getToken()); FormattedExpression formattedExpression = new FormattedExpressionImpl(exp, equalToken); setParents(formattedExpression); updateTokensLineAndColumn(token, startOfLiteral, lineOffsetCounter, exp, end); res.add(formattedExpression); com.sonar.sslr.api.Token lastToken = parse.getLastToken(); index = end + lastToken.getColumn() + lastToken.getValue().length(); } return res; }
Source:
public TaskletStep build() { Assert.notNull(applicationContext, "A GenericApplicationContext must be provided"); Assert.notNull(stepBuilder, "A SimpleStepBuilder must be provided"); if (!applicationContext.containsBean(inputChannelName)) { BeanDefinition requestsBeanDefinition = BeanDefinitionBuilder.genericBeanDefinition(DirectChannel.class).getBeanDefinition(); applicationContext.registerBeanDefinition(inputChannelName, requestsBeanDefinition); } if (!applicationContext.containsBean(outputChannelName)) { BeanDefinition repliesBeanDefinition = BeanDefinitionBuilder.genericBeanDefinition(QueueChannel.class).getBeanDefinition(); applicationContext.registerBeanDefinition(outputChannelName, repliesBeanDefinition); } MessagingTemplate messagingTemplate = new MessagingTemplate(); messagingTemplate.setDefaultChannel((MessageChannel) applicationContext.getBean(inputChannelName)); ChunkMessageChannelItemWriter<O> chunkMessageChannelItemWriter = new ChunkMessageChannelItemWriter<>(); chunkMessageChannelItemWriter.setMessagingOperations(messagingTemplate); chunkMessageChannelItemWriter.setReplyChannel((PollableChannel) applicationContext.getBean(outputChannelName)); TaskletStep step = stepBuilder.writer(chunkMessageChannelItemWriter).build(); BeanDefinition remoteChunkHandlerFactoryBeanDefinition = BeanDefinitionBuilder.genericBeanDefinition(RemoteChunkHandlerFactoryBean.class) .addPropertyValue("chunkWriter", chunkMessageChannelItemWriter) .addPropertyValue("step", step) .getBeanDefinition(); applicationContext.registerBeanDefinition(step.getName() + "_chunkHandler", remoteChunkHandlerFactoryBeanDefinition); return step; }

Target:
public TaskletStep build() { Assert.notNull(this.inputChannel, "An InputChannel must be provided"); Assert.notNull(this.outputChannel, "An OutputChannel must be provided"); if (this.messagingTemplate == null) { this.messagingTemplate = new MessagingTemplate(); } this.messagingTemplate.setDefaultChannel(this.outputChannel); ChunkMessageChannelItemWriter<O> chunkMessageChannelItemWriter = new ChunkMessageChannelItemWriter<>(); chunkMessageChannelItemWriter.setMessagingOperations(this.messagingTemplate); chunkMessageChannelItemWriter.setMaxWaitTimeouts(this.maxWaitTimeouts); chunkMessageChannelItemWriter.setThrottleLimit(this.throttleLimit); chunkMessageChannelItemWriter.setReplyChannel(this.inputChannel); super.writer(chunkMessageChannelItemWriter); return super.build(); }
Source:
private Object valueConversionFunction(Object val) { if (val instanceof Integer) { return Long.valueOf((Integer) val); } if (val instanceof BigInteger) { return Double.valueOf(((BigInteger) val).doubleValue()); } if (val instanceof String) { return charsetFix((String) val); } return val; }

Target:
private Object valueConversionFunction(Object val) { if (val instanceof Integer) { return Long.valueOf((Integer) val); } if (val instanceof BigInteger) { return Double.valueOf(((BigInteger) val).doubleValue()); } if (val instanceof String) { return charsetFix((String) val); } if (val instanceof List) { List<Object> newList = new ArrayList<>(); for(Object entry : ((List) val)) { newList.add(valueConversionFunction(entry)); } return newList; } if (val instanceof Map) { Map<String, Object> newMap = new LinkedHashMap<>(); Map<String, Object> valMap = (Map<String, Object>) val; for(Map.Entry<String, Object> entry : valMap.entrySet()) { newMap.put(entry.getKey(), valueConversionFunction(entry.getValue())); } return newMap; } return val; }