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 225063
Collapse All | Expand All

(-)a/projectapi/src/org/netbeans/modules/projectapi/SimpleFileOwnerQueryImplementation.java (-14 / +30 lines)
Lines 51-58 Link Here
51
import java.net.URI;
51
import java.net.URI;
52
import java.net.URISyntaxException;
52
import java.net.URISyntaxException;
53
import java.net.URL;
53
import java.net.URL;
54
import java.util.Arrays;
54
import java.util.Collections;
55
import java.util.Collections;
55
import java.util.HashMap;
56
import java.util.HashMap;
57
import java.util.HashSet;
56
import java.util.Map;
58
import java.util.Map;
57
import java.util.Set;
59
import java.util.Set;
58
import java.util.logging.Level;
60
import java.util.logging.Level;
Lines 77-82 Link Here
77
public class SimpleFileOwnerQueryImplementation implements FileOwnerQueryImplementation {
79
public class SimpleFileOwnerQueryImplementation implements FileOwnerQueryImplementation {
78
    private static final Logger LOG = Logger.getLogger(SimpleFileOwnerQueryImplementation.class.getName());
80
    private static final Logger LOG = Logger.getLogger(SimpleFileOwnerQueryImplementation.class.getName());
79
    private static final URI UNOWNED_URI = URI.create("http:unowned");
81
    private static final URI UNOWNED_URI = URI.create("http:unowned");
82
    private static final Set<String> forbiddenFolders;
83
    static {
84
        Set<String> files = new HashSet<String>();
85
        try {
86
            String forbidden = System.getProperty("project.forbiddenFolders", System.getProperty("versioning.forbiddenFolders", "")); //NOI18N
87
            files.addAll(Arrays.asList(forbidden.split("\\;"))); //NOI18N
88
            files.remove(""); //NOI18N
89
        } catch (Exception e) {
90
            LOG.log(Level.INFO, e.getMessage(), e);
91
        }
92
        forbiddenFolders = files;
93
    }
80
    
94
    
81
    /** Do nothing */
95
    /** Do nothing */
82
    public SimpleFileOwnerQueryImplementation() {}
96
    public SimpleFileOwnerQueryImplementation() {}
Lines 124-145 Link Here
124
            }
138
            }
125
            boolean folder = f.isFolder();
139
            boolean folder = f.isFolder();
126
            if (folder) {
140
            if (folder) {
127
                Project p;
141
                if (!forbiddenFolders.contains(f.getPath())) {
128
                try {
142
                    Project p;
129
                    p = ProjectManager.getDefault().findProject(f);
143
                    try {
130
                } catch (IOException e) {
144
                        p = ProjectManager.getDefault().findProject(f);
131
                    // There is a project here, but we cannot load it...
145
                    } catch (IOException e) {
132
                    if (warnedAboutBrokenProjects.add(f)) { // #60416
146
                        // There is a project here, but we cannot load it...
133
                        LOG.log(Level.FINE, "Cannot load project.", e); //NOI18N
147
                        if (warnedAboutBrokenProjects.add(f)) { // #60416
148
                            LOG.log(Level.FINE, "Cannot load project.", e); //NOI18N
149
                        }
150
                        return null;
134
                    }
151
                    }
135
                    return null;
152
                    if (p != null) {
136
                }
153
                        synchronized (this) {
137
                if (p != null) {
154
                            lastFoundKey = new WeakReference<FileObject>(f);
138
                    synchronized (this) {
155
                            lastFoundValue = new WeakReference<Project>(p);
139
                        lastFoundKey = new WeakReference<FileObject>(f);
156
                        }
140
                        lastFoundValue = new WeakReference<Project>(p);
157
                        return p;
141
                    }
158
                    }
142
                    return p;
143
                }
159
                }
144
            }
160
            }
145
            
161
            

Return to bug 225063