auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public List<IMethodInstance> intercept(List<IMethodInstance> methods, ITestContext context) { Comparator<IMethodInstance> comparator = new Comparator<IMethodInstance>() { private int getPriority(IMethodInstance mi) { int result = 0; Method method = mi.getMethod().getConstructorOrMethod().getMethod(); Priority a1 = method.getAnnotation(Priority.class); if (a1 != null) { result = a1.value(); } else { Class<?> cls = method.getDeclaringClass(); Priority classPriority = cls.getAnnotation(Priority.class); if (classPriority != null) { result = classPriority.value(); } } return result; } public int compare(IMethodInstance m1, IMethodInstance m2) { return getPriority(m1) - getPriority(m2); } }; methods.sort(comparator); <START> methods.forEach(m -> { <END> String clazz = m.getMethod().getInstance().getClass().getName() + "."; ordered.add(clazz + m.getMethod().getMethodName()); }); return methods; }</code><technical_language>If want Stream, map(), sort() collect() too</technical_language>

Target:
public List<IMethodInstance> intercept(List<IMethodInstance> methods, ITestContext context) { Comparator<IMethodInstance> comparator = Comparator.comparingInt(PriorityInterceptor::getPriority); methods.sort(comparator); return methods; }
Source:
<code>public User getUserFromMessage(PerunSessionImpl sess, String message) throws InternalErrorException { List<PerunBean> perunBeans = AuditParser.parseLog(message); User user = null; UserExtSource userExtSource = null; Member member = null; for(PerunBean perunBean: perunBeans) { if(perunBean instanceof User) { user = (User) perunBean; break; } else if (perunBean instanceof UserExtSource && userExtSource == null) { userExtSource = (UserExtSource) perunBean; } else if (perunBean instanceof Member && member == null) { member = (Member) perunBean; } } if(user == null && userExtSource != null && userExtSource.getUserId() != -1) { try { user = getPerunBl().getUsersManagerBl().getUserById(sess, userExtSource.getUserId()); } catch (UserNotExistsException ex) { <START> log.info("User from UserExtSource can't be found by id in Perun. Probably not exists any more or UserExtSource was audited without proper UserId!", userExtSource); <END> return null; } } else if (user == null && member != null) { try { user = getPerunBl().getUsersManagerBl().getUserById(sess, member.getUserId()); } catch (UserNotExistsException ex) { log.info("User from Member can't be found by id in Perun. Probably not exists any more or Member was audited without proper UserId!", userExtSource); return null; } } return user; }</code><technical_language>I reason, this info level</technical_language>

Target:
public User getUserFromMessage(PerunSessionImpl sess, String message) throws InternalErrorException { List<PerunBean> perunBeans = AuditParser.parseLog(message); User user = null; UserExtSource userExtSource = null; Member member = null; for(PerunBean perunBean: perunBeans) { if(perunBean instanceof User) { user = (User) perunBean; break; } else if (perunBean instanceof UserExtSource && userExtSource == null) { userExtSource = (UserExtSource) perunBean; } else if (perunBean instanceof Member && member == null) { member = (Member) perunBean; } } if(user == null && userExtSource != null && userExtSource.getUserId() != -1) { try { user = getPerunBl().getUsersManagerBl().getUserById(sess, userExtSource.getUserId()); } catch (UserNotExistsException ex) { log.debug("User from UserExtSource can't be found by id in Perun. Probably not exists any more or UserExtSource was audited without proper UserId!", userExtSource); return null; } } else if (user == null && member != null) { try { user = getPerunBl().getUsersManagerBl().getUserById(sess, member.getUserId()); } catch (UserNotExistsException ex) { log.debug("User from Member can't be found by id in Perun. Probably not exists any more or Member was audited without proper UserId!", userExtSource); return null; } } return user; }
Source:
<code>public void testIsNotWorkspaceMetacard() { MetacardImpl metacard = new MetacardImpl(); metacard.setTags(ImmutableSet.of("hello", "world")); boolean isWorkspace = WorkspaceMetacardImpl.isWorkspaceMetacard(metacard); <START> <END> assertFalse(isWorkspace); }</code><technical_language>typically assertThat in unit tests for assertions java assertThat(isWorkspace, is(false))</technical_language>

Target:
public void testIsNotWorkspaceMetacard() { MetacardImpl metacard = new MetacardImpl(); metacard.setTags(ImmutableSet.of("hello", "world")); boolean isWorkspace = WorkspaceMetacardImpl.isWorkspaceMetacard(metacard); assertThat(isWorkspace, is(false)); }
Source:
<code>public DetectRequest buildRequest(String location, InetAddress address, Integer port, Map<String, String> attributes) { <START> return new DetectRequestImpl(address, port); <END> }</code><technical_language>pass attributes map here</technical_language>

Target:
public DetectRequest buildRequest(String location, InetAddress address, Integer port, Map<String, String> attributes) { return new DetectRequestImpl(address, port, attributes); }
Source:
<code>private Owner findOwnerByIdOrKey(String id, String key) { Owner owner = null; if (id != null) { owner = this.ownerCurator.find(id); } <START> if (owner == null && key != null) { <END> owner = this.ownerCurator.lookupByKey(key); } if (owner == null) { throw new NotFoundException(i18n.tr("owner with key: {0} was not found.", key)); } return owner; }</code><technical_language>need careful kinds of lookups. this initiated client-input, pick other higher accuracy. In this case, ID if present, key. This leaves a lookup like: if (id != null) { // by-id lookup if (owner == null) { // error: find owner id } } else if (key != null) { ... // key lookup if (owner == null) { // error: find owner key } else { // error: identifiers provided } basically wrapped versions of other lookups, avoid some extra translation bits whatnot calling out each: if (id != null) { return this.findOwnerById(id); } else if (key != null) { return this.findOwnerByKey(key); } else { // error: identifying info }</technical_language>

Target:
private Owner findOwnerByIdOrKey(String id, String key) { if (id != null && !id.isEmpty()) { return this.findOwnerById(id); } else if (key != null && !key.isEmpty()) { return this.findOwnerByKey(key); } else { throw new BadRequestException(i18n.tr( "Owner lookup failed because id and key were null or empty.")); } }
Source:
<code>private void processRemovedPages(ApplicationSentListingMessage applicationSentListingMessage) { List<WebkitPage> old = new ArrayList<WebkitPage>(); <START> old.addAll(driver.getPages()); <END> for (WebkitPage p : applicationSentListingMessage.getPages()) { old.remove(p); } for (WebkitPage p : old) { log.fine("the page " + p + " has been deleted and must be removed from the driver cache"); int currentFocus = driver.getCurrentPageID(); if (p.getPageId() == currentFocus) { log.fine("the page deleted is the one with the focus."); } else { driver.setPages(applicationSentListingMessage.getPages()); } } }</code><technical_language>combine instantiation initialization 1 line</technical_language>

Target:
private void processRemovedPages(ApplicationSentListingMessage applicationSentListingMessage) { List<WebkitPage> old = new ArrayList<WebkitPage>(driver.getPages()); for (WebkitPage p : applicationSentListingMessage.getPages()) { old.remove(p); } for (WebkitPage p : old) { log.fine("the page " + p + " has been deleted and must be removed from the driver cache"); int currentFocus = driver.getCurrentPageID(); if (p.getPageId() == currentFocus) { log.fine("the page deleted is the one with the focus."); } else { driver.setPages(applicationSentListingMessage.getPages()); } } }
Source:
<code><START> protected void updateBusyIndicator(CTabItem cti, MPart part, boolean busy) { <END> IEclipseContext context = part.getContext(); CSSRenderingUtils renderingUtils = context.get(CSSRenderingUtils.class); if (renderingUtils == null) { return; } if (busy) { renderingUtils.addCSSClass(cti, CSSConstants.CSS_BUSY_CLASS); } else { renderingUtils.removeCSSClass(cti, CSSConstants.CSS_BUSY_CLASS); } }</code><technical_language>This simplified: add/remove CSS_BUSY_CLASS to/from this element's tags call setCSSInfo(). CSS class list is regenerated a part is activated. (The other changes removed.)</technical_language>

Target:
protected void updateBusyIndicator(CTabItem cti, MPart part, boolean busy) { int tagsListCount = part.getTags().size(); boolean containsBusyTag = part.getTags().contains( CSSConstants.CSS_BUSY_CLASS); if (busy && !containsBusyTag) { part.getTags().add(CSSConstants.CSS_BUSY_CLASS); } else if (!busy && containsBusyTag) { part.getTags().remove(CSSConstants.CSS_BUSY_CLASS); } if (part.getTags().size() != tagsListCount) { setCSSInfo(part, cti); reapplyStyles(cti); } }
Source:
<code>public void freeAABBTest() { Level check = new Level(emptyPlayer, emptyUnit, new Grid<>(Arrays.asList( Cell.WALL, Cell.WALL, Cell.WALL, Cell.WALL, Cell.EMPTY, Cell.WALL, Cell.WALL, Cell.WALL, Cell.WALL), 3, 3)); CollisionHandler handler = new CollisionHandler(check); Cell cell = handler.checkLevelAABB( new AABB(new Point(1, 1), new Point(2, 2)), new Point(0, 0)); <START> assertTrue(cell.getType() == Cell.EMPTY); <END> }</code><technical_language>assertEquals instead of == operator combined assertTrue, == work properly for non-objects. <testing</technical_language>

Target:
public void freeAABBTest() { Level check = new Level(emptyPlayer, emptyUnit, new Grid<>(Arrays.asList( Cell.WALL, Cell.WALL, Cell.WALL, Cell.WALL, Cell.EMPTY, Cell.WALL, Cell.WALL, Cell.WALL, Cell.WALL), 3, 3)); CollisionHandler handler = new CollisionHandler(check); Cell cell = handler.checkLevelAABB( new AABB(new Point(1, 1), new Point(2, 2)), new Point(0, 0)); assertEquals(cell, Cell.EMPTY); }
Source:
<code>public void initializeChannel(Channel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); if(transport != null) { <START> pipeline.addLast("stats", new StatsChannelHandler(transport)); <END> } SslConfiguration ssl = server.getConfiguration().ssl(); if (ssl.enabled()) { JdkSslContext defaultNettySslContext = createNettySslContext(ssl, ssl.sniDomainsConfiguration().get("*")); DomainMappingBuilder<JdkSslContext> domainMappingBuilder = new DomainMappingBuilder<>(defaultNettySslContext); ssl.sniDomainsConfiguration().forEach((k, v) -> { if (!"*".equals(k)) { domainMappingBuilder.add(k, createNettySslContext(ssl, v)); } }); pipeline.addLast("sni", new SniHandler(domainMappingBuilder.build())); } pipeline.addLast("decoder", server.getDecoder()); if (encoder != null) pipeline.addLast("encoder", encoder); }</code><technical_language>this stats for multi-tenant servers</technical_language>

Target:
public void initializeChannel(Channel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); if(transport != null) { pipeline.addLast("stats", new StatsChannelHandler(transport)); } SslConfiguration ssl = server.getConfiguration().ssl(); if (ssl.enabled()) { JdkSslContext defaultNettySslContext = SslUtils.createNettySslContext(ssl, ssl.sniDomainsConfiguration().get("*")); DomainMappingBuilder<JdkSslContext> domainMappingBuilder = new DomainMappingBuilder<>(defaultNettySslContext); ssl.sniDomainsConfiguration().forEach((k, v) -> { if (!"*".equals(k)) { domainMappingBuilder.add(k, SslUtils.createNettySslContext(ssl, v)); } }); pipeline.addLast("sni", new SniHandler(domainMappingBuilder.build())); } pipeline.addLast("decoder", server.getDecoder()); if (encoder != null) pipeline.addLast("encoder", encoder); }
Source:
<code>@Test public void callAdapterFactoryDelegateNoMatchThrows() { Type type = String.class; Annotation[] annotations = new Annotation[0]; DelegatingCallAdapterFactory delegatingFactory1 = new DelegatingCallAdapterFactory(); DelegatingCallAdapterFactory delegatingFactory2 = new DelegatingCallAdapterFactory(); NonMatchingCallAdapterFactory nonMatchingFactory = new NonMatchingCallAdapterFactory(); Retrofit retrofit = new Retrofit.Builder() .baseUrl("<LINK_0>") .addCallAdapterFactory(delegatingFactory1) .addCallAdapterFactory(delegatingFactory2) .addCallAdapterFactory(nonMatchingFactory) .build(); try { retrofit.callAdapter(type, annotations); <START> } catch (IllegalArgumentException e) { <END> assertThat(e).hasMessage("" + "Could not locate call adapter for class java.lang.String.\n" + " Skipped:\n" + " * retrofit2.helpers.DelegatingCallAdapterFactory\n" + " * retrofit2.helpers.DelegatingCallAdapterFactory\n" + " Tried:\n" + " * retrofit2.helpers.NonMatchingCallAdapterFactory\n" + " * retrofit2.DefaultCallAdapterFactory"); } assertThat(delegatingFactory1.called).isTrue(); assertThat(delegatingFactory2.called).isTrue(); assertThat(nonMatchingFactory.called).isTrue(); }</code><technical_language>fail</technical_language>

Target:
@Test public void callAdapterFactoryDelegateNoMatchThrows() { Type type = String.class; Annotation[] annotations = new Annotation[0]; DelegatingCallAdapterFactory delegatingFactory1 = new DelegatingCallAdapterFactory(); DelegatingCallAdapterFactory delegatingFactory2 = new DelegatingCallAdapterFactory(); NonMatchingCallAdapterFactory nonMatchingFactory = new NonMatchingCallAdapterFactory(); Retrofit retrofit = new Retrofit.Builder() .baseUrl("<LINK_0>") .addCallAdapterFactory(delegatingFactory1) .addCallAdapterFactory(delegatingFactory2) .addCallAdapterFactory(nonMatchingFactory) .build(); try { retrofit.callAdapter(type, annotations); fail(); } catch (IllegalArgumentException e) { assertThat(e).hasMessage("" + "Could not locate call adapter for class java.lang.String.\n" + " Skipped:\n" + " * retrofit2.helpers.DelegatingCallAdapterFactory\n" + " * retrofit2.helpers.DelegatingCallAdapterFactory\n" + " Tried:\n" + " * retrofit2.helpers.NonMatchingCallAdapterFactory\n" + " * retrofit2.DefaultCallAdapterFactory"); } assertThat(delegatingFactory1.called).isTrue(); assertThat(delegatingFactory2.called).isTrue(); assertThat(nonMatchingFactory.called).isTrue(); }
Source:
<code>private boolean isEquivalentInboundRelationship(final Multimap<Concept, Concept> equivalentConcepts, Relationship relationshipToRemove, Relationship relationshipToKeep) { Concept sourceToKeep = relationshipToKeep.getSource(); Concept sourceToRemove = relationshipToRemove.getSource(); <START> equivalentConcepts.get(sourceToKeep); <END> return relationshipToRemove.getType().equals(relationshipToKeep.getType()) && (sourceToRemove.equals(sourceToKeep) || equivalentConcepts.get(sourceToKeep).contains(sourceToRemove)) && relationshipToRemove.getCharacteristicType().equals(relationshipToKeep.getCharacteristicType()) && relationshipToRemove.getModifier().equals(relationshipToKeep.getModifier()); }</code><technical_language>This a no-op</technical_language>

Target:
private boolean isEquivalentInboundRelationship(final Multimap<Concept, Concept> equivalentConcepts, Relationship relationshipToRemove, Relationship relationshipToKeep) { Concept sourceToKeep = relationshipToKeep.getSource(); Concept sourceToRemove = relationshipToRemove.getSource(); return relationshipToRemove.getType().equals(relationshipToKeep.getType()) && (sourceToRemove.equals(sourceToKeep) || equivalentConcepts.get(sourceToKeep).contains(sourceToRemove)) && relationshipToRemove.getCharacteristicType().equals(relationshipToKeep.getCharacteristicType()) && relationshipToRemove.getModifier().equals(relationshipToKeep.getModifier()); }
Source:
<code>public OpenshiftIORefreshException(IAccount account, Throwable t) { super("Error refreshing token for " + account.getId() + " on cluster " + account.getCluster().getId(), t); this.account = account; <START> this.status = (-1); <END> }</code><technical_language>nitpicking - brackets here</technical_language>

Target:
public OpenshiftIORefreshException(IAccount account, Throwable t) { super("Error refreshing token for " + account.getId() + " on cluster " + account.getCluster().getId(), t); this.account = account; this.status = NO_STATUS; }
Source:
<code>@Test public void semiJoinCorrelateWithFilterCorrelateRule() { tester(false, new JdbcTest.HrSchema()) .query( "select empid, name from emps e where e.deptno in (select d.deptno from depts d) and e.empid > 100") .withHook(Hook.PLANNER, (Consumer<RelOptPlanner>) planner -> { planner.addRule(JoinToCorrelateRule.INSTANCE); planner.addRule(FilterCorrelateRule.INSTANCE); planner.removeRule(EnumerableRules.ENUMERABLE_JOIN_RULE); }) .explainContains("" + "EnumerableCalc(expr#0..3=[{inputs}], empid=[$t1], name=[$t3])\n" + " EnumerableCorrelate(correlation=[$cor4], joinType=[inner], requiredColumns=[{0}])\n" + " EnumerableAggregate(group=[{0}])\n" + " EnumerableTableScan(table=[[s, depts]])\n" <START> + " EnumerableCalc(expr#0..4=[{inputs}], expr#5=[$cor4], expr#6=[$t5.deptno], expr#7=[=($t1, $t6)], expr#8=[100], expr#9=[>($t0, $t8)], expr#10=[AND($t7, $t9)], proj#0..2=[{exprs}], $condition=[$t10])\n" <END> + " EnumerableTableScan(table=[[s, emps]])") .returnsUnordered( "empid=110; name=Theodore", "empid=150; name=Sebastian"); }</code><technical_language>Thanks @xndai , explain this plan changed</technical_language>

Target:
@Test public void semiJoinCorrelateWithFilterCorrelateRule() { tester(false, new JdbcTest.HrSchema()) .query( "select empid, name from emps e where e.deptno in (select d.deptno from depts d) and e.empid > 100") .withHook(Hook.PLANNER, (Consumer<RelOptPlanner>) planner -> { planner.addRule(JoinToCorrelateRule.INSTANCE); planner.addRule(FilterCorrelateRule.INSTANCE); planner.removeRule(EnumerableRules.ENUMERABLE_JOIN_RULE); }) .explainContains("" + "EnumerableCalc(expr#0..3=[{inputs}], empid=[$t1], name=[$t3])\n" + " EnumerableCorrelate(correlation=[$cor5], joinType=[inner], requiredColumns=[{0}])\n" + " EnumerableAggregate(group=[{0}])\n" + " EnumerableTableScan(table=[[s, depts]])\n" + " EnumerableCalc(expr#0..4=[{inputs}], expr#5=[100], expr#6=[>($t0, $t5)], expr#7=[$cor5], expr#8=[$t7.deptno], expr#9=[=($t1, $t8)], expr#10=[AND($t6, $t9)], proj#0..2=[{exprs}], $condition=[$t10])\n" + " EnumerableTableScan(table=[[s, emps]])") .returnsUnordered( "empid=110; name=Theodore", "empid=150; name=Sebastian"); }
Source:
<code>protected Optional<String> getStringValue(BaseElement element) { List<ExtensionAttributeValue> extensionValues = element.getExtensionValues(); String globalVariables = null; <START> if (extensionValues != null && extensionValues.size() > 0) { <END> for (ExtensionAttributeValue extattrval : extensionValues) { FeatureMap extensionElements = extattrval.getValue(); List<GlobalType> globalTypeDataExtensions = (List<GlobalType>) extensionElements .get(DOCUMENT_ROOT__GLOBAL, true); for (GlobalType globalType : globalTypeDataExtensions) { if (globalType.getIdentifier() != null && globalType.getIdentifier().length() > 0 && globalType.getType() != null && globalType.getType().length() > 0) { String variable = globalType.getIdentifier() + ":" + globalType.getType(); if (globalVariables != null) { globalVariables += ","; } else { globalVariables = ""; } globalVariables += variable; } } } } return Optional.ofNullable(globalVariables); }</code><technical_language>I suggest move of Streams (stream().filter().map().collect()) code more readable. for example Collectors.joining() generate resulting String..</technical_language>

Target:
protected Optional<String> getStringValue(BaseElement element) { List<ExtensionAttributeValue> extValues = element.getExtensionValues(); List<FeatureMap> extElementsList = extValues.stream() .map(extAttrVal -> extAttrVal.getValue()) .collect(Collectors.toList()); List<GlobalType> globalExtensions = extElementsList.stream() .map(extAttrVal -> (List<GlobalType>) extAttrVal.get(DOCUMENT_ROOT__GLOBAL, true)) .flatMap(Collection::stream) .collect(Collectors.toList()); String globalVariables = globalExtensions.stream() .filter(globalType -> globalType.getIdentifier() != null && globalType.getIdentifier().length() > 0 && globalType.getType() != null && globalType.getType().length() > 0) .map(globalType -> globalType.getIdentifier() + ":" + globalType.getType()) .collect(Collectors.joining(",")); return Optional.ofNullable(globalVariables); }
Source:
<code>public PictogramElement[] getSelections(PictogramElement selection) { <START> if (selection instanceof Connection && !isConnectionSelectionEnabled()) { return null; } <END> PictogramElement[] selections = { selection }; return selections; }</code><technical_language>I agree. However, this is done TBP preserve compatibility. If compatibility is desired, this should, indeed, move caller</technical_language>

Target:
public PictogramElement[] getSelections(PictogramElement selection) { PictogramElement[] selections = { selection }; return selections; }
Source:
<code>public Lz4Compressor(int directBufferSize, boolean useLz4HC) { this.useLz4HC = useLz4HC; this.directBufferSize = directBufferSize; try { LZ4Factory lz4Factory = LZ4Factory.fastestInstance(); <START> if (useLz4HC) { <END> lz4Compressor = lz4Factory.highCompressor(); } else { lz4Compressor = lz4Factory.fastCompressor(); } } catch (Throwable t) { throw new RuntimeException("lz4-java library is not available: " + "Lz4Compressor has not been loaded. You need to add " + "lz4-java.jar to your CLASSPATH", t); } uncompressedDirectBuf = ByteBuffer.allocateDirect(directBufferSize); compressedDirectBuf = ByteBuffer.allocateDirect(directBufferSize); compressedDirectBuf.position(directBufferSize); }</code><technical_language>library allow configuring compression level, add a Hadoop option enable later. This default compression level</technical_language>

Target:
public Lz4Compressor(int directBufferSize, boolean useLz4HC) { this.directBufferSize = directBufferSize; try { LZ4Factory lz4Factory = LZ4Factory.fastestInstance(); if (useLz4HC) { lz4Compressor = lz4Factory.highCompressor(); } else { lz4Compressor = lz4Factory.fastCompressor(); } } catch (AssertionError t) { throw new RuntimeException("lz4-java library is not available: " + "Lz4Compressor has not been loaded. You need to add " + "lz4-java.jar to your CLASSPATH. " + t, t); } uncompressedDirectBuf = ByteBuffer.allocateDirect(directBufferSize); this.dstCapacity = (directBufferSize) + ((directBufferSize) / 255) + 16; compressedDirectBuf = ByteBuffer.allocateDirect(this.dstCapacity); compressedDirectBuf.position(this.dstCapacity); }
Source:
<code>public String getMessage(Bundle bundle, String value) { String result = value; if (bundle != null && result != null && result.startsWith(PERCENT)) { if (bundle != null && result != null && result.startsWith(PERCENT + PERCENT)) { return result.replaceFirst(PERCENT, EMPTY); } try { result = Platform.getResourceBundle(bundle).getString(result.substring(PERCENT.length())); } catch (MissingResourceException mre) { <START> String message = MessageFormat.format(Messages.MessageTranslator_missingResourceMessage1, value) + value + MessageFormat.format(Messages.MessageTranslator_missingResourceMessage2, value); <END> DslCommonPlugin.INSTANCE.log(new Status(IStatus.WARNING, bundle.getSymbolicName(), 0, message, mre)); } } return result; }</code><technical_language>This is MessageFormat @TranslatableMessage meant used. A single message a single @TranslatableMessage</technical_language>

Target:
public String getMessage(Bundle bundle, String value) { String result = value; if (bundle != null && result != null && result.startsWith(PERCENT)) { if (bundle != null && result != null && result.startsWith(PERCENT + PERCENT)) { return result.replaceFirst(PERCENT, EMPTY); } try { result = Platform.getResourceBundle(bundle).getString(result.substring(PERCENT.length())); } catch (MissingResourceException mre) { String message = MessageFormat.format(Messages.MessageTranslator_missingResourceMessage, value) + value; DslCommonPlugin.INSTANCE.log(new Status(IStatus.WARNING, bundle.getSymbolicName(), 0, message, mre)); } } return result; }
Source:
<code>private void initComponents() { GridBagConstraints constraints = new GridBagConstraints(); setLayout(new GridBagLayout()); <START> JPanel teamMetaData = new JPanel(); <END> teamMetaData.setOpaque(false); teamMetaData.setLayout(new GridBagLayout()); teamMetaData.setBorder(BorderFactory.createTitledBorder(Messages.getString("GamePanel.info"))); GridBagConstraints teamConstraint = new GridBagConstraints(); teamConstraint.fill = GridBagConstraints.BOTH; teamConstraint.gridx = 0; teamConstraint.gridy = 0; teamConstraint.insets = new Insets(5, 0, 5, 5); teamMetaData.add(new JLabel(Messages.getString("GamePanel.player")), teamConstraint); teamConstraint.weightx = 1.0; teamConstraint.gridx = 1; teamConstraint.insets = new Insets(5, 0, 5, 0); teamMetaData.add(mPlayerName, teamConstraint); teamConstraint.gridx = 0; teamConstraint.gridy = 1; teamConstraint.weightx = 0.0; teamMetaData.add(new JLabel(Messages.getString("GamePanel.status")), teamConstraint); teamConstraint.gridx = 1; teamConstraint.weightx = 1.0; teamMetaData.add(mTeamLabel, teamConstraint); teamConstraint.gridy = 2; teamConstraint.gridx = 0; teamConstraint.gridwidth = 2; teamConstraint.weighty = 0.1; teamConstraint.weightx = 1.0; teamMetaData.add(mJailPanel, teamConstraint); constraints.anchor = GridBagConstraints.BASELINE; constraints.fill = GridBagConstraints.BOTH; constraints.gridy = 0; constraints.weightx = 1.0; constraints.weighty = 0.5; constraints.gridwidth = 2; constraints.insets = new Insets(10, 10, 10, 10); add(teamMetaData, constraints); }</code><technical_language>"Metadata" is word, this variable teamMetadata</technical_language>

Target:
private void initComponents() { GridBagConstraints constraints = new GridBagConstraints(); setLayout(new GridBagLayout()); JPanel teamMetadata = new JPanel(); teamMetadata.setOpaque(false); teamMetadata.setLayout(new GridBagLayout()); teamMetadata.setBorder(BorderFactory.createTitledBorder(Messages.getString("GamePanel.info"))); GridBagConstraints teamConstraint = new GridBagConstraints(); teamConstraint.fill = GridBagConstraints.BOTH; teamConstraint.gridx = 0; teamConstraint.gridy = 0; teamConstraint.insets = new Insets(5, 0, 5, 5); teamMetadata.add(new JLabel(Messages.getString("GamePanel.player")), teamConstraint); teamConstraint.weightx = 1.0; teamConstraint.gridx = 1; teamConstraint.insets = new Insets(5, 0, 5, 0); teamMetadata.add(mPlayerName, teamConstraint); teamConstraint.gridx = 0; teamConstraint.gridy = 1; teamConstraint.weightx = 0.0; teamMetadata.add(new JLabel(Messages.getString("GamePanel.status")), teamConstraint); teamConstraint.gridx = 1; teamConstraint.weightx = 1.0; teamMetadata.add(mTeamLabel, teamConstraint); teamConstraint.gridy = 2; teamConstraint.gridx = 0; teamConstraint.gridwidth = 2; teamConstraint.weighty = 0.1; teamConstraint.weightx = 1.0; teamMetadata.add(mJailPanel, teamConstraint); constraints.anchor = GridBagConstraints.BASELINE; constraints.fill = GridBagConstraints.BOTH; constraints.gridy = 0; constraints.weightx = 1.0; constraints.weighty = 0.5; constraints.gridwidth = 2; constraints.insets = new Insets(10, 10, 10, 10); add(teamMetadata, constraints); }
Source:
<code>private boolean validateAndCompleteParameters(QuotaConsumptionParametersWrapper parameters) { if (!checkAndCompleteStoragePool(parameters)) { return false; } <START> <END> if (QuotaEnforcementTypeEnum.DISABLED.equals(parameters.getStorage_pool().getQuotaEnforcementType())) { return true; } boolean hardEnforcement = QuotaEnforcementTypeEnum.HARD_ENFORCEMENT.equals(parameters.getStorage_pool().getQuotaEnforcementType()); if (null == parameters.getCanDoActionMessages() || null == parameters.getAuditLogable() || null == parameters.getParameters()){ if (hardEnforcement) { parameters.getCanDoActionMessages().add(VdcBllMessages.ACTION_TYPE_FAILED_QUOTA_IS_NOT_VALID.toString()); return false; } else { AUDIT_LOGGER.auditLog(parameters.getAuditLogable(), AuditLogType.MISSING_QUOTA_STORAGE_PARAMETERS_PERMISSIVE_MODE); return true; } } for (QuotaConsumptionParameter param : parameters.getParameters()) { boolean validQuotaId = checkAndFetchQuota(parameters, param); boolean validVdsGroup = checkVdsGroupMatchQuota(parameters, param); boolean validStorageDomain = checkStoragePoolMatchQuota(parameters, param); if (!validQuotaId || !validVdsGroup || !validStorageDomain) { if (hardEnforcement) { return false; } else { AUDIT_LOGGER.auditLog(parameters.getAuditLogable(), AuditLogType.MISSING_QUOTA_STORAGE_PARAMETERS_PERMISSIVE_MODE); parameters.getCanDoActionMessages().clear(); return true; } } } return true; }</code><technical_language>a case of new storage pool works ok</technical_language>

Target:
private boolean validateAndCompleteParameters(QuotaConsumptionParametersWrapper parameters) { if (QuotaEnforcementTypeEnum.DISABLED.equals(parameters.getStorage_pool().getQuotaEnforcementType())) { return true; } boolean hardEnforcement = QuotaEnforcementTypeEnum.HARD_ENFORCEMENT.equals(parameters.getStorage_pool().getQuotaEnforcementType()); for (QuotaConsumptionParameter param : parameters.getParameters()) { boolean validQuotaId = checkAndFetchQuota(parameters, param); boolean validVdsGroup = false; if (param instanceof QuotaVdsConsumptionParameter) { validVdsGroup = checkVdsGroupMatchQuota(parameters, param); } else { validVdsGroup = true; } boolean validStorageDomain = false; if (param instanceof QuotaStorageConsumptionParameter) { validStorageDomain = checkStoragePoolMatchQuota(parameters, param); } else { validStorageDomain = true; } if (!validQuotaId || !validVdsGroup || !validStorageDomain) { if (hardEnforcement) { return false; } else { quotaManagerAuditLogger.auditLog(parameters.getAuditLogable(), AuditLogType.MISSING_QUOTA_STORAGE_PARAMETERS_PERMISSIVE_MODE); parameters.getCanDoActionMessages().clear(); return true; } } } return true; }
Source:
<code>public List<RollingOperation> getRollingOperations(final String groupName) throws DeploymentGroupDoesNotExistException { final ZooKeeperClient client = provider.get("getRollingOperations"); <START> final List<RollingOperation> ops = new ArrayList<RollingOperation>(); <END> for (final String id : getRollingOperationIds(client, groupName)) { try { ops.add(getRollingOperation(client, id)); } catch (RollingOperationDoesNotExistException e) { } } return ImmutableList.copyOf(ops); }</code><technical_language>ArrayList<RollingOperation> ArrayList<> java7+ type inference for generic instance creation</technical_language>

Target:
public List<RollingOperation> getRollingOperations(final String groupName) throws DeploymentGroupDoesNotExistException { final ZooKeeperClient client = provider.get("getRollingOperations"); final List<RollingOperation> ops = new ArrayList<>(); for (final String id : getRollingOperationIds(client, groupName)) { try { ops.add(getRollingOperation(client, id)); } catch (RollingOperationDoesNotExistException e) { } } return ImmutableList.copyOf(ops); }
Source:
<code>public void add(int value) { if (sparse) { try { sparseWriter.add(value); } catch (IllegalStateException e) { <START> denseWriter = sparseWriter.transfer(denseWriter); <END> denseWriter.add(value); sparse = false; } } else { denseWriter.add(value); if (!denseWriter.isDirty()) { sparse = true; } } }</code><technical_language>This a bit awkward</technical_language>

Target:
public void add(int value) { if (sparse) { try { sparseWriter.add(value); } catch (IndexOutOfBoundsException e) { denseWriter = sparseWriter.transfer(); denseWriter.add(value); sparse = false; } } else { denseWriter.add(value); } }
Source:
<code>static void assertBinFolderIsCleaned(IProject project) throws CoreException { IFolder bin = project.getFolder("bin"); assertTrue("Expected bin/ folder of project " + project.getName() + " to exist", bin.isAccessible()); <START> class Visitor implements IResourceVisitor { List<IResource> contents = new ArrayList<>(); @Override public boolean visit(IResource resource) { if (!resource.equals(bin)) { contents.add(resource); } return true; } } Visitor visitor = new Visitor(); bin.accept(visitor); <END> assertEquals("Expected bin folder to be empty", Collections.EMPTY_LIST, visitor.contents); }</code><technical_language>bin.members() is enough here</technical_language>

Target:
static void assertBinFolderIsCleaned(IProject project) throws CoreException { IFolder bin = project.getFolder("bin"); assertTrue("Expected bin/ folder of project " + project.getName() + " to exist", bin.isAccessible()); assertEquals("Expected bin folder to be empty", Collections.EMPTY_LIST, Arrays.asList(bin.members())); }
Source:
<code>private static MergeAlgorithm getMergeAlgorithm(Config config) { SupportedAlgorithm diffAlg = config.getEnum( <START> ConfigConstants.CONFIG_DIFF_SECTION, null, <END> ConfigConstants.CONFIG_KEY_ALGORITHM, SupportedAlgorithm.HISTOGRAM); return new MergeAlgorithm(DiffAlgorithm.getAlgorithm(diffAlg)); }</code><technical_language>optional: imported statically? I easier read</technical_language>

Target:
private static MergeAlgorithm getMergeAlgorithm(Config config) { SupportedAlgorithm diffAlg = config.getEnum( CONFIG_DIFF_SECTION, null, CONFIG_KEY_ALGORITHM, HISTOGRAM); return new MergeAlgorithm(DiffAlgorithm.getAlgorithm(diffAlg)); }
Source:
<code>private int[] getHashes(byte[] read, int numberOfHashes, int skippedBases, int minReadLength) { <START> int[] hashValues = new int[numberOfHashes]; <END> for (int i = 0; i < numberOfHashes; ++i) { hashValues[i] = 1; int position = skippedBases + i; while (position < minReadLength) { hashValues[i] = 31 * hashValues[i] + read[position]; position += numberOfHashes; } } return hashValues; }</code><technical_language>final</technical_language>

Target:
private int[] getHashes(byte[] read, int numberOfHashes, int skippedBases, int minReadLength) { final int[] hashValues = new int[numberOfHashes]; for (int i = 0; i < numberOfHashes; ++i) { hashValues[i] = 1; int position = skippedBases + i; while (position < minReadLength) { hashValues[i] = 31 * hashValues[i] + read[position]; position += numberOfHashes; } } return hashValues; }
Source:
<code>public void testGetContainerReplicaWithParallelUpdate() throws Exception { testGetContainerWithPipeline(); final Optional<ContainerID> id = containerManager.getContainerIDs() .stream().findFirst(); Assert.assertTrue(id.isPresent()); final ContainerID cId = id.get(); final Optional<ContainerReplica> replica = containerManager .getContainerReplicas(cId).stream().findFirst(); Assert.assertTrue(replica.isPresent()); final ContainerReplica cReplica = replica.get(); final AtomicBoolean runUpdaterThread = new AtomicBoolean(true); Thread updaterThread = new Thread(() -> { while (runUpdaterThread.get()) { try { containerManager.removeContainerReplica(cId, cReplica); containerManager.updateContainerReplica(cId, cReplica); } catch (ContainerNotFoundException e) { <START> e.printStackTrace(); <END> } catch (ContainerReplicaNotFoundException e) { Assert.fail("Missing Container Replica for " + id); } } }); updaterThread.setDaemon(true); updaterThread.start(); IntStream.range(0, 10).forEach(i -> { try { Assert.assertNotNull(containerManager .getContainerReplicas(cId) .stream().map(ContainerReplica::getDatanodeDetails) .collect(Collectors.toSet())); } catch (ContainerNotFoundException e) { Assert.fail("Missing Container " + id); } }); runUpdaterThread.set(false); }</code><technical_language>This converted Assert.fail</technical_language>

Target:
public void testGetContainerReplicaWithParallelUpdate() throws Exception { testGetContainerWithPipeline(); final Optional<ContainerID> id = containerManager.getContainerIDs() .stream().findFirst(); Assert.assertTrue(id.isPresent()); final ContainerID cId = id.get(); final Optional<ContainerReplica> replica = containerManager .getContainerReplicas(cId).stream().findFirst(); Assert.assertTrue(replica.isPresent()); final ContainerReplica cReplica = replica.get(); final AtomicBoolean runUpdaterThread = new AtomicBoolean(true); Thread updaterThread = new Thread(() -> { while (runUpdaterThread.get()) { try { containerManager.removeContainerReplica(cId, cReplica); containerManager.updateContainerReplica(cId, cReplica); } catch (ContainerException e) { Assert.fail("Container Exception: " + e.getMessage()); } } }); updaterThread.setDaemon(true); updaterThread.start(); IntStream.range(0, 100).forEach(i -> { try { Assert.assertNotNull(containerManager .getContainerReplicas(cId) .stream().map(ContainerReplica::getDatanodeDetails) .collect(Collectors.toSet())); } catch (ContainerNotFoundException e) { Assert.fail("Missing Container " + id); } }); runUpdaterThread.set(false); }
Source:
<code>public void onDiagramLoad() { final Optional<CanvasHandler> canvasHandler = Optional.ofNullable(getCanvasHandler()); canvasHandler.ifPresent(c -> { final ExpressionEditorView.Presenter expressionEditor = ((DMNSession) sessionManager.getCurrentSession()).getExpressionEditor(); expressionEditor.setToolbarStateHandler(new DMNProjectToolbarStateHandler(getMenuSessionItems())); decisionNavigatorDock.setupCanvasHandler(c); dataTypesPage.reload(); <START> includedModelsPage.setup(importsPageProvider.withDiagram(c.getDiagram())); <END> }); }</code><technical_language>I need a condition here, similar here: <LINK_0></technical_language>

Target:
public void onDiagramLoad() { final Optional<CanvasHandler> canvasHandler = Optional.ofNullable(getCanvasHandler()); canvasHandler.ifPresent(c -> { final ExpressionEditorView.Presenter expressionEditor = ((DMNSession) sessionManager.getCurrentSession()).getExpressionEditor(); expressionEditor.setToolbarStateHandler(new DMNProjectToolbarStateHandler(getMenuSessionItems())); decisionNavigatorDock.setupCanvasHandler(c); dataTypesPage.reload(); final Channel channel = contextProvider.getChannel(); if (Objects.equals(channel, DEFAULT) || Objects.equals(channel, VSCODE)) { includedModelsPage.setup(importsPageProvider.withDiagram(c.getDiagram())); } }); }
Source:
<code>public void dispose() { cm.unregisterForCallStateChanged(this); cm.unregisterForOn(this); cm.unregisterForNotAvailable(this); <START> this.removeCallbacksAndMessages(null); <END> for(CdmaConnection c : connections) { if(c != null) { c.dispose(); c = null; } else { continue; } } this.phone = null; }</code><technical_language>this.removeCallbacksAndMessages(null) instead. Fixed in Patch Set 2</technical_language>

Target:
public void dispose() { cm.unregisterForCallStateChanged(this); cm.unregisterForOn(this); cm.unregisterForNotAvailable(this); for(CdmaConnection c : connections) { try { if(c != null) hangup(c); } catch (CallStateException ex) { Log.e(LOG_TAG, "unexpected error on hangup during dispose"); } } try { if(pendingMO != null) hangup(pendingMO); } catch (CallStateException ex) { Log.e(LOG_TAG, "unexpected error on hangup during dispose"); } clearDisconnected(); }
Source:
<code>HiveConf provideHiveConf() { if (this.hiveConf != null) { return this.hiveConf; } else { this.hiveConf = new HiveConf(SessionState.class); } troublesomeConfig(HIVEHISTORYFILELOC, hiveConf); troublesomeConfig(SCRATCHDIR, hiveConf); if (System.getenv("HADOOP_TOKEN_FILE_LOCATION") != null) { System.out.println("Setting hadoop tokens ... "); <START> hiveConf.set("mapreduce.job.credentials.binary", System.getenv("HADOOP_TOKEN_FILE_LOCATION")); <END> System.setProperty("mapreduce.job.credentials.binary", System.getenv("HADOOP_TOKEN_FILE_LOCATION")); } return hiveConf; }</code><technical_language>constants for property names</technical_language>

Target:
HiveConf provideHiveConf() { if (this.hiveConf != null) { return this.hiveConf; } else { this.hiveConf = new HiveConf(SessionState.class); } troublesomeConfig(HIVEHISTORYFILELOC, hiveConf); troublesomeConfig(SCRATCHDIR, hiveConf); if (System.getenv(HADOOP_TOKEN_FILE_LOCATION) != null) { System.out.println("Setting hadoop tokens ... "); hiveConf.set(MAPREDUCE_JOB_CREDENTIALS_BINARY, System.getenv(HADOOP_TOKEN_FILE_LOCATION)); System.setProperty(MAPREDUCE_JOB_CREDENTIALS_BINARY, System.getenv(HADOOP_TOKEN_FILE_LOCATION)); } return hiveConf; }
Source:
<code>messagesAreSentToKafka() throws Exception { <START> KafkaWriter writer = getTestKafkaWriter(); <END> writer.setProducer(producer); writer.doWrite(dummyServer(), dummyQuery(), singleNumericResult()); verify(producer).send(messageCaptor.capture()); ProducerRecord<String, String> message = messageCaptor.getValue(); assertThat(message.topic()).isEqualTo("myTopic"); assertThat(message.value()) .contains("\"keyspace\":\"rootPrefix.host_example_net_4321.MemoryAlias.ObjectPendingFinalizationCount\"") .contains("\"value\":\"10\"") .contains("\"timestamp\":0") .contains("\"tags\":{\"myTagKey1\":\"myTagValue1\""); }</code><technical_language>ensure KafkaWriter is closed properly (try-with-resources)</technical_language>

Target:
public void messagesAreSentToKafka() throws Exception { try(KafkaWriter writer = new KafkaWriter(ImmutableList.<String>of(), true, "rootPrefix", true, "myTopic", tags, settings, producer)) { writer.doWrite(dummyServer(), dummyQuery(), singleNumericResult()); verify(producer).send(messageCaptor.capture()); ProducerRecord<String, String> message = messageCaptor.getValue(); assertThat(message.topic()).isEqualTo("myTopic"); assertThat(message.value()) .contains("\"keyspace\":\"rootPrefix.host_example_net_4321.MemoryAlias.ObjectPendingFinalizationCount\"") .contains("\"value\":\"10\"") .contains("\"timestamp\":0") .contains("\"tags\":{\"myTagKey1\":\"myTagValue1\""); } }
Source:
<code>public static JobModel readJobModel(String jobModelVersion, MetadataStore metadataStore) { try { StringBuilder jobModelUnificationBuffer = new StringBuilder(); for (int jobModelSegmentIndex = 0;; ++jobModelSegmentIndex) { String jobModelSegmentKey = getJobModelSegmentKey(jobModelVersion, jobModelSegmentIndex); byte[] jobModelSegment = metadataStore.get(jobModelSegmentKey); if (jobModelSegment == null) { <START> break; <END> } else { jobModelUnificationBuffer.append(new String(jobModelSegment, Charset.forName(UTF_8))); } } return MAPPER.readValue(jobModelUnificationBuffer.toString(), JobModel.class); } catch (Exception e) { throw new SamzaException(String.format("Exception occurred when reading JobModel version: %s from metadata store.", jobModelVersion), e); } }</code><technical_language>need some kind of verification is corrupted. I suggested checksum</technical_language>

Target:
public static JobModel readJobModel(String jobModelVersion, MetadataStore metadataStore) { try { byte[] jobModelAsBytes = metadataStore.get(getJobModelKey(jobModelVersion)); return MAPPER.readValue(new String(jobModelAsBytes, UTF_8), JobModel.class); } catch (Exception e) { throw new SamzaException(String.format("Exception occurred when reading JobModel version: %s from metadata store.", jobModelVersion), e); } }
Source:
<code>public ActionInvocation serialize() { DefaultActionInvocation that = this; that.container = null; if(that.getInvocationContext() != null && that.getInvocationContext().getContextMap() != null) { Map<String, Object> thatContextMap = that.getInvocationContext().getContextMap(); thatContextMap.remove(ServletActionContext.HTTP_REQUEST); <START> thatContextMap.remove(ServletActionContext.HTTP_RESPONSE); <END> } return that; }</code><technical_language>100% in break Token Session support I remember try restore previous request invalid token</technical_language>

Target:
public ActionInvocation serialize() { DefaultActionInvocation that = this; that.container = null; if(that.getInvocationContext() != null && that.getInvocationContext().getContextMap() != null) { Map<String, Object> thatContextMap = that.getInvocationContext().getContextMap(); List<String> keysToRemove = new ArrayList<>(); for (Map.Entry<String, Object> entry : thatContextMap.entrySet()) { Object entryValue = entry.getValue(); if (entryValue instanceof ServletRequest || entryValue instanceof ServletResponse) { keysToRemove.add(entry.getKey()); } } for (String keyToRemove : keysToRemove) { thatContextMap.remove(keyToRemove); } } return that; }
Source:
<code>public static ModelPlotConfig createRandomized() { <START> return new ModelPlotConfig(randomBoolean(), randomAlphaOfLengthBetween(1, 30), randomBoolean()); <END> }</code><technical_language>good a null case for annotationsEnabled</technical_language>

Target:
public static ModelPlotConfig createRandomized() { return new ModelPlotConfig(randomBoolean(), randomAlphaOfLengthBetween(1, 30), randomBoolean() ? randomBoolean() : null); }
Source:
<code>public void handshakeFailed(Handshaker handshaker, Throwable error) { SerialExecutor executor = serialExecutor; <START> if (executor != null && !executor.isShutdown()) { <END> try { executor.assertOwner(); } catch (ConcurrentModificationException ex) { LOGGER_OWNER.error("on handshake failed: connection {}", ex.getMessage(), ex); if (LOGGER_OWNER.isDebugEnabled()) { throw ex; } } } if (ongoingHandshake.compareAndSet(handshaker, null)) { startingClientHelloRandom = null; LOGGER.debug("Handshake with has failed", handshaker.getPeerAddress()); } }</code><technical_language>check is LOGGER_OWNER is ErrorEnabled ? (same for handshake complete)</technical_language>

Target:
public void handshakeFailed(Handshaker handshaker, Throwable error) { SerialExecutor executor = serialExecutor; if (executor != null && !executor.isShutdown() && LOGGER_OWNER.isErrorEnabled()) { try { executor.assertOwner(); } catch (ConcurrentModificationException ex) { LOGGER_OWNER.error("on handshake failed: connection {}", ex.getMessage(), ex); if (LOGGER_OWNER.isDebugEnabled()) { throw ex; } } } if (ongoingHandshake.compareAndSet(handshaker, null)) { startingClientHelloRandom = null; LOGGER.debug("Handshake with has failed", handshaker.getPeerAddress()); } }
Source:
<code>public RefundEntity build() { ChargeEntity chargeEntity = charge == null ? buildChargeEntity() : charge; <START> RefundEntity refundEntity = new RefundEntity(chargeEntity, amount, null); <END> refundEntity.setStatus(status); refundEntity.setReference(reference); return refundEntity; }</code><technical_language>Another case I want actual</technical_language>

Target:
public RefundEntity build() { ChargeEntity chargeEntity = charge == null ? buildChargeEntity() : charge; RefundEntity refundEntity = new RefundEntity(chargeEntity, amount, userExternalId); refundEntity.setStatus(status); refundEntity.setReference(reference); return refundEntity; }
Source:
<code>public void run() { try { if (!makeResourceWritable(provider.getShell())) { return; } } catch (CoreException e) { <START> MessageDialog.openWarning(provider.getShell(), <END> "Resource Not Accessible", e.getMessage()); return; } if (LaunchUtils.hasLaunchedTestCases()) { MessageDialog.openWarning(provider.getShell(), Messages.DeleteAction_ErrorDialogTitle, Messages.DeleteAction_ErrorDialogMsg); return; } if (containsOnlyTags(getStructuredSelection())) { run(new DeleteTagWizard(getSelectedTags()), provider.getShell()); } else { IResource[] resources = getSelectedResourcesArray(); if (containsQ7Elements(resources)) { run(new DeleteQ7ElementWizard(resources), provider.getShell()); } else { super.run(); } } }</code><technical_language>this help</technical_language>

Target:
public void run() { try { if (!makeResourceWritable(provider.getShell())) { return; } } catch (CoreException e) { Q7UIPlugin.log(e); return; } if (LaunchUtils.hasLaunchedTestCases()) { MessageDialog.openWarning(provider.getShell(), Messages.DeleteAction_ErrorDialogTitle, Messages.DeleteAction_ErrorDialogMsg); return; } if (containsOnlyTags(getStructuredSelection())) { run(new DeleteTagWizard(getSelectedTags()), provider.getShell()); } else { IResource[] resources = getSelectedResourcesArray(); if (containsQ7Elements(resources)) { run(new DeleteQ7ElementWizard(resources), provider.getShell()); } else { super.run(); } } }
Source:
<code>public void processLockAcquire() { log.debug("Process lock acquire event"); isLeader = true; fetchTopologyFromClusterManager(); <START> updateTopologyConfigId(topologyDescriptor.getTopologyConfigId()); <END> onLeadershipAcquire(); }</code><technical_language>updateTopologyConfigID is enough. While process a topology change event, discovery service more work refer processTopologyChangeNotification. While combining events topology change leadership change together, is a bit complex. suggest call fetchTopologyFromClusterManager. First, topology change is a notification API clusterManager. this call, fetch cached clusterManagerAdapter. Second, add more complexity completely solve problem</technical_language>

Target:
public void processLockAcquire() { log.debug("Process lock acquire event"); isLeader.set(true); onLeadershipAcquire(); }