auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void updateDNS() { synchronized (sync) { if (shutdown) { return; } long ttl = Integer.MAX_VALUE; try { List<LookupResult> lookupResults = srvResolver.resolve(srvRecord); List<HostAndPort> hosts = Lists.newArrayListWithCapacity(lookupResults.size()); for (LookupResult lookupResult : lookupResults) { hosts.add(HostAndPort.fromParts(lookupResult.host(), lookupResult.port())); ttl = Math.min(ttl, lookupResult.ttl()); } List<HostAndPort> newAddresses = Ordering.from(HostAndPortComparator.INSTANCE) .sortedCopy(hosts); if (!newAddresses.equals(addresses)) { addresses = newAddresses; log.info("Connecting to " + newAddresses); List<AddressAndClient> addressAndClients = getAddressesAndClients(newAddresses); setPendingClient(addressAndClients); } } finally { long delay = clamp(MIN_DNS_WAIT_TIME, MAX_DNS_WAIT_TIME, ttl); <START> refreshJob = this.executor.schedule(refreshRunnable, delay, TimeUnit.SECONDS); <END> } } }</code><technical_language>wait 1 hour attempting resolve if records found. happen time time in prod due infra breakage. a special case retry earlier records found</technical_language>

Target:
public void updateDNS() { synchronized (sync) { if (shutdown) { return; } long ttl = TimeUnit.SECONDS.convert(period, periodUnit); try { List<LookupResult> lookupResults = srvResolver.resolve(srvRecord); List<HostAndPort> hosts = Lists.newArrayListWithCapacity(lookupResults.size()); for (LookupResult lookupResult : lookupResults) { hosts.add(HostAndPort.fromParts(lookupResult.host(), lookupResult.port())); ttl = Math.min(ttl, lookupResult.ttl()); } List<HostAndPort> newAddresses = Ordering.from(HostAndPortComparator.INSTANCE) .sortedCopy(hosts); if (!newAddresses.equals(addresses)) { addresses = newAddresses; log.info("Connecting to " + newAddresses); List<AddressAndClient> addressAndClients = getAddressesAndClients(newAddresses); setPendingClient(addressAndClients); } } finally { long delay = clamp(MIN_DNS_WAIT_TIME, MAX_DNS_WAIT_TIME, ttl); refreshJob = this.executor.schedule(refreshRunnable, delay, TimeUnit.SECONDS); } } }
Source:
<code>public void testReplaceAtHeadSucceedsMappingExistsHeadMatches() { ServerStore store = newStore(); populateStore(store); Chain existingMapping = store.get(1); store.append(1, getPayload(11)); store.replaceAtHead(1, existingMapping, chainBuilder.build(compactChain(existingMapping, getPayload(111)))); Chain chain = store.get(1); Iterator<Element> elements = chain.iterator(); <START> assertThat(readPayLoad(elements.next().getPayload()), is(Long.valueOf(111))); <END> assertThat(readPayLoad(elements.next().getPayload()), is(Long.valueOf(11))); store.append(2, getPayload(22)); existingMapping = store.get(2); store.append(2, getPayload(222)); store.replaceAtHead(2, existingMapping, chainBuilder.build(compactChain(existingMapping, getPayload(2222)))); chain = store.get(2); elements = chain.iterator(); assertThat(readPayLoad(elements.next().getPayload()), is(Long.valueOf(2222))); assertThat(readPayLoad(elements.next().getPayload()), is(Long.valueOf(222))); }</code><technical_language>this wrong? list replaceAtHead was: [1, 11], replace ([1], [111]), result [111, 11], right? iterator in reverse order [11] [111]. I confused</technical_language>

Target:
public void testReplaceAtHeadSucceedsMappingExistsHeadMatches() { ServerStore store = newStore(); populateStore(store); Chain existingMapping = store.get(1); store.append(1, createPayload(11)); store.replaceAtHead(1, existingMapping, chainBuilder.build(elementBuilder.build(createPayload(111)))); Chain chain = store.get(1); assertChainAndReverseChainOnlyHave(chain, 111, 11); store.append(2, createPayload(22)); existingMapping = store.get(2); store.append(2, createPayload(222)); store.replaceAtHead(2, existingMapping, chainBuilder.build(elementBuilder.build(createPayload(2222)))); chain = store.get(2); assertChainAndReverseChainOnlyHave(chain, 2222, 222); }
Source:
<code>public Object execute(ComplexEvent event) { try { Boolean condition = (attributeExpressionExecutors[0].execute(event) != null <START> && attributeExpressionExecutors[0].execute(event).equals(Boolean.TRUE)); <END> return execute( new Object[]{ condition, (condition) ? attributeExpressionExecutors[1].execute(event) : null, (!condition) ? attributeExpressionExecutors[2].execute(event) : null } ); } catch (Exception e) { log.error("Exception on execution plan '" + executionPlanContext.getName() + "' on class '" + this.getClass().getName() + "', " + e.getMessage(), e); return null; } }</code><technical_language>remove condition condition vise versa null is handled automatically</technical_language>

Target:
public Object execute(ComplexEvent event) { try { Boolean condition = Boolean.TRUE.equals(attributeExpressionExecutors[0].execute(event)); return execute( new Object[]{ condition, (condition) ? attributeExpressionExecutors[1].execute(event) : null, (!condition) ? attributeExpressionExecutors[2].execute(event) : null } ); } catch (Exception e) { log.error("Exception on execution plan '" + executionPlanContext.getName() + "' on class '" + this.getClass().getName() + "', " + e.getMessage(), e); return null; } }
Source:
<code>protected @NonNull List<IMarkerEvent> getViewMarkerList(long startTime, long endTime, long resolution, @NonNull IProgressMonitor monitor) { ITimeGraphEntry[] expandedElements = getTimeGraphViewer().getExpandedElements(); List<IMarkerEvent> markers = new ArrayList<>(); for (ITimeGraphEntry element : expandedElements) { if (((TimeGraphEntry) element).getModel() instanceof SpanLifeEntryModel) { SpanLifeEntryModel model = (SpanLifeEntryModel) ((TimeGraphEntry) element).getModel(); for (LogEvent log : model.getLogs()) { markers.add(new SpanMarkerEvent(element, log.getTime(), MARKER_COLOR, log.getType())); } <START> if (model.getErrorTag()) { markers.add(new SpanMarkerEvent(element, model.getStartTime(), MARKER_COLOR, "error.object")); } <END> } } return markers; }</code><technical_language>Remove this if postdraw for entries</technical_language>

Target:
protected @NonNull List<IMarkerEvent> getViewMarkerList(long startTime, long endTime, long resolution, @NonNull IProgressMonitor monitor) { ITimeGraphEntry[] expandedElements = getTimeGraphViewer().getExpandedElements(); List<IMarkerEvent> markers = new ArrayList<>(); for (ITimeGraphEntry element : expandedElements) { if (((TimeGraphEntry) element).getModel() instanceof SpanLifeEntryModel) { SpanLifeEntryModel model = (SpanLifeEntryModel) ((TimeGraphEntry) element).getModel(); for (LogEvent log : model.getLogs()) { markers.add(new SpanMarkerEvent(element, log.getTime(), MARKER_COLOR, log.getType())); } } } return markers; }
Source:
<code>protected InstructorAttributes getInstructorOfCourseFromRequest(String courseId) { <START> if (userInfo == null || !userInfo.isInstructor) { <END> throw new UnauthorizedAccessException("Instructor account is required to access this resource"); } String moderatedPerson = getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_MODERATED_PERSON); String previewAsPerson = getRequestParamValue(Const.ParamsNames.PREVIEWAS); if (!StringHelper.isEmpty(moderatedPerson)) { return logic.getInstructorForEmail(courseId, moderatedPerson); } else if (!StringHelper.isEmpty(previewAsPerson)) { return logic.getInstructorForEmail(courseId, previewAsPerson); } else { return logic.getInstructorForGoogleId(courseId, userInfo.getId()); } }</code><technical_language>reason here. > Actually, I is method's responsibility verify instructor privilege here. long pre-condition for getInstructorOfCourseFromRequest is fulfilled, executed. - login check verified L110 (where delete code) - caller method verify entity is instructor (I is checkAccessControlForInstructorFeedbackSubmission)</technical_language>

Target:
protected InstructorAttributes getInstructorOfCourseFromRequest(String courseId) { String moderatedPerson = getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_MODERATED_PERSON); String previewAsPerson = getRequestParamValue(Const.ParamsNames.PREVIEWAS); if (!StringHelper.isEmpty(moderatedPerson)) { return logic.getInstructorForEmail(courseId, moderatedPerson); } else if (!StringHelper.isEmpty(previewAsPerson)) { return logic.getInstructorForEmail(courseId, previewAsPerson); } else { gateKeeper.verifyLoggedInUserPrivileges(); return logic.getInstructorForGoogleId(courseId, userInfo.getId()); } }
Source:
<code>public static boolean renameFile(File src, File dst){ boolean renamed = false; Path srcPath = Paths.get(src.toURI()); Path dstPath = Paths.get(dst.toURI()); Path moved = null; try{ moved = Files.move(srcPath, dstPath, StandardCopyOption.ATOMIC_MOVE); } catch (Exception e){ if(log.isWarnEnabled()){ <START> log.warn("An error occurred when executing atomic file renaming. Falling back to the old File.renameTo() method", e); <END> } } if(moved == null || !Files.exists(moved)){ renamed = src.renameTo(dst); } else { renamed = true; } return renamed; }</code><technical_language>Logging this time fails lead a lot of log bloat. track of this warning emitted warn time</technical_language>

Target:
public static boolean renameFile(File src, File dst){ boolean renamed = false; Path srcPath = Paths.get(src.toURI()); Path dstPath = Paths.get(dst.toURI()); Path moved = null; try{ moved = Files.move(srcPath, dstPath, StandardCopyOption.ATOMIC_MOVE); } catch (Exception e){ if(log.isDebugEnabled()){ log.debug("An error occurred when executing atomic file renaming. Falling back to the old File.renameTo() method", e); } } if(moved == null || !Files.exists(moved)){ renamed = src.renameTo(dst); } else { renamed = true; } return renamed; }
Source:
<code>public String toString() { <START> return this.getClass().getSimpleName() + ": " + mode; <END> }</code><technical_language>this hard ourselves, put IF statement generate: SetWireframeTask : enable wireframe / SetWireframeTask : disable wireframe in log. want get opengl manual understand is on. =)</technical_language>

Target:
public String toString() { String status = "disabled"; if (mode == ENABLED) { status = "enabled"; } return String.format("%s: wireframe %s", this.getClass().getSimpleName(), status); }
Source:
<code><START> public AsyncFutureImpl<Executable> getStartCondition() { <END> return start; }</code><technical_language>Strictly speaking this is unnecessary start accessed setAsCancelled directly</technical_language>

Target:
public Future<Executable> getStartCondition() { return start; }
Source:
<code>public void onlyOneGroupIfNoSuicideOnHit() { final List<Unit> units = List.of( givenUnitWithSuicideOnHit("type1", false), givenUnitWithSuicideOnHit("type2", false)); final List<FiringGroup> groups = FiringGroup.groupBySuicideOnHit("test", units, List.of(mock(Unit.class))); <START> assertThat("There should only be one group", groups, hasSize(1)); <END> assertThat("The group name should have no prefix", groups.get(0).getDisplayName(), is("test")); assertThat( "The group should have all of the units", groups.get(0).getFiringUnits().toArray(), is(units.toArray())); assertThat("The group should not be suicide on hit", groups.get(0).isSuicideOnHit(), is(false)); }</code><technical_language>nit, assertion hasSize(1) group, is is why</technical_language>

Target:
public void onlyOneGroupIfNoSuicideOnHit() { final List<Unit> units = List.of(givenUnit(givenUnitType("type1")), givenUnit(givenUnitType("type2"))); final List<FiringGroup> groups = FiringGroup.groupBySuicideOnHit(GROUP_NAME, units, List.of(mock(Unit.class))); assertThat("All non-suicide units are in a single group", groups, hasSize(1)); assertThat( "The group name should have no prefix", groups.get(0).getDisplayName(), is(GROUP_NAME)); assertThat( "The group should have all of the units", groups.get(0).getFiringUnits().toArray(), is(units.toArray())); assertThat("The group should not be suicide on hit", groups.get(0).isSuicideOnHit(), is(false)); }
Source:
<code>private void insertToByteArray(byte[] array, int pos) <START> { <END> if (pos < 0 || (pos + 6) > array.length) { throw new IllegalArgumentException("Illegal offset ("+pos+"), need room for 6 bytes"); } int i = (int) (_address >> 32); array[pos++] = (byte) (i >> 8); array[pos++] = (byte) i; i = (int) _address; array[pos++] = (byte) (i >> 24); array[pos++] = (byte) (i >> 16); array[pos++] = (byte) (i >> 8); array[pos] = (byte) i; }</code><technical_language>Check formatting.</technical_language>

Target:
private void insertToByteArray(byte[] array, int pos) { if (pos < 0 || (pos + 6) > array.length) { throw new IllegalArgumentException("Illegal offset (" + pos + "), need room for 6 bytes"); } int i = (int) (address >> 32); array[pos++] = (byte) (i >> 8); array[pos++] = (byte) i; i = (int) address; array[pos++] = (byte) (i >> 24); array[pos++] = (byte) (i >> 16); array[pos++] = (byte) (i >> 8); array[pos] = (byte) i; }
Source:
<code>private void compare(ByteString a, ByteString b) { Assert.assertTrue(underTest.compare(a, b) < 0); Assert.assertTrue(underTest.compare(b, a) > 0); Assert.assertTrue(underTest.compare(b, b) == 0); <START> Assert.assertTrue("test", false); <END> }</code><technical_language>Please remove this committing</technical_language>

Target:
private void compare(ByteString a, ByteString b) { Assert.assertTrue(underTest.compare(a, b) < 0); Assert.assertTrue(underTest.compare(b, a) > 0); Assert.assertTrue(underTest.compare(b, b) == 0); }
Source:
<code>public void whenExpectingAssumptionViolatedExceptionStatementsPassingShouldFail() throws Exception { ExpectException expectException = new ExpectException(new PassingStatement(), AssumptionViolatedException.class); try { expectException.evaluate(); <START> fail("ExpectException should throw when the given statement passes"); <END> } catch (AssertionError e) { assertThat(e.getMessage(), containsString("Expected exception: " + AssumptionViolatedException.class.getName())); } }</code><technical_language>This call throws AssertionError this work. want: try { expectException.evaluate(); } catch (AssertionError e) { assertThat(e.getMessage(), containsString("Expected exception: " + AssumptionViolatedException.class.getName())); return; } fail("ExpectException throw statement passes");</technical_language>

Target:
public void whenExpectingAssumptionViolatedExceptionStatementsPassingShouldFail() throws Exception { ExpectException expectException = new ExpectException(new PassingStatement(), AssumptionViolatedException.class); try { expectException.evaluate(); } catch (AssertionError e) { assertThat(e.getMessage(), containsString("Expected exception: " + AssumptionViolatedException.class.getName())); return; } fail("ExpectException should throw when the given statement passes"); }
Source:
<code>public void whenMixedStreamsThenPartitionsAssignedCorrectly() throws IOException, InterruptedException { final TestStreamingClient autoClient1 = new TestStreamingClient(URL, subscription.getId(), ""); autoClient1.start(); final TestStreamingClient autoClient2 = new TestStreamingClient(URL, subscription.getId(), ""); autoClient2.start(); final TestStreamingClient directClient1 = new TestStreamingClient(URL, subscription.getId(), "", Optional.empty(), Optional.of("{\"partitions\":[" + "{\"event_type\":\"" + eventType.getName() + "\",\"partition\":\"6\"}]}")); directClient1.start(); final TestStreamingClient directClient2 = new TestStreamingClient(URL, subscription.getId(), "", Optional.empty(), Optional.of("{\"partitions\":[" + "{\"event_type\":\"" + eventType.getName() + "\",\"partition\":\"7\"}]}")); directClient2.start(); <START> Thread.sleep(1000); <END> publishBusinessEventWithUserDefinedPartition( eventType.getName(), 16, x -> "blah" + x, x -> String.valueOf(x % 8)); waitFor(() -> assertThat(directClient1.getBatches(), hasSize(2))); checkAllEventsAreFromPartitions(directClient1, ImmutableSet.of("6")); waitFor(() -> assertThat(directClient2.getBatches(), hasSize(2))); checkAllEventsAreFromPartitions(directClient2, ImmutableSet.of("7")); waitFor(() -> assertThat(autoClient1.getBatches(), hasSize(6))); waitFor(() -> assertThat(autoClient2.getBatches(), hasSize(6))); }</code><technical_language>This is a bit brittle, I a waitFor() end of rebalance (as opposed waiting for some time, hoping rebalance finished)</technical_language>

Target:
public void whenMixedStreamsThenPartitionsAssignedCorrectly() throws IOException, InterruptedException { final TestStreamingClient autoClient1 = new TestStreamingClient(URL, subscription.getId(), ""); autoClient1.start(); final TestStreamingClient autoClient2 = new TestStreamingClient(URL, subscription.getId(), ""); autoClient2.start(); final TestStreamingClient directClient1 = new TestStreamingClient(URL, subscription.getId(), "", Optional.empty(), Optional.of("{\"partitions\":[" + "{\"event_type\":\"" + eventType.getName() + "\",\"partition\":\"6\"}]}")); directClient1.start(); final TestStreamingClient directClient2 = new TestStreamingClient(URL, subscription.getId(), "", Optional.empty(), Optional.of("{\"partitions\":[" + "{\"event_type\":\"" + eventType.getName() + "\",\"partition\":\"7\"}]}")); directClient2.start(); waitFor(() -> assertThat(getNumberOfAssignedStreams(subscription.getId()), is(4))); publishBusinessEventWithUserDefinedPartition( eventType.getName(), 16, x -> "blah" + x, x -> String.valueOf(x % 8)); waitFor(() -> assertThat(directClient1.getBatches(), hasSize(2))); checkAllEventsAreFromPartitions(directClient1, ImmutableSet.of("6")); waitFor(() -> assertThat(directClient2.getBatches(), hasSize(2))); checkAllEventsAreFromPartitions(directClient2, ImmutableSet.of("7")); waitFor(() -> assertThat(autoClient1.getBatches(), hasSize(6))); waitFor(() -> assertThat(autoClient2.getBatches(), hasSize(6))); }
Source:
<code><START> public static Class<?> loadActualJavaType(String javaTypeName, ManagementContext mgmt, RegisteredType type, RegisteredTypeLoadingContext context) throws Exception { <END> Class<?> result = ((BasicRegisteredType)type).getCache().get(ACTUAL_JAVA_TYPE); if (result!=null) return result; result = CatalogUtils.newClassLoadingContext(mgmt, type, context==null ? null : context.getLoader()).loadClass( javaTypeName ); Preconditions.checkNotNull(result, "Could not load class "+javaTypeName+"; returned null (should have thrown a different exception!)"); ((BasicRegisteredType)type).getCache().put(ACTUAL_JAVA_TYPE, result); return result; }</code><technical_language>throws Exception is needed</technical_language>

Target:
public static Class<?> loadActualJavaType(String javaTypeName, ManagementContext mgmt, RegisteredType type, RegisteredTypeLoadingContext context) { Class<?> result = ((BasicRegisteredType)type).getCache().get(ACTUAL_JAVA_TYPE); if (result!=null) return result; result = CatalogUtils.newClassLoadingContext(mgmt, type, context==null ? null : context.getLoader()).loadClass( javaTypeName ); ((BasicRegisteredType)type).getCache().put(ACTUAL_JAVA_TYPE, result); return result; }
Source:
<code>public void init() throws FalconException { String listenerClassNames = StartupProperties.get(). getProperty("feedAlert.listeners"); for (String listenerClassName : listenerClassNames.split(",")) { listenerClassName = listenerClassName.trim(); if (listenerClassName.isEmpty()) { continue; } FeedSLAAlert listener = ReflectionUtils.getInstanceByClassName(listenerClassName); registerListener(listener); } ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1); <START> executor.scheduleWithFixedDelay(new Monitor(), 0, 20, TimeUnit.SECONDS); <END> }</code><technical_language>reason do this more eagerly "feed.sla.statusCheck.frequency.seconds". same, but, start a delay, this runs a Pending Instances is populated</technical_language>

Target:
public void init() throws FalconException { String listenerClassNames = StartupProperties.get(). getProperty("feedAlert.listeners"); for (String listenerClassName : listenerClassNames.split(",")) { listenerClassName = listenerClassName.trim(); if (listenerClassName.isEmpty()) { continue; } EntitySLAListener listener = ReflectionUtils.getInstanceByClassName(listenerClassName); registerListener(listener); } String freq = StartupProperties.get().getProperty("feed.sla.statusCheck.frequency.seconds", "600"); int statusCheckFrequencySeconds = Integer.parseInt(freq); ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1); executor.scheduleWithFixedDelay(new Monitor(), 0, statusCheckFrequencySeconds + 10, TimeUnit.SECONDS); }
Source:
<code>public String toString() { return "DropwizardEmitterConfig{" + "reporters=" + reporters + ", prefix='" + prefix + '\'' + ", includeHost=" + includeHost + <START> ", dimensionMapPath='" + dimensionMapPath + '\'' + <END> ", alertEmitters=" + alertEmitters + ", maxGaugeCount=" + maxGaugeCount + '}'; }</code><technical_language>toString() is implemented for DropwizardReporters</technical_language>

Target:
public String toString() { return "DropwizardEmitterConfig{" + "reporters=" + reporters + ", prefix='" + prefix + '\'' + ", includeHost=" + includeHost + ", dimensionMapPath='" + dimensionMapPath + '\'' + ", alertEmitters=" + alertEmitters + ", maxMetricsRegistrySize=" + maxMetricsRegistrySize + '}'; }
Source:
<code>protected Collection<Integer> translateForStreamingInternal( <START> final BroadcastStateTransformation<IN1, IN2, OUT> transformation, <END> final Context context) { checkNotNull(transformation); checkNotNull(context); final TypeInformation<IN1> nonBroadcastTypeInfo = transformation.getNonBroadcastStream().getType(); final TypeInformation<IN2> broadcastTypeInfo = transformation.getBroadcastStream().getType(); final StreamGraph streamGraph = context.getStreamGraph(); final String slotSharingGroup = context.getSlotSharingGroup(); final int transformationId = transformation.getId(); final ExecutionConfig executionConfig = streamGraph.getExecutionConfig(); streamGraph.addCoOperator( transformationId, slotSharingGroup, transformation.getCoLocationGroupKey(), transformation.getOperatorFactory(), nonBroadcastTypeInfo, broadcastTypeInfo, transformation.getOutputType(), transformation.getName()); if (transformation.getKeySelector() != null) { final TypeSerializer<?> keySerializer = transformation.getStateKeyType().createSerializer(executionConfig); streamGraph.setTwoInputStateKey( transformationId, transformation.getKeySelector(), null, keySerializer); } final int parallelism = transformation.getParallelism() != ExecutionConfig.PARALLELISM_DEFAULT ? transformation.getParallelism() : executionConfig.getParallelism(); streamGraph.setParallelism(transformationId, parallelism); streamGraph.setMaxParallelism(transformationId, transformation.getMaxParallelism()); for (Integer inputId: context.getStreamNodeIds(transformation.getNonBroadcastStream().getTransformation())) { streamGraph.addEdge(inputId, transformationId, 1); } for (Integer inputId: context.getStreamNodeIds(transformation.getBroadcastStream().getTransformation())) { streamGraph.addEdge(inputId, transformationId, 2); } return Collections.singleton(transformationId); }</code><technical_language>unify this BroadcastStateTransformationTranslator TwoInputTransformationTranslator? entire method is identical in classes (minus checking for keySelector in a single input, version TwoInputTransformationTranslator work well.) a similar AbstractOneInputTransformationTranslator</technical_language>

Target:
protected Collection<Integer> translateForStreamingInternal( final BroadcastStateTransformation<IN1, IN2, OUT> transformation, final Context context) { checkNotNull(transformation); checkNotNull(context); return translateInternal( transformation, transformation.getNonBroadcastStream(), transformation.getBroadcastStream(), transformation.getOperatorFactory(), transformation.getStateKeyType(), transformation.getKeySelector(), null, context); }
Source:
<code>protected IStatus run(IProgressMonitor monitor) { projects.stream().forEach(MarkerUtils::deleteChangeSetIssuesMarkers); List<Job> jobs = new ArrayList<>(); for (IProject project : projects) { <START> AnalyzeProjectRequest req = new AnalyzeProjectRequest(project, collectChangedFiles(project, monitor), TriggerType.CHANGESET); <END> AnalyzeProjectJob job = new AnalyzeProjectJob(req); job.schedule(); jobs.add(job); } jobs.stream().forEach(j -> { try { j.join(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } }); return Status.OK_STATUS; }</code><technical_language>if collectChangedFiles returns empty list, simply continue</technical_language>

Target:
protected IStatus run(IProgressMonitor monitor) { projects.stream().forEach(MarkerUtils::deleteChangeSetIssuesMarkers); List<Job> jobs = new ArrayList<>(); for (IProject project : projects) { if (monitor.isCanceled()) { break; } Collection<IFile> collectChangedFiles = collectChangedFiles(project, monitor); if (!collectChangedFiles.isEmpty()) { AnalyzeProjectRequest req = new AnalyzeProjectRequest(project, collectChangedFiles, TriggerType.CHANGESET); AnalyzeProjectJob job = new AnalyzeProjectJob(req); job.schedule(); jobs.add(job); } } jobs.stream().forEach(j -> { try { j.join(); } catch (InterruptedException e) { } }); if (monitor.isCanceled()) { return Status.CANCEL_STATUS; } return Status.OK_STATUS; }
Source:
<code>public void invalidate() { <START> this.targetDomainName = null; <END> }</code><technical_language>this. is needed. targetDomainName field volatile checked modified invalidated threads</technical_language>

Target:
public void invalidate() { targetDomainName = null; }
Source:
<code>private Set<GenericItem> getItemsInColorCond(EList<ColorArray> colorList) { Set<GenericItem> items = new HashSet<GenericItem>(); <START> if (colorList != null) { <END> for (ColorArray color : colorList) { String itemName = color.getItem(); if (itemName != null) { try { Item item = itemUIRegistry.getItem(itemName); if (item instanceof GenericItem) { final GenericItem gItem = (GenericItem) item; items.add(gItem); } } catch (ItemNotFoundException e) { } } } } return items; }</code><technical_language>colorList null, widget#getLabelColor widget#getValueColor return a list instance</technical_language>

Target:
private Set<GenericItem> getItemsInColorCond(EList<ColorArray> colorList) { Set<GenericItem> items = new HashSet<GenericItem>(); for (ColorArray color : colorList) { String itemName = color.getItem(); if (itemName != null) { try { Item item = itemUIRegistry.getItem(itemName); if (item instanceof GenericItem) { items.add((GenericItem) item); } } catch (ItemNotFoundException e) { } } } return items; }
Source:
<code>private JButton getAddOnInfoButton() { if (addOnInfoButton == null) { addOnInfoButton = new JButton(); addOnInfoButton.setText(Constant.messages.getString("cfu.button.addons.info")); addOnInfoButton.setEnabled(false); addOnInfoButton.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent e) { <START> if (getUninstalledAddOnsTable().convertRowIndexToModel(getUninstalledAddOnsTable().getSelectedRow()) >= 0) { <END> AddOnWrapper ao = uninstalledAddOnsModel.getAddOnWrapper(getUninstalledAddOnsTable().convertRowIndexToModel(getUninstalledAddOnsTable().getSelectedRow())); if (ao != null && ao.getAddOn().getInfo() != null) { DesktopUtils.openUrlInBrowser(ao.getAddOn().getInfo().toString()); } } } }); } return addOnInfoButton; }</code><technical_language>This statement need conversion, checking row selected</technical_language>

Target:
private JButton getAddOnInfoButton() { if (addOnInfoButton == null) { addOnInfoButton = new JButton(); addOnInfoButton.setText(Constant.messages.getString("cfu.button.addons.info")); addOnInfoButton.setEnabled(false); addOnInfoButton.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent e) { if (getUninstalledAddOnsTable().getSelectedRow() >= 0) { AddOnWrapper ao = uninstalledAddOnsModel.getAddOnWrapper(getUninstalledAddOnsTable().convertRowIndexToModel(getUninstalledAddOnsTable().getSelectedRow())); if (ao != null && ao.getAddOn().getInfo() != null) { DesktopUtils.openUrlInBrowser(ao.getAddOn().getInfo().toString()); } } } }); } return addOnInfoButton; }
Source:
<code>public void initShaders() { defaultShaderProgram = prepareAndStoreShaderProgramInstance("default"); defaultTexturedShaderProgram = prepareAndStoreShaderProgramInstance("defaultTextured"); <START> prepareAndStoreShaderProgramInstance("post"); <END> prepareAndStoreShaderProgramInstance("ssao"); prepareAndStoreShaderProgramInstance("lightShafts"); prepareAndStoreShaderProgramInstance("sobel"); prepareAndStoreShaderProgramInstance("initialPost"); prepareAndStoreShaderProgramInstance("prePostComposite"); prepareAndStoreShaderProgramInstance("highPass"); prepareAndStoreShaderProgramInstance("blur"); prepareAndStoreShaderProgramInstance("downSampler"); prepareAndStoreShaderProgramInstance("toneMapping"); prepareAndStoreShaderProgramInstance("sky"); prepareAndStoreShaderProgramInstance("chunk"); prepareAndStoreShaderProgramInstance("particle"); prepareAndStoreShaderProgramInstance("shadowMap"); prepareAndStoreShaderProgramInstance("lightBufferPass"); prepareAndStoreShaderProgramInstance("lightGeometryPass"); prepareAndStoreShaderProgramInstance("ssaoBlur"); }</code><technical_language>rename addShaderProgram(string)</technical_language>

Target:
public void initShaders() { defaultShaderProgram = addShaderProgram("default"); defaultTexturedShaderProgram = addShaderProgram("defaultTextured"); addShaderProgram("post"); addShaderProgram("ssao"); addShaderProgram("lightShafts"); addShaderProgram("sobel"); addShaderProgram("initialPost"); addShaderProgram("prePostComposite"); addShaderProgram("highPass"); addShaderProgram("blur"); addShaderProgram("downSampler"); addShaderProgram("toneMapping"); addShaderProgram("sky"); addShaderProgram("chunk"); addShaderProgram("particle"); addShaderProgram("shadowMap"); addShaderProgram("lightBufferPass"); addShaderProgram("lightGeometryPass"); addShaderProgram("ssaoBlur"); }
Source:
<code>private List<ColumnNameOrIndex> populateSelectItems(List<SelectItem> selectItems, OrderBy orderBy) { Set<String> aliases = selectItems.stream() .filter(item -> item instanceof SingleColumn) .map(SingleColumn.class::cast) .map(SingleColumn::getAlias) .filter(Optional::isPresent) <START> .map(Optional::get) <END> .map(Identifier::getValue) .collect(toImmutableSet()); ImmutableList.Builder<ColumnNameOrIndex> orderByKeys = ImmutableList.builder(); for (int i = 0; i < orderBy.getSortItems().size(); i++) { Expression sortKey = orderBy.getSortItems().get(i).getSortKey(); if (sortKey instanceof LongLiteral) { orderByKeys.add(ColumnNameOrIndex.forIndex(toIntExact(((LongLiteral) sortKey).getValue()) - 1)); } else if (sortKey instanceof Identifier && aliases.contains(((Identifier) sortKey).getValue())) { orderByKeys.add(ColumnNameOrIndex.forName(((Identifier) sortKey).getValue())); } else { String columnName = "$$sort_key$$" + i; selectItems.add(new SingleColumn(sortKey, delimitedIdentifier(columnName))); orderByKeys.add(ColumnNameOrIndex.forName(columnName)); } } return orderByKeys.build(); }</code><technical_language>nit: .filter(SingleColumn.class::isInstance)</technical_language>

Target:
private List<ColumnNameOrIndex> populateSelectItems(List<SelectItem> selectItems, OrderBy orderBy) { Set<String> aliases = selectItems.stream() .filter(SingleColumn.class::isInstance) .map(SingleColumn.class::cast) .map(SingleColumn::getAlias) .filter(Optional::isPresent) .map(Optional::get) .map(Identifier::getValue) .collect(toImmutableSet()); ImmutableList.Builder<ColumnNameOrIndex> orderByKeys = ImmutableList.builder(); for (int i = 0; i < orderBy.getSortItems().size(); i++) { Expression sortKey = orderBy.getSortItems().get(i).getSortKey(); if (sortKey instanceof LongLiteral) { orderByKeys.add(ColumnNameOrIndex.forIndex(toIntExact(((LongLiteral) sortKey).getValue()) - 1)); } else if (sortKey instanceof Identifier && aliases.contains(((Identifier) sortKey).getValue())) { orderByKeys.add(ColumnNameOrIndex.forName(((Identifier) sortKey).getValue())); } else { String columnName = "$$sort_key$$" + i; selectItems.add(new SingleColumn(sortKey, delimitedIdentifier(columnName))); orderByKeys.add(ColumnNameOrIndex.forName(columnName)); } } return orderByKeys.build(); }
Source:
<code>public JSONObject changePlateIdBarcode(HttpSession session, JSONObject json) { Long plateId = json.getLong("plateId"); String idBarcode = json.getString("identificationBarcode"); try { if (!"".equals(idBarcode)) { Plate plate = requestManager.getPlateById(plateId); plate.setIdentificationBarcode(idBarcode); requestManager.savePlate(plate); } else { return JSONUtils.SimpleJSONError("New identification barcode not recognized"); } } catch (IOException e) { <START> e.printStackTrace(); <END> return JSONUtils.SimpleJSONError(e.getMessage()); } return JSONUtils.SimpleJSONResponse("New identification barcode successfully assigned."); }</code><technical_language>log I think</technical_language>

Target:
public JSONObject changePlateIdBarcode(HttpSession session, JSONObject json) { Long plateId = json.getLong("plateId"); String idBarcode = json.getString("identificationBarcode"); try { if (!isStringEmptyOrNull(idBarcode)) { Plate<? extends List<? extends Plateable>, ? extends Plateable> plate = requestManager.getPlateById(plateId); plate.setIdentificationBarcode(idBarcode); requestManager.savePlate(plate); } else { return JSONUtils.SimpleJSONError("New identification barcode not recognized"); } } catch (IOException e) { log.debug("Could not change Plate identificationBarcode: " + e.getMessage()); e.printStackTrace(); return JSONUtils.SimpleJSONError(e.getMessage()); } return JSONUtils.SimpleJSONResponse("New identification barcode successfully assigned."); }
Source:
<code>public void testInvalidOptionForTimestampFormat() { final Map<String, String> tableOptions = getModifyOptions( options -> options.put("json.timestamp-format.standard", "test")); thrown.expect(ValidationException.class); <START> thrown.expect(containsCause(new ValidationException("Unsupported value test for timestamp-format.standard. Supported values are [SQL, ISO-8601]."))); <END> testSchemaDeserializationSchema(tableOptions); }</code><technical_language>suggestion thrown.expect(containsCause(new ValidationException("Unsupported 'test' for timestamp-format.standard. Supported values [SQL, ISO-8601].")));</technical_language>

Target:
public void testInvalidOptionForTimestampFormat() { final Map<String, String> tableOptions = getModifyOptions( options -> options.put("json.timestamp-format.standard", "test")); thrown.expect(ValidationException.class); thrown.expect(containsCause(new ValidationException("Unsupported value 'test' for timestamp-format.standard. Supported values are [SQL, ISO-8601]."))); testSchemaDeserializationSchema(tableOptions); }
Source:
<code>protected String getQuery(Query queryName, Supplier<String> queryProvider) { <START> String query = this.queryCache.get(queryName); <END> if (query == null) { query = StringUtils.replace(queryProvider.get(), "%PREFIX%", this.tablePrefix); this.queryCache.put(queryName, query); } return query; }</code><technical_language>computeIfAbsent() work for here</technical_language>

Target:
protected String getQuery(Query queryName, Supplier<String> queryProvider) { return this.queryCache.computeIfAbsent(queryName, k -> StringUtils.replace(queryProvider.get(), "%PREFIX%", this.tablePrefix)); }
Source:
<code>protected void setParam() { if("".equals(this.getExtraValue("type"))) { this.typeList = Arrays.asList(this.getExtraValue("type").trim().split("\\s*,\\s*")); } else { this.typeList = new ArrayList<String>(); this.typeList.add("all"); this.setExtraValue("type", String.join(",", this.typeList)); <START> } <END> }</code><technical_language>a doubt, typeList contains 1 ("all"), join is used, provide string</technical_language>

Target:
protected void setParam() { if(!"".equals(this.getExtraValue("type"))) { this.typeList = Arrays.asList(this.getExtraValue("type").trim().split("\\s*,\\s*")); } else { this.typeList = new ArrayList<String>(); this.typeList.add("all"); this.setExtraValue("type", String.join(",", this.typeList)); } }
Source:
<code>protected static Atomix.Builder buildAtomix(Node.Type type, int id, List<Integer> nodeIds, List<Integer> bootstrapIds) { Node localNode = Node.builder(String.valueOf(id)) .withType(type) .withAddress("localhost", BASE_PORT + id) .build(); Collection<Node> nodes = Stream.concat( nodeIds.stream() .map(nodeId -> Node.builder(String.valueOf(nodeId)) <START> .withType(Node.Type.CORE) <END> .withAddress("localhost", BASE_PORT + nodeId) .build()), bootstrapIds.stream() .filter(nodeId -> !nodeIds.contains(nodeId)) .map(nodeId -> Node.builder(String.valueOf(nodeId)) .withType(Node.Type.DATA) .withAddress("localhost", BASE_PORT + nodeId) .build())) .collect(Collectors.toList()); Atomix.Builder builder = Atomix.builder() .withClusterName("test") .withDataDirectory(new File("target/test-logs/" + id)) .withLocalNode(localNode) .withNodes(nodes) .addPartitionGroup(PrimaryBackupPartitionGroup.builder("data") .withNumPartitions(3) .build()); if (!nodeIds.isEmpty()) { builder.addPartitionGroup(RaftPartitionGroup.builder("core") .withPartitionSize(3) .withNumPartitions(3) .withDataDirectory(new File("target/test-logs/core/")) .build()); } return builder; }</code><technical_language>find port helper method</technical_language>

Target:
protected static Atomix.Builder buildAtomix(Node.Type type, int id, List<Integer> nodeIds, List<Integer> bootstrapIds) { Node localNode = Node.builder(String.valueOf(id)) .withType(type) .withAddress("localhost", nodeIds.contains(id) ? BASE_PORT + id : findAvailablePort(BASE_PORT + id)) .build(); Collection<Node> nodes = Stream.concat( nodeIds.stream() .map(nodeId -> Node.builder(String.valueOf(nodeId)) .withType(Node.Type.CORE) .withAddress("localhost", BASE_PORT + nodeId) .build()), bootstrapIds.stream() .filter(nodeId -> !nodeIds.contains(nodeId)) .map(nodeId -> Node.builder(String.valueOf(nodeId)) .withType(Node.Type.DATA) .withAddress("localhost", findAvailablePort(BASE_PORT + nodeId)) .build())) .collect(Collectors.toList()); Atomix.Builder builder = Atomix.builder() .withClusterName("test") .withDataDirectory(new File("target/test-logs/" + id)) .withLocalNode(localNode) .withNodes(nodes) .addPartitionGroup(PrimaryBackupPartitionGroup.builder("data") .withNumPartitions(3) .build()); if (!nodeIds.isEmpty()) { builder.addPartitionGroup(RaftPartitionGroup.builder("core") .withPartitionSize(3) .withNumPartitions(3) .withDataDirectory(new File("target/test-logs/core/")) .build()); } return builder; }
Source:
<code>@Test public void overrideEverything() { TypeElement classElement = getElement(Everything.class); ExecutableElement methodElement = getOnlyElement(methodsIn(classElement.getEnclosedElements())); <START> ExecutableType type = (ExecutableType) compilation.getTypes().asMemberOf((DeclaredType) classElement.asType(), methodElement); <END> MethodSpec method = MethodSpec.overriding(methodElement, type).build(); assertThat(method.toString()).isEqualTo("" + "@java.lang.Override\n" + "@java.lang.Deprecated\n" + "protected <T extends java.lang.Runnable & java.io.Closeable> " + "java.lang.Runnable everything(" + "@com.squareup.javapoet.MethodSpecTest.Nullable java.lang.String arg0, " + "java.util.List<? extends T> arg1) " + "throws java.io.IOException, java.lang.SecurityException {\n" + "}\n"); }</code><technical_language>nit: wrap 100 columns</technical_language>

Target:
@Test public void overrideEverything() { TypeElement classElement = getElement(Everything.class); ExecutableElement methodElement = getOnlyElement(methodsIn(classElement.getEnclosedElements())); MethodSpec method = MethodSpec.overriding(methodElement).build(); assertThat(method.toString()).isEqualTo("" + "@java.lang.Override\n" + "protected <T extends java.lang.Runnable & java.io.Closeable> " + "java.lang.Runnable everything(java.lang.String arg0, java.util.List<? extends T> arg1) " + "throws java.io.IOException, java.lang.SecurityException {\n" + "}\n"); }
Source:
<code>protected void channelRead0(ChannelHandlerContext ctx, FullHttpRequest request) throws Exception { if (request.headers().contains(HttpHeaderNames.UPGRADE, HttpHeaderValues.WEBSOCKET, true)) { ctx.fireChannelRead(request.retain()); return; } if (!sendResource(request, ctx)) { FullHttpResponse notFound = new DefaultFullHttpResponse(request.protocolVersion(), NOT_FOUND); notFound.headers().set(CONTENT_TYPE, TEXT_PLAIN); String payload = "Requested resource " + request.uri() + " not found"; notFound.content() <START> .writeBytes(ByteBufUtil.encodeString(ctx.alloc(), CharBuffer.wrap(payload), CharsetUtil.UTF_8)); <END> HttpUtil.setContentLength(notFound, notFound.content().readableBytes()); sendResponse(notFound, ctx, true); } }</code><technical_language>writeCharSequence(...)</technical_language>

Target:
protected void channelRead0(ChannelHandlerContext ctx, FullHttpRequest request) { if (request.headers().contains(HttpHeaderNames.UPGRADE, HttpHeaderValues.WEBSOCKET, true)) { ctx.fireChannelRead(request.retain()); return; } if (request.decoderResult().isFailure()) { FullHttpResponse badRequest = new DefaultFullHttpResponse(request.protocolVersion(), BAD_REQUEST); sendResponse(badRequest, ctx, true); return; } if (!sendResource(request, ctx)) { FullHttpResponse notFound = new DefaultFullHttpResponse(request.protocolVersion(), NOT_FOUND); notFound.headers().set(CONTENT_TYPE, TEXT_PLAIN); String payload = "Requested resource " + request.uri() + " not found"; notFound.content().writeCharSequence(payload, CharsetUtil.UTF_8); HttpUtil.setContentLength(notFound, notFound.content().readableBytes()); sendResponse(notFound, ctx, true); } }
Source:
<code>public void getAllDrugs_shouldReturnAListOfAllDrugs() throws Exception { int resultWhenTrue = 4; int resultWhenFalse = 2; List<Drug> allDrugs = conceptService.getAllDrugs(); assertEquals(resultWhenTrue, allDrugs.size()); <START> allDrugs = conceptService.getAllDrugs(false); <END> assertEquals(resultWhenFalse, allDrugs.size()); }</code><technical_language>@mavrk test for method combination of parameters. goal is public method in service layer is tested. write tests for methods * getAllDrugs() * getAllDrugs(includeRetired) for need test passing true passing false. another case is if drugs return empty list? I this is tedious this written [TDD|<LINK_0>] start tests wasnt used</technical_language>

Target:
public void getAllDrugs_shouldReturnAListOfAllDrugs() throws Exception { int resultWhenTrue = 4; List<Drug> allDrugs = conceptService.getAllDrugs(); assertEquals(resultWhenTrue, allDrugs.size()); }
Source:
<code>public Mono<Long> count() { final ResolvedView resolvedView = determineView(); ViewQuery query = ViewQuery.from(resolvedView.getDesignDocument(), resolvedView.getViewName()); query.reduce(true); query.stale(operations.getDefaultConsistency().viewConsistency()); return mapMono(operations .queryView(query) .flatMap(AsyncViewResult::rows) .map(asyncViewRow -> Long.valueOf(asyncViewRow.value().toString())) <START> .switchIfEmpty(Observable.just(Long.valueOf(0L))).toSingle()); <END> }</code><technical_language>NIT: Instead of Observable.just(Long.valueOf(0L)) advantage of auto-boxing write Observable.just(0L)</technical_language>

Target:
public Mono<Long> count() { final ResolvedView resolvedView = determineView(); ViewQuery query = ViewQuery.from(resolvedView.getDesignDocument(), resolvedView.getViewName()); query.reduce(true); query.stale(operations.getDefaultConsistency().viewConsistency()); return mapMono(operations .queryView(query) .flatMap(AsyncViewResult::rows) .map(asyncViewRow -> Long.valueOf(asyncViewRow.value().toString())) .switchIfEmpty(Observable.just(0L)).toSingle()); }
Source:
<code>public ChunkResponder sendChunkStart(HttpResponseStatus status, @Nullable Multimap<String, String> headers) { Preconditions.checkArgument(responded.compareAndSet(false, true), "Response has been already sent"); Preconditions.checkArgument((status.getCode() >= 200 && status.getCode() < 210) , "Http Chunk Failure"); HttpResponse response = new DefaultHttpResponse(HttpVersion.HTTP_1_1, status); setCustomHeaders(response, headers); response.setChunked(true); response.setHeader(HttpHeaders.Names.TRANSFER_ENCODING, HttpHeaders.Values.CHUNKED); <START> boolean keepAlive = setResponseKeepAlive(response); <END> channel.write(response); return new ChannelChunkResponder(channel, keepAlive); }</code><technical_language>a confusing a local variable of name a class variable. call keepThisConnectionAlive</technical_language>

Target:
public ChunkResponder sendChunkStart(HttpResponseStatus status, @Nullable Multimap<String, String> headers) { Preconditions.checkArgument(responded.compareAndSet(false, true), "Response has been already sent"); Preconditions.checkArgument((status.getCode() >= 200 && status.getCode() < 210) , "Http Chunk Failure"); HttpResponse response = new DefaultHttpResponse(HttpVersion.HTTP_1_1, status); setCustomHeaders(response, headers); response.setChunked(true); response.setHeader(HttpHeaders.Names.TRANSFER_ENCODING, HttpHeaders.Values.CHUNKED); boolean responseKeepAlive = setResponseKeepAlive(response); channel.write(response); return new ChannelChunkResponder(channel, responseKeepAlive); }
Source:
<code><START> public Map<Long, String> auditUnsafe(long record) { <END> return super.audit(record); }</code><technical_language>"unsafe" methods added package-private (default) protection instead of public</technical_language>

Target:
public Map<Long, String> auditUnsafe(long record) { transportLock.readLock().lock(); try { return super.audit(record); } finally { transportLock.readLock().unlock(); } }
Source:
<code>protected Map<String, Object> initProperties() { return BEANS.all(IRestApplicationPropertiesContributor.class).stream() .flatMap(c -> c.contribute().entrySet().stream()) <START> .collect(Collectors.toMap(Entry::getKey, Entry::getValue)); <END> }</code><technical_language>duplicates? toMap() variant overrides entries instead of throwing exception</technical_language>

Target:
protected Map<String, Object> initProperties() { return BEANS.all(IRestApplicationPropertiesContributor.class).stream().flatMap(contributor -> { Map<String, Object> properties = contributor.contribute(); LOG.info("Contributed properties by {}", properties.size(), contributor.getClass()); return properties.entrySet().stream(); }).collect(StreamUtility.toMap(Entry::getKey, Entry::getValue, StreamUtility.ignoringMerger())); }
Source:
<code>public PrimitiveLongReadableDiffSets indexUpdatesForSuffixOrContains( SchemaIndexDescriptor descriptor, IndexQuery query ) { <START> descriptor.schema().getPropertyId(); END> if ( indexUpdates == null ) { return PrimitiveLongReadableDiffSets.EMPTY; } Map<ValueTuple, PrimitiveLongDiffSets> updates = indexUpdates.get( descriptor.schema() ); if ( updates == null ) { return PrimitiveLongReadableDiffSets.EMPTY; } PrimitiveLongDiffSets diffs = new PrimitiveLongDiffSets(); for ( Map.Entry<ValueTuple,PrimitiveLongDiffSets> entry : updates.entrySet() ) { if ( query.acceptsValue( entry.getKey().getOnlyValue() ) ) { PrimitiveLongDiffSets diffsets = entry.getValue(); diffs.addAll( diffsets.getAdded().iterator() ); diffs.removeAll( diffsets.getRemoved().iterator() ); } } return diffs; }</code><technical_language>please do perform validation based method call side effects, if need validate number of properties do</technical_language>

Target:
public PrimitiveLongReadableDiffSets indexUpdatesForSuffixOrContains( SchemaIndexDescriptor descriptor, IndexQuery query ) { assert descriptor.schema().getPropertyIds().length == 1 : "Suffix and contains queries are only supported for single property queries"; if ( indexUpdates == null ) { return PrimitiveLongReadableDiffSets.EMPTY; } Map<ValueTuple, PrimitiveLongDiffSets> updates = indexUpdates.get( descriptor.schema() ); if ( updates == null ) { return PrimitiveLongReadableDiffSets.EMPTY; } PrimitiveLongDiffSets diffs = new PrimitiveLongDiffSets(); for ( Map.Entry<ValueTuple,PrimitiveLongDiffSets> entry : updates.entrySet() ) { if ( query.acceptsValue( entry.getKey().getOnlyValue() ) ) { PrimitiveLongDiffSets diffsets = entry.getValue(); diffs.addAll( diffsets.getAdded().iterator() ); diffs.removeAll( diffsets.getRemoved().iterator() ); } } return diffs; }