[hg] main-silver: Issue #225589 - Non-empty roots encountered wh...

  • From: Svata Dedic < >
  • To:
  • Subject: [hg] main-silver: Issue #225589 - Non-empty roots encountered wh...
  • Date: Fri, 01 Feb 2013 02:37:30 -0800

changeset e361a7d6d1bf in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/e361a7d6d1bf
description:
        Issue #225589 - Non-empty roots encountered while no projects are 
opened: fixed
        Improved detection of IDE-injected entries on classpaths so 
diagnostics of scanning without project is not printed

diffstat:

 
parsing.api/src/org/netbeans/modules/parsing/impl/indexing/RepositoryUpdater.java
 |  41 ++++++++-
 1 files changed, 36 insertions(+), 5 deletions(-)

diffs (61 lines):

diff --git 
a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/RepositoryUpdater.java
 
b/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/RepositoryUpdater.java
--- 
a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/RepositoryUpdater.java
+++ 
b/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/RepositoryUpdater.java
@@ -120,6 +120,7 @@
 import org.openide.filesystems.FileSystem;
 import org.openide.filesystems.FileUtil;
 import org.openide.filesystems.URLMapper;
+import org.openide.modules.InstalledFileLocator;
 import org.openide.util.Cancellable;
 import org.openide.util.Exceptions;
 import org.openide.util.Lookup;
@@ -4240,14 +4241,44 @@
             if (!shouldDoNothing || roots.isEmpty() || 
getCancelRequest().isRaised()) {
                 return;
             }
-            boolean found = false;
+            int stubCount = 0;
+            // ignore all files, which reside in IDE installation (in 
various clusters)
+            // the ignored files must be located 1 subdirectory beneath the 
cluster 
+            // directory
             for (URL u : roots) {
-                if (!u.getPath().contains("jsstubs/allstubs.zip")) {
-                    found = true;
+                String path = u.getPath();
+                if (path == null || !path.endsWith("stubs.zip!/")) { // 
NOI18N
                     break;
                 }
-            }
-            if (!found) {
+                FileObject f = URLMapper.findFileObject(u);
+                if (f == null) {
+                    break;
+                }
+                // !/ is a root inside archive, get the archive which 
encapsulates it -> normal FS
+                FileObject archive = FileUtil.getArchiveFile(f);
+                File archiveFile;
+                // quick check - if the archive is not on OS FS, bail out.
+                if (archive == null || 
+                    ((archiveFile = FileUtil.toFile(archive)) == null)) {
+                    break;
+                }
+                // 1 level up = dir-in-cluster. 2 levels up = cluster dir
+                FileObject parent = archive.getParent();
+                if (parent == null) {
+                    break;
+                }
+                parent = parent.getParent();
+                if (parent == null) {
+                    break;
+                }
+                String clusterPath = FileUtil.getRelativePath(parent, 
archive);
+                File file = 
InstalledFileLocator.getDefault().locate(clusterPath, null, false);
+                if (file == null || !file.equals(archiveFile)) {
+                    break;
+                }
+                stubCount++;
+            }
+            if (stubCount == roots.size()) {
                 return;
             }
             if (previousLevel == null) {

[hg] main-silver: Issue #225589 - Non-empty roots encountered wh...

Svata Dedic 02/01/2013

Project Features

About this Project

Editor was started in November 2009, is owned by Martin Ryzl, and has 147 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20131025.e7cbc9d). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close