auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public String decodeMessage(KM200Device device, byte[] encoded) { String retString = null; byte[] decodedB64 = null; try { decodedB64 = Base64.getMimeDecoder().decode(encoded); } catch (IllegalArgumentException e) { <START> logger.error("Message is not in valid Base64 scheme:" + e.getMessage()); <END> e.printStackTrace(); } try { if ((decodedB64.length & 0xF) != 0) { retString = new String(decodedB64, device.getCharSet()); return retString; } final Cipher cipher = Cipher.getInstance("AES/ECB/NoPadding"); cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(device.getCryptKeyPriv(), "AES")); final byte[] decryptedData = cipher.doFinal(decodedB64); byte[] decryptedDataWOZP = removeZeroPadding(decryptedData); retString = new String(decryptedDataWOZP, device.getCharSet()); return retString; } catch (BadPaddingException | IllegalBlockSizeException | UnsupportedEncodingException | NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException e) { logger.error("Exception on encoding:" + e.getMessage()); return null; } catch (final GeneralSecurityException e) { throw new IllegalStateException("Algorithms or unlimited crypto files not available", e); } }</code><technical_language>parameterized logging instead of string concatenation</technical_language>

Target:
public String decodeMessage(KM200Device device, byte[] encoded) { String retString = null; byte[] decodedB64 = null; try { decodedB64 = Base64.getMimeDecoder().decode(encoded); } catch (IllegalArgumentException e) { logger.error("Message is not in valid Base64 scheme: {}", e); e.printStackTrace(); } try { if ((decodedB64.length & 0xF) != 0) { retString = new String(decodedB64, device.getCharSet()); return retString; } final Cipher cipher = Cipher.getInstance("AES/ECB/NoPadding"); cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(device.getCryptKeyPriv(), "AES")); final byte[] decryptedData = cipher.doFinal(decodedB64); byte[] decryptedDataWOZP = removeZeroPadding(decryptedData); retString = new String(decryptedDataWOZP, device.getCharSet()); return retString; } catch (BadPaddingException | IllegalBlockSizeException | UnsupportedEncodingException | NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException e) { logger.error("Exception on encoding: {}", e); return null; } catch (final GeneralSecurityException e) { throw new IllegalStateException("Algorithms or unlimited crypto files not available", e); } }
Source:
<code>public static long localTime(ConnectorSession session) { <START> return UTC_CHRONOLOGY.millisOfDay().get(session.getStartTime()); <END> }</code><technical_language>This is obvious this commit _introduces_ legacy semantics -- i.e. localTime implemented _new_ TIME semantics in this commit implements _legacy_ fixed ~3 commits later</technical_language>

Target:
public static long localTime(ConnectorSession session) { if (session.isLegacyTimestamp()) { return UTC_CHRONOLOGY.millisOfDay().get(session.getStartTime()); } ISOChronology localChronology = getChronology(session.getTimeZoneKey()); return localChronology.millisOfDay().get(session.getStartTime()); }
Source:
<code>private void recreateUserVmSeach(NetworkVO network) { if (network != null) { SearchBuilder<NicVO> nicSearch = _nicDao.createSearchBuilder(); nicSearch.and("networkId", nicSearch.entity().getNetworkId(), SearchCriteria.Op.EQ); nicSearch.and("removed", nicSearch.entity().getRemoved(), SearchCriteria.Op.NULL); <START> if (!network.getGuestType().equals(Network.GuestType.L2)) { <END> nicSearch.and().op("ip4Address", nicSearch.entity().getIPv4Address(), SearchCriteria.Op.NNULL); nicSearch.or("ip6Address", nicSearch.entity().getIPv6Address(), SearchCriteria.Op.NNULL); nicSearch.cp(); } UserVmSearch = createSearchBuilder(); UserVmSearch.and("states", UserVmSearch.entity().getState(), SearchCriteria.Op.IN); UserVmSearch.join("nicSearch", nicSearch, UserVmSearch.entity().getId(), nicSearch.entity().getInstanceId(), JoinBuilder.JoinType.INNER); UserVmSearch.done(); } }</code><technical_language>method getGuestType return Null? If not, code is ok. Otherwise, more interesting do Network.GuestType.L2.equals(network.getGuestType()) ==, if is enum type, is ok ==</technical_language>

Target:
private void recreateUserVmSeach(NetworkVO network) { if (network != null) { SearchBuilder<NicVO> nicSearch = _nicDao.createSearchBuilder(); nicSearch.and("networkId", nicSearch.entity().getNetworkId(), SearchCriteria.Op.EQ); nicSearch.and("removed", nicSearch.entity().getRemoved(), SearchCriteria.Op.NULL); if (!Network.GuestType.L2.equals(network.getGuestType())) { nicSearch.and().op("ip4Address", nicSearch.entity().getIPv4Address(), SearchCriteria.Op.NNULL); nicSearch.or("ip6Address", nicSearch.entity().getIPv6Address(), SearchCriteria.Op.NNULL); nicSearch.cp(); } UserVmSearch = createSearchBuilder(); UserVmSearch.and("states", UserVmSearch.entity().getState(), SearchCriteria.Op.IN); UserVmSearch.join("nicSearch", nicSearch, UserVmSearch.entity().getId(), nicSearch.entity().getInstanceId(), JoinBuilder.JoinType.INNER); UserVmSearch.done(); } }
Source:
<code>public void edit(final IscsiStorageModel object) { driver.edit(object); initLists(object); object.getPropertyChangedEvent().addListener((ev, sender, args) -> { String propName = args.propertyName; if (propName.equals("IsValid")) { onIsValidPropertyChange(object); } else if (propName.equals("IsGroupedByTarget")) { updateListByGrouping(object); } }); iscsiTargetToLunView.edit(object); iscsiLunToTargetView.edit(object); targetsToLunTab.addClickHandler(event -> { iscsiLunToTargetView.disableItemsUpdate(); object.setIsGroupedByTarget(true); }); lunToTargetsTab.addClickHandler(event -> { iscsiTargetToLunView.disableItemsUpdate(); object.setIsGroupedByTarget(false); }); dialogTabPanel.switchTab(object.getIsGroupedByTarget() ? targetsToLunTab : lunToTargetsTab); updateListByGrouping(object); if (!object.getContainer().isNewStorage()) { switch (object.getContainer().getStorage().getStatus()) { case Maintenance: mainLabel.setText(constants.storageIscsiRemoveLUNsLabel()); subLabel.setText(constants.storageIscsiAvailableActionsOnMaintenanceLabel()); break; case Active: mainLabel.setText(constants.storageIscsiActionsLabel()); subLabel.setText(constants.storageIscsiAvailableActionsForActiveDomainsLabel()); break; } } if (object.getContainer().isNewStorage()) { dialogTabPanel.setBarStyle(multiSelection ? <START> style.barShort() <END> : style.barNewDisk()); } else { dialogTabPanel.setBarStyle(style.barLong()); } }</code><technical_language>Please consider renaming a more informative name, barNewDisk. barNewDomain</technical_language>

Target:
public void edit(final IscsiStorageModel object) { driver.edit(object); initLists(object); object.getPropertyChangedEvent().addListener((ev, sender, args) -> { String propName = args.propertyName; if (propName.equals("IsValid")) { onIsValidPropertyChange(object); } else if (propName.equals("IsGroupedByTarget")) { updateListByGrouping(object); } }); iscsiTargetToLunView.edit(object); iscsiLunToTargetView.edit(object); targetsToLunTab.addClickHandler(event -> { iscsiLunToTargetView.disableItemsUpdate(); object.setIsGroupedByTarget(true); }); lunToTargetsTab.addClickHandler(event -> { iscsiTargetToLunView.disableItemsUpdate(); object.setIsGroupedByTarget(false); }); dialogTabPanel.switchTab(object.getIsGroupedByTarget() ? targetsToLunTab : lunToTargetsTab); updateListByGrouping(object); if (!object.getContainer().isNewStorage()) { switch (object.getContainer().getStorage().getStatus()) { case Maintenance: mainLabel.setText(constants.storageIscsiRemoveLUNsLabel()); subLabel.setText(constants.storageIscsiAvailableActionsOnMaintenanceLabel()); break; case Active: mainLabel.setText(constants.storageIscsiActionsLabel()); subLabel.setText(constants.storageIscsiAvailableActionsForActiveDomainsLabel()); break; } } if (object.getContainer().isNewStorage()) { dialogTabPanel.setBarStyle(multiSelection ? style.barNewDomain() : style.barNewDisk()); } else { dialogTabPanel.setBarStyle(style.barEditDomain()); } }
Source:
<code>public void checkAttributeValue(PerunSessionImpl perunSession, Facility facility, Attribute attribute) throws InternalErrorException, WrongAttributeValueException, WrongReferenceAttributeValueException, WrongAttributeAssignmentException { if(attribute.getValue() == null) return; String attrValue = (String) attribute.getValue(); <START> Pattern pattern = Pattern.compile("^[01234567]?[01234567]{3}$"); <END> Matcher match = pattern.matcher(attrValue); if(!match.matches()) throw new WrongAttributeValueException(attribute, facility, "Bad format of attribute, (expected something like '750' or '0700')."); }</code><technical_language>Pattern compiled once. Please move method</technical_language>

Target:
public void checkAttributeValue(PerunSessionImpl perunSession, Facility facility, Attribute attribute) throws InternalErrorException, WrongAttributeValueException, WrongReferenceAttributeValueException, WrongAttributeAssignmentException { if(attribute.getValue() == null) return; String attrValue = (String) attribute.getValue(); Matcher match = pattern.matcher(attrValue); if(!match.matches()) throw new WrongAttributeValueException(attribute, facility, "Bad format of attribute, (expected something like '750' or '0700')."); }
Source:
<code>public void testFindActivator() throws Exception { Builder bmaker = new Builder(); try { bmaker.setProperty("Bundle-Activator", "test.activator.Activator"); bmaker.setProperty("build", "xyz"); bmaker.setProperty("Private-Package", "test.*"); bmaker.setProperty("-bundleannotations", <START> "!test.annotationheaders.attrs.std.activator.TypeInVersionedPackage"); <END> bmaker.setProperty("-dsannotations", "!*"); bmaker.setProperty("-metatypeannotations", "!*"); bmaker.setClasspath(new File[] { new File("bin_test") }); bmaker.setProperty("-fixupmessages.export", "The annotation aQute.bnd.annotation.Export applied to package test.versionpolicy.api is deprecated and will be removed in a future release. The org.osgi.annotation.bundle.Export should be used instead"); bmaker.setProperty("-fixupmessages.directive", "Unknown directive foobar: in Export-Package, allowed directives are uses:,mandatory:,include:,exclude:,-import:, and 'x-*'"); Jar jar = bmaker.build(); assertTrue(bmaker.check()); report("testFindActivator", bmaker, jar); assertEquals(0, bmaker.getErrors() .size()); assertEquals(0, bmaker.getWarnings() .size()); } finally { bmaker.close(); } }</code><technical_language>this a ,* end</technical_language>

Target:
public void testFindActivator() throws Exception { Builder bmaker = new Builder(); try { bmaker.setProperty("Bundle-Activator", "test.activator.Activator"); bmaker.setProperty("build", "xyz"); bmaker.setProperty("Private-Package", "test.*"); bmaker.setProperty("-bundleannotations", "!test.annotationheaders.attrs.std.activator.TypeInVersionedPackage,*"); bmaker.setProperty("-dsannotations", "!*"); bmaker.setProperty("-metatypeannotations", "!*"); bmaker.setClasspath(new File[] { new File("bin_test") }); bmaker.setProperty("-fixupmessages.export", "The annotation aQute.bnd.annotation.Export applied to package test.versionpolicy.api is deprecated and will be removed in a future release. The org.osgi.annotation.bundle.Export should be used instead"); bmaker.setProperty("-fixupmessages.directive", "Unknown directive foobar: in Export-Package, allowed directives are uses:,mandatory:,include:,exclude:,-import:, and 'x-*'"); Jar jar = bmaker.build(); assertTrue(bmaker.check()); report("testFindActivator", bmaker, jar); assertEquals(0, bmaker.getErrors() .size()); assertEquals(0, bmaker.getWarnings() .size()); } finally { bmaker.close(); } }
Source:
<code>public List<DispoItem> call() throws Exception { List<DispoItem> fromThread = new LinkedList<DispoItem>(); for (File file : sublist) { InputStream inputStream = null; try { inputStream = new FileInputStream(file); String sanitizedFileName = file.getName().replaceAll("\\..*", ""); <START> <END> DispoItemData itemToBuild = new DispoItemData(); if (sanitizedFileName.contains("sample")) { System.out.println(""); } if (exisitingItems.containsKey(sanitizedFileName)) { if (sanitizedFileName.contains("sample")) { System.out.println(""); } DispoItem oldItem = exisitingItems.get(sanitizedFileName); Date lastUpdate = oldItem.getLastUpdate(); boolean wasSameFile = DiscrepancyParser.buildItemFromFile(itemToBuild, sanitizedFileName, inputStream, false, lastUpdate); if (!wasSameFile) { itemToBuild.setGuid(oldItem.getGuid()); itemToBuild.setAnnotationsList(new JSONArray()); if (itemToBuild.getDiscrepanciesList().length() > 0) { DispoItemDataCopier.copyOldItemData(oldItem, itemToBuild); } dataFactory.setStatus(itemToBuild); fromThread.add(itemToBuild); } } else { DiscrepancyParser.buildItemFromFile(itemToBuild, sanitizedFileName, inputStream, true, new Date()); dataFactory.initDispoItem(itemToBuild); fromThread.add(itemToBuild); } } finally { Lib.close(inputStream); } } return fromThread; }</code><technical_language>/** */</technical_language>

Target:
public List<DispoItem> call() throws Exception { List<DispoItem> fromThread = new LinkedList<DispoItem>(); for (File file : sublist) { InputStream inputStream = null; try { inputStream = new FileInputStream(file); String sanitizedFileName = file.getName().replaceAll("\\..*", ""); DispoItemData itemToBuild = new DispoItemData(); if (exisitingItems.containsKey(sanitizedFileName)) { DispoItem oldItem = exisitingItems.get(sanitizedFileName); Date lastUpdate = oldItem.getLastUpdate(); boolean wasSameFile = DiscrepancyParser.buildItemFromFile(itemToBuild, sanitizedFileName, inputStream, false, lastUpdate); if (!wasSameFile) { itemToBuild.setGuid(oldItem.getGuid()); itemToBuild.setAnnotationsList(new JSONArray()); if (itemToBuild.getDiscrepanciesList().length() > 0) { DispoItemDataCopier.copyOldItemData(oldItem, itemToBuild); } dataFactory.setStatus(itemToBuild); fromThread.add(itemToBuild); } } else { DiscrepancyParser.buildItemFromFile(itemToBuild, sanitizedFileName, inputStream, true, new Date()); dataFactory.initDispoItem(itemToBuild); fromThread.add(itemToBuild); } } finally { Lib.close(inputStream); } } return fromThread; }
Source:
<code>int get(final int numAlleles, final int ploidy) { if(numAlleles <= 0 || ploidy <= 0){ <START> throw new IllegalArgumentException("numAlleles and ploidy must both exceed 0"); <END> } if(numAlleles < staticCache.length && ploidy < staticCache[numAlleles].length){ return staticCache[numAlleles][ploidy]; } else{ final Integer cachedValue = dynamicCache.get(new CacheKey(numAlleles, ploidy)); if(cachedValue == null){ final int newValue = GenotypeLikelihoods.calcNumLikelihoods(numAlleles, ploidy); put(numAlleles, ploidy, newValue); return newValue; } else{ return cachedValue; } } }</code><technical_language>include actual values in case hits this error</technical_language>

Target:
synchronized int get(final int numAlleles, final int ploidy) { if(numAlleles <= 0 || ploidy <= 0){ throw new IllegalArgumentException("numAlleles and ploidy must both exceed 0, but they are numAlleles: " + numAlleles + ", ploidy: " + ploidy); } if(numAlleles < staticCache.length && ploidy < staticCache[numAlleles].length){ return staticCache[numAlleles-1][ploidy-1]; } else{ final Integer cachedValue = dynamicCache.get(new CacheKey(numAlleles, ploidy)); if(cachedValue == null){ final int newValue = GenotypeLikelihoods.calcNumLikelihoods(numAlleles, ploidy); put(numAlleles, ploidy, newValue); return newValue; } else{ return cachedValue; } } }
Source:
<code>public static void validateOptions(Options options) { try { GcsPath valid = GcsPath.fromUri(options.getTempPath()); Preconditions.checkArgument(!Strings.isNullOrEmpty(valid.getBucket()), "Bucket must be specified"); } catch (Exception x) { <START> Preconditions.checkState(false, <END> "temp path must be a valid Google Cloud Storage URL (starting with gs://)"); } }</code><technical_language>This swallows exception presenting user. catch expected exception, include in message (since denying user important debugging information, access control problem a mispelled path)</technical_language>

Target:
public static void validateOptions(Options options) { try { GcsPath valid = GcsPath.fromUri(options.getTempPath()); Preconditions.checkArgument(!Strings.isNullOrEmpty(valid.getBucket()), "Bucket must be specified"); } catch (IllegalArgumentException x) { Preconditions.checkState(false, "the specified temp path is invalid: " + x.getMessage()); } }
Source:
<code>public boolean onOptionsItemSelected(final MenuItem item) { switch (item.getItemId()) { case android.R.id.home: finish(); return true; <START> case R.id.send_coins_options_help: <END> HelpDialogFragment.page(getFragmentManager(), R.string.help_pop); return true; } return super.onOptionsItemSelected(item); }</code><technical_language>Again, needs menu id</technical_language>

Target:
public boolean onOptionsItemSelected(final MenuItem item) { switch (item.getItemId()) { case android.R.id.home: finish(); return true; case R.id.pop_options_help: HelpDialogFragment.page(getFragmentManager(), R.string.help_pop); return true; } return super.onOptionsItemSelected(item); }
Source:
<code>CachedFileInfo loadFileInfo(long ledgerId, byte[] masterKey) throws IOException { lock.readLock().lock(); try { CachedFileInfo fi = fileInfos.get(ledgerId); if (fi != null) { <START> fi.retain(); END> return fi; } } finally { lock.readLock().unlock(); } lock.writeLock().lock(); try { File backingFile = fileLoader.load(ledgerId, masterKey != null); CachedFileInfo fi = new CachedFileInfo(ledgerId, backingFile, masterKey); fileInfos.put(ledgerId, fi); fi.retain(); return fi; } finally { lock.writeLock().unlock(); } }</code><technical_language>if fileInfo is in map, right</technical_language>

Target:
CachedFileInfo loadFileInfo(long ledgerId, byte[] masterKey) throws IOException { lock.readLock().lock(); try { CachedFileInfo fi = fileInfos.get(ledgerId); if (fi != null) { assert(fi.tryRetain()); return fi; } } finally { lock.readLock().unlock(); } lock.writeLock().lock(); try { File backingFile = fileLoader.load(ledgerId, masterKey != null); CachedFileInfo fi = new CachedFileInfo(ledgerId, backingFile, masterKey); fileInfos.put(ledgerId, fi); assert(fi.tryRetain()); return fi; } finally { lock.writeLock().unlock(); } }
Source:
<code>public void noEvents() { Single.just("1") .delay(1, TimeUnit.MILLISECONDS, testScheduler) .compose(new UntilCorrespondingEventSingleTransformer<String, String>(lifecycle, CORRESPONDING_EVENTS)) .subscribe(testSubscriber); <START> testScheduler.advanceTimeBy(1, TimeUnit.MILLISECONDS); <END> testSubscriber.assertValue("1"); testSubscriber.assertCompleted(); }</code><technical_language>in opinion increases readability of test purpose a bit clearer of is tested</technical_language>

Target:
public void noEvents() { Single.just("1") .delay(1, TimeUnit.MILLISECONDS, testScheduler) .compose(new UntilCorrespondingEventSingleTransformer<String, String>(lifecycle, CORRESPONDING_EVENTS)) .subscribe(testSubscriber); testSubscriber.assertNoValues(); testScheduler.advanceTimeBy(1, TimeUnit.MILLISECONDS); testSubscriber.assertValue("1"); testSubscriber.assertCompleted(); }
Source:
<code><START> public synchronized void put(final Protos.TaskID key, final Protos.TaskState value) { <END> LOGGER.debug("put(key : {}, value : {})", key.getValue(), value); taskStates.put(key, value); }</code><technical_language>need synchronized here, taskStates is a concurrent map</technical_language>

Target:
public void put(final Protos.TaskID key, final Protos.TaskState value) { LOGGER.debug("put(key : {}, value : {})", key.getValue(), value); taskStates.put(key, value); }
Source:
<code>public void logChange(final String storeName, final Bytes key, final byte[] value, final long timestamp) { <START> throwUnsupportedOperationExceptionIfStandby("logChange"); <END> collector.send( storeToChangelogTopic.get(storeName), key, value, null, taskId().partition, timestamp, KEY_SERIALIZER, VALUE_SERIALIZER); }</code><technical_language>req: Please unit test a processor context for a standby unsupported methods. is, code paths involve a call throwUnsupportedOperationExceptionIfStandby()</technical_language>

Target:
public void logChange(final String storeName, final Bytes key, final byte[] value, final long timestamp) { throwUnsupportedOperationExceptionIfStandby("logChange"); collector.send( storeToChangelogTopic.get(storeName), key, value, null, taskId().partition, timestamp, BYTES_KEY_SERIALIZER, BYTEARRAY_VALUE_SERIALIZER); }
Source:
<code>protected TimedBufferObserver createTimedBufferObserver() { <START> return new LocalBufferObserver() { <END> @Override public void flushBuffer(ByteBuf byteBuf, boolean requestedSync, List<IOCallback> callbacks) { final int bytes = byteBuf.readableBytes(); if (bytes == 0) { DelegateCallback.done(callbacks); } else { if (byteBuf.nioBufferCount() == 1 && byteBuf.isDirect()) { final ByteBuffer buffer = byteBuf.internalNioBuffer(byteBuf.readerIndex(), bytes); final IOCallback callback = new DelegateCallback(callbacks); try { internalWrite(buffer, requestedSync, callback, false); } catch (Exception e) { callback.onError(ActiveMQExceptionType.GENERIC_EXCEPTION.getCode(), e.getMessage()); } } else { super.flushBuffer(byteBuf, requestedSync, callbacks); } } } }; }</code><technical_language>this class, anonymous</technical_language>

Target:
protected TimedBufferObserver createTimedBufferObserver() { return new SyncLocalBufferObserver(); }
Source:
<code>public CLIWrapper(boolean connect, String cliAddress, InputStream consoleInput) throws CliInitializationException { <START> this(connect, cliAddress, consoleInput, CONNECTION_TIMEOUT); <END> }</code><technical_language>Do want supersede CLI defaults? provide connectionTimeout if a negative connectionTimeout is provided</technical_language>

Target:
public CLIWrapper(boolean connect, String cliAddress, InputStream consoleInput) throws CliInitializationException { this(connect, cliAddress, consoleInput, -1); }
Source:
<code>public String toString() { StringBuilder sb = new StringBuilder(); <START> sb.append("Swaps used: "); <END> sb.append(FormatUtil.formatBytes(getSwapUsed())); sb.append("/"); sb.append(FormatUtil.formatBytes(getSwapTotal())); return sb.toString(); }</code><technical_language>Similar memory header, put "Swap: " in SystemInfo test put "Used:" instead</technical_language>

Target:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append("Used: "); sb.append(FormatUtil.formatBytes(getSwapUsed())); sb.append("/"); sb.append(FormatUtil.formatBytes(getSwapTotal())); return sb.toString(); }
Source:
<code>String generateCalendar(String title, List<Absence> absences) { final Calendar calendar = new Calendar(); calendar.getProperties().add(VERSION_2_0); calendar.getProperties().add(new ProdId("- calendar.getProperties().add(GREGORIAN); calendar.getProperties().add(new XProperty("X-WR-CALNAME", title)); calendar.getProperties().add(new XProperty("X-MICROSOFT-CALSCALE", GREGORIAN.getValue())); RefreshInterval refreshInterval = new RefreshInterval(); <START> refreshInterval.setValue(Duration.ofHours(1).toString()); <END> calendar.getProperties().add(refreshInterval); final List<VEvent> absencesVEvents = absences.stream().map(this::toVEvent).collect(toList()); calendar.getComponents().addAll(absencesVEvents); final StringWriter calenderWriter = new StringWriter(); final CalendarOutputter calendarOutputter = new CalendarOutputter(); try { calendarOutputter.output(calendar, calenderWriter); } catch (ValidationException | IOException e) { throw new CalendarException("iCal calender could not be generated", e); } return calenderWriter.toString(); }</code><technical_language>uv.calendar.refresh-interval</technical_language>

Target:
String generateCalendar(String title, List<Absence> absences) { final Calendar calendar = new Calendar(); calendar.getProperties().add(VERSION_2_0); calendar.getProperties().add(new ProdId("- calendar.getProperties().add(GREGORIAN); calendar.getProperties().add(new XProperty("X-WR-CALNAME", title)); calendar.getProperties().add(new XProperty("X-MICROSOFT-CALSCALE", GREGORIAN.getValue())); calendar.getProperties().add(new RefreshInterval(new ParameterList(), calendarProperties.getRefreshInterval())); final List<VEvent> absencesVEvents = absences.stream().map(this::toVEvent).collect(toList()); calendar.getComponents().addAll(absencesVEvents); final StringWriter calenderWriter = new StringWriter(); final CalendarOutputter calendarOutputter = new CalendarOutputter(); try { calendarOutputter.output(calendar, calenderWriter); } catch (ValidationException | IOException e) { throw new CalendarException("iCal calender could not be generated", e); } return calenderWriter.toString(); }
Source:
<code>public void testSASTokenProviderInitializeException() throws Exception { final AzureBlobFileSystem fs = this.getFileSystem(); final AzureBlobFileSystem testFs = new AzureBlobFileSystem(); <START> MockSASTokenProvider.setThrowExceptionAtInit(true); <END> intercept(TokenAccessProviderException.class, ()-> { testFs.initialize(fs.getUri(), this.getConfiguration().getRawConfiguration()); }); MockSASTokenProvider.setThrowExceptionAtInit(false); }</code><technical_language>I this fail intermittently (since is stored in a static) tests run in parallel, is run tests</technical_language>

Target:
public void testSASTokenProviderInitializeException() throws Exception { final AzureBlobFileSystem fs = this.getFileSystem(); final AzureBlobFileSystem testFs = new AzureBlobFileSystem(); Configuration testConfig = this.getConfiguration().getRawConfiguration(); testConfig.set(ConfigurationKeys.FS_AZURE_SAS_TOKEN_PROVIDER_TYPE, TEST_ERR_AUTHZ_CLASS); testConfig.set(MOCK_SASTOKENPROVIDER_FAIL_INIT, "true"); intercept(TokenAccessProviderException.class, ()-> { testFs.initialize(fs.getUri(), this.getConfiguration().getRawConfiguration()); }); }
Source:
<code>public Response processReview(@Context HttpServletRequest request, @PathParam("deliveryId") Long deliveryId, @FormParam("grade") String grade, @FormParam("commentary") String commentary, @FormParam("state") Delivery.State state) throws UnauthorizedException, ApiError { if(!(currentUser.isAdmin() || currentUser.isAssisting(group.getCourse()))) { throw new UnauthorizedException(); } Double gradeValue = grade.isEmpty() ? null : Double.valueOf(grade); Delivery delivery = deliveries.find(group, deliveryId); Delivery.Review review = new Delivery.Review(); review.setState(state); <START> review.setGrade(gradeValue); <END> review.setCommentary(commentary); try { deliveriesBackend.review(delivery, review); } catch (Exception e){ throw new ApiError("error.could-not-review", e); } return redirect(request.getRequestURI()); }</code><technical_language>a delivery is rejected, graded. E.g. currently I review a delivery rejected, grade a 9,5. A variation of this grade > X, X is a configuration variable</technical_language>

Target:
public Response processReview(@Context HttpServletRequest request, @PathParam("deliveryId") Long deliveryId, @FormParam("grade") String grade, @FormParam("commentary") String commentary, @FormParam("state") Delivery.State state) throws UnauthorizedException, ApiError { if(!(currentUser.isAdmin() || currentUser.isAssisting(group.getCourse()))) { throw new UnauthorizedException(); } Double gradeValue = grade.isEmpty() ? null : Double.valueOf(grade); Delivery delivery = deliveries.find(group, deliveryId); Delivery.Review review = new Delivery.Review(); review.setState(state); review.setGrade(gradeValue); review.setCommentary(commentary); try { deliveriesBackend.review(delivery, review); reviewMailer.sendReviewMail(delivery); } catch (Exception e){ throw new ApiError("error.could-not-review", e); } return redirect(request.getRequestURI()); }
Source:
<code>@Override public boolean startListener(int port, String name, InboundProcessorParams inboundParameters) { try { messageConsumer.consumeMessage(); } catch (IOException | InterruptedException e) { log.error("An error occurred while connecting to NATS server or consuming messages. " + e); messageConsumer.closeConnection(); return true; } catch (SynapseException e) { <START> log.error("Error while retrieving or injecting NATS message. " + e.getMessage(), e); <END> return true; } catch (Exception e) { log.error("Error while retrieving or injecting NATS message. " + e.getMessage(), e); messageConsumer.closeConnection(); return true; } return true; }</code><technical_language>log ignore exception? I need throw it. WDYT></technical_language>

Target:
@Override public boolean startListener(int port, String name, InboundProcessorParams inboundParameters) { try { messageConsumer.initializeConsumer(); } catch (IOException | InterruptedException e) { messageConsumer.closeConnection(); throw new SynapseException("An error occurred while connecting to NATS server or consuming messages. ", e); } catch (Exception e) { messageConsumer.closeConnection(); throw new SynapseException("Error while retrieving or injecting NATS message. ", e); } return true; }
Source:
<code>public int hashCode() { int result; <START> final long temp; <END> temp = Double.doubleToLongBits(output); result = (int) (temp ^ (temp >>> 32)); result = 31 * result + feature.hashCode(); return result; }</code><technical_language>nit: declaration assignment in line follows? final long temp = Double.doubleToLongBits(output);</technical_language>

Target:
public int hashCode() { int result; final long temp = Double.doubleToLongBits(output); result = (int) (temp ^ (temp >>> 32)); result = 31 * result + feature.hashCode(); return result; }
Source:
<code>public <T> boolean isBean(Class<T> clazz) { m_lock.readLock().lock(); try { <START> if (m_beanHierarchies.containsKey(clazz)) { <END> return !m_beanHierarchies.get(clazz).getBeans().isEmpty(); } return false; } finally { m_lock.readLock().unlock(); } }</code><technical_language>get() contains</technical_language>

Target:
public <T> boolean isBean(Class<T> clazz) { m_lock.readLock().lock(); try { BeanHierarchy h = m_beanHierarchies.get(clazz); return h != null && !h.getBeans().isEmpty(); } finally { m_lock.readLock().unlock(); } }
Source:
<code>void checkMaxEnvironmentRam(@Nullable String workspaceId, WorkspaceConfig config) throws ServerException { if (maxRamPerEnvMB < 0) { return; } if (config.getEnvironments().isEmpty()) { return; } if (SidecarToolingWorkspaceUtil.isSidecarBasedWorkspace(config.getAttributes())) { <START> LOG.warn( <END> "Can not estimate memory needed for sidecar based workspace{}. Set environment memory limits may work incorrectly", workspaceId == null ? "" : ' ' + workspaceId); } for (Map.Entry<String, ? extends Environment> envEntry : config.getEnvironments().entrySet()) { Environment env = envEntry.getValue(); final long workspaceRam = environmentRamCalculator.calculate(env); if (workspaceRam > maxRamPerEnvMB) { throw new LimitExceededException( format("You are only allowed to use %d mb. RAM per workspace.", maxRamPerEnvMB), ImmutableMap.of( "environment_max_ram", Long.toString(maxRamPerEnvMB), "environment_max_ram_unit", "mb", "environment_ram", Long.toString(workspaceRam), "environment_ram_unit", "mb")); } } }</code><technical_language>about: "Cannot estimate memory requirements of a devfile-based workspace{}. memory limits applied correctly."</technical_language>

Target:
void checkMaxEnvironmentRam(@Nullable String workspaceId, WorkspaceConfig config) throws ServerException { if (maxRamPerEnvMB < 0) { return; } if (config.getEnvironments().isEmpty()) { return; } if (SidecarToolingWorkspaceUtil.isSidecarBasedWorkspace(config.getAttributes())) { LOG.warn( "Cannot estimate the memory requirements of a devfile-based workspace `{}`." + " The memory limits may not be applied correctly.", workspaceId == null ? "" : ' ' + workspaceId); } for (Map.Entry<String, ? extends Environment> envEntry : config.getEnvironments().entrySet()) { Environment env = envEntry.getValue(); final long workspaceRam = environmentRamCalculator.calculate(env); if (workspaceRam > maxRamPerEnvMB) { throw new LimitExceededException( format("You are only allowed to use %d mb. RAM per workspace.", maxRamPerEnvMB), ImmutableMap.of( "environment_max_ram", Long.toString(maxRamPerEnvMB), "environment_max_ram_unit", "mb", "environment_ram", Long.toString(workspaceRam), "environment_ram_unit", "mb")); } } }
Source:
<code>public ColumnFilter build() { if (built) { return null; } String columnName = "potOwner"; UserGroupCallback userGroupCallback = UserDataServiceProvider.getUserGroupCallback(); List<String> potOwners = (List<String>)parameters.get(columnName); List<String> potOwnersList = new ArrayList<String>(); for(String potOwner: potOwners) { potOwnersList.add(potOwner); if(userGroupCallback.getGroupsForUser(potOwner) != null) { <START> potOwnersList.addAll(userGroupCallback.getGroupsForUser(potOwner)); <END> } } ColumnFilter filter = FilterFactory.AND( FilterFactory.in(columnName,potOwnersList)); filter.setColumnId(columnName); built = true; return filter; }</code><technical_language>move this separate line List<String> groups = userGroupCallback.getGroupsForUser(potOwner); heavy in some cases call</technical_language>

Target:
public ColumnFilter build() { if (built) { return null; } String columnName = "potOwner"; UserGroupCallback userGroupCallback = UserDataServiceProvider.getUserGroupCallback(); List<String> potOwners = (List<String>)parameters.get(columnName); List<String> potOwnersList = new ArrayList<String>(); for(String potOwner: potOwners) { potOwnersList.add(potOwner); List<String> groups = userGroupCallback.getGroupsForUser(potOwner); if(groups != null) { potOwnersList.addAll(groups); } } ColumnFilter filter = FilterFactory.AND( FilterFactory.in(columnName,potOwnersList)); filter.setColumnId(columnName); built = true; return filter; }
Source:
<code>public InputFormatBuilder.InputFormatOptions<T> addIterator(IteratorSetting cfg) { Objects.requireNonNull(cfg, "IteratorSetting must not be null."); this.iterators.put(cfg.getName(), cfg); <START> tableConfigMap.get(currentTable).setIterators(new ArrayList<>(this.iterators.values())); <END> return this; }</code><technical_language>this.iterators is a bit odd. Dropping this.iterators tableConfigMap.get(currentTable).addIterator(cfg) clean this up</technical_language>

Target:
public InputFormatBuilder.InputFormatOptions<T> addIterator(IteratorSetting cfg) { Objects.requireNonNull(cfg, "IteratorSetting must not be null."); tableConfigMap.get(currentTable).addIterator(cfg); return this; }
Source:
<code>public PropertyConstraint computeSpecific( LabelSchemaDescriptor schema ) { switch ( descriptor.type() ) { case UNIQUE: final int labelId = schema.getLabelId(); <START> final int[] propertyKeyIds = new int[]{schema.getPropertyId()}; <END> return new UniquenessConstraint( SchemaDescriptorFactory.forLabel( labelId, propertyKeyIds ) ); case EXISTS: final int labelId1 = schema.getLabelId(); final int[] propertyKeyIds1 = new int[]{schema.getPropertyId()}; return new NodePropertyExistenceConstraint( SchemaDescriptorFactory.forLabel( labelId1, propertyKeyIds1 ) ); default: throw new UnsupportedOperationException( "Although we cannot get here, this has not been implemented." ); } }</code><technical_language>do schema.getPropertyIds() get real array</technical_language>

Target:
public PropertyConstraint computeSpecific( LabelSchemaDescriptor schema ) { switch ( descriptor.type() ) { case UNIQUE: return new UniquenessConstraint( schema ); case EXISTS: return new NodePropertyExistenceConstraint( schema ); default: throw new UnsupportedOperationException( "Although we cannot get here, this has not been implemented." ); } }
Source:
<code><START> private Map<String, String> getTagFor(TableReference tableRef) { <END> if (LoggingArgs.tableRef(tableRef).isSafeForLogging()) { return ImmutableMap.of("tableName", tableRef.getQualifiedName()); } else { return ImmutableMap.of("tableName", "suppressed"); } }</code><technical_language>This live in LoggingArgs. Also, LoggingArgs.safeTableOrPlaceholder avoid custom conditional logic</technical_language>

Target:
private Map<String, String> getTagFor(TableReference tableRef) { return ImmutableMap.of("tableName", LoggingArgs.safeTableOrPlaceholder(tableRef).getQualifiedName()); }
Source:
<code>public GroupIdPage(GroupByIdBlock groupByIdBlock, Page page) { <START> this.page = page; this.groupByIdBlock = groupByIdBlock; <END> }</code><technical_language>requireNonNull</technical_language>

Target:
public GroupIdPage(GroupByIdBlock groupByIdBlock, Page page) { this.page = requireNonNull(page, "page is null"); this.groupByIdBlock = requireNonNull(groupByIdBlock, "groupByIdBlock is null"); }
Source:
<code>public static Date parse(String date) { SimpleDateFormat format = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); format.setTimeZone(TimeZone.getTimeZone("ZULU")); Date ret; try { ret = format.parse(date); return ret; } catch (ParseException ex) { <START> format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", <END> Locale.getDefault()); try { return format.parse(date); } catch (ParseException e) { format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()); try { return format.parse(date); } catch (ParseException e1) { format = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()); try { return format.parse(date); } catch (ParseException e2) { format = new SimpleDateFormat("yyyy-MM", Locale.getDefault()); try { return format.parse(date); } catch (ParseException e3) { format = new SimpleDateFormat("yyyy", Locale.getDefault()); try { return format.parse(date); } catch (ParseException e4) { log.error(e4.getMessage(), e); } } } } } } return new Date(); }</code><technical_language>For others continue Locale.getDefault() hop servlet container/java environment is configured right one</technical_language>

Target:
public static Date parse(String date) { SimpleDateFormat format = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); format.setTimeZone(TimeZone.getTimeZone("ZULU")); Date ret; try { ret = format.parse(date); return ret; } catch (ParseException ex) { format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); format.setTimeZone(TimeZone.getTimeZone("ZULU")); try { return format.parse(date); } catch (ParseException e) { format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()); try { return format.parse(date); } catch (ParseException e1) { format = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()); try { return format.parse(date); } catch (ParseException e2) { format = new SimpleDateFormat("yyyy-MM", Locale.getDefault()); try { return format.parse(date); } catch (ParseException e3) { format = new SimpleDateFormat("yyyy", Locale.getDefault()); try { return format.parse(date); } catch (ParseException e4) { log.error(e4.getMessage(), e); } } } } } } return new Date(); }
Source:
<code>private void refill() { long now = System.currentTimeMillis(); if (now - this.lastRefillTime >= this.refillPeriod) { this.remainingTokens = (int) Math.min(this.capacity, this.remainingTokens + (now - this.lastRefillTime) / this.refillPeriod); <START> this.remainingTokens = Math.max(1, this.remainingTokens); <END> this.lastRefillTime = now; } }</code><technical_language>lastRefillTime is accurate lose elapsed part of refillPeriod time refill() is called. I computed as: lastRefillTime += ((now - lastRefillTime) / refillPeriod) * refillPeriod Note this equal due calculation integer arithmetics</technical_language>

Target:
private void refill() { long now = System.currentTimeMillis(); if (now - this.lastRefillTime >= this.refillPeriod) { this.remainingTokens = (int) Math.min(this.capacity, this.remainingTokens + (now - this.lastRefillTime) / this.refillPeriod); this.remainingTokens = Math.max(1, this.remainingTokens); this.lastRefillTime += ((now - lastRefillTime) / refillPeriod) * refillPeriod; } }
Source:
<code>public void showSingleOfficeObjectInOfficeView(String uri) { if (uri.isEmpty()) return; String filePath = CapraOfficeObject.getFilePathFromUri(uri); String objectID = CapraOfficeObject.getIdFromUri(uri); if (new File(filePath).exists()) <START> parseFile(filePath, objectID); <END> else showMessage(viewer.getControl().getShell(), SWT.ERROR, "Error", "Resource not found."); viewer.refresh(); }</code><technical_language>refactor parseFile() methods calls accept a File instance instead of path. create File instance else</technical_language>

Target:
public void showSingleOfficeObjectInOfficeView(String uri) { if (uri.isEmpty()) return; File officeFile = new File(CapraOfficeObject.getFilePathFromUri(uri)); String objectID = CapraOfficeObject.getIdFromUri(uri); if (officeFile.exists()) parseFile(officeFile, objectID); else showMessage(viewer.getControl().getShell(), SWT.ERROR, "Error", "Resource not found."); viewer.refresh(); }
Source:
<code>public double leftExtrapolate(double xValue) { <START> throw new IllegalArgumentException("Extrapolation is not permitted"); <END> }</code><technical_language>expect UnsupportedOperationException here. IllegalStateException</technical_language>

Target:
public double leftExtrapolate(double xValue) { throw new UnsupportedOperationException("Extrapolation is not permitted"); }
Source:
<code>private void setupSearchMenuItem(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.media_search, menu); MenuItem searchMenuItem = menu.findItem(R.id.action_search); if (searchMenuItem != null) { searchView = (SearchView) MenuItemCompat.getActionView(searchMenuItem); searchView.setOnQueryTextListener(this); searchView.setQueryHint(getString(R.string.action_search)); if (!TextUtils.isEmpty(savedSearchFilter)) { searchMenuItem.expandActionView(); searchView.setQuery(savedSearchFilter, false); searchView.clearFocus(); } MenuItemCompat.setOnActionExpandListener(searchMenuItem, new MenuItemCompat.OnActionExpandListener() { @Override public boolean onMenuItemActionExpand(MenuItem item) { return true; } @Override public boolean onMenuItemActionCollapse(MenuItem item) { searchFilter = savedSearchFilter = null; restartLoader(); return true; } }); } View view = searchView.findViewById(R.id.search_close_btn); if (view != null) { view.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { EditText editText = (EditText) searchView.findViewById(R.id.search_src_text); editText.setText(""); searchView.setQuery("", false); searchFilter = savedSearchFilter = ""; <START> restartLoader(); <END> } }); } }</code><technical_language>Call else this function, do Android's Loader - refreshList() for instance</technical_language>

Target:
private void setupSearchMenuItem(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.media_search, menu); MenuItem searchMenuItem = menu.findItem(R.id.action_search); if (searchMenuItem != null) { searchView = (SearchView) MenuItemCompat.getActionView(searchMenuItem); searchView.setOnQueryTextListener(this); searchView.setQueryHint(getString(R.string.action_search)); if (!TextUtils.isEmpty(savedSearchFilter)) { searchMenuItem.expandActionView(); searchView.setQuery(savedSearchFilter, false); searchView.clearFocus(); } MenuItemCompat.setOnActionExpandListener(searchMenuItem, new MenuItemCompat.OnActionExpandListener() { @Override public boolean onMenuItemActionExpand(MenuItem item) { return true; } @Override public boolean onMenuItemActionCollapse(MenuItem item) { searchFilter = savedSearchFilter = null; refreshList(); return true; } }); } View view = searchView.findViewById(R.id.search_close_btn); if (view != null) { view.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { EditText editText = (EditText) searchView.findViewById(R.id.search_src_text); editText.setText(""); searchView.setQuery("", false); searchFilter = savedSearchFilter = ""; refreshList(); } }); } }
Source:
<code>private void verifyInvalidValueSize(IndexValue value, String logSegmentName) { try { int capacity = TestUtils.RANDOM.nextInt(value.getBytes().capacity()); ByteBuffer invalidValue = ByteBuffer.allocate(capacity); invalidValue.put(value.getBytes().array(), 0, capacity); <START> new IndexValue(logSegmentName, invalidValue, version); <END> fail( "Contruction of IndexValue expected to fail with invalid byte buffer capacity of " + invalidValue.capacity()); } catch (IllegalArgumentException e) { } }</code><technical_language>minor: put _only_ statement expect fail in try</technical_language>

Target:
private void verifyInvalidValueSize(IndexValue value, String logSegmentName) { int capacity = TestUtils.RANDOM.nextInt(value.getBytes().capacity()); ByteBuffer invalidValue = ByteBuffer.allocate(capacity); invalidValue.put(value.getBytes().array(), 0, capacity); try { new IndexValue(logSegmentName, invalidValue, version); fail( "Contruction of IndexValue expected to fail with invalid byte buffer capacity of " + invalidValue.capacity()); } catch (IllegalArgumentException e) { } }
Source:
<code>public long getProducerTimestamp() { <START> return producerId << 16 >> 16; <END> }</code><technical_language>producerTimestamp a field avoid need strip out pid compareTo()</technical_language>

Target:
public long getProducerTimestamp() { return producerTimestamp; }
Source:
<code>public DefaultNmsService(final NmsEntity entity, BlockingQueue<Optional<Message>> incomingMessageQueue, Consumer<Message> sink) { this.entity = Objects.requireNonNull(entity); this.incomingMessageQueue = incomingMessageQueue; this.entity.registerMessageListener(Message.class, message -> { LOGGER.trace("onMessage({})", message); switch (message.getType()) { case "MANAGEMENT_CALL_RETURN": String managementCallIdentifier = ((ManagementCallMessage) message).getManagementCallIdentifier(); ContextualReturn<?> contextualReturn = message.unwrap(ContextualReturn.class).get(0); getManagementAnswerFor(managementCallIdentifier).complete(contextualReturn); break; case "NOTIFICATION": case "STATISTICS": boolean offered = incomingMessageQueue.offer(Optional.of(message)); if (!offered) { <START> sink.accept(message); <END> } break; default: LOGGER.warn("Received unsupported message: " + message); } }); }</code><technical_language>Ensure sink != null</technical_language>

Target:
public DefaultNmsService(final NmsEntity entity, BlockingQueue<Optional<Message>> incomingMessageQueue, Consumer<Message> sink) { Objects.requireNonNull(sink); this.entity = Objects.requireNonNull(entity); this.incomingMessageQueue = Objects.requireNonNull(incomingMessageQueue); this.entity.registerMessageListener(Message.class, message -> { LOGGER.trace("onMessage({})", message); switch (message.getType()) { case "MANAGEMENT_CALL_RETURN": String managementCallIdentifier = ((ManagementCallMessage) message).getManagementCallIdentifier(); ContextualReturn<?> contextualReturn = message.unwrap(ContextualReturn.class).get(0); getManagementAnswerFor(managementCallIdentifier).complete(contextualReturn); break; case "NOTIFICATION": case "STATISTICS": boolean offered = incomingMessageQueue.offer(Optional.of(message)); if (!offered) { sink.accept(message); } break; default: LOGGER.warn("Received unsupported message: " + message); } }); }
Source:
<code>protected int[] makeDimValSelector(PooledTopNParams params, int numProcessed, int numToProcess) { final TopNMetricSpecBuilder<int[]> arrayProvider = params.getArrayProvider(); <START> if (query.getDimensionSpec().preservesOrdering()) { <END> return arrayProvider.build(); } arrayProvider.ignoreFirstN(numProcessed); arrayProvider.keepOnlyN(numToProcess); return query.getTopNMetricSpec().configureOptimizer(arrayProvider).build(); }</code><technical_language>same, needs negated</technical_language>

Target:
protected int[] makeDimValSelector(PooledTopNParams params, int numProcessed, int numToProcess) { final TopNMetricSpecBuilder<int[]> arrayProvider = params.getArrayProvider(); if (!query.getDimensionSpec().preservesOrdering()) { return arrayProvider.build(); } arrayProvider.ignoreFirstN(numProcessed); arrayProvider.keepOnlyN(numToProcess); return query.getTopNMetricSpec().configureOptimizer(arrayProvider).build(); }