auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void undeploySynapseArtifact(String artifactName) { if (log.isDebugEnabled()) { log.debug("ProxyService Undeployment of the proxy named : " + artifactName + " : Started"); } try { ProxyService proxy = getSynapseConfiguration().getProxyService(artifactName); if (proxy != null) { proxy.setLogSetterValue(); if (log.isDebugEnabled()) { log.debug("Stopping the ProxyService named : " + artifactName); } proxy.stop(getSynapseConfiguration()); getSynapseConfiguration().removeProxyService(artifactName); if (log.isDebugEnabled()) { log.debug("ProxyService Undeployment of the proxy named : " + artifactName + " : Completed"); } String unDeployTime = String.valueOf(System.currentTimeMillis()); log.info("ProxyService named '" + proxy.getName() + "' has been undeployed"); <START> executeSynapseHandlerOnArtifactUnDeployment(proxy.getName(),"proxy_service", unDeployTime); <END> } else if (log.isDebugEnabled()) { log.debug("Proxy service " + artifactName + " has already been undeployed"); } } catch (Exception e) { handleSynapseArtifactDeploymentError( "ProxyService Undeployement of proxy named : " + artifactName + " : Failed", e); } }</code><technical_language>reuse constant</technical_language>

Target:
public void undeploySynapseArtifact(String artifactName) { if (log.isDebugEnabled()) { log.debug("ProxyService Undeployment of the proxy named : " + artifactName + " : Started"); } try { ProxyService proxy = getSynapseConfiguration().getProxyService(artifactName); if (proxy != null) { proxy.setLogSetterValue(); if (log.isDebugEnabled()) { log.debug("Stopping the ProxyService named : " + artifactName); } proxy.stop(getSynapseConfiguration()); getSynapseConfiguration().removeProxyService(artifactName); if (log.isDebugEnabled()) { log.debug("ProxyService Undeployment of the proxy named : " + artifactName + " : Completed"); } String unDeployTime = String.valueOf(System.currentTimeMillis()); executeSynapseHandlerOnArtifactUnDeployment(proxy.getName(), SynapseConstants.PROXY_SERVICE_TYPE, unDeployTime); log.info("ProxyService named '" + proxy.getName() + "' has been undeployed"); } else if (log.isDebugEnabled()) { log.debug("Proxy service " + artifactName + " has already been undeployed"); } } catch (Exception e) { handleSynapseArtifactDeploymentError( "ProxyService Undeployement of proxy named : " + artifactName + " : Failed", e); } }
Source:
<code><START> public void editIssueLabel() { <END> IssuesLabelService.editIssueLabel(IssueLabelListActivity.this, getRootLayout(), mRepoOwner, mRepoName, mLabel.getName(), mLabel.editedName, mLabel.editedColor) .doOnError(error -> { mAdapter.remove(mAddedLabel); mAddedLabel = null; }) .subscribe(result -> { forceLoaderReload(0); setResult(RESULT_OK); }, e -> {}); }</code><technical_language>above: private, 100 chars, error result instead of doOnError</technical_language>

Target:
private void editIssueLabel() { IssuesLabelService.editIssueLabel( IssueLabelListActivity.this, mRepoOwner, mRepoName, mLabel.getName(), mLabel.editedName, mLabel.editedColor ).subscribe(result -> { forceLoaderReload(0); setResult(RESULT_OK); }, error -> { mAdapter.remove(mAddedLabel); mAddedLabel = null; }); }
Source:
<code>public ClassSpecificObjectInputStream(ClassLoader classLoader, InputStream inputStream, Class classToAccept) throws IOException, StreamCorruptedException { super(classLoader, inputStream); this.classToAccept = classToAccept; <START> this.firstClass = true; <END> }</code><technical_language>set true in field declaration</technical_language>

Target:
public ClassSpecificObjectInputStream(ClassLoader classLoader, InputStream inputStream, Class classToAccept) throws IOException, StreamCorruptedException { super(classLoader, inputStream); this.classToAccept = classToAccept; }
Source:
<code>private boolean doLock() { try { boolean acquired = this.mutex.acquire(this.path); if (acquired) { this.lastUsed = System.currentTimeMillis(); } return acquired; } catch (Exception e) { <START> throw new MessagingException("Failed to aquire mutex at " + this.path, e); <END> } }</code><technical_language>RuntimeException better. Typically SI components check exception wrap MessagingException "guilty" Message. If is MessagingException lose "guilty" Message context</technical_language>

Target:
private boolean doLock() { try { boolean acquired = this.mutex.acquire(this.path); if (acquired) { this.lastUsed = System.currentTimeMillis(); } return acquired; } catch (Exception e) { throw new RuntimeException("Failed to acquire mutex at " + this.path, e); } }
Source:
<code>protected SortedMap<Integer, Node> orderedCommentsAndDeclarations(ASTCompilationUnit cUnit) { <START> <END> SortedMap<Integer, Node> itemsByLineNumber = new TreeMap<>(); List<ASTClassOrInterfaceDeclaration> classDecl = new ArrayList<>(); cUnit.findDescendantsOfType(ASTClassOrInterfaceDeclaration.class, classDecl, true); addDeclarations(itemsByLineNumber, classDecl); addDeclarations(itemsByLineNumber, cUnit.getComments()); List<ASTFieldDeclaration> fields = new ArrayList<>(); cUnit.findDescendantsOfType(ASTFieldDeclaration.class, fields, true); addDeclarations(itemsByLineNumber, fields); List<ASTMethodDeclaration> methods = new ArrayList<>(); cUnit.findDescendantsOfType(ASTMethodDeclaration.class, methods, true); addDeclarations(itemsByLineNumber, methods); List<ASTConstructorDeclaration> constructors = new ArrayList<>(); cUnit.findDescendantsOfType(ASTConstructorDeclaration.class, constructors, true); addDeclarations(itemsByLineNumber, constructors); List<ASTEnumDeclaration> enumDecl = new ArrayList<>(); cUnit.findDescendantsOfType(ASTEnumDeclaration.class, enumDecl, true); addDeclarations(itemsByLineNumber, enumDecl); return itemsByLineNumber; }</code><technical_language>I nice remove extra statement adding overload <T> List<T> findDescendantsOfType(Class<T>, boolean). This consistent signature usage of other find* methods -- return a list instead of void. variables initialized a single expression</technical_language>

Target:
protected SortedMap<Integer, Node> orderedCommentsAndDeclarations(ASTCompilationUnit cUnit) { SortedMap<Integer, Node> itemsByLineNumber = new TreeMap<>(); addDeclarations(itemsByLineNumber, cUnit.findDescendantsOfType(ASTClassOrInterfaceDeclaration.class, true)); addDeclarations(itemsByLineNumber, cUnit.getComments()); addDeclarations(itemsByLineNumber, cUnit.findDescendantsOfType(ASTFieldDeclaration.class, true)); addDeclarations(itemsByLineNumber, cUnit.findDescendantsOfType(ASTMethodDeclaration.class, true)); addDeclarations(itemsByLineNumber, cUnit.findDescendantsOfType(ASTConstructorDeclaration.class, true)); addDeclarations(itemsByLineNumber, cUnit.findDescendantsOfType(ASTEnumDeclaration.class, true)); return itemsByLineNumber; }
Source:
<code>public List<BlockDevice> getBlockDeviceMapping() { return blockDeviceMapping; <START> } <END></code><technical_language>move this method blockDeviceMapping? A cleanup of this class untangled current mix of getters "builder option" methods nice, part of this PR, I guess</technical_language>

Target:
public Set<BlockDeviceMapping> getBlockDeviceMapping() { return blockDeviceMapping; }
Source:
<code>private static Type findLeastSpecificType(Symbol parameter) { <START> List<IdentifierTree> usages = parameter.usages(); <END> InheritanceGraph inheritanceGraph = new InheritanceGraph(parameter.type()); for (IdentifierTree usage : usages) { Tree parent = usage.parent(); while (parent != null && !parent.is(Tree.Kind.ARGUMENTS, Tree.Kind.METHOD_INVOCATION, Tree.Kind.EXPRESSION_STATEMENT, Tree.Kind.FOR_EACH_STATEMENT)) { parent = parent.parent(); } if (parent == null || parent.is(Tree.Kind.EXPRESSION_STATEMENT, Tree.Kind.ARGUMENTS)) { return parameter.type(); } if (parent.is(Tree.Kind.FOR_EACH_STATEMENT)) { Collection<Symbol> symbols = parameter.type().symbol().lookupSymbols("iterator"); symbols.stream() .filter(Symbol::isMethodSymbol) .filter(s -> ((Symbol.MethodSymbol) s).parameterTypes().isEmpty()) .findFirst() .ifPresent(inheritanceGraph::update); } else if (parent.is(Tree.Kind.METHOD_INVOCATION)) { MethodInvocationTree mit = (MethodInvocationTree) parent; if (isMethodInvocationOnParameter(parameter, mit)) { inheritanceGraph.update(mit.symbol()); } } } return inheritanceGraph.leastSpecificType(); }</code><technical_language>I inline unecessary var</technical_language>

Target:
private static Type findLeastSpecificType(Symbol parameter) { InheritanceGraph inheritanceGraph = new InheritanceGraph(parameter.type()); for (IdentifierTree usage : parameter.usages()) { Tree parent = usage.parent(); while (parent != null && !parent.is(Tree.Kind.ARGUMENTS, Tree.Kind.METHOD_INVOCATION, Tree.Kind.EXPRESSION_STATEMENT, Tree.Kind.FOR_EACH_STATEMENT)) { parent = parent.parent(); } if (parent == null || parent.is(Tree.Kind.EXPRESSION_STATEMENT, Tree.Kind.ARGUMENTS)) { return parameter.type(); } if (parent.is(Tree.Kind.FOR_EACH_STATEMENT)) { findIteratorMethod(parameter).ifPresent(inheritanceGraph::update); } else if (parent.is(Tree.Kind.METHOD_INVOCATION)) { MethodInvocationTree mit = (MethodInvocationTree) parent; if (isMethodInvocationOnParameter(parameter, mit)) { inheritanceGraph.update(mit.symbol()); } } } return inheritanceGraph.leastSpecificType(); }
Source:
<code>private TimeZone getServerTimeZone() throws SQLException { String query = "select TIME_TO_SEC(timediff(now(),utc_timestamp()));"; Statement stmt = connection.createStatement(); try { ResultSet rs = stmt.executeQuery(query); if (rs.next()) { int offsetSeconds = rs.getInt(1); return fromGMTOffsetSeconds(offsetSeconds); } else { <START> return null; <END> } } finally { stmt.close(); } }</code><technical_language>If throwing SQLException instead of returning null, caller check null</technical_language>

Target:
private TimeZone getServerTimeZone() throws SQLException { String query = "select TIME_TO_SEC(timediff(now(),utc_timestamp()));"; Statement stmt = connection.createStatement(); try { ResultSet rs = stmt.executeQuery(query); if (rs.next()) { int offsetSeconds = rs.getInt(1); return fromGMTOffsetSeconds(offsetSeconds); } throw new SQLException(String.format(Locale.ENGLISH, "The timezone comparison query(%s) doesn't return the result.",query)); } finally { stmt.close(); } }
Source:
<code>public TTLSet(Map<String,String> objectStrings) { super(); for (Entry<String,String> entry : objectStrings.entrySet()) { String column = entry.getKey(); String ttl = entry.getValue(); <START> if (column.equals(NEGATE)) <END> continue; Long l = Long.parseLong(ttl); Pair<Text,Text> colPair = ColumnSet.decodeColumns(column); if (colPair.getSecond() == null) { addObject(colPair.getFirst(), l); } else { addObject(colPair.getFirst(), colPair.getSecond(), l); } } }</code><technical_language>A user want this filter a column named NEGATE. add a condition && !TTL.equalsIgnoreCase("true") && !ttl.equalsIgnoreCase("false")</technical_language>

Target:
public TTLSet(Map<String,String> objectStrings) { super(); for (Entry<String,String> entry : objectStrings.entrySet()) { String column = entry.getKey(); String ttl = entry.getValue(); if (column.equals(NEGATE) && (ttl.equalsIgnoreCase("true") || ttl.equalsIgnoreCase("false"))) continue; Long l = Long.parseLong(ttl); Pair<Text,Text> colPair = ColumnSet.decodeColumns(column); if (colPair.getSecond() == null) { addObject(colPair.getFirst(), l); } else { addObject(colPair.getFirst(), colPair.getSecond(), l); } } }
Source:
<code>public void handleNotification(Notification notification) { if (acquireScanLock()) { switch (notification.getType()) { case DEPLOYMENT_DEPLOYED_NOTIFICATION: { String runtimeName = notification.getData().get(DEPLOYMENT).asString(); <START> ROOT_LOGGER.warn(runtimeName + " has been deployed without the scanner but I have it referenced " + deployed.containsKey(runtimeName)); <END> if (!deployed.containsKey(runtimeName)) { try { updateDeploymentStatusAfterNotification(deploymentDir.toPath(), runtimeName); } catch (IOException ioex) { ROOT_LOGGER.error("Error cleaning", ioex); } } break; } case DEPLOYMENT_UNDEPLOYED_NOTIFICATION: { String runtimeName = notification.getData().get(DEPLOYMENT).asString(); if (deployed.containsKey(runtimeName)) { clearMarkers(deployed.get(runtimeName).parentFolder.toPath(), runtimeName, DEPLOYED); deployed.remove(runtimeName); } break; } default: } } }</code><technical_language>i18n</technical_language>

Target:
public void handleNotification(Notification notification) { if (acquireScanLock()) { switch (notification.getType()) { case DEPLOYMENT_DEPLOYED_NOTIFICATION: { String runtimeName = notification.getData().get(DEPLOYMENT).asString(); if (!deployed.containsKey(runtimeName)) { updateDeploymentStatusAfterNotification(deploymentDir.toPath(), runtimeName); } break; } case DEPLOYMENT_UNDEPLOYED_NOTIFICATION: { String runtimeName = notification.getData().get(DEPLOYMENT).asString(); if (deployed.containsKey(runtimeName)) { clearMarkers(deployed.get(runtimeName).parentFolder.toPath(), runtimeName); deployed.remove(runtimeName); } break; } default: } } }
Source:
<code>public FileFormat getFileType() { if (this.getName() == null) { return FileFormat.UNKNOWN; } if (this.getIsSuperfile()) { return FileFormat.FLAT; } boolean hasxpath = hasEcl() && getEcl().toLowerCase().contains("xpath"); FileFormat fileFormatFromContent = FileFormat.getFileFormat(getContentType()); if (fileFormatFromContent == FileFormat.FLAT) { if (!hasEcl() && this.isSprayedCsv()) { return FileFormat.CSV; } return FileFormat.FLAT; } <START> else if (fileFormatFromContent == FileFormat.CSV) { <END> return FileFormat.CSV; } else if (fileFormatFromContent == FileFormat.XML) { return FileFormat.XML; } else if (fileFormatFromContent == FileFormat.KEYED) { return FileFormat.KEYED; } else if (fileFormatFromContent == FileFormat.UNKNOWN && (getContentType() == null || getContentType().equals(""))) { FileFormat fileFormat = FileFormat.getFileFormat(getFormat()); if (FileFormat.CSV == fileFormat) { return FileFormat.CSV; } else if (FileFormat.XML == fileFormat) { return FileFormat.XML; } if (getFormat().toLowerCase().startsWith("utf")) { if (hasxpath) { return FileFormat.XML; } else { return FileFormat.CSV; } } else if (fileFormat == FileFormat.UNKNOWN && (getFormat() == null || getFormat().equals("")) && hasxpath) { return FileFormat.XML; } else if (hasEcl()) { return FileFormat.FLAT; } else if (!this.isSprayedCsv()) { return FileFormat.FLAT; } else { return FileFormat.UNKNOWN; } } else { return FileFormat.UNKNOWN; } }</code><technical_language>formatting a off</technical_language>

Target:
public FileFormat getFileType() { if (this.getName() == null) { return FileFormat.UNKNOWN; } boolean hasxpath = hasEcl() && getEcl().toLowerCase().contains("xpath"); FileFormat fileFormatFromContent = FileFormat.getFileFormat(getContentType()); if (fileFormatFromContent == FileFormat.FLAT) { if (!hasEcl() && this.isSprayedCsv()) { return FileFormat.CSV; } return FileFormat.FLAT; } else if (fileFormatFromContent == FileFormat.CSV) { return FileFormat.CSV; } else if (fileFormatFromContent == FileFormat.XML) { return FileFormat.XML; } else if (fileFormatFromContent == FileFormat.KEYED || isIndex()) { return FileFormat.KEYED; } else if (fileFormatFromContent == FileFormat.UNKNOWN && (getContentType() == null || getContentType().equals(""))) { FileFormat fileFormat = FileFormat.getFileFormat(getFormat()); if (this.getIsSuperfile() && fileFormat != FileFormat.KEYED && !isIndex()) { return FileFormat.FLAT; } if (FileFormat.CSV == fileFormat) { return FileFormat.CSV; } else if (FileFormat.XML == fileFormat) { return FileFormat.XML; } if (getFormat().toLowerCase().startsWith("utf")) { if (hasxpath) { return FileFormat.XML; } else { return FileFormat.CSV; } } else if (fileFormat == FileFormat.UNKNOWN && (getFormat() == null || getFormat().equals("")) && hasxpath) { return FileFormat.XML; } else if (hasEcl()) { return FileFormat.FLAT; } else if (!this.isSprayedCsv()) { return FileFormat.FLAT; } else { return FileFormat.UNKNOWN; } } else { return FileFormat.UNKNOWN; } }
Source:
<code>protected void registerDefaultRecipes() { registerRecipe(3, new ItemStack[] { new ItemStack(Material.GOLD_INGOT) }, <START> new ItemStack[] { new ItemStack(SlimefunItems.GOLD_DUST) }); <END> }</code><technical_language>need do new ItemStack() Slimefun Item, create a wasteful object there. Other that, good for merging</technical_language>

Target:
protected void registerDefaultRecipes() { registerRecipe(3, new ItemStack(Material.GOLD_INGOT), SlimefunItems.GOLD_DUST); }
Source:
<code>private void suspend(long millis) { try { Thread.sleep(millis); } catch (InterruptedException e) { <START> System.out.println("Suspend interrupted: " + e.getMessage()); <END> } }</code><technical_language>is a reason thread interrupted re-throw InterruptedException clean exit re-enable interrupt status with: Thread.currentThread().interrupt() in this case I log a message, terminate client0 return method</technical_language>

Target:
private void suspend(long millis) { try { Thread.sleep(millis); } catch (InterruptedException e) { e.printStackTrace(); Thread.currentThread().interrupt(); } }
Source:
<code>private void showThemeExistsDialog(String inputFileName, Operation continueOperation) { StringBuilder msg = new StringBuilder(); msg.append("A theme file with the same name, '") .append(inputFileName) .append("', already exists. Adding the theme will cause the existing file to be ") <START> .append("overwritten. Would you like to add the theme anyways?"); <END> globalDisplay_.showYesNoMessage( GlobalDisplay.MSG_WARNING, "Theme File Already Exists", msg.toString(), continueOperation, false); }</code><technical_language>"anyways" is slang, "anyway". Yes, of people</technical_language>

Target:
private void showThemeExistsDialog(String inputFileName, Operation continueOperation) { StringBuilder msg = new StringBuilder(); msg.append("A theme file with the same name, '") .append(inputFileName) .append("', already exists. Adding the theme will cause the existing file to be ") .append("overwritten. Would you like to add the theme anyway?"); globalDisplay_.showYesNoMessage( GlobalDisplay.MSG_WARNING, "Theme File Already Exists", msg.toString(), continueOperation, false); }
Source:
<code>public void testExplicitlySelected_ExplicitNoInternetExpected() throws Exception { WifiConfiguration config = makeLastSelectedWifiConfiguration(FRAMEWORK_NETWORK_ID, ClientModeImpl.LAST_SELECTED_NETWORK_EXPIRATION_AGE_MILLIS - 1); mConnectedNetwork.noInternetAccessExpected = true; connect(); expectRegisterNetworkAgent(); <START> expectNetworkAgentMessage(NetworkAgent.EVENT_SET_EXPLICITLY_SELECTED, 1 , 1 , null); <END> }</code><technical_language>Done, change included in patchset1</technical_language>

Target:
public void testExplicitlySelected_ExplicitNoInternetExpected() throws Exception { WifiConfiguration config = makeLastSelectedWifiConfiguration(FRAMEWORK_NETWORK_ID, ClientModeImpl.LAST_SELECTED_NETWORK_EXPIRATION_AGE_MILLIS - 1); mConnectedNetwork.noInternetAccessExpected = true; connect(); expectRegisterNetworkAgent((agentConfig) -> { assertTrue(agentConfig.explicitlySelected); assertTrue(agentConfig.acceptUnvalidated); assertTrue(agentConfig.acceptPartialConnectivity); }); }
Source:
<code>private void oldDrawMarker(IMarkerEvent marker, GC gc, Rectangle rect) { Color color = getColorScheme().getColor(marker.getColor()); gc.setBackground(color); gc.setAlpha(color.getAlpha()); gc.fillRectangle(rect); <START> gc.setAlpha(BLACK.getAlpha()); <END> String label = marker.getLabel(); if (fLabelsVisible && label != null && marker.getEntry() != null) { label = label.substring(0, Math.min(label.indexOf('\n') != -1 ? label.indexOf('\n') : label.length(), MAX_LABEL_LENGTH)); gc.setForeground(color); Utils.drawText(gc, label, rect.x - gc.textExtent(label).x, rect.y, true); } }</code><technical_language>OPAQUE</technical_language>

Target:
private void oldDrawMarker(IMarkerEvent marker, GC gc, Rectangle rect) { Color color = getColorScheme().getColor(marker.getColor()); gc.setBackground(color); gc.setAlpha(color.getAlpha()); gc.fillRectangle(rect); gc.setAlpha(OPAQUE); String label = marker.getLabel(); if (fLabelsVisible && label != null && marker.getEntry() != null) { label = label.substring(0, Math.min(label.indexOf('\n') != -1 ? label.indexOf('\n') : label.length(), MAX_LABEL_LENGTH)); gc.setForeground(color); Utils.drawText(gc, label, rect.x - gc.textExtent(label).x, rect.y, true); } }
Source:
<code>public synchronized void done() { setSubmitted(); if (fDone) { throw new IllegalStateException("RequestMonitor: " + this + ", done() method called more than once"); } fDone = true; fCancelListeners = null; if (fParentRequestMonitor != null) { fParentRequestMonitor.removeCancelListener(fCanceledListener); } <START> if (!isSuccess() && DEBUG_MONITORS) { <END> IStatus status = getStatus(); try { throw new Exception(); } catch (Exception e) { DsfPlugin.getDefault().getLog().log(new Status(status.getSeverity(), DsfPlugin.PLUGIN_ID, status.getCode(), status.getMessage() + "\n\nMonitor Back Trace:\n" + fMonitorBacktrace.toString(), e)); } } try { fExecutor.execute(new DsfRunnable() { @Override public void run() { RequestMonitor.this.handleCompleted(); } @Override public String toString() { return "Completed: " + RequestMonitor.this.toString(); } }); } catch (RejectedExecutionException e) { handleRejectedExecutionException(); } }</code><technical_language>Reverse order of checks for efficiency</technical_language>

Target:
public synchronized void done() { setSubmitted(); if (fDone) { throw new IllegalStateException("RequestMonitor: " + this + ", done() method called more than once"); } fDone = true; fCancelListeners = null; if (fParentRequestMonitor != null) { fParentRequestMonitor.removeCancelListener(fCanceledListener); } if (DEBUG_MONITORS && !isSuccess()) { IStatus status = getStatus(); try { throw new Exception(); } catch (Exception e) { DsfPlugin.getDefault().getLog().log(new Status(status.getSeverity(), DsfPlugin.PLUGIN_ID, status.getCode(), status.getMessage() + "\n\nMonitor Back Trace:\n" + fMonitorBacktrace.toString(), e)); } } try { fExecutor.execute(new DsfRunnable() { @Override public void run() { RequestMonitor.this.handleCompleted(); } @Override public String toString() { return "Completed: " + RequestMonitor.this.toString(); } }); } catch (RejectedExecutionException e) { handleRejectedExecutionException(); } }
Source:
<code>public List<VirtualFile> getBestFileMatches() { if (myResources != null && myFile != null) { FolderConfiguration config = myConfiguration.getFullConfig(); VersionQualifier versionQualifier = config.getVersionQualifier(); <START> config.setVersionQualifier(null); <END> List<VirtualFile> matchingFiles = myResources.getMatchingFiles(myFile, getResourceType(), config); config.setVersionQualifier(versionQualifier); return matchingFiles; } return Collections.emptyList(); }</code><technical_language>do try { } finally { } this rename versionQualifier prevQualifier clear restoring previous temporarily clearing</technical_language>

Target:
public List<VirtualFile> getBestFileMatches() { if (myResources != null && myFile != null) { FolderConfiguration config = myConfiguration.getFullConfig(); VersionQualifier versionQualifier = config.getVersionQualifier(); try { config.setVersionQualifier(null); return myResources.getMatchingFiles(myFile, getResourceType(), config); } finally { config.setVersionQualifier(versionQualifier); } } return Collections.emptyList(); }
Source:
<code>public PushToApplicationAction(StateManager stateManager, PushToApplicationsManager pushToApplicationsManager, DialogService dialogService) { <START> this.application = pushToApplicationsManager.getApplicationByName(Globals.prefs.get(JabRefPreferences.PUSH_TO_APPLICATION)); <END> this.stateManager = stateManager; this.dialogService = dialogService; this.executable.bind(needsDatabase(stateManager).and(needsEntriesSelected(stateManager))); this.statusMessage.bind(BindingsHelper.ifThenElse(this.executable, "", Localization.lang("This operation requires one or more entries to be selected."))); }</code><technical_language>reuse method I proposed introduce</technical_language>

Target:
public PushToApplicationAction(StateManager stateManager, PushToApplicationsManager pushToApplicationsManager, DialogService dialogService) { this.application = Globals.prefs.getActivePushToApplication(pushToApplicationsManager); this.stateManager = stateManager; this.dialogService = dialogService; this.executable.bind(needsDatabase(stateManager).and(needsEntriesSelected(stateManager))); this.statusMessage.bind(BindingsHelper.ifThenElse(this.executable, "", Localization.lang("This operation requires one or more entries to be selected."))); }
Source:
<code>public void testAdsOnFilePageOasis() throws Exception { AdsBaseObject ads = buildAdsObjectForPage("File:Example.jpg"); ads.setPageType("file"); <START> FILE_PAGE_EXPECTED_LINE_ITEMS.put(AdsContent.TOP_LB, PROJECT43_TEST_LINE_ITEM_ID); <END> FILE_PAGE_EXPECTED_AD_UNITS.put(AdsContent.TOP_LB, FILE_PAGE_AD_UNIT); FILE_PAGE_EXPECTED_LINE_ITEMS.put(AdsContent.MEDREC, PROJECT43_TEST_LINE_ITEM_ID); FILE_PAGE_EXPECTED_AD_UNITS.put(AdsContent.MEDREC, FILE_PAGE_AD_UNIT); FILE_PAGE_EXPECTED_LINE_ITEMS.put(AdsContent.BOTTOM_LB, PROJECT43_TEST_LINE_ITEM_ID); FILE_PAGE_EXPECTED_AD_UNITS.put(AdsContent.BOTTOM_LB, FILE_PAGE_AD_UNIT); ads.verifyAds(FILE_PAGE_EXPECTED_LINE_ITEMS, FILE_PAGE_EXPECTED_AD_UNITS); }</code><technical_language>this hashmap in test scope only? needed static class property</technical_language>

Target:
public void testAdsOnFilePageOasis() throws Exception { AdsBaseObject ads = buildAdsObjectForPage("File:Example.jpg"); testFilePage(ads); }
Source:
<code>public void log(EventType type, Object... values) { if(!enabled) { return; } try { Request request = Request.Post(forwardUrl + "/") .bodyString(mapper.writeValueAsString(new HttpEvent(new Date(), type, values)), ContentType.APPLICATION_JSON); async.execute(request, new FutureCallback<Content>() { public void failed(final Exception ex) { <START> metrics.markProxyError(); <END> } public void completed(final Content content) { } public void cancelled() { } }); } catch (Throwable t) { log.error("EventLog write failed: {}", t.getMessage()); metrics.markEventLogError(); } }</code><technical_language>markEventLogError</technical_language>

Target:
public void log(EventType type, Object... values) { if (!enabled) { return; } try { Request request = Request.Post(forwardUrl + "/") .bodyString(mapper.writeValueAsString(new HttpEvent(new Date(), type, values)), ContentType.APPLICATION_JSON); async.execute(request, new FutureCallback<Content>() { public void failed(final Exception ex) { metrics.markEventLogError(); } public void completed(final Content content) { } public void cancelled() { } }); } catch (Throwable t) { log.error("EventLog write failed: {}", t.getMessage()); metrics.markEventLogError(); } }
Source:
<code>public void testAllocateSlot() throws Exception { CompletableFuture<SlotRequest> slotRequestFuture = new CompletableFuture<>(); resourceManagerGateway.setRequestSlotConsumer(slotRequestFuture::complete); try (SlotPoolImpl slotPool = createAndSetUpSlotPool()) { testMainThreadExecutor.execute(() -> slotPool.registerTaskManager(taskManagerLocation.getResourceID())); <START> Scheduler scheduler = new SchedulerImpl(LocationPreferenceSlotSelectionStrategy.createDefault(), slotPool); <END> scheduler.start(testMainThreadExecutor.getMainThreadExecutor()); SlotRequestId requestId = new SlotRequestId(); CompletableFuture<LogicalSlot> future = testMainThreadExecutor.execute(() -> scheduler.allocateSlot( requestId, new DummyScheduledUnit(), SlotProfile.noRequirements(), timeout)); assertFalse(future.isDone()); final SlotRequest slotRequest = slotRequestFuture.get(timeout.toMilliseconds(), TimeUnit.MILLISECONDS); final SlotOffer slotOffer = new SlotOffer( slotRequest.getAllocationId(), 0, DEFAULT_TESTING_PROFILE); assertTrue(testMainThreadExecutor.execute(() -> slotPool.offerSlot( taskManagerLocation, taskManagerGateway, slotOffer))); LogicalSlot slot = future.get(1, TimeUnit.SECONDS); assertTrue(future.isDone()); assertTrue(slot.isAlive()); assertEquals(taskManagerLocation, slot.getTaskManagerLocation()); } }</code><technical_language>final. applies some other variables below</technical_language>

Target:
public void testAllocateSlot() throws Exception { CompletableFuture<SlotRequest> slotRequestFuture = new CompletableFuture<>(); resourceManagerGateway.setRequestSlotConsumer(slotRequestFuture::complete); try (SlotPoolImpl slotPool = createAndSetUpSlotPool()) { final Scheduler scheduler = createAndSetUpScheduler(slotPool); final CompletableFuture<LogicalSlot> allocatedSlotFuture = allocateSlot(scheduler); assertFalse(allocatedSlotFuture.isDone()); final SlotRequest slotRequest = slotRequestFuture.get(TIMEOUT.toMilliseconds(), TimeUnit.MILLISECONDS); testMainThreadExecutor.execute(() -> slotPool.registerTaskManager(taskManagerLocation.getResourceID())); final SlotOffer slotOffer = new SlotOffer( slotRequest.getAllocationId(), 0, ResourceProfile.ANY); testMainThreadExecutor.execute(() -> slotPool.offerSlot( taskManagerLocation, taskManagerGateway, slotOffer)); final LogicalSlot allocatedSlot = allocatedSlotFuture.get(1, TimeUnit.SECONDS); assertTrue(allocatedSlotFuture.isDone()); assertTrue(allocatedSlot.isAlive()); assertEquals(taskManagerLocation, allocatedSlot.getTaskManagerLocation()); } }
Source:
<code>private ImmutableList<Dimension> createDimensions(Iterable<Map<String, Object>> dimensions) { <START> if (dimensions == null) { <END> return ImmutableList.of(); } return FluentIterable.from(dimensions).transform(MAP_ENTRY_TO_DIMENSION).toList(); }</code><technical_language>Please handle nullity in constructor</technical_language>

Target:
private ImmutableList<Dimension> createDimensions(Iterable<Map<String, Object>> dimensions) { return FluentIterable.from(dimensions).transform(MAP_ENTRY_TO_DIMENSION).toList(); }
Source:
<code>public Set<IInstallableUnit> readXML(InputStream is) throws IOException { Parser parser = new <START> Parser(org.eclipse.tycho.p2.maven.repository.xmlio.MetadataIO.Parser.PARSER_MODE.REPO); <END> parser.parse(is, new NullProgressMonitor()); Set<IInstallableUnit> units = new LinkedHashSet<IInstallableUnit>(); for (InstallableUnitDescription desc : parser.getUnits()) { units.add(MetadataFactory.createInstallableUnit(desc)); } return units; }</code><technical_language>omit</technical_language>

Target:
public Set<IInstallableUnit> readXML(InputStream is) throws IOException { Parser parser = new Parser(Parser.PARSER_MODE.REPO); parser.parse(is, new NullProgressMonitor()); Set<IInstallableUnit> units = new LinkedHashSet<IInstallableUnit>(); for (InstallableUnitDescription desc : parser.getUnits()) { units.add(MetadataFactory.createInstallableUnit(desc)); } return units; }
Source:
<code>public static FieldNode addNodeByPath( FieldNode fieldNode, String path) { if (path == null || path.isEmpty()) { return fieldNode; } boolean found = false; int index = 0; String[] ps = path.split("\\."); FieldNode c = fieldNode; if (fieldNode != null) { <START> List<FieldNode> currentList = (c == null) ? null : Arrays.asList(c); <END> while (index < ps.length) { found = false; for (FieldNode n : currentList) { if (n.getFieldName().equals(ps[index])) { found = true; if (n.getNodes().isEmpty()) { return fieldNode; } c = n; currentList = c.getNodes(); break; } } if (found) { index++; } else { break; } } } if (!found) { while (index < ps.length) { FieldNode n = new FieldNode(ps[index]); if (fieldNode == null) { fieldNode = n; } if (c != null) { c.addFieldNodes(n); } c = n; index++; } } return fieldNode; }</code><technical_language>'c' is nonnull here</technical_language>

Target:
public static FieldNode addNodeByPath( FieldNode fieldNode, String path) { if (path == null || path.isEmpty()) { return fieldNode; } boolean found = false; int index = 0; String[] ps = path.split("\\."); FieldNode c = fieldNode; if (fieldNode != null) { List<FieldNode> currentList = Arrays.asList(c); while (index < ps.length) { found = false; for (FieldNode n : currentList) { if (n.getFieldName().equals(ps[index])) { found = true; if (n.getNodes().isEmpty()) { return fieldNode; } c = n; currentList = c.getNodes(); break; } } if (found) { index++; } else { break; } } } if (!found) { while (index < ps.length) { FieldNode n = new FieldNode(ps[index]); if (fieldNode == null) { fieldNode = n; } if (c != null) { c.addFieldNodes(n); } c = n; index++; } } else { if (index == ps.length) { c.getNodes().clear(); } } return fieldNode; }
Source:
<code>public List<String> getNames() { final List<String> steps = new ArrayList<>(); <START> if (battleState.getBattleSite().isWater() <END> && Properties.getTransportCasualtiesRestricted(battleState.getGameData()) && (battleState.getAttackingUnits().stream().anyMatch(Matches.unitIsTransport()) || battleState.getDefendingUnits().stream().anyMatch(Matches.unitIsTransport()))) { steps.add(REMOVE_UNESCORTED_TRANSPORTS); } return steps; }</code><technical_language>Nit: considered a ternary here? Avoiding intermediate variables is a good thing</technical_language>

Target:
public List<String> getNames() { if (battleState.getBattleSite().isWater() && Properties.getTransportCasualtiesRestricted(battleState.getGameData()) && (battleState.getAttackingUnits().stream().anyMatch(Matches.unitIsTransport()) || battleState.getDefendingUnits().stream().anyMatch(Matches.unitIsTransport()))) { return List.of(REMOVE_UNESCORTED_TRANSPORTS); } return List.of(); }
Source:
<code>private void createUpdateDialog(String content) { RssUpdate update = parser.parseUpdate(content); if(update != null) { <START> Thread updateDialogThread = new Thread(() -> myUiFacade.showUpdateDialog(update)); <END> updateDialogThread.start(); } }</code><technical_language>I creating Thread is necessary UI shown in Swing thread subsequent download run in Swing thread. SwingUtilities.invokeLater do trick</technical_language>

Target:
private void createUpdateDialog(String content) { RssUpdate update = parser.parseUpdate(content); if (update != null) { UpdateDialog.show(myUiFacade, update); } }
Source:
<code>public void scrape(HttpAction action) { try (ServletOutputStream out = action.response.getOutputStream()) { action.response.setContentType( WebContent.contentTypeTextPlain ); action.response.setCharacterEncoding( WebContent.charsetUTF8 ); <START> <END> out.write( meterRegistry.scrape().getBytes() ); } catch (Throwable t) { ServletOps.errorOccurred( t ); } }</code><technical_language>Add ServletOps.success(action); writing starts. This record response code. "-1 -1" printed Fuseki log</technical_language>

Target:
public void scrape(HttpAction action) { try (ServletOutputStream out = action.response.getOutputStream()) { ServletOps.success(action); action.response.setContentType( WebContent.contentTypeTextPlain ); action.response.setCharacterEncoding( WebContent.charsetUTF8 ); out.write( meterRegistry.scrape().getBytes() ); } catch (Throwable t) { ServletOps.errorOccurred( t ); } }
Source:
<code>public ITmfStateValue getValue(@Nullable ITmfEvent event, @Nullable TmfXmlScenarioInfo scenarioInfo) throws AttributeNotFoundException { Object result = null; ScriptEngineManager manager = new ScriptEngineManager(); ScriptEngine engine = manager.getEngineByName(fScriptEngine); for (TmfXmlStateValue stateValue : fChildStateValues) { ITmfStateValue value = stateValue.getValue(event, scenarioInfo); switch (value.getType()) { case LONG: engine.put(stateValue.getID(), value.unboxLong()); break; case INTEGER: engine.put(stateValue.getID(), value.unboxInt()); break; case STRING: engine.put(stateValue.getID(), value.unboxStr()); break; case DOUBLE: case CUSTOM: case NULL: default: } } try { result = engine.eval(fScript); } catch (ScriptException e) { <START> Activator.logError("Script execution failed", e); END> return TmfStateValue.nullValue(); } return TmfStateValue.newValueObjectWithForcedType(result, fForcedType); }</code><technical_language>If error, fail for event is called. approach validate better, simply stop analysis X script failures</technical_language>

Target:
public ITmfStateValue getValue(@Nullable ITmfEvent event, @Nullable TmfXmlScenarioInfo scenarioInfo) throws AttributeNotFoundException { Object result = null; ScriptEngineManager manager = new ScriptEngineManager(); ScriptEngine engine = manager.getEngineByName(fScriptEngine); for (TmfXmlStateValue stateValue : fChildStateValues) { String stateValueID = stateValue.getID(); if (stateValueID != null) { ITmfStateValue value = stateValue.getValue(event, scenarioInfo); switch (value.getType()) { case LONG: engine.put(stateValueID, value.unboxLong()); break; case INTEGER: engine.put(stateValueID, value.unboxInt()); break; case STRING: engine.put(stateValueID, value.unboxStr()); break; case DOUBLE: case CUSTOM: case NULL: default: } }else{ Activator.logWarning(Messages.TmfXmlStateValue_MissingScriptChildrenID); } } try { result = engine.eval(fScript); } catch (ScriptException e) { Activator.logError("Script execution failed", e); return TmfStateValue.nullValue(); } return TmfXmlUtils.newTmfStateValueFromObjectWithForcedType(result, fForcedType); }
Source:
<code>public void matchShouldReturnAddressesWhenSubclassOfSpecifiedExceptionHasOccurred() throws MessagingException { mockedMail.setAttribute(Mail.MAILET_ERROR_ATTRIBUTE_NAME, new javax.mail.internet.AddressException()); FakeMatcherConfig matcherConfig = FakeMatcherConfig.builder().matcherName("HasException") <START> .condition("javax.mail.MessagingException").build(); <END> matcher.init(matcherConfig); assertThat(matcher.match(mockedMail)).containsExactlyElementsOf(mockedMail.getRecipients()); }</code><technical_language>prevent a user define configuration in _mailetcontainer.xml_ <mailet match="HasException=ManageSieveException" class="...> a good idea cover this a test</technical_language>

Target:
public void matchShouldReturnAddressesWhenSubclassOfSpecifiedExceptionHasOccurred() throws MessagingException { mockedMail.setAttribute(Mail.MAILET_ERROR_ATTRIBUTE_NAME, new javax.mail.internet.AddressException()); FakeMatcherConfig matcherConfig = FakeMatcherConfig.builder() .matcherName("HasException") .condition("javax.mail.MessagingException") .build(); testee.init(matcherConfig); assertThat(testee.match(mockedMail)).containsExactlyElementsOf(mockedMail.getRecipients()); }
Source:
<code>protected IntegrationTest(final Class<? extends ResourceConfig> resourceConfig, String packageName) { this.resourceConfig = resourceConfig.getName(); this.packageName = packageName; if (dataStoreHarness == null) { dataStoreHarness = createHarness(); } this.dataStore = dataStoreHarness.getDataStore(); try { this.server = setUpServer(); } catch (Exception e) { <START> e.printStackTrace(); <END> throw new IllegalStateException(e); } }</code><technical_language>remove this</technical_language>

Target:
protected IntegrationTest(final Class<? extends ResourceConfig> resourceConfig, String packageName) { this.resourceConfig = resourceConfig.getName(); this.packageName = packageName; if (dataStoreHarness == null) { dataStoreHarness = createHarness(); } this.dataStore = dataStoreHarness.getDataStore(); try { this.server = setUpServer(); } catch (Exception e) { throw new IllegalStateException(e); } }
Source:
<code>public void cleanup() { if (solrClient != null) { try { solrClient.close(); } catch (IOException e) { <START> LOG.debug("Error while closing solrClient", e); <END> } } }</code><technical_language>error level</technical_language>

Target:
public void cleanup() { if (solrClient != null) { try { solrClient.close(); } catch (IOException e) { LOG.error("Error while closing solrClient", e); } } }
Source:
<code>public FormValidation doCheckResourceNames(@QueryParameter String value, @QueryParameter String labelName, @QueryParameter boolean script) { String labelVal = Util.fixEmptyAndTrim(labelName); String names = Util.fixEmptyAndTrim(value); if (names == null) { return FormValidation.ok(); } else if (labelVal != null || script) { return FormValidation.error( "Only label, groovy expression, or resources can be defined, not more than one."); } else { List<String> wrongNames = new ArrayList<>(); List<String> varNames = new ArrayList<>(); for (String name : names.split("\\s+")) { <START> if (name.startsWith("$")) { <END> varNames.add(name); continue; } boolean found = false; for (LockableResource r : LockableResourcesManager.get() .getResources()) { if (r.getName().equals(name)) { found = true; break; } } if (!found) wrongNames.add(name); } if (wrongNames.isEmpty() && varNames.isEmpty()) { return FormValidation.ok(); } else if (wrongNames.isEmpty()) { return FormValidation .warning("The following resources cannot be validated as they are the environment variables: " + varNames); } else { return FormValidation .error("The following resources do not exist: " + wrongNames); } } }</code><technical_language>Is this restriction useful? expand sub-strings? printer-${office} a perfectly valid case</technical_language>

Target:
public FormValidation doCheckResourceNames(@QueryParameter String value, @QueryParameter String labelName, @QueryParameter boolean script) { String labelVal = Util.fixEmptyAndTrim(labelName); String names = Util.fixEmptyAndTrim(value); if (names == null) { return FormValidation.ok(); } else if (labelVal != null || script) { return FormValidation.error( "Only label, groovy expression, or resources can be defined, not more than one."); } else { List<String> wrongNames = new ArrayList<>(); List<String> varNames = new ArrayList<>(); for (String name : names.split("\\s+")) { boolean found = false; for (LockableResource r : LockableResourcesManager.get() .getResources()) { if (r.getName().equals(name)) { found = true; break; } } if (!found) { if (name.contains("$")) { varNames.add(name); } else { wrongNames.add(name); } } } if (wrongNames.isEmpty() && varNames.isEmpty()) { return FormValidation.ok(); } else if (wrongNames.isEmpty()) { return FormValidation .warning("The following resources cannot be validated as they are the environment variables: " + varNames); } else { return FormValidation .error("The following resources do not exist: " + wrongNames); } } }
Source:
<code>private void validateCascadedContainerElementsForCurrentGroup(Object value, ValidationContext<?> validationContext, ValueContext<?, ?> valueContext, List<ContainerCascadingMetaData> containerElementTypesCascadingMetaData) { for ( ContainerCascadingMetaData cascadingMetaData : containerElementTypesCascadingMetaData ) { if ( !cascadingMetaData.isMarkedForCascadingOnAnnotatedObjectOrContainerElements() ) { continue; } ValueExtractorDescriptor extractor = valueExtractorManager.getMaximallySpecificAndRuntimeContainerElementCompliantValueExtractor( cascadingMetaData.getEnclosingType(), value.getClass(), <START> cascadingMetaData.getTypeParameter() <END> ); if ( extractor == null ) { throw LOG.getNoValueExtractorFoundForTypeException( cascadingMetaData.getEnclosingType(), cascadingMetaData.getTypeParameter(), value.getClass() ); } CascadingValueReceiver receiver = new CascadingValueReceiver( validationContext, valueContext, cascadingMetaData ); ValueExtractorHelper.extractValues( extractor, value, receiver ); } }</code><technical_language>I I put 2 cascading metadata information runtime type</technical_language>

Target:
private void validateCascadedContainerElementsForCurrentGroup(Object value, ValidationContext<?> validationContext, ValueContext<?, ?> valueContext, List<ContainerCascadingMetaData> containerElementTypesCascadingMetaData) { for ( ContainerCascadingMetaData cascadingMetaData : containerElementTypesCascadingMetaData ) { if ( !cascadingMetaData.isMarkedForCascadingOnAnnotatedObjectOrContainerElements() ) { continue; } ValueExtractorDescriptor extractor = valueExtractorManager.getMaximallySpecificAndRuntimeContainerElementCompliantValueExtractor( cascadingMetaData.getEnclosingType(), cascadingMetaData.getTypeParameter(), value.getClass(), cascadingMetaData.getValueExtractorCandidates() ); if ( extractor == null ) { throw LOG.getNoValueExtractorFoundForTypeException( cascadingMetaData.getEnclosingType(), cascadingMetaData.getTypeParameter(), value.getClass() ); } CascadingValueReceiver receiver = new CascadingValueReceiver( validationContext, valueContext, cascadingMetaData ); ValueExtractorHelper.extractValues( extractor, value, receiver ); } }
Source:
<code><START> public GHRepository loadRepository(final String repositoryName) { <END> try { if (gh != null && isAuthenticated() && (myRealm.hasScope("repo") || myRealm.hasScope("public_repo"))) { Optional<GHRepository> optionalRepo = repositoryCache.get(repositoryName, new Callable<Optional<GHRepository>>() { @Override public Optional<GHRepository> call() throws Exception { return Optional.fromNullable(getGitHub().getRepository(repositoryName)); } } ); return optionalRepo.orNull(); } } catch (Exception e) { LOGGER.log(Level.SEVERE, "an exception was thrown", e); LOGGER.log(Level.WARNING, "Looks like a bad GitHub URL OR the Jenkins user {0} does not have access to the repository {1}. May need to add 'repo' or 'public_repo' to the list of oauth scopes requested.", new Object[] { this.userName, repositoryName }); } return null; }</code><technical_language>is this a final String opposed String</technical_language>

Target:
public RepoRights loadRepository(final String repositoryName) { try { if (gh != null && isAuthenticated() && (myRealm.hasScope("repo") || myRealm.hasScope("public_repo"))) { return repositoryCache.get(repositoryName, new Callable<RepoRights>() { @Override public RepoRights call() throws Exception { GHRepository repo = getGitHub().getRepository(repositoryName); return new RepoRights(repo); } } ); } } catch (Exception e) { LOGGER.log(Level.SEVERE, "an exception was thrown", e); LOGGER.log(Level.WARNING, "Looks like a bad GitHub URL OR the Jenkins user {0} does not have access to the repository {1}. May need to add 'repo' or 'public_repo' to the list of oauth scopes requested.", new Object[] { this.userName, repositoryName }); } return null; }
Source:
<code>ContainerDelta(Set<PackingPlan.ContainerPlan> currentContainers, Set<PackingPlan.ContainerPlan> proposedContainers) { Set<PackingPlan.ContainerPlan> toAdd = new HashSet<>(); for (PackingPlan.ContainerPlan proposedContainerPlan : proposedContainers) { if (!currentContainers.contains(proposedContainerPlan)) { toAdd.add(proposedContainerPlan); } } this.containersToAdd = Collections.unmodifiableSet(toAdd); Set<PackingPlan.ContainerPlan> toRemove = new HashSet<>(); for (PackingPlan.ContainerPlan curentContainerPlan : currentContainers) { if (!proposedContainers.contains(curentContainerPlan)) { toRemove.add(curentContainerPlan); } } <START> this.containersToRemove = Collections.unmodifiableSet(toRemove); <END> }</code><technical_language>a confused here. Do remove a container if instances do match previous ones? if current container contains instances 1,2,3 proposed container contains 1,2,4? Do remove this container re-allocate it</technical_language>

Target:
ContainerDelta(Set<PackingPlan.ContainerPlan> currentContainers, Set<PackingPlan.ContainerPlan> proposedContainers) { Set<Integer> currentContainerIds = toIdSet(currentContainers); Set<Integer> proposedContainerIds = toIdSet(proposedContainers); Set<PackingPlan.ContainerPlan> toAdd = new HashSet<>(); for (PackingPlan.ContainerPlan proposedContainerPlan : proposedContainers) { if (!currentContainerIds.contains(proposedContainerPlan.getId())) { toAdd.add(proposedContainerPlan); } } this.containersToAdd = Collections.unmodifiableSet(toAdd); Set<PackingPlan.ContainerPlan> toRemove = new HashSet<>(); for (PackingPlan.ContainerPlan currentContainerPlan : currentContainers) { if (!proposedContainerIds.contains(currentContainerPlan.getId())) { toRemove.add(currentContainerPlan); } } this.containersToRemove = Collections.unmodifiableSet(toRemove); }