auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void onComment(String content, TagStack stack) { boolean ignoreElements = stack.shouldIgnoreElements(); if(!ignoreElements) { if (content.startsWith("startwikilink:")) { handleLinkCommentStart(XMLUtils.unescapeXMLComment(content), stack); } else if (content.startsWith("stopwikilink")) { handleLinkCommentStop(stack); } else if (content.startsWith("startimage:")) { handleImageCommentStart(XMLUtils.unescapeXMLComment(content), stack); } else if (content.startsWith("stopimage")) { handleImageCommentStop(stack); } else (content.startsWith("startmacro")) { super.onComment(XMLUtils.unescapeXMLComment(content), stack); <START> } } <END> else { super.onComment(content, stack); } }</code><technical_language>This follow XWiki format</technical_language>

Target:
public void onComment(String content, TagStack stack) { boolean ignoreElements = stack.shouldIgnoreElements(); if (!ignoreElements && content.startsWith("startwikilink:")) { handleLinkCommentStart(XMLUtils.unescapeXMLComment(content), stack); } else if (!ignoreElements && content.startsWith("stopwikilink")) { handleLinkCommentStop(stack); } else if (!ignoreElements && content.startsWith("startimage:")) { handleImageCommentStart(XMLUtils.unescapeXMLComment(content), stack); } else if (!ignoreElements && content.startsWith("stopimage")) { handleImageCommentStop(stack); } else if (!ignoreElements && content.startsWith("startmacro")) { super.onComment(XMLUtils.unescapeXMLComment(content), stack); } else { super.onComment(content, stack); } }
Source:
<code>public void method_with_unknown_symbol_should_not_produce_ucfg() { CompilationUnitTree cut = getCompilationUnitTreeWithSemantics("class A {void foo(UnkownType t) {return t;}}"); UCFGJavaVisitor UCFGJavaVisitor = new UCFGJavaVisitor(tmp.getRoot()) { @Override protected void serializeUCFG(MethodTree tree, CFG cfg) { fail("should not serialize a UCFG of a method with unknown parameters"); } }; UCFGJavaVisitor.fileKey = FILE_KEY; UCFGJavaVisitor.visitCompilationUnit(cut); cut = getCompilationUnitTreeWithSemantics("class A {UnkownType foo(String t) {return t;}}"); UCFGJavaVisitor.visitCompilationUnit(cut); <START> <END> }</code><technical_language>useless empty lines</technical_language>

Target:
public void method_with_unknown_symbol_should_not_produce_ucfg() { UCFGJavaVisitor UCFGJavaVisitor = new UCFGJavaVisitor(tmp.getRoot()) { @Override protected void serializeUCFG(MethodTree tree, CFG cfg) { fail("should not serialize a UCFG of a method with unknown parameters"); } }; UCFGJavaVisitor.fileKey = FILE_KEY; CompilationUnitTree cut = getCompilationUnitTreeWithSemantics("class A {void foo(UnkownType t) {return t;}}"); UCFGJavaVisitor.visitCompilationUnit(cut); cut = getCompilationUnitTreeWithSemantics("class A {UnkownType foo(String t) {return t;}}"); UCFGJavaVisitor.visitCompilationUnit(cut); }
Source:
<code>private static Envelope getEnvelope(OGCGeometry ogcGeometry) { <START> com.esri.core.geometry.Envelope env = new com.esri.core.geometry.Envelope(); <END> ogcGeometry.getEsriGeometry().queryEnvelope(env); return new Envelope(env.getXMin(), env.getXMax(), env.getYMin(), env.getYMax()); }</code><technical_language>env is typically for environment, please name envelope</technical_language>

Target:
private static Envelope getEnvelope(OGCGeometry ogcGeometry) { com.esri.core.geometry.Envelope envelope = new com.esri.core.geometry.Envelope(); ogcGeometry.getEsriGeometry().queryEnvelope(envelope); return new Envelope(envelope.getXMin(), envelope.getXMax(), envelope.getYMin(), envelope.getYMax()); }
Source:
<code>public void test401ShouldRetry4Times() { HttpCommand command = createMock(HttpCommand.class); HttpRequest request = createMock(HttpRequest.class); HttpResponse response = createMock(HttpResponse.class); @SuppressWarnings("unchecked") LoadingCache<Credentials, Access> cache = createMock(LoadingCache.class); expect(command.getCurrentRequest()).andReturn(request).anyTimes(); expect(request.getHeaders()).andStubReturn(null); cache.invalidateAll(); expectLastCall().anyTimes(); expect(response.getPayload()).andReturn(Payloads.newStringPayload("")).anyTimes(); expect(response.getStatusCode()).andReturn(401).anyTimes(); replay(command); replay(request); replay(response); <START> replay(cache); <END> RetryOnRenew retry = new RetryOnRenew(cache); for(int n=0; n<4; n++) assertTrue(retry.shouldRetryRequest(command, response)); assertFalse(retry.shouldRetryRequest(command, response)); verify(command); verify(response); verify(cache); }</code><technical_language>worth changing commit for, this replay(command, request, response, cache);</technical_language>

Target:
public void test401ShouldRetry4Times() { HttpCommand command = createMock(HttpCommand.class); HttpRequest request = createMock(HttpRequest.class); HttpResponse response = createMock(HttpResponse.class); @SuppressWarnings("unchecked") LoadingCache<Credentials, Access> cache = createMock(LoadingCache.class); expect(command.getCurrentRequest()).andReturn(request).anyTimes(); expect(request.getHeaders()).andStubReturn(null); cache.invalidateAll(); expectLastCall().anyTimes(); expect(response.getPayload()).andReturn(Payloads.newStringPayload("")).anyTimes(); expect(response.getStatusCode()).andReturn(401).anyTimes(); replay(command, request, response, cache); RetryOnRenew retry = new RetryOnRenew(cache); for(int n = 0; n < RetryOnRenew.AUTH_RETRIES; n++) assertTrue(retry.shouldRetryRequest(command, response), "Expected retry to succeed"); assertFalse(retry.shouldRetryRequest(command, response), "Expected retry to fail on attempt 5"); verify(command, response, cache); }
Source:
<code><START> private VdcBllMessages networkInUseValidationMessage(int numberOfEntities) { <END> boolean singular = numberOfEntities == 1; return singular ? VdcBllMessages.ACTION_TYPE_FAILED_NETWORK_IN_ONE_USE : VdcBllMessages.ACTION_TYPE_FAILED_NETWORK_IN_MANY_USES; }</code><technical_language>A method name start a verb (like get...)</technical_language>

Target:
private VdcBllMessages networkInUseValidationMessage(int numberOfEntities) { boolean singular = numberOfEntities == 1; if (singular) { return VdcBllMessages.ACTION_TYPE_FAILED_NETWORK_IN_ONE_USE; } else { return VdcBllMessages.ACTION_TYPE_FAILED_NETWORK_IN_MANY_USES; } }
Source:
<code>private void save(String interpreterSettingName) throws IOException { InterpreterSetting interpreterSetting = interpreterSettingManager.getInterpreterSettingByName(interpreterSettingName); List<String> recoveryContent = new ArrayList<>(); for (ManagedInterpreterGroup interpreterGroup : interpreterSetting.getAllInterpreterGroups()) { RemoteInterpreterProcess interpreterProcess = interpreterGroup.getInterpreterProcess(); if (interpreterProcess != null) { recoveryContent.add(interpreterGroup.getId() + "\t" + interpreterProcess.getHost() + ":" + interpreterProcess.getPort()); } } LOGGER.debug("Updating recovery data for interpreterSetting: " + interpreterSettingName); LOGGER.debug("Recovery Data: " + StringUtils.join(recoveryContent, "\n")); Path recoveryFile = new Path(recoveryDir, interpreterSettingName + ".recovery"); <START> fs.writeFile(StringUtils.join(recoveryContent, "\n"), recoveryFile, true); <END> }</code><technical_language>nit: System.lineSeparator()</technical_language>

Target:
private void save(String interpreterSettingName) throws IOException { InterpreterSetting interpreterSetting = interpreterSettingManager.getInterpreterSettingByName(interpreterSettingName); List<String> recoveryContent = new ArrayList<>(); for (ManagedInterpreterGroup interpreterGroup : interpreterSetting.getAllInterpreterGroups()) { RemoteInterpreterProcess interpreterProcess = interpreterGroup.getInterpreterProcess(); if (interpreterProcess != null) { recoveryContent.add(interpreterGroup.getId() + "\t" + interpreterProcess.getHost() + ":" + interpreterProcess.getPort()); } } LOGGER.debug("Updating recovery data for interpreterSetting: " + interpreterSettingName); LOGGER.debug("Recovery Data: " + StringUtils.join(recoveryContent, System.lineSeparator())); Path recoveryFile = new Path(recoveryDir, interpreterSettingName + ".recovery"); fs.writeFile(StringUtils.join(recoveryContent, System.lineSeparator()), recoveryFile, true); }
Source:
<code>public void notifyHasMessage(final Mailbox mailbox, final MessageSelector kind) { if (kind instanceof DifferentialTimestamp) { final DifferentialTimestamp timestamp = (DifferentialTimestamp) kind; if (Options.MONITOR_VIOLATION_OF_DIFFERENTIAL_DATAFLOW_TIMESTAMPS && this.currentlyDeliveredTimestamp != null) { final DifferentialTimestamp first = (DifferentialTimestamp) this.currentlyDeliveredTimestamp; if (timestamp.compareTo(first) < 0) { final Logger logger = this.representative.getContainer().getNetwork().getEngine().getLogger(); logger.error( "[INTERNAL ERROR] Violation of differential dataflow communication schema! The communication component with representative " + this.representative + " observed decreasing timestamp during message delivery!"); } } Set<Mailbox> mailboxes = this.mailboxQueue.get(timestamp); if (mailboxes == null) { mailboxes = new TreeSet<Mailbox>(new Comparator<Mailbox>() { @Override public int compare(final Mailbox left, final Mailbox right) { <START> return left.getReceiver().toString().compareTo(right.getReceiver().toString()); <END> }; }); this.mailboxQueue.put(timestamp, mailboxes); } mailboxes.add(mailbox); if (!this.isEnqueued && !this.currentlyDelivering) { this.tracker.activateUnenqueued(this); } } else { throw new IllegalArgumentException(UNSUPPORTED_MESSAGE_KIND + kind); } }</code><technical_language>receivers Node.getNodeID() do compared based potentially expensive toString()? This comparison is expected called gajillion times..</technical_language>

Target:
public void notifyHasMessage(final Mailbox mailbox, final MessageSelector kind) { if (kind instanceof DifferentialTimestamp) { final DifferentialTimestamp timestamp = (DifferentialTimestamp) kind; if (Options.MONITOR_VIOLATION_OF_DIFFERENTIAL_DATAFLOW_TIMESTAMPS && this.currentlyDeliveredTimestamp != null) { final DifferentialTimestamp first = (DifferentialTimestamp) this.currentlyDeliveredTimestamp; if (timestamp.compareTo(first) < 0) { final Logger logger = this.representative.getContainer().getNetwork().getEngine().getLogger(); logger.error( "[INTERNAL ERROR] Violation of differential dataflow communication schema! The communication component with representative " + this.representative + " observed decreasing timestamp during message delivery!"); } } Set<Mailbox> mailboxes = this.mailboxQueue.get(timestamp); if (mailboxes == null) { mailboxes = new HashSet<Mailbox>(); this.mailboxQueue.put(timestamp, mailboxes); } mailboxes.add(mailbox); if (!this.isEnqueued && !this.currentlyDelivering) { this.tracker.activateUnenqueued(this); } } else { throw new IllegalArgumentException(UNSUPPORTED_MESSAGE_KIND + kind); } }
Source:
<code>public void factoryWithDirectUrlWithSpecificBranch() { String repositoryName = testAuxiliaryRepo.getName(); final String wsTheiaIdeTerminalTitle = "theia-ide terminal 0"; List<String> expectedItemsAfterCloning = Arrays.asList("my-lib", "my-webapp", "my-lib/src", "pom.xml"); testFactoryWithSpecificBranch.authenticateAndOpen(); theiaIde.switchToIdeFrame(); theiaIde.waitTheiaIde(); theiaIde.waitLoaderInvisibility(); <START> theiaIde.waitNotificationDisappearance("Che Workspace: Finished cloning projects."); <END> theiaIde.waitNotificationDisappearance( "Che Workspace: Finished cloning projects.", UPDATING_PROJECT_TIMEOUT_SEC); theiaProjectTree.waitFilesTab(); theiaProjectTree.clickOnFilesTab(); theiaProjectTree.waitItem(repositoryName); theiaProjectTree.expandItem(repositoryName); theiaProjectTree.expandItem(repositoryName + "/my-lib"); theiaProjectTree.waitItem(repositoryName + "/my-lib/src"); expectedItemsAfterCloning.forEach( name -> { theiaProjectTree.waitItem(repositoryName + "/" + name); }); assertEquals(theiaIde.getBranchName(), SECOND_BRANCH_NAME); }</code><technical_language>duplicates next waitNotificationDisappearance()</technical_language>

Target:
public void factoryWithDirectUrlWithSpecificBranch() { String repositoryName = testAuxiliaryRepo.getName(); final String wsTheiaIdeTerminalTitle = "theia-ide terminal 0"; List<String> expectedItemsAfterCloning = Arrays.asList("my-lib", "my-webapp", "my-lib/src", "pom.xml"); testFactoryWithSpecificBranch.authenticateAndOpen(); theiaIde.switchToIdeFrame(); theiaIde.waitTheiaIde(); theiaIde.waitLoaderInvisibility(); theiaIde.waitNotificationDisappearance( "Che Workspace: Finished cloning projects.", UPDATING_PROJECT_TIMEOUT_SEC); theiaProjectTree.waitFilesTab(); theiaProjectTree.clickOnFilesTab(); theiaProjectTree.waitItem(repositoryName); theiaProjectTree.expandItem(repositoryName); theiaProjectTree.expandItem(repositoryName + "/my-lib"); theiaProjectTree.waitItem(repositoryName + "/my-lib/src"); expectedItemsAfterCloning.forEach( name -> { theiaProjectTree.waitItem(repositoryName + "/" + name); }); assertEquals(theiaIde.getBranchName(), SECOND_BRANCH_NAME); }
Source:
<code>String getSQLCommand() { if (command == null) { try (Connection connection = dataSource.getConnection()) { final DatabaseMetaData metaData = connection.getMetaData(); TableLocation functionLocation = TableLocation.parse(functionName); ResultSet functionData = metaData.getProcedureColumns( functionLocation.getCatalog(), <START> functionLocation.getSchema(), <END> functionLocation.getTable(), null); try { StringBuilder sb = new StringBuilder(); Map<Integer, Signature> signatureMap; if (JDBCUtilities.isH2DataBase(metaData)) { signatureMap = getH2SignatureMap(functionData); } else { signatureMap = getPostGRESignatureMap(functionData); } buildString(sb, signatureMap); command = sb.toString(); } finally { functionData.close(); } } catch (SQLException ex) { LOGGER.warn("Could not read function command"); } } return command; }</code><technical_language>getProcedureColumns expect null if catalog schema metaData.getProcedureColumns(functionLocation.getCatalog(null), functionLocation.getSchema(null),</technical_language>

Target:
String getSQLCommand() { if (command == null) { try (Connection connection = dataSource.getConnection()) { final DatabaseMetaData metaData = connection.getMetaData(); ResultSet functionData = getFunctionData(metaData); try { StringBuilder sb = new StringBuilder(); Map<Integer, Signature> signatureMap; if (JDBCUtilities.isH2DataBase(metaData)) { signatureMap = getH2SignatureMap(functionData); } else { signatureMap = getPostGRESignatureMap(functionData); } buildString(sb, signatureMap); command = sb.toString(); } finally { functionData.close(); } } catch (SQLException ex) { LOGGER.warn("Could not read function command"); } } return command; }
Source:
<code>public ValueMatcher makeValueMatcher(String dimension, final DruidPredicateFactory predicateFactory) { <START> if (dimension.equals(Column.TIME_COLUMN_NAME) || availableMetrics.contains(dimension)) { <END> if (getTypeForDimension(dimension) == ValueType.LONG) { return makeLongValueMatcher(dimension, predicateFactory.makeLongPredicate()); } } final DimensionQueryHelper queryHelper = DimensionHandlerUtils.makeBaseQueryHelper( dimension, cursor.getColumnCapabilities(dimension), Lists.<String>newArrayList(storageAdapter.getAvailableDimensions()) ); return queryHelper.getValueMatcher(cursor, predicateFactory); }</code><technical_language>Similar above, wondering prompted this change</technical_language>

Target:
public ValueMatcher makeValueMatcher(String dimension, final DruidPredicateFactory predicateFactory) { if (dimension.equals(Column.TIME_COLUMN_NAME) || availableMetrics.contains(dimension)) { if (getTypeForDimension(dimension) == ValueType.LONG) { return makeLongValueMatcher(dimension, predicateFactory.makeLongPredicate()); } } ColumnSelectorPlus<ValueMatcherColumnSelectorStrategy>[] selector = DimensionHandlerUtils.createColumnSelectorPluses( STRATEGY_FACTORY, ImmutableList.<DimensionSpec>of(DefaultDimensionSpec.of(dimension)), cursor ); final ValueMatcherColumnSelectorStrategy strategy = selector[0].getColumnSelectorStrategy(); return strategy.getValueMatcher(dimension, cursor, predicateFactory); }
Source:
<code>protected Object extractBlobContent(DocumentModel doc, TemplateInput param) throws ValueNotFound { Object propValue = getDocPropertyValue(doc, param.getSource()); <START> if (propValue != null && propValue instanceof Blob) { <END> Blob blobValue = (Blob) propValue; handleBlobField(param.getName(), blobValue); try { return blobValue.getString(); } catch (IOException e) { log.warn("Unable to handle binding for param " + param.getName(), e); return ""; } } return extractDefaultValue(doc, param); }</code><technical_language>propValue != null is redundant propValue instanceof Blob checks for it</technical_language>

Target:
protected Object extractBlobContent(DocumentModel doc, TemplateInput param) throws ValueNotFound { Object propValue = getDocPropertyValue(doc, param.getSource()); if (propValue instanceof Blob) { Blob blobValue = (Blob) propValue; handleBlobField(param.getName(), blobValue); try { return blobValue.getString(); } catch (IOException e) { log.warn("Unable to handle binding for param " + param.getName(), e); return ""; } } return extractDefaultValue(doc, param); }
Source:
<code>public void performAction(HttpMessage httpMessage) { File file = getOutputFile(); if (file == null) { return; } <START> byte[] bytes = new byte[0]; <END> byte[] bytesHeader = null; byte[] bytesBody = null; switch (messageComponent) { case REQUEST_HEADER: bytes = httpMessage.getRequestHeader().toString().getBytes(); break; case REQUEST_BODY: bytes = httpMessage.getRequestBody().getBytes(); break; case REQUEST: bytesHeader = httpMessage.getRequestHeader().toString().getBytes(); bytesBody = httpMessage.getRequestBody().getBytes(); bytes = new byte[bytesHeader.length + bytesBody.length]; System.arraycopy(bytesHeader, 0, bytes, 0, bytesHeader.length); System.arraycopy(bytesBody, 0, bytes, bytesHeader.length, bytesBody.length); break; case RESPONSE_HEADER: bytes = httpMessage.getResponseHeader().toString().getBytes(); break; case RESPONSE_BODY: bytes = httpMessage.getResponseBody().getBytes(); break; case RESPONSE: bytesHeader = httpMessage.getResponseHeader().toString().getBytes(); bytesBody = httpMessage.getResponseBody().getBytes(); bytes = new byte[bytesHeader.length + bytesBody.length]; System.arraycopy(bytesHeader, 0, bytes, 0, bytesHeader.length); System.arraycopy(bytesBody, 0, bytes, bytesHeader.length, bytesBody.length); break; } writeToFile(file, bytesHeader, bytesBody); }</code><technical_language>This removed (to write)</technical_language>

Target:
public void performAction(HttpMessage httpMessage) { File file = getOutputFile(); if (file == null) { return; } byte[] bytesHeader = null; byte[] bytesBody = null; switch (messageComponent) { case REQUEST_HEADER: bytesHeader = httpMessage.getRequestHeader().toString().getBytes(); break; case REQUEST_BODY: bytesBody = httpMessage.getRequestBody().getBytes(); break; case REQUEST: bytesHeader = httpMessage.getRequestHeader().toString().getBytes(); bytesBody = httpMessage.getRequestBody().getBytes(); break; case RESPONSE_HEADER: bytesHeader = httpMessage.getResponseHeader().toString().getBytes(); break; case RESPONSE_BODY: bytesBody = httpMessage.getResponseBody().getBytes(); break; case RESPONSE: bytesHeader = httpMessage.getResponseHeader().toString().getBytes(); bytesBody = httpMessage.getResponseBody().getBytes(); break; } writeToFile(file, bytesHeader, bytesBody); }
Source:
<code>private DataStore pickDataStoreFromVolumes(List<VolumeVO> volumes) { DataStore dataStore = null; for (Volume vol : volumes) { switch (vol.getState()) { case Migrating: case Expunging: case Expunged: case Destroy: case Destroying: case UploadOp: case Uploaded: case NotUploaded: case UploadInProgress: case UploadError: case UploadAbandoned: default: <START> break; <END> case Allocated: case Creating: case Ready: case Snapshotting: case RevertSnapshotting: case Resizing: case Copying: case Attaching: dataStore = _dataStoreMgr.getDataStore(vol.getPoolId(), DataStoreRole.Primary); if (dataStore != null) { return dataStore; } break; } } return dataStore; }</code><technical_language>cases removed</technical_language>

Target:
private DataStore pickDataStoreFromVolumes(List<VolumeVO> volumes) { DataStore dataStore = null; for (Volume vol : volumes) { if (doesVolumeStateCheckout(vol)) { dataStore = _dataStoreMgr.getDataStore(vol.getPoolId(), DataStoreRole.Primary); if (dataStore != null) { return dataStore; } } } return dataStore; }
Source:
<code>protected HttpRequestBase createHttpRequestBase() { String bugUrl = getUrlSuffix(); LoginToken token = ((BugzillaRestHttpClient) getClient()).getLoginToken(); HttpPost request = new HttpPost(baseUrl() + bugUrl); request.setHeader(CONTENT_TYPE, APPLICATION_JSON); request.setHeader(ACCEPT, APPLICATION_JSON); try { String gsonString = "{\"Bugzilla_token\":\"" + token.getToken() + "\"" + getGSonFieldsForNew(taskData) + "}"; StringEntity requestEntity = new StringEntity(gsonString); request.setEntity(requestEntity); } catch (UnsupportedEncodingException e) { <START> e.printStackTrace(); <END> } return request; }</code><technical_language>handle this</technical_language>

Target:
protected HttpRequestBase createHttpRequestBase() throws IOException { String bugUrl = getUrlSuffix(); LoginToken token = ((BugzillaRestHttpClient) getClient()).getLoginToken(); HttpPost request = new HttpPost(baseUrl() + bugUrl); request.setHeader(CONTENT_TYPE, APPLICATION_JSON); request.setHeader(ACCEPT, APPLICATION_JSON); try { Gson gson = new GsonBuilder().registerTypeAdapter(TaskData.class, new TaskAttributeTypeAdapter(token)) .create(); StringEntity requestEntity = new StringEntity(gson.toJson(taskData)); request.setEntity(requestEntity); } catch (UnsupportedEncodingException e) { throw new IOException("could not build REST String", e); } return request; }
Source:
<code>public ControlEditor (Composite parent) { this.parent = parent; controlListener = e -> layout (); for (int <START> element : <END> EVENTS) { parent.addListener (element, controlListener); } scrollbarListener = e -> scroll (e); ScrollBar hBar = parent.getHorizontalBar (); if (hBar != null) hBar.addListener (SWT.Selection, scrollbarListener); ScrollBar vBar = parent.getVerticalBar (); if (vBar != null) vBar.addListener (SWT.Selection, scrollbarListener); }</code><technical_language>rename event</technical_language>

Target:
public ControlEditor (Composite parent) { this.parent = parent; controlListener = e -> layout (); for (int event : EVENTS) { parent.addListener (event, controlListener); } scrollbarListener = e -> scroll (e); ScrollBar hBar = parent.getHorizontalBar (); if (hBar != null) hBar.addListener (SWT.Selection, scrollbarListener); ScrollBar vBar = parent.getVerticalBar (); if (vBar != null) vBar.addListener (SWT.Selection, scrollbarListener); }
Source:
<code>protected void amendDiskImage() { VdcReturnValueBase ret = <START> runInternalAction(VdcActionType.AmendImageGroupVolumes, amendImageGroupVolumesCommandParameters()); <END> if (!ret.getSucceeded()) { propagateInternalCommandFailure(ret); getReturnValue().setFault(ret.getFault()); } setSucceeded(ret.getSucceeded()); }</code><technical_language>WithTasksContext</technical_language>

Target:
protected void amendDiskImage() { VdcReturnValueBase ret = runInternalActionWithTasksContext(VdcActionType.AmendImageGroupVolumes, amendImageGroupVolumesCommandParameters()); if (!ret.getSucceeded()) { propagateInternalCommandFailure(ret); getReturnValue().setFault(ret.getFault()); } setSucceeded(ret.getSucceeded()); }
Source:
<code>private void removeNetworks() { final List<Network> networks = getNetworkDAO().getAllForDataCenter(getStoragePoolId()); for (Network network : networks) { if (network.isExternal()) { for (VmNic nic : getVmNicDao().getAllForNetwork(network.getId())) { <START> ExternalNetworkManager externalNetworkManager = new ExternalNetworkManager(nic, network); <END> externalNetworkManager.deallocateIfExternal(); } } } TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { for (final Network net : networks) { List<VnicProfile> profiles = getDbFacade().getVnicProfileDao().getAllForNetwork(net.getId()); for (VnicProfile vnicProfile : profiles) { getCompensationContext().snapshotEntity(vnicProfile); getDbFacade().getVnicProfileDao().remove(vnicProfile.getId()); } getCompensationContext().snapshotEntity(net); getNetworkDAO().remove(net.getId()); } getCompensationContext().stateChanged(); return null; } }); }</code><technical_language>inlined</technical_language>

Target:
private void removeNetworks() { final List<Network> networks = getNetworkDAO().getAllForDataCenter(getStoragePoolId()); for (Network network : networks) { if (network.isExternal()) { for (VmNic nic : getVmNicDao().getAllForNetwork(network.getId())) { new ExternalNetworkManager(nic, network).deallocateIfExternal(); } } } TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { for (final Network net : networks) { List<VnicProfile> profiles = getDbFacade().getVnicProfileDao().getAllForNetwork(net.getId()); for (VnicProfile vnicProfile : profiles) { getCompensationContext().snapshotEntity(vnicProfile); getDbFacade().getVnicProfileDao().remove(vnicProfile.getId()); } getCompensationContext().snapshotEntity(net); getNetworkDAO().remove(net.getId()); } getCompensationContext().stateChanged(); return null; } }); }
Source:
<code>public ExtensionEntity getExtensionByUrn(String urn, boolean caseInsensitive) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<ExtensionEntity> cq = cb.createQuery(ExtensionEntity.class); Root<ExtensionEntity> extension = cq.from(ExtensionEntity.class); Predicate predicate; if (caseInsensitive) { predicate = cb.equal(cb.lower(extension.get(ExtensionEntity_.urn)), urn.toLowerCase(Locale.ENGLISH)); } else { predicate = cb.equal(extension.get(ExtensionEntity_.urn), urn); } cq.select(extension).where(predicate); TypedQuery<ExtensionEntity> query = em.createQuery(cq); ExtensionEntity singleExtension; try { singleExtension = query.getSingleResult(); } catch (NoResultException e) { <START> String message = String.format("Extension with urn %s not found", urn); <END> LOGGER.warn(message); throw new NoSuchElementException(message); } return singleExtension; }</code><technical_language>please set single quotes %s</technical_language>

Target:
public ExtensionEntity getExtensionByUrn(String urn, boolean caseInsensitive) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<ExtensionEntity> cq = cb.createQuery(ExtensionEntity.class); Root<ExtensionEntity> extension = cq.from(ExtensionEntity.class); Predicate predicate; if (caseInsensitive) { predicate = cb.equal(cb.lower(extension.get(ExtensionEntity_.urn)), urn.toLowerCase(Locale.ENGLISH)); } else { predicate = cb.equal(extension.get(ExtensionEntity_.urn), urn); } cq.select(extension).where(predicate); TypedQuery<ExtensionEntity> query = em.createQuery(cq); ExtensionEntity singleExtension; try { singleExtension = query.getSingleResult(); } catch (NoResultException e) { String message = String.format("Extension with urn '%s' not found", urn); LOGGER.warn(message); throw new NoSuchElementException(message); } return singleExtension; }
Source:
<code>public void addNode(RepositoryTreeNode<?> treeNode, Object timeCarrier) { if (isFiltering()) { <START> if (maxCount > 0) { <END> int time = Integer.MIN_VALUE; if (timeCarrier instanceof RevCommit) { time = ((RevCommit) timeCarrier).getCommitTime(); } if (time >= thresholdTime) { TimedNode node = new TimedNode(treeNode, time); nodes.add(node); while (nodes.size() > maxCount) { nodes.poll(); } if (nodes.size() == maxCount) { thresholdTime = nodes.peek().time; } } } } else { allNodes.add(treeNode); } }</code><technical_language>change purpose? #0 returns nothing, #0100 return something</technical_language>

Target:
public void addNode(RepositoryTreeNode<?> treeNode, Object timeCarrier) { if (isFiltering()) { if (maxCount > 0) { int time = Integer.MIN_VALUE; if (timeCarrier instanceof RevCommit) { time = ((RevCommit) timeCarrier).getCommitTime(); } if (time >= thresholdTime) { TimedNode node = new TimedNode(treeNode, time); nodes.add(node); if (nodes.size() > maxCount) { nodes.poll(); thresholdTime = nodes.peek().time; } } } } else { allNodes.add(treeNode); } }
Source:
<code>private void calculateData() { initCalculations(); calculateBacklogCount(); calculateActionsCreated(); featureSums.clear(); ResultSet<ArtifactReadable> actions = sprint.getRelated(AtsRelationTypes.AgileSprintToItem_AtsItem); for (ArtifactReadable item : actions) { if (includeInCount(item)) { <START> ++numActionsCompleted; <END> int points = Integer.parseInt(item.getSoleAttributeValue(AtsAttributeTypes.Points)); if (item.getSoleAttributeValue(AtsAttributeTypes.UnplannedWork, false)) { walkupCompleted += points; } else { workCompleted += points; } updateFeatureGroupSum(item, featureSums, points); } } }</code><technical_language>1) This assumes actions a point attribute. getSoleAttributeValue(AtsAttributeTypes.Points, 0) instead. 2) need parseInt, convert for</technical_language>

Target:
private void calculateData() { initCalculations(); calculateBacklogCount(); calculateActionsCreated(); featureSums.clear(); ResultSet<ArtifactReadable> actions = sprint.getRelated(AtsRelationTypes.AgileSprintToItem_AtsItem); for (ArtifactReadable item : actions) { if (includeInCount(item)) { ++numActionsCompleted; double points = getPointsFromAction(item); if (item.getSoleAttributeValue(AtsAttributeTypes.UnplannedWork, false)) { walkupCompleted += points; } else { workCompleted += points; } updateFeatureGroupSum(item, featureSums, points); } } }
Source:
<code><START> public void reset(ByteBuffer input) { <END> this.input = input; isRead = false; }</code><technical_language>public ByteBuffer reset(ByteBuffer input)</technical_language>

Target:
public ByteBuffer reset(ByteBuffer input) { ByteBuffer old = this.input; this.input = input; isRead = false; return old; }
Source:
<code>public AmazonS3 awsS3Client(AWSCredentialsProvider awsCredentialsProvider, S3Properties s3Properties) { ClientConfiguration clientConfiguration = new ClientConfiguration(); if (s3Properties.getProxyProtocol() != null) { if (s3Properties.getProxyProtocol().equalsIgnoreCase("HTTPS")) { clientConfiguration.setProtocol(Protocol.HTTPS); } else { clientConfiguration.setProtocol(Protocol.HTTP); } Optional.ofNullable(s3Properties.getProxyHost()) .ifPresent(clientConfiguration::setProxyHost); Optional.ofNullable(s3Properties.getProxyPort()) .map(Integer::parseInt) .ifPresent(clientConfiguration::setProxyPort); } AmazonS3Client client = new AmazonS3Client(awsCredentialsProvider, clientConfiguration); <START> if (s3Properties.getEndpoint() != null && !s3Properties.getEndpoint().equals("")) { <END> client.setEndpoint(s3Properties.getEndpoint()); client.setS3ClientOptions(S3ClientOptions.builder().setPathStyleAccess(true).build()); } else { Optional.ofNullable(s3Properties.getRegion()) .map(Regions::fromName) .map(Region::getRegion) .ifPresent(client::setRegion); } return client; }</code><technical_language>I prefer StringUtils.isEmpty() for null & "" check in org.apache.commons.lang3</technical_language>

Target:
public AmazonS3 awsS3Client(AWSCredentialsProvider awsCredentialsProvider, S3Properties s3Properties) { ClientConfiguration clientConfiguration = new ClientConfiguration(); if (s3Properties.getProxyProtocol() != null) { if (s3Properties.getProxyProtocol().equalsIgnoreCase("HTTPS")) { clientConfiguration.setProtocol(Protocol.HTTPS); } else { clientConfiguration.setProtocol(Protocol.HTTP); } Optional.ofNullable(s3Properties.getProxyHost()) .ifPresent(clientConfiguration::setProxyHost); Optional.ofNullable(s3Properties.getProxyPort()) .map(Integer::parseInt) .ifPresent(clientConfiguration::setProxyPort); } AmazonS3Client client = new AmazonS3Client(awsCredentialsProvider, clientConfiguration); if (!StringUtils.isEmpty(s3Properties.getEndpoint())) { client.setEndpoint(s3Properties.getEndpoint()); client.setS3ClientOptions(S3ClientOptions.builder().setPathStyleAccess(true).build()); } else { Optional.ofNullable(s3Properties.getRegion()) .map(Regions::fromName) .map(Region::getRegion) .ifPresent(client::setRegion); } return client; }
Source:
<code>public List<ObjectIdentity> findChildren(ObjectIdentity parentIdentity) { <START> Object[] args = { "" + parentIdentity.getIdentifier(), parentIdentity.getType() }; <END> List<ObjectIdentity> objects = jdbcTemplate.query(findChildrenSql, args, new RowMapper<ObjectIdentity>() { public ObjectIdentity mapRow(ResultSet rs, int rowNum) throws SQLException { String javaType = rs.getString("class"); Serializable identifier = (Serializable) rs.getObject("obj_id"); identifier = aclClassIdUtils.identifierFrom(identifier, rs); return new ObjectIdentityImpl(javaType, identifier); } }); if (objects.size() == 0) { return null; } return objects; }</code><technical_language>calling toString() instead of string concatination? objects null? suggestion Object[] args = { parentIdentity.getIdentifier().toString(), parentIdentity.getType() };</technical_language>

Target:
public List<ObjectIdentity> findChildren(ObjectIdentity parentIdentity) { Object[] args = { parentIdentity.getIdentifier().toString(), parentIdentity.getType() }; List<ObjectIdentity> objects = jdbcOperations.query(findChildrenSql, args, new RowMapper<ObjectIdentity>() { public ObjectIdentity mapRow(ResultSet rs, int rowNum) throws SQLException { String javaType = rs.getString("class"); Serializable identifier = (Serializable) rs.getObject("obj_id"); identifier = aclClassIdUtils.identifierFrom(identifier, rs); return new ObjectIdentityImpl(javaType, identifier); } }); if (objects.size() == 0) { return null; } return objects; }
Source:
<code>private QueryResponse query(QueryRequest queryRequest) { AtomicLong hitCount = new AtomicLong(0); <START> <END> QueryFunction queryFunction = qr -> { SourceResponse sourceResponse = catalogFramework.query(qr); hitCount.compareAndSet(0, sourceResponse.getHits()); return sourceResponse; }; ResultIterable results = ResultIterable.resultIterable(queryFunction, queryRequest, maxSubscriptions); List<Result> resultList = results.stream().collect(Collectors.toList()); long totalHits = hitCount.get(); totalHits = totalHits != 0 ? totalHits : resultList.size(); return new QueryResponseImpl(queryRequest, resultList, totalHits); }</code><technical_language>atomic long in this method</technical_language>

Target:
private QueryResponse query(QueryRequest queryRequest) { AtomicLong hitCount = new AtomicLong(0); QueryFunction queryFunction = qr -> { SourceResponse sourceResponse = catalogFramework.query(qr); hitCount.compareAndSet(0, sourceResponse.getHits()); return sourceResponse; }; ResultIterable results = ResultIterable.resultIterable(queryFunction, queryRequest, maxSubscriptions); List<Result> resultList = results.stream().collect(Collectors.toList()); long totalHits = hitCount.get() != 0 ? hitCount.get() : resultList.size(); return new QueryResponseImpl(queryRequest, resultList, totalHits); }
Source:
<code>public final void cacheResources(final HttpRequestCache httpRequestCache, final MfClientHttpRequestFactory clientHttpRequestFactory, final MapfishMapContext transformer) { final MapfishMapContext layerTransformer = getLayerTransformer(transformer); final double dpi = transformer.getDPI(); final TilePreparationTask task = new TilePreparationTask( clientHttpRequestFactory, dpi, layerTransformer, this.tileCacheInformation, httpRequestCache); <START> this.tilePreparationInfo = this.forkJoinPool.invoke(task); <END> }</code><technical_language>sense forkJoinPool? tiles longer downloaded this point, add overhead run this in parallel</technical_language>

Target:
public final void cacheResources(final HttpRequestCache httpRequestCache, final MfClientHttpRequestFactory clientHttpRequestFactory, final MapfishMapContext transformer) { final MapfishMapContext layerTransformer = getLayerTransformer(transformer); final double dpi = transformer.getDPI(); final TilePreparationTask task = new TilePreparationTask( clientHttpRequestFactory, dpi, layerTransformer, this.tileCacheInformation, httpRequestCache); this.tilePreparationInfo = task.call(); }
Source:
<code><START> public void doSet(String attribute, Serializable value) { <END> unregisterResource(attribute); put(attribute, value); }</code><technical_language>I this method private</technical_language>

Target:
private void doSet(String attribute, Serializable value) { unregisterResource(attribute); put(attribute, value); }
Source:
<code>public final Set<String> excludeInternalImports(@NotNull final Set<String> imports) { final Set<String> internalImports = new HashSet<String>(); PackageIndex packageIndex = PackageIndex.getInstance(windowObjects.getProject()); for (String importName : imports) { int indexOfDot = importName.lastIndexOf(DOT); String packageName; if (indexOfDot != -1) { packageName = importName.substring(0, importName.lastIndexOf(DOT)); } else { packageName = ""; } List<VirtualFile> packageDirectories = Arrays.asList( <START> packageIndex.getDirectoriesByPackageName(packageName, false)); <END> if (packageDirectories.size() > 0) { VirtualFile packageDirectory = packageDirectories.get(0); if (!packageDirectory.isInLocalFileSystem()) { internalImports.add(importName); } } } return internalImports; }</code><technical_language>check for empty packageName. write tests for this</technical_language>

Target:
public final Set<String> excludeInternalImports(@NotNull final Set<String> imports) { final Set<String> internalImports = new HashSet<String>(); PackageIndex packageIndex = PackageIndex.getInstance(windowObjects.getProject()); for (String importName : imports) { int indexOfDot = importName.lastIndexOf(DOT); String packageName; if (indexOfDot != -1) { packageName = importName.substring(0, importName.lastIndexOf(DOT)); List<VirtualFile> packageDirectories = Arrays.asList( packageIndex.getDirectoriesByPackageName(packageName, false)); if (packageDirectories.size() > 0) { VirtualFile packageDirectory = packageDirectories.get(0); if (!packageDirectory.isInLocalFileSystem()) { internalImports.add(importName); } } } } return internalImports; }
Source:
<code>protected ModelAndView getRadiologyOrderFormWithExistingRadiologyOrderByOrderId( @RequestParam(value = "orderId", required = true) Order order) { ModelAndView modelAndView = new ModelAndView("module/radiology/radiologyOrderForm"); if (Context.isAuthenticated()) { RadiologyOrder radiologyOrder = radiologyService.getRadiologyOrderByOrderId(order.getOrderId()); modelAndView.addObject("order", order); modelAndView.addObject("isOrderActive", order.isActive()); modelAndView.addObject("radiologyOrder", radiologyOrder); modelAndView.addObject("discontinuationOrder", new Order()); Study study = radiologyOrder.getStudy(); DicomViewer dicomviewer = new DicomViewer(); <START> dicomviewer.setRadiologyProperties(radiologyProperties); <END> modelAndView.addObject("studyUID", study.isCompleted() ? study.getStudyInstanceUid() : null); modelAndView.addObject("dicomViewerUrl", dicomviewer.getDicomViewerUrl(study)); radiologyReportNeedsToBeCreated(modelAndView, order); } return modelAndView; }</code><technical_language>this block exchanged adding this java @Autowired private DicomViewer dicomViewer; top. call dicomviewer.getDicomViewerUrl(study)</technical_language>

Target:
protected ModelAndView getRadiologyOrderFormWithExistingRadiologyOrderByOrderId( @RequestParam(value = "orderId", required = true) Order order) { ModelAndView modelAndView = new ModelAndView(RADIOLOGY_ORDER_FORM_VIEW); if (Context.isAuthenticated()) { final RadiologyOrder radiologyOrder = radiologyService.getRadiologyOrderByOrderId(order.getOrderId()); modelAndView.addObject("order", order); modelAndView.addObject("isOrderActive", order.isActive()); modelAndView.addObject("radiologyOrder", radiologyOrder); modelAndView.addObject("discontinuationOrder", new Order()); Study study = radiologyOrder.getStudy(); modelAndView.addObject("studyUID", study.getStudyInstanceUid()); modelAndView.addObject("dicomViewerUrl", dicomViewer.getDicomViewerUrl(study)); radiologyReportNeedsToBeCreated(modelAndView, order); } return modelAndView; }
Source:
<code>private void invocation() throws IOException { final String name = expect(StreamTokenizer.TT_WORD).sval; final List<Object> args = new ArrayList<Object>(); expect('('); if (!accept(')')) { args.add(argument()); while (!accept(')')) { expect(','); args.add(argument()); } } <START> expect(';'); <END> visitor.visitInvocation(ctx, name, args.toArray()); }</code><technical_language>removal of ; is safe. This tests cleaner. replacement if (tokenizer.nextToken() != ';') { tokenizer.pushBack(); } tests StatementParserTest.should_fail_when_semicolon_is_missing pass</technical_language>

Target:
private void invocation() throws IOException { final String name = expect(StreamTokenizer.TT_WORD).sval; final List<Object> args = new ArrayList<Object>(); expect('('); if (!accept(')')) { args.add(argument()); while (!accept(')')) { expect(','); args.add(argument()); } } visitor.visitInvocation(ctx, name, args.toArray()); }
Source:
<code>public void interceptSentText(String text) { try { outgoingTextSplitter.write(text.getBytes(Charset.defaultCharset())); } catch (IOException e) { <START> LOGGER.log(Level.WARNING, "IOException encountered while parsing outgoing text" + text, e); <END> } }</code><technical_language>text: " + text</technical_language>

Target:
public void interceptSentText(String text) { try { outgoingTextSplitter.write(text.getBytes(Charset.defaultCharset())); } catch (IOException e) { LOGGER.log(Level.WARNING, "IOException encountered while parsing outgoing text: " + text, e); } }
Source:
<code>protected void startNewInstance(List<String> ids) { Map<String, Serializable> vars = null; if (variables != null) { if (variables instanceof DataModelProperties) { vars = ((DataModelProperties) variables).getMap(); vars.put(DocumentRoutingConstants._MAP_VAR_FORMAT_JSON, false); } else { <START> vars = new HashMap<>(); for (Entry<String, String> entry : variables.entrySet()) { vars.put(entry.getKey(), entry.getValue()); } <END> vars.put(DocumentRoutingConstants._MAP_VAR_FORMAT_JSON, true); } } String workflowId = documentRoutingService.createNewInstance(id, ids, vars, session, Boolean.TRUE.equals(start)); ctx.put("WorkflowId", workflowId); ctx.put("workflowInstanceId", workflowId); }</code><technical_language>improve code do vars = new HashMap<>(variables) here</technical_language>

Target:
protected void startNewInstance(List<String> ids) { Map<String, Serializable> vars = null; if (variables != null) { if (variables instanceof DataModelProperties) { vars = ((DataModelProperties) variables).getMap(); vars.put(DocumentRoutingConstants._MAP_VAR_FORMAT_JSON, false); } else { vars = new HashMap<>(variables); vars.put(DocumentRoutingConstants._MAP_VAR_FORMAT_JSON, true); } } String workflowId = documentRoutingService.createNewInstance(id, ids, vars, session, Boolean.TRUE.equals(start)); ctx.put("WorkflowId", workflowId); ctx.put("workflowInstanceId", workflowId); }
Source:
<code>public List<Matcher> replaceRecursive(final String baseFileNameGlob, final Pattern pattern, final int index, final String immediate) throws IOException { final ImmutableList.Builder<Matcher> matchers = ImmutableList.<Matcher>builder(); final PathMatcher pathMatcher = FileSystems.getDefault().getPathMatcher("glob:" + baseFileNameGlob); Files.walkFileTree(this.basePath, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path filePath, BasicFileAttributes attributes) throws IOException { if (pathMatcher.matches(filePath.getFileName())) { final String originalData = read(filePath); Matcher first = null; int position = 0; String modifiedData = originalData; while (position < modifiedData.length()) { <START> final String postModifiedData = modifiedData.substring(0,position); <END> final String preModifiedData = modifiedData.substring(position); final Matcher matcher = pattern.matcher(preModifiedData); if (!matcher.find()) { break; } if (first == null) { first = matcher; } final String replacingString = immediate; modifiedData = postModifiedData + preModifiedData.substring(0, matcher.start(index)) + replacingString + preModifiedData.substring(matcher.end(index)); position = postModifiedData.length() + matcher.start(index) + replacingString.length() + (matcher.end() - matcher.end(index)); } if (first != null) { modify(filePath, modifiedData); matchers.add(first); } } return FileVisitResult.CONTINUE; } }); return matchers.build(); }</code><technical_language>nitpick: a whilespace ,</technical_language>

Target:
public List<Matcher> replaceRecursive(final String baseFileNameGlob, final Pattern pattern, final int index, final String immediate) throws IOException { final ImmutableList.Builder<Matcher> matchers = ImmutableList.<Matcher>builder(); final PathMatcher pathMatcher = FileSystems.getDefault().getPathMatcher("glob:" + baseFileNameGlob); Files.walkFileTree(this.basePath, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path filePath, BasicFileAttributes attributes) throws IOException { if (pathMatcher.matches(filePath.getFileName())) { final String originalData = read(filePath); Matcher first = null; int position = 0; String modifiedData = originalData; while (position < modifiedData.length()) { final String formerModifiedData = modifiedData.substring(0, position); final String latterModifiedData = modifiedData.substring(position); final Matcher matcher = pattern.matcher(latterModifiedData); if (!matcher.find()) { break; } if (first == null) { first = matcher; } final String replacingString = immediate; modifiedData = formerModifiedData + latterModifiedData.substring(0, matcher.start(index)) + replacingString + latterModifiedData.substring(matcher.end(index)); position = formerModifiedData.length() + matcher.start(index) + replacingString.length() + (matcher.end() - matcher.end(index)); } if (first != null) { modify(filePath, modifiedData); matchers.add(first); } } return FileVisitResult.CONTINUE; } }); return matchers.build(); }
Source:
<code>public CompletableFuture<HermesResponse> send(URI uri, HermesMessage message) { final Mono<ClientResponse> clientResponse = webClient.post() .uri(uri) .syncBody(message.getBody()) .headers(httpHeaders -> httpHeaders.setAll(message.getHeaders())) .exchange(); <START> return clientResponse <END> .toFuture() .thenApply(response -> response.bodyToMono(String.class).toFuture()) .thenCompose(Function.identity()) .thenCombine( clientResponse.toFuture().thenApply(res -> new HttpData(res.rawStatusCode(), res.headers().asHttpHeaders())), (body, httpData) -> hermesResponse() .withBody(body) .withHttpStatus(httpData.getStatusCode()) .withHeaderSupplier(header -> convertToCaseInsensitiveMap(httpData.getHeaders()) .getOrDefault(header, null)) .build()); }</code><technical_language>This shorten to: java clientRespponse.flatMap(response -> response .bodyToMono(String.class) .map(body -> hermesResponse() .withBody(body) .withHttpStatus(response.rawStatusCode()) ...)) .toFuture();</technical_language>

Target:
public CompletableFuture<HermesResponse> send(URI uri, HermesMessage message) { return webClient.post() .uri(uri) .syncBody(message.getBody()) .headers(httpHeaders -> httpHeaders.setAll(message.getHeaders())) .exchange() .flatMap(response -> response .bodyToMono(String.class) .switchIfEmpty(NO_BODY) .map(body -> hermesResponse() .withBody(body) .withHttpStatus(response.rawStatusCode()) .withHeaderSupplier(header -> convertToCaseInsensitiveMap(response.headers().asHttpHeaders().toSingleValueMap()).get(header)) .build())) .toFuture(); }