auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void applyLocalVariableQualifierParameterDefaults( Element elt, AnnotatedTypeMirror type) { if (elt.getKind() != ElementKind.LOCAL_VARIABLE || getQualifierParameterHierarchies(type).isEmpty() || variablesUnderInitialization.contains(elt)) { return; } Tree declTree = declarationFromElement(elt); if (declTree == null || declTree.getKind() != Kind.VARIABLE) { return; } ExpressionTree initializer = ((VariableTree) declTree).getInitializer(); if (initializer == null) { return; } variablesUnderInitialization.add(elt); AnnotatedTypeMirror initializerType; if (shouldCache && initializerCache.containsKey(initializer)) { initializerType = initializerCache.get(initializer); } else { boolean oldUseFlow = useFlow; useFlow = everUseFlow; <START> initializerType = getAnnotatedType(initializer); <END> useFlow = oldUseFlow; } Set<AnnotationMirror> qualParamTypes = AnnotationUtils.createAnnotationSet(); for (AnnotationMirror initializerAnnotation : initializerType.getAnnotations()) { if (hasQualifierParameterInHierarchy( type, qualHierarchy.getTopAnnotation(initializerAnnotation))) { qualParamTypes.add(initializerAnnotation); } } type.addMissingAnnotations(qualParamTypes); variablesUnderInitialization.remove(elt); if (shouldCache) { initializerCache.put(initializer, initializerType); } }</code><technical_language>careful put code in try/finally blocks, ensure pre-state is restored if is error</technical_language>

Target:
private void applyLocalVariableQualifierParameterDefaults( Element elt, AnnotatedTypeMirror type) { if (elt.getKind() != ElementKind.LOCAL_VARIABLE || getQualifierParameterHierarchies(type).isEmpty() || variablesUnderInitialization.contains(elt)) { return; } Tree declTree = declarationFromElement(elt); if (declTree == null || declTree.getKind() != Kind.VARIABLE) { return; } ExpressionTree initializer = ((VariableTree) declTree).getInitializer(); if (initializer == null) { return; } VariableElement variableElt = (VariableElement) elt; variablesUnderInitialization.add(variableElt); AnnotatedTypeMirror initializerType; if (shouldCache && initializerCache.containsKey(initializer)) { initializerType = initializerCache.get(initializer); } else { boolean oldUseFlow = useFlow; useFlow = everUseFlow; try { initializerType = getAnnotatedType(initializer); } finally { useFlow = oldUseFlow; } } Set<AnnotationMirror> qualParamTypes = AnnotationUtils.createAnnotationSet(); for (AnnotationMirror initializerAnnotation : initializerType.getAnnotations()) { if (hasQualifierParameterInHierarchy( type, qualHierarchy.getTopAnnotation(initializerAnnotation))) { qualParamTypes.add(initializerAnnotation); } } type.addMissingAnnotations(qualParamTypes); variablesUnderInitialization.remove(variableElt); if (shouldCache) { initializerCache.put(initializer, initializerType); } }
Source:
<code>private String startedStateString(final int state) { switch (state) { case NOT_STARTED : return "NOT_STARTED"; case STARTING : return "STARTING"; case STARTED : return "STARTED"; } <START> return "UNKNOWN"; <END> }</code><technical_language>Consider throwing instead of returning UNKNOWN. encourages this list correct times. :-)</technical_language>

Target:
private String startedStateString(final int state) { switch (state) { case NOT_STARTED : return "NOT_STARTED"; case STARTING : return "STARTING"; case STARTED : return "STARTED"; } throw new IllegalArgumentException("Unknown state"); }
Source:
<code>public void save(String id) { context.saveStyle(); HashMap<String, String> map = new HashMap<>(); <START> Optional.ofNullable(id).ifPresent(node -> map.put(DEFAULT_NODE_ID, id)); <END> context.addAttributes(map); }</code><technical_language>Dtto</technical_language>

Target:
public void save(String id) { context.saveStyle(); HashMap<String, String> map = new HashMap<>(); if (id != null) { map.put(DEFAULT_NODE_ID, id); } context.addAttributes(map); }
Source:
<code>private void addSelfToCC(List<TaskAttribute> attributes) { TaskRepository repository = this.getTaskEditorPage().getTaskRepository(); if (repository.getUserName() == null) { return; } TaskAttribute root = getTaskData().getRoot(); TaskAttribute owner = root.getMappedAttribute(TaskAttribute.USER_ASSIGNED); if (owner != null && owner.getValue().indexOf(repository.getUserName()) != -1) { return; } TaskAttribute reporter = root.getMappedAttribute(TaskAttribute.USER_REPORTER); <START> if (reporter != null && reporter.getValue().indexOf(repository.getUserName()) != -1) { <END> return; } TaskAttribute ccAttribute = root.getMappedAttribute(TaskAttribute.USER_CC); if (ccAttribute != null && ccAttribute.getValues().contains(repository.getUserName())) { return; } TaskAttribute attrAddToCC = getTaskData().getRoot().getMappedAttribute(TaskAttribute.ADD_SELF_CC); if (attrAddToCC == null) { attrAddToCC = getTaskData().getRoot().createMappedAttribute(TaskAttribute.ADD_SELF_CC); } attributes.add(attrAddToCC); }</code><technical_language>weird this a direct equals, if signed in frank, frank2 is reporter I able add CC</technical_language>

Target:
private void addSelfToCC(List<TaskAttribute> attributes) { if (getTaskData().isNew()) { return; } TaskRepository repository = this.getTaskEditorPage().getTaskRepository(); if (repository.getUserName() == null) { return; } TaskAttribute root = getTaskData().getRoot(); TaskAttribute owner = root.getMappedAttribute(TaskAttribute.USER_ASSIGNED); if (owner != null && owner.getValue().indexOf(repository.getUserName()) != -1) { return; } TaskAttribute reporter = root.getMappedAttribute(TaskAttribute.USER_REPORTER); if (reporter != null && reporter.getValue().indexOf(repository.getUserName()) != -1) { return; } TaskAttribute ccAttribute = root.getMappedAttribute(TaskAttribute.USER_CC); if (ccAttribute != null && ccAttribute.getValues().contains(repository.getUserName())) { return; } TaskAttribute attrAddToCC = getTaskData().getRoot().getMappedAttribute(TaskAttribute.ADD_SELF_CC); if (attrAddToCC == null) { attrAddToCC = getTaskData().getRoot().createMappedAttribute(TaskAttribute.ADD_SELF_CC); } attributes.add(attrAddToCC); }
Source:
<code>public void test16ThreadsRateLimit20() throws ExecutionException, InterruptedException { Meter rate = new Meter(); List<ListenableFuture<?>> tasks = createWorkers(rate, 16, 20, Duration.ofMillis(100)) .map(executorService::submit) .collect(Collectors.toList()); ListenableFuture<?> task = Futures.allAsList(tasks); while (!task.isDone()) { sleep(1000); <START> log.info("Average rate is {}, 1 minute rate is {}", rate.getMeanRate(), rate.getOneMinuteRate()); <END> } task.get(); }</code><technical_language>assertThat(rate.getMeanRate()).isBetween(19, 21)? values expected some sort of broad assertion reasonable</technical_language>

Target:
public void test16ThreadsRateLimit20() throws ExecutionException, InterruptedException { Meter rate = new Meter(); Histogram avgRetries = new Histogram(new ExponentiallyDecayingReservoir()); int rateLimit = 20; List<ListenableFuture<?>> tasks = createWorkers(rate, avgRetries, 16, rateLimit, Duration.ofMillis(50)) .map(executorService::submit) .collect(Collectors.toList()); ListenableFuture<?> task = Futures.allAsList(tasks); Instant start = Instant.now(); while (!task.isDone()) { sleep(1000); log.info("Average rate is {}, 1 minute rate is {}", rate.getMeanRate(), rate.getOneMinuteRate()); log.info("Average number of retries is {}, max is {}", avgRetries.getSnapshot().getMean(), avgRetries.getSnapshot().getMax()); if (Duration.between(start, Instant.now()).compareTo(GRACE) > 0) { assertThat(rate.getMeanRate()).isGreaterThan(0.75 * rateLimit); } } task.get(); }
Source:
<code>public void before(){ browser.navigate().refresh(); Graphene.goTo(WebServiceEndpointsPage.class); <START> browser.manage().window().maximize(); <END> Console.withBrowser(browser).waitUntilLoaded(); }</code><technical_language>consider org.jboss.hal.testsuite.util.Console.maximizeWindow() instead</technical_language>

Target:
public void before(){ browser.navigate().refresh(); Graphene.goTo(WebServiceEndpointsPage.class); Console.withBrowser(browser).maximizeWindow().waitUntilLoaded(); }
Source:
<code>private List<TypeSpec> getSubTypes() { ArrayList<TypeSpec> results = new ArrayList(); <START> results.add(getSharedTriggers()); <END> results.add(getNullSharedTriggers(sharedTriggersType)); return results; }</code><technical_language>Lets maintain original ordering of fields: defaultNamespace, sharedTriggers, namespace. for constructors etc. diff smaller for generated schemas</technical_language>

Target:
private List<TypeSpec> getSubTypes() { ArrayList<TypeSpec> results = new ArrayList<>(); results.add(getSharedTriggers()); results.add(getNullSharedTriggers(sharedTriggersType)); return results; }
Source:
<code>private boolean setSealedReplicas(List<String> sealedReplicas) { InstanceConfig instanceConfig = helixAdmin.getInstanceConfig(clusterName, instanceName); if (instanceConfig == null) { throw new IllegalStateException( "No instance config found for cluster: \"" + clusterName + "\", instance: \"" + instanceName + "\""); } <START> logger.trace("Setting InstanceConfig with list of sealed replicas: {}", Arrays.toString(sealedReplicas.toArray())); <END> instanceConfig.getRecord().setListField(ClusterMapUtils.SEALED_STR, sealedReplicas); return helixAdmin.setInstanceConfig(clusterName, instanceName, instanceConfig); }</code><technical_language>need Arrays.toString(sealedReplicas.toArray())</technical_language>

Target:
private boolean setSealedReplicas(List<String> sealedReplicas) { InstanceConfig instanceConfig = helixAdmin.getInstanceConfig(clusterName, instanceName); if (instanceConfig == null) { throw new IllegalStateException( "No instance config found for cluster: \"" + clusterName + "\", instance: \"" + instanceName + "\""); } logger.trace("Setting InstanceConfig with list of sealed replicas: {}", sealedReplicas.toArray()); instanceConfig.getRecord().setListField(ClusterMapUtils.SEALED_STR, sealedReplicas); return helixAdmin.setInstanceConfig(clusterName, instanceName, instanceConfig); }
Source:
<code>public synchronized PageCursor openCursor( long pageId, PagedIndexInput owner ) throws IOException { assert owner.cursor == null : String.format( "Multiple cursors opened for the same input: %s", owner ); <START> if ( clones == null ) <END> { throw new IOException( "This index has been closed, cannot open more inputs" ); } PageCursor cursor = pagedFile.io( pageId, PagedFile.PF_SHARED_READ_LOCK ); if ( owner.resources != this ) { clones.add( owner ); } return cursor; }</code><technical_language>please introduce a boolean flag for future readers of this class explain a closed flag do side effects check a state, list of cursors is null while working this input</technical_language>

Target:
public PageCursor openCursor( long pageId, PagedIndexInput owner ) throws IOException { assert owner.cursor == null : String.format( "Multiple cursors opened for the same input: %s", owner ); if ( closed ) { throw new IOException( "This index has been closed, cannot open more inputs" ); } return pagedFile.io( pageId, PagedFile.PF_SHARED_READ_LOCK ); }
Source:
<code>public boolean updateConfiguration(File file) <START> throws IOException, SAXException, ParserConfigurationException, TransformerException, <END> XMLStreamException, ServletException { boolean success = false; DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = factory.newDocumentBuilder(); if (file.exists()) { Document doc = docBuilder.parse(file); String fileContent = getStringFromDocument(doc); success = configServiceAdminStub.updateConfiguration(createOMElement(fileContent)); } return success; }</code><technical_language>please introduce custom exception throwing set of exceptions</technical_language>

Target:
public boolean updateConfiguration(File file) throws IOException, SAXException, ParserConfigurationException, TransformerException, XMLStreamException { boolean success = false; DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = factory.newDocumentBuilder(); if (file.exists()) { Document doc = docBuilder.parse(file); String fileContent = getStringFromDocument(doc); success = configServiceAdminStub.updateConfiguration(createOMElement(fileContent)); } return success; }
Source:
<code><START> public String toString() { <END> String str = "\n"; if (!fTracingSupported) { return "\nTracing is not supported\n"; } if (fBackend.getSessionType() == SessionType.CORE) { str += "Off-line trace visualization\n"; } else { str += "Tracing with live execution\n"; } if (fCurrentRecordDmc instanceof MITraceRecordDMContext) { str += "Looking at trace frame " + ((MITraceRecordDMContext)fCurrentRecordDmc).getRecordId() + ", tracepoint " + fTracepointIndexForTraceRecord + "\n\n"; } else { str += "Not currently looking at any trace frame\n\n"; } str += "Tracing is currently" + (!fTracingActive ? " not":"") + " active\n"; str += "Buffer contains " + fNumberOfCollectedFrames + " trace frame" + (fNumberOfCollectedFrames>1?"s":"") + "\n"; str += "Currently using " + (fTotalBufferSize - fFreeBufferSize) + " bytes out of " + fTotalBufferSize + "\n"; if (fStopReason != null) { assert !fTracingActive; str += "Tracing stopped because of"; if (fStopReason == STOP_REASON_ENUM.REQUEST) { str += " user request"; } else if (fStopReason == STOP_REASON_ENUM.PASSCOUNT) { str += " passcount"; if (fStoppingTracepoint != null) { str += " of tracepoint number " + fStoppingTracepoint; } } else if (fStopReason == STOP_REASON_ENUM.OVERFLOW) { str += " buffer full"; } else if (fStopReason == STOP_REASON_ENUM.DISCONNECTION) { str += " disconnection"; } else if (fStopReason == STOP_REASON_ENUM.ERROR) { str += " error"; } else { str += " unknow reason"; } str += "\n"; } return str; }</code><technical_language>If this is longer TraceControlView (yes, this original output generated :O), simplify this method, is confusing</technical_language>

Target:
public String toString() { String str = "\n"; if (!fTracingSupported) { return "\nTracing is not supported\n"; } if (fBackend.getSessionType() == SessionType.CORE) { str += "Off-line trace visualization\n"; } else { str += "Tracing with live execution\n"; } str += "Tracing is currently" + (!isTracingActive() ? " not":"") + " active\n"; str += "Buffer contains " + getNumberOfCollectedFrame() + " trace frame" + (getNumberOfCollectedFrame() > 1 ? "s" : "") + "\n"; str += "Currently using " + (getTotalBufferSize() - getFreeBufferSize()) + " bytes out of " + getTotalBufferSize() + "\n"; if (getStopReason() != null) { assert !isTracingActive(); str += "Tracing stopped because of"; if (getStopReason() == STOP_REASON_ENUM.REQUEST) { str += " user request"; } else if (getStopReason() == STOP_REASON_ENUM.PASSCOUNT) { str += " passcount"; if (getStoppingTracepoint() != null) { str += " of tracepoint number " + getStoppingTracepoint(); } } else if (info.getStopReason() == STOP_REASON_ENUM.OVERFLOW) { str += " buffer full"; } else if (info.getStopReason() == STOP_REASON_ENUM.DISCONNECTION) { str += " disconnection"; } else if (info.getStopReason() == STOP_REASON_ENUM.ERROR) { str += " error"; } else { str += " unknow reason"; } str += "\n"; } return str; }
Source:
<code>private static String propertiesAsString(Properties properties) { Stream<Entry<Object, Object>> stream = properties.entrySet().stream(); <START> String propAsString = stream.map(e -> encodeEntry(e)).collect(Collectors.joining("|")); <END> return propAsString; }</code><technical_language>constant for entry separator</technical_language>

Target:
private static String propertiesAsString(Properties properties) { Stream<Entry<Object, Object>> stream = properties.entrySet().stream(); String propAsString = stream.map(e -> encodeEntry(e)).collect(Collectors.joining(PROPERTIES_SEPARATOR)); return propAsString; }
Source:
<code>protected void executeCommand() { DiskImage diskImage = getDiskImage(); OpenStackImageProviderProxy proxy = getProviderProxy(); acquireImageDbLock(); String newImageId = proxy.createImageFromDiskImage(diskImage); getParameters().setParentCommand(ActionType.ExportRepoImage); Guid taskId = persistAsyncTaskPlaceHolder(getParameters().getParentCommand()); getParameters().setEntityInfo(new EntityInfo(VdcObjectType.Disk, getParameters().getImageGroupID())); VDSReturnValue vdsReturnValue = runVdsCommand(VDSCommandType.UploadImage, new UploadImageVDSCommandParameters( getStorageDomain().getStoragePoolId(), getStorageDomain().getId(), diskImage.getId(), diskImage.getImageId(), new HttpLocationInfo( <START> getProviderProxy().getImageUrl(getCluster().getCompatibilityVersion(), <END> newImageId), getProviderProxy().getUploadHeaders() ) )); if (vdsReturnValue.getSucceeded()) { getReturnValue().getVdsmTaskIdList().add( createTask(taskId, vdsReturnValue.getCreationInfo(), getParameters().getParentCommand(), VdcObjectType.Disk, getParameters().getImageGroupID(), getParameters().getDestinationDomainId())); } getReturnValue().setActionReturnValue(newImageId); setSucceeded(true); }</code><technical_language>this: StoragePoolDao storagePoolDao = Injector.get(StoragePoolDao.class); StoragePool storagePool = storagePoolDao.get(diskImage.getStoragePoolId()); VdsDao vdsDao = Injector.get(VdsDao.class); VDS vds = vdsDao.get(storagePool.getSpmVdsId()); vds.getClusterCompatibilityVersion() safe enough (obviously injected DAOs injected @Inject)</technical_language>

Target:
protected void executeCommand() { DiskImage diskImage = getDiskImage(); OpenStackImageProviderProxy proxy = getProviderProxy(); acquireImageDbLock(); String newImageId = proxy.createImageFromDiskImage(diskImage); getParameters().setParentCommand(ActionType.ExportRepoImage); Guid taskId = persistAsyncTaskPlaceHolder(getParameters().getParentCommand()); getParameters().setEntityInfo(new EntityInfo(VdcObjectType.Disk, getParameters().getImageGroupID())); VDSReturnValue vdsReturnValue = runVdsCommand(VDSCommandType.UploadImage, new UploadImageVDSCommandParameters( getStorageDomain().getStoragePoolId(), getStorageDomain().getId(), diskImage.getId(), diskImage.getImageId(), new HttpLocationInfo( getProviderProxy().getImageUrl(getSpmCompatibilityVersion(diskImage.getStoragePoolId()), newImageId), getProviderProxy().getUploadHeaders() ) )); if (vdsReturnValue.getSucceeded()) { getReturnValue().getVdsmTaskIdList().add( createTask(taskId, vdsReturnValue.getCreationInfo(), getParameters().getParentCommand(), VdcObjectType.Disk, getParameters().getImageGroupID(), getParameters().getDestinationDomainId())); } getReturnValue().setActionReturnValue(newImageId); setSucceeded(true); }
Source:
<code>public void closeNewWikiCongratulationsLightBox() { scrollAndClick(welcomeLightBoxCloseButton); <START> PageObjectLogging.log("waitForCongratulationsLightBox ", "Congratulations lightbox verified", true, driver); <END> }</code><technical_language>is "waitForCongratulationsLightBox " in PageObjectLogging.log, if wait for lightbox? waitForElementByElement method in PageObjectLogging.log method "closeNewWikiCongratulationsLightBox" "Congratulations lightbox closed"</technical_language>

Target:
public void closeNewWikiCongratulationsLightBox() { scrollAndClick(welcomeLightBoxCloseButton); PageObjectLogging.log("closeNewWikiCongratulationsLightBox ", "congratulations lightbox closed", true); }
Source:
<code><START> public static boolean installable() { <END> return true; }</code><technical_language>This is wrong. While yes, "return true" static, this is inherently meant instance method (thats TODO). give instance field a fixed value, suppress warning here..</technical_language>

Target:
public boolean installable() { return installable; }
Source:
<code>public void fireChanged() { SelectionChangedEvent evt = new SelectionChangedEvent(this, getSelection()); for (ISelectionChangedListener <START> fListener : <END> fListeners) { fListener.selectionChanged(evt); } }</code><technical_language>rename listener</technical_language>

Target:
public void fireChanged() { SelectionChangedEvent evt = new SelectionChangedEvent(this, getSelection()); for (ISelectionChangedListener listener : fListeners) { listener.selectionChanged(evt); } }
Source:
<code>public UnifyResult apply(UnifyRuleCall call) { final MutableUnion query = (MutableUnion) call.query; final MutableUnion target = (MutableUnion) call.target; List<MutableRel> queryInputs = query.getInputs(); List<MutableRel> targetInputs = target.getInputs(); if (queryInputs.size() == targetInputs.size()) { <START> while (!queryInputs.isEmpty()) { <END> int index = targetInputs.indexOf(queryInputs.get(0)); if (index != -1) { targetInputs.remove(index); queryInputs.remove(0); } else { return null; } } return call.result(target); } return null; }</code><technical_language>for loop (i .. n) here? I removing elements in query inputs is necessary. Other that, good me</technical_language>

Target:
public UnifyResult apply(UnifyRuleCall call) { final MutableUnion query = (MutableUnion) call.query; final MutableUnion target = (MutableUnion) call.target; List<MutableRel> queryInputs = query.getInputs(); List<MutableRel> targetInputs = target.getInputs(); if (queryInputs.size() == targetInputs.size()) { for (MutableRel rel: queryInputs) { int index = targetInputs.indexOf(rel); if (index == -1) { return null; } else { targetInputs.remove(index); } } return call.result(target); } return null; }
Source:
<code>public List<PermissionSubject> getPermissionCheckSubjects() { List<PermissionSubject> listPermissionSubjects = new ArrayList<>(); <START> if (!isImageProvided()) { <END> listPermissionSubjects.add(new PermissionSubject(getParameters().getStorageDomainId(), VdcObjectType.Storage, ActionGroup.CREATE_DISK)); } else { listPermissionSubjects.add(new PermissionSubject(getParameters().getImageId(), VdcObjectType.Disk, ActionGroup.CREATE_DISK)); } return listPermissionSubjects; }</code><technical_language>mind inverting condition simplify skip negation ? if (isImageProvided()) { ... } else { ... }</technical_language>

Target:
public List<PermissionSubject> getPermissionCheckSubjects() { List<PermissionSubject> listPermissionSubjects = new ArrayList<>(); if (isImageProvided()) { listPermissionSubjects.add(new PermissionSubject(getParameters().getImageId(), VdcObjectType.Disk, ActionGroup.CREATE_DISK)); } else { listPermissionSubjects.add(new PermissionSubject(getParameters().getStorageDomainId(), VdcObjectType.Storage, ActionGroup.CREATE_DISK)); } return listPermissionSubjects; }
Source:
<code>protected UnrankedScientificName findPrincipal(Taxonomy taxonomy) { List<UnrankedScientificName> names = this.getConcepts(); if (names.isEmpty()) return null; if (names.size() == 1) return names.get(0); names.sort((tc1, tc2) -> tc2.getProviderScore() - tc1.getProviderScore()); final int cutoff = taxonomy.getAcceptedCutoff(); List<UnrankedScientificName> coded = names.stream().filter(sn -> !sn.getKey().isUncoded() && sn.getPrincipal() != null && sn.getPrincipalScore() > cutoff).collect(Collectors.toList()); if (coded.size() == 0) return names.get(0); if (coded.size() == 1) { return coded.get(0); } <START> taxonomy.report(IssueType.COLLISION, "uncodedScientificName.collision", this,coded.get(0), coded.get(1)); <END> final int score = coded.stream().mapToInt(UnrankedScientificName::getPrincipalScore).max().orElse(Integer.MIN_VALUE); List<UnrankedScientificName> candidates = coded.stream().filter(sn -> sn.getPrincipalScore() == score).collect(Collectors.toList()); if (candidates.size() > 1) taxonomy.report(IssueType.PROBLEM, "uncodedScientificName.collision.match", this, candidates.get(0), candidates.get(1)); return candidates.get(0); }</code><technical_language>Define this constant else for reuse</technical_language>

Target:
protected UnrankedScientificName findPrincipal(Taxonomy taxonomy) { List<UnrankedScientificName> names = this.getConcepts(); if (names.isEmpty()) return null; if (names.size() == 1) return names.get(0); names.sort(REVERSE_PROVIDER_SCORE_COMPARATOR); final int cutoff = taxonomy.getAcceptedCutoff(); List<UnrankedScientificName> coded = names.stream().filter(sn -> !sn.getKey().isUncoded() && sn.getPrincipal() != null && sn.getPrincipalScore() > cutoff).collect(Collectors.toList()); if (coded.size() == 0) return names.get(0); if (coded.size() == 1) { return coded.get(0); } taxonomy.report(IssueType.COLLISION, "uncodedScientificName.collision", this,coded.get(0), coded.get(1)); final int score = coded.stream().mapToInt(UnrankedScientificName::getPrincipalScore).max().orElse(TaxonomicElement.MIN_SCORE); List<UnrankedScientificName> candidates = coded.stream().filter(sn -> sn.getPrincipalScore() == score).collect(Collectors.toList()); if (candidates.size() > 1) taxonomy.report(IssueType.PROBLEM, "uncodedScientificName.collision.match", this, candidates.get(0), candidates.get(1)); return candidates.get(0); }
Source:
<code>protected List<MethodMatcher> getMethodInvocationMatchers() { return Collections.singletonList( MethodMatcher.create() <START> .typeDefinition(TypeCriteria.is("java.util.Hashtable")) <END> .name("put") .withAnyParameters()); }</code><technical_language>This more general: .typeDefinition(TypeCriteria.subtypeOf("java.util.Map"))</technical_language>

Target:
protected List<MethodMatcher> getMethodInvocationMatchers() { return Collections.singletonList( MethodMatcher.create() .typeDefinition(TypeCriteria.subtypeOf("java.util.Map")) .name("put") .withAnyParameters()); }
Source:
<code>public double reidentificationPotential(long threshold) { int highlyUniqueValues = 0; <START> for (HyperLogLog hll : minhash.values()) { <END> if (hll.cardinality() <= threshold) { highlyUniqueValues++; } } return (double) highlyUniqueValues / minhash.size(); }</code><technical_language>nit: int highlyUniqueValues = minhash.values().stream() .map(HyperLogLog::cardinality) .filter(cardinality -> cardinality <= threshold) .count();</technical_language>

Target:
public double reidentificationPotential(long threshold) { long highlyUniqueValues = minhash.values().stream() .map(HyperLogLog::cardinality) .filter(cardinality -> cardinality <= threshold) .count(); return (double) highlyUniqueValues / minhash.size(); }
Source:
<code>public void shouldObtainSecret() throws Exception { PlainTextVaultProvider provider = new PlainTextVaultProvider(Scenario.EXISTING.getPath()); Optional<byte[]> secret1 = provider.obtainSecret("key1"); assertNotNull(secret1); assertNotNull(secret1.orElse(null)); <START> assertEquals("secret1", new String(secret1.get())); <END> }</code><technical_language>prefer assertThat Hamster matchers. give output in case of failure</technical_language>

Target:
public void shouldObtainSecret() throws Exception { PlainTextVaultProvider provider = new PlainTextVaultProvider(Scenario.EXISTING.getPath(), "test"); VaultRawSecret secret1 = provider.obtainSecret("key1"); assertNotNull(secret1); assertNotNull(secret1.getRawSecret().get()); assertThat(secret1, secretContains("secret1")); }
Source:
<code>public Map<String, String> getCustomAttributes() { requireCustomAttributesEnabled("getCustomAttributes"); synchronized (customAttributes) { <START> return customAttributes; <END> } }</code><technical_language>Unnecessary synchronized block btw. need validate input in set methods, return unmodifiable Map here</technical_language>

Target:
public Map<String, String> getCustomAttributes() { requireCustomAttributesEnabled(); requireCustomAttributes(); return Collections.unmodifiableMap(customAttributes); }
Source:
<code>public static CommandBase<?> createCommand(String className, Guid commandId) { Constructor<?> constructor = null; Boolean isAcessible = null; try { constructor = Class.forName(className).getDeclaredConstructor(Guid.class); if (!constructor.isAccessible()) { isAcessible = constructor.isAccessible(); constructor.setAccessible(true); } CommandBase<?> cmd = (CommandBase<?>) constructor.newInstance(new Object[]{commandId}); return Injector.injectMembers(cmd); } catch (Exception e) { log.error("CommandsFactory : Failed to get type information using reflection for Class '{}', Command Id '{}': {}", className, commandId, e.getMessage()); <START> log.debug("Exception", e); <END> return null; } finally { if (isAcessible != null) { constructor.setAccessible(isAcessible); } } }</code><technical_language>this well, yair</technical_language>

Target:
public static CommandBase<?> createCommand(String className, Guid commandId) { Constructor<?> constructor = null; Boolean isAcessible = null; try { constructor = Class.forName(className).getDeclaredConstructor(Guid.class); if (!constructor.isAccessible()) { isAcessible = constructor.isAccessible(); constructor.setAccessible(true); } CommandBase<?> cmd = (CommandBase<?>) constructor.newInstance(new Object[]{commandId}); return Injector.injectMembers(cmd); } catch (Exception e) { log.error("CommandsFactory : Failed to get type information using reflection for Class '{}', Command Id '{}': {}", className, commandId, e.getMessage()); log.error("Exception", e); return null; } finally { if (isAcessible != null) { constructor.setAccessible(isAcessible); } } }
Source:
<code>private String resolveDockerfileLocation(Class<? extends DockerContainer> fixture, DockerFixture f) { String prefix = null; if(isSpecificDockerfileLocationSet(f)) { prefix = f.dockerfile().replace('.', '/').replace('$', '/'); } else { prefix = fixture.getName().replace('.', '/').replace('$', '/'); } <START> return prefix; <END> }</code><technical_language>clearer do replace in place? E.g. java String prefix = null; if(isSpecificDockerfileLocationSet(f)) { prefix = f.dockerfile(); } else { prefix = fixture.getName(); } return prefix.replace('.', '/').replace('$', '/');</technical_language>

Target:
private String resolveDockerfileLocation(Class<? extends DockerContainer> fixture, DockerFixture f) { String prefix = null; if(isSpecificDockerfileLocationSet(f)) { prefix = f.dockerfileFolder(); } else { prefix = fixture.getName(); } return prefix.replace('.', '/').replace('$', '/'); }
Source:
<code>private Module installModule(Collection<Module> modules, String installUri, ServletContext servletContext) { List<Module> moduleList = new ArrayList<Module>(modules); Module existingModule = moduleList.get(0); Module tempModule = null; File moduleFile = null; try { if (existingModule != null) { List<Module> dependentModulesStopped = moduleFactoryWrapper.stopModuleAndGetDependent(existingModule); for (Module depMod : dependentModulesStopped) { moduleFactoryWrapper.stopModuleSkipRefresh(depMod, servletContext); } moduleFactoryWrapper.stopModuleSkipRefresh(existingModule, servletContext); moduleFactoryWrapper.unloadModule(existingModule); } URL downloadUrl = new URL(installUri); String fileName = FilenameUtils.getName(downloadUrl.getPath()); InputStream inputStream = ModuleUtil.getURLStream(downloadUrl); moduleFile = ModuleUtil.insertModuleFile(inputStream, fileName); tempModule = moduleFactoryWrapper.loadModule(moduleFile); moduleFactoryWrapper.startModule(tempModule, servletContext); return tempModule; } catch (MalformedURLException e) { <START> throw new RuntimeException(e.getMessage()); <END> } catch (IOException e) { throw new RuntimeException(e.getMessage()); } finally { if (tempModule == null && moduleFile != null) { FileUtils.deleteQuietly(moduleFile); } } }</code><technical_language>is good good throw RuntimeException in this case. Throw APIException remember pass original exception parameter</technical_language>

Target:
private Module installModule(Collection<Module> modules, String installUri, ServletContext servletContext) { List<Module> moduleList = new ArrayList<Module>(modules); Module existingModule = moduleList.get(0); Module tempModule = null; File moduleFile = null; try { if (existingModule != null) { List<Module> dependentModulesStopped = moduleFactoryWrapper.stopModuleAndGetDependent(existingModule); for (Module depMod : dependentModulesStopped) { moduleFactoryWrapper.stopModuleSkipRefresh(depMod, servletContext); } moduleFactoryWrapper.stopModuleSkipRefresh(existingModule, servletContext); moduleFactoryWrapper.unloadModule(existingModule); } URL downloadUrl = new URL(installUri); String fileName = FilenameUtils.getName(downloadUrl.getPath()); InputStream inputStream = ModuleUtil.getURLStream(downloadUrl); moduleFile = ModuleUtil.insertModuleFile(inputStream, fileName); tempModule = moduleFactoryWrapper.loadModule(moduleFile); moduleFactoryWrapper.startModule(tempModule, servletContext); return tempModule; } catch (MalformedURLException e) { throw new APIException(e.getMessage(), e); } catch (IOException e) { throw new APIException(e.getMessage(), e); } finally { if (moduleFile != null) { FileUtils.deleteQuietly(moduleFile); } } }
Source:
<code><START> public void testMultipleFeatures() throws InterruptedException, JSONException { <END> final BackendSupplier backendSupplier = new BackendSupplier() { @Override public Collection<? extends Backend> get() { Backend backend = mock(Backend.class); when(backend.getSnippet(any(PickleStep.class), anyString(), any(FunctionNameGenerator.class))).thenReturn("TEST SNIPPET"); return singletonList(backend); } }; StringBuilder stringBuilderA = new StringBuilder(); Runtime.builder() .withArgs("--threads", "3", "src/test/resources/cucumber/runtime/formatter/JSONPrettyFormatterTest.feature", "src/test/resources/cucumber/runtime/formatter/FormatterInParallel.feature") .withAdditionalPlugins(new JSONFormatter(stringBuilderA)) .withBackendSupplier(backendSupplier) .build() .run(); StringBuilder stringBuilderB = new StringBuilder(); Runtime.builder() .withArgs("--threads", "1", "src/test/resources/cucumber/runtime/formatter/JSONPrettyFormatterTest.feature", "src/test/resources/cucumber/runtime/formatter/FormatterInParallel.feature") .withAdditionalPlugins(new JSONFormatter(stringBuilderB)) .withBackendSupplier(backendSupplier) .build() .run(); System.out.println(stringBuilderA.toString()); System.out.println("==================="); System.out.println(stringBuilderB.toString()); JSONAssert.assertEquals(stringBuilderB.toString(), new JSONArray(new JSONTokener(stringBuilderA.toString())), false); }</code><technical_language>This fails formatter expects events interleave features</technical_language>

Target:
public void testMultipleFeatures() { StringBuilder parallel = new StringBuilder(); Runtime.builder() .withArgs("--threads", "3", "src/test/resources/cucumber/runtime/formatter/JSONPrettyFormatterTest.feature", "src/test/resources/cucumber/runtime/formatter/FormatterInParallel.feature") .withAdditionalPlugins(new JSONFormatter(parallel)) .build() .run(); StringBuilder serial = new StringBuilder(); Runtime.builder() .withArgs("--threads", "1", "src/test/resources/cucumber/runtime/formatter/JSONPrettyFormatterTest.feature", "src/test/resources/cucumber/runtime/formatter/FormatterInParallel.feature") .withAdditionalPlugins(new JSONFormatter(serial)) .build() .run(); assertThat(parallel.toString(), sameJSONAs(serial.toString()).allowingAnyArrayOrdering()); }
Source:
<code>public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final GoloFunction other = (GoloFunction) obj; if (!Objects.equals(this.name, other.name)) { return false; } if (this.getArity() != other.getArity()) { return false; } return true; <START> } <END></code><technical_language>return Objects.equals(this.name, other.name) && this.getArity() == other.getArity() ? :smile:</technical_language>

Target:
public boolean equals(Object obj) { if (obj == this) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final GoloFunction other = (GoloFunction) obj; if (!Objects.equals(this.name, other.name)) { return false; } if (this.varargs != other.varargs) { return false; } return this.getArity() == other.getArity(); }
Source:
<code>public ObexTime(String time) { Pattern p = Pattern.compile( "(\\d{4})(\\d{2})(\\d{2})T(\\d{2})(\\d{2})(\\d{2})(([+-])(\\d{2})(\\d{2})" + ")?"); Matcher m = p.matcher(time); if (m.matches()) { <START> Calendar cal = Calendar.getInstance(); <END> cal.clear(); cal.setTimeZone(TimeZone.getDefault()); cal.set(Integer.parseInt(m.group(1)), Integer.parseInt(m.group(2)) - 1, Integer.parseInt(m.group(3)), Integer.parseInt(m.group(4)), Integer.parseInt(m.group(5)), Integer.parseInt(m.group(6))); if (m.group(7) != null) { int ohh = Integer.parseInt(m.group(9)); int omm = Integer.parseInt(m.group(10)); int offset = (ohh * 60 + omm) * 60 * 1000; if (m.group(8).equals("-")) { offset = -offset; } TimeZone tz = TimeZone.getTimeZone("UTC"); tz.setRawOffset(offset); cal.setTimeZone(tz); } mDate = cal.getTime(); } }</code><technical_language>Calendar.getInstance() a Calendar.Builder() of set methods</technical_language>

Target:
public ObexTime(String time) { Pattern p = Pattern.compile( "(\\d{4})(\\d{2})(\\d{2})T(\\d{2})(\\d{2})(\\d{2})(([+-])(\\d{2})(\\d{2})" + ")?"); Matcher m = p.matcher(time); if (m.matches()) { Calendar.Builder builder = new Calendar.Builder(); builder.setDate(Integer.parseInt(m.group(1)), Integer.parseInt(m.group(2)) - 1, Integer.parseInt(m.group(3))); builder.setTimeOfDay(Integer.parseInt(m.group(4)), Integer.parseInt(m.group(5)), Integer.parseInt(m.group(6)), 0); if (m.group(7) != null) { int ohh = Integer.parseInt(m.group(9)); int omm = Integer.parseInt(m.group(10)); int offset = (ohh * 60 + omm) * 60 * 1000; if (m.group(8).equals("-")) { offset = -offset; } TimeZone tz = TimeZone.getTimeZone("UTC"); tz.setRawOffset(offset); builder.setTimeZone(tz); } mDate = builder.build().getTime(); } }
Source:
<code>public ImageTicketInformation getTicket(Guid ticketUUID) { BasicHttpRequest request = new BasicHttpRequest( "GET", TICKETS_URI + ticketUUID, HttpVersion.HTTP_1_1); DefaultBHttpClientConnection conn = getConnection(); HttpEntity response = executeRequest(request, conn); String responseContent = null; try { BufferedReader reader = new BufferedReader(new InputStreamReader(response.getContent())); responseContent = reader.lines().collect(Collectors.joining()); return ImageTicketInformationHelper.fromJson(responseContent); } catch (com.google.gson.JsonSyntaxException e) { throw new RuntimeException(responseContent, e); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } finally { <START> finalize(response, conn); <END> } }</code><technical_language>try resources close connection move consume logic connection closing</technical_language>

Target:
public ImageTicketInformation getTicket(Guid ticketUUID) { BasicHttpRequest request = new BasicHttpRequest( "GET", TICKETS_URI + ticketUUID, HttpVersion.HTTP_1_1); String responseContent; try (DefaultBHttpClientConnection conn = getConnection()) { HttpEntity response = executeRequest(request, conn); BufferedReader reader = new BufferedReader(new InputStreamReader(response.getContent())); responseContent = reader.lines().collect(Collectors.joining()); consumeResponse(response); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } return ImageTicketInformationHelper.fromJson(responseContent); }
Source:
<code>static String getConsumerGroupId(Config config) { JobConfig jobConfig = new JobConfig(config); Option<String> jobIdOption = jobConfig.getJobId(); Option<String> jobNameOption = jobConfig.getName(); <START> return (jobNameOption.isDefined() ? jobNameOption.get() : "undefined_job_name") + "-" + (jobIdOption.isDefined() <END> ? jobIdOption.get() : "undefined_job_id"); }</code><technical_language>jobName jobId available? prefer throw if instead of defaulting arbitrary values</technical_language>

Target:
static String getConsumerGroupId(Config config) { JobConfig jobConfig = new JobConfig(config); Option jobNameOption = jobConfig.getName(); if (jobNameOption.isEmpty()) { throw new ConfigException("Missing job name"); } String jobName = (String) jobNameOption.get(); Option jobIdOption = jobConfig.getJobId(); String jobId = "1"; if (! jobIdOption.isEmpty()) { jobId = (String) jobIdOption.get(); } return String.format("%s-%s", jobName, jobId); }
Source:
<code><START> private static void set(Material material, String stat, float accuracy) { <END> IMaterialStats oldStat = material.getStats(stat); if (oldStat instanceof FletchingMaterialStats) { FletchingMaterialStats fletchingStat = (FletchingMaterialStats) oldStat; FletchingMaterialStats newFletching = new FletchingMaterialStats(accuracy, fletchingStat.modifier); material.addStats(newFletching); } }</code><technical_language>making this review here, applied actions this, is this private static? private do</technical_language>

Target:
private void set(Material material, String stat, float accuracy) { IMaterialStats oldStat = material.getStats(stat); if (oldStat instanceof FletchingMaterialStats) { FletchingMaterialStats fletchingStat = (FletchingMaterialStats) oldStat; FletchingMaterialStats newFletching = new FletchingMaterialStats(accuracy, fletchingStat.modifier); material.addStats(newFletching); } }
Source:
<code>public KeyValueServiceStatus getKeyValueServiceStatus() { NodeAvailabilityStatus nodeAvailabilityStatus = keyValueService.getNodeAvailabilityStatus(); <START> switch (nodeAvailabilityStatus) { <END> case TERMINAL: return KeyValueServiceStatus.TERMINAL; case ALL_AVAILABLE: return KeyValueServiceStatus.HEALTHY_ALL_OPERATIONS; case QUORUM_AVAILABLE: return KeyValueServiceStatus.HEALTHY_BUT_NO_SCHEMA_MUTATIONS_OR_DELETES; case NO_QUORUM_AVAILABLE: default: return KeyValueServiceStatus.UNHEALTHY; } }</code><technical_language>I context this, worth leaving this in case need do this in future</technical_language>

Target:
public KeyValueServiceStatus getKeyValueServiceStatus() { ClusterAvailabilityStatus clusterAvailabilityStatus = keyValueService.getClusterAvailabilityStatus(); switch (clusterAvailabilityStatus) { case TERMINAL: return KeyValueServiceStatus.TERMINAL; case ALL_AVAILABLE: return KeyValueServiceStatus.HEALTHY_ALL_OPERATIONS; case QUORUM_AVAILABLE: return KeyValueServiceStatus.HEALTHY_BUT_NO_SCHEMA_MUTATIONS_OR_DELETES; case NO_QUORUM_AVAILABLE: default: return KeyValueServiceStatus.UNHEALTHY; } }
Source:
<code>protected <T> T get(String artifactId, Class<T> clazz) { <START> return get(clazz,uri(ClientConstants.PATH_ARTIFACTS+ClientConstants.URI_SEP+ artifactType.value()+"/%s",artifactId)).execute(); <END> }</code><technical_language>import import static com.google.common.base.Preconditions.checkNotNull; add a null check arguments a prerequisite in method call, e.g. checkNotNull(artifactId);</technical_language>

Target:
protected <T> T get(String artifactId, Class<T> clazz) { return get(clazz,uri(PATH_ARTIFACTS+URI_SEP+ artifactType.value()+"/%s",artifactId)).execute(); }
Source:
<code>public void statusRedundancyWithIncludeRegionArgumentReturnsStatusForOnlyThatRegion() { createAndPopulateRegions(); String command = new CommandStringBuilder(COMMAND_NAME) .addOption(INCLUDE_REGION, SATISFIED_REGION) .getCommandString(); CommandResultAssert commandResult = gfsh.executeAndAssertThat(command); <START> commandResult.statusIsSuccess() .hasNoSection(ZERO_REDUNDANCY_SECTION) .hasNoSection(UNDER_REDUNDANCY_SECTION) .doesNotContainOutput(UNSATISFIED_REGION) .doesNotContainOutput(ZERO_COPIES_REGION) .doesNotContainOutput(NO_CONFIGURED_REDUNDANCY_REGION); verifySummarySection(commandResult, 0, 0, 1); InfoResultModelAssert satisfiedRedundancy = commandResult.hasInfoSection(SATISFIED_REDUNDANCY_SECTION); satisfiedRedundancy.hasHeader().isEqualTo(REDUNDANCY_SATISFIED_FOR_REGIONS); satisfiedRedundancy.hasOutput().contains(SATISFIED_REGION); <END> }</code><technical_language>This code block is duplicated test, extracted a separate method</technical_language>

Target:
public void statusRedundancyWithIncludeRegionArgumentReturnsStatusForOnlyThatRegion() { createAndPopulateRegions(); String includedRegion = SATISFIED_REGION; List<String> nonIncludedRegions = new ArrayList<>(regionNames); nonIncludedRegions.remove(includedRegion); String command = new CommandStringBuilder(STATUS_REDUNDANCY) .addOption(REDUNDANCY_INCLUDE_REGION, includedRegion) .getCommandString(); CommandResultAssert commandResult = gfsh.executeAndAssertThat(command).statusIsSuccess() .doesNotContainOutput(nonIncludedRegions.toArray(new String[0])); verifyGfshOutput(commandResult, new ArrayList<>(), new ArrayList<>(), Collections.singletonList(includedRegion)); }
Source:
<code>public HivePartitionResult getPartitions(SemiTransactionalHiveMetastore metastore, ConnectorTableHandle tableHandle, List<List<String>> partitionValuesList) { HiveTableHandle hiveTableHandle = (HiveTableHandle) tableHandle; SchemaTableName tableName = hiveTableHandle.getSchemaTableName(); Table table = getTable(metastore, tableName); List<HiveColumnHandle> partitionColumns = getPartitionKeyColumnHandles(table); List<Type> partitionColumnTypes = partitionColumns.stream() .map(column -> typeManager.getType(column.getTypeSignature())) .collect(toList()); <START> Iterable<HivePartition> partitionsIterable = () -> partitionValuesList.stream() <END> .map(partitionValues -> getPartitionNameByNonNullParts(table.getPartitionColumns(), partitionValues)) .map(partitionName -> parseValuesAndFilterPartition(tableName, partitionName, partitionColumns, partitionColumnTypes, alwaysTrue())) .peek(partition -> verify(partition.isPresent(), "partition must exist")) .map(Optional::get) .iterator(); return new HivePartitionResult(partitionColumns, partitionsIterable, all(), all(), none(), getHiveBucketHandle(table), Optional.empty()); }</code><technical_language>I reason iterable in other place is avoid instantiation of partitions in coordinator's memory. Here, chance of filtering out, calculating List<HivePartition> more readable</technical_language>

Target:
public HivePartitionResult getPartitions(SemiTransactionalHiveMetastore metastore, ConnectorTableHandle tableHandle, List<List<String>> partitionValuesList) { HiveTableHandle hiveTableHandle = (HiveTableHandle) tableHandle; SchemaTableName tableName = hiveTableHandle.getSchemaTableName(); Table table = getTable(metastore, tableName); List<HiveColumnHandle> partitionColumns = getPartitionKeyColumnHandles(table); List<Type> partitionColumnTypes = partitionColumns.stream() .map(column -> typeManager.getType(column.getTypeSignature())) .collect(toImmutableList()); List<HivePartition> partitionList = partitionValuesList.stream() .map(partitionValues -> makePartName(table.getPartitionColumns(), partitionValues)) .map(partitionName -> parseValuesAndFilterPartition(tableName, partitionName, partitionColumns, partitionColumnTypes, alwaysTrue())) .map(partition -> partition.orElseThrow(() -> new VerifyException("partition must exist"))) .collect(toImmutableList()); return new HivePartitionResult(partitionColumns, partitionList, all(), all(), none(), getHiveBucketHandle(table), Optional.empty()); }
Source:
<code>public void removeTask() { try { this.process.getTasks().remove(this.task); List<User> users = this.task.getUsers(); for (User user : users) { user.getTasks().remove(this.task); } List<UserGroup> userGroups = this.task.getUserGroups(); for (UserGroup userGroup : userGroups) { userGroup.getTasks().remove(this.task); } deleteSymlinksFromUserHomes(); serviceManager.getTaskService().remove(this.task); } catch (DataException e) { <START> logger.error(e); <END> } }</code><technical_language>In a previous pull request is a new Helper method added logs error inform user in UI. this a approach</technical_language>

Target:
public void removeTask() { try { this.process.getTasks().remove(this.task); List<User> users = this.task.getUsers(); for (User user : users) { user.getTasks().remove(this.task); } List<UserGroup> userGroups = this.task.getUserGroups(); for (UserGroup userGroup : userGroups) { userGroup.getTasks().remove(this.task); } deleteSymlinksFromUserHomes(); serviceManager.getTaskService().remove(this.task); } catch (DataException e) { Helper.setErrorMessage(e.getLocalizedMessage(), logger, e); } }