auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void stopReadingEarlyWhenEncounteringEntryKnownToBeCommittedAfterSweepTs() { immutableTs = 100L; enqueueWriteCommitted(TABLE_CONS, 10); enqueueWriteCommitedAt(TABLE_CONS, 30, 150); putTimestampIntoTransactionTable(50, 200); Map<Integer, Integer> largeWriteDistribution = enqueueAtLeastThresholdWritesInDefaultShardWithStartTs(100, 50); int writesInDedicated = largeWriteDistribution.get(CONS_SHARD); enqueueWriteUncommitted(TABLE_CONS, 70); enqueueWriteCommitted(TABLE_CONS, 90); sweepQueue.sweepNextBatch(ShardAndStrategy.conservative(CONS_SHARD)); assertThat(metricsManager).hasEntriesReadConservativeEqualTo(4 + writesInDedicated); sweepQueue.sweepNextBatch(ShardAndStrategy.conservative(CONS_SHARD)); assertThat(metricsManager).hasEntriesReadConservativeEqualTo(4 + writesInDedicated + 1); immutableTs = 170; sweepQueue.sweepNextBatch(ShardAndStrategy.conservative(CONS_SHARD)); assertThat(metricsManager).hasEntriesReadConservativeEqualTo(4 + writesInDedicated + 3); immutableTs = 250; sweepQueue.sweepNextBatch(ShardAndStrategy.conservative(CONS_SHARD)); <START> assertThat(metricsManager).hasEntriesReadConservativeEqualTo(4 + 3 + writesInDedicated + 2); <END> }</code><technical_language>Discussed offline -- a bug in test deleting deidcated rows early</technical_language>

Target:
public void stopReadingEarlyWhenEncounteringEntryKnownToBeCommittedAfterSweepTs() { immutableTs = 100L; enqueueWriteCommitted(TABLE_CONS, 10); enqueueWriteCommitedAt(TABLE_CONS, 30, 150); putTimestampIntoTransactionTable(50, 200); Map<Integer, Integer> largeWriteDistribution = enqueueAtLeastThresholdWritesInDefaultShardWithStartTs(100, 50); int writesInDedicated = largeWriteDistribution.get(CONS_SHARD); enqueueWriteUncommitted(TABLE_CONS, 70); enqueueWriteCommitted(TABLE_CONS, 90); sweepQueue.sweepNextBatch(ShardAndStrategy.conservative(CONS_SHARD)); assertThat(metricsManager).hasEntriesReadConservativeEqualTo(4 + writesInDedicated); sweepQueue.sweepNextBatch(ShardAndStrategy.conservative(CONS_SHARD)); assertThat(metricsManager).hasEntriesReadConservativeEqualTo(4 + writesInDedicated + 1); immutableTs = 170; sweepQueue.sweepNextBatch(ShardAndStrategy.conservative(CONS_SHARD)); assertThat(metricsManager).hasEntriesReadConservativeEqualTo(4 + writesInDedicated + 3); immutableTs = 250; sweepQueue.sweepNextBatch(ShardAndStrategy.conservative(CONS_SHARD)); assertThat(metricsManager).hasEntriesReadConservativeEqualTo(4 + writesInDedicated + 3 + writesInDedicated + 2); }
Source:
<code>private void assertCallbackSuccess(@NonNull Call<DescriptionEdit> call, @NonNull Callback cb) { verify(cb).success(eq(call)); verify(cb, <START> never()).failure(eq(call), <END> any(Throwable.class)); }</code><technical_language>This any() want this invoked argument</technical_language>

Target:
private void assertCallbackSuccess(@NonNull Call<DescriptionEdit> call, @NonNull Callback cb) { verify(cb).success(eq(call)); verify(cb, never()).failure(any(Call.class), any(Throwable.class)); }
Source:
<code>public Void visit(GenContext state, Sequence ast) { <START> return null; <END> }</code><technical_language>Need Sequence</technical_language>

Target:
public Void visit(GenContext state, Sequence ast) { for (TypedAST exp : ast.getExps()) { exp.acceptVisitor(this, state); } return null; }
Source:
<code>public void stopService(long timeout) { long startTime = System.currentTimeMillis(); waitForNonPendingState(); if (queryStatus().dwCurrentState == Winsvc.SERVICE_STOPPED) { return; } SERVICE_STATUS status = new SERVICE_STATUS(); if (! Advapi32.INSTANCE.ControlService(_handle, SERVICE_CONTROL_STOP, status)) { throw new Win32Exception(Kernel32.INSTANCE.GetLastError()); } while(status.dwCurrentState != Winsvc.SERVICE_STOPPED) { long msRemainingBeforeTimeout = timeout - (System.currentTimeMillis() - startTime); if (msRemainingBeforeTimeout < 0) { throw new RuntimeException(String.format("Service stop exceeded timeout time of %d ms", timeout)); } <START> int dwWaitTime = Math.min(sanitizeWaitTime(status.dwWaitHint), (int)msRemainingBeforeTimeout); <END> try { Thread.sleep( dwWaitTime ); } catch (InterruptedException e){ throw new RuntimeException(e); } if(! Advapi32.INSTANCE.QueryServiceStatus(_handle, status)) { throw new Win32Exception(Kernel32.INSTANCE.GetLastError()); } } }</code><technical_language>This needs declared a long. user pass in a timeout > Integer.MAX_VALUE, msRemainingBeforeTimeout > Integer.MAX_VALUE. cast, wrap get negative wait time</technical_language>

Target:
public void stopService(long timeout) { long startTime = System.currentTimeMillis(); waitForNonPendingState(); if (queryStatus().dwCurrentState == Winsvc.SERVICE_STOPPED) { return; } SERVICE_STATUS status = new SERVICE_STATUS(); if (! Advapi32.INSTANCE.ControlService(_handle, SERVICE_CONTROL_STOP, status)) { throw new Win32Exception(Kernel32.INSTANCE.GetLastError()); } while(status.dwCurrentState != Winsvc.SERVICE_STOPPED) { long msRemainingBeforeTimeout = timeout - (System.currentTimeMillis() - startTime); if (msRemainingBeforeTimeout < 0) { throw new RuntimeException(String.format("Service stop exceeded timeout time of %d ms", timeout)); } long dwWaitTime = Math.min(sanitizeWaitTime(status.dwWaitHint), msRemainingBeforeTimeout); try { Thread.sleep( dwWaitTime ); } catch (InterruptedException e){ throw new RuntimeException(e); } if(! Advapi32.INSTANCE.QueryServiceStatus(_handle, status)) { throw new Win32Exception(Kernel32.INSTANCE.GetLastError()); } } }
Source:
<code>public RepoCommit update( @NotNull(message = "path cannot be NULL") final String path, @NotNull(message = "json should not be NULL") final JsonObject json ) throws IOException { this.storage.lock(); try { final String xpath = String.format( <START> "/github/repos/repo[@coords='%s']/contents/content[path='%s']", <END> this.coords, path ); new JsonPatch(this.storage).patch(xpath, json); return this.commit(json); } finally { this.storage.unlock(); } }</code><technical_language>remove ref here? I understand refactoring, a valid param json object now. Previously, if ref specified, it, master value. do checking if JsonObject.containsKey("ref")</technical_language>

Target:
public RepoCommit update( @NotNull(message = "path cannot be NULL") final String path, @NotNull(message = "json should not be NULL") final JsonObject json ) throws IOException { this.storage.lock(); try { final String ref = "ref"; final String branch; if (json.containsKey(ref)) { branch = json.getString(ref); } else { branch = "master"; } final String xpath = String.format( "/github/repos/repo[@coords='%s']/contents/content[path='%s' and @ref='%s']", this.coords, path, branch ); new JsonPatch(this.storage).patch(xpath, json); return this.commit(json); } finally { this.storage.unlock(); } }
Source:
<code>public void onFinish(ISuite suite) { <START> ThreadLeakChecker.checkForLeaks(null); <END> }</code><technical_language>I this is testing code, creating another test called checkForLeaksOnFinish() that, instead of passing null some logic checkForLeaks</technical_language>

Target:
public void onFinish(ISuite suite) { ThreadLeakChecker.checkForLeaks(); }
Source:
<code>public void retireConcept_shouldRetireTheGivenConcept() throws Exception { <START> int drugId = 3; <END> String retireReason = "dummy reason"; Concept concept = conceptService.getConcept(drugId); assertFalse(concept.isRetired()); conceptService.retireConcept(concept, retireReason); assertTrue(concept.isRetired()); assertEquals(retireReason, concept.getRetireReason()); }</code><technical_language>dont need this local variable, more once. retireReason</technical_language>

Target:
public void retireConcept_shouldRetireTheGivenConcept() throws Exception { String retireReason = "dummy reason"; Concept concept = conceptService.getConcept(3); assertFalse(concept.isRetired()); conceptService.retireConcept(concept, retireReason); assertTrue(concept.isRetired()); assertEquals(retireReason, concept.getRetireReason()); }
Source:
<code>private boolean isArtifact(ITask reviewTask) { boolean hasAssosciatedTask = ReviewsUiPlugin.getDefault() .getTaskReviewsMappingStore() .getTaskUrl(reviewTask) != null; boolean hasContext = contextStore.hasContext(reviewTask); boolean hasScheduledDate = false; if (reviewTask instanceof AbstractTask) { AbstractTask abstractTask = (AbstractTask) reviewTask; hasScheduledDate = abstractTask.getScheduledForDate() != null; } boolean hasDueDate = reviewTask.getDueDate() != null; <START> return hasAssosciatedTask && !(hasContext || hasScheduledDate || hasDueDate); <END> }</code><technical_language>Turn boolean variables methods short circuiting prevent called unnecessarily. hasContext in expensive minimize computation in general this called a lot</technical_language>

Target:
private boolean isArtifact(ITask reviewTask) { return !(hasScheduledDate(reviewTask) || hasDueDate(reviewTask) || hasContext(reviewTask)) && hasAssosciatedTask(reviewTask); }
Source:
<code>private Call.Listener<ResponseT> wrap(Call.Listener<ResponseT> responseListener) { return new ClientInterceptors.ForwardingListener<ResponseT>(responseListener) { @Override public void onClose(Status status, Metadata.Trailers trailers) { super.onClose(status, trailers); <START> outstandingRequests.remove(id); <END> if (outstandingRequests.isEmpty()) { synchronized (outstandingRequests) { outstandingRequests.notify(); } } } }; }</code><technical_language>This threadsafe. mind: synchronizedSet()</technical_language>

Target:
private Call.Listener<ResponseT> wrap(Call.Listener<ResponseT> responseListener) { return new ClientInterceptors.ForwardingListener<ResponseT>(responseListener) { @Override public void onClose(Status status, Metadata.Trailers trailers) { super.onClose(status, trailers); untrack(); } }; }
Source:
<code><START> public Serializable parseDate(Serializable value) { <END> if (value instanceof Date) { return ((Date) value).toInstant(); } if (value instanceof Long) { return Instant.ofEpochMilli((Long) value); } if (!(value instanceof String)) { return null; } String string = String.valueOf(value); if (StringUtils.isBlank(string)) { return null; } if (StringUtils.isNumeric(string)) { try { return Instant.ofEpochMilli(Long.parseLong(string)); } catch (NumberFormatException ex) { throw new IllegalArgumentException(ex); } } if (iso8601Z.matcher(string).matches()) { return Instant.parse(string); } if (iso8601Offset.matcher(string).matches()) { return OffsetDateTime.parse(string).toInstant(); } SimpleDateFormat dateFormat; if (boonDefault.matcher(string).matches()) { dateFormat = new SimpleDateFormat("EEE MMM d HH:mm:ss zzz yyyy"); } else { dateFormat = new SimpleDateFormat(); } dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); try { return dateFormat.parse(value.toString()).toInstant(); } catch (ParseException e) { throw new IllegalArgumentException(e); } }</code><technical_language>If consistently returning Instant, this method return instead of Serializable</technical_language>

Target:
public Instant parseDate(Serializable value) { if (value instanceof Date) { return ((Date) value).toInstant(); } if (value instanceof Long) { return Instant.ofEpochMilli((Long) value); } if (!(value instanceof String)) { return null; } String string = String.valueOf(value); if (StringUtils.isBlank(string)) { return null; } if (StringUtils.isNumeric(string)) { try { return Instant.ofEpochMilli(Long.parseLong(string)); } catch (NumberFormatException ex) { LOGGER.debug("Failed to create Epoch time from a numeric: {}", string, ex); return null; } } if (iso8601Z.matcher(string).matches()) { return Instant.parse(string); } if (iso8601Offset.matcher(string).matches()) { return OffsetDateTime.parse(string).toInstant(); } SimpleDateFormat dateFormat; if (boonDefault.matcher(string).matches()) { dateFormat = new SimpleDateFormat("EEE MMM d HH:mm:ss zzz yyyy"); } else { dateFormat = new SimpleDateFormat(); } dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); try { return dateFormat.parse(string).toInstant(); } catch (ParseException e) { LOGGER.debug("Failed to parse as a dateFormat time from a date string: {}", string, e); return null; } }
Source:
<code>public PredicateFilterSqlBenchmark(LocalQueryRunner localQueryRunner) { <START> super(localQueryRunner, "sql_predicate_filter", 5, 50, "SELECT totalprice FROM orders WHERE totalprice > 50000"); <END> }</code><technical_language>Alter cases..</technical_language>

Target:
public PredicateFilterSqlBenchmark(LocalQueryRunner localQueryRunner) { super(localQueryRunner, "sql_predicate_filter", 5, 50, "select totalprice from orders where totalprice > 50000"); }
Source:
<code>public void onStart( final FileAlterationObserver observer ) { if (!this.hasBeenProvisioned.getAndSet( true )) { this.logger.fine( "Initial provisioning of templates..." ); final Collection<File> templateFiles = FileUtils.listFiles( this.templateDir, FileFilterUtils.and( FileFilterUtils.suffixFileFilter( MonitoringService.MONITORING_TEMPLATE_FILE_EXTENSION ), CanReadFileFilter.CAN_READ ), new AbstractFileFilter() { <START> @Override <END> public boolean accept( final File file ) { return templateDir.equals( file ) || templateDir.equals( file.getParentFile() ); } } ); final Collection<TemplateEntry> templateEntries = new ArrayList<TemplateEntry>(); for (final File templateFile : templateFiles) { final TemplateEntry templateEntry = compileTemplate( templateFile ); if (templateEntry != null) { templateEntries.add( templateEntry ); this.logger.finest( "++ Added " + templateEntry ); } } this.lock.writeLock().lock(); try { for (final TemplateEntry templateEntry : templateEntries) { updateTemplateEntry( templateEntry ); } } finally { this.lock.writeLock().unlock(); } this.manager.processTemplates( templateEntries ); } }</code><technical_language>again, prefer a static class anonymous one</technical_language>

Target:
public void onStart( final FileAlterationObserver observer ) { if (!this.hasBeenProvisioned.getAndSet(true)) { this.logger.fine("Initial provisioning of templates..."); final Collection<File> templateFiles = FileUtils.listFiles( this.templateDir, FileFilterUtils.and( FileFilterUtils.suffixFileFilter(MonitoringService.TEMPLATE_FILE_EXTENSION), CanReadFileFilter.CAN_READ), new TemplateDirectoryFileFilter(this.templateDir)); final Collection<TemplateEntry> templateEntries = new ArrayList<TemplateEntry>(); for (final File templateFile : templateFiles) { final TemplateEntry templateEntry = compileTemplate(templateFile); if (templateEntry != null) { templateEntries.add(templateEntry); this.logger.finest("++ Added " + templateEntry); } } this.lock.writeLock().lock(); try { for (final TemplateEntry templateEntry : templateEntries) { updateTemplateEntry(templateEntry); } } finally { this.lock.writeLock().unlock(); } this.manager.processTemplates(templateEntries); } }
Source:
<code>Set<String> getEmptyRoles(String userId) { Set<String> roles = new HashSet<String>(); roles.add(ANON_ROLE); if ((userId != null) && (!userDirectoryService().getAnonymousUser().getId().equals(userId))) { roles.add(AUTH_ROLE); if (m_roleProvider != null) { roles.addAll((m_roleProvider.getAdditionalRoles(userId))); } if (userId.startsWith(DUMMY_USER_PREFIX)) { <START> String roleId = userId.substring(DUMMY_USER_PREFIX.length()); <END> roles.add(roleId); } } return roles; }</code><technical_language>If authz check a userId of "dummy" I this throw a ArrayOutOfBoundsException substring</technical_language>

Target:
Set<String> getEmptyRoles(String userId) { Set<String> roles = new HashSet<String>(); roles.add(ANON_ROLE); if ((userId != null) && (!userDirectoryService().getAnonymousUser().getId().equals(userId))) { String roleId = decodeRoleFromDummyUser(userId); if (roleId != null){ roles.remove(ANON_ROLE); roles.add(roleId); } else { roles.add(AUTH_ROLE); if (m_roleProvider != null) { roles.addAll((m_roleProvider.getAdditionalRoles(userId))); } } } return roles; }
Source:
<code>private static Result firstInWinsMerge(Result current, Result incoming) { LOGGER.trace( "While collecting metacards into map, there were metacards found with a duplicate key.\nOld: {}\nNew: {}", LogSanitizer.cleanAndEncode(current.toString()), <START> LogSanitizer.cleanAndEncode(incoming.toString())); <END> return current; }</code><technical_language>question here. expensive is toString() calculation</technical_language>

Target:
private static Result firstInWinsMerge(Result current, Result incoming) { LOGGER.trace( "While collecting metacards into map, there were metacards found with a duplicate key.\nOld: {}\nNew: {}", LogSanitizer.sanitize(current), LogSanitizer.sanitize(incoming)); return current; }
Source:
<code><START> public static AuthenticationPlugin<?> load(ServerAuthenticationConfig config) { <END> return load(config, ImmutableList.<Path>of()); }</code><technical_language>this for loading plugins for client - ServerAuthenticationConfig name is unfortunate</technical_language>

Target:
public static AuthenticationPlugin<?> load(ServerAuthenticationConfig config) { final String scheme = config.getEnabledScheme(); final Path pluginPath = config.getPluginPath(); final ClassLoader classLoader; if (config.getPluginPath() == null) { classLoader = Thread.currentThread().getContextClassLoader(); } else { Preconditions.checkArgument(pluginPath.toFile().canRead(), "Plugin path " + pluginPath + " does not exist or is not readable"); classLoader = pluginClassLoader(pluginPath); } final ServiceLoader<AuthenticationPlugin> loader = ServiceLoader.load(AuthenticationPlugin.class, classLoader); for (AuthenticationPlugin plugin : loader) { if (scheme.equals(plugin.schemeName())) { return plugin; } } throw new IllegalStateException("No AuthenticationPlugin found for scheme " + scheme + ". Check classpath and plugin path settings"); }
Source:
<code>public IStyledLabelProvider[] getLabelProviders() { <START> if (fLabelProviders == null) { <END> fLabelProviders = CHEProviderSettings.getCCallHierarchyLabelProviders(); } return fLabelProviders; }</code><technical_language>this a get method returns result, a "load" method. do is unexpected (same for method)</technical_language>

Target:
public IStyledLabelProvider[] getLabelProviders() { return fLabelProviders; }
Source:
<code>private static Multimap<Integer, ITmfStateInterval> createThreadMultimap() { final Multimap<Integer, ITmfStateInterval> map = TreeMultimap.create( (arg0, arg1) -> arg0.compareTo(arg1), <START> (arg0, arg1) -> { <END> if (arg1.getStateValue() == VCPU_PREEMPT_VALUE && arg0.getStateValue() != VCPU_PREEMPT_VALUE) { if (((Long) arg0.getEndTime()).compareTo(arg1.getStartTime()) < 0) { return -1; } return ((Long) arg0.getStartTime()).compareTo(arg1.getEndTime()); } return (((Long) arg0.getStartTime()).compareTo(arg1.getStartTime())); }); return map; }</code><technical_language>oh, functional interface goodies while it</technical_language>

Target:
private static Multimap<Integer, ITmfStateInterval> createThreadMultimap() { final Multimap<Integer, ITmfStateInterval> map = TreeMultimap.create( Comparator.naturalOrder(), (arg0, arg1) -> { if (arg1.getStateValue() == VCPU_PREEMPT_VALUE && arg0.getStateValue() != VCPU_PREEMPT_VALUE) { if (((Long) arg0.getEndTime()).compareTo(arg1.getStartTime()) < 0) { return -1; } return ((Long) arg0.getStartTime()).compareTo(arg1.getEndTime()); } return (((Long) arg0.getStartTime()).compareTo(arg1.getStartTime())); }); return map; }
Source:
<code>public void writeDatastaxReadAstyanax() throws Exception { datastaxExcessEnumIO.insertExcessEnumMetric(testLocators.get(0)); datastaxExcessEnumIO.insertExcessEnumMetric(testLocators.get(1)); datastaxExcessEnumIO.insertExcessEnumMetric(testLocators.get(2)); datastaxExcessEnumIO.insertExcessEnumMetric(testLocators.get(3)); Set<Locator> excessEnums = astyanaxExcessEnumIO.getExcessEnumMetrics(); <START> assertEquals("Unexpected number of excessEnums", 4, excessEnums.size()); <END> String excessEnumLocators = ""; for ( Iterator<Locator> it = excessEnums.iterator(); it.hasNext(); ) { excessEnumLocators += it.next().toString() + ","; } assertTrue("excess enum does not contain " + testLocators.get(0), excessEnumLocators.contains(testLocators.get(0).toString())); assertTrue("excess enum does not contain " + testLocators.get(1), excessEnumLocators.contains(testLocators.get(1).toString())); assertTrue("excess enum does not contain " + testLocators.get(2), excessEnumLocators.contains(testLocators.get(2).toString())); assertTrue("excess enum does not contain " + testLocators.get(3), excessEnumLocators.contains(testLocators.get(3).toString())); }</code><technical_language>compare this testLocators.size() instead of hard coded 4</technical_language>

Target:
public void writeDatastaxReadAstyanax() throws Exception { for (Locator testLocator : testLocators) { datastaxExcessEnumIO.insertExcessEnumMetric(testLocator); } Thread.sleep(1000); Set<Locator> excessEnums = astyanaxExcessEnumIO.getExcessEnumMetrics(); assertEquals("Unexpected number of excessEnums", testLocators.size(), excessEnums.size()); for (Locator expectedLocator : testLocators) { assertTrue("excess enum does not contain " + expectedLocator, excessEnums.contains(expectedLocator)); } }
Source:
<code>public boolean canPrincipalManage(IAuthorizationPrincipal principal, String portletDefinitionId) throws AuthorizationException { final String owner = IPermission.PORTAL_PUBLISH; final String target = IPermission.PORTLET_PREFIX + portletDefinitionId; IPortletDefinition portlet = this.portletDefinitionRegistry.getPortletDefinition(portletDefinitionId); if (portlet == null) { return doesPrincipalHavePermission( principal, owner, IPermission.PORTLET_MANAGER_APPROVED_ACTIVITY, target); } final IPortletLifecycleEntry highestLifecycleEntryDefined = portlet.getLifecycle().get(portlet.getLifecycle().size() - 1); String activity = null; switch (highestLifecycleEntryDefined.getLifecycleState()) { case CREATED: activity = IPermission.PORTLET_MANAGER_CREATED_ACTIVITY; break; case APPROVED: activity = IPermission.PORTLET_MANAGER_APPROVED_ACTIVITY; break; case PUBLISHED: activity = IPermission.PORTLET_MANAGER_ACTIVITY; break; case EXPIRED: activity = IPermission.PORTLET_MANAGER_EXPIRED_ACTIVITY; break; case MAINTENANCE: activity = IPermission.PORTLET_MANAGER_MAINTENANCE_ACTIVITY; break; } <START> if (activity == null) { <END> final String msg = "Unrecognized portlet lifecycle state: " + highestLifecycleEntryDefined.getLifecycleState(); throw new IllegalStateException(msg); } return doesPrincipalHavePermission(principal, owner, activity, target); }</code><technical_language>this moved default case of switch</technical_language>

Target:
public boolean canPrincipalManage(IAuthorizationPrincipal principal, String portletDefinitionId) throws AuthorizationException { final String owner = IPermission.PORTAL_PUBLISH; final String target = IPermission.PORTLET_PREFIX + portletDefinitionId; IPortletDefinition portlet = this.portletDefinitionRegistry.getPortletDefinition(portletDefinitionId); if (portlet == null) { return doesPrincipalHavePermission( principal, owner, IPermission.PORTLET_MANAGER_APPROVED_ACTIVITY, target); } final IPortletLifecycleEntry highestLifecycleEntryDefined = portlet.getLifecycle().get(portlet.getLifecycle().size() - 1); String activity; switch (highestLifecycleEntryDefined.getLifecycleState()) { case CREATED: activity = IPermission.PORTLET_MANAGER_CREATED_ACTIVITY; break; case APPROVED: activity = IPermission.PORTLET_MANAGER_APPROVED_ACTIVITY; break; case PUBLISHED: activity = IPermission.PORTLET_MANAGER_ACTIVITY; break; case EXPIRED: activity = IPermission.PORTLET_MANAGER_EXPIRED_ACTIVITY; break; case MAINTENANCE: activity = IPermission.PORTLET_MANAGER_MAINTENANCE_ACTIVITY; break; default: final String msg = "Unrecognized portlet lifecycle state: " + highestLifecycleEntryDefined.getLifecycleState(); throw new IllegalStateException(msg); } return doesPrincipalHavePermission(principal, owner, activity, target); }
Source:
<code><START> public int getScrollBarContainerWidth() { <END> ViewGroup.LayoutParams layoutParams = mScrollBarView.getLayoutParams(); return layoutParams.width; }</code><technical_language>Annotate @Px</technical_language>

Target:
public int getScrollBarContainerWidth() { return mScrollBarView.getLayoutParams().width; }
Source:
<code>public Repository getRepository(final IResource resource) { Repository[] repositories = org.eclipse.egit.core.Activator .getDefault().getRepositoryCache().getAllRepositories(); Repository repository = null; IPath repositoryPath = null; for (Repository r : repositories) { if (!r.isBare()) { try { IPath repoPath = new Path(r.getWorkTree() .getCanonicalPath()); <START> if (repoPath.isPrefixOf(resource.getLocation())) { <END> if (repository == null || repositoryPath == null || repositoryPath.isPrefixOf(repoPath)) { repository = r; repositoryPath = repoPath; } } } catch (IOException e) { Activator .error("looking up working tree path of git repository failed", e); } } } return repository; }</code><technical_language>IResource#getLocation return null, this checked</technical_language>

Target:
public Repository getRepository(final IResource resource) { Repository[] repositories = org.eclipse.egit.core.Activator .getDefault().getRepositoryCache().getAllRepositories(); Repository repository = null; int segmentCount = 0; for (Repository r : repositories) { if (!r.isBare()) { try { IPath repoPath = new Path(r.getWorkTree() .getCanonicalPath()); IPath location = resource.getLocation(); if (location != null && repoPath.isPrefixOf(resource.getLocation())) { if (repository == null || repoPath.segmentCount() > segmentCount) { repository = r; segmentCount = repoPath.segmentCount(); } } } catch (IOException e) { Activator .error("looking up working tree path of git repository failed", e); } } } return repository; }
Source:
<code>public static Set<Class<?>> lookupBeanClasses(Class<?> lookupBeanClazz) { Set<Class<?>> classes = BEANS.getBeanManager().getBeans(lookupBeanClazz).stream() .peek(bean -> LOG.debug("{} contributed as REST {}", bean.getBeanClazz(), lookupBeanClazz.getSimpleName())) .map(IBean::getBeanClazz) .collect(Collectors.toSet()); <START> LOG.info("Contributed classes as REST {}", classes.size(), lookupBeanClazz.getSimpleName()); <END> return classes; }</code><technical_language>logging in RestApplication (where contributes objects JAX-RS)</technical_language>

Target:
public static Set<Class<?>> lookupBeanClasses(Class<?> lookupBeanClazz) { return BEANS.getBeanManager().getBeans(lookupBeanClazz).stream() .map(IBean::getBeanClazz) .collect(Collectors.toSet()); }
Source:
<code>public void testGetNodes() { final DMNGraphProcessor processor = new DMNGraphProcessor(); final Graph graph = mock(Graph.class); final Decision decision1 = mock(Decision.class); final Decision decision2 = mock(Decision.class); final Node node1 = createNode(decision1, "id1"); final Node node2 = createNode(decision2, "id2"); final List<Node> graphNodes = createGraphNodes(node1, node2); when(graph.nodes()).thenReturn(graphNodes); final Iterable<? extends Node> nodes = processor.getNodes(graph); <START> for (final Node r : nodes) { <END> assertTrue(graphNodes.contains(r)); assertFalse(processor.isReplacedByAnotherNode(r.getUUID())); } }</code><technical_language>I name node r</technical_language>

Target:
public void testGetNodes() { final DMNGraphProcessor processor = new DMNGraphProcessor(); final Graph graph = mock(Graph.class); final Decision decision1 = mock(Decision.class); final Decision decision2 = mock(Decision.class); final Node node1 = createNode(decision1, "id1"); final Node node2 = createNode(decision2, "id2"); final List<Node> graphNodes = createGraphNodes(node1, node2); when(graph.nodes()).thenReturn(graphNodes); final Iterable<? extends Node> nodes = processor.getNodes(graph); for (final Node node : nodes) { assertTrue(graphNodes.contains(node)); assertFalse(processor.isReplacedByAnotherNode(node.getUUID())); } }
Source:
<code>public DynamicTableSink createDynamicTableSink(Context context) { FactoryUtil.TableFactoryHelper helper = FactoryUtil.createTableFactoryHelper(this, context); helper.validate(); String sinkClass = helper.getOptions().get(TABLE_SINK_CLASS); boolean isInsertOnly = helper.getOptions().get(SINK_INSERT_ONLY); String runtimeSink = helper.getOptions().get(RUNTIME_SINK); int expectedNum = helper.getOptions().get(SINK_EXPECTED_MESSAGES_NUM); Integer parallelism = helper.getOptions().get(SINK_PARALLELISM); final Map<String, DataType> writableMetadata = convertToMetadataMap( helper.getOptions().get(WRITABLE_METADATA), context.getClassLoader()); <START> ChangelogMode changelogMode = Optional.ofNullable(helper.getOptions().get(SINK_CHANGELOG_MODE_ENFORCED)).map(m -> parseChangelogMode(m)).orElse(null); <END> final DataType consumedType = context.getCatalogTable().getSchema().toPhysicalRowDataType(); final int[] primaryKeyIndices = TableSchemaUtils.getPrimaryKeyIndices(context.getCatalogTable().getSchema()); if (sinkClass.equals("DEFAULT")) { return new TestValuesTableSink( consumedType, primaryKeyIndices, context.getObjectIdentifier().getObjectName(), isInsertOnly, runtimeSink, expectedNum, writableMetadata, parallelism, changelogMode); } else { try { return InstantiationUtil.instantiate( sinkClass, DynamicTableSink.class, Thread.currentThread().getContextClassLoader()); } catch (FlinkException e) { throw new TableException("Can't instantiate class " + sinkClass, e); } } }</code><technical_language>This line is long, break it</technical_language>

Target:
public DynamicTableSink createDynamicTableSink(Context context) { FactoryUtil.TableFactoryHelper helper = FactoryUtil.createTableFactoryHelper(this, context); helper.validate(); String sinkClass = helper.getOptions().get(TABLE_SINK_CLASS); boolean isInsertOnly = helper.getOptions().get(SINK_INSERT_ONLY); String runtimeSink = helper.getOptions().get(RUNTIME_SINK); int expectedNum = helper.getOptions().get(SINK_EXPECTED_MESSAGES_NUM); Integer parallelism = helper.getOptions().get(SINK_PARALLELISM); final Map<String, DataType> writableMetadata = convertToMetadataMap( helper.getOptions().get(WRITABLE_METADATA), context.getClassLoader()); final ChangelogMode changelogMode = Optional.ofNullable(helper.getOptions() .get(SINK_CHANGELOG_MODE_ENFORCED)).map(m -> parseChangelogMode(m)).orElse(null); final DataType consumedType = context.getCatalogTable().getSchema().toPhysicalRowDataType(); final int[] primaryKeyIndices = TableSchemaUtils.getPrimaryKeyIndices(context.getCatalogTable().getSchema()); if (sinkClass.equals("DEFAULT")) { return new TestValuesTableSink( consumedType, primaryKeyIndices, context.getObjectIdentifier().getObjectName(), isInsertOnly, runtimeSink, expectedNum, writableMetadata, parallelism, changelogMode); } else { try { return InstantiationUtil.instantiate( sinkClass, DynamicTableSink.class, Thread.currentThread().getContextClassLoader()); } catch (FlinkException e) { throw new TableException("Can't instantiate class " + sinkClass, e); } } }
Source:
<code>public Single<List<PodcastSearchResult>> loadToplist(String country, int limit) { return Single.create((SingleOnSubscribe<List<PodcastSearchResult>>) emitter -> { OkHttpClient client = AntennapodHttpClient.getHttpClient(); String feedString; try { feedString = getTopListFeed(client, country, limit); } catch (IOException e) { <START> feedString = getTopListFeed(client, "US", limit); <END> } List<PodcastSearchResult> podcasts = parseFeed(feedString); emitter.onSuccess(podcasts); }) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()); }</code><technical_language>do falling country selected yet? Other countries display "Sorry, do suggestions for region"</technical_language>

Target:
public Single<List<PodcastSearchResult>> loadToplist(String country, int limit) { return Single.create((SingleOnSubscribe<List<PodcastSearchResult>>) emitter -> { OkHttpClient client = AntennapodHttpClient.getHttpClient(); String feedString; String loadCountry = country; if (COUNTRY_CODE_UNSET.equals(country)) { loadCountry = Locale.getDefault().getCountry(); } try { feedString = getTopListFeed(client, loadCountry, limit); } catch (IOException e) { if (COUNTRY_CODE_UNSET.equals(country)) { feedString = getTopListFeed(client, "US", limit); } else { emitter.onError(e); return; } } List<PodcastSearchResult> podcasts = parseFeed(feedString); emitter.onSuccess(podcasts); }) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()); }
Source:
<code>public void registerAttributes(ManagementResourceRegistration registry) { for (AttributeDefinition attr : ATTRIBUTES) { if (!attr.getFlags().contains(AttributeAccess.Flag.STORAGE_RUNTIME)) { <START> registry.registerReadWriteAttribute(attr, null, new ReloadRequiredWriteAttributeHandler(ATTRIBUTES)); <END> } } ClusterConnectionControlHandler.INSTANCE.registerAttributes(registry); for (AttributeDefinition attr : READONLY_ATTRIBUTES) { registry.registerReadOnlyAttribute(attr, ClusterConnectionControlHandler.INSTANCE); } }</code><technical_language>move out of loop</technical_language>

Target:
public void registerAttributes(ManagementResourceRegistration registry) { ReloadRequiredWriteAttributeHandler reloadRequiredWriteAttributeHandler = new ReloadRequiredWriteAttributeHandler(ATTRIBUTES); for (AttributeDefinition attr : ATTRIBUTES) { if (!attr.getFlags().contains(AttributeAccess.Flag.STORAGE_RUNTIME)) { registry.registerReadWriteAttribute(attr, null, reloadRequiredWriteAttributeHandler); } } ClusterConnectionControlHandler.INSTANCE.registerAttributes(registry); for (AttributeDefinition attr : READONLY_ATTRIBUTES) { registry.registerReadOnlyAttribute(attr, ClusterConnectionControlHandler.INSTANCE); } }
Source:
<code>public TopNNode map(TopNNode node, PlanNode source, PlanNodeId newNodeId) { ImmutableList.Builder<Symbol> symbols = ImmutableList.builder(); ImmutableMap.Builder<Symbol, SortOrder> orderings = ImmutableMap.builder(); <START> Set<Symbol> seenCanonicals = new HashSet<>(node.getOrderBy().size()); <END> for (Symbol symbol : node.getOrderBy()) { Symbol canonical = map(symbol); if (seenCanonicals.contains(canonical)) { continue; } else { seenCanonicals.add(canonical); symbols.add(canonical); orderings.put(canonical, node.getOrderings().get(symbol)); } } return new TopNNode( newNodeId, source, node.getCount(), symbols.build(), orderings.build(), node.getStep()); }</code><technical_language>HashMap instead ImmutableMap.Builder for orderings Map.containsKey check if entry is present</technical_language>

Target:
public TopNNode map(TopNNode node, PlanNode source, PlanNodeId newNodeId) { ImmutableList.Builder<Symbol> symbols = ImmutableList.builder(); ImmutableMap.Builder<Symbol, SortOrder> orderings = ImmutableMap.builder(); Set<Symbol> seenCanonicals = new HashSet<>(node.getOrderBy().size()); for (Symbol symbol : node.getOrderBy()) { Symbol canonical = map(symbol); if (seenCanonicals.add(canonical)) { seenCanonicals.add(canonical); symbols.add(canonical); orderings.put(canonical, node.getOrderings().get(symbol)); } } return new TopNNode( newNodeId, source, node.getCount(), symbols.build(), orderings.build(), node.getStep()); }
Source:
<code>public Indirect<T[]> convertIndirect(String instructions) { if ((instructions == null) || instructions.isEmpty()) <START> { <END> return new ArrayIndirect(ArrayUtilities.buildEmpty(getIndirectClass())); } Class<Indirect<T>> managedClass = getIndirectClass(); Indirect<T>[] array = null; if (componentManager instanceof DispatchingFormatManager) { @SuppressWarnings("unchecked") DispatchingFormatManager<T> dfm = (DispatchingFormatManager<T>) componentManager; String[] groups = splitInstructions(instructions, groupSep); for (String group : groups) { Indirect<T>[] converted = dfm.convertViaDispatch(fm -> new Derived(fm), group); array = ArrayUtilities.mergeArray(managedClass, array, converted); } } else { array = convertInternal(componentManager::convertIndirect, instructions, managedClass); } return buildIndirect(array); }</code><technical_language>sure, I Arrays Collections</technical_language>

Target:
public Indirect<T[]> convertIndirect(String instructions) { if ((instructions == null) || instructions.isEmpty()) { return new ArrayIndirect(ArrayUtilities.buildEmpty(getIndirectClass())); } Class<Indirect<T>> managedClass = getIndirectClass(); Indirect<T>[] array = null; if (componentManager instanceof DispatchingFormatManager) { @SuppressWarnings("unchecked") DispatchingFormatManager<T> dfm = (DispatchingFormatManager<T>) componentManager; String[] groups = splitInstructions(instructions, groupSeparator); for (String group : groups) { Indirect<T>[] converted = dfm.convertViaDispatch(fm -> new Derived(fm), group); array = ArrayUtilities.mergeArray(managedClass, array, converted); } } else { array = convertInternal(componentManager::convertIndirect, instructions, managedClass); } return buildIndirect(array); }
Source:
<code>public ReadWriteKeyCommand(K key, Function<ReadWriteEntryView<K, V>, R> f, CommandInvocationId id, ValueMatcher valueMatcher, Params params, ComponentRegistry componentRegistry) { super(key, valueMatcher, id, params); this.f = f; <START> if(f instanceof CommandFunction) componentRegistry.wireDependencies(((CommandFunction)f).getRemappingFunction()); <END> }</code><technical_language>I this done (in a bit more generic way) this: if (f instanceof InjectionDelegate) ((InjectionDelegate) f).inject(componentRegistry); do MergeFunction contains wireDependencies</technical_language>

Target:
public ReadWriteKeyCommand(K key, Function<ReadWriteEntryView<K, V>, R> f, CommandInvocationId id, ValueMatcher valueMatcher, Params params, ComponentRegistry componentRegistry) { super(key, valueMatcher, id, params); this.f = f; this.init(componentRegistry); }
Source:
<code>public Object process(Object proxy, Method method, Object[] args) throws Throwable { CdiQueryInvocationContext queryContext = null; EntityManagerRef entityManagerRef = null; try { List<Class<?>> candidates = ProxyUtils.getProxyAndBaseTypes(proxy.getClass()); RepositoryComponent repo = components.lookupComponent(candidates); RepositoryMethod repoMethod = components.lookupMethod(repo, method); entityManagerRef = entityManagerRefLookup.lookupReference(repo); queryContext = createContext(proxy, method, args, entityManagerRef.getEntityManager(), repoMethod); QueryBuilder builder = queryBuilderFactory.build(repoMethod, queryContext); Object result = runner.executeQuery(builder, queryContext); return result; } catch (PersistenceException e) { throw e; } catch (Exception e) { log.log(Level.FINEST, "Query execution error", e); <START> throw new QueryInvocationException(e, proxy.getClass(), method); <END> } finally { if (entityManagerRef != null) { entityManagerRef.release(); } context.dispose(); } }</code><technical_language>else in this PR fine this change. is a chance queryContext null here, reported due runtime exceptions</technical_language>

Target:
public Object process(Object proxy, Method method, Object[] args) throws Throwable { CdiQueryInvocationContext queryContext = null; EntityManagerRef entityManagerRef = null; try { List<Class<?>> candidates = ProxyUtils.getProxyAndBaseTypes(proxy.getClass()); RepositoryComponent repo = components.lookupComponent(candidates); RepositoryMethod repoMethod = components.lookupMethod(repo, method); entityManagerRef = entityManagerRefLookup.lookupReference(repo); queryContext = createContext(proxy, method, args, entityManagerRef.getEntityManager(), repoMethod); QueryBuilder builder = queryBuilderFactory.build(repoMethod, queryContext); Object result = runner.executeQuery(builder, queryContext); return result; } catch (PersistenceException e) { throw e; } catch (Exception e) { log.log(Level.FINEST, "Query execution error", e); if (queryContext != null) { throw new QueryInvocationException(e, queryContext); } throw new QueryInvocationException(e, proxy.getClass(), method); } finally { if (entityManagerRef != null) { entityManagerRef.release(); } context.dispose(); } }
Source:
<code>public DBRecord(StructuredRecord record, int columnTypes) { this.record = record; this.columnTypes = columnTypes; <START> this.bytesWritten = 0; <END> }</code><technical_language>need. Default of long field is 0L</technical_language>

Target:
public DBRecord(StructuredRecord record, int columnTypes) { this.record = record; this.columnTypes = columnTypes; }
Source:
<code>public void testWritingNewSchedule() throws Exception { Interval interval = new Interval( <START> getDateTime(3, 21, 16, 0), <END> getDateTime(3, 21, 17, 0) ); Item item = new Item(Id.valueOf(1), Publisher.METABROADCAST); Broadcast broadcast = new Broadcast(channel, interval).withId("sid"); item.addBroadcast(broadcast); contentStore.writeContent(item); ScheduleRef scheduleRef = ScheduleRef.forChannel(channel.getId(), interval) .addEntry(item.getId(), broadcast.toRef()) .build(); updateSchedule(scheduleRef); EquivalentSchedule resolved = get(equivalentScheduleStore .resolveSchedules( ImmutableList.of(channel), interval, Publisher.METABROADCAST, ImmutableSet.of(Publisher.METABROADCAST) )); EquivalentChannelSchedule schedule = Iterables.getOnlyElement(resolved.channelSchedules()); Equivalent<Item> broadcastItems = Iterables.getOnlyElement(schedule.getEntries()) .getItems(); assertThat(Iterables.getOnlyElement(broadcastItems.getResources()), is(item)); }</code><technical_language>_make_DateTime</technical_language>

Target:
public void testWritingNewSchedule() throws Exception { Interval interval = new Interval( makeDateTime(3, 21, 16, 0), makeDateTime(3, 21, 17, 0) ); Item item = new Item(Id.valueOf(1), Publisher.METABROADCAST); Broadcast broadcast = new Broadcast(channel, interval).withId("sid"); item.addBroadcast(broadcast); contentStore.writeContent(item); ScheduleRef scheduleRef = ScheduleRef.forChannel(channel.getId(), interval) .addEntry(item.getId(), broadcast.toRef()) .build(); updateSchedule(scheduleRef); EquivalentSchedule resolved = get(equivalentScheduleStore .resolveSchedules( ImmutableList.of(channel), interval, Publisher.METABROADCAST, ImmutableSet.of(Publisher.METABROADCAST) )); EquivalentChannelSchedule schedule = Iterables.getOnlyElement(resolved.channelSchedules()); Equivalent<Item> broadcastItems = Iterables.getOnlyElement(schedule.getEntries()) .getItems(); assertThat(Iterables.getOnlyElement(broadcastItems.getResources()), is(item)); }
Source:
<code>public static void setUp() throws Exception { <START> Assume.assumeTrue("This test is skipped for Hadoop versions above 3", VersionUtil.compareVersions(System.getProperty("hadoop.version"), "3.0.0") <= 0); <END> LOG.info("HBase minicluster: Starting"); TEST_UTIL.startMiniCluster(1); TEST_UTIL.getConfiguration().setInt("hbase.master.info.port", -1); TEST_UTIL.getConfiguration().set("hbase.zookeeper.quorum", "localhost:" + TEST_UTIL.getZkCluster().getClientPort()); conf = initialize(TEST_UTIL.getConfiguration()); LOG.info("HBase minicluster: Running"); }</code><technical_language>suggestion Assume.assumeTrue("This test is skipped for Hadoop versions 3", VersionUtil.compareVersions(System.getProperty("hadoop.version"), "3.0.0") < 0);</technical_language>

Target:
public static void setUp() throws Exception { Assume.assumeTrue("This test is skipped for Hadoop versions above 3", VersionUtil.compareVersions(System.getProperty("hadoop.version"), "3.0.0") < 0); LOG.info("HBase minicluster: Starting"); TEST_UTIL.startMiniCluster(1); TEST_UTIL.getConfiguration().setInt("hbase.master.info.port", -1); TEST_UTIL.getConfiguration().set("hbase.zookeeper.quorum", "localhost:" + TEST_UTIL.getZkCluster().getClientPort()); conf = initialize(TEST_UTIL.getConfiguration()); LOG.info("HBase minicluster: Running"); }
Source:
<code>protected void processTuple(Object tuple) { if(keyMethod == null && keyField != "") { pojoClass = tuple.getClass(); try { keyMethod = generateGetterForKeyField(); } catch (NoSuchFieldException e) { throw new RuntimeException("Field " + keyField + " is invalid: " + e); } } KeyedMessage msg; if(keyMethod != null) { msg = new KeyedMessage(getTopic(), keyMethod.get(tuple), tuple); } else { msg = new KeyedMessage(getTopic(), tuple, tuple); } if (isBatchProcessing) { <START> if (messageList.size() == batchSize) { <END> getProducer().send(messageList); messageList.clear(); } messageList.add(msg); } else { getProducer().send(msg); } messageCount++; if(tuple instanceof byte[]) { byteCount += ((byte[])tuple).length; } }</code><technical_language>I do batch manually. set batch.num.messages batch size set queue.buffering.max.ms streaming window size. strictly here. logic performance similar</technical_language>

Target:
protected void processTuple(Object tuple) { if (keyMethod == null && keyField != "") { pojoClass = tuple.getClass(); try { keyMethod = generateGetterForKeyField(); } catch (NoSuchFieldException e) { throw new RuntimeException("Field " + keyField + " is invalid: " + e); } } KeyedMessage msg; if (keyMethod != null) { msg = new KeyedMessage(getTopic(), keyMethod.get(tuple), tuple); } else { msg = new KeyedMessage(getTopic(), tuple, tuple); } getProducer().send(msg); messageCount++; if (tuple instanceof byte[]) { byteCount += ((byte[])tuple).length; } }
Source:
<code>public synchronized Set<PublicKeyHash> getOwnedKeys() { <START> return ownedKeys; <END> }</code><technical_language>Suggest returning a copy of ownedKeys if thread-safety is desired</technical_language>

Target:
public synchronized Set<PublicKeyHash> getOwnedKeys() { return Collections.unmodifiableSet(ownedKeys); }
Source:
<code>void runInIoThread(Runnable task) { this.taskRunQueue.add(task); try { getIoThread().execute(new Runnable() { @Override public void run() { while (!taskRunQueue.isEmpty()) { taskRunQueue.poll().run(); } } }); } catch (RejectedExecutionException e) { UndertowLogger.REQUEST_IO_LOGGER.warnf("Server is shutting down, task %s will not be executed", task); <START> } <END> }</code><technical_language>I create a new Thread run tasks. running result in hangs if task is supposed unblock a thread release a buffer</technical_language>

Target:
void runInIoThread(Runnable task) { this.taskRunQueue.add(task); try { getIoThread().execute(taskRunQueueRunnable); } catch (RejectedExecutionException e) { Thread thread = new Thread(taskRunQueueRunnable); thread.setName(String.format("%s AbstractFramedChannel task queue", getWorker().getName()); thread.start(); } }
Source:
<code>public static void cleanup() { if (context != null) { RabbitAdmin admin = context.getBean(RabbitAdmin.class); String deployerQueue = context.getEnvironment().resolvePlaceholders(XD_DEPLOYER_PLACEHOLDER); String undeployerExchange = context.getEnvironment().resolvePlaceholders(XD_UNDEPLOYER_PLACEHOLDER); admin.deleteQueue(deployerQueue); admin.deleteExchange(undeployerExchange); <START> if (!queues.isEmpty()) { <END> for (String queue : queues) { admin.deleteQueue(queue); } } if (!topics.isEmpty()) { for (String exchange : topics) { admin.deleteExchange(exchange); } } } }</code><technical_language>I this answers question (why queues/topics needed), question preceded one: RabbitTestMessageBus test instead</technical_language>

Target:
public static void cleanup() { if (context != null) { RabbitAdmin admin = context.getBean(RabbitAdmin.class); String deployerQueue = context.getEnvironment().resolvePlaceholders(XD_DEPLOYER_PLACEHOLDER); String undeployerExchange = context.getEnvironment().resolvePlaceholders(XD_UNDEPLOYER_PLACEHOLDER); admin.deleteQueue(deployerQueue); admin.deleteExchange(undeployerExchange); } }
Source:
<code>public List<DataTableRow>aroundReplacementDataTableStatementName(ProceedingJoinPoint pjp) throws Throwable { List<DataTableRow> dataTableOld = (List<DataTableRow>) pjp.proceed(); if(dataTableOld != null){ for(int i= 0; i < dataTableOld.size(); i++){ List<String> row = dataTableOld.get(i).getCells(); for(int x = 0; x < row.size(); x++){ String value = row.get(x); <START> String newValue = replaceReflectionPlaceholders(value); <END> dataTableOld.get(i).getCells().set(x, newValue); } } } return dataTableOld; }</code><technical_language>dont want env vars replaced</technical_language>

Target:
public List<DataTableRow>aroundReplacementDataTableStatementName(ProceedingJoinPoint pjp) throws Throwable { List<DataTableRow> dataTableOld = (List<DataTableRow>) pjp.proceed(); if(dataTableOld != null){ for(int i= 0; i < dataTableOld.size(); i++){ List<String> row = dataTableOld.get(i).getCells(); for(int x = 0; x < row.size(); x++){ String value = row.get(x); if (value.contains("${")) { value = replaceEnvironmentPlaceholders(value); } if (value.contains("!{")) { value = replaceReflectionPlaceholders(value); } if (value.contains("@{")) { value = replaceCodePlaceholders(value); } dataTableOld.get(i).getCells().set(x, value); } } } return dataTableOld; }