auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void setFont (Font font) { checkWidget(); if (((state & FONT) == 0) && font == null) return; this.font = font; long fontDesc; if (font == null) { fontDesc = defaultFont ().handle; } else { if (font.isDisposed ()) error(SWT.ERROR_INVALID_ARGUMENT); fontDesc = font.handle; } if (font == null) { state &= ~FONT; } else { state |= FONT; } if (OS.GTK_VERSION < OS.VERSION(3, 22, 0)){ setFontDescription (fontDesc); } else { long context = OS.gtk_widget_get_style_context (handle); long family = OS.pango_font_description_get_family(fontDesc); String name; if (family == 0) { return; } else { int length = OS.strlen (family); byte buffer = new byte [length]; OS.memmove (buffer, family, length); name = new String (Converter.mbcsToWcs (null, buffer)); } String cssName = OS.GTK_VERSION >= OS.VERSION(3, 20, 0) ? display.gtk_widget_class_get_css_name(handle) : display.gtk_widget_get_name(handle); int height = OS.pango_font_description_get_size(fontDesc) / OS.PANGO_SCALE; <START> String css = cssName + " {font: "+ name +" "+height+";}"; <END> gtk_css_provider_load_from_css(context,css); } }</code><technical_language>spaces Strings "+" operator. I.e.: " {font: " + name + " " + height + ";}";</technical_language>

Target:
public void setFont (Font font) { checkWidget(); if (((state & FONT) == 0) && font == null) return; this.font = font; long fontDesc; if (font == null) { fontDesc = defaultFont ().handle; } else { if (font.isDisposed ()) error(SWT.ERROR_INVALID_ARGUMENT); fontDesc = font.handle; } if (font == null) { state &= ~FONT; } else { state |= FONT; } if (OS.GTK_VERSION < OS.VERSION(3, 21, 0)){ setFontDescription (fontDesc); } else { long context = OS.gtk_widget_get_style_context (handle); long family = OS.pango_font_description_get_family(fontDesc); String name; if (family == 0) { return; } else { int length = OS.strlen (family); byte buffer = new byte [length]; OS.memmove (buffer, family, length); name = new String (Converter.mbcsToWcs (null, buffer)); } String cssName = OS.GTK_VERSION >= OS.VERSION(3, 20, 0) ? display.gtk_widget_class_get_css_name(handle) : display.gtk_widget_get_name(handle); int height = OS.pango_font_description_get_size(fontDesc) / OS.PANGO_SCALE; String css = cssName + " {font: " + name +" " + height + ";}"; gtk_css_provider_load_from_css(context, css); } }
Source:
<code>public void dataIsInAUsableStateAfterBackup() throws Exception { Cluster cluster = startCluster( recordFormat ); createIndexes( cluster.getDbWithAnyRole( Role.LEADER ).database() ); AtomicBoolean continueFlagReference = new AtomicBoolean( false ); new Thread( () -> repeatedlyPopulateDatabase( clusterLeader( cluster ).database(), continueFlagReference ) ) .start(); <START> oneOffShutdownTasks.add( () -> continueFlagReference.set( false ) ); END> String ip = TestHelpers.backupAddressCc( clusterLeader( cluster ).database() ); assertEquals( 0, runBackupToolFromOtherJvmToGetExitCode( "--from", ip, "--cc-report-dir=" + backupDir, "--backup-dir=" + backupDir, "--name=defaultport" ) ); }</code><technical_language>this start true</technical_language>

Target:
public void dataIsInAUsableStateAfterBackup() throws Exception { Cluster cluster = startCluster( recordFormat ); ClusterHelper.createIndexes( cluster.getDbWithAnyRole( Role.LEADER ).database() ); AtomicBoolean populateDatabaseFlag = new AtomicBoolean( true ); new Thread( () -> repeatedlyPopulateDatabase( cluster, populateDatabaseFlag ) ) .start(); oneOffShutdownTasks.add( () -> populateDatabaseFlag.set( false ) ); String address = TestHelpers.backupAddressCc( clusterLeader( cluster ).database() ); assertEquals( 0, runBackupToolFromOtherJvmToGetExitCode( "--from", address, "--cc-report-dir=" + backupDir, "--backup-dir=" + backupDir, "--name=defaultport" ) ); }
Source:
<code>private void writeDirectoryToZip(ZipOutputStream destiny, FileHandle source, String relPath) { try { FileHandle[] children = source.list(); for (int i = 0; i < children.length; i++) { FileHandle child = children[i]; String childName = child.name(); if (child.isDirectory()) { <START> String childRelativePath = ""; <END> if (relPath != null && !relPath.equals("")) { relPath = relPath.replaceAll("\\\\", "/"); childRelativePath = relPath.endsWith("/") ? relPath + childName : relPath + "/" + childName; } else { childRelativePath = childName; } writeDirectoryToZip(destiny, child, childRelativePath); } else { InputStream fis = child.read(); String entryName = ""; if (relPath != null && !relPath.equals("")) { relPath = relPath.replaceAll("\\\\", "/"); entryName = relPath.endsWith("/") ? relPath + childName : relPath + "/" + childName; } else { entryName = childName; } ZipEntry anEntry = new ZipEntry(entryName); try { destiny.putNextEntry(anEntry); byte[] readBuffer = new byte[1024]; int bytesIn = 0; while ((bytesIn = fis.read(readBuffer)) != -1) { destiny.write(readBuffer, 0, bytesIn); } } catch (ZipException zipException) { Gdx.app.error("EditorIO.writeDirectoryToZip", "Error exporting: writeDirectoryToZip", zipException); } fis.close(); destiny.closeEntry(); } } } catch (Exception e) { Gdx.app.error("EditorIO.writeDirectoryToZip", "Error exporting: writeDirectoryToZip", e); } }</code><technical_language>I suggest create this method: private String canonicalize(String relPath, String childName) { String canonical; if (relPath != null && !relPath.equals("")) { relPath = relPath.replaceAll("\\\\", "/"); canonical = relPath.endsWith("/") ? relPath + childName : relPath + "/" + childName; } else { canonical = childName; } return canonical; } change lines 417-425 childRelativePath = canonicalize(relPath, childName);</technical_language>

Target:
private void writeDirectoryToZip(ZipOutputStream destiny, FileHandle source, String relPath) { try { FileHandle[] children = source.list(); for (int i = 0; i < children.length; i++) { FileHandle child = children[i]; String childName = child.name(); if (child.isDirectory()) { String childRelativePath = canonicalizeChild(relPath, childName); writeDirectoryToZip(destiny, child, childRelativePath); } else { InputStream fis = child.read(); String entryName = canonicalizeChild(relPath, childName); ZipEntry anEntry = new ZipEntry(entryName); try { destiny.putNextEntry(anEntry); byte[] readBuffer = new byte[1024]; int bytesIn = 0; while ((bytesIn = fis.read(readBuffer)) != -1) { destiny.write(readBuffer, 0, bytesIn); } } catch (ZipException zipException) { Gdx.app.error("EditorIO.writeDirectoryToZip", "Error exporting: writeDirectoryToZip", zipException); } fis.close(); destiny.closeEntry(); } } } catch (Exception e) { Gdx.app.error("EditorIO.writeDirectoryToZip", "Error exporting: writeDirectoryToZip", e); } }
Source:
<code>public void testDigestUpdatedWhenReplayCreateTxnForExistNode() { try { <START> System.setProperty(DigestCalculator.ZOOKEEPER_DIGEST_ENABLED, "true"); <END> dt.processTxn(new TxnHeader(13, 1000, 1, 30, ZooDefs.OpCode.create), new CreateTxn("/foo", "".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, false, 1)); dt.processTxn(new TxnHeader(13, 1000, 1, 30, ZooDefs.OpCode.create), new CreateTxn("/foo", "".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, false, 2)); assertEquals(dt.getTreeDigest(), dt.getLastProcessedZxidDigest().digest); } finally { System.setProperty(DigestCalculator.ZOOKEEPER_DIGEST_ENABLED, "false"); } }</code><technical_language>This effect of instantiate a new DataTree internal DigestCalculator</technical_language>

Target:
public void testDigestUpdatedWhenReplayCreateTxnForExistNode() { try { ZooKeeperServer.setDigestEnabled(true); DataTree dt = new DataTree(); dt.processTxn(new TxnHeader(13, 1000, 1, 30, ZooDefs.OpCode.create), new CreateTxn("/foo", "".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, false, 1)); dt.processTxn(new TxnHeader(13, 1000, 1, 30, ZooDefs.OpCode.create), new CreateTxn("/foo", "".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, false, 2)); assertEquals(dt.getTreeDigest(), dt.getLastProcessedZxidDigest().digest); } finally { ZooKeeperServer.setDigestEnabled(false); } }
Source:
<code>public void markMessage(Message message, ChatMarkersState chatMarkersState, String messageId) throws NotConnectedException, InterruptedException, IllegalStateException { <START> if (message == null) { <END> throw new IllegalStateException("Message must not be null"); } if (message.getTo() == null) { throw new IllegalStateException("To attribute must not be null"); } if (message.getStanzaId() == null) { message.setStanzaId(); } if (chatMarkersState == ChatMarkersState.received) { message.addExtension(new ChatMarkersElements.ReceivedExtension(messageId)); } else if (chatMarkersState == ChatMarkersState.displayed) { message.addExtension(new ChatMarkersElements.DisplayedExtension(messageId)); } else if (chatMarkersState == ChatMarkersState.acknowledged) { message.addExtension(new ChatMarkersElements.AcknowledgedExtension(messageId)); } connection().sendStanza(message); }</code><technical_language>Please Objects.requireNotNull() for nullity checks</technical_language>

Target:
public void markMessage(Message message, ChatMarkersState chatMarkersState, String messageId) throws NotConnectedException, InterruptedException, IllegalStateException { Objects.requireNonNull(message, "Message must not be null"); if (message.getTo() == null) { throw new IllegalStateException("To attribute must not be null"); } if (!message.hasStanzaIdSet()) { message.setStanzaId(); } switch (chatMarkersState) { case received: message.addExtension(new ChatMarkersElements.ReceivedExtension(messageId)); break; case displayed: message.addExtension(new ChatMarkersElements.DisplayedExtension(messageId)); break; case acknowledged: message.addExtension(new ChatMarkersElements.AcknowledgedExtension(messageId)); break; default: throw new IllegalStateException("markable is automatically set in outgoing messages."); } connection().sendStanza(message); }
Source:
<code>public void testMcqWeightsFeature_shouldToggleStateCorrectly() { <START> ______TS("MCQ: Weight cells are visible when weights are assigned"); <END> feedbackEditPage.clickAddQuestionButton(); feedbackEditPage.selectNewQuestionTypeAndWaitForNewQuestionPanelReady("MCQ"); feedbackEditPage.clickMcqAssignWeightCheckboxForNewQuestion(); assertTrue(feedbackEditPage.getMcqWeightsColumn(NEW_QUESTION_INDEX).isDisplayed()); assertFalse(browser.driver.findElement(By.id("mcqOtherOptionFlag-" + NEW_QUESTION_INDEX)).isSelected()); assertFalse(feedbackEditPage.getMcqOtherWeightBox(NEW_QUESTION_INDEX).isDisplayed()); ______TS("MCQ: Other weight Cell is visible when other option and weights both are enabled"); assertTrue(feedbackEditPage.isMcqAssignWeightCheckboxChecked(NEW_QUESTION_INDEX)); assertFalse(browser.driver.findElement(By.id("mcqOtherOptionFlag-" + NEW_QUESTION_INDEX)).isSelected()); feedbackEditPage.clickAddMcqOtherOptionCheckboxForNewQuestion(); assertTrue(feedbackEditPage.getMcqOtherWeightBox(NEW_QUESTION_INDEX).isDisplayed()); feedbackEditPage.clickMcqAssignWeightCheckboxForNewQuestion(); feedbackEditPage.clickAddMcqOtherOptionCheckboxForNewQuestion(); feedbackEditPage.clickDiscardChangesLinkForNewQuestion(); feedbackEditPage.waitForConfirmationModalAndClickOk(); }</code><technical_language>MCQ: Weight cells visible assigneWeights checkbox is clicked</technical_language>

Target:
public void testMcqWeightsFeature_shouldToggleStateCorrectly() { ______TS("MCQ: Weight cells are visible when assigneWeights checkbox is clicked?"); feedbackEditPage.clickAddQuestionButton(); feedbackEditPage.selectNewQuestionTypeAndWaitForNewQuestionPanelReady("MCQ"); feedbackEditPage.clickMcqAssignWeightCheckboxForNewQuestion(); assertTrue(feedbackEditPage.getMcqWeightsColumn(NEW_QUESTION_INDEX).isDisplayed()); assertFalse(feedbackEditPage.isMcqOtherOptionCheckboxChecked(NEW_QUESTION_INDEX)); assertFalse(feedbackEditPage.getMcqOtherWeightBox(NEW_QUESTION_INDEX).isDisplayed()); ______TS("MCQ: Other weight Cell is visible when other option and weights both are enabled"); assertTrue(feedbackEditPage.isMcqHasAssignWeightCheckboxChecked(NEW_QUESTION_INDEX)); assertFalse(feedbackEditPage.isMcqOtherOptionCheckboxChecked(NEW_QUESTION_INDEX)); feedbackEditPage.clickAddMcqOtherOptionCheckboxForNewQuestion(); assertTrue(feedbackEditPage.getMcqOtherWeightBox(NEW_QUESTION_INDEX).isDisplayed()); feedbackEditPage.clickAddMcqOtherOptionCheckboxForNewQuestion(); assertFalse(feedbackEditPage.getMcqOtherWeightBox(NEW_QUESTION_INDEX).isDisplayed()); feedbackEditPage.clickMcqAssignWeightCheckboxForNewQuestion(); assertFalse(feedbackEditPage.getMcqWeightsColumn(NEW_QUESTION_INDEX).isDisplayed()); feedbackEditPage.clickDiscardChangesLinkForNewQuestion(); feedbackEditPage.waitForConfirmationModalAndClickOk(); }
Source:
<code>public void noteOpenConnection(ServerStats serverStats) { if (serverStats == null) { return; } try { serverStats.incrementActiveRequestsCount(); <START> } catch (Error ex) { <END> logger.error("Error noting stats for client {}", clientName, ex); } }</code><technical_language>I noticed a bunch of transitioned Throwable Error. Exception</technical_language>

Target:
public void noteOpenConnection(ServerStats serverStats) { if (serverStats == null) { return; } try { serverStats.incrementActiveRequestsCount(); } catch (Exception ex) { logger.error("Error noting stats for client {}", clientName, ex); } }
Source:
<code>public GHRef createBranch(String branchName) throws IOException { <START> GHRef defaultBranch = ghRepo.getRef("heads/" + ghRepo.getDefaultBranch()); <END> return ghRepo.createRef("refs/heads/" + branchName, defaultBranch.getObject().getSha()); }</code><technical_language>Please create public method return default branch GHRef public getDefaultBranch(){ return ghRepo.getRef("heads/" + ghRepo.getDefaultBranch()); }</technical_language>

Target:
public GHRef createBranch(String branchName) throws IOException { GHRef defaultBranch = getReferenceToDefaultBranch(); return ghRepo.createRef("refs/heads/" + branchName, defaultBranch.getObject().getSha()); }
Source:
<code>protected Optional<UserImpl> doRemove(String id) { final EntityManager manager = managerProvider.get(); final UserImpl user = manager.find(UserImpl.class, id); <START> if (user != null) { <END> eventService.publish(new BeforeUserRemovedEvent(user)); manager.remove(user); } return Optional.ofNullable(user); }</code><technical_language>change java if (user == null) { return Optional.empty(); } eventService.publish(new BeforeUserRemovedEvent(user)); manager.remove(user); return Optional.of(user); Optional.ofNullable(user) another null check</technical_language>

Target:
protected Optional<UserImpl> doRemove(String id) throws ServerException { final EntityManager manager = managerProvider.get(); final UserImpl user = manager.find(UserImpl.class, id); if (user == null) { return Optional.empty(); } eventService.publish(new BeforeUserRemovedEvent(user)).propagateException(); manager.remove(user); manager.flush(); return Optional.of(user); }
Source:
<code>protected void internalReceiveCommand(String itemName, Command command) { logger.debug("internalReceiveCommand({},{}) is called!", itemName, command); for (TACmiBindingProvider provider : providers) { int canNode = provider.getCanNode(itemName); String portType = provider.getPortType(itemName); int portNumber = provider.getPortNumber(itemName); logger.debug("Type: {}, portNumber: {}, command: {}", portType, portNumber, command.toString()); if (portType.equals("d") && portNumber == 1 && command instanceof OnOffType) { boolean state = OnOffType.ON.equals(command) ? true : false; try { DigitalMessage message = new DigitalMessage((byte) canNode, state); byte[] messageBytes = message.getRaw(); InetAddress IPAddress = InetAddress .getByName(this.cmiAddress); DatagramPacket packet = new DatagramPacket(messageBytes, messageBytes.length, IPAddress, TACmiBinding.cmiPort); clientSocket.send(packet); } catch (Exception e) { logger.debug("Error sending message: {}, {}", e.getClass() <START> .getName(), e.getMessage()); <END> } } else { logger.debug( "Not sending command: portType: {}, portNumber: {}, command: {}", portType, portNumber, command.toString()); } } }</code><technical_language>increase WARN</technical_language>

Target:
protected void internalReceiveCommand(String itemName, Command command) { logger.debug("internalReceiveCommand({},{}) is called!", itemName, command); for (TACmiBindingProvider provider : providers) { int canNode = provider.getCanNode(itemName); String portType = provider.getPortType(itemName); int portNumber = provider.getPortNumber(itemName); logger.trace("Type: {}, portNumber: {}, command: {}", portType, portNumber, command.toString()); byte[] messageBytes; if (portType.equals("d") && portNumber == 1 && command instanceof OnOffType) { boolean state = OnOffType.ON.equals(command) ? true : false; DigitalMessage message = new DigitalMessage((byte) canNode, state); messageBytes = message.getRaw(); } else if (portType.equals("a") && (portNumber-1) % 4 == 0 && command instanceof DecimalType) { TACmiMeasureType measureType = provider.getMeasureType(itemName); AnalogMessage message = new AnalogMessage((byte) canNode, 1, (DecimalType) command, measureType); messageBytes = message.getRaw(); } else { logger.info( "Not sending command: portType: {}, portNumber: {}, command: {}", portType, portNumber, command.toString()); return; } DatagramPacket packet = new DatagramPacket(messageBytes, messageBytes.length, cmiAddress, TACmiBinding.cmiPort); try { clientSocket.send(packet); } catch (IOException e) { logger.warn("Error sending message: {}, {}", e.getClass() .getName(), e.getMessage()); } } }
Source:
<code>public List<ListSelectorItem> getItems(final int uiRowIndex, final int uiColumnIndex) { final List<ListSelectorItem> items = new ArrayList<>(); if (hasExpression.isClearSupported()) { items.add(ListSelectorTextItem.build(translationService.format(DMNEditorConstants.ExpressionEditor_Clear), true, () -> { cellEditorControls.hide(); clearExpressionType(); })); } <START> return items; <END> }</code><technical_language>due previous version, thinking if this is more effective: java if (hasExpression.isClearSupported()) { return Collections.singletonList(ListSelectorTextItem .build(translationService.format(DMNEditorConstants.ExpressionEditor_Clear), true, () -> { cellEditorControls.hide(); clearExpressionType(); })); } return Collections.emptyList(); do please</technical_language>

Target:
public List<ListSelectorItem> getItems(final int uiRowIndex, final int uiColumnIndex) { if (hasExpression.isClearSupported()) { return Collections.singletonList(ListSelectorTextItem .build(translationService.format(DMNEditorConstants.ExpressionEditor_Clear), true, () -> { cellEditorControls.hide(); clearExpressionType(); })); } return Collections.emptyList(); }
Source:
<code><START> public boolean isVmPluggedDiskUsingScsiReservation() { <END> if (getDbFacade().getVmDeviceDao() == null) { return false; } VM vm = vms.iterator().next(); List<VmDevice> devices = getDbFacade().getVmDeviceDao().getVmDeviceByVmIdAndType(vm.getId(), VmDeviceGeneralType.DISK); for (VmDevice device : devices) { if (device.getIsPlugged() && device.isUsingScsiReservation()) { return true; } } return false; }</code><technical_language>if i missed before, other methods retuning ValidationResult, please align the</technical_language>

Target:
public ValidationResult isVmPluggedDiskUsingScsiReservation() { if (getDbFacade().getVmDeviceDao() == null) { return ValidationResult.VALID; } for (VM vm : vms) { List<VmDevice> devices = getDbFacade().getVmDeviceDao().getVmDeviceByVmIdAndType(vm.getId(), VmDeviceGeneralType.DISK); for (VmDevice device : devices) { if (device.getIsPlugged() && device.isUsingScsiReservation()) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_VM_USES_SCSI_RESERVATION); } } } return ValidationResult.VALID; }
Source:
<code>public InputStreamConsumerThread(final InputStream in) { <START> setDaemon(true); <END> this.in = in; this.outStream = null; this.outWriter = null; this.outFile = null; }</code><technical_language>I recommend this(in, null). error-prone</technical_language>

Target:
public InputStreamConsumerThread(final InputStream in) { this(in, (Writer) null); }
Source:
<code>public String getExternalAddress() { if (useContainerAddress) { return externalAddressProperty != null ? externalAddressProperty : !isNullOrEmpty(gatewayAddressContainer) ? gatewayAddressContainer : this.internalHost; <START> } else { <END> return externalAddressProperty != null ? externalAddressProperty : internalAddressProperty != null ? internalAddressProperty : this.internalHost; } }</code><technical_language>is this else necessary</technical_language>

Target:
public String getExternalAddress() { if (useContainerAddress) { return cheDockerIpExternal != null ? cheDockerIpExternal : !isNullOrEmpty(gatewayAddressContainer) ? gatewayAddressContainer : this.internalHost; } return cheDockerIpExternal != null ? cheDockerIpExternal : cheDockerIp != null ? cheDockerIp : this.internalHost; }
Source:
<code>public void setMenuItems(@Nullable List<CarMenuItem> items) { mMenuItems = items; <START> List<CarMenuItem> actionItems = new ArrayList<>(); <END> mOverflowMenuItems.clear(); mActionViews.forEach(this::removeView); mActionViews.clear(); if (mMenuItems != null) { for (CarMenuItem item : mMenuItems) { if (item.getDisplayBehavior() == CarMenuItem.DisplayBehavior.ALWAYS) { actionItems.add(item); } else { mOverflowMenuItems.add(item); } } } mOverflowButtonView.setVisibility(mOverflowMenuItems.isEmpty() ? GONE : VISIBLE); for (CarMenuItem item : actionItems) { View view = item.isCheckable() ? createCheckableAction(item) : createAction(item); MarginLayoutParams marginLayoutParams = new MarginLayoutParams(LayoutParams.WRAP_CONTENT, mActionButtonHeight); view.setLayoutParams(marginLayoutParams); mActionViews.add(view); addView(view); } requestLayout(); }</code><technical_language>Move this declaration right mMenuItems != null check used</technical_language>

Target:
public void setMenuItems(@Nullable List<CarMenuItem> items) { mMenuItems = items; mOverflowMenuItems.clear(); mActionViews.forEach(this::removeView); mActionViews.clear(); List<CarMenuItem> actionItems = new ArrayList<>(); if (mMenuItems != null) { for (CarMenuItem item : mMenuItems) { if (item.getDisplayBehavior() == CarMenuItem.DisplayBehavior.ALWAYS) { actionItems.add(item); } else { mOverflowMenuItems.add(item); } } } mOverflowButtonView.setVisibility(mOverflowMenuItems.isEmpty() ? GONE : VISIBLE); for (CarMenuItem item : actionItems) { View action = item.isCheckable() ? createCheckableAction(item) : createAction(item); MarginLayoutParams marginLayoutParams = new MarginLayoutParams(LayoutParams.WRAP_CONTENT, mActionButtonHeight); action.setLayoutParams(marginLayoutParams); mActionViews.add(action); addView(action); } requestLayout(); }
Source:
<code>private String[] getIndexNames() { List<String> repositoryNames = getRepositoryNames(); <START> String indices[] = new String[this.repositoryNames.size()]; <END> int i = 0; for (String repo : repositoryNames) { indices[i++] = esa.getIndexNameForRepository(repo); } return indices; }</code><technical_language>this is surprising here, remove it</technical_language>

Target:
private String[] getIndexNames() { List<String> repositoryNames = getRepositoryNames(); String indices[] = new String[repositoryNames.size()]; int i = 0; for (String repo : repositoryNames) { indices[i++] = esa.getIndexNameForRepository(repo); } return indices; }
Source:
<code>public static DiffRepository lookup(Class<?> clazz, DiffRepository baseRepository, Filter filter) { final Key key = new Key(clazz, baseRepository, filter); final String overwrite = System.getProperty("overwrite"); if (overwrite != null && overwrite.equalsIgnoreCase("true")) { try { URL refFile = findFile(clazz, ".xml"); final String refFilePath = Sources.of(refFile).file().getAbsolutePath(); final String logFilePath = refFilePath.replace(".xml", "_actual.xml"); final File logFile = new File(logFilePath); <START> FileUtils.copyFile(logFile, new File(refFilePath.replace("out", "src"))); <END> } catch (IOException e) { e.printStackTrace(); } } return REPOSITORY_CACHE.getUnchecked(key); }</code><technical_language>guava Files.copy</technical_language>

Target:
public static DiffRepository lookup(Class<?> clazz, DiffRepository baseRepository, Filter filter) { final Key key = new Key(clazz, baseRepository, filter); if (CalciteSystemProperty.OVERWRITE_XML_TEST.value()) { try { final String logFilePath = key.toRepo().logFile.getAbsolutePath() .replace("build/resources/test", "out/test/resources"); final String refFilePath = logFilePath.replace("out", "src").replace("_actual.xml", ".xml"); final File logFile = new File(logFilePath); Files.copy(logFile, new File(refFilePath)); } catch (IOException e) { throw new RuntimeException(e); } } return REPOSITORY_CACHE.getUnchecked(key); }
Source:
<code>public String selector() { <START> return "ClusterUpgradeInitRequest"; <END> }</code><technical_language>this be: CLUSTER_UPGRADE_INIT_EVENT.event() CLUSTER_UPGRADE_INIT_EVENT.selector()</technical_language>

Target:
public String selector() { return EventSelectorUtil.selector(ClusterUpgradeInitRequest.class); }
Source:
<code>private Set<Tuple2<? extends Class<?>, ? extends Class<?>>> pairwiseDistinctSetClasses() { return generators.keySet() .flatMap(firstClass -> generators.keySet() .filter(filteredKey -> filteredKey != firstClass) .map(inner -> Tuple.of(firstClass, inner)) <START> .collect(Collectors.toSet())); <END> }</code><technical_language>java private Seq<Tuple2<Class<?>, Class<?>>> pairwiseDistinctSetClasses() { return generators.keySet().toList() .combinations(2) .map(seq -> Tuple.of(seq.get(0), seq.get(1))); }</technical_language>

Target:
private java.util.Set<Tuple2<? extends Class<?>, ? extends Class<?>>> pairwiseDistinctSetClasses() { return generators.keySet().toList() .combinations(2) .map(seq -> Tuple.of(seq.get(0), seq.get(1))) .collect(Collectors.toSet()); }
Source:
<code>public boolean validate() { getNetwork().validateSelectedItem(new IValidation[] { new NotEmptyValidation() }); getBond().validateSelectedItem(new IValidation[] { new NotEmptyValidation(), new LengthValidation(BusinessEntitiesDefinitions.HOST_NIC_NAME_LENGTH), new BondNameValidation() }); getAddress().setIsValid(true); getSubnet().setIsValid(true); getGateway().setIsValid(true); if (getIsStaticAddress()) { getAddress().validateEntity(new IValidation[] { new NotEmptyValidation(), new IpAddressValidation() }); getSubnet().validateEntity(new IValidation[] { new NotEmptyValidation(), new SubnetMaskValidation() }); getGateway().validateEntity(new IValidation[] { new NotEmptyValidation(), new IpAddressValidation() }); } <START> if (getBondingOptions().getSelectedItem().getKey().equals("custom")) { END> getCustomEditor().validateEntity(new IValidation[] { new NotEmptyValidation() }); } return getBond().getIsValid() && getNetwork().getIsValid() && getAddress().getIsValid() && getSubnet().getIsValid() && getGateway().getIsValid() && getCustomEditor().getIsValid(); }</code><technical_language>is getBondingOptions().getSelectedItem() return null</technical_language>

Target:
public boolean validate() { getNetwork().validateSelectedItem(new IValidation[] { new NotEmptyValidation() }); getBond().validateSelectedItem(new IValidation[] { new NotEmptyValidation(), new LengthValidation(BusinessEntitiesDefinitions.HOST_NIC_NAME_LENGTH), new BondNameValidation() }); getAddress().setIsValid(true); getSubnet().setIsValid(true); getGateway().setIsValid(true); if (getIsStaticAddress()) { getAddress().validateEntity(new IValidation[] { new NotEmptyValidation(), new IpAddressValidation() }); getSubnet().validateEntity(new IValidation[] { new NotEmptyValidation(), new SubnetMaskValidation() }); getGateway().validateEntity(new IValidation[] { new NotEmptyValidation(), new IpAddressValidation() }); } if (getBondingOptions().getSelectedItem().getKey().equals(CUSTOM_BONDING_MODE)) { getCustomBondMode().validateEntity(new IValidation[] { new NotEmptyValidation() }); } return getBond().getIsValid() && getNetwork().getIsValid() && getAddress().getIsValid() && getSubnet().getIsValid() && getGateway().getIsValid() && getCustomBondMode().getIsValid(); }
Source:
<code>public void before() throws TmfTraceException { fBot = new SWTWorkbenchBot(); fBot.closeAllEditors(); for (SWTBotView viewBot : fBot.views()) { viewBot.close(); } fTrace = new TmfTraceStub() { @Override public @NonNull String getName() { return "Stub"; } @Override public TmfContext seekEvent(ITmfLocation location) { return new TmfContext(); } }; fTrace.setStartTime(TmfTimestamp.fromNanos(0)); fTrace.setEndTime(TmfTimestamp.fromNanos(180)); TmfTraceStub trace = fTrace; trace.initialize(null, "", ITmfEvent.class); assertNotNull(trace); <START> TmfSignalManager.dispatchSignal(new TmfTraceOpenedSignal(this, trace, null)); <END> SWTBotUtils.openView(XYChartViewStub.ID); fViewBot = fBot.viewById(XYChartViewStub.ID); fViewBot.show(); IViewPart viewSite = fViewBot.getViewReference().getView(true); fXyViewer = getChartViewer(viewSite); fViewBot.bot().waitUntil(new DefaultCondition() { @Override public boolean test() throws Exception { return fXyViewer.getSwtChart() != null; } @Override public String getFailureMessage() { return "SWT Chart is null"; } }); resetTimeRange(); }</code><technical_language>dispatched UI thread, TimeGraphViewTest:225</technical_language>

Target:
public void before() throws TmfTraceException { fBot = new SWTWorkbenchBot(); fBot.closeAllEditors(); for (SWTBotView viewBot : fBot.views()) { viewBot.close(); } fTrace = new TmfTraceStub() { @Override public @NonNull String getName() { return "Stub"; } @Override public TmfContext seekEvent(ITmfLocation location) { return new TmfContext(); } }; fTrace.setStartTime(TmfTimestamp.fromNanos(0)); fTrace.setEndTime(TmfTimestamp.fromNanos(180)); TmfTraceStub trace = fTrace; trace.initialize(null, "", ITmfEvent.class); assertNotNull(trace); UIThreadRunnable.syncExec(() -> TmfSignalManager.dispatchSignal(new TmfTraceOpenedSignal(this, trace, null))); SWTBotUtils.openView(XYChartViewStub.ID); fViewBot = fBot.viewById(XYChartViewStub.ID); fViewBot.show(); IViewPart viewSite = fViewBot.getViewReference().getView(true); fXyViewer = getChartViewer(viewSite); fViewBot.bot().waitUntil(new DefaultCondition() { @Override public boolean test() throws Exception { return fXyViewer.getSwtChart() != null; } @Override public String getFailureMessage() { return "SWT Chart is null"; } }); resetTimeRange(); }
Source:
<code>protected void onInit() { super.onInit(); if (this.streamReceiverOptions != null) { this.streamReceiver = StreamReceiver.create(this.reactiveConnectionFactory, this.streamReceiverOptions); } else { this.streamReceiver = StreamReceiver.create(this.reactiveConnectionFactory); } <START> this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(getBeanFactory()); <END> }</code><technical_language>drop expression for stream key, need this context, too</technical_language>

Target:
protected void onInit() { super.onInit(); this.streamReceiver = StreamReceiver.create(this.reactiveConnectionFactory, this.streamReceiverOptions); if (StringUtils.hasText(this.consumerName) && StringUtils.isEmpty(this.consumerGroup)) { this.consumerGroup = getBeanName(); } this.reactiveRedisTemplate = new ReactiveRedisTemplate<>(this.reactiveConnectionFactory, RedisSerializationContext.string()); this.reactiveStreamOperations = this.reactiveRedisTemplate.opsForStream(); }
Source:
<code>public synchronized boolean start() { if (!started.get()) { started.set(loadingLookup.isOpen()); <START> LOGGER.info("starting loading lookup [%s]", id); <END> } return started.get(); }</code><technical_language>this start anything. Suggest rewording logging</technical_language>

Target:
public synchronized boolean start() { if (!started.get()) { started.set(loadingLookup.isOpen()); LOGGER.info("created loading lookup with id [%s]", id); } return started.get(); }
Source:
<code>public <T extends Closeable> Mono<T> bind(ServerTransport<T> transport) { return Mono.defer( new Supplier<Mono<T>>() { ServerSetup serverSetup = serverSetup(); @Override public Mono<T> get() { <START> return Mono.just(transport) .flatMap( transport -> transport.start( duplexConnection -> acceptor(serverSetup, duplexConnection), mtu)) <END> .doOnNext(c -> c.onClose().doFinally(v -> serverSetup.dispose()).subscribe()); } }); }</code><technical_language>suggestion return transport.start(duplexConnection -> acceptor(serverSetup, duplexConnection), mtu))</technical_language>

Target:
public <T extends Closeable> Mono<T> bind(ServerTransport<T> transport) { return Mono.defer( new Supplier<Mono<T>>() { ServerSetup serverSetup = serverSetup(); @Override public Mono<T> get() { return transport .start(duplexConnection -> acceptor(serverSetup, duplexConnection), mtu) .doOnNext(c -> c.onClose().doFinally(v -> serverSetup.dispose()).subscribe()); } }); }
Source:
<code>private TypeMirror getUnwrappedType(TypeMirror type) { Optional<TypeMirror> optional = constraintHelper.getUnwrappedToByDefault( getQualifiedName( type ) ); if ( optional.isPresent() ) { return optional.get(); } else { <START> return type; <END> } }</code><technical_language>Thinking out loud, allow declare types in annotation processor configuration (thinking Maven configuration here)? like: xml <containerTypesUnwrappedByDefault> <containerTypeUnwrappedByDefault> <containerType>...</containerType> <unwrappedType>...</unwrappedType> </containerTypeUnwrappedByDefault> </containerTypesUnwrappedByDefault> I mean, another, need a declare them. Note: blocking for merging this PR, thinking out loud. do in a step (if feasible)</technical_language>

Target:
private Optional<TypeMirror> getUnwrappedType(TypeMirror type) { return constraintHelper.getUnwrappedToByDefault( getQualifiedName( type ) ); }
Source:
<code>public ResponseEntity<FileSystemResource> getTemplate(@PathVariable final String cropName) { final VariableFilter variableFilter = new VariableFilter(); variableFilter.addPropertyId(TermId.INVENTORY_AMOUNT_PROPERTY.getId()); final List<VariableDetails> units = this.variableService.getVariablesByFilter(variableFilter); <START> Set<Integer> locationTypes =new HashSet<>(); <END> locationTypes.add(1500); final List<LocationDto> locations = locationService.getLocations(locationTypes, null, false, null); final File file = this.lotExcelTemplateExportServiceImpl.export(locations, units); final HttpHeaders headers = new HttpHeaders(); headers .add(HttpHeaders.CONTENT_DISPOSITION, String.format("attachment; filename=%s", FileUtils.sanitizeFileName(file.getName()))); final FileSystemResource fileSystemResource = new FileSystemResource(file); return new ResponseEntity<>(fileSystemResource, headers, HttpStatus.OK); }</code><technical_language>Create a constant private static final Set<Integer> STORAGE_LOCATION_TYPE = new HashSet<>(Arrays.asList(1500)); calling getLocations</technical_language>

Target:
public ResponseEntity<FileSystemResource> getTemplate(@PathVariable final String cropName) { final VariableFilter variableFilter = new VariableFilter(); variableFilter.addPropertyId(TermId.INVENTORY_AMOUNT_PROPERTY.getId()); final List<VariableDetails> units = this.variableService.getVariablesByFilter(variableFilter); final List<LocationDto> locations = locationService.getLocations(LotResource.STORAGE_LOCATION_TYPE, null, false, null); final File file = this.lotTemplateExportServiceImpl.export(locations, units); final HttpHeaders headers = new HttpHeaders(); headers .add(HttpHeaders.CONTENT_DISPOSITION, String.format("attachment; filename=%s", FileUtils.sanitizeFileName(file.getName()))); final FileSystemResource fileSystemResource = new FileSystemResource(file); return new ResponseEntity<>(fileSystemResource, headers, HttpStatus.OK); }
Source:
<code>public static ArrayList<String> teamKeys(JsonArray teamsJson) { <START> ArrayList<String> teamKeys = new ArrayList<>(); <END> for (int i = 0; i < teamsJson.size(); i++) { teamKeys.add(teamsJson.get(i).getAsString()); } return teamKeys; }</code><technical_language>Shoot, forgot reviewable reply inline. Yeah, a good change</technical_language>

Target:
public static ArrayList<String> teamKeys(JsonArray teamsJson) { ArrayList<String> teamKeys = new ArrayList<>(teamsJson.size()); for (JsonElement key : teamsJson) { teamKeys.add(key.getAsString()); } return teamKeys; }
Source:
<code>private boolean validateCommit(byte[] commit) { boolean returnValue = true; for (int offset = 0; returnValue && offset < commit.length; offset++) { int lineEnd = 0; for (lineEnd = offset; lineEnd < commit.length && commit[lineEnd] != '\n'; <START> lineEnd++); <END> switch (commit[offset]) { case 'a': case 'c': returnValue = validateLine(commit, offset, lineEnd); break; case 't': case 'p': break; default: return returnValue; } offset = lineEnd; } return returnValue; }</code><technical_language>Replace Also, wrap this line</technical_language>

Target:
private boolean validateCommit(byte[] commit) { boolean returnValue = true; for (int offset = 0; returnValue && offset < commit.length; offset++) { int lineEnd = 0; for (lineEnd = offset; lineEnd < commit.length && commit[lineEnd] != '\n'; lineEnd++) {}; switch (commit[offset]) { case 'a': case 'c': returnValue = validateLine(commit, offset, lineEnd); break; case 't': case 'p': break; default: return returnValue; } offset = lineEnd; } return returnValue; }
Source:
<code>public void testHttpIngestionPartialInvalidCollectionTime() throws Exception { String postfix = getPostfix(); long validTime = System.currentTimeMillis(); long pastTime = System.currentTimeMillis() - TIME_DIFF_MS - Configuration.getInstance().getLongProperty( CoreConfig.BEFORE_CURRENT_COLLECTIONTIME_MS ); long futureTime = System.currentTimeMillis() + TIME_DIFF_MS + Configuration.getInstance().getLongProperty( CoreConfig.AFTER_CURRENT_COLLECTIONTIME_MS ); String jsonBody = getJsonFromFile("sample_multi_partial_invalid_payload.json", postfix); jsonBody = updateTimeStampJson(jsonBody, "\"%TIMESTAMP%\"", validTime); jsonBody = updateTimeStampJson(jsonBody, "\"%PAST_TIMESTAMP%\"", pastTime); jsonBody = updateTimeStampJson(jsonBody, "\"%FUTURE_TIMESTAMP%\"", futureTime); jsonBody = jsonBody.replaceAll("%TENANT_ID_.%", TID); HttpResponse response = httpPost( TID, postMultiPath, jsonBody ); String[] output = getBodyArray( response ); try { assertEquals("Should get status 207 from ingestion server for POST with invalid collectionTime", 207, response.getStatusLine().getStatusCode() ); assertEquals( 4, output.length ); <START> assertTrue( Pattern.matches( PAST_COLLECTION_TIME_REGEX, output[ 1 ] ) ); <END> assertTrue( Pattern.matches( PAST_COLLECTION_TIME_REGEX, output[ 2 ] ) ); assertTrue( Pattern.matches( FUTURE_COLLECTION_TIME_REGEX, output[ 3 ] ) ); } finally { EntityUtils.consume( response.getEntity() ); } }</code><technical_language>I thought empty response</technical_language>

Target:
public void testHttpIngestionPartialInvalidCollectionTime() throws Exception { String postfix = getPostfix(); long validTime = System.currentTimeMillis(); long pastTime = System.currentTimeMillis() - TIME_DIFF_MS - Configuration.getInstance().getLongProperty( CoreConfig.BEFORE_CURRENT_COLLECTIONTIME_MS ); long futureTime = System.currentTimeMillis() + TIME_DIFF_MS + Configuration.getInstance().getLongProperty( CoreConfig.AFTER_CURRENT_COLLECTIONTIME_MS ); String jsonBody = getJsonFromFile("sample_multi_payload_with_different_time.json", postfix); jsonBody = updateTimeStampJson(jsonBody, "\"%TIMESTAMP_1%\"", validTime); jsonBody = updateTimeStampJson(jsonBody, "\"%TIMESTAMP_2%\"", pastTime); jsonBody = updateTimeStampJson(jsonBody, "\"%TIMESTAMP_3%\"", futureTime); jsonBody = jsonBody.replaceAll("%TENANT_ID_.%", TID); HttpResponse response = httpPost( TID, postMultiPath, jsonBody ); String[] output = getBodyArray( response ); try { assertEquals("Should get status 207 from " + String.format(postMultiPath, TID), 207, response.getStatusLine().getStatusCode() ); assertEquals("", output[0]); } finally { EntityUtils.consume( response.getEntity() ); } }
Source:
<code>private static boolean areParametersSame(Method method, Method targetMethod) { Class<?>[] methodTypes = method.getParameterTypes(); Class<?>[] targetMethodTypes = targetMethod.getParameterTypes(); int i = -1; if (methodTypes.length == targetMethodTypes.length) { for (Class<?> clz : methodTypes) { <START> i++; <END> if (clz.equals(targetMethodTypes[i].getClass())) { continue; } else { return false; } } return true; } return false; }</code><technical_language>this is weird =/ a normal for statement i counter then</technical_language>

Target:
private static boolean areParametersSame(Method method, Method targetMethod) { Class<?>[] methodTypes = method.getParameterTypes(); Class<?>[] targetMethodTypes = targetMethod.getParameterTypes(); if (methodTypes.length == targetMethodTypes.length) { for (int i = 0; i< methodTypes.length; i++) { if (methodTypes[i].getName().equals(targetMethodTypes[i].getName())) { continue; } else { return false; } } return true; } return false; }
Source:
<code>private static int numericalCompare(String i, String j) { <START> Number number1 = toNumber(i); <END> Number number2 = toNumber(j); if (number1 == null || number2 == null) { return 0; } else if (number1 instanceof Double || number2 instanceof Double || number1 instanceof Float || number2 instanceof Float) { return Double.compare(number1.doubleValue(), number2.doubleValue()); } return Long.compare(number1.longValue(), number2.longValue()); }</code><technical_language>If number1 is null, return 0 early</technical_language>

Target:
private static int numericalCompare(String i, String j) { Number number1 = toNumber(i); if (number1 == null) { return 0; } Number number2 = toNumber(j); if (number2 == null) { return 0; } else if (number1 instanceof Double || number2 instanceof Double || number1 instanceof Float || number2 instanceof Float) { return Double.compare(number1.doubleValue(), number2.doubleValue()); } return Long.compare(number1.longValue(), number2.longValue()); }
Source:
<code><START> @Override public boolean equals(Object o) { <END> LinkedList<Object> linkedList = new LinkedList<Object>(); linkedList.add(o); return validate().litems.equals(linkedList); }</code><technical_language>This is right. checking equality of map, of list: <LINK_0></technical_language>

Target:
@Override public boolean equals(Object o) { return validate().linkedListItems.equals(o); }
Source:
<code>public void setUp() { <START> ReflectionTestUtils.setField(service, "dataBucketName", dataBucketName); <END> ReflectionTestUtils.setField(service, "stateBucketName", stateBucketName); ReflectionTestUtils.setField(service, "dataDir", dataDir); ReflectionTestUtils.setField(service, "bucketPoolSize", 5); ReflectionTestUtils.setField(service, "bucketKeySize", 2); ReflectionTestUtils.setField(service, "expiration", 7); ReflectionTestUtils.setField(service, "urlGenerator", new AmazonURLGenerator()); ReflectionTestUtils.setField(service, "partCalculator", new SimplePartCalculator(20000)); }</code><technical_language>This a smell. this done mocking</technical_language>

Target:
public void setUp() { namingService.setObjectBucketName(objectBucketName); namingService.setStateBucketName(stateBucketName); namingService.setBucketPoolSize(16); namingService.setBucketKeySize(3); service.setBucketNamingService(namingService); ReflectionTestUtils.setField(service, "dataDir", dataDir); ReflectionTestUtils.setField(service, "expiration", 7); ReflectionTestUtils.setField(service, "urlGenerator", new AmazonURLGenerator()); ReflectionTestUtils.setField(service, "partCalculator", new SimplePartCalculator(20000)); }
Source:
<code>private boolean deleteDataSources(Manifest manifest, List<DataSource> dataSources) { final Path dataSourcePath = manifest.getDataSourcePath(); progress.progress(Bundle.DeleteCaseTask_progress_deletingDataSource(dataSourcePath)); logger.log(Level.INFO, String.format("Deleting data source %s from %s", dataSourcePath, caseNodeData.getDisplayName())); Set<Path> filesToDelete = new HashSet<>(); <START> int index = 0; <END> while (index < dataSources.size() && filesToDelete.isEmpty()) { DataSource dataSource = dataSources.get(index); if (dataSource instanceof Image) { Image image = (Image) dataSource; String[] imageFilePaths = image.getPaths(); for (String imageFilePath : imageFilePaths) { Path candidatePath = Paths.get(imageFilePath); if (candidatePath.equals(dataSourcePath)) { for (String path : imageFilePaths) { filesToDelete.add(Paths.get(path)); } break; } } } } filesToDelete.add(dataSourcePath); boolean allFilesDeleted = true; for (Path path : filesToDelete) { File fileOrDir = path.toFile(); if (fileOrDir.exists() && !FileUtil.deleteFileDir(fileOrDir)) { allFilesDeleted = false; logger.log(Level.WARNING, String.format("Failed to delete data source file at %s for %s", path, caseNodeData.getDisplayName())); } } return allFilesDeleted; }</code><technical_language>index get updated</technical_language>

Target:
private boolean deleteDataSources(Manifest manifest, List<DataSource> dataSources) { final Path dataSourcePath = manifest.getDataSourcePath(); progress.progress(Bundle.DeleteCaseTask_progress_deletingDataSource(dataSourcePath)); logger.log(Level.INFO, String.format("Deleting data source %s from %s", dataSourcePath, caseNodeData.getDisplayName())); Set<Path> filesToDelete = new HashSet<>(); int index = 0; while (index < dataSources.size() && filesToDelete.isEmpty()) { DataSource dataSource = dataSources.get(index); if (dataSource instanceof Image) { Image image = (Image) dataSource; String[] imageFilePaths = image.getPaths(); for (String imageFilePath : imageFilePaths) { Path candidatePath = Paths.get(imageFilePath); if (candidatePath.equals(dataSourcePath)) { for (String path : imageFilePaths) { filesToDelete.add(Paths.get(path)); } break; } } } ++index; } filesToDelete.add(dataSourcePath); boolean allFilesDeleted = true; for (Path path : filesToDelete) { File fileOrDir = path.toFile(); if (fileOrDir.exists() && !FileUtil.deleteFileDir(fileOrDir)) { allFilesDeleted = false; logger.log(Level.WARNING, String.format("Failed to delete data source file at %s for %s", path, caseNodeData.getDisplayName())); } } return allFilesDeleted; }
Source:
<code>protected Pair<Integer, Integer> computeStartEnd(int cardinality) { int startIndex = ignoreFirstN; if (previousStop != null && idLookup != null) { <START> int lookupId = idLookup.lookupId(previousStop) + 1; <END> if (lookupId < 0) { lookupId *= -1; } if (lookupId > ignoreFirstN + keepOnlyN) { startIndex = ignoreFirstN + keepOnlyN; } else { startIndex = Math.max(lookupId, startIndex); } } int endIndex = Math.min(ignoreFirstN + keepOnlyN, cardinality); if (ignoreAfterThreshold && query.getDimensionsFilter() == null) { endIndex = Math.min(endIndex, startIndex + query.getThreshold()); } return Pair.of(startIndex, endIndex); }</code><technical_language>This lookupId done blindly before, skipped if idLookup is null. skip throw exception if idLookup is null</technical_language>

Target:
protected Pair<Integer, Integer> computeStartEnd(int cardinality) { int startIndex = ignoreFirstN; if (previousStop != null) { if (idLookup == null) { throw new UnsupportedOperationException("Only DimensionSelectors which support idLookup() are supported yet"); } int lookupId = idLookup.lookupId(previousStop) + 1; if (lookupId < 0) { lookupId *= -1; } if (lookupId > ignoreFirstN + keepOnlyN) { startIndex = ignoreFirstN + keepOnlyN; } else { startIndex = Math.max(lookupId, startIndex); } } int endIndex = Math.min(ignoreFirstN + keepOnlyN, cardinality); if (ignoreAfterThreshold && query.getDimensionsFilter() == null) { endIndex = Math.min(endIndex, startIndex + query.getThreshold()); } return Pair.of(startIndex, endIndex); }