This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 177156
Collapse All | Expand All

(-)a/project.ant/src/org/netbeans/spi/project/support/ant/SourcesHelper.java (-9 / +3 lines)
Lines 711-718 Link Here
711
     * Register all external source or non-source roots using {@link FileOwnerQuery#markExternalOwner}.
711
     * Register all external source or non-source roots using {@link FileOwnerQuery#markExternalOwner}.
712
     * <p>
712
     * <p>
713
     * Only roots added by {@link #addPrincipalSourceRoot} and {@link #addNonSourceRoot}
713
     * Only roots added by {@link #addPrincipalSourceRoot} and {@link #addNonSourceRoot}
714
     * are considered. They are registered if (and only if) they in fact fall
714
     * are considered. They are registered only if the folders really
715
     * outside of the project directory, and of course only if the folders really
716
     * exist on disk. Currently it is not defined when this file existence check
715
     * exist on disk. Currently it is not defined when this file existence check
717
     * is done (e.g. when this method is first called, or periodically) or whether
716
     * is done (e.g. when this method is first called, or periodically) or whether
718
     * folders which are created subsequently will be registered, so project type
717
     * folders which are created subsequently will be registered, so project type
Lines 761-768 Link Here
761
     * Register all external source or non-source roots using {@link FileOwnerQuery#markExternalOwner}.
760
     * Register all external source or non-source roots using {@link FileOwnerQuery#markExternalOwner}.
762
     * <p>
761
     * <p>
763
     * Only roots added by {@link #addPrincipalSourceRoot} and {@link #addNonSourceRoot}
762
     * Only roots added by {@link #addPrincipalSourceRoot} and {@link #addNonSourceRoot}
764
     * are considered. They are registered if (and only if) they in fact fall
763
     * are considered. They are registered only if the folders really
765
     * outside of the project directory, and of course only if the folders really
766
     * exist on disk. Currently it is not defined when this file existence check
764
     * exist on disk. Currently it is not defined when this file existence check
767
     * is done (e.g. when this method is first called, or periodically) or whether
765
     * is done (e.g. when this method is first called, or periodically) or whether
768
     * folders which are created subsequently will be registered, so project type
766
     * folders which are created subsequently will be registered, so project type
Lines 836-849 Link Here
836
        // up calling APH.resolveFileObject repeatedly (for each property change)
834
        // up calling APH.resolveFileObject repeatedly (for each property change)
837
        for (Root r : allRoots) {
835
        for (Root r : allRoots) {
838
            for (FileObject loc : r.getIncludeRoots(minimalSubfolders)) {
836
            for (FileObject loc : r.getIncludeRoots(minimalSubfolders)) {
839
                if (FileUtil.getRelativePath(pdir, loc) != null) {
840
                    // Inside projdir already. Skip it.
841
                    continue;
842
                }
843
                if (loc.isFolder()) {
837
                if (loc.isFolder()) {
844
                    try {
838
                    try {
845
                        Project other = ProjectManager.getDefault().findProject(loc);
839
                        Project other = ProjectManager.getDefault().findProject(loc);
846
                        if (other != null) {
840
                        if (other != null && other != p) {
847
                            // This is a foreign project; we cannot own it. Skip it.
841
                            // This is a foreign project; we cannot own it. Skip it.
848
                            continue;
842
                            continue;
849
                        }
843
                        }
(-)a/projectapi/src/org/netbeans/modules/projectapi/SimpleFileOwnerQueryImplementation.java (-7 / +12 lines)
Lines 142-149 Link Here
142
                }
142
                }
143
            }
143
            }
144
            
144
            
145
            URI key = fileObject2URI(f);
145
            if (!externalOwners.isEmpty() && (folder || externalRootsIncludeNonFolders)) {
146
            if (!externalOwners.isEmpty() && (folder || externalRootsIncludeNonFolders)) {
146
                Reference<FileObject> externalOwnersReference = externalOwners.get(fileObject2URI(f));
147
                Reference<FileObject> externalOwnersReference = externalOwners.get(key);
147
148
148
                if (externalOwnersReference != null) {
149
                if (externalOwnersReference != null) {
149
                    FileObject externalOwner = externalOwnersReference.get();
150
                    FileObject externalOwner = externalOwnersReference.get();
Lines 166-181 Link Here
166
                }
167
                }
167
            }
168
            }
168
            if (!deserializedExternalOwners.isEmpty() && (folder || externalRootsIncludeNonFolders)) {
169
            if (!deserializedExternalOwners.isEmpty() && (folder || externalRootsIncludeNonFolders)) {
169
                FileObject externalOwner = deserializedExternalOwners.get(fileObject2URI(f));
170
                FileObject externalOwner = deserializedExternalOwners.get(key);
170
                if (externalOwner != null && externalOwner.isValid()) {
171
                if (externalOwner != null && externalOwner.isValid()) {
171
                    try {
172
                    try {
172
                        // Note: will be null if there is no such project.
173
                        Project p = ProjectManager.getDefault().findProject(externalOwner);
173
                        Project p = ProjectManager.getDefault().findProject(externalOwner);
174
                        synchronized (this) {
174
                        if (p == null) {
175
                            lastFoundKey = new WeakReference<FileObject>(f);
175
                            // Now-deleted project, remove from list.
176
                            lastFoundValue = new WeakReference<Project>(p);
176
                            deserializedExternalOwners.remove(key);
177
                        } else {
178
                            synchronized (this) {
179
                                lastFoundKey = new WeakReference<FileObject>(f);
180
                                lastFoundValue = new WeakReference<Project>(p);
181
                            }
182
                            return p;
177
                        }
183
                        }
178
                        return p;
179
                    } catch (IOException e) {
184
                    } catch (IOException e) {
180
                        // There is a project there, but we cannot load it...
185
                        // There is a project there, but we cannot load it...
181
                        LOG.log(Level.FINE, "Cannot load project.", e); //NOI18N
186
                        LOG.log(Level.FINE, "Cannot load project.", e); //NOI18N

Return to bug 177156