auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void UpdateSpmPriority(Integer value) { List<EntityModel> items = new ArrayList<EntityModel>(); if (value == null) { value = defaultSpmPriority; } int neverValue = -1; EntityModel neverItem = new EntityModel("Never", neverValue); items.add(neverItem); int lowValue = defaultSpmPriority / 2; items.add(new EntityModel("Low", lowValue)); items.add(new EntityModel("Normal", defaultSpmPriority)); int highValue = defaultSpmPriority + (maxSpmPriority - defaultSpmPriority) / 2; <START> items.add(new EntityModel("High", highValue)); END> EntityModel selectedItem = null; int[] values = new int[] { neverValue, lowValue, defaultSpmPriority, highValue, maxSpmPriority + 1 }; Integer prevValue = null; for (int i = 0; i < values.length; i++) { int currentValue = values[i]; if (value == currentValue) { selectedItem = items.get(i); break; } else if (prevValue != null && value > prevValue && value < currentValue) { EntityModel customItem = new EntityModel("Custom (" + value + ")", value); items.add(i, customItem); selectedItem = customItem; break; } prevValue = currentValue; } if (selectedItem != neverItem) { items.remove(neverItem); } getSpmPriority().setItems(items); getSpmPriority().setSelectedItem(selectedItem); }</code><technical_language>localization constants for strings ("Never", "Low", "Normal" "High"). E.g. ConstantsManager.getInstance().getConstants().highTitle() instead of "High"</technical_language>

Target:
private void UpdateSpmPriority(Integer value) { List<EntityModel> items = new ArrayList<EntityModel>(); if (value == null) { value = defaultSpmPriority; } int neverValue = -1; EntityModel neverItem = new EntityModel(constants.neverTitle(), neverValue); items.add(neverItem); int lowValue = defaultSpmPriority / 2; items.add(new EntityModel(constants.lowTitle(), lowValue)); items.add(new EntityModel(constants.normalTitle(), defaultSpmPriority)); int highValue = defaultSpmPriority + (maxSpmPriority - defaultSpmPriority) / 2; items.add(new EntityModel(constants.highTitle(), highValue)); EntityModel selectedItem = null; int[] values = new int[] { neverValue, lowValue, defaultSpmPriority, highValue, maxSpmPriority + 1 }; Integer prevValue = null; for (int i = 0; i < values.length; i++) { int currentValue = values[i]; if (value == currentValue) { selectedItem = items.get(i); break; } else if (prevValue != null && value > prevValue && value < currentValue) { EntityModel customItem = new EntityModel("Custom (" + value + ")", value); items.add(i, customItem); selectedItem = customItem; break; } prevValue = currentValue; } if (selectedItem != neverItem) { items.remove(neverItem); } getSpmPriority().setItems(items); getSpmPriority().setSelectedItem(selectedItem); }
Source:
<code>public void shouldHandleEmptyListOfDiagnosesConceptSource() throws Exception { ConceptSource source = cs.getConceptSourceByName("ICD-10-WHO"); source.setName("foobar"); cs.saveConceptSource(source); Assert.assertNotNull(emrApiProperties.getConceptSourcesForDiagnosisSearch()); Assert.assertEquals(0, emrApiProperties.getConceptSourcesForDiagnosisSearch().size()); MockHttpServletRequest getRequest = newGetRequest("/rest/emrapi/concept",new Parameter[]{new Parameter("term", "Diabetes"), new Parameter("limit", "100")}); @SuppressWarnings("unchecked") List<SimpleObject> response1 = deserialize(handle(getRequest), new TypeReference<List>() {}); Assert.assertEquals(2, response1.size()); for(Map simpleObject : response1) Assert.assertNull(simpleObject.get("code")); source.setName("ICD-10-WHO"); cs.saveConceptSource(source); Assert.assertNotNull(emrApiProperties.getConceptSourcesForDiagnosisSearch()); Assert.assertEquals(1, emrApiProperties.getConceptSourcesForDiagnosisSearch().size()); response1 = deserialize(handle(getRequest), new TypeReference<List>() {}); Assert.assertEquals(2, response1.size()); for(Map simpleObject : response1) Assert.assertNotNull(simpleObject.get("code")); <START> <END> }</code><technical_language>Collect list of UUIDs out of response, check lists of UUIDs out of responses same. do [assertArrayEquals](<LINK_0>[],%20java.lang.Object[])) more concise</technical_language>

Target:
public void shouldHandleEmptyListOfDiagnosesConceptSource() throws Exception { ConceptSource source = cs.getConceptSourceByName("ICD-10-WHO"); source.setName("foobar"); cs.saveConceptSource(source); Assert.assertNotNull(emrApiProperties.getConceptSourcesForDiagnosisSearch()); Assert.assertEquals(0, emrApiProperties.getConceptSourcesForDiagnosisSearch().size()); MockHttpServletRequest getRequest = newGetRequest("/rest/emrapi/concept",new Parameter[]{new Parameter("term", "Diabetes"), new Parameter("limit", "100")}); @SuppressWarnings("unchecked") List<SimpleObject> response = deserialize(handle(getRequest), new TypeReference<List>() {}); Assert.assertEquals(2, response.size()); List<String> actualUuids = new ArrayList<String>(); for(Map simpleObject : response){ Assert.assertNull(simpleObject.get("code")); actualUuids.add((String) simpleObject.get("conceptUuid")); } source.setName("ICD-10-WHO"); cs.saveConceptSource(source); Assert.assertNotNull(emrApiProperties.getConceptSourcesForDiagnosisSearch()); Assert.assertEquals(1, emrApiProperties.getConceptSourcesForDiagnosisSearch().size()); response = deserialize(handle(getRequest), new TypeReference<List>() {}); Assert.assertEquals(2, response.size()); List<String> expectedUuids = new ArrayList<String>(); for(Map simpleObject : response){ Assert.assertNotNull(simpleObject.get("code")); expectedUuids.add((String) simpleObject.get("conceptUuid")); } Assert.assertArrayEquals(expectedUuids.toArray(), actualUuids.toArray()); }
Source:
<code>public void testBOMWithCharBeforeProlog() throws Exception { HighlightingData firstHighlightingData = getFirstHighlightingData("bomCharBeforeProlog.xml"); <START> assertTrue(firstHighlightingData.startOffset() == 1 || firstHighlightingData.startOffset() == 2); <END> assertTrue(firstHighlightingData.endOffset() == 6 || firstHighlightingData.endOffset() == 7); assertTrue(TypeOfText.KEYWORD.equals(firstHighlightingData.highlightCode())); }</code><technical_language>@gjd6640 making this more explicit robust this way: int windowsOffset = System.getProperty("os.name").contains("Windows") ? 1 : 0; assertTrue(firstHighlightingData.startOffset()).isEqualTo(1 + windowsOffset); ..</technical_language>

Target:
public void testBOMWithCharBeforeProlog() throws Exception { HighlightingData firstHighlightingData = getFirstHighlightingData("bomCharBeforeProlog.xml"); int expectedStartOffset = System.getProperty("os.name").contains("Windows") ? 2 : 1; int expectedEndOffset = System.getProperty("os.name").contains("Windows") ? 7 : 6; assertData(firstHighlightingData, expectedStartOffset, expectedEndOffset, TypeOfText.KEYWORD); }
Source:
<code>public String unconvert(T[] array) { if (componentManager instanceof DispatchingFormatManager) { @SuppressWarnings("unchecked") DispatchingFormatManager<T> dfm = (DispatchingFormatManager<T>) componentManager; Stream<Tuple<String, String>> unconverted = Arrays.stream(array).map(dfm::unconvertSeparated); List<String> results = <START> TupleUtil.arrayLeftAndCombine(unconverted, listSep); <END> return StringUtil.join(results, groupSep); } return Arrays.stream(array) .map(componentManager::unconvert) .collect(joining(listSep)); }</code><technical_language>pull in a lib Guava roll Tuples etc</technical_language>

Target:
public String unconvert(T[] array) { if (componentManager instanceof DispatchingFormatManager) { @SuppressWarnings("unchecked") DispatchingFormatManager<T> dfm = (DispatchingFormatManager<T>) componentManager; Stream<Tuple<String, String>> unconverted = Arrays.stream(array).map(dfm::unconvertSeparated); List<String> results = TupleUtil.arrayLeftAndCombine(unconverted, listSeparator); return StringUtil.join(results, groupSeparator); } return Arrays.stream(array) .map(componentManager::unconvert) .collect(joining(listSeparator)); }
Source:
<code>public void deleteGroup() throws ESException { makeUserPA(); final ACOrgUnitId newUser = getSuperAdminBroker().createUser(getNewUsername()); final ACOrgUnitId group = getSuperAdminBroker().createGroup(getNewGroupName()); final ACOrgUnitId otherGroup = getSuperAdminBroker().createGroup(getNewOtherGroupName()); getAdminBroker().addMember(group, otherGroup); getAdminBroker().addMember(otherGroup, newUser); ProjectUtil.share(getUsersession(), getLocalProject()); final ProjectSpace clonedProjectSpace = cloneProjectSpace(getProjectSpace()); ProjectUtil.share(getSuperUsersession(), clonedProjectSpace.toAPI()); getAdminBroker().changeRole(getProjectSpace().getProjectId(), group, Roles.writer()); <START> getAdminBroker().changeRole(getProjectSpace().getProjectId(), otherGroup, Roles.writer()); <END> final int oldSize = getAdminBroker().getGroups().size(); getAdminBroker().deleteGroup(group); assertEquals(oldSize - 1, getAdminBroker().getGroups().size()); }</code><technical_language>is this change necessary</technical_language>

Target:
public void deleteGroup() throws ESException { makeUserPA(); final ACOrgUnitId newUser = getSuperAdminBroker().createUser(getNewUsername()); final ACOrgUnitId group = getSuperAdminBroker().createGroup(getNewGroupName()); final ACOrgUnitId otherGroup = getSuperAdminBroker().createGroup(getNewOtherGroupName()); getSuperAdminBroker().addMember(group, otherGroup); getSuperAdminBroker().addMember(otherGroup, newUser); ProjectUtil.share(getUsersession(), getLocalProject()); getSuperAdminBroker().changeRole(getProjectSpace().getProjectId(), group, Roles.writer()); final int oldSize = getSuperAdminBroker().getGroups().size(); getAdminBroker().deleteGroup(group); assertEquals(oldSize - 1, getSuperAdminBroker().getGroups().size()); assertEquals(oldSize - 2, getAdminBroker().getGroups().size()); }
Source:
<code>public Conversions getConversion(Comparable<? extends Object> colIndex) { Conversions type = null; if (colIndex instanceof Double) { type = Conversions.DOUBLE; } else if (colIndex instanceof Integer) { type = Conversions.INTEGER; } else if (colIndex instanceof Float) { type = Conversions.FLOAT; } else if (colIndex instanceof Byte) { type = Conversions.BYTE; } else if (colIndex instanceof Short) { type = Conversions.SHORT; } else if (colIndex instanceof Long) { type = Conversions.LONG; } <START> return type; <END> }</code><technical_language>some default case</technical_language>

Target:
private Conversions getConversion(Comparable<? extends Object> colIndex) { Conversions type = null; if (colIndex instanceof Double) { type = Conversions.DOUBLE; } else if (colIndex instanceof Integer) { type = Conversions.INTEGER; } else if (colIndex instanceof Float) { type = Conversions.FLOAT; } else if (colIndex instanceof Byte) { type = Conversions.BYTE; } else if (colIndex instanceof Short) { type = Conversions.SHORT; } else if (colIndex instanceof Long) { type = Conversions.LONG; } else { throw new IllegalArgumentException(); } return type; }
Source:
<code>private static String getApiTokenVersion2(SharedPreferences prefs) throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException, NoSuchPaddingException, InvalidKeyException, UnrecoverableEntryException, IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException { <START> if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.M) return null; <END> final KeyStore keyStore = getKeyStore(); final SecretKey key = (SecretKey) keyStore.getKey(KEYSTORE_WIGLE_CREDS_KEY_V2, null); final Cipher decrypt = Cipher.getInstance(AES_CIPHER); final byte[] cypherToken = Base64.decode(prefs.getString(ListFragment.PREF_TOKEN, ""), Base64.DEFAULT); final byte[] iv = Base64.decode(prefs.getString(ListFragment.PREF_TOKEN_IV, ""), Base64.DEFAULT); final int tagLength = prefs.getInt(ListFragment.PREF_TOKEN_TAG_LENGTH, 128); decrypt.init(Cipher.DECRYPT_MODE, key, new GCMParameterSpec(tagLength, iv) ); final byte[] done = decrypt.doFinal(cypherToken); final String token = new String(done, UTF8); MainActivity.info("[TOKEN] aes decrypted token length: " + token.length()); return token; }</code><technical_language>worth logging here, JiC</technical_language>

Target:
private static String getApiTokenVersion2(SharedPreferences prefs) throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException, NoSuchPaddingException, InvalidKeyException, UnrecoverableEntryException, IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { MainActivity.warn("[TOKEN] getApiTokenVersion2 sdk not M+: " + Build.VERSION.SDK_INT); return null; } else { final KeyStore keyStore = getKeyStore(); final SecretKey key = (SecretKey) keyStore.getKey(KEYSTORE_WIGLE_CREDS_KEY_V2, null); final Cipher decrypt = Cipher.getInstance(AES_CIPHER); final byte[] cypherToken = Base64.decode(prefs.getString(ListFragment.PREF_TOKEN, ""), Base64.DEFAULT); final byte[] iv = Base64.decode(prefs.getString(ListFragment.PREF_TOKEN_IV, ""), Base64.DEFAULT); final int tagLength = prefs.getInt(ListFragment.PREF_TOKEN_TAG_LENGTH, 128); decrypt.init(Cipher.DECRYPT_MODE, key, new GCMParameterSpec(tagLength, iv)); final byte[] done = decrypt.doFinal(cypherToken); final String token = new String(done, UTF8); MainActivity.info("[TOKEN] aes decrypted token length: " + token.length()); return token; } }
Source:
<code>public void testStartEffect() { PlayerFish pf = pu.getTarget(); double oldAcceleration = pf.getAcceleration(); double oldMaxSpeed = pf.getMaxSpeed(); pu.startEffect(); assertEquals(oldAcceleration * PuSuperSpeed.ACCELERATION_FACTOR, <START> pf.getAcceleration(), 0.0000001D); <END> assertEquals(oldMaxSpeed * PuSuperSpeed.MAX_SPEED_FACTOR, pf.getMaxSpeed(), 0.0000001D); }</code><technical_language>0.0000001D a private static final double DELTA = 0.0000001D; <naming,layout</technical_language>

Target:
public void testStartEffect() { PlayerFish pf = pu.getTarget(); double oldAcceleration = pf.getAcceleration(); double oldMaxSpeed = pf.getMaxSpeed(); pu.startEffect(); assertEquals(oldAcceleration * PuSuperSpeed.ACCELERATION_FACTOR, pf.getAcceleration(), DELTA); assertEquals(oldMaxSpeed * PuSuperSpeed.MAX_SPEED_FACTOR, pf.getMaxSpeed(), DELTA); }
Source:
<code>public void testE2() { try { T_const_class_7 t = new T_const_class_7(); t.run(); <START> fail("expected a IllegalAccessError exception"); <END> } catch (IllegalAccessError e) { } }</code><technical_language>"expected an" vs. "expected a"</technical_language>

Target:
public void testE2() { try { T_const_class_7 t = new T_const_class_7(); t.run(); fail("expected an IllegalAccessError exception"); } catch (IllegalAccessError e) { } }
Source:
<code>public IdToken idTokenWithAudience(String targetAudience, List<IdTokenProvider.Option> options) throws IOException { boolean includeEmail = false; <START> if (options != null) <END> if (options.contains(IdTokenProvider.Option.INCLUDE_EMAIL)) includeEmail = true; return IamUtils.getIdToken(getAccount(), sourceCredentials, transportFactory.create(), targetAudience, includeEmail, ImmutableMap.of("delegates", this.delegates)); }</code><technical_language>Google style: [always braces](<LINK_0> This be: java boolean includeEmail = options != null && options.contains(IdTokenProvider.Option.INCLUDE_EMAIL);</technical_language>

Target:
public IdToken idTokenWithAudience(String targetAudience, List<IdTokenProvider.Option> options) throws IOException { boolean includeEmail = options != null && options.contains(IdTokenProvider.Option.INCLUDE_EMAIL); return IamUtils.getIdToken( getAccount(), sourceCredentials, transportFactory.create(), targetAudience, includeEmail, ImmutableMap.of("delegates", this.delegates)); }
Source:
<code>public String getStartupNotifications() { this.configCommands.triggerTarget(); super.setPromptPath(null); final StringBuilder sb = new StringBuilder(); if (targetHolder.getTarget().getTargetException() != null && StringUtils.hasText(targetHolder.getTarget().getTargetResultMessage())) { sb.append("WARNING - During targeting we encountered a problem:" + System.lineSeparator()) .append("\"" + targetHolder.getTarget().getTargetResultMessage() + "\"" + System.lineSeparator()) <START> .append("Please double check your startup parameters and either restart the " <END> + "Data Flow Shell or target the Data Flow Server using the " + "'dataflow config server' command." + System.lineSeparator() + System.lineSeparator()); } else if (StringUtils.hasText(targetHolder.getTarget().getTargetResultMessage())) { sb.append(targetHolder.getTarget().getTargetResultMessage()); } return sb.toString(); }</code><technical_language>good include missing security config (though of reasons for failure). like: Please double check startup parameters restart Data Flow Shell (with missing configuration including security etc.,) target Data Flow Server 'dataflow config server' command</technical_language>

Target:
public String getStartupNotifications() { this.configCommands.triggerTarget(); super.setPromptPath(null); final StringBuilder sb = new StringBuilder(); if (targetHolder.getTarget().getTargetException() != null && StringUtils.hasText(targetHolder.getTarget().getTargetResultMessage())) { sb.append("WARNING - Problem connecting to the Spring Cloud Data Flow Server:" + System.lineSeparator()) .append("\"" + targetHolder.getTarget().getTargetResultMessage() + "\"" + System.lineSeparator()) .append("Please double check your startup parameters and either restart the " + "Data Flow Shell (with any missing configuration including security etc.) " + "or target the Data Flow Server using the " + "'dataflow config server' command." + System.lineSeparator() + System.lineSeparator()); } else if (StringUtils.hasText(targetHolder.getTarget().getTargetResultMessage())) { sb.append(targetHolder.getTarget().getTargetResultMessage()); } return sb.toString(); }
Source:
<code>public void test() throws Exception { <START> javax.transaction.TransactionManager tm = com.arjuna.ats.jta.TransactionManager <END> .transactionManager(); tm.begin(); javax.transaction.Transaction theTransaction = tm.getTransaction(); assertTrue(theTransaction.enlistResource(new XARMERRXAResource(false))); assertTrue(theTransaction.enlistResource(new XARMERRXAResource(true))); tm.rollback(); }</code><technical_language>This load JTA version of transaction manager, JTS one. loads JTS need: ORB myORB = ORB.getInstance("test"); RootOA myOA = OA.getRootOA(myORB); myORB.initORB(new String[] {}, null); myOA.initOA(); ORBManager.setORB(myORB); ORBManager.setPOA(myOA); jtaPropertyManager.getJTAEnvironmentBean().setTransactionManagerClassName(com.arjuna.ats.internal.jta.transaction.jts.TransactionManagerImple.class.getName()); jtaPropertyManager.getJTAEnvironmentBean().setUserTransactionClassName(com.arjuna.ats.internal.jta.transaction.jts.UserTransactionImple.class.getName()); javax.transaction.TransactionManager tm = com.arjuna.ats.jta.TransactionManager.transactionManager();</technical_language>

Target:
public void test() throws Exception { ORB myORB = ORB.getInstance("test"); RootOA myOA = OA.getRootOA(myORB); myORB.initORB(new String[] {}, null); myOA.initOA(); ORBManager.setORB(myORB); ORBManager.setPOA(myOA); jtaPropertyManager.getJTAEnvironmentBean().setTransactionManagerClassName(com.arjuna.ats.internal.jta.transaction.jts.TransactionManagerImple.class.getName()); jtaPropertyManager.getJTAEnvironmentBean().setUserTransactionClassName(com.arjuna.ats.internal.jta.transaction.jts.UserTransactionImple.class.getName()); javax.transaction.TransactionManager tm = com.arjuna.ats.jta.TransactionManager.transactionManager(); tm.begin(); javax.transaction.Transaction theTransaction = tm.getTransaction(); assertTrue(theTransaction.enlistResource(new XARMERRXAResource(false))); assertTrue(theTransaction.enlistResource(new XARMERRXAResource(true))); tm.rollback(); myOA.destroy(); myORB.shutdown(); }
Source:
<code>public Object unmarshal(HierarchicalStreamReader reader, <START> UnmarshallingContext context) { <END> GithubSecurityRealm realm = new GithubSecurityRealm(); String node; String value; while (reader.hasMoreChildren()) { reader.moveDown(); node = reader.getNodeName(); value = reader.getValue(); setValue(realm, node, value); reader.moveUp(); } if (realm.getGithubWebUri() == null) { realm.setGithubWebUri(DEFAULT_WEB_URI); } if (realm.getGithubApiUri() == null) { realm.setGithubApiUri(DEFAULT_API_URI); } return realm; }</code><technical_language>Check other plugins save load booleans. check well</technical_language>

Target:
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) { GithubSecurityRealm realm = new GithubSecurityRealm(); String node; String value; while (reader.hasMoreChildren()) { reader.moveDown(); node = reader.getNodeName(); value = reader.getValue(); setValue(realm, node, value); reader.moveUp(); } if (realm.getGithubWebUri() == null) { realm.setGithubWebUri(DEFAULT_WEB_URI); } if (realm.getGithubApiUri() == null) { realm.setGithubApiUri(DEFAULT_API_URI); } if (realm.getForceGithubEmail() == null) { realm.setForceGithubEmail(DEFAULT_FORCE_GITHUB_EMAIL); } return realm; }
Source:
<code>private static void usageError() { System.err.println("Usage: psql [-t table-name] [-h comma-separated-column-names | in-line] [-d field-delimiter-char quote-char escape-char]<zookeeper> <path-to-sql-or-csv-file>...\n" + " By default, the name of the CSV file is used to determine the Phoenix table into which the CSV data is loaded\n" + " and the ordinal value of the columns determines the mapping.\n" + " -t overrides the table into which the CSV data is loaded\n" + " -h overrides the column names to which the CSV data maps\n" + " A special value of in-line indicating that the first line of the CSV file\n" + " determines the column to which the data maps.\n" + " -s uses strict mode by throwing an exception if a column name doesn't match during CSV loading.\n" + " -d uses custom delimiters for CSV loader, need to specify single char for field delimiter, phrase delimiter, and escape char.\n" + " number is NOT usually a delimiter and shall be taken as 1 -> ctrl A, 2 -> ctrl B ... 9 -> ctrl I. \n" + "Examples:\n" + " psql localhost my_ddl.sql\n" + " psql localhost my_ddl.sql my_table.csv\n" + " psql my_cluster:1825 -t my_table my_table2012-Q3.csv\n" + <START> " psql my_cluster -t my_table -h col1,col2,col3 my_table2012-Q3.csv\n" <END> ); System.exit(-1); }</code><technical_language>I <zookeeper> argument other arguments. Also, good add more example -d flag</technical_language>

Target:
private static void usageError() { System.err.println("Usage: psql [-t table-name] [-h comma-separated-column-names | in-line] [-d field-delimiter-char quote-char escape-char]<zookeeper> <path-to-sql-or-csv-file>...\n" + " By default, the name of the CSV file is used to determine the Phoenix table into which the CSV data is loaded\n" + " and the ordinal value of the columns determines the mapping.\n" + " -t overrides the table into which the CSV data is loaded\n" + " -h overrides the column names to which the CSV data maps\n" + " A special value of in-line indicating that the first line of the CSV file\n" + " determines the column to which the data maps.\n" + " -s uses strict mode by throwing an exception if a column name doesn't match during CSV loading.\n" + " -d uses custom delimiters for CSV loader, need to specify single char for field delimiter, phrase delimiter, and escape char.\n" + " number is NOT usually a delimiter and shall be taken as 1 -> ctrl A, 2 -> ctrl B ... 9 -> ctrl I. \n" + "Examples:\n" + " psql localhost my_ddl.sql\n" + " psql localhost my_ddl.sql my_table.csv\n" + " psql -t my_table my_cluster:1825 my_table2012-Q3.csv\n" + " psql -t my_table -h col1,col2,col3 my_cluster:1825 my_table2012-Q3.csv\n" + " psql -t my_table -h col1,col2,col3 -d 1 2 3 my_cluster:1825 my_table2012-Q3.csv\n" ); System.exit(-1); }
Source:
<code>public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof AuditLog)) { return false; } AuditLog other = (AuditLog) obj; return auditLogId == other.auditLogId && Objects.equals(logTime, other.logTime) && logType == other.logType && Objects.equals(message, other.message) && Objects.equals(storageDomainId, other.storageDomainId) && Objects.equals(storagePoolId, other.storagePoolId) && severity == other.severity && Objects.equals(userId, other.userId) && Objects.equals(vdsId, other.vdsId) && Objects.equals(quotaId, other.quotaId) && Objects.equals(vmId, other.vmId) && Objects.equals(vmTemplateId, other.vmTemplateId) && processed == other.processed && Objects.equals(correlationId, other.correlationId) && Objects.equals(jobId, other.jobId) && Objects.equals(origin, other.origin) <START> && customId == other.customId <END> && customEventId == other.customEventId && eventFloodInSec == other.eventFloodInSec && Objects.equals(customData, other.customData) && external == other.external && deleted == other.deleted && Objects.equals(callStack, other.callStack); }</code><technical_language>compare strings ==. pls Objects.equals(customId, other.customId)</technical_language>

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof AuditLog)) { return false; } AuditLog other = (AuditLog) obj; return auditLogId == other.auditLogId && Objects.equals(logTime, other.logTime) && logType == other.logType && Objects.equals(message, other.message) && Objects.equals(storageDomainId, other.storageDomainId) && Objects.equals(storagePoolId, other.storagePoolId) && severity == other.severity && Objects.equals(userId, other.userId) && Objects.equals(vdsId, other.vdsId) && Objects.equals(quotaId, other.quotaId) && Objects.equals(vmId, other.vmId) && Objects.equals(vmTemplateId, other.vmTemplateId) && processed == other.processed && Objects.equals(correlationId, other.correlationId) && Objects.equals(jobId, other.jobId) && Objects.equals(origin, other.origin) && Objects.equals(customId, other.customId) && customEventId == other.customEventId && eventFloodInSec == other.eventFloodInSec && Objects.equals(customData, other.customData) && external == other.external && deleted == other.deleted && Objects.equals(callStack, other.callStack); }
Source:
<code><START> public void stop(ComponentContext context) throws InterruptedException { <END> setFailure(); }</code><technical_language>throws InterruptedException needed</technical_language>

Target:
public void stop(ComponentContext context) { setFailure(); }
Source:
<code>public void testGetDeployment() throws Exception { final DeploymentApi deploymentApi = api.getDeploymentApi(resourceGroup); server.enqueue(jsonResponse("/createdeploymentsucceeded.json")); Deployment deployment = deploymentApi.get(deploymentName); assertTrue(deployment != null); <START> assertEquals(ProvisioningState.fromValue(deployment.properties().provisioningState()), ProvisioningState.SUCCEEDED); <END> }</code><technical_language>Verify recorded request</technical_language>

Target:
public void testGetDeployment() throws Exception { final DeploymentApi deploymentApi = api.getDeploymentApi(resourceGroup); server.enqueue(jsonResponse("/createdeploymentsucceeded.json")); Deployment deployment = deploymentApi.get(deploymentName); assertTrue(deployment != null); assertEquals(ProvisioningState.fromValue(deployment.properties().provisioningState()), ProvisioningState.SUCCEEDED); assertSent(server, "GET", "/subscriptions/" + subscriptionId + "/resourcegroups/" + resourceGroup + "/providers/microsoft.resources/deployments/" + deploymentName + "?api-version=2016-02-01"); }
Source:
<code>public Builder setClass(Class utilClass) { <START> this.utilClass = utilClass; <END> return this; }</code><technical_language>I think, argument non-null. Check other Builders in Spine</technical_language>

Target:
public Builder setClass(Class utilClass) { this.targetClass = checkNotNull(utilClass); return this; }
Source:
<code>protected boolean doFilter(ScoredCandidate<T> candidate, T subject, ResultDescription desc) { ImmutableList<Long> excludedIds = excludedUris.stream() .filter(id -> !id.contains("http")) <START> .map(id -> codec.decode(id).longValue()) <END> .collect(MoreCollectors.toImmutableList()); boolean result = !excludedUris.contains(candidate.candidate().getCanonicalUri()) && !excludedIds.contains(candidate.candidate().getId()); if (!result) { desc.appendText("%s removed as contained in exclusion list", candidate.candidate().getCanonicalUri()); } return result; }</code><technical_language>here, "id" is a uri this point</technical_language>

Target:
protected boolean doFilter(ScoredCandidate<T> candidate, T subject, ResultDescription desc) { ImmutableList<Long> excludedDecodedIds = excludedIds.stream() .map(id -> codec.decode(id).longValue()) .collect(MoreCollectors.toImmutableList()); boolean result = !excludedUris.contains(candidate.candidate().getCanonicalUri()) && !excludedDecodedIds.contains(candidate.candidate().getId()); if (!result) { desc.appendText("%s removed as contained in exclusion list", candidate.candidate().getCanonicalUri()); } return result; }
Source:
<code>private static Benchmark run(String name, StarlarkFunction f, long budgetNanos) { Mutability mu = Mutability.create("test"); StarlarkThread thread = new StarlarkThread(mu, semantics); Benchmark b = new Benchmark(); <START> for (b.n = 1; b.time < budgetNanos && (b.n << 1) > b.n; b.n <<= 1) { <END> try { b.start(thread); Starlark.fastcall(thread, f, new Object[] {b}, new Object[0]); b.stop(thread); } catch (EvalException ex) { System.err.println(ex.getMessageWithStack()); return null; } catch ( @SuppressWarnings("InterruptedExceptionSwallowed") Throwable ex) { System.err.printf("In %s: %s\n", name, ex.getMessage()); ex.printStackTrace(); return null; } } return b; }</code><technical_language>change n a long</technical_language>

Target:
private static Benchmark run(String name, StarlarkFunction f, long budgetNanos) { Mutability mu = Mutability.create("test"); StarlarkThread thread = new StarlarkThread(mu, semantics); Benchmark b = new Benchmark(); for (b.n = 1; b.time < budgetNanos; b.n <<= 1) { if (b.n <= 0) { System.err.printf("In %s: bench is too fast, likely a loop over `range(b.n)` is missing", name); return null; } try { b.start(thread); Starlark.fastcall(thread, f, new Object[] {b}, new Object[0]); b.stop(thread); } catch (EvalException ex) { System.err.println(ex.getMessageWithStack()); return null; } catch ( @SuppressWarnings("InterruptedExceptionSwallowed") Throwable ex) { System.err.printf("In %s: %s\n", name, ex.getMessage()); ex.printStackTrace(); return null; } } return b; }
Source:
<code>private static String getPostCode3(byte[] bytes) { return String.valueOf( new char[] { SETS[0].charAt(getInt(bytes, new byte[] {39, 40, 41, 42, 31, 32})), SETS[0].charAt(getInt(bytes, new byte[] {33, 34, 35, 36, 25, 26})), SETS[0].charAt(getInt(bytes, new byte[] {27, 28, 29, 30, 19, 20})), SETS[0].charAt(getInt(bytes, new byte[] {21, 22, 23, 24, 13, 14})), SETS[0].charAt(getInt(bytes, new byte[] {15, 16, 17, 18, 7, 8})), <START> SETS[0].charAt(getInt(bytes, new byte[] { 9, 10, 11, 12, 1, 2})) <END> } ); }</code><technical_language>I leave this in purpose. trivial, if add a new line, change this line add comma. symmetry is nice</technical_language>

Target:
private static String getPostCode3(byte[] bytes) { return String.valueOf( new char[] { SETS[0].charAt(getInt(bytes, new byte[] {39, 40, 41, 42, 31, 32})), SETS[0].charAt(getInt(bytes, new byte[] {33, 34, 35, 36, 25, 26})), SETS[0].charAt(getInt(bytes, new byte[] {27, 28, 29, 30, 19, 20})), SETS[0].charAt(getInt(bytes, new byte[] {21, 22, 23, 24, 13, 14})), SETS[0].charAt(getInt(bytes, new byte[] {15, 16, 17, 18, 7, 8})), SETS[0].charAt(getInt(bytes, new byte[] { 9, 10, 11, 12, 1, 2})), } ); }
Source:
<code>protected void checkBundles(DistributionSnapshot snapshot, boolean partial) throws IOException { List<String> bids = snapshot.getBundleIds(); StringBuilder sb = new StringBuilder(); <START> bids.forEach(bid -> sb.append(represent(snapshot.getBundle(bid)))); <END> if (partial) { checkContentEquals("apidoc_snapshot/bundles_partial.txt", sb.toString()); } else { checkContentEquals("apidoc_snapshot/bundles.txt", sb.toString()); } }</code><technical_language>If want build string as: String s = bids.stream().map(snapshot::getBundle).map(this::represent).collect(Collectors.joining());</technical_language>

Target:
protected void checkBundles(DistributionSnapshot snapshot, boolean partial) throws IOException { List<String> bids = snapshot.getBundleIds(); String s = bids.stream().map(snapshot::getBundle).map(this::represent).collect(Collectors.joining()); if (partial) { checkContentEquals("apidoc_snapshot/bundles_partial.txt", s); } else { checkContentEquals("apidoc_snapshot/bundles.txt", s); } }
Source:
<code>public String toString() { <START> return "Tag{" + <END> "id='" + id + '\'' + ", value='" + user + '\'' + ", hashtag='" + hashtag + '\'' + '}'; }</code><technical_language>"InstaPost" actually</technical_language>

Target:
public String toString() { return "InstaPost{" + "id='" + id + '\'' + ", user='" + user + '\'' + ", hashtag='" + hashtag + '\'' + '}'; }
Source:
<code>private long getContentLength(ClientLogger logger, HttpHeaders headers) { long contentLength = 0; try { contentLength = Long.parseLong(headers.getValue("content-length")); } catch (NumberFormatException | NullPointerException ignored) { <START> logger.warning("Http logging cannot parse the content-length: " + headers.getValue("content-length")); <END> } return contentLength; }</code><technical_language>I placeholders evaluation of headers.getValue performed if log level is warning. In this case, java logger.warning("HTTP logging parse content-length: {}", headers.getValue("content-length")); <LINK_0></technical_language>

Target:
private long getContentLength(ClientLogger logger, HttpHeaders headers) { long contentLength = 0; try { contentLength = Long.parseLong(headers.getValue("content-length")); } catch (NumberFormatException | NullPointerException e) { logger.warning("Could not parse the HTTP header content-length: '{}'.", headers.getValue("content-length"), e); } return contentLength; }
Source:
<code>private boolean validateLine(byte[] line, int lineStart, int lineEnd) { for (; lineStart < lineEnd; lineStart++) { if ((line[lineStart] & 128) > 0) { int utf8Index = lineStart++; int utf8Bit = 64; if ((line[utf8Index] & utf8Bit) == 0) { return false; } for (; (lineStart - utf8Index) < 4 && (line[utf8Index] & utf8Bit) > 0 && (line[lineStart] & 128) > 0 && (line[lineStart] & 64) == 0 ; lineStart++, utf8Bit >>= <START> 1); <END> utf8Bit <<= 1; lineStart--; if ((lineStart - utf8Index) == 0) { return false; } if ((line[utf8Index] & utf8Bit) > 0 && (line[lineStart] & 128) == 0) { return false; } } } return true; }</code><technical_language>replace this prevent "empty control flow" compiler warning</technical_language>

Target:
private boolean validateLine(byte[] line, int lineStart, int lineEnd) { for (; lineStart < lineEnd; lineStart++) { if ((line[lineStart] & 128) > 0) { int utf8Index = lineStart++; int utf8Bit = 64; if ((line[utf8Index] & utf8Bit) == 0) { return false; } for (; (lineStart - utf8Index) < 4 && (line[utf8Index] & utf8Bit) > 0 && (line[lineStart] & 128) > 0 && (line[lineStart] & 64) == 0 ; lineStart++, utf8Bit >>= 1) {}; utf8Bit <<= 1; lineStart--; if ((lineStart - utf8Index) == 0) { return false; } if ((line[utf8Index] & utf8Bit) > 0 && (line[lineStart] & 128) == 0) { return false; } } } return true; }
Source:
<code>default void sendMessages(Text... messages) { <START> for (Text message : messages) { <END> this.sendMessage(message); } }</code><technical_language>Missing some check nulls</technical_language>

Target:
default void sendMessages(Text... messages) { checkNotNull(messages, "messages"); checkArgument(messages.length > 0, "empty array of messages"); for (Text message : messages) { this.sendMessage(message); } }
Source:
<code>public int updateAnnouncement(final Announcement announcement) { LOG.debug("update announcement"); final SqlSession session = factory.openSession(); int updateId = -1; try { final AnnouncementsMapper mapper = session.getMapper(AnnouncementsMapper.class); updateId = mapper.updateAnnouncement(announcement); session.commit(); } catch (Exception e) { throw new RuntimeException("Failed to update announcement", e); } finally { <START> session.close(); <END> } return updateId; }</code><technical_language>try-with-resources need manually close session</technical_language>

Target:
public int updateAnnouncement(final Announcement announcement) { int updateId = -1; try (final SqlSession session = factory.openSession()) { final AnnouncementsMapper mapper = session.getMapper(AnnouncementsMapper.class); updateId = mapper.updateAnnouncement(announcement); return updateId; } catch (Exception e) { throw new ServiceRuntimeException("Failed to update announcements", e); } }
Source:
<code>private void performSave(final IEditorPart editor) { EditorHandler.getInstance().activate(editor); <START> System.out.println("My Saving editor"); <END> Display.asyncExec(new Runnable() { @Override public void run() { editor.doSave(new NullProgressMonitor()); } }); new WaitUntil(new WaitCondition() { @Override public boolean test() { return !editor.isDirty(); } @Override public String errorMessage() { return "Could not save the editor"; } @Override public String description() { return " editor is not dirty..."; } }, TimePeriod.SHORT); }</code><technical_language>This forgotten sysout ;-)</technical_language>

Target:
private void performSave(final IEditorPart editor) { EditorHandler.getInstance().activate(editor); Display.asyncExec(new Runnable() { @Override public void run() { editor.doSave(new NullProgressMonitor()); } }); new WaitUntil(new WaitCondition() { @Override public boolean test() { return !editor.isDirty(); } @Override public String errorMessage() { return "Could not save the editor"; } @Override public String description() { return " editor is not dirty..."; } }, TimePeriod.SHORT); }
Source:
<code>void run(final ReviewDb db) throws OrmException { <START> if (commands == null) { <END> return; } try { final Connection c = ((JdbcSchema) db).getConnection(); final Statement stmt = c.createStatement(); try { for (String sql : commands) { try { stmt.execute(sql); } catch (SQLException e) { throw new OrmException("Error in " + name + ":\n" + sql, e); } } } finally { stmt.close(); } } catch (SQLException e) { throw new OrmException("Cannot run statements for " + name, e); } }</code><technical_language>do this check if NOP ScriptRunner</technical_language>

Target:
void run(final ReviewDb db) throws OrmException { try { final Connection c = ((JdbcSchema) db).getConnection(); final Statement stmt = c.createStatement(); try { for (String sql : commands) { try { stmt.execute(sql); } catch (SQLException e) { throw new OrmException("Error in " + name + ":\n" + sql, e); } } } finally { stmt.close(); } } catch (SQLException e) { throw new OrmException("Cannot run statements for " + name, e); } }
Source:
<code><START> ActionConfigurationBuilder() { <END> }</code><technical_language>constructors private right</technical_language>

Target:
private ActionConfigurationBuilder() { }
Source:
<code>public BotConfigDialog(JFrame parent, BotClient existingBot) { this(parent, new HashSet<IPlayer>()); <START> if(existingBot instanceof Princess) { <END> this.princessBehavior = ((Princess) existingBot).getBehaviorSettings(); nameField.setText(existingBot.getName()); setPrincessFields(); } }</code><technical_language>suggestion if (existingBot instanceof Princess) {</technical_language>

Target:
public BotConfigDialog(JFrame parent, BotClient existingBot) { this(parent, new HashSet<>()); if (existingBot instanceof Princess) { this.princessBehavior = ((Princess) existingBot).getBehaviorSettings(); nameField.setText(existingBot.getName()); setPrincessFields(); } }
Source:
<code>public String[] cutUri (URI uri) throws NullPointerException, IllegalArgumentException { String path = uri.getPath(); String[] result = path.split("/"); if (result.length < 2) { <START> throw new IllegalArgumentException(); <END> } for (int i = 1; i < result.length; i++){ if (result[i] == null) { throw new NullPointerException(); } } return result; }</code><technical_language>Add a message exception describing wrong</technical_language>

Target:
public String[] cutUri(URI uri) throws IllegalArgumentException { String path = uri.getPath(); String[] result = path.split("/"); if (result.length < 2) { throw new IllegalArgumentException("there is neither ContainerName nor BlobName in the URI path"); } return result; }
Source:
<code>public InformationDialog build() { final InformationDialog dialog = new InformationDialog(); dialog.initOwner(owner); dialog.setTitle(title); dialog.setHeaderText(title); dialog.setContentText(message); dialog.setResizable(resizable); <START> dialog.getDialogPane().getChildren().stream() <END> .filter(node -> node instanceof Label) .map(node -> (Label) node) .forEach(label -> label.setMinHeight(Region.USE_PREF_SIZE)); return dialog; }</code><technical_language>I this is needed</technical_language>

Target:
public InformationDialog build() { final InformationDialog dialog = new InformationDialog(); dialog.initOwner(owner); dialog.setTitle(title); dialog.setHeaderText(title); dialog.setContentText(message); dialog.setResizable(resizable); dialog.getDialogPane().setMinSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE); return dialog; }
Source:
<code>private RuntimeException requestFailedException(String task, Request request, JsonResponse<QueryResults> response) { <START> state.compareAndSet(State.RUNNING, State.COMMUNICATION_FAILURE); <END> if (!response.hasValue()) { if (response.getStatusCode() == HTTP_UNAUTHORIZED) { return new ClientException("Authentication failed" + Optional.ofNullable(response.getStatusMessage()) .map(message -> ": " + message) .orElse("")); } return new RuntimeException( format("Error %s at %s returned an invalid response: %s [Error: %s]", task, request.url(), response, response.getResponseBody()), response.getException()); } return new RuntimeException(format("Error %s at %s returned HTTP %s", task, request.url(), response.getStatusCode())); }</code><technical_language>I set this in callers. Pick other</technical_language>

Target:
private RuntimeException requestFailedException(String task, Request request, JsonResponse<QueryResults> response) { if (!response.hasValue()) { if (response.getStatusCode() == HTTP_UNAUTHORIZED) { return new ClientException("Authentication failed" + Optional.ofNullable(response.getStatusMessage()) .map(message -> ": " + message) .orElse("")); } return new RuntimeException( format("Error %s at %s returned an invalid response: %s [Error: %s]", task, request.url(), response, response.getResponseBody()), response.getException()); } return new RuntimeException(format("Error %s at %s returned HTTP %s", task, request.url(), response.getStatusCode())); }
Source:
<code>public void updateMetadata(String productName, String metadataName, Metadata metadata) throws APIException { Metadata updatedMetadata; try { updatedMetadata = productManager.loadMetadata(productName, metadataName); } catch (EntityNotFoundException e) { log.warning("The product " + productName + " or metadata: " + metadataName + " does not exist: " + e.getMessage()); throw new APIException(e); } if ((metadata.getKey() != null) && (updatedMetadata.getKey() != null)) { boolean differentKeys = !metadata.getKey().equals(updatedMetadata.getKey()); if (differentKeys) { String message = "Metadata: " + metadataName + " in database has different key to: " + metadata.getKey(); log.warning(message); <START> throw new APIException(new EntityNotFoundException(Metadata.class, "key", metadata.getKey())); <END> } } if (metadata.getDescription() != null) { updatedMetadata.setDescription(metadata.getDescription()); } if (metadata.getValue() != null) { updatedMetadata.setValue(metadata.getValue()); } try { productManager.updateMetadata(updatedMetadata); } catch (Exception e) { throw new APIException(e); } }</code><technical_language>I is thowing another type of exception (to return a HTTP 400 instead of HTTP 404)</technical_language>

Target:
public void updateMetadata(String productName, String metadataName, Metadata metadata) throws APIException { Metadata updatedMetadata; try { updatedMetadata = productManager.loadMetadata(productName, metadataName); } catch (EntityNotFoundException e) { log.warning("The product " + productName + " or metadata: " + metadataName + " does not exist: " + e.getMessage()); throw new APIException(e); } if ((metadata.getKey() != null) && (updatedMetadata.getKey() != null)) { boolean differentKeys = !metadata.getKey().equals(updatedMetadata.getKey()); if (differentKeys) { String message = "Metadata: " + metadataName + " in database has different key to: " + metadata.getKey(); log.warning(message); throw new APIException(new EntityNotFoundException(Metadata.class, "key", metadata.getKey()), 400); } } if (metadata.getDescription() != null) { updatedMetadata.setDescription(metadata.getDescription()); } if (metadata.getValue() != null) { updatedMetadata.setValue(metadata.getValue()); } try { productManager.updateMetadata(updatedMetadata); } catch (Exception e) { throw new APIException(e); } }
Source:
<code>public void before() { PostProcessorDescriptorRegistryImpl<String> registry = new PostProcessorDescriptorRegistryImpl<String>(); registry.put(UMLPostProcessor.class.getName(), new TestPostProcessor.TestPostProcessorDescriptor( Pattern.compile("<LINK_0>\\d\\.0\\.0/UML"), null, new UMLPostProcessor(), <START> 10)); <END> emfCompare = EMFCompare.builder().setPostProcessorRegistry(registry).build(); }</code><technical_language>plugin.xml declaration, 20</technical_language>

Target:
public void before() { PostProcessorDescriptorRegistryImpl<String> registry = new PostProcessorDescriptorRegistryImpl<String>(); registry.put(UMLPostProcessor.class.getName(), new TestPostProcessor.TestPostProcessorDescriptor( Pattern.compile("<LINK_0>\\d\\.0\\.0/UML"), null, new UMLPostProcessor(), 20)); emfCompare = EMFCompare.builder().setPostProcessorRegistry(registry).build(); }
Source:
<code>public void customizeJdbi(Jdbi jdbi) { <START> if (mapper != null) { <END> jdbi.getConfig(Jackson2Config.class).setMapper(mapper); } jdbi.registerArgument(new JsonArgumentFactory()); jdbi.registerColumnMapper(new JsonColumnMapperFactory()); }</code><technical_language>checking for non-null in constructor</technical_language>

Target:
public void customizeJdbi(Jdbi jdbi) { jdbi.getConfig(JsonConfig.class).setImpl(new JacksonJsonImpl()); super.customizeJdbi(jdbi); }