auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>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( <START> context.getAttribute(ApplicationConfiguration.class.getName())) <END> .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); }</code><technical_language>This next external stats tests removed is replacement</technical_language>

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:
<code>public static boolean isNumeric(String str, boolean allowDot) { if (str == null || str.isEmpty()) { return false; } <START> if (allowDot) { <END> 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; }</code><technical_language>handle ".1" not</technical_language>

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:
<code>public List<Subscription> listSubscriptions() throws ServiceUnavailableException { try { <START> return jdbcTemplate.query("SELECT s_subscription_object FROM zn_data.subscription", rowMapper); <END> } catch (final DataAccessException e) { throw new ServiceUnavailableException("Error occurred when running database request", e); } }</code><technical_language>expected order? Is concerns this in API definition</technical_language>

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:
<code>public void addArgumentsToUnInstallFeatures(String uninstallIUs, String destination, String profile) { launcher.addArguments( "-profileProperties", "org.eclipse.update.install.features=false", "-uninstallIU", uninstallIUs, <START> "-shared", Paths.get(destination + File.separator + "lib" + File.separator + "p2").toString(), <END> "-destination", Paths.get(destination + File.separator + profile).toString(), "-profile", profile ); }</code><technical_language>need FileSeparator for paths.get()</technical_language>

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:
<code>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() <START> .method(Method.GET) <END> .bucket("my-bucketname") .object("my-objectname") .expires(60 * 60 * 24) .build()); System.out.println(url); } catch (MinioException e) { System.out.println("Error occurred: " + e); } }</code><technical_language>files PresignedGetObject.java PresignedPutObject.java merged a single example file called GetPresignedObjectUrl.java</technical_language>

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:
<code>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()); <START> return new ACSModeledSegment(acnvModeledSegment.getInterval(), ModeledSegment.NO_CALL, targetCount, ParamUtils.log2(tau/2.0), <END> hetCount, f, sigmaTau, muMinor, sigmaMinor, muMajor, sigmaMajor, segLabelCNLOH); }</code><technical_language>This is confusing. I local variable segmentMeanInLog2CR = acnvModeledSegment.getSegmentMeanPosteriorSummary().getCenter() (since this is ACSModeledSegment constructor takes), tau = .... This passed constructor. This obviates need perform immediately undo transformation locally, is currently do</technical_language>

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:
<code>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) <START> .body("guest", equalTo(true)); <END> }</code><technical_language>checking of details in test? Username other details checked in other tests. difference is "guest=true". sure</technical_language>

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:
<code>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); <START> chatHandlerProvider.get().register(serviceName.replaceAll(".*:", ""), firehose); END> } else { log.info("No chathandler detected"); } return firehose; }</code><technical_language>rolf is preferred! syllable instead of</technical_language>

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:
<code>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]); <START> if (beatLength >= 0) <END> this.beatLength = beatLength; else { this.velocity = (int) beatLength; this.inherited = true; } }</code><technical_language>Explain this change? beatLength 0</technical_language>

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:
<code>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() <START> .getString(R.string.twitter_token_format), accessToken.token, accessToken.secret); <END> 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); } }); }</code><technical_language>Fragment#getString(int resId, Object[] args) preferred here. need modify strings multi-arg friendly. <string name="diseaseMessage2">%1$s killed %2$s!</string></technical_language>

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:
<code>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) { <START> watch.close(); <END> } return deleteFuture; } catch (KubernetesClientException ex) { if (toCloseOnException != null) { toCloseOnException.close(); } throw new KubernetesInfrastructureException(ex); } catch (Exception e) { if (toCloseOnException != null) { toCloseOnException.close(); } throw e; } }</code><technical_language>I think, in a case a pod exist, delete future completed exceptionally message Webscoket connection is closed. event removing is received.. I is exceptional situation. deleteFuture.complete() instead of closing a Watch</technical_language>

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:
<code>public void testConstructorFromJson() { <START> final String jsonString = "{\"data\":\"YXNkZmc=\",\"name\":\"filename.jpg\",\"headers\":{\"Header\":[\"Value\"]}}"; <END> JsonObject json = new JsonObject(jsonString); MailAttachment message = new MailAttachment(json); assertEquals(jsonString, message.toJson().encode()); }</code><technical_language>I guess, for compatibility reason, check contentId is passed in headers too</technical_language>

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:
<code><START> public void suppressLayout(boolean <END> 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(); } } }</code><technical_language>Do want this final for RecyclerView? isLayoutSuppressed()</technical_language>

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:
<code>@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) <START> .removeRule(EnumerableRules.ENUMERABLE_AGGREGATE_RULE).check(); <END> }</code><technical_language>2 in default rule setting of Query, sorted agg in tests</technical_language>

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:
<code>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(); <START> if(pAmount==0) <END> 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; }</code><technical_language>reformat code formatter? I belive is real performnce benefits in this checks. If players online, server is idle anyway, load players notice</technical_language>

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:
<code>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); <START> <END> CherryPickResult result = git.cherryPick().include(commit2).call(); assertNotNull(result); assertEquals(CherryPickStatus.OK, result.getStatus()); }</code><technical_language>For this test work windows - cherrypick fails. set core.filemode TRUE - means executable bit changes fail if differences in this flag index & worktree. produce a difference this flag: set executable bit true in index call db.getFS().setExecute() fail windows. wanted set core.filemode flag FALSE instead? this test succeed</technical_language>

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:
<code>private <T> StateBackedCreator<T, STATE> emptyConstructorStateSettingInstantiator( Class<T> type, Class<STATE> stateType) { final Constructor<T> constructor = getNoArgConstructor(type); if (constructor == null) return null; <START> if (Modifier.isAbstract(constructor.getDeclaringClass().getModifiers())) { <END> 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(); } } }; }</code><technical_language>add check for interface? information cached is expensive. I do check instantiation failed produce a error message there</technical_language>

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:
<code>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)) <START> .value("json", literal(alice, USER_CODEC)) <END> .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)); }</code><technical_language>I more sense pass session's codec registry here, simpler existing session (and necessarily a reference codecs registered init time): suggestion .value("json", literal(alice, session.getContext().getCodecRegistry()))</technical_language>

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:
<code>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"); <START> } catch (InterruptedException | ExecutionException | TimeoutException e) { <END> throw new KafkaException("Error sending message to Kafka", e); } producer.close(); }</code><technical_language>Whats meaning of catching exception rethrow a class</technical_language>

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:
<code><START> public Optional<@NotNull @NotBlank String> returnStringOptional() { <END> return stringOptional; }</code><technical_language>optional of null is a bit painful. another constraint perhaps? Do test payload business btw. (applying wrapper)</technical_language>

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

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:
<code>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) { <START> generator.writeStringField("type", breadcrumb.getType().name().toLowerCase()); <END> } 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(); }</code><technical_language>This a magical maintaining a mapping enum string value, IMO</technical_language>

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:
<code>public void requestAccess(DataFile file) { <START> System.out.print("requestAccess FileDownloadhelper"); <END> if (fileDownloadService.requestAccess(file.getId())) { file.getFileAccessRequesters().add((AuthenticatedUser) session.getUser()); fileDownloadService.sendRequestFileAccessNotification(file.getOwner(), file.getId()); } }</code><technical_language>This logger.fine removed</technical_language>

Target:
public void requestAccess(DataFile file){ processRequestAccess(file, true); }
Source:
<code><START> private void pulseTickMap() { <END> 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); } } } }</code><technical_language>Remove this method move requestPulse(). in requestPulse(), schedule a PulseTask scheduler methods depending is single not. add isPulseAsync getter BlockType</technical_language>

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:
<code>public List<SDVariable> doDiff(List<SDVariable> i_v1) { SDVariable out = outputVariables()[0]; <START> int[] argShape = arg().getShape(); <END> 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); }</code><technical_language>Arg a shape. some place holder logic want put in here. checking for null shapes do this good</technical_language>

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:
<code>protected List<Language> getLanguages() { <START> List<Language> list = CacheLocator.getLanguageCache().getLanguages(); <END> 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); } }</code><technical_language>rename languages</technical_language>

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:
<code>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(); } <START> return Optional.of(createPartitioningHandleWithHiveType( <END> smallerBucketCount, leftHandle.getHiveTypes().get(), maxCompatibleBucketCount)); }</code><technical_language>compatible native partitioning handle well. Please check if partitioning handle type is if column types well. sense constructor public, is easier change maxCompatibleBucketCount performing extra logic</technical_language>

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:
<code>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)) { <START> if (throwable.getClass() == ExceptionMechanismThrowable.class) { <END> 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; }</code><technical_language>instanceof operator test class 'equality'</technical_language>

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:
<code>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()) { <START> result.addStatement("$T view", ClassName.get("android.view", "View")); <END> 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(); }</code><technical_language>this a constant others top</technical_language>

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:
<code>public JPACommit getLastCommit(String key, Object value) throws EDBException { <START> Map<String, Object> q = new HashMap<String, Object>(); <END> q.put(key, value); return getLastCommit(q); }</code><technical_language>avoid char names</technical_language>

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:
<code>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; <START> for (Iterator<FieldDefinition> it = modelFields.iterator(); it.hasNext() && !found; ) { <END> 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; }</code><technical_language>a must, wondering if this arranged a while streams instead</technical_language>

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; }