auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>@Override public Bitmap transform(Bitmap source) { Bitmap result = createBitmap(source.getWidth(), source.getHeight(), source.getConfig()); Bitmap noise; try { noise = picasso.load(R.drawable.noise).get(); } catch (IOException e) { Log.w(TAG, "Failed to apply transformation!", e); <START> return source; <END> } BitmapShader shader = new BitmapShader(noise, REPEAT, REPEAT); ColorMatrix colorMatrix = new ColorMatrix(); colorMatrix.setSaturation(0); ColorMatrixColorFilter filter = new ColorMatrixColorFilter(colorMatrix); Paint paint = new Paint(ANTI_ALIAS_FLAG); paint.setColorFilter(filter); Canvas canvas = new Canvas(result); canvas.drawBitmap(source, 0, 0, paint); paint.setColorFilter(null); paint.setShader(shader); paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.MULTIPLY)); canvas.drawRect(0, 0, canvas.getWidth(), canvas.getHeight(), paint); source.recycle(); noise.recycle(); return result; }</code><technical_language>This throw a RuntimeException crash app. If missing a local resource, bad</technical_language>

Target:
@Override public Bitmap transform(Bitmap source) { Bitmap result = createBitmap(source.getWidth(), source.getHeight(), source.getConfig()); Bitmap noise; try { noise = picasso.load(R.drawable.noise).get(); } catch (IOException e) { throw new RuntimeException("Failed to apply transformation! Missing resource."); } BitmapShader shader = new BitmapShader(noise, REPEAT, REPEAT); ColorMatrix colorMatrix = new ColorMatrix(); colorMatrix.setSaturation(0); ColorMatrixColorFilter filter = new ColorMatrixColorFilter(colorMatrix); Paint paint = new Paint(ANTI_ALIAS_FLAG); paint.setColorFilter(filter); Canvas canvas = new Canvas(result); canvas.drawBitmap(source, 0, 0, paint); paint.setColorFilter(null); paint.setShader(shader); paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.MULTIPLY)); canvas.drawRect(0, 0, canvas.getWidth(), canvas.getHeight(), paint); source.recycle(); noise.recycle(); return result; }
Source:
<code>public static URI summaryToUri(S3ObjectSummary object) { final String originalAuthority = object.getBucketName(); final String originalPath = object.getKey(); final String authority = originalAuthority.endsWith("/") ? originalAuthority.substring(0, originalAuthority.length() - 1) : originalAuthority; final String path = originalPath.startsWith("/") ? originalPath.substring(1) : originalPath; <START> return URI.create(StringUtils.format("s3://%s/%s", authority, path)); <END> }</code><technical_language>authority path strings, string concatenation StringUtils.format()</technical_language>

Target:
public static URI summaryToUri(S3ObjectSummary object) { return summaryToCloudObjectLocation(object).toUri(SCHEME); }
Source:
<code>private RowColumnRangeIterator getAllColumns(Iterable<byte[]> rows) { <START> return kvs.getRowsColumnRange(TABLE_REF, rows, ALL_COLUMNS, 1000, SweepQueueUtils.CAS_TS); <END> }</code><technical_language>OK. decide 1000</technical_language>

Target:
private RowColumnRangeIterator getAllColumns(Iterable<byte[]> rows) { return kvs.getRowsColumnRange(TABLE_REF, rows, ALL_COLUMNS, 100_000, SweepQueueUtils.CAS_TS); }
Source:
<code>public void setUp() throws Exception { con = TestUtil.openDB(); <START> assumeTrue(TestUtil.haveMinimumServerVersion(con, ServerVersion.v9_3)); <END> Statement stmt = con.createStatement(); stmt.execute("CREATE DOMAIN testdom AS int4 CHECK (value < 10)"); TestUtil.createTable(con, "testerr", "id int not null, val testdom not null"); stmt.execute("ALTER TABLE testerr ADD CONSTRAINT testerr_pk PRIMARY KEY (id)"); stmt.close(); }</code><technical_language>idea: introduce a method assumeMinimumServerVersion(con, ServerVersion.v9_3)</technical_language>

Target:
public void setUp() throws Exception { super.setUp(); assumeMinimumServerVersion(ServerVersion.v9_3); Statement stmt = con.createStatement(); stmt.execute("CREATE DOMAIN testdom AS int4 CHECK (value < 10)"); TestUtil.createTable(con, "testerr", "id int not null, val testdom not null"); stmt.execute("ALTER TABLE testerr ADD CONSTRAINT testerr_pk PRIMARY KEY (id)"); stmt.close(); }
Source:
<code>public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { boolean smite = false; if (args.length >= 1) { if (args[0].equalsIgnoreCase("smite")) { TFM_Util.adminAction(sender.getName(), "Smiting all invisible players", true); smite = true; } else { return false; } } List<String> players = new ArrayList<String>(); int smites = 0; for (Player player : server.getOnlinePlayers()) { if (player.hasPotionEffect(PotionEffectType.INVISIBILITY)) { players.add(player.getName()); if (smite && !TFM_AdminList.isSuperAdmin(player)) { player.setHealth(0.0); smites++; } } } if (players.isEmpty()) { playerMsg("There are no invisible players"); return true; } if (smite) { playerMsg("Smitten " + smites + " players"); } else { playerMsg("Invisible players (" + players.size() + "): " + StringUtils.join(players, ", ")); } { if (args[0].equalsIgnoreCase("clear")) { TFM_Util.adminAction(sender.getName(), "Clearing all invis potion effect from all players", true); smite = true; } else { return false; } } <START> for (Player player : server.getOnlinePlayers()) <END> { if (player.hasPotionEffect(PotionEffectType.INVISIBILITY)) { { player.removePotionEffect((PotionEffectType.INVISIBILITY)); } } } return true; }</code><technical_language>Formatting a tad here</technical_language>

Target:
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { boolean smite = false; if (args.length >= 1) { if (args[0].equalsIgnoreCase("smite")) { TFM_Util.adminAction(sender.getName(), "Smiting all invisible players", true); smite = true; } else { return false; } } List<String> players = new ArrayList<String>(); int smites = 0; for (Player player : server.getOnlinePlayers()) { if (player.hasPotionEffect(PotionEffectType.INVISIBILITY)) { players.add(player.getName()); if (smite && !TFM_AdminList.isSuperAdmin(player)) { player.setHealth(0.0); smites++; } } } if (players.isEmpty()) { playerMsg("There are no invisible players"); return true; } if (smite) { playerMsg("Smitten " + smites + " players"); } else { playerMsg("Invisible players (" + players.size() + "): " + StringUtils.join(players, ", ")); } { if (args[0].equalsIgnoreCase("clear")) { TFM_Util.adminAction(sender.getName(), "Clearing all invis potion effect from all players", true); } else { return false; } } for (Player player : server.getOnlinePlayers()) { if (player.hasPotionEffect(PotionEffectType.INVISIBILITY)) { { player.removePotionEffect((PotionEffectType.INVISIBILITY)); } } } return true; }
Source:
<code>public void beforeCompletion(@NotNull CompletionInitializationContext context) { PsiFile file = context.getFile(); if (file.getFileType() != ErlangFileType.APP) return; int startOffset = context.getStartOffset(); PsiElement elementAt = file.findElementAt(startOffset); PsiElement parent = elementAt != null ? elementAt.getParent() : null; if (parent instanceof ErlangTupleExpression) { context.setDummyIdentifier("a"); <START> } <END> }</code><technical_language>Do need set dummy identifier</technical_language>

Target:
public void beforeCompletion(@NotNull CompletionInitializationContext context) { PsiFile file = context.getFile(); if (file.getFileType() != ErlangFileType.APP) return; int startOffset = context.getStartOffset(); PsiElement elementAt = file.findElementAt(startOffset); PsiElement parent = elementAt != null ? elementAt.getParent() : null; if (parent instanceof ErlangTupleExpression) { context.setDummyIdentifier(APPLICATION_KEYWORD); } }
Source:
<code>public void updateBrand_doesNotFireEventWhenBrandIsSame() { Brand brand = Brand.CHOSEN; currentBrand.update(brand); Mockito.reset(eventBus); currentBrand.update(brand); <START> verify(eventBus, never()).fireEventFromSource(isA(BrandChangedEvent.class), same(currentBrand)); <END> }</code><technical_language>verifyZeroInteractions() here</technical_language>

Target:
public void updateBrand_doesNotFireEventWhenBrandIsSame() { Brand brand = Brand.CHOSEN; currentBrand.update(brand); Mockito.reset(eventBus); currentBrand.update(brand); verifyZeroInteractions(eventBus); }
Source:
<code><START> private int stringToSurfaceRotation(String s) { <END> if (s.equals("0")) { return Surface.ROTATION_0; } if (s.equals("90")) { return Surface.ROTATION_90; } if (s.equals("180")) { return Surface.ROTATION_180; } if (s.equals("270")) { return Surface.ROTATION_270; } throw new IllegalArgumentException("Unsupported surface rotation string '" + s + "'"); }</code><technical_language>This method static well. Also, comparisons of form "0".equals(s) preferred s.equals("0") if s is null throw a NPE while will. aware rest of this file follow this convention, reason fix for new patches... :)</technical_language>

Target:
private static int stringToSurfaceRotation(String s) { if ("0".equals(s)) { return Surface.ROTATION_0; } if ("90".equals(s)) { return Surface.ROTATION_90; } if ("180".equals(s)) { return Surface.ROTATION_180; } if ("270".equals(s)) { return Surface.ROTATION_270; } throw new IllegalArgumentException("Unsupported surface rotation string '" + s + "'"); }
Source:
<code>public void canSendCalendarParameters() throws IOException { DocumentModel testUser = userManager.getBareUserModel(); testUser.setProperty("user", "username", "existingMembers"); testUser = userManager.createUser(testUser); assertNotNull(testUser.getId()); txFeature.nextTransaction(); Document root = (Document) super.session.newRequest(FetchDocument.ID).set("value", "/").execute(); OperationRequest request = session.newRequest(AddPermission.ID); GregorianCalendar begin = new GregorianCalendar(2015, Calendar.JUNE, 20, 12, 34, 56); GregorianCalendar end = new GregorianCalendar(2015, Calendar.JULY, 14, 12, 34, 56); request.setInput(root) .set("username", "existingMembers") .set("permission", "Write") .set("begin", begin) .set("end", end) .execute(); <START> userManager.deleteUser(testUser.getId()); <END> }</code><technical_language>Please, do tear in a try finally ensure user is deleted</technical_language>

Target:
public void canSendCalendarParameters() throws IOException { DocumentModel testUser = userManager.getBareUserModel(); testUser.setProperty("user", "username", "existingMembers"); testUser = userManager.createUser(testUser); assertNotNull(testUser.getId()); txFeature.nextTransaction(); try { Document root = (Document) super.session.newRequest(FetchDocument.ID).set("value", "/").execute(); OperationRequest request = session.newRequest(AddPermission.ID); GregorianCalendar begin = new GregorianCalendar(2015, Calendar.JUNE, 20, 12, 34, 56); GregorianCalendar end = new GregorianCalendar(2015, Calendar.JULY, 14, 12, 34, 56); request.setInput(root) .set("username", "existingMembers") .set("permission", "Write") .set("begin", begin) .set("end", end) .execute(); } finally { userManager.deleteUser(testUser.getId()); } }
Source:
<code>public boolean isValidTokenLocalUser(int token, String username) throws TOTPException { KeyRepresentation encoding = KeyRepresentation.BASE32; try { if ("Base64".equals(TOTPUtil.getEncodingMethod())) { encoding = KeyRepresentation.BASE64; } } catch (IdentityApplicationManagementException e) { <START> log.error("Error when reading the tenant encoding method"); <END> } GoogleAuthenticatorConfig.GoogleAuthenticatorConfigBuilder gacb = new GoogleAuthenticatorConfig .GoogleAuthenticatorConfigBuilder() .setKeyRepresentation(encoding); GoogleAuthenticator googleAuthenticator = new GoogleAuthenticator(gacb.build()); try { int tenantId = IdentityUtil.getTenantIdOFUser(username); UserRealm userRealm = TOTPManagerComponent.getRealmService().getTenantUserRealm(tenantId); if (userRealm != null) { UserStoreManager userStoreManager = userRealm.getUserStoreManager(); String secretkey = userStoreManager.getUserClaimValue(MultitenantUtils.getTenantAwareUsername (username), Constants.SECRET_KEY, null); return googleAuthenticator.authorize(secretkey, token); } else { throw new TOTPException("Cannot find the user realm for the given tenant domain : " + CarbonContext .getThreadLocalCarbonContext().getTenantDomain()); } } catch (IdentityException e) { throw new TOTPException("TOTPTokenVerifier failed while trying to get the tenant ID of the user : " + username, e); } catch (UserStoreException e) { throw new TOTPException("TOTPTokenVerifier failed while trying to access userRealm of the user : " + username, e); } }</code><technical_language>'e' is logged</technical_language>

Target:
public boolean isValidTokenLocalUser(int token, String username) throws TOTPException { KeyRepresentation encoding = KeyRepresentation.BASE32; try { if (Constants.BASE64.equals(TOTPUtil.getEncodingMethod())) { encoding = KeyRepresentation.BASE64; } } catch (IdentityApplicationManagementException e) { log.error("Error when reading the tenant encoding method", e); } GoogleAuthenticatorConfig.GoogleAuthenticatorConfigBuilder gacb = new GoogleAuthenticatorConfig .GoogleAuthenticatorConfigBuilder() .setKeyRepresentation(encoding); GoogleAuthenticator googleAuthenticator = new GoogleAuthenticator(gacb.build()); try { int tenantId = IdentityUtil.getTenantIdOFUser(username); UserRealm userRealm = TOTPManagerComponent.getRealmService().getTenantUserRealm(tenantId); if (userRealm != null) { UserStoreManager userStoreManager = userRealm.getUserStoreManager(); String secretkey = userStoreManager.getUserClaimValue(MultitenantUtils.getTenantAwareUsername (username), Constants.SECRET_KEY_CLAIM_URL, null); return googleAuthenticator.authorize(secretkey, token); } else { throw new TOTPException("Cannot find the user realm for the given tenant domain : " + CarbonContext .getThreadLocalCarbonContext().getTenantDomain()); } } catch (IdentityException e) { throw new TOTPException("TOTPTokenVerifier failed while trying to get the tenant ID of the user : " + username, e); } catch (UserStoreException e) { throw new TOTPException("TOTPTokenVerifier failed while trying to access userRealm of the user : " + username, e); } }
Source:
<code>public static void error(String message, Throwable throwable) { logError(Level.SEVERE, message, throwable); <START> SlimefunPlugin.instance.getLogger().log(Level.SEVERE, message, throwable); <END> }</code><technical_language>do Slimefun.getLogger()</technical_language>

Target:
public static void error(String message, Throwable throwable) { logError(Level.SEVERE, message, throwable); Slimefun.getLogger().log(Level.SEVERE, message, throwable); }
Source:
<code><START> public BundleContext getBundleContext() { <END> final Bundle bundle = FrameworkUtil.getBundle(this.getClass()); if (bundle != null) { return bundle.getBundleContext(); } else { return null; } }</code><technical_language>I prefer if change bundleContext member default protected. getBundleContext() is initialize bundleContext variable (I description is correct)</technical_language>

Target:
private BundleContext getBundleContext() { final Bundle bundle = FrameworkUtil.getBundle(this.getClass()); if (bundle != null) { return bundle.getBundleContext(); } else { return null; } }
Source:
<code>for (Class clazz : ApplyFunction.class.getClasses()) { if (!Modifier.isAbstract(clazz.getModifiers()) && ApplyFunction.class.isAssignableFrom(clazz)) { try { ApplyFunction function = (ApplyFunction) clazz.newInstance(); applyFunctionMap.put(StringUtils.toLowerCase(function.name()), function); } catch (Exception e) { <START> log.info("failed to instantiate " + clazz.getName() + ".. ignoring", e); <END> } } }</code><technical_language>I a copy/paste function, I termed error. Also, "e" argument , currently I is ignored</technical_language>

Target:
for (Class clazz : ApplyFunction.class.getClasses()) { if (!Modifier.isAbstract(clazz.getModifiers()) && ApplyFunction.class.isAssignableFrom(clazz)) { try { ApplyFunction function = (ApplyFunction) clazz.newInstance(); applyFunctionMap.put(StringUtils.toLowerCase(function.name()), function); } catch (Exception e) { log.error(e, "failed to instantiate %s.. ignoring", clazz.getName()); } } }
Source:
<code>public void configure(Binder binder) { this.binder = requireNonNull(binder, "binder is null"); configBinder(binder).bindConfig(KerberosConfig.class); configBinder(binder).bindConfig(HttpClientConfig.class, annotation, name); configBinder(binder).bindConfig(JettyIoPoolConfig.class); binder.bind(JettyIoPoolManager.class).to(SharedJettyIoPoolManager.class).in(Scopes.SINGLETON); binder.bind(QueuedThreadPoolMBean.class) .toProvider(QueuedThreadPoolMBeanProvider.class) .in(SINGLETON); newExporter(binder).export(QueuedThreadPoolMBean.class) <START> .as(generatedNameOf(QueuedThreadPool.class, "shared_" + annotation.getSimpleName())); <END> binder.bind(HttpClient.class).annotatedWith(annotation).toProvider(new HttpClientProvider(name, annotation)).in(SINGLETON); newSetBinder(binder, HttpRequestFilter.class, GlobalFilter.class); newSetBinder(binder, HttpRequestFilter.class, annotation); newExporter(binder).export(HttpClient.class).annotatedWith(annotation).withGeneratedName(); }</code><technical_language>This shared pool is global, name shared annotation. This exports MBean multiple names (one client), I is correct</technical_language>

Target:
public void configure(Binder binder) { this.binder = requireNonNull(binder, "binder is null"); configBinder(binder).bindConfig(KerberosConfig.class); configBinder(binder).bindConfig(HttpClientConfig.class, annotation, name); binder.install(JETTY_SHARED_IO_POOL_MODULE); binder.bind(HttpClient.class).annotatedWith(annotation).toProvider(new HttpClientProvider(name, annotation)).in(Scopes.SINGLETON); newSetBinder(binder, HttpRequestFilter.class, GlobalFilter.class); newSetBinder(binder, HttpRequestFilter.class, annotation); newExporter(binder).export(HttpClient.class).annotatedWith(annotation).withGeneratedName(); }
Source:
<code><START> public String toString(){ <END> return mComponent; }</code><technical_language>Space {</technical_language>

Target:
public String toString() { return component; }
Source:
<code>void afterNamesPerGroupChanged() { <START> String namesNumber = namesPerGroup.getText().toString().trim(); <END> if (namesPerGroup.isFocused() && isValid(namesNumber)) { numGroups.setText(getOffset(namesNumber)); } dialog.getActionButton(DialogAction.POSITIVE).setEnabled(isValid(namesNumber)); }</code><technical_language>suggestion String namesPerGroupInput = namesPerGroup.getText().toString().trim();</technical_language>

Target:
void afterNamesPerGroupChanged() { String namesPerGroupInput = namesPerGroup.getText().toString().trim(); if (namesPerGroup.isFocused() && isValid(namesNumber)) { numGroups.setText(getOffset(namesNumber)); } dialog.getActionButton(DialogAction.POSITIVE).setEnabled(isValid(namesNumber)); }
Source:
<code>protected final void registerAsSlingFilter(ComponentContext ctx, int ranking, String pattern) { Dictionary<String, String> filterProps = new Hashtable<String, String>(); filterProps.put("service.ranking", String.valueOf(ranking)); <START> filterProps.put("sling.filter.scope", "REQUEST"); <END> filterRegistration = ctx.getBundleContext().registerService(Filter.class.getName(), this, filterProps); }</code><technical_language>Again, SlingFilterScope enum</technical_language>

Target:
protected final void registerAsSlingFilter(ComponentContext ctx, int ranking, String pattern) { Dictionary<String, String> filterProps = new Hashtable<String, String>(); filterProps.put("service.ranking", String.valueOf(ranking)); filterProps.put("sling.filter.scope", "REQUEST"); filterProps.put("sling.filter.pattern", StringUtils.defaultIfEmpty(pattern, ".*")); filterRegistration = ctx.getBundleContext().registerService(Filter.class.getName(), this, filterProps); }
Source:
<code>private static URL deploymentStaticOne() throws Throwable { <START> System.out.println("deploymentStatic"); <END> return new URL("<LINK_0>"); }</code><technical_language>Remove this</technical_language>

Target:
private static URL deploymentStaticOne() throws Throwable { return new URL("<LINK_0>"); }
Source:
<code>RevCommit next() throws MissingObjectException, IncorrectObjectTypeException, IOException { try { for (;;) { final RevCommit c = pending.next(); if (c == null) { return null; } final boolean produce; if ((c.flags & UNINTERESTING) != 0) produce = false; else { if (filter.requiresCommitBody()) c.parseBody(walker); produce = filter.include(walker, c); } for (int i = 0; i < c.parents.length; i++) { RevCommit p = c.parents[i]; if ((p.flags & SEEN) != 0) continue; if ((p.flags & PARSED) == 0) p.parseHeaders(walker); p.flags |= SEEN; <START> if (firstParent && i > 0) { <END> continue; } pending.add(p); } walker.carryFlagsImpl(c); if ((c.flags & UNINTERESTING) != 0) { if (pending.everbodyHasFlag(UNINTERESTING)) { final RevCommit n = pending.peek(); if (n != null && n.commitTime >= last.commitTime) { overScan = OVER_SCAN; } else if (--overScan == 0) throw StopWalkException.INSTANCE; } else { overScan = OVER_SCAN; } if (canDispose) c.disposeBody(); continue; } if (produce) return last = c; else if (canDispose) c.disposeBody(); } } catch (StopWalkException swe) { pending.clear(); return null; } }</code><technical_language>I sense skip parseHeaders, too, logic traversed other parents all. If trouble, a followup change. :)</technical_language>

Target:
RevCommit next() throws MissingObjectException, IncorrectObjectTypeException, IOException { try { for (;;) { final RevCommit c = pending.next(); if (c == null) { return null; } final boolean produce; if ((c.flags & UNINTERESTING) != 0) produce = false; else { if (filter.requiresCommitBody()) c.parseBody(walker); produce = filter.include(walker, c); } for (int i = 0; i < c.parents.length; i++) { RevCommit p = c.parents[i]; if (firstParent && i > 0) { continue; } if ((p.flags & SEEN) != 0) continue; if ((p.flags & PARSED) == 0) p.parseHeaders(walker); p.flags |= SEEN; pending.add(p); } walker.carryFlagsImpl(c); if ((c.flags & UNINTERESTING) != 0) { if (pending.everbodyHasFlag(UNINTERESTING)) { final RevCommit n = pending.peek(); if (n != null && n.commitTime >= last.commitTime) { overScan = OVER_SCAN; } else if (--overScan == 0) throw StopWalkException.INSTANCE; } else { overScan = OVER_SCAN; } if (canDispose) c.disposeBody(); continue; } if (produce) return last = c; else if (canDispose) c.disposeBody(); } } catch (StopWalkException swe) { pending.clear(); return null; } }
Source:
<code>public List<ExperimentSpotDesign> list() { <START> List expmts = this.getHibernateTemplate().find("from ExperimentSpotDesign as spotDesign order by readSpec.experimentSpotDesignId asc" END> ); return expmts; }</code><technical_language>copy/paste bug in order clause</technical_language>

Target:
public List<ExperimentSpotDesign> list() { List expmts = this.getHibernateTemplate().find("from ExperimentSpotDesign as spotDesign" ); return expmts; }
Source:
<code>public Config<T> withRecordClass(Class<T> klass) { <START> return new Config<T>(Objects.requireNonNull(klass, "recordClass"), this.filterPredicate, this.deprecatedProjectionString, this.strictProjectionString); <END> }</code><technical_language>suggestion return new Config<T>(Objects.requireNonNull(klass, "recordClass null"), this.filterPredicate, this.deprecatedProjectionString, this.strictProjectionString);</technical_language>

Target:
public Config<T> withRecordClass(Class<T> klass) { return new Config<T>( Objects.requireNonNull(klass, "recordClass cannot be null"), this.filterPredicate, this.deprecatedProjectionString, this.strictProjectionString); }
Source:
<code>public void validateJob(InputStream jobInputStream) throws JobValidationException { try { byte[] bytes = ValidationUtil.getInputStreamBytes(jobInputStream); String findSchemaByNamespaceUsed = findSchemaByNamespaceUsed(new ByteArrayInputStream(bytes)); InputStream schemaStream = this.getClass().getResourceAsStream(findSchemaByNamespaceUsed); <START> ValidationUtil.validate(new ByteArrayInputStream(bytes), schemaStream); <END> } catch (Exception e) { throw new JobValidationException(true, e); } }</code><technical_language>closed ByteArrayInputStream</technical_language>

Target:
public void validateJob(InputStream jobInputStream) throws JobValidationException { try { byte[] bytes = ValidationUtil.getInputStreamBytes(jobInputStream); try (ByteArrayInputStream jobInputStreamForSchema = new ByteArrayInputStream(bytes)) { String findSchemaByNamespaceUsed = findSchemaByNamespaceUsed(jobInputStreamForSchema); InputStream schemaStream = this.getClass().getResourceAsStream(findSchemaByNamespaceUsed); try (ByteArrayInputStream jobInputStreamForValidation = new ByteArrayInputStream(bytes)) { ValidationUtil.validate(jobInputStreamForValidation, schemaStream); } } } catch (Exception e) { throw new JobValidationException(true, e); } }
Source:
<code><START> public CompletionStage<MarshallableEntry> loadFromAllStores(Object key, boolean localInvocation, boolean includeStores) { <END> assert !Thread.currentThread().getName().startsWith("persistence") : "Thread name is: " + Thread.currentThread().getName(); int traceId = getNextTraceNumber("Loading from first store for id %d"); return continueOnCPUExecutor(CompletableFuture.supplyAsync(() -> loadFromAllStoresSync(key, localInvocation, includeStores, traceId), persistenceExecutor), traceId); }</code><technical_language><K, V> CompletionStage<MarshallableEntry<K,V>></technical_language>

Target:
public <K, V> CompletionStage<MarshallableEntry<K, V>> loadFromAllStores(Object key, boolean localInvocation, boolean includeStores) { assert !Thread.currentThread().getName().startsWith("persistence") : "Thread name is: " + Thread.currentThread().getName(); return supplyOnPersistenceExAndContinue(traceId -> loadFromAllStoresSync(key, localInvocation, includeStores, traceId), "Loading from first store for id %d"); }
Source:
<code>private static String getLogType(String logs) { String[] logsArray = logs.split("~"); <START> String types = ""; END> for (int i = 0; i < logsArray.length; i++) { types += logsArray[i].substring(0, logsArray[i].indexOf(':')); } if (types.contains(ERROR)) { return ERROR; } else if (types.contains(EVENT)) { return EVENT; } else if (types.contains(MESSAGE)) { return MESSAGE; } else if (types.contains(STACK)) { return STACK; } else { return OTHER; } }</code><technical_language>if want, StringBuilder: StringBuilder builder = new StringBuilder(); for (int i = 0; i < logsArray.length; i++) { builder.append(logsArray[i].substring(0, logsArray[i].indexOf(':'))); } String types = builder.toString();</technical_language>

Target:
private static String getLogType(String logs) { String[] logsArray = logs.split("~"); StringBuilder builder = new StringBuilder(); for (int i = 0; i < logsArray.length; i++) { builder.append(logsArray[i].substring(0, logsArray[i].indexOf(':'))); } String types = builder.toString(); if (types.contains(ERROR)) { return ERROR; } else if (types.contains(EVENT)) { return EVENT; } else if (types.contains(MESSAGE)) { return MESSAGE; } else if (types.contains(STACK)) { return STACK; } else { return OTHER; } }
Source:
<code>private void packetReceived(int seq, boolean marked) { long now = System.currentTimeMillis(); synchronized (incomingSeqsSyncRoot) { if (incomingSeqs == null) { <START> incomingSeqs = new TreeMap<>(RTPUtils.sequenceNumberComparator); <END> } if (incomingSeqs.size() >= MAX_INCOMING_PACKETS_HISTORY) { Iterator<Map.Entry<Integer, Long>> iter = incomingSeqs.entrySet().iterator(); if (iter.hasNext()) { iter.next(); iter.remove(); } logger.info("Reached max size, removing an entry."); } if (incomingSeqs.isEmpty()) { firstIncomingTs = now; } incomingSeqs.put(seq, now); } maybeSendRtcp(marked, now); }</code><technical_language>reason do this construction time</technical_language>

Target:
private void packetReceived(int seq, boolean marked) { long now = System.currentTimeMillis(); synchronized (incomingPacketsSyncRoot) { if (incomingPackets == null) { incomingPackets = new RTCPTCCPacket.PacketMap(); } if (incomingPackets.size() >= MAX_INCOMING_PACKETS_HISTORY) { Iterator<Map.Entry<Integer, Long>> iter = incomingPackets.entrySet().iterator(); if (iter.hasNext()) { iter.next(); iter.remove(); } logger.info("Reached max size, removing an entry."); } if (incomingPackets.isEmpty()) { firstIncomingTs = now; } incomingPackets.put(seq, now); } maybeSendRtcp(marked, now); }
Source:
<code><START> public Optional<String> getLatestSchemaSnapshotFilename() { Optional<String> snapshotVersion = getLatestSnapshotVersion(); if (snapshotVersion.isPresent()) { return Optional .of(SCHEMA_ONLY_FOLDER_NAME + File.separator + SCHEMA_ONLY_BASE_NAME + snapshotVersion.get() + DOT_XML); } return Optional.empty(); } <END></code><technical_language>This reduced to: java return getLatestLiquibaseSnapshotVersion().map( snapshotVersion -> LIQUIBASE_SNAPSHOTS_FOLDER + File.separator + snapshotVersion + File.separator + LIQUIBASE_CORE_DATA_FILENAME); need change</technical_language>

Target:
public Optional<String> getLatestSchemaSnapshotFilename() { return getLatestSnapshotVersion().map( snapshotVersion -> SCHEMA_ONLY_FOLDER_NAME + File.separator + SCHEMA_ONLY_BASE_NAME + snapshotVersion + DOT_XML); }
Source:
<code>public long getNumberOfImagesInStorageDomain(Guid storageDomainId) { <START> MapSqlParameterSource params = getCustomMapSqlParameterSource().addValue("storage_domain_id", storageDomainId); <END> return getCallsHandler().executeRead("GetNumberOfImagesInStorageDomain", getLongMapper(), params); }</code><technical_language>inline this conform rest of class</technical_language>

Target:
public long getNumberOfImagesInStorageDomain(Guid storageDomainId) { return getCallsHandler().executeRead("GetNumberOfImagesInStorageDomain", getLongMapper(), getCustomMapSqlParameterSource().addValue("storage_domain_id", storageDomainId)); }
Source:
<code>public StreamsProducer(final Producer<byte[], byte[]> producer, final StreamThread.ProcessingMode processingMode, final LogContext logContext) { this.producer = Objects.requireNonNull(producer, "producer cannot be null"); this.processingMode = Objects.requireNonNull(processingMode, "processingMode cannot be null"); <START> this.eosEnabled = processingMode == EXACTLY_ONCE_ALPHA || processingMode == EXACTLY_ONCE_BETA; <END> log = Objects.requireNonNull(logContext, "logContext cannot be null").logger(getClass()); logPrefix = logContext.logPrefix().trim(); }</code><technical_language>nit: passing in processingMode, potentially this check a helper function as: private boolean0 eosEnabled() { processingMode == EXACTLY_ONCE_ALPHA || processingMode == EXACTLY_ONCE_BETA; }</technical_language>

Target:
public StreamsProducer(final Producer<byte[], byte[]> producer, final StreamThread.ProcessingMode processingMode, final LogContext logContext) { this.producer = Objects.requireNonNull(producer, "producer cannot be null"); this.processingMode = Objects.requireNonNull(processingMode, "processingMode cannot be null"); log = Objects.requireNonNull(logContext, "logContext cannot be null").logger(getClass()); logPrefix = logContext.logPrefix().trim(); }
Source:
<code><START> protected String[] getGDBCommandLine() { <END> List<String> gdbCommandLine = new ArrayList<String>(); gdbCommandLine.add(getGDBPath().toOSString()); gdbCommandLine.add("--interpreter"); gdbCommandLine.add("mi2"); gdbCommandLine.add("--nx"); return gdbCommandLine.toArray(new String[gdbCommandLine.size()]); }</code><technical_language>API breakage errors. declare another method mark for deprecation this one</technical_language>

Target:
protected String getGDBCommandLine() { StringBuffer gdbCommandLine = new StringBuffer(getGDBPath().toOSString()); gdbCommandLine.append(" --interpreter"); gdbCommandLine.append(" mi2"); gdbCommandLine.append(" --nx"); return gdbCommandLine.toString(); }
Source:
<code>public PerformSearchResponse performSearch(JsonRpcPeer peer, final JSONObject params) { final PerformSearchRequest request = mObjectMapper.convertValue( params, PerformSearchRequest.class); <START> final ArrayListAccumulator<Integer> results = new ArrayListAccumulator<>(); <END> mDocument.postAndWait(new Runnable() { @Override public void run() { mDocument.findMatchingElements(request.query, results); } }); final String id = String.valueOf(mResultCounter.getAndIncrement()); mSearchResults.put(id, results); final PerformSearchResponse response = new PerformSearchResponse(); response.searchId = id; response.resultCount = results.size(); return response; }</code><technical_language>I opportunity increase clarity ... do integers of results represent? node IDs? If so, calling this nodeIdResults illuminate this fact</technical_language>

Target:
public PerformSearchResponse performSearch(JsonRpcPeer peer, final JSONObject params) { final PerformSearchRequest request = mObjectMapper.convertValue( params, PerformSearchRequest.class); final ArrayListAccumulator<Integer> resultNodeIds = new ArrayListAccumulator<>(); mDocument.postAndWait(new Runnable() { @Override public void run() { mDocument.findMatchingElements(request.query, resultNodeIds); } }); final String searchId = String.valueOf(mResultCounter.getAndIncrement()); mSearchResults.put(searchId, resultNodeIds); final PerformSearchResponse response = new PerformSearchResponse(); response.searchId = searchId; response.resultCount = resultNodeIds.size(); return response; }
Source:
<code>private String getBrowserTimezoneOffsetMins(EpdqTemplateData templateData) { return templateData.getAuthCardDetails().getJsTimezoneOffsetMins() .filter(timezoneOffsetMins -> NUMBER_FROM_MINUS_840_TO_720.matcher(timezoneOffsetMins).matches()) .map(Integer::parseInt) .filter(timezoneOffsetMins -> timezoneOffsetMins >= -840 && timezoneOffsetMins <= 720) .map(timezoneOffsetMins -> Integer.toString(timezoneOffsetMins)) <START> .orElse(getCurrentBrowserOffsetInMinutes()); <END> }</code><technical_language>This .orElseGet(this::getDefaultBrowserLanguage) default calculated time if needed</technical_language>

Target:
private String getBrowserTimezoneOffsetMins(EpdqTemplateData templateData) { return templateData.getAuthCardDetails().getJsTimezoneOffsetMins() .filter(timezoneOffsetMins -> NUMBER_FROM_MINUS_999_TO_999.matcher(timezoneOffsetMins).matches()) .map(Integer::parseInt) .filter(timezoneOffsetMins -> timezoneOffsetMins >= -840 && timezoneOffsetMins <= 720) .map(timezoneOffsetMins -> Integer.toString(timezoneOffsetMins)) .orElseGet(() -> getDefaultBrowserOffsetInMinutes()); }
Source:
<code>public Config set(String name, String value) throws GitException { ConfigKey key = parseName(name); repository.getConfig().setString(key.section, key.subsection, key.name, value); try { this.repository.getConfig().save(); } catch (IOException e) { <START> throw new GitException("Failed to save to config file"); <END> } return this; }</code><technical_language>exception is dropped, log</technical_language>

Target:
public Config set(String name, String value) throws GitException { ConfigKey key = parseName(name); repository.getConfig().setString(key.section, key.subsection, key.name, value); try { this.repository.getConfig().save(); } catch (IOException e) { throw new GitException(e.getMessage(), e); } return this; }
Source:
<code>PathAddress getModelControllerResourceAddress(ManagementModel managementModel) { if (modelControllerResourceAddress == null) { Set<String> hosts = managementModel.getRootResource().getChildrenNames(HOST); if (hosts.size() == 0) { return null; <START> } <END> String hostName = managementModel.getRootResource().getChildrenNames(HOST).iterator().next(); modelControllerResourceAddress = PathAddress.pathAddress(HOST, hostName).append(MODEL_CONTROLLER_ADDRESS); } return modelControllerResourceAddress; }</code><technical_language>Is this related JMX problem, noticed working this issue? If please file a separate JIRA split commit. I this need fixed, problem change</technical_language>

Target:
PathAddress getModelControllerResourceAddress(ManagementModel managementModel) { if (modelControllerResourceAddress == null) { Set<String> hosts = managementModel.getRootResource().getChildrenNames(HOST); if (hosts.size() == 0) { return null; } String hostName = hosts.iterator().next(); modelControllerResourceAddress = PathAddress.pathAddress(HOST, hostName).append(MODEL_CONTROLLER_ADDRESS); } return modelControllerResourceAddress; }
Source:
<code>public static List<Object> map(Package pack) { List<Object> row = Lists.newArrayList(); for (Entry<String, String> entry : PACKAGE_ATTRS.entrySet()) { switch (entry.getKey()) { case EMX_PACKAGE_TAGS: row.add( <START> StringUtils.join( <END> StreamSupport.stream(pack.getTags().spliterator(), false) .map(Tag::getId) .collect(Collectors.toList()), ",")); break; case EMX_PACKAGE_PARENT: Package parent = pack.getParent(); row.add(parent != null ? parent.getId() : ""); break; default: Object value = pack.get(entry.getValue()); row.add(value != null ? value.toString() : ""); } } return row; }</code><technical_language>Java 8 String.join instead of a party library</technical_language>

Target:
public static List<Object> map(Package pack) { List<Object> row = Lists.newArrayList(); for (Entry<String, String> entry : PACKAGE_ATTRS.entrySet()) { switch (entry.getKey()) { case EMX_PACKAGE_TAGS: row.add(Streams.stream(pack.getTags()).map(Tag::getId).collect(joining(","))); break; case EMX_PACKAGE_PARENT: Package parent = pack.getParent(); row.add(parent != null ? parent.getId() : ""); break; default: Object value = pack.get(entry.getValue()); row.add(value != null ? value.toString() : ""); } } return row; }
Source:
<code>public void if_then_test_predecessors() { ControlFlowGraph cfg = build(functionTree( <START> BlockString.withId(0).withSuccessorIds(1, 2).withPredecessorIds().build() + <END> "$x = 1;" + "1 + 1;" + "if (a) {" + BlockString.withId(1).withSuccessorIds(2).withPredecessorIds(0).build() + "}" + BlockString.withId(2).withSuccessorIds("END").withPredecessorIds(0, 1).build())); assertThat(cfg.blocks()).hasSize(4); Map<String, BlockMetadata> data = MetadataParser.parse(cfg.blocks()); CfgBlock startBlock = data.get("0").getBlock(); assertThat(startBlock).isEqualTo(cfg.start()); assertThat(startBlock).isExactlyInstanceOf(PhpCfgBranchingBlock.class); PhpCfgBranchingBlock ifBlock = (PhpCfgBranchingBlock) startBlock; assertThat(ifBlock.trueSuccessor()).isEqualTo(data.get("1").getBlock()); assertThat(ifBlock.falseSuccessor()).isEqualTo(data.get("2").getBlock()); assertThat(data.get("END").getBlock().predecessors()).hasSize(1); Validator.assertCfgStructure(data, CfgPrinter.toDot(cfg), true); }</code><technical_language>replace inlined function</technical_language>

Target:
public void if_then_test_predecessors() { verifyBlockCfg("" + "b0( succ = [b1, b2], pred = );" + "foo();" + "if (a) {" + " b1( succ = [b2], pred = [b0] );" + "}" + "b2( succ = [END], pred = [b0, b1] );"); }
Source:
<code>public void testCancelCommitWithProgressMonitor() throws Exception { CDOSession session = openSession(); CDONet4jSession.Options options = (Options)session.options(); options.setCommitTimeout(100000 * CommitTransactionRequest.DEFAULT_MONITOR_TIMEOUT_SECONDS); CDOTransaction transaction1 = session.openTransaction(); CDOResource resource1 = transaction1.createResource(getResourcePath(RESOURCE_PATH)); Company customer1 = initializeModel(resource1); resource1.getContents().add(customer1); ProgressMonitorAsserter progressMonitorAsserter = new ProgressMonitorAsserter(); try { <START> transaction1.commit(progressMonitorAsserter); <END> } catch (Exception ex) { Assert.assertTrue(ex instanceof OperationCanceledException); } }</code><technical_language>expecting in catch block commit, a fail method commit call, in order test failing if commit is canceled</technical_language>

Target:
public void testCancelCommitWithProgressMonitor() throws Exception { CDOSession session = openSession(); CDONet4jSession.Options options = (Options)session.options(); options.setCommitTimeout(100000 * CommitTransactionRequest.DEFAULT_MONITOR_TIMEOUT_SECONDS); CDOTransaction transaction1 = session.openTransaction(); CDOResource resource1 = transaction1.createResource(getResourcePath(RESOURCE_PATH)); Company customer1 = initializeModel(resource1); resource1.getContents().add(customer1); ProgressMonitorAsserter progressMonitorAsserter = new ProgressMonitorAsserter(); try { transaction1.commit(progressMonitorAsserter); fail("An OperationCanceledException should be thrown as the commit has been canceled"); } catch (Exception ex) { Assert.assertTrue(ex instanceof OperationCanceledException); } }
Source:
<code>public void clear( final ChangeSummary summary ) throws IndyDataException { <START> stores.getCache().clear(); END> }</code><technical_language>this change summary in future. (Will related Repo change log?)</technical_language>

Target:
public void clear( final ChangeSummary summary ) throws IndyDataException { stores.executeCache( c -> { c.clear(); return null; } ); }
Source:
<code><START> public ImmutableMap<ColumnName, Column> lifecycleColumns() { <END> return columns().lifecycleColumns(); }</code><technical_language>Maybe, this is final</technical_language>

Target:
public final ImmutableMap<ColumnName, Column> lifecycleColumns() { return columns().lifecycleColumns(); }
Source:
<code>public void copyOf() { Headers headers = new Headers(); headers.set("Content-Length", "5"); Headers headers2 = Headers.copyOf(headers); headers2.add("Via", "duct"); <START> Truth.assertThat(headers.getAll("Via")).isEmpty(); <END> }</code><technical_language>Consider adding assertions headers2 contents</technical_language>

Target:
public void copyOf() { Headers headers = new Headers(); headers.set("Content-Length", "5"); Headers headers2 = Headers.copyOf(headers); headers2.add("Via", "duct"); Truth.assertThat(headers.getAll("Via")).isEmpty(); Truth.assertThat(headers2.size()).isEqualTo(2); Truth.assertThat(headers2.getAll("Content-Length")).containsExactly("5"); }
Source:
<code>public Href path(final Object suffix) { return new Href( URI.create( new StringBuilder( <START> TRAILER.matcher(this.uri.toString()).replaceAll("") <END> ) .append('/') .append(Href.encode(suffix.toString())).toString() ), this.params ); }</code><technical_language>@Happy-Neko access this field in a static way</technical_language>

Target:
public Href path(final Object suffix) { return new Href( URI.create( new StringBuilder( Href.TRAILING_SLASH.matcher(this.uri.toString()) .replaceAll("") ) .append('/') .append(Href.encode(suffix.toString())).toString() ), this.params ); }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_privacy_policy); setupToolbar(); getSupportActionBar().setDisplayHomeAsUpEnabled(true); setTitle(getText(R.string.actionbar_privacy_policy)); final ProgressBar mProgressBar = (ProgressBar) findViewById(R.id.syncProgressBar); DisplayUtils.colorPreLollipopHorizontalProgressBar(mProgressBar); WebView webview = (WebView) findViewById(R.id.privacyPolicyWebview); webview.getSettings().setJavaScriptEnabled(true); webview.getSettings().setBuiltInZoomControls(true); webview.getSettings().setDisplayZoomControls(false); final Activity activity = this; webview.setWebChromeClient(new WebChromeClient() { public void onProgressChanged(WebView view, int progress) { mProgressBar.setProgress(progress); if(progress == 100) { mProgressBar.setVisibility(View.GONE); } } }); webview.setWebViewClient(new WebViewClient() { public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { <START> Toast.makeText(activity, "An error has occurred: " + description, Toast.LENGTH_SHORT).show(); <END> } }); String urlPrivacyPolicy = getResources().getString(R.string.url_privacy_policy); webview.loadUrl(urlPrivacyPolicy); }</code><technical_language>@davigonz a snackbar</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_privacy_policy); setupToolbar(); getSupportActionBar().setDisplayHomeAsUpEnabled(true); setTitle(getText(R.string.actionbar_privacy_policy)); final ProgressBar mProgressBar = (ProgressBar) findViewById(R.id.syncProgressBar); DisplayUtils.colorPreLollipopHorizontalProgressBar(mProgressBar); WebView webview = (WebView) findViewById(R.id.privacyPolicyWebview); webview.getSettings().setJavaScriptEnabled(true); webview.getSettings().setBuiltInZoomControls(true); webview.getSettings().setDisplayZoomControls(false); webview.setWebChromeClient(new WebChromeClient() { public void onProgressChanged(WebView view, int progress) { mProgressBar.setProgress(progress); if(progress == 100) { mProgressBar.setVisibility(View.GONE); } } }); webview.setWebViewClient(new WebViewClient() { public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { Snackbar snackbar = Snackbar.make( findViewById(android.R.id.content), getString(R.string.privacy_policy_error) + description, Snackbar.LENGTH_LONG ); snackbar.show(); } }); String urlPrivacyPolicy = getResources().getString(R.string.url_privacy_policy); webview.loadUrl(urlPrivacyPolicy); }
Source:
<code>public Container create(boolean loadSingletons) { ensureNotCreated(); created = true; <START> final ContainerImpl container = new ContainerImpl(factories); <END> if (loadSingletons) { container.callInContext(new ContainerImpl.ContextualCallable<Void>() { public Void call(InternalContext context) { for (InternalFactory<?> factory : singletonFactories) { factory.create(context); } return null; } }); } container.callInContext(new ContainerImpl.ContextualCallable<Void>() { public Void call(InternalContext context) { for (InternalFactory<?> factory : earlyInitializableFactories) { factory.create(context); } return null; } }); container.injectStatics(staticInjections); return container; }</code><technical_language>if problem originally new HashMap<>(factories) (new copy of current factories). I more safe this unchanged</technical_language>

Target:
public Container create(boolean loadSingletons) { ensureNotCreated(); created = true; final ContainerImpl container = new ContainerImpl(new HashMap<>(factories)); if (loadSingletons) { container.callInContext(new ContainerImpl.ContextualCallable<Void>() { public Void call(InternalContext context) { for (InternalFactory<?> factory : singletonFactories) { factory.create(context); } return null; } }); } container.callInContext(new ContainerImpl.ContextualCallable<Void>() { public Void call(InternalContext context) { for (InternalFactory<?> factory : earlyInitializableFactories) { factory.create(context); } return null; } }); container.injectStatics(staticInjections); return container; }
Source:
<code>private LeipzigTestSampleStream(int sentencePerDocument, Tokenizer tokenizer, InputStreamFactory in) throws IOException { super(new PlainTextByLineStream(in, StandardCharsets.UTF_8)); this.sentencePerDocument = sentencePerDocument; this.tokenizer = tokenizer; <START> System.setOut(new PrintStream(System.out, true, "UTF-8")); <END> }</code><technical_language>Remove this line, need set this here</technical_language>

Target:
private LeipzigTestSampleStream(int sentencePerDocument, Tokenizer tokenizer, InputStreamFactory in) throws IOException { super(new PlainTextByLineStream(in, StandardCharsets.UTF_8)); this.sentencePerDocument = sentencePerDocument; this.tokenizer = tokenizer; }