auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void onResume() { super.onResume(); if (mSelectRoleShareVM.isRemoveSeleted()) { showSpinner(); mCollaborationsShareVM.deleteCollaboration(mSelectRoleShareVM.getCollaboration()); mSelectRoleShareVM.setRemoveSelected(false); } else { if (mSelectRoleShareVM.getSelectedRole().getValue() != null && mSelectRoleShareVM.getCollaboration() != null) { if (mSelectRoleShareVM.getSelectedRole().getValue() != mSelectRoleShareVM.getCollaboration().getRole()) { if (mSelectRoleShareVM.getSelectedRole().getValue() == BoxCollaboration.Role.OWNER) { AlertDialog dialog = new AlertDialog.Builder(getActivity()).setTitle(R.string.box_sharesdk_change_owner_alert_title) .setMessage(R.string.box_sharesdk_change_owner_alert_message) .setPositiveButton(android.R.string.yes, (d, which) -> { showSpinner(R.string.box_sharesdk_fetching_collaborators, R.string.boxsdk_Please_wait); mCollaborationsShareVM.updateOwner(mSelectRoleShareVM.getCollaboration()); }).setNegativeButton(android.R.string.no, (d, which) -> {}).setIcon(android.R.drawable.ic_dialog_alert).create(); dialog.show(); } else { showSpinner(); mCollaborationsShareVM.updateCollaboration(mSelectRoleShareVM.getCollaboration(), mSelectRoleShareVM.getSelectedRole().getValue()); } mSelectRoleShareVM.setSelectedRole(null); } } } if (mCollaborationsShareVM.getCollaborations().getValue() == null) { mCollaborationsShareVM.fetchItemInfo(mCollaborationsShareVM.getShareItem()); } }

Target:
public void onResume() { super.onResume(); if (mSelectRoleShareVM.isRemoveSelected()) { showSpinner(); mCollaborationsShareVM.deleteCollaboration(mSelectRoleShareVM.getCollaboration()); } else { if (mSelectRoleShareVM.getSelectedRole().getValue() != null && mSelectRoleShareVM.getCollaboration() != null) { if (mSelectRoleShareVM.getSelectedRole().getValue() != mSelectRoleShareVM.getCollaboration().getRole()) { if (mSelectRoleShareVM.getSelectedRole().getValue() == BoxCollaboration.Role.OWNER) { AlertDialog dialog = new AlertDialog.Builder(getActivity()).setTitle(R.string.box_sharesdk_change_owner_alert_title) .setMessage(R.string.box_sharesdk_change_owner_alert_message) .setPositiveButton(android.R.string.yes, (d, which) -> { showSpinner(R.string.box_sharesdk_fetching_collaborators, R.string.boxsdk_Please_wait); mCollaborationsShareVM.updateOwner(mSelectRoleShareVM.getCollaboration()); }).setNegativeButton(android.R.string.no, (d, which) -> {}).setIcon(android.R.drawable.ic_dialog_alert).create(); dialog.show(); } else { showSpinner(); mCollaborationsShareVM.updateCollaboration(mSelectRoleShareVM.getCollaboration(), mSelectRoleShareVM.getSelectedRole().getValue()); } } } } if (mCollaborationsShareVM.getCollaborations().getValue() == null) { mCollaborationsShareVM.fetchItemInfo(mCollaborationsShareVM.getShareItem()); } mSelectRoleShareVM.reset(); }
Source:
void stop() { allocatorExecutor.shutdown(); try { if (!allocatorExecutor.awaitTermination(3, TimeUnit.SECONDS)) { log.warn("Timedout while awaiting for allocatorExecutor's termination, so force shuttingdown"); } } catch (InterruptedException e) { log.warn("Got InterruptedException while awaiting termination of allocatorExecutor, so force shuttingdown"); } allocatorExecutor.shutdownNow(); log.info("Stopped entry logger preallocator."); }

Target:
void stop() { allocatorExecutor.shutdown(); try { if (!allocatorExecutor.awaitTermination(5, TimeUnit.SECONDS)) { log.warn("Timedout while awaiting for allocatorExecutor's termination, so force shuttingdown"); } } catch (InterruptedException e) { log.warn("Got InterruptedException while awaiting termination of allocatorExecutor, so force shuttingdown"); Thread.currentThread().interrupt(); } allocatorExecutor.shutdownNow(); log.info("Stopped entry logger preallocator."); }
Source:
public AbstractLunAvailableSizeColumn() { super(new AbstractToggleButtonCell<LunModel>() { @Override public void onClickEvent(LunModel lunModel) { if (lunModel !=null) { lunModel.setAdditionalAvailableSizeSelected(!lunModel.isAdditionalAvailableSizeSelected()); } } @Override public void render(Context context, LunModel value, SafeHtmlBuilder sb, String id) { boolean isGrayedOut = value.getIsGrayedOut(); String inputId = id + "_input"; SafeHtml input = null; int additionalAvailableSizeSize = value.getAdditionalAvailableSize(); String additionalAvailableSizeSizeString = "+ " + additionalAvailableSizeSize + " GB"; if (additionalAvailableSizeSize == 0 || !value.getIsIncluded()) { input = templates.disabled("", "color:gray", inputId); } else if (!isGrayedOut) { input = templates.disabled("", "color:black", inputId); } else if (value.isAdditionalAvailableSizeSelected()) { input = templates.toggledDown(inputId, additionalAvailableSizeSizeString); } else { input = templates.toggledUp(inputId, additionalAvailableSizeSizeString); } sb.append(templates.span(id, input)); } }); }

Target:
public AbstractLunAvailableSizeColumn() { super(new AbstractToggleButtonCell<LunModel>() { @Override public void onClickEvent(LunModel lunModel) { if (lunModel !=null) { lunModel.setAdditionalAvailableSizeSelected(!lunModel.isAdditionalAvailableSizeSelected()); } } @Override public void render(Context context, LunModel value, SafeHtmlBuilder sb, String id) { boolean isGrayedOut = value.getIsGrayedOut(); String inputId = id + "_input"; SafeHtml input = null; int additionalAvailableSizeSize = value.getAdditionalAvailableSize(); String additionalAvailableSizeSizeString = messages.additionalAvailableSizeInGB(additionalAvailableSizeSize); if (additionalAvailableSizeSize == 0 || !value.getIsIncluded()) { input = templates.disabled("", "color:gray", inputId); } else if (!isGrayedOut) { input = templates.disabled("", "color:black", inputId); } else if (value.isAdditionalAvailableSizeSelected()) { input = templates.toggledDown(inputId, additionalAvailableSizeSizeString); } else { input = templates.toggledUp(inputId, additionalAvailableSizeSizeString); } sb.append(templates.span(id, input)); } }); }
Source:
public String getPendingViewAsString() { CacheTopology cacheTopology = stateTransferManager.getCacheTopology(); return (!(cacheTopology != null && cacheTopology.getPendingCH() != null)) ? "N/A" : cacheTopology.getPendingCH().getMembers().toString(); }

Target:
public String getPendingViewAsString() { CacheTopology cacheTopology = stateTransferManager.getCacheTopology(); return (cacheTopology != null && cacheTopology.getPendingCH() != null) ? cacheTopology.getPendingCH().getMembers().toString() : "N/A"; }
Source:
public void scrutinize(ItemUpdate update) { Map<PropertyIdValue, Value> propertyIdValueValueMap = new HashMap<>(); for (Statement statement : update.getAddedStatements()){ PropertyIdValue pid = statement.getClaim().getMainSnak().getPropertyId(); Value value = statement.getClaim().getMainSnak().getValue(); propertyIdValueValueMap.put(pid, value); } for(PropertyIdValue propertyId : propertyIdValueValueMap.keySet()){ List<PropertyIdValue> conflictingProperties = _fetcher.getConflictsWithProperties(propertyId); if (conflictingProperties != null){ for (PropertyIdValue conflictingPid : conflictingProperties) { if (propertyIdValueValueMap.containsKey(conflictingPid) && raiseWarning(propertyId, propertyIdValueValueMap, conflictingPid)) { QAWarning issue = new QAWarning(type, propertyId.getId(), QAWarning.Severity.WARNING, 1); issue.setProperty("property_entity", propertyId); issue.setProperty("added_property_entity", conflictingPid); issue.setProperty("example_entity", update.getItemId()); addIssue(issue); } } } } }

Target:
public void scrutinize(ItemUpdate update) { Map<PropertyIdValue, Set<Value>> propertyIdValueValueMap = new HashMap<>(); for (Statement statement : update.getAddedStatements()){ PropertyIdValue pid = statement.getClaim().getMainSnak().getPropertyId(); Value value = statement.getClaim().getMainSnak().getValue(); Set<Value> values; if (value != null) { if (propertyIdValueValueMap.containsKey(pid)) { values = propertyIdValueValueMap.get(pid); } else { values = new HashSet<>(); } values.add(value); propertyIdValueValueMap.put(pid, values); } } for(PropertyIdValue propertyId : propertyIdValueValueMap.keySet()){ Map<PropertyIdValue, List<Value>> conflictingPropertyMap = _fetcher.getParamConflictsWith(propertyId); for (PropertyIdValue conflictingPid : conflictingPropertyMap.keySet()) { if (propertyIdValueValueMap.containsKey(conflictingPid) && raiseWarning(propertyIdValueValueMap, conflictingPid, conflictingPropertyMap)) { QAWarning issue = new QAWarning(type, propertyId.getId()+conflictingPid.getId(), QAWarning.Severity.WARNING, 1); issue.setProperty("property_entity", propertyId); issue.setProperty("added_property_entity", conflictingPid); issue.setProperty("example_entity", update.getItemId()); addIssue(issue); } } } }
Source:
public SSLContext get() { Credentials currentCreds = checkNotNull(creds.get(), "credential supplier returned null"); String keyStorePassword = checkNotNull(currentCreds.credential, "credential supplier returned null credential (should be keyStorePassword)"); KeyManagerFactory kmf; try { kmf = KeyManagerFactory.getInstance("SunX509"); kmf.init(keyStore.get(), keyStorePassword.toCharArray()); SSLContext sc = SSLContext.getInstance("TLS"); sc.init(kmf.getKeyManagers(), trustManager, new SecureRandom()); System.setProperty("https.protocols", "TLSv1"); return sc; } catch (NoSuchAlgorithmException e) { throw propagate(e); } catch (UnrecoverableKeyException e) { throw propagate(e); } catch (KeyStoreException e) { throw propagate(e); } catch (KeyManagementException e) { throw propagate(e); } }

Target:
public SSLContext get() { Credentials currentCreds = checkNotNull(creds.get(), "credential supplier returned null"); try { SSLContext sslContext = SSLContext.getInstance("TLS"); X509Certificate certificate = getCertificate(loadFile(currentCreds.identity)); PrivateKey privateKey = getKey(loadFile(currentCreds.credential)); sslContext.init(new KeyManager[]{new InMemoryKeyManager(certificate, privateKey)}, trustManager, new SecureRandom()); return sslContext; } catch (NoSuchAlgorithmException e) { throw propagate(e); } catch (KeyManagementException e) { throw propagate(e); } catch (CertificateException e) { throw propagate(e); } catch (IOException e) { throw propagate(e); } }
Source:
public void fromStream_user_providesToken() throws IOException { MockTokenServerTransportFactory transportFactory = new MockTokenServerTransportFactory(); transportFactory.transport.addClient(CLIENT_ID, CLIENT_SECRET); transportFactory.transport.addRefreshToken(REFRESH_TOKEN, ACCESS_TOKEN); InputStream userStream = UserCredentialsTest.writeUserStream(CLIENT_ID, CLIENT_SECRET, REFRESH_TOKEN); UserCredentials credentials = UserCredentials.fromStream(userStream, transportFactory); assertNotNull(credentials); Map<String, List<String>> metadata = credentials.getRequestMetadata(CALL_URI); TestUtils.assertContainsBearerToken(metadata, ACCESS_TOKEN); }

Target:
public void fromStream_user_providesToken() throws IOException { MockTokenServerTransportFactory transportFactory = new MockTokenServerTransportFactory(); transportFactory.transport.addClient(CLIENT_ID, CLIENT_SECRET); transportFactory.transport.addRefreshToken(REFRESH_TOKEN, ACCESS_TOKEN); InputStream userStream = writeUserStream(CLIENT_ID, CLIENT_SECRET, REFRESH_TOKEN); UserCredentials credentials = UserCredentials.fromStream(userStream, transportFactory); assertNotNull(credentials); Map<String, List<String>> metadata = credentials.getRequestMetadata(CALL_URI); TestUtils.assertContainsBearerToken(metadata, ACCESS_TOKEN); }
Source:
public void scan(HttpMessage msg, String param, String value) { if (this.inScope(Tech.Linux) || this.inScope(Tech.MacOS)) { if (matchBodyPattern(getBaseMsg(), patternSSIUnix, new StringBuilder())) { return; } if (testServerSideInclude(param, SSI_UNIX, patternSSIUnix)) { return; } if (testServerSideInclude(param, SSI_UNIX2, patternSSIUnix)) { return; } } if (this.inScope(Tech.Windows)) { if (matchBodyPattern(getBaseMsg(), patternSSIWin, new StringBuilder())) { return; } if (testServerSideInclude(param, SSI_WIN, patternSSIWin)) { return; } if (testServerSideInclude(param, SSI_WIN2, patternSSIWin)) { return; } } }

Target:
public void scan(HttpMessage msg, String param, String value) { if ((this.inScope(Tech.Linux) || this.inScope(Tech.MacOS)) && !isEvidencePresent(patternSSIUnix)) { if (testServerSideInclude(param, SSI_UNIX, patternSSIUnix)) { return; } if (testServerSideInclude(param, SSI_UNIX2, patternSSIUnix)) { return; } } if (this.inScope(Tech.Windows) && !isEvidencePresent(patternSSIWin)) { if (testServerSideInclude(param, SSI_WIN, patternSSIWin)) { return; } if (testServerSideInclude(param, SSI_WIN2, patternSSIWin)) { return; } } }
Source:
public void onHelpClick() { UriUtil.visitInExternalBrowser(getContext(), Uri.parse(requireContext().getString(R.string.android_app_edit_help_url))); }

Target:
public void onHelpClick() { FeedbackUtil.showAndroidAppEditingFAQ(requireContext()); }
Source:
public static Block read(final int major, InputStream inputStream) { final boolean v3OrHigher = major >= CramVersions.CRAM_v3.major; if (v3OrHigher) { inputStream = new CRC32InputStream(inputStream); } try { final BlockCompressionMethod method = BlockCompressionMethod.byId(inputStream.read()); final BlockContentType type = BlockContentType.byId(inputStream.read()); final int contentId = ITF8.readUnsignedITF8(inputStream); final int compressedSize = ITF8.readUnsignedITF8(inputStream); final int rawSize = ITF8.readUnsignedITF8(inputStream); final byte[] compressedContent = new byte[compressedSize]; InputStreamUtils.readFully(inputStream, compressedContent, 0, compressedSize); if (v3OrHigher) { final int actualChecksum = ((CRC32InputStream) inputStream).getCRC32(); final int checksum = CramInt.readInt32(inputStream); if (checksum != actualChecksum) { throw new RuntimeException(String.format("Block CRC32 mismatch: %04x vs %04x", checksum, actualChecksum)); } } final byte[] uncompressedContent = ExternalCompression.uncompress(method, compressedContent); if (uncompressedContent.length != rawSize) { throw new CRAMException(String.format("Block uncompressed size did not match expected size: %04x vs %04x", rawSize, uncompressedContent.length)); } switch (type) { case FILE_HEADER: return new FileHeaderBlock(method, compressedContent); case COMPRESSION_HEADER: return new CompressionHeaderBlock(method, compressedContent); case MAPPED_SLICE: return new SliceHeaderBlock(method, compressedContent); case EXTERNAL: return new ExternalDataBlock(method, compressedContent, contentId); case CORE: return new CoreDataBlock(method, compressedContent); default: throw new CRAMException("Unknown BlockContentType " + type.name()); } } catch (final IOException e) { throw new RuntimeIOException(e); } }

Target:
public static Block read(final int major, InputStream inputStream) { final boolean v3OrHigher = major >= CramVersions.CRAM_v3.major; if (v3OrHigher) { inputStream = new CRC32InputStream(inputStream); } try { final BlockCompressionMethod compressionMethod = BlockCompressionMethod.byId(inputStream.read()); final BlockContentType contentType = BlockContentType.byId(inputStream.read()); final int contentId = ITF8.readUnsignedITF8(inputStream); final int compressedSize = ITF8.readUnsignedITF8(inputStream); final int uncompressedSize = ITF8.readUnsignedITF8(inputStream); final byte[] compressedContent = new byte[compressedSize]; InputStreamUtils.readFully(inputStream, compressedContent, 0, compressedSize); if (v3OrHigher) { final int actualChecksum = ((CRC32InputStream) inputStream).getCRC32(); final int checksum = CramInt.readInt32(inputStream); if (checksum != actualChecksum) { throw new RuntimeException(String.format("Block CRC32 mismatch: %04x vs %04x", checksum, actualChecksum)); } } if (contentType == BlockContentType.EXTERNAL) { return new ExternalBlock(compressionMethod, contentId, compressedContent, uncompressedSize); } else { return new Block(compressionMethod, contentType, compressedContent, uncompressedSize); } } catch (final IOException e) { throw new RuntimeIOException(e); } }
Source:
protected boolean validateSourceDomainsSpaceRequirements() { Map<Guid, List<DiskImage>> storageDomainsActiveImagesMap = new HashMap<>(); for (LiveMigrateDiskParameters parameters : getParameters().getParametersList()) { DiskImage diskImage = getDiskImageByImageId(parameters.getImageId()); if (diskImage.getActive()) { diskImage.getSnapshots().add(diskImage); MultiValueMapUtils.addToMap(parameters.getSourceStorageDomainId(), diskImage, storageDomainsActiveImagesMap); } } for (Map.Entry<Guid, List<DiskImage>> entry : storageDomainsActiveImagesMap.entrySet()) { Guid sourceDomainId = entry.getKey(); List<DiskImage> disksList = entry.getValue(); Guid storagePoolId = disksList.get(0).getStoragePoolId(); StorageDomain sourceDomain = getStorageDomainById(sourceDomainId, storagePoolId); if (!doesStorageDomainHasSpaceForRequest(sourceDomain, disksList)) { return false; } } return true; }

Target:
protected boolean validateSourceDomainsSpaceRequirements() { Map<Guid, List<DiskImage>> storageDomainsActiveImagesMap = new HashMap<>(); for (LiveMigrateDiskParameters parameters : getParameters().getParametersList()) { DiskImage diskImage = getDiskImageByImageId(parameters.getImageId()); if (diskImage.getActive()) { diskImage.getSnapshots().add(diskImage); MultiValueMapUtils.addToMap(parameters.getSourceStorageDomainId(), diskImage, storageDomainsActiveImagesMap); } } for (Map.Entry<Guid, List<DiskImage>> entry : storageDomainsActiveImagesMap.entrySet()) { Guid sourceDomainId = entry.getKey(); List<DiskImage> disksList = entry.getValue(); Guid storagePoolId = disksList.get(0).getStoragePoolId(); StorageDomain sourceDomain = getStorageDomainById(sourceDomainId, storagePoolId); if (!doesStorageDomainHaveSpaceForRequest(sourceDomain, disksList)) { return false; } } return true; }
Source:
int binarySearch(K key) { int res = map.getKeyType().binarySearch(key, keys, getKeyCount(), cachedCompare); cachedCompare = (res < 0 ? -res : res) - 1; return res; }

Target:
int binarySearch(K key) { int res = map.getKeyType().binarySearch(key, keys, getKeyCount(), cachedCompare); cachedCompare = res < 0 ? ~res : res + 1; return res; }
Source:
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) { if (resource != null) { Fluid f = resource.getFluid(); if (f != null) { Fluid fluid = tank.getFluidType(); if (fluid != null && f.getID() == fluid.getID()) return tank.drain(resource.amount, doDrain); } } return null; }

Target:
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) { return tank.drain(resource, doDrain); }
Source:
public static <K, V> List<ConsumerRecord<K, V>> waitUntilMinRecordsReceived(final Properties consumerConfig, final String topic, final int expectedNumRecords, final long waitTime) throws InterruptedException { final List<ConsumerRecord<K, V>> accumData = new ArrayList<>(); final String reason = String.format("Did not receive all %d records from topic %s within %d ms", expectedNumRecords, topic, waitTime); try (final Consumer<K, V> consumer = createConsumer(consumerConfig)) { TestUtils.retryOnExceptionWithTimeout(waitTime, () -> { final List<ConsumerRecord<K, V>> readData = readRecords(topic, consumer, waitTime, expectedNumRecords); accumData.addAll(readData); assertThat(reason, accumData.size(), is(greaterThanOrEqualTo(expectedNumRecords))); }); } return accumData; }

Target:
public static <K, V> List<ConsumerRecord<K, V>> waitUntilMinRecordsReceived(final Properties consumerConfig, final String topic, final int expectedNumRecords, final long waitTime) throws InterruptedException { final List<ConsumerRecord<K, V>> accumData = new ArrayList<>(); final String reason = String.format("Did not receive all %d records from topic %s within %d ms", expectedNumRecords, topic, waitTime); try (final Consumer<K, V> consumer = createConsumer(consumerConfig)) { retryOnExceptionWithTimeout(waitTime, () -> { final List<ConsumerRecord<K, V>> readData = readRecords(topic, consumer, waitTime, expectedNumRecords); accumData.addAll(readData); assertThat(reason, accumData.size(), is(greaterThanOrEqualTo(expectedNumRecords))); }); } return accumData; }
Source:
public void setImage (Image image) { checkWidget (); if ((style & SWT.SEPARATOR) != 0) return; if (image != null && image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT); this.image = image; updateStyleBits(false); OS.InvalidateRect (handle, null, true); }

Target:
public void setImage (Image image) { checkWidget (); if ((style & SWT.SEPARATOR) != 0) return; if (image != null && image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT); this.image = image; updateStyleBits(image == null); OS.InvalidateRect (handle, null, true); }
Source:
public static void setupEnvironment() throws Exception { IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceDescription description = workspace.getDescription(); description.setAutoBuilding(false); workspace.setDescription(description); GitImportRepoWizard importWizard = new GitImportRepoWizard(); importWizard.openWizard(); String repoName = "egit"; String repoUrl = "git://egit.eclipse.org/egit.git"; if (!importWizard.containsRepo(repoName)) { addRepository(importWizard, repoUrl); } importWizard.selectAndCloneRepository(repoName); importWizard.waitForCreate(); waitForWorkspaceRefresh(); }

Target:
public static void setupEnvironment() throws Exception { IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceDescription description = workspace.getDescription(); description.setAutoBuilding(false); workspace.setDescription(description); GitImportRepoWizard importWizard = new GitImportRepoWizard(); importWizard.openWizard(); String repoName = "egit"; String repoUrl = "git://egit.eclipse.org/egit.git"; if (!importWizard.containsRepo(repoName)) addRepository(importWizard, repoUrl); importWizard.selectAndCloneRepository(repoName); importWizard.waitForCreate(); waitForWorkspaceRefresh(); }
Source:
protected void configure() { bind(String.class).annotatedWith(PluginName.class).toInstance(pluginName); bind(WebUiPlugin.class).annotatedWith(UniqueAnnotations.create()) .toInstance(new JavaScriptPlugin(fileName)); }

Target:
protected void configure() { bind(String.class).annotatedWith(PluginName.class).toInstance(pluginName); DynamicSet.bind(binder(), WebUiPlugin.class).toInstance( new JavaScriptPlugin(fileName)); }
Source:
public List<QuickFilter> getQuickFilters() { return this.quickFilters; }

Target:
public List<QuickFilter> getQuickFilters() { return quickFilters; }
Source:
public ListenableFuture<?> isBlocked() { if (!finishing || !joinPagesNotNeeded.isPresent()) { return NOT_BLOCKED; } return joinPagesNotNeeded.get(); }

Target:
public ListenableFuture<?> isBlocked() { return probeDoneWithPages.orElse(NOT_BLOCKED); }
Source:
public ConsumerTestRuntimeEnvironment(Supplier<CuratorFramework> curatorSupplier) { this.paths = new ZookeeperPaths("/hermes"); this.curatorSupplier = curatorSupplier; this.curator = curatorSupplier.get(); this.groupRepository = new ZookeeperGroupRepository(curator, objectMapper, paths); this.topicRepository = new ZookeeperTopicRepository(curator, objectMapper, paths, groupRepository); this.subscriptionRepository = new ZookeeperSubscriptionRepository(curator, objectMapper, paths, topicRepository); this.configFactory = new MutableConfigFactory().overrideProperty(CONSUMER_WORKLOAD_REBALANCE_INTERVAL, 1); this.consumersRegistry = new ConsumerNodesRegistry(curator, executorService, paths.consumersRegistryPath(), "id"); this.metrics = mock(HermesMetrics.class); when(metrics.timer(anyString())).thenReturn(new Timer()); try { curator.create().creatingParentsIfNeeded().forPath("/hermes/groups"); consumersRegistry.start(); } catch (Exception e) { e.printStackTrace(); } }

Target:
public ConsumerTestRuntimeEnvironment(Supplier<CuratorFramework> curatorSupplier) { this.paths = new ZookeeperPaths("/hermes"); this.curatorSupplier = curatorSupplier; this.curator = curatorSupplier.get(); this.groupRepository = new ZookeeperGroupRepository(curator, objectMapper, paths); this.topicRepository = new ZookeeperTopicRepository(curator, objectMapper, paths, groupRepository); this.subscriptionRepository = new ZookeeperSubscriptionRepository(curator, objectMapper, paths, topicRepository); this.configFactory = new MutableConfigFactory().overrideProperty(CONSUMER_WORKLOAD_REBALANCE_INTERVAL, 1); this.consumersRegistry = new ConsumerNodesRegistry(curator, executorService, paths.consumersRegistryPath(CLUSTER_NAME), "id"); this.metrics = mock(HermesMetrics.class); when(metrics.consumersWorkloadRebalanceDurationTimer(anyString())).thenReturn(new Timer()); try { curator.create().creatingParentsIfNeeded().forPath("/hermes/groups"); consumersRegistry.start(); } catch (Exception e) { throw new InternalProcessingException(e); } }
Source:
public void testDefaults() { ConfigAssertions.assertRecordedDefaults(ConfigAssertions.recordDefaults(JsonWebTokenConfig.class) .setKey(null) .setRequiredAudience(null) .setRequiredIssuer(null)); }

Target:
public void testDefaults() { assertRecordedDefaults(ConfigAssertions.recordDefaults(JsonWebTokenConfig.class) .setKey(null) .setRequiredAudience(null) .setRequiredIssuer(null)); }
Source:
public Message[] getErrors() { Message[] messages = new Message[fErrors.size()]; int i = 0; for (String string : fErrors) { messages[i++] = new Message(string, -1); } return messages; }

Target:
public Message[] getErrors() { Message[] messages = new Message[fErrors.size()]; int i = 0; for (String message : fErrors) { messages[i++] = new Message(message, -1); } return messages; }
Source:
public void publishJobModelVersion(String oldVersion, String newVersion) { Stat stat = new Stat(); String currentVersion = zkClient.<String>readData(keyBuilder.getJobModelVersionPath(), stat); LOG.info("publishing new version: " + newVersion + "; oldVersion = " + oldVersion + "(" + stat .getVersion() + ")"); if (currentVersion != null && !currentVersion.equals(oldVersion)) { throw new SamzaException( "Someone changed JobModelVersion while the leader was generating one: expected" + oldVersion + ", got " + currentVersion); } int dataVersion = stat.getVersion(); try { stat = zkClient.writeDataReturnStat(keyBuilder.getJobModelVersionPath(), newVersion, dataVersion); } catch (Exception e) { String msg = "publish job model version failed for new version = " + newVersion + "; old version = " + oldVersion; LOG.error(msg, e); throw new SamzaException(e); } LOG.info("published new version: " + newVersion + "; expected data version = " + (dataVersion + 1) + "(actual data version after update = " + stat.getVersion() + ")"); }

Target:
public void publishJobModelVersion(String oldVersion, String newVersion) { Stat stat = new Stat(); String currentVersion = zkClient.<String>readData(keyBuilder.getJobModelVersionPath(), stat); LOG.info("publishing new version: " + newVersion + "; oldVersion = " + oldVersion + "(" + stat .getVersion() + ")"); if (currentVersion != null && !currentVersion.equals(oldVersion)) { throw new SamzaException( "Someone changed JobModelVersion while the leader was generating one: expected" + oldVersion + ", got " + currentVersion); } int dataVersion = stat.getVersion(); try { stat = zkClient.writeDataReturnStat(keyBuilder.getJobModelVersionPath(), newVersion, dataVersion); } catch (Exception e) { String msg = "publish job model version failed for new version = " + newVersion + "; old version = " + oldVersion; LOG.error(msg, e); throw new SamzaException(msg, e); } LOG.info("published new version: " + newVersion + "; expected data version = " + (dataVersion + 1) + "(actual data version after update = " + stat.getVersion() + ")"); }
Source:
private String generateExcludes(final Iterable<String> excludes) { final StringBuilder xml = new StringBuilder(75); xml.append("<FindBugsFilter><Match><Or>"); for (final String exclude : excludes) { xml.append("<Class name=\"").append(exclude).append("\"/>"); } xml.append("</Or></Match></FindBugsFilter>"); return xml.toString(); }

Target:
private String generateExcludes(final Iterable<String> excludes) { final Directives directives = new Directives() .add("FindBugsFilter") .add("Match") .add("Or"); for (final String exclude : excludes) { if (exclude != null) { directives.add("Class").attr("name", exclude).up(); } } return new Xembler(directives).xmlQuietly(); }
Source:
public Registration deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { JsonNode node = p.readValueAsTree(); Registration.Builder builder = Registration.builder(); if (node.hasNonNull("name")) { builder.name(node.get("name").asText()); } if (node.hasNonNull("url")) { String url = node.get("url").asText(); builder.healthUrl(url.replaceFirst("/+$", "") + "/health").managementUrl(url); } else { if (node.hasNonNull("healthUrl")) { builder.healthUrl(node.get("healthUrl").asText()); } if (node.hasNonNull("managementUrl")) { builder.managementUrl(node.get("managementUrl").asText()); } if (node.hasNonNull("serviceUrl")) { builder.serviceUrl(node.get("serviceUrl").asText()); } } if (node.hasNonNull("metadata")) { Iterator<Map.Entry<String, JsonNode>> it = node.get("metadata").fields(); while (it.hasNext()) { Map.Entry<String, JsonNode> entry = it.next(); builder.metadata(entry.getKey(), entry.getValue().asText()); } } return builder.build(); }

Target:
public Registration deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { JsonNode node = p.readValueAsTree(); Registration.Builder builder = Registration.builder(); if (node.hasNonNull("name")) { builder.name(node.get("name").asText()); } if (node.hasNonNull("url")) { String url = node.get("url").asText(); builder.healthUrl(url.replaceFirst("/+$", "") + "/health").managementUrl(url); } else { if (node.hasNonNull("healthUrl")) { builder.healthUrl(node.get("healthUrl").asText()); } if (node.hasNonNull("managementUrl")) { builder.managementUrl(node.get("managementUrl").asText()); } if (node.hasNonNull("serviceUrl")) { builder.serviceUrl(node.get("serviceUrl").asText()); } } if (node.has("metadata")) { Iterator<Map.Entry<String, JsonNode>> it = node.get("metadata").fields(); while (it.hasNext()) { Map.Entry<String, JsonNode> entry = it.next(); builder.metadata(entry.getKey(), entry.getValue().asText()); } } if (node.hasNonNull("source")) { builder.source(node.get("source").asText()); } return builder.build(); }
Source:
private Map<Long, Pair<String, Long>> recoverPendingLargeMessages() throws Exception { Map<Long, Pair<String, Long>> largeMessages = new HashMap<>(); List<String> filenames = largeMessagesFactory.listFiles("msg"); List<Long> idList = new ArrayList<>(); for (String filename : filenames) { Long id = getLargeMessageIdFromFilename(filename); if (!largeMessagesToDelete.containsKey(id)) { idList.add(id); SequentialFile seqFile = largeMessagesFactory.createSequentialFile(filename); long size = seqFile.size(); largeMessages.put(id, new Pair<>(filename, size)); } } return largeMessages; }

Target:
private Map<Long, Pair<String, Long>> recoverPendingLargeMessages() throws Exception { Map<Long, Pair<String, Long>> largeMessages = new HashMap<>(); List<String> filenames = largeMessagesFactory.listFiles("msg"); for (String filename : filenames) { long id = getLargeMessageIdFromFilename(filename); if (!largeMessagesToDelete.containsKey(id)) { SequentialFile seqFile = largeMessagesFactory.createSequentialFile(filename); long size = seqFile.size(); largeMessages.put(id, new Pair<>(filename, size)); } } return largeMessages; }
Source:
public void setComponent(T component) { this.component = component; }

Target:
void setComponent(T component) { this.component = component; }
Source:
private void activeDetailModelChanging(HasEntity<D> newValue, boolean stopRefresh) { for (HasEntity<D> oldValue : activeDetailModels) { if (oldValue != null && stopRefresh) { oldValue.setEntity(null); if (oldValue instanceof SearchableListModel) { ((SearchableListModel) oldValue).stopRefresh(); } } } if (newValue != null) { newValue.setEntity(provideDetailModelEntity(getSelectedItem())); } }

Target:
private void activeDetailModelChanging(HasEntity<D> newValue, boolean stopRefresh) { if (stopRefresh) { for (HasEntity<D> oldValue : activeDetailModels) { if (oldValue != null) { oldValue.setEntity(null); if (oldValue instanceof SearchableListModel) { ((SearchableListModel) oldValue).stopRefresh(); } } } } if (newValue != null) { newValue.setEntity(provideDetailModelEntity(getSelectedItem())); } }
Source:
public void findAllPaginationTest() throws Exception { context.turnOffAuthorisationSystem(); EPerson ePerson = EPersonBuilder.createEPerson(context) .withNameInMetadata("John", "Doe") .withEmail("Johndoe@gmail.com") .build(); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(get("/api/eperson/epersons") .param("size", "1")) .andExpect(status().isOk()) .andExpect(content().contentType(contentType)) .andExpect(jsonPath("$._embedded.epersons", Matchers.contains(Matchers.anyOf( EPersonMatcher.matchEPersonOnEmail(eperson.getEmail()), EPersonMatcher.matchEPersonOnEmail(admin.getEmail()), EPersonMatcher.matchEPersonOnEmail(ePerson.getEmail()) )))) .andExpect(jsonPath("$._embedded.epersons", Matchers.hasSize(1))) .andExpect(jsonPath("$.page.size", is(1))) .andExpect(jsonPath("$.page.totalElements", is(3))) ; getClient(token).perform(get("/api/eperson/epersons") .param("size", "1") .param("page", "1")) .andExpect(status().isOk()) .andExpect(content().contentType(contentType)) .andExpect(jsonPath("$._embedded.epersons", Matchers.contains(Matchers.anyOf( EPersonMatcher.matchEPersonOnEmail(eperson.getEmail()), EPersonMatcher.matchEPersonOnEmail(admin.getEmail()), EPersonMatcher.matchEPersonOnEmail(ePerson.getEmail()) )))) .andExpect(jsonPath("$._embedded.epersons", Matchers.hasSize(1))) .andExpect(jsonPath("$.page.size", is(1))) .andExpect(jsonPath("$.page.totalElements", is(3))) ; getClient().perform(get("/api/eperson/epersons")) .andExpect(status().isForbidden()) ; }

Target:
public void findAllPaginationTest() throws Exception { context.turnOffAuthorisationSystem(); EPerson testEPerson = EPersonBuilder.createEPerson(context) .withNameInMetadata("John", "Doe") .withEmail("Johndoe@fake-email.com") .build(); String authToken = getAuthToken(admin.getEmail(), password); getClient(authToken).perform(get("/api/eperson/epersons") .param("size", "2")) .andExpect(status().isOk()) .andExpect(content().contentType(contentType)) .andExpect(jsonPath("$._embedded.epersons", Matchers.containsInAnyOrder( EPersonMatcher.matchEPersonEntry(admin), EPersonMatcher.matchEPersonEntry(testEPerson) ))) .andExpect(jsonPath("$._embedded.epersons", Matchers.not( Matchers.contains( EPersonMatcher.matchEPersonEntry(admin) ) ))) .andExpect(jsonPath("$.page.size", is(2))) .andExpect(jsonPath("$.page.totalElements", is(3))) ; getClient(authToken).perform(get("/api/eperson/epersons") .param("size", "2") .param("page", "1")) .andExpect(status().isOk()) .andExpect(content().contentType(contentType)) .andExpect(jsonPath("$._embedded.epersons", Matchers.contains( EPersonMatcher.matchEPersonEntry(eperson) ))) .andExpect(jsonPath("$._embedded.epersons", Matchers.hasSize(1))) .andExpect(jsonPath("$.page.size", is(2))) .andExpect(jsonPath("$.page.totalElements", is(3))) ; getClient().perform(get("/api/eperson/epersons")) .andExpect(status().isUnauthorized()) ; }
Source:
public void testAccessControl_studentNotExistInCourse_shouldFail() { InstructorAttributes instructor1OfCourse1 = typicalBundle.instructors.get("instructor1OfCourse1"); StudentAttributes student1InCourse2 = typicalBundle.students.get("student1InCourse2"); CourseAttributes typicalCourse1 = typicalBundle.courses.get("typicalCourse1"); loginAsInstructor(instructor1OfCourse1.googleId); String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, typicalCourse1.getId(), Const.ParamsNames.STUDENT_EMAIL, student1InCourse2.getEmail(), }; verifyCannotAccess(submissionParams); }

Target:
public void testAccessControl_studentNotExistInCourse_shouldFail() { StudentAttributes student1InCourse2 = typicalBundle.students.get("student1InCourse2"); CourseAttributes typicalCourse1 = typicalBundle.courses.get("typicalCourse1"); String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, typicalCourse1.getId(), Const.ParamsNames.STUDENT_EMAIL, student1InCourse2.getEmail(), }; verifyInaccessibleForInstructors(submissionParams); verifyInaccessibleForStudents(submissionParams); }
Source:
public @Nullable String resolveDeviceType(int quark, long timestamp) { return TmfStrings.cpu(); }

Target:
public @Nullable String resolveDeviceType(int quark, long timestamp) { ITmfTrace trace = getTrace(); if (trace != null) { for (ITmfEventAspect<?> aspect : trace.getEventAspects()) { if (aspect instanceof TmfCpuAspect) { return ((TmfCpuAspect) aspect).getDeviceType(); } } } return "unknown"; }
Source:
public void run() { logger.info("System Resource: {}", SystemResourceMonitor.create(SystemResourceMonitor.allResources).getFormattedSystemResourceUsage()); }

Target:
public void run() { logger.info("System Resource: {}", allResourceMonitor.getFormattedSystemResourceUsage()); }
Source:
public RangeResourceEntry remove(ResourceEntry<Long> resourceEntry) { RangeResourceEntry rangeResourceEntry = (RangeResourceEntry) resourceEntry; if (this.begin > rangeResourceEntry.getBegin()) { this.begin = rangeResourceEntry.getBegin(); } if (this.end < rangeResourceEntry.getEnd()) { this.end = rangeResourceEntry.getEnd(); } return this; }

Target:
public RangeResourceEntry remove(ResourceEntry<Long> resourceEntry) { RangeResourceEntry rangeResourceEntry = (RangeResourceEntry) resourceEntry; if (this.begin < rangeResourceEntry.getBegin()) { this.begin = rangeResourceEntry.getBegin(); } if (this.end > rangeResourceEntry.getEnd()) { this.end = rangeResourceEntry.getEnd(); } return this; }
Source:
public void secondary_no_location() throws Exception { thrown.expectMessage("Precise secondary location should contain at least one '^'"); check( "foo(); "x = bar();\n" + " TestIssue.create("msg1", 1).secondary("Secondary message", 3, 5, 8)); }

Target:
public void secondary_no_location() throws Exception { thrown.expectMessage("Precise location should contain at least one '^' for comment at line 3"); check( "foo(); "x = bar();\n" + " TestIssue.create("msg1", 1).secondary("Secondary message", 3, 5, 8)); }
Source:
public ASN1DataFormat() { super(); this.usingIterator = false; }

Target:
public ASN1DataFormat() { this.usingIterator = false; }
Source:
public Long getUuid() { return new Long(artId); }

Target:
public Long getUuid() { return Long.valueOf(artId); }
Source:
public void testCreateProcessWithLogonW() { String winDir = Kernel32Util.getEnvironmentVariable("WINDIR"); if (winDir == null || !(new File(winDir).exists())) { throw new IllegalStateException("WINDIR environment variable did not properly resolve to a directory."); } STARTUPINFO si = new STARTUPINFO(); si.lpDesktop = null; PROCESS_INFORMATION results = new PROCESS_INFORMATION(); boolean result = Advapi32.INSTANCE.CreateProcessWithLogonW("A" + System.currentTimeMillis(), "localhost", "12345", Advapi32.LOGON_WITH_PROFILE, new File(winDir, "notepad.exe").getAbsolutePath(), "", 0, null, "", si, results); assertFalse(result); assertEquals(Native.getLastError(), W32Errors.ERROR_LOGON_FAILURE); }

Target:
public void testCreateProcessWithLogonW() { String winDir = Kernel32Util.getEnvironmentVariable("WINDIR"); assertNotNull("No WINDIR value returned", winDir); assertTrue("Specified WINDIR does not exist: " + winDir, new File(winDir).exists()); STARTUPINFO si = new STARTUPINFO(); si.lpDesktop = null; PROCESS_INFORMATION results = new PROCESS_INFORMATION(); boolean result = Advapi32.INSTANCE.CreateProcessWithLogonW("A" + System.currentTimeMillis(), "localhost", "12345", Advapi32.LOGON_WITH_PROFILE, new File(winDir, "notepad.exe").getAbsolutePath(), "", 0, null, "", si, results); assertFalse("CreateProcessWithLogonW should have returned false because the username was bogus.", result); assertEquals("GetLastError() should have returned ERROR_LOGON_FAILURE because the username was bogus.", W32Errors.ERROR_LOGON_FAILURE, Native.getLastError()); }
Source:
public void compileSuccessForBundleSparseArray() { CompileResult result = compileFiles(BundleSparseArrayCompileSuccessActivity.class); assertCompilationSuccessful(result); }

Target:
public void compileSuccessForBundleSparseArray() { String[] methodSignature = { " @Override", " public void onSaveInstanceState(Bundle bundle_) {", " super.onSaveInstanceState(bundle_);", " bundle_.putSparseParcelableArray(\"sparseArrayWithParcelable\", sparseArrayWithParcelable);", " bundle_.putSparseParcelableArray(\"sparseArrayWithExtendParcelable\", sparseArrayWithExtendParcelable);", " }", "", " private void restoreSavedInstanceState_(Bundle savedInstanceState) {", " if (savedInstanceState == null) {", " return;", " }", " sparseArrayWithParcelable = savedInstanceState.getSparseParcelableArray(\"sparseArrayWithParcelable\");", " sparseArrayWithExtendParcelable = savedInstanceState.getSparseParcelableArray(\"sparseArrayWithExtendParcelable\");", " }"}; CompileResult result = compileFiles(BundleSparseArrayCompileSuccessActivity.class); assertCompilationSuccessful(result); assertGeneratedClassContains(toGeneratedFile(BundleSparseArrayCompileSuccessActivity.class), methodSignature); }
Source:
public ExecutionError filter(ExecutionErrorContext errorContext) { Builder errorBuilder = ExecutionError.builder().type("DB").initActivityId(getInitActivityId(errorContext)); String stacktrace = getStackTrace(errorContext.getCause()); Task task = errorContext.getLastExecutedTask(); NodeInstance nodeInstance = errorContext.getLastExecutedNode(); logger.debug("Last executed node instance {}, last executed task {}", nodeInstance, task); if (nodeInstance != null) { logger.debug("Last executed node instance will be used to populate error details", nodeInstance); errorBuilder .deploymentId(((ProcessInstanceImpl)nodeInstance.getProcessInstance()).getDeploymentId()) .processInstanceId(nodeInstance.getProcessInstance().getId()) .processId(nodeInstance.getProcessInstance().getProcessId()) .activityId(nodeInstance.getId()) .activityName(nodeName(nodeInstance)); } else if (task != null) { logger.debug("Last executed task will be used to populate error details", task); errorBuilder .deploymentId(task.getTaskData().getDeploymentId()) .processInstanceId(task.getTaskData().getProcessInstanceId()) .processId(task.getTaskData().getProcessId()) .activityId(task.getId()) .activityName(task.getName()); } return errorBuilder .message(errorContext.getCause().getMessage()) .error(stacktrace) .errorDate(new Date()) .build(); }

Target:
public ExecutionError filter(ExecutionErrorContext errorContext) { Builder errorBuilder = ExecutionError.builder().type(TYPE).initActivityId(getInitActivityId(errorContext)); String stacktrace = getStackTrace(errorContext.getCause()); Task task = errorContext.getLastExecutedTask(); NodeInstance nodeInstance = errorContext.getLastExecutedNode(); logger.debug("Last executed node instance {}, last executed task {}", nodeInstance, task); if (nodeInstance != null) { logger.debug("Last executed node instance will be used to populate error details", nodeInstance); errorBuilder .deploymentId(((ProcessInstanceImpl)nodeInstance.getProcessInstance()).getDeploymentId()) .processInstanceId(nodeInstance.getProcessInstance().getId()) .processId(nodeInstance.getProcessInstance().getProcessId()) .activityId(nodeInstance.getId()) .activityName(nodeName(nodeInstance)); } else if (task != null) { logger.debug("Last executed task will be used to populate error details", task); errorBuilder .deploymentId(task.getTaskData().getDeploymentId()) .processInstanceId(task.getTaskData().getProcessInstanceId()) .processId(task.getTaskData().getProcessId()) .activityId(task.getId()) .activityName(task.getName()); } return errorBuilder .message(errorContext.getCause().getMessage()) .error(stacktrace) .errorDate(new Date()) .build(); }
Source:
public Urllib login() throws LoginException, BankException, IOException { LoginPackage lp = preLogin(); HttpResponse response = urlopen.openAsHttpResponse(lp.getLoginTarget(), new StringEntity(objectAsJson(new LoginRequest(getUsername(), getPassword())), HTTP.UTF_8), true); loginResponse = MAPPER.reader() .withType(LoginResponse.class) .readValue(response.getEntity().getContent()); if(loginResponse.getLogonData().getStatus() != 0) { throw new BankException(loginResponse.getLogonData().getMessage()); } urlopen.addHeader("cupcake", loginResponse.getLogonData().getCupcake()); return urlopen; }

Target:
public Urllib login() throws LoginException, BankException, IOException { LoginPackage lp = preLogin(); loginResponse = parseLoginResponse(urlopen.openAsHttpResponse( lp.getLoginTarget(), new StringEntity( objectAsJson(new LoginRequest( getUsername(), getPassword())), HTTP.UTF_8), true)); urlopen.addHeader("cupcake", loginResponse.getLogonData().getCupcake()); return urlopen; }
Source:
public boolean walRollFinished() { return wals.values().stream().noneMatch(RollController::isRollRequested) && isWaiting(); }

Target:
public boolean walRollFinished() { return wals.values().stream().noneMatch(rc -> rc.needsRoll(System.currentTimeMillis())) && isWaiting(); }
Source:
private Function<IConstraintEvaluationContext, Float> createCostFunction(IQueryRuntimeContext runtimeContext, PQuery query){ Object object = hintProvider.getHints(query).get(LocalSearchHintKeys.PLANNER_COST_FUNCTION); if (object instanceof ICostFunction){ ICostFunction costFunction = (ICostFunction)object; return costFunction; } return new IndexerBasedConstraintCostFunction(); }

Target:
private Function<IConstraintEvaluationContext, Float> createCostFunction(IQueryRuntimeContext runtimeContext, PQuery query){ Object object = hintProvider.getHints(query).get(LocalSearchHintKeys.PLANNER_COST_FUNCTION); if (object != null){ Preconditions.checkArgument(object instanceof ICostFunction); ICostFunction costFunction = (ICostFunction)object; return costFunction; } return new IndexerBasedConstraintCostFunction(); }
Source:
void processMsg(TxMessage txMessage) { OpaqueEntry opaqueEntry = OpaqueEntry.deserialize(Unpooled.wrappedBuffer(txMessage.getData())); Map<UUID, List<SMREntry>> map = opaqueEntry.getEntries(); if (!streamUUIDs.contains(map.keySet())) { log.error("txMessage contains noisy streams {}, expecting {}", map.keySet(), streamUUIDs); } try { rt.getObjectsView().TXBegin(); TokenResponse tokenResponse = rt.getSequencerView().next((UUID[])(map.keySet().toArray())); MultiObjectSMREntry multiObjectSMREntry = new MultiObjectSMREntry(); for (UUID uuid : opaqueEntry.getEntries().keySet()) { for(SMREntry smrEntry : opaqueEntry.getEntries().get(uuid)) { multiObjectSMREntry.addTo(uuid, smrEntry); } } rt.getAddressSpaceView().write(tokenResponse.getToken(), multiObjectSMREntry); } finally { rt.getObjectsView().TXEnd(); } }

Target:
void processMsg(TxMessage txMessage) throws Exception { OpaqueEntry opaqueEntry = OpaqueEntry.deserialize(Unpooled.wrappedBuffer(txMessage.getData())); Map<UUID, List<SMREntry>> map = opaqueEntry.getEntries(); if (!streamUUIDs.containsAll(map.keySet())) { log.error("txMessage contains noisy streams {}, expecting {}", map.keySet(), streamUUIDs); throw new Exception("Wrong streams set"); } try { rt.getObjectsView().TXBegin(); TokenResponse tokenResponse = rt.getSequencerView().next((UUID[])(map.keySet().toArray())); MultiObjectSMREntry multiObjectSMREntry = new MultiObjectSMREntry(); for (UUID uuid : opaqueEntry.getEntries().keySet()) { for(SMREntry smrEntry : opaqueEntry.getEntries().get(uuid)) { multiObjectSMREntry.addTo(uuid, smrEntry); } } rt.getAddressSpaceView().write(tokenResponse.getToken(), multiObjectSMREntry); } catch (Exception e) { log.error("Catch an exception while processing message {}", txMessage.getMetadata(), e); throw e; } finally { rt.getObjectsView().TXEnd(); } }