auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void run() { String originalText = editor.getCurrentTab().getSelectedText(); boolean selection = true; <START> if(originalText == null || originalText.isEmpty()) { <END> originalText = editor.getCurrentTab().getText(); selection = false; } String formattedText = aStyleInterface.AStyleMain(originalText, formatterConfiguration); if (formattedText.equals(originalText)) { editor.statusNotice(tr("No changes necessary for Auto Format.")); return; } if(selection) editor.getCurrentTab().setSelectedText(formattedText); else editor.getCurrentTab().setText(formattedText); editor.statusNotice(tr("Auto Format finished.")); }</code><technical_language>I a space if here, is convention here</technical_language>

Target:
public void run() { SketchTextArea textArea = editor.getCurrentTab().getTextArea(); String originalText = textArea.getSelectedText(); if (originalText == null || originalText.isEmpty()) { String formattedText = aStyleInterface.AStyleMain(textArea.getText(), formatterConfiguration); editor.getCurrentTab().setText(formattedText); } else { try { String FORMAT_ON = "\n String FORMAT_OFF = "\n RSyntaxDocument content = (RSyntaxDocument) textArea.getDocument(); textArea.beginAtomicEdit(); int selStart = editor.getCurrentTab().getSelectionStart(); int selEnd = editor.getCurrentTab().getSelectionStop(); int lineStart = textArea.getLineOfOffset(selStart); int lineEnd = textArea.getLineOfOffset(selEnd); int fristLineOffset = textArea.getLineStartOffset(lineStart); int lastLineOffset = textArea.getLineEndOffset(lineEnd); fristLineOffset = navigateOffComments(textArea, fristLineOffset); lastLineOffset = navigateOffComments(textArea, lastLineOffset); int offLength = FORMAT_OFF.length(); int onLength = FORMAT_ON.length(); content.insertString(0, FORMAT_OFF, null); content.insertString(fristLineOffset + offLength, FORMAT_ON, null); content.insertString(lastLineOffset + offLength + onLength, FORMAT_OFF,null); originalText = content.getText(0, content.getLength()); String formattedText = aStyleInterface.AStyleMain(originalText, formatterConfiguration); formattedText = formattedText.replaceAll(Pattern.quote(FORMAT_OFF), ""); formattedText = formattedText.replaceAll(Pattern.quote(FORMAT_ON), ""); textArea.setText(formattedText); textArea.select(selStart, selStart); } catch (BadLocationException e) { editor.statusNotice(tr("Auto Format Error") + ": " + e.getLocalizedMessage()); e.printStackTrace(); return; } finally { textArea.endAtomicEdit(); } } editor.statusNotice(tr("Auto Format finished.")); }
Source:
<code>protected void initialize() { LogKitten.d("MotorControl initialized"); if (motor instanceof PositionSensorMotor) { <START> ((PositionSensorMotor) motor).disableMC(); <END> } }</code><technical_language>"MC" is more ambiguous PID. stand for "Motor Controller" "Motion Controller"</technical_language>

Target:
protected void initialize() { LogKitten.d("MotorControl initialized"); if (motor instanceof PositionSensorMotor) { ((PositionSensorMotor) motor).disableMotionController(); } }
Source:
<code>private List<String> loadColumnFamilyNames() throws IOException { final List<String> cfNames = new ArrayList<>(); final Path file = rocksdbDir.resolve(CF_NAMES_FILENAME); if(Files.exists(file)) { try (final LineNumberReader reader = <START> new LineNumberReader(new InputStreamReader(Files.newInputStream(file), UTF_8))) { <END> String line = null; while ((line = reader.readLine()) != null) { cfNames.add(line); } } } return cfNames; }</code><technical_language>instead of new InputStreamReader(Files.newInputStream(file), UTF_8) Files.newBufferedReader(file, UTF_8)</technical_language>

Target:
private List<String> loadColumnFamilyNames() throws IOException { final List<String> cfNames = new ArrayList<>(); final Path file = rocksDbDir.resolve(COLUMN_FAMILY_NAMES_FILENAME); if(Files.exists(file)) { try (final LineNumberReader reader = new LineNumberReader(Files.newBufferedReader(file, UTF_8))) { String line = null; while ((line = reader.readLine()) != null) { cfNames.add(line); } } } return cfNames; }
Source:
<code>public static String getPreviewURL(DocumentModel doc, String xpath) { StringJoiner sj = new StringJoiner("/", "", "/") .add(REST_API_PREFIX) .add("repo").add(doc.getRepositoryName()) .add("id").add(doc.getId()); if (xpath != null) { sj.add("@blob").add(xpath); } String result = sj.add("@preview").toString(); String ct = doc.getChangeToken(); <START> if (StringUtils.isNoneBlank(ct)) { <END> result += "?" + CoreSession.CHANGE_TOKEN + "=" + doc.getChangeToken(); } return result; }</code><technical_language>I isNotBlank here</technical_language>

Target:
public static String getPreviewURL(DocumentModel doc, String xpath) { StringJoiner sj = new StringJoiner("/", "", "/") .add(REST_API_PREFIX) .add("repo").add(doc.getRepositoryName()) .add("id").add(doc.getId()); if (xpath != null) { sj.add("@blob").add(xpath); } String result = sj.add("@preview").toString(); String ct = doc.getChangeToken(); if (StringUtils.isNotBlank(ct)) { try { result += "?" + CoreSession.CHANGE_TOKEN + "=" + URLEncoder.encode(ct, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new PreviewException(e); } } return result; }
Source:
<code>public Emitter getEmitter( Supplier<HttpEmitterConfig> config, @Nullable SSLContext sslContext, Lifecycle lifecycle, ObjectMapper jsonMapper ) { final DefaultAsyncHttpClientConfig.Builder builder = new DefaultAsyncHttpClientConfig.Builder(); if (sslContext != null) { builder.setSslContext(new JdkSslContext(sslContext, true, ClientAuth.NONE)); } <START> builder.setThreadFactory(new DefaultThreadFactory("emitter-http-client", true)); <END> final AsyncHttpClient client = new DefaultAsyncHttpClient(builder.build()); lifecycle.addCloseableInstance(client); return new HttpPostEmitter(config.get(), client, jsonMapper); }</code><technical_language>io.druid.java.util.common.concurrent.Execs#makeThreadFactory(java.lang.String)</technical_language>

Target:
public Emitter getEmitter( Supplier<HttpEmitterConfig> config, @Nullable SSLContext sslContext, Lifecycle lifecycle, ObjectMapper jsonMapper ) { return new HttpPostEmitter( config.get(), lifecycle.addCloseableInstance( createAsyncHttpClient("HttpPostEmitter-AsyncHttpClient-%d", sslContext) ), jsonMapper ); }
Source:
<code>protected void eventHandle(@NonNull ITmfEvent event) { Integer cpu = TmfTraceUtils.resolveIntEventAspectOfClassForEvent(event.getTrace(), TmfCpuAspect.class, event); if (cpu == null) { return; } ITmfStateSystemBuilder ssb = getStateSystemBuilder(); if (ssb == null) { return; } Integer cpuQuark = fCpuNumToQuark.get(cpu); if (cpuQuark == null) { try { String cpuAttributeName = NonNullUtils.nullToEmptyString(cpu); cpuQuark = ssb.getQuarkAbsoluteAndAdd(cpuAttributeName); fCpuNumToQuark.put(cpu, cpuQuark); <START> ssb.modifyAttribute(0, TmfStateValue.nullValue(), cpuQuark); <END> } catch (StateValueTypeException | AttributeNotFoundException e) { throw new IllegalStateException(e); } } if (!event.getName().equals(fSchedSwitch)) { return; } try { int nextTid = ((Long) event.getContent().getField(fNextTid).getValue()).intValue(); final TmfStateValue value = TmfStateValue.newValueInt(nextTid); ssb.modifyAttribute(event.getTimestamp().toNanos(), value, cpuQuark); } catch (StateValueTypeException | AttributeNotFoundException e) { Activator.getDefault().logError(NonNullUtils.nullToEmptyString(e.getMessage()), e); } }</code><technical_language>t=0. Anyways, I new attributes initialized nullValue state system</technical_language>

Target:
protected void eventHandle(@NonNull ITmfEvent event) { Integer cpu = TmfTraceUtils.resolveIntEventAspectOfClassForEvent(event.getTrace(), TmfCpuAspect.class, event); if (cpu == null) { return; } ITmfStateSystemBuilder ssb = getStateSystemBuilder(); if (ssb == null) { return; } Integer cpuQuark = fCpuNumToQuark.get(cpu); if (cpuQuark == null) { try { String cpuAttributeName = NonNullUtils.nullToEmptyString(cpu); cpuQuark = ssb.getQuarkAbsoluteAndAdd(cpuAttributeName); fCpuNumToQuark.put(cpu, cpuQuark); } catch (StateValueTypeException e) { throw new IllegalStateException(e); } } if (!event.getName().equals(fSchedSwitch)) { return; } try { int nextTid = ((Long) event.getContent().getField(fNextTid).getValue()).intValue(); final TmfStateValue value = TmfStateValue.newValueInt(nextTid); ssb.modifyAttribute(event.getTimestamp().toNanos(), value, cpuQuark); } catch (StateValueTypeException | AttributeNotFoundException e) { Activator.getDefault().logError(NonNullUtils.nullToEmptyString(e.getMessage()), e); } }
Source:
<code>public String toString() { <START> return new ToStringBuilder(this, SHORT_CLASS_NAME_STYLE).append(DataList.this) <END> .append("future", future == null ? null : future.getClass().getSimpleName() + '@' + Integer.toHexString(System.identityHashCode(future))) .append("isMoreDataAvailable", isMoreDataAvailable).toString(); }</code><technical_language>format for future instead of creating string '@' separator</technical_language>

Target:
public String toString() { return new ToStringBuilder(this, ToStringStyle.DEFAULT).append(DataList.this) .append("future", future == null ? null : future.getClass().getSimpleName() + '@' + Integer.toHexString(System.identityHashCode(future))) .append("isMoreDataAvailable", isMoreDataAvailable).toString(); }
Source:
<code>public void testCapture() throws IllegalStateException { URI uri = api().capture(getName(), getName(), getName()); if (uri != null){ boolean jobDone = Predicates2.retry(new Predicate<URI>() { @Override public boolean apply(URI uri) { try { List<ResourceDefinition> definitions = api.getJobApi().captureStatus(uri); if (definitions != null) { for (ResourceDefinition definition : definitions) { LinkedTreeMap<String, String> properties = (LinkedTreeMap<String, String>) definition.properties(); Object storageObject = properties.get("storageProfile"); LinkedTreeMap<String, String> properties2 = (LinkedTreeMap<String, String>) storageObject; Object osDiskObject = properties2.get("osDisk"); LinkedTreeMap<String, String> osProperties = (LinkedTreeMap<String, String>) osDiskObject; Object dataDisksObject = properties2.get("dataDisks"); ArrayList<Object> dataProperties = (ArrayList<Object>) dataDisksObject; LinkedTreeMap<String, String> datadiskObject = (LinkedTreeMap<String, String>) dataProperties.get(0); Assert.assertNotNull(osProperties.get("name")); Assert.assertNotNull(datadiskObject.get("name")); } return true; } <START> assert true; <END> return false; } catch (Exception e) { assert true; return false; } } }, 15 * 1000 ).apply(uri); } }</code><technical_language>Remove this</technical_language>

Target:
public void testCapture() throws IllegalStateException { URI uri = api().capture(getName(), getName(), getName()); if (uri != null) { if (imageAvailablePredicate.apply(uri)) { List<ResourceDefinition> definitions = api.getJobApi().captureStatus(uri); if (definitions != null) { for (ResourceDefinition definition : definitions) { LinkedTreeMap<String, String> properties = (LinkedTreeMap<String, String>) definition.properties(); Object storageObject = properties.get("storageProfile"); LinkedTreeMap<String, String> properties2 = (LinkedTreeMap<String, String>) storageObject; Object osDiskObject = properties2.get("osDisk"); LinkedTreeMap<String, String> osProperties = (LinkedTreeMap<String, String>) osDiskObject; Object dataDisksObject = properties2.get("dataDisks"); ArrayList<Object> dataProperties = (ArrayList<Object>) dataDisksObject; LinkedTreeMap<String, String> datadiskObject = (LinkedTreeMap<String, String>) dataProperties.get(0); Assert.assertNotNull(osProperties.get("name")); Assert.assertNotNull(datadiskObject.get("name")); } } } } }
Source:
<code>private List<DispoItem> createItems(Map<String, DispoItem> exisitingItems, OperationReport report) { List<DispoItem> toReturn; Collection<DispoItemData> values = datIdToItem.values(); for (DispoItemData item : values) { dataFactory.initDispoItem(item); item.setTotalPoints(String.valueOf(item.getAnnotationsList().length() + item.getDiscrepanciesList().length())); } if (!exisitingItems.isEmpty()) { DispoSetCopier copier = new DispoSetCopier(dispoConnector); List<DispoItemData> itemsFromImport = new ArrayList<DispoItemData>(); itemsFromImport.addAll(values); Map<String, DispoItemData> nameToItem = new HashMap<String, DispoItemData>(); for (DispoItemData item : itemsFromImport) { nameToItem.put(item.getName(), item); } toReturn = copier.copyAllDispositions(nameToItem, exisitingItems.values(), false, report); } else { toReturn = new ArrayList<DispoItem>(); toReturn.addAll(values); } <START> for (DispoItem item : toReturn) { <END> if (item.getStatus().equalsIgnoreCase("incomplete")) { createPlaceHolderAnnotations((DispoItemData) item); } } return toReturn; }</code><technical_language>getStatus() return null? If do this backward, get null pointer. if ("incomplete".eqalsIgnoreCase(item.getStatus)) {</technical_language>

Target:
private List<DispoItem> createItems(Map<String, DispoItem> exisitingItems, OperationReport report) { List<DispoItem> toReturn; Collection<DispoItemData> values = datIdToItem.values(); for (DispoItemData item : values) { dataFactory.initDispoItem(item); item.setTotalPoints(String.valueOf(item.getAnnotationsList().length() + item.getDiscrepanciesList().length())); } if (!exisitingItems.isEmpty()) { DispoSetCopier copier = new DispoSetCopier(dispoConnector); List<DispoItemData> itemsFromImport = new ArrayList<>(); itemsFromImport.addAll(values); Map<String, DispoItemData> nameToItem = new HashMap<>(); for (DispoItemData item : itemsFromImport) { nameToItem.put(item.getName(), item); } toReturn = copier.copyAllDispositions(nameToItem, exisitingItems.values(), false, report); } else { toReturn = new ArrayList<>(); toReturn.addAll(values); } for (DispoItem item : toReturn) { if (item.getStatus().equalsIgnoreCase("incomplete")) { createPlaceHolderAnnotations((DispoItemData) item); } } return toReturn; }
Source:
<code>public void deleteBlob(String blobIdString) throws CoordinatorException { OperationContext oc = getOperationContext(); BlobId blobId = getBlobIdFromString(blobIdString); <START> new DeleteOperation(datacenterName, connectionPool, requesterPool, oc, blobId, operationTimeoutMs).execute(); <END> }</code><technical_language>execute is easy miss. format in a is more obvious add another line</technical_language>

Target:
public void deleteBlob(String blobIdString) throws CoordinatorException { BlobId blobId = getBlobIdFromString(blobIdString); DeleteOperation deleteOperation = new DeleteOperation(datacenterName, connectionPool, requesterPool, getOperationContext(), blobId, operationTimeoutMs); deleteOperation.execute(); }
Source:
<code>public void testServiceTopologyInitializationDelayed() throws Exception { IgniteEx loc = startGrids(NODES_CNT); IgniteEx rmt = grid(NODES_CNT - 1); <START> <END> deployServices(loc); fullMsgReceivedLatch.await(getTestTimeout(), MILLISECONDS); IgniteInternalFuture<Boolean> decentSvcFut = runAsync(() -> rmt.services().serviceProxy(DECENT_SRVC, Invoker.class, false).invoke()); IgniteInternalFuture<Boolean> brokenSvcFut = runAsync(() -> rmt.services().serviceProxy(BROKEN_SRVC, Invoker.class, false).invoke()); U.sleep(500); assertFalse(decentSvcFut.isDone()); assertFalse(brokenSvcFut.isDone()); fullMsgUnblockedLatch.countDown(); assertTrue(decentSvcFut.get(getTestTimeout())); assertThrowsWithCause(() -> brokenSvcFut.get(getTestTimeout()), IgniteException.class); }</code><technical_language>assertEquals(1, fullMsgReceivedLatch.getCount());</technical_language>

Target:
public void testServiceTopologyInitializationDelayed() throws Exception { IgniteEx loc = startGrids(NODES_CNT); IgniteEx rmt = grid(NODES_CNT - 1); assertEquals(1, fullMsgReceivedLatch.getCount()); deployServices(loc); assertTrue(fullMsgReceivedLatch.await(getTestTimeout(), MILLISECONDS)); IgniteInternalFuture<Boolean> decentSvcFut = runAsync(() -> rmt.services().serviceProxy(DECENT_SRVC, Invoker.class, false).invoke()); IgniteInternalFuture<Boolean> brokenSvcFut = runAsync(() -> rmt.services().serviceProxy(BROKEN_SRVC, Invoker.class, false).invoke()); U.sleep(500); assertEquals(1, fullMsgUnblockedLatch.getCount()); assertFalse(decentSvcFut.isDone()); assertFalse(brokenSvcFut.isDone()); fullMsgUnblockedLatch.countDown(); assertTrue(decentSvcFut.get(getTestTimeout())); assertThrowsWithCause(() -> brokenSvcFut.get(getTestTimeout()), IgniteException.class); }
Source:
<code>public synchronized void start() { if (live) { return; } if (!registry.isOpen()) { throw new IllegalStateException("Networking Service is already shutdown. Cannot start!"); } live = true; logger.finest("Starting Networking Service and IO selectors."); networking.restart(); startAcceptor(); if (unifiedEndpointManager == null) { <START> refreshStatsFuture = metricsRegistry.scheduleAtFixedRate(refreshStatsTask, 1, SECONDS, ProbeLevel.INFO); <END> refreshStatsTask.registerMetrics(); } }</code><technical_language>1 is ok, consider a configurable interval, ie. Group Property. I start a greater interval here, eg. 3 seconds, for MC use</technical_language>

Target:
public synchronized void start() { if (live) { return; } if (!registry.isOpen()) { throw new IllegalStateException("Networking Service is already shutdown. Cannot start!"); } live = true; logger.finest("Starting Networking Service and IO selectors."); networking.restart(); startAcceptor(); if (unifiedEndpointManager == null) { refreshStatsFuture = metricsRegistry.scheduleAtFixedRate(refreshStatsTask, refreshStatsIntervalSeconds, SECONDS, ProbeLevel.INFO); } }
Source:
<code>public String toString() { <START> return "atomatic"; <END> }</code><technical_language>suggestion return "automatic";</technical_language>

Target:
public String toString() { return "stretch"; }
Source:
<code>public static boolean isAcronymValid(String acronym) { <START> return acronym != null && !acronym.isEmpty() <END> && !ACRONYM_SKIP_LOWERCASED_VALUES.contains(acronym.trim().toLowerCase()); }</code><technical_language>StringUtils.isEmpty is else</technical_language>

Target:
public static boolean isAcronymValid(String acronym) { return !StringUtils.isEmpty(acronym) && !ACRONYM_SKIP_LOWERCASED_VALUES.contains(acronym.trim().toLowerCase()); }
Source:
<code>public Set<String> getChangedFieldsForStatus(VmStatic source, VmStatic destination, VmManagementParametersBase params, VMStatus status) { List<String> fields = updateVmsStatic.getChangedFieldsForStatus(source, destination, status); List<VmDeviceUpdate> devices = getVmDevicesFieldsToUpdateOnNextRun(source.getId(), status, params); <START> fields.addAll(devices.stream().map(d -> d.getName()).collect(Collectors.toList())); <END> return new HashSet<>(fields); }</code><technical_language>VmDeviceUpdate::getName</technical_language>

Target:
public Set<String> getChangedFieldsForStatus(VmStatic source, VmStatic destination, VmManagementParametersBase params, VMStatus status) { List<String> fields = updateVmsStatic.getChangedFieldsForStatus(source, destination, status); List<VmDeviceUpdate> devices = getVmDevicesFieldsToUpdateOnNextRun(source.getId(), status, params); fields.addAll(devices.stream().map(VmDeviceUpdate::getName).collect(Collectors.toList())); return new HashSet<>(fields); }
Source:
<code>public void changesDeliveredToIndexWriter() throws Exception { LuceneIndexWriter writer = mock( LuceneIndexWriter.class ); NonUniqueLuceneIndexPopulatingUpdater updater = newUpdater( writer ); <START> <END> String expectedString1 = documentRepresentingProperties( (long) 1, "after1" ).toString(); String expectedString2 = documentRepresentingProperties( (long) 2, "after2" ).toString(); String expectedString3 = documentRepresentingProperties( 3, "bit", "after2" ).toString(); updater.process( change( 1, SCHEMA_DESCRIPTOR, "before1", "after1" ) ); verifydocument( writer, newTermForChangeOrRemove( 1 ), expectedString1 ); updater.process( change( 2, SCHEMA_DESCRIPTOR, "before2", "after2" ) ); verifydocument( writer, newTermForChangeOrRemove( 2 ), expectedString2 ); updater.process( change( 3, COMPOSITE_SCHEMA_DESCRIPTOR, new Object[]{"bit", "before2"}, new Object[]{"bit", "after2"} ) ); verifydocument( writer, newTermForChangeOrRemove( 3 ), expectedString3 ); }</code><technical_language>remove other unnecessary casts, for symmetry :)</technical_language>

Target:
public void changesDeliveredToIndexWriter() throws Exception { LuceneIndexWriter writer = mock( LuceneIndexWriter.class ); NonUniqueLuceneIndexPopulatingUpdater updater = newUpdater( writer ); String expectedString1 = documentRepresentingProperties( 1, "after1" ).toString(); String expectedString2 = documentRepresentingProperties( 2, "after2" ).toString(); String expectedString3 = documentRepresentingProperties( 3, "bit", "after2" ).toString(); updater.process( change( 1, SCHEMA_DESCRIPTOR, "before1", "after1" ) ); verifydocument( writer, newTermForChangeOrRemove( 1 ), expectedString1 ); updater.process( change( 2, SCHEMA_DESCRIPTOR, "before2", "after2" ) ); verifydocument( writer, newTermForChangeOrRemove( 2 ), expectedString2 ); updater.process( change( 3, COMPOSITE_SCHEMA_DESCRIPTOR, new Object[]{"bit", "before2"}, new Object[]{"bit", "after2"} ) ); verifydocument( writer, newTermForChangeOrRemove( 3 ), expectedString3 ); }
Source:
<code>public List<CourseAttributes> getCoursesForInstructor(List<InstructorAttributes> instructorList) { Assumption.assertNotNull("Supplied parameter was null", instructorList); List<String> courseIdList = new ArrayList<>(); for (InstructorAttributes instructor : instructorList) { <START> if (!coursesDb.getCourse(instructor.courseId).isCourseDeleted()) { <END> courseIdList.add(instructor.courseId); } } List<CourseAttributes> courseList = coursesDb.getCourses(courseIdList); if (courseIdList.size() > courseList.size()) { for (CourseAttributes ca : courseList) { courseIdList.remove(ca.getId()); } log.severe("Course(s) was deleted but the instructor still exists: " + System.lineSeparator() + courseIdList.toString()); } return courseList; }</code><technical_language>above: Streams API</technical_language>

Target:
public List<CourseAttributes> getCoursesForInstructor(List<InstructorAttributes> instructorList) { Assumption.assertNotNull("Supplied parameter was null", instructorList); List<String> courseIdList = instructorList.stream() .filter(instructor -> !coursesDb.getCourse(instructor.courseId).isCourseDeleted()) .map(InstructorAttributes::getCourseId) .collect(Collectors.toList()); List<CourseAttributes> courseList = coursesDb.getCourses(courseIdList); if (courseIdList.size() > courseList.size()) { for (CourseAttributes ca : courseList) { courseIdList.remove(ca.getId()); } log.severe("Course(s) was deleted but the instructor still exists: " + System.lineSeparator() + courseIdList.toString()); } return courseList; }
Source:
<code>public DeleteQuery build() { <START> Checks.checkNotEmpty(table, "Please specify table name"); <END> return new DeleteQuery( table, where, whereArgs ); }</code><technical_language>Static import</technical_language>

Target:
public DeleteQuery build() { checkNotEmpty(table, "Please specify table name"); return new DeleteQuery( table, where, whereArgs ); }
Source:
<code>public ActionValueObjectResponseDto execute(final ClientConnection conn, final DlmsDevice device, final ActivityCalendarDataDto activityCalendar) { MethodResultCode methodResult = null; try { this.setActivityCalendarCommandExecutor.execute(conn, device, activityCalendar.getActivityCalendar()); methodResult = this.setActivityCalendarCommandActivationExecutor.execute(conn, device, null); } catch (final ProtocolAdapterException e) { return new ActionValueObjectResponseDto(e, "Error while setting new activity calendar"); } if (!MethodResultCode.SUCCESS.equals(methodResult)) { <START> return new ActionValueObjectResponseDto("AccessResultCode for set Activity Calendar: " + methodResult); <END> } return new ActionValueObjectResponseDto("Set Activity Calendar Result is OK for device id: " + device.getDeviceIdentification() + " calendar name: " + activityCalendar.getActivityCalendar().getCalendarName()); }</code><technical_language>For method result codes other SUCCESS throw exception bundle. For bundled response I in cases exception thrown added ActionValueObjectResponseDto consistent. I this remark applies other cases result is SUCCESS for a bundled action well,</technical_language>

Target:
public ActionResponseDto execute(final ClientConnection conn, final DlmsDevice device, final ActivityCalendarDataDto activityCalendar) { try { this.setActivityCalendarCommandExecutor.execute(conn, device, activityCalendar.getActivityCalendar()); final MethodResultCode methodResult = this.setActivityCalendarCommandActivationExecutor.execute(conn, device, null); if (!MethodResultCode.SUCCESS.equals(methodResult)) { return new ActionResponseDto("AccessResultCode for set Activity Calendar: " + methodResult); } return new ActionResponseDto("Set Activity Calendar Result is OK for device id: " + device.getDeviceIdentification() + " calendar name: " + activityCalendar.getActivityCalendar().getCalendarName()); } catch (final ProtocolAdapterException e) { LOGGER.error("Error while setting new activity calendar", e); return new ActionResponseDto(e, "Error while setting new activity calendar"); } }
Source:
<code>public void onSaveChangesClicked() { <START> if (compareWithLatest) { <END> view.getEditableContent(content -> { if (isEdited(content)) { saveContent(content); } }); } }</code><technical_language>do check if compareWithLatest</technical_language>

Target:
public void onSaveChangesClicked() { if (compareWithLatest) { final String content = view.getEditableContent(); if (isSaveNeeded(content)) { saveContent(content); } } }
Source:
<code>public void testConnectAnnotationsStringComplete() { <START> dispoItem.getDiscrepanciesList().values(); <END> for (Discrepancy discrepancy : dispoItem.getDiscrepanciesList().values()) { discrepancy.setLocation(discrepancy.getLocation() + "zzz"); } DispoAnnotationData annotationOne = new DispoAnnotationData(); annotationOne.setLocationRefs("1zzz, 2zzz, 3zzz,4zzz,5zzz,12zzz,13zzz,14zzz,15zzz,16zzz,17zzz,18zzz,20zzz"); annotationOne.setIsResolutionValid(true); annotationOne.setResolutionType("Code"); annotationOne.setId(annotIdOne); List<String> idsOfCoveredDisc = new ArrayList<String>(); annotationOne.setIdsOfCoveredDiscrepancies(idsOfCoveredDisc); dispoConnector.connectAnnotation(annotationOne, dispoItem.getDiscrepanciesList()); List<DispoAnnotationData> annotationsList = new ArrayList<DispoAnnotationData>(); annotationsList.add(annotationOne); dispoItem.setAnnotationsList(annotationsList); List<String> idsOfCoveredDiscrepancies = annotationOne.getIdsOfCoveredDiscrepancies(); Assert.assertTrue(idsOfCoveredDiscrepancies.size() == 13); for (int i = 0; i < idsOfCoveredDiscrepancies.size(); i++) { if (i < 5) { assertEquals(idsOfCoveredDiscrepancies.get(i), idsForDiscrepancies1_5[i]); } else if (i < 12) { assertEquals(idsOfCoveredDiscrepancies.get(i), idsForDiscrepancies12_18[i - 5]); } else { assertEquals(idsOfCoveredDiscrepancies.get(i), id20); } } assertTrue(annotationOne.getIsConnected()); String actual = dispoConnector.getItemStatus(dispoItem); assertEquals(DispoStrings.Item_Complete, actual); }</code><technical_language>delete line 79</technical_language>

Target:
public void testConnectAnnotationsStringComplete() { for (Discrepancy discrepancy : dispoItem.getDiscrepanciesList().values()) { discrepancy.setLocation(discrepancy.getLocation() + "zzz"); } DispoAnnotationData annotationOne = new DispoAnnotationData(); annotationOne.setLocationRefs("1zzz, 2zzz, 3zzz,4zzz,5zzz,12zzz,13zzz,14zzz,15zzz,16zzz,17zzz,18zzz,20zzz"); annotationOne.setIsResolutionValid(true); annotationOne.setResolutionType("Code"); annotationOne.setId(annotIdOne); List<String> idsOfCoveredDisc = new ArrayList<String>(); annotationOne.setIdsOfCoveredDiscrepancies(idsOfCoveredDisc); dispoConnector.connectAnnotation(annotationOne, dispoItem.getDiscrepanciesList()); List<DispoAnnotationData> annotationsList = new ArrayList<DispoAnnotationData>(); annotationsList.add(annotationOne); dispoItem.setAnnotationsList(annotationsList); List<String> idsOfCoveredDiscrepancies = annotationOne.getIdsOfCoveredDiscrepancies(); Assert.assertTrue(idsOfCoveredDiscrepancies.size() == 13); for (int i = 0; i < idsOfCoveredDiscrepancies.size(); i++) { if (i < 5) { assertEquals(idsOfCoveredDiscrepancies.get(i), idsForDiscrepancies1_5[i]); } else if (i < 12) { assertEquals(idsOfCoveredDiscrepancies.get(i), idsForDiscrepancies12_18[i - 5]); } else { assertEquals(idsOfCoveredDiscrepancies.get(i), id20); } } assertTrue(annotationOne.getIsConnected()); String actual = dispoConnector.getItemStatus(dispoItem); assertEquals(DispoStrings.Item_Complete, actual); }
Source:
<code>private String invoke(Object obj, String methodName, Object...args) throws Throwable { Class<?>[] types = extractTypes(args); try { Method method = null; for (int length = types.length; length >= 0; length--) { method = new Mirror().on(obj.getClass()).reflect().method(methodName) .withArgs(Arrays.copyOf(types, length)); if (method != null) break; } if (methodName.startsWith("get")) { return method.invoke(obj).toString(); } return method.invoke(obj, args).toString(); } catch (MirrorException | InvocationTargetException e) { <START> throw e.getCause() == null? e : e.getCause(); <END> } }</code><technical_language>simply new Mirror().on(obj).invoke(method).withArgs(args)</technical_language>

Target:
private String invoke(Object obj, String methodName, Object...args) throws Throwable { Class<?>[] types = extractTypes(args); try { Method method = null; for (int length = types.length; length >= 0; length--) { method = new Mirror().on(obj.getClass()).reflect().method(methodName) .withArgs(Arrays.copyOf(types, length)); if (method != null) break; } if (methodName.startsWith("get")) { return method.invoke(obj).toString(); } return new Mirror().on(obj).invoke().method(method).withArgs(args).toString(); } catch (MirrorException | InvocationTargetException e) { throw e.getCause() == null? e : e.getCause(); } }
Source:
<code>private void refreshPage() throws IOException { ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext(); <START> ec.redirect(((HttpServletRequest) ec.getRequest()).getRequestURI()); <END> }</code><technical_language>suggestion externalContext.redirect(((HttpServletRequest) externalContext.getRequest()).getRequestURI());</technical_language>

Target:
private void refreshPage() throws IOException { FacesContext currentInstance = FacesContext.getCurrentInstance(); if (Objects.nonNull(currentInstance)) { ExternalContext externalContext = currentInstance.getExternalContext(); externalContext.redirect(((HttpServletRequest) externalContext.getRequest()).getRequestURI()); } }
Source:
<code>private void populateSoldierBox(final View view, final ListRowElement item) { if (item instanceof SoldierSpinnerRow) { final SoldierSpinnerRow row = (SoldierSpinnerRow) item; final SoldierSpinnerAdapter adapter = new SoldierSpinnerAdapter(context, row.getSoldierStats()); final Spinner spinner = (Spinner) view.findViewById(R.id.spinner_soldier); final long id = preferences.getLong(Keys.Menu.LATEST_PERSONA, 0); spinner.setAdapter(adapter); spinner.setOnItemSelectedListener( new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { <START> final long oldId = preferences.getLong(Keys.Menu.LATEST_PERSONA, -1); <END> if (oldId != id) { preferences.edit().putLong(Keys.Menu.LATEST_PERSONA, id).commit(); BusProvider.getInstance().post(new ActiveSoldierChangedEvent(id)); } } @Override public void onNothingSelected(AdapterView<?> parent) { } } ); spinner.setSelection(getIndexForSoldierInList(id, row.getSoldierStats())); } }</code><technical_language>thinking loud oldId called currentId id called selectedId</technical_language>

Target:
private void populateSoldierBox(final View view, final ListRowElement item) { if (item instanceof SoldierSpinnerRow) { final SoldierSpinnerRow row = (SoldierSpinnerRow) item; final SoldierSpinnerAdapter adapter = new SoldierSpinnerAdapter(context, row.getSoldierStats()); final Spinner spinner = (Spinner) view.findViewById(R.id.spinner_soldier); final long id = preferences.getLong(Keys.Menu.LATEST_PERSONA, 0); spinner.setAdapter(adapter); spinner.setOnItemSelectedListener( new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long selectedId) { final long currentId = preferences.getLong(Keys.Menu.LATEST_PERSONA, -1); if (currentId != selectedId) { preferences.edit().putLong(Keys.Menu.LATEST_PERSONA, selectedId).commit(); BusProvider.getInstance().post(new ActiveSoldierChangedEvent(selectedId)); } } @Override public void onNothingSelected(AdapterView<?> parent) { } } ); spinner.setSelection(getIndexForSoldierInList(id, row.getSoldierStats())); } }
Source:
<code>public BeanMetaDataManager(ConstraintHelper constraintHelper, ExecutableHelper executableHelper, ParameterNameProvider parameterNameProvider, List<MetaDataProvider> optionalMetaDataProviders) { this.constraintHelper = constraintHelper; this.metaDataProviders = newArrayList(); this.metaDataProviders.addAll( optionalMetaDataProviders ); this.executableHelper = executableHelper; this.beanMetaDataCache = new ConcurrentReferenceHashMap<Class<?>, BeanMetaData<?>>( DEFAULT_INITIAL_CAPACITY, DEFAULT_LOAD_FACTOR, DEFAULT_CONCURRENCY_LEVEL, SOFT, SOFT, EnumSet.of( IDENTITY_COMPARISONS ) ); AnnotationProcessingOptions annotationProcessingOptions = getAnnotationProcessingOptionsFromNonDefaultProviders(); AnnotationMetaDataProvider defaultProvider = null; if ( Version.getJavaRelease() >= 8 ) { <START> defaultProvider = new TypeUseAnnotationMetaDataProvider( <END> constraintHelper, parameterNameProvider, annotationProcessingOptions ); } else { defaultProvider = new AnnotationMetaDataProvider( constraintHelper, parameterNameProvider, annotationProcessingOptions ); } this.metaDataProviders.add( defaultProvider ); }</code><technical_language>I for this approach need fully fledged metadata providers</technical_language>

Target:
public BeanMetaDataManager(ConstraintHelper constraintHelper, ExecutableHelper executableHelper, ParameterNameProvider parameterNameProvider, List<MetaDataProvider> optionalMetaDataProviders) { this.constraintHelper = constraintHelper; this.metaDataProviders = newArrayList(); this.metaDataProviders.addAll( optionalMetaDataProviders ); this.executableHelper = executableHelper; this.beanMetaDataCache = new ConcurrentReferenceHashMap<Class<?>, BeanMetaData<?>>( DEFAULT_INITIAL_CAPACITY, DEFAULT_LOAD_FACTOR, DEFAULT_CONCURRENCY_LEVEL, SOFT, SOFT, EnumSet.of( IDENTITY_COMPARISONS ) ); AnnotationProcessingOptions annotationProcessingOptions = getAnnotationProcessingOptionsFromNonDefaultProviders(); AnnotationMetaDataProvider defaultProvider = null; if ( Version.getJavaRelease() >= 8 ) { defaultProvider = new TypeAnnotationAwareMetaDataProvider( constraintHelper, parameterNameProvider, annotationProcessingOptions ); } else { defaultProvider = new AnnotationMetaDataProvider( constraintHelper, parameterNameProvider, annotationProcessingOptions ); } this.metaDataProviders.add( defaultProvider ); }
Source:
<code>public CommonProgressDialog(Context context) { progressDialog = new ProgressDialog(context); progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); <START> setCancelable(false); <END> }</code><technical_language>This change removed</technical_language>

Target:
public CommonProgressDialog(Context context) { progressDialog = new ProgressDialog(context); progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); }
Source:
<code>public Configuration getConfiguration() { final Configuration configuration = new Configuration(); final Map<String, File> configurationFiles = new HashMap<>(); Arrays.stream(getDirectories()).map(File::new).filter(File::isDirectory).forEach(c -> { final File[] array = c.listFiles(); assert (array != null); Arrays.stream(array).filter(File::isFile).filter(f -> !configurationFiles.containsKey(f.getName())) .forEach(f -> configurationFiles.put(f.getName(), f)); }); if (configurationFiles.size() == 0) { throw new IllegalStateException( "Specified directories does not contain any Hadoop configuration files"); } <START> configurationFiles.values().stream().map(File::toURI).map(Path::new).forEach(configuration::addResource); <END> return configuration; }</code><technical_language>If of configuration directories contains a non-XML file DataCleaner fail successfully startup Hadoop's Configuration class expects resources parse-able XML</technical_language>

Target:
public Configuration getConfiguration() { final Configuration configuration = new Configuration(); final Map<String, File> configurationFiles = new HashMap<>(); Arrays.stream(getDirectories()).map(File::new).filter(File::isDirectory).forEach(c -> { final File[] array = c.listFiles(); assert (array != null); Arrays.stream(array).filter(File::isFile).filter(f -> !configurationFiles.containsKey(f.getName())) .filter(f -> FilenameUtils.getExtension(f.getName()).equalsIgnoreCase("xml")) .forEach(f -> configurationFiles.put(f.getName(), f)); }); if (configurationFiles.size() == 0) { throw new IllegalStateException( "Specified directories does not contain any Hadoop configuration files"); } configurationFiles.values().stream().map(File::toURI).map(Path::new).forEach(configuration::addResource); return configuration; }
Source:
<code>private void checkEnvironment(RegistrationManager rm) throws BookieException, IOException { List<File> allLedgerDirs = new ArrayList<File>(ledgerDirsManager.getAllLedgerDirs().size() + indexDirsManager.getAllLedgerDirs().size()); allLedgerDirs.addAll(ledgerDirsManager.getAllLedgerDirs()); if (indexDirsManager != ledgerDirsManager) { allLedgerDirs.addAll(indexDirsManager.getAllLedgerDirs()); } if (rm == null) { for (File journalDirectory : journalDirectories) { checkDirectoryStructure(journalDirectory); } for (File dir : allLedgerDirs) { checkDirectoryStructure(dir); } return; } checkEnvironmentWithStorageExpansion(conf, rm, journalDirectories, allLedgerDirs); List<File> ledgerDirs = ledgerDirsManager.getAllLedgerDirs(); checkIfDirsOnSameDiskPartition(ledgerDirs); List<File> indexDirs = indexDirsManager.getAllLedgerDirs(); <START> checkIfDirsOnSameDiskPartition(indexDirs); <END> checkIfDirsOnSameDiskPartition(journalDirectories); }</code><technical_language>simply call checkIfDirsOnSameDiskPartition(allLedgerDirs)</technical_language>

Target:
private void checkEnvironment(RegistrationManager rm) throws BookieException, IOException { List<File> allLedgerDirs = new ArrayList<File>(ledgerDirsManager.getAllLedgerDirs().size() + indexDirsManager.getAllLedgerDirs().size()); allLedgerDirs.addAll(ledgerDirsManager.getAllLedgerDirs()); if (indexDirsManager != ledgerDirsManager) { allLedgerDirs.addAll(indexDirsManager.getAllLedgerDirs()); } if (rm == null) { for (File journalDirectory : journalDirectories) { checkDirectoryStructure(journalDirectory); } for (File dir : allLedgerDirs) { checkDirectoryStructure(dir); } return; } checkEnvironmentWithStorageExpansion(conf, rm, journalDirectories, allLedgerDirs); checkIfDirsOnSameDiskPartition(allLedgerDirs); checkIfDirsOnSameDiskPartition(journalDirectories); }
Source:
<code>public void enableTrySamples(){ final MenuResourceHandlerWidget menuResourceHandlerWidget = menuResourceHandlerWidgets.get(); <START> menuResourceHandlerWidget.init(this.translationService.getTranslation("TrySamples"), <END> () -> libraryPlaces.closeAllPlacesOrNothing(() -> { libraryPlaces.goToLibrary(); libraryPlaces.goToTrySamples(); })); view.addNewMenuItem(menuResourceHandlerWidget); }</code><technical_language>extract "TrySamples" string a constant in LibraryConstants.java</technical_language>

Target:
public void enableTrySamples(){ final MenuResourceHandlerWidget menuResourceHandlerWidget = menuResourceHandlerWidgets.get(); menuResourceHandlerWidget.init(this.translationService.getTranslation(LibraryConstants.TrySamples), () -> libraryPlaces.closeAllPlacesOrNothing(() -> { libraryPlaces.goToLibrary(); libraryPlaces.goToTrySamples(); })); view.addNewMenuItem(menuResourceHandlerWidget); }
Source:
<code>private void validatePlayists(final Page<SimplePlaylist> playlistSearchResult) { assertEquals("<LINK_2>", playlistSearchResult.getHref()); assertEquals(20, playlistSearchResult.getLimit()); assertEquals(0, playlistSearchResult.getOffset()); assertNull(playlistSearchResult.getNext()); assertNull(playlistSearchResult.getPrevious()); assertEquals(7, playlistSearchResult.getTotal()); List<SimplePlaylist> playlists = playlistSearchResult.getItems(); assertEquals(7, playlists.size()); SimplePlaylist firstPlaylist = playlists.get(0); assertEquals("<LINK_0>", firstPlaylist.getExternalUrls().get("spotify")); assertEquals("<LINK_1>", firstPlaylist.getHref()); assertEquals("5W11lXKiV9B5RZluPrxmCS", firstPlaylist.getId()); <START> assertEquals("Tdog✌🏿️", firstPlaylist.getName()); <END> assertNotNull(firstPlaylist.getImages()); assertNotNull(firstPlaylist.getOwner()); assertEquals(SpotifyEntityType.PLAYLIST, firstPlaylist.getType()); assertEquals("spotify:user:theodorduf:playlist:5W11lXKiV9B5RZluPrxmCS", firstPlaylist.getUri()); }</code><technical_language>This line throws error: unmappable character for encoding Cp1252</technical_language>

Target:
private void validatePlayists(final Page<SimplePlaylist> playlistSearchResult) { assertEquals("<LINK_2>", playlistSearchResult.getHref()); assertEquals(20, playlistSearchResult.getLimit()); assertEquals(0, playlistSearchResult.getOffset()); assertNull(playlistSearchResult.getNext()); assertNull(playlistSearchResult.getPrevious()); assertEquals(7, playlistSearchResult.getTotal()); List<SimplePlaylist> playlists = playlistSearchResult.getItems(); assertEquals(7, playlists.size()); SimplePlaylist firstPlaylist = playlists.get(0); assertEquals("<LINK_0>", firstPlaylist.getExternalUrls().get("spotify")); assertEquals("<LINK_1>", firstPlaylist.getHref()); assertEquals("5W11lXKiV9B5RZluPrxmCS", firstPlaylist.getId()); assertEquals("Tdog", firstPlaylist.getName()); assertNotNull(firstPlaylist.getImages()); assertNotNull(firstPlaylist.getOwner()); assertEquals(SpotifyEntityType.PLAYLIST, firstPlaylist.getType()); assertEquals("spotify:user:theodorduf:playlist:5W11lXKiV9B5RZluPrxmCS", firstPlaylist.getUri()); }
Source:
<code>public boolean exec() throws CliException { String path = args[1]; CountDownLatch latch = new CountDownLatch(1); final int[] resultCode = new int[1]; try { zk.sync(path, new AsyncCallback.VoidCallback() { public void processResult(int rc, String path, Object ctx) { resultCode[0] = rc; latch.countDown(); } }, null); <START> latch.await(); <END> out.println("Sync returned " + resultCode[0]); } catch (IllegalArgumentException | InterruptedException ex) { throw new MalformedPathException(ex.getMessage()); } return false; }</code><technical_language>safer wait for some reasonable amount of time (30s) waiting indefinitely</technical_language>

Target:
public boolean exec() throws CliException { String path = args[1]; CompletableFuture<Integer> cf = new CompletableFuture<>(); try { zk.sync(path, new AsyncCallback.VoidCallback() { public void processResult(int rc, String path, Object ctx) { cf.complete(rc); } }, null); int resultCode = cf.get(SYNC_TIMEOUT, TimeUnit.MILLISECONDS); if(resultCode == 0) { out.println("Sync is OK"); } else { out.println("Sync has failed. rc=" + resultCode); } } catch (IllegalArgumentException ex) { throw new MalformedPathException(ex.getMessage()); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); throw new CliWrapperException(ie); } catch (TimeoutException | ExecutionException ex) { throw new CliWrapperException(ex); } return false; }
Source:
<code>public Optional<HostLocation> get() { <START> switch (snitch) { <END> case "org.apache.cassandra.locator.EC2Snitch": return ec2Supplier.get(); default: return defaultSupplier.get(); } }</code><technical_language>suggest default supplier in preference of automatic if present. Basically - if user configured something, thing. This account 'the Cassandra is in AWS not' - a see, do 'the Cassandra is in a AWS account' is thing</technical_language>

Target:
public Optional<HostLocation> get() { try { if (overrideLocation.isPresent()) { return overrideLocation; } switch (snitchSupplier.get()) { case "org.apache.cassandra.locator.EC2Snitch": return Optional.of(ec2Supplier.get()); default: return Optional.empty(); } } catch (RuntimeException e) { log.warn("Host location supplier failed to retrieve the host location", e); return Optional.empty(); } }
Source:
<code>public boolean equals(Object o) { if (this == o) return true; <START> if (o != null && !(o instanceof RangeData)) { <END> return false; } RangeData data = (RangeData)o; if (startLine != data.startLine) return false; if (startColumn != data.startColumn) return false; if (endLine != data.endLine) return false; if (endColumn != data.endColumn) return false; if (hits != data.hits) return false; if (statements != data.statements) return false; return true; }</code><technical_language>redundant o != null here. if want avoid npe, separate if</technical_language>

Target:
public boolean equals(Object o) { if (this == o) return true; if (o != null) { if (this.getClass() != o.getClass()) { return false; } } RangeData data = (RangeData)o; if (startLine != data.startLine) return false; if (startColumn != data.startColumn) return false; if (endLine != data.endLine) return false; if (endColumn != data.endColumn) return false; if (hits != data.hits) return false; if (statements != data.statements) return false; return true; }
Source:
<code><START> public Properties getQueueProperties(final String queueName) { <END> return this.rabbitTemplate.execute(new ChannelCallback<Properties>() { public Properties doInRabbit(Channel channel) throws Exception { try { DeclareOk declareOk = channel.queueDeclarePassive(queueName); Properties props = new Properties(); props.put(QUEUE_NAME, declareOk.getQueue()); props.put(QUEUE_MESSAGE_COUNT, declareOk.getMessageCount()); props.put(QUEUE_CONSUMER_COUNT, declareOk.getConsumerCount()); return props; } catch (Exception e) { if (logger.isDebugEnabled()) { logger.debug("Queue '" + queueName + "' does not exist"); } return null; } } }); }</code><technical_language>do assertion / null-check queue name here</technical_language>

Target:
public Properties getQueueProperties(final String queueName) { Assert.hasText(queueName, "'queueName' cannot be null or empty"); return this.rabbitTemplate.execute(new ChannelCallback<Properties>() { public Properties doInRabbit(Channel channel) throws Exception { try { DeclareOk declareOk = channel.queueDeclarePassive(queueName); Properties props = new Properties(); props.put(QUEUE_NAME, declareOk.getQueue()); props.put(QUEUE_MESSAGE_COUNT, declareOk.getMessageCount()); props.put(QUEUE_CONSUMER_COUNT, declareOk.getConsumerCount()); return props; } catch (Exception e) { if (logger.isDebugEnabled()) { logger.debug("Queue '" + queueName + "' does not exist"); } return null; } } }); }
Source:
<code>public String type () { <START> return TYPE; <END> }</code><technical_language>This is implementations override type() method else in objectstore - a getType() BACoordinator means override getType() I see, I miss required I do need some clarification</technical_language>

Target:
public String type () { return "/StateManager/BasicAction/AtomicAction/Sagas/BACoordinator"; }
Source:
<code>public Mono<ConfigurationSetting> addSetting(ConfigurationSetting setting) { return client.addSetting(setting) <START> .flatMap(response -> Mono.justOrEmpty(response.value())); <END> }</code><technical_language>If this approach this code pattern common want optimise it. I propose create some static utility method named unwrapResponse called lines of return unwrapResponse(client.addSetting(setting))</technical_language>

Target:
public Mono<ConfigurationSetting> addSetting(ConfigurationSetting setting) { return client.addSetting(setting).map(ConfigurationAsyncClient::unwrapResponse); }