auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public ArrayList<SrlProblem> getCourseProblem(final List<String> problemID, final String userId) throws AuthenticationException, DatabaseAccessException { final long currentTime = System.currentTimeMillis(); final ArrayList<SrlProblem> allCourses = new ArrayList<SrlProblem>(); for (int index = 0; index < problemID.size(); index++) { try { allCourses.add(CourseProblemManager.mongoGetCourseProblem(getInstance().auth, getInstance().database, problemID.get(index), userId, currentTime)); } catch (DatabaseAccessException e) { <START> LOG.info(LoggingConstants.EXCEPTION_MESSAGE, e); <END> if (!e.isRecoverable()) { throw e; } } catch (AuthenticationException e) { if (e.getType() != AuthenticationException.INVALID_DATE) { throw e; } } } return allCourses; }</code><technical_language>in rest of this file</technical_language>

Target:
public ArrayList<SrlProblem> getCourseProblem(final List<String> problemID, final String userId) throws AuthenticationException, DatabaseAccessException { final long currentTime = System.currentTimeMillis(); final ArrayList<SrlProblem> allCourses = new ArrayList<SrlProblem>(); for (int index = 0; index < problemID.size(); index++) { try { allCourses.add(CourseProblemManager.mongoGetCourseProblem(getInstance().auth, getInstance().database, problemID.get(index), userId, currentTime)); } catch (DatabaseAccessException e) { LOG.error(LoggingConstants.EXCEPTION_MESSAGE, e); if (!e.isRecoverable()) { throw e; } } catch (AuthenticationException e) { if (e.getType() != AuthenticationException.INVALID_DATE) { throw e; } } } return allCourses; }
Source:
<code>public DatasetException(String message, String dataset, Throwable cause) { <START> super("Load dataset " + asList(dataset) + " failed: " + message, cause); <END> this.datasets = asList(dataset); }</code><technical_language>call this(message, asList(dataset), cause)</technical_language>

Target:
public DatasetException(String message, String dataset, Throwable cause) { this(message, asList(dataset), cause); }
Source:
<code>public Object[][] VCFCompData() { return new Object[][]{ new Object[]{TEST_DIR.resolve("IntervalListFromVCFTest.vcf"), TEST_DIR.resolve("IntervalListFromVCFTestComp.interval_list"), false}, new Object[]{TEST_DIR.resolve("IntervalListFromVCFTest.vcf"), TEST_DIR.resolve("IntervalListFromVCFTestCompInverse.interval_list"), true}, new Object[]{TEST_DIR.resolve("IntervalListFromVCFTestManual.vcf"), TEST_DIR.resolve("IntervalListFromVCFTestManualComp.interval_list"), false}, <START> new Object[]{TEST_DIR.resolve("IntervalListFromVCFTestManual.vcf"), TEST_DIR.resolve("IntervalListFromVCFTestCompInverseManual.interval_list"), true} <END> }; }</code><technical_language>Multiple resolves of File declared a final variable</technical_language>

Target:
public Object[][] VCFCompData() { final Path intervalListFromVcf = TEST_DIR.resolve("IntervalListFromVCFTest.vcf"); final Path intervalListFromVcfManual = TEST_DIR.resolve("IntervalListFromVCFTestManual.vcf"); return new Object[][]{ new Object[]{intervalListFromVcf, TEST_DIR.resolve("IntervalListFromVCFTestComp.interval_list"), false}, new Object[]{intervalListFromVcf, TEST_DIR.resolve("IntervalListFromVCFTestCompInverse.interval_list"), true}, new Object[]{intervalListFromVcfManual, TEST_DIR.resolve("IntervalListFromVCFTestManualComp.interval_list"), false}, new Object[]{intervalListFromVcfManual, TEST_DIR.resolve("IntervalListFromVCFTestCompInverseManual.interval_list"), true} }; }
Source:
<code>private void printAssignments(NodeRepresentation nodeOutput, Assignments assignments) { for (Map.Entry<Symbol, RowExpression> entry : assignments.getMap().entrySet()) { if (entry.getValue() instanceof VariableReferenceExpression && ((VariableReferenceExpression) entry.getValue()).getName().equals(entry.getKey().getName())) { continue; } <START> if (isExpression(entry.getValue())) { <END> nodeOutput.appendDetailsLine("%s := %s", entry.getKey(), castToExpression(entry.getValue())); } else { nodeOutput.appendDetailsLine("%s := %s", entry.getKey(), formatter.formatRowExpression(entry.getValue())); } } }</code><technical_language>expect this Expression. Fix test handled here</technical_language>

Target:
private void printAssignments(NodeRepresentation nodeOutput, Assignments assignments) { for (Map.Entry<VariableReferenceExpression, RowExpression> entry : assignments.getMap().entrySet()) { if (entry.getValue() instanceof VariableReferenceExpression && ((VariableReferenceExpression) entry.getValue()).getName().equals(entry.getKey().getName())) { continue; } nodeOutput.appendDetailsLine("%s := %s", entry.getKey(), formatter.formatRowExpression(entry.getValue())); } }
Source:
<code>public void setup() throws Exception { URL resource = getClass().getResource("/projects/multi-module-java-with-ext-libs"); testProjectServiceClient.importProject( workspace.getId(), Paths.get(resource.toURI()), PROJECT, ProjectTemplates.CONSOLE_JAVA_SIMPLE); ide.open(workspace); loader.waitOnClosed(); projectExplorer.waitItem(PROJECT); projectExplorer.selectItem(PROJECT); notificationsPopupPanel.waitProgressPopupPanelClose(); projectExplorer.expandPathInProjectExplorerAndOpenFile( PATH_FOR_EXPAND_APP_CLASS, APP_CLASS_NAME + ".java"); <START> projectExplorer.openItemByPath(PROJECT + "/model"); <END> projectExplorer.openItemByPath(PROJECT + "/model/src"); projectExplorer.openItemByPath(PROJECT + "/model/src/main"); projectExplorer.openItemByPath(PROJECT + "/model/src/main/java"); projectExplorer.openItemByPath(PROJECT + "/model/src/main/java/multimodule/model"); projectExplorer.openItemByPath( PROJECT + "/model/src/main/java/multimodule/model/" + BOOK_IMPL_CLASS_NAME + ".java"); }</code><technical_language>replace sequence of commands **openItemByPath()** calls command expandPathInProjectExplorerAndOpenFile(PROJECT + "/model/src/main/java/multimodule/model/", BOOK_IMPL_CLASS_NAME + ".java"). So, is propose of this sequence</technical_language>

Target:
public void setup() throws Exception { URL resource = getClass().getResource("/projects/multi-module-java-with-ext-libs"); testProjectServiceClient.importProject( workspace.getId(), Paths.get(resource.toURI()), PROJECT, ProjectTemplates.CONSOLE_JAVA_SIMPLE); ide.open(workspace); loader.waitOnClosed(); projectExplorer.waitItem(PROJECT); projectExplorer.selectItem(PROJECT); notificationsPopupPanel.waitProgressPopupPanelClose(); projectExplorer.expandPathInProjectExplorerAndOpenFile( PATH_FOR_EXPAND_APP_CLASS, APP_CLASS_NAME + ".java"); projectExplorer.openItemByPath(PROJECT); projectExplorer.expandPathInProjectExplorerAndOpenFile( PROJECT + "/model/src/main/java/multimodule.model", BOOK_IMPL_CLASS_NAME + ".java"); }
Source:
<code>public UserPrefBooleanPaletteEntry(BooleanValue val, UserPrefPaletteItem item) { super(val, item); prefItem_ = item; boolean initial = false; <START> initial = val.getGlobalValue(); <END> checkbox_ = new CheckBox(); checkbox_.setValue(initial); Style style = checkbox_.getElement().getStyle(); syncLabel(); style.setWidth(45, Unit.PX); style.setDisplay(Display.INLINE_BLOCK); style.setTextAlign(TextAlign.LEFT); style.setCursor(Cursor.POINTER); checkbox_.addValueChangeHandler((newVal) -> { BooleanValue pref = (BooleanValue)pref_; pref.setGlobalValue(newVal.getValue()); syncLabel(); prefItem_.nudgeWriter(); }); initialize(); Roles.getCheckboxRole().setAriaLabelledbyProperty(checkbox_.getElement(), Id.of(name_.getElement())); }</code><technical_language>super-nitpicky; declare assign boolean initial in a single line</technical_language>

Target:
public UserPrefBooleanPaletteEntry(BooleanValue val, UserPrefPaletteItem item) { super(val, item); prefItem_ = item; boolean initial = val.getGlobalValue(); checkbox_ = new CheckBox(); checkbox_.setValue(initial); Style style = checkbox_.getElement().getStyle(); syncLabel(); style.setWidth(45, Unit.PX); style.setDisplay(Display.INLINE_BLOCK); style.setTextAlign(TextAlign.LEFT); style.setCursor(Cursor.POINTER); checkbox_.addValueChangeHandler((newVal) -> { BooleanValue pref = (BooleanValue)pref_; pref.setGlobalValue(newVal.getValue()); syncLabel(); prefItem_.nudgeWriter(); }); initialize(); Roles.getCheckboxRole().setAriaLabelledbyProperty(checkbox_.getElement(), Id.of(name_.getElement())); }
Source:
<code>public ActionResult execute() { String idOfCourseToBin = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); try { CourseAttributes courseAttributes = logic.getCourse(idOfCourseToBin); logic.moveCourseToRecycleBin(idOfCourseToBin); return new JsonResult(new CourseData(courseAttributes)); } catch (EntityDoesNotExistException e) { <START> return new JsonResult(e.getMessage(), HttpStatus.SC_INTERNAL_SERVER_ERROR); <END> } }</code><technical_language>Rethrow exception EntityNotFoundException()</technical_language>

Target:
public ActionResult execute() { String idOfCourseToBin = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); try { CourseAttributes courseAttributes = logic.getCourse(idOfCourseToBin); logic.moveCourseToRecycleBin(idOfCourseToBin); return new JsonResult(new CourseData(courseAttributes)); } catch (EntityDoesNotExistException e) { throw new EntityNotFoundException(e); } }
Source:
<code>public SunburstRingSegment(final PhylogeneticTreeItem value, final int layer, final double degreeStart, final double degreeEnd, final Point2D center, final double scale) { setValue(value); String name = getValue().getName(); String tooltip; if (name == null) { <START> tooltip = "Distance: " + getValue().getDistance(); <END> } else { tooltip = name + "\nDistance: " + getValue().getDistance(); } setName(new Tooltip(tooltip)); setDisplay(createRing(layer, degreeStart, degreeEnd , center, scale)); getChildren().add(getDisplay()); }</code><technical_language>duplicate code</technical_language>

Target:
public SunburstRingSegment(final PhylogeneticTreeItem value, final int layer, final double degreeStart, final double degreeEnd, final Point2D center, final double scale) { setValue(value); String name = getValue().getName(); double distance = getValue().getDistance(); String tooltip; if (name == null) { tooltip = "Distance: " + distance; } else { tooltip = name + "\nDistance: " + distance; } setName(new Tooltip(tooltip)); setDisplay(createRing(layer, degreeStart, degreeEnd , center, scale)); getChildren().add(getDisplay()); }
Source:
<code><START> void checkNeedsPropertiesReloading(long now) { <END> if (CACHING_VALIDITY_MS > 0 && now - lastCachedTime > CACHING_VALIDITY_MS) { this.rampUp = owner.getRampUpSeconds(); this.hold = owner.getHoldSeconds(); this.steps = owner.getStepsAsLong(); this.maxConcurr = Math.round(owner.getTargetLevelAsDouble()); this.lastCachedTime = System.currentTimeMillis(); } }</code><technical_language>private call in constructor avoid code duplication</technical_language>

Target:
void checkNeedsPropertiesReloading(long now) { if (CACHING_VALIDITY_MS > 0 && now - lastCachedTime > CACHING_VALIDITY_MS) { this.rampUp = owner.getRampUpSeconds(); this.hold = owner.getHoldSeconds(); this.steps = owner.getStepsAsLong(); this.maxConcurr =owner.getTargetLevelAsDouble(); this.defaultShiftRampup = JMeterUtils.getPropDefault("dynamic_tg.shift_rampup_start", 0L); this.lastCachedTime = System.currentTimeMillis(); } }
Source:
<code>public void partHidden(IWorkbenchPartReference partRef) { <START> setActive(partRef, <END> false); }</code><technical_language>This editor open (sometimes) BP hit if debug view is hidden - in a single window. Open Java perspective, start debugging, close editor, hide view, resume times editor is opened..</technical_language>

Target:
public void partHidden(IWorkbenchPartReference partRef) { }
Source:
<code>public void testUpdate() { TaskReviewsMappingsStore taskReviewsMappingStore = getEmptyTaskReviewStore(); addReviewData(review1, descriptionWithTaskUrl1); TaskContainerDelta delta = new TaskContainerDelta(review1, Kind.ADDED); taskReviewsMappingStore.containersChanged(ImmutableSet.of(delta)); assertTrue(taskReviewsMappingStore.getReviewUrls(taskUrl1).contains(reviewUrl1)); addReviewData(review1, descriptionWithTaskUrl2); delta = new TaskContainerDelta(review1, Kind.CONTENT); taskReviewsMappingStore.containersChanged(ImmutableSet.of(delta)); assertFalse(taskReviewsMappingStore.getReviewUrls(taskUrl1).contains(reviewUrl1)); assertTrue(taskReviewsMappingStore.getReviewUrls(taskUrl2).contains(reviewUrl1)); <START> <END> }</code><technical_language>assert getTaskUrl</technical_language>

Target:
public void testUpdate() throws CoreException { TaskReviewsMappingsStore taskReviewsMappingStore = getEmptyTaskReviewStore(); addReviewData(review1, descriptionWithTaskUrl1); TaskContainerDelta delta = new TaskContainerDelta(review1, Kind.ADDED); taskReviewsMappingStore.containersChanged(ImmutableSet.of(delta)); assertTrue(taskReviewsMappingStore.getReviewUrls(taskUrl1).contains(reviewUrl1)); addReviewData(review1, descriptionWithTaskUrl2); delta = new TaskContainerDelta(review1, Kind.CONTENT); taskReviewsMappingStore.containersChanged(ImmutableSet.of(delta)); assertFalse(taskReviewsMappingStore.getReviewUrls(taskUrl1).contains(reviewUrl1)); assertTrue(taskReviewsMappingStore.getReviewUrls(taskUrl2).contains(reviewUrl1)); }
Source:
<code>public MessageBuffer slice(int offset, int length) { if(offset == 0 && length == size()) return this; else <START> return new MessageBuffer(base, address + offset, length, reference); <END> }</code><technical_language>checking if sum of offset + length exceed size</technical_language>

Target:
public MessageBuffer slice(int offset, int length) { if(offset == 0 && length == size()) return this; else { checkArgument(offset + length <= size()); return new MessageBuffer(base, address + offset, length, reference); } }
Source:
<code>public void run() { PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() { public void run() { <START> ScriptConsole console = ScriptConsole.getActive(); <END> if(null != console && console.isRunning()){ console.stop(); } } }); }</code><technical_language>console class member ask for active</technical_language>

Target:
public void run() { PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() { public void run() { if(null != console && console.isRunning()){ console.stop(); } } }); }
Source:
<code>public Object[] factory() { return new Object[] { new TotalOrderStateTransferFunctionalTest("dist-to-1pc-nbst", CacheMode.DIST_SYNC, false, false, StorageType.OBJECT), new TotalOrderStateTransferFunctionalTest("dist-to-2pc-nbst", CacheMode.DIST_SYNC, true, false, StorageType.OBJECT), <START> new TotalOrderStateTransferFunctionalTest("dist-to-1pc-nbst-off-heap", CacheMode.DIST_SYNC, false, false, StorageType.OBJECT), <END> new TotalOrderStateTransferFunctionalTest("dist-to-2pc-nbst-off-heap", CacheMode.DIST_SYNC, false, true, StorageType.OBJECT), new TotalOrderStateTransferFunctionalTest("repl-to-1pc-nbst", CacheMode.REPL_SYNC, true, true, StorageType.OBJECT), new TotalOrderStateTransferFunctionalTest("repl-to-2pc-nbst", CacheMode.REPL_SYNC, true, false, StorageType.OBJECT), new TotalOrderStateTransferFunctionalTest("repl-to-1pc-nbst-off-heap", CacheMode.REPL_SYNC, false, false, StorageType.OBJECT), new TotalOrderStateTransferFunctionalTest("repl-to-1pc-nbst-off-heap", CacheMode.REPL_SYNC, false, true, StorageType.OBJECT) }; }</code><technical_language>meant put StorageType.OFF_HEAP for a of</technical_language>

Target:
public Object[] factory() { return new Object[] { new TotalOrderStateTransferFunctionalTest("dist-to-1pc-nbst", CacheMode.DIST_SYNC, false, false, StorageType.OBJECT), new TotalOrderStateTransferFunctionalTest("dist-to-2pc-nbst", CacheMode.DIST_SYNC, true, false, StorageType.OBJECT), new TotalOrderStateTransferFunctionalTest("dist-to-1pc-nbst-off-heap", CacheMode.DIST_SYNC, false, false, StorageType.OFF_HEAP), new TotalOrderStateTransferFunctionalTest("dist-to-2pc-nbst-off-heap", CacheMode.DIST_SYNC, false, true, StorageType.OFF_HEAP), new TotalOrderStateTransferFunctionalTest("repl-to-1pc-nbst", CacheMode.REPL_SYNC, true, true, StorageType.OBJECT), new TotalOrderStateTransferFunctionalTest("repl-to-2pc-nbst", CacheMode.REPL_SYNC, true, false, StorageType.OBJECT), new TotalOrderStateTransferFunctionalTest("repl-to-1pc-nbst-off-heap", CacheMode.REPL_SYNC, false, false, StorageType.OFF_HEAP), new TotalOrderStateTransferFunctionalTest("repl-to-1pc-nbst-off-heap", CacheMode.REPL_SYNC, false, true, StorageType.OFF_HEAP) }; }
Source:
<code>private static JsonNode applyConfigWithEnvVariables(JsonNode jsonNode) { final JsonNodeType nodeType = jsonNode.getNodeType(); switch (nodeType) { case OBJECT: if (jsonNode.size() > 0) { Iterator<Map.Entry<String, JsonNode>> iterator = jsonNode.fields(); while (iterator.hasNext()) { final Map.Entry<String, JsonNode> next = iterator.next(); next.setValue(applyConfigWithEnvVariables(next.getValue())); } } break; case ARRAY: if (jsonNode.isArray()) { ArrayNode arrayNode = (ArrayNode) jsonNode; for (int i = 0; i < arrayNode.size(); i++) { JsonNode arrayElement = arrayNode.get(i); arrayNode.set(i, applyConfigWithEnvVariables(arrayElement)); } } break; case STRING: final String field = jsonNode.asText(); if (field.startsWith("${") && field.endsWith("}")) { final String envVarKey = field.substring(2, field.length() - 1); <START> if (ENVIRONMENT_VARIABLES.containsKey(envVarKey)) { <END> return JsonNodeFactory.instance.textNode(ENVIRONMENT_VARIABLES.get(envVarKey)); } throw new RuntimeException("Missing environment Variable: " + field); } break; } return jsonNode; }</code><technical_language>case insenstive require caps</technical_language>

Target:
private static JsonNode applyConfigWithEnvVariables(JsonNode jsonNode) { final JsonNodeType nodeType = jsonNode.getNodeType(); switch (nodeType) { case OBJECT: if (jsonNode.size() > 0) { Iterator<Map.Entry<String, JsonNode>> iterator = jsonNode.fields(); while (iterator.hasNext()) { final Map.Entry<String, JsonNode> next = iterator.next(); next.setValue(applyConfigWithEnvVariables(next.getValue())); } } break; case ARRAY: if (jsonNode.isArray()) { ArrayNode arrayNode = (ArrayNode) jsonNode; for (int i = 0; i < arrayNode.size(); i++) { JsonNode arrayElement = arrayNode.get(i); arrayNode.set(i, applyConfigWithEnvVariables(arrayElement)); } } break; case STRING: final String field = jsonNode.asText(); if (field.startsWith("${") && field.endsWith("}")) { String[] envVarSplits = field.substring(2, field.length() - 1).split(":", 2); String envVarKey = envVarSplits[0]; if (ENVIRONMENT_VARIABLES.containsKey(envVarKey)) { return JsonNodeFactory.instance.textNode(ENVIRONMENT_VARIABLES.get(envVarKey)); } else if (envVarSplits.length > 1) { return JsonNodeFactory.instance.textNode(envVarSplits[1]); } throw new RuntimeException("Missing environment Variable: " + envVarKey); } break; default: break; } return jsonNode; }
Source:
<code>public PrimitiveLongResourceIterator query( IndexQuery... predicates ) throws IndexNotApplicableKernelException { if ( predicates[0] instanceof ExistsPredicate ) { PrimitiveLongResourceIterator[] iterators = new PrimitiveLongResourceIterator[readerMap.size()]; int i = 0; for ( IndexReader reader : readerMap.values() ) { iterators[i] = reader.query( predicates[0] ); <START> ++i; <END> } return PrimitiveLongResourceCollections.concat( iterators ); } else { NodeValueIterator nodeValueIterator = new NodeValueIterator(); query( nodeValueIterator, IndexOrder.NONE, predicates ); return nodeValueIterator; } }</code><technical_language>This is fine I prefer iterators[i++] is a more common style in code base</technical_language>

Target:
public PrimitiveLongResourceIterator query( IndexQuery... predicates ) throws IndexNotApplicableKernelException { if ( predicates[0] instanceof ExistsPredicate ) { PrimitiveLongResourceIterator[] iterators = new PrimitiveLongResourceIterator[readerMap.size()]; int i = 0; for ( IndexReader reader : readerMap.values() ) { iterators[i++] = reader.query( predicates[0] ); } return PrimitiveLongResourceCollections.concat( iterators ); } else { NodeValueIterator nodeValueIterator = new NodeValueIterator(); query( nodeValueIterator, IndexOrder.NONE, predicates ); return nodeValueIterator; } }
Source:
<code>private void handleException(RuntimeException runtimeException) { final Throwable cause = ExceptionUtils.getRootCause(runtimeException); <START> if (cause instanceof TimeoutException || <END> cause instanceof IllegalStateException || cause instanceof NetworkException) { log.warn("WorkflowRequest: Error while running with cause:", this, runtimeException); } else { throw runtimeException; } }</code><technical_language>TimeoutException here, handled in invoke method</technical_language>

Target:
private void handleException(RuntimeException runtimeException) { final Throwable cause = runtimeException.getCause(); if (cause instanceof TimeoutException || runtimeException instanceof NetworkException) { log.warn("WorkflowRequest: Error while running with cause:", this, runtimeException); } else { throw runtimeException; } }
Source:
<code>public void report(SortedMap<String, Gauge> gauges, SortedMap<String, Counter> counters, SortedMap<String, Histogram> histograms, SortedMap<String, Meter> meters, SortedMap<String, Timer> timers) { for (Map.Entry<String, Counter> entry : counters.entrySet()) { reportCounter(entry.getKey(), entry.getValue()); } <START> meters <END> .entrySet() .stream() .filter(meterEntry -> meterEntry.getKey().startsWith(Meters.THROUGHPUT_BYTES)) .forEach(meterEntry -> reportVolumeCounter(meterEntry.getKey(), meterEntry.getValue().getCount())); }</code><technical_language>For consistency, I suggest write this forEach in loop above</technical_language>

Target:
public void report(SortedMap<String, Gauge> gauges, SortedMap<String, Counter> counters, SortedMap<String, Histogram> histograms, SortedMap<String, Meter> meters, SortedMap<String, Timer> timers) { counters.forEach((name, counter) -> reportCounter(name, counter)); meters .entrySet() .stream() .filter(meterEntry -> meterEntry.getKey().startsWith(Meters.THROUGHPUT_BYTES)) .forEach(meterEntry -> reportVolumeCounter(meterEntry.getKey(), meterEntry.getValue().getCount())); }
Source:
<code>protected void update(float percent) { if (userList == null) { return; } String csvData; try { <START> csvData = formulaCSVData == null ? "" : formulaCSVData.interpretString(sprite); <END> } catch (InterpretationException exception) { csvData = ""; } int columnToExtract; try { columnToExtract = formulaColumnToExtract == null ? 0 : formulaColumnToExtract.interpretInteger(sprite); } catch (InterpretationException interpretationException) { columnToExtract = 0; } columnToExtract--; char separator = ','; Pattern pattern = Pattern.compile("^(?:\".*?\"|[^,;]*?)([,;])"); Matcher matcher = pattern.matcher(csvData); if (matcher.find()) { separator = matcher.group(1).charAt(0); } if (separator != ',' && separator != ';') { separator = ','; } userList.reset(); boolean resetList = true; try { CSVParser parser = new CSVParserBuilder().withSeparator(separator).build(); CSVReader reader = new CSVReaderBuilder(new StringReader(csvData)).withCSVParser(parser) .build(); List<String[]> allRows = reader.readAll(); if (allRows.size() > 0 && columnToExtract >= 0) { for (String[] row : allRows) { if (row.length <= columnToExtract) { userList.addListItem(""); } else { resetList = false; userList.addListItem(row[columnToExtract]); } } if (resetList) { userList.reset(); } } } catch (IOException | CsvException exception) { userList.reset(); } }</code><technical_language>pls do try catch block 3 seperate **(IF is ).** Additionally check if overrided method exception handling itself</technical_language>

Target:
protected void update(float percent) { if (userList == null) { return; } String csvData; try { csvData = formulaCSVData == null ? "" : formulaCSVData.interpretString(sprite); int columnToExtract; columnToExtract = formulaColumnToExtract == null ? 0 : formulaColumnToExtract.interpretInteger(sprite); columnToExtract--; char separator = ','; Pattern pattern = Pattern.compile("^(?:\".*?\"|[^,;]*?)([,;])"); Matcher matcher = pattern.matcher(csvData); if (matcher.find()) { separator = matcher.group(1).charAt(0); } if (separator != ',' && separator != ';') { separator = ','; } userList.reset(); boolean resetList = true; CSVParser parser = new CSVParserBuilder().withSeparator(separator).build(); CSVReader reader = new CSVReaderBuilder(new StringReader(csvData)).withCSVParser(parser) .build(); List<String[]> allRows = reader.readAll(); if (allRows.size() > 0 && columnToExtract >= 0) { for (String[] row : allRows) { if (row.length <= columnToExtract) { userList.addListItem(""); } else { resetList = false; userList.addListItem(row[columnToExtract]); } } if (resetList) { userList.reset(); } } } catch (IOException | CsvException | InterpretationException exception) { userList.reset(); } }
Source:
<code>public static void logoutUser(Context context) { SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); String userName = sharedPreferences.getString(Constants.USERNAME, Constants.NO_USERNAME); <START> new GoogleLoginHandler((AppCompatActivity) context).getGoogleSignInClient().signOut(); <END> LogoutTask logoutTask = new LogoutTask(context, userName); logoutTask.execute(); sharedPreferences.edit() .putString(Constants.TOKEN, Constants.NO_TOKEN) .putString(Constants.USERNAME, Constants.NO_USERNAME) .putString(Constants.GOOGLE_EXCHANGE_CODE, Constants.NO_GOOGLE_EXCHANGE_CODE) .putString(Constants.GOOGLE_EMAIL, Constants.NO_GOOGLE_EMAIL) .putString(Constants.GOOGLE_USERNAME, Constants.NO_GOOGLE_USERNAME) .putString(Constants.GOOGLE_ID, Constants.NO_GOOGLE_ID) .putString(Constants.GOOGLE_LOCALE, Constants.NO_GOOGLE_LOCALE) .putString(Constants.GOOGLE_ID_TOKEN, Constants.NO_GOOGLE_ID_TOKEN) .apply(); WebViewActivity.clearCookies(); }</code><technical_language>split this function calls object</technical_language>

Target:
public static void logoutUser(Context context) { SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); String userName = sharedPreferences.getString(Constants.USERNAME, Constants.NO_USERNAME); GoogleLoginHandler googleLoginHandler = new GoogleLoginHandler((AppCompatActivity) context); googleLoginHandler.getGoogleSignInClient().signOut(); LogoutTask logoutTask = new LogoutTask(context, userName); logoutTask.execute(); sharedPreferences.edit() .putString(Constants.TOKEN, Constants.NO_TOKEN) .putString(Constants.USERNAME, Constants.NO_USERNAME) .putString(Constants.GOOGLE_EXCHANGE_CODE, Constants.NO_GOOGLE_EXCHANGE_CODE) .putString(Constants.GOOGLE_EMAIL, Constants.NO_GOOGLE_EMAIL) .putString(Constants.GOOGLE_USERNAME, Constants.NO_GOOGLE_USERNAME) .putString(Constants.GOOGLE_ID, Constants.NO_GOOGLE_ID) .putString(Constants.GOOGLE_LOCALE, Constants.NO_GOOGLE_LOCALE) .putString(Constants.GOOGLE_ID_TOKEN, Constants.NO_GOOGLE_ID_TOKEN) .apply(); WebViewActivity.clearCookies(); }
Source:
<code>public Href(final CharSequence txt) { <START> this.params = new HashMap<String, List<String>>(0); <END> final URI link = Href.createURI(txt.toString()); final String query = link.getRawQuery(); if (query == null) { this.uri = link; } else { final String href = link.toString(); this.uri = URI.create( href.substring(0, href.length() - query.length() - 1) ); final String[] pairs = query.split("&"); for (final String pair : pairs) { final String[] parts = pair.split("=", 2); final String key = Href.decode(parts[0]); final String value; if (parts.length > 1) { value = Href.decode(parts[1]); } else { value = ""; } this.params.putIfAbsent(key, new LinkedList<String>()); this.params.get(key).add(value); } } }</code><technical_language>@Happy-Neko is a call putIfAbsent below</technical_language>

Target:
public Href(final CharSequence txt) { this.params = new TreeMap<String, List<String>>(); final URI link = Href.createURI(txt.toString()); final String query = link.getRawQuery(); if (query == null) { this.uri = link; } else { final String href = link.toString(); this.uri = URI.create( href.substring(0, href.length() - query.length() - 1) ); final String[] pairs = query.split("&"); for (final String pair : pairs) { final String[] parts = pair.split("=", 2); final String key = Href.decode(parts[0]); final String value; if (parts.length > 1) { value = Href.decode(parts[1]); } else { value = ""; } if (!this.params.containsKey(key)) { this.params.put(key, new LinkedList<String>()); } this.params.get(key).add(value); } } }
Source:
<code>private Object convertValue() { if (declaredType instanceof Class<?>) { Class<?> clazz = (Class<?>) declaredType; try { return getValueFromMap(clazz); } catch (ClassCastException e) { <START> if (clazz.isArray()) { <END> return handleArrayProperty(clazz); } return null; } } else if (ParameterizedType.class.isInstance(declaredType)) { return handleCollectionTypes((ParameterizedType) declaredType); } else { LOG.debug("ValueMapTypeConverter doesn't support non-class types {}", declaredType); return null; } }</code><technical_language>sense move this if (clazz.isArray()) check try block? exception thrown if is array</technical_language>

Target:
private Object convertValue() { if (declaredType instanceof Class<?>) { Class<?> clazz; try { clazz = (Class<?>) declaredType; if(clazz.isArray()){ return handleArrayProperty(clazz); }else{ return getValueFromMap(clazz); } } catch (ClassCastException e) { return null; } } else if (ParameterizedType.class.isInstance(declaredType)) { return handleCollectionTypes((ParameterizedType) declaredType); } else { LOG.debug("ValueMapTypeConverter doesn't support non-class types {}", declaredType); return null; } }
Source:
<code>public Disk get() { Disks disks = parent.list(); <START> for (Disk disk : disks.getDisks()) { <END> if (disk.getId().equals(diskId)) { return disk; } } return notFound(); }</code><technical_language>move this inheriting classes (making this method abstract) map of <guid, disk>, fetch disk in more efficient - in ~O(1) (even if amount of disks is big) instead of 1. fetch disks 2. map api object 3. loop find current throw notFound()</technical_language>

Target:
public Disk get() { org.ovirt.engine.core.common.businessentities.Disk disk = parent.getDisk(asGuid(diskId)); if (disk == null) { return notFound(); } return map(disk); }
Source:
<code>private static @CheckForNull ByteBuffer maybeTranscode(@Nonnull byte[] data, @CheckForNull String charset) { if (charset == null) { return null; } else { Charset cs = charset.isEmpty() ? Charset.defaultCharset() : Charset.forName(charset); if (cs.equals(StandardCharsets.UTF_8)) { return null; } else { <START> return StandardCharsets.UTF_8.encode(cs.decode(ByteBuffer.wrap(data))); <END> } } }</code><technical_language>do allocate reuse a buffer -- i.e. create a transient byte[] / Buffer is for storing encoded output, StandardCharsets.UTF_8.encode -- generate massive amounts of memory garbage</technical_language>

Target:
private static @CheckForNull ByteBuffer maybeTranscode(@Nonnull byte[] data, @CheckForNull String charset) { Charset cs = transcodingCharset(charset); if (cs == null) { return null; } else { return StandardCharsets.UTF_8.encode(cs.decode(ByteBuffer.wrap(data))); } }
Source:
<code>public Optional<PlanNode> apply(PlanNode node, Context context) { <START> Set<Rule> matching = Sets.filter(ruleSet.rules(), rule -> rule.getPattern().matches(node)); <END> return Optional.ofNullable(Iterables.getOnlyElement(matching, null)) .flatMap(rule -> rule.apply(node, context)); }</code><technical_language>toSingleton collector</technical_language>

Target:
public Optional<PlanNode> apply(PlanNode node, Context context) { Set<Rule> matching = ruleSet.rules().stream().filter(rule -> rule.getPattern().matches(node)).collect(toSet()); if (matching.size() == 0) { return empty(); } return getOnlyElement(matching).apply(node, context); }
Source:
<code>public void markAsModified(Integer updatedBy, Date updatedAt) { Map<String, Object> params = new HashMap<>(); params.put("updated_at", updatedAt); params.put("updated_by", updatedBy); int affected = jdbcTemplate.update( markAsModifiedSql, params ); Validate.validState( affected == 1, <START> "Unexpected number of affected rows after updating collections: %d", <END> affected ); }</code><technical_language>s/collections/collection/</technical_language>

Target:
public void markAsModified(Integer updatedBy, Date updatedAt) { Map<String, Object> params = new HashMap<>(); params.put("updated_at", updatedAt); params.put("updated_by", updatedBy); int affected = jdbcTemplate.update( markAsModifiedSql, params ); Validate.validState( affected == 1, "Unexpected number of affected rows after updating collection: %d", affected ); }
Source:
<code>private static void initVimKeys() { KeyMap km = CodeMirror.cloneKeyMap("vim"); for (String s : new String[] {"A", "C", "O", "R", "U", "Ctrl-C"}) { km.remove(s); } <START> CodeMirror.addKeyMap("vim_ro", km); <END> }</code><technical_language>I suggest mapping here</technical_language>

Target:
private static void initVimKeys() { KeyMap km = CodeMirror.cloneKeyMap("vim"); for (String s : new String[] {"A", "C", "O", "R", "U", "Ctrl-C"}) { km.remove(s); } CodeMirror.addKeyMap("vim_ro", km); CodeMirror.mapVimKey("j", "gj"); CodeMirror.mapVimKey("k", "gk"); CodeMirror.mapVimKey("Down", "gj"); CodeMirror.mapVimKey("Up", "gk"); }
Source:
<code>public TimeDetectorStrategyCallbackImpl(@NonNull Context context) { mContext = context; mContentResolver = context.getContentResolver(); PowerManager powerManager = context.getSystemService(PowerManager.class); mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG); mAlarmManager = <START> context.getSystemService(AlarmManager.class); <END> mSystemClockUpdateThreshold = SystemProperties.getInt("ro.time_detector_update_diff", SYSTEM_CLOCK_UPDATE_THRESHOLD_DEFAULT); }</code><technical_language>claiming @NonNull for things, enforcing Preconditions.checkNotNull()</technical_language>

Target:
public TimeDetectorStrategyCallbackImpl(@NonNull Context context) { mContext = Objects.requireNonNull(context); mContentResolver = Objects.requireNonNull(context.getContentResolver()); PowerManager powerManager = context.getSystemService(PowerManager.class); mWakeLock = Objects.requireNonNull( powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG)); mAlarmManager = Objects.requireNonNull(context.getSystemService(AlarmManager.class)); mSystemClockUpdateThresholdMillis = SystemProperties.getInt("ro.sys.time_detector_update_diff", SYSTEM_CLOCK_UPDATE_THRESHOLD_MILLIS_DEFAULT); }
Source:
<code>public void onSensorChanged(SensorEvent event) { Sensor sensor = event.sensor; if (!knownSensorAccuracies.contains(sensor)) { onAccuracyChanged(sensor, event.accuracy); } int valuesViewId; if (sensor == accelSensor) { valuesViewId = R.id.diagnose_accelerometer_values_txt; } else if (sensor == magSensor) { valuesViewId = R.id.diagnose_compass_values_txt; } else if (sensor == gyroSensor) { valuesViewId = R.id.diagnose_gyro_values_txt; } else if (sensor == rotationVectorSensor) { valuesViewId = R.id.diagnose_rotation_values_txt; } else if (sensor == lightSensor) { valuesViewId = R.id.diagnose_light_values_txt; } else { Log.e(TAG, "Receiving values for unknown sensor " + sensor); return; } float[] values = event.values; setArrayValuesInUi(valuesViewId, values); if (sensor == rotationVectorSensor) { float[] matrix = new float[9]; SensorManager.getRotationMatrixFromVector(matrix, event.values); for (int row = 0; row < 3; ++row) { switch(row) { case 0: valuesViewId = R.id.diagnose_rotation_matrix_row1_txt; break; case 1: valuesViewId = R.id.diagnose_rotation_matrix_row2_txt; break; case 2: default: valuesViewId = R.id.diagnose_rotation_matrix_row3_txt; } float[] rowValues = new float[3]; <START> System.arraycopy(matrix, row * 3 + 0, rowValues, 0, 3); <END> setArrayValuesInUi(valuesViewId, rowValues); } } }</code><technical_language>drop +0</technical_language>

Target:
public void onSensorChanged(SensorEvent event) { Sensor sensor = event.sensor; if (!knownSensorAccuracies.contains(sensor)) { onAccuracyChanged(sensor, event.accuracy); } int valuesViewId; if (sensor == accelSensor) { valuesViewId = R.id.diagnose_accelerometer_values_txt; } else if (sensor == magSensor) { valuesViewId = R.id.diagnose_compass_values_txt; } else if (sensor == gyroSensor) { valuesViewId = R.id.diagnose_gyro_values_txt; } else if (sensor == rotationVectorSensor) { valuesViewId = R.id.diagnose_rotation_values_txt; } else if (sensor == lightSensor) { valuesViewId = R.id.diagnose_light_values_txt; } else { Log.e(TAG, "Receiving values for unknown sensor " + sensor); return; } float[] values = event.values; setArrayValuesInUi(valuesViewId, values); if (sensor == rotationVectorSensor) { float[] matrix = new float[9]; SensorManager.getRotationMatrixFromVector(matrix, event.values); for (int row = 0; row < 3; ++row) { switch(row) { case 0: valuesViewId = R.id.diagnose_rotation_matrix_row1_txt; break; case 1: valuesViewId = R.id.diagnose_rotation_matrix_row2_txt; break; case 2: default: valuesViewId = R.id.diagnose_rotation_matrix_row3_txt; } float[] rowValues = new float[3]; for (int col = 0; col < 3; ++col) { rowValues[col] = matrix[row * 3 + col]; } setArrayValuesInUi(valuesViewId, rowValues); } } }
Source:
<code>public Boolean get(HttpServletRequest request, HttpServletResponse response) { <START> if (this.isHTTPSForwardedProtoResolver.get(request, response)) { <END> return false; } return this.secureRequiredExceptForLocalhostResolver.get(request, response); }</code><technical_language>understanding logic here. If isHTTPSForwardedProtoResolver returns true, want SecureForwardedProtoAwareResolver return false</technical_language>

Target:
public Boolean get(HttpServletRequest request, HttpServletResponse response) { String xForwardedProtoValue = request.getHeader(HEADER_FORWARDED_PROTO); return HTTPS.equalsIgnoreCase(xForwardedProtoValue); }
Source:
<code>public static Datum createFromInt4(DataType type, int val) { switch (type.getType()) { case INT4: return new Int4Datum(val); case DATE: return new DateDatum(val); default: <START> throw new TajoRuntimeException(Errors.ResultCode.UNSUPPORTED_DATATYPE, type.getType().name()); <END> } }</code><technical_language>new TajoRuntimeException(new UnsupportedDataType(...)</technical_language>

Target:
public static Datum createFromInt4(DataType type, int val) { switch (type.getType()) { case INT4: return new Int4Datum(val); case DATE: return new DateDatum(val); default: throw new TajoRuntimeException(new UnsupportedDataTypeException(type.getType().name())); } }
Source:
<code>private void loadIncludedFeatures(Feature feature, FeatureParser featureParser, Map<String, Feature> features, IProgressMonitor monitor) throws ProvisionException { FeatureEntry[] featureEntries = feature.getEntries(); for (FeatureEntry <START> featureEntrie : <END> featureEntries) { if (monitor.isCanceled()) throw new OperationCanceledException(); FeatureEntry entry = featureEntrie; if (entry.isRequires() || entry.isPlugin()) continue; String key = entry.getId() + VERSION_SEPARATOR + entry.getVersion(); if (features.containsKey(key)) continue; URI includedFeatureURI = getFeatureURI(entry.getId(), entry.getVersion()); Feature includedFeature = parseFeature(featureParser, includedFeatureURI, monitor); if (includedFeature == null) { LogHelper.log(new Status(IStatus.ERROR, Activator.ID, NLS.bind(Messages.ErrorReadingFeature, includedFeatureURI))); } else { features.put(key, includedFeature); loadIncludedFeatures(includedFeature, featureParser, features, monitor); } } }</code><technical_language>featureEntry</technical_language>

Target:
private void loadIncludedFeatures(Feature feature, FeatureParser featureParser, Map<String, Feature> features, IProgressMonitor monitor) throws ProvisionException { FeatureEntry[] featureEntries = feature.getEntries(); for (FeatureEntry featureEntry : featureEntries) { if (monitor.isCanceled()) throw new OperationCanceledException(); FeatureEntry entry = featureEntry; if (entry.isRequires() || entry.isPlugin()) continue; String key = entry.getId() + VERSION_SEPARATOR + entry.getVersion(); if (features.containsKey(key)) continue; URI includedFeatureURI = getFeatureURI(entry.getId(), entry.getVersion()); Feature includedFeature = parseFeature(featureParser, includedFeatureURI, monitor); if (includedFeature == null) { LogHelper.log(new Status(IStatus.ERROR, Activator.ID, NLS.bind(Messages.ErrorReadingFeature, includedFeatureURI))); } else { features.put(key, includedFeature); loadIncludedFeatures(includedFeature, featureParser, features, monitor); } } }
Source:
<code>public void init(Map<String, String> options, ConfigurationSource cfg) { super.initCfg(cfg); FormattingPreferences prefs = new FormattingPreferences(); String maxLineLength = options.get("maxLineLength"); String wrapLongLines = options.get("wrapLongLines"); String tabInsteadOfSpaces = options.get("tabInsteadOfSpaces"); String tabWidth = options.get("tabWidth"); String splitMultiAttrs = options.get("splitMultiAttrs"); String wellFormedValidation = options.get("wellFormedValidation"); prefs.setMaxLineLength(maxLineLength != null ? Integer.valueOf(maxLineLength) : null); prefs.setWrapLongLines(wrapLongLines != null ? Boolean.valueOf(wrapLongLines) : null); prefs.setTabInsteadOfSpaces(tabInsteadOfSpaces != null ? Boolean.valueOf(tabInsteadOfSpaces) : null); prefs.setTabWidth(tabWidth != null ? Integer.valueOf(tabWidth) : null); prefs.setSplitMultiAttrs(splitMultiAttrs != null ? Boolean.valueOf(splitMultiAttrs) : null); <START> if (wellFormedValidation != null) <END> prefs.setWellFormedValidation(wellFormedValidation); this.formatter = new XmlDocumentFormatter(options.getOrDefault("lineending", System.lineSeparator()), prefs); }</code><technical_language>@jam01 add curry brackets if statement here? good merge :)</technical_language>

Target:
public void init(Map<String, String> options, ConfigurationSource cfg) { super.initCfg(cfg); FormattingPreferences prefs = new FormattingPreferences(); String maxLineLength = options.get("maxLineLength"); String wrapLongLines = options.get("wrapLongLines"); String tabInsteadOfSpaces = options.get("tabInsteadOfSpaces"); String tabWidth = options.get("tabWidth"); String splitMultiAttrs = options.get("splitMultiAttrs"); String wellFormedValidation = options.get("wellFormedValidation"); prefs.setMaxLineLength(maxLineLength != null ? Integer.valueOf(maxLineLength) : null); prefs.setWrapLongLines(wrapLongLines != null ? Boolean.valueOf(wrapLongLines) : null); prefs.setTabInsteadOfSpaces(tabInsteadOfSpaces != null ? Boolean.valueOf(tabInsteadOfSpaces) : null); prefs.setTabWidth(tabWidth != null ? Integer.valueOf(tabWidth) : null); prefs.setSplitMultiAttrs(splitMultiAttrs != null ? Boolean.valueOf(splitMultiAttrs) : null); if (wellFormedValidation != null) { prefs.setWellFormedValidation(wellFormedValidation); } this.formatter = new XmlDocumentFormatter(options.getOrDefault("lineending", System.lineSeparator()), prefs); }
Source:
<code>public void loadScript(File file) throws FileNotFoundException, ScriptException { logger.info("Loading Script " + file.getName()); String extension = getFileExtension(file); ScriptEngineManager factory = new ScriptEngineManager(); engine = factory.getEngineByExtension(extension); if (engine != null) { try { engine.put("RuleSet", RuleSet.class); engine.put("Rule", Rule.class); engine.put("State", State.class); engine.put("Command", Command.class); engine.put("ChangedEventTrigger", ChangedEventTrigger.class); engine.put("CommandEventTrigger", CommandEventTrigger.class); engine.put("Event", Event.class); engine.put("EventTrigger", EventTrigger.class); engine.put("ShutdownTrigger", ShutdownTrigger.class); engine.put("StartupTrigger", StartupTrigger.class); engine.put("TimerTrigger", TimerTrigger.class); engine.put("TriggerType", TriggerType.class); engine.put("ItemRegistry", scriptManager.getItemRegistry()); engine.put("DateTime", org.joda.time.DateTime.class); engine.put("oh", Openhab.class); engine.put("DateTimeType", DateTimeType.class); engine.put("DecimalType", DecimalType.class); engine.put("HSBType", HSBType.class); engine.put("IncreaseDecreaseType", IncreaseDecreaseType.class); engine.put("OnOffType", OnOffType.class); engine.put("OpenClosedType", OpenClosedType.class); engine.put("PercentType", PercentType.class); engine.put("PointType", PointType.class); engine.put("StopMoveType", StopMoveType.class); engine.put("UpDownType", UpDownType.class); <START> engine.put("StringType", StringType.class); <END> engine.eval(new FileReader(file)); Invocable inv = (Invocable) engine; RuleSet ruleSet = (RuleSet) inv.invokeFunction("getRules"); rules.addAll(ruleSet.getRules()); } catch (Exception e) { logger.error("error loading script " + file.getName(), e); } } }</code><technical_language>move code out of try-catch</technical_language>

Target:
public void loadScript(File file) throws FileNotFoundException, ScriptException, NoSuchMethodException { logger.info("Loading Script " + file.getName()); String extension = getFileExtension(file); ScriptEngineManager factory = new ScriptEngineManager(); engine = factory.getEngineByExtension(extension); if (engine != null) { initializeSciptGlobals(); engine.eval(new FileReader(file)); Invocable inv = (Invocable) engine; RuleSet ruleSet = (RuleSet) inv.invokeFunction("getRules"); rules.addAll(ruleSet.getRules()); } }
Source:
<code>public static void setUp() { rand = new Random(); <START> CacheFactory cf = new CacheFactory(); cf.set(LOG_LEVEL, "info"); cf.set(MCAST_PORT, "0"); cf.set(LOCATORS, ""); cache = cf.create(); <END> port = AvailablePortHelper.getRandomAvailableTCPPort(); server = new GeodeRedisServer("localhost", port); client = new Jedis("localhost", port, 100000); server.start(); }</code><technical_language>Please single (or double) character variable names</technical_language>

Target:
public static void setUp() { rand = new Random(); CacheFactory cacheFactory = new CacheFactory(); cacheFactory.set(LOG_LEVEL, "info"); cacheFactory.set(MCAST_PORT, "0"); cacheFactory.set(LOCATORS, ""); cache = cacheFactory.create(); port = AvailablePortHelper.getRandomAvailableTCPPort(); server = new GeodeRedisServer("localhost", port); client = new Jedis("localhost", port, 100000); server.start(); }
Source:
<code>public int getBatchSize() { <START> return getContextValue("batchSize") == null ? DEFAULT_BATCH_SIZE : Integer.parseInt(getContextValue("batchSize").toString()); <END> }</code><technical_language>This greater 0 else % operation is get interesting</technical_language>

Target:
public int getBatchSize() { return getContextValue("batchSize") == null ? DEFAULT_BATCH_SIZE : (Integer.parseInt(getContextValue("batchSize").toString()) > 0 ? Integer.parseInt(getContextValue("batchSize").toString()) : DEFAULT_BATCH_SIZE); }