auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean isItemAllowed(@Nonnull ItemStack item, @Nullable SlimefunItem itemAsSlimefunItem) { if (SlimefunTag.SHULKER_BOXES.isTagged(item.getType())) { return false; } if (SlimefunItem.getByID(getId()) instanceof HazmatBackpack && !(itemAsSlimefunItem instanceof Radioactive)) { return false; } <START> if (itemAsSlimefunItem instanceof Radioactive && !(SlimefunItem.getByID(getId()) instanceof HazmatBackpack)) { <END> return false; } return !(itemAsSlimefunItem instanceof SlimefunBackpack); }</code><technical_language>(SlimefunItem.getByID(getId()) WTF..</technical_language>

Target:
public boolean isItemAllowed(@Nonnull ItemStack item, @Nullable SlimefunItem itemAsSlimefunItem) { if (SlimefunTag.SHULKER_BOXES.isTagged(item.getType())) { return false; } if (this instanceof HazmatBackpack && !(itemAsSlimefunItem instanceof Radioactive)) { return false; } if (itemAsSlimefunItem instanceof Radioactive && !(this instanceof HazmatBackpack)) { return false; } return !(itemAsSlimefunItem instanceof SlimefunBackpack); }
Source:
<code>private boolean init(ChangeBoundsRequest request, GraphicalEditPart hostGraphicalEditPart) { List<?> editParts = request.getEditParts(); boolean isInLayoutingMode = isInLayoutingMode(hostGraphicalEditPart); for (Object editPart : editParts) { if (editPart instanceof DragAndDropWrapper) { DragAndDropWrapper dragAndDropWrapperToDrop = (DragAndDropWrapper) editPart; elementsFromEclipseViewToDrop.add(dragAndDropWrapperToDrop); } else if (editPart instanceof IGraphicalEditPart) { IGraphicalEditPart graphicalEditPartToDrop = (IGraphicalEditPart) editPart; if (!(graphicalEditPartToDrop.getParent() == hostGraphicalEditPart || hostGraphicalEditPart instanceof CompartmentEditPart && graphicalEditPartToDrop.getParent() == hostGraphicalEditPart.getParent()) && graphicalEditPartToDrop.resolveSemanticElement() instanceof DSemanticDecorator) { EObject elementFromDiagramToDrop = graphicalEditPartToDrop.resolveSemanticElement(); DDiagramElement dDiagramElementTopDrop = (DDiagramElement) elementFromDiagramToDrop; elementsFromDiagramToDrop.add(dDiagramElementTopDrop); editPartsFromDiagramToDrop.add(graphicalEditPartToDrop); if (isInLayoutingMode && (graphicalEditPartToDrop instanceof <START> IDiagramBorderNodeEditPart || graphicalEditPartToDrop instanceof INodeEditPart)) <END> { return false; } } } } return true; }</code><technical_language>IDiagramBorderNodeEditPart a candidate</technical_language>

Target:
private boolean init(ChangeBoundsRequest request, GraphicalEditPart hostGraphicalEditPart) { List<?> editParts = request.getEditParts(); boolean isInLayoutingMode = new EditPartQuery(hostGraphicalEditPart).isInLayoutingMode(); for (Object editPart : editParts) { if (editPart instanceof DragAndDropWrapper) { DragAndDropWrapper dragAndDropWrapperToDrop = (DragAndDropWrapper) editPart; elementsFromEclipseViewToDrop.add(dragAndDropWrapperToDrop); } else if (editPart instanceof IGraphicalEditPart) { IGraphicalEditPart graphicalEditPartToDrop = (IGraphicalEditPart) editPart; if (!(graphicalEditPartToDrop.getParent() == hostGraphicalEditPart || hostGraphicalEditPart instanceof CompartmentEditPart && graphicalEditPartToDrop.getParent() == hostGraphicalEditPart.getParent()) && graphicalEditPartToDrop.resolveSemanticElement() instanceof DSemanticDecorator) { EObject elementFromDiagramToDrop = graphicalEditPartToDrop.resolveSemanticElement(); DDiagramElement dDiagramElementTopDrop = (DDiagramElement) elementFromDiagramToDrop; elementsFromDiagramToDrop.add(dDiagramElementTopDrop); editPartsFromDiagramToDrop.add(graphicalEditPartToDrop); if (isInLayoutingMode && graphicalEditPartToDrop instanceof IAbstractDiagramNodeEditPart) { return false; } } } } return true; }
Source:
<code><START> public void verifyStatus(String expectedStatus) { <END> for (int i = 0; i < VERIFICATION_RETRY_COUNT; i++) { try { waitForElementVisibility(statusMessage); if (expectedStatus.equals(getStatus())) { break; } } catch (StaleElementReferenceException e) { } if (i == VERIFICATION_RETRY_COUNT - 1) { assertEquals(expectedStatus, getStatus()); break; } ThreadHelper.waitFor(VERIFICATION_RETRY_DELAY_IN_MS); } }</code><technical_language>I change void a FirstTimers issue. related this PR</technical_language>

Target:
public AppPage verifyStatus(String expectedStatus){ for (int i = 0; i < VERIFICATION_RETRY_COUNT; i++) { if (i == VERIFICATION_RETRY_COUNT - 1) { waitForElementVisibility(statusMessage); assertEquals(expectedStatus, getStatus()); break; } try { waitForElementVisibility(statusMessage); if (expectedStatus.equals(getStatus())) { break; } } catch (StaleElementReferenceException e) { } ThreadHelper.waitFor(VERIFICATION_RETRY_DELAY_IN_MS); } return this; }
Source:
<code>protected void init() { getNameTextField().setText(scanner.getName()); <START> <END> getConfigurationTextField().setText(scanner.getConf()); getConfigurationTextField().discardAllEdits(); getRequestUrlRegexTextField().setText(scanner.getRequestUrlRegex()); getRequestUrlRegexTextField().discardAllEdits(); getRequestHeaderRegexTextField().setText(scanner.getRequestHeaderRegex()); getRequestHeaderRegexTextField().discardAllEdits(); getResponseHeaderRegexTextField().setText(scanner.getResponseHeaderRegex()); getResponseHeaderRegexTextField().discardAllEdits(); getResponseBodyRegexTextField().setText(scanner.getResponseBodyRegex()); getResponseBodyRegexTextField().discardAllEdits(); getEnabledCheckBox().setSelected(scanner.isEnabled()); }</code><technical_language>call getNameTextField().discardAllEdits(); instead</technical_language>

Target:
protected void init() { getNameTextField().setText(scanner.getName()); getNameTextField().discardAllEdits(); getConfigurationTextField().setText(scanner.getConf()); getConfigurationTextField().discardAllEdits(); getRequestUrlRegexTextField().setText(scanner.getRequestUrlRegex()); getRequestUrlRegexTextField().discardAllEdits(); getRequestHeaderRegexTextField().setText(scanner.getRequestHeaderRegex()); getRequestHeaderRegexTextField().discardAllEdits(); getResponseHeaderRegexTextField().setText(scanner.getResponseHeaderRegex()); getResponseHeaderRegexTextField().discardAllEdits(); getResponseBodyRegexTextField().setText(scanner.getResponseBodyRegex()); getResponseBodyRegexTextField().discardAllEdits(); getEnabledCheckBox().setSelected(scanner.isEnabled()); }
Source:
<code>private void expandConcepts(ValueSet.ValueSetExpansionComponent theExpansionComponent, TermValueSet theTermValueSet, int theOffset, int theCount) { int conceptsExpanded = 0; int toIndex = theOffset + theCount; <START> Supplier<Slice<TermValueSetConcept>> loader = () -> myValueSetConceptDao.findByTermValueSetIdAndPreFetchDesignations(SearchCoordinatorSvcImpl.toPage(theOffset, toIndex), theTermValueSet.getId()); <END> Slice<TermValueSetConcept> slice = loader.get(); if (!slice.hasContent()) { logConceptsExpanded(theTermValueSet, conceptsExpanded); return; } for (TermValueSetConcept concept : slice.getContent()) { ValueSet.ValueSetExpansionContainsComponent containsComponent = theExpansionComponent.addContains(); containsComponent.setSystem(concept.getSystem()); containsComponent.setCode(concept.getCode()); containsComponent.setDisplay(concept.getDisplay()); expandDesignations(theTermValueSet, concept, containsComponent); if (++conceptsExpanded % 250 == 0) { logConceptsExpanded(theTermValueSet, conceptsExpanded); } } logConceptsExpanded(theTermValueSet, conceptsExpanded); }</code><technical_language>is this a lambda call next line? call a bit easier read</technical_language>

Target:
private void expandConcepts(ValueSet.ValueSetExpansionComponent theExpansionComponent, TermValueSet theTermValueSet, int theOffset, int theCount) { int conceptsExpanded = 0; int toIndex = theOffset + theCount; Slice<TermValueSetConcept> slice = myValueSetConceptDao.findByTermValueSetIdAndPreFetchDesignations(SearchCoordinatorSvcImpl.toPage(theOffset, toIndex), theTermValueSet.getId()); if (!slice.hasContent()) { logConceptsExpanded(theTermValueSet, conceptsExpanded); return; } for (TermValueSetConcept concept : slice.getContent()) { ValueSet.ValueSetExpansionContainsComponent containsComponent = theExpansionComponent.addContains(); containsComponent.setSystem(concept.getSystem()); containsComponent.setCode(concept.getCode()); containsComponent.setDisplay(concept.getDisplay()); expandDesignations(theTermValueSet, concept, containsComponent); if (++conceptsExpanded % 250 == 0) { logConceptsExpanded(theTermValueSet, conceptsExpanded); } } logConceptsExpanded(theTermValueSet, conceptsExpanded); }
Source:
<code>private void validateSupportedHostGroup(Cluster cluster, String requestHostGroup, AlertType alertType) { Set<String> supportedHostGroups = Optional.ofNullable( recommendationService.getAutoscaleRecommendations(cluster.getStackCrn())).map( recommendation -> { if (AlertType.LOAD.equals(alertType)) { return recommendation.getLoadBasedHostGroups(); } if (AlertType.TIME.equals(alertType)) { return recommendation.getTimeBasedHostGroups(); } return Set.of(""); }).orElse(Set.of("")); <START> if (!supportedHostGroups.contains(requestHostGroup)) { <END> throw new BadRequestException(messagesService.getMessage(MessageCode.UNSUPPORTED_AUTOSCALING_HOSTGROUP, List.of(requestHostGroup, alertType, cluster.getStackName(), supportedHostGroups))); } }</code><technical_language>This NPE if supported groups, correct</technical_language>

Target:
private void validateSupportedHostGroup(Cluster cluster, String requestHostGroup, AlertType alertType) { Set<String> supportedHostGroups = Optional.ofNullable( recommendationService.getAutoscaleRecommendations(cluster.getStackCrn())).map( recommendation -> { if (AlertType.LOAD.equals(alertType)) { return Optional.ofNullable(recommendation.getLoadBasedHostGroups()).orElse(Set.of()); } if (AlertType.TIME.equals(alertType)) { return Optional.ofNullable(recommendation.getTimeBasedHostGroups()).orElse(Set.of()); } return Set.of(""); }).orElse(Set.of("")); if (!supportedHostGroups.contains(requestHostGroup)) { throw new BadRequestException(messagesService.getMessage(MessageCode.UNSUPPORTED_AUTOSCALING_HOSTGROUP, List.of(requestHostGroup, alertType, cluster.getStackName(), supportedHostGroups))); } }
Source:
<code>public void testGetSlashValidSlashDotGitSlashHumanishName() { <START> String humanishName = URIish.getHumanishName("/abc/.git"); <END> assertEquals("abc", humanishName); }</code><technical_language>strange case of /abc//.git</technical_language>

Target:
public void testGetSlashValidSlashDotGitSlashHumanishName() throws IllegalArgumentException, URISyntaxException { String humanishName = new URIish("/abc/.git").getHumanishName(); assertEquals("abc", humanishName); }
Source:
<code>public boolean equals(Object o) { if(this == o) return true; if(o == null || getClass() != o.getClass()) return false; MCItemStack that = (MCItemStack) o; <START> return internal.equals(that.internal); <END> }</code><technical_language>Is this meant compare item stacks object equality, ItemStack override equals *or* hashCode</technical_language>

Target:
public boolean equals(Object o) { if(this == o) return true; if(o == null || getClass() != o.getClass()) return false; final ItemStack thatStack = ((MCItemStack) o).internal; final ItemStack thisStack = this.internal; if(thisStack.isEmpty()) { return thatStack.isEmpty(); } if(thisStack.getCount() != thatStack.getCount()) { return false; } if(!Objects.equals(thisStack.getItem(), thatStack.getItem())) { return false; } if(!Objects.equals(thisStack.getTag(), thatStack.getTag())) { return false; } return thisStack.areCapsCompatible(thatStack); }
Source:
<code><START> public PrefetchableAndPredicate( <END> Collection<? extends Predicate<ChangeData>> that) { super(that); }</code><technical_language>need public</technical_language>

Target:
PrefetchableAndPredicate( Collection<? extends Predicate<ChangeData>> that) { super(that); }
Source:
<code>public VariantSourceEntry convert(DBObject object) { <START> <END> BasicDBObject mongoGenotypes = (BasicDBObject) object.get(SAMPLES_FIELD); VariantSourceEntry fileWithSamples = new VariantSourceEntry(object.get(FILEID_FIELD).toString(), object.get(STUDYID_FIELD).toString()); for (Object gtToIndexesObj: mongoGenotypes.entrySet()) { Map.Entry<String, Object> gtToIndexes = (Map.Entry) gtToIndexesObj; if (gtToIndexes.getKey().equals("def")) { fileWithSamples = addGenotypeToVariantSourceEntry(fileWithSamples, "def", (String) gtToIndexes.getValue()); } else { String gtString = (String) gtToIndexes.getKey(); List<Integer> indexes = (List<Integer>) gtToIndexes.getValue(); for (Integer index : indexes) { fileWithSamples = addGenotypeToVariantSourceEntry(fileWithSamples, Integer.toString(index), gtString); } } } return fileWithSamples; }</code><technical_language>Remove blank line</technical_language>

Target:
public VariantSourceEntry convert(DBObject object) { BasicDBObject mongoGenotypes = (BasicDBObject) object.get(SAMPLES_FIELD); VariantSourceEntry fileWithSamples = new VariantSourceEntry(object.get(FILEID_FIELD).toString(), object.get(STUDYID_FIELD).toString()); for (Map.Entry<String, Object> gtToIndexes: mongoGenotypes.entrySet()) { String gtString = gtToIndexes.getKey(); if (gtString.equals("def")) { fileWithSamples = addGenotypeToVariantSourceEntry(fileWithSamples, "def", (String) gtToIndexes.getValue()); } else { List<Integer> indexes = (List<Integer>) gtToIndexes.getValue(); for (Integer index : indexes) { fileWithSamples = addGenotypeToVariantSourceEntry(fileWithSamples, Integer.toString(index), gtString); } } } return fileWithSamples; }
Source:
<code>public ResourceUtils(ClassLoader loader, Object contextObject, String contextMessage) { <START> } <END></code><technical_language>wrong; this constructor nothing</technical_language>

Target:
public ResourceUtils(ClassLoader loader, Object contextObject, String contextMessage) { this(new JavaBrooklynClassLoadingContext(null, loader), contextObject, contextMessage); }
Source:
<code>protected CheckoutCommand checkoutPaths() throws IOException, RefNotFoundException { RevWalk revWalk = new RevWalk(repo); DirCache dc = repo.lockDirCache(); <START> try { <END> TreeWalk treeWalk = new TreeWalk(revWalk.getObjectReader()); treeWalk.addTree(new DirCacheIterator(dc)); treeWalk.setFilter(PathFilterGroup.createFromStrings(paths)); List<String> files = new LinkedList<String>(); while (treeWalk.next()) files.add(treeWalk.getPathString()); if (startCommit != null || startPoint != null) { DirCacheEditor editor = dc.editor(); TreeWalk startWalk = new TreeWalk(revWalk.getObjectReader()); startWalk.setFilter(treeWalk.getFilter()); startWalk.addTree(revWalk.parseCommit(getStartPoint()) .getTree()); while (startWalk.next()) { final ObjectId blobId = startWalk.getObjectId(0); editor.add(new PathEdit(startWalk.getPathString()) { public void apply(DirCacheEntry ent) { ent.setObjectId(blobId); } }); } editor.commit(); } File workTree = repo.getWorkTree(); for (String file : files) DirCacheCheckout.checkoutEntry(repo, new File(workTree, file), dc.getEntry(file)); } finally { dc.unlock(); revWalk.release(); } return this; }</code><technical_language>lines of code purpose transfer folder paths list of contained files, right? some time for figure out, useful extract a method here</technical_language>

Target:
protected CheckoutCommand checkoutPaths() throws IOException, RefNotFoundException { RevWalk revWalk = new RevWalk(repo); DirCache dc = repo.lockDirCache(); try { TreeWalk treeWalk = new TreeWalk(revWalk.getObjectReader()); treeWalk.addTree(new DirCacheIterator(dc)); treeWalk.setFilter(PathFilterGroup.createFromStrings(paths)); List<String> files = new LinkedList<String>(); while (treeWalk.next()) if (treeWalk.isSubtree()) treeWalk.enterSubtree(); else files.add(treeWalk.getPathString()); if (startCommit != null || startPoint != null) { DirCacheEditor editor = dc.editor(); TreeWalk startWalk = new TreeWalk(revWalk.getObjectReader()); startWalk.setFilter(treeWalk.getFilter()); startWalk.addTree(revWalk.parseCommit(getStartPoint()) .getTree()); while (startWalk.next()) if (startWalk.isSubtree()) startWalk.enterSubtree(); else { final ObjectId blobId = startWalk.getObjectId(0); editor.add(new PathEdit(startWalk.getPathString()) { public void apply(DirCacheEntry ent) { ent.setObjectId(blobId); } }); } editor.commit(); } File workTree = repo.getWorkTree(); for (String file : files) DirCacheCheckout.checkoutEntry(repo, new File(workTree, file), dc.getEntry(file)); } finally { dc.unlock(); revWalk.release(); } return this; }
Source:
<code>public void setWidth(String width, boolean isFixedLayout) { table.setWidth("100%", true); <START> tableHeader.setWidth("100%", true); END> }</code><technical_language>Please pass 'isFixedLayout' 'setWidth' methods</technical_language>

Target:
public void setWidth(String width, boolean isFixedLayout) { table.setWidth("100%", isFixedLayout); tableHeader.setWidth("100%", isFixedLayout); }
Source:
<code>public static String getThreadId(final Thread thread) { <START> final Object id = THREAD_ID.get(thread) ; <END> if (id != null) { return (String)id ; } final String newId = getNextId() ; THREAD_ID.put(thread,newId) ; return newId ; }</code><technical_language>This is a String final String id = THREAD_ID.get(thread) ; need do cast next line</technical_language>

Target:
public static String getThreadId(final Thread thread) { final String id = THREAD_ID.get(thread) ; if (id != null) { return id ; } final String newId = getNextId() ; THREAD_ID.put(thread,newId) ; return newId ; }
Source:
<code>public ICPPEvaluation[] getAll() { <START> return new ICPPEvaluation[] {this.getEvaluation()}; <END> }</code><technical_language>"this" is redundant</technical_language>

Target:
public ICPPEvaluation[] getAll() { return new ICPPEvaluation[] { getEvaluation() }; }
Source:
<code>public static List<SCMHeadCategory> addUncategorizedIfMissing(List<SCMHeadCategory> categories) { for (SCMHeadCategory category : categories) { if (category.isUncategorized()) { return categories; } } <START> categories.add(new UncategorizedSCMHeadCategory()); <END> return categories; }</code><technical_language>this a constant</technical_language>

Target:
public static List<SCMHeadCategory> addUncategorizedIfMissing(List<SCMHeadCategory> categories) { for (SCMHeadCategory category : categories) { if (category.isUncategorized()) { return categories; } } categories.add(UncategorizedSCMHeadCategory.DEFAULT); return categories; }
Source:
<code>private void verifyHeadersForGetBlobNotModified(MockRestResponseChannel restResponseChannel) throws RestServiceException { Assert.assertNotNull("Date has not been set", restResponseChannel.getHeader(RestUtils.Headers.DATE)); <START> Assert.assertNull("Blob Size should have been null", restResponseChannel.getHeader(RestUtils.Headers.BLOB_SIZE)); <END> Assert.assertNull("Content Type should have been null", restResponseChannel.getHeader(RestUtils.Headers.CONTENT_TYPE)); Assert.assertNull("Expires should have been null", restResponseChannel.getHeader(RestUtils.Headers.EXPIRES)); Assert.assertNull("Cache control should have been null", restResponseChannel.getHeader(RestUtils.Headers.CACHE_CONTROL)); Assert.assertNull("Pragma should have been null", restResponseChannel.getHeader(RestUtils.Headers.PRAGMA)); Assert.assertEquals("Content length should have been 0", "0", restResponseChannel.getHeader(RestUtils.Headers.CONTENT_LENGTH)); }</code><technical_language>verifyAbsenceOfHeaders()</technical_language>

Target:
private void verifyHeadersForGetBlobNotModified(MockRestResponseChannel restResponseChannel) throws RestServiceException { Assert.assertNotNull("Date has not been set", restResponseChannel.getHeader(RestUtils.Headers.DATE)); Assert.assertEquals("Content length should have been 0", "0", restResponseChannel.getHeader(RestUtils.Headers.CONTENT_LENGTH)); verifyAbsenceOfHeaders(restResponseChannel, RestUtils.Headers.LAST_MODIFIED, RestUtils.Headers.BLOB_SIZE, RestUtils.Headers.CONTENT_TYPE, RestUtils.Headers.EXPIRES, RestUtils.Headers.CACHE_CONTROL, RestUtils.Headers.PRAGMA); }
Source:
<code>protected List<E> getSelectionFromWidget() { if (virtualManager != null) { return getVirtualSelection(); } Widget[] items = doGetSelection(); ArrayList<E> list = new ArrayList<E>(items.length); for (int i = 0; i < items.length; i++) { Widget item = items[i]; <START> E e = (E) item.getData(); <END> if (e != null) { list.add(e); } } return list; }</code><technical_language>this need a @SuppressWarnings("unchecked") ? I a couple of other places this</technical_language>

Target:
protected List<E> getSelectionFromWidget() { if (virtualManager != null) { return getVirtualSelection(); } Widget[] items = doGetSelection(); ArrayList<E> list = new ArrayList<E>(items.length); for (int i = 0; i < items.length; i++) { Widget item = items[i]; @SuppressWarnings("unchecked") E e = (E) item.getData(); if (e != null) { list.add(e); } } return list; }
Source:
<code>protected void fireTrigger(final ReplicationTrigger trigger) { Log.d(Log.TAG_SYNC, "%s [fireTrigger()] => " + trigger, this); <START> if (executor != null) { <END> synchronized (executor) { if (!executor.isShutdown()) { executor.submit(new Runnable() { @Override public void run() { try { Log.d(Log.TAG_SYNC, "firing trigger: %s", trigger); stateMachine.fire(trigger); } catch (Exception e) { Log.i(Log.TAG_SYNC, "Error in StateMachine.fire(trigger): %s", e.getMessage()); throw new RuntimeException(e); } } }); } } } }</code><technical_language>Need need check null, right</technical_language>

Target:
protected void fireTrigger(final ReplicationTrigger trigger) { Log.d(Log.TAG_SYNC, "%s [fireTrigger()] => " + trigger, this); synchronized (executor) { if (!executor.isShutdown()) { executor.submit(new Runnable() { @Override public void run() { try { Log.d(Log.TAG_SYNC, "firing trigger: %s", trigger); stateMachine.fire(trigger); } catch (Exception e) { Log.i(Log.TAG_SYNC, "Error in StateMachine.fire(trigger): %s", e.getMessage()); throw new RuntimeException(e); } } }); } } }
Source:
<code>public void close() throws InterruptedException { <START> close(false, false); <END> }</code><technical_language>parameter removed</technical_language>

Target:
public void close() throws InterruptedException { close(false); }
Source:
<code>private SqlTask( TaskId taskId, URI location, String nodeId, QueryContext queryContext, SqlTaskExecutionFactory sqlTaskExecutionFactory, ExchangeClientSupplier exchangeClientSupplier, ExecutorService taskNotificationExecutor, DataSize maxBufferSize) { this.taskId = requireNonNull(taskId, "taskId is null"); <START> this.taskInstanceUUID = UUID.randomUUID(); <END> this.taskInstanceId = taskInstanceUUID.toString(); this.location = requireNonNull(location, "location is null"); this.nodeId = requireNonNull(nodeId, "nodeId is null"); this.queryContext = requireNonNull(queryContext, "queryContext is null"); this.sqlTaskExecutionFactory = requireNonNull(sqlTaskExecutionFactory, "sqlTaskExecutionFactory is null"); requireNonNull(exchangeClientSupplier, "exchangeClientSupplier is null"); requireNonNull(taskNotificationExecutor, "taskNotificationExecutor is null"); requireNonNull(maxBufferSize, "maxBufferSize is null"); this.taskExchangeClientManager = new TaskExchangeClientManager(exchangeClientSupplier); outputBuffer = new LazyOutputBuffer( taskId, taskInstanceId, taskNotificationExecutor, maxBufferSize, () -> queryContext.getTaskContextByTaskId(taskId).localSystemMemoryContext()); taskStateMachine = new TaskStateMachine(taskId, taskNotificationExecutor); }</code><technical_language>a weird both. feels a single part (one long) enough entropy. simply switch a single long</technical_language>

Target:
private SqlTask( TaskId taskId, URI location, String nodeId, QueryContext queryContext, SqlTaskExecutionFactory sqlTaskExecutionFactory, ExchangeClientSupplier exchangeClientSupplier, ExecutorService taskNotificationExecutor, DataSize maxBufferSize) { this.taskId = requireNonNull(taskId, "taskId is null"); this.taskInstanceId = new TaskInstanceId(UUID.randomUUID()); this.location = requireNonNull(location, "location is null"); this.nodeId = requireNonNull(nodeId, "nodeId is null"); this.queryContext = requireNonNull(queryContext, "queryContext is null"); this.sqlTaskExecutionFactory = requireNonNull(sqlTaskExecutionFactory, "sqlTaskExecutionFactory is null"); requireNonNull(exchangeClientSupplier, "exchangeClientSupplier is null"); requireNonNull(taskNotificationExecutor, "taskNotificationExecutor is null"); requireNonNull(maxBufferSize, "maxBufferSize is null"); this.taskExchangeClientManager = new TaskExchangeClientManager(exchangeClientSupplier); outputBuffer = new LazyOutputBuffer( taskId, taskInstanceId.getUuidString(), taskNotificationExecutor, maxBufferSize, () -> queryContext.getTaskContextByTaskId(taskId).localSystemMemoryContext()); taskStateMachine = new TaskStateMachine(taskId, taskNotificationExecutor); }
Source:
<code>private GraphQLObjectType buildObjectType(BuildContext buildCtx, ObjectTypeDefinition typeDefinition) { GraphQLObjectType.Builder builder = GraphQLObjectType.newObject(); builder.name(typeDefinition.getName()); builder.description(buildDescription(typeDefinition)); Map<String, GraphQLFieldDefinition> fieldDefinitions = new LinkedHashMap<>(); typeDefinition.getFieldDefinitions().forEach(fieldDef -> { GraphQLFieldDefinition newFieldDefinition = buildField(buildCtx, typeDefinition, fieldDef); fieldDefinitions.put(newFieldDefinition.getName(), newFieldDefinition); }); List<TypeExtensionDefinition> typeExtensions = getTypeExtensionsOf(typeDefinition, buildCtx); typeExtensions.forEach(typeExt -> typeExt.getFieldDefinitions().forEach(fieldDef -> { GraphQLFieldDefinition newFieldDefinition = buildField(buildCtx, typeDefinition, fieldDef); if (!fieldDefinitions.containsKey(newFieldDefinition.getName())) { fieldDefinitions.put(newFieldDefinition.getName(), newFieldDefinition); } })); <START> for (GraphQLFieldDefinition fieldDefinition : fieldDefinitions.values()) { <END> builder.field(fieldDefinition); } Map<String, GraphQLInterfaceType> interfaces = new LinkedHashMap<>(); typeDefinition.getImplements().forEach(type -> { GraphQLInterfaceType newInterfaceType = buildOutputType(buildCtx, type); interfaces.put(newInterfaceType.getName(), newInterfaceType); }); typeExtensions.forEach(typeExt -> typeExt.getImplements().forEach(type -> { GraphQLInterfaceType interfaceType = buildOutputType(buildCtx, type); if (!interfaces.containsKey(interfaceType.getName())) { interfaces.put(interfaceType.getName(), interfaceType); } })); for (GraphQLInterfaceType anInterface : interfaces.values()) { builder.withInterface(anInterface); } return builder.build(); }</code><technical_language>a forEach consistent</technical_language>

Target:
private GraphQLObjectType buildObjectType(BuildContext buildCtx, ObjectTypeDefinition typeDefinition) { GraphQLObjectType.Builder builder = GraphQLObjectType.newObject(); builder.name(typeDefinition.getName()); builder.description(buildDescription(typeDefinition)); List<TypeExtensionDefinition> typeExtensions = getTypeExtensionsOf(typeDefinition, buildCtx); buildObjectTypeFields(buildCtx, typeDefinition, builder, typeExtensions); buildObjectTypeInterfaces(buildCtx, typeDefinition, builder, typeExtensions); return builder.build(); }
Source:
<code>public abstract String getText() throws IOException; <START> public abstract boolean readText(Writer writer) throws IOException; <END> public abstract char[] getTextCharacters() throws IOException; public abstract int getTextLength() throws IOException; public abstract int getTextOffset() throws IOException; public abstract boolean hasTextCharacters(); public abstract Number getNumberValue() throws IOException; public abstract NumberType getNumberType() throws IOException; public byte getByteValue() throws IOException { int value = getIntValue(); if (value < MIN_BYTE_I || value > MAX_BYTE_I) { throw _constructError("Numeric value ("+getText()+") out of range of Java byte"); } return (byte) value; }</code><technical_language>Please add @since 2.8 method introduced. Also, for compatibility, please this throw UnsupportedOperationException, existing non-json implementations fail load 2.8</technical_language>

Target:
public abstract String getText() throws IOException; public abstract int readText(Writer writer) throws IOException, UnsupportedOperationException; public abstract char[] getTextCharacters() throws IOException; public abstract int getTextLength() throws IOException; public abstract int getTextOffset() throws IOException; public abstract boolean hasTextCharacters(); public abstract Number getNumberValue() throws IOException; public abstract NumberType getNumberType() throws IOException; public byte getByteValue() throws IOException { int value = getIntValue(); if (value < MIN_BYTE_I || value > MAX_BYTE_I) { throw _constructError("Numeric value ("+getText()+") out of range of Java byte"); } return (byte) value; }
Source:
<code>public void sendQueueChunk(List<Song> chunk) throws RemoteException { <START> Preconditions.checkNotNull(mQueueTemp).addAll(chunk); <END> }</code><technical_language>Preconditions is in Dagger's internal package, kind of hesitant here. I do like: if (mQueueTemp == null) { throw new IllegalStateException("Must call beginBigQueue() start a transaction"); } mQueueTemp.addAll(chunk)</technical_language>

Target:
public void sendQueueChunk(List<Song> chunk) throws RemoteException { List<Song> queue = mQueueTemp; if (queue == null) { throw new IllegalStateException("Must call beginBigQueue() to start a transaction"); } queue.addAll(chunk); }
Source:
<code>public LocalWorkspaceDaoImpl(LocalStorageFactory factory) throws IOException { <START> final Map<Class<?>, Object> adapters = new HashMap<>(); <END> adapters.put(Recipe.class, new RecipeTypeAdapter()); adapters.put(ModuleConfig.class, new ModuleConfigAdapter()); this.localStorage = factory.create("workspaces.json", adapters); this.workspaces = new HashMap<>(); }</code><technical_language>is okay. note ImmutableMap.of values want. E.g java ImmutableMap.of(Recipe.class, new RecipeTypeAdapter(), ModuleConfig.class, new ModuleConfigAdapter());</technical_language>

Target:
public LocalWorkspaceDaoImpl(LocalStorageFactory factory) throws IOException { final Map<Class<?>, Object> adapters = ImmutableMap.of(Recipe.class, new RecipeTypeAdapter(), ModuleConfig.class, new ModuleConfigAdapter()); this.localStorage = factory.create("workspaces.json", adapters); this.workspaces = new HashMap<>(); }
Source:
<code>private void startStatusLogging() { <START> final int healthStatusInterval = config.getInt(NetworkConfig.Keys.HEALTH_STATUS_INTERVAL, 0); END> if (healthStatusInterval > 0 && HEALTH_LOGGER.isDebugEnabled()) { this.scheduler = Executors .newSingleThreadScheduledExecutor(new DaemonThreadFactory("MessageExchangeStore")); statusLogger = scheduler.scheduleAtFixedRate(new Runnable() { @Override public void run() { if (enableStatus) { dump(5); } } }, healthStatusInterval, healthStatusInterval, TimeUnit.SECONDS); } }</code><technical_language>I prefer add 0 NetworkConfigDefaults field field in places, default is intended</technical_language>

Target:
private void startStatusLogging() { final int healthStatusInterval = config.getInt(NetworkConfig.Keys.HEALTH_STATUS_INTERVAL, NetworkConfigDefaults.DEFAULT_HEALTH_STATUS_INTERVAL); if (healthStatusInterval > 0 && HEALTH_LOGGER.isDebugEnabled()) { this.scheduler = Executors .newSingleThreadScheduledExecutor(new DaemonThreadFactory("MessageExchangeStore")); statusLogger = scheduler.scheduleAtFixedRate(new Runnable() { @Override public void run() { if (enableStatus) { dump(5); } } }, healthStatusInterval, healthStatusInterval, TimeUnit.SECONDS); } }
Source:
<code>public ServletRegistration.Dynamic addServlet(String name, Servlet servlet) { final ServletHolder holder = new NonblockingServletHolder(checkNotNull(servlet)); holder.setName(name); handler.getServletHandler().addServlet(holder); <START> ServletRegistration.Dynamic registration = holder.getRegistration(); <END> if(servlets.contains(name)) { LOGGER.warn("Overriding the existing servlet registered with name: {}", name); } servlets.add(name); return registration; }</code><technical_language>This a minor pick code duplication, a private method takes a Set key, this check, warn, add. in places</technical_language>

Target:
public ServletRegistration.Dynamic addServlet(String name, Servlet servlet) { final ServletHolder holder = new NonblockingServletHolder(checkNotNull(servlet)); holder.setName(name); handler.getServletHandler().addServlet(holder); ServletRegistration.Dynamic registration = holder.getRegistration(); checkDuplicateRegistration(name, servlets, "servlet"); return registration; }
Source:
<code>public Object eval(Object[] args, EvaluationContext ec) { if (entitySelectActivity != null && !entitySelectActivity.containsHereFunction) { refreshLocation(); allowGpsUse(); <START> entitySelectActivity.containsHereFunction = true; <END> } if (location == null) { return ""; } return location.getDisplayText(); }</code><technical_language>is generally bad form in Java land modify fields of another class directly. do this getters setters. While this introduces boilerplate, for more extensible code: want synchronize setters threads, want cache computations invalidate a setter is called, etc. importantly, this is convention: readers of code expect for class field mutations occur of class, for understand code</technical_language>

Target:
public Object eval(Object[] args, EvaluationContext ec) { if (entitySelectActivity != null && !entitySelectActivity.getContainsHereFunction()) { refreshLocation(); allowGpsUse(); entitySelectActivity.setContainsHereFunction(true); } if (location == null) { return ""; } return location.getDisplayText(); }
Source:
<code>protected List<Row> getRowsToUpdate() { final DataContext dc = _updateCallback.getDataContext(); final Table table = getTable(); final List<FilterItem> whereItems = getWhereItems(); final DataSet dataSet = dc.query() .from(table) <START> .select(table.getColumns().toArray(new Column[table.getColumns().size()])) <END> .where(whereItems).execute(); final List<Row> rows = dataSet.toRows(); return rows; }</code><technical_language>This is a bit of a shame. good avoid extra toArray()? added overriden method Query same, I missing here</technical_language>

Target:
protected List<Row> getRowsToUpdate() { final DataContext dc = _updateCallback.getDataContext(); final Table table = getTable(); final List<FilterItem> whereItems = getWhereItems(); final DataSet dataSet = dc.query() .from(table) .select(table.getColumns()) .where(whereItems).execute(); final List<Row> rows = dataSet.toRows(); return rows; }
Source:
<code>public void addAll(SerializableStatus status) { Assert.isLegal(status != null); SerializableStatus[] statuses = (SerializableStatus[]) status.getChildren(); for (SerializableStatus <START> statuse : <END> statuses) { add(statuse); } }</code><technical_language>rename s</technical_language>

Target:
public void addAll(SerializableStatus status) { Assert.isLegal(status != null); SerializableStatus[] statuses = (SerializableStatus[]) status.getChildren(); for (SerializableStatus s : statuses) { add(s); } }
Source:
<code>private void returnToSyncStateFromOperationHistory() { IProgressMonitor pm = new NullProgressMonitor(); try { IOperationHistory operationHistory = OperationHistoryFactory.getOperationHistory(); IUndoContext undoCtx = getUndoContext(); while (operationHistory != null && operationHistory.canUndo(undoCtx) && session.getStatus() != SessionStatus.SYNC) { IUndoableOperation toUndo = operationHistory.getUndoOperation(undoCtx); operationHistory.undoOperation(toUndo, new NullProgressMonitor(), null); if (marker == toUndo) { break; } } setResourcesBackToSync(); } catch (ExecutionException e) { reloadTheResources(); String sessionLabel = SiriusEditPlugin.getPlugin().getUiCallback().getSessionNameToDisplayWhileSaving(session); <START> SiriusPlugin.getDefault().warning("the session <END> " + sessionLabel + " modified resource(s) have(has) been reloaded. An error occurs while attempting to cancel all modifications.", e); } }</code><technical_language>org.eclipse.sirius.ui.tools.api.command.AbstractSWTCallback.getSessionNameToDisplayWhileSaving(Session) for default label. .warning("the session " + sessionLabel + " (like deletion of this class) sufficient message. replace 'the' 'The'</technical_language>

Target:
private void returnToSyncStateFromOperationHistory() { IProgressMonitor pm = new NullProgressMonitor(); try { IOperationHistory operationHistory = OperationHistoryFactory.getOperationHistory(); IUndoContext undoCtx = getUndoContext(); while (operationHistory != null && operationHistory.canUndo(undoCtx) && session.getStatus() != SessionStatus.SYNC) { IUndoableOperation toUndo = operationHistory.getUndoOperation(undoCtx); operationHistory.undoOperation(toUndo, new NullProgressMonitor(), null); if (marker == toUndo) { break; } } setResourcesBackToSync(); } catch (ExecutionException e) { reloadTheResources(); String sessionLabel = SiriusEditPlugin.getPlugin().getUiCallback().getSessionNameToDisplayWhileSaving(session); SiriusPlugin.getDefault().warning(sessionLabel + " modified resources were reloaded. An error occurs while attempting to cancel all modifications.", e); } }
Source:
<code><START> public static List<ParameterSignature> signatures(Method method) { <END> return signatures(method.getParameterTypes(), method .getParameterAnnotations()); }</code><technical_language>This change break people</technical_language>

Target:
public static ArrayList<ParameterSignature> signatures(Method method) { return signatures(method.getParameterTypes(), method .getParameterAnnotations()); }
Source:
<code>private static DescriptorProtos.FieldDescriptorProto.Type pigTypeToProtoType(byte pigTypeId) { switch(pigTypeId) { case DataType.BOOLEAN: return DescriptorProtos.FieldDescriptorProto.Type.TYPE_BOOL; case DataType.INTEGER: return DescriptorProtos.FieldDescriptorProto.Type.TYPE_INT32; case DataType.LONG: return DescriptorProtos.FieldDescriptorProto.Type.TYPE_INT64; case DataType.FLOAT: return DescriptorProtos.FieldDescriptorProto.Type.TYPE_FLOAT; case DataType.DOUBLE: return DescriptorProtos.FieldDescriptorProto.Type.TYPE_DOUBLE; case DataType.CHARARRAY: return DescriptorProtos.FieldDescriptorProto.Type.TYPE_STRING; case DataType.BYTEARRAY: return DescriptorProtos.FieldDescriptorProto.Type.TYPE_BYTES; default: <START> throw new IllegalArgumentException("Unexpected Pig type where a simple type is expected : " + pigTypeId); <END> } }</code><technical_language>add "while generating dynamic Protobuf" is clear stacktrace. btw, of code support nested structs lists is in this patch (of course, is needed yet, find some for in future)</technical_language>

Target:
private static Type pigTypeToProtoType(byte pigTypeId) { switch(pigTypeId) { case DataType.BOOLEAN: return Type.TYPE_BOOL; case DataType.INTEGER: return Type.TYPE_INT32; case DataType.LONG: return Type.TYPE_INT64; case DataType.FLOAT: return Type.TYPE_FLOAT; case DataType.DOUBLE: return Type.TYPE_DOUBLE; case DataType.CHARARRAY: return Type.TYPE_STRING; case DataType.BYTEARRAY: return Type.TYPE_BYTES; default: throw new IllegalArgumentException("Unsupported Pig type passed (" + pigTypeId + ") where a simple type is expected while converting Pig to a dynamic Protobuf"); } }
Source:
<code>public TrieNodeImpl put(String path, EntryPoint e) { <START> LOG.info("Entrie.put(" + path + ")"); <END> if (path.startsWith("/")) path = path.substring(1); if (path.length() == 0) { return new TrieNodeImpl(children, Optional.of(e), pathMappings); } String[] elements = path.split("/"); TrieNode existing = children.getOrDefault(elements[0], TrieNodeImpl.empty()); TrieNode newChild = existing.put(path.substring(elements[0].length()), e); HashMap<String, TrieNode> newChildren = new HashMap<>(children); newChildren.put(elements[0], newChild); return new TrieNodeImpl(newChildren, value, pathMappings); }</code><technical_language>This debug? Similarly for other log statements this in this class</technical_language>

Target:
public TrieNodeImpl put(String path, EntryPoint e) { LOG.info("Entrie.put(" + path + ")"); path = TrieNode.canonicalise(path); if (path.length() == 0) { return new TrieNodeImpl(children, Optional.of(e)); } String[] elements = path.split("/"); TrieNode existing = children.getOrDefault(elements[0], TrieNodeImpl.empty()); TrieNode newChild = existing.put(path.substring(elements[0].length()), e); HashMap<String, TrieNode> newChildren = new HashMap<>(children); newChildren.put(elements[0], newChild); return new TrieNodeImpl(newChildren, value); }
Source:
<code>private void updatePartitionDataFromKafka() { <START> List<PartitionInfo> partitions = consumer.partitionsFor(ioConfig.getTopic()); <END> if (partitions == null) { log.warn("No such topic [%s] found", ioConfig.getTopic()); } int numPartitions = (partitions != null ? partitions.size() : 0); log.debug("Found [%d] Kafka partitions for topic [%s]", numPartitions, ioConfig.getTopic()); for (int partition = 0; partition < numPartitions; partition++) { int taskGroupId = getTaskGroupIdForPartition(partition); ConcurrentHashMap<Integer, Long> partitionMap = partitionGroups.computeIfAbsent( taskGroupId, k -> new ConcurrentHashMap<>() ); if (partitionMap.putIfAbsent(partition, NOT_SET) == null) { log.info( "New partition [%d] discovered for topic [%s], added to task group [%d]", partition, ioConfig.getTopic(), taskGroupId ); } } }</code><technical_language>lock exception handling get removed? lock needed, checking docs partitionsFor throw a handful of exceptions too: Throws: WakeupException - if wakeup() is called while this function is called InterruptException - if calling thread is interrupted while this function is called AuthorizationException - if authorized topic TimeoutException - if topic metadata fetched expiration of configured request timeout KafkaException - for other unrecoverable errors</technical_language>

Target:
private void updatePartitionDataFromKafka() { List<PartitionInfo> partitions; try { synchronized (consumerLock) { partitions = consumer.partitionsFor(ioConfig.getTopic()); } } catch (Exception e) { log.warn( e, "Unable to get partition data from Kafka for brokers [%s], are the brokers up?", ioConfig.getConsumerProperties().get(KafkaSupervisorIOConfig.BOOTSTRAP_SERVERS_KEY) ); return; } int numPartitions = (partitions != null ? partitions.size() : 0); log.debug("Found [%d] Kafka partitions for topic [%s]", numPartitions, ioConfig.getTopic()); for (int partition = 0; partition < numPartitions; partition++) { int taskGroupId = getTaskGroupIdForPartition(partition); ConcurrentHashMap<Integer, Long> partitionMap = partitionGroups.computeIfAbsent( taskGroupId, k -> new ConcurrentHashMap<>() ); if (partitionMap.putIfAbsent(partition, NOT_SET) == null) { log.info( "New partition [%d] discovered for topic [%s], added to task group [%d]", partition, ioConfig.getTopic(), taskGroupId ); } } }
Source:
<code>public void testGetFieldsSimpleBooleanJson() throws IOException { ObjectMapper mapper = new ObjectMapper(); JsonNode jsonNode = mapper.readTree(simpleBooleanJson); List<Schema.Field> fields = jsonSchemaInferrer.getFields(jsonNode); <START> assertEquals(2, fields.size()); <END> Schema.Field fieldA = fields.get(0); assertEquals("a", fieldA.name()); assertEquals("record", fieldA.schema().getType().getName()); List<Schema.Field> fieldATypeFields = fieldA.schema().getFields(); Schema.Field fieldB = fieldATypeFields.get(0); assertEquals("b", fieldB.name()); Schema.Type fieldBType = fieldB.schema().getType(); assertEquals("union", fieldBType.getName()); List<Schema> fieldSchemaBTypeItems = fieldB.schema().getTypes(); assertEquals("boolean", fieldSchemaBTypeItems.get(0).getName()); assertEquals("null", fieldSchemaBTypeItems.get(1).getName()); Schema.Field fieldD = fields.get(1); assertEquals("d", fieldD.name()); Schema.Type fieldDType = fieldD.schema().getType(); assertEquals("union", fieldDType.getName()); List<Schema> fieldSchemaDTypeItems = fieldD.schema().getTypes(); assertEquals("boolean", fieldSchemaDTypeItems.get(0).getName()); assertEquals("null", fieldSchemaDTypeItems.get(1).getName()); }</code><technical_language>I recommend hamcrest matchers here. special syntax, a test easier read: assertThat(fieldList, hasSize(2)); In case more simple asserts assertEquals, assertTrue, is recommended standard JUnit asserts</technical_language>

Target:
public void testGetFieldsSimpleBooleanJson() throws IOException { ObjectMapper mapper = new ObjectMapper(); JsonNode jsonNode = mapper.readTree(simpleBooleanJson); List<Schema.Field> fieldList = jsonSchemaInferrer.getFields(jsonNode); assertThat(fieldList, hasSize(2)); Schema.Field fieldA = fieldList.get(0); assertThat(fieldA.name(), is(equalTo("a"))); assertThat(fieldA.schema().getType().getName(), is(equalTo("record"))); List<Schema.Field> fieldATypeFields = fieldA.schema().getFields(); Schema.Field fieldB = fieldATypeFields.get(0); assertThat(fieldB.name(), is(equalTo("b"))); Schema.Type fieldBType = fieldB.schema().getType(); assertThat(fieldBType.getName(), is(equalTo("union"))); List<Schema> fieldSchemaBTypeItems = fieldB.schema().getTypes(); assertThat(fieldSchemaBTypeItems.get(0).getName(), is(equalTo("boolean"))); assertThat(fieldSchemaBTypeItems.get(1).getName(), is(equalTo("null"))); Schema.Field fieldD = fieldList.get(1); assertThat(fieldD.name(), is(equalTo("d"))); Schema.Type fieldDType = fieldD.schema().getType(); assertThat(fieldDType.getName(), is(equalTo("union"))); List<Schema> fieldSchemaDTypeItems = fieldD.schema().getTypes(); assertThat(fieldSchemaDTypeItems.get(0).getName(), is(equalTo("boolean"))); assertThat(fieldSchemaDTypeItems.get(1).getName(), is(equalTo("null"))); }
Source:
<code>public boolean isAsync() { <START> return false; <END> }</code><technical_language>this return true</technical_language>

Target:
public boolean isAsync() { return true; }
Source:
<code>public void configure(ServerSideConfiguration config) throws ClusteredTierManagerConfigurationException { try { invokeInternal(messageFactory.configureStoreManager(config), true); <START> } catch (ClusteredClientException e) { <END> throw new ClusteredTierManagerConfigurationException("Error configuring clustered tier manager", e.getCause()); } }</code><technical_language>This is wrong - end wrapping a server exception in a client exception unwrap immediately rewrap throwing</technical_language>

Target:
public void configure(ServerSideConfiguration config) throws ClusteredTierManagerConfigurationException, TimeoutException { try { invokeInternal(timeouts.getLifecycleOperationTimeout(), messageFactory.configureStoreManager(config), true); } catch (ClusterException e) { throw new ClusteredTierManagerConfigurationException("Error configuring clustered tier manager", e); } }
Source:
<code>public void close() { if (ROOT_LOGGER.isTraceEnabled()) { ROOT_LOGGER.tracef("stop second level cache by removing dependency on service '%s'", this.controller.getName().getCanonicalName()); } final UninterruptibleCountDownLatch latch = new UninterruptibleCountDownLatch(1); controller.addListener(new LifecycleListener() { @Override public void handleEvent(final ServiceController<?> controller, final LifecycleEvent event) { if (event == LifecycleEvent.REMOVED) latch.countDown(); } }); controller.setMode(ServiceController.Mode.REMOVE); <START> latch.awaitUninterruptibly(); <END> }</code><technical_language>ignore interrupts here</technical_language>

Target:
public void close() { if (ROOT_LOGGER.isTraceEnabled()) { ROOT_LOGGER.tracef("stop second level cache by removing dependency on service '%s'", this.controller.getName().getCanonicalName()); } final CountDownLatch latch = new CountDownLatch(1); controller.addListener(new LifecycleListener() { @Override public void handleEvent(final ServiceController<?> controller, final LifecycleEvent event) { if (event == LifecycleEvent.REMOVED) latch.countDown(); } }); controller.setMode(ServiceController.Mode.REMOVE); try { latch.await(); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); } }