View | Details | Raw Unified | Return to bug 207294 | Differences between
and this patch

Collapse All | Expand All

(-)a/ant.debugger/src/org/netbeans/modules/ant/debugger/Utils.java (-5 lines)
 Lines 65-71    Link Here 
65
import org.openide.cookies.EditorCookie;
65
import org.openide.cookies.EditorCookie;
66
import org.openide.cookies.LineCookie;
66
import org.openide.cookies.LineCookie;
67
import org.openide.filesystems.FileObject;
67
import org.openide.filesystems.FileObject;
68
import org.openide.filesystems.FileStateInvalidException;
69
import org.openide.filesystems.FileUtil;
68
import org.openide.filesystems.FileUtil;
70
import org.openide.loaders.DataObject;
69
import org.openide.loaders.DataObject;
71
import org.openide.loaders.DataObjectNotFoundException;
70
import org.openide.loaders.DataObjectNotFoundException;
 Lines 405-415    Link Here 
405
        }
404
        }
406
        InputSource in = new InputSource (new StringReader (w.toString ()));
405
        InputSource in = new InputSource (new StringReader (w.toString ()));
407
        if (fo != null) { // #10348
406
        if (fo != null) { // #10348
408
            try {
409
                in.setSystemId (fo.getURL ().toExternalForm ());
407
                in.setSystemId (fo.getURL ().toExternalForm ());
410
            } catch (FileStateInvalidException e) {
411
                assert false : e;
412
            }
413
            // [PENDING] Ant's ProjectHelper has an elaborate set of work-
408
            // [PENDING] Ant's ProjectHelper has an elaborate set of work-
414
            // arounds for inconsistent parser behavior, e.g. file:foo.xml
409
            // arounds for inconsistent parser behavior, e.g. file:foo.xml
415
            // works in Ant but not with Xerces parser. You must use just foo.xml
410
            // works in Ant but not with Xerces parser. You must use just foo.xml
(-)a/ant.debugger/src/org/netbeans/modules/ant/debugger/breakpoints/BreakpointsReader.java (-6 lines)
 Lines 49-59    Link Here 
49
import java.net.MalformedURLException;
49
import java.net.MalformedURLException;
50
import java.net.URL;
50
import java.net.URL;
51
import org.netbeans.api.debugger.Breakpoint;
51
import org.netbeans.api.debugger.Breakpoint;
52
import org.netbeans.api.debugger.DebuggerManager;
53
import org.netbeans.api.debugger.Properties;
52
import org.netbeans.api.debugger.Properties;
54
import org.openide.cookies.LineCookie;
53
import org.openide.cookies.LineCookie;
55
import org.openide.filesystems.FileObject;
54
import org.openide.filesystems.FileObject;
56
import org.openide.filesystems.FileStateInvalidException;
57
import org.openide.filesystems.URLMapper;
55
import org.openide.filesystems.URLMapper;
58
import org.openide.loaders.DataObject;
56
import org.openide.loaders.DataObject;
59
import org.openide.loaders.DataObjectNotFoundException;
57
import org.openide.loaders.DataObjectNotFoundException;
 Lines 105-111    Link Here 
105
        AntBreakpoint b = (AntBreakpoint) object;
103
        AntBreakpoint b = (AntBreakpoint) object;
106
        FileObject fo = (FileObject) b.getLine ().getLookup ().
104
        FileObject fo = (FileObject) b.getLine ().getLookup ().
107
            lookup (FileObject.class);
105
            lookup (FileObject.class);
108
        try {
109
            properties.setString ("url", fo.getURL ().toString ());
106
            properties.setString ("url", fo.getURL ().toString ());
110
            properties.setInt (
107
            properties.setInt (
111
                "lineNumber", 
108
                "lineNumber", 
 Lines 119-127    Link Here 
119
            properties.setInt(Breakpoint.PROP_HIT_COUNT_FILTER, b.getHitCountFilter());
116
            properties.setInt(Breakpoint.PROP_HIT_COUNT_FILTER, b.getHitCountFilter());
120
            Breakpoint.HIT_COUNT_FILTERING_STYLE style = b.getHitCountFilteringStyle();
117
            Breakpoint.HIT_COUNT_FILTERING_STYLE style = b.getHitCountFilteringStyle();
121
            properties.setInt(Breakpoint.PROP_HIT_COUNT_FILTER+"_style", style != null ? style.ordinal() : 0); // NOI18N
118
            properties.setInt(Breakpoint.PROP_HIT_COUNT_FILTER+"_style", style != null ? style.ordinal() : 0); // NOI18N
122
        } catch (FileStateInvalidException ex) {
123
            ex.printStackTrace ();
124
        }
125
    }
119
    }
126
    
120
    
127
121
(-)a/api.debugger.jpda/src/org/netbeans/api/debugger/jpda/LineBreakpoint.java (-11 lines)
 Lines 49-57    Link Here 
49
import java.io.IOException;
49
import java.io.IOException;
50
import java.net.MalformedURLException;
50
import java.net.MalformedURLException;
51
import java.net.URL;
51
import java.net.URL;
52
import java.util.ArrayList;
53
import java.util.Collection;
52
import java.util.Collection;
54
import java.util.List;
55
import java.util.Map;
53
import java.util.Map;
56
import java.util.WeakHashMap;
54
import java.util.WeakHashMap;
57
import javax.swing.event.ChangeEvent;
55
import javax.swing.event.ChangeEvent;
 Lines 67-73    Link Here 
67
import org.openide.filesystems.FileEvent;
65
import org.openide.filesystems.FileEvent;
68
import org.openide.filesystems.FileObject;
66
import org.openide.filesystems.FileObject;
69
import org.openide.filesystems.FileRenameEvent;
67
import org.openide.filesystems.FileRenameEvent;
70
import org.openide.filesystems.FileStateInvalidException;
71
import org.openide.filesystems.URLMapper;
68
import org.openide.filesystems.URLMapper;
72
import org.openide.loaders.DataObject;
69
import org.openide.loaders.DataObject;
73
import org.openide.util.NbBundle;
70
import org.openide.util.NbBundle;
 Lines 518-528    Link Here 
518
        }
515
        }
519
516
520
        public void fileRenamed(FileRenameEvent fe) {
517
        public void fileRenamed(FileRenameEvent fe) {
521
            try {
522
                this.setURL(((FileObject) fe.getSource()).getURL().toString());
518
                this.setURL(((FileObject) fe.getSource()).getURL().toString());
523
            } catch (FileStateInvalidException ex) {
524
                ErrorManager.getDefault().notify(ex);
525
            }
526
        }
519
        }
527
520
528
        public void fileAttributeChanged(FileAttributeEvent fe) {
521
        public void fileAttributeChanged(FileAttributeEvent fe) {
 Lines 562-572    Link Here 
562
                FileObject newFO = ((DataObject) evt.getSource()).getPrimaryFile();
555
                FileObject newFO = ((DataObject) evt.getSource()).getPrimaryFile();
563
                fileListener = WeakListeners.create(FileChangeListener.class, this, newFO);
556
                fileListener = WeakListeners.create(FileChangeListener.class, this, newFO);
564
                newFO.addFileChangeListener(fileListener);
557
                newFO.addFileChangeListener(fileListener);
565
                try {
566
                    this.setURL(newFO.getURL().toString());
558
                    this.setURL(newFO.getURL().toString());
567
                } catch (FileStateInvalidException ex) {
568
                    ErrorManager.getDefault().notify(ex);
569
                }
570
                fo = newFO;
559
                fo = newFO;
571
                DebuggerManager.getDebuggerManager().addBreakpoint(this);
560
                DebuggerManager.getDebuggerManager().addBreakpoint(this);
572
                firePropertyChange(PROP_GROUP_PROPERTIES, null, null);
561
                firePropertyChange(PROP_GROUP_PROPERTIES, null, null);
(-)a/api.java.classpath/nbproject/project.xml (-1 / +1 lines)
 Lines 19-25    Link Here 
19
                    <build-prerequisite/>
19
                    <build-prerequisite/>
20
                    <compile-dependency/>
20
                    <compile-dependency/>
21
                    <run-dependency>
21
                    <run-dependency>
22
                        <specification-version>1.12</specification-version>
22
                        <specification-version>1.26</specification-version>
23
                    </run-dependency>
23
                    </run-dependency>
24
                </dependency>
24
                </dependency>
25
                <dependency>
25
                <dependency>
(-)a/api.java.classpath/src/org/netbeans/api/java/classpath/ClassLoaderSupport.java (-7 / +2 lines)
 Lines 68-79    Link Here 
68
    }
68
    }
69
    
69
    
70
    static ClassLoader create (final ClassPath cp, final ClassLoader parentClassLoader) {
70
    static ClassLoader create (final ClassPath cp, final ClassLoader parentClassLoader) {
71
        try {
71
        return new ClassLoaderSupport(cp, parentClassLoader);
72
            return new ClassLoaderSupport(cp, parentClassLoader);
73
        } catch (FileStateInvalidException e) {
74
            // Should not happen, we already trimmed unused roots:
75
            throw new AssertionError(e);
76
        }
77
    }
72
    }
78
73
79
    /** change listener */
74
    /** change listener */
 Lines 97-103    Link Here 
97
    /** Constructor that attaches itself to the filesystem pool.
92
    /** Constructor that attaches itself to the filesystem pool.
98
    */
93
    */
99
    @SuppressWarnings("LeakingThisInConstructor")
94
    @SuppressWarnings("LeakingThisInConstructor")
100
    private ClassLoaderSupport (final ClassPath cp, final ClassLoader parentClassLoader) throws FileStateInvalidException {
95
    private ClassLoaderSupport (final ClassPath cp, final ClassLoader parentClassLoader) {
101
        super(cp.getRoots(), parentClassLoader, null);
96
        super(cp.getRoots(), parentClassLoader, null);
102
        this.classPath = cp;
97
        this.classPath = cp;
103
98
(-)a/api.java.classpath/src/org/netbeans/api/java/classpath/ClassPath.java (-10 / +1 lines)
 Lines 83-89    Link Here 
83
import org.openide.filesystems.FileEvent;
83
import org.openide.filesystems.FileEvent;
84
import org.openide.filesystems.FileObject;
84
import org.openide.filesystems.FileObject;
85
import org.openide.filesystems.FileRenameEvent;
85
import org.openide.filesystems.FileRenameEvent;
86
import org.openide.filesystems.FileStateInvalidException;
87
import org.openide.filesystems.FileUtil;
86
import org.openide.filesystems.FileUtil;
88
import org.openide.filesystems.URLMapper;
87
import org.openide.filesystems.URLMapper;
89
import org.openide.util.Lookup;
88
import org.openide.util.Lookup;
 Lines 559-569    Link Here 
559
        if (f.isFolder()) {
558
        if (f.isFolder()) {
560
            path += "/"; // NOI18N
559
            path += "/"; // NOI18N
561
        }
560
        }
562
        try {
561
        return filter.includes(root.getURL(), path);
563
            return filter.includes(root.getURL(), path);
564
        } catch (FileStateInvalidException x) {
565
            throw new AssertionError(x);
566
        }
567
    }
562
    }
568
563
569
    /**
564
    /**
 Lines 1047-1053    Link Here 
1047
            f = findPath(roots[ridx], nameComponents);
1042
            f = findPath(roots[ridx], nameComponents);
1048
            FilteringPathResourceImplementation filter = root2Filter.get(roots[ridx]);
1043
            FilteringPathResourceImplementation filter = root2Filter.get(roots[ridx]);
1049
            if (filter != null) {
1044
            if (filter != null) {
1050
                try {
1051
                    if (f != null) {
1045
                    if (f != null) {
1052
                        String path = FileUtil.getRelativePath(roots[ridx], f);
1046
                        String path = FileUtil.getRelativePath(roots[ridx], f);
1053
                        assert path != null : String.format("FileUtil.getRelativePath(%s(%b),%s(%b)) returned null",
1047
                        assert path != null : String.format("FileUtil.getRelativePath(%s(%b),%s(%b)) returned null",
 Lines 1062-1070    Link Here 
1062
                            f = null;
1056
                            f = null;
1063
                        }
1057
                        }
1064
                    }
1058
                    }
1065
                } catch (FileStateInvalidException x) {
1066
                    throw new AssertionError(x);
1067
                }
1068
            }
1059
            }
1069
        }
1060
        }
1070
        rootIndex[0] = ridx;
1061
        rootIndex[0] = ridx;
(-)a/api.java.classpath/src/org/netbeans/api/java/queries/BinaryForSourceQuery.java (-6 lines)
 Lines 50-59    Link Here 
50
import org.netbeans.api.java.classpath.ClassPath;
50
import org.netbeans.api.java.classpath.ClassPath;
51
import org.netbeans.spi.java.queries.BinaryForSourceQueryImplementation;
51
import org.netbeans.spi.java.queries.BinaryForSourceQueryImplementation;
52
import org.openide.filesystems.FileObject;
52
import org.openide.filesystems.FileObject;
53
import org.openide.filesystems.FileStateInvalidException;
54
import org.openide.filesystems.FileUtil;
53
import org.openide.filesystems.FileUtil;
55
import org.openide.filesystems.URLMapper;
54
import org.openide.filesystems.URLMapper;
56
import org.openide.util.Exceptions;
57
import org.openide.util.Lookup;
55
import org.openide.util.Lookup;
58
56
59
/**
57
/**
 Lines 138-150    Link Here 
138
            for (ClassPath.Entry e : exec.entries()) {
136
            for (ClassPath.Entry e : exec.entries()) {
139
                FileObject[] roots = SourceForBinaryQuery.findSourceRoots(e.getURL()).getRoots();
137
                FileObject[] roots = SourceForBinaryQuery.findSourceRoots(e.getURL()).getRoots();
140
                for (FileObject root : roots) {
138
                for (FileObject root : roots) {
141
                    try {
142
                        if (sourceRoot.equals (root.getURL())) {
139
                        if (sourceRoot.equals (root.getURL())) {
143
                            result.add (e.getURL());
140
                            result.add (e.getURL());
144
                        }
141
                        }
145
                    } catch (FileStateInvalidException fsie) {
146
                        Exceptions.printStackTrace(fsie);
147
                    }
148
                }
142
                }
149
            }
143
            }
150
            return result.toArray(new URL[result.size()]);
144
            return result.toArray(new URL[result.size()]);
(-)a/api.java.classpath/src/org/netbeans/spi/java/classpath/support/ClassPathSupport.java (-6 lines)
 Lines 54-62    Link Here 
54
import java.net.URL;
54
import java.net.URL;
55
import java.util.List;
55
import java.util.List;
56
import java.util.ArrayList;
56
import java.util.ArrayList;
57
import org.openide.filesystems.FileStateInvalidException;
58
import org.openide.filesystems.FileUtil;
57
import org.openide.filesystems.FileUtil;
59
import org.openide.util.Exceptions;
60
58
61
/**
59
/**
62
 * Convenience factory for creating classpaths of common sorts.
60
 * Convenience factory for creating classpaths of common sorts.
 Lines 124-135    Link Here 
124
            if (root == null || !root.isValid()) {
122
            if (root == null || !root.isValid()) {
125
                continue;
123
                continue;
126
            }
124
            }
127
            try {
128
                URL u = root.getURL();            
125
                URL u = root.getURL();            
129
                l.add(createResource(u));
126
                l.add(createResource(u));
130
            } catch (FileStateInvalidException e) {
131
                Exceptions.printStackTrace (e);
132
            }
133
        }
127
        }
134
        return createClassPath (l);
128
        return createClassPath (l);
135
    }
129
    }
(-)a/api.java.classpath/test/unit/src/org/netbeans/api/java/classpath/GlobalPathRegistryTest.java (-4 lines)
 Lines 222-232    Link Here 
222
        FileObject src2excluded1 = FileUtil.createData(src2, "excluded/file1");
222
        FileObject src2excluded1 = FileUtil.createData(src2, "excluded/file1");
223
        class PRI extends PathResourceBase implements FilteringPathResourceImplementation {
223
        class PRI extends PathResourceBase implements FilteringPathResourceImplementation {
224
            public URL[] getRoots() {
224
            public URL[] getRoots() {
225
                try {
226
                    return new URL[] {src1.getURL()};
225
                    return new URL[] {src1.getURL()};
227
                } catch (FileStateInvalidException x) {
228
                    throw new AssertionError(x);
229
                }
230
            }
226
            }
231
            public boolean includes(URL root, String resource) {
227
            public boolean includes(URL root, String resource) {
232
                return resource.startsWith("incl");
228
                return resource.startsWith("incl");
(-)a/api.xml/nbproject/project.xml (-18 / +18 lines)
 Lines 50-66    Link Here 
50
            <code-name-base>org.netbeans.api.xml</code-name-base>
50
            <code-name-base>org.netbeans.api.xml</code-name-base>
51
            <module-dependencies>
51
            <module-dependencies>
52
                <dependency>
52
                <dependency>
53
                    <code-name-base>org.openide.filesystems</code-name-base>
54
                    <build-prerequisite/>
55
                    <compile-dependency/>
56
                    <run-dependency>
57
                        <specification-version>7.57</specification-version>
58
                    </run-dependency>
59
                </dependency>
60
                <dependency>
53
                    <code-name-base>org.openide.loaders</code-name-base>
61
                    <code-name-base>org.openide.loaders</code-name-base>
54
                    <build-prerequisite/>
62
                    <build-prerequisite/>
55
                    <compile-dependency/>
63
                    <compile-dependency/>
56
                    <run-dependency/>
64
                    <run-dependency/>
57
                </dependency>
65
                </dependency>
58
                <dependency>
66
                <dependency>
59
                    <code-name-base>org.openide.filesystems</code-name-base>
67
                    <code-name-base>org.openide.nodes</code-name-base>
60
                    <build-prerequisite/>
68
                    <build-prerequisite/>
61
                    <compile-dependency/>
69
                    <compile-dependency/>
62
                    <run-dependency>
70
                    <run-dependency>
63
                        <specification-version>6.2</specification-version>
71
                        <specification-version>7.23</specification-version>
72
                    </run-dependency>
73
                </dependency>
74
                <dependency>
75
                    <code-name-base>org.openide.text</code-name-base>
76
                    <build-prerequisite/>
77
                    <compile-dependency/>
78
                    <run-dependency>
79
                        <specification-version>6.16</specification-version>
64
                    </run-dependency>
80
                    </run-dependency>
65
                </dependency>
81
                </dependency>
66
                <dependency>
82
                <dependency>
 Lines 79-100    Link Here 
79
                        <specification-version>8.0</specification-version>
95
                        <specification-version>8.0</specification-version>
80
                    </run-dependency>
96
                    </run-dependency>
81
                </dependency>
97
                </dependency>
82
                <dependency>
83
                    <code-name-base>org.openide.nodes</code-name-base>
84
                    <build-prerequisite/>
85
                    <compile-dependency/>
86
                    <run-dependency>
87
                        <specification-version>7.23</specification-version>
88
                    </run-dependency>
89
                </dependency>
90
                <dependency>
91
                    <code-name-base>org.openide.text</code-name-base>
92
                    <build-prerequisite/>
93
                    <compile-dependency/>
94
                    <run-dependency>
95
                        <specification-version>6.16</specification-version>
96
                    </run-dependency>
97
                </dependency>
98
            </module-dependencies>
98
            </module-dependencies>
99
            <test-dependencies>
99
            <test-dependencies>
100
                <test-type>
100
                <test-type>
(-)a/api.xml/src/org/netbeans/api/xml/parsers/DocumentInputSource.java (-6 lines)
 Lines 46-52    Link Here 
46
46
47
import java.io.*;
47
import java.io.*;
48
import java.net.URL;
48
import java.net.URL;
49
import java.util.*;
50
49
51
import javax.swing.text.Document;
50
import javax.swing.text.Document;
52
51
 Lines 112-126    Link Here 
112
        if (system == null) {
111
        if (system == null) {
113
            Object obj = doc.getProperty(Document.StreamDescriptionProperty);        
112
            Object obj = doc.getProperty(Document.StreamDescriptionProperty);        
114
            if (obj instanceof DataObject) {
113
            if (obj instanceof DataObject) {
115
                try { 
116
                        DataObject dobj = (DataObject) obj;
114
                        DataObject dobj = (DataObject) obj;
117
                        FileObject fo = dobj.getPrimaryFile();
115
                        FileObject fo = dobj.getPrimaryFile();
118
                        URL url = fo.getURL();
116
                        URL url = fo.getURL();
119
                        system = url.toExternalForm();
117
                        system = url.toExternalForm();
120
                } catch (IOException io) {
121
                    ErrorManager emgr = (ErrorManager) Lookup.getDefault().lookup(ErrorManager.class);
122
                    emgr.notify(io);
123
                }
124
            } else {
118
            } else {
125
                ErrorManager emgr = (ErrorManager) Lookup.getDefault().lookup(ErrorManager.class);
119
                ErrorManager emgr = (ErrorManager) Lookup.getDefault().lookup(ErrorManager.class);
126
                emgr.log("XML:DocumentInputSource:Unknown stream description:" + obj);
120
                emgr.log("XML:DocumentInputSource:Unknown stream description:" + obj);
(-)a/api.xml/src/org/netbeans/spi/xml/cookies/DataObjectAdapters.java (-23 / +1 lines)
 Lines 45-53    Link Here 
45
package org.netbeans.spi.xml.cookies;
45
package org.netbeans.spi.xml.cookies;
46
46
47
import java.io.Reader;
47
import java.io.Reader;
48
import java.net.URI;
49
import java.net.URISyntaxException;
50
import java.net.URL;
51
import javax.swing.text.Document;
48
import javax.swing.text.Document;
52
import javax.xml.parsers.ParserConfigurationException;
49
import javax.xml.parsers.ParserConfigurationException;
53
import javax.xml.parsers.SAXParser;
50
import javax.xml.parsers.SAXParser;
 Lines 57-64    Link Here 
57
import org.netbeans.api.xml.parsers.DocumentInputSource;
54
import org.netbeans.api.xml.parsers.DocumentInputSource;
58
import org.netbeans.api.xml.services.UserCatalog;
55
import org.netbeans.api.xml.services.UserCatalog;
59
import org.openide.cookies.EditorCookie;
56
import org.openide.cookies.EditorCookie;
60
import org.openide.filesystems.FileObject;
61
import org.openide.filesystems.FileStateInvalidException;
62
import org.openide.loaders.DataObject;
57
import org.openide.loaders.DataObject;
63
import org.xml.sax.EntityResolver;
58
import org.xml.sax.EntityResolver;
64
import org.xml.sax.InputSource;
59
import org.xml.sax.InputSource;
 Lines 179-202    Link Here 
179
     * @return system Id of <code>dataObject</code>
174
     * @return system Id of <code>dataObject</code>
180
     */
175
     */
181
    private static String getSystemId (DataObject dataObject) {
176
    private static String getSystemId (DataObject dataObject) {
182
        String systemId = null;
177
        return dataObject.getPrimaryFile().toURI().toASCIIString();
183
        try {
184
            FileObject fileObject = dataObject.getPrimaryFile();
185
            URL url = fileObject.getURL();
186
            try {
187
                systemId = new URI(url.toString()).toASCIIString();
188
            } catch (URISyntaxException ex) {
189
                // if cannot be converted to URI, return at least external form
190
                // instead of returning null
191
                systemId = url.toExternalForm();
192
                Util.THIS.debug(ex);
193
            }
194
        } catch (FileStateInvalidException exc) {
195
            if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug (exc);
196
197
            // nothing to do -> return null; //???
198
        }
199
        return systemId;
200
    }
178
    }
201
179
202
    private static synchronized SAXParserFactory getSAXParserFactory () throws ParserConfigurationException, SAXNotRecognizedException, SAXNotSupportedException {
180
    private static synchronized SAXParserFactory getSAXParserFactory () throws ParserConfigurationException, SAXNotRecognizedException, SAXNotSupportedException {
(-)a/apisupport.ant/src/org/netbeans/modules/apisupport/project/queries/ClassPathProviderImpl.java (-33 / +8 lines)
 Lines 72-80    Link Here 
72
import org.netbeans.spi.project.support.ant.AntProjectEvent;
72
import org.netbeans.spi.project.support.ant.AntProjectEvent;
73
import org.netbeans.spi.project.support.ant.AntProjectListener;
73
import org.netbeans.spi.project.support.ant.AntProjectListener;
74
import org.netbeans.spi.project.support.ant.PropertyUtils;
74
import org.netbeans.spi.project.support.ant.PropertyUtils;
75
import org.openide.ErrorManager;
76
import org.openide.filesystems.FileObject;
75
import org.openide.filesystems.FileObject;
77
import org.openide.filesystems.FileStateInvalidException;
78
import org.openide.filesystems.FileUtil;
76
import org.openide.filesystems.FileUtil;
79
import org.openide.util.WeakListeners;
77
import org.openide.util.WeakListeners;
80
import org.openide.xml.XMLUtil;
78
import org.openide.xml.XMLUtil;
 Lines 128-140    Link Here 
128
        URL generatedClasses = FileUtil.urlForArchiveOrDir(project.getGeneratedClassesDirectory());
126
        URL generatedClasses = FileUtil.urlForArchiveOrDir(project.getGeneratedClassesDirectory());
129
        URL generatedUnitTestClasses = FileUtil.urlForArchiveOrDir(project.getTestGeneratedClassesDirectory("unit"));
127
        URL generatedUnitTestClasses = FileUtil.urlForArchiveOrDir(project.getTestGeneratedClassesDirectory("unit"));
130
        URL generatedFunctionalTestClasses = FileUtil.urlForArchiveOrDir(project.getTestGeneratedClassesDirectory("qa-functional"));
128
        URL generatedFunctionalTestClasses = FileUtil.urlForArchiveOrDir(project.getTestGeneratedClassesDirectory("qa-functional"));
131
        String fileU;
129
        String fileU = file.getURL().toString();
132
        try {
133
            fileU = file.getURL().toString();
134
        } catch (FileStateInvalidException x) {
135
            LOG.log(Level.INFO, null, x);
136
            return null;
137
        }
138
        if (srcDir != null &&
130
        if (srcDir != null &&
139
                (FileUtil.isParentOf(srcDir, file) || file == srcDir || fileU.startsWith(generatedClasses.toString()))) {
131
                (FileUtil.isParentOf(srcDir, file) || file == srcDir || fileU.startsWith(generatedClasses.toString()))) {
140
            // Regular sources.
132
            // Regular sources.
 Lines 151-161    Link Here 
151
                return execute;
143
                return execute;
152
            } else if (type.equals(ClassPath.SOURCE)) {
144
            } else if (type.equals(ClassPath.SOURCE)) {
153
                if (source == null) {
145
                if (source == null) {
154
                    try {
146
                    source = ClassPathSupport.createClassPath(srcDir.getURL(), generatedClasses);
155
                        source = ClassPathSupport.createClassPath(srcDir.getURL(), generatedClasses);
156
                    } catch (FileStateInvalidException x) {
157
                        LOG.log(Level.INFO, null, x);
158
                    }
159
                }
147
                }
160
                return source;
148
                return source;
161
            }
149
            }
 Lines 177-187    Link Here 
177
                return testExecute;
165
                return testExecute;
178
            } else if (type.equals(ClassPath.SOURCE)) {
166
            } else if (type.equals(ClassPath.SOURCE)) {
179
                if (testSource == null) {
167
                if (testSource == null) {
180
                    try {
168
                    testSource = ClassPathSupport.createClassPath(testSrcDir.getURL(), generatedUnitTestClasses);
181
                        testSource = ClassPathSupport.createClassPath(testSrcDir.getURL(), generatedUnitTestClasses);
182
                    } catch (FileStateInvalidException x) {
183
                        LOG.log(Level.INFO, null, x);
184
                    }
185
                }
169
                }
186
                return testSource;
170
                return testSource;
187
            }
171
            }
 Lines 190-200    Link Here 
190
            // Functional tests.
174
            // Functional tests.
191
            if (type.equals(ClassPath.SOURCE)) {
175
            if (type.equals(ClassPath.SOURCE)) {
192
                if (funcTestSource == null) {
176
                if (funcTestSource == null) {
193
                    try {
177
                    funcTestSource = ClassPathSupport.createClassPath(funcTestSrcDir.getURL(), generatedFunctionalTestClasses);
194
                        funcTestSource = ClassPathSupport.createClassPath(funcTestSrcDir.getURL(), generatedFunctionalTestClasses);
195
                    } catch (FileStateInvalidException x) {
196
                        LOG.log(Level.INFO, null, x);
197
                    }
198
                }
178
                }
199
                return funcTestSource;
179
                return funcTestSource;
200
            } else if (type.equals(ClassPath.COMPILE)) {
180
            } else if (type.equals(ClassPath.COMPILE)) {
 Lines 212-226    Link Here 
212
            }
192
            }
213
        } else if (classesDir != null && (classesDir.equals(file) || FileUtil.isParentOf(classesDir,file))) {
193
        } else if (classesDir != null && (classesDir.equals(file) || FileUtil.isParentOf(classesDir,file))) {
214
            if (ClassPath.EXECUTE.equals(type)) {
194
            if (ClassPath.EXECUTE.equals(type)) {
215
                try {
195
                List<PathResourceImplementation> roots = new ArrayList<PathResourceImplementation>();
216
                    List<PathResourceImplementation> roots = new ArrayList<PathResourceImplementation>();
196
                roots.add ( ClassPathSupport.createResource(classesDir.getURL()));
217
                    roots.add ( ClassPathSupport.createResource(classesDir.getURL()));
197
                roots.addAll(createCompileClasspath().getResources());
218
                    roots.addAll(createCompileClasspath().getResources());
198
                return ClassPathSupport.createClassPath (roots);
219
                    return ClassPathSupport.createClassPath (roots);
220
                } catch (FileStateInvalidException e) {
221
                    ErrorManager.getDefault().notify (e);
222
                    return null;
223
                }
224
            }
199
            }
225
        } else if (testClassesDir != null && (testClassesDir.equals(file) || FileUtil.isParentOf(testClassesDir,file))) {
200
        } else if (testClassesDir != null && (testClassesDir.equals(file) || FileUtil.isParentOf(testClassesDir,file))) {
226
            if (ClassPath.EXECUTE.equals(type)) {
201
            if (ClassPath.EXECUTE.equals(type)) {
(-)a/apisupport.ant/src/org/netbeans/modules/apisupport/project/ui/ActionFilterNode.java (-13 / +3 lines)
 Lines 50-62    Link Here 
50
import java.util.logging.Level;
50
import java.util.logging.Level;
51
import java.util.logging.Logger;
51
import java.util.logging.Logger;
52
import javax.swing.Action;
52
import javax.swing.Action;
53
import org.openide.ErrorManager;
54
import org.openide.actions.EditAction;
53
import org.openide.actions.EditAction;
55
import org.openide.actions.FindAction;
54
import org.openide.actions.FindAction;
56
import org.openide.loaders.DataObject;
55
import org.openide.loaders.DataObject;
57
import org.openide.actions.OpenAction;
56
import org.openide.actions.OpenAction;
58
import org.openide.filesystems.FileObject;
57
import org.openide.filesystems.FileObject;
59
import org.openide.filesystems.FileStateInvalidException;
60
import org.openide.filesystems.FileUtil;
58
import org.openide.filesystems.FileUtil;
61
import org.openide.nodes.FilterNode;
59
import org.openide.nodes.FilterNode;
62
import org.openide.nodes.Node;
60
import org.openide.nodes.Node;
 Lines 204-220    Link Here 
204
        }
202
        }
205
        
203
        
206
        public boolean hasJavadoc() {
204
        public boolean hasJavadoc() {
207
            try {
205
            boolean rNotNull = resource != null;
208
                boolean rNotNull = resource != null;
206
            int jLength = JavadocForBinaryQuery.findJavadoc(cpRoot.getURL()).getRoots().length;
209
                int jLength = JavadocForBinaryQuery.findJavadoc(cpRoot.getURL()).getRoots().length;
207
            return  rNotNull && jLength > 0;
210
                return  rNotNull && jLength > 0;
211
            } catch (FileStateInvalidException fsi) {
212
                return false;
213
            }
214
        }
208
        }
215
        
209
        
216
        public void showJavadoc() {
210
        public void showJavadoc() {
217
            try {
218
                String relativeName = FileUtil.getRelativePath(cpRoot, resource);
211
                String relativeName = FileUtil.getRelativePath(cpRoot, resource);
219
                URL[] urls = JavadocForBinaryQuery.findJavadoc(cpRoot.getURL()).getRoots();
212
                URL[] urls = JavadocForBinaryQuery.findJavadoc(cpRoot.getURL()).getRoots();
220
                URL pageURL;
213
                URL pageURL;
 Lines 231-239    Link Here 
231
                    pageURL = ShowJavadocAction.findJavadoc(javadocFileName, urls);
224
                    pageURL = ShowJavadocAction.findJavadoc(javadocFileName, urls);
232
                }
225
                }
233
                ShowJavadocAction.showJavaDoc(pageURL,relativeName.replace('/','.'));  //NOI18N
226
                ShowJavadocAction.showJavaDoc(pageURL,relativeName.replace('/','.'));  //NOI18N
234
            } catch (FileStateInvalidException fsi) {
235
                ErrorManager.getDefault().notify(fsi);
236
            }
237
        }
227
        }
238
        
228
        
239
    }
229
    }
(-)a/apisupport.ant/src/org/netbeans/modules/apisupport/project/ui/LibrariesSourceGroup.java (-8 / +1 lines)
 Lines 47-55    Link Here 
47
import java.beans.PropertyChangeListener;
47
import java.beans.PropertyChangeListener;
48
import javax.swing.Icon;
48
import javax.swing.Icon;
49
import org.netbeans.api.project.SourceGroup;
49
import org.netbeans.api.project.SourceGroup;
50
import org.openide.ErrorManager;
51
import org.openide.filesystems.FileObject;
50
import org.openide.filesystems.FileObject;
52
import org.openide.filesystems.FileStateInvalidException;
53
import org.openide.filesystems.FileUtil;
51
import org.openide.filesystems.FileUtil;
54
52
55
// XXX this class is more or less copy-pasted from j2seproject.
53
// XXX this class is more or less copy-pasted from j2seproject.
 Lines 88-99    Link Here 
88
    }
86
    }
89
    
87
    
90
    public String getName() {
88
    public String getName() {
91
        try {
89
        return root.getURL().toExternalForm();
92
            return root.getURL().toExternalForm();
93
        } catch (FileStateInvalidException fsi) {
94
            ErrorManager.getDefault().notify(fsi);
95
            return root.toString();
96
        }
97
    }
90
    }
98
    
91
    
99
    public String getDisplayName() {
92
    public String getDisplayName() {
(-)a/apisupport.ant/src/org/netbeans/modules/apisupport/project/ui/PlatformNode.java (-7 lines)
 Lines 58-70    Link Here 
58
import java.util.Set;
58
import java.util.Set;
59
import javax.swing.Action;
59
import javax.swing.Action;
60
import javax.swing.Icon;
60
import javax.swing.Icon;
61
import javax.swing.ImageIcon;
62
import javax.swing.event.ChangeEvent;
61
import javax.swing.event.ChangeEvent;
63
import javax.swing.event.ChangeListener;
62
import javax.swing.event.ChangeListener;
64
import org.netbeans.api.java.classpath.ClassPath;
63
import org.netbeans.api.java.classpath.ClassPath;
65
import org.netbeans.api.java.queries.JavadocForBinaryQuery;
64
import org.netbeans.api.java.queries.JavadocForBinaryQuery;
66
import org.openide.filesystems.FileObject;
65
import org.openide.filesystems.FileObject;
67
import org.openide.filesystems.FileStateInvalidException;
68
import org.openide.filesystems.FileUtil;
66
import org.openide.filesystems.FileUtil;
69
import org.openide.nodes.Children;
67
import org.openide.nodes.Children;
70
import org.openide.nodes.AbstractNode;
68
import org.openide.nodes.AbstractNode;
 Lines 72-78    Link Here 
72
import org.openide.util.ImageUtilities;
70
import org.openide.util.ImageUtilities;
73
import org.openide.util.NbBundle;
71
import org.openide.util.NbBundle;
74
import org.openide.util.RequestProcessor;
72
import org.openide.util.RequestProcessor;
75
import org.openide.util.Utilities;
76
import org.openide.util.WeakListeners;
73
import org.openide.util.WeakListeners;
77
import org.openide.ErrorManager;
74
import org.openide.ErrorManager;
78
import org.netbeans.api.java.platform.JavaPlatform;
75
import org.netbeans.api.java.platform.JavaPlatform;
 Lines 205-211    Link Here 
205
            FileObject[] roots = platform.getBootstrapLibraries().getRoots();
202
            FileObject[] roots = platform.getBootstrapLibraries().getRoots();
206
            List<SourceGroup> result = new ArrayList<SourceGroup>(roots.length);
203
            List<SourceGroup> result = new ArrayList<SourceGroup>(roots.length);
207
            for (int i=0; i<roots.length; i++) {
204
            for (int i=0; i<roots.length; i++) {
208
                try {
209
                    FileObject file;
205
                    FileObject file;
210
                    Icon icon;
206
                    Icon icon;
211
                    if ("jar".equals(roots[i].getURL().getProtocol())) { //NOI18N
207
                    if ("jar".equals(roots[i].getURL().getProtocol())) { //NOI18N
 Lines 218-226    Link Here 
218
                    if (file.isValid()) {
214
                    if (file.isValid()) {
219
                        result.add(new LibrariesSourceGroup(roots[i], file.getNameExt(), icon, icon));
215
                        result.add(new LibrariesSourceGroup(roots[i], file.getNameExt(), icon, icon));
220
                    }
216
                    }
221
                } catch (FileStateInvalidException e) {
222
                    ErrorManager.getDefault().notify(e);
223
                }
224
            }
217
            }
225
            return result;
218
            return result;
226
        }
219
        }
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/api/LayerHandle.java (-6 / +1 lines)
 Lines 67-73    Link Here 
67
import org.openide.filesystems.FileEvent;
67
import org.openide.filesystems.FileEvent;
68
import org.openide.filesystems.FileObject;
68
import org.openide.filesystems.FileObject;
69
import org.openide.filesystems.FileRenameEvent;
69
import org.openide.filesystems.FileRenameEvent;
70
import org.openide.filesystems.FileStateInvalidException;
71
import org.openide.filesystems.FileSystem;
70
import org.openide.filesystems.FileSystem;
72
import org.openide.filesystems.FileUtil;
71
import org.openide.filesystems.FileUtil;
73
import org.openide.filesystems.MultiFileSystem;
72
import org.openide.filesystems.MultiFileSystem;
 Lines 151-161    Link Here 
151
                    return fs = FileUtil.createMemoryFileSystem();
150
                    return fs = FileUtil.createMemoryFileSystem();
152
                }
151
                }
153
            }
152
            }
154
            try {
153
            fs = new DualLayers(new WritableXMLFileSystem(xml.getURL(), cookie = LayerUtils.cookieForFile(xml), LayerUtils.findResourceCP(project)));
155
                fs = new DualLayers(new WritableXMLFileSystem(xml.getURL(), cookie = LayerUtils.cookieForFile(xml), LayerUtils.findResourceCP(project)));
156
            } catch (FileStateInvalidException e) {
157
                throw new AssertionError(e);
158
            }
159
            cookie.addPropertyChangeListener(new PropertyChangeListener() {
154
            cookie.addPropertyChangeListener(new PropertyChangeListener() {
160
                public void propertyChange(PropertyChangeEvent evt) {
155
                public void propertyChange(PropertyChangeEvent evt) {
161
                    //System.err.println("changed in mem");
156
                    //System.err.println("changed in mem");
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/layers/LayerUtils.java (-7 lines)
 Lines 64-70    Link Here 
64
import org.netbeans.api.project.ProjectUtils;
64
import org.netbeans.api.project.ProjectUtils;
65
import org.netbeans.api.project.SourceGroup;
65
import org.netbeans.api.project.SourceGroup;
66
import org.netbeans.api.project.Sources;
66
import org.netbeans.api.project.Sources;
67
import org.netbeans.modules.apisupport.project.api.Util;
68
import org.netbeans.modules.apisupport.project.api.LayerHandle;
67
import org.netbeans.modules.apisupport.project.api.LayerHandle;
69
import org.netbeans.modules.apisupport.project.spi.NbModuleProvider;
68
import org.netbeans.modules.apisupport.project.spi.NbModuleProvider;
70
import org.netbeans.modules.xml.tax.cookies.TreeEditorCookie;
69
import org.netbeans.modules.xml.tax.cookies.TreeEditorCookie;
 Lines 74-86    Link Here 
74
import org.netbeans.tax.TreeException;
73
import org.netbeans.tax.TreeException;
75
import org.netbeans.tax.TreeObject;
74
import org.netbeans.tax.TreeObject;
76
import org.netbeans.tax.io.TreeStreamResult;
75
import org.netbeans.tax.io.TreeStreamResult;
77
import org.openide.ErrorManager;
78
import org.openide.filesystems.FileAttributeEvent;
76
import org.openide.filesystems.FileAttributeEvent;
79
import org.openide.filesystems.FileChangeListener;
77
import org.openide.filesystems.FileChangeListener;
80
import org.openide.filesystems.FileEvent;
78
import org.openide.filesystems.FileEvent;
81
import org.openide.filesystems.FileObject;
79
import org.openide.filesystems.FileObject;
82
import org.openide.filesystems.FileRenameEvent;
80
import org.openide.filesystems.FileRenameEvent;
83
import org.openide.filesystems.FileStateInvalidException;
84
import org.openide.filesystems.FileSystem;
81
import org.openide.filesystems.FileSystem;
85
import org.openide.filesystems.FileSystem.AtomicAction;
82
import org.openide.filesystems.FileSystem.AtomicAction;
86
import org.openide.filesystems.FileUtil;
83
import org.openide.filesystems.FileUtil;
 Lines 125-131    Link Here 
125
        if (cp == null) {
122
        if (cp == null) {
126
            return new URL[] {u};
123
            return new URL[] {u};
127
        }
124
        }
128
        try {
129
            if (u.getProtocol().equals("nbres")) { // NOI18N
125
            if (u.getProtocol().equals("nbres")) { // NOI18N
130
                String path = u.getFile();
126
                String path = u.getFile();
131
                if (path.startsWith("/")) path = path.substring(1); // NOI18N
127
                if (path.startsWith("/")) path = path.substring(1); // NOI18N
 Lines 171-179    Link Here 
171
                    return urls.toArray(new URL[urls.size()]);
167
                    return urls.toArray(new URL[urls.size()]);
172
                }
168
                }
173
            }
169
            }
174
        } catch (FileStateInvalidException fsie) {
175
            Util.err.notify(ErrorManager.WARNING, fsie);
176
        }
177
        return new URL[] {u};
170
        return new URL[] {u};
178
    }
171
    }
179
172
(-)a/apisupport.refactoring/src/org/netbeans/modules/apisupport/hints/LayerHints.java (-9 / +1 lines)
 Lines 73-79    Link Here 
73
import org.openide.filesystems.FileChangeListener;
73
import org.openide.filesystems.FileChangeListener;
74
import org.openide.filesystems.FileEvent;
74
import org.openide.filesystems.FileEvent;
75
import org.openide.filesystems.FileObject;
75
import org.openide.filesystems.FileObject;
76
import org.openide.filesystems.FileStateInvalidException;
77
import org.openide.filesystems.FileSystem;
76
import org.openide.filesystems.FileSystem;
78
import org.openide.filesystems.FileUtil;
77
import org.openide.filesystems.FileUtil;
79
import org.openide.loaders.DataObject;
78
import org.openide.loaders.DataObject;
 Lines 181-194    Link Here 
181
                cancelAll();
180
                cancelAll();
182
                return;
181
                return;
183
            }
182
            }
184
            final URL layerURL;
183
            final URL layerURL = handle.getLayerFile().getURL();
185
            try {
186
                layerURL = handle.getLayerFile().getURL();
187
            } catch (FileStateInvalidException x) {
188
                LOG.log(Level.INFO, null, x);
189
                cancelAll();
190
                return;
191
            }
192
            String expectedLayers = "[" + layerURL + "]";
184
            String expectedLayers = "[" + layerURL + "]";
193
            List<ErrorDescription> errors = new ArrayList<ErrorDescription>();
185
            List<ErrorDescription> errors = new ArrayList<ErrorDescription>();
194
            RunnableFuture<Map<String,Integer>> linesFuture = new FutureTask<Map<String,Integer>>(new Callable<Map<String,Integer>>() {
186
            RunnableFuture<Map<String,Integer>> linesFuture = new FutureTask<Map<String,Integer>>(new Callable<Map<String,Integer>>() {
(-)a/autoupdate.services/src/org/netbeans/modules/autoupdate/updateprovider/DummyModuleInfo.java (-6 / +1 lines)
 Lines 73-84    Link Here 
73
//                List urls = new ArrayList(Math.max(kids.length, 1)); // List<URL>
73
//                List urls = new ArrayList(Math.max(kids.length, 1)); // List<URL>
74
//                for (int i = 0; i < kids.length; i++) {
74
//                for (int i = 0; i < kids.length; i++) {
75
//                    if (kids[i].hasExt("xml")) {
75
//                    if (kids[i].hasExt("xml")) {
76
//                        try {
76
//                        urls.add(kids[i].getURL());
77
//                            urls.add(kids[i].getURL());
78
//                        }
79
//                        catch (FileStateInvalidException e) {
80
//                            Exceptions.printStackTrace(e);
81
//                        }
82
//                    }
77
//                    }
83
//                }
78
//                }
84
//                try {
79
//                try {
(-)a/java.api.common/nbproject/project.xml (-1 / +1 lines)
 Lines 174-180    Link Here 
174
                    <build-prerequisite/>
174
                    <build-prerequisite/>
175
                    <compile-dependency/>
175
                    <compile-dependency/>
176
                    <run-dependency>
176
                    <run-dependency>
177
                        <specification-version>7.20</specification-version>
177
                        <specification-version>7.57</specification-version>
178
                    </run-dependency>
178
                    </run-dependency>
179
                </dependency>
179
                </dependency>
180
                <dependency>
180
                <dependency>
(-)a/java.api.common/src/org/netbeans/modules/java/api/common/applet/AppletSupport.java (-5 / +1 lines)
 Lines 252-262    Link Here 
252
            }
252
            }
253
        }
253
        }
254
        else {
254
        else {
255
            try {
255
            url = htmlFile.getURL();
256
                url = htmlFile.getURL();
257
            } catch (FileStateInvalidException f) {
258
                ErrorManager.getDefault().notify(f);
259
            }
260
        }
256
        }
261
        return url;
257
        return url;
262
    }
258
    }
(-)a/java.api.common/src/org/netbeans/modules/java/api/common/classpath/ClassPathExtender.java (-8 / +1 lines)
 Lines 46-52    Link Here 
46
46
47
import java.io.IOException;
47
import java.io.IOException;
48
import java.net.URI;
48
import java.net.URI;
49
import java.net.URISyntaxException;
50
49
51
import org.openide.filesystems.FileObject;
50
import org.openide.filesystems.FileObject;
52
import org.openide.filesystems.FileUtil;
51
import org.openide.filesystems.FileUtil;
 Lines 90-102    Link Here 
90
        }
89
        }
91
        URI[] archiveFileURIs = new URI[archiveFiles.length];
90
        URI[] archiveFileURIs = new URI[archiveFiles.length];
92
        for (int i = 0; i < archiveFiles.length; i++) {
91
        for (int i = 0; i < archiveFiles.length; i++) {
93
            try {
92
            archiveFileURIs[i] = archiveFiles[i].toURI();
94
                archiveFileURIs[i] = archiveFiles[i].getURL().toURI();
95
            } catch (URISyntaxException ex) {
96
                IOException ioe = new IOException();
97
                ioe.initCause(ex);
98
                throw ioe;
99
            }
100
        }        
93
        }        
101
        return this.delegate.handleRoots(archiveFileURIs, classPathId, projectXMLElementName, ClassPathModifier.ADD);
94
        return this.delegate.handleRoots(archiveFileURIs, classPathId, projectXMLElementName, ClassPathModifier.ADD);
102
    }
95
    }
(-)a/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/ActionFilterNode.java (-15 / +2 lines)
 Lines 59-65    Link Here 
59
59
60
import org.openide.loaders.DataObject;
60
import org.openide.loaders.DataObject;
61
import org.openide.filesystems.FileObject;
61
import org.openide.filesystems.FileObject;
62
import org.openide.filesystems.FileStateInvalidException;
63
import org.openide.filesystems.FileUtil;
62
import org.openide.filesystems.FileUtil;
64
import org.openide.nodes.FilterNode;
63
import org.openide.nodes.FilterNode;
65
import org.openide.nodes.Node;
64
import org.openide.nodes.Node;
 Lines 391-401    Link Here 
391
                RP.execute(new Runnable() {
390
                RP.execute(new Runnable() {
392
                    @Override
391
                    @Override
393
                    public void run() {
392
                    public void run() {
394
                        try {
393
                        JavadocForBinaryQuery.findJavadoc(cpRoot.getURL());
395
                            JavadocForBinaryQuery.findJavadoc(cpRoot.getURL());
396
                        } catch (FileStateInvalidException ex) {
397
                            Exceptions.printStackTrace(ex);
398
                        }
399
                    }
394
                    }
400
                });
395
                });
401
            }
396
            }
 Lines 403-418    Link Here 
403
398
404
        @Override
399
        @Override
405
        public boolean hasJavadoc() {
400
        public boolean hasJavadoc() {
406
            try {
401
            return resource != null && JavadocForBinaryQuery.findJavadoc(cpRoot.getURL()).getRoots().length>0;
407
                return resource != null && JavadocForBinaryQuery.findJavadoc(cpRoot.getURL()).getRoots().length>0;
408
            } catch (FileStateInvalidException fsi) {
409
                return false;
410
            }
411
        }
402
        }
412
403
413
        @Override
404
        @Override
414
        public void showJavadoc() {
405
        public void showJavadoc() {
415
            try {
416
                String relativeName = FileUtil.getRelativePath(cpRoot,resource);
406
                String relativeName = FileUtil.getRelativePath(cpRoot,resource);
417
                URL[] urls = JavadocForBinaryQuery.findJavadoc(cpRoot.getURL()).getRoots();
407
                URL[] urls = JavadocForBinaryQuery.findJavadoc(cpRoot.getURL()).getRoots();
418
                URL pageURL;
408
                URL pageURL;
 Lines 431-439    Link Here 
431
                    pageURL = ShowJavadocAction.findJavadoc (javadocFileName,urls);
421
                    pageURL = ShowJavadocAction.findJavadoc (javadocFileName,urls);
432
                }
422
                }
433
                ShowJavadocAction.showJavaDoc(pageURL,relativeName.replace('/','.'));  //NOI18N
423
                ShowJavadocAction.showJavaDoc(pageURL,relativeName.replace('/','.'));  //NOI18N
434
            } catch (FileStateInvalidException fsi) {
435
                Exceptions.printStackTrace(fsi);
436
            }
437
        }
424
        }
438
    }
425
    }
439
426
(-)a/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/LibrariesSourceGroup.java (-8 / +1 lines)
 Lines 47-56    Link Here 
47
import java.beans.PropertyChangeListener;
47
import java.beans.PropertyChangeListener;
48
import javax.swing.Icon;
48
import javax.swing.Icon;
49
import org.openide.filesystems.FileObject;
49
import org.openide.filesystems.FileObject;
50
import org.openide.filesystems.FileStateInvalidException;
51
import org.openide.filesystems.FileUtil;
50
import org.openide.filesystems.FileUtil;
52
import org.netbeans.api.project.SourceGroup;
51
import org.netbeans.api.project.SourceGroup;
53
import org.openide.util.Exceptions;
54
52
55
53
56
/**
54
/**
 Lines 96-107    Link Here 
96
    }
94
    }
97
95
98
    public String getName() {
96
    public String getName() {
99
        try {        
97
        return root.getURL().toExternalForm();
100
            return root.getURL().toExternalForm();
101
        } catch (FileStateInvalidException fsi) { 
102
            Exceptions.printStackTrace(fsi);
103
            return root.toString();
104
        }
105
    }
98
    }
106
99
107
    public String getDisplayName() {
100
    public String getDisplayName() {
(-)a/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/PlatformNode.java (-6 lines)
 Lines 65-71    Link Here 
65
import org.netbeans.api.java.classpath.ClassPath;
65
import org.netbeans.api.java.classpath.ClassPath;
66
import org.netbeans.api.java.queries.JavadocForBinaryQuery;
66
import org.netbeans.api.java.queries.JavadocForBinaryQuery;
67
import org.openide.filesystems.FileObject;
67
import org.openide.filesystems.FileObject;
68
import org.openide.filesystems.FileStateInvalidException;
69
import org.openide.filesystems.FileUtil;
68
import org.openide.filesystems.FileUtil;
70
import org.openide.loaders.DataObjectNotFoundException;
69
import org.openide.loaders.DataObjectNotFoundException;
71
import org.openide.nodes.Children;
70
import org.openide.nodes.Children;
 Lines 84-90    Link Here 
84
import org.openide.loaders.DataFolder;
83
import org.openide.loaders.DataFolder;
85
import org.openide.loaders.DataObject;
84
import org.openide.loaders.DataObject;
86
import org.openide.util.ChangeSupport;
85
import org.openide.util.ChangeSupport;
87
import org.openide.util.Exceptions;
88
import org.openide.util.Lookup;
86
import org.openide.util.Lookup;
89
import org.openide.util.Parameters;
87
import org.openide.util.Parameters;
90
import org.openide.util.actions.SystemAction;
88
import org.openide.util.actions.SystemAction;
 Lines 240-246    Link Here 
240
            FileObject[] roots = platform.getBootstrapLibraries().getRoots();
238
            FileObject[] roots = platform.getBootstrapLibraries().getRoots();
241
            List<SourceGroup> result = new ArrayList<SourceGroup>(roots.length);
239
            List<SourceGroup> result = new ArrayList<SourceGroup>(roots.length);
242
            for (int i = 0; i < roots.length; i++) {
240
            for (int i = 0; i < roots.length; i++) {
243
                try {
244
                    FileObject file;
241
                    FileObject file;
245
                    Icon icon;
242
                    Icon icon;
246
                    Icon openedIcon;
243
                    Icon openedIcon;
 Lines 257-265    Link Here 
257
                    if (file.isValid()) {
254
                    if (file.isValid()) {
258
                        result.add (new LibrariesSourceGroup(roots[i],file.getNameExt(),icon, openedIcon));
255
                        result.add (new LibrariesSourceGroup(roots[i],file.getNameExt(),icon, openedIcon));
259
                    }
256
                    }
260
                } catch (FileStateInvalidException e) {
261
                    Exceptions.printStackTrace(e);
262
                }
263
            }
257
            }
264
            return result;
258
            return result;
265
        }
259
        }
(-)a/java.j2seproject/test/unit/src/org/netbeans/modules/java/j2seproject/classpath/J2SEProjectClassPathModifierTest.java (-1 / +1 lines)
 Lines 303-309    Link Here 
303
        final ClassPath cp = ClassPath.getClassPath(srcGrp.getRootFolder(), JavaClassPathConstants.PROCESSOR_PATH);
303
        final ClassPath cp = ClassPath.getClassPath(srcGrp.getRootFolder(), JavaClassPathConstants.PROCESSOR_PATH);
304
        assertFalse(Arrays.asList(cp.getRoots()).contains(libRoot));
304
        assertFalse(Arrays.asList(cp.getRoots()).contains(libRoot));
305
        ProjectClassPathModifier.addRoots(
305
        ProjectClassPathModifier.addRoots(
306
            new URI[] {libRoot.getURL().toURI()},
306
            new URI[] {libRoot.toURI()},
307
            srcGrp.getRootFolder(),
307
            srcGrp.getRootFolder(),
308
            JavaClassPathConstants.PROCESSOR_PATH);
308
            JavaClassPathConstants.PROCESSOR_PATH);
309
        assertTrue("No lib on processor path!", Arrays.asList(cp.getRoots()).contains(libRoot));    //NOI18N
309
        assertTrue("No lib on processor path!", Arrays.asList(cp.getRoots()).contains(libRoot));    //NOI18N
(-)a/openide.execution/apichanges.xml (+20 lines)
 Lines 57-62    Link Here 
57
    <!-- ACTUAL CHANGES BEGIN HERE: -->
57
    <!-- ACTUAL CHANGES BEGIN HERE: -->
58
58
59
    <changes>
59
    <changes>
60
        <change id="NbClassLoader.no.FileStateInvalidException">
61
            <api name="execution"/>
62
            <summary><code>NbClassLoader(FileObject[], ...)</code> does not throw <code>FileStateInvalidException</code></summary>
63
            <version major="1" minor="26"/>
64
            <date year="2012" month="1" day="20"/>
65
            <author login="jglick"/>
66
            <compatibility source="incompatible">
67
                <p>
68
                    No <code>NbClassLoader</code> constructor throws <code>FileStateInvalidException</code> any longer,
69
                    which can cause some existing source code to not compile.
70
                </p>
71
            </compatibility>
72
            <description>
73
                <p>
74
                    <code>NbClassLoader(FileObject[], ClassLoader, InputOutput)</code> does not throw <code>FileStateInvalidException</code> ahy more.
75
                </p>
76
            </description>
77
            <class package="org.openide.execution" name="NbClassLoader"/>
78
            <issue number="207294"/>
79
        </change>
60
    <change id="automatic-request-of-engine-impl">
80
    <change id="automatic-request-of-engine-impl">
61
      <api name="execution"/>
81
      <api name="execution"/>
62
      <summary> No need to require ExecutionEngine token anymore</summary>
82
      <summary> No need to require ExecutionEngine token anymore</summary>
(-)a/openide.execution/manifest.mf (-1 / +1 lines)
 Lines 1-6    Link Here 
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.openide.execution
2
OpenIDE-Module: org.openide.execution
3
OpenIDE-Module-Specification-Version: 1.25
3
OpenIDE-Module-Specification-Version: 1.26
4
OpenIDE-Module-Localizing-Bundle: org/openide/execution/Bundle.properties
4
OpenIDE-Module-Localizing-Bundle: org/openide/execution/Bundle.properties
5
OpenIDE-Module-Recommends: org.openide.execution.ExecutionEngine
5
OpenIDE-Module-Recommends: org.openide.execution.ExecutionEngine
6
AutoUpdate-Essential-Module: true
6
AutoUpdate-Essential-Module: true
(-)a/openide.execution/nbproject/project.xml (-9 / +9 lines)
 Lines 54-60    Link Here 
54
                    <build-prerequisite/>
54
                    <build-prerequisite/>
55
                    <compile-dependency/>
55
                    <compile-dependency/>
56
                    <run-dependency>
56
                    <run-dependency>
57
                        <specification-version>6.2</specification-version>
57
                        <specification-version>7.57</specification-version>
58
                    </run-dependency>
59
                </dependency>
60
                <dependency>
61
                    <code-name-base>org.openide.io</code-name-base>
62
                    <build-prerequisite/>
63
                    <compile-dependency/>
64
                    <run-dependency>
65
                        <specification-version>1.0</specification-version>
58
                    </run-dependency>
66
                    </run-dependency>
59
                </dependency>
67
                </dependency>
60
                <dependency>
68
                <dependency>
 Lines 73-86    Link Here 
73
                        <specification-version>8.0</specification-version>
81
                        <specification-version>8.0</specification-version>
74
                    </run-dependency>
82
                    </run-dependency>
75
                </dependency>
83
                </dependency>
76
                <dependency>
77
                    <code-name-base>org.openide.io</code-name-base>
78
                    <build-prerequisite/>
79
                    <compile-dependency/>
80
                    <run-dependency>
81
                        <specification-version>1.0</specification-version>
82
                    </run-dependency>
83
                </dependency>
84
            </module-dependencies>
84
            </module-dependencies>
85
            <test-dependencies>
85
            <test-dependencies>
86
                <test-type>
86
                <test-type>
(-)a/openide.execution/src/org/openide/execution/NbClassLoader.java (-5 / +3 lines)
 Lines 54-66    Link Here 
54
import java.security.PermissionCollection;
54
import java.security.PermissionCollection;
55
import java.util.Enumeration;
55
import java.util.Enumeration;
56
import java.util.HashMap;
56
import java.util.HashMap;
57
import java.util.concurrent.atomic.AtomicBoolean;
58
import java.util.jar.Manifest;
57
import java.util.jar.Manifest;
59
import java.util.logging.Level;
58
import java.util.logging.Level;
60
import java.util.logging.Logger;
59
import java.util.logging.Logger;
61
import org.openide.filesystems.FileObject;
60
import org.openide.filesystems.FileObject;
62
import org.openide.filesystems.FileStateInvalidException;
63
import org.openide.filesystems.FileSystem;
61
import org.openide.filesystems.FileSystem;
62
import org.openide.filesystems.FileSystemCapability;
64
import org.openide.filesystems.FileUtil;
63
import org.openide.filesystems.FileUtil;
65
import org.openide.filesystems.URLMapper;
64
import org.openide.filesystems.URLMapper;
66
import org.openide.util.Exceptions;
65
import org.openide.util.Exceptions;
 Lines 115-125    Link Here 
115
     * @param roots a set of package roots
114
     * @param roots a set of package roots
116
     * @param parent a parent loader
115
     * @param parent a parent loader
117
     * @param io an I/O tab in the Output Window, or null
116
     * @param io an I/O tab in the Output Window, or null
118
     * @throws FileStateInvalidException if some of the roots are not valid
119
     * @since XXX
117
     * @since XXX
120
     */
118
     */
121
    static ThreadLocal<Boolean> f = new ThreadLocal<Boolean>();
119
    static ThreadLocal<Boolean> f = new ThreadLocal<Boolean>();
122
    public NbClassLoader(FileObject[] roots, ClassLoader parent, InputOutput io) throws FileStateInvalidException {
120
    public NbClassLoader(FileObject[] roots, ClassLoader parent, InputOutput io) {
123
        super(createRootURLs(roots), parent);
121
        super(createRootURLs(roots), parent);
124
        fast = canOptimize(getURLs());
122
        fast = canOptimize(getURLs());
125
        inout = io;
123
        inout = io;
 Lines 286-292    Link Here 
286
     * @param roots file roots
284
     * @param roots file roots
287
     * @return array of URLs
285
     * @return array of URLs
288
     */
286
     */
289
    private static URL[] createRootURLs(FileObject[] roots) throws FileStateInvalidException {
287
    private static URL[] createRootURLs(FileObject[] roots) {
290
        URL[] urls = new URL[roots.length];
288
        URL[] urls = new URL[roots.length];
291
        for (int i = 0; i < roots.length; i++) {
289
        for (int i = 0; i < roots.length; i++) {
292
            urls[i] = roots[i].getURL();
290
            urls[i] = roots[i].getURL();
(-)a/openide.filesystems/apichanges.xml (+25 lines)
 Lines 49-54    Link Here 
49
        <apidef name="filesystems">Filesystems API</apidef>
49
        <apidef name="filesystems">Filesystems API</apidef>
50
    </apidefs>
50
    </apidefs>
51
    <changes>
51
    <changes>
52
        <change id="FileObject.toURI">
53
            <api name="filesystems"/>
54
            <summary>Introduced <code>FileObject.toURI</code></summary>
55
            <version major="7" minor="57"/>
56
            <date year="2012" month="1" day="20"/>
57
            <author login="jglick"/>
58
            <compatibility addition="yes" source="incompatible">
59
                <p>
60
                    <code>FileObject.getURL</code> no longer throws <code>FileStateInvalidException</code>,
61
                    which can cause some existing source code to not compile.
62
                </p>
63
            </compatibility>
64
            <description>
65
                <p>
66
                    Added <code>FileObject.toURI</code> for convenience.
67
                </p>
68
                <p>
69
                    Also removed checked exception from <code>FileObject.getURL</code>,
70
                    and clarified that <code>URLMapper.findURL(fo, INTERNAL)</code>
71
                    will never return null.
72
                </p>
73
            </description>
74
            <class package="org.openide.filesystems" name="FileObject"/>
75
            <issue number="207294"/>
76
        </change>
52
         <change id="default-line-separator">
77
         <change id="default-line-separator">
53
            <api name="filesystems"/>
78
            <api name="filesystems"/>
54
            <summary>Provides default line separator</summary>
79
            <summary>Provides default line separator</summary>
(-)a/openide.filesystems/manifest.mf (-1 / +1 lines)
 Lines 2-6    Link Here 
2
OpenIDE-Module: org.openide.filesystems
2
OpenIDE-Module: org.openide.filesystems
3
OpenIDE-Module-Localizing-Bundle: org/openide/filesystems/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/openide/filesystems/Bundle.properties
4
OpenIDE-Module-Layer: org/openide/filesystems/resources/layer.xml
4
OpenIDE-Module-Layer: org/openide/filesystems/resources/layer.xml
5
OpenIDE-Module-Specification-Version: 7.56
5
OpenIDE-Module-Specification-Version: 7.57
6
6
(-)a/openide.filesystems/src/META-INF/upgrade/FileObject.hint (+21 lines)
 Lines 2-4    Link Here 
2
=>
2
=>
3
!$f.canWrite()
3
!$f.canWrite()
4
;;
4
;;
5
6
/* XXX cannot get this to work:
7
try {
8
    $body1$;
9
    $f.getURL();
10
    $body2$;
11
} catch (org.openide.filesystems.FileStateInvalidException $e) {
12
    $impossible$;
13
}
14
:: $f instanceof org.openide.filesystems.FileObject
15
=>
16
$body1$;
17
$f.getURL() :: $f instanceof org.openide.filesystems.FileObject;
18
$body2$;
19
;;
20
*/
21
22
$f.getURL().toURI() :: $f instanceof org.openide.filesystems.FileObject
23
=>
24
$f.toURI()
25
;;
(-)a/openide.filesystems/src/org/openide/filesystems/FileObject.java (-3 / +20 lines)
 Lines 51-56    Link Here 
51
import java.io.InputStream;
51
import java.io.InputStream;
52
import java.io.OutputStream;
52
import java.io.OutputStream;
53
import java.io.Serializable;
53
import java.io.Serializable;
54
import java.net.URI;
55
import java.net.URISyntaxException;
54
import java.net.URL;
56
import java.net.URL;
55
import java.nio.charset.Charset;
57
import java.nio.charset.Charset;
56
import java.util.Arrays;
58
import java.util.Arrays;
 Lines 1133-1148    Link Here 
1133
     * the URL will only be usable within NetBeans as it uses a special protocol handler.
1135
     * the URL will only be usable within NetBeans as it uses a special protocol handler.
1134
     * Otherwise an attempt is made to produce an external URL.
1136
     * Otherwise an attempt is made to produce an external URL.
1135
    * @return URL of this file object
1137
    * @return URL of this file object
1136
    * @exception FileStateInvalidException if the file is not valid
1137
     * @see URLMapper#findURL
1138
     * @see URLMapper#findURL
1138
     * @see URLMapper#INTERNAL
1139
     * @see URLMapper#INTERNAL
1139
    */
1140
    */
1140
    public final URL getURL() throws FileStateInvalidException {
1141
    public final URL getURL() {
1141
        // XXX why does this still throw FSIE? need not
1142
        return URLMapper.findURL(this, URLMapper.INTERNAL);
1142
        return URLMapper.findURL(this, URLMapper.INTERNAL);
1143
    }
1143
    }
1144
1144
1145
    /**
1145
    /**
1146
     * Gets a URI for this file.
1147
     * Similar to {@link #getURL}.
1148
     * @return an absolute URI representing this file location
1149
     * @since 7.57
1150
     */
1151
    public final URI toURI() {
1152
        try {
1153
            URI uri = getURL().toURI();
1154
            assert uri.isAbsolute() : uri;
1155
            assert uri.equals(uri.normalize()) : uri;
1156
            return uri;
1157
        } catch (URISyntaxException x) {
1158
            throw new IllegalStateException(x);
1159
        }
1160
    }
1161
1162
    /**
1146
     * Tests if file really exists or is missing. Some operation on it may be restricted.
1163
     * Tests if file really exists or is missing. Some operation on it may be restricted.
1147
     * @return true indicates that the file is missing.
1164
     * @return true indicates that the file is missing.
1148
     * @since 1.9
1165
     * @since 1.9
(-)a/openide.filesystems/src/org/openide/filesystems/FileURL.java (-2 / +1 lines)
 Lines 99-107    Link Here 
99
    /** Provides a URL to access a file object.
99
    /** Provides a URL to access a file object.
100
    * @param fo the file object
100
    * @param fo the file object
101
    * @return a URL using the correct syntax and {@link #PROTOCOL protocol}
101
    * @return a URL using the correct syntax and {@link #PROTOCOL protocol}
102
    * @exception FileStateInvalidException if the file object is not valid (typically, if its filesystem is inconsistent or no longer present)
103
    */
102
    */
104
    public static URL encodeFileObject(FileObject fo) throws FileStateInvalidException {
103
    public static URL encodeFileObject(FileObject fo) {
105
        return NbfsUtil.getURL(fo);
104
        return NbfsUtil.getURL(fo);
106
    }
105
    }
107
106
(-)a/openide.filesystems/src/org/openide/filesystems/NbfsUtil.java (-3 / +7 lines)
 Lines 65-74    Link Here 
65
     * Gets URL with nbfs protocol for passes fo
65
     * Gets URL with nbfs protocol for passes fo
66
     * @param fo
66
     * @param fo
67
     * @return url with nbfs protocol
67
     * @return url with nbfs protocol
68
     * @throws FileStateInvalidException if FileObject somehow corrupted
69
     */
68
     */
70
    static URL getURL(FileObject fo) throws FileStateInvalidException {
69
    static URL getURL(FileObject fo) {
71
        final String fsPart = encodeFsPart(fo);
70
        String fsPart;
71
        try {
72
            fsPart = encodeFsPart(fo);
73
        } catch (FileStateInvalidException x) {
74
            fsPart = "invalid";
75
        }
72
        final String foPart = encodeFoPart(fo);
76
        final String foPart = encodeFoPart(fo);
73
77
74
        final String host = "nbhost"; //NOI18N
78
        final String host = "nbhost"; //NOI18N
(-)a/openide.filesystems/src/org/openide/filesystems/URLMapper.java (-6 / +2 lines)
 Lines 130-136    Link Here 
130
     * <li>inside this machine
130
     * <li>inside this machine
131
     * <li>from networked machines
131
     * <li>from networked machines
132
     * </ul>
132
     * </ul>
133
     * @return a suitable URL, or null
133
     * @return a suitable URL, or (only if not {@link #INTERNAL}) null
134
     */
134
     */
135
    public static URL findURL(FileObject fo, int type) {
135
    public static URL findURL(FileObject fo, int type) {
136
136
 Lines 146-156    Link Here 
146
        // if not resolved yet then internal URL with nbfs protocol is returned
146
        // if not resolved yet then internal URL with nbfs protocol is returned
147
        // XXX this would be better handled by making DefaultURLMapper just return nbfs for INTERNAL when necessary!
147
        // XXX this would be better handled by making DefaultURLMapper just return nbfs for INTERNAL when necessary!
148
        if (type == INTERNAL) {
148
        if (type == INTERNAL) {
149
            try {
149
            return FileURL.encodeFileObject(fo);
150
                return FileURL.encodeFileObject(fo);
151
            } catch (FileStateInvalidException iex) {
152
                // ignore
153
            }
154
        }
150
        }
155
151
156
        return null;
152
        return null;
(-)a/openide.filesystems/test/unit/src/META-INF/upgrade/FileObject.test (+38 lines)
Line 0    Link Here 
1
%%TestCase toURI
2
package test;
3
class C {
4
    org.openide.filesystems.FileObject f;
5
    java.net.URI u() throws Exception {
6
        return f.getURL().toURI();
7
    }
8
}
9
%%=>
10
package test;
11
class C {
12
    org.openide.filesystems.FileObject f;
13
    java.net.URI u() throws Exception {
14
        return f.toURI();
15
    }
16
}
17
18
%%TestCase remove-catch
19
// XXX
20
package test;
21
class C {
22
    org.openide.filesystems.FileObject f;
23
    String n() {
24
        try {
25
            return f.getURL().toExternalForm();
26
        } catch (org.openide.filesystems.FileStateInvalidException e) {
27
            return e.toString();
28
        }
29
    }
30
}
31
%%=>
32
package test;
33
class C {
34
    org.openide.filesystems.FileObject f;
35
    String n() {
36
        return f.getURL().toExternalForm();
37
    }
38
}
(-)a/openide.filesystems/test/unit/src/org/openide/filesystems/FileObjectTestHid.java (-2 / +3 lines)
 Lines 1697-1703    Link Here 
1697
    }
1697
    }
1698
1698
1699
1699
1700
    public void testNbfsTransformation () throws FileStateInvalidException{
1700
    public void testNbfsTransformation () {
1701
        checkSetUp();
1701
        checkSetUp();
1702
        // additional check
1702
        // additional check
1703
        String sysName = fs.getSystemName();
1703
        String sysName = fs.getSystemName();
 Lines 3094-3100    Link Here 
3094
        URL url = null;
3094
        URL url = null;
3095
        url  = fo1.getURL();
3095
        url  = fo1.getURL();
3096
        /** Only invalid files may fire FileStateInvalidException*/
3096
        /** Only invalid files may fire FileStateInvalidException*/
3097
        fsAssert ("Expected valid url",url != null);                
3097
        fsAssert ("Expected valid url",url != null);
3098
        fsAssert("same URI", url.toURI().equals(fo1.toURI()));
3098
        
3099
        
3099
        // #39613: check that it actually works!
3100
        // #39613: check that it actually works!
3100
        // Note that since getURL now produces a file: URL for files with File's,
3101
        // Note that since getURL now produces a file: URL for files with File's,
(-)a/project.ant/nbproject/project.xml (-1 / +1 lines)
 Lines 140-146    Link Here 
140
                    <build-prerequisite/>
140
                    <build-prerequisite/>
141
                    <compile-dependency/>
141
                    <compile-dependency/>
142
                    <run-dependency>
142
                    <run-dependency>
143
                        <specification-version>7.50</specification-version>
143
                        <specification-version>7.57</specification-version>
144
                    </run-dependency>
144
                    </run-dependency>
145
                </dependency>
145
                </dependency>
146
                <dependency>
146
                <dependency>
(-)a/project.ant/src/org/netbeans/modules/project/ant/ProjectLibraryProvider.java (-7 / +1 lines)
 Lines 1178-1190    Link Here 
1178
                URI u;
1178
                URI u;
1179
                FileObject newFO;
1179
                FileObject newFO;
1180
                String name;
1180
                String name;
1181
                URI libEntryU;
1181
                if (CollocationQuery.areCollocated(libBaseFolder.toURI(), libEntryFO.toURI())) {
1182
                try {
1183
                    libEntryU = libEntryFO.getURL().toURI();
1184
                } catch (Exception x) {
1185
                    libEntryU = null;
1186
                }
1187
                if (libEntryU != null && CollocationQuery.areCollocated(libBaseFolder.toURI(), libEntryU)) {
1188
                    // if the jar/folder is in relation to the library folder (parent+child/same vcs)
1182
                    // if the jar/folder is in relation to the library folder (parent+child/same vcs)
1189
                    // don't replicate it but reference the original file.
1183
                    // don't replicate it but reference the original file.
1190
                    newFO = libEntryFO;
1184
                    newFO = libEntryFO;
(-)a/project.ant/src/org/netbeans/modules/project/ant/ProjectXMLCatalogReader.java (-6 / +1 lines)
 Lines 63-69    Link Here 
63
import org.netbeans.modules.xml.catalog.spi.CatalogListener;
63
import org.netbeans.modules.xml.catalog.spi.CatalogListener;
64
import org.netbeans.modules.xml.catalog.spi.CatalogReader;
64
import org.netbeans.modules.xml.catalog.spi.CatalogReader;
65
import org.openide.filesystems.FileObject;
65
import org.openide.filesystems.FileObject;
66
import org.openide.filesystems.FileStateInvalidException;
67
import org.openide.filesystems.FileUtil;
66
import org.openide.filesystems.FileUtil;
68
import org.openide.util.Exceptions;
67
import org.openide.util.Exceptions;
69
import org.openide.util.ImageUtilities;
68
import org.openide.util.ImageUtilities;
 Lines 96-106    Link Here 
96
        if (name.startsWith(PREFIX)) {
95
        if (name.startsWith(PREFIX)) {
97
            FileObject rsrc = FileUtil.getConfigFile(CATALOG + "/" + name.substring(PREFIX.length()) + "." + EXTENSION);
96
            FileObject rsrc = FileUtil.getConfigFile(CATALOG + "/" + name.substring(PREFIX.length()) + "." + EXTENSION);
98
            if (rsrc != null) {
97
            if (rsrc != null) {
99
                try {
98
                return rsrc.getURL().toString();
100
                    return rsrc.getURL().toString();
101
                } catch (FileStateInvalidException x) {
102
                    Exceptions.printStackTrace(x);
103
                }
104
            }
99
            }
105
        }
100
        }
106
        return null;
101
        return null;
(-)a/project.ant/src/org/netbeans/spi/project/support/ant/SourcesHelper.java (-6 / +2 lines)
 Lines 69-74    Link Here 
69
import org.netbeans.api.project.ProjectManager;
69
import org.netbeans.api.project.ProjectManager;
70
import org.netbeans.api.project.ProjectUtils;
70
import org.netbeans.api.project.ProjectUtils;
71
import org.netbeans.api.project.SourceGroup;
71
import org.netbeans.api.project.SourceGroup;
72
import org.netbeans.api.project.SourceGroupModifier;
72
import org.netbeans.api.project.Sources;
73
import org.netbeans.api.project.Sources;
73
import org.netbeans.api.queries.SharabilityQuery;
74
import org.netbeans.api.queries.SharabilityQuery;
74
import org.netbeans.modules.project.ant.AntBasedProjectFactorySingleton;
75
import org.netbeans.modules.project.ant.AntBasedProjectFactorySingleton;
 Lines 78-84    Link Here 
78
import org.openide.filesystems.FileEvent;
79
import org.openide.filesystems.FileEvent;
79
import org.openide.filesystems.FileObject;
80
import org.openide.filesystems.FileObject;
80
import org.openide.filesystems.FileRenameEvent;
81
import org.openide.filesystems.FileRenameEvent;
81
import org.openide.filesystems.FileStateInvalidException;
82
import org.openide.filesystems.FileUtil;
82
import org.openide.filesystems.FileUtil;
83
import org.openide.util.ChangeSupport;
83
import org.openide.util.ChangeSupport;
84
import org.openide.util.Parameters;
84
import org.openide.util.Parameters;
 Lines 1019-1029    Link Here 
1019
            // Remember what we computed here so we know whether to fire changes later.
1019
            // Remember what we computed here so we know whether to fire changes later.
1020
            List<URL> rootURLs = new ArrayList<URL>(groups.size());
1020
            List<URL> rootURLs = new ArrayList<URL>(groups.size());
1021
            for (SourceGroup g : groups) {
1021
            for (SourceGroup g : groups) {
1022
                try {
1022
                rootURLs.add(g.getRootFolder().getURL());
1023
                    rootURLs.add(g.getRootFolder().getURL());
1024
                } catch (FileStateInvalidException e) {
1025
                    assert false : e; // should be a valid file object!
1026
                }
1027
            }
1023
            }
1028
            lastComputedRoots.put(type, rootURLs);
1024
            lastComputedRoots.put(type, rootURLs);
1029
            return groups.toArray(new SourceGroup[groups.size()]);
1025
            return groups.toArray(new SourceGroup[groups.size()]);
(-)a/project.ant/test/unit/src/org/netbeans/spi/project/support/ant/ReferenceHelperTest.java (-3 / +3 lines)
 Lines 171-177    Link Here 
171
        assertNotNull("found ref helper for " + p, r);
171
        assertNotNull("found ref helper for " + p, r);
172
        sisterprojdir = FileUtil.createFolder(scratch, "proj2");
172
        sisterprojdir = FileUtil.createFolder(scratch, "proj2");
173
        assertTrue("projdir and sisterprojdir collocated",
173
        assertTrue("projdir and sisterprojdir collocated",
174
            CollocationQuery.areCollocated(projdir.getURL().toURI(), sisterprojdir.getURL().toURI()));
174
            CollocationQuery.areCollocated(projdir.toURI(), sisterprojdir.toURI()));
175
        sisterh = ProjectGenerator.createProject(sisterprojdir, "test");
175
        sisterh = ProjectGenerator.createProject(sisterprojdir, "test");
176
        setCodeNameOfTestProject(sisterh, "proj2");
176
        setCodeNameOfTestProject(sisterh, "proj2");
177
        EditableProperties props = sisterh.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH);
177
        EditableProperties props = sisterh.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH);
 Lines 183-189    Link Here 
183
        
183
        
184
        sisterprojdir2 = FileUtil.createFolder(scratch, "proj2-copy");
184
        sisterprojdir2 = FileUtil.createFolder(scratch, "proj2-copy");
185
        assertTrue("projdir and sisterprojdir2 collocated",
185
        assertTrue("projdir and sisterprojdir2 collocated",
186
            CollocationQuery.areCollocated(projdir.getURL().toURI(), sisterprojdir2.getURL().toURI()));
186
            CollocationQuery.areCollocated(projdir.toURI(), sisterprojdir2.toURI()));
187
        sisterh2 = ProjectGenerator.createProject(sisterprojdir2, "test");
187
        sisterh2 = ProjectGenerator.createProject(sisterprojdir2, "test");
188
        setCodeNameOfTestProject(sisterh2, "proj2");
188
        setCodeNameOfTestProject(sisterh2, "proj2");
189
        props = sisterh2.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH);
189
        props = sisterh2.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH);
 Lines 198-204    Link Here 
198
        // similarly as it is done for SampleCVSCollocationQueryImpl
198
        // similarly as it is done for SampleCVSCollocationQueryImpl
199
        // in META-INF/services.
199
        // in META-INF/services.
200
        assertFalse("" + projdir + " and " + sepprojdir + " cannot be collocated",
200
        assertFalse("" + projdir + " and " + sepprojdir + " cannot be collocated",
201
            CollocationQuery.areCollocated(projdir.getURL().toURI(), sepprojdir.getURL().toURI()));
201
            CollocationQuery.areCollocated(projdir.toURI(), sepprojdir.toURI()));
202
        seph = ProjectGenerator.createProject(sepprojdir, "test");
202
        seph = ProjectGenerator.createProject(sepprojdir, "test");
203
        setCodeNameOfTestProject(seph, "proj3");
203
        setCodeNameOfTestProject(seph, "proj3");
204
        props = seph.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH);
204
        props = seph.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH);
(-)a/projectapi/nbproject/project.xml (-1 / +1 lines)
 Lines 63-69    Link Here 
63
                    <build-prerequisite/>
63
                    <build-prerequisite/>
64
                    <compile-dependency/>
64
                    <compile-dependency/>
65
                    <run-dependency>
65
                    <run-dependency>
66
                        <specification-version>7.50</specification-version>
66
                        <specification-version>7.57</specification-version>
67
                    </run-dependency>
67
                    </run-dependency>
68
                </dependency>
68
                </dependency>
69
                <dependency>
69
                <dependency>
(-)a/projectapi/src/org/netbeans/api/project/ProjectUtils.java (-6 / +1 lines)
 Lines 67-73    Link Here 
67
import org.netbeans.spi.project.SubprojectProvider;
67
import org.netbeans.spi.project.SubprojectProvider;
68
import org.netbeans.spi.project.support.GenericSources;
68
import org.netbeans.spi.project.support.GenericSources;
69
import org.openide.filesystems.FileObject;
69
import org.openide.filesystems.FileObject;
70
import org.openide.filesystems.FileStateInvalidException;
71
import org.openide.filesystems.FileUtil;
70
import org.openide.filesystems.FileUtil;
72
import org.openide.util.ImageUtilities;
71
import org.openide.util.ImageUtilities;
73
import org.openide.util.Lookup;
72
import org.openide.util.Lookup;
 Lines 235-245    Link Here 
235
        }
234
        }
236
        
235
        
237
        public String getName() {
236
        public String getName() {
238
            try {
237
            return p.getProjectDirectory().getURL().toExternalForm();
239
                return p.getProjectDirectory().getURL().toExternalForm();
240
            } catch (FileStateInvalidException e) {
241
                return e.toString();
242
            }
243
        }
238
        }
244
        
239
        
245
        public String getDisplayName() {
240
        public String getDisplayName() {
(-)a/projectapi/src/org/netbeans/modules/projectapi/SimpleFileOwnerQueryImplementation.java (-16 / +4 lines)
 Lines 51-63    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.Collection;
55
import java.util.Collections;
54
import java.util.Collections;
56
import java.util.HashMap;
55
import java.util.HashMap;
57
import java.util.LinkedList;
58
import java.util.Map;
56
import java.util.Map;
59
import java.util.Set;
57
import java.util.Set;
60
import java.util.WeakHashMap;
61
import java.util.logging.Level;
58
import java.util.logging.Level;
62
import java.util.logging.Logger;
59
import java.util.logging.Logger;
63
import java.util.prefs.BackingStoreException;
60
import java.util.prefs.BackingStoreException;
 Lines 66-72    Link Here 
66
import org.netbeans.api.project.ProjectManager;
63
import org.netbeans.api.project.ProjectManager;
67
import org.netbeans.spi.project.FileOwnerQueryImplementation;
64
import org.netbeans.spi.project.FileOwnerQueryImplementation;
68
import org.openide.filesystems.FileObject;
65
import org.openide.filesystems.FileObject;
69
import org.openide.filesystems.FileStateInvalidException;
70
import org.openide.filesystems.URLMapper;
66
import org.openide.filesystems.URLMapper;
71
import org.openide.util.NbPreferences;
67
import org.openide.util.NbPreferences;
72
import org.openide.util.Utilities;
68
import org.openide.util.Utilities;
 Lines 146-152    Link Here 
146
            }
142
            }
147
            
143
            
148
            if (!externalOwners.isEmpty() && (folder || externalRootsIncludeNonFolders)) {
144
            if (!externalOwners.isEmpty() && (folder || externalRootsIncludeNonFolders)) {
149
                URI externalOwnersURI = externalOwners.get(fileObject2URI(f));
145
                URI externalOwnersURI = externalOwners.get(f.toURI());
150
146
151
                if (externalOwnersURI != null) {
147
                if (externalOwnersURI != null) {
152
                    FileObject externalOwner = uri2FileObject(externalOwnersURI);
148
                    FileObject externalOwner = uri2FileObject(externalOwnersURI);
 Lines 169-175    Link Here 
169
                }
165
                }
170
            }
166
            }
171
            if (!deserializedExternalOwners.isEmpty() && (folder || externalRootsIncludeNonFolders)) {
167
            if (!deserializedExternalOwners.isEmpty() && (folder || externalRootsIncludeNonFolders)) {
172
                FileObject externalOwner = deserializedExternalOwners.get(fileObject2URI(f));
168
                FileObject externalOwner = deserializedExternalOwners.get(f.toURI());
173
                if (externalOwner != null && externalOwner.isValid()) {
169
                if (externalOwner != null && externalOwner.isValid()) {
174
                    try {
170
                    try {
175
                        // Note: will be null if there is no such project.
171
                        // Note: will be null if there is no such project.
 Lines 241-257    Link Here 
241
        externalOwners.clear();
237
        externalOwners.clear();
242
    }
238
    }
243
    
239
    
244
    private static URI fileObject2URI(FileObject f) {
245
        try {
246
            return URI.create(f.getURL().toString());
247
        } catch (FileStateInvalidException e) {
248
            throw (IllegalArgumentException) new IllegalArgumentException(e.toString()).initCause(e);
249
        }
250
    }
251
    
252
    /** @see FileOwnerQuery#markExternalOwner */
240
    /** @see FileOwnerQuery#markExternalOwner */
253
    public static void markExternalOwnerTransient(FileObject root, Project owner) {
241
    public static void markExternalOwnerTransient(FileObject root, Project owner) {
254
        markExternalOwnerTransient(fileObject2URI(root), owner);
242
        markExternalOwnerTransient(root.toURI(), owner);
255
    }
243
    }
256
    
244
    
257
    /** @see FileOwnerQuery#markExternalOwner */
245
    /** @see FileOwnerQuery#markExternalOwner */
 Lines 259-265    Link Here 
259
        externalRootsIncludeNonFolders |= !root.getPath().endsWith("/");
247
        externalRootsIncludeNonFolders |= !root.getPath().endsWith("/");
260
        if (owner != null) {
248
        if (owner != null) {
261
            FileObject fo = owner.getProjectDirectory();
249
            FileObject fo = owner.getProjectDirectory();
262
            externalOwners.put(root, fileObject2URI(fo));
250
            externalOwners.put(root, fo.toURI());
263
            deserializedExternalOwners.remove(root);
251
            deserializedExternalOwners.remove(root);
264
        } else {
252
        } else {
265
            externalOwners.remove(root);
253
            externalOwners.remove(root);
(-)a/projectapi/test/unit/src/org/netbeans/modules/projectapi/FileOwnerCollocationQueryImplTest.java (-7 / +7 lines)
 Lines 74-80    Link Here 
74
        
74
        
75
        //root/prj1/foo
75
        //root/prj1/foo
76
        FileOwnerCollocationQueryImpl instance = new FileOwnerCollocationQueryImpl();
76
        FileOwnerCollocationQueryImpl instance = new FileOwnerCollocationQueryImpl();
77
        assertEquals(projdir.getURL().toURI(), instance.findRoot(projdir.createData("foo").getURL().toURI()));
77
        assertEquals(projdir.toURI(), instance.findRoot(projdir.createData("foo").toURI()));
78
        
78
        
79
        //root/prj2/foo/prj3/bar
79
        //root/prj2/foo/prj3/bar
80
        projdir = root.createFolder("prj2");
80
        projdir = root.createFolder("prj2");
 Lines 82-91    Link Here 
82
        projdir.createFolder("testproject");
82
        projdir.createFolder("testproject");
83
        projdir = projdir.createFolder("foo").createFolder("prj3");
83
        projdir = projdir.createFolder("foo").createFolder("prj3");
84
        projdir.createFolder("testproject");
84
        projdir.createFolder("testproject");
85
        assertEquals(expected.getURL().toURI(), instance.findRoot(projdir.createData("bar").getURL().toURI()));
85
        assertEquals(expected.toURI(), instance.findRoot(projdir.createData("bar").toURI()));
86
        
86
        
87
        //root
87
        //root
88
        assertEquals(null, instance.findRoot(root.getURL().toURI()));
88
        assertEquals(null, instance.findRoot(root.toURI()));
89
    }
89
    }
90
90
91
    /**
91
    /**
 Lines 101-114    Link Here 
101
        FileObject file1 = lib.createData("pron");
101
        FileObject file1 = lib.createData("pron");
102
        FileObject file2 = projdir.createData("xxx");
102
        FileObject file2 = projdir.createData("xxx");
103
        FileOwnerCollocationQueryImpl instance = new FileOwnerCollocationQueryImpl();
103
        FileOwnerCollocationQueryImpl instance = new FileOwnerCollocationQueryImpl();
104
        assertFalse(instance.areCollocated(file1.getURL().toURI(), file2.getURL().toURI()));
104
        assertFalse(instance.areCollocated(file1.toURI(), file2.toURI()));
105
        file1 = projdir.createData("pron");
105
        file1 = projdir.createData("pron");
106
        assertTrue(instance.areCollocated(file1.getURL().toURI(), file2.getURL().toURI()));
106
        assertTrue(instance.areCollocated(file1.toURI(), file2.toURI()));
107
        
107
        
108
        
108
        
109
        file1 = projdir;
109
        file1 = projdir;
110
        file2 = lib;
110
        file2 = lib;
111
        assertFalse(instance.areCollocated(file1.getURL().toURI(), file2.getURL().toURI()));
111
        assertFalse(instance.areCollocated(file1.toURI(), file2.toURI()));
112
        
112
        
113
        projdir = root.createFolder("noproj").createFolder("proj1");
113
        projdir = root.createFolder("noproj").createFolder("proj1");
114
        projdir.createFolder("testproject");
114
        projdir.createFolder("testproject");
 Lines 118-124    Link Here 
118
        file2 = projdir2.createData("bar");
118
        file2 = projdir2.createData("bar");
119
//        System.out.println("root1=" + instance.findRoot(file1.getURL().toURI()));
119
//        System.out.println("root1=" + instance.findRoot(file1.getURL().toURI()));
120
//        System.out.println("root2=" + instance.findRoot(file2.getURL().toURI()));
120
//        System.out.println("root2=" + instance.findRoot(file2.getURL().toURI()));
121
        assertFalse(instance.areCollocated(file1.getURL().toURI(), file2.getURL().toURI()));
121
        assertFalse(instance.areCollocated(file1.toURI(), file2.toURI()));
122
        
122
        
123
    }
123
    }
124
124
(-)a/queries/nbproject/project.xml (-1 / +1 lines)
 Lines 54-60    Link Here 
54
                    <build-prerequisite/>
54
                    <build-prerequisite/>
55
                    <compile-dependency/>
55
                    <compile-dependency/>
56
                    <run-dependency>
56
                    <run-dependency>
57
                        <specification-version>7.19</specification-version>
57
                        <specification-version>7.57</specification-version>
58
                    </run-dependency>
58
                    </run-dependency>
59
                </dependency>
59
                </dependency>
60
                <dependency>
60
                <dependency>
(-)a/queries/src/org/netbeans/api/queries/SharabilityQuery.java (-11 / +1 lines)
 Lines 46-57    Link Here 
46
46
47
import java.io.File;
47
import java.io.File;
48
import java.net.URI;
48
import java.net.URI;
49
import java.net.URISyntaxException;
50
import java.util.logging.Level;
51
import java.util.logging.Logger;
49
import java.util.logging.Logger;
52
import org.netbeans.spi.queries.SharabilityQueryImplementation2;
50
import org.netbeans.spi.queries.SharabilityQueryImplementation2;
53
import org.openide.filesystems.FileObject;
51
import org.openide.filesystems.FileObject;
54
import org.openide.filesystems.FileStateInvalidException;
55
import org.openide.filesystems.FileUtil;
52
import org.openide.filesystems.FileUtil;
56
import org.openide.util.Lookup;
53
import org.openide.util.Lookup;
57
import org.openide.util.Parameters;
54
import org.openide.util.Parameters;
 Lines 232-244    Link Here 
232
     * @since 1.27
229
     * @since 1.27
233
     */
230
     */
234
    public static Sharability getSharability(FileObject fo) {
231
    public static Sharability getSharability(FileObject fo) {
235
        try {
232
        return getSharability(fo.toURI());
236
            return getSharability(fo.getURL().toURI());
237
        } catch (URISyntaxException ex) {
238
            LOG.log(Level.FINE, null, ex);
239
        } catch (FileStateInvalidException ex) {
240
            LOG.log(Level.FINE, null, ex);
241
        }
242
        return Sharability.UNKNOWN;
243
    }
233
    }
244
}
234
}

Return to bug 207294
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo