auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>final void uncheckedSet(boolean reverse, IntsRef ref, int value) { if (reverse && !storeBothDirections) <START> throw new IllegalArgumentException(getName() + ": value for reverse direction would overwrite forward direction. Enable 'storeBothDirections' or always use reverse==true when storing the value"); <END> if (reverse) { int flags = ref.ints[bwdDataIndex + ref.offset]; flags &= ~bwdMask; value <<= bwdShift; ref.ints[bwdDataIndex + ref.offset] = flags | value; } else { int flags = ref.ints[fwdDataIndex + ref.offset]; flags &= ~fwdMask; value <<= fwdShift; ref.ints[fwdDataIndex + ref.offset] = flags | value; } }</code><technical_language>Nice! this fix #1588</technical_language>

Target:
final void uncheckedSet(boolean reverse, IntsRef ref, int value) { if (reverse && !storeTwoDirections) throw new IllegalArgumentException(getName() + ": value for reverse direction would overwrite forward direction. Enable storeTwoDirections for this EncodedValue or don't use setReverse"); if (reverse) { int flags = ref.ints[bwdDataIndex + ref.offset]; flags &= ~bwdMask; value <<= bwdShift; ref.ints[bwdDataIndex + ref.offset] = flags | value; } else { int flags = ref.ints[fwdDataIndex + ref.offset]; flags &= ~fwdMask; value <<= fwdShift; ref.ints[fwdDataIndex + ref.offset] = flags | value; } }
Source:
<code>public ClientStats getClientStats() { <START> return null; <END> }</code><technical_language>throw new UnsupportedOperationException</technical_language>

Target:
public ClientStats getClientStats() { throw new UnsupportedOperationException(); }
Source:
<code>protected void EndSuccessfully() { EndActionOnAllImageGroups(); VM vm = getVm(); <START> if (vm != null) { <END> VmHandler.UnLockVm(vm.getId()); endDiskRelatedActions(vm); if (getParameters().getCopyCollapse()) { this.endCopyCollapseOperations(vm); } else { this.endDefaultOps(vm); } } else { setCommandShouldBeLogged(false); log.warn("ExportVmCommand::EndMoveVmCommand: Vm is null - not performing full EndAction"); } setSucceeded(true); }</code><technical_language>if vm null, is locked</technical_language>

Target:
protected void EndSuccessfully() { EndActionOnAllImageGroups(); VM vm = getVm(); VmHandler.UnLockVm(vm.getId()); endDiskRelatedActions(vm); if (getParameters().getCopyCollapse()) { this.endCopyCollapseOperations(vm); } else { this.endDefaultOps(vm); } setSucceeded(true); }
Source:
<code>protected String inferHostname(Entity entity) { String hostname = entity.getAttribute(Attributes.HOSTNAME); String url = entity.getAttribute(WebAppService.ROOT_URL); if (url!=null) { try { URL u = new URL(url); String hostname2 = u.getHost(); if (hostname==null) { if (!entitiesWithoutGeoInfo.contains(entity)) log.warn("GeoDns using URL to redirect to (HOSTNAME attribute is preferred, but not available)", url, entity); hostname = hostname2; } else if (!hostname.equals(hostname2)) { if (!entitiesWithoutGeoInfo.contains(entity)) <START> log.warn("GeoDns URL of does not match advertised HOSTNAME {}; using hostname, not URL", url, hostname); <END> } if (u.getPort() > 0 && u.getPort() != 80 && u.getPort() != 443) { if (!entitiesWithoutGeoInfo.contains(entity)) log.warn("GeoDns detected non-standard port in URL for {}; forwarding may not work", url, entity); } } catch (MalformedURLException e) { log.warn("Invalid URL for entity in {}", new Object[] {url, entity, this}); } } return hostname; }</code><technical_language>{} additional args method</technical_language>

Target:
protected String inferHostname(Entity entity) { String hostname = entity.getAttribute(Attributes.HOSTNAME); String url = entity.getAttribute(WebAppService.ROOT_URL); if (url!=null) { try { URL u = new URL(url); String hostname2 = u.getHost(); if (hostname==null) { if (!entitiesWithoutGeoInfo.contains(entity)) log.warn("GeoDns "+this+" using URL to redirect to (HOSTNAME attribute is preferred, but not available)", url, entity); hostname = hostname2; } else if (!hostname.equals(hostname2)) { if (!entitiesWithoutGeoInfo.contains(entity)) log.warn("GeoDns "+this+" URL of "+entity+" does not match advertised HOSTNAME {}; using hostname, not URL", url, hostname); } if (u.getPort() > 0 && u.getPort() != 80 && u.getPort() != 443) { if (!entitiesWithoutGeoInfo.contains(entity)) log.warn("GeoDns "+this+" detected non-standard port in URL for {}; forwarding may not work", url, entity); } } catch (MalformedURLException e) { log.warn("Invalid URL for entity in {}", new Object[] {url, entity, this}); } } return hostname; }
Source:
<code>public void terminateEarly() { future.cancel(false); synchronized (this) { <START> if (solverStatus == SolverStatus.SOLVING_SCHEDULED) { solvingTerminated(); } else if (solverStatus == SolverStatus.SOLVING_ACTIVE) { solver.terminateEarly(); } else if (solverStatus == SolverStatus.NOT_SOLVING) { } else { throw new IllegalStateException("Unsupported solverStatus (" + solverStatus + ")."); } <END> } try { terminatedLatch.await(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); logger.warn("The terminateEarly() call is interrupted.", e); } }</code><technical_language>This replacable switch (solverStatus.get()), actual state mutation in solvingTerminated()/solver.terminateEarly() suggested above</technical_language>

Target:
public void terminateEarly() { future.cancel(false); SolverStatus solverStatus = solverStatusReference.get(); switch (solverStatus) { case SOLVING_SCHEDULED: solvingTerminated(); break; case SOLVING_ACTIVE: solver.terminateEarly(); break; case NOT_SOLVING: break; default: throw new IllegalStateException("Unsupported solverStatus (" + solverStatus + ")."); } try { terminatedLatch.await(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); logger.warn("The terminateEarly() call is interrupted.", e); } }
Source:
<code>void complete() { final T value = getAndSet(null); if (value != null) { emit(value); } <START> actual.onComplete(); <END> }</code><technical_language>This race emission of run()</technical_language>

Target:
void complete() { if (wip.decrementAndGet() == 0) { final T value = getAndSet(null); if (value != null) { emit(value); } actual.onComplete(); } }
Source:
<code>FluxMd5Wrapper(Flux<ByteBuffer> data, byte[] md5) { this.data = data; <START> this.md5 = md5 == null ? null : md5.clone(); <END> }</code><technical_language>CoreUtils.clone handle this</technical_language>

Target:
FluxMd5Wrapper(Flux<ByteBuffer> data, byte[] md5) { this.data = data; this.md5 = CoreUtils.clone(md5); }
Source:
<code><START> private void rebase(int locusPosition) { <END> for (Counter counter : arrays) { int[] array = counter.array; System.arraycopy(array, locusPosition - offset, array, 0, arrayLength - locusPosition + offset); Arrays.fill(array, arrayLength - locusPosition + offset, arrayLength, 0); } offset = locusPosition; }</code><technical_language>is implicit assumption move "forward"? i.e. locusPosition is greater offset? if so, please assert this in top of method</technical_language>

Target:
private void rebase(int locusPosition) { if (locusPosition < offset) { throw new IllegalArgumentException("Position in the reference sequence is lesser than offset."); } for (Counter counter : arrays) { final int[] array = counter.array; final int skipLength = locusPosition - offset; System.arraycopy(array, skipLength, array, 0, arrayLength - skipLength); Arrays.fill(array, arrayLength - skipLength, arrayLength, 0); } offset = locusPosition; }
Source:
<code>private void replacePodsVolumesWithCommon(Map<String, PodData> pods, String commonPVCName) { <START> for (PodData pod : pods.values()) { <END> Set<String> pvcVolumes = new HashSet<>(); Iterator<io.fabric8.kubernetes.api.model.Volume> volumeIterator = pod.getSpec().getVolumes().iterator(); while (volumeIterator.hasNext()) { io.fabric8.kubernetes.api.model.Volume volume = volumeIterator.next(); if (volume.getPersistentVolumeClaim() != null) { pvcVolumes.add(volume.getName()); volumeIterator.remove(); } } pod.getSpec() .getVolumes() .add( new VolumeBuilder() .withName(commonPVCName) .withNewPersistentVolumeClaim() .withClaimName(commonPVCName) .endPersistentVolumeClaim() .build()); Stream.concat( pod.getSpec().getContainers().stream(), pod.getSpec().getInitContainers().stream()) .flatMap(c -> c.getVolumeMounts().stream()) .forEach( volumeMount -> { if (pvcVolumes.contains(volumeMount.getName())) { volumeMount.setName(commonPVCName); } }); } }</code><technical_language>Consider moving this code a separate method</technical_language>

Target:
private void replacePodsVolumesWithCommon(Map<String, PodData> pods, String commonPVCName) { for (PodData pod : pods.values()) { Set<String> pvcSourcedVolumes = reducePVCSourcedVolumes(pod.getSpec().getVolumes()); pod.getSpec() .getVolumes() .add( new VolumeBuilder() .withName(commonPVCName) .withNewPersistentVolumeClaim() .withClaimName(commonPVCName) .endPersistentVolumeClaim() .build()); Stream.concat( pod.getSpec().getContainers().stream(), pod.getSpec().getInitContainers().stream()) .flatMap(c -> c.getVolumeMounts().stream()) .filter(vm -> pvcSourcedVolumes.contains(vm.getName())) .forEach(vm -> vm.setName(commonPVCName)); } }
Source:
<code>protected Message<?> doReceive(long timeout) { try { if (timeout > 0) { if (this.queue instanceof BlockingQueue) { return ((BlockingQueue<Message<?>>) this.queue).poll(timeout, TimeUnit.MILLISECONDS); } else { long nanos = TimeUnit.MILLISECONDS.toNanos(timeout); long deadline = System.nanoTime() + nanos; Message<?> message = null; while ((message = this.queue.poll()) == null){ if (Thread.interrupted() || System.nanoTime() > deadline) { break; <START> } <END> } return message; } } if (timeout == 0) { return this.queue.poll(); } if (this.queue instanceof BlockingQueue) { return ((BlockingQueue<Message<?>>) this.queue).take(); } else { Message<?> message = null; while ((message = this.queue.poll()) == null) { if (Thread.interrupted()) { break; } } return message; } } catch (InterruptedException e) { Thread.currentThread().interrupt(); return null; } }</code><technical_language>This suck entire CPU (with PersistentQueue) a message is timeout occurs</technical_language>

Target:
protected Message<?> doReceive(long timeout) { try { if (timeout > 0) { if (this.queue instanceof BlockingQueue) { return ((BlockingQueue<Message<?>>) this.queue).poll(timeout, TimeUnit.MILLISECONDS); } else { long nanos = TimeUnit.MILLISECONDS.toNanos(timeout); long deadline = System.nanoTime() + nanos; while (this.queue.size() == 0 && nanos > 0) { this.queueSemaphore.tryAcquire(nanos, TimeUnit.NANOSECONDS); nanos = deadline - System.nanoTime(); } return this.queue.poll(); } } if (timeout == 0) { return this.queue.poll(); } if (this.queue instanceof BlockingQueue) { return ((BlockingQueue<Message<?>>) this.queue).take(); } else { while (this.queue.size() == 0) { this.queueSemaphore.tryAcquire(50, TimeUnit.MILLISECONDS); } return this.queue.poll(); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); return null; } }
Source:
<code><START> public static <I, R> Aggregator<I, CanonicalizingHashSet<R>> distinct(String attributePath) { <END> return new DistinctValuesAggregator<I, R>(attributePath); }</code><technical_language>CanonicalizingHashSet is internal class. visible in public API. I this part stay Set</technical_language>

Target:
public static <I, R> Aggregator<I, Set<R>> distinct(String attributePath) { return new DistinctValuesAggregator<>(attributePath); }
Source:
<code>public ExecutionReference(int execId, Executor executor) { this.execId = execId; <START> this.executor = executor; <END> }</code><technical_language>check for null reference - executor.getHost(), executor.getPort()</technical_language>

Target:
public ExecutionReference(int execId, Executor executor) { if (executor == null) { throw new IllegalArgumentException(String.format( "Executor cannot be null for exec id: %d ExecutionReference", execId)); } this.execId = execId; this.executor = executor; }
Source:
<code><START> private static void setProperty(String entryId, KalturaEntryIdKey entryIdKey, String subKey, Object value) throws Exception { <END> if (!entryIdToKalturaLiveEntryMap.containsKey(entryIdKey)) { entryIdToKalturaLiveEntryMap.put(entryIdKey, new ConcurrentHashMap<String, Object>()); ConcurrentHashMap<String, Object> entryMap = entryIdToKalturaLiveEntryMap.get(entryIdKey); entryMap.put(subKey, value); } logger.debug("(" + entryId + ") successfully updated entry " + entryIdKey.getEntryId() + " sub key " + subKey + "."); }</code><technical_language>entryId is used, please remove</technical_language>

Target:
private static void setProperty(String entryId, KalturaEntryIdKey entryIdKey, String subKey, Object value) throws Exception { ConcurrentHashMap<String, Object> entryMap = entryIdToKalturaLiveEntryMap.get(entryIdKey); entryMap.put(subKey, value); logger.debug("(" + entryId + ") successfully updated entry " + entryIdKey.getEntryId() + " sub key \"" + subKey + "\" (map size:" + entryIdToKalturaLiveEntryMap.size() + ")"); }
Source:
<code>public void testIndexSegmentRollOverNewIndexSegmentVersion() throws StoreException, IOException { state.closeAndClearIndex(); <START> state.reloadIndex(false, false); <END> Offset endOffset = state.index.getCurrentEndOffset(); state.index.close(); state.appendToLog(100); IndexEntry entry = new IndexEntry(state.getUniqueId(), IndexValueUtils.getIndexValue(100, endOffset, state.time.seconds(), PersistentIndex.VERSION_0)); MetricRegistry metricRegistry = new MetricRegistry(); StoreMetrics metrics = new StoreMetrics(state.tempDirStr, metricRegistry); StoreConfig config = new StoreConfig(new VerifiableProperties(state.properties)); IndexSegment info = new IndexSegment(state.tempDirStr, entry.getValue().getOffset(), state.STORE_KEY_FACTORY, entry.getKey().sizeInBytes(), entry.getValue().getBytes().capacity(), config, metrics, state.time); endOffset = new Offset(entry.getValue().getOffset().getName(), entry.getValue().getOffset().getOffset() + entry.getValue().getSize()); info.addEntry(entry, endOffset); StoreTestUtils.writeIndexSegmentToFile(info, endOffset); metricRegistry = new MetricRegistry(); metrics = new StoreMetrics(state.tempDirStr, metricRegistry); config = new StoreConfig(new VerifiableProperties(state.properties)); state.index = new PersistentIndex(state.tempDirStr, state.scheduler, state.log, config, state.STORE_KEY_FACTORY, state.recovery, state.hardDelete, metrics, state.time, state.sessionId, state.incarnationId); int indexCount = state.index.indexes.size(); state.addPutEntries(1, 100, Utils.Infinite_Time); assertEquals("Index roll over should have happened ", indexCount + 1, state.index.indexes.size()); state.closeAndClearIndex(); }</code><technical_language>reload index if close again</technical_language>

Target:
public void testIndexSegmentRollOverNewIndexSegmentVersion() throws StoreException, IOException { indexSegmentRollOverTest(true); indexSegmentRollOverTest(false); }
Source:
<code>public void testWatermarkBeforeRecords() { final TestingWatermarkOutput output = new TestingWatermarkOutput(); <START> final WatermarkGenerator<Object> watermarks = <END> WatermarkStrategy .forMonotonousTimestamps() .createWatermarkGenerator(() -> null); watermarks.onPeriodicEmit(output); assertEquals(Long.MIN_VALUE, output.lastWatermark().getTimestamp()); }</code><technical_language>Do need change these? AscendingTimestampsWatermarksTest test AscendingTimestampsWatermarks class, coupled WatermarkStrategy class. indicator scope of testing is is () -> null lambda needed instantiate class tested, do tests</technical_language>

Target:
public void testWatermarkBeforeRecords() { final TestingWatermarkOutput output = new TestingWatermarkOutput(); final AscendingTimestampsWatermarks<Object> watermarks = new AscendingTimestampsWatermarks<>(); watermarks.onPeriodicEmit(output); assertEquals(Long.MIN_VALUE, output.lastWatermark().getTimestamp()); }
Source:
<code>public static void logDriverVersion() { Logger core = LoggerFactory.getLogger("com.datastax.driver.core"); <START> core.info("DataStax Java driver for Apache Cassandra version {}", getDriverVersion()); <END> }</code><technical_language>wording of this easy misunderstand DataStax Java driver for: "Apache Cassandra version X". In other words, mistaking version logged for Apache Cassandra java driver. "DataStax Java driver 1.2.3 for Apache Cassandra" satisfy legal requirements</technical_language>

Target:
public static void logDriverVersion() { Logger core = LoggerFactory.getLogger("com.datastax.driver.core"); core.info("DataStax Java driver for Apache Cassandra", getDriverVersion()); }
Source:
<code>public void testDeleteJob() { <START> JobRequest jobRequest = createSpace("deleteJobOrgUnitWith" + user.getUserName()); <END> assertOperation(() -> roleClient.deleteJob(jobRequest.getJobId())); }</code><technical_language>Maybe, this changed "Space" (also in test method this one)</technical_language>

Target:
public void testDeleteJob() { JobRequest jobRequest = createSpace("deleteSpaceWith" + user.getUserName()); assertOperation(() -> roleClient.deleteJob(jobRequest.getJobId())); }
Source:
<code>public void setUp() { doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) throws Throwable { final Runnable r = (Runnable) invocation.getArguments()[0]; <START> new InstantExecutor().execute(r); <END> return null; } }).when(factory).queueOnEventThread(any(Runnable.class)); mockListener = getEventListener(); channel = newInstance(getChannelName()); channel.setEventListener(mockListener); }</code><technical_language>This InstantExecutor class is redundant now. ((Runnable)invocation.getArguments()[0]).run(); do trick. stick proper OO patterns, create a GloballySynchronizedExecutor takes lock object a constructor arg, return a dummy type here. insist though</technical_language>

Target:
public void setUp() { doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) throws Throwable { final Runnable r = (Runnable) invocation.getArguments()[0]; r.run(); return null; } }).when(factory).queueOnEventThread(any(Runnable.class)); mockListener = getEventListener(); channel = newInstance(getChannelName()); channel.setEventListener(mockListener); }
Source:
<code>private AtomicOperation doJsonify(List<Long> records, boolean includePrimaryKey, Compoundable store, StringBuilder jsonStr) { AtomicOperation operation = store.startAtomicOperation(); try { List<Map<String, Set<Object>>> result = Lists.newLinkedList(); <START> Set<Map<String, Set<Object>>> resultNoKey = Sets.newHashSet(); <END> for (Long record: records) { Map<String, Set<Object>> rec = Maps.newHashMap(); Map<String, Set<TObject>> r = operation.browse(record); for (Map.Entry<String, Set<TObject>> entry: r.entrySet()) { Set<Object> values = Transformers.transformSet(entry.getValue(), Functions.TOBJECT_TO_JAVA); rec.put(entry.getKey(), values); } if (includePrimaryKey) { Set<Object> recordSet = Sets.newHashSet(); recordSet.add(record); rec.put("$primaryKey$", recordSet); result.add(rec); } else { resultNoKey.add(rec); } } if (includePrimaryKey) { jsonStr.append(Convert.javaToJson(result)); } else { jsonStr.append(Convert.javaToJson(resultNoKey)); } return operation; } catch (AtomicStateException e) { return null; } }</code><technical_language>indentation in this block</technical_language>

Target:
private AtomicOperation doJsonify(List<Long> records, boolean includePrimaryKey, Compoundable store, StringBuilder jsonStr) { AtomicOperation operation = store.startAtomicOperation(); try { List<Map<String, Set<Object>>> result = Lists.newLinkedList(); Set<Map<String, Set<Object>>> resultNoKey = Sets.newHashSet(); for (Long record : records) { Map<String, Set<Object>> rec = Maps.newHashMap(); Map<String, Set<TObject>> r = operation.browse(record); for (Map.Entry<String, Set<TObject>> entry : r.entrySet()) { Set<Object> values = Transformers.transformSet( entry.getValue(), Functions.THRIFT_TO_JAVA); rec.put(entry.getKey(), values); } if (includePrimaryKey) { Set<Object> recordSet = Sets.newHashSet(); recordSet.add(record); rec.put("$primaryKey$", recordSet); result.add(rec); } else { resultNoKey.add(rec); } } if (includePrimaryKey) { jsonStr.append(Convert.javaToJson(result)); } else { jsonStr.append(Convert.javaToJson(resultNoKey)); } return operation; } catch (AtomicStateException e) { return null; } }
Source:
<code>public void display(final List<MergeStrategySection> mergeStrategies) { while (1 < table.getRowCount()) table.removeRow(table.getRowCount() - 1); <START> for (final MergeStrategySection r : mergeStrategies) { <END> final int row = table.getRowCount(); table.insertRow(row); applyDataRowStyle(row); populate(row, r); } }</code><technical_language>I merge strategies sorted ref name displaying them</technical_language>

Target:
public void display(final List<MergeStrategySection> mergeStrategies) { while (1 < table.getRowCount()) table.removeRow(table.getRowCount() - 1); Collections.sort(mergeStrategies); for (final MergeStrategySection r : mergeStrategies) { final int row = table.getRowCount(); table.insertRow(row); applyDataRowStyle(row); populate(row, r); } }
Source:
<code>public VdcActionParametersBase getParameters(Host incoming, VDS entity) { String managementIp = null; if (incoming.isSetPowerManagement()) { managementIp = getManagementIp(incoming.getPowerManagement(), entity.getStaticData()); } VdsStatic updated = getMapper(modelType, VdsStatic.class).map(incoming, entity.getStaticData()); if (incoming.isSetPowerManagement()) { <START> updated.setManagementIp(managementIp); <END> } UpdateVdsActionParameters updateParams = new UpdateVdsActionParameters(updated, "", false); if (incoming.isSetOverrideIptables()) { updateParams.setOverrideFirewall(incoming.isOverrideIptables()); } return updateParams; }</code><technical_language>this happen in host mapper</technical_language>

Target:
public VdcActionParametersBase getParameters(Host incoming, VDS entity) { VdsStatic updated = getMapper(modelType, VdsStatic.class).map(incoming, entity.getStaticData()); UpdateVdsActionParameters updateParams = new UpdateVdsActionParameters(updated, "", false); if (incoming.isSetOverrideIptables()) { updateParams.setOverrideFirewall(incoming.isOverrideIptables()); } return updateParams; }
Source:
<code>@Test public void testRequestNotFound() throws Throwable { enqueue404(); AnnouncementClient.Callback cb = mock(AnnouncementClient.Callback.class); request(cb); server().takeRequest(); <START> verify(cb, never()).success(eq(new ArrayList<Card>())); verify(cb).error(any(Throwable.class)); <END> }</code><technical_language>This asserting callback failure. Consider making a helper method</technical_language>

Target:
@Test public void testRequestNotFound() throws Throwable { enqueue404(); Callback cb = mock(Callback.class); request(cb); server().takeRequest(); verify(cb, never()).success(anyListOf(Card.class)); verify(cb).error(any(Throwable.class)); }
Source:
<code>private void updateFooter() { if (issueCount == 0){ totalIssueText.setText(String.valueOf(0)); hideFooterPanelStatsDetails(true); } else { openIssueText.setText(String.valueOf(openIssueCount)); closedIssueText.setText(String.valueOf(closedIssueCount)); totalIssueText.setText(String.valueOf(issueCount)); <START> hideFooterPanelStatsDetails(false); <END> } }</code><technical_language>DRYer extract a method update texts of 3 stats text nodes, updated (either none). I a good idea update totalIssueText in if branch</technical_language>

Target:
private void updateFooter() { updateFooterPanelStatsDetails(); if (issuesCount == 0){ hideFooterPanelStatsDetails(true); } else { hideFooterPanelStatsDetails(false); } }
Source:
<code>public void testUnmarshallSubprocessLevelEventEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateSignalEventCatching emptySubprocessEvent = getCatchingIntermediateNodeById(diagram, EMPTY_SUBPROCESS_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_OUTGOING_EDGE); assertGeneralSet(emptySubprocessEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); <START> assertSignalEventExecutionSet(emptySubprocessEvent.getExecutionSet(), EMPTY_VALUE, CANCELLING, ""); <END> assertDataIOSet(emptySubprocessEvent.getDataIOSet(), EMPTY_VALUE); }</code><technical_language>suggestion assertSignalEventExecutionSet(emptySubprocessEvent.getExecutionSet(), EMPTY_VALUE, CANCELLING, EMPTY_VALUE);</technical_language>

Target:
public void testUnmarshallSubprocessLevelEventEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateSignalEventCatching emptySubprocessEvent = getCatchingIntermediateNodeById(diagram, EMPTY_SUBPROCESS_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_OUTGOING_EDGE); assertGeneralSet(emptySubprocessEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertSignalEventExecutionSet(emptySubprocessEvent.getExecutionSet(), EMPTY_VALUE, CANCELLING, EMPTY_VALUE); assertDataIOSet(emptySubprocessEvent.getDataIOSet(), EMPTY_VALUE); }
Source:
<code>public void draw(TooltipLine value, Canvas canvas) { <START> final UISkin skin = value.getSkin(); <END> if (skin != null) { canvas.setSkin(skin); canvas.setFamily(value.getFamily()); canvas.drawText(value.getText()); } else { canvas.setSkin(defaultSkin); Font font = value.getFont(); if (font == null) { font = canvas.getCurrentStyle().getFont(); } Color color = value.getColor(); if (color == null) { color = canvas.getCurrentStyle().getTextColor(); } canvas.drawTextRaw(value.getText(), font, color, canvas.getRegion()); } }</code><technical_language>This logic right. Skin Family choices mutually exclusive specific fonts colors. I admit uncomfortable UIList approach. This feel a solution in engine example of do things, designed for extensibility. examples of for - is durability coloured text? indicator bar</technical_language>

Target:
public void draw(TooltipLine value, Canvas canvas) { Font font = getFont(value); Color color = getColor(value); canvas.drawTextRaw(value.getText(), font, color, canvas.getRegion()); }
Source:
<code>public IMarkerResolution[] getResolutions(final IMarker marker) { List<IMarkerResolution> resolutions = new ArrayList<>(); resolutions.add(new ShowRuleDescriptionMarkerResolver(marker)); <START> if (hasResolutions(marker)) { <END> resolutions.add(new ShowIssueFlowsMarkerResolver(marker)); } if (isStandalone(marker)) { resolutions.add(new DeactivateRuleMarkerResolver(marker)); } return resolutions.toArray(new IMarkerResolution[resolutions.size()]); }</code><technical_language>code, renamed "hasExtraLocations"</technical_language>

Target:
public IMarkerResolution[] getResolutions(final IMarker marker) { List<IMarkerResolution> resolutions = new ArrayList<>(); resolutions.add(new ShowRuleDescriptionMarkerResolver(marker)); if (hasExtraLocations(marker)) { resolutions.add(new ShowIssueFlowsMarkerResolver(marker)); } if (isStandaloneIssue(marker)) { resolutions.add(new DeactivateRuleMarkerResolver(marker)); } return resolutions.toArray(new IMarkerResolution[resolutions.size()]); }
Source:
<code>protected void executeCommand() { executeInNewTransaction(() -> { setStorageDomainStatus(StorageDomainStatus.Locked, getCompensationContext()); getCompensationContext().stateChanged(); return null; }); runVdsCommand(VDSCommandType.ExtendStorageDomain, new ExtendStorageDomainVDSCommandParameters(getStoragePoolId(), getStorageDomain() .getId(), getParameters().getLunIds(), getParameters().isForce())); <START> getParameters().setLunsList(getVgInfo()); <END> executeInNewTransaction(() -> { for (LUNs lun : getParameters().getLunsList()) { proceedLUNInDb(lun, getStorageDomain().getStorageType(), getStorageDomain().getStorage()); } setStorageDomainStatus(StorageDomainStatus.Active, null); getCompensationContext().cleanupCompensationDataAfterSuccessfulCommand(); return null; }); setSucceeded(true); }</code><technical_language>currently flow fail if call getVgInfo() fails dangerous, especially if running vms disks domain (as user able try reuse device for other domain). seems, save devices pv id fix synclunsinfo command handle case</technical_language>

Target:
protected void executeCommand() { executeInNewTransaction(() -> { setStorageDomainStatus(StorageDomainStatus.Locked, getCompensationContext()); getCompensationContext().stateChanged(); return null; }); runVdsCommand(VDSCommandType.ExtendStorageDomain, new ExtendStorageDomainVDSCommandParameters(getStoragePoolId(), getStorageDomain() .getId(), getParameters().getLunIds(), getParameters().isForce())); updateLunsList(); executeInNewTransaction(() -> { for (LUNs lun : getParameters().getLunsList()) { proceedLUNInDb(lun, getStorageDomain().getStorageType(), getStorageDomain().getStorage()); } setStorageDomainStatus(StorageDomainStatus.Active, null); getCompensationContext().cleanupCompensationDataAfterSuccessfulCommand(); return null; }); setSucceeded(true); }
Source:
<code>public void createUnauthorized() throws Exception { <START> context.turnOffAuthorisationSystem(); <END> MetadataFieldRest metadataFieldRest = new MetadataFieldRest(); metadataFieldRest.setElement(ELEMENT); metadataFieldRest.setQualifier(QUALIFIER); metadataFieldRest.setScopeNote(SCOPE_NOTE); getClient() .perform(post("/api/core/metadatafields") .param("schemaId", metadataSchema.getID() + "") .content(new ObjectMapper().writeValueAsBytes(metadataFieldRest)) .contentType(contentType)) .andExpect(status().isUnauthorized()); }</code><technical_language>I Auth system remain in this method</technical_language>

Target:
public void createUnauthorized() throws Exception { MetadataFieldRest metadataFieldRest = new MetadataFieldRest(); metadataFieldRest.setElement(ELEMENT); metadataFieldRest.setQualifier(QUALIFIER); metadataFieldRest.setScopeNote(SCOPE_NOTE); getClient() .perform(post("/api/core/metadatafields") .param("schemaId", metadataSchema.getID() + "") .content(new ObjectMapper().writeValueAsBytes(metadataFieldRest)) .contentType(contentType)) .andExpect(status().isUnauthorized()); }
Source:
<code>private String clearQueue(Queue queue, SampleResult res) { String retVal = null; try { QueueReceiver consumer = session.createReceiver(queue); Message deletedMsg = null; long deletedMsgCount = 0; do { deletedMsg = consumer.receiveNoWait(); if (deletedMsg != null) { deletedMsgCount++; <START> deletedMsg.acknowledge(); <END> } } while (deletedMsg != null); retVal = deletedMsgCount + " message(s) removed"; res.setResponseMessage(retVal); } catch (Exception ex) { res.setResponseMessage("Error clearing queue"); ex.printStackTrace(); LOGGER.error(ex.getMessage()); } return retVal; }</code><technical_language>this parameterized ? 4 modes, if ACK for AUTO_ACK wrong</technical_language>

Target:
private String clearQueue(Queue queue, SampleResult res) throws JMSException { String retVal; consumer = session.createReceiver(queue); Message deletedMsg; long deletedMsgCount = 0; do { deletedMsg = consumer.receive(Long.valueOf(getTimeoutAsInt())); if (deletedMsg != null) { deletedMsgCount++; } } while (deletedMsg != null); retVal = " " + deletedMsgCount + " message(s) removed"; res.setResponseMessage(retVal); return retVal; }
Source:
<code>void openFirstTimeWindow() { final boolean showProgress = PrefUtil.getAPIPreferenceStore().getBoolean( IWorkbenchPreferenceConstants.SHOW_PROGRESS_ON_STARTUP); if (!showProgress) { doOpenFirstTimeWindow(); } else { <START> final int expectedProgressCount = Math.max(1, WorkbenchPlugin.getDefault().getBundleCount()); <END> runStartupWithProgress(expectedProgressCount, () -> doOpenFirstTimeWindow()); } }</code><technical_language>I move this 2508 used</technical_language>

Target:
void openFirstTimeWindow() { final boolean showProgress = PrefUtil.getAPIPreferenceStore().getBoolean( IWorkbenchPreferenceConstants.SHOW_PROGRESS_ON_STARTUP); if (!showProgress) { doOpenFirstTimeWindow(); } else { runStartupWithProgress(() -> doOpenFirstTimeWindow()); } }
Source:
<code>public void testRemoveProject() throws Exception { StringBuilder xmlContent = new StringBuilder(); xmlContent.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n") .append("<manifest>") .append("<remote name=\"remote1\" fetch=\".\" />") .append("<default revision=\"master\" remote=\"remote1\" />") .append("<project path=\"foo\" name=\"foo\" />") .append("<project path=\"bar\" name=\"bar\" />") .append("<remove-project name=\"foo\" />") .append("<project path=\"foo\" name=\"baz\" />") .append("</manifest>"); ManifestParser parser = new ManifestParser(null, null, "master", "<LINK_0>", null, null); parser.read(new ByteArrayInputStream( xmlContent.toString().getBytes(CHARSET))); Set<String> results = new HashSet<>(); results.add("bar"); results.add("baz"); for (RepoProject proj : parser.getProjects()) { assertTrue("Unexpected project is included: " + proj.getName(), results.contains(proj.getName())); results.remove(proj.getName()); } assertTrue( "Expected projects are not included", <START> results.isEmpty()); <END> }</code><technical_language>optional: this assertion l.166 is hard read. Set<String> result = parser.getProjects().stream().map(x -> x.getName()).collect(toSet()) assertEquals(result, ImmutableSet.of("baz", "bar");</technical_language>

Target:
public void testRemoveProject() throws Exception { StringBuilder xmlContent = new StringBuilder(); xmlContent.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n") .append("<manifest>") .append("<remote name=\"remote1\" fetch=\".\" />") .append("<default revision=\"master\" remote=\"remote1\" />") .append("<project path=\"foo\" name=\"foo\" />") .append("<project path=\"bar\" name=\"bar\" />") .append("<remove-project name=\"foo\" />") .append("<project path=\"foo\" name=\"baz\" />") .append("</manifest>"); ManifestParser parser = new ManifestParser(null, null, "master", "<LINK_0>", null, null); parser.read(new ByteArrayInputStream( xmlContent.toString().getBytes(CHARSET))); assertEquals(Stream.of("bar", "baz").collect(Collectors.toSet()), parser.getProjects().stream().map(RepoProject::getName) .collect(Collectors.toSet())); }
Source:
<code>private static <K, V> void prune(Map<K, Reference<V>> map) { for (final Iterator<Map.Entry<K, Reference<V>>> i = map.entrySet() .iterator(); i.hasNext();) { final Map.Entry<K, Reference<V>> e = i.next(); if (e.getValue().get() == null) { i.remove(); } <START> } <END> }</code><technical_language>is hard read generic coding here</technical_language>

Target:
private static <K, V> void prune(Map<K, Reference<V>> map) { for (final Iterator<Map.Entry<K, Reference<V>>> i = map.entrySet() .iterator(); i.hasNext();) { if (i.next().getValue().get() == null) i.remove(); } }
Source:
<code>public DeliveryErrors executeFor(List<InboxMessage> messages) { List<Segment> segments = groupByTargetType(messages); DeliveryErrors.Builder errors = DeliveryErrors.newBuilder(); <START> for (Segment segment : segments) { <END> ShardedMessageDelivery<InboxMessage> delivery = inboxDeliveries.get(segment.typeUrl); List<InboxMessage> deliveryPackage = segment.messages; try { delivery.deliver(deliveryPackage); } catch (RuntimeException exception) { errors.addException(exception); } catch (@SuppressWarnings("ErrorNotRethrown") ModelError error) { errors.addError(error); } } return errors.build(); }</code><technical_language>run this in parallel (i.e. segments.parallelStream()</technical_language>

Target:
public DeliveryErrors executeFor(List<InboxMessage> messages) { List<Segment> segments = Segment.groupByTargetType(messages); DeliveryErrors.Builder errors = DeliveryErrors.newBuilder(); for (Segment segment : segments) { ShardedMessageDelivery<InboxMessage> delivery = inboxDeliveries.get(segment.typeUrl()); List<InboxMessage> deliveryPackage = segment.messages(); try { delivery.deliver(deliveryPackage); } catch (RuntimeException exception) { errors.addException(exception); } catch (@SuppressWarnings("ErrorNotRethrown") ModelError error) { errors.addError(error); } } return errors.build(); }
Source:
<code>public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); int selectedItemLocalId = mAdapter.getSelectedItemLocalId(); <START> if (selectedItemLocalId != 1) { <END> outState.putInt(ARG_LAST_USED_BLOG_LOCAL_ID, mAdapter.getSelectedItemLocalId()); } }</code><technical_language>conditional -1 perhaps</technical_language>

Target:
public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); int selectedItemLocalId = mAdapter.getSelectedItemLocalId(); if (selectedItemLocalId != -1) { outState.putInt(ARG_LAST_USED_BLOG_LOCAL_ID, mAdapter.getSelectedItemLocalId()); } }
Source:
<code>public PrimitiveLongIterator query( IndexQuery... predicates ) throws IndexNotApplicableKernelException { NodeValueIterator nodeValueIterator = new NodeValueIterator(); <START> query( nodeValueIterator, null, predicates ); <END> return nodeValueIterator; }</code><technical_language>avoid passing null here? introduce constant IndexOrder.NONE for instead</technical_language>

Target:
public PrimitiveLongIterator query( IndexQuery... predicates ) throws IndexNotApplicableKernelException { NodeValueIterator nodeValueIterator = new NodeValueIterator(); query( nodeValueIterator, IndexOrder.NONE, predicates ); return nodeValueIterator; }
Source:
<code>public HTMLPageAsset getPage(final HttpServletRequest request, final User user, final String uri, final PageMode mode) throws DotSecurityException, DotDataException { final String siteName = null == request.getParameter(Host.HOST_VELOCITY_VAR_NAME) ? request.getServerName() : request.getParameter(Host.HOST_VELOCITY_VAR_NAME); final Host site = this.hostWebAPI.resolveHostName(siteName, user, RESPECT_FE_ROLES); <START> final String pageUri = (uri.length()>0 && '/' == uri.charAt(0)) ? uri : ("/" + uri); <END> return (HTMLPageAsset) this.htmlPageAssetAPI.getPageByPath(pageUri, site, this.languageAPI.getDefaultLanguage().getId(), mode.respectAnonPerms); }</code><technical_language>want create a method pageUri = URLUtils.addSlashIfNeeded(uri); method name sucks, need a</technical_language>

Target:
public HTMLPageAsset getPage(final HttpServletRequest request, final User user, final String uri, final PageMode mode) throws DotSecurityException, DotDataException { final String siteName = null == request.getParameter(Host.HOST_VELOCITY_VAR_NAME) ? request.getServerName() : request.getParameter(Host.HOST_VELOCITY_VAR_NAME); final Host site = this.hostWebAPI.resolveHostName(siteName, user, RESPECT_FE_ROLES); final String pageUri = URLUtils.addSlashIfNeeded(uri); return (HTMLPageAsset) this.htmlPageAssetAPI.getPageByPath(pageUri, site, this.languageAPI.getDefaultLanguage().getId(), mode.respectAnonPerms); }
Source:
<code>public StringBuilder dateToText( Date date, StringBuilder output ){ <START> DateFormat formatter; <END> if (date.getTime() % 1000 == 0) { formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssz"); } else { formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSz"); } formatter.setTimeZone(TimeZone.getTimeZone("GMT+00:00")); String text = formatter.format(date); text = text.replace("GMT", ""); output.append( text ); return output; }</code><technical_language>add a final ensure is set: final DateFormat formatter</technical_language>

Target:
public StringBuilder dateToText( Date date, StringBuilder output ){ final DateFormat formatter; if (date.getTime() % 1000 == 0) { formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssz"); } else { formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSz"); } formatter.setTimeZone(TimeZone.getTimeZone("GMT+00:00")); String text = formatter.format(date); text = text.replace("GMT", ""); output.append( text ); return output; }
Source:
<code><START> private static String getRandomString() { <END> String alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; Random rand = new Random(); int length = 8; StringBuilder result = new StringBuilder(length); for (int i = 0; i < length; i++) { result.append(alphabet.charAt(rand.nextInt(alphabet.length()))); } return result.toString(); }</code><technical_language>give owasp zap catcher (0W45pz4p) chances however</technical_language>

Target:
private static String getRandomString() { Random rand = new Random(); StringBuilder result = new StringBuilder(RAND_STR_LEN); for (int i = 0; i < RAND_STR_LEN; i++) { result.append(alphabet.charAt(rand.nextInt(alphabet.length()))); } return result.toString(); }
Source:
<code>public long getLongMetric(String metric) { Object metricValue = event.get(metric); if (metricValue == null) { return 0L; } if (metricValue instanceof Number) { return ((Number) metricValue).longValue(); } else if (metricValue instanceof String) { try { String s = ((String) metricValue).replace(",", ""); <START> return s.contains(".") ? Math.round(Double.valueOf(s)) : Long.valueOf(s); <END> } catch (Exception e) { throw new ParseException(e, "Unable to parse metrics[%s], value[%s]", metric, metricValue); } } else { throw new ParseException("Unknown type[%s]", metricValue.getClass()); } }</code><technical_language>rounding more consistent Double.longValue, in 0.6.x cast long aggregating in longSum</technical_language>

Target:
public long getLongMetric(String metric) { Object metricValue = event.get(metric); if (metricValue == null) { return 0L; } if (metricValue instanceof Number) { return ((Number) metricValue).longValue(); } else if (metricValue instanceof String) { try { String s = ((String) metricValue).replace(",", ""); return LONG_PAT.matcher(s).matches() ? Long.valueOf(s) : Double.valueOf(s).longValue(); } catch (Exception e) { throw new ParseException(e, "Unable to parse metrics[%s], value[%s]", metric, metricValue); } } else { throw new ParseException("Unknown type[%s]", metricValue.getClass()); } }
Source:
<code>public NetworkDiagnostics( Network network, LinkProperties lp, PrivateDnsConfig privateDnsCfg, long timeoutMs) { mNetwork = network; mLinkProperties = lp; mPrivateDnsCfg = privateDnsCfg; mInterfaceIndex = getInterfaceIndex(mLinkProperties.getInterfaceName()); mTimeoutMs = timeoutMs; mStartTime = now(); mDeadlineTime = mStartTime + mTimeoutMs; if (mLinkProperties.isReachable(TEST_DNS4)) { mLinkProperties.addDnsServer(TEST_DNS4); } if (mLinkProperties.hasGlobalIpv6Address() || mLinkProperties.hasIpv6DefaultRoute()) { mLinkProperties.addDnsServer(TEST_DNS6); } for (RouteInfo route : mLinkProperties.getRoutes()) { if (route.hasGateway()) { InetAddress gateway = route.getGateway(); prepareIcmpMeasurement(gateway); if (route.isIPv6Default()) { prepareExplicitSourceIcmpMeasurements(gateway); } } } for (InetAddress nameserver : mLinkProperties.getDnsServers()) { prepareIcmpMeasurement(nameserver); prepareDnsMeasurement(nameserver); <START> prepareDnsTlsMeasurement("", nameserver); <END> } for (InetAddress tlsNameserver : mPrivateDnsCfg.ips) { if (mLinkProperties.isReachable(tlsNameserver)) { prepareDnsTlsMeasurement(mPrivateDnsCfg.hostname, tlsNameserver); } } mCountDownLatch = new CountDownLatch(totalMeasurementCount()); startMeasurements(); mDescription = "ifaces{" + TextUtils.join(",", mLinkProperties.getAllInterfaceNames()) + "}" + " index{" + mInterfaceIndex + "}" + " network{" + mNetwork + "}" + " nethandle{" + mNetwork.getNetworkHandle() + "}"; }</code><technical_language>reason "" instead of null</technical_language>

Target:
public NetworkDiagnostics( Network network, LinkProperties lp, PrivateDnsConfig privateDnsCfg, long timeoutMs) { mNetwork = network; mLinkProperties = lp; mPrivateDnsCfg = privateDnsCfg; mInterfaceIndex = getInterfaceIndex(mLinkProperties.getInterfaceName()); mTimeoutMs = timeoutMs; mStartTime = now(); mDeadlineTime = mStartTime + mTimeoutMs; if (mLinkProperties.isReachable(TEST_DNS4)) { mLinkProperties.addDnsServer(TEST_DNS4); } if (mLinkProperties.hasGlobalIpv6Address() || mLinkProperties.hasIpv6DefaultRoute()) { mLinkProperties.addDnsServer(TEST_DNS6); } for (RouteInfo route : mLinkProperties.getRoutes()) { if (route.hasGateway()) { InetAddress gateway = route.getGateway(); prepareIcmpMeasurement(gateway); if (route.isIPv6Default()) { prepareExplicitSourceIcmpMeasurements(gateway); } } } for (InetAddress nameserver : mLinkProperties.getDnsServers()) { prepareIcmpMeasurement(nameserver); prepareDnsMeasurement(nameserver); prepareDnsTlsMeasurement(null , nameserver); } for (InetAddress tlsNameserver : mPrivateDnsCfg.ips) { if (mLinkProperties.isReachable(tlsNameserver)) { prepareDnsTlsMeasurement(mPrivateDnsCfg.hostname, tlsNameserver); } } mCountDownLatch = new CountDownLatch(totalMeasurementCount()); startMeasurements(); mDescription = "ifaces{" + TextUtils.join(",", mLinkProperties.getAllInterfaceNames()) + "}" + " index{" + mInterfaceIndex + "}" + " network{" + mNetwork + "}" + " nethandle{" + mNetwork.getNetworkHandle() + "}"; }
Source:
<code>public EventProcessor buildEventProcessor() { <START> Objects.requireNonNull(processEvent); <END> Objects.requireNonNull(eventProcessorStore); final TracerProvider tracerProvider = new TracerProvider(ServiceLoader.load(Tracer.class)); return new EventProcessor(eventHubClientBuilder, this.consumerGroup, getPartitionProcessorSupplier(), EventPosition.earliest(), eventProcessorStore, tracerProvider); }</code><technical_language>nit: add message</technical_language>

Target:
public EventProcessor buildEventProcessor() { Objects.requireNonNull(processEvent, "'processEvent' cannot be null"); Objects.requireNonNull(eventProcessorStore, "'eventProcessStore' cannot be null"); Objects.requireNonNull(consumerGroup, "'consumerGroup' cannot be null"); final TracerProvider tracerProvider = new TracerProvider(ServiceLoader.load(Tracer.class)); return new EventProcessor(eventHubClientBuilder, this.consumerGroup, getPartitionProcessorSupplier(), EventPosition.earliest(), eventProcessorStore, tracerProvider); }
Source:
<code>private void updateVertexBuffer(final PointCloud2 pointCloud) { Preconditions.checkArgument(pointCloud.getHeight() == 1); Preconditions.checkArgument(pointCloud.getIsDense()); Preconditions.checkArgument(pointCloud.getFields().size() == 3); Preconditions.checkArgument(pointCloud.getFields().get(0).getDatatype() == PointField.FLOAT32); Preconditions.checkArgument(pointCloud.getFields().get(1).getDatatype() == PointField.FLOAT32); Preconditions.checkArgument(pointCloud.getFields().get(2).getDatatype() == PointField.FLOAT32); Preconditions.checkArgument(pointCloud.getPointStep() == 16); Preconditions.checkArgument(pointCloud.getData().order().equals(ByteOrder.LITTLE_ENDIAN)); final int numVertices = (pointCloud.getRowStep() / pointCloud.getPointStep() + 1 ) * 3 ; if (vertexBackBuffer == null || vertexBackBuffer.capacity() < numVertices) { vertexBackBuffer = Vertices.allocateBuffer(numVertices); } vertexBackBuffer.clear(); vertexBackBuffer.put(0.f); vertexBackBuffer.put(0.f); vertexBackBuffer.put(0.f); final ChannelBuffer buffer = pointCloud.getData(); while (buffer.readable()) { vertexBackBuffer.put(buffer.readFloat()); vertexBackBuffer.put(buffer.readFloat()); buffer.readFloat(); buffer.readFloat(); <START> vertexBackBuffer.put(0.f); <END> } vertexBackBuffer.position(0); synchronized (mutex) { FloatBuffer tmp = vertexFrontBuffer; vertexFrontBuffer = vertexBackBuffer; vertexBackBuffer = tmp; } }</code><technical_language>move this z data</technical_language>

Target:
private void updateVertexBuffer(final PointCloud2 pointCloud) { Preconditions.checkArgument(pointCloud.getHeight() == 1); Preconditions.checkArgument(pointCloud.getIsDense()); Preconditions.checkArgument(pointCloud.getFields().size() == 3); Preconditions.checkArgument(pointCloud.getFields().get(0).getDatatype() == PointField.FLOAT32); Preconditions.checkArgument(pointCloud.getFields().get(1).getDatatype() == PointField.FLOAT32); Preconditions.checkArgument(pointCloud.getFields().get(2).getDatatype() == PointField.FLOAT32); Preconditions.checkArgument(pointCloud.getPointStep() == 16); Preconditions.checkArgument(pointCloud.getData().order().equals(ByteOrder.LITTLE_ENDIAN)); final int numVertices = (pointCloud.getRowStep() / pointCloud.getPointStep() + 1 ) * 3 ; if (vertexBackBuffer == null || vertexBackBuffer.capacity() < numVertices) { vertexBackBuffer = Vertices.allocateBuffer(numVertices); } vertexBackBuffer.clear(); vertexBackBuffer.put(0.f); vertexBackBuffer.put(0.f); vertexBackBuffer.put(0.f); final ChannelBuffer buffer = pointCloud.getData(); while (buffer.readable()) { vertexBackBuffer.put(buffer.readFloat()); vertexBackBuffer.put(buffer.readFloat()); vertexBackBuffer.put(0.f); buffer.readFloat(); buffer.readFloat(); } vertexBackBuffer.position(0); synchronized (mutex) { FloatBuffer tmp = vertexFrontBuffer; vertexFrontBuffer = vertexBackBuffer; vertexBackBuffer = tmp; } }