auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void configure() { System.out.println("TestGuiceModule binder"); newSetBinder(binder(), TestRunner.class); newSetBinder(binder(), TestClasspathProvider.class); bind(TestingService.class); }

Target:
protected void configure() { newSetBinder(binder(), TestRunner.class); newSetBinder(binder(), TestClasspathProvider.class); bind(TestingService.class); }
Source:
public static ClassLoadingStrategy<?> resolveClassLoadingStrategy(Class<?> originalClass) { if ( ClassInjector.UsingLookup.isAvailable() ) { Object lookup; Method privateLookupIn; try { Class<?> methodHandles = Class.forName( "java.lang.invoke.MethodHandles" ); lookup = methodHandles.getMethod( "lookup" ).invoke( null ); privateLookupIn = methodHandles.getMethod( "privateLookupIn", Class.class, Class.forName( "java.lang.invoke.MethodHandles$Lookup" ) ); } catch (Exception e) { throw new HibernateException( LOG.bytecodeEnhancementFailed( originalClass.getName() ), e ); } Object privateLookup; try { try { privateLookup = privateLookupIn.invoke( null, originalClass, lookup ); } catch (InvocationTargetException exception) { if ( exception.getCause() instanceof IllegalAccessException ) { return new ClassLoadingStrategy.ForUnsafeInjection( originalClass.getProtectionDomain() ); } else { throw new HibernateException( LOG.bytecodeEnhancementFailed( originalClass.getName() ), exception.getCause() ); } } return ClassLoadingStrategy.UsingLookup.of( privateLookup ); } catch (Throwable e) { throw new HibernateException( LOG.bytecodeEnhancementFailedUnableToGetPrivateLookupFor( originalClass.getName() ), e ); } } else { return new ClassLoadingStrategy.ForUnsafeInjection( originalClass.getProtectionDomain() ); } }

Target:
public static ClassLoadingStrategy<?> resolveClassLoadingStrategy(Class<?> originalClass) { if ( ClassInjector.UsingLookup.isAvailable() ) { Method privateLookupIn; try { privateLookupIn = MethodHandles.class.getMethod( "privateLookupIn", Class.class, MethodHandles.Lookup.class ); } catch (Exception e) { throw new HibernateException( LOG.bytecodeEnhancementFailed( originalClass.getName() ), e ); } try { Object privateLookup; try { privateLookup = privateLookupIn.invoke( null, originalClass, LOOKUP ); } catch (InvocationTargetException exception) { if ( exception.getCause() instanceof IllegalAccessException ) { return new ClassLoadingStrategy.ForUnsafeInjection( originalClass.getProtectionDomain() ); } else { throw new HibernateException( LOG.bytecodeEnhancementFailed( originalClass.getName() ), exception.getCause() ); } } return ClassLoadingStrategy.UsingLookup.of( privateLookup ); } catch (Throwable e) { throw new HibernateException( LOG.bytecodeEnhancementFailedUnableToGetPrivateLookupFor( originalClass.getName() ), e ); } } else { return new ClassLoadingStrategy.ForUnsafeInjection( originalClass.getProtectionDomain() ); } }
Source:
protected IStatus getArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) { ProcessingStepHandler handler = new ProcessingStepHandler(); List<ChecksumVerifier> checksumVerifiers = ChecksumUtilities.getChecksumVerifiers(descriptor); for (ChecksumVerifier checksumVerifier : checksumVerifiers) { destination = handler.link(new ProcessingStep[] {checksumVerifier}, destination, monitor); } return getSourceRepository().getRawArtifact(descriptor, destination, monitor); }

Target:
protected IStatus getArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) { ProcessingStepHandler handler = new ProcessingStepHandler(); Iterable<ChecksumVerifier> checksumVerifiers = ChecksumUtilities.getChecksumVerifiers(descriptor); for (ChecksumVerifier checksumVerifier : checksumVerifiers) { destination = handler.link(new ProcessingStep[] {checksumVerifier}, destination, monitor); } return getSourceRepository().getRawArtifact(descriptor, destination, monitor); }
Source:
public QuantityType<T> offset(QuantityType<T> offset, Unit<T> unit) { List<Quantity<T>> list = new ArrayList<>(); list.add(quantity); list.add(offset.quantity); final Quantity<T> sum = list.stream().reduce(QuantityFunctions.sum(unit)).get(); return new QuantityType<T>(sum); }

Target:
public QuantityType<T> offset(QuantityType<T> offset, Unit<T> unit) { final Quantity<T> sum = Arrays.asList(quantity, offset.quantity).stream().reduce(QuantityFunctions.sum(unit)) .get(); return new QuantityType<T>(sum); }
Source:
public ActionResult<ItemStack> onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, EnumHand hand) { if(!par2World.isRemote) { InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(par3EntityPlayer); for(int i = 0; i < baubles.getSizeInventory(); i++) if(baubles.getStackInSlot(i) == null && baubles.isItemValidForSlot(i, par1ItemStack)) { baubles.setInventorySlotContents(i, par1ItemStack.copy()); if(!par3EntityPlayer.capabilities.isCreativeMode){ par3EntityPlayer.inventory.setInventorySlotContents(par3EntityPlayer.inventory.currentItem, null); } onEquipped(par1ItemStack, par3EntityPlayer); break; } } return new ActionResult<ItemStack>(EnumActionResult.PASS, par1ItemStack); }

Target:
public ActionResult<ItemStack> onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, EnumHand hand) { if(!par2World.isRemote) { InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(par3EntityPlayer); for(int i = 0; i < baubles.getSizeInventory(); i++) if(baubles.getStackInSlot(i) == null && baubles.isItemValidForSlot(i, par1ItemStack)) { baubles.setInventorySlotContents(i, par1ItemStack.copy()); if(!par3EntityPlayer.capabilities.isCreativeMode){ par3EntityPlayer.inventory.setInventorySlotContents(par3EntityPlayer.inventory.currentItem, null); } onEquipped(par1ItemStack, par3EntityPlayer); break; } } return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, par1ItemStack); }
Source:
public KV<Object, Object> apply(SamzaSqlRelMessage message) { if (!message.hasMetadata()) { LOG.warn("Output message with no Metadata: " + message); message.setSamzaSqlRelMsgMetadata(new SamzaSqlRelMsgMetadata(Instant.now().toString())); } KV<Object, Object> retKV = this.samzaMsgConverter.convertToSamzaMessage(message); updateMetrics(message.getSamzaSqlRelMsgMetadata().getEventTime(), Instant.now()); return retKV; }

Target:
public KV<Object, Object> apply(SamzaSqlRelMessage message) { Instant beginProcessing = Instant.now(); KV<Object, Object> retKV = this.samzaMsgConverter.convertToSamzaMessage(message); updateMetrics(beginProcessing, Instant.now(), message.getSamzaSqlRelMsgMetadata()); return retKV; }
Source:
public static void main(String[] args) throws InterruptedException { Microservices seed = Microservices.builder() .discovery(ScalecubeServiceDiscovery::new) .transport(ServiceTransports::rsocketServiceTransport) .startAwait(); Microservices.builder() .discovery( serviceEndpoint -> new ScalecubeServiceDiscovery(serviceEndpoint) .options(opts -> opts.seedMembers(toAddress(seed.discovery().address())))) .transport(ServiceTransports::rsocketServiceTransport) .services(new BidiGreetingImpl()) .startAwait(); BidiGreetingService service = seed.call().api(BidiGreetingService.class); service .greeting(Flux.fromArray(new String[] {"joe", "dan", "roni"})) .doOnNext(onNext -> System.out.println(onNext)) .blockLast(); Thread.currentThread().join(); }

Target:
public static void main(String[] args) { Microservices seed = Microservices.builder() .discovery(ScalecubeServiceDiscovery::new) .transport(ServiceTransports::rsocketServiceTransport) .startAwait(); Microservices ms = Microservices.builder() .discovery( serviceEndpoint -> new ScalecubeServiceDiscovery(serviceEndpoint) .options(opts -> opts.seedMembers(toAddress(seed.discovery().address())))) .transport(ServiceTransports::rsocketServiceTransport) .services(new BidiGreetingImpl()) .startAwait(); BidiGreetingService service = seed.call().api(BidiGreetingService.class); service .greeting(Flux.fromArray(new String[] {"joe", "dan", "roni"})) .doOnNext(onNext -> System.out.println(onNext)) .blockLast(); seed.onShutdown().block(); ms.onShutdown().block(); }
Source:
public SnomedQueryBuilder statedParent(Long id) { return addToQuery(SnomedMappings.parent(Concepts.STATED_RELATIONSHIP), id); }

Target:
public SnomedQueryBuilder statedParent(Long id) { return addToQuery(SnomedMappings.statedParent(), id); }
Source:
public void init() { Map<String, Class<? extends Check>> checks = new HashMap<>(); checks.put("allow all", Book.class); checks.put("allow all", Author.class); dictionary = new EntityDictionary(checks); dictionary.bindEntity(Book.class); dictionary.bindEntity(Author.class); dictionary.bindEntity(Publisher.class); dictionary.bindEntity(Pseudonym.class); dictionary.bindEntity(Address.class); }

Target:
public void init() { Map<String, Class<? extends Check>> checks = new HashMap<>(); checks.put("allow all", com.yahoo.elide.security.checks.prefab.Role.ALL.class); checks.put("allow all", com.yahoo.elide.security.checks.prefab.Role.ALL.class); dictionary = new EntityDictionary(checks); dictionary.bindEntity(Book.class); dictionary.bindEntity(Author.class); dictionary.bindEntity(Publisher.class); dictionary.bindEntity(Pseudonym.class); dictionary.bindEntity(Address.class); }
Source:
protected void setProxy() { if (Configuration.useProxy()) { Proxy proxyServer = new Proxy(); if ("true".equals(Configuration.useZap())) { String zapProxyAddress = String.format("%s:%s", XMLReader.getValue("zap_proxy.address"), Integer .parseInt(XMLReader.getValue("zap_proxy.port"))); proxyServer.setHttpProxy(zapProxyAddress); proxyServer.setSslProxy(zapProxyAddress); } else { server = new NetworkTrafficInterceptor(); server.setTrustAllServers(true); server.setConnectTimeout(90, TimeUnit.SECONDS); server.setTrustSource(TrustSource.defaultTrustSource()); server.setMitmDisabled(!Boolean.parseBoolean(Configuration.useMITM())); server.enableHarCaptureTypes(CaptureType.REQUEST_HEADERS, CaptureType.RESPONSE_HEADERS); server.setUseEcc(true); proxyServer = server.startBrowserMobProxyServer(); } caps.setCapability(CapabilityType.PROXY, proxyServer); } }

Target:
protected void setProxy() { if (Configuration.useProxy()) { Proxy proxyServer = new Proxy(); if ("true".equals(Configuration.useZap())) { String zapProxyAddress = String.format("%s:%s", XMLReader.getValue("zap_proxy.address"), Integer .parseInt(XMLReader.getValue("zap_proxy.port"))); proxyServer.setHttpProxy(zapProxyAddress); proxyServer.setSslProxy(zapProxyAddress); } else { server = new NetworkTrafficInterceptor(); server.setTrustAllServers(true); server.setConnectTimeout(90, TimeUnit.SECONDS); server.setTrustSource(TrustSource.defaultTrustSource()); server.setMitmDisabled(!Boolean.parseBoolean(Configuration.useMITM())); server.setRequestTimeout(90, TimeUnit.SECONDS); server.enableHarCaptureTypes(CaptureType.REQUEST_HEADERS, CaptureType.RESPONSE_HEADERS); server.setUseEcc(true); proxyServer = server.startBrowserMobProxyServer(); } caps.setCapability(CapabilityType.PROXY, proxyServer); } }
Source:
public void testIsVerificationSuccessful() { ______TS("null or empty response"); assertFalse(RecaptchaVerifier.isVerificationSuccessful(null)); assertFalse(RecaptchaVerifier.isVerificationSuccessful("")); ______TS("any other key"); assertTrue(RecaptchaVerifier.isVerificationSuccessful("testResponseKey")); assertTrue(RecaptchaVerifier.isVerificationSuccessful(".#?")); }

Target:
public void testIsVerificationSuccessful() { ______TS("null or empty CAPTCHA response"); assertFalse(new RecaptchaVerifierStub().isVerificationSuccessful(null, "testKey")); assertFalse(new RecaptchaVerifierStub().isVerificationSuccessful("", "testKey")); ______TS("empty CAPTCHA secret key"); assertTrue(new RecaptchaVerifierStub().isVerificationSuccessful("empty secret key", null)); ______TS("Successful verification"); assertTrue(new RecaptchaVerifierStub().isVerificationSuccessful("success", "testKey")); ______TS("reCAPTCHA error codes that can occur during the API request execution"); assertFalse(new RecaptchaVerifierStub().isVerificationSuccessful("missing recaptcha params", "testKey")); assertFalse(new RecaptchaVerifierStub().isVerificationSuccessful("invalid recaptcha secret key", "testKey")); assertFalse(new RecaptchaVerifierStub().isVerificationSuccessful("invalid recaptcha response", "testKey")); assertFalse(new RecaptchaVerifierStub().isVerificationSuccessful("invalid recaptcha request", "testKey")); ______TS("Exceptions that can occur during the API request execution"); assertFalse(new RecaptchaVerifierStub().isVerificationSuccessful("null response", "testKey")); assertFalse(new RecaptchaVerifierStub().isVerificationSuccessful("invalid uri", "testKey")); assertFalse(new RecaptchaVerifierStub().isVerificationSuccessful("http protocol error", "testKey")); assertFalse(new RecaptchaVerifierStub().isVerificationSuccessful("i/o exception", "testKey")); assertFalse(new RecaptchaVerifierStub().isVerificationSuccessful("timeout exception", "testKey")); assertFalse(new RecaptchaVerifierStub().isVerificationSuccessful("non 2xx http response", "testKey")); }
Source:
private void fillValues(final Repository repository) throws IOException { gitDir.setText(repository.getDirectory().getAbsolutePath()); branch.setText(repository.getBranch()); workDir.setText(repository.getWorkTree().getAbsolutePath()); state.setText(repository.getRepositoryState().getDescription()); final ObjectId objectId = repository .resolve(repository.getFullBranch()); if (objectId == null) { if (repository.getAllRefs().size() == 0) headLink.setText(UIText.GitProjectPropertyPage_ValueEmptyRepository); else headLink.setText(UIText.GitProjectPropertyPage_ValueUnbornBranch); } else { headLink.setText(objectId.name()); headLink.setUnderlined(true); headLink.setFont(JFaceResources.getDialogFont()); headLink.setForeground(JFaceColors.getHyperlinkText(headLink .getDisplay())); headLink.addHyperlinkListener(new HyperlinkAdapter() { @Override public void linkActivated(HyperlinkEvent e) { CommitEditor.openQuiet(getCommit(repository, objectId)); } }); } }

Target:
private void fillValues(final Repository repository) throws IOException { gitDir.setText(repository.getDirectory().getAbsolutePath()); branch.setText(repository.getBranch()); workDir.setText(repository.getWorkTree().getAbsolutePath()); state.setText(repository.getRepositoryState().getDescription()); final ObjectId objectId = repository .resolve(repository.getFullBranch()); if (objectId == null) { if (repository.getAllRefs().size() == 0) headLink.setText(UIText.GitProjectPropertyPage_ValueEmptyRepository); else headLink.setText(UIText.GitProjectPropertyPage_ValueUnbornBranch); } else { headLink.setText(objectId.name()); headLink.setUnderlined(true); headLink.setFont(JFaceResources.getDialogFont()); headLink.setForeground(JFaceColors.getHyperlinkText(headLink .getDisplay())); headLink.addHyperlinkListener(new HyperlinkAdapter() { @Override public void linkActivated(HyperlinkEvent e) { RepositoryCommit commit = getCommit(repository, objectId); if(commit != null) { CommitEditor.openQuiet(commit); } } }); } }
Source:
public byte[] readFromCopy() throws SQLException { byte[] result = buf; try { if (isBufAvailable()) { if (curPosition > 0 || len < buf.length) { byte[] ba = new byte[len - curPosition]; for (int i = curPosition; i < len; i++) { ba[i - curPosition] = buf[i]; } result = ba; } curPosition = len; } else { result = null; } } catch (IOException ioe) { throw new PSQLException(GT.tr("Read from copy failed."), PSQLState.CONNECTION_FAILURE); } return result; }

Target:
public byte[] readFromCopy() throws SQLException { final byte[] result; try { if (isBufAvailable()) { if (curPosition == 0 && len == bytes.length) { result = bytes; } else { result = Arrays.copyOfRange(bytes, curPosition, len); } curPosition = len; } else { result = null; } } catch (IOException ioe) { throw new PSQLException(GT.tr("Read from copy failed."), PSQLState.CONNECTION_FAILURE); } return result; }
Source:
private void editToolbarItems() { Display.getDefault().asyncExec(new Runnable() { @Override public void run() { IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); IWorkbenchPage page = window.getActivePage(); IViewPart part = page.findView(IConsoleConstants.ID_CONSOLE_VIEW); ConsoleView view = (ConsoleView)part; if (view != null) { IToolBarManager tbm = view.getViewSite().getActionBars().getToolBarManager(); IContributionItem items= tbm.getItems(); GenieOpenConsoleAction openConsoleAction = new GenieOpenConsoleAction(); tbm.insertBefore(WARNING_CHECKBOX_ID, openConsoleAction); List<ActionContributionItem> itemsToRemove = Arrays.stream(items).filter(item->(item instanceof ActionContributionItem)) .map(item->(ActionContributionItem)item) .filter(item-> item.getAction().toString().contains("PinConsole")|| item.getAction() instanceof OpenConsoleAction) .collect(Collectors.toList()); itemsToRemove.forEach(action -> tbm.remove(action)); view.getViewSite().getActionBars().updateActionBars(); } } }); }

Target:
private void editToolbarItems() { Display.getDefault().asyncExec(new Runnable() { @Override public void run() { ConsoleView view = getConsoleView(); if (view != null) { IToolBarManager tbm = view.getViewSite().getActionBars().getToolBarManager(); IContributionItem items= tbm.getItems(); GenieOpenConsoleAction openConsoleAction = new GenieOpenConsoleAction(); tbm.insertBefore(CLEAR_CONSOLE_ID, openConsoleAction); List<ActionContributionItem> itemsToRemove = Arrays.stream(items).filter(item->(item instanceof ActionContributionItem)) .map(item->(ActionContributionItem)item) .filter(item-> item.getAction().toString().contains("PinConsole")|| item.getAction() instanceof OpenConsoleAction) .collect(Collectors.toList()); itemsToRemove.forEach(action -> tbm.remove(action)); view.getViewSite().getActionBars().updateActionBars(); } } }); }
Source:
private void sendIPDataAsyncImpl(Inet4Address ipAddress, int destPort, IPProtocol protocol, boolean closeSocket, byte[] data) throws XBeeException { if (ipAddress == null) throw new NullPointerException("IP address cannot be null"); if (data == null) throw new NullPointerException("Data cannot be null"); if (destPort < 0 || destPort > 65535) throw new IllegalArgumentException("Destination port must be between 0 and 65535."); if (isRemote()) throw new OperationNotSupportedException("Cannot send IP data from a remote device."); int sourcePort = this.sourcePort; if (protocol != IPProtocol.UDP) sourcePort = 0; logger.debug(toString() + "Sending IP data asynchronously to {}:{} >> {}.", ipAddress, destPort, HexUtils.prettyHexString(data)); XBeePacket xbeePacket = new TXIPv4Packet(getNextFrameID(), ipAddress, destPort, sourcePort, protocol, closeSocket ? TXIPv4Packet.OPTIONS_CLOSE_SOCKET: TXIPv4Packet.OPTIONS_LEAVE_SOCKET_OPEN, data); sendAndCheckXBeePacket(xbeePacket, true); }

Target:
private void sendIPDataAsyncImpl(Inet4Address ipAddress, int destPort, IPProtocol protocol, boolean closeSocket, byte[] data) throws XBeeException { if (ipAddress == null) throw new NullPointerException("IP address cannot be null"); if (protocol == null) throw new NullPointerException("Protocol cannot be null"); if (data == null) throw new NullPointerException("Data cannot be null"); if (destPort < 0 || destPort > 65535) throw new IllegalArgumentException("Destination port must be between 0 and 65535."); if (isRemote()) throw new OperationNotSupportedException("Cannot send IP data from a remote device."); int sourcePort = this.sourcePort; if (protocol != IPProtocol.UDP) sourcePort = 0; logger.debug(toString() + "Sending IP data asynchronously to {}:{} >> {}.", ipAddress, destPort, HexUtils.prettyHexString(data)); XBeePacket xbeePacket = new TXIPv4Packet(getNextFrameID(), ipAddress, destPort, sourcePort, protocol, closeSocket ? TXIPv4Packet.OPTIONS_CLOSE_SOCKET: TXIPv4Packet.OPTIONS_LEAVE_SOCKET_OPEN, data); sendAndCheckXBeePacket(xbeePacket, true); }
Source:
public static void listenBucketNotification_test1() throws Exception { String methodName = "listenBucketNotification(ListenBucketNotificationArgs args)"; if (!mintEnv) { System.out.println("Test: " + methodName); } long startTime = System.currentTimeMillis(); String file = createFile1Kb(); String bucketName = getRandomName(); CloseableIterator<Result<NotificationRecords>> ci = null; try { client.makeBucket(MakeBucketArgs.builder().bucket(bucketName).region(region).build()); String[] events = {"s3:ObjectCreated:*", "s3:ObjectAccessed:*"}; ci = client.listenBucketNotification( ListenBucketNotificationArgs.builder() .bucket(bucketName) .prefix("prefix") .suffix("suffix") .events(events) .build()); client.putObject(bucketName, "prefix-random-suffix", file, new PutObjectOptions(1 * KB, -1)); while (ci.hasNext()) { NotificationRecords records = ci.next().get(); if (records.events().size() == 0) { continue; } boolean found = false; for (Event event : records.events()) { if (event.objectName().equals("prefix-random-suffix")) { found = true; break; } } if (found) { break; } } mintSuccessLog(methodName, null, startTime); } catch (Exception e) { handleException(methodName, null, startTime, e); } finally { if (ci != null) { ci.close(); } Files.delete(Paths.get(file)); client.removeObject( RemoveObjectArgs.builder().bucket(bucketName).object("prefix-random-suffix").build()); client.removeBucket(RemoveBucketArgs.builder().bucket(bucketName).build()); } }

Target:
public static void listenBucketNotification_test1() throws Exception { String methodName = "listenBucketNotification(ListenBucketNotificationArgs args)"; if (!mintEnv) { System.out.println("Test: " + methodName); } long startTime = System.currentTimeMillis(); String file = createFile1Kb(); String bucketName = getRandomName(); CloseableIterator<Result<NotificationRecords>> ci = null; String mintArgs = "prefix=prefix, suffix=suffix, events={\"s3:ObjectCreated:*\", \"s3:ObjectAccessed:*\"}"; try { client.makeBucket(MakeBucketArgs.builder().bucket(bucketName).region(region).build()); String[] events = {"s3:ObjectCreated:*", "s3:ObjectAccessed:*"}; ci = client.listenBucketNotification( ListenBucketNotificationArgs.builder() .bucket(bucketName) .prefix("prefix") .suffix("suffix") .events(events) .build()); client.putObject(bucketName, "prefix-random-suffix", file, new PutObjectOptions(1 * KB, -1)); while (ci.hasNext()) { NotificationRecords records = ci.next().get(); if (records.events().size() == 0) { continue; } boolean found = false; for (Event event : records.events()) { if (event.objectName().equals("prefix-random-suffix")) { found = true; break; } } if (found) { break; } } mintSuccessLog(methodName, mintArgs, startTime); } catch (Exception e) { handleException(methodName, mintArgs, startTime, e); } finally { if (ci != null) { ci.close(); } Files.delete(Paths.get(file)); client.removeObject( RemoveObjectArgs.builder().bucket(bucketName).object("prefix-random-suffix").build()); client.removeBucket(RemoveBucketArgs.builder().bucket(bucketName).build()); } }
Source:
protected void fillRtTestInfos() { rtTestInfos.add(TEST001); }

Target:
protected void fillRtTestInfos()
Source:
public void expire(String version) { String barrierStatePath = keyBuilder.getBarrierStatePath(version); State barrierState = State.valueOf(zkUtils.getZkClient().readData(barrierStatePath)); if (Objects.equals(barrierState, State.NEW)) { LOG.info(String.format("Expiring the barrier version: %s. Marking the barrier state: %s as %s.", version, barrierStatePath, State.TIMED_OUT)); zkUtils.writeData(keyBuilder.getBarrierStatePath(version), State.TIMED_OUT.getValue()); } else { LOG.debug(String.format("Barrier version: %s is at: %s state. Not marking barrier as %s.", version, barrierState, State.TIMED_OUT)); } }

Target:
public void expire(String version) { String barrierStatePath = keyBuilder.getBarrierStatePath(version); State barrierState = State.valueOf(zkUtils.getZkClient().readData(barrierStatePath)); if (Objects.equals(barrierState, State.NEW)) { LOG.info(String.format("Expiring the barrier version: %s. Marking the barrier state: %s as %s.", version, barrierStatePath, State.TIMED_OUT)); zkUtils.writeData(keyBuilder.getBarrierStatePath(version), State.TIMED_OUT.toString()); } else { LOG.debug(String.format("Barrier version: %s is at: %s state. Not marking barrier as %s.", version, barrierState, State.TIMED_OUT)); } }
Source:
private void matchSinglelineComment(boolean includeNewline) { int c = getChar(); while (c != '\n' && c != EOFCHAR && (includeNewline || (c != '\r'))) { c = getChar(); } if (c == EOFCHAR || !includeNewline) { ungetChar(c); } }

Target:
private void matchSinglelineComment(boolean includeNewline) { int c = getChar(); while (c != '\n' && c != EOFCHAR) { int next = getChar(); if (c == '\r' && next == '\n' && !includeNewline) { ungetChar(next); break; } c = next; } if (c == EOFCHAR || !includeNewline) { ungetChar(c); } }
Source:
public TaskWrapper getNextTask() { TaskWrapper nextScheduledTask = scheduleQueue.peekFirst(); TaskWrapper nextExecuteTask = executeQueue.peek(); if (nextExecuteTask != null) { if (nextScheduledTask != null) { long scheduleDelay; long executeDelay; ClockWrapper.stopForcingUpdate(); try { scheduleDelay = nextScheduledTask.getDelay(TimeUnit.MILLISECONDS); executeDelay = nextExecuteTask.getDelay(TimeUnit.MILLISECONDS); } finally { ClockWrapper.resumeForcingUpdate(); } if (scheduleDelay < executeDelay) { return nextScheduledTask; } else { return nextExecuteTask; } } else { return nextExecuteTask; } } else if (nextScheduledTask != null) { return nextScheduledTask; } else { return null; } }

Target:
public TaskWrapper getNextTask() { TaskWrapper scheduledTask = scheduleQueue.peekFirst(); TaskWrapper executeTask = executeQueue.peek(); if (executeTask != null) { if (scheduledTask != null) { if (scheduledTask.getDelayInMs(0) < executeTask.getDelayInMs(0)) { return scheduledTask; } else { return executeTask; } } else { return executeTask; } } else { return scheduledTask; } }
Source:
public final Mono<TransactionalBatchResponse> executeAsync() { List<ItemBatchOperation<?>> operations = BridgeInternal.getOperationsFromTransactionalBatch(this.transactionalBatch); checkArgument(operations.size() > 0, "Number of operations should be more than 0."); final SinglePartitionKeyServerBatchRequest request = SinglePartitionKeyServerBatchRequest.createBatchRequest( BridgeInternal.getPartitionKeyFromTransactionalBatch(this.transactionalBatch), operations); request.setAtomicBatch(true); request.setShouldContinueOnError(false); return CosmosBridgeInternal.getAsyncDocumentClient(container.getDatabase()) .executeBatchRequest(BridgeInternal.getLink(container), request, BridgeInternal.toRequestOptions(options), false); }

Target:
public final Mono<TransactionalBatchResponse> executeAsync() { List<CosmosItemOperation> operations = this.transactionalBatch.getOperations(); checkArgument(operations.size() > 0, "Number of operations should be more than 0."); final SinglePartitionKeyServerBatchRequest request = SinglePartitionKeyServerBatchRequest.createBatchRequest( this.transactionalBatch.getPartitionKeyValue(), operations); request.setAtomicBatch(true); request.setShouldContinueOnError(false); return CosmosBridgeInternal.getAsyncDocumentClient(container.getDatabase()) .executeBatchRequest(BridgeInternal.getLink(container), request, BridgeInternal.toRequestOptions(options), false); }
Source:
public void testNoEndCallToneInSilence() { when(mAudioManagerAdapter.isVolumeOverZero()).thenReturn(false); InCallTonePlayer player = mFactory.createPlayer(InCallTonePlayer.TONE_CALL_ENDED); player.startTone(); verify(mCallAudioManager, never()).setIsTonePlaying(eq(true)); verify(mMediaPlayerFactory, never()).get(anyInt(), any()); player.cleanup(); }

Target:
public void testNoEndCallToneInSilence() { when(mAudioManagerAdapter.isVolumeOverZero()).thenReturn(false); InCallTonePlayer player = mFactory.createPlayer(InCallTonePlayer.TONE_CALL_ENDED); assertFalse(player.startTone()); verify(mCallAudioManager, never()).setIsTonePlaying(eq(true)); verify(mMediaPlayerFactory, never()).get(anyInt(), any()); player.cleanup(); }
Source:
private void closeDruidStatement(final DruidStatement statement) { final DruidStatement druidStatement2; synchronized (connections) { final DruidConnection connection = getDruidConnection(statement.getConnectionId()); druidStatement2 = connection.statements().remove(statement.getStatementId()); } if (statement == druidStatement2) { log.debug("Connection[%s] closed statement[%s].", statement.getConnectionId(), statement.getStatementId()); statement.close(); } }

Target:
private void closeDruidStatement(final DruidStatement statement) { synchronized (connections) { final DruidConnection connection = getDruidConnection(statement.getConnectionId()); if (connection.statements().get(statement.getStatementId()) == statement) { connection.statements().remove(statement.getStatementId()); } else { throw new ISE("Statement[%s] not open", statement.getStatementId()); } } log.debug("Connection[%s] closed statement[%s].", statement.getConnectionId(), statement.getStatementId()); statement.close(); }
Source:
public void execute(Database database) throws CustomChangeException { JdbcConnection connection = (JdbcConnection) database.getConnection(); Statement stmt = null; PreparedStatement pStmt = null; try { stmt = connection.createStatement(); ResultSet rs = stmt .executeQuery("SELECT @i:=0"); if (rs.next()) { pStmt = connection .prepareStatement("UPDATE cohort_member SET cohort_member_id = @i:=@i+1"); pStmt.addBatch(); pStmt.executeBatch(); } } catch (DatabaseException | SQLException e) { log.warn("Error generated", e); } finally { if (stmt != null) { try { stmt.close(); } catch (SQLException e) { log.warn("Failed to close the statement object"); } } if (pStmt != null) { try { pStmt.close(); } catch (SQLException e) { log.warn("Failed to close the prepared statement object"); } } } }

Target:
public void execute(Database database) throws CustomChangeException { JdbcConnection connection = (JdbcConnection) database.getConnection(); Statement stmt = null; PreparedStatement pStmt = null; try { stmt = connection.createStatement(); ResultSet rs = stmt.executeQuery("SELECT * FROM cohort_member"); pStmt = connection .prepareStatement("UPDATE cohort_member SET cohort_member_id = ?" + " WHERE cohort_id = ? AND patient_id = ?"); int i = 0; while (rs.next()) { int cohortId = rs.getInt("cohort_id"); int patientId = rs.getInt("patient_id"); pStmt.setInt(1, ++i); pStmt.setInt(2, cohortId); pStmt.setInt(3, patientId); pStmt.addBatch(); } pStmt.executeBatch(); } catch (DatabaseException | SQLException e) { log.warn("Error generated", e); } finally { if (stmt != null) { try { stmt.close(); } catch (SQLException e) { log.warn("Failed to close the statement object"); } } if (pStmt != null) { try { pStmt.close(); } catch (SQLException e) { log.warn("Failed to close the prepared statement object"); } } } }
Source:
public Config getConfigByName(String name) { return name == null ? configs.getDefault() : configs.getByName(name); }

Target:
public Config getConfigByName(String name) { return StringUtils.isEmpty(name) ? configs.getDefault() : configs.getByName(name); }
Source:
private void showSwitchFrame(final JSONObject json) { FrameLayout frameLayout = (FrameLayout) getView().findViewById(R.id.action_interface); frameLayout.removeAllViews(); getActivity().getLayoutInflater().inflate(R.layout.fragment_battle_action_switch, frameLayout); TextView[] textViews = new TextView[6]; textViews[0] = (TextView) getView().findViewById(R.id.switch_pokemon1_name); textViews[1] = (TextView) getView().findViewById(R.id.switch_pokemon2_name); textViews[2] = (TextView) getView().findViewById(R.id.switch_pokemon3_name); textViews[3] = (TextView) getView().findViewById(R.id.switch_pokemon4_name); textViews[4] = (TextView) getView().findViewById(R.id.switch_pokemon5_name); textViews[5] = (TextView) getView().findViewById(R.id.switch_pokemon6_name); for (int i = 0; i < getPlayer1Team().size(); i++) { final int idx = i + 1; textViews[i].setText(getPlayer1Team().get(i).getName()); textViews[i].setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if(!isTeamPreview()) { addCommand("switch " + idx); } else { addCommand("team " + idx); } clearActionFrame(); mCurrentActivePokemon++; if (mCurrentActivePokemon < mTotalActivePokemon) { showAttackOrSwitchFrame(json); } else { sendCommands(); } } }); } }

Target:
private void showSwitchFrame(final JSONObject json) { FrameLayout frameLayout = (FrameLayout) getView().findViewById(R.id.action_interface); frameLayout.removeAllViews(); getActivity().getLayoutInflater().inflate(R.layout.fragment_battle_action_switch, frameLayout); TextView[] textViews = new TextView[6]; textViews[0] = (TextView) getView().findViewById(R.id.switch_pokemon1_name); textViews[1] = (TextView) getView().findViewById(R.id.switch_pokemon2_name); textViews[2] = (TextView) getView().findViewById(R.id.switch_pokemon3_name); textViews[3] = (TextView) getView().findViewById(R.id.switch_pokemon4_name); textViews[4] = (TextView) getView().findViewById(R.id.switch_pokemon5_name); textViews[5] = (TextView) getView().findViewById(R.id.switch_pokemon6_name); for (int i = 0; i < getPlayer1Team().size(); i++) { final int idx = i + 1; textViews[i].setText(getPlayer1Team().get(i).getName()); textViews[i].setCompoundDrawablesWithIntrinsicBounds(getPlayer1Team().get(i).getIcon(getActivity()),0,0,0); textViews[i].setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if(!isTeamPreview()) { addCommand("switch " + idx); } else { addCommand("team " + idx); } clearActionFrame(); mCurrentActivePokemon++; if (mCurrentActivePokemon < mTotalActivePokemon) { showAttackOrSwitchFrame(json); } else { sendCommands(); } } }); } }
Source:
static CompletableFuture<?> and(CompletableFuture<?> first, CompletableFuture<?> second) { if (first == AVAILABLE) { if (second == AVAILABLE) { return AVAILABLE; } else { return second; } } else { if (second == AVAILABLE) { return first; } else { return CompletableFuture.allOf(first, second); } } }

Target:
static CompletableFuture<?> and(CompletableFuture<?> first, CompletableFuture<?> second) { if (first == AVAILABLE && second == AVAILABLE) { return AVAILABLE; } else if (first == AVAILABLE) { return second; } else if (second == AVAILABLE) { return first; } else { return CompletableFuture.allOf(first, second); } }
Source:
public void createXWidgetLayoutData(XWidgetRendererItem layoutData, XWidget xWidget, FormToolkit toolkit, Artifact art, XModifiedListener xModListener, boolean isEditable) { if (!Strings.isValid(xWidget.getToolTip())) { String description = ""; if (layoutData.getXWidgetName().equals(XCommitManager.WIDGET_NAME)) { description = XCommitManager.DESCRIPTION; } if (AttributeTypeManager.typeExists(layoutData.getStoreName())) { try { AttributeTypeToken type = null; if (layoutData.getStoreId() > 0) { type = AttributeTypeManager.getTypeById(layoutData.getStoreId()); } else { type = AttributeTypeManager.getType(layoutData.getStoreName()); } if (type != null && Strings.isValid(type.getDescription())) { description = type.getDescription(); } if (Strings.isValid(description)) { xWidget.setToolTip(description); layoutData.setToolTip(description); } } catch (Exception ex) { } } } if (xWidget.getControl() != null) { xWidget.getControl().setData(layoutData); } }

Target:
public void createXWidgetLayoutData(XWidgetRendererItem layoutData, XWidget xWidget, FormToolkit toolkit, Artifact art, XModifiedListener xModListener, boolean isEditable) { if (!Strings.isValid(xWidget.getToolTip())) { String description = ""; if (layoutData.getXWidgetName().equals(XCommitManager.WIDGET_NAME)) { description = XCommitManager.DESCRIPTION; } if (AttributeTypeManager.typeExists(layoutData.getStoreName())) { try { AttributeTypeToken type = null; if (layoutData.getStoreId() > 0) { type = AtsAttributeTypes.getTypeById(layoutData.getStoreId()); } else { type = AtsAttributeTypes.getTypeByName(layoutData.getStoreName()); } if (type == null) { if (layoutData.getStoreId() > 0) { type = AttributeTypeManager.getTypeById(layoutData.getStoreId()); } else { type = AttributeTypeManager.getType(layoutData.getStoreName()); } } if (type != null && Strings.isValid(type.getDescription())) { description = type.getDescription(); } if (Strings.isValid(description)) { xWidget.setToolTip(description); layoutData.setToolTip(description); } } catch (Exception ex) { String msg = String.format("Error setting tooltip for widget [%s]. Error %s (see log for details)", xWidget.getLabel(), ex.getLocalizedMessage()); OseeLog.log(Activator.class, Level.SEVERE, msg, ex); } } } if (xWidget.getControl() != null) { xWidget.getControl().setData(layoutData); } }
Source:
private void createServerSocket() throws UnknownHostException, IOException { serverSocket = new ServerSocket(0, 1, InetAddress.getByName("127.0.0.1")); int a = serverSocket.getLocalPort(); }

Target:
private void createServerSocket() throws UnknownHostException, IOException { serverSocket = new ServerSocket(0, 1, InetAddress.getByName("127.0.0.1")); }
Source:
public void testJsonResponseType() { Assertions.assertAll("Assert equal JSON response type.", () -> Assertions.assertEquals(ResponseType.JSON, ResponseType.fromString("json")), () -> Assertions.assertEquals("json", ResponseType.JSON.toString())); }

Target:
public void testJsonResponseType() { assertAll("Assert equal JSON response type.", () -> assertEquals(ResponseType.JSON, ResponseType.fromString("json")), () -> assertEquals("json", ResponseType.JSON.toString())); }
Source:
private void setServiceDays() { Calendar c = Calendar.getInstance(); c.setTime(new Date(opt.getSecondsSinceEpoch() * 1000)); c.setTimeZone(graph.getTimeZone()); final ServiceDate serviceDate = new ServiceDate(c); this.serviceDays = new ArrayList<ServiceDay>(3); if (calendarService == null && graph.getCalendarService() != null && (opt.modes == null || opt.modes.contains(TraverseMode.TRANSIT))) { LOG.warn("RoutingContext has no CalendarService. Transit will never be boarded."); return; } for (String feedId : graph.getFeedIds()) { for (Agency agency : graph.getAgencies(feedId)) { addIfNotExists(this.serviceDays, new ServiceDay(graph, serviceDate.previous(), calendarService, agency.getId())); addIfNotExists(this.serviceDays, new ServiceDay(graph, serviceDate, calendarService, agency.getId())); addIfNotExists(this.serviceDays, new ServiceDay(graph, serviceDate.next(), calendarService, agency.getId())); if (opt.serviceDayLookout > 0) { ServiceDate sd = serviceDate; for (int i = 0; i < opt.serviceDayLookout; i++) { sd = opt.arriveBy ? sd.previous() : sd.next(); addIfNotExists(this.serviceDays, new ServiceDay(graph, sd, calendarService, agency.getId())); } } } } }

Target:
private void setServiceDays() { Calendar c = Calendar.getInstance(); c.setTime(new Date(opt.getSecondsSinceEpoch() * 1000)); c.setTimeZone(graph.getTimeZone()); final ServiceDate serviceDate = new ServiceDate(c); this.serviceDays = new ArrayList<ServiceDay>(3); if (calendarService == null && graph.getCalendarService() != null && (opt.modes == null || opt.modes.contains(TraverseMode.TRANSIT))) { LOG.warn("RoutingContext has no CalendarService. Transit will never be boarded."); return; } for (TimeZone timeZone : graph.getAllTimeZones()) { addIfNotExists(this.serviceDays, new ServiceDay(graph, serviceDate, calendarService, timeZone)); addIfNotExists(this.serviceDays, new ServiceDay(graph, opt.arriveBy ? serviceDate.next() : serviceDate.previous(), calendarService, timeZone)); ServiceDate sd = serviceDate; int lookout = Math.max(1, opt.serviceDayLookout); for (int i = 0; i < lookout; i++) { sd = opt.arriveBy ? sd.previous() : sd.next(); addIfNotExists(this.serviceDays, new ServiceDay(graph, sd, calendarService, timeZone)); } } serviceDays.sort(Comparator.comparing(ServiceDay::getServiceDate)); }
Source:
protected PMML4Result evaluate(KiePMMLModel model, PMMLContext context) { logger.debug("evaluate {}", model, context); addMissingValuesReplacements(model, context); Optional<PMMLModelExecutor> pmmlModelExecutor = getFromPMMLModelType(model.getPmmlMODEL()); return pmmlModelExecutor.isPresent() ? pmmlModelExecutor.get().evaluate(knowledgeBase, model, context) : new PMML4Result(); }

Target:
protected PMML4Result evaluate(KiePMMLModel model, PMMLContext context) { if (logger.isDebugEnabled()) { logger.debug("evaluate {}", model, context); } addMissingValuesReplacements(model, context); PMMLModelExecutor executor = getFromPMMLModelType(model.getPmmlMODEL()) .orElseThrow(() -> new KiePMMLException(String.format("PMMLModelExecutor not found for model %s", model.getPmmlMODEL()))); return executor.evaluate(knowledgeBase, model, context); }
Source:
public void createWithCorrectUrl() throws Exception { MatcherAssert.assertThat( "Hook json returned wrong url", this.hook.json().getString("url"), new IsEqual<String>( this.xml.xpath("url/text()").get(0) ) ); }

Target:
public void createWithCorrectUrl() throws Exception { final String url = "<LINK_0>"; final int number = 5; final Coordinates coords = new Coordinates.Simple("user/repo"); final MkStorage storage = new MkStorage.InFile(); storage.apply( this.hookDirs(number, coords) .add("url").set(url).up() ); MatcherAssert.assertThat( "Hook json returned wrong url", new MkHook( storage, "login", coords, number ).json().getString("url"), new IsEqual<String>(url) ); }
Source:
private void setBandDetails(List<String> inListe) throws MetadataTypeNotAllowedException { DocStruct ds = this.logicalTopstruct.getAllChildren().get(0); for (String bandDetial : inListe) { String meineDetailNr = bandDetial.substring(0, 3); if (meineDetailNr.equals("060")) { addMetadata(ds, "RUSPublisher", bandDetial); } if (meineDetailNr.equals("070")) { addMetadata(ds, "RUSPlaceOfPublication", bandDetial); } } }

Target:
private void setBandDetails(List<String> inListe) throws MetadataTypeNotAllowedException { DocStruct ds = this.logicalTopstruct.getAllChildren().get(0); for (String bandDetail : inListe) { String meineDetailNr = bandDetail.substring(0, 3); if (meineDetailNr.equals("060")) { addMetadata(ds, "RUSPublisher", bandDetail); } if (meineDetailNr.equals("070")) { addMetadata(ds, "RUSPlaceOfPublication", bandDetail); } } }
Source:
public Method getSearchMethod(String searchMethodName, DSpaceRestRepository repository) { Method searchMethod = null; Method[] methods = org.springframework.util.ClassUtils.getUserClass(repository.getClass()).getMethods(); for (Method method : methods) { SearchRestMethod ann = AnnotationUtils.findAnnotation(method, SearchRestMethod.class); if (ann != null) { String name = ann.name(); if (name.isEmpty()) { name = method.getName(); } if (StringUtils.equals(name, searchMethodName)) { searchMethod = method; break; } } } return searchMethod; }

Target:
public Method getSearchMethod(String searchMethodName, DSpaceRestRepository repository) { Method searchMethod = null; Method[] methods = ClassUtils.getUserClass(repository.getClass()).getMethods(); for (Method method : methods) { SearchRestMethod ann = AnnotationUtils.findAnnotation(method, SearchRestMethod.class); if (ann != null) { String name = ann.name(); if (name.isEmpty()) { name = method.getName(); } if (StringUtils.equals(name, searchMethodName)) { searchMethod = method; break; } } } return searchMethod; }
Source:
public void scheduleJobsForHosts() { vdsManagersDict.values().stream().forEach(VdsManager::scheduleJobs); }

Target:
public void scheduleJobsForHosts() { vdsManagersDict.values().forEach(VdsManager::scheduleJobs); }
Source:
protected void populateAdditions(BasicBrooklynCatalog catalog) { if (Strings.isNonBlank(additionsUri)) { if (disallowLocal) { if (!hasRunAdditions) { log.warn("CLI additions supplied but not supported in disallow-local mode; ignoring."); } return; } if (!hasRunAdditions) { log.debug("Adding to catalog from CLI: "+additionsUri+" (force: "+force+")"); } Iterable<? extends CatalogItem<?, ?>> items = catalog.addItems( new ResourceUtils(this).getResourceAsString(additionsUri), force); if (!hasRunAdditions) log.debug("Added to catalog from CLI: "+items); else log.debug("Added to catalog from CLI: count "+Iterables.size(items)); hasRunAdditions = true; } }

Target:
protected void populateAdditions(BasicBrooklynCatalog catalog) { if (Strings.isNonBlank(additionsUri)) { if (disallowLocal) { if (!hasRunAdditions) { log.warn("CLI additions supplied but not supported when catalog load mode disallows local loads; ignoring."); } return; } if (!hasRunAdditions) { log.debug("Adding to catalog from CLI: "+additionsUri+" (force: "+force+")"); } Iterable<? extends CatalogItem<?, ?>> items = catalog.addItems( new ResourceUtils(this).getResourceAsString(additionsUri), force); if (!hasRunAdditions) log.debug("Added to catalog from CLI: "+items); else log.debug("Added to catalog from CLI: count "+Iterables.size(items)); hasRunAdditions = true; } }
Source:
public void delete(String id) { File file = getFingerprintFile(id); file.delete(); File inner = new File(Jenkins.get().getRootDir(), "fingerprints/"+id.substring(0,2)+"/"+id.substring(2,4)); String[] inner_files = inner.list(); if (inner_files!=null && inner_files.length==0) inner.delete(); File outer = new File(Jenkins.get().getRootDir(), "fingerprints/"+id.substring(0,2)); String[] outer_files = outer.list(); if (outer_files!=null && outer_files.length==0) outer.delete(); }

Target:
public void delete(String id) throws IOException { File file = getFingerprintFile(id); if (!file.exists()) { return; } if (!file.delete()) { throw new IOException("Error occurred in deleting Fingerprint " + id); } File inner = new File(Jenkins.get().getRootDir(), "fingerprints/" + id.substring(0,2) + "/" + id.substring(2,4)); String[] inner_files = inner.list(); if (inner_files != null && inner_files.length == 0) { if (!inner.delete()){ throw new IOException("Error occurred in deleting inner directory of Fingerprint " + id); } } File outer = new File(Jenkins.get().getRootDir(), "fingerprints/" + id.substring(0,2)); String[] outer_files = outer.list(); if (outer_files != null && outer_files.length == 0) { if (!outer.delete()){ throw new IOException("Error occurred in deleting outer directory of Fingerprint " + id); } } }
Source:
private void setMem(ITmfEvent event, Long ptr, Long size) { long ts = event.getTimestamp().getValue(); Long tid = getVtid(event); Long memoryDiff = size; if (ZERO.equals(size)) { Long memSize = fMemory.remove(ptr); if (memSize == null) { return; } memoryDiff = MINUS_ONE * memSize; } else { fMemory.put(ptr, size); } try { int tidQuark = ss.getQuarkAbsoluteAndAdd(String.valueOf(tid)); int tidMemQuark = ss.getQuarkRelativeAndAdd(tidQuark, UstMemoryStrings.UST_MEMORY_MEMORY_ATTRIBUTE); ITmfStateValue prevMem = ss.queryOngoingState(tidMemQuark); if (prevMem.isNull()) { int procNameQuark = ss.getQuarkRelativeAndAdd(tidQuark, UstMemoryStrings.UST_MEMORY_PROCNAME_ATTRIBUTE); String procName = getProcname(event); if (MINUS_ONE.equals(tid)) { procName = UstMemoryStrings.OTHERS; } ss.modifyAttribute(ts, TmfStateValue.newValueString(procName), procNameQuark); prevMem = TmfStateValue.newValueLong(0); } long prevMemValue = prevMem.unboxLong(); prevMemValue += memoryDiff.longValue(); ss.modifyAttribute(ts, TmfStateValue.newValueLong(prevMemValue), tidMemQuark); } catch (AttributeNotFoundException | TimeRangeException | StateValueTypeException e) { throw new IllegalStateException(e); } }

Target:
private void setMem(ITmfEvent event, Long ptr, Long size) { long ts = event.getTimestamp().getValue(); Long tid = getVtid(event); Long memoryDiff = size; if (ZERO.equals(size)) { Long memSize = fMemory.remove(ptr); if (memSize == null) { return; } memoryDiff = -memSize; } else { fMemory.put(ptr, size); } try { int tidQuark = ss.getQuarkAbsoluteAndAdd(tid.toString()); int tidMemQuark = ss.getQuarkRelativeAndAdd(tidQuark, UstMemoryStrings.UST_MEMORY_MEMORY_ATTRIBUTE); ITmfStateValue prevMem = ss.queryOngoingState(tidMemQuark); if (prevMem.isNull()) { int procNameQuark = ss.getQuarkRelativeAndAdd(tidQuark, UstMemoryStrings.UST_MEMORY_PROCNAME_ATTRIBUTE); String procName = getProcname(event); if (tid.equals(MINUS_ONE)) { procName = UstMemoryStrings.OTHERS; } ss.modifyAttribute(ts, TmfStateValue.newValueString(procName), procNameQuark); prevMem = TmfStateValue.newValueLong(0); } long prevMemValue = prevMem.unboxLong(); prevMemValue += memoryDiff.longValue(); ss.modifyAttribute(ts, TmfStateValue.newValueLong(prevMemValue), tidMemQuark); } catch (AttributeNotFoundException | TimeRangeException | StateValueTypeException e) { throw new IllegalStateException(e); } }