auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setmDbHandler(new DatabaseHandler(this)); getmDbHandler().open(); setContentView(R.layout.gamemap); Button house = (Button) findViewById(R.id.HouseButton); house.setOnClickListener(onClickListener); Button boyfriend = (Button) findViewById(R.id.BoyfriendButton); boyfriend.setOnClickListener(onClickListener); Button hospital = (Button) findViewById(R.id.HospitalButton); hospital.setOnClickListener(onClickListener); Button school = (Button) findViewById(R.id.SchoolButton); school.setOnClickListener(onClickListener); Button storeButton = (Button) findViewById(R.id.storeButton); storeButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { <START> Intent intent = new Intent(MapActivity.this, DressingRoomActivity.class); <END> startActivity(intent); } }); }</code><technical_language>Give more descriptive name intent generate needed</technical_language>

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setmDbHandler(new DatabaseHandler(this)); getmDbHandler().open(); setContentView(R.layout.gamemap); Button house = (Button) findViewById(R.id.HouseButton); house.setOnClickListener(onClickListener); Button boyfriend = (Button) findViewById(R.id.BoyfriendButton); boyfriend.setOnClickListener(onClickListener); Button hospital = (Button) findViewById(R.id.HospitalButton); hospital.setOnClickListener(onClickListener); Button school = (Button) findViewById(R.id.SchoolButton); school.setOnClickListener(onClickListener); Button storeButton = (Button) findViewById(R.id.storeButton); storeButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(MapActivity.this, DressingRoomActivity.class)); } }); }
Source:
<code><START> public static Integer getJsonDepth(Object o) { <END> if (isScalarObject(o)) { return 1; } Queue<Object> q = new LinkedList<>(); int depth = 0; q.add(o); while (!q.isEmpty()) { int size = q.size(); for (int i = 0; i < size; ++i) { Object obj = q.poll(); if (obj instanceof Map) { for (Object value : ((LinkedHashMap) obj).values()) { q.add(value); } } else if (obj instanceof Collection) { for (Object value : (ArrayList) obj) { q.add(value); } } } ++depth; } return depth; }</code><technical_language>this function private jsonDepth above</technical_language>

Target:
private static Integer getJsonDepth(Object o) { if (isScalarObject(o)) { return 1; } Queue<Object> q = new LinkedList<>(); int depth = 0; q.add(o); while (!q.isEmpty()) { int size = q.size(); for (int i = 0; i < size; ++i) { Object obj = q.poll(); if (obj instanceof Map) { for (Object value : ((LinkedHashMap) obj).values()) { q.add(value); } } else if (obj instanceof Collection) { for (Object value : (Collection) obj) { q.add(value); } } } ++depth; } return depth; }
Source:
<code>public List<? extends PartitionId> getAssignedPartitionIds() { <START> return new ArrayList<>(assignedPartitionIds); <END> }</code><technical_language>change this signature return Collection instead of List? need copy</technical_language>

Target:
public Collection<? extends PartitionId> getAssignedPartitionIds() { return Collections.unmodifiableCollection(assignedPartitionIds); }
Source:
<code>public static boolean addHostRoute(String interfaceName, InetAddress dst, InetAddress gw) { if (dst == null) { Log.w(TAG, "addHostRoute: dst should not be null"); return false; } int prefixLength; String dstStr = dst.getHostAddress(); String gwStr = (gw != null) ? gw.getHostAddress() : null; if (dst instanceof Inet4Address) { prefixLength = 32; if (gwStr == null) { <START> gwStr = "0.0.0.0"; <END> } } else if (dst instanceof Inet6Address) { prefixLength = 128; if (gwStr == null) { gwStr = "::"; } } else { Log.w(TAG, "addHostRoute failure: address is neither IPv4 nor IPv6" + "(" + dst + ")"); return false; } return addRoute(interfaceName, dstStr, prefixLength, gwStr) == 0; }</code><technical_language>need do special if gwStr is null, native code do right if gw parameter is NULL. So: if (dst instanceof Inet4Address) { prefixLength = 32; } else if (dst instanceof Inet6Address) { prefixLength = 128; } else { Log.w(...) return false; }</technical_language>

Target:
public static boolean addHostRoute(String interfaceName, InetAddress dst, InetAddress gw) { if (dst == null) { Log.w(TAG, "addHostRoute: dst should not be null"); return false; } int prefixLength; String dstStr = dst.getHostAddress(); String gwStr = (gw != null) ? gw.getHostAddress() : null; if (dst instanceof Inet4Address) { prefixLength = 32; } else if (dst instanceof Inet6Address) { prefixLength = 128; } else { Log.w(TAG, "addHostRoute failure: address is neither IPv4 nor IPv6" + "(" + dst + ")"); return false; } return addRoute(interfaceName, dstStr, prefixLength, gwStr) == 0; }
Source:
<code>public void onBlockPlaced() { determineTrackMeta(); determineMirror(); Block myBlock = getWorld().getBlock(getX(), getY(), getZ()); <START> getWorld().notifyBlocksOfNeighborChange(getX(), getY(), getZ(), myBlock); <END> }</code><technical_language>a shortcut function for this super class notifyBlocksOfNeighborChange()</technical_language>

Target:
public void onBlockPlaced() { determineTrackMeta(); determineMirror(); ((RailcraftTileEntity)tileEntity).notifyBlocksOfNeighborChange(); }
Source:
<code>public List<VariantAnnotation> fetchAndCache(List<String> ids) throws ResourceMappingException { Map<String, VariantAnnotation> variantResponse = super.constructFetchedMap(ids); for (String variantId : variantResponse.keySet()) { if (variantResponse.get(variantId) == null) { VariantAnnotation variantAnnotation = new VariantAnnotation(variantId); variantResponse.put(variantId, variantAnnotation); } else { variantResponse.get(variantId).setSuccessfullyAnnotated(true); } } <START> List<VariantAnnotation> values = new ArrayList(); <END> for (String id : ids) { values.add(variantResponse.get(id)); } return values; }</code><technical_language>consistent other areas of code convert this for-block lambda representation? I preference way</technical_language>

Target:
public List<VariantAnnotation> fetchAndCache(List<String> ids) throws ResourceMappingException { Map<String, VariantAnnotation> variantResponse = this.constructFetchedMap(ids); for (String variantId : variantResponse.keySet()) { if (variantResponse.get(variantId) == null) { VariantAnnotation variantAnnotation = new VariantAnnotation(variantId); variantResponse.put(variantId, variantAnnotation); } else { variantResponse.get(variantId).setSuccessfullyAnnotated(true); } } List<VariantAnnotation> values = new ArrayList(); for (String id : ids) { values.add(variantResponse.get(id)); } return values; }
Source:
<code><START> protected static UiHttpSessionHelper getHttpSessionHelper() { <END> return HTTP_SESSION_HELPER.get(); }</code><technical_language>Name mismatch</technical_language>

Target:
protected static HttpSessionHelper getHttpSessionHelper() { return HTTP_SESSION_HELPER.get(); }
Source:
<code>private void verifyBloomFilter(boolean mightContain) { if (!mightContain) { filtedCount++; } else { unfiltedCount++; } <START> long now = System.currentTimeMillis(); <END> if (verifyBloomFilterBeginTime == 0) { verifyBloomFilterBeginTime = now; } else if (now - verifyBloomFilterBeginTime > verifyBloomFilterInterval) { if (unfiltedCount > filtedCount * 4) { unloadBloomFilter(); } else { filtedCount = unfiltedCount = 0; verifyBloomFilterBeginTime = now; } } }</code><technical_language>this introduce problems idempotency</technical_language>

Target:
private void verifyBloomFilter(boolean mightContain) { if (!mightContain) { filteredCount++; } else { unfilteredCount++; } if (unfilteredCount + filteredCount > STATISTICS_BARRIER_NUM && unfilteredCount > filteredCount * 4) { unloadBloomFilter(); } }
Source:
<code>public int hashCode() { return <START> commit.hashCode() + otherCommit.hashCode() + submitType.hashCode() + Boolean.valueOf(contentMerge).hashCode(); <END> }</code><technical_language>mixing hashcodes add values together. Objects.hashCode(commit, otherCommit, submitType, contentMerge)</technical_language>

Target:
public int hashCode() { return Objects.hashCode(commit, otherCommit, submitType, contentMerge); }
Source:
<code>private void recordFailure(final RuleResult result, final String match) { if (reportFailureCount == -1 || <START> result.getDetails().size() < reportFailureCount) { <END> final Map<String, Object> m = new LinkedHashMap<>(); m.put("sequence", match); result.setValid(false); result.getDetails().add(new RuleResultDetail(ERROR_CODE, m)); } }</code><technical_language>This condition is surprising. some confusion usage</technical_language>

Target:
private void recordFailure(final RuleResult result, final String match) { if (reportAllFailures || result.getDetails().size() == 0) { final Map<String, Object> m = new LinkedHashMap<>(); m.put("sequence", match); result.setValid(false); result.getDetails().add(new RuleResultDetail(ERROR_CODE, m)); } }
Source:
<code>public void testEvaluateUnknown() throws HiveException, IOException { RefererClassifierUDF udf = new RefererClassifierUDF(); <START> assertEquals("Unknown referer", udf.evaluate("foo"), "unknown"); <END> }</code><technical_language>E.g. compare this Webrequest.REFERRER_UNKNOWN hardcoding string</technical_language>

Target:
public void testEvaluateUnknown() throws HiveException, IOException { RefererClassifierUDF udf = new RefererClassifierUDF(); assertEquals("Unknown referer", udf.evaluate("foo"), Webrequest.REFERER_UNKNOWN); }
Source:
<code>public void votable(String label) { if (votable == null) { votable = new HashSet<String>(); } votable.add(label); <START> hasNonZero = 1; <END> }</code><technical_language>If a label is votable is a vote. I hasNonZero simply set in this method</technical_language>

Target:
public void votable(String label) { if (votable == null) { votable = new HashSet<String>(); } votable.add(label); }
Source:
<code>public List<Network> getAll() { try { Networks networks = getQuantumClient().execute(new ListNetworks()); return map(networks.getList()); } catch (RuntimeException e) { <START> throw new VdcBLLException(VdcBllErrors.ENGINE, new RuntimeException(e)); <END> } }</code><technical_language>wrapping thrown exception RuntimeException is redundant ? also, producing a specific error for this failure</technical_language>

Target:
public List<Network> getAll() { try { Networks networks = getQuantumClient().networks().list().execute(); return map(networks.getList()); } catch (RuntimeException e) { throw new VdcBLLException(VdcBllErrors.ENGINE, new RuntimeException(e)); } }
Source:
<code>public ResourceInfoPage openResourceInfoPage(String resourceNameToSearch) { wait.until(ExpectedConditions.visibilityOf(resourceName)); <START> action.doubleClick(driver.findElement(By.xpath("./ span[contains(text(),'" + <END> resourceNameToSearch + "')]"))); action.perform(); return new ResourceInfoPage(); }</code><technical_language>Follow Java conventions: number of characters for code line</technical_language>

Target:
public ResourceInfoPage openResourceInfoPage(String resourceNameToSearch) throws InterruptedException { waitForMaskDesappears(); WebElement resourceName = driver.findElement(By.xpath(" uiMethod.doubleClick(resourceName); return new ResourceInfoPage(); }
Source:
<code>public Entry<K, V> next() { <START> checkInvariants(); <END> if (hasNext()) { current = next; next = null; return current; } else { throw new NoSuchElementException(); } }</code><technical_language>remove this hasNext call checkInvariants</technical_language>

Target:
public Entry<K, V> next() { if (hasNext()) { current = next; next = null; return current; } else { throw new NoSuchElementException(); } }
Source:
<code>private void trim(LogFilePath srcPath, long startOffset) throws Exception { if (startOffset == srcPath.getOffset()) { return; } FileReader reader = null; FileWriter writer = null; LogFilePath dstPath = null; int copiedMessages = 0; mFileRegistry.deleteWriter(srcPath); try { reader = createReader(srcPath); <START> LogFilePathAttributes mFilePathAttributes = new LogFilePathAttributes(mConfig); <END> KeyValue keyVal; while ((keyVal = reader.next()) != null) { if (keyVal.getKey() >= startOffset) { if (writer == null) { String localPrefix = mConfig.getLocalPath() + '/' + IdUtil.getLocalMessageDir(); dstPath = new LogFilePath(localPrefix, srcPath.getTopic(), srcPath.getPartitions(), srcPath.getGeneration(), srcPath.getKafkaPartition(), startOffset, mFilePathAttributes.getLogFileExtension()); writer = mFileRegistry.getOrCreateWriter(dstPath, mFilePathAttributes.getCompressionCodec()); } writer.write(keyVal.getKey(), keyVal.getValue()); copiedMessages++; } } } finally { if (reader != null) { reader.close(); } } mFileRegistry.deletePath(srcPath); if (dstPath == null) { LOG.info("removed file " + srcPath.getLogFilePath()); } else { LOG.info("trimmed " + copiedMessages + " messages from " + srcPath.getLogFilePath() + " to " + dstPath.getLogFilePath() + " with start offset " + startOffset); } }</code><technical_language>This variable called filePathAttributes</technical_language>

Target:
private void trim(LogFilePath srcPath, long startOffset) throws Exception { if (startOffset == srcPath.getOffset()) { return; } FileReaderWriter reader = null; FileReaderWriter writer = null; LogFilePath dstPath = null; int copiedMessages = 0; mFileRegistry.deleteWriter(srcPath); try { CompressionCodec codec = null; String extension = ""; if (mConfig.getCompressionCodec() != null && !mConfig.getCompressionCodec().isEmpty()) { codec = CompressionUtil.createCompressionCodec(mConfig.getCompressionCodec()); extension = codec.getDefaultExtension(); } reader = createReader(srcPath, codec); KeyValue keyVal; while ((keyVal = reader.next()) != null) { if (keyVal.getKey() >= startOffset) { if (writer == null) { String localPrefix = mConfig.getLocalPath() + '/' + IdUtil.getLocalMessageDir(); dstPath = new LogFilePath(localPrefix, srcPath.getTopic(), srcPath.getPartitions(), srcPath.getGeneration(), srcPath.getKafkaPartition(), startOffset, extension); writer = mFileRegistry.getOrCreateWriter(dstPath, codec); } writer.write(keyVal); copiedMessages++; } } } finally { if (reader != null) { reader.close(); } } mFileRegistry.deletePath(srcPath); if (dstPath == null) { LOG.info("removed file " + srcPath.getLogFilePath()); } else { LOG.info("trimmed " + copiedMessages + " messages from " + srcPath.getLogFilePath() + " to " + dstPath.getLogFilePath() + " with start offset " + startOffset); } }
Source:
<code>public ConsumerGroupMetadata groupMetadata() { <START> return new ConsumerGroupMetadata(groupMetadata); <END> }</code><technical_language>want return a clone of groupMetadata? If declare fields final, update create a new ConsumerGroupMetadata object, I safely return cached object directly</technical_language>

Target:
public ConsumerGroupMetadata groupMetadata() { return groupMetadata; }
Source:
<code>public void start() throws Exception { <START> LOG.info("Starting split enumerator."); <END> enumerator.start(); started = true; }</code><technical_language>get name of source log lines? I tremendously helpful in cases multiple sources (which common)</technical_language>

Target:
public void start() throws Exception { LOG.info("Starting split enumerator for source {}.", operatorName); enumerator.start(); started = true; }
Source:
<code>protected void configure() { this.bind(Timer.StaticInterface.class).to(MockTimer.class); this.bind(WPIFactory.class).to(MockWPIFactory.class); this.bind(ITableProxy.class).to(TableProxy.class).in(Singleton.class); <START> if(this.useRealDatabaseForPropertyStorage) { <END> this.bind(PermanentStorage.class).to(OffRobotDatabaseStorage.class).in(Singleton.class); } else { this.bind(PermanentStorage.class).to(MockPermamentStorage.class).in(Singleton.class); } this.bind(SmartDashboardCommandPutter.class).to(MockSmartDashboardCommandPutter.class); this.bind(RobotAssertionManager.class).to(LoudRobotAssertionManager.class); }</code><technical_language>a variable store target class instead of duplicating rest of line</technical_language>

Target:
protected void configure() { this.bind(Timer.StaticInterface.class).to(MockTimer.class); this.bind(WPIFactory.class).to(MockWPIFactory.class); this.bind(ITableProxy.class).to(TableProxy.class).in(Singleton.class); Class<? extends PermanentStorage> permanentStorageClass = null; if(this.useRealDatabaseForPropertyStorage) { permanentStorageClass = OffRobotDatabaseStorage.class; } else { permanentStorageClass = MockPermamentStorage.class; } this.bind(PermanentStorage.class).to(permanentStorageClass).in(Singleton.class); this.bind(SmartDashboardCommandPutter.class).to(MockSmartDashboardCommandPutter.class); this.bind(RobotAssertionManager.class).to(LoudRobotAssertionManager.class); }
Source:
<code>public static void patch(String token, final Patch.Key id, final int patchIndex, final PatchSetDetail patchSetDetail, final PatchTable patchTable, final PatchScreen.TopView topView, final String panelType) { final String parametersUrl; <START> if (token.indexOf(DiffPatchScreen.URL_PARAMETER_MARK_START) != -1) { <END> parametersUrl = token.substring(token.indexOf(DiffPatchScreen.URL_PARAMETER_MARK_START)+1); token = token.substring(0, token.indexOf(DiffPatchScreen.URL_PARAMETER_MARK_START)); }else{ parametersUrl=null; } final PatchScreen.TopView top = topView == null ? Gerrit.getPatchScreenTopView() : topView; GWT.runAsync(new AsyncSplit(token) { public void onSuccess() { Gerrit.display(token, select()); } private Screen select() { if (id != null) { String panel = panelType; if (panel == null) { int c = token.lastIndexOf(','); panel = 0 <= c ? token.substring(c + 1) : ""; } if ("".equals(panel)) { return new PatchScreen.SideBySide( id, patchIndex, patchSetDetail, patchTable, top, parametersUrl ); } else if ("unified".equals(panel)) { return new PatchScreen.Unified( id, patchIndex, patchSetDetail, patchTable, top, parametersUrl ); } } return new NotFoundScreen(); } }); }</code><technical_language>I want query parameters for this. I approach is embed base in URL. For example this page's current URL is: <LINK_1> If comparing patch set 1 patch set 3 of this change, URL instead be: <LINK_0> turns out this is a very, ancient bug in Gerrit Code Review. I find stupid issue right now, is issue remember base patch set in URL, making impossible copy-and-paste URL a co-worker show diff at. In this change, diff pages change URL 1..3 syntax comparing patch set 1 patch set 3</technical_language>

Target:
public static void patch(String token, final Patch.Key id, final int patchIndex, final PatchSetDetail patchSetDetail, final PatchTable patchTable, final PatchScreen.TopView topView, final String panelType) { final PatchSet.Id baseId; if (token.contains(PatchLink.DIFF_WITH)) { String tailPart = token.substring(token.indexOf(PatchLink.DIFF_WITH) + 2); baseId = new PatchSet.Id(id.getParentKey().getParentKey(), Integer.valueOf( tailPart.substring(0, tailPart.indexOf("/"))).intValue()); } else { baseId = null; } final PatchScreen.TopView top = topView == null ? Gerrit.getPatchScreenTopView() : topView; GWT.runAsync(new AsyncSplit(token) { public void onSuccess() { Gerrit.display(token, select()); } private Screen select() { if (id != null) { String panel = panelType; if (panel == null) { int c = token.lastIndexOf(','); panel = 0 <= c ? token.substring(c + 1) : ""; } if ("".equals(panel)) { return new PatchScreen.SideBySide( id, patchIndex, patchSetDetail, patchTable, top, baseId ); } else if ("unified".equals(panel)) { return new PatchScreen.Unified( id, patchIndex, patchSetDetail, patchTable, top, baseId ); } } return new NotFoundScreen(); } }); }
Source:
<code>protected Disk addLinks(Disk model, Class<? extends BaseResource> suggestedParent, String... subCollectionMembersToExclude) { if (model.isSetQuota() && model.getQuota().isSetId()) { Quota quota = getEntity(Quota.class, QueryType.GetQuotaByQuotaId, new IdQueryParameters(asGuid(model.getQuota().getId())), <START> "quota"); <END> model.getQuota().setDataCenter(new DataCenter()); model.getQuota().getDataCenter().setId(quota.getStoragePoolId().toString()); } Disk disk = super.addLinks(model, suggestedParent, subCollectionMembersToExclude); if (disk.isSetStorageDomains()) { disk.getStorageDomains().getStorageDomains().forEach( storageDomain -> LinkHelper.addLinks(storageDomain, null, false) ); } return disk; }</code><technical_language>This string identifier of object. is a detail message in potential "not found" error</technical_language>

Target:
protected Disk addLinks(Disk model, Class<? extends BaseResource> suggestedParent, String... subCollectionMembersToExclude) { Disk disk = super.addLinks(model, suggestedParent, subCollectionMembersToExclude); if (disk.isSetStorageDomains()) { disk.getStorageDomains().getStorageDomains().forEach( storageDomain -> LinkHelper.addLinks(storageDomain, null, false) ); } return disk; }
Source:
<code>TimedAverageMetrics(int windowDataSize, long windowTimeSize) { <START> this(windowDataSize, windowTimeSize, System.nanoTime()); <END> }</code><technical_language>current time default time essentially values valid time window. aggregate zeros here. sense initialize this zero mark entries "outside of window" initially</technical_language>

Target:
TimedAverageMetrics(int windowDataSize, long windowTimeSize) { this(windowDataSize, windowTimeSize, System.nanoTime() - windowTimeSize - 1); }
Source:
<code>public static String getServiceCode(String handlerName) throws InvalidNameException { HashMap<String, String> diagnosticServices = new HashMap<String, String>(); <START> diagnosticServices.put("LaboratoryHandler", "LAB"); <END> diagnosticServices.put("RadiologyHandler", "RAD"); diagnosticServices.put("BloodBankHandler", "BLB"); diagnosticServices.put("CATScanHandler", "CT"); if (diagnosticServices.containsKey(handlerName)) { return diagnosticServices.get(handlerName); } else { throw new InvalidNameException( "<Handler Name should be one of 'Description' value in <LINK_0>> + Handler"); } }</code><technical_language>constants for strings</technical_language>

Target:
public static String getServiceCode(String handlerName) throws InvalidNameException { HashMap<String, String> diagnosticServices = new HashMap<String, String>(); diagnosticServices.put("DefaultDiagnosticReportHandler", "DEFAULT"); diagnosticServices.put("LaboratoryHandler", "LAB"); diagnosticServices.put("RadiologyHandler", "RAD"); diagnosticServices.put("BloodBankHandler", "BLB"); diagnosticServices.put("CATScanHandler", "CT"); if (diagnosticServices.containsKey(handlerName)) { return diagnosticServices.get(handlerName); } else { throw new InvalidNameException( "<Handler Name should be one of 'Description' value in <LINK_0>> + Handler"); } }
Source:
<code>private void adjustInputType(String currentText) { if (currentText != null && Pattern.matches("[+]\\d+", currentText)) { searchEditText.setInputType(InputType.TYPE_CLASS_PHONE); } else if (searchEditTextSpellcheck) { <START> searchEditText.setInputType(SPELLCHECK_ENABLED_TYPE); <END> } else { searchEditText.setInputType(InputType.TYPE_CLASS_TEXT); } }</code><technical_language>Ideally, this InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT; reuse static SPELLCHECK_ENABLED_TYPE</technical_language>

Target:
private void adjustInputType(String currentText) { int currentInputType = searchEditText.getInputType(); int requiredInputType; if (currentText != null && Pattern.matches("[+]\\d+", currentText)) { requiredInputType = InputType.TYPE_CLASS_PHONE; } else if (searchEditTextSpellcheck) { requiredInputType = SPELLCHECK_ENABLED_INPUT_TYPE; } else { requiredInputType = DEFAULT_INPUT_TYPE; } if (currentInputType != requiredInputType) { searchEditText.setInputType(requiredInputType); } }
Source:
<code>public void test_SystemProperties() { Properties originalProperties = System.getProperties(); <START> try { <END> Properties testProperties = new Properties(); testProperties.put("testIncInt", "notInt"); System.setProperties(testProperties); assertNull("returned incorrect default Integer", Integer.getInteger("testIncInt")); assertTrue("returned incorrect default Integer", Integer.getInteger("testIncInt", 4).equals(new Integer(4))); assertTrue("returned incorrect default Integer", Integer.getInteger( "testIncInt", new Integer(4)).equals(new Integer(4))); } finally { System.setProperties(originalProperties); } }</code><technical_language>is this test testing ?</technical_language>

Target:
public void test_SystemProperties() { Properties originalProperties = System.getProperties(); try { Properties testProperties = new Properties(); testProperties.put("testIncInt", "notInt"); System.setProperties(testProperties); assertNull("returned incorrect default Integer", Integer.getInteger("testIncInt")); assertEquals(Integer.getInteger("testIncInt", 4), new Integer(4)); assertEquals(Integer.getInteger("testIncInt", new Integer(4)), new Integer(4)); } finally { System.setProperties(originalProperties); } }
Source:
<code>public void eventThrowsBadException() { PublishSubject<String> stream = PublishSubject.create(); PublishSubject<String> lifecycle = PublishSubject.create(); TestObserver<String> testObserver = stream .compose(RxLifecycle.<String, String>bind(lifecycle, CORRESPONDING_EVENTS)) .test(); lifecycle.onNext("ick"); stream.onNext("1"); testObserver.assertNoValues(); <START> testObserver.assertError(CompositeException.class); <END> }</code><technical_language>assert this exception contains wanted in a order</technical_language>

Target:
public void eventThrowsBadException() { PublishSubject<String> stream = PublishSubject.create(); PublishSubject<String> lifecycle = PublishSubject.create(); TestObserver<String> testObserver = stream .compose(RxLifecycle.<String, String>bind(lifecycle, CORRESPONDING_EVENTS)) .test(); lifecycle.onNext("ick"); stream.onNext("1"); testObserver.assertNoValues(); testObserver.assertError(new Predicate<Throwable>() { @Override public boolean test(Throwable throwable) throws Exception { if (throwable instanceof CompositeException) { CompositeException ce = (CompositeException) throwable; for (Throwable t : ce.getExceptions()) { if (t instanceof IllegalArgumentException) { return true; } } } return false; } }); }
Source:
<code>public void factoryWithDirectUrlWithKeepDirectory() { String repositoryName = testRepo.getName(); testFactoryWithKeepDir.authenticateAndOpen(); theiaIde.switchToIdeFrame(); theiaIde.waitTheiaIde(); theiaIde.waitLoaderInvisibility(); <START> theiaIde.waitNotificationDisappearance("Che Workspace: Finished cloning projects."); <END> theiaIde.waitNotificationDisappearance( "Che Workspace: Finished cloning projects.", UPDATING_PROJECT_TIMEOUT_SEC); theiaProjectTree.waitFilesTab(); theiaProjectTree.clickOnFilesTab(); theiaProjectTree.waitProjectsRootItem(); theiaProjectTree.waitItem(repositoryName); theiaProjectTree.openItem(repositoryName + "/my-lib"); theiaProjectTree.waitItem(repositoryName + "/my-lib/src"); Assert.assertTrue(theiaProjectTree.isItemVisible(repositoryName + "/my-lib/pom.xml")); try { Assert.assertFalse(theiaProjectTree.isItemVisible(repositoryName + "/my-webapp")); } catch (AssertionError ex) { fail("Known permanent failure <LINK_0>"); } }</code><technical_language>duplicates next waitNotificationDisappearance()</technical_language>

Target:
public void factoryWithDirectUrlWithKeepDirectory() { String repositoryName = testRepo.getName(); testFactoryWithKeepDir.authenticateAndOpen(); theiaIde.switchToIdeFrame(); theiaIde.waitTheiaIde(); theiaIde.waitLoaderInvisibility(); theiaIde.waitNotificationDisappearance( "Che Workspace: Finished cloning projects.", UPDATING_PROJECT_TIMEOUT_SEC); theiaProjectTree.waitFilesTab(); theiaProjectTree.clickOnFilesTab(); theiaProjectTree.waitProjectsRootItem(); theiaProjectTree.waitItem(repositoryName); theiaProjectTree.openItem(repositoryName + "/my-lib"); theiaProjectTree.waitItem(repositoryName + "/my-lib/src"); Assert.assertTrue(theiaProjectTree.isItemVisible(repositoryName + "/my-lib/pom.xml")); try { Assert.assertFalse(theiaProjectTree.isItemVisible(repositoryName + "/my-webapp")); } catch (AssertionError ex) { fail("Known permanent failure <LINK_0>"); } }
Source:
<code>private void unlinkWebHook(final ReleaseWebHookResource resource) { if (resource == null) { <START> throw new InvalidParameterException("event parameter is null"); <END> } AbstractProject project = validateAndGetJenkinsProject(resource); String webHookNameToUnlink = resource.getWebHookName(); if (webHookNameToUnlink == null || webHookNameToUnlink.isEmpty()) { throw new InvalidParameterException("webhook name is empty"); } ReleaseWebHookAction action = getReleaseWebHookActionFromProject(project); if (action == null) { logger.fine(String.format("Cannot find ReleaseWebHook post build action")); return; } List<ReleaseWebHookName> webHookNames = action.getWebHookNames(); for (ReleaseWebHookName webHookName : webHookNames) { if (webHookName.getWebHookName().equalsIgnoreCase(webHookNameToUnlink)) { logger.fine(String.format("Found webhook %s in project %s. Removing it", webHookNameToUnlink, project.getName())); webHookNames.remove(webHookName); if (webHookNames.isEmpty()) { logger.fine(String.format("ReleaseWebHook post build action is empty, removing the post build action from project")); DescribableList<Publisher, Descriptor<Publisher>> publishersList = project.getPublishersList(); publishersList.remove(action); } saveProject(project); return; } } logger.fine(String.format("Cannnot find webhook with the name %s in project %s", webHookNameToUnlink, project.getName())); }</code><technical_language>fix message</technical_language>

Target:
private void unlinkWebHook(final ReleaseWebHookResource resource) { if (resource == null) { throw new InvalidParameterException("resource is null"); } AbstractProject project = validateAndGetJenkinsProject(resource); String webHookNameToUnlink = resource.getWebHookName(); if (StringUtils.isBlank(webHookNameToUnlink)) { throw new InvalidParameterException("webhook name is empty"); } ReleaseWebHookAction action = getReleaseWebHookActionFromProject(project); if (action == null) { logger.fine(String.format("Cannot find ReleaseWebHook post build action")); return; } List<ReleaseWebHookReference> webHookReferences = action.getWebHookReferences(); for (ReleaseWebHookReference webHookReference : webHookReferences) { if (webHookReference.getWebHookName().equalsIgnoreCase(webHookNameToUnlink)) { logger.fine(String.format("Found webhook %s in project %s. Removing it", webHookNameToUnlink, project.getName())); webHookReferences.remove(webHookReference); if (webHookReferences.isEmpty()) { logger.fine(String.format("ReleaseWebHook post build action is empty, removing the post build action from project")); DescribableList<Publisher, Descriptor<Publisher>> publishersList = project.getPublishersList(); publishersList.remove(action); } saveProject(project); return; } } logger.fine(String.format("Cannnot find webhook with the name %s in project %s", webHookNameToUnlink, project.getName())); }
Source:
<code>public void testDefaultWithContext() { Context.CancellableContext context = Context.current().withDeadlineAfter(1, TimeUnit.SECONDS, mockExecutor); context.run(new Runnable() { @Override public void run() { CallOptionsFactory factory = new CallOptionsFactory.Default(); Assert.assertEquals( Context.current().getDeadline().timeRemaining(TimeUnit.MILLISECONDS), getDeadlineMs(factory, null), <START> 100.0 <END> ); } }); }</code><technical_language>Cast int instead? 100.0 delta big</technical_language>

Target:
public void testDefaultWithContext() { final Deadline deadline = DeadlineUtil.deadlineWithFixedTime(1, TimeUnit.SECONDS, NOW); Context.CancellableContext context = Context.current().withDeadline(deadline, mockExecutor); context.run(new Runnable() { @Override public void run() { CallOptionsFactory factory = new CallOptionsFactory.Default(); assertEqualsDeadlines( deadline.timeRemaining(TimeUnit.MILLISECONDS), getDeadlineMs(factory, null) ); } }); }
Source:
<code>public RawPacket reverseTransform(RawPacket pkt) { <START> if (enabled && !closed && pkt != null && pkt.getVersion() == 2) <END> { incomingRawPacketCache.cachePacket(pkt); } return pkt; }</code><technical_language>get rid of checks for pkt if RTPPacketPredicate</technical_language>

Target:
public RawPacket reverseTransform(RawPacket pkt) { if (enabled && !closed) { incomingRawPacketCache.cachePacket(pkt); } return pkt; }
Source:
<code>public void setRuleParam(String ruleKey, String paramName, String paramValue) { <START> if (!rules.containsKey(ruleKey)) { <END> rules.put(ruleKey, new Rule(true)); } rules.get(ruleKey).params.put(paramName, paramValue); }</code><technical_language>computeIfAbsent</technical_language>

Target:
public void setRuleParam(String ruleKey, String paramName, String paramValue) { rules.computeIfAbsent(ruleKey, s -> new Rule(true)); rules.get(ruleKey).params.put(paramName, paramValue); }
Source:
<code><START> public Set<Map.Entry<Long, Long>> multiGet(StoreNamespace storeNamespace, List<Long> keys) { <END> Preconditions.checkArgument( availableColumnFamilies.containsKey(storeNamespace.uniqueName()), "Store namespace does not exist"); List<byte[]> byteKeys = keys.stream() .map(ValueType.VAR_LONG::convertFromJava) .collect(Collectors.toList()); List<byte[]> byteValues = multiGetValueBytes( availableColumnFamilies.get(storeNamespace.uniqueName()), byteKeys); if (byteValues.isEmpty()) { return ImmutableSet.of(); } return KeyedStream.ofEntries( Streams.zip( keys.stream(), byteValues.stream(), (key, value) -> { if (value == null) { return Maps.immutableEntry(key, null); } return Maps.immutableEntry( key, key + (Long) ValueType.VAR_LONG.convertToJava(value, 0)); })) .collectToMap() .entrySet(); }</code><technical_language>enough return Map<Long, Long></technical_language>

Target:
public Map<Long, Long> multiGet(StoreNamespace storeNamespace, List<Long> keys) { checkNamespaceExists(storeNamespace); List<byte[]> byteKeys = keys.stream() .map(ValueType.VAR_LONG::convertFromJava) .collect(Collectors.toList()); List<byte[]> byteValues = multiGetValueBytes( availableColumnFamilies.get(storeNamespace.uniqueName()), byteKeys); if (byteValues.isEmpty()) { return ImmutableMap.of(); } return KeyedStream.ofEntries( Streams.zip( keys.stream(), byteValues.stream(), (key, value) -> Maps.immutableEntry(key, deserializeValue(key, value)))) .filter(Objects::nonNull) .collectToMap(); }
Source:
<code>protected AbstractRemoteFileStreamingMessageSource(RemoteFileTemplate<F> template, Comparator<AbstractFileInfo<F>> comparator) { this.remoteFileTemplate = template; this.comparator = comparator; if (JacksonJsonUtils.isJackson2Present()) { <START> this.objectMapper = JsonObjectMapperProvider.newInstanceBuilder(false).build(); <END> } else { this.objectMapper = null; } }</code><technical_language>So, if is jackson, is boon fail the: > jackson-databind.jar, boon.jar of: else if (boonPresent) { return new BoonJsonObjectMapperBuilder(); } else { throw new IllegalStateException("Neither jackson-databind.jar, boon.jar is present in classpath."); } approach FileSplitter work here? JsonObjectMapperProvider.jsonAvailable() ? JsonObjectMapperProvider.newInstance() : null; In other words fallback boon if present jackson</technical_language>

Target:
protected AbstractRemoteFileStreamingMessageSource(RemoteFileTemplate<F> template, Comparator<AbstractFileInfo<F>> comparator) { this.remoteFileTemplate = template; this.comparator = comparator; }
Source:
<code>private List<DataObject> getSeason(final SeasonProfile seasonProfile) throws IOException { final List<DataObject> seasonElements = new ArrayList<>(); <START> seasonProfile.getSeasonProfileName(); <END> seasonProfile.getSeasonStart(); seasonProfile.getWeekProfile().getWeekProfileName(); final DataObject seasonProfileNameObject = DataObject.newOctetStringData(seasonProfile.getSeasonProfileName() .getBytes(StandardCharsets.UTF_8)); seasonElements.add(seasonProfileNameObject); final DateTime dt = new DateTime(seasonProfile.getSeasonStart()); final DataObject seasonStartObject = this.dlmsHelperService.asDataObject(dt); seasonElements.add(seasonStartObject); final DataObject seasonWeekProfileNameObject = DataObject.newOctetStringData(seasonProfile.getWeekProfile() .getWeekProfileName().getBytes(StandardCharsets.UTF_8)); seasonElements.add(seasonWeekProfileNameObject); return seasonElements; }</code><technical_language>return values of calls used. calls needed</technical_language>

Target:
private List<DataObject> getSeason(final SeasonProfile seasonProfile) throws IOException { final List<DataObject> seasonElements = new ArrayList<>(); final DataObject seasonProfileNameObject = DataObject.newOctetStringData(seasonProfile.getSeasonProfileName() .getBytes(StandardCharsets.UTF_8)); seasonElements.add(seasonProfileNameObject); final DateTime dt = new DateTime(seasonProfile.getSeasonStart()); final DataObject seasonStartObject = this.dlmsHelperService.asDataObject(dt); seasonElements.add(seasonStartObject); final DataObject seasonWeekProfileNameObject = DataObject.newOctetStringData(seasonProfile.getWeekProfile() .getWeekProfileName().getBytes(StandardCharsets.UTF_8)); seasonElements.add(seasonWeekProfileNameObject); return seasonElements; }
Source:
<code>public void forArgsGeneratorTest() { List<Double> outputValues = new ArrayList<Double>(); <START> class Output { <END> List<Double> inputValues = new ArrayList<Double>(); int i; Output() { inputValues = Stream .iterate(10.0, last -> last - Double.valueOf(1)) .limit(10) .collect(Collectors.toList()); Collections.sort(inputValues); i = 0; } } final Output output = new Output(); batcher = caller .batcher() .forArgsGenerator(result -> (result == null || output.i<output.inputValues.size()) ? caller.args().param("param1", output.inputValues.get(output.i)) : null) .onCallSuccess(event -> { output.i+= 1; outputValues.add(event.getItem()); }) .onCallFailure((event, throwable) -> throwable.printStackTrace()); batcher.startJob(); batcher.awaitCompletion(); batcher.stopJob(); Collections.sort(outputValues); assertEquals("forArgsGenerator input not equal to output.", outputValues, output.inputValues); }</code><technical_language>Is Output class necessary? assign inputValues,size() a final variable</technical_language>

Target:
public void forArgsGeneratorTest() { List<Double> outputValues = new ArrayList<Double>(); final List<Double> inputValues = Stream .iterate(10.0, last -> last - Double.valueOf(1)) .limit(10) .collect(Collectors.toList()); Collections.sort(inputValues); class Output { int i = 0; } final Output output = new Output(); batcher = caller .batcher() .forArgsGenerator(result -> (result == null || output.i<inputValues.size()) ? caller.args().param("param1", inputValues.get(output.i)) : null) .onCallSuccess(event -> { output.i+= 1; outputValues.add(event.getItem()); }) .onCallFailure((event, throwable) -> throwable.printStackTrace()); batcher.startJob(); batcher.awaitCompletion(); batcher.stopJob(); Collections.sort(outputValues); assertEquals("forArgsGenerator input not equal to output.", outputValues, inputValues); }
Source:
<code>public Abbreviation(String name, String abbreviation) { <START> this(name, abbreviation, StringUtils.EMPTY); <END> }</code><technical_language>oh, this form apache. jsut ust "" if is readable</technical_language>

Target:
public Abbreviation(String name, String abbreviation) { this(name, abbreviation, StringUtil.EMPTY); }
Source:
<code>private void close(final boolean clean) { if (state() == State.CREATED) { transitionTo(State.CLOSING); } else { if (state() == State.RUNNING) { closeTopology(clean); if (clean) { commitState(); stateMgr.checkpoint(checkpointableOffsets()); } else { executeAndMaybeSwallow(false, stateMgr::flush, "state manager flush"); } transitionTo(State.CLOSING); } else if (state() == State.RESTORING) { executeAndMaybeSwallow(clean, () -> { stateMgr.flush(); stateMgr.checkpoint(Collections.emptyMap()); }, "state manager flush and checkpoint"); transitionTo(State.CLOSING); } else if (state() == State.SUSPENDED) { transitionTo(State.CLOSING); } if (state() == State.CLOSING) { if (!clean && !eosDisabled) { StateManagerUtil.wipeStateStores(log, stateMgr); } <START> StateManagerUtil.closeStateManager(log, logPrefix, clean, stateMgr, stateDirectory); <END> executeAndMaybeSwallow(clean, recordCollector::close, "record collector close"); } else { throw new IllegalStateException("Illegal state " + state() + " while closing active task " + id); } } partitionGroup.close(); closeTaskSensor.record(); transitionTo(State.CLOSED); }</code><technical_language>Is wipe out directory closing state manager, in flush stores close them? exception thrown</technical_language>

Target:
private void close(final boolean clean) { if (state() == State.CREATED) { transitionTo(State.CLOSING); } else { if (state() == State.RUNNING) { closeTopology(clean); if (clean) { commitState(); stateMgr.checkpoint(checkpointableOffsets()); } else { executeAndMaybeSwallow(false, stateMgr::flush, "state manager flush"); } transitionTo(State.CLOSING); } else if (state() == State.RESTORING) { executeAndMaybeSwallow(clean, () -> { stateMgr.flush(); stateMgr.checkpoint(Collections.emptyMap()); }, "state manager flush and checkpoint"); transitionTo(State.CLOSING); } else if (state() == State.SUSPENDED) { transitionTo(State.CLOSING); } if (state() == State.CLOSING) { final boolean wipeStateStore = !clean && !eosDisabled; StateManagerUtil.closeStateManager(log, logPrefix, clean, wipeStateStore, stateMgr, stateDirectory, TaskType.ACTIVE); executeAndMaybeSwallow(clean, recordCollector::close, "record collector close"); } else { throw new IllegalStateException("Illegal state " + state() + " while closing active task " + id); } } partitionGroup.close(); closeTaskSensor.record(); transitionTo(State.CLOSED); }
Source:
<code>private static AtlasDbRuntimeConfigRefreshable createPolling(Supplier<Optional<AtlasDbRuntimeConfig>> config) { DefaultRefreshable<Optional<AtlasDbRuntimeConfig>> refreshable = new DefaultRefreshable<>(call(config)); ScheduledExecutorService executor = PTExecutors.newSingleThreadScheduledExecutor(); executor.scheduleWithFixedDelay( () -> { try { refreshable.update(config.get()); } catch (Throwable e) { log.error("Failed to reload runtime config", e); } }, REFRESH_INTERVAL.toNanos(), REFRESH_INTERVAL.toNanos(), TimeUnit.NANOSECONDS); return new AtlasDbRuntimeConfigRefreshable(refreshable, () -> { if (!MoreExecutors.shutdownAndAwaitTermination( executor, GRACEFUL_SHUTDOWN.toMillis(), TimeUnit.MILLISECONDS)) { <START> log.error("Executor did not terminate within graceful shutdown duration"); <END> } }); }</code><technical_language>nit: prefer warn, this is super actionable for us</technical_language>

Target:
private static AtlasDbRuntimeConfigRefreshable createPolling(Supplier<Optional<AtlasDbRuntimeConfig>> config) { DefaultRefreshable<Optional<AtlasDbRuntimeConfig>> refreshable = new DefaultRefreshable<>(call(config)); ScheduledExecutorService executor = PTExecutors.newSingleThreadScheduledExecutor(); executor.scheduleWithFixedDelay( () -> { try { refreshable.update(config.get()); } catch (Throwable e) { log.error("Failed to reload runtime config", e); } }, REFRESH_INTERVAL.toNanos(), REFRESH_INTERVAL.toNanos(), TimeUnit.NANOSECONDS); return new AtlasDbRuntimeConfigRefreshable(refreshable, () -> { if (!MoreExecutors.shutdownAndAwaitTermination( executor, GRACEFUL_SHUTDOWN.toMillis(), TimeUnit.MILLISECONDS)) { log.warn("Executor did not terminate within graceful shutdown duration"); } }); }
Source:
<code>private void setupTestsFiltering(TestNG testNG) { if (!options.getTestGroups().isEmpty()) { <START> System.setProperty(TestNameGroupNameMethodSelector.TEST_GROUPS_TO_RUN_PROPERTY, Joiner.on(',').join(options.getTestGroups())); <END> } if (!options.getExcludeGroups().isEmpty()) { System.setProperty(TestNameGroupNameMethodSelector.TEST_GROUPS_TO_EXCLUDE_PROPERTY, Joiner.on(',').join(options.getExcludeGroups())); } if (!options.getTests().isEmpty()) { System.setProperty(TestNameGroupNameMethodSelector.TEST_NAMES_TO_RUN_PROPERTY, Joiner.on(',').join(options.getTests())); } testNG.addMethodSelector("com.teradata.tempto.internal.listeners.TestNameGroupNameMethodSelector", 20); }</code><technical_language>static import</technical_language>

Target:
private void setupTestsFiltering(TestNG testNG) { if (!options.getTestGroups().isEmpty()) { System.setProperty(TEST_GROUPS_TO_RUN_PROPERTY, Joiner.on(',').join(options.getTestGroups())); } if (!options.getExcludeGroups().isEmpty()) { System.setProperty(TEST_GROUPS_TO_EXCLUDE_PROPERTY, Joiner.on(',').join(options.getExcludeGroups())); } if (!options.getTests().isEmpty()) { System.setProperty(TEST_NAMES_TO_RUN_PROPERTY, Joiner.on(',').join(options.getTests())); } testNG.addMethodSelector(METHOD_SELECTOR_CLASS_NAME, METHOD_SELECTOR_PRIORITY); }
Source:
<code>public List<Composition> searchEncounterComposition(String id) { org.openmrs.Encounter omrsEncounter = Context.getEncounterService().getEncounterByUuid(id); List<Composition> encounterList = new ArrayList<Composition>(); if (omrsEncounter != null) { try { encounterList.add(FHIREncounterUtil.generateComposition(omrsEncounter)); } catch (FHIRException e) { <START> String msg = "Error while searching the encounter composition"; <END> log.error(msg, e); } } return encounterList; }</code><technical_language>move this a constant</technical_language>

Target:
public List<Composition> searchEncounterComposition(String id) { org.openmrs.Encounter omrsEncounter = Context.getEncounterService().getEncounterByUuid(id); List<Composition> encounterList = new ArrayList<Composition>(); if (omrsEncounter != null) { try { encounterList.add(FHIREncounterUtil.generateComposition(omrsEncounter)); } catch (FHIRException e) { String msg = "Error while searching the encounter composition with id " + id; log.error(msg, e); } } return encounterList; }
Source:
<code>public Session start(String deviceUUID) { checkNotNull(deviceUUID, "deviceUUID parameter must not be null"); checkArgument(!deviceUUID.trim().isEmpty(), "deviceUUID must not be empty"); String url = "/sync/start"; Response response = this.httpClient.request(HttpMethod.POST, url, null, buildHeaders(deviceUUID), null); <START> if (response.getHttpStatus() == 204) { <END> log.info("Received 204 from sync start. Nothing to fetch."); return null; } final Session session = SessionDeserializer.deserialize(JsonDeserializer.deserializeRaw(response.getBody())); if (session != null) { log.info("Started sync process with pending queues: {}", session.getQueues()); } else { log.warn("Sync process will not be started due to missing session data: {}", response); } return session; }</code><technical_language>Lets define 204 (as const existing mapping classpath if exists)</technical_language>

Target:
public Session start(String deviceUUID) { checkNotNull(deviceUUID, "deviceUUID parameter must not be null"); checkArgument(!deviceUUID.trim().isEmpty(), "deviceUUID must not be empty"); String url = "/sync/start"; Response response = this.httpClient.request(HttpMethod.POST, url, null, buildHeaders(deviceUUID), null); if (noConent(response)) { log.info("Received 204 from sync start. Nothing to fetch."); return null; } final Session session = SessionDeserializer.deserialize(JsonDeserializer.deserializeRaw(response.getBody())); if (session != null) { log.info("Started sync process with pending queues: {}", session.getQueues()); } else { log.warn("Sync process will not be started due to missing session data: {}", response); } return session; }