auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public ArrayList<VdcReturnValueBase> execute() { if (parameters == null || parameters.isEmpty()) { log.info("{} of type '{}' invoked with no actions", this.getClass().getSimpleName(), actionType); return new ArrayList<VdcReturnValueBase>(); } ArrayList<VdcReturnValueBase> returnValues = new ArrayList<VdcReturnValueBase>(); try { VdcReturnValueBase returnValue; for (VdcActionParametersBase parameter : getParameters()) { parameter.setMultipleAction(true); returnValue = ExecutionHandler.evaluateCorrelationId(parameter); if (returnValue == null) { CommandBase<?> command = isInternal ? CommandsFactory.createCommand(actionType, parameter, commandContext.clone() .withoutCompensationContext()) : CommandsFactory.createCommand(actionType, parameter); command.setInternalExecution(isInternal); getCommands().add(command); } else { returnValues.add(returnValue); } } if (getCommands().size() == 1) { CorrelationIdTracker.setCorrelationId(getCommands().get(0).getCorrelationId()); returnValues.add(getCommands().get(0).canDoActionOnly()); } else { checkCanDoActionsAsynchronously(returnValues); } boolean canRunActions = true; if (isRunOnlyIfAllCanDoPass) { for (VdcReturnValueBase value : returnValues) { if (!value.getCanDoAction()) { canRunActions = false; break; } } } if (canRunActions) { if (isWaitForResult) { invokeSyncCommands(); } else { invokeCommands(); } } } catch (RuntimeException e) { log.error("Failed to execute multiple actions of type '{}': ", actionType, e.getMessage()); log.debug("Exception", e); } return returnValues; }

Target:
public ArrayList<VdcReturnValueBase> execute() { if (parameters == null || parameters.isEmpty()) { log.info("{} of type '{}' invoked with no actions", this.getClass().getSimpleName(), actionType); return new ArrayList<VdcReturnValueBase>(); } ArrayList<VdcReturnValueBase> returnValues = new ArrayList<VdcReturnValueBase>(); try { VdcReturnValueBase returnValue; for (VdcActionParametersBase parameter : getParameters()) { parameter.setMultipleAction(true); returnValue = ExecutionHandler.evaluateCorrelationId(parameter); if (returnValue == null) { CommandBase<?> command = isInternal ? CommandsFactory.createCommand(actionType, parameter, commandContext.clone() .withoutCompensationContext()) : CommandsFactory.createCommand(actionType, parameter); command.setInternalExecution(isInternal); getCommands().add(command); } else { returnValues.add(returnValue); } } if (getCommands().size() == 1) { CorrelationIdTracker.setCorrelationId(getCommands().get(0).getCorrelationId()); returnValues.add(getCommands().get(0).canDoActionOnly()); } else { checkCanDoActionsAsynchronously(returnValues); } boolean canRunActions = true; if (isRunOnlyIfAllCanDoPass) { for (VdcReturnValueBase value : returnValues) { if (!value.getCanDoAction()) { canRunActions = false; break; } } } if (canRunActions) { if (isWaitForResult) { invokeSyncCommands(); } else { invokeCommands(); } } } catch (RuntimeException e) { log.error("Failed to execute multiple actions of type '{}': {}", actionType, e.getMessage()); log.error("Exception", e); } return returnValues; }
Source:
private Object getOutputChannelFromRoutingSlip(Object reply, Message<?> requestMessage, List<?> routingSlip, AtomicInteger routingSlipIndex) { if (routingSlip.size() == routingSlipIndex.get()) { return null; } Object path = routingSlip.get(routingSlipIndex.get()); Object routingSlipPathValue = null; if (path instanceof String) { routingSlipPathValue = getBeanFactory().getBean((String) path); } else if (path instanceof RoutingSlipRouteStrategy) { routingSlipPathValue = path; } else { throw new IllegalArgumentException("The RoutingSlip 'path' can be of " + "String or RoutingSlipRouteStrategy type, but gotten: " + path); } if (routingSlipPathValue instanceof MessageChannel) { routingSlipIndex.incrementAndGet(); return routingSlipPathValue; } else { String nextPath = ((RoutingSlipRouteStrategy) routingSlipPathValue).getNextPath(requestMessage, reply); if (StringUtils.hasText(nextPath)) { return nextPath; } else { routingSlipIndex.incrementAndGet(); return getOutputChannelFromRoutingSlip(reply, requestMessage, routingSlip, routingSlipIndex); } } }

Target:
private Object getOutputChannelFromRoutingSlip(Object reply, Message<?> requestMessage, List<?> routingSlip, AtomicInteger routingSlipIndex) { if (routingSlipIndex.get() >= routingSlip.size()) { return null; } Object path = routingSlip.get(routingSlipIndex.get()); Object routingSlipPathValue = null; if (path instanceof String) { routingSlipPathValue = getBeanFactory().getBean((String) path); } else if (path instanceof RoutingSlipRouteStrategy) { routingSlipPathValue = path; } else { throw new IllegalArgumentException("The RoutingSlip 'path' can be of " + "String or RoutingSlipRouteStrategy type, but gotten: " + path); } if (routingSlipPathValue instanceof MessageChannel) { routingSlipIndex.incrementAndGet(); return routingSlipPathValue; } else { String nextPath = ((RoutingSlipRouteStrategy) routingSlipPathValue).getNextPath(requestMessage, reply); if (StringUtils.hasText(nextPath)) { return nextPath; } else { routingSlipIndex.incrementAndGet(); return getOutputChannelFromRoutingSlip(reply, requestMessage, routingSlip, routingSlipIndex); } } }
Source:
public int hashCode() { int result = id; result = 31 * result + (name != null ? name.hashCode() : 0); return result; }

Target:
public int hashCode() { return Objects.hash(id, name); }
Source:
public boolean oldValueRequired() { CacheContinuousQueryHandler hnd0 = cacheHandler(); if (hnd0 == null) return false; return hnd0.oldValueRequired(); }

Target:
public boolean oldValueRequired() { CacheContinuousQueryHandler hnd0 = cacheHandler(); return hnd0 != null && hnd0.oldValueRequired(); }
Source:
public BaseResourceSelectionComposite(Composite parent, int style) { super(parent, style | SWT.CHECK); SarosPluginContext.initComponent(this); super.setLayout(LayoutUtils.createGridLayout()); this.checkboxTreeViewer = getViewer(); this.checkboxTreeViewer.getControl().setLayoutData(LayoutUtils.createFillGridData()); this.checkboxTreeViewer.setInput(ResourcesPlugin.getWorkspace().getRoot()); this.checkboxTreeViewer.addCheckStateListener(checkStateListener); addDisposeListener(e -> checkboxTreeViewer.removeCheckStateListener(checkStateListener)); this.checkboxTreeViewer.addFilter(sharedResourcesFilter); this.resourceSelectionListeners = new ArrayList<>(); this.selectedBaseResources = new ArrayList<>(); this.lastSelected = new Stack<>(); this.prevSelected = new Stack<>(); }

Target:
public BaseResourceSelectionComposite(Composite parent, int style) { super(parent, style | SWT.CHECK); SarosPluginContext.initComponent(this); super.setLayout(LayoutUtils.createGridLayout()); this.checkboxTreeViewer = getViewer(); this.checkboxTreeViewer.getControl().setLayoutData(LayoutUtils.createFillGridData()); this.checkboxTreeViewer.setInput(ResourcesPlugin.getWorkspace().getRoot()); this.checkboxTreeViewer.addCheckStateListener(checkStateListener); addDisposeListener(e -> checkboxTreeViewer.removeCheckStateListener(checkStateListener)); this.checkboxTreeViewer.addFilter(sharedResourcesFilter); this.resourceSelectionListeners = new ArrayList<>(); this.selectedBaseContainers = new ArrayList<>(); this.lastSelected = new LinkedList<>(); this.prevSelected = new LinkedList<>(); }
Source:
public void testRead() throws Exception { seekAndVerify(50); byte[] b = new byte[200]; blockStream.read(b, 0, 200); matchWithInputData(b, 50, 250); Assert.assertEquals(250, blockStream.getPos()); Assert.assertEquals(2, blockStream.getChunkIndex()); }

Target:
public void testRead() throws Exception { seekAndVerify(50); byte[] b = new byte[200]; blockStream.read(b, 0, 200); matchWithInputData(b, 50, 200); Assert.assertEquals(250, blockStream.getPos()); Assert.assertEquals(2, blockStream.getChunkIndex()); }
Source:
public CosemObisCode(final int[] code) { if (code.length != 6) { throw new IllegalArgumentException("ObisCode must have 6 values: " + code.length); } this.a = code[0]; this.b = code[1]; this.c = code[2]; this.d = code[3]; this.e = code[4]; this.f = code[5]; this.checkValues(); }

Target:
public CosemObisCode(final int[] code) { if (code.length != 6) { throw new IllegalArgumentException("ObisCode must have 6 values: " + code.length); } this.a = code[0]; this.b = code[1]; this.c = code[2]; this.d = code[3]; this.e = code[4]; this.f = code[5]; this.checkValues(this.a, this.b, this.c, this.d, this.e, this.f); }
Source:
protected static List<ImageDescriptor> getImages(String value, Bundle definingBundle) { List<URL> urls = getURLs(value, definingBundle); if (urls == null || urls.isEmpty()) { return Collections.emptyList(); } List<ImageDescriptor> images = new ArrayList<>(urls.size()); urls.forEach(u -> images.add(ImageDescriptor.createFromURL(u))); return images; }

Target:
protected static List<ImageDescriptor> getImages(String value, Bundle definingBundle) { List<URL> urls = getURLs(value, definingBundle); if (urls.isEmpty()) { return Collections.emptyList(); } return urls.stream().map(u -> ImageDescriptor.createFromURL(u)) .collect(Collectors.toList()); }
Source:
protected VirtualGuestBlockDeviceTemplateGroup(int id, @Nullable String name, @Nullable String globalIdentifier, int statusId, int accountId, int parentId, @Nullable String summary, @Nullable Set<VirtualGuestBlockDeviceTemplateGroup> children, @Nullable Set<VirtualGuestBlockDeviceTemplate> blockDevices) { this.id = checkNotNull(id, "id"); this.name = name; this.globalIdentifier = globalIdentifier; this.statusId = checkNotNull(statusId, "statusId"); this.accountId = checkNotNull(accountId, "accountId"); this.parentId = checkNotNull(parentId, "parentId"); this.summary = summary; this.children = children == null ? ImmutableSet.<VirtualGuestBlockDeviceTemplateGroup>of() : ImmutableSet.copyOf(children); this.blockDevices = blockDevices == null ? ImmutableSet.<VirtualGuestBlockDeviceTemplate>of() : ImmutableSet.copyOf(blockDevices); }

Target:
protected VirtualGuestBlockDeviceTemplateGroup(int id, @Nullable String name, @Nullable String globalIdentifier, int statusId, int accountId, int parentId, @Nullable String summary, @Nullable Set<VirtualGuestBlockDeviceTemplateGroup> children, @Nullable Set<VirtualGuestBlockDeviceTemplate> blockDevices) { this.id = id; this.name = name; this.globalIdentifier = globalIdentifier; this.statusId = statusId; this.accountId = accountId; this.parentId = parentId; this.summary = summary; this.children = children == null ? ImmutableSet.<VirtualGuestBlockDeviceTemplateGroup>of() : ImmutableSet.copyOf(children); this.blockDevices = blockDevices == null ? ImmutableSet.<VirtualGuestBlockDeviceTemplate>of() : ImmutableSet.copyOf(blockDevices); }
Source:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + desiredCaretPosition; result = prime * result + ((message == null) ? 0 : message.hashCode()); return result; }

Target:
public int hashCode() { return Objects.hash(message, Integer.valueOf(desiredCaretPosition)); }
Source:
protected void configure() { synchronized (lock) { if (alreadyBound) { if (!boundType.equals(getClass())) { throw new RuntimeException("You are trying to use more than one DispatchAsync implementation. " + boundType.getName() + " was already installed."); } } else { alreadyBound = true; boundType = getClass(); bind(ExceptionHandler.class).to(exceptionHandlerType); bind(SecurityCookieAccessor.class).to(sessionAccessorType); bind(ClientActionHandlerRegistry.class).to(clientActionHandlerRegistryType).asEagerSingleton(); } } }

Target:
protected void configure() { if (alreadyBound) { if (!boundType.equals(getClass())) { throw new RuntimeException("You are trying to use more than one DispatchAsync implementation. " + boundType.getName() + " was already installed."); } } else { alreadyBound = true; boundType = getClass(); bind(ExceptionHandler.class).to(exceptionHandlerType); bind(SecurityCookieAccessor.class).to(sessionAccessorType); bind(ClientActionHandlerRegistry.class).to(clientActionHandlerRegistryType).asEagerSingleton(); } }
Source:
public void testGetCustomData(boolean createRepresentationInSeparateResource) throws Exception { TestsUtil.setCreateRepresentationInSeparateResource(createRepresentationInSeparateResource); DDiagram diagram2 = (DDiagram) createRepresentation(ENTITIES_DESC_NAME); final DFeatureExtension eClass = createExtension(); Command cmd = new RecordingCommand(session.getTransactionalEditingDomain()) { @Override protected void doExecute() { session.getServices().putCustomData(CustomDataConstants.DFEATUREEXTENSION, diagram2, eClass); session.save(defaultProgress); } }; executeCommand(cmd); Collection<EObject> collected; collected = session.getServices().getCustomData(CustomDataConstants.DFEATUREEXTENSION, null); assertEquals(1, collected.size()); assertTrue(collected.contains(eClass)); if (TestsUtil.isCreateRepresentationInSeparateResource()) { collected = session.getServices().getCustomData(CustomDataConstants.DFEATUREEXTENSION, diagram2); assertEquals(1, collected.size()); assertTrue(collected.contains(eClass)); } }

Target:
public void testGetCustomData(boolean createRepresentationInSeparateResource) throws Exception { TestsUtil.setCreateRepresentationInSeparateResource(createRepresentationInSeparateResource); DDiagram diagram2 = (DDiagram) createRepresentation(ENTITIES_DESC_NAME); final DFeatureExtension eClass = createExtension(); Command cmd = new RecordingCommand(session.getTransactionalEditingDomain()) { @Override protected void doExecute() { session.getServices().putCustomData(CustomDataConstants.DFEATUREEXTENSION, diagram2, eClass); session.save(defaultProgress); } }; executeCommand(cmd); Collection<EObject> collected; collected = session.getServices().getCustomData(CustomDataConstants.DFEATUREEXTENSION, null); assertEquals(1, collected.size()); assertTrue(collected.contains(eClass)); collected = session.getServices().getCustomData(CustomDataConstants.DFEATUREEXTENSION, diagram2); assertEquals(1, collected.size()); assertTrue(collected.contains(eClass)); }
Source:
public void removeBreakpoints(IBreakpoint[] breakpoints, final boolean delete) throws CoreException { final List<IBreakpoint> remove = new ArrayList<>(breakpoints.length); List<IBreakpoint> bps = getBreakpoints0(); for (IBreakpoint breakpoint : breakpoints) { if (bps.contains(breakpoint)) { remove.add(breakpoint); } } if (!remove.isEmpty()) { for (IBreakpoint breakpoint : remove) { bps.remove(breakpoint); fMarkersToBreakpoints.remove(breakpoint.getMarker()); } fireUpdate(remove, null, REMOVED); refreshTriggerpointDisplay(); IWorkspaceRunnable r = montitor -> { for (IBreakpoint breakpoint : remove) { if (delete) { breakpoint.delete(); } else { IMarker marker = breakpoint.getMarker(); if (marker.exists()) { IProject project = breakpoint.getMarker().getResource().getProject(); if (project == null || project.isOpen()) { breakpoint.setRegistered(false); } } } } }; getWorkspace().run(r, null, 0, null); } }

Target:
public void removeBreakpoints(IBreakpoint[] breakpoints, final boolean delete) throws CoreException { final List<IBreakpoint> remove = new ArrayList<>(breakpoints.length); List<IBreakpoint> bps = getBreakpoints0(); for (IBreakpoint breakpoint : breakpoints) { if (bps.contains(breakpoint)) { remove.add(breakpoint); } } if (!remove.isEmpty()) { for (IBreakpoint breakpoint : remove) { bps.remove(breakpoint); fMarkersToBreakpoints.remove(breakpoint.getMarker()); } fireUpdate(remove, null, REMOVED); refreshTriggerpointDisplay(); IWorkspaceRunnable r = monitor -> { for (IBreakpoint breakpoint : remove) { if (delete) { breakpoint.delete(); } else { IMarker marker = breakpoint.getMarker(); if (marker.exists()) { IProject project = breakpoint.getMarker().getResource().getProject(); if (project == null || project.isOpen()) { breakpoint.setRegistered(false); } } } } }; getWorkspace().run(r, null, 0, null); } }
Source:
public void handle(CacheRpcCommand command, Reply reply, DeliverOrder order) { if (command instanceof EndInvalidationCommand) { ExpectingEndInvalidationCommand cmd = new ExpectingEndInvalidationCommand((EndInvalidationCommand) command, latch); delegate.handle(cmd, reply, order); } else { delegate.handle(command, reply, order); } }

Target:
public void handle(CacheRpcCommand command, Reply reply, DeliverOrder order) { if (command instanceof EndInvalidationCommand) { delegate.handle(command, response -> { latch.countDown(); log.tracef("Latch after count down %s", latch); reply.reply(response); }, order); } else { delegate.handle(command, reply, order); } }
Source:
public PutJobResult call() throws Exception { try { final ModifyJobRequest request = new ModifyJobRequest(jobId); if (priority != null) { request.withPriority(priority); } getClient().modifyJob(request); } catch (IOException e) { throw new CommandException("Error: Request failed with the following error: " + e.getMessage(), e); } String result = "Success: Modified job with job id '" + jobId.toString() + "'"; if (priority != null) { result = result.concat(" with priority " + priority.toString()); } return new PutJobResult(result + "."); }

Target:
public PutJobResult call() throws Exception { try { final ModifyJobRequest request = new ModifyJobRequest(jobId); if (priority != null) { request.withPriority(priority); } getClient().modifyJob(request); } catch (final IOException e) { throw new CommandException("Error: Request failed with the following error: " + e.getMessage(), e); } String result = "Success: Modified job with job id '" + jobId.toString() + "'"; if (priority != null) { result = result.concat(" with priority " + priority.toString()); } return new PutJobResult(result + "."); }
Source:
private void handleTextWebSocketMessage(TextCarbonMessage textCarbonMessage, PatternPathRouter.RoutableDestination<Object> routableEndpoint, Session session) { Object endpoint = routableEndpoint.getDestination(); Map<String, String> paramValues = routableEndpoint.getGroupNameValues(); Method method = new EndpointDispatcher().getOnStringMessageMethod(endpoint); try { List<Object> parameterList = new LinkedList<>(); boolean isStringSatifsfied = false; Arrays.stream(method.getParameters()).forEach( parameter -> { if (parameter.getType() == String.class) { PathParam pathParam = parameter.getAnnotation(PathParam.class); if (pathParam == null) { parameterList.add(textCarbonMessage.getText()); } else { if (isStringSatifsfied == false) { parameterList.add(paramValues.get(pathParam.value())); } else { parameterList.add(null); throw new IllegalArgumentException("String parameters without" + " @PathParam annotation"); } } } else if (parameter.getType() == Session.class) { parameterList.add(session); } else { parameterList.add(null); } } ); executeMethod(method, endpoint, parameterList, session); } catch (Throwable throwable) { handleError(textCarbonMessage, throwable, routableEndpoint, session); } }

Target:
private void handleTextWebSocketMessage(TextCarbonMessage textCarbonMessage, PatternPathRouter.RoutableDestination<Object> routableEndpoint, Session session) { Object endpoint = routableEndpoint.getDestination(); Map<String, String> paramValues = routableEndpoint.getGroupNameValues(); Optional<Method> methodOptional = new EndpointDispatcher().getOnStringMessageMethod(endpoint); try { methodOptional.ifPresent( method -> { List<Object> parameterList = new LinkedList<>(); boolean isStringSatifsfied = false; Arrays.stream(method.getParameters()).forEach( parameter -> { if (parameter.getType() == String.class) { PathParam pathParam = parameter.getAnnotation(PathParam.class); if (pathParam == null) { parameterList.add(textCarbonMessage.getText()); } else { if (!isStringSatifsfied) { parameterList.add(paramValues.get(pathParam.value())); } else { throw new IllegalArgumentException("String parameters without" + " @PathParam annotation"); } } } else if (parameter.getType() == Session.class) { parameterList.add(session); } else { parameterList.add(null); } } ); executeMethod(method, endpoint, parameterList, session); } ); } catch (Throwable throwable) { handleError(throwable, routableEndpoint, session); } }
Source:
public List<Feature> getInstallationProfiles() { LOGGER.debug("Looking for installation profile features"); List<Feature> profiles = new ArrayList<>(); try { profiles = Arrays.asList(featuresService.listFeatures()) .stream() .filter(f -> f.getName().contains(INSTALLATION_PROFILE_PREFIX)) .sorted(Comparator.comparingInt(Feature::getStartLevel)) .collect(Collectors.toList()); } catch (Exception e) { LOGGER.warn( "Encountered an error while trying to obtain the installation profile features.", e); } return profiles; }

Target:
public List<Feature> getInstallationProfiles() { LOGGER.debug("Looking for installation profile features"); List<Feature> profiles = new ArrayList<>(); try { profiles = Arrays.stream(featuresService.listFeatures()) .filter(f -> f.getName().contains(INSTALLATION_PROFILE_PREFIX)) .sorted(Comparator.comparingInt(Feature::getStartLevel)) .collect(Collectors.toList()); } catch (Exception e) { LOGGER.warn( "Encountered an error while trying to obtain the installation profile features.", e); } return profiles; }
Source:
public void checkForUpdates() { visit("advanced"); clickButton("Check now"); updated = true; }

Target:
public void checkForUpdates() { visit("advanced"); final String current = getCurrentUrl(); clickButton("Check now"); waitFor(find(by.button("Check now"))).withTimeout(30, TimeUnit.SECONDS).until(new Predicate<WebElement>() { @Override public boolean apply(@Nullable WebElement webElement) { try { try { webElement.findElement(by.id("it does not matter")); } catch(StaleElementReferenceException e) { if (current.equals(getCurrentUrl())) { return true; } } } catch(Exception e) { } return true; } }); updated = true; }
Source:
private Timer newNettyTimer(AsyncHttpClientConfig config) { ThreadFactory threadFactory = config.getThreadFactory() != null ? config.getThreadFactory() : new DefaultThreadFactory(config.getThreadPoolName()); HashedWheelTimer timer = new HashedWheelTimer(threadFactory); timer.start(); return timer; }

Target:
private Timer newNettyTimer(AsyncHttpClientConfig config) { ThreadFactory threadFactory = config.getThreadFactory() != null ? config.getThreadFactory() : new DefaultThreadFactory(config.getThreadPoolName() + "-timer"); HashedWheelTimer timer = new HashedWheelTimer(threadFactory); timer.start(); return timer; }
Source:
public void testNewPomStructure() throws IOException, XmlPullParserException { final File projectDir = getProjectDir(SPACE_B, PROJECT_B2), pom = new File(projectDir, "pom.xml"); final MavenXpp3Reader reader = new MavenXpp3Reader(); final Model model = reader.read(new FileInputStream(pom)); assertThat(model.getVersion()).isEqualTo("1.2.3"); assertThat(model.getDependencies().size()).isEqualTo(6); assertThat(model.getBuild().getPlugins().size()).isEqualTo(1); assertThat(model.getPackaging()).isEqualTo("kjar"); }

Target:
public void testNewPomStructure() throws IOException, XmlPullParserException { final File projectDir = getProjectDir(SPACE_B, PROJECT_B2), pom = new File(projectDir, "pom.xml"); final MavenXpp3Reader reader = new MavenXpp3Reader(); final Model model = reader.read(new FileInputStream(pom)); assertThat(model.getVersion()).isEqualTo("1.2.3"); assertThat(model.getDependencies()).hasSize(6); assertThat(model.getBuild().getPlugins()).hasSize(1); assertThat(model.getPackaging()).isEqualTo("kjar"); }
Source:
private void emitReset(StringBuilder builder) { builder.append(" public static void reset(").append(targetClass) .append(" target) {\n"); if (parentInjector != null) { builder.append(" ").append(parentInjector) .append(".reset(target);\n\n"); } for (ViewInjection injection : viewIdMap.values()) { for (ViewBinding viewBinding : injection.getViewBindings()) { builder.append(" target.").append(viewBinding.getName()) .append(" = null;\n"); } } for (ResourceInjection injection : resourceIdMap.values()) { for (ResourceBinding binding : injection.getResourceBindings()) { builder.append(" target.").append(binding.getName()) .append(" = null;\n"); } } for (CollectionBinding collectionBinding : collectionBindings.keySet()) { builder.append(" target.").append(collectionBinding.getName()) .append(" = null;\n"); } builder.append(" }\n"); }

Target:
private void emitReset(StringBuilder builder) { builder.append(" public static void reset(").append(targetClass) .append(" target) {\n"); if (parentInjector != null) { builder.append(" ").append(parentInjector) .append(".reset(target);\n\n"); } for (ViewInjection injection : viewIdMap.values()) { for (ViewBinding viewBinding : injection.getViewBindings()) { builder.append(" target.").append(viewBinding.getName()) .append(" = null;\n"); } } for (CollectionBinding collectionBinding : collectionBindings.keySet()) { builder.append(" target.").append(collectionBinding.getName()) .append(" = null;\n"); } builder.append(" }\n"); }
Source:
public static boolean isFlashEdgeCase( byte[] request , int requestsize ){ byte[] req = "<policy-file-request/>".getBytes( UTF8_CHARSET ); for( int i = 0 ; i < requestsize && i < req.length ; i++ ){ if( req[i] != request[i] ){ return false; } } return requestsize >= req.length; }

Target:
public static boolean isFlashEdgeCase( byte[] request , int requestsize ){ for( int i = 0 ; i < requestsize && i < FLASH_POLICY_REQUEST.length ; i++ ){ if( FLASH_POLICY_REQUEST[i] != request[i] ){ return false; } } return requestsize >= FLASH_POLICY_REQUEST.length; }
Source:
private static void injectSoundFileInStream( MediaStream stream, String fileName) throws Throwable { OpusFile of = new OpusFile(new OggPacketReader( Util.class.getClassLoader().getResourceAsStream(fileName))); OpusAudioData opusAudioData; int seq = new Random().nextInt(0xFFFF); long ts = new Random().nextInt(0xFFFF); long ssrc = new Random().nextInt(0xFFFF); byte pt = stream.getDynamicRTPPayloadType(Constants.OPUS); long timePushPreviousData = 0; while ((opusAudioData = of.getNextAudioPacket()) != null) { if (seq > AbstractCodec2.SEQUENCE_MAX) { seq = 0; } int nSamples = opusAudioData.getNumberOfSamples(); ts += nSamples; if (ts > TimestampUtils.MAX_TIMESTAMP_VALUE) { ts = ts - TimestampUtils.MAX_TIMESTAMP_VALUE; } byte[] data = opusAudioData.getData(); RawPacket rtp = Util.makeRTP( ssrc, pt, seq++, ts, data.length + RawPacket.FIXED_HEADER_SIZE ); System.arraycopy( data, 0, rtp.getBuffer(), rtp.getPayloadOffset(), data.length); long sleepTime = nSamples/48 - (System.currentTimeMillis() - timePushPreviousData); if (sleepTime < 0) sleepTime = 0; Thread.sleep(sleepTime); stream.injectPacket(rtp, true, null); timePushPreviousData = System.currentTimeMillis(); } }

Target:
private static void injectSoundFileInStream( MediaStream stream, String fileName) throws Throwable { OpusFile of = new OpusFile(new OggPacketReader( Util.class.getClassLoader().getResourceAsStream(fileName))); OpusAudioData opusAudioData; int seq = new Random().nextInt(0xFFFF); long ts = new Random().nextInt(0xFFFF); long ssrc = new Random().nextInt(0xFFFF); byte pt = stream.getDynamicRTPPayloadType(Constants.OPUS); long timeForNextPacket = System.currentTimeMillis(); long sentDuration = 0; while ((opusAudioData = of.getNextAudioPacket()) != null) { if (seq > AbstractCodec2.SEQUENCE_MAX) { seq = 0; } int nSamples = opusAudioData.getNumberOfSamples(); ts += nSamples; if (ts > TimestampUtils.MAX_TIMESTAMP_VALUE) { ts = ts - TimestampUtils.MAX_TIMESTAMP_VALUE; } byte[] data = opusAudioData.getData(); RawPacket rtp = Util.makeRTP( ssrc, pt, seq++, ts, data.length + RawPacket.FIXED_HEADER_SIZE ); System.arraycopy( data, 0, rtp.getBuffer(), rtp.getPayloadOffset(), data.length); int duration = nSamples/48; timeForNextPacket += duration; sentDuration += duration; stream.injectPacket(rtp, true, null); long sleep = timeForNextPacket - System.currentTimeMillis(); if (sleep > 0 && sentDuration > 200) { Thread.sleep(sleep); } } }
Source:
private List<Patch> runNopolProcessor(List<TestResult> tests, SourceLocation sourceLocation, SpoonedClass spoonCl, NopolProcessor nopolProcessor) { AngelicValue angelicValue; List<Patch> patches = new ArrayList<>(); try { angelicValue = buildConstraintsModelBuilder(nopolProcessor, sourceLocation, spooner); } catch (UnsupportedOperationException | DynamicCompilationException ignored) { return patches; } if (angelicValue != null) { this.nopolResult.incrementNbAngelicValues(); } else { this.nopolResult.setNopolStatus(NopolStatus.NO_ANGELIC_VALUE); } Synthesizer synth = SynthesizerFactory.build(sourceFiles, spooner, nopolContext, sourceLocation, nopolProcessor, angelicValue, spoonCl); if (synth == Synthesizer.NO_OP_SYNTHESIZER) { return patches; } Collection<TestCase> failingTest = reRunFailingTestCases(getFailingTestCase(tests), new URLClassLoader(classpath)); if (failingTest.isEmpty()) { return patches; } List<Patch> tmpPatches = synth.buildPatch(classpath, tests, failingTest, nopolContext.getMaxTimeBuildPatch()); if (tmpPatches.size() > 0) { for (int i = 0; i < tmpPatches.size(); i++) { Patch patch = tmpPatches.get(i); if (nopolContext.isSkipRegressionStep() || isOk(patch, tests, synth.getProcessor())) { patches.add(patch); if (nopolContext.isOnlyOneSynthesisResult()) { this.nopolResult.setNopolStatus(NopolStatus.PATCH); return patches; } } else { logger.debug("Could not find a patch in {}", sourceLocation); } } } return patches; }

Target:
private List<Patch> runNopolProcessor(List<TestResult> tests, SourceLocation sourceLocation, SpoonedClass spoonCl, NopolProcessor nopolProcessor) { AngelicValue angelicValue; List<Patch> patches = new ArrayList<>(); try { angelicValue = buildConstraintsModelBuilder(nopolProcessor, sourceLocation, spooner); } catch (UnsupportedOperationException | DynamicCompilationException ignored) { return patches; } if (angelicValue != null) { this.nopolResult.incrementNbAngelicValues(); } Synthesizer synth = SynthesizerFactory.build(sourceFiles, spooner, nopolContext, sourceLocation, nopolProcessor, angelicValue, spoonCl); if (synth == Synthesizer.NO_OP_SYNTHESIZER) { return patches; } Collection<TestCase> failingTest = reRunFailingTestCases(getFailingTestCase(tests), new URLClassLoader(classpath)); if (failingTest.isEmpty()) { return patches; } List<Patch> tmpPatches = synth.buildPatch(classpath, tests, failingTest, nopolContext.getMaxTimeBuildPatch()); if (tmpPatches.size() > 0) { for (int i = 0; i < tmpPatches.size(); i++) { Patch patch = tmpPatches.get(i); if (nopolContext.isSkipRegressionStep() || isOk(patch, tests, synth.getProcessor())) { patches.add(patch); if (nopolContext.isOnlyOneSynthesisResult()) { return patches; } } else { logger.debug("Could not find a patch in {}", sourceLocation); } } } return patches; }
Source:
public void loadMessages(MessageRepository messageRepository) { List<BackupMessage> messages = messageRepository.findAll(); logger.info("Loading messages from backup storage.", messages.size()); int retry = 0; toResent.set(new ConcurrentLinkedQueue<>()); sendMessages(messages); do { if (retry > 0) { List<Pair<Message, Topic>> retryMessages = new ArrayList(toResent.getAndSet(new ConcurrentLinkedQueue<>())); resendMessages(retryMessages, retry); } try { Thread.sleep(resentSleep); } catch (InterruptedException e) { logger.warn("Sleep interrupted", e); } retry++; } while (toResent.get().size() > 0 && retry <= maxResent); logger.info("Finished resending messages from backup storage after retry #{} with #{} not sent messages.", retry, toResent.get().size()); }

Target:
public void loadMessages(MessageRepository messageRepository) { List<BackupMessage> messages = messageRepository.findAll(); logger.info("Loading messages from backup storage.", messages.size()); int retry = 0; toResend.set(new ConcurrentLinkedQueue<>()); sendMessages(messages); do { if (retry > 0) { List<Pair<Message, Topic>> retryMessages = new ArrayList(toResend.getAndSet(new ConcurrentLinkedQueue<>())); resendMessages(retryMessages, retry); } try { Thread.sleep(resendSleep); } catch (InterruptedException e) { logger.warn("Sleep interrupted", e); } retry++; } while (toResend.get().size() > 0 && retry <= maxResendRetries); logger.info("Finished resending messages from backup storage after retry #{} with #{} not sent messages.", retry, toResend.get().size()); }
Source:
public void tighten() { RealInterval res; switch (op) { case NEG: case ABS: case EXP: case LN: case SQRT: case COS: res = RealUtils.cos(e); break; case SIN: res = RealUtils.sin(e); break; case TAN: case ACOS: case ASIN: case ATAN: case COSH: case SINH: case TANH: case ACOSH: case ASINH: case ATANH: default: throw new UnsupportedOperationException("Equation does not support " + op.name()); } l.set(res.getLB()); u.set(res.getUB()); }

Target:
public void tighten() { RealInterval res; switch (op) { case COS: res = RealUtils.cos(e); break; case SIN: res = RealUtils.sin(e); break; case NEG: res = new RealIntervalConstant(-e.getUB(), -e.getLB()); break; case SQR: res = RealUtils.iPower(e, 2); break; case SQRT: res = RealUtils.iRoot(e, 2); break; case CUB: res = RealUtils.iPower(e, 3); break; case CBRT: res = RealUtils.iRoot(e, 3); break; case ABS: double linf = e.getLB(); double lsup = e.getUB(); if(lsup < 0.){ res = new RealIntervalConstant(-lsup, -linf); }else if (linf < 0.){ res = new RealIntervalConstant(0., Math.max(-linf, lsup)); }else{ res = new RealIntervalConstant(linf, lsup); } break; case EXP: case LN: case TAN: case ACOS: case ASIN: case ATAN: case COSH: case SINH: case TANH: case ACOSH: case ASINH: case ATANH: default: throw new UnsupportedOperationException("Equation does not support " + op.name()+". Consider using Ibex instead."); } l.set(res.getLB()); u.set(res.getUB()); }
Source:
public Account removeGroup(String hrefOrName) { GroupMembership groupMembership = null; for (GroupMembership aGroupMembership : getGroupMemberships()) { if (aGroupMembership.getGroup().getName().equalsIgnoreCase(hrefOrName) || aGroupMembership.getGroup().getHref().equalsIgnoreCase(hrefOrName)) { groupMembership = aGroupMembership; break; } } if (groupMembership != null){ groupMembership.delete(); } return this; }

Target:
public Account removeGroup(String hrefOrName) { GroupMembership groupMembership = null; for (GroupMembership aGroupMembership : getGroupMemberships()) { if (aGroupMembership.getGroup().getName().equals(hrefOrName) || aGroupMembership.getGroup().getHref().equals(hrefOrName)) { groupMembership = aGroupMembership; break; } } if (groupMembership != null){ groupMembership.delete(); } else { throw new IllegalStateException("This account does not belong to the specified group."); } return this; }
Source:
public JobProperty<?> reconfigure(StaplerRequest req, @Nonnull JSONObject form) throws Descriptor.FormException { DatadogJobProperty prop = (DatadogJobProperty) super.reconfigure(req, form); if (prop == null){ return null; } boolean isEnableFile = form.getBoolean("enableFile"); boolean isEnableTagProperties = form.getBoolean("enableProperty"); if (!isEnableFile) { prop.tagFile = null; prop.emitOnCheckout = false; } if (!isEnableTagProperties) { prop.tagProperties = null; } return prop; }

Target:
public JobProperty<?> reconfigure(StaplerRequest req, @Nonnull JSONObject form) throws Descriptor.FormException { DatadogJobProperty prop = (DatadogJobProperty) super.reconfigure(req, form); boolean isEnableFile = form.getBoolean("enableFile"); boolean isEnableTagProperties = form.getBoolean("enableProperty"); if (!isEnableFile) { prop.tagFile = null; prop.emitOnCheckout = false; } if (!isEnableTagProperties) { prop.tagProperties = null; } return prop; }
Source:
protected String cleanExpression(String rawExpression) { if (rawExpression != null && rawExpression.trim().startsWith(MVEL_ESCAPE_SYMBOL)) { return rawExpression.replaceFirst(MVEL_ESCAPE_SYMBOL, ""); } Optional<JsonNode> optionalJSONNode = JsonUtils.convertFromStringToJSONNode(rawExpression); if (optionalJSONNode.isPresent()) { JsonNode jsonNode = optionalJSONNode.get(); if (jsonNode.isTextual() && jsonNode.asText() != null && jsonNode.asText().trim().startsWith(MVEL_ESCAPE_SYMBOL)) { String expression = jsonNode.asText(); return expression.replaceFirst(MVEL_ESCAPE_SYMBOL, ""); } } throw new IllegalArgumentException("Malformed MVEL expression '" + rawExpression + "'"); }

Target:
protected String cleanExpression(String rawExpression) { if (rawExpression != null && rawExpression.trim().startsWith(MVEL_ESCAPE_SYMBOL)) { return rawExpression.replaceFirst(MVEL_ESCAPE_SYMBOL, ""); } Optional<JsonNode> optionalJSONNode = JsonUtils.convertFromStringToJSONNode(rawExpression); if (optionalJSONNode.isPresent()) { JsonNode jsonNode = optionalJSONNode.get(); if (jsonNode.isTextual() && jsonNode.asText() != null && jsonNode.asText().trim().startsWith(MVEL_ESCAPE_SYMBOL)) { String expression = jsonNode.asText(); return expression.replaceFirst(MVEL_ESCAPE_SYMBOL, ""); } } throw new IllegalArgumentException(MALFORMED_MVEL_EXPRESSION + "'" + rawExpression + "'"); }
Source:
public void open() throws Exception { super.open(); timestampAssigner = watermarkStrategy.createTimestampAssigner(this::getMetricGroup); watermarkGenerator = watermarkStrategy.createWatermarkGenerator(); wmOutput = new WatermarkEmitter(output, getContainingTask().getStreamStatusMaintainer()); watermarkInterval = getExecutionConfig().getAutoWatermarkInterval(); if (watermarkInterval > 0) { final long now = getProcessingTimeService().getCurrentProcessingTime(); getProcessingTimeService().registerTimer(now + watermarkInterval, this); } }

Target:
public void open() throws Exception { super.open(); timestampAssigner = watermarkStrategy.createTimestampAssigner(this::getMetricGroup); watermarkGenerator = watermarkStrategy.createWatermarkGenerator(this::getMetricGroup); wmOutput = new WatermarkEmitter(output, getContainingTask().getStreamStatusMaintainer()); watermarkInterval = getExecutionConfig().getAutoWatermarkInterval(); if (watermarkInterval > 0) { final long now = getProcessingTimeService().getCurrentProcessingTime(); getProcessingTimeService().registerTimer(now + watermarkInterval, this); } }
Source:
public Map<String, String> getStartupOptions() { return startupOptionsBuilderRef.get().build(); }

Target:
public Map<String, String> getStartupOptions() { return startupOptionsRef.get(); }
Source:
public void destroy() { final ExecutionMonitor execmon = _wapp != null ? _wapp.getConfiguration().getExecutionMonitor() : null; _rque = null; final ServerPush sp = _spush; if (sp != null) { _spush = null; try { sp.stop(); } catch (Throwable ex) { log.warn("Failed to stop server-push, " + sp, ex); } } try { final List<Page> pages = new ArrayList<Page>(_pages); for (Page page : pages) { try { for (Component root: page.getRoots()) { root.detach(); } ((PageCtrl) page).destroy(); } catch (Throwable ex) { log.warn("Failed to destroy " + page, ex); } } _pages.clear(); } catch (Throwable ex) { log.warn("Failed to clean up pages of " + this, ex); } if (execmon != null) execmon.desktopDestroy(this); _attrs.getAttributes().clear(); _comps = new HashMap<String, Component>(2); _meds = null; final Object lock = getActivationLock(); if (lock != null) { synchronized (lock) { lock.notifyAll(); } } }

Target:
public void destroy() { final ExecutionMonitor execmon = _wapp != null ? _wapp.getConfiguration().getExecutionMonitor() : null; _rque = null; final ServerPush sp = _spush; if (sp != null) { _spush = null; try { sp.stop(); } catch (Throwable ex) { log.warn("Failed to stop server-push, " + sp, ex); } } try { final List<Page> pages = new ArrayList<Page>(_pages); for (Page page : pages) { try { ((PageCtrl) page).destroy(); } catch (Throwable ex) { log.warn("Failed to destroy " + page, ex); } } _pages.clear(); } catch (Throwable ex) { log.warn("Failed to clean up pages of " + this, ex); } if (execmon != null) execmon.desktopDestroy(this); _attrs.getAttributes().clear(); _comps = new HashMap<String, Component>(2); _meds = null; final Object lock = getActivationLock(); if (lock != null) { synchronized (lock) { lock.notifyAll(); } } }
Source:
protected void syncSearch() { super.syncSearch(); VdcQueryParametersBase queryParameters = new VdcQueryParametersBase(); queryParameters.setRefresh(getIsQueryFirstTime()); Frontend.getInstance().runQuery(VdcQueryType.GetAllVmsAndVmPools, queryParameters, new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { UserPortalListModel userPortalListModel = (UserPortalListModel) model; ArrayList<VM> vms = new ArrayList<VM>(); ArrayList<VmPool> pools = new ArrayList<VmPool>(); VdcQueryReturnValue retValue = (VdcQueryReturnValue) returnValue; if (retValue != null && retValue.getSucceeded()) { List<Object> list = (ArrayList<Object>) retValue.getReturnValue(); if (list != null) { for (Object object : list) { if (object instanceof VM) { vms.add((VM) object); } else if (object instanceof VmPool) { pools.add((VmPool) object); } } } } onVmAndPoolLoad(vms, pools); } })); }

Target:
protected void syncSearch() { super.syncSearch(); VdcQueryParametersBase queryParameters = new VdcQueryParametersBase(); queryParameters.setRefresh(getIsQueryFirstTime()); Frontend.getInstance().runQuery(VdcQueryType.GetAllVmsAndVmPools, queryParameters, new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { ArrayList<VM> vms = new ArrayList<VM>(); ArrayList<VmPool> pools = new ArrayList<VmPool>(); VdcQueryReturnValue retValue = (VdcQueryReturnValue) returnValue; if (retValue != null && retValue.getSucceeded()) { List<Object> list = (ArrayList<Object>) retValue.getReturnValue(); if (list != null) { for (Object object : list) { if (object instanceof VM) { vms.add((VM) object); } else if (object instanceof VmPool) { pools.add((VmPool) object); } } } } onVmAndPoolLoad(vms, pools); } })); }
Source:
public BaseChangeEvent<T> getNextEvent() throws IOException { String line; while ((((line = response.readBodyLine())) != null)) { watchStream.feedLine(line); if (watchStream.getState().equals(OsWatchStream.HAVE_EVENT)) return ChangeEvent.fromBsonDocument(watchStream.getNextEvent(), documentClass, codecRegistry); if (watchStream.getState().equals(OsWatchStream.HAVE_ERROR)) { response.close(); throw new IOException("Watch stream has error"); } } throw new IOException("Stream closed"); }

Target:
public BaseChangeEvent<T> getNextEvent() throws AppException, IOException { while (true) { watchStream.feedLine(response.readBodyLine()); String watchStreamState = watchStream.getState(); if (watchStreamState.equals(OsWatchStream.HAVE_EVENT)) { return ChangeEvent.fromBsonDocument(watchStream.getNextEvent(), documentClass, codecRegistry); } if (watchStreamState.equals(OsWatchStream.HAVE_ERROR)) { response.close(); throw watchStream.getError(); } } }
Source:
public void onResume(ClientContext context) throws FetchException { if(logMINOR) Logger.minor(this, "Restarting SplitFileFetcher from storage..."); boolean resumed = parent instanceof ClientGetter && ((ClientGetter)parent).resumedFetcher(); this.context = context; try { KeySalter salter = getSalter(); raf.onResume(context); this.storage = new SplitFileFetcherStorage(raf, realTimeFlag, this, blockFetchContext, context.random, context.jobRunner, context.getChkFetchScheduler(realTimeFlag).fetchingKeys(), context.ticker, context.memoryLimitedJobRunner, new CRCChecksumChecker(), context.jobRunner.newSalt(), salter, resumed, callbackCompleteViaTruncation != null); } catch (ResumeFailedException e) { raf.free(); Logger.error(this, "Failed to resume storage file: "+e+" for "+raf, e); throw new FetchException(FetchExceptionMode.BUCKET_ERROR, e); } catch (IOException e) { raf.free(); Logger.error(this, "Failed to resume due to I/O error: "+e+" raf = "+raf, e); throw new FetchException(FetchExceptionMode.BUCKET_ERROR, e); } catch (StorageFormatException e) { raf.free(); Logger.error(this, "Failed to resume due to storage error: "+e+" raf = "+raf, e); throw new FetchException(FetchExceptionMode.INTERNAL_ERROR, "Resume failed: "+e, e); } catch (FetchException e) { raf.free(); throw e; } synchronized(this) { lastNotifiedStoreFetch = System.currentTimeMillis(); } getter = new SplitFileFetcherGet(this, storage); if(storage.start(resumed)) getter.schedule(context, storage.hasCheckedStore()); }

Target:
public void onResume(ClientContext context) throws FetchException { if(logMINOR) Logger.minor(this, "Restarting SplitFileFetcher from storage..."); boolean resumed = parent instanceof ClientGetter && ((ClientGetter)parent).resumedFetcher(); this.context = context; try { KeySalter salter = getSalter(); raf.onResume(context); this.storage = new SplitFileFetcherStorage(raf, realTimeFlag, this, blockFetchContext, context.random, context.jobRunner, context.getChkFetchScheduler(realTimeFlag).fetchingKeys(), context.ticker, context.memoryLimitedJobRunner, new CRCChecksumChecker(), context.jobRunner.newSalt(), salter, resumed, callbackCompleteViaTruncation != null); } catch (ResumeFailedException e) { raf.free(); Logger.error(this, "Failed to resume storage file: "+e+" for "+raf, e); throw new FetchException(FetchExceptionMode.BUCKET_ERROR, e); } catch (IOException e) { raf.free(); Logger.error(this, "Failed to resume due to I/O error: "+e+" raf = "+raf, e); throw new FetchException(FetchExceptionMode.BUCKET_ERROR, e); } catch (StorageFormatException e) { raf.free(); Logger.error(this, "Failed to resume due to storage error: "+e+" raf = "+raf, e); throw new FetchException(FetchExceptionMode.INTERNAL_ERROR, "Resume failed: "+e, e); } catch (FetchException e) { raf.free(); throw e; } synchronized(this) { lastNotifiedStoreFetch = System.currentTimeMillis(); } getter = new SplitFileFetcherGet(this, storage); if (storage.start(resumed)) { getter.schedule(context, storage.hasCheckedStore()); } }
Source:
private void buildChildrenEntries(AggregatedCalledFunction threadNode) { FlamegraphDepthEntry threadEntry = new FlamegraphDepthEntry("", 0, fActiveTrace.getEndTime().toNanos() - fActiveTrace.getStartTime().toNanos(), fFlameGraphEntries.size()); fChildrenEntries = new ArrayList<>(); fThreadDuration = 0L; threadNode.getChildren().stream() .sorted(Comparator.comparingLong(AggregatedCalledFunction::getDuration)) .forEach(rootFunction -> { fTimestampStack.push(fThreadDuration); setData(rootFunction); fThreadDuration += rootFunction.getDuration(); fTimestampStack.pop(); }); fChildrenEntries.forEach(child -> { if (child != null) { threadEntry.addChild(child); } }); threadEntry.setName(threadNode.getSymbol().toString()); fFlameGraphEntries.add(threadEntry); }

Target:
private void buildChildrenEntries(AggregatedCalledFunction threadNode) { FlamegraphDepthEntry threadEntry = new FlamegraphDepthEntry("", 0, fActiveTrace.getEndTime().toNanos() - fActiveTrace.getStartTime().toNanos(), fFlameGraphEntries.size()); List<FlamegraphDepthEntry> childrenEntries = new ArrayList<>(); fThreadDuration = 0L; threadNode.getChildren().stream() .sorted(Comparator.comparingLong(AggregatedCalledFunction::getDuration)) .forEach(rootFunction -> { Deque<Long> timestampStack = new ArrayDeque<>(); timestampStack.push(fThreadDuration); setData(rootFunction, childrenEntries, timestampStack); fThreadDuration += rootFunction.getDuration(); timestampStack.pop(); }); childrenEntries.forEach(child -> { if (child != null) { threadEntry.addChild(child); } }); threadEntry.setName(threadNode.getSymbol().toString()); fFlameGraphEntries.add(threadEntry); }
Source:
public void testRLEOnly() throws Exception { RunLengthBitPackingHybridEncoder encoder = new RunLengthBitPackingHybridEncoder(3, 5, 10, new DirectByteBufferAllocator()); for (int i = 0; i < 100; i++) { encoder.writeInt(4); } for (int i = 0; i < 100; i++) { encoder.writeInt(5); } ByteArrayInputStream is = new ByteArrayInputStream(encoder.toBytes().toByteArray()); assertEquals(200, BytesUtils.readUnsignedVarInt(is)); assertEquals(4, BytesUtils.readIntLittleEndianOnOneByte(is)); assertEquals(200, BytesUtils.readUnsignedVarInt(is)); assertEquals(5, BytesUtils.readIntLittleEndianOnOneByte(is)); assertEquals(-1, is.read()); }

Target:
public void testRLEOnly() throws Exception { RunLengthBitPackingHybridEncoder encoder = getRunLengthBitPackingHybridEncoder(); for (int i = 0; i < 100; i++) { encoder.writeInt(4); } for (int i = 0; i < 100; i++) { encoder.writeInt(5); } ByteArrayInputStream is = new ByteArrayInputStream(encoder.toBytes().toByteArray()); assertEquals(200, BytesUtils.readUnsignedVarInt(is)); assertEquals(4, BytesUtils.readIntLittleEndianOnOneByte(is)); assertEquals(200, BytesUtils.readUnsignedVarInt(is)); assertEquals(5, BytesUtils.readIntLittleEndianOnOneByte(is)); assertEquals(-1, is.read()); }