auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void createInitParameters_fallbackChunkIsCreatedViaAppConfig_fallbackChunkObjectIsInInitParams() throws VaadinConfigurationException, IOException { ServletContext context = Mockito.mock(ServletContext.class); ServletConfig config = Mockito.mock(ServletConfig.class); ApplicationConfiguration appConfig = Mockito .mock(ApplicationConfiguration.class); Mockito.when(config.getServletContext()).thenReturn(context); Mockito.when(config.getInitParameterNames()) .thenReturn(Collections.emptyEnumeration()); Mockito.when( context.getAttribute(ApplicationConfiguration.class.getName())) .thenReturn(appConfig); Mockito.when(appConfig.getFallbackChunk()).thenReturn(fallbackChunk); Properties properties = new DeploymentConfigurationFactory() .createInitParameters(Object.class, new VaadinServletConfig(config)); Object object = properties .get(DeploymentConfigurationFactory.FALLBACK_CHUNK); Assert.assertSame(fallbackChunk, object); }

Target:
public void createInitParameters_fallbackChunkIsCreatedViaAppConfig_fallbackChunkObjectIsInInitParams() throws IOException { ServletContext context = Mockito.mock(ServletContext.class); ServletConfig config = Mockito.mock(ServletConfig.class); ApplicationConfiguration appConfig = Mockito .mock(ApplicationConfiguration.class); Mockito.when(config.getServletContext()).thenReturn(context); Mockito.when(config.getInitParameterNames()) .thenReturn(Collections.emptyEnumeration()); Mockito.when( context.getAttribute(ApplicationConfiguration.class.getName())) .thenReturn(appConfig); Mockito.when(appConfig.getFallbackChunk()).thenReturn(fallbackChunk); Properties properties = new DeploymentConfigurationFactory() .createInitParameters(Object.class, new VaadinServletConfig(config)); Object object = properties .get(DeploymentConfigurationFactory.FALLBACK_CHUNK); Assert.assertSame(fallbackChunk, object); }
Source:
public static boolean isNumeric(String str, boolean allowDot) { if (str == null || str.isEmpty()) { return false; } if (allowDot) { int index = str.indexOf("."); if (index > 0) { if (str.indexOf(".", index) == -1) { return false; } else { String left = str.substring(0, index); String right = str.substring(index + 1); return StringUtils.isNumeric(left, false) && StringUtils.isNumeric(right, false); } } } int sz = str.length(); for (int i = 0; i < sz; i++) { if (!Character.isDigit(str.charAt(i))) { return false; } } return true; }

Target:
public static boolean isNumeric(String str, boolean allowDot) { if (str == null || str.isEmpty()) { return false; } boolean hasDot = false; int sz = str.length(); for (int i = 0; i < sz; i++) { if (str.charAt(i) == '.') { if (hasDot || !allowDot) { return false; } hasDot = true; continue; } if (!Character.isDigit(str.charAt(i))) { return false; } } return true; }
Source:
public List<Subscription> listSubscriptions() throws ServiceUnavailableException { try { return jdbcTemplate.query("SELECT s_subscription_object FROM zn_data.subscription", rowMapper); } catch (final DataAccessException e) { throw new ServiceUnavailableException("Error occurred when running database request", e); } }

Target:
public List<Subscription> listSubscriptions() throws ServiceUnavailableException { try { return jdbcTemplate.query("SELECT s_subscription_object FROM zn_data.subscription ORDER BY " + "s_subscription_object->>'created_at' DESC", rowMapper); } catch (final DataAccessException e) { LOG.error("Database error when listing subscriptions", e); throw new ServiceUnavailableException("Error occurred when running database request"); } }
Source:
public void addArgumentsToUnInstallFeatures(String uninstallIUs, String destination, String profile) { launcher.addArguments( "-profileProperties", "org.eclipse.update.install.features=false", "-uninstallIU", uninstallIUs, "-shared", Paths.get(destination + File.separator + "lib" + File.separator + "p2").toString(), "-destination", Paths.get(destination + File.separator + profile).toString(), "-profile", profile ); }

Target:
public void addArgumentsToUnInstallFeatures(String uninstallIUs, String destination, String profile) { launcher.addArguments( "-profileProperties", "org.eclipse.update.install.features=false", "-uninstallIU", uninstallIUs, "-shared", Paths.get(destination, "lib", "p2").toString(), "-destination", Paths.get(destination, profile).toString(), "-profile", profile ); }
Source:
public static void main(String[] args) throws IOException, NoSuchAlgorithmException, InvalidKeyException { try { MinioClient minioClient = new MinioClient( "<LINK_1>", "Q3AM3UQ867SPQQA43P2F", "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG"); String url = minioClient.getPresignedObjectUrl( GetPresignedObjectUrlArgs.builder() .method(Method.GET) .bucket("my-bucketname") .object("my-objectname") .expires(60 * 60 * 24) .build()); System.out.println(url); } catch (MinioException e) { System.out.println("Error occurred: " + e); } }

Target:
public static void main(String[] args) throws IOException, NoSuchAlgorithmException, InvalidKeyException { try { MinioClient minioClient = new MinioClient( "<LINK_1>", "Q3AM3UQ867SPQQA43P2F", "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG"); String url = minioClient.getPresignedObjectUrl( GetPresignedObjectUrlArgs.builder() .method(Method.GET) .bucket("my-bucketname") .object("my-objectname") .expiry(60 * 60 * 24) .build()); System.out.println(url); } catch (MinioException e) { System.out.println("Error occurred: " + e); } }
Source:
public static ACSModeledSegment convertACNVSegmentToACSSegment(final ACNVModeledSegment acnvModeledSegment, final double divisor, final Genome genome, final boolean isSegmentBalanced) { final double f = (isSegmentBalanced ? 0.5 : acnvModeledSegment.getMinorAlleleFractionPosteriorSummary().getCenter()); final double tau = Math.pow(2, acnvModeledSegment.getSegmentMeanPosteriorSummary().getCenter()) * 2.0; final double widthTau = Math.pow(2, acnvModeledSegment.getSegmentMeanPosteriorSummary().getUpper()) - Math.pow(2, acnvModeledSegment.getSegmentMeanPosteriorSummary().getLower()); final double sigmaTau = widthTau/divisor; final double muMinor = tau * f; final double widthF = acnvModeledSegment.getMinorAlleleFractionPosteriorSummary().getUpper() - acnvModeledSegment.getMinorAlleleFractionPosteriorSummary().getLower(); final double sigmaMinor = widthF/divisor; final double muMajor = tau * (1-f); final double sigmaMajor = sigmaMinor; final int targetCount = genome.getTargets().targetCount(acnvModeledSegment.getInterval()); final int segLabelCNLOH = 2; final int hetCount = genome.getSNPs().targetCount(acnvModeledSegment.getInterval()); return new ACSModeledSegment(acnvModeledSegment.getInterval(), ModeledSegment.NO_CALL, targetCount, ParamUtils.log2(tau/2.0), hetCount, f, sigmaTau, muMinor, sigmaMinor, muMajor, sigmaMajor, segLabelCNLOH); }

Target:
public static ACSModeledSegment convertACNVSegmentToACSSegment(final ACNVModeledSegment acnvModeledSegment, final double divisor, final Genome genome, final boolean isSegmentBalanced) { final double segmentMeanInLog2CR = acnvModeledSegment.getSegmentMeanPosteriorSummary().getCenter(); final double f = (isSegmentBalanced ? 0.5 : acnvModeledSegment.getMinorAlleleFractionPosteriorSummary().getCenter()); final double tau = Math.pow(2, segmentMeanInLog2CR) * 2.0; final double widthTau = Math.pow(2, acnvModeledSegment.getSegmentMeanPosteriorSummary().getUpper()) - Math.pow(2, acnvModeledSegment.getSegmentMeanPosteriorSummary().getLower()); final double sigmaTau = widthTau/divisor; final double muMinor = tau * f; final double widthF = acnvModeledSegment.getMinorAlleleFractionPosteriorSummary().getUpper() - acnvModeledSegment.getMinorAlleleFractionPosteriorSummary().getLower(); final double sigmaMinor = widthF/divisor; final double muMajor = tau * (1-f); final double sigmaMajor = sigmaMinor; final int targetCount = genome.getTargets().targetCount(acnvModeledSegment.getInterval()); final int segLabelCNLOH = 2; final int hetCount = genome.getSNPs().targetCount(acnvModeledSegment.getInterval()); return new ACSModeledSegment(acnvModeledSegment.getInterval(), ModeledSegment.NO_CALL, targetCount, segmentMeanInLog2CR, hetCount, f, sigmaTau, muMinor, sigmaMinor, muMajor, sigmaMajor, segLabelCNLOH); }
Source:
public void should_successfully_register_and_login_guest() { String userToken = registerAndLoginGuest(USER_NAME_GUEST_1) .then() .statusCode(200) .body("token", not(equalTo(isEmptyString()))) .extract() .path("token"); getUserDetails(userToken) .then() .statusCode(200) .body("guest", equalTo(true)); }

Target:
public void should_successfully_register_and_login_guest() { String userToken = registerAndLoginGuest(USER_NAME_GUEST_1) .then() .statusCode(200) .body("token", not(isEmptyOrNullString())) .extract() .path("token"); getUserDetails(userToken) .then() .statusCode(200) .body("guest", equalTo(true)); }
Source:
public Firehose connect() throws IOException { log.info("Connecting firehose: %s", serviceName); final EventReceiverFirehose firehose = new EventReceiverFirehose(); if (chatHandlerProvider.isPresent()) { log.info("Found chathandler of class[%s]", chatHandlerProvider.get().getClass().getName()); chatHandlerProvider.get().register(serviceName, firehose); chatHandlerProvider.get().register(serviceName.replaceAll(".*:", ""), firehose); } else { log.info("No chathandler detected"); } return firehose; }

Target:
public Firehose connect() throws IOException { log.info("Connecting firehose: %s", serviceName); final EventReceiverFirehose firehose = new EventReceiverFirehose(); if (chatHandlerProvider.isPresent()) { log.info("Found chathandler of class[%s]", chatHandlerProvider.get().getClass().getName()); chatHandlerProvider.get().register(serviceName, firehose); } else { log.info("No chathandler detected"); } return firehose; }
Source:
public TimingPoint(String line) { String[] tokens = line.split(","); try { this.time = (int) Float.parseFloat(tokens[0]); this.meter = Integer.parseInt(tokens[2]); this.sampleType = Byte.parseByte(tokens[3]); this.sampleTypeCustom = Byte.parseByte(tokens[4]); this.sampleVolume = Integer.parseInt(tokens[5]); if (tokens.length > 7) this.kiai = Utils.parseBoolean(tokens[7]); } catch (ArrayIndexOutOfBoundsException e) { Log.debug(String.format("Error parsing timing point: '%s'", line)); } float beatLength = Float.parseFloat(tokens[1]); if (beatLength >= 0) this.beatLength = beatLength; else { this.velocity = (int) beatLength; this.inherited = true; } }

Target:
public TimingPoint(String line) { String[] tokens = line.split(","); try { this.time = (int) Float.parseFloat(tokens[0]); this.meter = Integer.parseInt(tokens[2]); this.sampleType = Byte.parseByte(tokens[3]); this.sampleTypeCustom = Byte.parseByte(tokens[4]); this.sampleVolume = Integer.parseInt(tokens[5]); if (tokens.length > 7) this.kiai = Utils.parseBoolean(tokens[7]); } catch (ArrayIndexOutOfBoundsException e) { Log.debug(String.format("Error parsing timing point: '%s'", line)); } double beatLength = Double.parseDouble(tokens[1]); if (beatLength >= 0) this.beatLength = beatLength; else { this.velocity = (int) beatLength; this.inherited = true; } }
Source:
private void loginWithTwitter() { socialNetworkManager.getTwitterSocialNetwork().requestLogin(new OnLoginCompleteListener() { @Override public void onLoginSuccess(int socialNetworkID) { socialNetworkManager.getTwitterSocialNetwork().requestCurrentPerson(new OnRequestSocialPersonCompleteListener() { @Override public void onRequestSocialPersonSuccess(int socialNetworkID, SocialPerson socialPerson) { AccessToken accessToken = socialNetworkManager.getTwitterSocialNetwork().getAccessToken(); String result = String.format(getActivity() .getString(R.string.twitter_token_format), accessToken.token, accessToken.secret); loginSuccessCallback.onLoginSuccess(socialPerson.name, result); } @Override public void onError(int socialNetworkID, String requestID, String errorMessage, Object data) { } }); } @Override public void onError(int socialNetworkID, String requestID, String errorMessage, Object data) { Timber.e("Twitter login failed: %s", errorMessage); } }); }

Target:
private void loginWithTwitter() { socialNetworkManager.getTwitterSocialNetwork().requestLogin(new OnLoginCompleteListener() { @Override public void onLoginSuccess(int socialNetworkID) { socialNetworkManager.getTwitterSocialNetwork().requestCurrentPerson(new OnRequestSocialPersonCompleteListener() { @Override public void onRequestSocialPersonSuccess(int socialNetworkID, SocialPerson socialPerson) { AccessToken accessToken = socialNetworkManager.getTwitterSocialNetwork().getAccessToken(); String result = String.format(getString(R.string.twitter_token_format), accessToken.token, accessToken.secret); loginSuccessCallback.onLoginSuccess(socialPerson.name, result); } @Override public void onError(int socialNetworkID, String requestID, String errorMessage, Object data) { Timber.w("Retreival of Twitter account information failed with the following" + "error %s", errorMessage); String token = socialNetworkManager.getFacebookSocialNetwork().getAccessToken().token; String result = String.format(getString(R.string.facebook_token_format), token); loginSuccessCallback.onLoginSuccess(getString(R.string.twitter), result); } }); } @Override public void onError(int socialNetworkID, String requestID, String errorMessage, Object data) { Timber.e("Twitter login failed: %s", errorMessage); } }); }
Source:
private CompletableFuture<Void> doDelete(String name) throws InfrastructureException { Watch toCloseOnException = null; try { final PodResource<Pod, DoneablePod> podResource = clientFactory.create(workspaceId).pods().inNamespace(namespace).withName(name); CompletableFuture<Void> deleteFuture = new CompletableFuture<>(); final Watch watch = podResource.watch(new DeleteWatcher(deleteFuture)); toCloseOnException = watch; deleteFuture = deleteFuture.whenComplete( (v, e) -> { if (e != null) { LOG.warn("Failed to remove pod cause {}", name, e.getMessage()); } watch.close(); }); Boolean deleteSucceeded = podResource.delete(); if (deleteSucceeded == null || !deleteSucceeded) { watch.close(); } return deleteFuture; } catch (KubernetesClientException ex) { if (toCloseOnException != null) { toCloseOnException.close(); } throw new KubernetesInfrastructureException(ex); } catch (Exception e) { if (toCloseOnException != null) { toCloseOnException.close(); } throw e; } }

Target:
CompletableFuture<Void> doDelete(String name) throws InfrastructureException { Watch toCloseOnException = null; try { final PodResource<Pod, DoneablePod> podResource = clientFactory.create(workspaceId).pods().inNamespace(namespace).withName(name); final CompletableFuture<Void> deleteFuture = new CompletableFuture<>(); final Watch watch = podResource.watch(new DeleteWatcher(deleteFuture)); toCloseOnException = watch; Boolean deleteSucceeded = podResource.delete(); if (deleteSucceeded == null || !deleteSucceeded) { deleteFuture.complete(null); } return deleteFuture.whenComplete( (v, e) -> { if (e != null) { LOG.warn("Failed to remove pod cause {}", name, e.getMessage()); } watch.close(); }); } catch (KubernetesClientException ex) { if (toCloseOnException != null) { toCloseOnException.close(); } throw new KubernetesInfrastructureException(ex); } catch (Exception e) { if (toCloseOnException != null) { toCloseOnException.close(); } throw e; } }
Source:
public void testConstructorFromJson() { final String jsonString = "{\"data\":\"YXNkZmc=\",\"name\":\"filename.jpg\",\"headers\":{\"Header\":[\"Value\"]}}"; JsonObject json = new JsonObject(jsonString); MailAttachment message = new MailAttachment(json); assertEquals(jsonString, message.toJson().encode()); }

Target:
public void testConstructorFromJson() { final String jsonString = "{\"data\":\"YXNkZmc=\",\"name\":\"filename.jpg\",\"headers\":{\"Content-ID\":[\"<image1@example.org\"],\"Header\":[\"Value\"]}}"; JsonObject json = new JsonObject(jsonString); MailAttachment message = new MailAttachment(json); assertEquals(jsonString, message.toJson().encode()); }
Source:
public void suppressLayout(boolean suppress) { if (suppress != mLayoutSuppressed) { assertNotInLayoutOrScroll("Do not suppressLayout in layout or scroll"); if (!suppress) { mLayoutSuppressed = false; if (mLayoutWasDefered && mLayout != null && mAdapter != null) { requestLayout(); } mLayoutWasDefered = false; } else { final long now = SystemClock.uptimeMillis(); MotionEvent cancelEvent = MotionEvent.obtain(now, now, MotionEvent.ACTION_CANCEL, 0.0f, 0.0f, 0); onTouchEvent(cancelEvent); mLayoutSuppressed = true; mIgnoreMotionEventTillDown = true; stopScroll(); } } }

Target:
public final void suppressLayout(boolean suppress) { if (suppress != mLayoutSuppressed) { assertNotInLayoutOrScroll("Do not suppressLayout in layout or scroll"); if (!suppress) { mLayoutSuppressed = false; if (mLayoutWasDefered && mLayout != null && mAdapter != null) { requestLayout(); } mLayoutWasDefered = false; } else { final long now = SystemClock.uptimeMillis(); MotionEvent cancelEvent = MotionEvent.obtain(now, now, MotionEvent.ACTION_CANCEL, 0.0f, 0.0f, 0); onTouchEvent(cancelEvent); mLayoutSuppressed = true; mIgnoreMotionEventTillDown = true; stopScroll(); } } }
Source:
@Test void testSortAgg() { final String sql = "select mgr, count(*) from sales.emp\n" + "group by mgr order by mgr desc nulls last limit 5"; Query.create(sql) .addRule(EnumerableRules.ENUMERABLE_SORTED_AGGREGATE_RULE) .removeRule(EnumerableRules.ENUMERABLE_AGGREGATE_RULE).check(); }

Target:
@Test void testSortAgg() { final String sql = "select mgr, count(*) from sales.emp\n" + "group by mgr order by mgr desc nulls last limit 5"; Query.create(sql).check(); }
Source:
public int findChunksForSpawning(WorldServer worldOrig, boolean hostileEnable, boolean peacefulEnable, boolean spawnOnSetTickRate) { if (!hostileEnable && !peacefulEnable) return 0; ICubicWorldServer world = (ICubicWorldServer) worldOrig; List<EntityPlayer> pList = world.getPlayerEntities(); int pAmount = pList.size(); if(pAmount==0) return 0; List<CubePos> cubePosList = this.selectCubePos(world, pList); int spawned = 0; if (!cubePosList.isEmpty()) { a:for (EnumCreatureType mobType : EnumCreatureType.values()) { if (shouldSpawnType(mobType, hostileEnable, peacefulEnable, spawnOnSetTickRate)) { int worldEntityCount = 0; int maxEntityCount = mobType.getMaxNumberOfCreature() * pAmount; Class<? extends IAnimals> mobTypeClass = mobType.getCreatureClass(); for (Entity entity : worldOrig.loadedEntityList) { if (mobTypeClass.isInstance(entity) && ++worldEntityCount > maxEntityCount) { continue a; } } spawned += spawnCreatureTypeInAllChunks(mobType, cubePosList, world); } } } return spawned; }

Target:
public int findChunksForSpawning(WorldServer worldOrig, boolean hostileEnable, boolean peacefulEnable, boolean spawnOnSetTickRate) { if (!hostileEnable && !peacefulEnable) return 0; ICubicWorldServer world = (ICubicWorldServer) worldOrig; int spawned = 0; next_mob_type: for (EnumCreatureType mobType : EnumCreatureType.values()) { if (!shouldSpawnType(mobType, hostileEnable, peacefulEnable, spawnOnSetTickRate)) { continue; } int worldEntityCount = 0; int maxEntityCount = mobType.getMaxNumberOfCreature() * world.getPlayerEntities().size(); Class<? extends IAnimals> mobTypeClass = mobType.getCreatureClass(); for (Entity entity : worldOrig.loadedEntityList) { if (mobTypeClass.isInstance(entity) && ++worldEntityCount > maxEntityCount) { continue next_mob_type; } } spawned += spawnCreatureTypeInAllChunks(mobType, world); } return spawned; }
Source:
public void testCherryPickOverExecutableChangeOnNonExectuableFileSystem() throws Exception { Git git = new Git(db); File file = writeTrashFile("test.txt", "a"); assertNotNull(git.add().addFilepattern("test.txt").call()); assertNotNull(git.commit().setMessage("commit1").call()); assertNotNull(git.checkout().setCreateBranch(true).setName("a").call()); writeTrashFile("test.txt", "b"); assertNotNull(git.add().addFilepattern("test.txt").call()); RevCommit commit2 = git.commit().setMessage("commit2").call(); assertNotNull(commit2); assertNotNull(git.checkout().setName(Constants.MASTER).call()); DirCache cache = db.lockDirCache(); cache.getEntry("test.txt").setFileMode(FileMode.EXECUTABLE_FILE); cache.write(); assertTrue(cache.commit()); cache.unlock(); db.getFS().setExecute(file, true); assertNotNull(git.commit().setMessage("commit3").call()); git.getRepository() .getConfig() .setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_FILEMODE, true); CherryPickResult result = git.cherryPick().include(commit2).call(); assertNotNull(result); assertEquals(CherryPickStatus.OK, result.getStatus()); }

Target:
public void testCherryPickOverExecutableChangeOnNonExectuableFileSystem() throws Exception { Git git = new Git(db); File file = writeTrashFile("test.txt", "a"); assertNotNull(git.add().addFilepattern("test.txt").call()); assertNotNull(git.commit().setMessage("commit1").call()); assertNotNull(git.checkout().setCreateBranch(true).setName("a").call()); writeTrashFile("test.txt", "b"); assertNotNull(git.add().addFilepattern("test.txt").call()); RevCommit commit2 = git.commit().setMessage("commit2").call(); assertNotNull(commit2); assertNotNull(git.checkout().setName(Constants.MASTER).call()); DirCache cache = db.lockDirCache(); cache.getEntry("test.txt").setFileMode(FileMode.EXECUTABLE_FILE); cache.write(); assertTrue(cache.commit()); cache.unlock(); assertNotNull(git.commit().setMessage("commit3").call()); db.getFS().setExecute(file, false); git.getRepository() .getConfig() .setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_KEY_FILEMODE, false); CherryPickResult result = git.cherryPick().include(commit2).call(); assertNotNull(result); assertEquals(CherryPickStatus.OK, result.getStatus()); }
Source:
private <T> StateBackedCreator<T, STATE> emptyConstructorStateSettingInstantiator( Class<T> type, Class<STATE> stateType) { final Constructor<T> constructor = getNoArgConstructor(type); if (constructor == null) return null; if (Modifier.isAbstract(constructor.getDeclaringClass().getModifiers())) { throw new InvalidEntityTypeException("Unabled to create entity using base abstract class : " + type); } if (log.isDebugEnabled()) log.debug("Using " + type + " no-arg constructor"); return new StateBackedCreator<T, STATE>() { public T create(STATE state, Class<T> c) throws Exception { try { StateProvider.setUnderlyingState(state); T newInstance = constructor.newInstance(); setState(newInstance, state); return newInstance; } finally { StateProvider.retrieveState(); } } }; }

Target:
private <T> StateBackedCreator<T, STATE> emptyConstructorStateSettingInstantiator( Class<T> type, Class<STATE> stateType) { final Constructor<T> constructor = getNoArgConstructor(type); if (constructor == null) return null; if (log.isDebugEnabled()) log.debug("Using " + type + " no-arg constructor"); return new StateBackedCreator<T, STATE>() { public T create(STATE state, Class<T> c) throws Exception { try { StateProvider.setUnderlyingState(state); T newInstance = constructor.newInstance(); setState(newInstance, state); return newInstance; } finally { StateProvider.retrieveState(); } } }; }
Source:
private static void insertJsonColumn(CqlSession session) { User alice = new User("alice", 30); User bob = new User("bob", 35); Statement stmt = insertInto("examples", "json_jackson_column") .value("id", literal(1)) .value("json", literal(alice, USER_CODEC)) .build(); session.execute(stmt); PreparedStatement pst = session.prepare( insertInto("examples", "json_jackson_column") .value("id", bindMarker("id")) .value("json", bindMarker("json")) .build()); session.execute(pst.bind().setInt("id", 2).set("json", bob, User.class)); }

Target:
private static void insertJsonColumn(CqlSession session) { User alice = new User("alice", 30); User bob = new User("bob", 35); Statement stmt = insertInto("examples", "json_jackson_column") .value("id", literal(1)) .value("json", literal(alice, session.getContext().getCodecRegistry())) .build(); session.execute(stmt); PreparedStatement pst = session.prepare( insertInto("examples", "json_jackson_column") .value("id", bindMarker("id")) .value("json", bindMarker("json")) .build()); session.execute(pst.bind().setInt("id", 2).set("json", bob, User.class)); }
Source:
public void sendAndConfirmMessage(String message, String topicName, long timeoutSeconds) throws KafkaException{ Producer<String, String> producer = new KafkaProducer<>(props); try { producer.send(new ProducerRecord<String, String>(topicName,message)).get(timeoutSeconds, TimeUnit.SECONDS); logger.debug("Message sent and acknowlegded by Kafka"); } catch (InterruptedException | ExecutionException | TimeoutException e) { throw new KafkaException("Error sending message to Kafka", e); } producer.close(); }

Target:
public void sendAndConfirmMessage(String message, String topicName, long timeoutSeconds) throws InterruptedException, ExecutionException, TimeoutException { Producer<String, String> producer = new KafkaProducer<>(props); try { producer.send(new ProducerRecord<String, String>(topicName,message)).get(timeoutSeconds, TimeUnit.SECONDS); logger.debug("Message sent and acknowlegded by Kafka"); } catch (InterruptedException | ExecutionException | TimeoutException e) { logger.error("Message not sent or acknowlegded by Kafka {}", e.getMessage()); throw e; } finally { producer.close(); } }
Source:
public Optional<@NotNull @NotBlank String> returnStringOptional() { return stringOptional; }

Target:
public Optional<@NotBlank String> returnStringOptional() { return stringOptional; }
Source:
public void move() { if (!isCaughtByBubble()) { moveCollisionChecker(); if (jumpCounter < 12) { jumpCounter++; } if (jumpCounter == 12) { setDy(0); jumping = false; } moveHorizontal(); moveVertical(); } else { setDx(0); setDy(0); setX(getPrisonBubble().getX()); setY(getPrisonBubble().getY()); } checkBounds(); super.move(); }

Target:
public void move() { if (!isCaughtByBubble()) { ableToJump = moveCollisionChecker(jumping, ableToJump); double jumpMaxCounter = Math.ceil(Settings.JUMP_HEIGHT_WALKER / Settings.JUMP_SPEED_WALKER); if (jumpCounter < jumpMaxCounter) { jumpCounter++; } else if (jumpCounter == jumpMaxCounter) { setDy(0); jumping = false; } moveHorizontal(); moveVertical(); } else { setDx(0); setDy(0); setX(getPrisonBubble().getX()); setY(getPrisonBubble().getY()); } checkBounds(walkerMinX, walkerMaxX, walkerMinY, walkerMaxY); super.move(); }
Source:
private void writeBreadcumbs(JsonGenerator generator, List<Breadcrumb> breadcrumbs) throws IOException { if (breadcrumbs.isEmpty()) { return; } generator.writeObjectFieldStart(BREADCRUMBS); generator.writeArrayFieldStart("values"); for (Breadcrumb breadcrumb : breadcrumbs) { generator.writeStartObject(); generator.writeNumberField("timestamp", breadcrumb.getTimestamp().getTime() / 1000); if (breadcrumb.getType() != null) { generator.writeStringField("type", breadcrumb.getType().name().toLowerCase()); } if (breadcrumb.getLevel() != null) { generator.writeStringField("level", breadcrumb.getLevel().name().toLowerCase()); } if (breadcrumb.getMessage() != null) { generator.writeStringField("message", breadcrumb.getMessage()); } if (breadcrumb.getCategory() != null) { generator.writeStringField("category", breadcrumb.getCategory()); } if (breadcrumb.getData() != null && !breadcrumb.getData().isEmpty()) { generator.writeObjectFieldStart("data"); for (Map.Entry<String, String> entry : breadcrumb.getData().entrySet()) { generator.writeStringField(entry.getKey(), entry.getValue()); } generator.writeEndObject(); } generator.writeEndObject(); } generator.writeEndArray(); generator.writeEndObject(); }

Target:
private void writeBreadcumbs(JsonGenerator generator, List<Breadcrumb> breadcrumbs) throws IOException { if (breadcrumbs.isEmpty()) { return; } generator.writeObjectFieldStart(BREADCRUMBS); generator.writeArrayFieldStart("values"); for (Breadcrumb breadcrumb : breadcrumbs) { generator.writeStartObject(); generator.writeNumberField("timestamp", breadcrumb.getTimestamp().getTime() / 1000); if (breadcrumb.getType() != null) { generator.writeStringField("type", breadcrumb.getType().getValue()); } if (breadcrumb.getLevel() != null) { generator.writeStringField("level", breadcrumb.getLevel().getValue()); } if (breadcrumb.getMessage() != null) { generator.writeStringField("message", breadcrumb.getMessage()); } if (breadcrumb.getCategory() != null) { generator.writeStringField("category", breadcrumb.getCategory()); } if (breadcrumb.getData() != null && !breadcrumb.getData().isEmpty()) { generator.writeObjectFieldStart("data"); for (Map.Entry<String, String> entry : breadcrumb.getData().entrySet()) { generator.writeStringField(entry.getKey(), entry.getValue()); } generator.writeEndObject(); } generator.writeEndObject(); } generator.writeEndArray(); generator.writeEndObject(); }
Source:
public void requestAccess(DataFile file) { System.out.print("requestAccess FileDownloadhelper"); if (fileDownloadService.requestAccess(file.getId())) { file.getFileAccessRequesters().add((AuthenticatedUser) session.getUser()); fileDownloadService.sendRequestFileAccessNotification(file.getOwner(), file.getId()); } }

Target:
public void requestAccess(DataFile file){ processRequestAccess(file, true); }
Source:
private void pulseTickMap() { ItemTable itemTable = ItemTable.instance(); for (Location location : getTickMap()) { BlockType type = itemTable.getBlock(Material.getMaterial(getBlockTypeIdAt(location))); if (type == null) { cancelPulse(location); continue; } GlowBlock block = (GlowBlock) location.getBlock(); Integer speed = type.getPulseTickSpeed(block); boolean once = type.isPulseOnce(block); if (speed == null) { continue; } if (worldAge % speed == 0) { type.receivePulse(block); if (once) { cancelPulse(location); } } } }

Target:
private void pulseTickMap() { ItemTable itemTable = ItemTable.instance(); for (Location location : getTickMap()) { if (!location.getChunk().isLoaded()) { continue; } BlockType type = itemTable.getBlock(Material.getMaterial(getBlockTypeIdAt(location))); if (type == null) { cancelPulse(location); continue; } GlowBlock block = (GlowBlock) location.getBlock(); Integer speed = type.getPulseTickSpeed(block); boolean once = type.isPulseOnce(block); if (speed == 0) { continue; } if (worldAge % speed == 0) { type.receivePulse(block); if (once) { cancelPulse(location); } } } }
Source:
public FormIndex walk(){ FormIndex currentIndex = step(parentIndex, true); while(indexInScope(currentIndex)){ boolean relevant = fem.isIndexRelevant(currentIndex); if(!relevant){ currentIndex = step(currentIndex, false); break; } JSONObject obj = new JSONObject(); PromptToJson.parseQuestionType(fem, obj); obj.put("relevant", relevant ? 1 : 0); if(obj.get("type").equals("sub-group")){ Walker walker; if(obj.has("caption") && obj.get("caption") != JSONObject.NULL ){ JSONArray childObject = new JSONArray(); walker = new Walker(childObject, currentIndex, fec, fem); obj.put("children", childObject); } else{ walker = new Walker(compiler, currentIndex, fec, fem); } compiler.put(obj); currentIndex = walker.walk(); } else if(obj.get("type").equals("repeat-juncture")){ JSONArray children = new JSONArray(); for(int i = 0; i < fem.getForm().getNumRepetitions(currentIndex); i++){ JSONObject subEvent = new JSONObject(); FormIndex ix = fem.getForm().descendIntoRepeat(currentIndex, i); JSONArray subChildren = new JSONArray(); subEvent.put("type", "sub-group"); subEvent.put("ix", ix); JSONArray repetitionsArray = obj.getJSONArray("repetitions"); subEvent.put("caption", repetitionsArray.get(i)); subEvent.put("repeatable", true); subEvent.put("uuid", ix.getReference()).hashCode(); Walker walker = new Walker(subChildren, ix, fec, fem); walker.walk(); subEvent.put("children", subChildren); children.put(subEvent); } obj.put("children", children); compiler.put(obj); currentIndex = step(currentIndex, true); } else{ compiler.put(obj); currentIndex = step(currentIndex, true); } } return currentIndex; }

Target:
public FormIndex walk() { FormIndex currentIndex = step(parentIndex, true); while (indexInScope(currentIndex)) { boolean relevant = fem.isIndexRelevant(currentIndex); if (!relevant) { currentIndex = step(currentIndex, false); break; } JSONObject obj = new JSONObject(); PromptToJson.parseQuestionType(fem, obj); if (obj.get("type").equals("sub-group")) { Walker walker; if (obj.has("caption") && obj.get("caption") != JSONObject.NULL) { JSONArray childObject = new JSONArray(); walker = new Walker(childObject, currentIndex, fec, fem); obj.put("children", childObject); } else { walker = new Walker(compiler, currentIndex, fec, fem); } compiler.put(obj); currentIndex = walker.walk(); } else if (obj.get("type").equals("repeat-juncture")) { JSONArray children = new JSONArray(); for (int i = 0; i < fem.getForm().getNumRepetitions(currentIndex); i++) { JSONObject subEvent = new JSONObject(); FormIndex ix = fem.getForm().descendIntoRepeat(currentIndex, i); JSONArray subChildren = new JSONArray(); subEvent.put("type", "sub-group"); subEvent.put("ix", ix); JSONArray repetitionsArray = obj.getJSONArray("repetitions"); subEvent.put("caption", repetitionsArray.get(i)); subEvent.put("repeatable", true); subEvent.put("uuid", ix.getReference()).hashCode(); Walker walker = new Walker(subChildren, ix, fec, fem); walker.walk(); subEvent.put("children", subChildren); children.put(subEvent); } obj.put("children", children); compiler.put(obj); currentIndex = step(currentIndex, true); } else { compiler.put(obj); currentIndex = step(currentIndex, true); } } return currentIndex; }
Source:
public List<SDVariable> doDiff(List<SDVariable> i_v1) { SDVariable out = outputVariables()[0]; int[] argShape = arg().getShape(); SDVariable expandedOut = sameDiff.f().reductionBroadcastableWithOrigShape(argShape.length, dimensions, out); expandedOut = sameDiff.onesLike(arg()).mul(expandedOut); SDVariable expandedGrad = sameDiff.f().reductionBroadcastableWithOrigShape(argShape.length, dimensions, i_v1.get(0)); SDVariable eq = sameDiff.eq(arg(), expandedOut); SDVariable ret = eq.mul(expandedGrad); return Collections.singletonList(ret); }

Target:
public List<SDVariable> doDiff(List<SDVariable> i_v1) { SDVariable out = outputVariables()[0]; int origRank = Shape.rankFromShape(arg().getShape()); SDVariable expandedOut = sameDiff.f().reductionBroadcastableWithOrigShape(origRank, dimensions, out); expandedOut = sameDiff.onesLike(arg()).mul(expandedOut); SDVariable expandedGrad = sameDiff.f().reductionBroadcastableWithOrigShape(origRank, dimensions, i_v1.get(0)); SDVariable eq = sameDiff.eq(arg(), expandedOut); SDVariable ret = eq.mul(expandedGrad); return Collections.singletonList(ret); }
Source:
protected List<Language> getLanguages() { List<Language> list = CacheLocator.getLanguageCache().getLanguages(); if(list!=null){ return list; } try { Language defaultLang = getDefaultLanguage(); list = fromDbList(new DotConnect().setSQL( SELECT_ALL_LANGUAGES) .addParam(defaultLang.getId()) .loadObjectResults()); list.add(0,defaultLang); CacheLocator.getLanguageCache().putLanguages(list); return list; } catch (DotDataException e) { CacheLocator.getLanguageCache().putLanguages(null); throw new DotRuntimeException(e); } }

Target:
protected List<Language> getLanguages() { List<Language> languages = CacheLocator.getLanguageCache().getLanguages(); if(languages != null){ return languages; } try { final Language defaultLang = getDefaultLanguage(); languages = fromDbList(new DotConnect().setSQL( SELECT_ALL_LANGUAGES ) .addParam(defaultLang.getId()) .loadObjectResults()); languages.add(0,defaultLang); CacheLocator.getLanguageCache().putLanguages(languages); return languages; } catch (DotDataException e) { CacheLocator.getLanguageCache().putLanguages(null); throw new DotRuntimeException(e); } }
Source:
public Optional<ConnectorPartitioningHandle> getCommonPartitioningHandle(ConnectorSession session, ConnectorPartitioningHandle left, ConnectorPartitioningHandle right) { HivePartitioningHandle leftHandle = (HivePartitioningHandle) left; HivePartitioningHandle rightHandle = (HivePartitioningHandle) right; if (!leftHandle.getHiveTypes().equals(rightHandle.getHiveTypes())) { return Optional.empty(); } if (leftHandle.getBucketCount() == rightHandle.getBucketCount()) { return Optional.of(leftHandle); } if (!isOptimizedMismatchedBucketCount(session)) { return Optional.empty(); } int largerBucketCount = Math.max(leftHandle.getBucketCount(), rightHandle.getBucketCount()); int smallerBucketCount = Math.min(leftHandle.getBucketCount(), rightHandle.getBucketCount()); if (largerBucketCount % smallerBucketCount != 0) { return Optional.empty(); } if (Integer.bitCount(largerBucketCount / smallerBucketCount) != 1) { return Optional.empty(); } OptionalInt maxCompatibleBucketCount = min(leftHandle.getMaxCompatibleBucketCount(), rightHandle.getMaxCompatibleBucketCount()); if (maxCompatibleBucketCount.isPresent() && maxCompatibleBucketCount.getAsInt() < smallerBucketCount) { return Optional.empty(); } return Optional.of(createPartitioningHandleWithHiveType( smallerBucketCount, leftHandle.getHiveTypes().get(), maxCompatibleBucketCount)); }

Target:
public Optional<ConnectorPartitioningHandle> getCommonPartitioningHandle(ConnectorSession session, ConnectorPartitioningHandle left, ConnectorPartitioningHandle right) { HivePartitioningHandle leftHandle = (HivePartitioningHandle) left; HivePartitioningHandle rightHandle = (HivePartitioningHandle) right; if (!leftHandle.getBucketFunctionType().equals(rightHandle.getBucketFunctionType()) || !leftHandle.getHiveTypes().equals(rightHandle.getHiveTypes()) || !leftHandle.getTypes().equals(rightHandle.getTypes())) { return Optional.empty(); } if (leftHandle.getBucketCount() == rightHandle.getBucketCount()) { return Optional.of(leftHandle); } if (!isOptimizedMismatchedBucketCount(session)) { return Optional.empty(); } int largerBucketCount = Math.max(leftHandle.getBucketCount(), rightHandle.getBucketCount()); int smallerBucketCount = Math.min(leftHandle.getBucketCount(), rightHandle.getBucketCount()); if (largerBucketCount % smallerBucketCount != 0) { return Optional.empty(); } if (Integer.bitCount(largerBucketCount / smallerBucketCount) != 1) { return Optional.empty(); } OptionalInt maxCompatibleBucketCount = min(leftHandle.getMaxCompatibleBucketCount(), rightHandle.getMaxCompatibleBucketCount()); if (maxCompatibleBucketCount.isPresent() && maxCompatibleBucketCount.getAsInt() < smallerBucketCount) { return Optional.empty(); } return Optional.of(new HivePartitioningHandle( smallerBucketCount, maxCompatibleBucketCount, leftHandle.getBucketFunctionType(), leftHandle.getHiveTypes(), leftHandle.getTypes())); }
Source:
public static Deque<SentryException> extractExceptionQueue(Throwable throwable) { Deque<SentryException> exceptions = new ArrayDeque<>(); Set<Throwable> circularityDetector = new HashSet<>(); StackTraceElement[] childExceptionStackTrace = new StackTraceElement[0]; ExceptionMechanism exceptionMechanism = null; while (throwable != null && circularityDetector.add(throwable)) { if (throwable.getClass() == ExceptionMechanismThrowable.class) { ExceptionMechanismThrowable exceptionMechanismThrowable = (ExceptionMechanismThrowable) throwable; exceptionMechanism = exceptionMechanismThrowable.getExceptionMechanism(); throwable = exceptionMechanismThrowable.getThrowable(); } else { exceptionMechanism = null; } exceptions.add(new SentryException(throwable, childExceptionStackTrace, exceptionMechanism)); childExceptionStackTrace = throwable.getStackTrace(); throwable = throwable.getCause(); } return exceptions; }

Target:
public static Deque<SentryException> extractExceptionQueue(Throwable throwable) { Deque<SentryException> exceptions = new ArrayDeque<>(); Set<Throwable> circularityDetector = new HashSet<>(); StackTraceElement[] childExceptionStackTrace = new StackTraceElement[0]; ExceptionMechanism exceptionMechanism = null; while (throwable != null && circularityDetector.add(throwable)) { if (throwable instanceof ExceptionMechanismThrowable) { ExceptionMechanismThrowable exceptionMechanismThrowable = (ExceptionMechanismThrowable) throwable; exceptionMechanism = exceptionMechanismThrowable.getExceptionMechanism(); throwable = exceptionMechanismThrowable.getThrowable(); } else { exceptionMechanism = null; } exceptions.add(new SentryException(throwable, childExceptionStackTrace, exceptionMechanism)); childExceptionStackTrace = throwable.getStackTrace(); throwable = throwable.getCause(); } return exceptions; }
Source:
private MethodSpec createBindMethod() { MethodSpec.Builder result = MethodSpec.methodBuilder("bind") .addAnnotation(Override.class) .addModifiers(PUBLIC) .addParameter(FINDER, "finder", FINAL) .addParameter(TypeVariableName.get("T"), "target", FINAL) .addParameter(Object.class, "source"); if (parentViewBinder != null) { result.addStatement("super.bind(finder, target, source)"); } if (!viewIdMap.isEmpty() || !collectionBindings.isEmpty()) { result.addStatement("$T view", ClassName.get("android.view", "View")); for (ViewBindings bindings : viewIdMap.values()) { addViewBindings(result, bindings); } for (Map.Entry<FieldCollectionViewBinding, int[]> entry : collectionBindings.entrySet()) { emitCollectionBinding(result, entry.getKey(), entry.getValue()); } } if (requiresResources()) { result.addStatement("$T res = finder.getContext(source).getResources()", Resources.class); if (!bitmapBindings.isEmpty()) { for (FieldBitmapBinding binding : bitmapBindings) { result.addStatement("target.$L = $T.decodeResource(res, $L)", binding.getName(), BitmapFactory.class, binding.getId()); } } if (!resourceBindings.isEmpty()) { for (FieldResourceBinding binding : resourceBindings) { result.addStatement("target.$L = res.$L($L)", binding.getName(), binding.getMethod(), binding.getId()); } } } return result.build(); }

Target:
private MethodSpec createBindMethod() { MethodSpec.Builder result = MethodSpec.methodBuilder("bind") .addAnnotation(Override.class) .addModifiers(PUBLIC) .addParameter(FINDER, "finder", FINAL) .addParameter(TypeVariableName.get("T"), "target", FINAL) .addParameter(Object.class, "source"); if (parentViewBinder != null) { result.addStatement("super.bind(finder, target, source)"); } if (!viewIdMap.isEmpty() || !collectionBindings.isEmpty()) { result.addStatement("$T view", VIEW); for (ViewBindings bindings : viewIdMap.values()) { addViewBindings(result, bindings); } for (Map.Entry<FieldCollectionViewBinding, int[]> entry : collectionBindings.entrySet()) { emitCollectionBinding(result, entry.getKey(), entry.getValue()); } } if (requiresResources()) { result.addStatement("$T res = finder.getContext(source).getResources()", Resources.class); if (!bitmapBindings.isEmpty()) { for (FieldBitmapBinding binding : bitmapBindings) { result.addStatement("target.$L = $T.decodeResource(res, $L)", binding.getName(), BitmapFactory.class, binding.getId()); } } if (!resourceBindings.isEmpty()) { for (FieldResourceBinding binding : resourceBindings) { result.addStatement("target.$L = res.$L($L)", binding.getName(), binding.getMethod(), binding.getId()); } } } return result.build(); }
Source:
public JPACommit getLastCommit(String key, Object value) throws EDBException { Map<String, Object> q = new HashMap<String, Object>(); q.put(key, value); return getLastCommit(q); }

Target:
public JPACommit getLastCommit(String key, Object value) throws EDBException { Map<String, Object> queryMap = new HashMap<String, Object>(); queryMap.put(key, value); return getLastCommit(queryMap); }
Source:
public FormDefinition createRootFormDefinition(GenerationContext<Path> context) { FormModelHandler modelHandler = formModelHandlerManager.getFormModelHandler(context.getFormModel().getClass()); modelHandler.init(context.getFormModel(), context.getSource()); List<FieldDefinition> modelFields = modelHandler.getAllFormModelFields(); FormDefinition form; org.uberfire.java.nio.file.Path kiePath = Paths.convert(context.getSource()); if (ioService.exists(kiePath)) { form = formSerializer.deserialize(ioService.readAllString(kiePath)); form.getFields().forEach(originalField -> { boolean found = false; for (Iterator<FieldDefinition> it = modelFields.iterator(); it.hasNext() && !found; ) { FieldDefinition modelField = it.next(); if (modelField.getBinding().equals(originalField.getBinding())) { found = true; originalField.setName(modelField.getName()); originalField.setStandaloneClassName(modelField.getStandaloneClassName()); it.remove(); } } if (!found) { originalField.setBinding(null); } }); form.getFields().addAll(modelFields); layoutTemplateGenerator.updateLayoutTemplate(form, modelFields); } else { form = new FormDefinition(context.getFormModel()); form.setId(context.getFormModel().getName()); form.setName(context.getSource().getFileName()); form.getFields().addAll(modelFields); layoutTemplateGenerator.generateLayoutTemplate(form); } form.setModel(context.getFormModel()); return form; }

Target:
public FormDefinition createRootFormDefinition(GenerationContext<Path> context) { FormModelHandler modelHandler = formModelHandlerManager.getFormModelHandler(context.getFormModel().getClass()); modelHandler.init(context.getFormModel(), context.getSource()); List<FieldDefinition> modelFields = modelHandler.getAllFormModelFields(); FormDefinition form; org.uberfire.java.nio.file.Path kiePath = Paths.convert(context.getSource()); if (ioService.exists(kiePath)) { form = formSerializer.deserialize(ioService.readAllString(kiePath)); form.getFields().forEach(originalField -> { FieldDefinition modelField = modelFields.stream().filter(field -> field.getBinding().equals(originalField.getBinding())).findFirst().orElse(null); if (modelField != null) { originalField.setName(modelField.getName()); originalField.setStandaloneClassName(modelField.getStandaloneClassName()); modelFields.remove(modelField); } else { originalField.setBinding(null); } }); form.getFields().addAll(modelFields); layoutTemplateGenerator.updateLayoutTemplate(form, modelFields); } else { form = new FormDefinition(context.getFormModel()); form.setId(context.getFormModel().getName()); form.setName(context.getSource().getFileName()); form.getFields().addAll(modelFields); layoutTemplateGenerator.generateLayoutTemplate(form); } form.setModel(context.getFormModel()); return form; }
Source:
public static Iterator<Pair<byte[],List<KeyValue>>> getUncommittedDataIterator(Connection conn, boolean includeMutableIndexes) throws SQLException { final PhoenixConnection pconn = conn.unwrap(PhoenixConnection.class); final Iterator<Pair<byte[],List<Mutation>>> iterator = pconn.getMutationState().toMutations(includeMutableIndexes, null); return new Iterator<Pair<byte[],List<KeyValue>>>() { @Override public boolean hasNext() { return iterator.hasNext(); } @Override public Pair<byte[], List<KeyValue>> next() { Pair<byte[],List<Mutation>> pair = iterator.next(); List<KeyValue> keyValues = Lists.newArrayListWithExpectedSize(pair.getSecond().size() * 5); for (Mutation mutation : pair.getSecond()) { for (List<Cell> keyValueList : mutation.getFamilyCellMap().values()) { for (Cell keyValue : keyValueList) { keyValues.add(org.apache.hadoop.hbase.KeyValueUtil.ensureKeyValue(keyValue)); } } } Collections.sort(keyValues, pconn.getKeyValueBuilder().getKeyValueComparator()); return new Pair<byte[], List<KeyValue>>(pair.getFirst(),keyValues); } @Override public void remove() { throw new UnsupportedOperationException(); } }; }

Target:
public static Iterator<Pair<byte[],List<KeyValue>>> getUncommittedDataIterator(Connection conn, boolean includeMutableIndexes) throws SQLException { final PhoenixConnection pconn = conn.unwrap(PhoenixConnection.class); final Iterator<Pair<byte[],List<Mutation>>> iterator = pconn.getMutationState().toMutations(includeMutableIndexes); return new Iterator<Pair<byte[],List<KeyValue>>>() { @Override public boolean hasNext() { return iterator.hasNext(); } @Override public Pair<byte[], List<KeyValue>> next() { Pair<byte[],List<Mutation>> pair = iterator.next(); List<KeyValue> keyValues = Lists.newArrayListWithExpectedSize(pair.getSecond().size() * 5); for (Mutation mutation : pair.getSecond()) { for (List<Cell> keyValueList : mutation.getFamilyCellMap().values()) { for (Cell keyValue : keyValueList) { keyValues.add(org.apache.hadoop.hbase.KeyValueUtil.ensureKeyValue(keyValue)); } } } Collections.sort(keyValues, pconn.getKeyValueBuilder().getKeyValueComparator()); return new Pair<byte[], List<KeyValue>>(pair.getFirst(),keyValues); } @Override public void remove() { throw new UnsupportedOperationException(); } }; }