auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>static Template parsedTemplateForResource(String resourceName) { String jar = getJARFromURL(AutoValueTemplateVars.class); InputStream in = null; if (jar != null) { File file = new File(jar); try { JarFile jarFile = new JarFile(file); ZipEntry entry = jarFile.getEntry("com/google/auto/value/processor/".replace('/', File.separatorChar) + resourceName); in = jarFile.getInputStream(entry); <START> } catch (IOException e) { <END> } } if (in == null) { in = AutoValueTemplateVars.class.getResourceAsStream(resourceName); } if (in == null) { throw new IllegalArgumentException("Could not find resource: " + resourceName); } try { Reader reader = new BufferedReader(new InputStreamReader(in, "UTF-8")); return Template.parseFrom(reader); } catch (UnsupportedEncodingException e) { throw new AssertionError(e); } catch (IOException e) { throw new AssertionError(e); } }</code><technical_language>e -></technical_language>

Target:
static Template parsedTemplateForResource(String resourceName) { String jar = getJARFromURL(AutoValueTemplateVars.class); InputStream in = null; if (jar != null) { File file = new File(jar); try { JarFile jarFile = new JarFile(file); ZipEntry entry = jarFile.getEntry("com/google/auto/value/processor/".replace('/', File.separatorChar) + resourceName); in = jarFile.getInputStream(entry); } catch (Exception ignored) { } } if (in == null) { in = AutoValueTemplateVars.class.getResourceAsStream(resourceName); } if (in == null) { throw new IllegalArgumentException("Could not find resource: " + resourceName); } try { Reader reader = new BufferedReader(new InputStreamReader(in, "UTF-8")); return Template.parseFrom(reader); } catch (UnsupportedEncodingException e) { throw new AssertionError(e); } catch (IOException e) { throw new AssertionError(e); } }
Source:
<code>public static Method[] getPropertyMethods(PropertyDescriptor[] properties, boolean read, boolean write) { Set methods = new HashSet(); for (int i = 0; i < properties.length; i++) { PropertyDescriptor pd = properties[i]; if (read) { methods.add(pd.getReadMethod()); } if (write) { methods.add(pd.getWriteMethod()); } } methods.remove(null); <START> return (Method[]) methods.toArray(new Method[0]); <END> }</code><technical_language>This is bad, creates **2 arrays**: new Method[0], toArray() capacity of array is sufficient create **one more array**</technical_language>

Target:
public static Method[] getPropertyMethods(PropertyDescriptor[] properties, boolean read, boolean write) { Set methods = new HashSet(); for (int i = 0; i < properties.length; i++) { PropertyDescriptor pd = properties[i]; if (read) { methods.add(pd.getReadMethod()); } if (write) { methods.add(pd.getWriteMethod()); } } methods.remove(null); return (Method[]) methods.toArray(new Method[methods.size()]); }
Source:
<code>public int execute(File runFile, String task, File workingDir, Operation operation) throws Exception { try (Bndrun run = init(runFile, task, workingDir)) { run.getInfo(run.getWorkspace()); int errors = report(run); if (!run.isOk()) { <START> return errors; <END> } return operation.apply(runFile, getNamePart(runFile), run); } }</code><technical_language>I need check for run == null return 1;. prior behavior if runFile exist. Otherwise, get NPE here</technical_language>

Target:
public int execute(File runFile, String task, File workingDir, Operation operation) throws Exception { try (Bndrun run = init(runFile, task, workingDir)) { if (run == null) { return 1; } int errors = report(run); if (!run.isOk()) { return errors; } injectImplicitRepository(run); return operation.apply(runFile, getNamePart(runFile), run); } }
Source:
<code>private void initGUI() { <START> ArrayList<Part> spareParts = campaign.getSpareParts(); <END> for(Part spare : spareParts) { if(spare instanceof AmmoStorage && ((EquipmentPart)spare).getType() instanceof BombType && spare.isPresent()) { int bombType = (BombType.getBombTypeFromInternalName(((AmmoStorage)spare).getType().getInternalName())); bombCatalog[bombType] = spare.getId(); availBombs[bombType] = ((AmmoStorage)spare).getShots(); } } for (int type = 0; type < BombType.B_NUM; type++) { typeMax[type] = availBombs[type] + bombChoices[type]; } bombPanel = new BombChoicePanel(bomber, campaign.getGameOptions().booleanOption("at2_nukes"), campaign.getGameOptions().booleanOption("allow_advanced_ammo"), typeMax); JScrollPane scroller = new JScrollPane(bombPanel); scroller.setPreferredSize(new Dimension(300, 200)); setLayout(new BorderLayout()); add(scroller, BorderLayout.CENTER); add(buildButtonPanel(), BorderLayout.SOUTH); }</code><technical_language>is more generic interface List<Part> instead of specific ArrayList class. more flexible handle a change in return type container class implements List interface. For matter, method is called a return type of List, scope of this feature</technical_language>

Target:
private void initGUI() { List<Part> spareParts = campaign.getSpareParts(); for(Part spare : spareParts) { if(spare instanceof AmmoStorage && ((EquipmentPart)spare).getType() instanceof BombType && spare.isPresent()) { int bombType = (BombType.getBombTypeFromInternalName(((AmmoStorage)spare).getType().getInternalName())); bombCatalog[bombType] = spare.getId(); availBombs[bombType] = ((AmmoStorage)spare).getShots(); } } for (int type = 0; type < BombType.B_NUM; type++) { typeMax[type] = availBombs[type] + bombChoices[type]; } bombPanel = new BombChoicePanel(bomber, campaign.getGameOptions().booleanOption("at2_nukes"), campaign.getGameOptions().booleanOption("allow_advanced_ammo"), typeMax); JScrollPane scroller = new JScrollPane(bombPanel); scroller.setPreferredSize(new Dimension(300, 200)); setLayout(new BorderLayout()); add(scroller, BorderLayout.CENTER); add(buildButtonPanel(), BorderLayout.SOUTH); }
Source:
<code>public void testFindLiveVersionHTMLPage() throws Exception{ String ext="."+Config.getStringProperty("VELOCITY_PAGE_EXTENSION"); Template template=new Template(); template.setTitle("TEST TEMPLATE VERSIONABLE"); template.setBody("<html><body> I'm mostly empty </body></html>"); <START> template=APILocator.getTemplateAPI().saveTemplate(template, host, user, false); <END> Folder folder = APILocator.getFolderAPI().createFolders("/testingVersionable", host, user, false); HTMLPage page=new HTMLPage(); page.setPageUrl("testpage"+ext); page.setFriendlyName("testpage"+ext); page.setTitle("testpage"+ext); page=APILocator.getHTMLPageAPI().saveHTMLPage(page, template, folder, user, false); APILocator.getVersionableAPI().setLive(page); Versionable verAPI = APILocator.getVersionableAPI().findLiveVersion(page.getIdentifier(), user, false); assertEquals(verAPI.getTitle(),page.getTitle()); assertEquals(verAPI.getInode(),page.getInode()); APILocator.getHTMLPageAPI().delete(page, user, false); APILocator.getFolderAPI().delete(folder, user, false); APILocator.getTemplateAPI().delete(template, user, false); }</code><technical_language>above: Template template = new TemplateDataGen().nextPersisted();</technical_language>

Target:
public void testFindLiveVersionHTMLPage() throws Exception{ HTMLPage page = createHTMLPage(); APILocator.getVersionableAPI().setLive(page); Versionable verAPI = APILocator.getVersionableAPI().findLiveVersion(page.getIdentifier(), user, false); assertEquals(verAPI.getTitle(),page.getTitle()); assertEquals(verAPI.getInode(),page.getInode()); Folder folder = APILocator.getHTMLPageAPI().getParentFolder(page); Template template = APILocator.getHTMLPageAPI().getTemplateForWorkingHTMLPage(page); APILocator.getHTMLPageAPI().delete(page, user, false); APILocator.getFolderAPI().delete(folder, user, false); APILocator.getTemplateAPI().delete(template, user, false); }
Source:
<code>void openRedirect(Attributes attributes) { <START> page.Redirect = new Title(attributes.getValue("title"), siteinfo.Namespaces); <END> }</code><technical_language>this work expected dump title attribute</technical_language>

Target:
void openRedirect(Attributes attributes) { String title = attributes.getValue("title"); if (title != null) { page.Redirect = new Title(title, siteinfo.Namespaces); } page.isRedirect = true; }
Source:
<code>public String generateStorePath( String physicalPath ) { if ( StringUtils.isBlank( baseDir ) || !physicalPath.contains( baseDir ) ) { return physicalPath; } final int storePathStart = physicalPath.indexOf( baseDir ) + baseDir.length(); final String storePath = physicalPath.substring( storePathStart ); <START> return storePath.startsWith( "/" ) ? storePath : "/" + storePath; <END> }</code><technical_language>I suggest removing /. In physical store "new File( baseDir, fileInfo.getFileStorage())" storage path is relative baseDir. works, a bit different, e.g, "9s/3b/jasldjgenha" vs. "/9s/3b/jasldjgenha". In this case, leading / confuse root of disk</technical_language>

Target:
public String generateStorePath( String physicalPath ) { if ( StringUtils.isBlank( baseDir ) || !physicalPath.contains( baseDir ) ) { return physicalPath; } final int storePathStart = physicalPath.indexOf( baseDir ) + baseDir.length(); final String storePath = physicalPath.substring( storePathStart ); return storePath.startsWith( "/" ) ? storePath.substring( 1 ) : storePath; }
Source:
<code>public void decreaseMultiplier() { SweepBatchConfig lastBatchConfig = getAdjustedSweepConfig(); batchSizeMultiplier = Math.max(batchSizeMultiplier / 2, 1.5 / lastBatchConfig.candidateBatchSize()); <START> log.warn("The background sweep job failed unexpectedly with candidate batch size {}," <END> + " delete batch size {}," + " and cell+timestamp pairs to examine." + " Attempting to continue with new batchSizeMultiplier {}", SafeArg.of("candidateBatchSize", lastBatchConfig.candidateBatchSize()), SafeArg.of("deleteBatchSize", lastBatchConfig.deleteBatchSize()), SafeArg.of("maxCellTsPairsToExamine", lastBatchConfig.maxCellTsPairsToExamine()), SafeArg.of("batchSizeMultiplier", batchSizeMultiplier)); }</code><technical_language>nit: odd AdjustableSweepBatchConfigSource logs for background sweep job, wouldnt block refactor here</technical_language>

Target:
public void decreaseMultiplier() { SweepBatchConfig lastBatchConfig = getAdjustedSweepConfig(); batchSizeMultiplier = Math.max(batchSizeMultiplier / 2, 1.5 / lastBatchConfig.candidateBatchSize()); log.warn("Sweep failed unexpectedly with candidate batch size {}," + " delete batch size {}," + " and cell+timestamp pairs to examine." + " Attempting to continue with new batchSizeMultiplier {}", SafeArg.of("candidateBatchSize", lastBatchConfig.candidateBatchSize()), SafeArg.of("deleteBatchSize", lastBatchConfig.deleteBatchSize()), SafeArg.of("maxCellTsPairsToExamine", lastBatchConfig.maxCellTsPairsToExamine()), SafeArg.of("batchSizeMultiplier", batchSizeMultiplier)); }
Source:
<code>public void directBufferCheck() throws Exception { ByteBuffer heapBuf = ByteBuffer.allocate(64); ByteBuffer directBuf = ByteBuffer.allocateDirect(64); try { BitShuffle.bitShuffle(heapBuf, BitShuffleType.BYTE, directBuf); fail("no expected exception happened"); } catch (SnappyError e) { Assert.assertTrue(e.errorCode == SnappyErrorCode.NOT_A_DIRECT_BUFFER); <START> System.err.println("XXX:" + e.getMessage()); <END> Assert.assertTrue(e.getMessage().contains("input is not a direct buffer")); } try { BitShuffle.bitShuffle(directBuf, BitShuffleType.BYTE, heapBuf); fail("no expected exception happened"); } catch (SnappyError e) { Assert.assertTrue(e.errorCode == SnappyErrorCode.NOT_A_DIRECT_BUFFER); Assert.assertTrue(e.getMessage().contains("destination is not a direct buffer")); } try { BitShuffle.bitUnShuffle(heapBuf, BitShuffleType.BYTE, directBuf); fail("no expected exception happened"); } catch (SnappyError e) { Assert.assertTrue(e.errorCode == SnappyErrorCode.NOT_A_DIRECT_BUFFER); Assert.assertTrue(e.getMessage().contains("input is not a direct buffer")); } try { BitShuffle.bitUnShuffle(directBuf, BitShuffleType.BYTE, heapBuf); fail("no expected exception happened"); } catch (SnappyError e) { Assert.assertTrue(e.errorCode == SnappyErrorCode.NOT_A_DIRECT_BUFFER); Assert.assertTrue(e.getMessage().contains("destination is not a direct buffer")); } }</code><technical_language>Unnecessary line</technical_language>

Target:
public void directBufferCheck() throws Exception { ByteBuffer heapBuf = ByteBuffer.allocate(64); ByteBuffer directBuf = ByteBuffer.allocateDirect(64); try { BitShuffle.shuffle(heapBuf, BitShuffleType.BYTE, directBuf); fail("no expected exception happened"); } catch (SnappyError e) { Assert.assertTrue(e.errorCode == SnappyErrorCode.NOT_A_DIRECT_BUFFER); Assert.assertTrue(e.getMessage().contains("input is not a direct buffer")); } try { BitShuffle.shuffle(directBuf, BitShuffleType.BYTE, heapBuf); fail("no expected exception happened"); } catch (SnappyError e) { Assert.assertTrue(e.errorCode == SnappyErrorCode.NOT_A_DIRECT_BUFFER); Assert.assertTrue(e.getMessage().contains("destination is not a direct buffer")); } try { BitShuffle.unshuffle(heapBuf, BitShuffleType.BYTE, directBuf); fail("no expected exception happened"); } catch (SnappyError e) { Assert.assertTrue(e.errorCode == SnappyErrorCode.NOT_A_DIRECT_BUFFER); Assert.assertTrue(e.getMessage().contains("input is not a direct buffer")); } try { BitShuffle.unshuffle(directBuf, BitShuffleType.BYTE, heapBuf); fail("no expected exception happened"); } catch (SnappyError e) { Assert.assertTrue(e.errorCode == SnappyErrorCode.NOT_A_DIRECT_BUFFER); Assert.assertTrue(e.getMessage().contains("destination is not a direct buffer")); } }
Source:
<code>private void addNetworkBroadcastReceiver() { IntentFilter intentFilter = new IntentFilter(NETWORK_INTENT_ACTION); broadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (NetworkUtils.isInternetConnectionEstablished(NearbyActivity.this)) { <START> refreshView(LOCATION_SIGNIFICANTLY_CHANGED); <END> } else { Snackbar.make(transparentView , R.string.no_internet, Snackbar.LENGTH_INDEFINITE).show(); } } }; this.registerReceiver(broadcastReceiver, intentFilter); }</code><technical_language>want remove snackbar here</technical_language>

Target:
private void addNetworkBroadcastReceiver() { IntentFilter intentFilter = new IntentFilter(NETWORK_INTENT_ACTION); Snackbar snackbar = Snackbar.make(transparentView , R.string.no_internet, Snackbar.LENGTH_INDEFINITE); broadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (NetworkUtils.isInternetConnectionEstablished(NearbyActivity.this)) { refreshView(LOCATION_SIGNIFICANTLY_CHANGED); snackbar.dismiss(); } else { snackbar.show(); } } }; this.registerReceiver(broadcastReceiver, intentFilter); }
Source:
<code>public void store(A aggregateRoot) { <START> final Collection<EventRecord> uncommittedEvents = aggregateRoot.getApplicableUncommittedEvents(); <END> final int snapshotTrigger = getSnapshotTrigger(); for (EventRecord event : uncommittedEvents) { storeEvent(event); if (countSinceLastSnapshot > snapshotTrigger) { createAndStoreSnapshot(aggregateRoot); countSinceLastSnapshot = 0; } } aggregateRoot.commitEvents(); }</code><technical_language>Events applied in sequence. Return Iterable, if like</technical_language>

Target:
public void store(A aggregateRoot) { final Iterable<EventRecord> uncommittedEvents = aggregateRoot.getStateChangingUncommittedEvents(); final int snapshotTrigger = getSnapshotTrigger(); for (EventRecord event : uncommittedEvents) { storeEvent(event); if (countSinceLastSnapshot > snapshotTrigger) { createAndStoreSnapshot(aggregateRoot); countSinceLastSnapshot = 0; } } aggregateRoot.commitEvents(); }
Source:
<code>public void testRenameRSGroup() throws Exception { RSGroupInfo oldgroup = addGroup("oldgroup", 2); TableName tb = TableName.valueOf("testRename"); TEST_UTIL.createTable(tb, "tr"); ADMIN.setRSGroup(Sets.newHashSet(tb), oldgroup.getName()); <START> Thread.sleep(500); <END> oldgroup = ADMIN.getRSGroup(oldgroup.getName()); assertEquals(2, oldgroup.getServers().size()); assertEquals(oldgroup.getName(), ADMIN.getRSGroup(tb).getName()); ADMIN.renameRSGroup(oldgroup.getName(), "newgroup"); Set<Address> servers = oldgroup.getServers(); RSGroupInfo newgroup = ADMIN.getRSGroup("newgroup"); assertEquals(servers.size(), newgroup.getServers().size()); int match = 0; for (Address addr : newgroup.getServers()) { if (servers.contains(addr)) { match++; } } assertEquals(servers.size(), match); assertEquals(newgroup.getName(), ADMIN.getRSGroup(tb).getName()); }</code><technical_language>Instead of sleep(), HBASE_TESTING_UTILITY.waitFor: e.g. HBASE_TESTING_UTILITY.waitFor(1000, () -> { oldgroup = ADMIN.getRSGroup(oldgroup.getName()); return oldgroup.getServers().size() == 2 && ADMIN.getRSGroup(tb).getName().equals(oldgroup.getName()); }); This ensure, wait for specific period of time predicate returns true</technical_language>

Target:
public void testRenameRSGroup() throws Exception { RSGroupInfo oldgroup = addGroup("oldgroup", 2); TableName tb1 = TableName.valueOf("testRename"); TEST_UTIL.createTable(tb1, "tr"); ADMIN.setRSGroup(Sets.newHashSet(tb1), oldgroup.getName()); TEST_UTIL.waitFor(1000, (Waiter.Predicate<Exception>) () -> ADMIN.getRSGroup(tb1).getServers().size() == 2); oldgroup = ADMIN.getRSGroup(oldgroup.getName()); assertEquals(2, oldgroup.getServers().size()); assertEquals(oldgroup.getName(), ADMIN.getRSGroup(tb1).getName()); RSGroupInfo normal = addGroup("normal", 1); TableName tb2 = TableName.valueOf("unmovedTable"); TEST_UTIL.createTable(tb2, "ut"); ADMIN.setRSGroup(Sets.newHashSet(tb2), normal.getName()); TEST_UTIL.waitFor(1000, (Waiter.Predicate<Exception>) () -> ADMIN.getRSGroup(tb2).getServers().size() == 1); normal = ADMIN.getRSGroup(normal.getName()); assertEquals(1, normal.getServers().size()); assertEquals(normal.getName(), ADMIN.getRSGroup(tb2).getName()); ADMIN.renameRSGroup(oldgroup.getName(), "newgroup"); Set<Address> servers = oldgroup.getServers(); RSGroupInfo newgroup = ADMIN.getRSGroup("newgroup"); assertEquals(servers.size(), newgroup.getServers().size()); int match = 0; for (Address addr : newgroup.getServers()) { if (servers.contains(addr)) { match++; } } assertEquals(servers.size(), match); assertEquals(newgroup.getName(), ADMIN.getRSGroup(tb1).getName()); assertEquals(normal.getName(), ADMIN.getRSGroup(tb2).getName()); }
Source:
<code>public UpdateContainerOptions versionsLocation(String containerName) { <START> this.headers.put(CONTAINER_VERSIONS_LOCATION, containerName); <END> return this; }</code><technical_language>VERSIONS_LOCATION_CONTAINER more sense here? I read "CONTAINER_VERSIONS_LOCATION" "the versions location for container", (as I understand) "the container is location of versions"</technical_language>

Target:
public UpdateContainerOptions versionsLocation(String containerName) { this.headers.put(VERSIONS_LOCATION, containerName); return this; }
Source:
<code>protected List<PRPAIN201306UV02MFMIMT700711UV01Subject1> getSubjects(PRPAIN201306UV02 response) { <START> List<PRPAIN201306UV02MFMIMT700711UV01Subject1> subjects = null; <END> if (response != null && response.getControlActProcess() != null) { subjects = response.getControlActProcess().getSubject(); } return subjects; }</code><technical_language>a suggestion, anytime a function return a Collection, consider initializing empty instead of null a compelling reason -- this allows callers run result enhanced for loop (or similar) requiring a null check</technical_language>

Target:
protected List<PRPAIN201306UV02MFMIMT700711UV01Subject1> getSubjects(PRPAIN201306UV02 response) { List<PRPAIN201306UV02MFMIMT700711UV01Subject1> subjects = new ArrayList<PRPAIN201306UV02MFMIMT700711UV01Subject1>(); if (response != null && response.getControlActProcess() != null) { subjects = response.getControlActProcess().getSubject(); } return subjects; }
Source:
<code>public static void writeMetadataFile(String jobName, String jobId, String containerId, Optional<String> execEnvContainerId, Config config) { Optional<File> metadataFile = JobConfig.getMetadataFile(execEnvContainerId.orElse(null)); if (metadataFile.isPresent()) { <START> MetricsHeader metricsHeader = new MetricsHeader(jobName, jobId, "samza-container-" + containerId, execEnvContainerId.orElse(""), LocalContainerRunner.class.getName(), Util.getTaskClassVersion(config), Util.getSamzaVersion(), Util.getLocalHost().getHostName(), System.currentTimeMillis(), System.currentTimeMillis(), config); <END> class MetadataFileContents { public final String version; public final String metricsSnapshot; public MetadataFileContents(String version, String metricsSnapshot) { this.version = version; this.metricsSnapshot = metricsSnapshot; } } MetricsSnapshot metricsSnapshot = new MetricsSnapshot(metricsHeader, new Metrics()); MetadataFileContents metadataFileContents = new MetadataFileContents("1", new String(new MetricsSnapshotSerdeV2().toBytes(metricsSnapshot))); new FileUtil().writeToTextFile(metadataFile.get(), new String(new JsonSerde<>().toBytes(metadataFileContents)), false); } else { log.info("Skipping writing metadata file."); } }</code><technical_language>do want add config metric-header? entire config map (potentially 10s of MB of data) emitted in message. This is want do right? Instead want emit in MetricsMessage, container start (first message) in message</technical_language>

Target:
public static void writeMetadataFile(String jobName, String jobId, String containerId, Optional<String> execEnvContainerId, Config config) { Optional<File> metadataFile = JobConfig.getMetadataFile(execEnvContainerId.orElse(null)); if (metadataFile.isPresent()) { MetricsHeader metricsHeader = new MetricsHeader(jobName, jobId, "samza-container-" + containerId, execEnvContainerId.orElse(""), LocalContainerRunner.class.getName(), Util.getTaskClassVersion(config), Util.getSamzaVersion(), Util.getLocalHost().getHostName(), System.currentTimeMillis(), System.currentTimeMillis()); class MetadataFileContents { public final String version; public final String metricsSnapshot; public MetadataFileContents(String version, String metricsSnapshot) { this.version = version; this.metricsSnapshot = metricsSnapshot; } } MetricsSnapshot metricsSnapshot = new MetricsSnapshot(metricsHeader, new Metrics()); MetadataFileContents metadataFileContents = new MetadataFileContents("1", new String(new MetricsSnapshotSerdeV2().toBytes(metricsSnapshot))); new FileUtil().writeToTextFile(metadataFile.get(), new String(new JsonSerde<>().toBytes(metadataFileContents)), false); } else { log.info("Skipping writing metadata file."); } }
Source:
<code>Set<File> collect(IMavenProjectFacade projectFacade, IProgressMonitor monitor) { logger.debug("{}: Collecting files for project {}", getName(), projectFacade.getProject()); Set<File> files = new HashSet<>(); if (!isValid(projectFacade.getProject())) { logger.debug("{}: Project determined invalid", getName(), projectFacade.getProject()); return files; } try { MavenBndrunContainer mavenBndrunContainer = MavenBndrunContainer.getBndrunContainer(projectFacade, null, true, true, allScopes, monitor); MapStream.of(mavenBndrunContainer.resolve() <START> .entrySet()) <END> .mapToObj((f, a) -> new MavenFile(f, a.getArtifact() .getGroupId(), a.getArtifact() .getArtifactId(), a.getArtifact() .getVersion(), "jar", a .getArtifact() .getClassifier(), getFrom( a))) .forEach(files::add); logger.debug("{}: Collected files for project {}", getName(), files, projectFacade.getProject()); } catch (Exception e) { logger.error("{}: Failed to collect files for project {}", getName(), projectFacade.getProject(), e); } return files; }</code><technical_language>need .entrySet(), MapStream.of takes a map</technical_language>

Target:
Set<Artifact> collect(IMavenProjectFacade projectFacade, IProgressMonitor monitor) { logger.debug("{}: Collecting files for project {}", getName(), projectFacade.getProject()); Set<Artifact> files = new HashSet<>(); if (!isValid(projectFacade.getProject())) { logger.debug("{}: Project determined invalid", getName(), projectFacade.getProject()); return files; } try { MavenBndrunContainer mavenBndrunContainer = MavenBndrunContainer.getBndrunContainer(projectFacade, null, true, true, allScopes, monitor); mavenBndrunContainer.resolve() .values() .stream() .map( this::fromArtifactResult) .forEach(files::add); logger.debug("{}: Collected artifacts for project {}", getName(), files, projectFacade.getProject()); } catch (Exception e) { logger.error("{}: Failed to collect artifacts for project {}", getName(), projectFacade.getProject(), e); } return files; }
Source:
<code>public Set<KProperty<?>> build() { final Set<KProperty<?>> indexElements = new HashSet<>(); for (IndexElementsGenerator generator : generators) { addIndexElements(indexElements, generator); } indexElements.add(new KProperty<String>() { @Override public String getName() { return FullFileNameIndexTerm.TERM; } @Override public String getValue() { return fileName; } @Override public boolean isSearchable() { return true; } }); indexElements.add(new KProperty<String>() { @Override public String getName() { return FieldFactory.FILE_NAME_FIELD_SORTED; } <START> @Override <END> public String getValue() { return fileName.toLowerCase(); } @Override public boolean isSearchable() { return false; } @Override public boolean isSortable() { return true; } }); if (project != null && project.getRootPath() != null) { final String projectRootUri = project.getRootPath().toURI(); indexElements.add(new KProperty<String>() { @Override public String getName() { return ProjectRootPathIndexTerm.TERM; } @Override public String getValue() { return projectRootUri; } @Override public boolean isSearchable() { return true; } }); final String projectName = project.getProjectName(); if (projectName != null) { indexElements.add(new KProperty<String>() { @Override public String getName() { return ProjectNameIndexTerm.TERM; } @Override public String getValue() { return projectName; } @Override public boolean isSearchable() { return true; } }); } } if (pkgName == null) { pkgName = pkg.getPackageName(); } if (pkg != null) { indexElements.add(new KProperty<String>() { @Override public String getName() { return PackageNameIndexTerm.TERM; } @Override public String getValue() { return pkgName; } @Override public boolean isSearchable() { return true; } }); } return indexElements; }</code><technical_language>@manstis pkgName != null</technical_language>

Target:
public Set<KProperty<?>> build() { final Set<KProperty<?>> indexElements = new HashSet<>(); generators.forEach((generator) -> addIndexElements(indexElements, generator)); indexElements.add(new KPropertyImpl<>(FullFileNameIndexTerm.TERM, fileName)); indexElements.add(new KPropertyImpl<>(FieldFactory.FILE_NAME_FIELD_SORTED, fileName.toLowerCase(), false, true)); if (project != null && project.getRootPath() != null) { final String projectRootUri = project.getRootPath().toURI(); indexElements.add(new KPropertyImpl<>(ProjectRootPathIndexTerm.TERM, projectRootUri)); final String projectName = project.getProjectName(); if (projectName != null) { indexElements.add(new KPropertyImpl<>(ProjectNameIndexTerm.TERM, projectName)); } } if (pkgName == null) { pkgName = pkg.getPackageName(); } if (pkgName != null) { indexElements.add(new KPropertyImpl<>(PackageNameIndexTerm.TERM, pkgName)); } return indexElements; }
Source:
<code>public void completeRadiologyReport_shouldSetTheRadiologyReportStatusToComplete() throws Exception { RadiologyReport existingRadiologyReport = radiologyService .getRadiologyReportByRadiologyReportId(EXISTING_RADIOLOGY_REPORT_ID); <START> Provider existingProvider = existingRadiologyReport.getProvider(); <END> RadiologyReport radiologyReport = radiologyService .completeRadiologyReport(existingRadiologyReport, existingProvider); assertNotNull(radiologyReport); assertThat(radiologyReport.getRadiologyReportStatus(), is(RadiologyReportStatus.COMPLETED)); }</code><technical_language>inline provider method call</technical_language>

Target:
public void completeRadiologyReport_shouldSetTheRadiologyReportStatusToComplete() throws Exception { RadiologyReport radiologyReport = radiologyService.completeRadiologyReport(radiologyService .getRadiologyReportByRadiologyReportId(EXISTING_RADIOLOGY_REPORT_ID), radiologyService .getRadiologyReportByRadiologyReportId(EXISTING_RADIOLOGY_REPORT_ID).getPrincipalResultsInterpreter()); assertNotNull(radiologyReport); assertThat(radiologyReport.getReportStatus(), is(RadiologyReportStatus.COMPLETED)); }
Source:
<code><START> public void update(ViewerCell cell) { <END> Object element = cell.getElement(); if (cell.getColumnIndex() == 0) { cell.setImage(getColumnImage(element, cell.getColumnIndex())); cell.setText(getColumnText(element, cell.getColumnIndex())); } else { if (cell.getColumnIndex() == 3) { cell.setText(getColumnText(element, cell.getColumnIndex())); } else { cell.setImage(getColumnImage(element, cell.getColumnIndex())); } } }</code><technical_language>do need override this</technical_language>

Target:
public void update(ViewerCell cell) { Object element = cell.getElement(); int columnNumber = cell.getColumnIndex(); if (columnNumber == 0) { cell.setImage(getColumnImage(element, cell.getColumnIndex())); cell.setText(getColumnText(element, cell.getColumnIndex())); } else { if (columnNumber == 3) { cell.setText(getColumnText(element, cell.getColumnIndex())); } else { cell.setImage(getColumnImage(element, cell.getColumnIndex())); } } }
Source:
<code>public static void fixHardcore() { Minecraft mc = Minecraft.getInstance(); IntegratedServer server = ((IntegratedServer) ServerLifecycleHooks.getCurrentServer()); if(server != null) { server.addScheduledTask(() -> { String ownerName = server.getServerOwner(); EntityPlayerMP owner = server.getPlayerList().getPlayerByUsername(ownerName); owner.setGameType(GameType.NOT_SET); <START> mc.world.sendQuittingDisconnectingPacket(); <END> }); } else { mc.world.sendQuittingDisconnectingPacket(); } while(mc.getConnection().getNetworkManager().isChannelOpen()) mc.loadWorld(null); }</code><technical_language>is this a race calling client code server thread? server kick client instead</technical_language>

Target:
public static void fixHardcore() { Minecraft mc = Minecraft.getInstance(); IntegratedServer server = ((IntegratedServer) ServerLifecycleHooks.getCurrentServer()); if(server != null) { server.addScheduledTask(() -> { String ownerName = server.getServerOwner(); EntityPlayerMP owner = server.getPlayerList().getPlayerByUsername(ownerName); owner.setGameType(GameType.NOT_SET); owner.connection.disconnect(new TextComponentTranslation("deathScreen.title.hardcore")); }); } else { mc.world.sendQuittingDisconnectingPacket(); } while(mc.getConnection().getNetworkManager().isChannelOpen()) mc.loadWorld(null); }
Source:
<code>public <S extends T> S findOne(Example<S> example) { Assert.notNull(example); WherePath selectFrom = N1qlUtils.createSelectFromForEntity(getCouchbaseOperations().getCouchbaseBucket().name()); Expression whereCriteria = N1qlUtils.createWhereFilterByExampleForEntity(null, getCouchbaseOperations().getConverter(), getEntityInformation(), example); Statement st = selectFrom.where(whereCriteria).limit(1); ScanConsistency consistency = getCouchbaseOperations().getDefaultConsistency().n1qlConsistency(); N1qlQuery query = N1qlQuery.simple(st, N1qlParams.build().consistency(consistency)); <START> return getCouchbaseOperations().findByN1QL(query, example.getProbeType()).get(0); <END> }</code><technical_language>need null safety index out of bounds safety check get(0)</technical_language>

Target:
public <S extends T> S findOne(Example<S> example) { Assert.notNull(example); WherePath selectFrom = N1qlUtils.createSelectFromForEntity(getCouchbaseOperations().getCouchbaseBucket().name()); Expression whereCriteria = N1qlUtils.createWhereFilterByExampleForEntity(null, getCouchbaseOperations().getConverter(), getEntityInformation(), example); Statement st = selectFrom.where(whereCriteria).limit(1); ScanConsistency consistency = getCouchbaseOperations().getDefaultConsistency().n1qlConsistency(); N1qlQuery query = N1qlQuery.simple(st, N1qlParams.build().consistency(consistency)); List<S> result = getCouchbaseOperations().findByN1QL(query, example.getProbeType()); return result.size() > 0 ? result.get(0) : null; }
Source:
<code>public void setPriority(boolean priority) { if (priority) { Assert.isInstanceOf(ChannelPriorityMessageStore.class, this.messageGroupStore); <START> } <END> }</code><technical_language>else { if (logger.isWarnEnabled() && messageGroupStore instanceof ChannelPriorityMessageStore) { logger.warn("It's recommended ChannelPriorityMessageStore" for simple QueueChannel: desired FIFO logic broken.); } }</technical_language>

Target:
public void setPriority(boolean priority) { if (priority) { Assert.isInstanceOf(PriorityCapableChannelMessageStore.class, this.messageGroupStore); Assert.isTrue(((PriorityCapableChannelMessageStore) this.messageGroupStore).isPriorityEnabled(), "When using priority, the 'PriorityCapableChannelMessageStore' must have priority enabled."); } else { if (logger.isWarnEnabled() && this.messageGroupStore instanceof PriorityCapableChannelMessageStore && ((PriorityCapableChannelMessageStore) this.messageGroupStore).isPriorityEnabled()) { logger.warn("It's not recommended to use a priority-based message store " + "when declaring a non-priority 'MessageGroupQueue'; message retrieval may not be FIFO; " + "set 'priority' to 'true' if that is your intent. If you are using the namespace to " + "define a channel, use '<priority-queue message-store.../> instead."); } } }
Source:
<code>public void processRelation(ReaderRelation relation) { if (relation.hasTag("type", "restriction")) { List<OSMTurnRelation> turnRelations = createTurnRelation(relation); for (OSMTurnRelation turnRelation : turnRelations) { <START> if (turnRelation != null) { <END> GraphExtension extendedStorage = graph.getExtension(); if (extendedStorage instanceof TurnCostExtension) { TurnCostExtension tcs = (TurnCostExtension) extendedStorage; Collection<TurnCostTableEntry> entries = analyzeTurnRelation(turnRelation); for (TurnCostTableEntry entry : entries) { tcs.addTurnInfo(entry.edgeFrom, entry.nodeVia, entry.edgeTo, entry.flags); } } } } } }</code><technical_language>this null check needed</technical_language>

Target:
public void processRelation(ReaderRelation relation) { if (relation.hasTag("type", "restriction")) { GraphExtension extendedStorage = graph.getExtension(); if (extendedStorage instanceof TurnCostExtension) { TurnCostExtension tcs = (TurnCostExtension) extendedStorage; List<OSMTurnRelation> turnRelations = createTurnRelations(relation); for (OSMTurnRelation turnRelation : turnRelations) { Collection<TurnCostTableEntry> entries = analyzeTurnRelation(turnRelation); for (TurnCostTableEntry entry : entries) { tcs.addTurnInfo(entry.edgeFrom, entry.nodeVia, entry.edgeTo, entry.flags); } } } } }
Source:
<code>public boolean stop(long executionId) throws NoSuchJobExecutionException, JobExecutionNotRunningException { JobExecution jobExecution = findExecutionById(executionId); BatchStatus status = jobExecution.getStatus(); if (!(status == BatchStatus.STARTED || status == BatchStatus.STARTING)) { throw new JobExecutionNotRunningException("JobExecution must be running so that it can be stopped: "+jobExecution); } jobExecution.setStatus(BatchStatus.STOPPING); jobRepository.update(jobExecution); try { Job job = jobRegistry.getJob(jobExecution.getJobInstance().getJobName()); if (job instanceof StepLocator) { for (StepExecution stepExecution : jobExecution.getStepExecutions()) { if (stepExecution.getStatus().isRunning()) { try { Step step = ((StepLocator)job).getStep(stepExecution.getStepName()); if (step instanceof TaskletStep) { Tasklet tasklet = ((TaskletStep)step).getTasklet(); if (tasklet instanceof StoppableTasklet) { StepSynchronizationManager.register(stepExecution); ((StoppableTasklet)tasklet).stop(); StepSynchronizationManager.release(); } } } catch (NoSuchStepException e) { logger.warn("Step not found",e); } } } } } catch (NoSuchJobException e) { <START> logger.warn("Cannot find Job object in the job registry",e); <END> } return true; }</code><technical_language>more detailed here. "Cannot find Job object in job registry. StoppableTasklet#stop() called"</technical_language>

Target:
public boolean stop(long executionId) throws NoSuchJobExecutionException, JobExecutionNotRunningException { JobExecution jobExecution = findExecutionById(executionId); BatchStatus status = jobExecution.getStatus(); if (!(status == BatchStatus.STARTED || status == BatchStatus.STARTING)) { throw new JobExecutionNotRunningException("JobExecution must be running so that it can be stopped: "+jobExecution); } jobExecution.setStatus(BatchStatus.STOPPING); jobRepository.update(jobExecution); try { Job job = jobRegistry.getJob(jobExecution.getJobInstance().getJobName()); if (job instanceof StepLocator) { for (StepExecution stepExecution : jobExecution.getStepExecutions()) { if (stepExecution.getStatus().isRunning()) { try { Step step = ((StepLocator)job).getStep(stepExecution.getStepName()); if (step instanceof TaskletStep) { Tasklet tasklet = ((TaskletStep)step).getTasklet(); if (tasklet instanceof StoppableTasklet) { StepSynchronizationManager.register(stepExecution); ((StoppableTasklet)tasklet).stop(); StepSynchronizationManager.release(); } } } catch (NoSuchStepException e) { logger.warn("Step not found",e); } } } } } catch (NoSuchJobException e) { logger.warn("Cannot find Job object in the job registry. StoppableTasklet#stop() will not be called",e); } return true; }
Source:
<code>public int doOnePhaseCommit () { int status = super.status(); if (status == ActionStatus.ABORT_ONLY || doBeforeCompletion()) { status = super.End(true); switch (super.getHeuristicDecision()) { case TwoPhaseOutcome.PREPARE_OK: case TwoPhaseOutcome.FINISH_OK: if (super.failedList != null && super.failedList.size() > 0) { <START> return ActionStatus.H_COMMIT; <END> } default: break; } } else { status = ActionStatus.ABORTED; } afterCompletion(status); TransactionReaper.transactionReaper().remove(this); return status; }</code><technical_language>Is skip afterCompletion(H_COMMIT) call previously performed line 252</technical_language>

Target:
public int doOnePhaseCommit () { int status = super.status(); if (status == ActionStatus.ABORT_ONLY || doBeforeCompletion()) { status = super.End(true); switch (super.getHeuristicDecision()) { case TwoPhaseOutcome.PREPARE_OK: case TwoPhaseOutcome.FINISH_OK: if (super.failedList != null && super.failedList.size() > 0) { status = ActionStatus.H_COMMIT; } default: break; } } else { status = ActionStatus.ABORTED; } afterCompletion(status); TransactionReaper.transactionReaper().remove(this); return status; }
Source:
<code>protected void insertOrUpdateEntity() throws IOException { if (isNewEntity) { try { CrudResponse response = bullhornRestApi.insertEntity((CreateEntity) entity); checkForRestSdkErrorMessages(response); entityID = response.getChangedEntityId(); entity.setId(entityID); if (entity.getClass() == ClientCorporation.class) { <START> handleDefaultContactExternalId(entityID); <END> } } catch (RestApiException e) { checkForRequiredFieldsError(e); } } else { CrudResponse response = bullhornRestApi.updateEntity((UpdateEntity) entity); checkForRestSdkErrorMessages(response); } }</code><technical_language>call this setDefaultContactExternalId</technical_language>

Target:
protected void insertOrUpdateEntity() throws IOException { if (isNewEntity) { try { CrudResponse response = bullhornRestApi.insertEntity((CreateEntity) entity); checkForRestSdkErrorMessages(response); entityID = response.getChangedEntityId(); entity.setId(entityID); if (entity.getClass() == ClientCorporation.class) { setDefaultContactExternalId(entityID); } } catch (RestApiException e) { checkForRequiredFieldsError(e); } } else { CrudResponse response = bullhornRestApi.updateEntity((UpdateEntity) entity); checkForRestSdkErrorMessages(response); } }
Source:
<code>public boolean incrementToken() throws IOException { if (!input.incrementToken()) { return false; } String thisToken = termAtt.toString(); <START> if (highSurrogatePattern.matcher(thisToken).matches()) { <END> highSurrogate = termAtt.buffer()[0]; highSurrogateStart = offsetAtt.startOffset(); termAtt.setEmpty(); offsetAtt.setOffset(highSurrogateStart, highSurrogateStart); posIncr.setPositionIncrement(1); } else if (lowSurrogatePattern.matcher(thisToken).matches()) { termAtt.setEmpty(); if (highSurrogate == null) { offsetAtt.setOffset(offsetAtt.startOffset(), offsetAtt.startOffset()); posIncr.setPositionIncrement(1); } else { termAtt.append(highSurrogate).append(thisToken); offsetAtt.setOffset(highSurrogateStart, offsetAtt.endOffset()); posIncr.setPositionIncrement(1); } highSurrogate = null; } else { highSurrogate = null; } return true; }</code><technical_language>work a char primitive Character.isHighSurrogate()/isLowSurrogate()</technical_language>

Target:
public boolean incrementToken() throws IOException { if (!input.incrementToken()) { return false; } String thisToken = termAtt.toString(); if (thisToken.length() == 1 && Character.isHighSurrogate(termAtt.buffer()[0])) { char highSurrogate = termAtt.buffer()[0]; int highSurrogateStart = offsetAtt.startOffset(); if (!input.incrementToken()) { return true; } thisToken = termAtt.toString(); if (thisToken.length() == 1 && Character.isLowSurrogate(termAtt.buffer()[0])) { termAtt.setEmpty(); termAtt.append(highSurrogate).append(thisToken); offsetAtt.setOffset(highSurrogateStart, offsetAtt.endOffset()); posIncr.setPositionIncrement(1); } } return true; }
Source:
<code>public MyCustomCacheStore() { try { <START> TimeUnit.SECONDS.sleep(10); <END> } catch (InterruptedException e) { throw new AssertionError("Got interrupted exception", e); } }</code><technical_language>1 enough, I</technical_language>

Target:
public MyCustomCacheStore() { try { TimeUnit.SECONDS.sleep(1); } catch (InterruptedException e) { fail("This thread shouldn't get interrupted; " + e.getMessage()); } }
Source:
<code>public void clear() { while (getRowCount() != 0) { removeRow(0); <START> } <END> }</code><technical_language>If a list for rowData this rowData.clear()</technical_language>

Target:
public void clear() { rowData.clear(); fireTableDataChanged(); }
Source:
<code>ParallaxEngine() { <START> super(); <END> renderer = new LondonParallaxWallpaperRenderer(LondonParallaxWallpaper.this.getAssets()); setRenderer(renderer); ENDERMODE_WHEN_DIRTY if not showing snow setRenderMode(RENDERMODE_WHEN_DIRTY); initLayers(); requestRender(); }</code><technical_language>Do explicitly call default super? :P</technical_language>

Target:
ParallaxEngine() { super(); renderer = new LondonParallaxWallpaperRenderer(LondonParallaxWallpaper.this.getAssets()); setRenderer(renderer); setRenderMode(RENDERMODE_WHEN_DIRTY); initLayers(); requestRender(); }
Source:
<code><START> public Iterator<Note> iterator() { <END> try { return new Iterator<Note>() { private Iterator<Note> itr = root == null ? null : root .iterator(new MutableObjectId(), reader); public boolean hasNext() { if (itr == null) return true; return itr.hasNext(); } public Note next() { return itr.next(); } public void remove() { throw new UnsupportedOperationException(); } }; } catch (IOException e) { throw new RuntimeException(e); } }</code><technical_language>This in earlier commit a new unit test verify iterator() works expected. rely verify result of a merge in merge unit tests</technical_language>

Target:
public Iterator<Note> iterator() { try { return root.iterator(new MutableObjectId(), reader); } catch (IOException e) { throw new RuntimeException(e); } }
Source:
<code>private int getInfixPrecedence(Token token) { switch (token.getType()) { case SEMICOLON: <START> return Precedence.SHORTER_DISJUNCTION; <END> case AND: case QUALIFIER: case SYMBOL: case LBRACKET: return Precedence.CONJUNCTION; case OR: return Precedence.DISJUNCTION; case NOT: return Precedence.PREFIX; default: return 0; } }</code><technical_language>Hmm, is this needed? This is for operators qualifiers, care of main loop in parseExpression. ; handled in context of a single qualifier. parse exception in sort:label;assignee case is due ; a recognised infix operator, sort parse properly</technical_language>

Target:
private int getInfixPrecedence(Token token) { switch (token.getType()) { case AND: case QUALIFIER: case SYMBOL: case LBRACKET: return Precedence.CONJUNCTION; case OR: return Precedence.DISJUNCTION; case NOT: return Precedence.PREFIX; default: return 0; } }
Source:
<code>public int cleanupOldCheckIns() { String hql = "SELECT cc1.id FROM CheckIn cc1 WHERE cc1.checkInTime != (" + "SELECT MAX(cc2.checkInTime) " + "FROM CheckIn cc2 " + "WHERE cc2.consumer = cc1.consumer)"; Query q = currentSession().createQuery(hql); q.setMaxResults(DELETE_BATCH_SIZE); List<String> checkInIds = q.list(); int totalDeleted = 0; int totalQueries = 1; while (checkInIds.size() > 0) { log.debug("Found check-in IDs to be deleted.", checkInIds.size()); String deleteHql = "DELETE from CheckIn where id in (:deleteIds)"; <START> Query deleteQuery = currentSession().createQuery(deleteHql); <END> deleteQuery.setParameterList("deleteIds", checkInIds); totalDeleted += deleteQuery.executeUpdate(); checkInIds = q.list(); totalQueries += 2; } log.info("Deleted a total of consumer check-in times with queries.", totalDeleted, totalQueries); return totalDeleted; }</code><technical_language>Minor optimization: move this query out of loop save some re-parsing time (much select query above)</technical_language>

Target:
public int cleanupOldCheckIns() { String hql = "SELECT cc1.id FROM CheckIn cc1 WHERE cc1.checkInTime != (" + "SELECT MAX(cc2.checkInTime) " + "FROM CheckIn cc2 " + "WHERE cc2.consumer = cc1.consumer)"; Query q = currentSession().createQuery(hql); q.setMaxResults(DELETE_BATCH_SIZE); List<String> checkInIds = q.list(); int totalDeleted = 0; int totalQueries = 1; String deleteHql = "DELETE from CheckIn where id in (:deleteIds)"; Query deleteQuery = currentSession().createQuery(deleteHql); while (checkInIds.size() > 0) { log.debug("Found check-in IDs to be deleted.", checkInIds.size()); deleteQuery.setParameterList("deleteIds", checkInIds); totalDeleted += deleteQuery.executeUpdate(); checkInIds = q.list(); totalQueries += 2; } log.info("Deleted a total of consumer check-in times with queries.", totalDeleted, totalQueries); return totalDeleted; }
Source:
<code>public int available() { <START> throw new UnsupportedOperationException("this operation is not supported"); <END> }</code><technical_language>@igorbernstein2, is get in-memory count of rows</technical_language>

Target:
public int available() { return stream.isReceiveReady() ? 1 : 0; }
Source:
<code>public IComparisonScope createMinimizedScope() { minimize(); final ResourceSet leftResourceSet = new NotLoadingResourceSet(leftTraversal); final ResourceSet rightResourceSet = new NotLoadingResourceSet(rightTraversal); final ResourceSet originResourceSet; if (originTraversal == null || originTraversal.getStorages().isEmpty()) { originResourceSet = null; } else { originResourceSet = new NotLoadingResourceSet(originTraversal); } final Set<URI> urisInScope = Sets.newLinkedHashSet(); for (IStorage left : leftTraversal.getStorages()) { urisInScope.add(createURIFor(left)); } for (IStorage right : rightTraversal.getStorages()) { urisInScope.add(createURIFor(right)); } <START> for (IStorage origin : originTraversal.getStorages()) { <END> urisInScope.add(createURIFor(origin)); } final FilterComparisonScope scope = new DefaultComparisonScope(leftResourceSet, rightResourceSet, originResourceSet); scope.setResourceSetContentFilter(isInScope(urisInScope)); return scope; }</code><technical_language>originTraversal null here. tested for nullness do return this method</technical_language>

Target:
public IComparisonScope createMinimizedScope() { minimize(); final ResourceSet leftResourceSet = new NotLoadingResourceSet(leftTraversal); final ResourceSet rightResourceSet = new NotLoadingResourceSet(rightTraversal); final ResourceSet originResourceSet; if (originTraversal == null || originTraversal.getStorages().isEmpty()) { originResourceSet = null; } else { originResourceSet = new NotLoadingResourceSet(originTraversal); } final Set<URI> urisInScope = Sets.newLinkedHashSet(); for (IStorage left : leftTraversal.getStorages()) { urisInScope.add(createURIFor(left)); } for (IStorage right : rightTraversal.getStorages()) { urisInScope.add(createURIFor(right)); } if (originTraversal != null) { for (IStorage origin : originTraversal.getStorages()) { urisInScope.add(createURIFor(origin)); } } final FilterComparisonScope scope = new DefaultComparisonScope(leftResourceSet, rightResourceSet, originResourceSet); scope.setResourceSetContentFilter(isInScope(urisInScope)); return scope; }