auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public String toString() { StringBuilder builder = new StringBuilder(); builder.append("[TimeLineEvent Values=").append(getValues()) .append(", Entry=").append(getEntry()) .append(", fTime=").append(getTime()) <START> .append(", Duration=").append(getDuration()) END> .append(']'); return builder.toString(); }</code><technical_language>format of names is inconsistent, remove duration</technical_language>

Target:
public String toString() { return new StringBuilder().append("[TimeLineEvent Values=").append(getValues()) .append(", Entry=").append(getEntry()) .append(", fTime=").append(getTime()) .append(", Duration=").append(getDuration()) .append(']').toString(); }
Source:
<code>public int compareTo(@Nullable ITmfStateValue object) { <START> if (!(object instanceof DoubleStateValue)) { <END> return -1; } DoubleStateValue other = (DoubleStateValue) object; return Double.compare(this.value, other.value); }</code><technical_language>Alexandre pointed out, a good check comparison similar types, a long int</technical_language>

Target:
public int compareTo(@Nullable ITmfStateValue object) { if (object == null) { return 1; } int result = 0; switch (object.getType()) { case INTEGER: double otherDoubleValue = ((IntegerStateValue) object).unboxInt(); result = Double.compare(this.value, otherDoubleValue); break; case DOUBLE: otherDoubleValue = ((DoubleStateValue) object).unboxDouble(); result = Double.compare(this.value, otherDoubleValue); break; case LONG: otherDoubleValue = ((LongStateValue) object).unboxLong(); result = Double.compare(this.value, otherDoubleValue); break; case NULL: result = 1; break; case STRING: result = -1; break; default: break; } return result; }
Source:
<code>static List<Integer> getIntervalStartPositions(final int[] scanPayload) { final List<Integer> intervalStarts = new ArrayList<Integer>(); intervalStarts.add( 0 ); boolean foundFF = false; boolean foundD0toD7 = false; int pos = 0; while ( pos < scanPayload.length ) { if ( foundFF == true ) { if ( scanPayload[ pos ] >= ( 0xff & JpegConstants.RST0_MARKER ) && scanPayload[ pos ] <= ( 0xff & JpegConstants.RST7_MARKER ) ) { foundD0toD7 = true; } else { foundFF = false; } } if ( scanPayload[ pos ] == 0xFF ) { foundFF = true; } <START> if ( foundFF == true && foundD0toD7 == true ) { <END> intervalStarts.add( pos + 1 ); foundFF = foundD0toD7 = false; } pos++; } return intervalStarts; }</code><technical_language>if (foundFF && foundD0toD7)</technical_language>

Target:
static List<Integer> getIntervalStartPositions(final int[] scanPayload) { final List<Integer> intervalStarts = new ArrayList<Integer>(); intervalStarts.add(0); boolean foundFF = false; boolean foundD0toD7 = false; int pos = 0; while (pos < scanPayload.length) { if (foundFF) { if (scanPayload[pos] >= (0xff & JpegConstants.RST0_MARKER) && scanPayload[pos] <= (0xff & JpegConstants.RST7_MARKER)) { foundD0toD7 = true; } else { foundFF = false; } } if (scanPayload[pos] == 0xFF) { foundFF = true; } if (foundFF && foundD0toD7) { intervalStarts.add(pos + 1); foundFF = foundD0toD7 = false; } pos++; } return intervalStarts; }
Source:
<code>private void init() { <START> if (!ServerType.MONITORING.equals(ServerType.getServerType())) { <END> runWithLock(() -> { migrateDatasets(); migratePerspectives(); migrateNavigation(); }); } }</code><technical_language>improve check if this is monitoring cloud/k8s</technical_language>

Target:
protected void init() { if (this.isMigrationEnabled()) { runWithLock(() -> { migrateDatasets(); migratePerspectives(); migrateNavigation(); }); } }
Source:
<code>public Integer getNumberOfDays(Interval interval) { Interval overlap = getInterval().overlap(interval); <START> return overlap == null ? 0 : Days.daysBetween(overlap.getStart(), overlap.getEnd()).getDays(); <END> }</code><technical_language>DateTimes work... of daylight savings time: <LINK_0> a toLocaleDate solve this issue</technical_language>

Target:
public Integer getNumberOfDays(Interval interval) { Interval overlap = getInterval().overlap(interval); return overlap == null ? 0 : Days.daysBetween(overlap.getStart().toLocalDate(), overlap.getEnd().toLocalDate()).getDays(); }
Source:
<code>public Optional<StatisticType> getById(String id) { <START> return Optional.ofNullable(this.universalStatisticMappings.get(id.toLowerCase())); <END> }</code><technical_language>This lowercase</technical_language>

Target:
public Optional<StatisticType> getById(String id) { return Optional.ofNullable(this.statisticTypeMappings.get(id.toLowerCase(Locale.ENGLISH))); }
Source:
<code>private void setNew(Change c, ChangeMessage msg) { for (int attempts = 0; attempts < 10; attempts++) { c.setStatus(Change.Status.NEW); ChangeUtil.updated(c); try { final Transaction txn = schema.beginTransaction(); schema.changes().update(Collections.singleton(c), txn); if (msg != null) { schema.changeMessages().insert(Collections.singleton(msg), txn); } txn.commit(); break; } catch (OrmException e) { try { c = schema.changes().get(c.getId()); if (c.getStatus().isClosed()) { break; } } catch (OrmException e2) { } } } try { final ChangeMail cm = new ChangeMail(server, c); cm.setFrom(getSubmitter(c)); cm.setReviewDb(schema); cm.setPatchSet(schema.patchSets().get(c.currentPatchSetId()), schema .patchSetInfo().get(c.currentPatchSetId())); if (msg.getMessage().indexOf("path conflict") == -1) { cm.sendMergeFailed(null); } else { cm.sendMergeFailed("path conflict"); } } catch (OrmException e) { <START> log.error("Cannot send email for submitted patch set " + c.getId(), e); <END> } catch (MessagingException e) { log.error("Cannot send email for submitted patch set " + c.getId(), e); } }</code><technical_language>This log message is wrong; a patch conflict error</technical_language>

Target:
private void setNew(Change c, ChangeMessage msg) { for (int attempts = 0; attempts < 10; attempts++) { c.setStatus(Change.Status.NEW); ChangeUtil.updated(c); try { final Transaction txn = schema.beginTransaction(); schema.changes().update(Collections.singleton(c), txn); if (msg != null) { schema.changeMessages().insert(Collections.singleton(msg), txn); } txn.commit(); break; } catch (OrmException e) { try { c = schema.changes().get(c.getId()); if (c.getStatus().isClosed()) { break; } } catch (OrmException e2) { } } } try { final ChangeMail cm = new ChangeMail(server, c); cm.setFrom(getSubmitter(c)); cm.setReviewDb(schema); cm.setPatchSet(schema.patchSets().get(c.currentPatchSetId()), schema .patchSetInfo().get(c.currentPatchSetId())); cm.setChangeMessage(msg); cm.sendMergeFailed(); } catch (OrmException e) { log.error("Cannot submit patch set for Change " + c.getId() + " due to a path conflict.", e); } catch (MessagingException e) { log.error("Cannot submit patch set for Change " + c.getId() + " due to a path conflict.", e); } }
Source:
<code>private boolean waitManagedProfileProvisioning() throws InterruptedException { BlockingBroadcastReceiver managedProfileProvisionedReceiver = new BlockingBroadcastReceiver(mContext, ACTION_MANAGED_PROFILE_PROVISIONED); BlockingBroadcastReceiver managedProfileAddedReceiver = new BlockingBroadcastReceiver(mContext, ACTION_MANAGED_PROFILE_ADDED); try { managedProfileProvisionedReceiver.register(); managedProfileAddedReceiver.register(); if (!pollProvisioningResult()) { return false; } mReceivedProfileProvisionedIntent = <START> managedProfileProvisionedReceiver.awaitForBroadcast(TIMEOUT_SECONDS * 1000); <END> if (mReceivedProfileProvisionedIntent == null) { Log.i(TAG, "managedProfileProvisionedReceiver.awaitForBroadcast(): failed"); return false; } if (managedProfileAddedReceiver.awaitForBroadcast(TIMEOUT_SECONDS * 1000) == null) { Log.i(TAG, "managedProfileAddedReceiver.awaitForBroadcast(): failed"); return false; } } finally { managedProfileProvisionedReceiver.unregisterQuietly(); managedProfileAddedReceiver.unregisterQuietly(); } return true; }</code><technical_language>in other places, TimeUnit.SECONDS.toMillis(TIMEOUT_SECONDS)</technical_language>

Target:
private boolean waitManagedProfileProvisioning() throws InterruptedException { BlockingBroadcastReceiver managedProfileProvisionedReceiver = new BlockingBroadcastReceiver(mContext, ACTION_MANAGED_PROFILE_PROVISIONED); BlockingBroadcastReceiver managedProfileAddedReceiver = new BlockingBroadcastReceiver(mContext, ACTION_MANAGED_PROFILE_ADDED); try { managedProfileProvisionedReceiver.register(); managedProfileAddedReceiver.register(); if (!pollProvisioningResult()) { return false; } mReceivedProfileProvisionedIntent = managedProfileProvisionedReceiver.awaitForBroadcast( TimeUnit.SECONDS.toMillis(TIMEOUT_SECONDS)); if (mReceivedProfileProvisionedIntent == null) { Log.i(TAG, "managedProfileProvisionedReceiver.awaitForBroadcast(): failed"); return false; } if (managedProfileAddedReceiver.awaitForBroadcast( TimeUnit.SECONDS.toMillis(TIMEOUT_SECONDS)) == null) { Log.i(TAG, "managedProfileAddedReceiver.awaitForBroadcast(): failed"); return false; } } finally { managedProfileProvisionedReceiver.unregisterQuietly(); managedProfileAddedReceiver.unregisterQuietly(); } return true; }
Source:
<code>public void setUp() { if (isNullOrEmpty(POSTGRESQL)) { throw new IllegalStateException("Environment variable `DIGDAG_TEST_POSTGRESQL` isn't set"); <START> } <END> props = new Properties(); try (StringReader reader = new StringReader(POSTGRESQL)) { props.load(reader); } catch (IOException ex) { throw Throwables.propagate(ex); } database = "pgoptest_" + UUID.randomUUID().toString().replace('-', '_'); createTempDatabase(props, database); setupRestrictedUser(props, database); setupSourceTable(props, database); }</code><technical_language>assumeThat(POSTGRESQL, not(isEmptyOrNullString())) this test class is skipped if DIGDAG_TEST_POSTGRESQL is set (see S3StorageIT.java for usage). DIGDAG_TEST_POSTGRESQL is set want test H2 database adapter</technical_language>

Target:
public void setUp() { assumeThat(POSTGRESQL, not(isEmptyOrNullString())); props = new Properties(); try (StringReader reader = new StringReader(POSTGRESQL)) { props.load(reader); } catch (IOException ex) { throw Throwables.propagate(ex); } database = "pgoptest_" + UUID.randomUUID().toString().replace('-', '_'); createTempDatabase(props, database); setupRestrictedUser(props, database); setupSourceTable(props, database); }
Source:
<code>private static String toString(ToStringStyle style) { ToStringTreeBuilder builder = new ToStringTreeBuilder( style ); return builder.attribute( "foo", "value" ) .startObject( "children" ) .attribute( "childrenFoo", 23 ) .startObject( "child1" ) .attribute( "child1Foo", new Object() { @Override public String toString() { return "customToString"; } } ) .startList() .value( "foo" ) .value( 42 ) .endList() .endObject() .startObject( "emptyChild" ) .endObject() .attribute( "appendable", new Appendable() ) .attribute("appendableAsObject", new Appendable()) <START> .attribute("nullAppendable", null) <END> .startList( "list" ) .startObject() .attribute( "name", "foo" ) .endObject() .startObject( "object" ) .attribute( "name", "foo" ) .attribute( "attr", "bar" ) .endObject() .startObject() .startList( "nestedList" ) .value( "first" ) .value( "second" ) .endList() .attribute( "name", "bar" ) .endObject() .endList() .endObject() .attribute( "bar", "value" ) .toString(); }</code><technical_language>Code style: a space opening parenthesis a closing parenthesis</technical_language>

Target:
private static String toString(ToStringStyle style) { ToStringTreeBuilder builder = new ToStringTreeBuilder( style ); return builder.attribute( "foo", "value" ) .startObject( "children" ) .attribute( "childrenFoo", 23 ) .startObject( "child1" ) .attribute( "child1Foo", new Object() { @Override public String toString() { return "customToString"; } } ) .startList() .value( "foo" ) .value( 42 ) .endList() .endObject() .startObject( "emptyChild" ) .endObject() .attribute( "appendable", new Appendable() ) .attribute( "appendableAsObject" , (Object) new Appendable() ) .attribute( "nullAppendable" , null) .startList( "list" ) .startObject() .attribute( "name", "foo" ) .endObject() .startObject( "object" ) .attribute( "name", "foo" ) .attribute( "attr", "bar" ) .endObject() .startObject() .startList( "nestedList" ) .value( "first" ) .value( "second" ) .endList() .attribute( "name", "bar" ) .endObject() .endList() .endObject() .attribute( "bar", "value" ) .toString(); }
Source:
<code>void generateParameterValueSet(ActivationClassBuilder acb) throws StandardException { Vector parameterList = getCompilerContext().getParameterList(); int numberOfParameters = (parameterList == null) ? 0 : parameterList.size(); <START> if (numberOfParameters < 0) <END> return; ParameterNode.generateParameterValueSet (acb, numberOfParameters, parameterList); }</code><technical_language>Why? this happen</technical_language>

Target:
void generateParameterValueSet(ActivationClassBuilder acb) throws StandardException { Vector parameterList = getCompilerContext().getParameterList(); int numberOfParameters = (parameterList == null) ? 0 : parameterList.size(); ParameterNode.generateParameterValueSet (acb, numberOfParameters, parameterList); }
Source:
<code>public RMState getState() throws NotConnectedException { <START> return rm.getState(sessionId); <END> }</code><technical_language>connect() succeed called, kind of exception is thrown</technical_language>

Target:
public RMState getState() throws NotConnectedException { checkNonEmptySession(); return rm.getState(sessionId); }
Source:
<code>protected void registerFactorFilter(FactorFilter<T,V> filter){ if (null == filter ) { <START> logger.info("skipping registerFactorFilter as the comaractor is null or has an invalid weight value."); <END> return; } this.factorFilterList.put(filter.getFactorName(),filter); logger.info(String.format("Factor filter added for '%s'.", filter.getFactorName())); }</code><technical_language>I is throw exception</technical_language>

Target:
protected void registerFactorFilter(FactorFilter<T,V> filter){ if (null == filter ) { throw new IllegalArgumentException("unable to register factor filter. " + "The passed comaractor is null or has an invalid weight value."); } this.factorFilterList.put(filter.getFactorName(),filter); logger.info(String.format("Factor filter added for '%s'.", filter.getFactorName())); }
Source:
<code>protected void execute() { final boolean pass = buildResult.isBetterOrEqualTo(hudson.model.Result.SUCCESS); info(String.format("Sending diffusion result as: %s", buildResult.toString())); try { harbormaster.sendHarbormasterUri(phid, buildUrl); <START> harbormaster.sendHarbormasterMessage(phid, pass ? MessageType.pass : MessageType.fail, null, null, null); <END> result = Result.SUCCESS; return; } catch (ConduitAPIException e) { e.printStackTrace(logger.getStream()); } catch (IOException e) { e.printStackTrace(logger.getStream()); } result = Result.FAILURE; }</code><technical_language>non-differential builds respect sending "work" updates</technical_language>

Target:
protected void execute() { MessageType messageType; if (this.sendPartialResults) { messageType = MessageType.work; } else if (buildResult.isBetterOrEqualTo(hudson.model.Result.SUCCESS)) { messageType = MessageType.pass; } else { messageType = MessageType.fail; } info(String.format("Sending diffusion result as: %s, message type: %s", buildResult.toString(), messageType.name())); try { harbormaster.sendHarbormasterUri(phid, buildUrl); harbormaster.sendHarbormasterMessage(phid, messageType, null, null, null); result = Result.SUCCESS; return; } catch (ConduitAPIException e) { e.printStackTrace(logger.getStream()); } catch (IOException e) { e.printStackTrace(logger.getStream()); } result = Result.FAILURE; }
Source:
<code>public void runApplication() throws Exception { Configuration conf = new Configuration(false); LocalMode lma = LocalMode.newInstance(); DAG dag = lma.getDAG(); super.populateDAG(dag, conf); StreamingApplication app = new StreamingApplication() { @Override public void populateDAG(DAG dag, Configuration conf) { } }; lma.prepareDAG(app, conf); tupleCount = 0; final LocalMode.Controller lc = lma.getController(); lc.runAsync(); <START> while (tupleCount < tupleSize) { <END> try { Thread.sleep(500); } catch (Exception e) { } } lc.shutdown(); Assert.assertTrue("setupTimes: " + setupTimes, setupTimes == 2); }</code><technical_language>timeout</technical_language>

Target:
public void runApplication() throws Exception { Configuration conf = new Configuration(false); LocalMode lma = LocalMode.newInstance(); DAG dag = lma.getDAG(); super.populateDAG(dag, conf); StreamingApplication app = new StreamingApplication() { @Override public void populateDAG(DAG dag, Configuration conf) { } }; lma.prepareDAG(app, conf); tupleCount = 0; final LocalMode.Controller lc = lma.getController(); lc.runAsync(); long endTime = System.currentTimeMillis() + atMostRunTime; while (tupleCount < tupleSize && System.currentTimeMillis() < endTime) { try { Thread.sleep(500); } catch (Exception e) { } } lc.shutdown(); Assert.assertTrue("Expect call setup() twice, Actually called " + setupTimes + " times", setupTimes == 2); }
Source:
<code>public void testWriteBehindMultipleClients() throws Exception { PersistentCacheManager cacheManager1 = createCacheManager(); PersistentCacheManager cacheManager2 = createCacheManager(); Cache<Long, String> client1 = cacheManager1.getCache(CACHE_NAME, Long.class, String.class); Cache<Long, String> client2 = cacheManager2.getCache(CACHE_NAME, Long.class, String.class); client1.put(KEY, "The one from client1"); <START> client2.put(KEY, "The one one from client2"); <END> assertValue(client1, "The one one from client2"); client1.remove(KEY); client2.put(KEY, "The one from client2"); client1.put(KEY, "The one one from client1"); assertValue(client2, "The one one from client1"); client2.remove(KEY); assertValue(client1, null); client1.put(KEY, "The one from client1"); client1.put(KEY, "The one one from client1"); client2.remove(KEY); client2.put(KEY, "The one from client2"); client2.put(KEY, "The one one from client2"); client1.remove(KEY); assertValue(client2, null); CLUSTER.getClusterControl().terminateActive(); CLUSTER.getClusterControl().waitForActive(); CLUSTER.getClusterControl().startOneServer(); assertValue(client1, null); assertValue(client2, null); checkValueFromLoaderWriter(client1, null); client1.clear(); }</code><technical_language>one</technical_language>

Target:
public void testWriteBehindMultipleClients() throws Exception { PersistentCacheManager cacheManager1 = createCacheManager(); PersistentCacheManager cacheManager2 = createCacheManager(); Cache<Long, String> client1 = cacheManager1.getCache(CACHE_NAME, Long.class, String.class); Cache<Long, String> client2 = cacheManager2.getCache(CACHE_NAME, Long.class, String.class); client1.put(KEY, "The one from client1"); client2.put(KEY, "The one from client2"); assertValue(client1, "The one from client2"); client1.remove(KEY); client2.put(KEY, "The one from client2"); client1.put(KEY, "The one from client1"); assertValue(client2, "The one from client1"); client2.remove(KEY); assertValue(client1, null); client1.put(KEY, "The one from client1"); client1.put(KEY, "The one one from client1"); assertValue(client2, "The one one from client1"); client2.remove(KEY); assertValue(client1, null); client2.put(KEY, "The one from client2"); client2.put(KEY, "The one one from client2"); assertValue(client1, "The one one from client2"); client1.remove(KEY); assertValue(client2, null); CLUSTER.getClusterControl().terminateActive(); CLUSTER.getClusterControl().waitForActive(); CLUSTER.getClusterControl().startOneServer(); Thread.sleep(1000); assertValue(client1, null); assertValue(client2, null); checkValueFromLoaderWriter(client1, null); client1.clear(); }
Source:
<code>public User getUser(String uniqueId, AbstractUserStoreManager userStoreManager) throws UserStoreException { String userName = userStoreManager.getFromUserNameCache(uniqueId); if (StringUtils.isEmpty(userName)) { String[] usernames = userStoreManager.getUserList(UserCoreClaimConstants.USER_ID_CLAIM_URI, uniqueId, null); if (usernames.length > 1) { throw new UserStoreException("More than one user presents with the same user unique id."); } if (usernames.length == 0) { return null; } userName = usernames[0]; UserStore userStore = userStoreManager.getUserStoreWithID(uniqueId); <START> String[] userNames = userName.split(CarbonConstants.DOMAIN_SEPARATOR); String domainFreeUserName; if (userNames.length > 1) { domainFreeUserName = userNames[1]; } else { domainFreeUserName = userName; } <END> userStoreManager.addToUserNameCache(uniqueId, domainFreeUserName, userStore); userStoreManager.addToUserIDCache(uniqueId, domainFreeUserName, userStore); } User user = new User(); user.setUserID(uniqueId); user.setUsername(UserCoreUtil.removeDomainFromName(userName)); user.setUserStoreDomain(UserCoreUtil.extractDomainFromName(userName)); return user; }</code><technical_language>I guess able UserCoreUtil.removeDomainFromName get domainFreeUserName</technical_language>

Target:
public User getUser(String uniqueId, AbstractUserStoreManager userStoreManager) throws UserStoreException { String userName = getFromUserNameCache(uniqueId); if (StringUtils.isEmpty(userName)) { String[] usernames = userStoreManager.getUserList(UserCoreClaimConstants.USER_ID_CLAIM_URI, uniqueId, null); if (usernames.length > 1) { throw new UserStoreException("More than one user presents with the same user unique id."); } if (usernames.length == 0) { return null; } userName = usernames[0]; addToUserNameCache(uniqueId, userName); addToUserIDCache(uniqueId, userName); } User user = new User(); user.setUserID(uniqueId); user.setUsername(UserCoreUtil.removeDomainFromName(userName)); user.setUserStoreDomain(UserCoreUtil.extractDomainFromName(userName)); return user; }
Source:
<code>protected String doTaskBackground(Void... params) { final Uri SMS_INBOX = Uri.parse("content://sms/inbox"); <START> DateTime oneDayAgo = (new DateTime()).minusDays(7); <END> Cursor cursor = contentResolver.query(SMS_INBOX, null, "date >? ", new String[]{"" + oneDayAgo.getMillis()}, "date DESC"); int messageIterationCount = 0; if (cursor != null) { try { while (cursor.moveToNext() && messageIterationCount <= SMS_CHECK_COUNT) { messageIterationCount++; String textMessageBody = cursor.getString(cursor.getColumnIndex("body")); if (textMessageBody.contains(GlobalConstants.SMS_INSTALL_KEY_STRING)) { return processSMS(textMessageBody); } } } finally { cursor.close(); } } return null; }</code><technical_language>rename this variable</technical_language>

Target:
protected String doTaskBackground(Void... params) { final Uri SMS_INBOX = Uri.parse("content://sms/inbox"); DateTime oneWeekAgo = (new DateTime()).minusDays(7); Cursor cursor = contentResolver.query(SMS_INBOX, null, "date >? ", new String[]{"" + oneWeekAgo.getMillis()}, "date DESC"); int messageIterationCount = 0; if (cursor != null) { try { while (cursor.moveToNext() && messageIterationCount <= SMS_CHECK_COUNT) { messageIterationCount++; String textMessageBody = cursor.getString(cursor.getColumnIndex("body")); if (textMessageBody.contains(GlobalConstants.SMS_INSTALL_KEY_STRING)) { return processSMS(textMessageBody); } } } finally { cursor.close(); } } return null; }
Source:
<code>private List<Entity> validateExtensionAndGetEntities(String extensionName, String jobName, InputStream configStream) { JSONObject extensionDetailJson; if (StringUtils.isNotBlank(extensionName)) { extensionDetailJson = getExtensionDetailJson(extensionName); } else { <START> extensionDetailJson = getExtensionJobDetailJson(jobName); <END> } String extensionType = ExtensionHandler.getExtensionType(extensionName, extensionDetailJson); String extensionBuildLocation = ExtensionHandler.getExtensionLocation(extensionName, extensionDetailJson); return getEntities(extensionName, jobName, configStream, extensionType, extensionBuildLocation); }</code><technical_language>prefer this cleaner making a call getExtensionJobDetails another getExtensionDetail</technical_language>

Target:
private List<Entity> validateExtensionAndGetEntities(String extensionName, String jobName, InputStream configStream) { JSONObject extensionDetailJson; if (StringUtils.isBlank(extensionName)) { extensionName = ExtensionHandler.getExtensionName(jobName, getExtensionJobDetailJson(jobName)); } extensionDetailJson = getExtensionDetailJson(extensionName); String extensionType = ExtensionHandler.getExtensionType(extensionName, extensionDetailJson); String extensionBuildLocation = ExtensionHandler.getExtensionLocation(extensionName, extensionDetailJson); return getEntities(extensionName, jobName, configStream, extensionType, extensionBuildLocation); }
Source:
<code>private Text createFilterTextArea(Composite parent, Composite container, Composite labels) { Text filterText = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_CANCEL | SWT.ICON_SEARCH); GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false); gridData.widthHint = FIND_X_WIDTH_HINT; filterText.setLayoutData(gridData); if (fRegex != null) { filterText.setText(fRegex); } Color background = filterText.getBackground(); filterText.addModifyListener(e -> { fRegex = filterText.getText(); filterText.setBackground(background); fView.restartZoomThread(); <START> while(fView.isDirty()) <END> }); filterText.addKeyListener(new KeyListener() { @Override public void keyReleased(KeyEvent e) { } @Override public void keyPressed(KeyEvent e) { if (e.character == SWT.CR) { handleEnterPressed(parent, labels, filterText); fView.restartZoomThread(); } } }); return filterText; }</code><technical_language>sure</technical_language>

Target:
private Text createFilterTextArea(Composite parent, Composite container, Composite labels) { Text filterText = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_CANCEL | SWT.ICON_SEARCH); GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false); gridData.widthHint = FIND_X_WIDTH_HINT; filterText.setLayoutData(gridData); if (fRegex != null) { filterText.setText(fRegex); } Color background = filterText.getBackground(); filterText.addModifyListener(e -> { fRegex = filterText.getText(); filterText.setBackground(background); fView.restartZoomThread(); }); filterText.addKeyListener(new KeyListener() { @Override public void keyReleased(KeyEvent e) { } @Override public void keyPressed(KeyEvent e) { if (e.character == SWT.CR) { handleEnterPressed(parent, labels, filterText); fView.restartZoomThread(); } } }); return filterText; }
Source:
<code>public MeshPartBuilder begin () { if (building) throw new GdxRuntimeException("Call end() after calling begin()"); building = true; builder.begin(mesh.getVertexAttributes(), GL20.GL_LINES); <START> return builder; <END> }</code><technical_language>change this in builder.begin(attributes); builder.part(id, primitive, renderable.meshPart);. This MeshBuilder update mesh part, remove code in end() method, including need call update()</technical_language>

Target:
public MeshPartBuilder begin () { return begin(GL20.GL_LINES); }
Source:
<code>static public void assertEquals(String message, double expected, double actual, double delta) { if (Double.compare(expected, actual) == 0) { return; } if (!(Math.abs(expected - actual) <= delta)) { <START> failNotEquals(message, Double.valueOf(expected), Double.valueOf(actual)); <END> } }</code><technical_language>This optimization; Double.valueOf(double d) calls 'new Double(d)' remove this change. this class is deprecated, I want minimize changes possible</technical_language>

Target:
static public void assertEquals(String message, double expected, double actual, double delta) { if (Double.compare(expected, actual) == 0) { return; } if (!(Math.abs(expected - actual) <= delta)) { failNotEquals(message, new Double(expected), new Double(actual)); } }
Source:
<code>public void actionPerformed(ActionEvent event) { eventLogger.log(this); if (appContext.getCurrentProject() == null || appContext.getCurrentProject().getRootProject() == null) { Log.error(getClass(), "Can not run find/replace without opened project\n"); return; } if (event.getParameters() == null) { Log.error(getClass(), "Can not run find/replace without parameters"); return; } final Map<String, String> parameters = event.getParameters(); String file = parameters.get("in"); String find = parameters.get("find"); String replace = parameters.get("replace"); String mode = parameters.get("replaceMode"); final ReplacementSet replacementSet = dtoFactory.createDto(ReplacementSet.class).withFiles(Arrays.asList(file)) .withEntries(Arrays.asList(dtoFactory.createDto(Variable.class) .withFind(find) .withReplace(replace) .withReplacemode(mode))); <START> vfsServiceClient.replaceInCurrentWorkspace(appContext.getWorkspaceId(), <END> appContext.getCurrentProject().getRootProject().getPath(), Arrays.asList(replacementSet), new AsyncRequestCallback<Void>() { @Override protected void onSuccess(Void result) { } @Override protected void onFailure(Throwable exception) { } }); }</code><technical_language>replace in current workspace workspace id. strange</technical_language>

Target:
public void actionPerformed(ActionEvent event) { eventLogger.log(this); if (appContext.getCurrentProject() == null || appContext.getCurrentProject().getRootProject() == null) { Log.error(getClass(), "Can not run find/replace without opened project\n"); return; } if (event.getParameters() == null) { Log.error(getClass(), "Can not run find/replace without parameters"); return; } final Map<String, String> parameters = event.getParameters(); String file = parameters.get("in"); String find = parameters.get("find"); String replace = parameters.get("replace"); String mode = parameters.get("replaceMode"); final ReplacementSet replacementSet = dtoFactory.createDto(ReplacementSet.class).withFiles(Arrays.asList(file)) .withEntries(Arrays.asList(dtoFactory.createDto(Variable.class) .withFind(find) .withReplace(replace) .withReplacemode(mode))); vfsServiceClient.replace(appContext.getWorkspaceId(), appContext.getCurrentProject().getRootProject().getPath(), Arrays.asList(replacementSet), new AsyncRequestCallback<Void>() { @Override protected void onSuccess(Void result) { } @Override protected void onFailure(Throwable exception) { } }); }
Source:
<code>public NullOperationLogger() { <START> } <END></code><technical_language>This public</technical_language>

Target:
private NullOperationLogger() { }
Source:
<code>private List<VdsNetworkInterface> nicsToInterfaces(List<HostNIC> hostNics) { List<VdsNetworkInterface> ifaces = new ArrayList<VdsNetworkInterface>(hostNics.size()); for (HostNIC nic : hostNics) { VdsNetworkInterface iface = map(nic, null); ifaces.add(iface); if (nic.isSetBonding() && nic.getBonding().isSetSlaves()) { for (HostNIC slave : nic.getBonding().getSlaves().getSlaves()) { <START> VdsNetworkInterface slaveIface = map(lookupNic(slave.getId()), null); <END> slaveIface.setBondName(nic.getName()); ifaces.add(slaveIface); } } } return ifaces; }</code><technical_language>this, override data provided user in bond.slave, missing info added in BE</technical_language>

Target:
private List<VdsNetworkInterface> nicsToInterfaces(List<HostNIC> hostNics) { List<VdsNetworkInterface> ifaces = new ArrayList<VdsNetworkInterface>(hostNics.size()); for (HostNIC nic : hostNics) { VdsNetworkInterface iface = map(nic, null); ifaces.add(iface); if (nic.isSetBonding() && nic.getBonding().isSetSlaves()) { for (HostNIC slave : nic.getBonding().getSlaves().getSlaves()) { VdsNetworkInterface slaveIface = map(slave, lookupInterface(slave.getId())); slaveIface.setBondName(nic.getName()); ifaces.add(slaveIface); } } } return ifaces; }
Source:
<code>public ListenableFuture<SegmentsAndMetadata> publish( final TransactionalSegmentPublisher publisher, final Committer committer, final Collection<String> sequenceNames ) { final List<SegmentIdentifier> theSegments = new ArrayList<>(); synchronized (segments) { sequenceNames.stream() .filter(sequenceName -> !publishingSequences.contains(sequenceName)) .forEach(sequenceName -> { if (segments.containsKey(sequenceName)) { segments.get(sequenceName) .values() .stream() .flatMap(Collection::stream) .forEach(segmentWithState -> { segmentWithState.state = SegmentState.PUBLISHING; theSegments.add(segmentWithState.getSegmentIdentifier()); }); } <START> }); <END> } final ListenableFuture<SegmentsAndMetadata> publishFuture = publish( publisher, wrapCommitter(committer), theSegments ); Futures.addCallback( publishFuture, new FutureCallback<SegmentsAndMetadata>() { @Override public void onSuccess(SegmentsAndMetadata result) { if (result != null) { publishingSequences.removeAll(sequenceNames); sequenceNames.forEach(segments::remove); } } @Override public void onFailure(Throwable t) { log.error("Error publishing sequences [%s]", sequenceNames); } } ); return publishFuture; }</code><technical_language>publishingSequences written this is true</technical_language>

Target:
public ListenableFuture<SegmentsAndMetadata> publish( final TransactionalSegmentPublisher publisher, final Committer committer, final Collection<String> sequenceNames ) { final List<SegmentIdentifier> theSegments = new ArrayList<>(); synchronized (segments) { sequenceNames.stream() .filter(sequenceName -> !publishingSequences.contains(sequenceName)) .forEach(sequenceName -> { if (segments.containsKey(sequenceName)) { publishingSequences.add(sequenceName); segments.get(sequenceName) .values() .stream() .flatMap(Collection::stream) .forEach(segmentWithState -> { segmentWithState.state = SegmentState.PUBLISHING; theSegments.add(segmentWithState.getSegmentIdentifier()); }); } }); } final ListenableFuture<SegmentsAndMetadata> publishFuture = publish( publisher, wrapCommitter(committer), theSegments ); Futures.addCallback( publishFuture, new FutureCallback<SegmentsAndMetadata>() { @Override public void onSuccess(SegmentsAndMetadata result) { if (result != null) { publishingSequences.removeAll(sequenceNames); sequenceNames.forEach(segments::remove); } } @Override public void onFailure(Throwable t) { log.error("Error publishing sequences [%s]", sequenceNames); } } ); return publishFuture; }
Source:
<code><START> public PartitionedFile getResultFile() { <END> return resultFile; }</code><technical_language>This method publicly exposes a field is lock-guarded. good avoid that, in production scope. do following: - pass this constructor of SortMergeSubpartitionReader - reduce visibility package-private annotate @VisibleForTesting</technical_language>

Target:
PartitionedFile getResultFile() { return resultFile; }
Source:
<code>public boolean isNoexcept(boolean inCalledContext) { <START> return fPositive.isNoexcept(inCalledContext) && fNegative.isNoexcept(inCalledContext); <END> }</code><technical_language>condition expression throw well</technical_language>

Target:
public boolean isNoexcept(boolean inCalledContext) { return fCondition.isNoexcept(inCalledContext) && fPositive.isNoexcept(inCalledContext) && fNegative.isNoexcept(inCalledContext); }
Source:
<code>public Response getByURI(@HeaderParam("Accept-Language") @ApiParam(value = "Accept-Language") String language, @PathParam("uri") @ApiParam(value = "uri") String uri) { Locale locale = LocaleUtil.getLocale(language); try { ConfigDescription configDescription = this.configDescriptionRegistry.getConfigDescription(new URI(uri), locale); <START> return configDescription != null ? Response.ok(configDescription).build() : Response.status(404).build(); <END> } catch (URISyntaxException e) { return Response.status(400).build(); } }</code><technical_language>Is conversion ConfigDescription ConfigDescriptionDTO done implicitly</technical_language>

Target:
public Response getByURI(@HeaderParam("Accept-Language") @ApiParam(value = "Accept-Language") String language, @PathParam("uri") @ApiParam(value = "uri") String uri) { Locale locale = LocaleUtil.getLocale(language); try { ConfigDescription configDescription = this.configDescriptionRegistry.getConfigDescription(new URI(uri), locale); return configDescription != null ? Response.ok(ConfigDescriptionDTOMapper.map(configDescription)).build() : Response.status(404).build(); } catch (URISyntaxException e) { return Response.status(400).build(); } }
Source:
<code>private void postFailureEvent(String extensionId, String msg) { <START> if (eventPublisher != null) { <END> Event event = ExtensionEventFactory.createExtensionFailureEvent(extensionId, msg); eventPublisher.post(event); } }</code><technical_language>I assume this function called if service is activated. EventPublisher is a mandatory reference, need check for nullness</technical_language>

Target:
private void postFailureEvent(String extensionId, String msg) { Event event = ExtensionEventFactory.createExtensionFailureEvent(extensionId, msg); eventPublisher.post(event); }
Source:
<code>private Future<Integer> recycleIps(final UUID devId, List<String> ips) { ArrayList<Future<Integer>> fs = new ArrayList<>(ips.size()); for (String ip : ips) { final IPv4Addr ipv4 = IPv4Addr.apply(ip); final String ipPath = paths.getNatIpPath(devId, ipv4); final Promise<Integer> p = Promise$.MODULE$.apply(); fs.add(p.future()); zk.getData(ipPath, false, new AsyncCallback.DataCallback() { @Override public void processResult(int rc, String path, Object ctx, byte[] data, Stat stat) { ArrayList<Op> deleteOps = new ArrayList<>(NatBlock.TOTAL_BLOCKS + 1); if (rc == KeeperException.Code.OK.intValue()) { deleteOps.add(Op.delete(path, stat.getVersion())); tryRecycleBlocks(devId, ipv4, 0, deleteOps, p); <START> } else { <END> p.success(0); } } }, null); } return sum(fs); }</code><technical_language>failing silently</technical_language>

Target:
private Future<Integer> recycleIps(final UUID devId, List<String> ips) { ArrayList<Future<Integer>> fs = new ArrayList<>(ips.size()); for (String ip : ips) { final IPv4Addr ipv4 = IPv4Addr.apply(ip); final String ipPath = paths.getNatIpPath(devId, ipv4); final Promise<Integer> p = Promise$.MODULE$.apply(); fs.add(p.future()); zk.getData(ipPath, false, new AsyncCallback.DataCallback() { @Override public void processResult(int rc, String path, Object ctx, byte[] data, Stat stat) { Op[] deleteOps = new Op[NatBlock.TOTAL_BLOCKS + 1]; if (rc == KeeperException.Code.OK.intValue()) { deleteOps[NatBlock.TOTAL_BLOCKS] = Op.delete(path, stat.getVersion()); tryRecycleBlocks(devId, ipv4, 0, deleteOps, p); } else { p.success(0); } } }, null); } return sum(fs); }
Source:
<code>private void populatePositionsForEachPartition(Page page) { for (int i = 0; i < partitionData.length; i++) { <START> PartitionData target = partitionData[i]; <END> target.ensurePositionsCapacity(page.getPositionCount()); target.resetPositionCount(); } Page partitionFunctionArgs = getPartitionFunctionArguments(page); int positionCount = page.getPositionCount(); for (int position = 0; position < positionCount; position++) { boolean shouldReplicate = (replicatesAnyRow && !hasAnyRowBeenReplicated) || nullChannel.isPresent() && page.getBlock(nullChannel.getAsInt()).isNull(position); if (shouldReplicate) { for (int i = 0; i < partitionData.length; i++) { partitionData[i].appendPosition(position); } hasAnyRowBeenReplicated = true; } else { int partition = partitionFunction.getPartition(partitionFunctionArgs, position); partitionData[partition].appendPosition(position); } } }</code><technical_language>avoid introducing new term target partitionData[i].ensurePositionsCapacity(page.getPositionCount()); partitionData[i].resetPositionCount();</technical_language>

Target:
private void populatePositionsForEachPartition(Page page) { int positionCount = page.getPositionCount(); for (int i = 0; i < partitionData.length; i++) { partitionData[i].ensurePositionsCapacity(positionCount); partitionData[i].resetPositionCount(); } Block nullBlock = nullChannel.isPresent() ? page.getBlock(nullChannel.getAsInt()) : null; Page partitionFunctionArgs = getPartitionFunctionArguments(page); for (int position = 0; position < positionCount; position++) { boolean shouldReplicate = (replicatesAnyRow && !hasAnyRowBeenReplicated) || nullChannel.isPresent() && nullBlock.isNull(position); if (shouldReplicate) { for (int i = 0; i < partitionData.length; i++) { partitionData[i].appendPosition(position); } hasAnyRowBeenReplicated = true; } else { int partition = partitionFunction.getPartition(partitionFunctionArgs, position); partitionData[partition].appendPosition(position); } } }
Source:
<code>public void modifyIcon( final ModifyProjectIconParams params ) { callWithUpdateContext( ( () -> { doModifyIcon( params ); <START> LOG.info( "Icon for project updated: " + params.getName() ); <END> return true; } ), params.getName() ); }</code><technical_language>debug</technical_language>

Target:
public void modifyIcon( final ModifyProjectIconParams params ) { callWithUpdateContext( ( () -> { doModifyIcon( params ); LOG.debug( "Icon for project updated: " + params.getName() ); return true; } ), params.getName() ); }
Source:
<code>public void testCreateTaskManagerPodFailedAndRetry() throws Exception { <START> flinkKubeClient = spy(createFlinkKubeClient()); <END> TestingKubernetesResourceManager testRM = createAndStartResourceManager(flinkConfig); registerSlotRequest(testRM); verify(flinkKubeClient, timeout(TIMEOUT.toMilliseconds()) .atLeast(2)) .createTaskManagerPod(any(KubernetesPod.class)); testRM.close(); flinkKubeClient.close(); }</code><technical_language>Flink code style, avoid mockito mocks. create proper testing implementations of classes. E.g. in this case, have: private static FlinkKubeClient createTestingFlinkKubeClientAllocatingPodsAfter( int numberOfRetries, AtomicInteger retries) { ... } fails increments retries reaches numberOfRetries succeeds</technical_language>

Target:
public void testCreateTaskManagerPodFailedAndRetry() throws Exception { final AtomicInteger retries = new AtomicInteger(0); final int numOfFailedRetries = 3; final OneShotLatch podCreated = new OneShotLatch(); final FlinkKubeClient flinkKubeClient = createTestingFlinkKubeClientAllocatingPodsAfter(numOfFailedRetries, retries, podCreated); final TestingKubernetesResourceManager testRM = createAndStartResourceManager(flinkConfig, flinkKubeClient); registerSlotRequest(testRM); podCreated.await(); assertThat( "Creating taskmanager should fail " + numOfFailedRetries + " times and then succeed", retries.get(), is(numOfFailedRetries + 1)); testRM.close(); flinkKubeClient.close(); }
Source:
<code>public void setContentType(String contentType) { if (contentType != null) { this.contentType = GlusterHookContentType.valueOf(contentType); <START> } <END> }</code><technical_language>of happen in case contentType passed is null? - throw exception, - set this.contentType = null</technical_language>

Target:
public void setContentType(String contentType) { if (contentType != null) { this.contentType = GlusterHookContentType.valueOf(contentType); } else { this.contentType = null; } }
Source:
<code><START> void unregister() throws JMException { <END> try { server.unregisterMBean(instance.getObjectName()); } finally { instance = null; } }</code><technical_language>protected instead of package protected</technical_language>

Target:
protected void unregister() throws JMException { try { server.unregisterMBean(instance.getObjectName()); } finally { instance = null; } }
Source:
<code>public SequencerServerCache(long cacheSize) { CacheWriter<String, Long> writer = new CacheWriter<String, Long>() { @Override public void write(@Nonnull String key, @Nonnull Long value) { } @Override public void delete(@Nonnull String key, @Nullable Long globalAddress, @Nonnull RemovalCause cause) { <START> if (cause == RemovalCause.REPLACED) { <END> return; } log.trace( "Updating maxConflictWildcard. Old = '{}', new ='{}' conflictParam = '{}'. Cause = '{}'", maxConflictWildcard, globalAddress, key, cause ); if (globalAddress == null) { globalAddress = Address.NOT_FOUND; } maxConflictWildcard = Math.max(globalAddress, maxConflictWildcard); } }; this.conflictToGlobalTailCache = Caffeine.newBuilder() .maximumSize(cacheSize) .executor(Runnable::run) .writer(writer) .recordStats() .build(); }</code><technical_language>throw exception</technical_language>

Target:
public SequencerServerCache(long cacheSize) { this.conflictCache = Caffeine.newBuilder() .maximumSize(cacheSize) .executor(Runnable::run) .writer(getDefaultCacheWriter()) .recordStats() .build(); }
Source:
<code>private void encodeComponent(CharSequence s) { <START> if (CharsetUtil.UTF_8.equals(charset)) { <END> encodeUtf8Component(s); } else { encodeNonUtf8Component(s); } }</code><technical_language>imho do equals check in constructor, store result in field reduce overhead more.</technical_language>

Target:
private void encodeComponent(CharSequence s) { if (charset == null) { encodeUtf8Component(s); } else { encodeNonUtf8Component(s); } }
Source:
<code>public void scrutinize(ItemUpdate update) { Map<PropertyIdValue, Integer> propertyCount = new HashMap<>(); for (Statement statement : update.getAddedStatements()) { PropertyIdValue pid = statement.getClaim().getMainSnak().getPropertyId(); if (propertyCount.containsKey(pid)) { propertyCount.put(pid, propertyCount.get(pid) + 1); } else if (_fetcher.hasMultiValue(pid)) { propertyCount.put(pid, 1); } } if (update.isNew()) { for (PropertyIdValue pid : propertyCount.keySet()) { if (propertyCount.get(pid) == 1) { QAWarning issue = new QAWarning(new_type, pid.getId(), QAWarning.Severity.WARNING, 1); issue.setProperty("property_entity", pid); issue.setProperty("example_entity", update.getItemId()); addIssue(issue); } } } else { for (PropertyIdValue pid : propertyCount.keySet()) { if (propertyCount.get(pid) == 1) { <START> QAWarning issue = new QAWarning(existing_type, pid.getId(), QAWarning.Severity.WARNING, 1); <END> issue.setProperty("property_entity", pid); issue.setProperty("example_entity", update.getItemId()); addIssue(issue); } } } }</code><technical_language>a severity level for warnings existing items</technical_language>

Target:
public void scrutinize(ItemUpdate update) { Map<PropertyIdValue, Integer> propertyCount = new HashMap<>(); for (Statement statement : update.getAddedStatements()) { PropertyIdValue pid = statement.getClaim().getMainSnak().getPropertyId(); if (propertyCount.containsKey(pid)) { propertyCount.put(pid, propertyCount.get(pid) + 1); } else if (_fetcher.hasMultiValue(pid)) { propertyCount.put(pid, 1); } } if (update.isNew()) { for (PropertyIdValue pid : propertyCount.keySet()) { if (propertyCount.get(pid) == 1) { QAWarning issue = new QAWarning(new_type, pid.getId(), QAWarning.Severity.WARNING, 1); issue.setProperty("property_entity", pid); issue.setProperty("example_entity", update.getItemId()); addIssue(issue); } } } else { for (PropertyIdValue pid : propertyCount.keySet()) { if (propertyCount.get(pid) == 1) { QAWarning issue = new QAWarning(existing_type, pid.getId(), QAWarning.Severity.INFO, 1); issue.setProperty("property_entity", pid); issue.setProperty("example_entity", update.getItemId()); addIssue(issue); } } } }
Source:
<code>protected C retrieveCredentials(final WebContext context) throws HttpAction { CommonHelper.assertNotNull("credentialsExtractor", this.credentialsExtractor); CommonHelper.assertNotNull("authenticator", this.authenticator); try { final C credentials = this.credentialsExtractor.extract(context); if (credentials == null) { return null; } this.authenticator.validate(credentials, context); return credentials; } catch (CredentialsException e) { if (e instanceof MultipleAccountsFoundException) { throw e; } <START> if (logger.isDebugEnabled()) { <END> logger.info("Failed to retrieve or validate credentials", e); } else { logger.info("Failed to retrieve or validate credentials: {}", e.getMessage()); } return null; } }</code><technical_language>This entire block appears duplicated here. Is a remove duplication</technical_language>

Target:
protected C retrieveCredentials(final WebContext context) throws HttpAction { CommonHelper.assertNotNull("credentialsExtractor", this.credentialsExtractor); CommonHelper.assertNotNull("authenticator", this.authenticator); try { final C credentials = this.credentialsExtractor.extract(context); if (credentials == null) { return null; } this.authenticator.validate(credentials, context); return credentials; } catch (CredentialsException e) { logger.info("Failed to retrieve or validate credentials: {}", e.getMessage()); logger.debug("Failed to retrieve or validate credentials", e); return null; } }