auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public JSLibModel getWorkingCopy() { if(workingCopy == null) { synchronized (this) { <START> workingCopy = createCopy(getPreferenceModel()); <END> } } return workingCopy; }</code><technical_language>If want this method thread safe if(workingCopy == null) workingCopy = ... in synchronized block</technical_language>

Target:
public synchronized JSLibModel getWorkingCopy() { if(workingCopy == null) { workingCopy = createCopy(getPreferenceModel()); } return workingCopy; }
Source:
<code>private static LockAndTimestampServices getLockAndTimestampServices( MetricsManager metricsManager, Supplier<ServerListConfig> timelockServerListConfig, String userAgent) { LockService lockService = new ServiceCreator<>(metricsManager, LockService.class, userAgent) .applyDynamic(timelockServerListConfig); <START> TimelockServerInterface rawTimelockService = new ServiceCreator<>(metricsManager, <END> TimelockServerInterface.class, userAgent).applyDynamic(timelockServerListConfig); TimelockService timelockService = LeasingTimelockClient.create(rawTimelockService); TimestampManagementService timestampManagementService = new ServiceCreator<>(metricsManager, TimestampManagementService.class, userAgent) .applyDynamic(timelockServerListConfig); return ImmutableLockAndTimestampServices.builder() .lock(lockService) .timestamp(new TimelockTimestampServiceAdapter(timelockService)) .timestampManagement(timestampManagementService) .timelock(timelockService) .build(); }</code><technical_language>worth calling this TimelockRpcs TimelockRpcClient that? TimelockServerInterface a bit fixable..</technical_language>

Target:
private static LockAndTimestampServices getLockAndTimestampServices( MetricsManager metricsManager, Supplier<ServerListConfig> timelockServerListConfig, String userAgent) { LockService lockService = new ServiceCreator<>(metricsManager, LockService.class, userAgent) .applyDynamic(timelockServerListConfig); TimelockRpcClient timelockRpcClient = new ServiceCreator<>(metricsManager, TimelockRpcClient.class, userAgent).applyDynamic(timelockServerListConfig); TimelockService timelockService = LeasingTimelockClient.create(timelockRpcClient); TimestampManagementService timestampManagementService = new ServiceCreator<>(metricsManager, TimestampManagementService.class, userAgent) .applyDynamic(timelockServerListConfig); return ImmutableLockAndTimestampServices.builder() .lock(lockService) .timestamp(new TimelockTimestampServiceAdapter(timelockService)) .timestampManagement(timestampManagementService) .timelock(timelockService) .build(); }
Source:
<code>public JaxbList<String> getConnectionIDs() { JaxbList<String> connections = new JaxbList<>(); try { <START> connections.setList( service.getConnections().stream().map( x -> x.getName() ).collect( toList() ) ); <END> } catch ( ConnectionServiceException e ) { logger.error( "Error " + e.getMessage() ); throw new WebApplicationException( Response.Status.INTERNAL_SERVER_ERROR ); } return connections; }</code><technical_language>Separate names setting / returning connections JaxList type. Put stream operation line facilitate debug. suggestion List<String> connectionNames = service.getConnections().stream() .map( x -> x.getName() ) .collect( toList() ); connections.setList( connectionNames ); // JabList instantiation try catch previously</technical_language>

Target:
public JaxbList<String> getConnectionIDs() { List<String> connectionNames; try { connectionNames = service.getConnections().stream() .map( connection -> connection.getName() ) .collect( toList() ); } catch ( ConnectionServiceException e ) { logger.error( "Error " + e.getMessage() ); throw new WebApplicationException( Response.Status.INTERNAL_SERVER_ERROR ); } return new JaxbList<>( connectionNames ); }
Source:
<code>public void closesAllParts() throws Exception { final String body = "RqMtFakeTest.closesAllParts"; final RqMultipart request = new RqMtFake( new RqFake(), new RqWithHeaders( new RqFake("", "", body), new FormattedText( "Content-Length: %s", body.getBytes().length ).asString(), "Content-Disposition: form-data; name=\"name\"" ), new RqWithHeaders( new RqFake("", "", body), "Content-Length: 0", <START> "Content-Disposition: form-data; name=\"content\"; filename=\"a.bin\"" <END> ) ); final String exmessage = "An IOException was expected since the Stream is closed"; final String name = "name"; final String content = "content"; final RqMtBase multi = new RqMtBase(request); multi.part(name).iterator().next().body().read(); multi.part(content).iterator().next().body().read(); multi.body().close(); MatcherAssert.assertThat( multi.part(name).iterator().next(), Matchers.notNullValue() ); try { multi.part(name).iterator().next().body().read(); Assert.fail(exmessage); } catch (final IOException ex) { MatcherAssert.assertThat( ex, new IsInstanceOf(ClosedChannelException.class) ); } MatcherAssert.assertThat( multi.part(content).iterator().next(), Matchers.notNullValue() ); try { multi.part(content).iterator().next().body().read(); Assert.fail(exmessage); } catch (final IOException ex) { MatcherAssert.assertThat( ex, new IsInstanceOf(ClosedChannelException.class) ); } }</code><technical_language>@Serranya here. above</technical_language>

Target:
public void closesAllParts() throws Exception { final String body = "RqMtFakeTest.closesAllParts"; final RqMultipart request = new RqMtFake( new RqFake(), new RqWithHeaders( new RqFake("", "", body), new FormattedText( RqMtFakeTest.CONTENT_LENGTH, body.getBytes().length ).asString(), new FormattedText( RqMtFakeTest.CONTENT_DISP, "name=\"name\"" ).asString() ), new RqWithHeaders( new RqFake("", "", body), new FormattedText( RqMtFakeTest.CONTENT_LENGTH, 0 ).asString(), new FormattedText( RqMtFakeTest.CONTENT_DISP, "name=\"content\"; filename=\"a.bin\"" ).asString() ) ); final String exmessage = "An IOException was expected since the Stream is closed"; final String name = "name"; final String content = "content"; final RqMtBase multi = new RqMtBase(request); multi.part(name).iterator().next().body().read(); multi.part(content).iterator().next().body().read(); multi.body().close(); MatcherAssert.assertThat( multi.part(name).iterator().next(), Matchers.notNullValue() ); try { multi.part(name).iterator().next().body().read(); Assert.fail(exmessage); } catch (final IOException ex) { MatcherAssert.assertThat( ex, new IsInstanceOf(ClosedChannelException.class) ); } MatcherAssert.assertThat( multi.part(content).iterator().next(), Matchers.notNullValue() ); try { multi.part(content).iterator().next().body().read(); Assert.fail(exmessage); } catch (final IOException ex) { MatcherAssert.assertThat( ex, new IsInstanceOf(ClosedChannelException.class) ); } }
Source:
<code>private static int runCheckstyle(CliOptions cliOptions) throws CheckstyleException, FileNotFoundException { final Properties props; if (cliOptions.propertiesLocation == null) { props = System.getProperties(); } else { props = loadProperties(new File(cliOptions.propertiesLocation)); } final Configuration config = ConfigurationLoader.loadConfiguration( cliOptions.configLocation, new PropertiesExpander(props), <START> cliOptions.omitIgnoredModules); <END> final AuditListener listener = createListener(cliOptions.format, cliOptions.outputLocation); final int errorCounter; final ClassLoader moduleClassLoader = Checker.class.getClassLoader(); final RootModule rootModule = getRootModule(config.getName(), moduleClassLoader); try { rootModule.setModuleClassLoader(moduleClassLoader); rootModule.configure(config); rootModule.addListener(listener); errorCounter = rootModule.process(cliOptions.files); } finally { rootModule.destroy(); } return errorCounter; }</code><technical_language>executeIgnoredModules</technical_language>

Target:
private static int runCheckstyle(CliOptions cliOptions) throws CheckstyleException, FileNotFoundException { final Properties props; if (cliOptions.propertiesLocation == null) { props = System.getProperties(); } else { props = loadProperties(new File(cliOptions.propertiesLocation)); } final Configuration config = ConfigurationLoader.loadConfiguration( cliOptions.configLocation, new PropertiesExpander(props), !cliOptions.executeIgnoredModules); final AuditListener listener = createListener(cliOptions.format, cliOptions.outputLocation); final int errorCounter; final ClassLoader moduleClassLoader = Checker.class.getClassLoader(); final RootModule rootModule = getRootModule(config.getName(), moduleClassLoader); try { rootModule.setModuleClassLoader(moduleClassLoader); rootModule.configure(config); rootModule.addListener(listener); errorCounter = rootModule.process(cliOptions.files); } finally { rootModule.destroy(); } return errorCounter; }
Source:
<code>protected void markImagesIllegalIfNotInDb(VM vm) { List<DiskImage> imagesInDb = getDiskImageDao().getAllSnapshotsForVmSnapshot(getParameters().getSnapshotId()); Map<Guid, DiskImage> imagesInDbMap = ImagesHandler.getDiskImagesByIdMap(imagesInDb); for (DiskImage fromConfigImg : vm.getImages()) { if (!imagesInDbMap.containsKey(fromConfigImg.getId())) { <START> log.info(String.format("Image %1$s of Disk %2$s cannot be found in database. This image will be returned as ILLEGAL from the query", <END> fromConfigImg.getId(), fromConfigImg.getDisk().getId())); fromConfigImg.setimageStatus(ImageStatus.ILLEGAL); } } }</code><technical_language>I log.infoFormat is standard way. Also, I logging this info level is verbose, this sounds more a debug (and if wants monitor this query specifically log level)</technical_language>

Target:
protected void markImagesIllegalIfNotInDb(VM vm) { List<DiskImage> imagesInDb = getDiskImageDao().getAllSnapshotsForVmSnapshot(getParameters().getSnapshotId()); Map<Guid, DiskImage> imagesInDbMap = ImagesHandler.getDiskImagesByIdMap(imagesInDb); for (DiskImage fromConfigImg : vm.getImages()) { if (!imagesInDbMap.containsKey(fromConfigImg.getId())) { log.debugFormat("Image {0} of Disk {1} cannot be found in database. This image will be returned as ILLEGAL from the query", fromConfigImg.getId(), fromConfigImg.getDisk().getId()); fromConfigImg.setimageStatus(ImageStatus.ILLEGAL); } } }
Source:
<code>public MysqlTableReader(MysqlSource source, String username, String password, TableInfoProvider tableInfoProvider, int bufSize) throws SQLException { _bufSize = bufSize; _source = source; _username = username; _password = password; _columnInfo = tableInfoProvider.getColumnList(source.getDatabaseName(), source.getTableName()); _conn = MysqlQueryUtils.initMysqlConn(source.getHostName(), source.getPort(), username, password); _conn.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED); _stmt = _conn.createStatement(); String fullyQualifiedTableName = String.format("%s.%s", source.getDatabaseName(), source.getTableName()); _stmt.executeUpdate(new SqlStringBuilder().append("HANDLER ") .append(fullyQualifiedTableName) .append(" OPEN AS ") .appendIdent(source.getTableName(), "Iterator") .toString()); <START> _rs = _stmt.executeQuery(new SqlStringBuilder().append("HANDLER ") <END> .appendIdent(source.getTableName(), "Iterator") .append(" READ `PRIMARY` FIRST LIMIT ") .append(_bufSize) .toString()); _next = false; _closed = false; _needToClose = false; }</code><technical_language>Is need for a timeout query? is more server time _us_ out long queries</technical_language>

Target:
public MysqlTableReader(MysqlSource source, String username, String password, TableInfoProvider tableInfoProvider, int bufSize) throws SQLException { _bufSize = bufSize; _source = source; _username = username; _password = password; _columnInfo = tableInfoProvider.getColumnList(source.getDatabaseName(), source.getTableName()); _conn = MysqlQueryUtils.initMysqlConn(source.getHostName(), source.getPort(), username, password); _conn.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED); _stmt = _conn.createStatement(); String fullyQualifiedTableName = String.format("%s.%s", source.getDatabaseName(), source.getTableName()); _stmt.executeUpdate(new SqlStringBuilder().append("HANDLER ") .append(fullyQualifiedTableName) .append(" OPEN AS ") .appendIdent(source.getTableName(), "Iterator") .toString()); _rs = _stmt.executeQuery(new SqlStringBuilder().append("HANDLER ") .appendIdent(source.getTableName(), "Iterator") .append(" READ `PRIMARY` FIRST LIMIT ") .append(_bufSize) .toString()); _next = false; _closed = false; _isEof = false; }
Source:
<code>private Set<String> getSchemaSQLServerNames(DatabaseMetaData metaData) throws SQLException { Set<String> schemas = new HashSet<>(); ResultSet rs = metaData.getTables(_catalogName, null, null, JdbcUtils.getTableTypesAsStrings(_tableTypes)); while (rs.next()) { schemas.add(rs.getString("TABLE_SCHEM")); } if(rs != null){ <START> rs.close(); <END> } return schemas; }</code><technical_language>FileHelper.safeClose(rs);</technical_language>

Target:
private Set<String> getSchemaSQLServerNames(DatabaseMetaData metaData) throws SQLException { Set<String> schemas = new HashSet<>(); ResultSet rs = null; try { rs = metaData.getTables(_catalogName, null, null, JdbcUtils.getTableTypesAsStrings(_tableTypes)); while (rs.next()) { schemas.add(rs.getString("TABLE_SCHEM")); } }finally { FileHelper.safeClose(rs); } return schemas; }
Source:
<code>protected List<String> doTokenize(String line) { <START> Assert.state(null != delimiter && 0 != delimiter.length()); <END> List<String> tokens = new ArrayList<String>(); char[] chars = line.toCharArray(); boolean inQuoted = false; int lastCut = 0; int length = chars.length; int fieldCount = 0; int endIndexLastDelimiter = -1; for (int i = 0; i < length; i++) { char currentChar = chars[i]; boolean isEnd = (i == (length - 1)); boolean isDelimiter = isDelimiter(chars, i, delimiter, endIndexLastDelimiter); if ((isDelimiter && !inQuoted) || isEnd) { endIndexLastDelimiter = i; int endPosition = (isEnd ? (length - lastCut) : (i - lastCut)); if (isEnd && isDelimiter) { endPosition = endPosition - delimiter.length(); } else if (!isEnd){ endPosition = (endPosition - delimiter.length()) + 1; } if (includedFields == null || includedFields.contains(fieldCount)) { String value = maybeStripQuotes(new String(chars, lastCut, endPosition)); tokens.add(value); } fieldCount++; if (isEnd && (isDelimiter)) { if (includedFields == null || includedFields.contains(fieldCount)) { tokens.add(""); } fieldCount++; } lastCut = i + 1; } else if (isQuoteCharacter(currentChar)) { inQuoted = !inQuoted; } } return tokens; }</code><technical_language>want this for record. want issue this point. implementing InitializerBean providing check there</technical_language>

Target:
protected List<String> doTokenize(String line) { List<String> tokens = new ArrayList<String>(); char[] chars = line.toCharArray(); boolean inQuoted = false; int lastCut = 0; int length = chars.length; int fieldCount = 0; int endIndexLastDelimiter = -1; for (int i = 0; i < length; i++) { char currentChar = chars[i]; boolean isEnd = (i == (length - 1)); boolean isDelimiter = isDelimiter(chars, i, delimiter, endIndexLastDelimiter); if ((isDelimiter && !inQuoted) || isEnd) { endIndexLastDelimiter = i; int endPosition = (isEnd ? (length - lastCut) : (i - lastCut)); if (isEnd && isDelimiter) { endPosition = endPosition - delimiter.length(); } else if (!isEnd){ endPosition = (endPosition - delimiter.length()) + 1; } if (includedFields == null || includedFields.contains(fieldCount)) { String value = maybeStripQuotes(new String(chars, lastCut, endPosition)); tokens.add(value); } fieldCount++; if (isEnd && (isDelimiter)) { if (includedFields == null || includedFields.contains(fieldCount)) { tokens.add(""); } fieldCount++; } lastCut = i + 1; } else if (isQuoteCharacter(currentChar)) { inQuoted = !inQuoted; } } return tokens; }
Source:
<code>protected void updateProductContentMappings(ProductData pdata) { if (pdata == null) { throw new IllegalArgumentException("pdata is null"); } <START> if (pdata.getId() == null || pdata.getId().matches("\\A\\s*\\z")) { <END> throw new IllegalArgumentException("product lacks identifying information: " + pdata); } Set<String> cids = new HashSet<>(); if (pdata.getProductContent() != null) { for (ProductContentData pcdata : pdata.getProductContent()) { if (pcdata != null) { ContentData cdata = pcdata.getContent(); if (cdata != null && cdata.getId() != null) { cids.add(cdata.getId()); } } } } for (String cid : cids) { if (!this.contentMap.containsKey(cid)) { throw new IllegalStateException("unknown/unexpected content id: " + cid); } if (!this.contentProductMap.containsKey(cid)) { throw new IllegalStateException("content=>product map lacks table for content: " + cid); } } for (Map.Entry<String, Set<String>> entry : this.contentProductMap.entrySet()) { String cid = entry.getKey(); Set<String> pids = entry.getValue(); if (cids.contains(cid)) { pids.add(pdata.getId()); } else { pids.remove(pdata.getId()); } } }</code><technical_language>StringUtils.isBlank</technical_language>

Target:
protected void updateProductContentMappings(ProductData pdata) { if (pdata == null) { throw new IllegalArgumentException("pdata is null"); } if (StringUtils.isBlank(pdata.getId())) { throw new IllegalArgumentException("product lacks identifying information: " + pdata); } Set<String> cids = new HashSet<>(); if (pdata.getProductContent() != null) { for (ProductContentData pcdata : pdata.getProductContent()) { if (pcdata != null) { ContentData cdata = pcdata.getContent(); if (cdata != null && cdata.getId() != null) { cids.add(cdata.getId()); } } } } for (String cid : cids) { if (!this.contentMap.containsKey(cid)) { throw new IllegalStateException("unknown/unexpected content id: " + cid); } if (!this.contentProductMap.containsKey(cid)) { throw new IllegalStateException("content=>product map lacks table for content: " + cid); } } for (Map.Entry<String, Set<String>> entry : this.contentProductMap.entrySet()) { String cid = entry.getKey(); Set<String> pids = entry.getValue(); if (cids.contains(cid)) { pids.add(pdata.getId()); } else { pids.remove(pdata.getId()); } } }
Source:
<code>protected void close() { try { <START> m_sout.flush(); <END> m_sout.close(); } catch (IOException ex) { } }</code><technical_language>close implicit flush</technical_language>

Target:
protected void close() { try { m_sout.close(); } catch (IOException ex) { } }
Source:
<code><START> PaxosLeaderElectionService(PaxosProposer proposer, <END> PaxosLearner knowledge, Map<PingableLeader, HostAndPort> otherPotentialLeadersToHosts, List<PaxosAcceptor> acceptors, List<PaxosLearner> learners, Function<String, ExecutorService> executorServiceFactory, long updatePollingWaitInMs, long randomWaitBeforeProposingLeadership, long noQuorumMaxDelay, long leaderPingResponseWaitMs, PaxosLeaderElectionEventRecorder eventRecorder, Supplier<Boolean> onlyLogOnQuorumFailure) { this.proposer = proposer; this.knowledge = knowledge; this.otherPotentialLeadersToHosts = Collections.unmodifiableMap(otherPotentialLeadersToHosts); this.acceptors = ImmutableList.copyOf(acceptors); this.learners = ImmutableList.copyOf(learners); this.leaderPingExecutors = createLeaderPingExecutors(otherPotentialLeadersToHosts, executorServiceFactory); this.knowledgeUpdatingExecutors = createKnowledgeUpdateExecutors(learners, executorServiceFactory); this.updatePollingRateInMs = updatePollingWaitInMs; this.randomWaitBeforeProposingLeadership = randomWaitBeforeProposingLeadership; this.noQuorumMaxDelay = noQuorumMaxDelay; this.leaderPingResponseWaitMs = leaderPingResponseWaitMs; lock = new ReentrantLock(); this.eventRecorder = eventRecorder; this.latestRoundVerifier = new CoalescingPaxosLatestRoundVerifier( new PaxosLatestRoundVerifierImpl( acceptors, proposer.getQuorumSize(), createLatestRoundVerifierExecutors(acceptors, executorServiceFactory), onlyLogOnQuorumFailure)); }</code><technical_language>do this *second* constructor if a builder? :S</technical_language>

Target:
PaxosLeaderElectionService(PaxosProposer proposer, PaxosLearner knowledge, Map<PingableLeader, HostAndPort> otherPotentialLeadersToHosts, List<PaxosAcceptor> acceptors, List<PaxosLearner> learners, Function<String, ExecutorService> executorServiceFactory, long updatePollingWaitInMs, long randomWaitBeforeProposingLeadership, long noQuorumMaxDelay, long leaderPingResponseWaitMs, PaxosLeaderElectionEventRecorder eventRecorder, Supplier<Boolean> onlyLogOnQuorumFailure) { this.proposer = proposer; this.knowledge = knowledge; this.otherPotentialLeadersToHosts = Collections.unmodifiableMap(otherPotentialLeadersToHosts); this.acceptors = ImmutableList.copyOf(acceptors); this.learners = ImmutableList.copyOf(learners); this.leaderPingExecutors = createLeaderPingExecutors(otherPotentialLeadersToHosts, executorServiceFactory); this.knowledgeUpdatingExecutors = createKnowledgeUpdateExecutors(learners, executorServiceFactory); this.updatePollingRateInMs = updatePollingWaitInMs; this.randomWaitBeforeProposingLeadership = randomWaitBeforeProposingLeadership; this.noQuorumMaxDelay = noQuorumMaxDelay; this.leaderPingResponseWaitMs = leaderPingResponseWaitMs; this.eventRecorder = eventRecorder; this.latestRoundVerifier = new CoalescingPaxosLatestRoundVerifier( new PaxosLatestRoundVerifierImpl( acceptors, proposer.getQuorumSize(), createLatestRoundVerifierExecutors(acceptors, executorServiceFactory), onlyLogOnQuorumFailure)); }
Source:
<code>public SiteRequestCondition(SiteSet siteSet, SiteResolver siteResolver, Set<String> includedSites, Set<String> excludedSites){ Preconditions.checkNotNull(siteResolver); Preconditions.checkNotNull(siteSet); Preconditions.checkNotNull(includedSites); this.siteSet = siteSet; this.siteResolver = siteResolver; <START> this.includedSites = includedSites.isEmpty() ? siteSet.getSiteKeys() : ImmutableSet.copyOf(includedSites); <END> this.excludedSites = excludedSites == null ? ImmutableSet.<String>of() : ImmutableSet.copyOf(excludedSites); }</code><technical_language>counter-intuitive empty set "everything". I recommend making constructor private replacing factory methods: takes a set of included sites, signifies want include sites</technical_language>

Target:
private SiteRequestCondition(SiteSet siteSet, SiteResolver siteResolver, Set<String> includedSites, Set<String> excludedSites){ this.siteSet = Preconditions.checkNotNull(siteSet); this.siteResolver = Preconditions.checkNotNull(siteResolver); this.includedSites = ImmutableSet.copyOf(Preconditions.checkNotNull(includedSites)); this.excludedSites = ImmutableSet.copyOf(Preconditions.checkNotNull(excludedSites)); }
Source:
<code>public boolean onCreateOptionsMenu(Menu menu) { MenuItem buttonSettings = menu.add(R.string.title_settings); buttonSettings.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); buttonSettings.setOnMenuItemClickListener(new MenuItem. OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { Intent settingsIntent = new Intent(EntryLogsActivity.this, SettingsActivity.class); settingsIntent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, SettingsFragment.class.getName()); settingsIntent.putExtra(PreferenceActivity.EXTRA_NO_HEADERS, true); EntryLogsActivity.this.startActivity(settingsIntent); return false; } }); MenuItem buttonSignout = menu.add(R.string.title_signout); buttonSignout.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); buttonSignout.setOnMenuItemClickListener(new MenuItem. OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { <START> ApiInterface.getInstance().logOut(); <END> Intent logOut = new Intent(EntryLogsActivity.this, LoginActivity.class); logOut.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); startActivity(logOut); return false; } }); return true; }</code><technical_language>Remove trailing whitespace here</technical_language>

Target:
public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.items, menu); return super.onCreateOptionsMenu(menu); }
Source:
<code>private XmlEntry processEntry(@NonNull Element entryElement, @NonNull Element displayEl, @NonNull XmlEntry parentEntry, int quark, ITmfStateSystem ss) { ITmfXmlStateAttribute display = fFactory.createStateAttribute(displayEl, parentEntry); int displayQuark = display.getAttributeQuark(quark, null); if (displayQuark == IXmlStateSystemContainer.ERROR_QUARK) { return new XmlEntry(quark, parentEntry.getTrace(), String.format("Unknown display quark for %s", ss.getAttributeName(quark)), ss); } long entryStart = ss.getStartTime(); <START> long entryEnd = ss.getCurrentEndTime(); <END> try { ITmfStateInterval oneInterval = ss.querySingleState(entryStart, displayQuark); while (oneInterval.getStateValue().isNull()) { long ts = oneInterval.getEndTime() + 1; if (ts > ss.getCurrentEndTime()) { break; } oneInterval = ss.querySingleState(ts, displayQuark); } entryStart = oneInterval.getStartTime(); oneInterval = ss.querySingleState(entryEnd, displayQuark); while (oneInterval.getStateValue().isNull()) { long ts = oneInterval.getStartTime() - 1; if (ts < ss.getStartTime()) { break; } oneInterval = ss.querySingleState(ts, displayQuark); } entryEnd = oneInterval.getEndTime(); } catch (StateSystemDisposedException e) { } return new XmlEntry(quark, displayQuark, parentEntry.getTrace(), ss.getAttributeName(quark), entryStart, entryEnd, EntryDisplayType.DISPLAY, ss, entryElement); }</code><technical_language>a +1</technical_language>

Target:
private XmlEntry processEntry(@NonNull Element entryElement, @NonNull Element displayEl, @NonNull XmlEntry parentEntry, int quark, ITmfStateSystem ss) { ITmfXmlStateAttribute display = fFactory.createStateAttribute(displayEl, parentEntry); int displayQuark = display.getAttributeQuark(quark, null); if (displayQuark == IXmlStateSystemContainer.ERROR_QUARK) { return new XmlEntry(quark, parentEntry.getTrace(), String.format("Unknown display quark for %s", ss.getAttributeName(quark)), ss); } long entryStart = ss.getStartTime(); long entryEnd = ss.getCurrentEndTime() + 1; try { ITmfStateInterval oneInterval = ss.querySingleState(entryStart, displayQuark); while (oneInterval.getStateValue().isNull()) { long ts = oneInterval.getEndTime() + 1; if (ts > ss.getCurrentEndTime()) { break; } oneInterval = ss.querySingleState(ts, displayQuark); } entryStart = oneInterval.getStartTime(); oneInterval = ss.querySingleState(entryEnd - 1, displayQuark); while (oneInterval.getStateValue().isNull()) { long ts = oneInterval.getStartTime() - 1; if (ts < ss.getStartTime()) { break; } oneInterval = ss.querySingleState(ts, displayQuark); } entryEnd = oneInterval.getEndTime() + 1; } catch (StateSystemDisposedException e) { } return new XmlEntry(quark, displayQuark, parentEntry.getTrace(), ss.getAttributeName(quark), entryStart, entryEnd, EntryDisplayType.DISPLAY, ss, entryElement); }
Source:
<code>public static IconvResult encode(long pointer, CharBuffer in, ByteBuffer out) { boolean isInDirect = in.isDirect(); boolean isOutDirect = out.isDirect(); int res = 0; IconvResult result = new IconvResult(); CharBuffer bufferInData = copyCharBufferData(in); ByteBuffer bufferOutData = copyByteBufferData(out); if (isInDirect && isOutDirect) { res = encodeNativeBuffer(pointer, in, out, result, in.position(), in.limit(), out.position(), out.limit()); } else if(!isInDirect && !isOutDirect) { res = encodeNativeArray(pointer, bufferInData.array(), bufferOutData.array(), result, in.position(), in.limit(), out.position(), out.limit()); } else if(isInDirect && !isOutDirect) { res = encodeHybridBufferArray(pointer, in, bufferOutData.array(), result, in.position(), in.limit(), out.position(), out.limit()); } else { res = encodeHybridArrayBuffer(pointer, bufferInData.array(), out, result, in.position(), in.limit(), out.position(), out.limit()); } ConversionResult conversionState = ConversionResult.getResult(res); result.setResultCode(conversionState); in.position(in.position() + result.getBytesReadFromSource()/2); out.position(out.position() + result.getBytesWrittenToDestination()); <START> out.limit(out.position()); <END> return result; }</code><technical_language>limit changed</technical_language>

Target:
public static IconvResult encode(long pointer, CharBuffer in, ByteBuffer out) { boolean isInDirect = in.isDirect(); boolean isOutDirect = out.isDirect(); int res = 0; IconvResult result = new IconvResult(); CharBuffer bufferInData = copyCharBufferData(in); ByteBuffer bufferOutData = copyByteBufferData(out); if (isInDirect && isOutDirect) { res = encodeNativeBuffer(pointer, in, out, result, in.position(), in.limit(), out.position(), out.limit()); } else if(!isInDirect && !isOutDirect) { res = encodeNativeArray(pointer, bufferInData.array(), bufferOutData.array(), result, bufferInData.position(), bufferInData.limit(), bufferOutData.position(), bufferOutData.limit()); } else if(isInDirect && !isOutDirect) { res = encodeHybridBufferArray(pointer, in, bufferOutData.array(), result, in.position(), in.limit(), bufferOutData.position(), bufferOutData.limit()); } else { res = encodeHybridArrayBuffer(pointer, bufferInData.array(), out, result, bufferInData.position(), bufferInData.limit(), out.position(), out.limit()); } ConversionResult conversionState = ConversionResult.getResult(res); result.setResultCode(conversionState); in.position(in.position() + result.getBytesReadFromSource()/2); if (out != bufferOutData) { bufferOutData.limit(result.getBytesWrittenToDestination()); out.put(bufferOutData); } else { out.position(out.position() + result.getBytesWrittenToDestination()); } return result; }
Source:
<code>public View getView(int position, View convertView, ViewGroup parent) { View vwRet = convertView; if (null == vwRet) { LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); <START> vwRet = inflater.inflate(R.layout.list_language_row, null); <END> } View delBtn = vwRet.findViewById(R.id.button_delete); View dldBtn = vwRet.findViewById(R.id.button_download); View optBtn = vwRet.findViewById(R.id.button_options); delBtn.setOnClickListener(this); dldBtn.setOnClickListener(this); optBtn.setOnClickListener(this); delBtn.setVisibility(View.GONE); dldBtn.setVisibility(View.GONE); optBtn.setVisibility(View.GONE); delBtn.setTag(SUPPORTED_LANGUAGES[position]); dldBtn.setTag(SUPPORTED_LANGUAGES[position]); optBtn.setTag(SUPPORTED_LANGUAGES[position]); if (null != this.customizer) { this.customizer.customizeUI(vwRet, SUPPORTED_LANGUAGES[position]); } return vwRet; }</code><technical_language>I a do this shorter: LayoutInflater.from(context).inflate(R.layout.list_language_row, null);</technical_language>

Target:
public View getView(int position, View convertView, ViewGroup parent) { View vwRet = convertView; if (null == vwRet) { vwRet = LayoutInflater.from(context).inflate(R.layout.list_language_row, null); } View delBtn = vwRet.findViewById(R.id.button_delete); View dldBtn = vwRet.findViewById(R.id.button_download); View optBtn = vwRet.findViewById(R.id.button_options); delBtn.setOnClickListener(this); dldBtn.setOnClickListener(this); optBtn.setOnClickListener(this); delBtn.setVisibility(View.GONE); dldBtn.setVisibility(View.GONE); optBtn.setVisibility(View.GONE); delBtn.setTag(SUPPORTED_LANGUAGES[position]); dldBtn.setTag(SUPPORTED_LANGUAGES[position]); optBtn.setTag(SUPPORTED_LANGUAGES[position]); if (null != this.customizer) { this.customizer.customizeUI(vwRet, SUPPORTED_LANGUAGES[position]); } return vwRet; }
Source:
<code>private UnhandledErrorListener getUnhandledErrorListener(){ return new UnhandledErrorListener() { @Override public void unhandledError(String message, Throwable e) { <START> LOG.error("unhandled exception ",e); <END> } }; }</code><technical_language>Include message</technical_language>

Target:
private UnhandledErrorListener getUnhandledErrorListener(){ return new UnhandledErrorListener() { @Override public void unhandledError(String message, Throwable e) { LOG.error("unhandled exception: "+ message,e); } }; }
Source:
<code>public JobConfig generateJobConfig(Layout base, Layout transformed) { PartitionInfo partitionInfo; try { partitionInfo = ProtoUtils.toHiveLayout(base.toProto()); <START> } catch (InvalidProtocolBufferException e) { <END> return new CompactConfig(null, base.getLocation().toString(), transformed.getLocation().toString(), mLayoutType, mNumFiles); } String serdeClass = partitionInfo.getStorage().getStorageFormat().getSerde(); String inputFormat = partitionInfo.getStorage().getStorageFormat().getInputFormat(); ArrayList<SchemaField> colList = new ArrayList<>(partitionInfo.getDataColsList().size()); for (FieldSchema col : partitionInfo.getDataColsList()) { colList.add(new SchemaField(col.getId(), col.getName(), col.getType(), col.getOptional(), col.getComment())); } alluxio.job.transform.PartitionInfo transformPartInfo = new alluxio.job.transform.PartitionInfo(serdeClass, inputFormat, partitionInfo.getStorage().getSerdeParametersMap(), colList); return new CompactConfig(transformPartInfo, base.getLocation().toString(), transformed.getLocation().toString(), mLayoutType, mNumFiles); }</code><technical_language>throw IllegalStateException</technical_language>

Target:
public JobConfig generateJobConfig(Layout base, Layout transformed) { PartitionInfo partitionInfo; try { partitionInfo = ProtoUtils.toHiveLayout(base.toProto()); } catch (InvalidProtocolBufferException e) { throw new IllegalStateException(e); } String serdeClass = partitionInfo.getStorage().getStorageFormat().getSerde(); String inputFormat = partitionInfo.getStorage().getStorageFormat().getInputFormat(); ArrayList<FieldSchema> colList = new ArrayList<>(partitionInfo.getDataColsList().size()); for (alluxio.grpc.table.FieldSchema col : partitionInfo.getDataColsList()) { colList.add(new FieldSchema(col.getId(), col.getName(), col.getType(), col.getComment())); } alluxio.job.transform.PartitionInfo transformPartInfo = new alluxio.job.transform.PartitionInfo(serdeClass, inputFormat, new HashMap<>(partitionInfo.getStorage().getStorageFormat().getSerdelibParametersMap()), colList); return new CompactConfig(transformPartInfo, base.getLocation().toString(), transformed.getLocation().toString(), mLayoutType, mNumFiles); }
Source:
<code>public DatastreamJettyStandaloneLauncher(int port, int parseqThreadPoolSize, ResourceFactory resourceFactory, String... packages) { _port = port; _packages = packages; final RestLiConfig config = new RestLiConfig(); config.setDocumentationRequestHandler(new DefaultDocumentationRequestHandler()); config.setServerNodeUri(URI.create("/")); config.addResourcePackageNames(_packages); final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(parseqThreadPoolSize); final Engine engine = new EngineBuilder() .setTaskExecutor(scheduler) .setTimerScheduler(scheduler) .build(); final RestLiServer restServer = new RestLiServer(config, resourceFactory, engine); final TransportDispatcher dispatcher = new DelegatingTransportDispatcher(restServer, restServer); <START> _httpJettyServer = (HttpJettyServer) new HttpServerFactory(FilterChains.empty()).createServer(0, dispatcher); <END> }</code><technical_language>I need some understand "_port" is set 0</technical_language>

Target:
public DatastreamJettyStandaloneLauncher(int port, int parseqThreadPoolSize, ResourceFactory resourceFactory, String... packages) { _port = port; _packages = packages; final RestLiConfig config = new RestLiConfig(); config.setDocumentationRequestHandler(new DefaultDocumentationRequestHandler()); config.setServerNodeUri(URI.create("/")); config.addResourcePackageNames(_packages); final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(parseqThreadPoolSize); final Engine engine = new EngineBuilder() .setTaskExecutor(scheduler) .setTimerScheduler(scheduler) .build(); final RestLiServer restServer = new RestLiServer(config, resourceFactory, engine); final TransportDispatcher dispatcher = new DelegatingTransportDispatcher(restServer, restServer); _httpJettyServer = (HttpJettyServer) new HttpServerFactory(FilterChains.empty()).createServer(port, dispatcher); }
Source:
<code>public String getRelativePath() { int lastDelimiter = path.lastIndexOf(File.separatorChar); String relativePath = lastDelimiter >= 0 ? path.substring(0, lastDelimiter) : ""; <START> return path.indexOf('*', lastDelimiter + 1) > -1 ? relativePath : path; <END> }</code><technical_language>I written this code in place, if touch fix please clean well? short notations awful read; please write out. I get if I read a couple of times obvious understandable in place. is relativePath created first? if needed if/else return statement is evaluated. bother computing time? Originally, in branch needed for</technical_language>

Target:
public String getRelativePath() { int lastDelimiter = path.lastIndexOf(File.separatorChar); if (path.indexOf('*', lastDelimiter + 1) > -1) { return lastDelimiter >= 0 ? path.substring(0, lastDelimiter) : ""; } return path; }
Source:
<code>public List<FeatureDto> getAllFeatures() { List<FeatureDto> features = new ArrayList<FeatureDto>(); try { for (Feature feature : featuresService.listFeatures()) { features.add(getFeatureView(feature)); } } catch (Exception ex) { <START> logger.warn("getAllFeatures Exception: " + ex.getMessage()); <END> } return features; }</code><technical_language>Throw entire stack trace in log message</technical_language>

Target:
public List<FeatureDetails> getAllFeatures() { List<FeatureDetails> features = new ArrayList<FeatureDetails>(); try { for (Feature feature : featuresService.listFeatures()) { features.add(getFeatureView(feature)); } } catch (Exception ex) { logger.warn("Could not obtain all features.", ex); } return features; }
Source:
<code>public void testCrossCacheTxInAnotherThread() throws Exception { executeTestForAllCaches(new CI2Exc<Ignite, IgniteCache<Integer, Integer>>() { @Override public void applyx(Ignite ignite, final IgniteCache<Integer, Integer> cache) throws Exception { if (transactionConcurrency() == TransactionConcurrency.OPTIMISTIC && cache.getConfiguration(CacheConfiguration.class).getCacheMode() == LOCAL) return; for (TransactionIsolation isolation : TransactionIsolation.values()) { final IgniteCache<Integer, Integer> otherCache = ignite.getOrCreateCache( cacheConfiguration("otherCache", PARTITIONED, 0, false)); final Transaction tx = ignite.transactions().txStart(transactionConcurrency(), isolation); final AtomicInteger cntr = new AtomicInteger(0); cache.put(-1, -1); otherCache.put(-1, -1); tx.suspend(); for (int i = 0; i < 10; i++) { <START> GridTestUtils.runAsync(new Runnable() { <END> @Override public void run() { tx.resume(); assertEquals(ACTIVE, tx.state()); cache.put(-1, -1); otherCache.put(-1, -1); cache.put(cntr.get(), cntr.get()); otherCache.put(cntr.get(), cntr.getAndIncrement()); tx.suspend(); } }).get(FUT_TIMEOUT); } tx.resume(); cache.remove(-1); otherCache.remove(-1); tx.commit(); assertEquals(COMMITTED, tx.state()); for (int i = 0; i < cntr.get(); i++) { assertEquals(i, (int)cache.get(i)); assertEquals(i, (int)otherCache.get(i)); } assertFalse(cache.containsKey(-1)); assertFalse(otherCache.containsKey(-1)); cache.removeAll(); otherCache.removeAll(); } } }); }</code><technical_language>replaced lambda</technical_language>

Target:
public void testCrossCacheTxInAnotherThread() throws Exception { executeTestForAllCaches(new CI2Exc<Ignite, IgniteCache<Integer, Integer>>() { @Override public void applyx(Ignite ignite, final IgniteCache<Integer, Integer> cache) throws Exception { if (transactionConcurrency() == TransactionConcurrency.OPTIMISTIC && cache.getConfiguration(CacheConfiguration.class).getCacheMode() == LOCAL) return; for (TransactionIsolation isolation : TransactionIsolation.values()) { final IgniteCache<Integer, Integer> otherCache = ignite.getOrCreateCache( cacheConfiguration("otherCache", PARTITIONED, 0, false)); final Transaction tx = ignite.transactions().txStart(transactionConcurrency(), isolation); final AtomicInteger cntr = new AtomicInteger(0); cache.put(-1, -1); otherCache.put(-1, -1); tx.suspend(); for (int i = 0; i < 10; i++) { GridTestUtils.runAsync(() -> { tx.resume(); assertEquals(ACTIVE, tx.state()); cache.put(-1, -1); otherCache.put(-1, -1); cache.put(cntr.get(), cntr.get()); otherCache.put(cntr.get(), cntr.getAndIncrement()); tx.suspend(); }).get(FUT_TIMEOUT); } tx.resume(); cache.remove(-1); otherCache.remove(-1); tx.commit(); assertEquals(COMMITTED, tx.state()); for (int i = 0; i < cntr.get(); i++) { assertEquals(i, (int)cache.get(i)); assertEquals(i, (int)otherCache.get(i)); } assertFalse(cache.containsKey(-1)); assertFalse(otherCache.containsKey(-1)); cache.removeAll(); otherCache.removeAll(); } } }); }
Source:
<code>private AddServiceRequest(OperationType operationType, ConfigRecommendationStrategy recommendationStrategy, ProvisionAction provisionAction, String stackName, String stackVersion, Set<Service> services, Set<Component> components, Configuration configuration) { <START> this.operationType = operationType; <END> this.recommendationStrategy = null != recommendationStrategy ? recommendationStrategy : ConfigRecommendationStrategy.NEVER_APPLY; this.provisionAction = null != provisionAction ? provisionAction : ProvisionAction.INSTALL_AND_START; this.stackName = stackName; this.stackVersion = stackVersion; this.services = null != services ? services : emptySet(); this.components = null != components ? components : emptySet(); this.configuration = null != configuration ? configuration : new Configuration(new HashMap<>(), new HashMap<>()); checkNotNull(operationType, "operationType is mandatory"); checkArgument(!this.services.isEmpty() || !this.components.isEmpty(), "Either services or components must be specified"); }</code><technical_language>Minor issue: add a similar check for null, default "ADD_SERVICE", if operation type is in request</technical_language>

Target:
private AddServiceRequest(OperationType operationType, ConfigRecommendationStrategy recommendationStrategy, ProvisionAction provisionAction, String stackName, String stackVersion, Set<Service> services, Set<Component> components, Configuration configuration) { this.operationType = null != operationType ? operationType : OperationType.ADD_SERVICE; this.recommendationStrategy = null != recommendationStrategy ? recommendationStrategy : ConfigRecommendationStrategy.NEVER_APPLY; this.provisionAction = null != provisionAction ? provisionAction : ProvisionAction.INSTALL_AND_START; this.stackName = stackName; this.stackVersion = stackVersion; this.services = null != services ? services : emptySet(); this.components = null != components ? components : emptySet(); this.configuration = null != configuration ? configuration : new Configuration(new HashMap<>(), new HashMap<>()); checkArgument(!this.services.isEmpty() || !this.components.isEmpty(), "Either services or components must be specified"); }
Source:
<code>private Node createFilterBox() { filterTextField = new FilterTextField("") .setOnConfirm((text) -> { Platform.runLater(() -> ui.triggerEvent(new PanelReloadingEvent())); applyStringFilter(text); <START> Platform.runLater(() -> ui.triggerEvent(new PanelReloadedEvent())); <END> return text; }) .setOnCancel(this::requestFocus); filterTextField.setId(guiController.getDefaultRepo() + "_col" + panelIndex + "_filterTextField"); filterTextField.setMinWidth(388); filterTextField.setMaxWidth(388); ui.registerEvent(onModelUpdate); filterTextField.setOnMouseClicked(e -> ui.triggerEvent(new PanelClickedEvent(panelIndex))); HBox layout = new HBox(); layout.getChildren().addAll(filterTextField); layout.setPadding(new Insets(0, 0, 3, 0)); setupPanelDragEvents(layout); return layout; }</code><technical_language>this in account if some of repos changed in filter? opening a repo asynchronously applyStringFilter(text) takes some time, loading indicator is useful for it</technical_language>

Target:
private Node createFilterBox() { filterTextField = new FilterTextField("") .setOnConfirm((text) -> { Platform.runLater(() -> ui.triggerEvent(new ApplyingFilterEvent(this))); applyStringFilter(text); return text; }) .setOnCancel(this::requestFocus); filterTextField.setId(guiController.getDefaultRepo() + "_col" + panelIndex + "_filterTextField"); filterTextField.setMinWidth(388); filterTextField.setMaxWidth(388); ui.registerEvent(onModelUpdate); filterTextField.setOnMouseClicked(e -> ui.triggerEvent(new PanelClickedEvent(panelIndex))); HBox layout = new HBox(); layout.getChildren().addAll(filterTextField); layout.setPadding(new Insets(0, 0, 3, 0)); setupPanelDragEvents(layout); return layout; }
Source:
<code>public void onError(Throwable t) { synchronized (this) { if (_sessionState != State.CLOSED || _closeStatus == null) throw new IllegalArgumentException(); if (!_closeStatus.isAbnormal()) _closeStatus = new CloseStatus(CloseStatus.SERVER_ERROR, t); if (_closeStatus.getCause() == null) <START> _closeStatus.initCause(t); <END> } }</code><technical_language>this seams wrong. If closed for some other reason, adding a put wrong a close reason</technical_language>

Target:
public void onError(Throwable t) { synchronized (this) { if (_sessionState != State.CLOSED || _closeStatus == null) throw new IllegalArgumentException(); if (!_closeStatus.isAbnormal()) _closeStatus = new CloseStatus(CloseStatus.SERVER_ERROR, t); if (_closeStatus.getCause() == null) _closeStatus = new CloseStatus(_closeStatus.getCode(), _closeStatus.getReason(), t); } }
Source:
<code>public void refreshView(State state) { super.refreshView(state); mState = state; <START> final Product product = mState.getProduct(); <END> }</code><technical_language>Unused variable</technical_language>

Target:
public void refreshView(State state) { super.refreshView(state); mState = state; }
Source:
<code>public static boolean parseBoolean(String str) { switch (str.toUpperCase(Locale.ENGLISH)) { case "TRUE": case "T": case "YES": case "Y": return true; case "FALSE": case "F": case "NO": case "N": return false; default: <START> throw new IllegalArgumentException("Unknown boolean value, must 'True' or 'False' but was '" + str + "'"); <END> } }</code><technical_language>error message match actual behaviour</technical_language>

Target:
public static boolean parseBoolean(String str) { switch (str.toUpperCase(Locale.ENGLISH)) { case "TRUE": case "T": case "YES": case "Y": return true; case "FALSE": case "F": case "NO": case "N": return false; default: throw new IllegalArgumentException( "Unknown BuySell value, must be 'True' or 'False' but was '" + str + "'; " + "parser is case insensitive and also accepts 'T', 'Yes', 'Y', 'F', 'No' and 'N'"); } }
Source:
<code>public void shouldUpdatePersonAddress() throws Exception { String personId = "CCC"; Person.Address preferredAddress = prepareAddress(); <START> URI url = config.toInstancePathWithParams("/person/{personUuid}/address/{addressUuid}?v=full", personId, <END> preferredAddress.getUuid()); personResource.updatePersonAddress(config, personId, preferredAddress); verify(restOperations).exchange(eq(url), eq(HttpMethod.POST), requestCaptor.capture(), eq(String.class)); assertThat(requestCaptor.getValue().getHeaders(), equalTo(getHeadersForPostWithoutResponse(config))); assertThat(JsonUtils.readJson(requestCaptor.getValue().getBody(), JsonObject.class), equalTo(readFromFile(UPDATE_PERSON_ADDRESS_JSON, JsonObject.class))); }</code><technical_language>remove this</technical_language>

Target:
public void shouldUpdatePersonAddress() throws Exception { String personId = "CCC"; Person.Address preferredAddress = prepareAddress(); URI url = config.toInstancePathWithParams("/person/{personUuid}/address/{addressUuid}", personId, preferredAddress.getUuid()); personResource.updatePersonAddress(config, personId, preferredAddress); verify(restOperations).exchange(eq(url), eq(HttpMethod.POST), requestCaptor.capture(), eq(String.class)); assertThat(requestCaptor.getValue().getHeaders(), equalTo(getHeadersForPostWithoutResponse(config))); assertThat(JsonUtils.readJson(requestCaptor.getValue().getBody(), JsonObject.class), equalTo(readFromFile(UPDATE_PERSON_ADDRESS_JSON, JsonObject.class))); }