auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void search(){ String title = NbBundle.getMessage(this.getClass(), "CommonFilesPanel.search.results.title"); String pathText = NbBundle.getMessage(this.getClass(), "CommonFilesPanel.search.results.pathText"); Case currentCase = Case.getCurrentCase(); List<AbstractFile> contentList = null; try { SleuthkitCase tskDb = currentCase.getSleuthkitCase(); contentList = tskDb.findAllFilesWhere("1 == 1 GROUP BY md5 HAVING COUNT(*) > 1;"); } catch (TskCoreException ex) { <START> Logger logger = Logger.getLogger(this.getClass().getName()); <END> logger.log(Level.WARNING, "Error while trying to get common files.", ex); } if (contentList == null) { contentList = Collections.<AbstractFile>emptyList(); } CommonFilesNode sn = new CommonFilesNode(contentList); final TopComponent searchResultWin = DataResultTopComponent.createInstance( title, pathText, new TableFilterNode(sn, true, sn.getName()), contentList.size()); searchResultWin.requestActive(); }</code><technical_language>Please define a Logger store reference a final class (static) field</technical_language>

Target:
private void search() { String title = Bundle.CommonFilesPanel_search_results_title(); String pathText = Bundle.CommonFilesPanel_search_results_pathText(); new SwingWorker<Void, Void>() { private int count = 0; private TableFilterNode tfn = null; @Override @SuppressWarnings("FinallyDiscardsException") protected Void doInBackground() throws Exception { List<AbstractFile> contentList; try { Case currentCase = Case.getOpenCase(); SleuthkitCase tskDb = currentCase.getSleuthkitCase(); contentList = tskDb.findAllFilesWhere("1 == 1 GROUP BY md5 HAVING COUNT(*) > 1;"); CommonFilesNode cfn = new CommonFilesNode(contentList); tfn = new TableFilterNode(cfn, true, cfn.getName()); count = contentList.size(); } catch (TskCoreException | NoCurrentCaseException ex) { LOGGER.log(Level.WARNING, "Error while trying to get common files.", ex); contentList = Collections.<AbstractFile>emptyList(); CommonFilesNode cfn = new CommonFilesNode(contentList); tfn = new TableFilterNode(cfn, true, cfn.getName()); } finally { return null; } } @Override protected void done() { try { super.done(); get(); TopComponent component = DataResultTopComponent.createInstance( title, pathText, tfn, count); component.requestActive(); } catch (InterruptedException | ExecutionException ex) { JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), ex.getCause().getMessage(), "Some went wrong finding common files.", JOptionPane.ERROR_MESSAGE); } } }.execute(); }
Source:
<code>public boolean handleSelectedOption(MenuItem item) { if (item.getItemId() == R.id.option_friendadd) { <START> new AsyncFriendRequest(context, selectedPersona().getPersonaId()).execute(comClient); <END> } else if (item.getItemId() == R.id.option_frienddel) { new AsyncFriendRemove(context, selectedPersona().getPersonaId()).execute(comClient); } return true; }</code><technical_language>mistaken, this bug above</technical_language>

Target:
public boolean handleSelectedOption(MenuItem item) { if (item.getItemId() == R.id.option_friendadd) { new AsyncFriendRequest(context, BF3Droid.getUserId()).execute(comClient); } else if (item.getItemId() == R.id.option_frienddel) { new AsyncFriendRemove(context, BF3Droid.getUserId()).execute(comClient); } return true; }
Source:
<code>public C list() { List<Q> collection = getBackendCollection(queryType, queryParams); <START> if (collection == null || collection.isEmpty()) { <END> throw new WebApplicationException(Response.Status.NOT_FOUND); } return mapCollection(collection); }</code><technical_language>Consider CollectionUtils.isEmpty</technical_language>

Target:
public C list() { List<Q> collection = getBackendCollection(queryType, queryParams); if (CollectionUtils.isEmpty(collection)) { throw new WebApplicationException(Response.Status.NOT_FOUND); } return mapCollection(collection); }
Source:
<code>public SamzaResourceRequest(int numCores, int memoryMB, String preferredHost, String processorId, Instant requestTimestamp, Set<FaultDomain> faultDomains) { <START> this.numCores = numCores; <END> this.memoryMB = memoryMB; this.preferredHost = preferredHost; this.requestId = UUID.randomUUID().toString(); this.processorId = processorId; this.requestTimestamp = requestTimestamp; if (faultDomains == null) { this.faultDomains = new HashSet<>(); } else { this.faultDomains = faultDomains; } log.info("SamzaResourceRequest created for Processor ID: on host: at time: with Request ID: and the following list of fault domains: {}", this.processorId, this.preferredHost, this.requestTimestamp, this.requestId, this.faultDomains.toString()); }</code><technical_language>add null pre conditions check for faultDomains</technical_language>

Target:
public SamzaResourceRequest(int numCores, int memoryMB, String preferredHost, String processorId, Instant requestTimestamp, Set<FaultDomain> faultDomains) { Preconditions.checkNotNull(faultDomains, "Set of fault domains should not be null."); this.numCores = numCores; this.memoryMB = memoryMB; this.preferredHost = preferredHost; this.requestId = UUID.randomUUID().toString(); this.processorId = processorId; this.requestTimestamp = requestTimestamp; this.faultDomains = faultDomains; log.info("SamzaResourceRequest created for Processor ID: on host: at time: with Request ID: and the following list of fault domains: {}", this.processorId, this.preferredHost, this.requestTimestamp, this.requestId, this.faultDomains.toString()); }
Source:
<code>public void setVanished(final boolean set) { vanished = set; if (set) { for (User user : ess.getOnlineUsers()) { if (!user.isAuthorized("essentials.vanish.see")) { user.getBase().hidePlayer(getBase()); } } setHidden(true); <START> this.getBase().setMetadata("vanished", new FixedMetadataValue(Essentials, true)); <END> ess.getVanishedPlayersNew().add(getName()); if (isAuthorized("essentials.vanish.effect")) { this.getBase().addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1, false)); } } else { for (Player p : ess.getOnlinePlayers()) { p.showPlayer(getBase()); } setHidden(false); this.getBase().removeMetadata("vanished", Essentials); ess.getVanishedPlayersNew().remove(getName()); if (isAuthorized("essentials.vanish.effect")) { this.getBase().removePotionEffect(PotionEffectType.INVISIBILITY); } } }</code><technical_language>"Essentials" is a variable defined in this method. need get instance here</technical_language>

Target:
public void setVanished(final boolean set) { vanished = set; if (set) { for (User user : ess.getOnlineUsers()) { if (!user.isAuthorized("essentials.vanish.see")) { user.getBase().hidePlayer(getBase()); } } setHidden(true); this.getBase().setMetadata("vanished", new FixedMetadataValue(this.ess, true)); ess.getVanishedPlayersNew().add(getName()); if (isAuthorized("essentials.vanish.effect")) { this.getBase().addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1, false)); } } else { for (Player p : ess.getOnlinePlayers()) { p.showPlayer(getBase()); } setHidden(false); this.getBase().removeMetadata("vanished", this.ess); ess.getVanishedPlayersNew().remove(getName()); if (isAuthorized("essentials.vanish.effect")) { this.getBase().removePotionEffect(PotionEffectType.INVISIBILITY); } } }
Source:
<code>public final void submit(Config userConf) throws AlreadyAliveException, InvalidTopologyException { <START> if (this.httpServerResultsUrl == null) { <END> TopologyBuilder builder = new TopologyBuilder(); Config conf = buildConfig(new BasicConfig()); if (userConf != null) { conf.putAll(userConf); } HeronSubmitter.submitTopology(topologyName, conf, buildTopology(builder).createTopology()); } else { TopologyTestTopologyBuilder builder = new TopologyTestTopologyBuilder(httpServerResultsUrl); Config conf = buildConfig(new BasicConfig()); conf.setTopologyReliabilityMode(Config.TopologyReliabilityMode.EFFECTIVELY_ONCE); conf.setTopologyStatefulCheckpointIntervalSecs(CHECKPOINT_INTERVAL); if (userConf != null) { conf.putAll(userConf); } HeronSubmitter.submitTopology(topologyName, conf, buildStatefulTopology(builder).createTopology()); } }</code><technical_language>this if ... else ... clause shares common code, reuse duplicate part</technical_language>

Target:
public final void submit(Config userConf) throws AlreadyAliveException, InvalidTopologyException { Config conf = buildConfig(new BasicConfig()); if (userConf != null) { conf.putAll(userConf); } if (this.httpServerResultsUrl == null) { TopologyBuilder builder = new TopologyBuilder(); HeronSubmitter.submitTopology(topologyName, conf, buildTopology(builder).createTopology()); } else { TopologyTestTopologyBuilder builder = new TopologyTestTopologyBuilder(httpServerResultsUrl); conf.setTopologyReliabilityMode(Config.TopologyReliabilityMode.EFFECTIVELY_ONCE); conf.setTopologyStatefulCheckpointIntervalSecs(CHECKPOINT_INTERVAL); HeronSubmitter.submitTopology(topologyName, conf, buildStatefulTopology(builder).createTopology()); } }
Source:
<code>public int pollKey() { size--; if (size < 0) { throw new IllegalStateException("collection is already empty!?"); } Entry<Integer, GHIntHashSet> e = map.firstEntry(); GHIntHashSet set = e.getValue(); if (set.isEmpty()) { throw new IllegalStateException("internal set is already empty!?"); } Iterator<IntCursor> iter = set.iterator(); final int val = iter.next().value; <START> set.removeAll(new IntPredicate() { <END> @Override public boolean apply(int value) { return value == val; } }); if (set.isEmpty()) { map.remove(e.getKey()); } return val; }</code><technical_language><LINK_0></technical_language>

Target:
public int pollKey() { size--; if (size < 0) { throw new IllegalStateException("collection is already empty!?"); } Entry<Integer, GHIntHashSet> e = map.firstEntry(); GHIntHashSet set = e.getValue(); if (set.isEmpty()) { throw new IllegalStateException("internal set is already empty!?"); } Iterator<IntCursor> iter = set.iterator(); final int val = iter.next().value; set.remove(val); if (set.isEmpty()) { map.remove(e.getKey()); } return val; }
Source:
<code>protected void onPause() { super.onPause(); mMapView.pause(); <START> } <END></code><technical_language>missing onDestroy suggestion @Override protected void onDestroy() { super.onDestroy(); mMapView.dispose(); }</technical_language>

Target:
protected void onPause() { mMapView.pause(); super.onPause(); }
Source:
<code>private void recursivelyExpandGroups(final Set<String> groupDNs, final LdapSchema schema, final DirContext ctx, final String groupDN) { if (groupDNs.add(groupDN) && schema.accountMemberField != null) { <START> Set<String> cachedGroupDNs = groupsByInclude.getIfPresent(groupDN); <END> if (cachedGroupDNs != null) { for (String cachedGroupDN : cachedGroupDNs) { recursivelyExpandGroups(groupDNs, schema, ctx, cachedGroupDN); } } else { try { final Name compositeGroupName = new CompositeName().add(groupDN); final Attribute in = ctx.getAttributes(compositeGroupName).get(schema.accountMemberField); cachedGroupDNs = new HashSet<String>(); if (in != null) { final NamingEnumeration<?> groups = in.getAll(); try { while (groups.hasMore()) { final String nextDN = (String) groups.next(); cachedGroupDNs.add(nextDN); recursivelyExpandGroups(groupDNs, schema, ctx, nextDN); } } catch (PartialResultException e) { } } groupsByInclude.put(groupDN, cachedGroupDNs); } catch (NamingException e) { LdapRealm.log.warn("Could not find group " + groupDN, e); } } } }</code><technical_language>This a loader format</technical_language>

Target:
private void recursivelyExpandGroups(final Set<String> groupDNs, final LdapSchema schema, final DirContext ctx, final String groupDN) { if (groupDNs.add(groupDN) && schema.accountMemberField != null) { ImmutableSet<String> cachedGroupDNs = groupsByInclude.getIfPresent(groupDN); if (cachedGroupDNs == null) { ImmutableSet.Builder<String> dns = ImmutableSet.builder(); try { final Name compositeGroupName = new CompositeName().add(groupDN); final Attribute in = ctx.getAttributes(compositeGroupName).get(schema.accountMemberField); if (in != null) { final NamingEnumeration<?> groups = in.getAll(); try { while (groups.hasMore()) { dns.add((String) groups.next()); } } catch (PartialResultException e) { } } } catch (NamingException e) { LdapRealm.log.warn("Could not find group " + groupDN, e); } cachedGroupDNs = dns.build(); groupsByInclude.put(groupDN, cachedGroupDNs); } for (String dn : cachedGroupDNs) { recursivelyExpandGroups(groupDNs, schema, ctx, dn); } } }
Source:
<code>public void draw(T value, Canvas canvas) { Texture texture = getTexture(value); if (marginTop + texture.getHeight() + marginBottom > canvas.size().y) { int iconHeight = canvas.size().y - marginTop - marginBottom; canvas.drawTexture(texture, Rect2i.createFromMinAndSize(marginLeft, marginTop, texture.getWidth(), iconHeight)); } else { int iconVerticalPosition = (canvas.size().y - texture.getHeight()) / 2; canvas.drawTexture(texture, Rect2i.createFromMinAndSize(marginLeft, iconVerticalPosition, texture.getWidth(), texture.getHeight())); } String text = getString(value); int iconWidth = marginLeft + texture.getWidth() + marginRight; if (wrap) { canvas.drawText(text, Rect2i.createFromMinAndSize(iconWidth, 0, canvas.getRegion().width() - iconWidth, canvas.getRegion().height())); } else { int width = canvas.size().x - iconWidth; Font font = canvas.getCurrentStyle().getFont(); if (font.getWidth(text) <= width) { canvas.drawText(text); } else { String shortText = "..."; StringBuilder sb = new StringBuilder(text); <START> while (sb.length() > 0) { <END> shortText = sb.toString() + "..."; if (font.getWidth(shortText) <= width) { break; } sb.setLength(sb.length() - 1); } canvas.drawText(shortText); } } }</code><technical_language>I similar code exists already, ok I guess</technical_language>

Target:
public void draw(T value, Canvas canvas) { Texture texture = getTexture(value); if (marginTop + texture.getHeight() + marginBottom > canvas.size().y) { int iconHeight = canvas.size().y - marginTop - marginBottom; canvas.drawTexture(texture, Rect2i.createFromMinAndSize(marginLeft, marginTop, texture.getWidth(), iconHeight)); } else { int iconVerticalPosition = (canvas.size().y - texture.getHeight()) / 2; canvas.drawTexture(texture, Rect2i.createFromMinAndSize(marginLeft, iconVerticalPosition, texture.getWidth(), texture.getHeight())); } String text = getString(value); int iconWidth = marginLeft + texture.getWidth() + marginRight; if (wrap) { canvas.drawText(text, Rect2i.createFromMinAndSize(iconWidth, 0, canvas.getRegion().width() - iconWidth, canvas.getRegion().height())); } else { int width = canvas.size().x - iconWidth; Font font = canvas.getCurrentStyle().getFont(); if (font.getWidth(text) <= width) { canvas.drawText(text); } else { String shortText = "..."; StringBuilder sb = new StringBuilder(text); while (sb.length() > 0) { shortText = sb.toString() + "..."; if (font.getWidth(shortText) <= width) { break; } sb.setLength(sb.length() - 1); } canvas.drawText(shortText, Rect2i.createFromMinAndSize(iconWidth, 0, canvas.getRegion().width() - iconWidth, canvas.getRegion().height())); } } }
Source:
<code>private void disposeInternal() { logger.debug("Disposing bridge '{}'", getThing().getUID().getId()); <START> super.dispose(); <END> if (discoveryService != null) { discoveryService.stopScan(); unregisterDeviceDiscoveryService(); } if (gateway != null) { gateway.dispose(); } if (config != null) { portPool.release(config.getXmlCallbackPort()); portPool.release(config.getBinCallbackPort()); } }</code><technical_language>is super.dispose intended called here? initializeInternal fails exceptionally super.dispose is called scheduleReinitialize handler up. I suggest clean internal stuff call super.dispose this.dispose</technical_language>

Target:
private void disposeInternal() { logger.debug("Disposing bridge '{}'", getThing().getUID().getId()); if (discoveryService != null) { discoveryService.stopScan(); unregisterDeviceDiscoveryService(); } if (gateway != null) { gateway.dispose(); } if (config != null) { portPool.release(config.getXmlCallbackPort()); portPool.release(config.getBinCallbackPort()); } }
Source:
<code>public static void init() { Debug.log("Loading Paper support module..."); ScriptEvent.registerScriptEvent(new PlayerEquipsArmorScriptEvent()); ScriptEvent.registerScriptEvent(new PlayerJumpsPaperScriptEventImpl()); ScriptEvent.registerScriptEvent(new PlayerSpectatesEntityScriptEvent()); <START> ScriptEvent.registerScriptEvent(new EntityKnocksbackEntityScriptEvent()); <END> ScriptEvent.registerScriptEvent(new PlayerStopsSpectatingScriptEvent()); ScriptEvent.registerScriptEvent(new ProjectileCollideScriptEvent()); ScriptEvent.registerScriptEvent(new TNTPrimesScriptEvent()); PropertyParser.registerProperty(EntityCanTick.class, EntityTag.class); }</code><technical_language>This list alphabetized (just order of events in IntelliJ class listing)</technical_language>

Target:
public static void init() { Debug.log("Loading Paper support module..."); ScriptEvent.registerScriptEvent(new EntityKnocksbackEntityScriptEvent()); ScriptEvent.registerScriptEvent(new PlayerEquipsArmorScriptEvent()); ScriptEvent.registerScriptEvent(new PlayerJumpsPaperScriptEventImpl()); ScriptEvent.registerScriptEvent(new PlayerSpectatesEntityScriptEvent()); ScriptEvent.registerScriptEvent(new PlayerStopsSpectatingScriptEvent()); ScriptEvent.registerScriptEvent(new ProjectileCollideScriptEvent()); ScriptEvent.registerScriptEvent(new TNTPrimesScriptEvent()); PropertyParser.registerProperty(EntityCanTick.class, EntityTag.class); }
Source:
<code>private Session getSession(URI sessionModelURI, boolean restore) { Session sessionFromURI; try { sessionFromURI = SessionManager.INSTANCE.getExistingSession(sessionModelURI); if (sessionFromURI == null && restore) { status = Status.OK_STATUS; SubMonitor subMonitor = SubMonitor.convert(new NullProgressMonitor(), "Get session", 1); <START> sessionFromURI = SessionManager.INSTANCE.openSession(sessionModelURI, subMonitor, SiriusEditPlugin.getPlugin().getUiCallback()); <END> } } catch (OperationCanceledException e) { sessionFromURI = null; status = new Status(IStatus.CANCEL, SiriusEditPlugin.ID, e.getLocalizedMessage(), e); } catch (RuntimeException e) { sessionFromURI = null; status = new Status(IStatus.ERROR, SiriusEditPlugin.ID, e.getLocalizedMessage(), e); } return sessionFromURI; }</code><technical_language>Lost code</technical_language>

Target:
private Session getSession(URI sessionModelURI, boolean restore) { Session sessionFromURI; try { sessionFromURI = SessionManager.INSTANCE.getExistingSession(sessionModelURI); if (sessionFromURI == null && restore) { status = Status.OK_STATUS; sessionFromURI = SessionManager.INSTANCE.openSession(sessionModelURI, new NullProgressMonitor(), SiriusEditPlugin.getPlugin().getUiCallback()); } if (sessionFromURI != null && sessionFromURI.isOpen()) { IEditingSession uiSession = SessionUIManager.INSTANCE.getUISession(sessionFromURI); if (uiSession == null && restore) { uiSession = SessionUIManager.INSTANCE.getOrCreateUISession(sessionFromURI); } if (uiSession != null && !uiSession.isOpen()) { uiSession.open(); } } } catch (OperationCanceledException e) { sessionFromURI = null; status = new Status(IStatus.CANCEL, SiriusEditPlugin.ID, e.getLocalizedMessage(), e); } catch (RuntimeException e) { sessionFromURI = null; status = new Status(IStatus.ERROR, SiriusEditPlugin.ID, e.getLocalizedMessage(), e); } return sessionFromURI; }
Source:
<code>public <P extends ProviderProxy<?>> P create(Provider<?> provider) { <START> if (provider.getIsDummy()) { return (P) new DummyNetworkProviderProxy(provider); } <END> switch (provider.getType()) { case EXTERNAL_NETWORK: return (P) new ExternalNetworkProviderProxy((Provider<OpenstackNetworkProviderProperties>) provider); case FOREMAN: return (P) new ForemanHostProviderProxy(provider); case OPENSTACK_NETWORK: return (P) new OpenstackNetworkProviderProxy((Provider<OpenstackNetworkProviderProperties>) provider); case OPENSTACK_IMAGE: return (P) new OpenStackImageProviderProxy((Provider<OpenStackImageProviderProperties>) provider); case OPENSTACK_VOLUME: return (P) new OpenStackVolumeProviderProxy((Provider<OpenStackVolumeProviderProperties>) provider); case VMWARE: return (P) Injector.injectMembers(new VmwareVmProviderProxy((Provider<VmwareVmProviderProperties>) provider)); case KVM: return (P) Injector.injectMembers(new KVMVmProviderProxy((Provider<KVMVmProviderProperties>) provider)); case XEN: return (P) Injector.injectMembers(new XENVmProviderProxy((Provider<XENVmProviderProperties>) provider)); default: return null; } }</code><technical_language>point of view, move this case EXTERNAL_NETWORK case OPENSTACK_NETWORK, types 'dummyaware', this means code duplication</technical_language>

Target:
public <P extends ProviderProxy<?>> P create(Provider<?> provider) { switch (provider.getType()) { case EXTERNAL_NETWORK: if (provider.getIsDummy()) { return (P) new DummyNetworkProviderProxy(provider); } return (P) new ExternalNetworkProviderProxy((Provider<OpenstackNetworkProviderProperties>) provider); case FOREMAN: return (P) new ForemanHostProviderProxy(provider); case OPENSTACK_NETWORK: if (provider.getIsDummy()) { return (P) new DummyNetworkProviderProxy(provider); } return (P) new OpenstackNetworkProviderProxy((Provider<OpenstackNetworkProviderProperties>) provider); case OPENSTACK_IMAGE: return (P) new OpenStackImageProviderProxy((Provider<OpenStackImageProviderProperties>) provider); case OPENSTACK_VOLUME: return (P) new OpenStackVolumeProviderProxy((Provider<OpenStackVolumeProviderProperties>) provider); case VMWARE: return (P) Injector.injectMembers(new VmwareVmProviderProxy((Provider<VmwareVmProviderProperties>) provider)); case KVM: return (P) Injector.injectMembers(new KVMVmProviderProxy((Provider<KVMVmProviderProperties>) provider)); case XEN: return (P) Injector.injectMembers(new XENVmProviderProxy((Provider<XENVmProviderProperties>) provider)); default: return null; } }
Source:
<code>public void testSizeLimitReachWaits() throws InterruptedException { ExecutorService pool = Executors.newCachedThreadPool(); try { final HeapSizeManager underTest = new HeapSizeManager(1l, 1, executorService); long id = underTest.registerOperationWithHeapSize(5l); assertTrue(underTest.hasInflightRequests()); final AtomicBoolean secondRequestRegistered = new AtomicBoolean(); pool.submit(new Runnable() { @Override public void run() { try { underTest.registerOperationWithHeapSize(5l); <START> secondRequestRegistered.set(true); <END> } catch (InterruptedException e) { e.printStackTrace(); } } }); Thread.sleep(10); assertFalse(secondRequestRegistered.get()); underTest.markOperationCompleted(id); Thread.sleep(10); assertTrue(secondRequestRegistered.get()); } finally { pool.shutdownNow(); } }</code><technical_language>adding another flag, isFull() check</technical_language>

Target:
public void testSizeLimitReachWaits() throws InterruptedException { ExecutorService pool = Executors.newCachedThreadPool(); try { final HeapSizeManager underTest = new HeapSizeManager(1l, 1, executorService); long id = underTest.registerOperationWithHeapSize(5l); assertTrue(underTest.hasInflightRequests()); assertTrue(underTest.isFull()); final AtomicBoolean secondRequestRegistered = new AtomicBoolean(); pool.submit(new Runnable() { @Override public void run() { try { underTest.registerOperationWithHeapSize(5l); secondRequestRegistered.set(true); } catch (InterruptedException e) { throw new RuntimeException(e); } } }); Thread.sleep(10); assertFalse(secondRequestRegistered.get()); underTest.markOperationCompleted(id); Thread.sleep(10); assertTrue(secondRequestRegistered.get()); } finally { pool.shutdownNow(); } }
Source:
<code>public RepositoryCacheConfig fromConfig(Config config) { setExpireAfter( <START> config.getLong("core", <END> null, "repositoryCacheExpireAfter", getExpireAfter())); setCleanupDelay( config.getLong("core", null, "repositoryCacheCleanupDelay", AUTO_CLEANUP_DELAY)); return this; }</code><technical_language>this change rebase top of config time unit change config.getTimeUnit here</technical_language>

Target:
public RepositoryCacheConfig fromConfig(Config config) { setExpireAfter( config.getTimeUnit("core", null, "repositoryCacheExpireAfter", getExpireAfter(), TimeUnit.MILLISECONDS)); setCleanupDelay( config.getTimeUnit("core", null, "repositoryCacheCleanupDelay", AUTO_CLEANUP_DELAY, TimeUnit.MILLISECONDS)); return this; }
Source:
<code>public boolean performOk() { for(int i=0; i<envVariables.length; i++) <START> envVariables[i].store(); <END> return true; }</code><technical_language>braces great</technical_language>

Target:
public boolean performOk() { for (StringFieldEditor envVariable : envVariables) { envVariable.store(); } return true; }
Source:
<code>public void checkDebug() { debug = getContext().getConfiguration().get(GenomixJobConf.DEBUG_KMERS) != null; if (problemKmers == null) { problemKmers = new ArrayList<VKmer>(); if (getContext().getConfiguration().get(GenomixJobConf.DEBUG_KMERS) != null) { for (String kmer : getContext().getConfiguration().get(GenomixJobConf.DEBUG_KMERS).split(",")) { problemKmers.add(new VKmer(kmer)); } Node.problemKmers = problemKmers; } } verbose = false; <START> verbose |= debug; <END> for (VKmer problemKmer : problemKmers) { verbose |= debug && (getVertexValue().getNode().findEdge(problemKmer) != null || getVertexId().equals(problemKmer)); } }</code><technical_language>nodes verbose if debug is true??</technical_language>

Target:
public void checkDebug() { debug = getContext().getConfiguration().get(GenomixJobConf.DEBUG_KMERS) != null; if (problemKmers == null) { problemKmers = new ArrayList<VKmer>(); if (getContext().getConfiguration().get(GenomixJobConf.DEBUG_KMERS) != null) { for (String kmer : getContext().getConfiguration().get(GenomixJobConf.DEBUG_KMERS).split(",")) { problemKmers.add(new VKmer(kmer)); } Node.problemKmers = problemKmers; } } verbose = false; for (VKmer problemKmer : problemKmers) { verbose |= debug && (getVertexValue().getNode().findEdge(problemKmer) != null || getVertexId().equals(problemKmer)); } }
Source:
<code>public void setVariable(final TestSuite testSuite, final String identifier, final String content, @ScriptParameter(defaultValue = ScriptParameter.NULL) final String description, @ScriptParameter(defaultValue = ScriptParameter.NULL) final String path) { <START> testSuite.getModel().setVariable(identifier, content, description, new Path(path)); <END> }</code><technical_language>working for null input</technical_language>

Target:
public void setVariable(final TestSuite testSuite, final String identifier, final String content, @ScriptParameter(defaultValue = ScriptParameter.NULL) final String description, @ScriptParameter(defaultValue = ScriptParameter.NULL) final String path) { final IPath validPath = (path == null) ? Path.ROOT : new Path(path); testSuite.getModel().setVariable(identifier, content, description, validPath); }
Source:
<code>private Map<String, Guid> getAllDestinationInterfacesIdByName() { if (allDestinationInterfacesIdByName == null) { allDestinationInterfacesIdByName = <START> interfaceDao.getAllInterfacesForVds(getDestinationHostId()) <END> .stream() .collect(Collectors.toMap(VdsNetworkInterface::getName, NetworkInterface::getId)); } return allDestinationInterfacesIdByName; }</code><technical_language>This db query is triggered twice, cache result, e.g. in a getter ;-)</technical_language>

Target:
private Map<String, Guid> getAllDestinationInterfacesIdByName() { if (allDestinationInterfacesIdByName == null) { allDestinationInterfacesIdByName = getUnfilteredDestinationInterfaces() .stream() .collect(Collectors.toMap(VdsNetworkInterface::getName, NetworkInterface::getId)); } return allDestinationInterfacesIdByName; }
Source:
<code>public void testCheckAccessNullThreadGroup() { carbonSecurityManager = mock(CarbonSecurityManager.class); ThreadGroup threadGroup = null; assertNull(threadGroup); <START> carbonSecurityManager.checkAccess(threadGroup); <END> }</code><technical_language>checkAccess method a null throw exception. IMO, do need mock this class. This method altered test for a null pointer expected exception</technical_language>

Target:
public void testCheckAccessNullThreadGroup() { System.setProperty("denied.system.properties", "mockDeniedProperty"); carbonSecurityManager = new CarbonSecurityManager(); ThreadGroup threadGroup = null; assertNull(threadGroup); carbonSecurityManager.checkAccess(threadGroup); }
Source:
<code>public String getWithSleep() throws InterruptedException { <START> Thread.sleep(SLEEP_TIME); <END> return "success"; }</code><technical_language>I personally prefer this approach instead of Thread.sleep() long sleep represents</technical_language>

Target:
public String getWithSleep() throws InterruptedException { TimeUnit.MILLISECONDS.sleep(SLEEP_TIME_IN_MILLIS); return "success"; }
Source:
<code>public void display(OutputStream out) { final PrintWriter stdout; try { stdout = new PrintWriter(new BufferedWriter(new OutputStreamWriter(out, "UTF-8"))); } catch (UnsupportedEncodingException e) { throw new RuntimeException("JVM lacks UTF-8 encoding", e); } try { final Map<String, DashboardInfo> dashboards; if (level != null) { switch (level) { case PROJECT: final Project.NameKey projectName = new Project.NameKey(entityName); final ProjectState projectState = projectCache.get(projectName); DashboardInfo defaultInfo = findProjectDefaultDashboard(projectState); if (defaultDashboard) { dashboards = Maps.newTreeMap(); if (defaultInfo != null) { dashboards.put(defaultInfo.id, defaultInfo); } } else { <START> dashboards = allDashboardsFor(projectState, defaultInfo.id); <END> } break; default: throw new IllegalStateException("unsupported dashboard level: " + level); } } else { dashboards = Maps.newTreeMap(); } format.newGson().toJson(dashboards, new TypeToken<Map<String, DashboardInfo>>() {}.getType(), stdout); stdout.print('\n'); } finally { stdout.flush(); } }</code><technical_language>defaultInfo null</technical_language>

Target:
public void display(OutputStream out) { final PrintWriter stdout; try { stdout = new PrintWriter(new BufferedWriter(new OutputStreamWriter(out, "UTF-8"))); } catch (UnsupportedEncodingException e) { throw new RuntimeException("JVM lacks UTF-8 encoding", e); } try { final Map<String, DashboardInfo> dashboards; if (level != null) { switch (level) { case PROJECT: final Project.NameKey projectName = new Project.NameKey(entityName); final ProjectState projectState = projectCache.get(projectName); DashboardInfo defaultInfo = findProjectDefaultDashboard(projectState); if (defaultDashboard) { dashboards = Maps.newTreeMap(); if (defaultInfo != null) { dashboards.put(defaultInfo.id, defaultInfo); } } else { dashboards = allDashboardsFor(projectState, defaultInfo != null ? defaultInfo.id : null); } break; default: throw new IllegalStateException("unsupported dashboard level: " + level); } } else { dashboards = Maps.newTreeMap(); } format.newGson().toJson(dashboards, new TypeToken<Map<String, DashboardInfo>>() {}.getType(), stdout); stdout.print('\n'); } finally { stdout.flush(); } }
Source:
<code>public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; if (!FiltersHelper.isAuthenticated(req)) { chain.doFilter(request, response); String headerValue = req.getHeader("Authorization"); if (headerValue != null && headerValue.startsWith("Basic ")) { <START> String credentials = headerValue.substring("Basic".length()); <END> String userPass = new String(Base64.decodeBase64(credentials), Charset.defaultCharset().toString()); String[] creds = userPass.split(":", 2); if (creds != null && creds.length == 2) { handleCredentials(request, creds[0], creds[1], getSeparator(creds[0])); } } } chain.doFilter(request, response); }</code><technical_language>need credentials temp variable</technical_language>

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; if (!FiltersHelper.isAuthenticated(req)) { chain.doFilter(request, response); String headerValue = req.getHeader("Authorization"); if (headerValue != null && headerValue.startsWith("Basic ")) { String[] creds = new String( Base64.decodeBase64(headerValue.substring("Basic".length())), Charset.forName("UTF-8") ).split(":", 2); handleCredentials(request, creds); } } chain.doFilter(request, response); }
Source:
<code>public ItemUseHandler getItemHandler() { return e -> { <START> if (e.getClickedBlock().isPresent()) { <END> Block block = e.getClickedBlock().get(); ItemStack item = e.getItem(); Player p = e.getPlayer(); if (!getID().equals("TEST_CLIMBING_PICK") && p.getLocation().distance(block.getLocation()) > 1.5) return; if (e.getClickedFace() == BlockFace.DOWN || e.getClickedFace() == BlockFace.UP) return; if (!users.contains(p.getUniqueId())) { Vector velocity = new Vector(1, 1, 1); if (!getID().equals("TEST_CLIMBING_PICK")) { velocity = p.getVelocity(); } Material mat = block.getType(); if (materialSpeeds.getValue().containsKey(mat.name())) { double launch = materialSpeeds.getValue().get(mat.name()); if (item.getEnchantments().containsKey(Enchantment.DIG_SPEED)) { launch += (item.getEnchantmentLevel(Enchantment.DIG_SPEED) * 0.2); } velocity = velocity.setY(velocity.getY() + launch); } users.add(p.getUniqueId()); Bukkit.getScheduler().runTaskLaterAsynchronously(SlimefunPlugin.instance, () -> users.remove(p.getUniqueId()), 4L); ClimbingPickLaunchEvent event = new ClimbingPickLaunchEvent(p, velocity, item); Bukkit.getPluginManager().callEvent(event); } } }; }</code><technical_language>save some intention negate + return</technical_language>

Target:
public ItemUseHandler getItemHandler() { return e -> { if (!e.getClickedBlock().isPresent()) return; Block block = e.getClickedBlock().get(); ItemStack item = e.getItem(); Player p = e.getPlayer(); if (p.getLocation().distanceSquared(block.getLocation()) > 2.25) return; if (e.getClickedFace() == BlockFace.DOWN || e.getClickedFace() == BlockFace.UP) return; if (!users.contains(p.getUniqueId())) { double launch = materialSpeeds.getOrDefault(block.getType(), 0D); Vector velocity = new Vector(0, 0, 0); if (launch > 0.05) { int efficiencyLevel = item.getEnchantments().getOrDefault(Enchantment.DIG_SPEED, 0); if (efficiencyLevel != 0){ launch += (efficiencyLevel * 0.2); } velocity.setY(launch); users.add(p.getUniqueId()); Bukkit.getScheduler().runTaskLater(SlimefunPlugin.instance(), () -> users.remove(p.getUniqueId()), 4L); } ClimbingPickLaunchEvent event = new ClimbingPickLaunchEvent(p, velocity, this, item, block); Bukkit.getPluginManager().callEvent(event); if (!event.isCancelled()) { p.setVelocity(event.getVelocity()); p.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, 1); if (p.getGameMode() != GameMode.CREATIVE) { damageItem(p, e.getItem()); } } } }; }
Source:
<code>public boolean equals(Object o) { <START> if (this == o) return true; <END> if (o == null || getClass() != o.getClass()) return false; FieldType fieldType = (FieldType) o; return id != null ? id.equals(fieldType.id) : fieldType.id == null; }</code><technical_language>![MINOR](<LINK_2> 'Severity: MINOR') Missing curly brace. [![rule](<LINK_1>](<LINK_0> ![MINOR](<LINK_2> 'Severity: MINOR') statement is allowed line, 2 statements this line. [![rule](<LINK_1>](<LINK_3></technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } FieldType fieldType = (FieldType) o; return id != null ? id.equals(fieldType.id) : fieldType.id == null; }
Source:
<code>public Command(String[] cmd, String[] envVars) { if (cmd != null) { this.cmd = new String[cmd.length]; System.arraycopy(cmd, 0, this.cmd, 0, cmd.length); } if (envVars != null) { <START> this.envVars = new String[envVars.length]; <END> System.arraycopy(envVars, 0, this.envVars, 0, envVars.length); } }</code><technical_language>considered Arrays.copyOf</technical_language>

Target:
public Command(String[] cmd, String[] envVars) { if (cmd != null) { this.cmd = Arrays.copyOf(cmd, cmd.length); } if (envVars != null) { this.envVars = Arrays.copyOf(envVars, envVars.length); } }
Source:
<code>public void startDownload(List<DiskImage> disks) { log.info("Start download for disks: " + Linq.getDiskAliases(disks)); List<ActionParametersBase> <START> transferDiskImageParametersList = <END> new ArrayList<>(); disks.forEach(disk -> transferDiskImageParametersList.add( DownloadImageHandler.createInitParams(disk))); Frontend.getInstance().runMultipleAction(ActionType.TransferDiskImage, transferDiskImageParametersList, callback()); }</code><technical_language>"transferDiskImageParameters"</technical_language>

Target:
public void startDownload(List<DiskImage> disks) { log.info("Start download for disks: " + Linq.getDiskAliases(disks)); List<ActionParametersBase> transferDiskImageParameters = new ArrayList<>(); disks.forEach(disk -> transferDiskImageParameters.add( DownloadImageHandler.createInitParams(disk))); Frontend.getInstance().runMultipleAction(ActionType.TransferDiskImage, transferDiskImageParameters, callback()); }
Source:
<code>private int calculatePortalHeight() { for (height = 0; height < 21; ++height) { boolean flag = false; for (int i = 0; i < width; ++i) { Location location = offsetImmutable(bottomLeft, left.getOppositeFace(), i) .add(0, height, 0); Material material = location.getBlock().getType(); if (!canBuildThrough(material)) { flag = true; break; } if (material == Material.PORTAL) { ++portalBlockCount; } if (i == 0) { material = offsetImmutable(location, left, 1).getBlock().getType(); if (material != Material.OBSIDIAN) { flag = true; break; } } else if (i == width - 1) { material = offsetImmutable(location, left, -1).getBlock().getType(); if (material != Material.OBSIDIAN) { flag = true; break; } } } if (flag) { break; } } for (int j = 0; j < width; ++j) { if (offsetImmutable(bottomLeft, left, -j).add(0, height, 0).getBlock().getType() != Material.OBSIDIAN) { height = 0; break; } } if (height <= 21 && height >= 3) { return height; <START> } else { <END> bottomLeft = null; width = 0; height = 0; return 0; } }</code><technical_language>else statement is unnecessary returning in if-statement</technical_language>

Target:
private int calculatePortalHeight() { for (height = 0; height < MAX_PORTAL_WIDTH_HEIGHT; ++height) { boolean flag = false; for (int i = 0; i < width; ++i) { Location location = offsetImmutable(bottomLeft, left.getOppositeFace(), i) .add(0, height, 0); Material material = location.getBlock().getType(); if (!canBuildThrough(material)) { flag = true; break; } if (material == Material.PORTAL) { ++portalBlockCount; } if (i == 0) { material = offsetImmutable(location, left, 1).getBlock().getType(); if (material != Material.OBSIDIAN) { flag = true; break; } } else if (i == width - 1) { material = offsetImmutable(location, left, -1).getBlock().getType(); if (material != Material.OBSIDIAN) { flag = true; break; } } } if (flag) { break; } } for (int j = 0; j < width; ++j) { if (offsetImmutable(bottomLeft, left, -j).add(0, height, 0).getBlock().getType() != Material.OBSIDIAN) { height = 0; break; } } if (height <= MAX_PORTAL_WIDTH_HEIGHT && height >= MIN_PORTAL_HEIGHT) { return height; } bottomLeft = null; width = 0; height = 0; return 0; }
Source:
<code>public void testBatchLoookupOverconsumedBySubscriptionId() { Map<String, Entitlement> subIdMap = new HashMap<String, Entitlement>(); List<Pool> expectedPools = new ArrayList<Pool>(); for (Integer i = 0; i < 5; i++) { <START> <END> Pool pool = createPool(owner, product, 1L, TestUtil.createDate(2050, 3, 2), TestUtil.createDate(2055, 3, 2)); poolCurator.create(pool); expectedPools.add(pool); String subid = pool.getSubscriptionId(); Entitlement e = new Entitlement(pool, consumer, 2); entitlementCurator.create(e); subIdMap.put(subid, e); } Pool unconsumedPool = createPool(owner, product, 1L, TestUtil.createDate(2050, 3, 2), TestUtil.createDate(2055, 3, 2)); poolCurator.create(unconsumedPool); Pool notOverConsumedPool = createPool(owner, product, 1L, TestUtil.createDate(2050, 3, 2), TestUtil.createDate(2055, 3, 2)); poolCurator.create(notOverConsumedPool); entitlementCurator.create(new Entitlement(notOverConsumedPool, consumer, 1)); List<Pool> gotPools = poolCurator.lookupOversubscribedBySubscriptionIds(subIdMap); assertEquals(5, gotPools.size()); for (Pool expectedPool : gotPools) { assertTrue(gotPools.contains(expectedPool)); } assertFalse(gotPools.contains(unconsumedPool)); assertFalse(gotPools.contains(notOverConsumedPool)); }</code><technical_language>Extraneous whitespace</technical_language>

Target:
public void testBatchLoookupOverconsumedBySubscriptionId() { Map<String, Entitlement> subIdMap = new HashMap<String, Entitlement>(); List<Pool> expectedPools = new ArrayList<Pool>(); for (Integer i = 0; i < 5; i++) { Pool pool = createPool(owner, product, 1L, TestUtil.createDate(2050, 3, 2), TestUtil.createDate(2055, 3, 2)); poolCurator.create(pool); expectedPools.add(pool); String subid = pool.getSubscriptionId(); Entitlement e = new Entitlement(pool, consumer, 2); entitlementCurator.create(e); subIdMap.put(subid, e); } Pool unconsumedPool = createPool(owner, product, 1L, TestUtil.createDate(2050, 3, 2), TestUtil.createDate(2055, 3, 2)); poolCurator.create(unconsumedPool); Pool notOverConsumedPool = createPool(owner, product, 1L, TestUtil.createDate(2050, 3, 2), TestUtil.createDate(2055, 3, 2)); poolCurator.create(notOverConsumedPool); entitlementCurator.create(new Entitlement(notOverConsumedPool, consumer, 1)); Pool overConsumedPool = createPool(owner, product, 1L, TestUtil.createDate(2050, 3, 2), TestUtil.createDate(2055, 3, 2)); poolCurator.create(overConsumedPool); entitlementCurator.create(new Entitlement(overConsumedPool, consumer, 2)); List<Pool> gotPools = poolCurator.lookupOversubscribedBySubscriptionIds(subIdMap); assertEquals(5, gotPools.size()); assertThat(expectedPools, hasItems(gotPools.toArray(new Pool[0]))); assertThat(gotPools, not(hasItem(unconsumedPool))); assertThat(gotPools, not(hasItem(notOverConsumedPool))); assertThat(gotPools, not(hasItem(overConsumedPool))); }
Source:
<code>private boolean needsTildeValue(final int firstNonzeroIdx, final int lastNonzeroIdx, final LinkedHashMap<String, Long> truncatedFragments, final int handledFragmentCount, final boolean needsTilde, final Long value, final String key) { boolean tilde = needsTilde; long longValue = value.longValue(); int idx; <START> switch (key) { <END> case WEEK: idx = WEEKIDX; break; case DAY: idx = DAYIDX; break; case HOUR: idx = HOURIDX; break; case MIN: idx = MINIDX; break; default: idx = -1; break; } if (firstNonzeroIdx <= idx && idx <= lastNonzeroIdx && longValue > 0) { if (handledFragmentCount < 2) { truncatedFragments.put(key, value); } else { tilde = true; } } return tilde; }</code><technical_language>Extract switch a method please</technical_language>

Target:
private boolean needsTildeValue(final int firstNonzeroIdx, final int lastNonzeroIdx, final LinkedHashMap<String, Long> truncatedFragments, final int handledFragmentCount, final boolean needsTilde, final Long value, final String key) { boolean tilde = needsTilde; long longValue = value.longValue(); int idx = getIdx(key); if (firstNonzeroIdx <= idx && idx <= lastNonzeroIdx && longValue > 0) { if (handledFragmentCount < 2) { truncatedFragments.put(key, value); } else { tilde = true; } } return tilde; }
Source:
<code>private void initializeCommand() { when(vmDao.get(any())).thenReturn(vm); Cluster cluster = new Cluster(); cluster.setCompatibilityVersion(Version.v4_4); when(clusterDao.get(any())).thenReturn(cluster); VmTemplate vmTemplate = new VmTemplate(); when(vmTemplateDao.get(any())).thenReturn(vmTemplate); disk.setStorageIds(Collections.singletonList(Guid.newGuid())); List<Disk> disks = Collections.singletonList(disk); QueryReturnValue queryReturnValue = new QueryReturnValue(); queryReturnValue.setSucceeded(true); queryReturnValue.setReturnValue(disks); <START> when(backendInternal.runInternalQuery(eq(QueryType.GetAllDisksByVmId), any(), any())).thenReturn(queryReturnValue); <END> when(diskDao.getAllForVm(any())).thenReturn(disks); cmd.init(); }</code><technical_language>please break line</technical_language>

Target:
private void initializeCommand() { when(vmDao.get(any())).thenReturn(vm); Cluster cluster = new Cluster(); cluster.setCompatibilityVersion(Version.v4_4); when(clusterDao.get(any())).thenReturn(cluster); VmTemplate vmTemplate = new VmTemplate(); when(vmTemplateDao.get(any())).thenReturn(vmTemplate); disk.setStorageIds(Collections.singletonList(Guid.newGuid())); List<Disk> disks = Collections.singletonList(disk); QueryReturnValue disksByVmId = new QueryReturnValue(); disksByVmId.setSucceeded(true); disksByVmId.setReturnValue(disks); when(backendInternal.runInternalQuery(eq(QueryType.GetAllDisksByVmId), any(), any())) .thenReturn(disksByVmId); when(diskDao.getAllForVm(any())).thenReturn(disks); cmd.init(); }
Source:
<code>private static FileDialog createNewFileDialog(Shell parent, int style) { String[] <START> overrridePath = <END> fOverridePath; List<String> sanitizedPath = overrridePath == null ? Collections.emptyList() : overrridePath.length == 0 ? Collections.emptyList() : Arrays.asList(overrridePath); fOverride = false; return new FileDialog(parent, style) { @Override public String open() { return !sanitizedPath.isEmpty() ? sanitizedPath.get(0) : null; } @Override protected void checkSubclass() { } @Override public String getFileName() { return !sanitizedPath.isEmpty() ? getFileName(sanitizedPath.get(0)) : ""; } @Override public String[] getFileNames() { List<String> outStrings = new ArrayList<>(); for (String entry : sanitizedPath) { outStrings.add(getFileName(entry)); } return outStrings.toArray(new String[outStrings.size()]); } @Override public String getFilterPath() { return !sanitizedPath.isEmpty() ? new Path(sanitizedPath.get(0)).removeLastSegments(1).toString() : ""; } private String getFileName(String path) { return new Path(path).lastSegment(); } }; }</code><technical_language>r's</technical_language>

Target:
private static FileDialog createNewFileDialog(Shell parent, int style) { String[] overridePath = fOverridePath; List<String> sanitizedPath = overridePath == null ? Collections.emptyList() : Arrays.asList(overridePath); fOverride = false; return new FileDialog(parent, style) { @Override public String open() { return !sanitizedPath.isEmpty() ? sanitizedPath.get(0) : null; } @Override protected void checkSubclass() { } @Override public String getFileName() { return !sanitizedPath.isEmpty() ? getFileName(sanitizedPath.get(0)) : ""; } @Override public String[] getFileNames() { List<String> outStrings = new ArrayList<>(); for (String entry : sanitizedPath) { outStrings.add(getFileName(entry)); } return outStrings.toArray(new String[outStrings.size()]); } @Override public String getFilterPath() { return !sanitizedPath.isEmpty() ? new Path(sanitizedPath.get(0)).removeLastSegments(1).toString() : ""; } private String getFileName(String path) { return new Path(path).lastSegment(); } }; }