auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Mono<Void> processChanges(ChangeFeedObserverContext context, List<CosmosItemProperties> docs) { <START> AutoCheckpointer self = this; <END> return self.observer.processChanges(context, docs) .then(self.afterProcessChanges(context)); }</code><technical_language>I guess reason for is compiler allow non-final variable .then() In case, explicitly final more clear reader of code</technical_language>

Target:
public Mono<Void> processChanges(ChangeFeedObserverContext context, List<CosmosItemProperties> docs) { return this.observer.processChanges(context, docs) .then(this.afterProcessChanges(context)); }
Source:
<code>public FiltersDataPanel(FilterSubTab parentPanel) { this.parentSubTab = parentPanel; getElement().setId("filters_container"); FlowPanel panel = new FlowPanel(); FlexTable filterGroupButtons = new FlexTable(); filterGroupButtons.setWidget(0, 0, new SaveFilterGroupButton(parentSubTab)); copyButton = new SaveAsFilterGroupButton(parentSubTab); filterGroupButtons.setWidget(0, 1, copyButton); removeButton = new RemoveFilterGroupButton(parentSubTab); filterGroupButtons.setWidget(0, 2, removeButton); panel.add(filterGroupButtons); HTML filterText = new HTML("<h2 id=\"filter_header\">Filters Applied</h2>"); filterText.getElement().setId("filter_desc_title"); VerticalPanel filterGlobal = new VerticalPanel(); FlexTable paginationTable = new FlexTable(); paginationTable.setHTML(0, 0, "<p id=\"filter_header\">Submissions per page</p>"); paginationTable.setWidget(0, 1, new PaginationNumTextBox(parentSubTab)); filterGlobal.add(paginationTable); filterGlobal.add(filterText); panel.add(filterGlobal); filterHeader = new FlowPanel(); panel.add(filterHeader); filtersTree = new Tree(); panel.add(filtersTree); String latestVersion = getLatestVersion(); <START> boolean needsUpdate = !BuildConfig.VERSION.startsWith(latestVersion); <END> HTML versionNote = new HTML("" + "<small>ODK Aggregate " + BuildConfig.VERSION + "<br/>" + (needsUpdate ? "Update available: <a href=\"<LINK_0>\" target=\"_blank\">" + latestVersion + "</a>" : "You're up to date" ) + "</small>"); Style style = versionNote.getElement().getStyle(); style.setProperty("position", "fixed"); style.setProperty("bottom", "10px"); style.setProperty("left", "10px"); panel.add(versionNote); addFilter = new AddFilterButton(parentPanel); add(panel); }</code><technical_language>Is this startsWith instead of equals running a local version a commit hash told upgrade</technical_language>

Target:
public FiltersDataPanel(FilterSubTab parentPanel) { this.parentSubTab = parentPanel; getElement().setId("filters_container"); FlowPanel panel = new FlowPanel(); FlexTable filterGroupButtons = new FlexTable(); filterGroupButtons.setWidget(0, 0, new SaveFilterGroupButton(parentSubTab)); copyButton = new SaveAsFilterGroupButton(parentSubTab); filterGroupButtons.setWidget(0, 1, copyButton); removeButton = new RemoveFilterGroupButton(parentSubTab); filterGroupButtons.setWidget(0, 2, removeButton); panel.add(filterGroupButtons); HTML filterText = new HTML("<h2 id=\"filter_header\">Filters Applied</h2>"); filterText.getElement().setId("filter_desc_title"); VerticalPanel filterGlobal = new VerticalPanel(); FlexTable paginationTable = new FlexTable(); paginationTable.setHTML(0, 0, "<p id=\"filter_header\">Submissions per page</p>"); paginationTable.setWidget(0, 1, new PaginationNumTextBox(parentSubTab)); filterGlobal.add(paginationTable); filterGlobal.add(filterText); panel.add(filterGlobal); filterHeader = new FlowPanel(); panel.add(filterHeader); filtersTree = new Tree(); panel.add(filtersTree); panel.add(buildVersionNote()); addFilter = new AddFilterButton(parentPanel); add(panel); }
Source:
<code>public void testDestroyCreatureLifeLoss(){ addCard(Zone.BATTLEFIELD, playerA, "Mountain"); addCard(Zone.BATTLEFIELD, playerA, "Swamp"); <START> addCard(Zone.BATTLEFIELD, playerA, "Swamp"); <END> addCard(Zone.HAND, playerA, "Unlicensed Disintegration"); addCard(Zone.BATTLEFIELD, playerB, "Volrath, the Shapestealer"); addCard(Zone.BATTLEFIELD, playerA, "Sol Ring"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Unlicensed Disintegration", "Volrath, the Shapestealer"); setStopAt(1, PhaseStep.BEGIN_COMBAT); setStrictChooseMode(true); execute(); assertAllCommandsUsed(); assertLife(playerA, 20); assertGraveyardCount(playerA, "Unlicensed Disintegration", 1); assertLife(playerB, 17); assertGraveyardCount(playerB, "Volrath, the Shapestealer", 1); }</code><technical_language>Add card's amount end, need duplicate for land: addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);</technical_language>

Target:
public void testDestroyCreatureLifeLoss(){ addCard(Zone.HAND, playerA, "Unlicensed Disintegration"); addCard(Zone.BATTLEFIELD, playerB, "Balduvian Bears"); addCard(Zone.BATTLEFIELD, playerA, "Mountain"); addCard(Zone.BATTLEFIELD, playerA, "Swamp",2); addCard(Zone.BATTLEFIELD, playerA, "Sol Ring"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Unlicensed Disintegration", "Balduvian Bears"); setStopAt(1, PhaseStep.BEGIN_COMBAT); setStrictChooseMode(true); execute(); assertAllCommandsUsed(); assertLife(playerA, 20); assertGraveyardCount(playerA, "Unlicensed Disintegration", 1); assertLife(playerB, 17); assertGraveyardCount(playerB, "Balduvian Bears", 1); }
Source:
<code>public Tuple next() throws IOException { if (currentPosInBatch == batchSize) { getNextBatch(); if (batchSize == -1) { return null; } } <START> Tuple tuple = new VTuple(targets.length); <END> for (int i=0; i<targetColInfo.length; i++) { tuple.put(i, createValueDatum(vectors[i], targetColInfo[i].type)); } currentPosInBatch++; return tuple; }</code><technical_language><LINK_0>, tuple singleton</technical_language>

Target:
public Tuple next() throws IOException { if (currentPosInBatch == batchSize) { getNextBatch(); if (batchSize == -1) { return null; } } for (int i=0; i<targetColInfo.length; i++) { outTuple.put(i, createValueDatum(vectors[i], targetColInfo[i].type)); } currentPosInBatch++; return outTuple; }
Source:
<code>public Page getOutput() { if (finished) { return null; } if (unfinishedWork != null) { if (unfinishedWork.process()) { unfinishedWork = null; } aggregationBuilder.updateMemory(); <START> return null; <END> } if (outputIterator == null) { outputIterator = null; if (finishing) { if (!inputProcessed && produceDefaultOutput) { finished = true; return getGlobalAggregationOutput(); } if (aggregationBuilder == null) { finished = true; return null; } } if (!finishing && (aggregationBuilder == null || !aggregationBuilder.isFull())) { return null; } outputIterator = aggregationBuilder.buildResult(); if (!outputIterator.hasNext()) { closeAggregationBuilder(); return null; } } Page output = outputIterator.next(); if (!outputIterator.hasNext()) { closeAggregationBuilder(); } return output; }</code><technical_language>I understand return null unconditionally is ok a functionality perspective. this raises confusion for readers of code. boolean workDone = unfinishedWork.process(); aggregationBuilder.updateMemory(); if (!workDone) { return null; } unfinishedWork = null;</technical_language>

Target:
public Page getOutput() { if (finished) { return null; } if (unfinishedWork != null) { boolean workDone = unfinishedWork.process(); aggregationBuilder.updateMemory(); if (!workDone) { return null; } unfinishedWork = null; } if (outputIterator == null) { outputIterator = null; if (finishing) { if (!inputProcessed && produceDefaultOutput) { finished = true; return getGlobalAggregationOutput(); } if (aggregationBuilder == null) { finished = true; return null; } } if (!finishing && (aggregationBuilder == null || !aggregationBuilder.isFull())) { return null; } outputIterator = aggregationBuilder.buildResult(); if (!outputIterator.hasNext()) { closeAggregationBuilder(); return null; } } Page output = outputIterator.next(); if (!outputIterator.hasNext()) { closeAggregationBuilder(); } return output; }
Source:
<code>public void modelChanged(String modelName, EventType type) { <START> if (type != EventType.MODIFIED || !modelName.endsWith("." + SITEMAP_SUFFIX)) { <END> return; } String changedSitemapName = modelName.substring(0, modelName.indexOf(".")); for (Entry<String, PageChangeListener> listenerEntry : pageChangeListeners.entrySet()) { String sitemapWithPage = listenerEntry.getKey(); String sitemapName = sitemapWithPage.substring(0, sitemapWithPage.indexOf(SITEMAP_PAGE_SEPARATOR)); String pageId = sitemapWithPage.substring(sitemapWithPage.indexOf(SITEMAP_PAGE_SEPARATOR) + 1, sitemapWithPage.length()); if (sitemapName.equals(changedSitemapName)) { EList<Widget> widgets = collectWidgets(sitemapName, pageId); listenerEntry.getValue().sitemapContentChanged(widgets); } } }</code><technical_language>remove "." include in constant</technical_language>

Target:
public void modelChanged(String modelName, EventType type) { if (type != EventType.MODIFIED || !modelName.endsWith(SITEMAP_SUFFIX)) { return; } String changedSitemapName = StringUtils.removeEnd(modelName, SITEMAP_SUFFIX); for (Entry<String, PageChangeListener> listenerEntry : pageChangeListeners.entrySet()) { String sitemapWithPage = listenerEntry.getKey(); String sitemapName = extractSitemapName(sitemapWithPage); String pageId = extractPageId(sitemapWithPage); if (sitemapName.equals(changedSitemapName)) { EList<Widget> widgets = collectWidgets(sitemapName, pageId); listenerEntry.getValue().sitemapContentChanged(widgets); } } }
Source:
<code>private static String getCounterLabel(int counterIndex) { switch (counterIndex) { case ON_POST_DIAL_WAIT: return "onPostDialWait"; case ON_CALL_EVENT: return "onCallEvent"; case ON_PULL_EXTERNAL_CALL: return "onPullExternalCall"; case ON_EXTRAS_CHANGED: return "onExtrasChanged"; <START> case ON_START_RTT: return "onStartRtt"; <END> default: return "Callback"; } }</code><technical_language>ON_RTT_REQUEST_RESPONSE ON_STOP_RTT</technical_language>

Target:
private static String getCounterLabel(int counterIndex) { switch (counterIndex) { case ON_POST_DIAL_WAIT: return "onPostDialWait"; case ON_CALL_EVENT: return "onCallEvent"; case ON_PULL_EXTERNAL_CALL: return "onPullExternalCall"; case ON_EXTRAS_CHANGED: return "onExtrasChanged"; case ON_START_RTT: return "onStartRtt"; case ON_RTT_REQUEST_RESPONSE: return "onRttRequestResponse"; case ON_STOP_RTT: return "onStopRtt"; default: return "Callback"; } }
Source:
<code>public void analyzeClass(final InputStream input, final String location) throws IOException { try { analyzeClass(new ClassReader(input)); <START> } catch (final Exception cause) { <END> throw analyzerError(location, cause); } }</code><technical_language>wondering why? this is related ASM 6</technical_language>

Target:
public void analyzeClass(final InputStream input, final String location) throws IOException { final byte[] buffer; try { buffer = InputStreams.readFully(input); } catch (final IOException e) { throw analyzerError(location, e); } analyzeClass(buffer, location); }
Source:
<code>public StringDataValue split_part( StringDataValue delimiter, NumberDataValue fieldNumber, StringDataValue result) throws StandardException { StringDataValue stringResult; if (result == null) { result = getNewVarchar(); } stringResult = (StringDataValue) result; if (this.isNull() || delimiter == null || delimiter.isNull() || delimiter.getString() == null || fieldNumber == null || fieldNumber.isNull()) { stringResult.setToNull(); return stringResult; } String valueParts[] = getString().split(Pattern.quote(delimiter.getString())); <START> int partIndex = fieldNumber.getInt(); <END> if (partIndex == 0) { throw StandardException.newException(SQLState.LANG_FIELD_POSITION_ZERO); } if (partIndex > valueParts.length) { stringResult.setToNull(); } else { stringResult.setValue(valueParts[partIndex - 1]); } return stringResult; }</code><technical_language>if partIndex is negative</technical_language>

Target:
public StringDataValue split_part( StringDataValue delimiter, NumberDataValue fieldNumber, StringDataValue result) throws StandardException { StringDataValue stringResult; if (result == null) { result = getNewVarchar(); } stringResult = (StringDataValue) result; if (this.isNull() || delimiter == null || delimiter.isNull() || delimiter.getString() == null || fieldNumber == null || fieldNumber.isNull()) { stringResult.setToNull(); return stringResult; } String valueParts[] = getString().split(Pattern.quote(delimiter.getString())); int partIndex = fieldNumber.getInt(); if (partIndex <= 0) { throw StandardException.newException(SQLState.LANG_FIELD_POSITION_ZERO); } if (partIndex > valueParts.length) { stringResult.setToNull(); } else { stringResult.setValue(valueParts[partIndex - 1]); } return stringResult; }
Source:
<code>private void setParent(MtpObject parent) { mParent = parent; if <START> (mId != <END> parent.getStorageId()) { mStorage = Preconditions.checkNotNull(parent.getStorage()); } }</code><technical_language>This object Id, StorageId if root directory. check for sub-directory case</technical_language>

Target:
private void setParent(MtpObject parent) { mParent = parent; if (this.getStorageId() != parent.getStorageId()) { mStorage = Preconditions.checkNotNull(parent.getStorage()); } }
Source:
<code>private void checkEquality(JsonApiDocument doc1) { JsonApiDocument doc2; try { String json = mapper.writeJsonApiDocument(doc1); doc2 = mapper.readJsonApiDocument(json); } catch (IOException e) { throw new UncheckedIOException(e); } <START> if (doc2.getData() == null) { <END> doc2.setData(doc1.getData()); } assertEquals(doc1.hashCode(), doc2.hashCode()); assertEquals(doc1, doc2); }</code><technical_language>do do this</technical_language>

Target:
private void checkEquality(JsonApiDocument doc1) { JsonApiDocument doc2; try { String json = mapper.writeJsonApiDocument(doc1); doc2 = mapper.readJsonApiDocument(json); } catch (IOException e) { throw new UncheckedIOException(e); } assertEquals(doc1, doc2); assertEquals(doc1.hashCode(), doc2.hashCode()); }
Source:
<code>private static Properties getDefaultProperties() { if (defaultProperties == null) { String[] keyArr = { "serverName", "portNumber", "databaseName", "url", "user", "password", "driverClassName", "className", "maxPoolSize", "allowLocalTransactions" }; String[] defaultPropArr = { "", "", "", "jdbc:h2:tcp://localhost/JPADroolsFlow", "sa", "", "org.h2.Driver", "org.h2.jdbcx.JdbcDataSource", "16", "true" }; <START> assert keyArr.length == defaultPropArr.length : "Unequal number of keys for default properties"; <END> defaultProperties = new Properties(); for (int i = 0; i < keyArr.length; ++i) { defaultProperties.put(keyArr[i], defaultPropArr[i]); } } return defaultProperties; }</code><technical_language>Is a reason for java asserts instead of Assert class</technical_language>

Target:
private static Properties getDefaultProperties() { if (defaultProperties == null) { String[] keyArr = { "serverName", "portNumber", "databaseName", "url", "user", "password", "driverClassName", "className", "maxPoolSize", "allowLocalTransactions" }; String[] defaultPropArr = { "", "", "", "jdbc:h2:tcp://localhost/JPADroolsFlow", "sa", "", "org.h2.Driver", "org.h2.jdbcx.JdbcDataSource", "16", "true" }; if (keyArr.length != defaultPropArr.length) { throw new IllegalStateException("Unequal number of keys for default properties!"); } defaultProperties = new Properties(); for (int i = 0; i < keyArr.length; ++i) { defaultProperties.put(keyArr[i], defaultPropArr[i]); } } return defaultProperties; }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_provider); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { getSupportActionBar().setElevation(0); getSupportActionBar().setDisplayHomeAsUpEnabled(true); } addProviderFragment = (AddProviderFragment) getSupportFragmentManager().findFragmentById(R.id.activity_add_provider_content_frame); if (addProviderFragment == null) { addProviderFragment = AddProviderFragment.newInstance(); } if (!addProviderFragment.isActive()) { addFragmentToActivity(getSupportFragmentManager(), addProviderFragment, R.id.activity_add_provider_content_frame); } if (savedInstanceState != null) { AddProviderPresenter mPresenter = new AddProviderPresenter(addProviderFragment); } else { <START> AddProviderPresenter mPresenter = new AddProviderPresenter(addProviderFragment); <END> } }</code><technical_language>is of mPresenter in this class</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_provider); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { getSupportActionBar().setElevation(0); getSupportActionBar().setDisplayHomeAsUpEnabled(true); } addProviderFragment = (AddProviderFragment) getSupportFragmentManager().findFragmentById(R.id.activity_add_provider_content_frame); if (addProviderFragment == null) { addProviderFragment = AddProviderFragment.newInstance(); } if (!addProviderFragment.isActive()) { addFragmentToActivity(getSupportFragmentManager(), addProviderFragment, R.id.activity_add_provider_content_frame); } AddProviderPresenter mPresenter = new AddProviderPresenter(addProviderFragment); }
Source:
<code>public Response getSitemapData(@Context HttpHeaders headers, @HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @ApiParam(value = "language") String language, @PathParam("sitemapname") @ApiParam(value = "sitemap name") String sitemapname, @QueryParam("type") String type, @QueryParam("jsoncallback") @DefaultValue("callback") String callback) { final Locale locale = localeService.getLocale(language); logger.debug("Received HTTP GET request from IP at '{}' for media type '{}'.", <START> new Object[] { request.getRemoteAddr(), uriInfo.getPath(), type }); <END> Object responseObject = getSitemapBean(sitemapname, uriInfo.getBaseUriBuilder().build(), locale); return Response.ok(responseObject).build(); }</code><technical_language>I added additional information log, is reason create object array? vararg logging method of slf4j's logger</technical_language>

Target:
public Response getSitemapData(@Context HttpHeaders headers, @HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @ApiParam(value = "language") String language, @PathParam("sitemapname") @ApiParam(value = "sitemap name") String sitemapname, @QueryParam("type") String type, @QueryParam("jsoncallback") @DefaultValue("callback") String callback) { final Locale locale = localeService.getLocale(language); logger.debug("Received HTTP GET request from IP at '{}' for media type '{}'.", request.getRemoteAddr(), uriInfo.getPath(), type); Object responseObject = getSitemapBean(sitemapname, uriInfo.getBaseUriBuilder().build(), locale); return Response.ok(responseObject).build(); }
Source:
<code>private void closeInterpreter(Interpreter interpreter) { Scheduler scheduler = interpreter.getScheduler(); <START> if (false == remoteIntpProcessIsShutdown()) { <END> for (final Job job : scheduler.getAllJobs()) { job.abort(); job.setStatus(Job.Status.ABORT); LOGGER.info("Job " + job.getJobName() + " aborted "); } try { LOGGER.info("Trying to close interpreter " + interpreter.getClassName()); interpreter.close(); } catch (InterpreterException e) { LOGGER.warn("Fail to close interpreter " + interpreter.getClassName(), e); } } SchedulerFactory.singleton().removeScheduler(scheduler.getName()); }</code><technical_language>this expected... if process is created running, shutdown else killed crashed something. in case, abort jobs anyway</technical_language>

Target:
private void closeInterpreter(Interpreter interpreter) { Scheduler scheduler = interpreter.getScheduler(); if (false == remoteIntpProcessIsInvalid()) { for (final Job job : scheduler.getAllJobs()) { job.abort(); job.setStatus(Job.Status.ABORT); LOGGER.info("Job " + job.getJobName() + " aborted "); } try { LOGGER.info("Trying to close interpreter " + interpreter.getClassName()); interpreter.close(); } catch (InterpreterException e) { LOGGER.warn("Fail to close interpreter " + interpreter.getClassName(), e); } } SchedulerFactory.singleton().removeScheduler(scheduler.getName()); }
Source:
<code>public void refresh(Command callback) { libraryPreferences.load(loadedLibraryPreferences -> { organizationalUnitAliasInSingular = loadedLibraryPreferences.getOrganizationalUnitPreferences().getAliasInSingular(); if (organizationalUnitAliasInSingular == null || organizationalUnitAliasInSingular.isEmpty()) { organizationalUnitAliasInSingular = ts.format(LibraryConstants.OrganizationalUnitDefaultAliasInSingular); } organizationalUnitAliasInPlural = loadedLibraryPreferences.getOrganizationalUnitPreferences().getAliasInPlural(); if (organizationalUnitAliasInPlural == null || organizationalUnitAliasInPlural.isEmpty()) { organizationalUnitAliasInPlural = ts.format(LibraryConstants.OrganizationalUnitDefaultAliasInPlural); } }, <START> error -> { <END> }); callback.execute(); }</code><technical_language>This repeats times. sense introduce load method error callback</technical_language>

Target:
public void refresh(Command callback) { libraryPreferences.load(loadedLibraryPreferences -> { organizationalUnitAliasInSingular = loadedLibraryPreferences.getOrganizationalUnitPreferences().getAliasInSingular(); if (organizationalUnitAliasInSingular == null || organizationalUnitAliasInSingular.isEmpty()) { organizationalUnitAliasInSingular = getOrganizationalUnitDefaultAliasInSingular(); } organizationalUnitAliasInPlural = loadedLibraryPreferences.getOrganizationalUnitPreferences().getAliasInPlural(); if (organizationalUnitAliasInPlural == null || organizationalUnitAliasInPlural.isEmpty()) { organizationalUnitAliasInPlural = getOrganizationalUnitDefaultAliasInPlural(); } }, error -> { organizationalUnitAliasInSingular = getOrganizationalUnitDefaultAliasInSingular(); organizationalUnitAliasInPlural = getOrganizationalUnitDefaultAliasInPlural(); }); callback.execute(); }
Source:
<code>Optional<List<String>> find(Map<String, String> parameters) { Supplier<List<String>> reportLocationsSupplier = () -> { try { return parameters.entrySet().stream() .filter(entry -> isParameterReportLocation(entry.getKey())) .map(Map.Entry::getValue) .collect(Collectors.toList()); } catch (Exception e) { logger.error("Report locations finder failed."); <START> e.printStackTrace(); <END> return null; } }; return find(reportLocationsSupplier); }</code><technical_language>Logging</technical_language>

Target:
Optional<List<String>> find(Map<String, String> parameters) { Supplier<List<String>> reportLocationsSupplier = () -> { try { return HdfsUtils.listDirs(Job.getInstance().getConfiguration(), parameters.get(REPORTS_DIR_PATH)); } catch (Exception e) { logger.error("Report locations finder failed.", e); return null; } }; return find(reportLocationsSupplier); }
Source:
<code>public int compareTo(final ITmfTimestamp ts) { if (ts == null) { return 1; } if (this == ts || (fValue == ts.getValue() && fScale == ts.getScale())) { return 0; } if ((fValue == BIG_BANG.getValue() && fScale == BIG_BANG.getScale()) || (ts.getValue() == BIG_CRUNCH.getValue() && ts.getScale() == BIG_CRUNCH.getScale())) { return -1; } if ((fValue == BIG_CRUNCH.getValue() && fScale == BIG_CRUNCH.getScale()) || (ts.getValue() == BIG_BANG.getValue() && ts.getScale() == BIG_BANG.getScale())) { return 1; } try { final ITmfTimestamp nts = ts.normalize(0, fScale); final long delta = fValue - nts.getValue(); if (delta > 0) { return 1; } else if (delta < 0) { return -1; <START> } else { <END> return 0; } } catch (final ArithmeticException e) { final long value = ts.getValue(); if (fValue == 0 && value == 0) { return 0; } if (fValue < 0 && value >= 0) { return -1; } if (fValue >= 0 && value < 0) { return 1; } final int scale = ts.getScale(); return (fScale > scale) ? (fValue >= 0) ? 1 : -1 : (fValue >= 0) ? -1 : 1; } }</code><technical_language>replace this if, else if, else Integer.compare(delta, 0)</technical_language>

Target:
public int compareTo(final ITmfTimestamp ts) { if (ts == null) { return 1; } if (this == ts || (fValue == ts.getValue() && fScale == ts.getScale())) { return 0; } if ((fValue == BIG_BANG.getValue() && fScale == BIG_BANG.getScale()) || (ts.getValue() == BIG_CRUNCH.getValue() && ts.getScale() == BIG_CRUNCH.getScale())) { return -1; } if ((fValue == BIG_CRUNCH.getValue() && fScale == BIG_CRUNCH.getScale()) || (ts.getValue() == BIG_BANG.getValue() && ts.getScale() == BIG_BANG.getScale())) { return 1; } try { final ITmfTimestamp nts = ts.normalize(0, fScale); final long delta = fValue - nts.getValue(); return Long.compare(delta, 0); } catch (final ArithmeticException e) { final long value = ts.getValue(); if (fValue == 0 && value == 0) { return 0; } if (fValue < 0 && value >= 0) { return -1; } if (fValue >= 0 && value < 0) { return 1; } final int scale = ts.getScale(); return (fScale > scale) ? (fValue >= 0) ? 1 : -1 : (fValue >= 0) ? -1 : 1; } }
Source:
<code>private ConsumerRebalanceListener getExceptionConsumerRebalanceListener() { return new ConsumerRebalanceListener() { @Override public void onPartitionsRevoked(Collection<TopicPartition> partitions) { <START> throw new RuntimeException("Hit partition revoke"); <END> } @Override public void onPartitionsAssigned(Collection<TopicPartition> partitions) { throw new RuntimeException("Hit partition assign"); } @Override public void onPartitionsLost(Collection<TopicPartition> partitions) { throw new RuntimeException("Hit partition lost"); } }; }</code><technical_language>add partitions parameter message verify expected partitions revoked</technical_language>

Target:
private ConsumerRebalanceListener getExceptionConsumerRebalanceListener() { return new ConsumerRebalanceListener() { @Override public void onPartitionsRevoked(Collection<TopicPartition> partitions) { throw new RuntimeException(partitionRevoked + partitions); } @Override public void onPartitionsAssigned(Collection<TopicPartition> partitions) { throw new RuntimeException(partitionAssigned + partitions); } @Override public void onPartitionsLost(Collection<TopicPartition> partitions) { throw new RuntimeException(partitionLost + partitions); } }; }
Source:
<code>public FileInfo toFileInfo() { FileInfo info = new FileInfo(); info.setExists(true); info.setLength(st_size); info.setLastModified((st_mtime * 1_000) <START> + (st_mtime_nsec / 1_000_000)); <END> if ((st_mode & UnixFileFlags.S_IFMT) == UnixFileFlags.S_IFDIR) info.setDirectory(true); if ((st_flags & (UnixFileFlags.UF_IMMUTABLE | UnixFileFlags.SF_IMMUTABLE)) != 0) info.setAttribute(EFS.ATTRIBUTE_IMMUTABLE, true); if ((st_mode & UnixFileFlags.S_IRUSR) == 0) info.setAttribute(EFS.ATTRIBUTE_OWNER_READ, false); if ((st_mode & UnixFileFlags.S_IWUSR) == 0) info.setAttribute(EFS.ATTRIBUTE_OWNER_WRITE, false); if ((st_mode & UnixFileFlags.S_IXUSR) != 0) info.setAttribute(EFS.ATTRIBUTE_OWNER_EXECUTE, true); if ((st_mode & UnixFileFlags.S_IRGRP) != 0) info.setAttribute(EFS.ATTRIBUTE_GROUP_READ, true); if ((st_mode & UnixFileFlags.S_IWGRP) != 0) info.setAttribute(EFS.ATTRIBUTE_GROUP_WRITE, true); if ((st_mode & UnixFileFlags.S_IXGRP) != 0) info.setAttribute(EFS.ATTRIBUTE_GROUP_EXECUTE, true); if ((st_mode & UnixFileFlags.S_IROTH) != 0) info.setAttribute(EFS.ATTRIBUTE_OTHER_READ, true); if ((st_mode & UnixFileFlags.S_IWOTH) != 0) info.setAttribute(EFS.ATTRIBUTE_OTHER_WRITE, true); if ((st_mode & UnixFileFlags.S_IXOTH) != 0) info.setAttribute(EFS.ATTRIBUTE_OTHER_EXECUTE, true); return info; }</code><technical_language>requested, want a system flag disabling new functionality allow "second" precision for backward" compatibility -Declipse.filesystem.useNativeSecondPrecision=true I "nano" enabled default system flag request one</technical_language>

Target:
public FileInfo toFileInfo() { FileInfo info = new FileInfo(); info.setExists(true); info.setLength(st_size); info.setLastModified((st_mtime * 1_000) + st_mtime_msec); if ((st_mode & UnixFileFlags.S_IFMT) == UnixFileFlags.S_IFDIR) info.setDirectory(true); if ((st_flags & (UnixFileFlags.UF_IMMUTABLE | UnixFileFlags.SF_IMMUTABLE)) != 0) info.setAttribute(EFS.ATTRIBUTE_IMMUTABLE, true); if ((st_mode & UnixFileFlags.S_IRUSR) == 0) info.setAttribute(EFS.ATTRIBUTE_OWNER_READ, false); if ((st_mode & UnixFileFlags.S_IWUSR) == 0) info.setAttribute(EFS.ATTRIBUTE_OWNER_WRITE, false); if ((st_mode & UnixFileFlags.S_IXUSR) != 0) info.setAttribute(EFS.ATTRIBUTE_OWNER_EXECUTE, true); if ((st_mode & UnixFileFlags.S_IRGRP) != 0) info.setAttribute(EFS.ATTRIBUTE_GROUP_READ, true); if ((st_mode & UnixFileFlags.S_IWGRP) != 0) info.setAttribute(EFS.ATTRIBUTE_GROUP_WRITE, true); if ((st_mode & UnixFileFlags.S_IXGRP) != 0) info.setAttribute(EFS.ATTRIBUTE_GROUP_EXECUTE, true); if ((st_mode & UnixFileFlags.S_IROTH) != 0) info.setAttribute(EFS.ATTRIBUTE_OTHER_READ, true); if ((st_mode & UnixFileFlags.S_IWOTH) != 0) info.setAttribute(EFS.ATTRIBUTE_OTHER_WRITE, true); if ((st_mode & UnixFileFlags.S_IXOTH) != 0) info.setAttribute(EFS.ATTRIBUTE_OTHER_EXECUTE, true); return info; }
Source:
<code>private static String executeScriptOnNode(MySqlNode node, String commands) { <START> return node.invoke(MySqlNode.EXECUTE_SCRIPT, ImmutableMap.of("commands", commands)).getUnchecked(); <END> }</code><technical_language>"commands" live in a public static String variable in MySQLNode effector parameter value</technical_language>

Target:
private static String executeScriptOnNode(MySqlNode node, String commands) { return node.invoke(MySqlNode.EXECUTE_SCRIPT, ImmutableMap.of(MySqlNode.EXECUTE_SCRIPT_COMMANDS, commands)).getUnchecked(); }
Source:
<code>public Fragment getFirstFragment() { Fragment fragment; if (searchQuery != null) { fragment = courseDiscussionPostsSearchFragment; } else { fragment = courseDiscussionPostsThreadFragment; } if (fragment.getArguments() == null) { Bundle args = new Bundle(); args.putSerializable(Router.EXTRA_ENROLLMENT_COURSE_DATA, courseData); <START> fragment.setArguments(args); <END> } fragment.setRetainInstance(true); return fragment; }</code><technical_language>This done generically in BaseSingleFragmentActivity I guess, instead of needing Fragments query Activity's launching Intent extras. This Fragments more modular, here</technical_language>

Target:
public Fragment getFirstFragment() { Fragment fragment; if (searchQuery != null) { fragment = courseDiscussionPostsSearchFragment; } else { fragment = courseDiscussionPostsThreadFragment; } if (fragment.getArguments() == null) { Bundle args = new Bundle(); args.putSerializable(Router.EXTRA_COURSE_DATA, courseData); args.putBoolean(CourseDiscussionPostsThreadFragment.ARG_DISCUSSION_HAS_TOPIC_NAME, discussionTopic != null); fragment.setArguments(args); } fragment.setRetainInstance(true); return fragment; }
Source:
<code>public void updateStats(TableRef table) throws SQLException { SQLException sqlE = null; HTableInterface hTable = services.getTable(table.getTableName()); try { byte[] minKey = null, maxKey = null; Scan scan = new Scan(HConstants.EMPTY_START_ROW, new KeyOnlyFilter()); ResultScanner scanner = hTable.getScanner(scan); try { Result r = scanner.next(); if (r != null) { minKey = r.getRow(); } } finally { scanner.close(); } int maxPossibleKeyLength = SchemaUtil.estimateKeyLength(table.getTable()); byte[] maxPossibleKey = new byte[maxPossibleKeyLength]; Arrays.fill(maxPossibleKey, (byte)255); @SuppressWarnings("deprecation") Result r = hTable.getRowOrBefore(maxPossibleKey, table.getTable().getColumnFamilies().iterator().next().getName().getBytes()); if (r != null) { maxKey = r.getRow(); } tableStatsMap.put(table, new PTableStats(timeKeeper.currentTimeMillis(),minKey,maxKey)); } catch (IOException e) { sqlE = SQLExceptionInfo.getNewInfoObject(SQLExceptionCodeEnum.IO_EXCEPTION).genWrappedException(e); } finally { try { hTable.close(); } catch (IOException e) { if (sqlE == null) { sqlE = SQLExceptionInfo.getNewInfoObject(SQLExceptionCodeEnum.IO_EXCEPTION).genWrappedException(e); } else { <START> sqlE.setNextException(SQLExceptionInfo.getNewInfoObject(SQLExceptionCodeEnum.IO_EXCEPTION).genWrappedException(e)); <END> } } finally { if (sqlE != null) { throw sqlE; } } } }</code><technical_language>This is example I wanted point to. Please other finally blocks throw exceptions work this one</technical_language>

Target:
public void updateStats(TableRef table) throws SQLException { SQLException sqlE = null; HTableInterface hTable = services.getTable(table.getTableName()); try { byte[] minKey = null, maxKey = null; Scan scan = new Scan(HConstants.EMPTY_START_ROW, new KeyOnlyFilter()); ResultScanner scanner = hTable.getScanner(scan); try { Result r = scanner.next(); if (r != null) { minKey = r.getRow(); } } finally { scanner.close(); } int maxPossibleKeyLength = SchemaUtil.estimateKeyLength(table.getTable()); byte[] maxPossibleKey = new byte[maxPossibleKeyLength]; Arrays.fill(maxPossibleKey, (byte)255); @SuppressWarnings("deprecation") Result r = hTable.getRowOrBefore(maxPossibleKey, table.getTable().getColumnFamilies().iterator().next().getName().getBytes()); if (r != null) { maxKey = r.getRow(); } tableStatsMap.put(table, new PTableStats(timeKeeper.currentTimeMillis(),minKey,maxKey)); } catch (IOException e) { sqlE = new PhoenixIOException(e); } finally { try { hTable.close(); } catch (IOException e) { if (sqlE == null) { sqlE = new PhoenixIOException(e); } else { sqlE.setNextException(new PhoenixIOException(e)); } } finally { if (sqlE != null) { throw sqlE; } } } }
Source:
<code>public boolean waitForYellowStatus(String[] indexNames, int timeoutSecond) { ClusterHealthStatus healthStatus; Response response; try { response = lowLevelClient.performRequest("GET", String.format("/_cluster/health/%s?wait_for_status=yellow&timeout=%ds", getIndexesAsString(indexNames), timeoutSecond)); try (InputStream is = response.getEntity().getContent()) { Map<String, Object> map = XContentHelper.convertToMap(XContentType.JSON.xContent(), is, true); healthStatus = ClusterHealthStatus.fromString((String) map.get("status")); } } catch (IOException e) { throw new RuntimeException(e); } switch (healthStatus) { case GREEN: log.info("ES Cluster ready: " + response); return true; case YELLOW: log.warn("Es Cluster ready but not GREEN: " + response); return false; default: String error = "ES Cluster health status: " + healthStatus + ", not Yellow after " + timeoutSecond + " give up: " + response; log.error(error); throw new IllegalStateException(error); <START> } <END> }</code><technical_language>log throw</technical_language>

Target:
public boolean waitForYellowStatus(String[] indexNames, int timeoutSecond) { ClusterHealthStatus healthStatus; Response response; try { response = lowLevelClient.performRequest("GET", String.format("/_cluster/health/%s?wait_for_status=yellow&timeout=%ds", getIndexesAsString(indexNames), timeoutSecond)); try (InputStream is = response.getEntity().getContent()) { Map<String, Object> map = XContentHelper.convertToMap(XContentType.JSON.xContent(), is, true); healthStatus = ClusterHealthStatus.fromString((String) map.get("status")); } } catch (IOException e) { throw new NuxeoException(e); } switch (healthStatus) { case GREEN: log.info("Elasticsearch Cluster ready: " + response); return true; case YELLOW: log.warn("Elasticsearch Cluster ready but not GREEN: " + response); return false; default: String error = "Elasticsearch Cluster health status: " + healthStatus + ", not Yellow after " + timeoutSecond + " give up: " + response; throw new IllegalStateException(error); } }
Source:
<code>public VdsStatic() { serverSslEnabled = false; vdsStrength = 100; vdsSpmPriority = HOST_DEFAULT_SPM_PRIORITY; sshPort = DEFAULT_SSH_PORT; sshUsername = DEFAULT_SSH_USERNAME; name = ""; comment = <START> comment == null ? "" : comment; <END> vdsType = VDSType.VDS; autoRecoverable = true; disablePowerManagementPolicy = false; pmKdumpDetection = true; hostProviderId = null; }</code><technical_language>Is this intended</technical_language>

Target:
public VdsStatic() { serverSslEnabled = false; vdsStrength = 100; vdsSpmPriority = HOST_DEFAULT_SPM_PRIORITY; sshPort = DEFAULT_SSH_PORT; sshUsername = DEFAULT_SSH_USERNAME; name = ""; comment = ""; vdsType = VDSType.VDS; autoRecoverable = true; disablePowerManagementPolicy = false; pmKdumpDetection = true; hostProviderId = null; }
Source:
<code>public void pushFileToReview(String testIdent, String refSpec, PrivilegeLevel privilegeLevel) throws Exception { changeId = "I" + StringUtils.rightPad(testIdent, 40, "a"); CommitCommand command = createCommitCommand(changeId); addFile("testFile1.txt"); <START> CommitResult result = gerritHarness.project().commitAndPush(command, refSpec, privilegeLevel); <END> shortId = StringUtils.trimToEmpty(StringUtils.substringAfterLast(result.push.getMessages(), "/")); shortId = StringUtils.removeEnd(shortId, " [DRAFT]"); commitId = result.commit.getId().toString(); assertThat("Bad Push: " + result.push.getMessages(), shortId.length(), greaterThan(0)); }</code><technical_language>Create a commitAndPush method in this class</technical_language>

Target:
public void pushFileToReview(String testIdent, String refSpec, PrivilegeLevel privilegeLevel) throws Exception { changeId = "I" + StringUtils.rightPad(testIdent, 40, "a"); CommitCommand command = createCommitCommand(changeId); addFile("testFile1.txt"); CommitResult result = commitAndPush(command, refSpec, privilegeLevel); shortId = StringUtils.trimToEmpty(StringUtils.substringAfterLast(result.push.getMessages(), "/")); shortId = StringUtils.removeEnd(shortId, " [DRAFT]"); commitId = result.commit.getId().toString(); assertThat("Bad Push: " + result.push.getMessages(), shortId.length(), greaterThan(0)); }
Source:
<code>private void fillReadAheadCache(long orginalLedgerId, long firstEntryId, long firstEntryLocation) { try { long firstEntryLogId = (firstEntryLocation >> 32); long currentEntryLogId = firstEntryLogId; long currentEntryLocation = firstEntryLocation; int count = 0; long size = 0; while (count < readAheadCacheBatchSize && currentEntryLogId == firstEntryLogId) { <START> ByteBuf entry = entryLogger.internalReadEntry(orginalLedgerId, firstEntryId, currentEntryLocation, <END> false ); try { long currentEntryLedgerId = entry.getLong(0); long currentEntryId = entry.getLong(8); if (currentEntryLedgerId != orginalLedgerId) { return; } readCache.put(orginalLedgerId, currentEntryId, entry); count++; firstEntryId++; size += entry.readableBytes(); currentEntryLocation += 4 + entry.readableBytes(); currentEntryLogId = currentEntryLocation >> 32; } finally { entry.release(); } } dbLedgerStorageStats.getReadAheadBatchCountStats().registerSuccessfulValue(count); dbLedgerStorageStats.getReadAheadBatchSizeStats().registerSuccessfulValue(size); } catch (Exception e) { if (log.isDebugEnabled()) { log.debug("Exception during read ahead for ledger: {}: e", orginalLedgerId, e); } } }</code><technical_language>This change is part of this task</technical_language>

Target:
private void fillReadAheadCache(long orginalLedgerId, long firstEntryId, long firstEntryLocation) { try { long firstEntryLogId = (firstEntryLocation >> 32); long currentEntryLogId = firstEntryLogId; long currentEntryLocation = firstEntryLocation; int count = 0; long size = 0; while (count < readAheadCacheBatchSize && currentEntryLogId == firstEntryLogId) { ByteBuf entry = entryLogger.internalReadEntry(orginalLedgerId, -1, currentEntryLocation, false ); try { long currentEntryLedgerId = entry.getLong(0); long currentEntryId = entry.getLong(8); if (currentEntryLedgerId != orginalLedgerId) { return; } readCache.put(orginalLedgerId, currentEntryId, entry); count++; size += entry.readableBytes(); currentEntryLocation += 4 + entry.readableBytes(); currentEntryLogId = currentEntryLocation >> 32; } finally { entry.release(); } } dbLedgerStorageStats.getReadAheadBatchCountStats().registerSuccessfulValue(count); dbLedgerStorageStats.getReadAheadBatchSizeStats().registerSuccessfulValue(size); } catch (Exception e) { if (log.isDebugEnabled()) { log.debug("Exception during read ahead for ledger: {}: e", orginalLedgerId, e); } } }
Source:
<code>private void init() { try { hostname = InetAddress.getLocalHost().getHostName(); <START> hostname = "localhost"; <END> } catch (UnknownHostException e) { logger.warn("Error getting the value of localhost. " + "Proceeding with 'localhost'.", e); } }</code><technical_language>Please remove this. This is due incorrect /etc/hosts file in test environment</technical_language>

Target:
private void init() { try { hostname = InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException e) { logger.warn("Error getting the value of localhost. " + "Proceeding with 'localhost'.", e); } }
Source:
<code>public Beacon(byte[] rlp) { RLPList items = RLP.unwrapList(rlp); this.parentHash = items.get(0).getRLPData(); this.randaoReveal = items.get(1).getRLPData(); this.mainChainRef = items.get(2).getRLPData(); this.stateHash = items.get(3).getRLPData(); this.slotNumber = ByteUtil.bytesToBigInteger(items.get(4).getRLPData()).longValue(); <START> RLPList attestationsRlp = RLP.unwrapList(items.get(5).getRLPData()); <END> this.attestations = new AttestationRecord[attestationsRlp.size()]; for (int i = 0; i < attestationsRlp.size(); ++i) { attestations[i] = new AttestationRecord(attestationsRlp.get(i).getRLPData()); } }</code><technical_language>if is attestation records in block? this list parsed</technical_language>

Target:
public Beacon(byte[] rlp) { RLPList items = RLP.unwrapList(rlp); this.parentHash = items.get(0).getRLPData(); this.randaoReveal = items.get(1).getRLPData(); this.mainChainRef = items.get(2).getRLPData(); this.stateHash = items.get(3).getRLPData(); this.slotNumber = ByteUtil.bytesToBigInteger(items.get(4).getRLPData()).longValue(); this.attestations = new ArrayList<>(); if (!isSingleZero(items.get(5).getRLPData())) { RLPList attestationsRlp = RLP.unwrapList(items.get(5).getRLPData()); for (RLPElement anAttestationsRlp : attestationsRlp) { attestations.add(new AttestationRecord(anAttestationsRlp.getRLPData())); } } }
Source:
<code>public ParameterizedSqlFactory(String initialSql) { sqlStringBuilder = new StringBuilder(initialSql); <START> parameters = new ArrayList(); <END> }</code><technical_language>Initialization of list generics. For this case, empty generic-type placeholder compiler able auto-detect type used</technical_language>

Target:
public ParameterizedSqlFactory(String initialSql) { sqlStringBuilder = new StringBuilder(initialSql); parameters = new ArrayList<>(); }
Source:
<code>protected void doStop() throws Exception { Logger.log(Logger.DEBUG, ACCESSLOG_RESOURCES, "SimpleAccessLogger.Close", this.fileName); if (this.outWriter != null) { this.outWriter.flush(); this.outWriter.close(); this.outWriter = null; } if (this.outStream != null) { try { this.outStream.close(); } catch (IOException err) { <START> throw new WinstoneException(err.getMessage(), err); <END> } this.outStream = null; } this.fileName = null; }</code><technical_language>this a bit change previously ignoring issue sense while stopping</technical_language>

Target:
protected void doStop() throws Exception { Logger.log(Logger.DEBUG, ACCESSLOG_RESOURCES, "SimpleAccessLogger.Close", this.fileName); if (this.outWriter != null) { this.outWriter.flush(); this.outWriter.close(); this.outWriter = null; } if (this.outStream != null) { try { this.outStream.close(); } catch (IOException err) { Logger.logDirectMessage(Logger.ERROR, null, "SimpleAccessLogger.Exception" + err.getMessage(), err); } this.outStream = null; } this.fileName = null; }
Source:
<code>public ObserveOnSubscriber(Scheduler scheduler, Subscriber<? super T> subscriber) { this.observer = subscriber; this.recursiveScheduler = scheduler.createWorker(); this.scheduledUnsubscribe = new ScheduledUnsubscribe(recursiveScheduler); subscriber.add(scheduledUnsubscribe); <START> subscriber.add(Subscriptions.create(new Action0() { <END> @Override public void call() { s.unsubscribe(); } })); }</code><technical_language>indirection? s is a Subscription, added subscriber directly</technical_language>

Target:
public ObserveOnSubscriber(Scheduler scheduler, Subscriber<? super T> subscriber) { this.observer = subscriber; this.recursiveScheduler = scheduler.createWorker(); this.scheduledUnsubscribe = new ScheduledUnsubscribe(recursiveScheduler); subscriber.add(scheduledUnsubscribe); subscriber.add(new SynchronizedSubscription(this)); }
Source:
<code>public void test() { <START> List<Subfield.PathElement> elements = ImmutableList.of( <END> new NestedField("b"), new Subfield.LongSubscript(2), new Subfield.StringSubscript("z"), Subfield.allSubscripts(), new Subfield.StringSubscript("34"), new Subfield.StringSubscript("b \"test\""), new Subfield.StringSubscript("\"abc"), new Subfield.StringSubscript("abc\""), new Subfield.StringSubscript("ab\"cde")); for (Subfield.PathElement element : elements) { assertPath(new Subfield("a", ImmutableList.of(element))); } for (Subfield.PathElement element : elements) { for (Subfield.PathElement secondElement : elements) { assertPath(new Subfield("a", ImmutableList.of(element, secondElement))); } } for (Subfield.PathElement element : elements) { for (Subfield.PathElement secondElement : elements) { for (Subfield.PathElement thirdElement : elements) { assertPath(new Subfield("a", ImmutableList.of(element, secondElement, thirdElement))); } } } }</code><technical_language>another test cover some illegal cases</technical_language>

Target:
public void test() { List<PathElement> elements = ImmutableList.of( new NestedField("b"), new Subfield.LongSubscript(2), new Subfield.StringSubscript("z"), Subfield.allSubscripts(), new Subfield.StringSubscript("34"), new Subfield.StringSubscript("b \"test\""), new Subfield.StringSubscript("\"abc"), new Subfield.StringSubscript("abc\""), new Subfield.StringSubscript("ab\"cde"), new Subfield.StringSubscript("a.b[\"hello\uDBFF\"]")); for (PathElement element : elements) { assertPath(new Subfield("a", ImmutableList.of(element))); } for (PathElement element : elements) { for (PathElement secondElement : elements) { assertPath(new Subfield("a", ImmutableList.of(element, secondElement))); } } for (PathElement element : elements) { for (PathElement secondElement : elements) { for (PathElement thirdElement : elements) { assertPath(new Subfield("a", ImmutableList.of(element, secondElement, thirdElement))); } } } }
Source:
<code>public ContainerRequest filter(ContainerRequest request) { final String taskId = Preconditions.checkNotNull( request.getPathSegments() .get( Iterables.indexOf( request.getPathSegments(), new Predicate<PathSegment>() { @Override public boolean apply(PathSegment input) { return input.getPath().equals("task"); } } ) + 1 ).getPath() ); Optional<Task> taskOptional = taskStorageQueryAdapter.getTask(taskId); if (!taskOptional.isPresent()) { throw new WebApplicationException( Response.status(Response.Status.BAD_REQUEST) .entity(StringUtils.format("Cannot find any task with id: [%s]", taskId)) .build() ); } final String dataSourceName = Preconditions.checkNotNull(taskOptional.get().getDataSource()); final ResourceAction resourceAction = new ResourceAction( new Resource(dataSourceName, ResourceType.DATASOURCE), getAction(request) ); final Access authResult = AuthorizationUtils.authorizeResourceAction( getReq(), resourceAction, getAuthorizerMapper() ); if (!authResult.isAllowed()) { <START> throw new WebApplicationException(Response.status(Response.Status.FORBIDDEN) <END> .entity( StringUtils.format("Access-Check-Result: %s", authResult.toString()) ) .build()); } return request; }</code><technical_language>This response, others it, generated a utility method ensure consistency</technical_language>

Target:
public ContainerRequest filter(ContainerRequest request) { final String taskId = Preconditions.checkNotNull( request.getPathSegments() .get( Iterables.indexOf( request.getPathSegments(), new Predicate<PathSegment>() { @Override public boolean apply(PathSegment input) { return input.getPath().equals("task"); } } ) + 1 ).getPath() ); Optional<Task> taskOptional = taskStorageQueryAdapter.getTask(taskId); if (!taskOptional.isPresent()) { throw new WebApplicationException( Response.status(Response.Status.BAD_REQUEST) .entity(StringUtils.format("Cannot find any task with id: [%s]", taskId)) .build() ); } final String dataSourceName = Preconditions.checkNotNull(taskOptional.get().getDataSource()); final ResourceAction resourceAction = new ResourceAction( new Resource(dataSourceName, ResourceType.DATASOURCE), getAction(request) ); final Access authResult = AuthorizationUtils.authorizeResourceAction( getReq(), resourceAction, getAuthorizerMapper() ); if (!authResult.isAllowed()) { throw new ForbiddenException(authResult.toString()); } return request; }