auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void analyzeSentimentStringListWithOptions() { List<String> documents = Arrays.asList( "The hotel was dark and unclean.", "The restaurant had amazing gnocchi." ); <START> textAnalyticsAsyncClient.analyzeSentimentBatch(documents, "en", (TextAnalyticsRequestOptions) null).subscribe( <END> response -> { TextDocumentBatchStatistics batchStatistics = response.getStatistics(); System.out.printf("Batch statistics, transaction count: %s, valid document count: %s.%n", batchStatistics.getTransactionCount(), batchStatistics.getValidDocumentCount()); response.forEach(analyzeSentimentResult -> { System.out.printf("Document ID: %s%n", analyzeSentimentResult.getId()); DocumentSentiment documentSentiment = analyzeSentimentResult.getDocumentSentiment(); System.out.printf("Recognized document sentiment: %s.%n", documentSentiment.getSentiment()); documentSentiment.getSentences().forEach(sentenceSentiment -> System.out.printf("Recognized sentence sentiment: %s, positive score: %.2f, " + "neutral score: %.2f, negative score: %.2f.%n", sentenceSentiment.getSentiment(), sentenceSentiment.getConfidenceScores().getPositive(), sentenceSentiment.getConfidenceScores().getNeutral(), sentenceSentiment.getConfidenceScores().getNegative())); }); }); END: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.analyzeSentimentBatch#Iterable-String-TextAnalyticsRequestOptions }</code><technical_language>a good example show. Please options more efficiently other overload. Applicable for examples below</technical_language>

Target:
public void analyzeSentimentStringListWithOptions() { List<String> documents = Arrays.asList( "The hotel was dark and unclean.", "The restaurant had amazing gnocchi." ); textAnalyticsAsyncClient.analyzeSentimentBatch(documents, "en", new TextAnalyticsRequestOptions().setIncludeStatistics(true)).subscribe( response -> { TextDocumentBatchStatistics batchStatistics = response.getStatistics(); System.out.printf("Batch statistics, transaction count: %s, valid document count: %s.%n", batchStatistics.getTransactionCount(), batchStatistics.getValidDocumentCount()); response.forEach(analyzeSentimentResult -> { System.out.printf("Document ID: %s%n", analyzeSentimentResult.getId()); DocumentSentiment documentSentiment = analyzeSentimentResult.getDocumentSentiment(); System.out.printf("Recognized document sentiment: %s.%n", documentSentiment.getSentiment()); documentSentiment.getSentences().forEach(sentenceSentiment -> System.out.printf("Recognized sentence sentiment: %s, positive score: %.2f, " + "neutral score: %.2f, negative score: %.2f.%n", sentenceSentiment.getSentiment(), sentenceSentiment.getConfidenceScores().getPositive(), sentenceSentiment.getConfidenceScores().getNeutral(), sentenceSentiment.getConfidenceScores().getNegative())); }); }); END: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.analyzeSentimentBatch#Iterable-String-TextAnalyticsRequestOptions }
Source:
<code>public Map<String, List<Message>> validateProjectData(final Workbook workbook, final String programUUID) { final Map<String, List<Message>> errors = new HashMap<String, List<Message>>(); <START> this.checkForExistingTrialInstance(this.ontologyDataManager, workbook, errors, programUUID); <END> this.setRequiredFields(this.ontologyDataManager, workbook); final List<Message> requiredVariableValueErrors = this.checkForEmptyRequiredVariables(workbook); if (!requiredVariableValueErrors.isEmpty()) { errors.put(Constants.OBSERVATION_DATA_ERRORS, requiredVariableValueErrors); } return errors; }</code><technical_language>services class members, need pass internally in functions either. Please remove parameters access in other functions. This needs done for instances of ontology germplasm data manager services passed in function parameters. I fix this @abatac while I syncing master</technical_language>

Target:
public Map<String, List<Message>> validateProjectData(final Workbook workbook, final String programUUID) { final Map<String, List<Message>> errors = new HashMap<String, List<Message>>(); this.checkForExistingTrialInstance(workbook, errors, programUUID); this.setRequiredFields(workbook); final List<Message> requiredVariableValueErrors = this.checkForEmptyRequiredVariables(workbook); if (!requiredVariableValueErrors.isEmpty()) { errors.put(Constants.OBSERVATION_DATA_ERRORS, requiredVariableValueErrors); } return errors; }
Source:
<code>void downloadArchiveForMixedValidAndInvalidExperimentAccessions() throws Exception { ResultActions result = this.mockMvc.perform(get(ARCHIVE_DOWNLOAD_LIST_URL) .param("accession", EXPERIMENT_ACCESSION_LIST.get(0)) .param("accession", EXPERIMENT_ACCESSION_LIST.get(1)) .param("accession", INVALID_EXPERIMENT_ACCESSION_LIST.get(0)) .param("accession", INVALID_EXPERIMENT_ACCESSION_LIST.get(1))); byte[] contentByte = result.andReturn().getResponse().getContentAsByteArray(); ZipInputStream zipInputStream = new ZipInputStream(new ByteArrayInputStream(contentByte)); String expectedArchiveName = MessageFormat.format( ARCHIVE_NAME, EXPERIMENT_ACCESSION_LIST.size(), "experiment"); result.andExpect(status().isOk()) <START> .andExpect(content().string(containsString(zipInputStream.getNextEntry().getName()))) <END> .andExpect(header().string(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + expectedArchiveName)) .andExpect(content().contentType("application/zip")); }</code><technical_language>test zip archive contains **all** file names expect, one</technical_language>

Target:
void downloadArchiveForMixedValidAndInvalidExperimentAccessions() throws Exception { ResultActions result = this.mockMvc.perform(get(ARCHIVE_DOWNLOAD_LIST_URL) .param("accession", EXPERIMENT_ACCESSION_LIST.get(0)) .param("accession", EXPERIMENT_ACCESSION_LIST.get(1)) .param("accession", INVALID_EXPERIMENT_ACCESSION_LIST.get(0)) .param("accession", INVALID_EXPERIMENT_ACCESSION_LIST.get(1))); String expectedArchiveName = MessageFormat.format( ARCHIVE_NAME, EXPERIMENT_ACCESSION_LIST.size(), "experiment"); byte[] contentByte = result.andReturn().getResponse().getContentAsByteArray(); ZipInputStream zipInputStream = new ZipInputStream(new ByteArrayInputStream(contentByte)); ImmutableList<String> sourceFileNames = getSourceValidFileNames(); ArrayList<String> contentFileNames = new ArrayList<>(); ZipEntry entry; while ((entry = zipInputStream.getNextEntry()) != null) { contentFileNames.add(Paths.get(entry.getName()).getFileName().toString()); } assertThat(sourceFileNames.containsAll(contentFileNames)).isTrue(); result.andExpect(status().isOk()) .andExpect(header().string(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + expectedArchiveName)) .andExpect(content().contentType("application/zip")); }
Source:
<code>public View display(Context context, int position, View v) { if (v == null) v = inflateFromId(context, R.layout.item_search); TextView appName = (TextView) v.findViewById(R.id.item_search_text); <START> String text = context.getString(R.string.ui_item_search); <END> ImageView image = (ImageView) v.findViewById(R.id.item_search_icon); if(searchPojo.direct) { text = context.getString(R.string.ui_item_visit); appName.setText(enrichText(String.format(text, "{" + this.pojo.name + "}"))); image.setImageResource(R.drawable.ic_public); } else { appName.setText(enrichText(String.format(text, this.pojo.name, "{" + searchPojo.query + "}"))); image.setImageResource(R.drawable.search); } image.setColorFilter(getThemeFillColor(context), PorterDuff.Mode.SRC_IN); return v; }</code><technical_language>Please move this else branch of if(searchPojo.direct) clearer (code flow-wise) this is (and isn't) used</technical_language>

Target:
public View display(Context context, int position, View v) { if (v == null) v = inflateFromId(context, R.layout.item_search); TextView appName = (TextView) v.findViewById(R.id.item_search_text); ImageView image = (ImageView) v.findViewById(R.id.item_search_icon); if(searchPojo.direct) { String text = context.getString(R.string.ui_item_visit); appName.setText(enrichText(String.format(text, "{" + this.pojo.name + "}"))); image.setImageResource(R.drawable.ic_public); } else { String text = context.getString(R.string.ui_item_search); appName.setText(enrichText(String.format(text, this.pojo.name, "{" + searchPojo.query + "}"))); image.setImageResource(R.drawable.search); } image.setColorFilter(getThemeFillColor(context), PorterDuff.Mode.SRC_IN); return v; }
Source:
<code>private void testContent() throws Exception { ______TS("Typical case: large session with no sections"); resultsPage = loginToInstructorFeedbackResultsPageWithViewType("CFResultsUiT.instr", "Session with no sections", true, "question"); resultsPage.verifyStatus(Const.StatusMessages.FEEDBACK_RESULTS_QUESTIONVIEWWARNING); ______TS("Typical case: standard session results"); resultsPage = loginToInstructorFeedbackResultsPage("CFResultsUiT.instr", "Open Session"); <START> resultsPage.clickCollapseExpandButton(); <END> resultsPage.verifyHtml("/instructorFeedbackResultsPageOpen.html"); ______TS("Typical case: standard session results: helper view"); resultsPage = loginToInstructorFeedbackResultsPage("CFResultsUiT.helper1", "Open Session"); resultsPage.loadResultQuestionPanel(1); resultsPage.verifyHtmlMainContent("/instructorFeedbackResultsPageOpenViewForHelperOne.html"); resultsPage = loginToInstructorFeedbackResultsPage("CFResultsUiT.helper2", "Open Session"); resultsPage.loadResultQuestionPanel(1); resultsPage.verifyHtmlMainContent("/instructorFeedbackResultsPageOpenViewForHelperTwo.html"); ______TS("Typical case: empty session"); resultsPage = loginToInstructorFeedbackResultsPage("CFResultsUiT.instr", "Empty Session"); resultsPage.loadResultQuestionPanel(1); resultsPage.verifyHtmlMainContent("/instructorFeedbackResultsPageEmpty.html"); }</code><technical_language>a change in behaviour - wait</technical_language>

Target:
private void testContent() throws Exception { ______TS("Typical case: large session with no sections"); resultsPage = loginToInstructorFeedbackResultsPageWithViewType("CFResultsUiT.instr", "Session with no sections", true, "question"); resultsPage.verifyStatus(Const.StatusMessages.FEEDBACK_RESULTS_QUESTIONVIEWWARNING); ______TS("Typical case: standard session results"); resultsPage = loginToInstructorFeedbackResultsPage("CFResultsUiT.instr", "Open Session"); resultsPage.clickCollapseExpandButtonAndWaitForPanelsToExpand(); resultsPage.verifyHtml("/instructorFeedbackResultsPageOpen.html"); ______TS("Typical case: standard session results: helper view"); resultsPage = loginToInstructorFeedbackResultsPage("CFResultsUiT.helper1", "Open Session"); resultsPage.loadResultQuestionPanel(1); resultsPage.verifyHtmlMainContent("/instructorFeedbackResultsPageOpenViewForHelperOne.html"); resultsPage = loginToInstructorFeedbackResultsPage("CFResultsUiT.helper2", "Open Session"); resultsPage.loadResultQuestionPanel(1); resultsPage.verifyHtmlMainContent("/instructorFeedbackResultsPageOpenViewForHelperTwo.html"); ______TS("Typical case: empty session"); resultsPage = loginToInstructorFeedbackResultsPage("CFResultsUiT.instr", "Empty Session"); resultsPage.loadResultQuestionPanel(1); resultsPage.verifyHtmlMainContent("/instructorFeedbackResultsPageEmpty.html"); }
Source:
<code>public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(PreferenceConstants.DIAGRAM_FONT)) { <START> updateListner.updateFonts(); <END> } }</code><technical_language>Listener Listner (typo)</technical_language>

Target:
public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(PreferenceConstants.DIAGRAM_FONT)) { updateListener.updateFonts(); } }
Source:
<code>private Set<String> processPoolUpdates( Map<String, EventBuilder> poolEvents, List<PoolUpdate> updatedPools) { Set<String> entitlementsToRegen = Util.newSet(); for (PoolUpdate updatedPool : updatedPools) { Pool existingPool = updatedPool.getPool(); log.info("Pool changed: {}", updatedPool.toString()); if (existingPool.isMarkedForDelete()) { log.warn("Deleting pool as requested by rules: {}", existingPool.getId()); deletePool(existingPool); continue; } this.poolCurator.merge(existingPool); this.poolCurator.flush(); if (updatedPool.getQuantityChanged()) { List<Pool> existingPools = new ArrayList<Pool>(); existingPools.add(existingPool); <START> this.deleteExcessEntitlements(existingPools); <END> } if (updatedPool.getDatesChanged() || updatedPool.getProductsChanged() || updatedPool.getBrandingChanged()) { List<String> entitlements = poolCurator .retrieveFreeEntitlementIdsOfPool(existingPool, true); entitlementsToRegen.addAll(entitlements); } EventBuilder builder = poolEvents.get(existingPool.getId()); if (builder != null) { Event event = builder.setNewEntity(existingPool).buildEvent(); sink.queueEvent(event); } else { log.warn("Pool updated without an event builder: {}", existingPool); } } return entitlementsToRegen; }</code><technical_language>In future need a quick list this, Arrays.asList wrap element (or elements)</technical_language>

Target:
private Set<String> processPoolUpdates( Map<String, EventBuilder> poolEvents, List<PoolUpdate> updatedPools) { Set<String> entitlementsToRegen = Util.newSet(); for (PoolUpdate updatedPool : updatedPools) { Pool existingPool = updatedPool.getPool(); log.info("Pool changed: {}", updatedPool.toString()); if (existingPool.isMarkedForDelete()) { log.warn("Deleting pool as requested by rules: {}", existingPool.getId()); deletePool(existingPool); continue; } this.poolCurator.merge(existingPool); this.poolCurator.flush(); if (updatedPool.getQuantityChanged()) { List<Pool> existingPools = Arrays.asList(existingPool); this.deleteExcessEntitlements(existingPools); } if (updatedPool.getDatesChanged() || updatedPool.getProductsChanged() || updatedPool.getBrandingChanged()) { List<String> entitlements = poolCurator .retrieveFreeEntitlementIdsOfPool(existingPool, true); entitlementsToRegen.addAll(entitlements); } EventBuilder builder = poolEvents.get(existingPool.getId()); if (builder != null) { Event event = builder.setNewEntity(existingPool).buildEvent(); sink.queueEvent(event); } else { log.warn("Pool updated without an event builder: {}", existingPool); } } return entitlementsToRegen; }
Source:
<code>static long Proc (long handle, long arg0, long user_data) { long webView = 0; boolean indirectWebView = false; if (OS.G_TYPE_CHECK_INSTANCE_TYPE (handle, WebKitGTK.webkit_web_view_get_type ())) { webView = handle; } else if (OS.G_TYPE_CHECK_INSTANCE_TYPE (handle, WebKitGTK.webkit_web_frame_get_type ())) { if (WEBKIT2) { } else { webView = WebKitGTK.webkit_web_frame_get_web_view (handle); } <START> } else if (OS.G_TYPE_CHECK_INSTANCE_TYPE (handle, WebKitGTK.webkit_web_context_get_type ())) { webView = user_data; user_data = DOWNLOAD_REQUESTED; indirectWebView = true; } else if (OS.G_TYPE_CHECK_INSTANCE_TYPE (handle, WebKitGTK.webkit_download_get_type ())) { webView = WebKitGTK.webkit_download_get_web_view(handle); indirectWebView = true; <END> } else { return 0; } assert webView != 0 : "Webview shouldn't be null here"; Browser browser = FindBrowser (webView); if (browser == null) return 0; WebKit webkit = (WebKit)browser.webBrowser; if (webView == handle || indirectWebView) { return webkit.webViewProc (handle, arg0, user_data); } else { return webkit.webFrameProc (handle, arg0, user_data); } }</code><technical_language>I checked, is safe run this Webkit1? sense add a webkit2 guard</technical_language>

Target:
static long Proc (long handle, long arg0, long user_data) { long webView = 0; boolean indirectWebView = false; if (OS.G_TYPE_CHECK_INSTANCE_TYPE (handle, WebKitGTK.webkit_web_view_get_type ())) { webView = handle; } else if (OS.G_TYPE_CHECK_INSTANCE_TYPE (handle, WebKitGTK.webkit_web_frame_get_type ())) { if (WEBKIT2) { } else { webView = WebKitGTK.webkit_web_frame_get_web_view (handle); } } else if (WEBKIT2 && OS.G_TYPE_CHECK_INSTANCE_TYPE (handle, WebKitGTK.webkit_web_context_get_type ())) { webView = user_data; user_data = DOWNLOAD_REQUESTED; indirectWebView = true; } else if (WEBKIT2 && OS.G_TYPE_CHECK_INSTANCE_TYPE (handle, WebKitGTK.webkit_download_get_type ())) { webView = WebKitGTK.webkit_download_get_web_view(handle); indirectWebView = true; } else { return 0; } assert webView != 0 : "Webview shouldn't be null here"; Browser browser = FindBrowser (webView); if (browser == null) return 0; WebKit webkit = (WebKit)browser.webBrowser; if (webView == handle || indirectWebView) { return webkit.webViewProc (handle, arg0, user_data); } else { return webkit.webFrameProc (handle, arg0, user_data); } }
Source:
<code><START> protected Map<String, String> getConfiguration() { <END> return ImmutableMap.copyOf(configuration); }</code><technical_language>change signature ImmutableMap well, please</technical_language>

Target:
protected ImmutableMap<String, String> getConfiguration() { return ImmutableMap.copyOf(configuration); }
Source:
<code>public BytecodeNode visitSpecialForm(SpecialFormExpression specialForm, Context context) { BytecodeGenerator generator; switch (specialForm.getForm()) { case IF: generator = new IfCodeGenerator(); break; case NULL_IF: generator = new NullIfCodeGenerator(); break; case SWITCH: generator = new SwitchCodeGenerator(); break; case IS_NULL: generator = new IsNullCodeGenerator(); break; case COALESCE: generator = new CoalesceCodeGenerator(); break; case IN: generator = new InCodeGenerator(functionManager); break; case AND: generator = new AndCodeGenerator(); break; case OR: generator = new OrCodeGenerator(); break; <START> case DEREFERENCE: <END> generator = new DereferenceCodeGenerator(); break; case ROW_CONSTRUCTOR: generator = new RowConstructorCodeGenerator(); break; case BIND: generator = new BindCodeGenerator(compiledLambdaMap, context.getLambdaInterface().get()); break; default: throw new IllegalStateException("Can not compile special form: " + specialForm.getForm()); } BytecodeGeneratorContext generatorContext = new BytecodeGeneratorContext( RowExpressionCompiler.this, context.getScope(), callSiteBinder, cachedInstanceBinder, functionManager); return generator.generateExpression(null, generatorContext, specialForm.getType(), specialForm.getArguments(), context.getOutputBlockVariable()); }</code><technical_language>Cannot. This message is vague, Unknown special form operation</technical_language>

Target:
public BytecodeNode visitSpecialForm(SpecialFormExpression specialForm, Context context) { SpecialFormBytecodeGenerator generator; switch (specialForm.getForm()) { case IF: generator = new IfCodeGenerator(); break; case NULL_IF: generator = new NullIfCodeGenerator(); break; case SWITCH: generator = new SwitchCodeGenerator(); break; case IS_NULL: generator = new IsNullCodeGenerator(); break; case COALESCE: generator = new CoalesceCodeGenerator(); break; case IN: generator = new InCodeGenerator(functionManager); break; case AND: generator = new AndCodeGenerator(); break; case OR: generator = new OrCodeGenerator(); break; case DEREFERENCE: generator = new DereferenceCodeGenerator(); break; case ROW_CONSTRUCTOR: generator = new RowConstructorCodeGenerator(); break; case BIND: generator = new BindCodeGenerator(compiledLambdaMap, context.getLambdaInterface().get()); break; default: throw new IllegalStateException("Cannot compile special form: " + specialForm.getForm()); } BytecodeGeneratorContext generatorContext = new BytecodeGeneratorContext( RowExpressionCompiler.this, context.getScope(), callSiteBinder, cachedInstanceBinder, functionManager); return generator.generateExpression(generatorContext, specialForm.getType(), specialForm.getArguments(), context.getOutputBlockVariable()); }
Source:
<code>private void depositDuration(String depositUUID, Map<String, String> status) { String strDepositStartTime = status.get(DepositField.startTime.name()); Long depositStartTime = Long.parseLong(strDepositStartTime); long depositEndTime = System.currentTimeMillis(); long depositTotalTime = depositEndTime - depositStartTime; <START> GaugeFactory.createDurationGauge(MetricRegistry.name("deposit " + depositUUID, "deposit-duration"), <END> depositTotalTime); String strDepositEndTime = Long.toString(depositEndTime); depositStatusFactory.set(depositUUID, DepositField.endTime, strDepositEndTime); }</code><technical_language>want "deposit:" uuid run it</technical_language>

Target:
private void depositDuration(String depositUUID, Map<String, String> status) { String strDepositStartTime = status.get(DepositField.startTime.name()); Long depositStartTime = Long.parseLong(strDepositStartTime); long depositEndTime = System.currentTimeMillis(); long depositTotalTime = depositEndTime - depositStartTime; depositHist.update(depositTotalTime); String strDepositEndTime = Long.toString(depositEndTime); depositStatusFactory.set(depositUUID, DepositField.endTime, strDepositEndTime); }
Source:
<code>public boolean migrateIfNeeded() { SQLiteDatabase db = app.getDbOpenHelper().getWritableDatabase(); Cursor cur; try { cur = db.rawQuery("SELECT * FROM bookmarks", null); } catch (SQLiteException ex) { return false; } int rowsFound = 0; cur.moveToFirst(); while (!cur.isAfterLast()) { Site site = new Site(cur.getString(COL_INDEX_SITE)); PageTitle title = new PageTitle(cur.getString(COL_INDEX_TITLE), site); Date timestamp = new Date(cur.getLong(COL_INDEX_TIME)); SavedPage page = new SavedPage(title, timestamp); <START> app.getPersister(SavedPage.class).upsert(page, null); <END> Log.d("Wikipedia", "Migrated " + title.getDisplayText()); rowsFound += 1; cur.moveToNext(); } cur.close(); db.execSQL("DROP TABLE IF EXISTS bookmarks"); return rowsFound != 0; }</code><technical_language>overloaded upsert() 2nd param? changes in other files</technical_language>

Target:
public boolean migrateIfNeeded() { SQLiteDatabase db = app.getDbOpenHelper().getWritableDatabase(); Cursor cur; try { cur = db.rawQuery("SELECT * FROM bookmarks", null); } catch (SQLiteException ex) { return false; } int rowsFound = 0; cur.moveToFirst(); while (!cur.isAfterLast()) { Site site = new Site(cur.getString(COL_INDEX_SITE)); PageTitle title = new PageTitle(cur.getString(COL_INDEX_TITLE), site); Date timestamp = new Date(cur.getLong(COL_INDEX_TIME)); SavedPage page = new SavedPage(title, timestamp); app.getPersister(SavedPage.class).upsert(page); Log.d("Wikipedia", "Migrated " + title.getDisplayText()); rowsFound += 1; cur.moveToNext(); } cur.close(); db.execSQL("DROP TABLE IF EXISTS bookmarks"); return rowsFound != 0; }
Source:
<code>public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException { <START> return ClusterConnection.getClusterConnectionInfo(); <END> }</code><technical_language>Storing getClusterConnectionInfo ExtensionContext.store remove ThreadLocal dependency lookup</technical_language>

Target:
public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException { return getStore(extensionContext).get(STORE_KEY_CLUSTER_CONNECTION_INFO, ClusterConnectionInfo.class); }
Source:
<code>private void upgradeCustomSystemProperties(ImportMigrationContext context) { Properties importedProps = new Properties(); Properties currentProps; try { File fileOnSystem = Paths.get(System.getProperty("ddf.home")) .toRealPath(LinkOption.NOFOLLOW_LINKS) .resolve(Paths.get("etc", "custom.system.properties")) .toFile(); importedProps.load( context .getEntry(PlatformMigratable.CUSTOM_SYSTEM_PROPERTIES_PATH) .getInputStream() .orElseThrow(IOException::new)); currentProps = new Properties(fileOnSystem); currentProps .entrySet() .stream() .filter( e -> !importedProps.containsKey(e.getKey()) || SYSTEM_PROPERTIES_TO_PRESERVE.contains(e.getKey())) .forEach(e -> importedProps.put(e.getKey(), e.getValue())); importedProps.save(fileOnSystem); } catch (IOException e) { <START> LOGGER.warn("Failed to upgrade system properties", e); <END> } }</code><technical_language>record in context.getReport()</technical_language>

Target:
void upgradeCustomSystemProperties(ImportMigrationContext context) throws IOException { Properties importedProps = new Properties(); Properties currentProps; File fileOnSystem = Paths.get(System.getProperty("ddf.home")) .toRealPath(LinkOption.NOFOLLOW_LINKS) .resolve(Paths.get("etc", "custom.system.properties")) .toFile(); currentProps = new Properties(fileOnSystem); importedProps.load( context .getEntry(PlatformMigratable.CUSTOM_SYSTEM_PROPERTIES_PATH) .getInputStream() .orElseThrow(IOException::new)); currentProps .entrySet() .stream() .filter(e -> propertyShouldNotBeOverwritten(e, importedProps)) .forEach(e -> importedProps.put(e.getKey(), e.getValue())); importedProps.save(fileOnSystem); }
Source:
<code>public Libc load() { try { if (isGraalBuildTime()) { LOG.info("Using Graal-native functions for Graal build time"); return new GraalLibc(); } <START> if (isGraalRunTime()) { <END> LOG.info("Using Graal-native functions for Graal run time"); return new GraalLibc(); } return new JnrLibc(); } catch (Throwable t) { LOG.info( "Unable to load JNR native implementation. This could be normal if JNR is excluded from the classpath", t); return new EmptyLibc(); } }</code><technical_language>I understand do need create conditions. If graal is in build time, is in build time, it? If coalesce if checks: return System.getProperty(GRAAL_STATUS_PROP).equals( return System.getProperty(GRAAL_STATUS_PROP).equals(GRAAL_BUILDTIME_STATUS) || return System.getProperty(GRAAL_STATUS_PROP).equals(GRAAL_RUNTIME_STATUS)</technical_language>

Target:
public Libc load() { try { if (isGraal()) { LOG.info("Using Graal-specific native functions"); return new GraalLibc(); } return new JnrLibc(); } catch (Throwable t) { LOG.info( "Unable to load JNR native implementation. This could be normal if JNR is excluded from the classpath", t); return new EmptyLibc(); } }
Source:
<code>public static void main(String[] args) { CreateDatabase createDatabase = new CreateDatabase(); try { createDatabase.init(args); Instance instance = createDatabase.getInstance(); createDatabase.createDatabase(instance); <START> } <END> catch (Exception e) { e.printStackTrace(); } finally { createDatabase.close(); } }</code><technical_language>[style] } catch {? for } finally {? a big deal - leave this if prefer</technical_language>

Target:
public static void main(String[] args) throws IOException { CreateDatabase createDatabase = new CreateDatabase(); try { createDatabase.init(args); Instance instance = createDatabase.getInstance(); createDatabase.createDatabase(instance); } catch (Exception e) { e.printStackTrace(); } finally { createDatabase.close(); } }
Source:
<code>public Pair<Long, Long> find(byte bucket, byte[] begin, boolean reverse) throws IOException { <START> Scan s = new Scan(); <END> byte[] arr = {bucket}; s.setReversed(reverse).setFilter(new PrefixFilter(arr)); if(begin != null) { s.withStartRow(begin); } HBaseTxnFinder.ScanTimestampIterator si = new HBaseTxnFinder.ScanTimestampIterator(region.getScanner(s)); if(si.hasNext()) { return si.next; } else { return null; } }</code><technical_language>column interested in in scan, check for right KV</technical_language>

Target:
public Pair<Long, Long> find(byte bucket, byte[] begin, boolean reverse) throws IOException { Scan hbaseScan = new Scan(); hbaseScan.addColumn(V2TxnDecoder.FAMILY, V2TxnDecoder.STATE_QUALIFIER_BYTES) .setReversed(reverse) .readAllVersions() .setFilter(new PrefixFilter(new byte[]{bucket})); if (begin != null) { hbaseScan.withStartRow(begin); } HBaseTxnFinder.ScanTimestampIterator si = new ScanTimestampIterator(region.getScanner(hbaseScan)); if (si.hasNext()) { return si.next; } else { return null; } }
Source:
<code>public void processKafkaMessages() throws Exception { final String[] serverlist = m_config.servers.split(","); m_config.password = CLIConfig.readPasswordIfNeeded(m_config.user, m_config.password, "Enter password: "); final ClientConfig c_config = new ClientConfig(m_config.user, m_config.password, null); if (m_config.ssl != null && !m_config.ssl.trim().isEmpty()) { c_config.setTrustStoreConfigFromPropertyFile(m_config.ssl); c_config.enableSSL(); } c_config.setProcedureCallTimeout(0); m_client = getClient(c_config, serverlist, m_config.port); if (m_config.useSuppliedProcedure) { m_loader = new CSVTupleDataLoader((ClientImpl) m_client, m_config.procedure, new KafkaBulkLoaderCallback()); } else { m_loader = new CSVBulkDataLoader((ClientImpl) m_client, m_config.table, m_config.batch, m_config.update, new KafkaBulkLoaderCallback()); } m_loader.setFlushInterval(m_config.flush, m_config.flush); m_consumer = new KafkaConsumerConnector(m_config); try { <START> m_es = getConsumerExecutor(m_consumer, m_loader); <END> if (m_config.useSuppliedProcedure) { m_log.info("Kafka Consumer from topic: " + m_config.topic + " Started using procedure: " + m_config.procedure); } else { m_log.info("Kafka Consumer from topic: " + m_config.topic + " Started for table: " + m_config.table); } m_es.awaitTermination(365, TimeUnit.DAYS); } catch (Throwable terminate) { m_log.error("Error in Kafka Consumer", terminate); System.exit(-1); } close(); }</code><technical_language>"es" is a descriptive name. This is optional introduce variable, I prefer names "m_consumerExecutor" clear a glance variable does</technical_language>

Target:
public void processKafkaMessages() throws Exception { final String[] serverlist = m_config.servers.split(","); m_config.password = CLIConfig.readPasswordIfNeeded(m_config.user, m_config.password, "Enter password: "); final ClientConfig c_config = new ClientConfig(m_config.user, m_config.password, null); if (m_config.ssl != null && !m_config.ssl.trim().isEmpty()) { c_config.setTrustStoreConfigFromPropertyFile(m_config.ssl); c_config.enableSSL(); } c_config.setProcedureCallTimeout(0); m_client = getClient(c_config, serverlist, m_config.port); if (m_config.useSuppliedProcedure) { m_loader = new CSVTupleDataLoader((ClientImpl) m_client, m_config.procedure, new KafkaBulkLoaderCallback()); } else { m_loader = new CSVBulkDataLoader((ClientImpl) m_client, m_config.table, m_config.batch, m_config.update, new KafkaBulkLoaderCallback()); } m_loader.setFlushInterval(m_config.flush, m_config.flush); m_consumer = new KafkaConsumerConnector(m_config); try { m_executorService = getConsumerExecutor(m_consumer, m_loader); if (m_config.useSuppliedProcedure) { m_log.info("Kafka Consumer from topic: " + m_config.topic + " Started using procedure: " + m_config.procedure); } else { m_log.info("Kafka Consumer from topic: " + m_config.topic + " Started for table: " + m_config.table); } m_executorService.awaitTermination(365, TimeUnit.DAYS); } catch (Throwable terminate) { m_log.error("Error in Kafka Consumer", terminate); System.exit(-1); } close(); }
Source:
<code>private static Constraints buildConstraints(Requirements requirements) { Constraints.Builder builder = new Constraints.Builder(); switch (requirements.getRequiredNetworkType()) { case Requirements.NETWORK_TYPE_NONE: builder.setRequiredNetworkType(NetworkType.NOT_REQUIRED); break; case Requirements.NETWORK_TYPE_ANY: builder.setRequiredNetworkType(NetworkType.CONNECTED); break; case Requirements.NETWORK_TYPE_UNMETERED: builder.setRequiredNetworkType(NetworkType.UNMETERED); break; default: throw new UnsupportedOperationException(); } if (requirements.isChargingRequired()) { builder.setRequiresCharging(true); } <START> if (requirements.isIdleRequired() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { <END> builder.setRequiresDeviceIdle(true); } return builder.build(); }</code><technical_language>version check is necessary</technical_language>

Target:
private static Constraints buildConstraints(Requirements requirements) { Constraints.Builder builder = new Constraints.Builder(); switch (requirements.getRequiredNetworkType()) { case Requirements.NETWORK_TYPE_NONE: builder.setRequiredNetworkType(NetworkType.NOT_REQUIRED); break; case Requirements.NETWORK_TYPE_ANY: builder.setRequiredNetworkType(NetworkType.CONNECTED); break; case Requirements.NETWORK_TYPE_UNMETERED: builder.setRequiredNetworkType(NetworkType.UNMETERED); break; default: throw new UnsupportedOperationException(); } if (requirements.isChargingRequired()) { builder.setRequiresCharging(true); } if (requirements.isIdleRequired() && Util.SDK_INT >= 23) { builder.setRequiresDeviceIdle(true); } return builder.build(); }
Source:
<code>public boolean removeRoute(@NonNull RouteInfo route) { <START> if (Objects.equals(mIfaceName, route.getInterface())) { <END> int i = findRouteIndexByDestination(route); if (i >= 0) { mRoutes.remove(i); return true; } } return false; }</code><technical_language>Suggest unindenting for clarity: if (!Objects.equals(mIfaceName, route.getInterface) { return false; } int i = ...; if (i == -1) { return false; } mRoutes.remove(i); return true;</technical_language>

Target:
public boolean removeRoute(@NonNull RouteInfo route) { if (Objects.equals(mIfaceName, route.getInterface())) { return false; } int i = findRouteIndexByDestination(route); if (i == -1) { return false; } mRoutes.remove(i); return true; }
Source:
<code>public void shouldDecorateFutureAndCircuitBreakingLogicApplyOnceOnMultipleFutureEval() throws Exception { CircuitBreaker circuitBreaker = CircuitBreaker.ofDefaults("testName"); <START> final Future<String> future = executor.submit(() -> "Hello World"); <END> CircuitBreakerFuture<String> decoratedFuture = new CircuitBreakerFuture<>(circuitBreaker, future); decoratedFuture.get(); decoratedFuture.get(); assertThat(circuitBreaker.getMetrics().getNumberOfBufferedCalls()).isEqualTo(1); assertThat(circuitBreaker.getMetrics().getNumberOfFailedCalls()).isEqualTo(0); assertThat(circuitBreaker.getMetrics().getNumberOfSuccessfulCalls()).isEqualTo(1); assertThat(circuitBreaker.getMetrics().getNumberOfNotPermittedCalls()).isEqualTo(0); assertThat(circuitBreaker.getState()).isEqualTo(CircuitBreaker.State.CLOSED); }</code><technical_language>please mock Future</technical_language>

Target:
public void shouldDecorateFutureAndCircuitBreakingLogicApplyOnceOnMultipleFutureEval() throws Exception { CircuitBreaker circuitBreaker = CircuitBreaker.ofDefaults("testName"); final Future<String> future = mock(Future.class); when(future.get()).thenReturn("Hello World"); CircuitBreakerFuture<String> decoratedFuture = new CircuitBreakerFuture<>(circuitBreaker, future); decoratedFuture.get(); decoratedFuture.get(); assertThat(circuitBreaker.getMetrics().getNumberOfBufferedCalls()).isEqualTo(1); assertThat(circuitBreaker.getMetrics().getNumberOfFailedCalls()).isEqualTo(0); assertThat(circuitBreaker.getMetrics().getNumberOfSuccessfulCalls()).isEqualTo(1); assertThat(circuitBreaker.getMetrics().getNumberOfNotPermittedCalls()).isEqualTo(0); assertThat(circuitBreaker.getState()).isEqualTo(CircuitBreaker.State.CLOSED); then(future).should(times(2)).get(); }
Source:
<code>public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } KafkaTuningConfig that = (KafkaTuningConfig) o; <START> return maxRowsInMemory == that.maxRowsInMemory && <END> maxRowsPerSegment == that.maxRowsPerSegment && maxPendingPersists == that.maxPendingPersists && reportParseExceptions == that.reportParseExceptions && handoffConditionTimeout == that.handoffConditionTimeout && resetOffsetAutomatically == that.resetOffsetAutomatically && Objects.equals(intermediatePersistPeriod, that.intermediatePersistPeriod) && Objects.equals(basePersistDirectory, that.basePersistDirectory) && Objects.equals(indexSpec, that.indexSpec) && Objects.equals(outputMediumFactory, that.outputMediumFactory); }</code><technical_language>wondering if this is autogenrated handmade</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } KafkaTuningConfig that = (KafkaTuningConfig) o; return maxRowsInMemory == that.maxRowsInMemory && maxRowsPerSegment == that.maxRowsPerSegment && maxPendingPersists == that.maxPendingPersists && reportParseExceptions == that.reportParseExceptions && handoffConditionTimeout == that.handoffConditionTimeout && resetOffsetAutomatically == that.resetOffsetAutomatically && Objects.equals(intermediatePersistPeriod, that.intermediatePersistPeriod) && Objects.equals(basePersistDirectory, that.basePersistDirectory) && Objects.equals(indexSpec, that.indexSpec) && Objects.equals(segmentWriteOutMediumFactory, that.segmentWriteOutMediumFactory); }
Source:
<code>private void copyAllMemoryImages(Guid containerID) { for (Snapshot snapshot : snapshotsWithMemory) { List<Guid> guids = Guid.createGuidListFromString(snapshot.getMemoryVolume()); ActionReturnValue vdcRetValue = runInternalActionWithTasksContext( ActionType.CopyImageGroup, buildMoveOrCopyImageGroupParametersForMemoryDumpImage( containerID, guids.get(0), guids.get(2), guids.get(3))); if (!vdcRetValue.getSucceeded()) { throw new EngineException(vdcRetValue.getFault().getError(), "Failed during ExportVmCommand"); } <START> getTaskIdList().addAll(vdcRetValue.getVdsmTaskIdList()); <END> vdcRetValue = runInternalActionWithTasksContext( ActionType.CopyImageGroup, buildMoveOrCopyImageGroupParametersForMemoryConfImage( containerID, guids.get(0), guids.get(4), guids.get(5))); if (!vdcRetValue.getSucceeded()) { throw new EngineException(vdcRetValue.getFault().getError(), "Failed during ExportVmCommand"); } getTaskIdList().addAll(vdcRetValue.getVdsmTaskIdList()); } }</code><technical_language>discussed f2f, please if async flag REST is a bug is some other monitor async commands in REST. how, this code monitor tasks twice, ExportVmCommand child command</technical_language>

Target:
private void copyAllMemoryImages(Guid containerID) { for (Snapshot snapshot : snapshotsWithMemory) { List<Guid> guids = Guid.createGuidListFromString(snapshot.getMemoryVolume()); ActionReturnValue vdcRetValue = runInternalActionWithTasksContext( ActionType.CopyImageGroup, buildMoveOrCopyImageGroupParametersForMemoryDumpImage( containerID, guids.get(0), guids.get(2), guids.get(3))); if (!vdcRetValue.getSucceeded()) { throw new EngineException(vdcRetValue.getFault().getError(), "Failed during ExportVmCommand"); } vdcRetValue = runInternalActionWithTasksContext( ActionType.CopyImageGroup, buildMoveOrCopyImageGroupParametersForMemoryConfImage( containerID, guids.get(0), guids.get(4), guids.get(5))); if (!vdcRetValue.getSucceeded()) { throw new EngineException(vdcRetValue.getFault().getError(), "Failed during ExportVmCommand"); } } }
Source:
<code>public BundleAsyncResponse bundleRequest(@OrganisationIdentification final String organisationIdentification, @MessagePriority final String messagePriority, @ResponseUrl final String responseUrl, @RequestPayload final BundleRequest request) throws OsgpException { LOGGER.info("Bundle request for organisation: and device: {}. and responseUrl: {}", organisationIdentification, request.getDeviceIdentification(), responseUrl); BundleAsyncResponse response = null; try { response = new BundleAsyncResponse(); final String deviceIdentification = request.getDeviceIdentification(); final Actions actions = request.getActions(); final List<? extends Action> actionList = actions.getActionList(); final List<ActionRequest> actionRequestList = this.actionMapperService.mapAllActions(actionList); final String correlationUid = this.bundleService.enqueueBundleRequest(organisationIdentification, deviceIdentification, actionRequestList, MessagePriorityEnum.getMessagePriority(messagePriority)); response.setCorrelationUid(correlationUid); response.setDeviceIdentification(request.getDeviceIdentification()); <START> this.responseUrlService.saveResponseUrlIfNeeded(correlationUid, responseUrl); <END> } catch (final Exception e) { this.handleException(e); } return response; }</code><technical_language>this part of centralized CorrelationIdProviderService create in CorrelationIdResponseUrlProviderService functionality of storing responseUrl correlationId in place. other endpoint of this centralized CorrelationIdProviderService/CorrelationIdResponseUrlProviderService</technical_language>

Target:
public BundleAsyncResponse bundleRequest(@OrganisationIdentification final String organisationIdentification, @MessagePriority final String messagePriority, @ResponseUrl final String responseUrl, @RequestPayload final BundleRequest request) throws OsgpException { LOGGER.info("Bundle request for organisation: and device: {}. and responseUrl: {}", organisationIdentification, request.getDeviceIdentification(), responseUrl); BundleAsyncResponse response = null; try { response = new BundleAsyncResponse(); final String deviceIdentification = request.getDeviceIdentification(); final Actions actions = request.getActions(); final List<? extends Action> actionList = actions.getActionList(); final List<ActionRequest> actionRequestList = this.actionMapperService.mapAllActions(actionList); final String correlationUid = this.bundleService.enqueueBundleRequest(organisationIdentification, deviceIdentification, actionRequestList, MessagePriorityEnum.getMessagePriority(messagePriority)); response.setCorrelationUid(correlationUid); response.setDeviceIdentification(request.getDeviceIdentification()); this.saveResponseUrlIfNeeded(correlationUid, responseUrl); } catch (final Exception e) { this.handleException(e); } return response; }
Source:
<code>public void updateAnnotation(CoreSession session, String annotationId, Annotation annotation) { IdRef annotationRef = new IdRef(annotationId); if (!session.exists(annotationRef)) { throw new IllegalArgumentException("The annotation " + annotationId + " does not exist."); } DocumentModel annotationModel = session.getDocument(annotationRef); <START> Comments.externalAnnotationToDocumentModel().accept(annotation, annotationModel); <END> session.saveDocument(annotationModel); }</code><technical_language>thought useful, real case in end. I change simpler methods</technical_language>

Target:
public void updateAnnotation(CoreSession session, String annotationId, Annotation annotation) { IdRef annotationRef = new IdRef(annotationId); if (!session.exists(annotationRef)) { throw new IllegalArgumentException("The annotation " + annotationId + " does not exist."); } DocumentModel annotationModel = session.getDocument(annotationRef); Comments.annotationToDocumentModel(annotation, annotationModel); if (annotation instanceof ExternalEntity) { Comments.externalEntityToDocumentModel((ExternalEntity) annotation, annotationModel); } session.saveDocument(annotationModel); }
Source:
<code>private static int primeNo(int index) { return Match .when(1, (i) -> 2) .orElse(() -> knownPrimes.drop(index - 1).head()) <START> .apply(index); <END> }</code><technical_language>it, I work return knownPrimes.drop(index - 1).head();. If index == 1 dropping 0 Stream.gen seed of 2 is returned</technical_language>

Target:
private static int primeNo(int index) { return knownPrimes.drop(index - 1).head(); }
Source:
<code>private void strictCheck(List<FileDescriptor> walFiles, FileWALPointer lowBound, FileWALPointer highBound) throws IgniteCheckedException { int idx = 0; if (lowBound.index() > Long.MIN_VALUE) { for (; idx < walFiles.size(); idx++) { FileDescriptor desc = walFiles.get(idx); assert desc != null; if (desc.idx() == lowBound.index()) break; } } if (idx == walFiles.size()) <START> throw new IgniteCheckedException("Wal segments not in bounds."); <END> long curWalSegmIdx = walFiles.get(idx).idx(); for (; idx < walFiles.size() && curWalSegmIdx <= highBound.index(); idx++, curWalSegmIdx++) { FileDescriptor desc = walFiles.get(idx); assert desc != null; if (curWalSegmIdx != desc.idx()) throw new IgniteCheckedException("Wal segment " + curWalSegmIdx + " not found."); } if (highBound.index() < Long.MAX_VALUE && curWalSegmIdx <= highBound.index()) throw new IgniteCheckedException("Wal segments not in bounds."); }</code><technical_language>I suggest providing a more informative message bounds broken, avoid this message generated fix it. message min/max bounds broke here. This suggestion is related current message exceptions</technical_language>

Target:
private static void strictCheck(List<FileDescriptor> walFiles, FileWALPointer lowBound, FileWALPointer highBound) throws IgniteCheckedException { int idx = 0; if (lowBound.index() > Long.MIN_VALUE) { for (; idx < walFiles.size(); idx++) { FileDescriptor desc = walFiles.get(idx); assert desc != null; if (desc.idx() == lowBound.index()) break; } } if (idx == walFiles.size()) throw new IgniteCheckedException("Wal segments not in bounds. loBoundIndex=" + lowBound.index() + ", indexes=" + printIndexes(walFiles)); long curWalSegmIdx = walFiles.get(idx).idx(); for (; idx < walFiles.size() && curWalSegmIdx <= highBound.index(); idx++, curWalSegmIdx++) { FileDescriptor desc = walFiles.get(idx); assert desc != null; if (curWalSegmIdx != desc.idx()) throw new IgniteCheckedException("Wal segment " + curWalSegmIdx + " not found in files " + printIndexes(walFiles)); } if (highBound.index() < Long.MAX_VALUE && curWalSegmIdx <= highBound.index()) throw new IgniteCheckedException("Wal segments not in bounds. hiBoundIndex=" + highBound.index() + ", indexes=" + printIndexes(walFiles)); }
Source:
<code>public <T> Tuple.WindowedTuple<T> getWindowedValueWithTimestamp(Tuple<T> input, long timestamp) { if (windowOption == null && input instanceof Tuple.WindowedTuple) { <START> initialWindowStates(((Tuple.WindowedTuple<T>)input).getWindows()); <END> return (Tuple.WindowedTuple<T>)input; } else { return new Tuple.WindowedTuple<>(assignWindows(input, timestamp), timestamp, input.getValue()); } }</code><technical_language>name initializeWindowStates</technical_language>

Target:
public <T> Tuple.WindowedTuple<T> getWindowedValueWithTimestamp(Tuple<T> input, long timestamp) { if (windowOption == null && input instanceof Tuple.WindowedTuple) { initializeWindowStates(((Tuple.WindowedTuple<T>)input).getWindows()); return (Tuple.WindowedTuple<T>)input; } else { return new Tuple.WindowedTuple<>(assignWindows(input, timestamp), timestamp, input.getValue()); } }
Source:
<code><START> public InternetGatewayHandler(TagSetHandler tagSetHandler, InternetGatewayAttachmentSetHandler attachmentHandler) { <END> this.tagSetHandler = tagSetHandler; this.attachmentSetHandler = attachmentHandler; }</code><technical_language>Remove public modifier</technical_language>

Target:
InternetGatewayHandler(TagSetHandler tagSetHandler, InternetGatewayAttachmentSetHandler attachmentHandler) { this.tagSetHandler = tagSetHandler; this.attachmentSetHandler = attachmentHandler; }