auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public AbstractExpression processTVE(TupleValueExpression expr, String columnName) { if (m_origSubqueryScan != null) { expr.setTableName(getTableName()); Integer columnIndex = m_origSubqueryScan.getColumnIndex(columnName, expr.getDifferentiator()); assert(columnIndex != null); SchemaColumn origColumnSchema = m_origSubqueryScan.getSchemaColumn(columnIndex); assert(origColumnSchema != null); <START> AbstractExpression colExpr = (AbstractExpression) origColumnSchema.getExpression(); <END> List<TupleValueExpression> tves = ExpressionUtil.getTupleValueExpressions(colExpr); for (TupleValueExpression tve : tves) { tve.setTableAlias(expr.getTableAlias()); tve.setColumnAlias(expr.getColumnAlias()); tve.resolveForTable(m_table); } return colExpr; } expr.resolveForTable(m_table); return expr; }</code><technical_language>Drop cast</technical_language>

Target:
public AbstractExpression processTVE(TupleValueExpression expr, String columnName) { if (m_origSubqueryScan != null) { expr.setTableName(getTableName()); Integer columnIndex = m_origSubqueryScan.getColumnIndex(columnName, expr.getDifferentiator()); assert(columnIndex != null); SchemaColumn origColumnSchema = m_origSubqueryScan.getSchemaColumn(columnIndex); assert(origColumnSchema != null); AbstractExpression colExpr = origColumnSchema.getExpression(); List<TupleValueExpression> tves = ExpressionUtil.getTupleValueExpressions(colExpr); for (TupleValueExpression tve : tves) { tve.setTableAlias(expr.getTableAlias()); tve.setColumnAlias(expr.getColumnAlias()); tve.resolveForTable(m_table); } return colExpr; } expr.resolveForTable(m_table); return expr; }
Source:
<code>public CompletableFuture<Void> deleteColumnFamily(TableName tableName, byte[] columnName) { <START> return CompletableFuture.supplyAsync(() -> { <END> Modification.Builder modification = Modification.newBuilder().setId(Bytes.toString(columnName)) .setDrop(true); ModifyColumnFamiliesRequest.Builder modifyColumnBuilder = ModifyColumnFamiliesRequest .newBuilder().addModifications(modification).setName(toBigtableName(tableName)); return modifyColumnBuilder; }).thenCompose( d -> FutureUtils.toCompletableFuture( bigtableTableAdminClient.modifyColumnFamilyAsync(d.build())) .thenApply(r -> null)); }</code><technical_language>create a request of CompletableFuture return: FutureUtils.toCompletableFuture(bigtableTableAdminClient.modifyColumnFamilyAsync(request)) .thenApply(r -> null))</technical_language>

Target:
public CompletableFuture<Void> deleteColumnFamily(TableName tableName, byte[] columnName) { Modification.Builder modification = Modification.newBuilder().setId(Bytes.toString(columnName)) .setDrop(true); ModifyColumnFamiliesRequest request = ModifyColumnFamiliesRequest .newBuilder().addModifications(modification).setName(toBigtableName(tableName)).build(); return FutureUtils.toCompletableFuture( bigtableTableAdminClient. modifyColumnFamilyAsync(request)). thenApply(response -> null); }
Source:
<code><START> private void onUpgrade(SQLiteConnection db, int oldVersion, int newVersion) { <END> db.execSQL("DROP TABLE IF EXISTS " + MARKERS_TABLE_NAME); db.execSQL("DROP TABLE IF EXISTS " + GROUPS_TABLE_NAME); onCreate(db); }</code><technical_language>upgrade drop existing markers</technical_language>

Target:
private void onUpgrade(SQLiteConnection db, int oldVersion, int newVersion) { }
Source:
<code>public static void analyzeFiles(Set<String> filenames) throws ArgumentParserException, IOException { long numErrors = 0; MaxLengths maxLengths = argumentParser.parseMaxLengths(); Severity maxSeverity = argumentParser.getMaxSeverity(); ColorSettings colorSettings = new ColorSettings(argumentParser.shouldColorOutput(), argumentParser.shouldInvertColorOutput()); Set<Rules> enabledRules = argumentParser.getEnabledRules(); for (String filename : filenames) { File inputFile = new File(filename); CommonTokenStream tokenStream; SwiftParser.TopLevelContext tree; try { tokenStream = getTokenStream(inputFile); tree = getParseTree(tokenStream); } catch (ErrorListener.ParseException e) { Printer printer = new Printer(inputFile, maxSeverity, colorSettings); printer.printParseErrorMessage(); continue; } try (Printer printer = new Printer(inputFile, maxSeverity, colorSettings)) { <START> List<SwiftBaseListener> listeners = createListeners(enabledRules, printer, tokenStream); <END> listeners.add(new MaxLengthListener(printer, maxLengths)); listeners.add(new MainListener(printer, maxLengths, tokenStream)); ParseTreeWalker walker = new ParseTreeWalker(); for (SwiftBaseListener listener : listeners) { walker.walk(listener, tree); } try (FileListener fileListener = new FileListener(printer, inputFile, maxLengths)) { fileListener.verify(); } CommentAnalyzer commentAnalyzer = new CommentAnalyzer(tokenStream, printer); commentAnalyzer.analyze(); numErrors += printer.getNumErrorMessages(); } } if (numErrors >= 1L) { System.exit(EXIT_FAILURE); } }</code><technical_language>Is necessary pass tokenStream</technical_language>

Target:
public static void analyzeFiles(Set<String> filenames) throws ArgumentParserException, IOException { long numErrors = 0; MaxLengths maxLengths = argumentParser.parseMaxLengths(); Severity maxSeverity = argumentParser.getMaxSeverity(); ColorSettings colorSettings = new ColorSettings(argumentParser.shouldColorOutput(), argumentParser.shouldInvertColorOutput()); Set<Rules> enabledRules = argumentParser.getEnabledRules(); for (String filename : filenames) { File inputFile = new File(filename); CommonTokenStream tokenStream; SwiftParser.TopLevelContext tree; try { tokenStream = getTokenStream(inputFile); tree = getParseTree(tokenStream); } catch (ErrorListener.ParseException e) { Printer printer = new Printer(inputFile, maxSeverity, colorSettings); printer.printParseErrorMessage(); continue; } try (Printer printer = new Printer(inputFile, maxSeverity, colorSettings)) { List<SwiftBaseListener> listeners = createListeners(enabledRules, printer); listeners.add(new MaxLengthListener(printer, maxLengths)); listeners.add(new MainListener(printer, maxLengths, tokenStream)); ParseTreeWalker walker = new ParseTreeWalker(); for (SwiftBaseListener listener : listeners) { walker.walk(listener, tree); } try (FileListener fileListener = new FileListener(printer, inputFile, maxLengths)) { fileListener.verify(); } CommentAnalyzer commentAnalyzer = new CommentAnalyzer(tokenStream, printer); commentAnalyzer.analyze(); numErrors += printer.getNumErrorMessages(); } } if (numErrors >= 1L) { System.exit(ExitCode.FAILURE); } }
Source:
<code>private static void logTaskExecutorConfiguration(TaskExecutorProcessSpec spec) { TaskExecutorFlinkMemory flinkMemory = spec.getFlinkMemory(); MemorySize totalOffHeapMemory = flinkMemory.getManaged().add(flinkMemory.getJvmDirectMemorySize()); LOG.info("Final TaskExecutor Memory configuration:"); LOG.info(" Total Process Memory: {}", spec.getTotalProcessMemorySize().toHumanReadableString()); LOG.info(" Total Flink Memory: {}", flinkMemory.getTotalFlinkMemorySize().toHumanReadableString()); <START> LOG.info(" Total Heap Memory: {}", flinkMemory.getJvmHeapMemorySize().toHumanReadableString()); <END> LOG.info(" Framework: {}", flinkMemory.getFrameworkHeap().toHumanReadableString()); LOG.info(" Task: {}", flinkMemory.getTaskHeap().toHumanReadableString()); LOG.info(" Total Off-heap Memory: {}", totalOffHeapMemory.toHumanReadableString()); LOG.info(" Managed: {}", flinkMemory.getManaged().toHumanReadableString()); LOG.info(" Total Direct Memory: {}", flinkMemory.getJvmDirectMemorySize().toHumanReadableString()); LOG.info(" Framework: {}", flinkMemory.getFrameworkOffHeap().toHumanReadableString()); LOG.info(" Task: {}", flinkMemory.getTaskOffHeap().toHumanReadableString()); LOG.info(" Network: {}", flinkMemory.getNetwork().toHumanReadableString()); LOG.info(" JVM Metaspace: {}", spec.getJvmMetaspaceSize().toHumanReadableString()); LOG.info(" JVM Overhead: {}", spec.getJvmOverheadSize().toHumanReadableString()); }</code><technical_language>suggestion LOG.info(" JVM Heap Memory: {}", flinkMemory.getJvmHeapMemorySize().toHumanReadableString());</technical_language>

Target:
private static void logTaskExecutorConfiguration(TaskExecutorProcessSpec spec) { TaskExecutorFlinkMemory flinkMemory = spec.getFlinkMemory(); MemorySize totalOffHeapMemory = flinkMemory.getManaged().add(flinkMemory.getJvmDirectMemorySize()); LOG.info("Final TaskExecutor Memory configuration:"); LOG.info(" Total Process Memory: {}", spec.getTotalProcessMemorySize().toHumanReadableString()); LOG.info(" Total Flink Memory: {}", flinkMemory.getTotalFlinkMemorySize().toHumanReadableString()); LOG.info(" Total JVM Heap Memory: {}", flinkMemory.getJvmHeapMemorySize().toHumanReadableString()); LOG.info(" Framework: {}", flinkMemory.getFrameworkHeap().toHumanReadableString()); LOG.info(" Task: {}", flinkMemory.getTaskHeap().toHumanReadableString()); LOG.info(" Total Off-heap Memory: {}", totalOffHeapMemory.toHumanReadableString()); LOG.info(" Managed: {}", flinkMemory.getManaged().toHumanReadableString()); LOG.info(" Total JVM Direct Memory: {}", flinkMemory.getJvmDirectMemorySize().toHumanReadableString()); LOG.info(" Framework: {}", flinkMemory.getFrameworkOffHeap().toHumanReadableString()); LOG.info(" Task: {}", flinkMemory.getTaskOffHeap().toHumanReadableString()); LOG.info(" Network: {}", flinkMemory.getNetwork().toHumanReadableString()); LOG.info(" JVM Metaspace: {}", spec.getJvmMetaspaceSize().toHumanReadableString()); LOG.info(" JVM Overhead: {}", spec.getJvmOverheadSize().toHumanReadableString()); }
Source:
<code>@Override public void loginLogoutClick() { new AlertDialog.Builder(MainActivity.this) .setMessage(R.string.logout_prompt) .setNegativeButton(android.R.string.cancel, null) .setPositiveButton(R.string.preference_title_logout, (dialog, which) -> { if (AccountUtil.isLoggedIn()) { WikipediaApp.getInstance().logOut(); FeedbackUtil.showMessage(MainActivity.this, R.string.toast_logout_complete); if (Prefs.isReadingListSyncEnabled() && !ReadingListDbHelper.instance().isEmpty()) { ReadingListSyncBehaviorDialogs.removeExistingListsOnLogoutDialog(MainActivity.this); } Prefs.setReadingListsLastSyncTime(null); Prefs.setReadingListSyncEnabled(false); } else { <START> getFragment().onLoginRequested(); <END> } closeMainDrawer(); }).show(); }</code><technical_language>AccountUtil.isLoggedIn() moved out main logic of behavior, otherwise, users able log in</technical_language>

Target:
@Override public void loginLogoutClick() { if (AccountUtil.isLoggedIn()) { new AlertDialog.Builder(MainActivity.this) .setMessage(R.string.logout_prompt) .setNegativeButton(android.R.string.cancel, null) .setPositiveButton(R.string.preference_title_logout, (dialog, which) -> { WikipediaApp.getInstance().logOut(); FeedbackUtil.showMessage(MainActivity.this, R.string.toast_logout_complete); if (Prefs.isReadingListSyncEnabled() && !ReadingListDbHelper.instance().isEmpty()) { ReadingListSyncBehaviorDialogs.removeExistingListsOnLogoutDialog(MainActivity.this); } Prefs.setReadingListsLastSyncTime(null); Prefs.setReadingListSyncEnabled(false); }).show(); } else { getFragment().onLoginRequested(); } closeMainDrawer(); }
Source:
<code>public void shouldRegisterWithKubernetesDeserializer() throws IOException { new CustomResourceOperationsImpl<>(context); JsonFactory factory = new MappingJsonFactory(); JsonParser parser = factory.createParser("{\n" + " \"apiVersion\": \"custom.group/v1alpha1\",\n" + " \"kind\": \"MyCustomResource\"\n" + "}"); KubernetesDeserializer deserializer = new KubernetesDeserializer(); KubernetesResource resource = deserializer.deserialize(parser, null); <START> assertThat(resource, instanceOf(MyCustomResource.class)); <END> }</code><technical_language>add assertion validation content of a field in order verify deserialization worked. (e.g. assertThat(((MyCustomResource)resource).getApiVersion(), equalTo("custom.group/v1alpha1")))</technical_language>

Target:
public void shouldRegisterWithKubernetesDeserializer() throws IOException { new CustomResourceOperationsImpl<>(context); JsonFactory factory = new MappingJsonFactory(); JsonParser parser = factory.createParser("{\n" + " \"apiVersion\": \"custom.group/v1alpha1\",\n" + " \"kind\": \"MyCustomResource\"\n" + "}"); KubernetesDeserializer deserializer = new KubernetesDeserializer(); KubernetesResource resource = deserializer.deserialize(parser, null); assertThat(resource, instanceOf(MyCustomResource.class)); assertEquals("custom.group/v1alpha1", ((MyCustomResource) resource).getApiVersion()); }
Source:
<code>void testAnyNull() { assertTrue(ObjectUtils.anyNull((Object) null)); assertTrue(ObjectUtils.anyNull(null, null, null)); assertFalse(ObjectUtils.anyNull()); assertFalse(ObjectUtils.anyNull((Object[]) null)); assertFalse(ObjectUtils.anyNull(FOO)); <START> assertFalse(ObjectUtils.anyNull(null, FOO, null)); <END> assertFalse(ObjectUtils.anyNull(null, null, null, null, FOO, BAR)); }</code><technical_language>this assertFalse? ObjectUtils.anyNull(null, null, null, null, FOO, BAR) - return true, null elements in varargs</technical_language>

Target:
void testAnyNull() { assertTrue(ObjectUtils.anyNull((Object) null)); assertTrue(ObjectUtils.anyNull(null, null, null)); assertTrue(ObjectUtils.anyNull(null, null, null, null, FOO, BAR)); assertTrue(ObjectUtils.anyNull(null, FOO, null)); assertFalse(ObjectUtils.anyNull()); assertFalse(ObjectUtils.anyNull((Object[]) null)); assertFalse(ObjectUtils.anyNull(FOO)); assertFalse(ObjectUtils.anyNull(FOO, BAR)); }
Source:
<code>private static void buildContext(final XContentBuilder b, Series series, boolean indexResourceIdentifiers) throws IOException { b.field(KEY, series.getKey()); b.startArray(TAGS); for (final Map.Entry<String, String> entry : series.getTags().entrySet()) { b.value(entry.getKey() + TAG_DELIMITER + entry.getValue()); } if(indexResourceIdentifiers) { for (final Map.Entry<String, String> entry : series.getResource().entrySet()) { b.value(entry.getKey() + TAG_DELIMITER + entry.getValue()); } } b.endArray(); b.startArray(TAG_KEYS); for (final Map.Entry<String, String> entry : series.getTags().entrySet()) { b.value(entry.getKey()); } <START> if(indexResourceIdentifiers) { <END> for (final Map.Entry<String, String> entry : series.getResource().entrySet()) { b.value(entry.getKey() + TAG_DELIMITER + entry.getValue()); } } b.endArray(); b.field(HASH_FIELD, series.hash()); }</code><technical_language>This block adds tags, TAG_DELIMITER + entry.getValue() removed</technical_language>

Target:
private static void buildContext( final XContentBuilder b, Series series, boolean indexResourceIdentifiers ) throws IOException { b.field(KEY, series.getKey()); appendData(b, series.getTags(), TAGS, TAG_DELIMITER); b.startArray(TAG_KEYS); for (final Map.Entry<String, String> entry : series.getTags().entrySet()) { b.value(entry.getKey()); } b.endArray(); if (indexResourceIdentifiers) { appendData(b, series.getResource(), RESOURCE, TAG_DELIMITER); } b.field(HASH_FIELD, series.hash()); }
Source:
<code>public static SecurityMode fromCode(int code) { <START> switch (code) { <END> case 0: return PSK; case 1: return RPK; case 2: return X509; case 3: return NO_SEC; default: throw new IllegalArgumentException(String.format("Unsupported security code : %d", code)); } }</code><technical_language>error prone iterate values()</technical_language>

Target:
public static SecurityMode fromCode(int code) { for (SecurityMode sm : SecurityMode.values()) { if (sm.code == code) { return sm; } } throw new IllegalArgumentException(String.format("Unsupported security code : %d", code)); }
Source:
<code>private void collectOverriddenMethodsInInterfaces(ExecutableElement overridingMethod, TypeElement currentTypeElement, MethodInheritanceTree.Builder methodInheritanceTreeBuilder) { for ( TypeMirror implementedInterface : currentTypeElement.getInterfaces() ) { TypeElement interfaceTypeElement = (TypeElement) typeUtils.asElement( implementedInterface ); ExecutableElement overriddenMethod = getOverriddenMethod( overridingMethod, interfaceTypeElement ); if ( overriddenMethod != null ) { methodInheritanceTreeBuilder.addOverriddenMethod( overridingMethod, overriddenMethod ); collectOverriddenMethodsInInterfaces( overriddenMethod, interfaceTypeElement, methodInheritanceTreeBuilder ); } else { <START> collectOverriddenMethodsInInterfaces( overridingMethod, interfaceTypeElement, methodInheritanceTreeBuilder ); <END> } } }</code><technical_language>collectOverriddenMethodsInInterfaces moved out of if else is called in cases</technical_language>

Target:
private void collectOverriddenMethodsInInterfaces(ExecutableElement overridingMethod, TypeElement currentTypeElement, MethodInheritanceTree.Builder methodInheritanceTreeBuilder) { for ( TypeMirror implementedInterface : currentTypeElement.getInterfaces() ) { TypeElement interfaceTypeElement = (TypeElement) typeUtils.asElement( implementedInterface ); ExecutableElement overriddenMethod = getOverriddenMethod( overridingMethod, interfaceTypeElement ); ExecutableElement newOverridingMethod; if ( overriddenMethod != null ) { methodInheritanceTreeBuilder.addOverriddenMethod( overridingMethod, overriddenMethod ); newOverridingMethod = overriddenMethod; } else { newOverridingMethod = overridingMethod; } collectOverriddenMethodsInInterfaces( newOverridingMethod, interfaceTypeElement, methodInheritanceTreeBuilder ); } }
Source:
<code>public void normal() { <START> final TestSubscriber<Integer> ts = new TestSubscriber<Integer>(); <END> Flowable.range(1, 5).mergeWith( Maybe.just(100) ) .subscribe(ts); ts.assertResult(1, 2, 3, 4, 5, 100); }</code><technical_language>inlined test()</technical_language>

Target:
public void normal() { Flowable.range(1, 5) .mergeWith(Maybe.just(100)) .test() .assertResult(1, 2, 3, 4, 5, 100); }
Source:
<code>public static void setSplitFile(Job job, String file) { URI uri = new Path(file).toUri(); <START> DistributedCacheHelper.addCacheFile(uri, job.getConfiguration()); <END> job.getConfiguration().set(CUTFILE_KEY, uri.getPath()); }</code><technical_language>call job.addCacheFile() here</technical_language>

Target:
public static void setSplitFile(Job job, String file) { URI uri = new Path(file).toUri(); job.addCacheFile(uri); job.getConfiguration().set(CUTFILE_KEY, uri.getPath()); }
Source:
<code>private void sendMessage(final Message message, final EmailConfiguration emailConfiguration) throws MessagingException { <START> try (Transport transport = createSession(emailConfiguration).getTransport()) { <END> transport.connect(); transport.sendMessage(message, message.getAllRecipients()); } }</code><technical_language>method createSession is synchronized. I is check if session present invoking synchronized method</technical_language>

Target:
private void sendMessage(final Message message, final EmailConfiguration emailConfiguration) throws MessagingException { try (Transport transport = Optional.ofNullable(session).orElseGet(() -> createSession(emailConfiguration)).getTransport()) { transport.connect(); transport.sendMessage(message, message.getAllRecipients()); } }
Source:
<code>private static boolean isSingleLineSwitchMember(DetailAST statement) { final boolean isInSwitchRule = <START> statement.getParent().getType() == TokenTypes.SWITCH_RULE; <END> final boolean result; if (isInSwitchRule) { result = isSingleLineSwitchRule(statement); } else { result = isSingleLineCaseGroup(statement); } return result; }</code><technical_language>This code duplicates method isSwitchRuleLambda. this method here</technical_language>

Target:
private static boolean isSingleLineSwitchMember(DetailAST statement) { final boolean result; if (isInSwitchRule(statement)) { result = isSingleLineSwitchRule(statement); } else { result = isSingleLineCaseGroup(statement); } return result; }
Source:
<code>public void define(WebService.NewController controller) { <START> controller.createAction(ARRAY_UPGRADES) <END> .setDescription("Lists available upgrades for the SonarQube instance (if any) and for each one, " + "lists incompatible plugins and plugins requiring upgrade." + "<br/>" + "Plugin information is retrieved from Update Center. Date and time at which Update Center was last refreshed " + "is provided in the response.") .setSince("5.2") .setHandler(this) .setResponseExample(Resources.getResource(this.getClass(), "example-upgrades_plugins.json")); }</code><technical_language>fact constants necessary means constant. ARRAY_UPGRADES is element of JSON response. fact is coincidental, constant code readable giving impression intent in places</technical_language>

Target:
public void define(WebService.NewController controller) { controller.createAction("upgrades") .setDescription("Lists available upgrades for the SonarQube instance (if any) and for each one, " + "lists incompatible plugins and plugins requiring upgrade." + "<br/>" + "Plugin information is retrieved from Update Center. Date and time at which Update Center was last refreshed " + "is provided in the response.") .setSince("5.2") .setHandler(this) .setResponseExample(Resources.getResource(this.getClass(), "example-upgrades_plugins.json")); }
Source:
<code>public void validateMemberInGroup(PerunSession sess, Member member, Group group) throws InternalErrorException { <START> <END> if (group == null) { throw new InternalErrorException("Group can not be null."); } if (VosManager.MEMBERS_GROUP.equals(group.getName())) { throw new InternalErrorException("Can not expire member in members group."); } if (member == null) { throw new InternalErrorException("Member to expire can not be null"); } MemberGroupStatus previousStatus = getDirectMemberGroupStatus(sess, member, group); if (MemberGroupStatus.VALID.equals(previousStatus)) { log.warn("Validating member in group where is already validated. Member: {}, Group: {}", member, group); } groupsManagerImpl.setDirectGroupStatus(sess, member, group, MemberGroupStatus.VALID); recalculateMemberGroupStatusRecursively(sess, member, group); }</code><technical_language>if member is direct member of this group</technical_language>

Target:
public void validateMemberInGroup(PerunSession sess, Member member, Group group) throws InternalErrorException { if (group == null) { throw new InternalErrorException("Group can not be null."); } if (VosManager.MEMBERS_GROUP.equals(group.getName())) { throw new InternalErrorException("Can not validate member in members group."); } if (member == null) { throw new InternalErrorException("Member to validate can not be null"); } MemberGroupStatus previousStatus = getDirectMemberGroupStatus(sess, member, group); if (MemberGroupStatus.VALID.equals(previousStatus)) { log.warn("Validating member in group where is already validated. Member: {}, Group: {}", member, group); } groupsManagerImpl.setDirectGroupStatus(sess, member, group, MemberGroupStatus.VALID); recalculateMemberGroupStatusRecursively(sess, member, group); }
Source:
<code>public void onComplete() { subscribers.dispose(); synchronized (this) { Map<Long, C> bufs = buffers; if (bufs == null) { return; } for (C b : bufs.values()) { queue.offer(b); } <START> bufs = null; <END> } done = true; drain(); }</code><technical_language>this buffers = null</technical_language>

Target:
public void onComplete() { subscribers.dispose(); synchronized (this) { Map<Long, C> bufs = buffers; if (bufs == null) { return; } for (C b : bufs.values()) { queue.offer(b); } buffers = null; } done = true; drain(); }
Source:
<code>public SingleStringInputCachingExpressionColumnValueSelector( final DimensionSelector selector, final Expr expression ) { if (Parser.findRequiredBindings(expression).size() != 1) { throw new ISE("WTF?! Expected expression with just one binding"); } this.selector = Preconditions.checkNotNull(selector, "selector"); this.expression = Preconditions.checkNotNull(expression, "expression"); if (selector.getValueCardinality() == DimensionSelector.CARDINALITY_UNKNOWN) { throw new ISE("Selector must have a dictionary"); } final Supplier<Object> inputSupplier = ExpressionSelectors.supplierFromDimensionSelector(selector); this.bindings = name -> inputSupplier.get(); <START> if (selector.getValueCardinality() <= CACHE_SIZE) { <END> arrayEvalCache = new ExprEval[selector.getValueCardinality()]; lruEvalCache = null; } else { arrayEvalCache = null; lruEvalCache = new LruEvalCache(expression, bindings); } }</code><technical_language>consider -1 is "unknown" cardinality</technical_language>

Target:
public SingleStringInputCachingExpressionColumnValueSelector( final DimensionSelector selector, final Expr expression ) { if (Parser.findRequiredBindings(expression).size() != 1) { throw new ISE("WTF?! Expected expression with just one binding"); } this.selector = Preconditions.checkNotNull(selector, "selector"); this.expression = Preconditions.checkNotNull(expression, "expression"); final Supplier<Object> inputSupplier = ExpressionSelectors.supplierFromDimensionSelector(selector); this.bindings = name -> inputSupplier.get(); if (selector.getValueCardinality() == DimensionSelector.CARDINALITY_UNKNOWN) { throw new ISE("Selector must have a dictionary"); } else if (selector.getValueCardinality() <= CACHE_SIZE) { arrayEvalCache = new ExprEval[selector.getValueCardinality()]; lruEvalCache = null; } else { arrayEvalCache = null; lruEvalCache = new LruEvalCache(expression, bindings); } }
Source:
<code>public static EObject getEObjectValue(View view, String property, EObject defaultValue) { EObject value = defaultValue; EClass eObjectValueStyle = NotationPackage.eINSTANCE.getEObjectValueStyle(); NamedStyle <START> style; <END> if (eObjectValueStyle != null) { style = view.getNamedStyle(eObjectValueStyle, property); if (style instanceof EObjectValueStyle) { value = ((EObjectValueStyle) style).getEObjectValue(); } } return value; }</code><technical_language>variable is declared in bad scope</technical_language>

Target:
public static EObject getEObjectValue(View view, String property, EObject defaultValue) { EObject value = defaultValue; EClass eObjectValueStyle = NotationPackage.eINSTANCE.getEObjectValueStyle(); if (eObjectValueStyle != null) { NamedStyle style = view.getNamedStyle(eObjectValueStyle, property); if (style instanceof EObjectValueStyle) { value = ((EObjectValueStyle) style).getEObjectValue(); } } return value; }
Source:
<code>public void copyRuntimeResources() { try { getLocation().execCommands("create run directory", ImmutableList.of("mkdir -p " + getRunDir())); Map<String, String> runtimeFiles = entity.getConfig(SoftwareProcess.RUNTIME_FILES); if (runtimeFiles != null && runtimeFiles.size() > 0) { for (String source : runtimeFiles.keySet()) { String target = runtimeFiles.get(source); String destination = Os.isAbsolutish(target) ? target : Os.mergePathsUnix(getRunDir(), target); copyResource(source, destination, true); } } Map<String, String> runtimeTemplates = entity.getConfig(SoftwareProcess.RUNTIME_TEMPLATES); if (runtimeTemplates != null && runtimeTemplates.size() > 0) { for (String source : runtimeTemplates.keySet()) { String target = runtimeTemplates.get(source); String destination = Os.isAbsolutish(target) ? target : Os.mergePathsUnix(getRunDir(), target); copyTemplate(source, destination, true, MutableMap.<String, Object>of()); } } } catch (Exception e) { <START> Exceptions.propagateIfFatal(e); <END> } }</code><technical_language>Again, log exception</technical_language>

Target:
public void copyRuntimeResources() { try { execute("mkdir -p " + getRunDir(), "create run directory"); Map<String, String> runtimeFiles = entity.getConfig(SoftwareProcess.RUNTIME_FILES); if (runtimeFiles != null && runtimeFiles.size() > 0) { for (String source : runtimeFiles.keySet()) { String target = runtimeFiles.get(source); String destination = Os.isAbsolutish(target) ? target : Os.mergePathsUnix(getRunDir(), target); copyResource(source, destination, true); } } Map<String, String> runtimeTemplates = entity.getConfig(SoftwareProcess.RUNTIME_TEMPLATES); if (runtimeTemplates != null && runtimeTemplates.size() > 0) { for (String source : runtimeTemplates.keySet()) { String target = runtimeTemplates.get(source); String destination = Os.isAbsolutish(target) ? target : Os.mergePathsUnix(getRunDir(), target); copyTemplate(source, destination, true, MutableMap.<String, Object>of()); } } } catch (Exception e) { log.warn("Error copying runtime resources", e); throw Exceptions.propagate(e); } }
Source:
<code>public void update(Session session) { TagDAO tags = new TagDAO(session); <START> int maxRecentTags = Integer.parseInt(env.get("max_recent_tags")); <END> this.recentTagsUsage = tags.getRecentTagsSince(new DateTime().minusMonths(3), maxRecentTags); }</code><technical_language>please check if max_recent_tags exists java if(env.has("max_recent_tags"))</technical_language>

Target:
public void update(Session session) { TagDAO tags = new TagDAO(session); int maxRecentTags = env.has("max_recent_tags") ? Integer.parseInt(env.get("max_recent_tags")) : 10; this.recentTagsUsage = tags.getRecentTagsSince(new DateTime().minusMonths(3), maxRecentTags); }
Source:
<code>private void addProjectListener() { model.addFieldListener(model.getProject(), new FieldListener() { @Override public void modelChanged(FieldEvent event) { addChildrenListener(); } @Override public boolean listenToField(String fieldName) { <START> return EditScene.NAME.equals(fieldName); <END> } }); }</code><technical_language>This was. "editScene" is name of field in Project, EditScene.NAME is identifier for action. casually string, differ some point</technical_language>

Target:
private void addProjectListener() { model.addFieldListener(model.getProject(), new FieldListener() { @Override public void modelChanged(FieldEvent event) { addChildrenListener(); } @Override public boolean listenToField(String fieldName) { return "editScene".equals(fieldName); } }); }
Source:
<code>public Set<Player> getViewers() { <START> return ImmutableSet.copyOf((Set) playerList); <END> }</code><technical_language>this</technical_language>

Target:
public Set<Player> getViewers() { return ImmutableSet.copyOf((Set) this.playerList); }
Source:
<code>public void initForViewByQuestion(InstructorAttributes instructor, String selectedSection, String showStats, String groupByTeam) { this.viewType = ViewType.QUESTION; this.sortType = ViewType.QUESTION.toString(); initCommonVariables(instructor, selectedSection, showStats, groupByTeam); Map<FeedbackQuestionAttributes, List<FeedbackResponseAttributes>> questionToResponseMap = bundle.getQuestionResponseMap(); questionPanels = new ArrayList<InstructorFeedbackResultsQuestionTable>(); boolean isLoadingStructureOnly = questionToResponseMap.size() > 1; for (Map.Entry<FeedbackQuestionAttributes, List<FeedbackResponseAttributes>> entry : questionToResponseMap.entrySet()) { FeedbackQuestionAttributes question = entry.getKey(); List<FeedbackResponseAttributes> responses = entry.getValue(); InstructorFeedbackResultsQuestionTable questionPanel = buildQuestionTableAndResponseRows(question, responses, ""); if (isLoadingStructureOnly) { questionPanel.setQuestionHasResponses(false); <START> } <END> questionPanels.add(questionPanel); } }</code><technical_language>In case loading structure, is building response rows, showing them? responses empty list in case, isShowingResponseRows (in called method) set false, is this handled already</technical_language>

Target:
public void initForViewByQuestion(InstructorAttributes instructor, String selectedSection, String showStats, String groupByTeam) { this.viewType = ViewType.QUESTION; this.sortType = ViewType.QUESTION.toString(); initCommonVariables(instructor, selectedSection, showStats, groupByTeam); Map<FeedbackQuestionAttributes, List<FeedbackResponseAttributes>> questionToResponseMap = bundle.getQuestionResponseMap(); questionPanels = new ArrayList<InstructorFeedbackResultsQuestionTable>(); boolean isLoadingStructureOnly = questionToResponseMap.size() > 1; for (Map.Entry<FeedbackQuestionAttributes, List<FeedbackResponseAttributes>> entry : questionToResponseMap.entrySet()) { FeedbackQuestionAttributes question = entry.getKey(); List<FeedbackResponseAttributes> responses = entry.getValue(); InstructorFeedbackResultsQuestionTable questionPanel; if (isLoadingStructureOnly) { questionPanel = buildQuestionTableWithoutResponseRows(question, responses, ""); questionPanel.setHasResponses(false); } else { questionPanel = buildQuestionTableAndResponseRows(question, responses, ""); } questionPanels.add(questionPanel); } }
Source:
<code>public void run() { try (SweepLocks locks = createSweepLocks()) { waitUntilSpecificTableSweeperIsInitialized(); Thread.sleep(getBackoffTimeWhenSweepHasNotRun()); log.info("Starting background sweeper."); while (true) { SweepOutcome outcome = checkConfigAndRunSweep(locks); log.info("Sweep iteration finished with outcome: {}", SafeArg.of("sweepOutcome", outcome)); updateBatchSize(outcome); updateMetrics(outcome); sleepUntilNextRun(outcome); } } catch (InterruptedException e) { log.warn("Shutting down background sweeper. Please restart the service to rerun background sweep."); sweepOutcomeMetrics.shutdown(); } catch (Throwable t) { log.error("BackgroundSweeper failed fatally and will not rerun until restarted: {}", <START> UnsafeArg.of("message", t.getMessage()), t); <END> sweepOutcomeMetrics.fatal(); } }</code><technical_language>nit: rewrapping message in unsafe arg in unnecessary</technical_language>

Target:
public void run() { try (SweepLocks locks = createSweepLocks()) { waitUntilSpecificTableSweeperIsInitialized(); Thread.sleep(getBackoffTimeWhenSweepHasNotRun()); log.info("Starting background sweeper."); while (true) { SweepOutcome outcome = checkConfigAndRunSweep(locks); log.info("Sweep iteration finished with outcome: {}", SafeArg.of("sweepOutcome", outcome)); updateBatchSize(outcome); updateMetrics(outcome); sleepUntilNextRun(outcome); } } catch (InterruptedException e) { log.warn("Shutting down background sweeper. Please restart the service to rerun background sweep."); sweepOutcomeMetrics.registerOccurrenceOf(SweepOutcome.SHUTDOWN); } catch (Throwable t) { log.error("BackgroundSweeper failed fatally and will not rerun until restarted: {}", UnsafeArg.of("message", t.getMessage()), t); sweepOutcomeMetrics.registerOccurrenceOf(SweepOutcome.FATAL); } }
Source:
<code>public void serialize(OutputArchive oa) throws IOException { Map<Long, List<ACL>> clonedLongKeyMap; synchronized (this) { clonedLongKeyMap = new HashMap<Long, List<ACL>>(longKeyMap); } <START> oa.writeInt(clonedLongKeyMap.size(), "map"); <END> for (Map.Entry<Long, List<ACL>> val : clonedLongKeyMap.entrySet()) { oa.writeLong(val.getKey(), "long"); List<ACL> aclList = val.getValue(); oa.startVector(aclList, "acls"); for (ACL acl : aclList) { acl.serialize(oa, "acl"); } oa.endVector(aclList, "acls"); } }</code><technical_language>synchronized (this) { clonedLongKeyMap = new HashMap<>(longKeyMap); }</technical_language>

Target:
public void serialize(OutputArchive oa) throws IOException { Map<Long, List<ACL>> clonedLongKeyMap; synchronized (this) { clonedLongKeyMap = new HashMap<>(longKeyMap); } oa.writeInt(clonedLongKeyMap.size(), "map"); for (Map.Entry<Long, List<ACL>> val : clonedLongKeyMap.entrySet()) { oa.writeLong(val.getKey(), "long"); List<ACL> aclList = val.getValue(); oa.startVector(aclList, "acls"); for (ACL acl : aclList) { acl.serialize(oa, "acl"); } oa.endVector(aclList, "acls"); } }
Source:
<code>public void handleMessage(Message msg) { switch(msg.what) { case MSG_SHOW_NO_UPSTREAM: final Resources res = getResourcesForSubId(mContext, <START> mActiveDataSubId); <END> final String title = res.getString(R.string.no_upstream_notification_title); final String message = res.getString(R.string.no_upstream_notification_message); final String disableButton = res.getString(R.string.no_upstream_notification_disable_button); final PendingIntent pi = PendingIntent.getBroadcast( mContext.createContextAsUser(UserHandle.CURRENT, 0), 0 , new Intent(ACTION_DISABLE_TETHERING), 0 ); final Action action = new Action.Builder(NO_ICON_ID, disableButton, pi).build(); showNotification(R.drawable.stat_sys_tether_general, title, message, NO_UPSTREAM_NOTIFICATION_ID, null , action); break; } }</code><technical_language>accessing this wrong thread</technical_language>

Target:
public void handleMessage(Message msg) { switch(msg.what) { case EVENT_SHOW_NO_UPSTREAM: notifyTetheringNoUpstream(); break; } }
Source:
<code>public E save(final E entity) { <START> if (entity.getId() == null) { <END> entityManager.persist(entity); return entity; } else { return entityManager.merge(entity); } }</code><technical_language>some not-null check added here</technical_language>

Target:
public E save(final E entity) { Assert.requireNonNull(entity , "entity"); if (entity.getId() == null) { entityManager.persist(entity); return entity; } else { return entityManager.merge(entity); } }
Source:
<code>public void setAscent (int ascent) { checkLayout(); if (ascent < -1) SWT.error(SWT.ERROR_INVALID_ARGUMENT); <START> if (this.ascent == ascent) return; <END> freeRuns(); this.ascent = ascent; }</code><technical_language>Points Pixel conversion needed</technical_language>

Target:
public void setAscent (int ascent) { checkLayout(); if (ascent < -1) SWT.error(SWT.ERROR_INVALID_ARGUMENT); ascent = DPIUtil.autoScaleUp(ascent); if (this.ascentInPixels == ascent) return; freeRuns(); this.ascentInPixels = ascent; }
Source:
<code>public static Response<AssetReportGetResponse> waitTillReady( PlaidClient client, String assetReportToken) throws Exception { int NUM_RETRIES = 20; int INTER_REQUEST_SLEEP = 1000; int attempt = 0; Response<AssetReportGetResponse> response; do { <START> boolean includeInsights = false; <END> AssetReportGetRequest assetReportGet = new AssetReportGetRequest(assetReportToken) .withIncludeInsights(includeInsights); response = client.service().assetReportGet(assetReportGet).execute(); attempt++; Thread.sleep(INTER_REQUEST_SLEEP); } while ( !response.isSuccessful() && response.errorBody() != null && client.parseError(response).getErrorCode().equals(PRODUCT_NOT_READY) && attempt < NUM_RETRIES ); if (!response.isSuccessful()) { throw new Exception( String.format("Could not get asset report. Failed with %s", client.parseError(response).getErrorMessage() )); } return response; }</code><technical_language>include a test set includeInsights true</technical_language>

Target:
public static Response<AssetReportGetResponse> waitTillReady( PlaidClient client, String assetReportToken) throws Exception { int NUM_RETRIES = 20; int INTER_REQUEST_SLEEP = 1000; int attempt = 0; Response<AssetReportGetResponse> response; do { AssetReportGetRequest assetReportGet = new AssetReportGetRequest(assetReportToken); response = client.service().assetReportGet(assetReportGet).execute(); attempt++; Thread.sleep(INTER_REQUEST_SLEEP); } while ( !response.isSuccessful() && response.errorBody() != null && client.parseError(response).getErrorCode().equals(PRODUCT_NOT_READY) && attempt < NUM_RETRIES ); if (!response.isSuccessful()) { throw new Exception( String.format("Could not get asset report. Failed with %s", client.parseError(response).getErrorMessage() )); } return response; }
Source:
<code>public static String HEX(String s) throws UnsupportedEncodingException { if (s == null) return null; else { <START> byte[] b = s.getBytes("UTF-8"); <END> return StringUtil.toHexString(b, 0, b.length).toUpperCase(); } }</code><technical_language>I a constant com.splicemachine.primitives.Bytes.UTF8_CHARSET</technical_language>

Target:
public static String HEX(String s) throws UnsupportedEncodingException { if (s == null) return null; else { byte[] b = s.getBytes(Bytes.UTF8_CHARSET); return StringUtil.toHexString(b, 0, b.length).toUpperCase(); } }
Source:
<code>public double predict(Double[] input) { <START> LeapFrameBuilder builder = new LeapFrameBuilder(); <END> List<StructField> structFields = new ArrayList<>(); for (String fieldName : schema) structFields.add(new StructField(fieldName, ScalarType.Double())); StructType schema = builder.createSchema(structFields); List<Row> rows = new ArrayList<>(); rows.add(builder.createRowFromIterable(Arrays.asList(input))); DefaultLeapFrame inputFrame = builder.createFrame(schema, rows); return predict(inputFrame); }</code><technical_language>add assertion input.size == schema.size behavior: HashMap vec = IntStream.range(0, input.length).boxed().collect(Collectors.asMap(i -> schema.get(i), i -> input.get(i))); return predict(vec);</technical_language>

Target:
public double predict(Double[] input) { if (input.length != schema.size()) throw new IllegalArgumentException("Input size is not equal to schema size"); Map<String, Double> vec = IntStream.range(0, input.length) .boxed() .collect(Collectors.toMap(schema::get, i -> input[i])); return predict(new HashMap<>(vec)); }
Source:
<code>public void setupSelectComponent(final DataTypeSelect typeSelect) { type.innerHTML = ""; <START> HTMLElement element = typeSelect.getElement(); <END> if (element instanceof HTMLDivElement) { new MenuInitializer((HTMLDivElement) element, ".btn-group").init(); } type.appendChild(typeSelect.getElement()); }</code><technical_language>I add a final here: suggestion final HTMLElement element = typeSelect.getElement();</technical_language>

Target:
public void setupSelectComponent(final DataTypeSelect typeSelect) { type.innerHTML = ""; final HTMLElement element = typeSelect.getElement(); new MenuInitializer(element, ".btn-group").init(); type.appendChild(element); }
Source:
<code>public void migrate() { String connectionUrl = ninjaProperties.getOrDie(NinjaConstant.DB_CONNECTION_URL); String connectionUsername = ninjaProperties.getOrDie(NinjaConstant.DB_CONNECTION_USERNAME); String connectionPassword = ninjaProperties.getOrDie(NinjaConstant.DB_CONNECTION_PASSWORD); String locations = ninjaProperties.get(NinjaConstant.NINJA_MIGRATION_LOCATIONS); String schemas = this.ninjaProperties.get(NinjaConstant.NINJA_MIGRATION_SCHEMAS); Flyway flyway = new Flyway(); flyway.setDataSource(connectionUrl, connectionUsername, connectionPassword); <START> if (locations != null) <END> flyway.setLocations(locations); if (schemas != null) flyway.setSchemas(schemas); if (ninjaProperties.getBooleanWithDefault(NinjaConstant.NINJA_MIGRATION_DROP_SCHEMA, ninjaProperties.isTest() ? true : false )) { flyway.clean(); } flyway.migrate(); }</code><technical_language>tiny, add curly braces if statements</technical_language>

Target:
public void migrate() { String connectionUrl = ninjaProperties.getOrDie(NinjaConstant.DB_CONNECTION_URL); String connectionUsername = ninjaProperties.getOrDie(NinjaConstant.DB_CONNECTION_USERNAME); String connectionPassword = ninjaProperties.getOrDie(NinjaConstant.DB_CONNECTION_PASSWORD); String locations = ninjaProperties.get(NinjaConstant.NINJA_MIGRATION_LOCATIONS); String schemas = ninjaProperties.get(NinjaConstant.NINJA_MIGRATION_SCHEMAS); Flyway flyway = flywayProvider.get(); flyway.setDataSource(connectionUrl, connectionUsername, connectionPassword); if (locations != null) { flyway.setLocations(locations); } if (schemas != null) { flyway.setSchemas(schemas); } if (ninjaProperties.getBooleanWithDefault(NinjaConstant.NINJA_MIGRATION_DROP_SCHEMA, ninjaProperties.isTest() ? true : false )) { flyway.clean(); } flyway.migrate(); }
Source:
<code>@Override Expression implementSafe(RexToLixTranslator translator, RexCall call, List<Expression> argValueList) { final Expression argValue = argValueList.get(0); final Expression e; if (expressionType == ExpressionType.Negate && argValue.type == BigDecimal.class) { <START> e = Expressions.call(BuiltInMethod.DECIMAL_NEGATE.method, argValue); <END> } else { e = Expressions.makeUnary(expressionType, argValue); } if (e.type.equals(argValue.type)) { return e; } return Expressions.convert_(e, argValue.type); }</code><technical_language>Julian's suggestion, Expressions.call(argValue, "negate") here, do need extra functions</technical_language>

Target:
@Override Expression implementSafe(RexToLixTranslator translator, RexCall call, List<Expression> argValueList) { final Expression argValue = argValueList.get(0); final Expression e; if (expressionType == ExpressionType.Negate && argValue.type == BigDecimal.class && null != backupMethodName) { e = Expressions.call(argValue, backupMethodName); } else { e = Expressions.makeUnary(expressionType, argValue); } if (e.type.equals(argValue.type)) { return e; } return Expressions.convert_(e, argValue.type); }
Source:
<code>public Object readBlocksWithoutJni(BenchmarkData data) throws Throwable { OrcBatchRecordReader recordReader = data.createRecordReader(false); <START> List<Block> blocks = new ArrayList<>(); <END> while (recordReader.nextBatch() > 0) { Block block = recordReader.readBlock(data.type, 0); blocks.add(block); } return blocks; }</code><technical_language>ImmutableList.builder</technical_language>

Target:
public Object readBlocksWithoutJni(BenchmarkData data) throws Throwable { OrcBatchRecordReader recordReader = data.createRecordReader(false); ImmutableList.Builder<Block> blocks = new ImmutableList.Builder<>(); while (recordReader.nextBatch() > 0) { Block block = recordReader.readBlock(0); blocks.add(block); } return blocks.build(); }
Source:
<code>public Map<String, Metric> getMetrics() { <START> return metrics; <END> }</code><technical_language>wrap this in Collections.unmodifiableMap</technical_language>

Target:
public Map<String, Metric> getMetrics() { return Collections.unmodifiableMap(metrics); }
Source:
<code>public synchronized void dispose() { ReactContext reactContext = (ReactContext) mContext; reactContext.removeLifecycleEventListener(mLifeCycleListener); if(mLocationLayer != null){ mLocationLayer.onStop(); } mLocationManger.dispose(); final RCTMGLMapView mapView = this; reactContext.runOnUiQueueThread(new Runnable() { @Override public void run() { mapView.onDestroy(); } <START> }); <END> }</code><technical_language>'this' is a view, post message queue. call onDestroy method directly. post(new Runnable() { @Override public void run() { onDestroy(); } });</technical_language>

Target:
public synchronized void dispose() { if (mDestroyed) { return; } ReactContext reactContext = (ReactContext) mContext; reactContext.removeLifecycleEventListener(mLifeCycleListener); if(mLocationLayer != null){ mLocationLayer.onStop(); } mLocationManger.dispose(); if (!mPaused) { onPause(); } onStop(); onDestroy(); }
Source:
<code>public DescriptorImpl getDescriptor() { return (DescriptorImpl) Jenkins.getInstance().getDescriptor(RoleBasedProjectNamingStrategy.class); <START> <END> }</code><technical_language>whitespace</technical_language>

Target:
public DescriptorImpl getDescriptor() { return (DescriptorImpl) Jenkins.getActiveInstance().getDescriptor(RoleBasedProjectNamingStrategy.class); }
Source:
<code><START> private String getShortDescription(final String extensionName) throws FalconException { <END> AbstractExtension extension = ExtensionFactory.getExtensionType(extensionName); return extension.getDescription(); }</code><technical_language>This emulate is done in org.apache.falcon.resource.extensions.ExtensionManager#getShortDescription. AbstractExtension a getDescription method</technical_language>

Target:
private String getShortDescription(final String extensionName) throws FalconException { String content = getResource(extensionName, extensionName.toLowerCase() + EXTENSION_PROPERTY_JSON_SUFFIX); String description; try { JSONObject jsonObject = new JSONObject(content); description = (String) jsonObject.get(SHORT_DESCRIPTION); } catch (JSONException e) { throw new FalconException(e); } return description; }