auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private static IEditorDescriptor getEditorDescriptor(String name, IEditorRegistry editorReg, IEditorDescriptor defaultDescriptor, boolean allowInteractive) throws PartInitException, OperationCanceledException { if (defaultDescriptor != null) { return defaultDescriptor; } IUnknownEditorStrategy strategy = null; if (allowInteractive ) { strategy = <START> getUnknowEditorStrategy(); <END> } else { strategy = new SystemEditorOrTextEditorStrategy(); } IEditorDescriptor editorDesc; try { editorDesc = strategy.getEditorDescriptor(name, editorReg); } catch (CoreException e) { throw new PartInitException(IDEWorkbenchMessages.IDE_noFileEditorFound, e); } if (editorDesc == null) { throw new PartInitException( IDEWorkbenchMessages.IDE_noFileEditorFound); } return editorDesc; }</code><technical_language>I add logic introduce new boolean flag strategy interface: isInteractive() (don't is a TODO in patch here). I allowInteractive flag call getUnknownEditorStrategy(), if configured strategy is interactive, select SystemEditorOrTextEditor. line 1176: if(res == null || (!allowInteractive && res.isInteractive())) { res = new SystemEditorOrTextEditor(); }</technical_language>

Target:
private static IEditorDescriptor getEditorDescriptor(String name, IEditorRegistry editorReg, IEditorDescriptor defaultDescriptor, boolean allowInteractive) throws PartInitException, OperationCanceledException { if (defaultDescriptor != null) { return defaultDescriptor; } IUnknownEditorStrategy strategy = getUnknowEditorStrategy(allowInteractive); if (strategy == null) { strategy = new SystemEditorOrTextEditorStrategy(); } IEditorDescriptor editorDesc; try { editorDesc = strategy.getEditorDescriptor(name, editorReg); } catch (CoreException e) { throw new PartInitException(IDEWorkbenchMessages.IDE_noFileEditorFound, e); } if (editorDesc == null) { throw new PartInitException( IDEWorkbenchMessages.IDE_noFileEditorFound); } return editorDesc; }
Source:
<code><START> public static SmartSyncSDKManager getInstance() { <END> if (INSTANCE != null) { SalesforceSDKManager.getInstance().registerUsedAppFeature(FEATURE_SMART_SYNC); return (SmartSyncSDKManager) INSTANCE; } else { throw new RuntimeException("Applications need to call SmartSyncSDKManager.init() first."); } }</code><technical_language>app compiled smartstore/smartsync SmartSyncSDKManager. Instead set flag SyncManager.java getInstance</technical_language>

Target:
public static SmartSyncSDKManager getInstance() { if (INSTANCE != null) { return (SmartSyncSDKManager) INSTANCE; } else { throw new RuntimeException("Applications need to call SmartSyncSDKManager.init() first."); } }
Source:
<code>public void testSameDiff() throws Exception { write(new File(db.getDirectory().getParent(), "test.txt"), "test"); File folder = new File(db.getDirectory().getParent(), "folder"); folder.mkdir(); write(new File(folder, "folder.txt"), "\n\n\n\nfolder"); Git git = new Git(db); git.add().addFilepattern(".").call(); git.commit().setMessage("Initial commit").call(); write(new File(folder, "folder.txt"), "\n\n\n\nfolder change"); PatchIdDiffFormatter df = new PatchIdDiffFormatter(); df.setRepository(db); df.setPathFilter(PathFilter.create("folder")); DirCacheIterator oldTree = new DirCacheIterator(db.readDirCache()); FileTreeIterator newTree = new FileTreeIterator(db); df.format(oldTree, newTree); df.flush(); assertEquals("AnyObjectId[08fca5ac531383eb1da8bf6b6f7cf44411281407]", <START> df.getCalulatedPatchId().toString()); <END> write(new File(folder, "folder.txt"), "a\n\n\n\nfolder"); git.add().addFilepattern(".").call(); git.commit().setMessage("Initial commit").call(); write(new File(folder, "folder.txt"), "a\n\n\n\nfolder change"); df = new PatchIdDiffFormatter(); df.setRepository(db); df.setPathFilter(PathFilter.create("folder")); oldTree = new DirCacheIterator(db.readDirCache()); newTree = new FileTreeIterator(db); df.format(oldTree, newTree); df.flush(); assertEquals("AnyObjectId[08fca5ac531383eb1da8bf6b6f7cf44411281407]", df.getCalulatedPatchId().toString()); }</code><technical_language>Again, .name()</technical_language>

Target:
public void testSameDiff() throws Exception { write(new File(db.getDirectory().getParent(), "test.txt"), "test"); File folder = new File(db.getDirectory().getParent(), "folder"); folder.mkdir(); write(new File(folder, "folder.txt"), "\n\n\n\nfolder"); Git git = new Git(db); git.add().addFilepattern(".").call(); git.commit().setMessage("Initial commit").call(); write(new File(folder, "folder.txt"), "\n\n\n\nfolder change"); PatchIdDiffFormatter df = new PatchIdDiffFormatter(); df.setRepository(db); df.setPathFilter(PathFilter.create("folder")); DirCacheIterator oldTree = new DirCacheIterator(db.readDirCache()); FileTreeIterator newTree = new FileTreeIterator(db); df.format(oldTree, newTree); df.flush(); assertEquals("08fca5ac531383eb1da8bf6b6f7cf44411281407", df .getCalulatedPatchId().name()); write(new File(folder, "folder.txt"), "a\n\n\n\nfolder"); git.add().addFilepattern(".").call(); git.commit().setMessage("Initial commit").call(); write(new File(folder, "folder.txt"), "a\n\n\n\nfolder change"); df = new PatchIdDiffFormatter(); df.setRepository(db); df.setPathFilter(PathFilter.create("folder")); oldTree = new DirCacheIterator(db.readDirCache()); newTree = new FileTreeIterator(db); df.format(oldTree, newTree); df.flush(); assertEquals("08fca5ac531383eb1da8bf6b6f7cf44411281407", df .getCalulatedPatchId().name()); }
Source:
<code>public void testnameEqualsWhenEqual() { <START> assertTrue(nameEquals("jclouds").apply(ref)); <END> }</code><technical_language>give more overview in logs? E.g. assertTrue(nameEquals("jclouds").apply(ref), "Expected 'jclouds' name of " + ref);</technical_language>

Target:
public void testnameEqualsWhenEqual() { assertTrue(nameEquals("jclouds").apply(ref), "expected 'jclouds' as the name of " + ref); }
Source:
<code>protected ApiRequest validateLaunchConfigs(Service service, ApiRequest request) { Map<String, Object> data = CollectionUtils.toMap(request.getRequestObject()); List<Object> modifiedSlcs = new ArrayList<>(); if (data.get(ServiceConstants.FIELD_SECONDARY_LAUNCH_CONFIGS) != null) { List<Object> slcs = (List<Object>) data.get(ServiceConstants.FIELD_SECONDARY_LAUNCH_CONFIGS); for (Object slcObj : slcs) { Map<String, Object> slc = (Map<String, Object>) slcObj; <START> slc.put(InstanceConstants.FIELD_NETWORK_MODE, NetworkConstants.NETWORK_MODE_CONTAINER); <END> slc.put(InstanceConstants.FIELD_NETWORK_CONTAINER_ID, service.getName()); modifiedSlcs.add(slc); } data.put(ServiceConstants.FIELD_SECONDARY_LAUNCH_CONFIGS, modifiedSlcs); request.setRequestObject(data); } Object newName = data.get("name"); String serviceName = newName != null ? newName.toString() : service.getName(); List<Map<String, Object>> launchConfigs = populateLaunchConfigs(service, request); validateLaunchConfigNames(service, serviceName, launchConfigs); validateLaunchConfigsCircularRefs(service, serviceName, launchConfigs); validateScale(service, request); return request; }</code><technical_language>network mode needs set host if primary is set host none. Also, primary "--net=container". Additionally need validate standalone container. in a PR</technical_language>

Target:
protected void validateLaunchConfigs(Service service, ApiRequest request) { Map<String, Object> data = CollectionUtils.toMap(request.getRequestObject()); Object newName = data.get("name"); String serviceName = newName != null ? newName.toString() : service.getName(); List<Map<String, Object>> launchConfigs = populateLaunchConfigs(service, request); validateLaunchConfigNames(service, serviceName, launchConfigs); validateLaunchConfigsCircularRefs(service, serviceName, launchConfigs); validateScale(service, request); }
Source:
<code>public int hashCode() { <START> return Objects.hash(id, status, savepoint, triggerTimestamp, latestAckTimestamp, stateSize, duration, alignmentBuffered, numSubtasks, numAckSubtasks, checkPointType, checkpointStatisticsPerTask); <END> }</code><technical_language>suggestion return Objects.hash(id, status, savepoint, triggerTimestamp, latestAckTimestamp, stateSize, duration, alignmentBuffered, numSubtasks, numAckSubtasks, checkpointType, checkpointStatisticsPerTask);</technical_language>

Target:
public int hashCode() { return Objects.hash( id, status, savepoint, triggerTimestamp, latestAckTimestamp, stateSize, duration, alignmentBuffered, processedData, persistedData, numSubtasks, numAckSubtasks, checkpointType, checkpointStatisticsPerTask); }
Source:
<code>protected void assertSameLastUpdateTime() { assertTrueEventually(() -> { <START> long lastUpdateTime = localCollectionStats.getLastUpdateTime(); <END> assertEqualsStringFormat("Expected the lastUpdateTime to be %d, but was %d", previousUpdateTime, lastUpdateTime); previousUpdateTime = lastUpdateTime; }); }</code><technical_language>Do need assertTrueEventually() in methods? In concrete tests a reference is obtained stats instance, means, time operations return stats instance is updated</technical_language>

Target:
protected void assertSameLastUpdateTime() { long lastUpdateTime = localCollectionStats.getLastUpdateTime(); assertEqualsStringFormat("Expected the lastUpdateTime to be %d, but was %d", previousUpdateTime, lastUpdateTime); previousUpdateTime = lastUpdateTime; }
Source:
<code>private static void expectedCounts( List<Metacard> metacards, int total, int queryTemplates, int resultTemplates) { assertThat( <START> "Expected total number of generated metacards to be " + total, metacards.size(), is(total)); <END> assertThat( "Expected number of generated query template metacards to be " + queryTemplates, metacards.stream().filter(QueryTemplateMetacardImpl::isQueryTemplateMetacard).count(), is((long) queryTemplates)); assertThat( "Expected number of generated result template metacards to be " + resultTemplates, metacards.stream().filter(ResultTemplateMetacardImpl::isResultTemplateMetacard).count(), is((long) resultTemplates)); }</code><technical_language>hasSize</technical_language>

Target:
private static void expectedCounts( List<Metacard> metacards, int total, int queryTemplates, int resultTemplates) { assertThat( "Expected total number of generated metacards to be " + total, metacards, hasSize(total)); assertThat( "Expected number of generated query template metacards to be " + queryTemplates, metacards.stream().filter(QueryTemplateMetacard::isQueryTemplateMetacard).count(), is((long) queryTemplates)); assertThat( "Expected number of generated result template metacards to be " + resultTemplates, metacards.stream().filter(AttributeGroupMetacard::isAttributeGroupMetacard).count(), is((long) resultTemplates)); }
Source:
<code>private void generateDeepLinkLoader(List<DeepLinkAnnotatedElement> elements) throws IOException { <START> MethodSpec.Builder loadMethod = MethodSpec.methodBuilder("load") <END> .returns(void.class); FieldSpec registry = FieldSpec .builder(ParameterizedTypeName.get(List.class, DeepLinkEntry.class), "registry", Modifier.PRIVATE, Modifier.FINAL) .initializer("new $T<>()", TypeName.get(LinkedList.class)) .build(); for (DeepLinkAnnotatedElement element : elements) { String type = "DeepLinkEntry.Type." + element.getAnnotationType().toString(); ClassName activity = ClassName.bestGuess(element.getActivity()); Object method = element.getMethod() == null ? null : element.getMethod(); String uri = element.getUri(); loadMethod.addStatement("registry.add(new DeepLinkEntry($S, $L, $T.class, $S))", uri, type, activity, method); } MethodSpec parseMethod = MethodSpec.methodBuilder("parseUri") .addParameter(String.class, "uri") .returns(DeepLinkEntry.class) .beginControlFlow("for (DeepLinkEntry entry : registry)") .beginControlFlow("if (entry.matches(uri))") .addStatement("return entry") .endControlFlow() .endControlFlow() .addStatement("return null") .build(); TypeSpec deepLinkLoader = TypeSpec.classBuilder("DeepLinkLoader") .addModifiers(Modifier.PUBLIC, Modifier.FINAL) .addField(registry) .addMethod(loadMethod.build()) .addMethod(parseMethod) .build(); JavaFile.builder("com.airbnb.deeplinkdispatch", deepLinkLoader) .build() .writeTo(filer); }</code><technical_language>Move this right for loop 132 relevant localized other</technical_language>

Target:
private void generateDeepLinkLoader(List<DeepLinkAnnotatedElement> elements) throws IOException { FieldSpec registry = FieldSpec .builder(ParameterizedTypeName.get(List.class, DeepLinkEntry.class), "registry", Modifier.PRIVATE, Modifier.FINAL) .initializer("new $T<>()", TypeName.get(LinkedList.class)) .build(); MethodSpec.Builder loadMethod = MethodSpec.methodBuilder("load") .returns(void.class); for (DeepLinkAnnotatedElement element : elements) { String type = "DeepLinkEntry.Type." + element.getAnnotationType().toString(); ClassName activity = ClassName.bestGuess(element.getActivity()); Object method = element.getMethod() == null ? null : element.getMethod(); String uri = element.getUri(); loadMethod.addStatement("registry.add(new DeepLinkEntry($S, $L, $T.class, $S))", uri, type, activity, method); } MethodSpec parseMethod = MethodSpec.methodBuilder("parseUri") .addParameter(String.class, "uri") .returns(DeepLinkEntry.class) .beginControlFlow("for (DeepLinkEntry entry : registry)") .beginControlFlow("if (entry.matches(uri))") .addStatement("return entry") .endControlFlow() .endControlFlow() .addStatement("return null") .build(); TypeSpec deepLinkLoader = TypeSpec.classBuilder("DeepLinkLoader") .addModifiers(Modifier.PUBLIC, Modifier.FINAL) .addField(registry) .addMethod(loadMethod.build()) .addMethod(parseMethod) .build(); JavaFile.builder("com.airbnb.deeplinkdispatch", deepLinkLoader) .build() .writeTo(filer); }
Source:
<code>public final Boolean isAABBInsideMaterial(World world, BlockPos pos, AxisAlignedBB aabb, Material material) <START> { <END> IMicroblockContainerTile tile = getMicroblockTile(world, pos); Boolean def = isAABBInsideMaterialDefault(world, pos, aabb, material); if (tile == null) { return def; } Boolean is = tile.getMicroblockContainer().getPartContainer().isAABBInsideMaterial(aabb, material); if ((def != null && def == true) || (is != null && is == true)) { return true; } if ((def != null && def == false) || (is != null && is == false)) { return false; } return null; }</code><technical_language>Out of curiosity I code in front of me, null signify do care this a ternary return</technical_language>

Target:
public final Boolean isAABBInsideMaterial(World world, BlockPos pos, AxisAlignedBB aabb, Material material) { IMicroblockContainerTile tile = getMicroblockTile(world, pos); Boolean def = isAABBInsideMaterialDefault(world, pos, aabb, material); if (tile != null) { Boolean is = tile.getMicroblockContainer().getPartContainer().isAABBInsideMaterial(aabb, material); if ((def != null && def == true) || (is != null && is == true)) { return true; } if ((def != null && def == false) || (is != null && is == false)) { return false; } return null; } return def; }
Source:
<code>public void setExceptionHandler(UncaughtExceptionHandler exceptionHandler) { this.uncaughtExceptionHandler = exceptionHandler; <START> this.bookie.setExceptionHandler(exceptionHandler); <END> }</code><technical_language>nit: bookie is final, possibility bookie is null if methods called in correct order. add final modifier bookie field</technical_language>

Target:
public void setExceptionHandler(UncaughtExceptionHandler exceptionHandler) { this.uncaughtExceptionHandler = exceptionHandler; }
Source:
<code>public String getReference() { <START> return "<LINK_0>"; <END> }</code><technical_language>This obtained i18n file in case a language specific reference</technical_language>

Target:
public String getReference() { return REFERENCE; }
Source:
<code>void addIntermediateStream(StreamSpec streamSpec, JobNode from, JobNode to) { StreamEdge edge = getOrCreateStreamEdge(streamSpec); edge.addSourceNode(from); edge.addTargetNode(to); <START> edge.setIsIntermediate(true); <END> from.addOutEdge(edge); to.addInEdge(edge); intermediateStreams.add(edge); }</code><technical_language>Consider wrapping this constructor, rid setter? StreamEdge(isIntermediate)</technical_language>

Target:
void addIntermediateStream(StreamSpec streamSpec, JobNode from, JobNode to) { StreamEdge edge = getOrCreateStreamEdge(streamSpec, true); edge.addSourceNode(from); edge.addTargetNode(to); from.addOutEdge(edge); to.addInEdge(edge); intermediateStreams.add(edge); }
Source:
<code>public static Version parse(String version) { final Matcher matcher = VERSION_PATTERN.matcher(version); if (matcher.find() && matcher.groupCount() == 4) { final int major = Integer.parseInt(matcher.group(1)); final int minor = Integer.parseInt(matcher.group(2)); final int patch = Integer.parseInt(matcher.group(3)); if (major < 0) { throw new IllegalArgumentException("Major version number cannot be negative!"); } if (minor < 0) { throw new IllegalArgumentException("Minor version number cannot be negative!"); } if (patch < 0) { throw new IllegalArgumentException("Patch version number cannot be negative!"); } <START> <END> final String stability = parseStability(matcher.group(4)); return new Version(major, minor, patch, stability); } else { throw new IllegalArgumentException("Could not parse version: " + version); } }</code><technical_language>i supposed uppercase. in fact, i in wiki acceptable values are: -beta -alpha -RC -RC2 - a version appended</technical_language>

Target:
public static Version parse(String version) { final Matcher matcher = VERSION_PATTERN.matcher(version); if (matcher.find() && matcher.groupCount() == 4) { final int major = Integer.parseInt(matcher.group(1)); final int minor = Integer.parseInt(matcher.group(2)); final int patch = Integer.parseInt(matcher.group(3)); final String stability = parseStability(matcher.group(4)); return new Version(major, minor, patch, stability); } else { throw new IllegalArgumentException("Could not parse version: " + version); } }
Source:
<code>public Integer when() { final Object value = this.get("when"); <START> return (null != value) ? new Integer(value.toString()) : null; <END> }</code><technical_language>[Integer.valueOf](<LINK_0> yet, value.toString. Is Object returned Integer</technical_language>

Target:
public Integer when() { return (Integer) this.get("when"); }
Source:
<code>public static void saveRecordTreesToLocalStore(SyncManager syncManager, SyncTarget target, ParentInfo parentInfo, ChildrenInfo childrenInfo, JSONArray recordTrees) throws JSONException { SmartStore smartStore = syncManager.getSmartStore(); <START> SmartSyncSDKManager.getInstance().registerUsedAppFeature(FEATURE_RELATED_RECORDS); <END> synchronized(smartStore.getDatabase()) { try { smartStore.beginTransaction(); for (int i=0; i<recordTrees.length(); i++) { JSONObject record = recordTrees.getJSONObject(i); JSONObject parent = new JSONObject(record.toString()); JSONArray children = (JSONArray) parent.remove(childrenInfo.sobjectTypePlural); target.cleanRecord(parent); target.cleanAndSaveInSmartStore(smartStore, parentInfo.soupName, parent, false); if (children != null) { for (int j = 0; j < children.length(); j++) { JSONObject child = children.getJSONObject(j); child.put(childrenInfo.parentIdFieldName, parent.get(parentInfo.idFieldName)); target.cleanRecord(child); target.cleanAndSaveInSmartStore(smartStore, childrenInfo.soupName, child, false); } } } smartStore.setTransactionSuccessful(); } finally { smartStore.endTransaction(); } } }</code><technical_language>sync down. I recommend registerUsedAppFeature call constructors of parent children sync sync targets</technical_language>

Target:
public static void saveRecordTreesToLocalStore(SyncManager syncManager, SyncTarget target, ParentInfo parentInfo, ChildrenInfo childrenInfo, JSONArray recordTrees) throws JSONException { SmartStore smartStore = syncManager.getSmartStore(); synchronized(smartStore.getDatabase()) { try { smartStore.beginTransaction(); for (int i=0; i<recordTrees.length(); i++) { JSONObject record = recordTrees.getJSONObject(i); JSONObject parent = new JSONObject(record.toString()); JSONArray children = (JSONArray) parent.remove(childrenInfo.sobjectTypePlural); target.cleanRecord(parent); target.cleanAndSaveInSmartStore(smartStore, parentInfo.soupName, parent, false); if (children != null) { for (int j = 0; j < children.length(); j++) { JSONObject child = children.getJSONObject(j); child.put(childrenInfo.parentIdFieldName, parent.get(parentInfo.idFieldName)); target.cleanRecord(child); target.cleanAndSaveInSmartStore(smartStore, childrenInfo.soupName, child, false); } } } smartStore.setTransactionSuccessful(); } finally { smartStore.endTransaction(); } } }
Source:
<code>public void testIsSatisfied() { Bundle bundle = mock(Bundle.class); Dictionary<String, String> headers = new Hashtable<>(); headers.put("Bundle-SymbolicName", "bundle2"); when(bundle.getHeaders()).thenReturn(headers); BundleNameCondition bundleNameCondition = new BundleNameCondition( bundle, new ConditionInfo( BundleNameCondition.class.getName(), new String[] {"bundle1/bundle2/bundle3"})); boolean satisfied = bundleNameCondition.isSatisfied(); assertThat(satisfied, is(true)); satisfied = bundleNameCondition.isSatisfied(); <START> assertThat(satisfied, is(true)); <END> }</code><technical_language>this prove condition result cached, class returns consistent results? consider adding a package-private getter get cache Map, a inject it, verify entry properly cached? question for methods</technical_language>

Target:
public void testIsSatisfied() { Bundle bundle = mock(Bundle.class); Dictionary<String, String> headers = new Hashtable<>(); headers.put("Bundle-SymbolicName", "bundle2"); when(bundle.getHeaders()).thenReturn(headers); BundleNameCondition bundleNameCondition = new BundleNameCondition( bundle, new ConditionInfo( BundleNameCondition.class.getName(), new String[] {"bundle1", "bundle2", "bundle3"})); boolean satisfied = bundleNameCondition.isSatisfied(); assertThat(satisfied, is(true)); satisfied = bundleNameCondition.isSatisfied(); assertThat(satisfied, is(true)); }
Source:
<code>public void setUp() { context = InstrumentationRegistry.getTargetContext(); sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); <START> editor = sharedPreferences.edit(); <END> editor.clear(); editor.commit(); exception = new RuntimeException("Error"); }</code><technical_language>expensive operation test</technical_language>

Target:
public void setUp() { context = InstrumentationRegistry.getTargetContext(); sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); editor = sharedPreferences.edit(); editor.clear(); editor.putBoolean(SettingsActivity.SETTINGS_CRASH_REPORTS, true); editor.commit(); exception = new RuntimeException("Error"); CrashReporter.setIsCrashReportEnabled(true); CrashReporter.initialize(context); }
Source:
<code>void runOnceForTable(TableToSweep tableToSweep, Optional<SweepBatchConfig> newSweepBatchConfig, boolean saveSweepResults) { Stopwatch watch = Stopwatch.createStarted(); TableReference tableRef = tableToSweep.getTableRef(); byte[] startRow = tableToSweep.getStartRow(); SweepBatchConfig batchConfig = newSweepBatchConfig.orElse(getAdjustedBatchConfig()); try { SweepResults results = sweepRunner.run( tableRef, batchConfig, startRow); long elapsedMillis = watch.elapsed(TimeUnit.MILLISECONDS); log.info("Swept successfully.", LoggingArgs.tableRef("tableRef", tableRef), UnsafeArg.of("startRow", startRowToHex(startRow)), <START> SafeArg.of("cell+ts pairs examined", results.getCellTsPairsExamined()), <END> SafeArg.of("cell+ts pairs deleted", results.getStaleValuesDeleted()), SafeArg.of("time taken", elapsedMillis), SafeArg.of("last swept timestamp", results.getSweptTimestamp())); sweepPerfLogger.logSweepResults( SweepPerformanceResults.builder() .sweepResults(results) .tableName(tableRef.getQualifiedName()) .elapsedMillis(elapsedMillis) .build()); if (saveSweepResults) { saveSweepResults(tableToSweep, results); } } catch (RuntimeException e) { log.info("Failed to sweep.", LoggingArgs.tableRef("tableRef", tableRef), UnsafeArg.of("startRow", startRowToHex(startRow)), SafeArg.of("batchConfig", batchConfig)); throw e; } }</code><technical_language>cell+ts good regex searches :(. this cellTs, everywhere</technical_language>

Target:
void runOnceForTable(TableToSweep tableToSweep, Optional<SweepBatchConfig> newSweepBatchConfig, boolean saveSweepResults) { Stopwatch watch = Stopwatch.createStarted(); TableReference tableRef = tableToSweep.getTableRef(); byte[] startRow = tableToSweep.getStartRow(); SweepBatchConfig batchConfig = newSweepBatchConfig.orElse(getAdjustedBatchConfig()); try { SweepResults results = sweepRunner.run( tableRef, batchConfig, startRow); long elapsedMillis = watch.elapsed(TimeUnit.MILLISECONDS); log.info("Swept successfully.", LoggingArgs.tableRef("tableRef", tableRef), UnsafeArg.of("startRow", startRowToHex(startRow)), SafeArg.of("cellTs pairs examined", results.getCellTsPairsExamined()), SafeArg.of("cellTs pairs deleted", results.getStaleValuesDeleted()), SafeArg.of("time taken", elapsedMillis), SafeArg.of("last swept timestamp", results.getSweptTimestamp())); sweepPerfLogger.logSweepResults( SweepPerformanceResults.builder() .sweepResults(results) .tableName(tableRef.getQualifiedName()) .elapsedMillis(elapsedMillis) .build()); if (saveSweepResults) { saveSweepResults(tableToSweep, results); } } catch (RuntimeException e) { log.info("Failed to sweep.", LoggingArgs.tableRef("tableRef", tableRef), UnsafeArg.of("startRow", startRowToHex(startRow)), SafeArg.of("batchConfig", batchConfig)); throw e; } }
Source:
<code>public void rollback() throws IllegalStateException, SecurityException, SystemException { notifyAssociationListeners(getTransaction(), TransactionEvent.DISASSOCIATING); <START> transactionManager.rollback(); <END> }</code><technical_language>white space issue</technical_language>

Target:
public void rollback() throws IllegalStateException, SecurityException, SystemException { notifyAssociationListeners(getTransaction(), EnumSet.of(EventType.DISASSOCIATING)); transactionManager.rollback() ; }
Source:
<code>public void joinTest() { assertEquals("<LINK_0>path", URIUtil.join("<LINK_1>base", "path")); assertEquals("<LINK_0>path/to", URIUtil.join("<LINK_1>", "base/", "/path", "to/")); assertEquals("path/to", URIUtil.join("", "path", "to")); assertEquals("<LINK_0>path", URIUtil.join(URI.create("<LINK_1>base"), "path")); <START> } <END></code><technical_language>suggestion cover a more test secnarios: (1) a null base String (2) empty base String (3) a null array of segments (4) empty array of segments</technical_language>

Target:
public void joinTest() { assertEquals("<LINK_2>", URIUtil.join("<LINK_1>")); assertEquals("<LINK_1>base", URIUtil.join("<LINK_0>", new String[0])); assertEquals("<LINK_0>path", URIUtil.join("<LINK_1>base", "path")); assertEquals("<LINK_0>path/to", URIUtil.join("<LINK_1>", "base/", "/path", "to/")); assertEquals("path/to", URIUtil.join("", "path", "to")); assertEquals("path/to", URIUtil.join((String) null, "path", "to")); assertEquals("<LINK_0>path", URIUtil.join(URI.create("<LINK_1>base"), "path")); assertEquals("path", URIUtil.join((URI) null, "path")); }
Source:
<code>public void replaceWithMoreThanMaxItems() { List<Object> items = createItems(); String[] messageItems = ReplacementUtils.replaceWith(PROPERTY_NAME, items); validateMessageContainsProperties(messageItems); <START> assertTrue(messageItems[1].contains(String.valueOf(items.size()))); <END> }</code><technical_language>interesting items max contained in message</technical_language>

Target:
public void replaceWithMoreThanMaxItems() { List<Object> items = createItems(); String[] messageItems = ReplacementUtils.replaceWith(PROPERTY_NAME, items); validateMessageContainsProperties(messageItems); validateMessageDoesNotContainUnexpectedItems(messageItems[0], items); assertTrue(messageItems[1].contains(String.valueOf(items.size()))); }
Source:
<code>public static Collection<Tile> parseTileMetrics(final File tileMetricsOutFile, final Map<Integer, File> phasingMetricsFiles, final ReadStructure readStructure, final ValidationStringency validationStringency) throws FileNotFoundException { <START> Map<Integer, Map<Integer, Collection<TilePhasingValue>>> phasingValues = getTilePhasingValues(phasingMetricsFiles, readStructure); <END> TileMetricsOutReader tileMetricsIterator = new TileMetricsOutReader(tileMetricsOutFile, TileMetricsOutReader.TileMetricsVersion.THREE); final Collection<IlluminaTileMetrics> tileMetrics = determineLastValueForLaneTileMetricsCode(tileMetricsIterator); final Map<String, ? extends Collection<IlluminaTileMetrics>> locationToMetricsMap = partitionTileMetricsByLocation(tileMetrics); return getTileClusterRecordsV3(locationToMetricsMap, phasingValues, tileMetricsIterator.getDensity()); }</code><technical_language>final</technical_language>

Target:
public static Collection<Tile> parseTileMetrics(final File tileMetricsOutFile, final Map<Integer, File> phasingMetricsFiles, final ReadStructure readStructure, final ValidationStringency validationStringency) throws FileNotFoundException { final Map<Integer, Map<Integer, Collection<TilePhasingValue>>> phasingValues = getTilePhasingValues(phasingMetricsFiles, readStructure); final TileMetricsOutReader tileMetricsIterator = new TileMetricsOutReader(tileMetricsOutFile, TileMetricsOutReader.TileMetricsVersion.THREE); final Collection<IlluminaTileMetrics> tileMetrics = determineLastValueForLaneTileMetricsCode(tileMetricsIterator); final Map<String, ? extends Collection<IlluminaTileMetrics>> locationToMetricsMap = partitionTileMetricsByLocation(tileMetrics); return getTileClusterRecordsV3(locationToMetricsMap, phasingValues, tileMetricsIterator.getDensity()); }
Source:
<code>private boolean isBoardNameDuplicate(String newName) { if (prefs.getAllBoards().containsKey(newName)) { <START> return true; <END> } return false; }</code><technical_language>here, return result of predicate</technical_language>

Target:
private boolean isBoardNameDuplicate(String newName) { return prefs.getAllBoards().containsKey(newName); }
Source:
<code>public int hashCode() { <START> return Objects.hash(id, name); <END> }</code><technical_language>Datanucleus advise id in hash</technical_language>

Target:
public int hashCode() { return Objects.hash(name, displayName); }
Source:
<code>public void terminateCanBeCalledEvenIfWorkerHasNotBeenActivated() throws Exception { verifierWebWorkerConnection.terminate(); assertTrue("You shall pass!", <START> true); <END> }</code><technical_language>I check verify(verifierWebWorkerConnection, never()).activate()</technical_language>

Target:
public void terminateCanBeCalledEvenIfWorkerHasNotBeenActivated() throws Exception { verifierWebWorkerConnection.activate(); verifierWebWorkerConnection.terminate(); verify(worker).terminate(); }
Source:
<code>private Long createdAt( <START> final Release release <END> ) { try { final Release.Smart smart = new Release.Smart(release); final Date created = smart.createdAt(); if (created != null) { return created.getTime(); } } catch (final IOException iox) { } return 0L; }</code><technical_language>@weisebrazil move parameter previous line</technical_language>

Target:
private long createdAt(final Release release) { long result = 0; try { final Date created = this.smart(release).createdAt(); if (created != null) { result = created.getTime(); } } catch (final IOException iox) { throw new IllegalArgumentException(iox); } return result; }
Source:
<code>protected void onInitUI() { super.onInitUI(); setHeaderVisible(false); Resources.I.style().ensureInjected(); star.setVisible(Gerrit.isSignedIn()); labels.init(style, statusText); reviewers.init(style); keysNavigation = new KeyCommandSet(Gerrit.C.sectionNavigation()); keysNavigation.add(new KeyCommand(0, 'u', Util.C.upToChangeList()) { @Override public void onKeyPress(final KeyPressEvent event) { Gerrit.displayLastChangeList(); } }); keysNavigation.add(new KeyCommand(0, 'R', Util.C.keyReload()) { @Override public void onKeyPress(final KeyPressEvent event) { reload.reload(); } }); keysAction = new KeyCommandSet(Gerrit.C.sectionActions()); keysAction.add(new KeyCommand(0, 'a', Util.C.keyPublishComments()) { @Override public void onKeyPress(KeyPressEvent event) { if (Gerrit.isSignedIn()) { onReply(null); } else { Gerrit.doSignIn(getToken()); } } }); if (Gerrit.isSignedIn()) { keysAction.add(new KeyCommand(0, 's', Util.C.changeTableStar()) { @Override public void onKeyPress(KeyPressEvent event) { star.setValue(!star.getValue(), true); } }); <START> keysAction.add(new KeyCommand(0, 'f', Util.C.keyEditReviewers()) { <END> @Override public void onKeyPress(KeyPressEvent event) { reviewers.onEdit(); } }); } }</code><technical_language>'f'? curious</technical_language>

Target:
protected void onInitUI() { super.onInitUI(); setHeaderVisible(false); Resources.I.style().ensureInjected(); star.setVisible(Gerrit.isSignedIn()); labels.init(style, statusText); reviewers.init(style); keysNavigation = new KeyCommandSet(Gerrit.C.sectionNavigation()); keysNavigation.add(new KeyCommand(0, 'u', Util.C.upToChangeList()) { @Override public void onKeyPress(final KeyPressEvent event) { Gerrit.displayLastChangeList(); } }); keysNavigation.add(new KeyCommand(0, 'R', Util.C.keyReload()) { @Override public void onKeyPress(final KeyPressEvent event) { reload.reload(); } }); keysAction = new KeyCommandSet(Gerrit.C.sectionActions()); keysAction.add(new KeyCommand(0, 'a', Util.C.keyPublishComments()) { @Override public void onKeyPress(KeyPressEvent event) { if (Gerrit.isSignedIn()) { onReply(null); } else { Gerrit.doSignIn(getToken()); } } }); if (Gerrit.isSignedIn()) { keysAction.add(new KeyCommand(0, 's', Util.C.changeTableStar()) { @Override public void onKeyPress(KeyPressEvent event) { star.setValue(!star.getValue(), true); } }); keysAction.add(new KeyCommand(0, 'c', Util.C.keyEditReviewers()) { @Override public void onKeyPress(KeyPressEvent event) { reviewers.onEdit(); } }); } }
Source:
<code>public ResponseEntity addUser(Authentication authentication) { return ResponseEntity <START> .status(HttpStatus.CREATED) <END> .body("{\"ok\":\"user '" + authentication.getName() + "' created\"}"); }</code><technical_language>out of curiousity... org.couchdb.user:{username} string...? I -- is this behaviour for Verdaccio and, npmjs.org, (or some other npm server)</technical_language>

Target:
public ResponseEntity addUser(Authentication authentication) { if (authentication == null || !authentication.isAuthenticated()) { throw new InsufficientAuthenticationException("unauthorized"); } if (!(authentication instanceof UsernamePasswordAuthenticationToken)) { return toResponseEntityError("Unsupported authentication class " + authentication.getClass().getName()); } Object principal = authentication.getPrincipal(); if (!(principal instanceof SpringSecurityUser)) { return toResponseEntityError( "Unsupported authentication principal " + Optional.ofNullable(principal).orElse(null)); } return ResponseEntity .status(HttpStatus.CREATED) .body("{\"ok\":\"user '" + authentication.getName() + "' created\"}"); }
Source:
<code>public ImportResult importSpreadsheet(File file, EClass eClass) { final BundleContext bundleContext = FrameworkUtil.getBundle(getClass()).getBundleContext(); final ServiceReference<ReportService> serviceReference = bundleContext.getServiceReference(ReportService.class); final ReportService reportService = bundleContext.getService(serviceReference); Workbook workbook = null; FileInputStream inputStream = null; try { inputStream = new FileInputStream(file); workbook = new HSSFWorkbook(inputStream); } catch (final IOException ex) { reportService.report(new EMFFormsSpreadsheetReport(ex, 4)); } finally { try { inputStream.close(); } catch (final IOException ex) { reportService.report(new EMFFormsSpreadsheetReport(ex, 4)); } } bundleContext.ungetService(serviceReference); if (workbook == null) { return <START> null; <END> } final ImportResult result = EMFFormsSpreadsheetImporter.INSTANCE.importSpreadsheet(workbook, eClass); return result; }</code><technical_language>Write error result</technical_language>

Target:
public SpreadsheetImportResult importSpreadsheet(File file, EClass eClass) { final BundleContext bundleContext = FrameworkUtil.getBundle(getClass()).getBundleContext(); final ServiceReference<ReportService> serviceReference = bundleContext.getServiceReference(ReportService.class); final ReportService reportService = bundleContext.getService(serviceReference); Workbook workbook = null; FileInputStream inputStream = null; try { inputStream = new FileInputStream(file); workbook = new HSSFWorkbook(inputStream); } catch (final IOException ex) { reportService.report(new EMFFormsSpreadsheetReport(ex, 4)); } finally { try { inputStream.close(); } catch (final IOException ex) { reportService.report(new EMFFormsSpreadsheetReport(ex, 4)); } } bundleContext.ungetService(serviceReference); if (workbook == null) { final SpreadsheetImportResult result = ErrorFactory.eINSTANCE.createSpreadsheetImportResult(); result.reportError(Severity.CANCEL, Messages.EMFFormsSpreadsheetFileImporterImpl_FileNotAWorkbook); return result; } final SpreadsheetImportResult result = EMFFormsSpreadsheetImporter.INSTANCE.importSpreadsheet(workbook, eClass); return result; }
Source:
<code>public Integer getWaitForResponses() { if (waitForResponses == null) { return 0; } else if (waitForResponses == -1) { <START> return Integer.MAX_VALUE; <END> } else { return waitForResponses; } }</code><technical_language>a hack. Technically able receive more 5 billion responses :)</technical_language>

Target:
public Integer getWaitForResponses() { if (waitForResponses == null) { return 0; } else { return waitForResponses; } }
Source:
<code>public void addFirstPartWithIconTest() { SVGResource titleSVGResource = mock(SVGResource.class); SVGImage svgImage = mock(SVGImage.class); OMSVGSVGElement svgElem = mock(OMSVGSVGElement.class); doReturn(svgElem).when(titleSVGResource).getSvg(); <START> doReturn(GWT.create(Node.class)).when(svgElem).getElement(); <END> doReturn(titleSVGResource).when(part1).getTitleSVGImage(); doReturn(svgImage).when(part1).decorateIcon(any(SVGImage.class)); doReturn(item).when(view).addTabButton(svgImage, null, null, null, true); presenter.addPart(part1); stopSchedulers(); verify(part1).getTitleSVGImage(); verify(part1).decorateIcon(any(SVGImage.class)); }</code><technical_language>Do need GWT class</technical_language>

Target:
public void addFirstPartWithIconTest() { presenter.addPart(part1); stopSchedulers(); verify(part1).getTitleSVGImage(); verify(part1).decorateIcon(any(SVGImage.class)); }
Source:
<code><START> public void testRetrieveCollecton() throws ItemNotFoundException, IllegalOperationException, IOException, <END> AccessDeniedException, NoSuchResourceStoreException { final String collectionPath = "/dir"; final StorageItem item = unzipRepo.doRetrieveItem(new ResourceStoreRequest(collectionPath)); Assert.assertTrue(item instanceof ZipAwareStorageCollectionItem); final StorageCollectionItem collectionItem = (StorageCollectionItem) item; Assert.assertEquals(collectionPath, collectionItem.getPath()); TestUtil.assertMembers(new String[] { "/dir/subdir" }, new String[0], collectionItem.list()); }</code><technical_language>(minor) simply declare "throws Exception" remove clutter. This is perfectly OK for test methods. for other test methods in this class I guess</technical_language>

Target:
public void testRetrieveCollecton() throws Exception { final String collectionPath = "/dir"; final StorageItem item = unzipRepo.doRetrieveItem(new ResourceStoreRequest(collectionPath)); Assert.assertTrue(item instanceof ZipAwareStorageCollectionItem); final StorageCollectionItem collectionItem = (StorageCollectionItem) item; Assert.assertEquals(collectionPath, collectionItem.getPath()); TestUtil.assertMembers(new String[] { "/dir/subdir" }, new String[0], collectionItem.list()); }
Source:
<code>public Collection<MessagePathParameter<?>> getPathParameters() { <START> return Collections.unmodifiableCollection(Arrays.asList( logFileNamePathParameter )); <END> }</code><technical_language>suggestion return Collections.singleton(logFileNamePathParameter)</technical_language>

Target:
public Collection<MessagePathParameter<?>> getPathParameters() { return Collections.singleton(logFileNamePathParameter); }
Source:
<code>public APICategory getAPICategoryByID(String apiCategoryId) throws APIManagementException { APICategory apiCategory = ApiMgtDAO.getInstance().getAPICategoryByID(apiCategoryId); if (apiCategory != null) { return apiCategory; }else { String msg = "Failed to get APICategory. API category corresponding to UUID " + apiCategoryId + " does not exist"; <START> log.error(msg); <END> throw new APIMgtResourceNotFoundException(msg); } }</code><technical_language>need logging throwing exception</technical_language>

Target:
public APICategory getAPICategoryByID(String apiCategoryId) throws APIManagementException { APICategory apiCategory = ApiMgtDAO.getInstance().getAPICategoryByID(apiCategoryId); if (apiCategory != null) { return apiCategory; }else { String msg = "Failed to get APICategory. API category corresponding to UUID " + apiCategoryId + " does not exist"; throw new APIMgtResourceNotFoundException(msg); } }
Source:
<code>public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof GraphiteEmitterConfig)) { return false; } GraphiteEmitterConfig that = (GraphiteEmitterConfig) o; if (getPort() != that.getPort()) { return false; } if (getBatchSize() != that.getBatchSize()) { return false; } if (!getHostname().equals(that.getHostname())) { return false; } if (!getFlushPeriod().equals(that.getFlushPeriod())) { return false; } if (!getMaxQueueSize().equals(that.getMaxQueueSize())) { return false; } if (!getDruidToGraphiteEventConverter().equals(that.getDruidToGraphiteEventConverter())) { return false; } if (getAlertEmitters() != null ? !getAlertEmitters().equals(that.getAlertEmitters()) : that.getAlertEmitters() != null) { return false; } <START> if (getRequestLogEmitters() != null <END> ? !getRequestLogEmitters().equals(that.getRequestLogEmitters()) : that.getRequestLogEmitters() != null) { return false; } if (!getEmitWaitTime().equals(that.getEmitWaitTime())) { return false; } return getWaitForEventTime().equals(that.getWaitForEventTime()); }</code><technical_language>Objects.equals()</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof GraphiteEmitterConfig)) { return false; } GraphiteEmitterConfig that = (GraphiteEmitterConfig) o; if (getPort() != that.getPort()) { return false; } if (getBatchSize() != that.getBatchSize()) { return false; } if (!getProtocol().equals(that.getProtocol())) { return false; } if (!getHostname().equals(that.getHostname())) { return false; } if (!getFlushPeriod().equals(that.getFlushPeriod())) { return false; } if (!getMaxQueueSize().equals(that.getMaxQueueSize())) { return false; } if (!getDruidToGraphiteEventConverter().equals(that.getDruidToGraphiteEventConverter())) { return false; } if (getAlertEmitters() != null ? !getAlertEmitters().equals(that.getAlertEmitters()) : that.getAlertEmitters() != null) { return false; } if (getRequestLogEmitters() != null ? !getRequestLogEmitters().equals(that.getRequestLogEmitters()) : that.getRequestLogEmitters() != null) { return false; } if (!getEmitWaitTime().equals(that.getEmitWaitTime())) { return false; } return getWaitForEventTime().equals(that.getWaitForEventTime()); }
Source:
<code>public void updateImplementations(String schema, Stream<UserDefinedFunctionMetaData> userDefinedFunctions) { final Map<FunctionName, List<FuncResolver>> implementations = new HashMap<>(); Iterator<UserDefinedFunctionMetaData> it = userDefinedFunctions.iterator(); while (it.hasNext()) { UserDefinedFunctionMetaData udf = it.next(); FuncResolver resolver = buildFunctionResolver(udf); if (resolver == null) { continue; } implementations.compute( new FunctionName(udf.schema(), udf.name()), (key, resolvers) -> { if (resolvers == null) { resolvers = new ArrayList<>(); } resolvers.add(resolver); return resolvers; <START> }); <END> } functions.registerUdfFunctionImplementationsForSchema(schema, implementations); }</code><technical_language>prefer this style for improved readability, more a personal preference: List<FuncResolver> resolvers = implementations.computeIfAbsent(functionName, new ArrayList<>()); resolvers.add(udfService.buildFunctionResolver(udf));</technical_language>

Target:
public void updateImplementations(String schema, Stream<UserDefinedFunctionMetaData> userDefinedFunctions) { final Map<FunctionName, List<FuncResolver>> implementations = new HashMap<>(); Iterator<UserDefinedFunctionMetaData> it = userDefinedFunctions.iterator(); while (it.hasNext()) { UserDefinedFunctionMetaData udf = it.next(); FuncResolver resolver = buildFunctionResolver(udf); if (resolver == null) { continue; } var functionName = new FunctionName(udf.schema(), udf.name()); var resolvers = implementations.computeIfAbsent( functionName, k -> new ArrayList<>()); resolvers.add(resolver); } functions.registerUdfFunctionImplementationsForSchema(schema, implementations); }
Source:
<code>public boolean within(final LineRange range) { <START> return range != null <END> && range.first() >= this.first() && range.last() <= this.last(); }</code><technical_language>@JimDeanSpivey need for this null check. nulls, :)</technical_language>

Target:
public boolean within(final LineRange range) { return range.first() >= this.first() && range.last() <= this.last(); }
Source:
<code>public static AppConfig parseAppConfig(String appConfigString) { AppConfig appConfig = new AppConfig(); try { JSONObject parentObj = new JSONObject(appConfigString); appConfig.setAppFormatVersion(parentObj.getLong("appFormatVersion")); <START> if (appConfig.appFormatVersion >= 6) { <END> JSONObject rootPage = parentObj.getJSONObject("rootPage"); appConfig.mRootPageArgs = rootPage.getJSONObject("args"); appConfig.mRootPageName = rootPage.getString("page"); appConfig.mAppConfigString = appConfig.mRootPageArgs.toString(); appConfig.mNotifications = parentObj.optBoolean("notifications"); } else { throw new RuntimeException("Not Supported appFormatVersion"); } } catch (JSONException e) { throw new RuntimeException("Invalid app.json!", e); } return appConfig; }</code><technical_language>extract 6 a constant top of file</technical_language>

Target:
public static AppConfig parseAppConfig(String appConfigString) { AppConfig appConfig = new AppConfig(); try { JSONObject parentObj = new JSONObject(appConfigString); appConfig.setAppFormatVersion(parentObj.getLong("appFormatVersion")); if (appConfig.appFormatVersion >= SUPPORTED_APP_FORMAT_VERSION) { JSONObject rootPage = parentObj.getJSONObject("rootPage"); appConfig.mRootPageArgs = rootPage.getJSONObject("args"); appConfig.mRootPageName = rootPage.getString("page"); appConfig.mAppConfigString = appConfig.mRootPageArgs.toString(); appConfig.mNotifications = parentObj.optBoolean("notifications"); } else { throw new RuntimeException("Not Supported appFormatVersion"); } } catch (JSONException e) { throw new RuntimeException("Invalid app.json!", e); } return appConfig; }