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

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

(-)a/api.java.classpath/nbproject/project.xml (-1 / +1 lines)
Lines 43-49 Link Here
43
                    <build-prerequisite/>
43
                    <build-prerequisite/>
44
                    <compile-dependency/>
44
                    <compile-dependency/>
45
                    <run-dependency>
45
                    <run-dependency>
46
                        <specification-version>8.0</specification-version>
46
                        <specification-version>8.25</specification-version>
47
                    </run-dependency>
47
                    </run-dependency>
48
                </dependency>
48
                </dependency>
49
                <dependency>
49
                <dependency>
(-)a/api.java.classpath/src/org/netbeans/api/java/classpath/ClassPath.java (-2 / +2 lines)
Lines 311-317 Link Here
311
                    //todo: Ignore non file urls, we can try to url->fileobject->url
311
                    //todo: Ignore non file urls, we can try to url->fileobject->url
312
                    //if it becomes a file.
312
                    //if it becomes a file.
313
                    if ("file".equals(url.getProtocol())) { //NOI18N
313
                    if ("file".equals(url.getProtocol())) { //NOI18N
314
                        file = FileUtil.normalizeFile(new File(url.toURI()));
314
                        file = FileUtil.normalizeFile(Utilities.toFile(url.toURI()));
315
                    }
315
                    }
316
                } catch (IllegalArgumentException e) {
316
                } catch (IllegalArgumentException e) {
317
                    LOG.log(Level.WARNING, "Unexpected URL <{0}>: {1}", new Object[] {url, e});
317
                    LOG.log(Level.WARNING, "Unexpected URL <{0}>: {1}", new Object[] {url, e});
Lines 800-806 Link Here
800
                            } else {
800
                            } else {
801
                                String fileState = null;
801
                                String fileState = null;
802
                                try {
802
                                try {
803
                                    final File file = new File(this.url.toURI());
803
                                    final File file = Utilities.toFile(this.url.toURI());
804
                                    fileState = "(exists: " + file.exists() +           //NOI18N
804
                                    fileState = "(exists: " + file.exists() +           //NOI18N
805
                                                " file: " + file.isFile() +             //NOI18N
805
                                                " file: " + file.isFile() +             //NOI18N
806
                                                " directory: "+ file.isDirectory() +    //NOI18N
806
                                                " directory: "+ file.isDirectory() +    //NOI18N
(-)a/api.java.classpath/src/org/netbeans/modules/java/classpath/SimplePathResourceImplementation.java (-1 / +2 lines)
Lines 50-55 Link Here
50
import org.netbeans.spi.java.classpath.ClassPathImplementation;
50
import org.netbeans.spi.java.classpath.ClassPathImplementation;
51
51
52
import java.net.URL;
52
import java.net.URL;
53
import org.openide.util.Utilities;
53
54
54
55
55
/**
56
/**
Lines 91-97 Link Here
91
        if (rootS.matches("file:.+[.]jar/?")) {
92
        if (rootS.matches("file:.+[.]jar/?")) {
92
            boolean dir = false;
93
            boolean dir = false;
93
            try {
94
            try {
94
                dir = new File (root.toURI()).isDirectory();
95
                dir = Utilities.toFile(root.toURI()).isDirectory();
95
            } catch (URISyntaxException use) {
96
            } catch (URISyntaxException use) {
96
                //pass - handle as non dir
97
                //pass - handle as non dir
97
            }
98
            }
(-)a/api.java.classpath/test/unit/src/org/netbeans/api/java/classpath/ClassPathTest.java (-7 / +8 lines)
Lines 76-81 Link Here
76
import org.netbeans.spi.java.classpath.PathResourceImplementation;
76
import org.netbeans.spi.java.classpath.PathResourceImplementation;
77
import org.openide.filesystems.FileObject;
77
import org.openide.filesystems.FileObject;
78
import org.openide.filesystems.FileUtil;
78
import org.openide.filesystems.FileUtil;
79
import org.openide.util.Utilities;
79
80
80
public class ClassPathTest extends NbTestCase {
81
public class ClassPathTest extends NbTestCase {
81
82
Lines 228-239 Link Here
228
        assertNotNull("Cannot find file",FileUtil.toFileObject(root_3));
229
        assertNotNull("Cannot find file",FileUtil.toFileObject(root_3));
229
        TestClassPathImplementation impl = new TestClassPathImplementation();
230
        TestClassPathImplementation impl = new TestClassPathImplementation();
230
	ClassPath cp = ClassPathFactory.createClassPath (impl);
231
	ClassPath cp = ClassPathFactory.createClassPath (impl);
231
        impl.addResource(root_1.toURI().toURL());
232
        impl.addResource(Utilities.toURI(root_1).toURL());
232
        cp.addPropertyChangeListener (impl);
233
        cp.addPropertyChangeListener (impl);
233
        impl.addResource (root_2.toURI().toURL());
234
        impl.addResource (Utilities.toURI(root_2).toURL());
234
        impl.assertEvents(ClassPath.PROP_ENTRIES, ClassPath.PROP_ROOTS);
235
        impl.assertEvents(ClassPath.PROP_ENTRIES, ClassPath.PROP_ROOTS);
235
        assertTrue (cp.getRoots().length==2);
236
        assertTrue (cp.getRoots().length==2);
236
        impl.removeResource (root_2.toURI().toURL());
237
        impl.removeResource (Utilities.toURI(root_2).toURL());
237
        impl.assertEvents(ClassPath.PROP_ENTRIES, ClassPath.PROP_ROOTS);
238
        impl.assertEvents(ClassPath.PROP_ENTRIES, ClassPath.PROP_ROOTS);
238
        assertTrue (cp.getRoots().length==1);
239
        assertTrue (cp.getRoots().length==1);
239
        FileObject fo = cp.getRoots()[0];
240
        FileObject fo = cp.getRoots()[0];
Lines 296-302 Link Here
296
        cp.addPropertyChangeListener(impl);
297
        cp.addPropertyChangeListener(impl);
297
        File d = new File(getBaseDir(), "d");
298
        File d = new File(getBaseDir(), "d");
298
        d.mkdir();
299
        d.mkdir();
299
        pri.changeRoots(new URL[] {d.toURI().toURL()});
300
        pri.changeRoots(new URL[] {Utilities.toURI(d).toURL()});
300
        impl.assertEvents(ClassPath.PROP_ENTRIES, ClassPath.PROP_ROOTS);
301
        impl.assertEvents(ClassPath.PROP_ENTRIES, ClassPath.PROP_ROOTS);
301
        assertEquals(Collections.singletonList(FileUtil.toFileObject(d)), Arrays.asList(cp.getRoots()));
302
        assertEquals(Collections.singletonList(FileUtil.toFileObject(d)), Arrays.asList(cp.getRoots()));
302
    }
303
    }
Lines 609-615 Link Here
609
            final String path = tk.nextToken();
610
            final String path = tk.nextToken();
610
            final File f = FileUtil.normalizeFile(new File (path));
611
            final File f = FileUtil.normalizeFile(new File (path));
611
            if (f.canRead()) {
612
            if (f.canRead()) {
612
                roots.add(f.toURI().toURL());
613
                roots.add(Utilities.toURI(f).toURL());
613
            }
614
            }
614
        }
615
        }
615
        final ClassLoader bootLoader = new URLClassLoader(roots.toArray(new URL[roots.size()]), null);
616
        final ClassLoader bootLoader = new URLClassLoader(roots.toArray(new URL[roots.size()]), null);
Lines 624-630 Link Here
624
            if (!f.canRead()) {
625
            if (!f.canRead()) {
625
                continue;
626
                continue;
626
            }
627
            }
627
            URL url = f.toURI().toURL();
628
            URL url = Utilities.toURI(f).toURL();
628
            roots2.add(url);
629
            roots2.add(url);
629
            if (FileUtil.isArchiveFile(url)) {
630
            if (FileUtil.isArchiveFile(url)) {
630
                url = FileUtil.getArchiveRoot(url);
631
                url = FileUtil.getArchiveRoot(url);
Lines 739-745 Link Here
739
    }
740
    }
740
741
741
    public void testJVMPathConversion() throws Exception {
742
    public void testJVMPathConversion() throws Exception {
742
        String root = getWorkDir().toURI().toString();
743
        String root = Utilities.toURI(getWorkDir()).toString();
743
        ClassPath cp = ClassPathSupport.createClassPath(
744
        ClassPath cp = ClassPathSupport.createClassPath(
744
                new URL(root + "folder/"),
745
                new URL(root + "folder/"),
745
                new URL("jar:" + root + "file.zip!/"),
746
                new URL("jar:" + root + "file.zip!/"),
(-)a/api.java.classpath/test/unit/src/org/netbeans/api/java/queries/SourceForBinaryQueryTest.java (-4 / +5 lines)
Lines 64-69 Link Here
64
import org.openide.filesystems.FileObject;
64
import org.openide.filesystems.FileObject;
65
import org.openide.filesystems.FileUtil;
65
import org.openide.filesystems.FileUtil;
66
import org.openide.util.ChangeSupport;
66
import org.openide.util.ChangeSupport;
67
import org.openide.util.Utilities;
67
68
68
/**
69
/**
69
 *
70
 *
Lines 115-121 Link Here
115
        assertEquals(Collections.singletonList(sr2), Arrays.asList(res.getRoots()));
116
        assertEquals(Collections.singletonList(sr2), Arrays.asList(res.getRoots()));
116
        assertFalse(res.preferSources());
117
        assertFalse(res.preferSources());
117
        
118
        
118
        res = SourceForBinaryQuery.findSourceRoots2(getWorkDir().toURI().toURL());
119
        res = SourceForBinaryQuery.findSourceRoots2(Utilities.toURI(getWorkDir()).toURL());
119
        assertNotNull(res);
120
        assertNotNull(res);
120
        assertEquals(0, res.getRoots().length);
121
        assertEquals(0, res.getRoots().length);
121
        assertTrue(res.preferSources());        
122
        assertTrue(res.preferSources());        
Lines 135-141 Link Here
135
        assertEquals(Collections.singletonList(sr2), Arrays.asList(res.getRoots()));
136
        assertEquals(Collections.singletonList(sr2), Arrays.asList(res.getRoots()));
136
        assertTrue(res.preferSources());
137
        assertTrue(res.preferSources());
137
        
138
        
138
        res = SourceForBinaryQuery.findSourceRoots2(getWorkDir().toURI().toURL());
139
        res = SourceForBinaryQuery.findSourceRoots2(Utilities.toURI(getWorkDir()).toURL());
139
        assertNotNull(res);
140
        assertNotNull(res);
140
        assertEquals(0, res.getRoots().length);
141
        assertEquals(0, res.getRoots().length);
141
        assertTrue(res.preferSources());        
142
        assertTrue(res.preferSources());        
Lines 158-164 Link Here
158
        assertEquals(Collections.singletonList(sr2), Arrays.asList(res.getRoots()));
159
        assertEquals(Collections.singletonList(sr2), Arrays.asList(res.getRoots()));
159
        assertFalse(res.preferSources());
160
        assertFalse(res.preferSources());
160
        
161
        
161
        res = SourceForBinaryQuery.findSourceRoots2(getWorkDir().toURI().toURL());
162
        res = SourceForBinaryQuery.findSourceRoots2(Utilities.toURI(getWorkDir()).toURL());
162
        assertNotNull(res);
163
        assertNotNull(res);
163
        assertEquals(0, res.getRoots().length);
164
        assertEquals(0, res.getRoots().length);
164
        assertTrue(res.preferSources());        
165
        assertTrue(res.preferSources());        
Lines 181-187 Link Here
181
        assertEquals(Collections.singletonList(sr2), Arrays.asList(res.getRoots()));
182
        assertEquals(Collections.singletonList(sr2), Arrays.asList(res.getRoots()));
182
        assertTrue(res.preferSources());
183
        assertTrue(res.preferSources());
183
        
184
        
184
        res = SourceForBinaryQuery.findSourceRoots2(getWorkDir().toURI().toURL());
185
        res = SourceForBinaryQuery.findSourceRoots2(Utilities.toURI(getWorkDir()).toURL());
185
        assertNotNull(res);
186
        assertNotNull(res);
186
        assertEquals(0, res.getRoots().length);
187
        assertEquals(0, res.getRoots().length);
187
        assertTrue(res.preferSources());                
188
        assertTrue(res.preferSources());                
(-)a/api.java.classpath/test/unit/src/org/netbeans/modules/java/classpath/SimplePathResourceImplementationTest.java (-1 / +2 lines)
Lines 45-50 Link Here
45
import java.io.File;
45
import java.io.File;
46
import java.net.URL;
46
import java.net.URL;
47
import org.netbeans.junit.NbTestCase;
47
import org.netbeans.junit.NbTestCase;
48
import org.openide.util.Utilities;
48
49
49
/**
50
/**
50
 *
51
 *
Lines 101-107 Link Here
101
            final File wd = getWorkDir();
102
            final File wd = getWorkDir();
102
            final File strangeFolder = new File(wd,"strange.jar");  //NOI18N
103
            final File strangeFolder = new File(wd,"strange.jar");  //NOI18N
103
            strangeFolder.mkdirs();
104
            strangeFolder.mkdirs();
104
            SimplePathResourceImplementation.verify(strangeFolder.toURI().toURL(),null);
105
            SimplePathResourceImplementation.verify(Utilities.toURI(strangeFolder).toURL(),null);
105
        } catch (IllegalArgumentException e) {
106
        } catch (IllegalArgumentException e) {
106
            assertTrue("Verify should not fail for .jar folder",false);
107
            assertTrue("Verify should not fail for .jar folder",false);
107
        }
108
        }
(-)a/apisupport.ant/nbproject/project.xml (-1 / +1 lines)
Lines 308-314 Link Here
308
                    <build-prerequisite/>
308
                    <build-prerequisite/>
309
                    <compile-dependency/>
309
                    <compile-dependency/>
310
                    <run-dependency>
310
                    <run-dependency>
311
                        <specification-version>8.14</specification-version>
311
                        <specification-version>8.25</specification-version>
312
                    </run-dependency>
312
                    </run-dependency>
313
                </dependency>
313
                </dependency>
314
                <dependency>
314
                <dependency>
(-)a/apisupport.ant/src/org/netbeans/modules/apisupport/project/NbModuleProject.java (-1 / +2 lines)
Lines 136-141 Link Here
136
import org.openide.util.Lookup;
136
import org.openide.util.Lookup;
137
import org.openide.util.Mutex;
137
import org.openide.util.Mutex;
138
import org.openide.util.NbBundle.Messages;
138
import org.openide.util.NbBundle.Messages;
139
import org.openide.util.Utilities;
139
import org.openide.util.lookup.AbstractLookup;
140
import org.openide.util.lookup.AbstractLookup;
140
import org.openide.util.lookup.InstanceContent;
141
import org.openide.util.lookup.InstanceContent;
141
import org.openide.xml.XMLUtil;
142
import org.openide.xml.XMLUtil;
Lines 535-541 Link Here
535
                URL[] roots = platform.getSourceRoots();
536
                URL[] roots = platform.getSourceRoots();
536
                for (int i = 0; i < roots.length; i++) {
537
                for (int i = 0; i < roots.length; i++) {
537
                    if (roots[i].getProtocol().equals("file")) { // NOI18N
538
                    if (roots[i].getProtocol().equals("file")) { // NOI18N
538
                        File f = new File(URI.create(roots[i].toExternalForm()));
539
                        File f = Utilities.toFile(URI.create(roots[i].toExternalForm()));
539
                        if (ModuleList.isNetBeansOrg(f)) {
540
                        if (ModuleList.isNetBeansOrg(f)) {
540
                            return f;
541
                            return f;
541
                        }
542
                        }
(-)a/apisupport.ant/src/org/netbeans/modules/apisupport/project/NbModuleProviderImpl.java (-1 / +2 lines)
Lines 73-78 Link Here
73
import org.openide.filesystems.FileUtil;
73
import org.openide.filesystems.FileUtil;
74
import org.openide.filesystems.XMLFileSystem;
74
import org.openide.filesystems.XMLFileSystem;
75
import org.openide.modules.SpecificationVersion;
75
import org.openide.modules.SpecificationVersion;
76
import org.openide.util.Utilities;
76
77
77
class NbModuleProviderImpl implements NbModuleProvider {
78
class NbModuleProviderImpl implements NbModuleProvider {
78
79
Lines 196-202 Link Here
196
                if (layer != null) {
197
                if (layer != null) {
197
                    File layerXml = new File(getClassesDirectory(), layer);
198
                    File layerXml = new File(getClassesDirectory(), layer);
198
                    if (layerXml.isFile()) {
199
                    if (layerXml.isFile()) {
199
                        otherLayerURLs.add(layerXml.toURI().toURL());
200
                        otherLayerURLs.add(Utilities.toURI(layerXml).toURL());
200
                    }
201
                    }
201
                }
202
                }
202
                // TODO cache
203
                // TODO cache
(-)a/apisupport.ant/src/org/netbeans/modules/apisupport/project/queries/AntArtifactProviderImpl.java (-1 / +2 lines)
Lines 55-60 Link Here
55
import org.netbeans.spi.project.support.ant.AntProjectHelper;
55
import org.netbeans.spi.project.support.ant.AntProjectHelper;
56
import org.netbeans.spi.project.support.ant.PropertyEvaluator;
56
import org.netbeans.spi.project.support.ant.PropertyEvaluator;
57
import org.netbeans.spi.project.support.ant.PropertyUtils;
57
import org.netbeans.spi.project.support.ant.PropertyUtils;
58
import org.openide.util.Utilities;
58
59
59
/**
60
/**
60
 * Provide the module JAR as an exported artifact that other projects could import.
61
 * Provide the module JAR as an exported artifact that other projects could import.
Lines 104-110 Link Here
104
                    throw new AssertionError(e);
105
                    throw new AssertionError(e);
105
                }
106
                }
106
            } else {
107
            } else {
107
                return new URI[] {jar.toURI()};
108
                return new URI[] {Utilities.toURI(jar)};
108
            }
109
            }
109
            // XXX should it add in class path extensions?
110
            // XXX should it add in class path extensions?
110
        }
111
        }
(-)a/apisupport.ant/src/org/netbeans/modules/apisupport/project/queries/BinaryForSourceImpl.java (-6 / +7 lines)
Lines 57-62 Link Here
57
import org.openide.filesystems.FileObject;
57
import org.openide.filesystems.FileObject;
58
import org.openide.util.Exceptions;
58
import org.openide.util.Exceptions;
59
import org.openide.util.Parameters;
59
import org.openide.util.Parameters;
60
import org.openide.util.Utilities;
60
61
61
/**
62
/**
62
 *
63
 *
Lines 84-97 Link Here
84
                //Try project sources
85
                //Try project sources
85
                final FileObject srcDir = project.getSourceDirectory();                
86
                final FileObject srcDir = project.getSourceDirectory();                
86
                if (srcDir != null && srcDir.toURI().equals(key)) {
87
                if (srcDir != null && srcDir.toURI().equals(key)) {
87
                    binRoot = project.getClassesDirectory().toURI().toURL();
88
                    binRoot = Utilities.toURI(project.getClassesDirectory()).toURL();
88
                }
89
                }
89
                
90
                
90
                //Try project generated sources
91
                //Try project generated sources
91
                if (binRoot == null) {
92
                if (binRoot == null) {
92
                    final File genSrcDir = project.getGeneratedClassesDirectory();
93
                    final File genSrcDir = project.getGeneratedClassesDirectory();
93
                    if (genSrcDir != null && genSrcDir.toURI().equals(key)) {
94
                    if (genSrcDir != null && Utilities.toURI(genSrcDir).equals(key)) {
94
                        binRoot = project.getClassesDirectory().toURI().toURL();
95
                        binRoot = Utilities.toURI(project.getClassesDirectory()).toURL();
95
                    }
96
                    }
96
                }
97
                }
97
                
98
                
Lines 100-111 Link Here
100
                    for (final String testKind : project.supportedTestTypes()) {
101
                    for (final String testKind : project.supportedTestTypes()) {
101
                        final FileObject testSrcDir = project.getTestSourceDirectory(testKind);
102
                        final FileObject testSrcDir = project.getTestSourceDirectory(testKind);
102
                        if (testSrcDir != null && testSrcDir.toURI().equals(key)) {
103
                        if (testSrcDir != null && testSrcDir.toURI().equals(key)) {
103
                            binRoot = project.getTestClassesDirectory(testKind).toURI().toURL();
104
                            binRoot = Utilities.toURI(project.getTestClassesDirectory(testKind)).toURL();
104
                            break;
105
                            break;
105
                        }
106
                        }
106
                        final File testGenSrcDir = project.getTestGeneratedClassesDirectory(testKind);
107
                        final File testGenSrcDir = project.getTestGeneratedClassesDirectory(testKind);
107
                        if (testGenSrcDir != null && testGenSrcDir.toURI().equals(key)) {
108
                        if (testGenSrcDir != null && Utilities.toURI(testGenSrcDir).equals(key)) {
108
                            binRoot = project.getTestClassesDirectory(testKind).toURI().toURL();
109
                            binRoot = Utilities.toURI(project.getTestClassesDirectory(testKind)).toURL();
109
                            break;
110
                            break;
110
                        }
111
                        }
111
                    }
112
                    }
(-)a/apisupport.ant/src/org/netbeans/modules/apisupport/project/queries/GlobalJavadocForBinaryImpl.java (-1 / +2 lines)
Lines 70-75 Link Here
70
import org.netbeans.spi.java.queries.JavadocForBinaryQueryImplementation;
70
import org.netbeans.spi.java.queries.JavadocForBinaryQueryImplementation;
71
import org.openide.filesystems.FileUtil;
71
import org.openide.filesystems.FileUtil;
72
import org.openide.filesystems.URLMapper;
72
import org.openide.filesystems.URLMapper;
73
import org.openide.util.Utilities;
73
import org.openide.util.lookup.ServiceProvider;
74
import org.openide.util.lookup.ServiceProvider;
74
75
75
/**
76
/**
Lines 98-104 Link Here
98
            Util.err.log(binaryRoot + " is not an archive file."); // NOI18N
99
            Util.err.log(binaryRoot + " is not an archive file."); // NOI18N
99
            return null;
100
            return null;
100
        }
101
        }
101
        File binaryRootF = new File(URI.create(jar.toExternalForm()));
102
        File binaryRootF = Utilities.toFile(URI.create(jar.toExternalForm()));
102
        // XXX this will only work for modules following regular naming conventions:
103
        // XXX this will only work for modules following regular naming conventions:
103
        String n = binaryRootF.getName();
104
        String n = binaryRootF.getName();
104
        if (!n.endsWith(".jar")) { // NOI18N
105
        if (!n.endsWith(".jar")) { // NOI18N
(-)a/apisupport.ant/src/org/netbeans/modules/apisupport/project/queries/GlobalSourceForBinaryImpl.java (-2 / +3 lines)
Lines 77-82 Link Here
77
import org.openide.filesystems.FileUtil;
77
import org.openide.filesystems.FileUtil;
78
import org.openide.filesystems.URLMapper;
78
import org.openide.filesystems.URLMapper;
79
import org.openide.util.ChangeSupport;
79
import org.openide.util.ChangeSupport;
80
import org.openide.util.Utilities;
80
import org.openide.xml.XMLUtil;
81
import org.openide.xml.XMLUtil;
81
import org.w3c.dom.Document;
82
import org.w3c.dom.Document;
82
import org.w3c.dom.Element;
83
import org.w3c.dom.Element;
Lines 132-138 Link Here
132
            String cnb = name.substring(0, name.length() - 4).replace('-', '.');
133
            String cnb = name.substring(0, name.length() - 4).replace('-', '.');
133
            NbPlatform supposedPlaf = null;
134
            NbPlatform supposedPlaf = null;
134
            for (NbPlatform plaf : NbPlatform.getPlatformsOrNot()) {
135
            for (NbPlatform plaf : NbPlatform.getPlatformsOrNot()) {
135
                String plafS = plaf.getDestDir().toURI().toURL().toExternalForm();
136
                String plafS = Utilities.toURI(plaf.getDestDir()).toURL().toExternalForm();
136
                Matcher m = Pattern.compile("jar:\\Q" + plafS + "\\E[^/]+/(?:modules|lib|core)/([^/]+)[.]jar!/").matcher(binaryRootS);
137
                Matcher m = Pattern.compile("jar:\\Q" + plafS + "\\E[^/]+/(?:modules|lib|core)/([^/]+)[.]jar!/").matcher(binaryRootS);
137
                if (m.matches()) {
138
                if (m.matches()) {
138
                    supposedPlaf = plaf;
139
                    supposedPlaf = plaf;
Lines 235-241 Link Here
235
        @Override
236
        @Override
236
        protected String resolveRelativePath(URL sourceRoot) throws IOException {
237
        protected String resolveRelativePath(URL sourceRoot) throws IOException {
237
            // TODO C.P cache root + cnb -> relpath? dig into library wrappers?
238
            // TODO C.P cache root + cnb -> relpath? dig into library wrappers?
238
            File srPath = new File(URI.create(sourceRoot.toExternalForm()));
239
            File srPath = Utilities.toFile(URI.create(sourceRoot.toExternalForm()));
239
            File moduleSrc = new File(srPath, "src");    // NOI18N
240
            File moduleSrc = new File(srPath, "src");    // NOI18N
240
            if (moduleSrc.exists()) {   // src root is module project root directly
241
            if (moduleSrc.exists()) {   // src root is module project root directly
241
                return "src/";    // NOI18N
242
                return "src/";    // NOI18N
(-)a/apisupport.ant/src/org/netbeans/modules/apisupport/project/queries/JavadocForBinaryImpl.java (-1 / +2 lines)
Lines 60-65 Link Here
60
import org.netbeans.spi.java.queries.JavadocForBinaryQueryImplementation;
60
import org.netbeans.spi.java.queries.JavadocForBinaryQueryImplementation;
61
import org.openide.filesystems.FileUtil;
61
import org.openide.filesystems.FileUtil;
62
import org.openide.filesystems.URLMapper;
62
import org.openide.filesystems.URLMapper;
63
import org.openide.util.Utilities;
63
64
64
/**
65
/**
65
 * Defines Javadoc locations for built modules with built javadoc.
66
 * Defines Javadoc locations for built modules with built javadoc.
Lines 134-140 Link Here
134
        URL jar = FileUtil.getArchiveFile(binaryRoot);
135
        URL jar = FileUtil.getArchiveFile(binaryRoot);
135
        if (jar == null)
136
        if (jar == null)
136
            return null;    // not a class-path-extension
137
            return null;    // not a class-path-extension
137
        File binaryRootF = new File(URI.create(jar.toExternalForm()));
138
        File binaryRootF = Utilities.toFile(URI.create(jar.toExternalForm()));
138
        // XXX this will only work for modules following regular naming conventions:
139
        // XXX this will only work for modules following regular naming conventions:
139
        String n = binaryRootF.getName();
140
        String n = binaryRootF.getName();
140
        if (!n.endsWith(".jar")) { // NOI18N
141
        if (!n.endsWith(".jar")) { // NOI18N
(-)a/apisupport.ant/src/org/netbeans/modules/apisupport/project/queries/ModuleProjectClassPathExtender.java (-1 / +2 lines)
Lines 69-74 Link Here
69
import org.openide.filesystems.FileUtil;
69
import org.openide.filesystems.FileUtil;
70
import org.openide.util.Exceptions;
70
import org.openide.util.Exceptions;
71
import org.openide.util.NbBundle;
71
import org.openide.util.NbBundle;
72
import org.openide.util.Utilities;
72
73
73
/**
74
/**
74
 * Adds module dependencies that seem to correspond to some more visible artifact.
75
 * Adds module dependencies that seem to correspond to some more visible artifact.
Lines 199-205 Link Here
199
        // XXX handle >1 args
200
        // XXX handle >1 args
200
        String displayName = artifactElements.length > 0 ? artifactElements[0].toString() : "<nothing>";
201
        String displayName = artifactElements.length > 0 ? artifactElements[0].toString() : "<nothing>";
201
        if (artifactElements.length > 0 && "file".equals(artifactElements[0].getScheme())) { // NOI18N
202
        if (artifactElements.length > 0 && "file".equals(artifactElements[0].getScheme())) { // NOI18N
202
            displayName = new File(artifactElements[0]).getAbsolutePath();
203
            displayName = Utilities.toFile(artifactElements[0]).getAbsolutePath();
203
        }
204
        }
204
        Exceptions.attachLocalizedMessage(e, NbBundle.getMessage(ModuleProjectClassPathExtender.class, "ERR_jar", displayName));
205
        Exceptions.attachLocalizedMessage(e, NbBundle.getMessage(ModuleProjectClassPathExtender.class, "ERR_jar", displayName));
205
        throw e;
206
        throw e;
(-)a/apisupport.ant/src/org/netbeans/modules/apisupport/project/queries/SubprojectProviderImpl.java (-1 / +2 lines)
Lines 66-71 Link Here
66
import org.openide.ErrorManager;
66
import org.openide.ErrorManager;
67
import org.openide.filesystems.FileObject;
67
import org.openide.filesystems.FileObject;
68
import org.openide.filesystems.FileUtil;
68
import org.openide.filesystems.FileUtil;
69
import org.openide.util.Utilities;
69
import org.openide.xml.XMLUtil;
70
import org.openide.xml.XMLUtil;
70
import org.w3c.dom.Element;
71
import org.w3c.dom.Element;
71
72
Lines 163-169 Link Here
163
                    continue;
164
                    continue;
164
                }
165
                }
165
                File jar = project.getHelper().resolveFile(piece);
166
                File jar = project.getHelper().resolveFile(piece);
166
                Project owner = FileOwnerQuery.getOwner(jar.toURI());
167
                Project owner = FileOwnerQuery.getOwner(Utilities.toURI(jar));
167
                if (owner != null) {
168
                if (owner != null) {
168
                    s.add(owner);
169
                    s.add(owner);
169
                }
170
                }
(-)a/apisupport.ant/src/org/netbeans/modules/apisupport/project/queries/UnitTestForSourceQueryImpl.java (-2 / +3 lines)
Lines 57-62 Link Here
57
import org.netbeans.spi.java.queries.MultipleRootsUnitTestForSourceQueryImplementation;
57
import org.netbeans.spi.java.queries.MultipleRootsUnitTestForSourceQueryImplementation;
58
import org.netbeans.spi.project.support.ant.AntProjectHelper;
58
import org.netbeans.spi.project.support.ant.AntProjectHelper;
59
import org.openide.filesystems.FileObject;
59
import org.openide.filesystems.FileObject;
60
import org.openide.util.Utilities;
60
61
61
public class UnitTestForSourceQueryImpl implements MultipleRootsUnitTestForSourceQueryImplementation {
62
public class UnitTestForSourceQueryImpl implements MultipleRootsUnitTestForSourceQueryImplementation {
62
63
Lines 92-98 Link Here
92
            File f = helper.resolveFile(val);
93
            File f = helper.resolveFile(val);
93
            if (! f.exists()) {
94
            if (! f.exists()) {
94
                // #143633: need not to exist, ensure proper URI ending with a slash
95
                // #143633: need not to exist, ensure proper URI ending with a slash
95
                URI u = f.toURI();
96
                URI u = Utilities.toURI(f);
96
                String path = u.getPath();
97
                String path = u.getPath();
97
                if (! path.endsWith("/"))
98
                if (! path.endsWith("/"))
98
                    path = path.concat("/");
99
                    path = path.concat("/");
Lines 105-111 Link Here
105
                }
106
                }
106
            }
107
            }
107
108
108
            return new URL[] {f.toURI().toURL()};
109
            return new URL[] {Utilities.toURI(f).toURL()};
109
        } catch (MalformedURLException e) {
110
        } catch (MalformedURLException e) {
110
            throw new AssertionError(e);
111
            throw new AssertionError(e);
111
        }
112
        }
(-)a/apisupport.ant/src/org/netbeans/modules/apisupport/project/queries/UpdateTrackingFileOwnerQuery.java (-1 / +2 lines)
Lines 57-62 Link Here
57
import org.openide.ErrorManager;
57
import org.openide.ErrorManager;
58
import org.openide.filesystems.FileObject;
58
import org.openide.filesystems.FileObject;
59
import org.openide.filesystems.FileUtil;
59
import org.openide.filesystems.FileUtil;
60
import org.openide.util.Utilities;
60
61
61
/**
62
/**
62
 * Associated built module files with their owning project.
63
 * Associated built module files with their owning project.
Lines 73-79 Link Here
73
            return null; // #65700
74
            return null; // #65700
74
        }
75
        }
75
        if (file.getScheme().equals("file")) { // NOI18N
76
        if (file.getScheme().equals("file")) { // NOI18N
76
            return getOwner(new File(file));
77
            return getOwner(Utilities.toFile(file));
77
        } else {
78
        } else {
78
            return null;
79
            return null;
79
        }
80
        }
(-)a/apisupport.ant/src/org/netbeans/modules/apisupport/project/universe/ClusterUtils.java (-1 / +2 lines)
Lines 62-67 Link Here
62
import org.netbeans.modules.apisupport.project.ui.customizer.SuiteProperties;
62
import org.netbeans.modules.apisupport.project.ui.customizer.SuiteProperties;
63
import org.netbeans.spi.project.support.ant.PropertyEvaluator;
63
import org.netbeans.spi.project.support.ant.PropertyEvaluator;
64
import org.netbeans.spi.project.support.ant.PropertyUtils;
64
import org.netbeans.spi.project.support.ant.PropertyUtils;
65
import org.openide.util.Utilities;
65
66
66
/**
67
/**
67
 * Utility methods for cluster-related tasks.
68
 * Utility methods for cluster-related tasks.
Lines 183-189 Link Here
183
            File cd = evaluateClusterPathEntry(path, root, eval, nbPlatformRoot);
184
            File cd = evaluateClusterPathEntry(path, root, eval, nbPlatformRoot);
184
            boolean isPlaf = cd.getParentFile().equals(nbPlatformRoot);
185
            boolean isPlaf = cd.getParentFile().equals(nbPlatformRoot);
185
            Project prj = null;
186
            Project prj = null;
186
            Project _prj = FileOwnerQuery.getOwner(cd.toURI());
187
            Project _prj = FileOwnerQuery.getOwner(Utilities.toURI(cd));
187
            if (_prj != null) {
188
            if (_prj != null) {
188
                // Must be actual cluster output of a suite or standalone module to qualify. See also: #168804, #180475
189
                // Must be actual cluster output of a suite or standalone module to qualify. See also: #168804, #180475
189
                SuiteProvider prov = _prj.getLookup().lookup(SuiteProvider.class);
190
                SuiteProvider prov = _prj.getLookup().lookup(SuiteProvider.class);
(-)a/apisupport.ant/src/org/netbeans/modules/apisupport/project/universe/ModuleList.java (-3 / +4 lines)
Lines 88-93 Link Here
88
import org.openide.util.MutexException;
88
import org.openide.util.MutexException;
89
import org.openide.util.NbBundle.Messages;
89
import org.openide.util.NbBundle.Messages;
90
import org.openide.util.NbCollections;
90
import org.openide.util.NbCollections;
91
import org.openide.util.Utilities;
91
import org.openide.xml.EntityCatalog;
92
import org.openide.xml.EntityCatalog;
92
import org.openide.xml.XMLUtil;
93
import org.openide.xml.XMLUtil;
93
import org.w3c.dom.Document;
94
import org.w3c.dom.Document;
Lines 965-971 Link Here
965
                String res;
966
                String res;
966
                Document doc;
967
                Document doc;
967
                try {
968
                try {
968
                    doc = XMLUtil.parse(new InputSource(xml.toURI().toString()), false, false, null, EntityCatalog.getDefault());
969
                    doc = XMLUtil.parse(new InputSource(Utilities.toURI(xml).toString()), false, false, null, EntityCatalog.getDefault());
969
                    if (xpe == null) {
970
                    if (xpe == null) {
970
                        xpe = XPathFactory.newInstance().newXPath().compile("module/param[@name='jar']/text()");
971
                        xpe = XPathFactory.newInstance().newXPath().compile("module/param[@name='jar']/text()");
971
                    }
972
                    }
Lines 999-1005 Link Here
999
            try {
1000
            try {
1000
                xmlFilesParsed++;
1001
                xmlFilesParsed++;
1001
                timeSpentInXmlParsing -= System.currentTimeMillis();
1002
                timeSpentInXmlParsing -= System.currentTimeMillis();
1002
                doc = XMLUtil.parse(new InputSource(tracking.toURI().toString()), false, false, null, null);
1003
                doc = XMLUtil.parse(new InputSource(Utilities.toURI(tracking).toString()), false, false, null, null);
1003
                timeSpentInXmlParsing += System.currentTimeMillis();
1004
                timeSpentInXmlParsing += System.currentTimeMillis();
1004
            } catch (SAXException e) {
1005
            } catch (SAXException e) {
1005
                throw (IOException) new IOException(e.toString()).initCause(e);
1006
                throw (IOException) new IOException(e.toString()).initCause(e);
Lines 1038-1044 Link Here
1038
        try {
1039
        try {
1039
            xmlFilesParsed++;
1040
            xmlFilesParsed++;
1040
            timeSpentInXmlParsing -= System.currentTimeMillis();
1041
            timeSpentInXmlParsing -= System.currentTimeMillis();
1041
            doc = XMLUtil.parse(new InputSource(projectXml.toURI().toString()), false, true, null, null);
1042
            doc = XMLUtil.parse(new InputSource(Utilities.toURI(projectXml).toString()), false, true, null, null);
1042
            timeSpentInXmlParsing += System.currentTimeMillis();
1043
            timeSpentInXmlParsing += System.currentTimeMillis();
1043
        } catch (SAXException e) {
1044
        } catch (SAXException e) {
1044
            throw (IOException) new IOException(projectXml + ": " + e.toString()).initCause(e); // NOI18N
1045
            throw (IOException) new IOException(projectXml + ": " + e.toString()).initCause(e); // NOI18N
(-)a/apisupport.ant/src/org/netbeans/modules/apisupport/project/universe/NbPlatform.java (-1 / +2 lines)
Lines 86-91 Link Here
86
import org.openide.util.MutexException;
86
import org.openide.util.MutexException;
87
import org.openide.util.NbBundle;
87
import org.openide.util.NbBundle;
88
import org.openide.util.NbBundle.Messages;
88
import org.openide.util.NbBundle.Messages;
89
import org.openide.util.Utilities;
89
90
90
/**
91
/**
91
 * Represents one NetBeans platform, i.e. installation of the NB platform or IDE
92
 * Represents one NetBeans platform, i.e. installation of the NB platform or IDE
Lines 657-663 Link Here
657
        File loc = getDestDir();
658
        File loc = getDestDir();
658
        if (loc.getName().equals("netbeans") && loc.getParentFile().getName().equals("nbbuild")) { // NOI18N
659
        if (loc.getName().equals("netbeans") && loc.getParentFile().getName().equals("nbbuild")) { // NOI18N
659
            try {
660
            try {
660
                defaultSourceRoots = new URL[] {loc.getParentFile().getParentFile().toURI().toURL()};
661
                defaultSourceRoots = new URL[] {Utilities.toURI(loc.getParentFile().getParentFile()).toURL()};
661
            } catch (MalformedURLException e) {
662
            } catch (MalformedURLException e) {
662
                assert false : e;
663
                assert false : e;
663
            }
664
            }
(-)a/apisupport.ant/src/org/netbeans/modules/apisupport/project/universe/PlatformLayersCacheManager.java (-1 / +2 lines)
Lines 83-88 Link Here
83
import org.openide.util.NbBundle.Messages;
83
import org.openide.util.NbBundle.Messages;
84
import org.openide.util.Parameters;
84
import org.openide.util.Parameters;
85
import org.openide.util.RequestProcessor;
85
import org.openide.util.RequestProcessor;
86
import org.openide.util.Utilities;
86
87
87
/**
88
/**
88
 *
89
 *
Lines 507-513 Link Here
507
            }
508
            }
508
            List<URL> urll = new ArrayList<URL>(2);
509
            List<URL> urll = new ArrayList<URL>(2);
509
            try {
510
            try {
510
                URI juri = jar.toURI();
511
                URI juri = Utilities.toURI(jar);
511
                if (layer != null) {
512
                if (layer != null) {
512
                    urll.add(new URL("jar:" + juri + "!/" + layer));
513
                    urll.add(new URL("jar:" + juri + "!/" + layer));
513
514
(-)a/apisupport.ant/src/org/netbeans/modules/apisupport/project/universe/SourceRootsSupport.java (-1 / +2 lines)
Lines 54-59 Link Here
54
import java.util.List;
54
import java.util.List;
55
import org.netbeans.modules.apisupport.project.api.Util;
55
import org.netbeans.modules.apisupport.project.api.Util;
56
import org.openide.ErrorManager;
56
import org.openide.ErrorManager;
57
import org.openide.util.Utilities;
57
58
58
59
59
/**
60
/**
Lines 124-130 Link Here
124
                if (!u.getProtocol().equals("file")) { // NOI18N
125
                if (!u.getProtocol().equals("file")) { // NOI18N
125
                    continue;
126
                    continue;
126
                }
127
                }
127
                File dir = new File(URI.create(u.toExternalForm()));
128
                File dir = Utilities.toFile(URI.create(u.toExternalForm()));
128
                if (dir.isDirectory()) {
129
                if (dir.isDirectory()) {
129
                    try {
130
                    try {
130
                        if (ModuleList.isNetBeansOrg(dir)) {
131
                        if (ModuleList.isNetBeansOrg(dir)) {
(-)a/apisupport.ant/src/org/netbeans/modules/apisupport/project/universe/TestEntry.java (-1 / +2 lines)
Lines 57-62 Link Here
57
import org.netbeans.spi.project.SubprojectProvider;
57
import org.netbeans.spi.project.SubprojectProvider;
58
import org.openide.filesystems.FileObject;
58
import org.openide.filesystems.FileObject;
59
import org.openide.filesystems.FileUtil;
59
import org.openide.filesystems.FileUtil;
60
import org.openide.util.Utilities;
60
61
61
/**
62
/**
62
 * Representation of jarfile with tests 
63
 * Representation of jarfile with tests 
Lines 130-136 Link Here
130
    public URL getSrcDir() throws IOException {
131
    public URL getSrcDir() throws IOException {
131
        String nborgPath = getNetBeansOrgPath();
132
        String nborgPath = getNetBeansOrgPath();
132
        if (nborgPath != null) {
133
        if (nborgPath != null) {
133
            return new File(getNBRoot(),nborgPath).toURI().toURL(); 
134
            return Utilities.toURI(new File(getNBRoot(),nborgPath)).toURL();
134
        }
135
        }
135
        File prjDir = getTestDistRoot();
136
        File prjDir = getTestDistRoot();
136
        if (prjDir == null)
137
        if (prjDir == null)
(-)a/apisupport.ant/test/unit/src/org/netbeans/modules/apisupport/project/ProjectXMLManagerTest.java (-1 / +2 lines)
Lines 83-88 Link Here
83
import org.xml.sax.SAXException;
83
import org.xml.sax.SAXException;
84
import static org.netbeans.modules.apisupport.project.universe.TestModuleDependency.UNIT;
84
import static org.netbeans.modules.apisupport.project.universe.TestModuleDependency.UNIT;
85
import static org.netbeans.modules.apisupport.project.universe.TestModuleDependency.QA_FUNCTIONAL;
85
import static org.netbeans.modules.apisupport.project.universe.TestModuleDependency.QA_FUNCTIONAL;
86
import org.openide.util.Utilities;
86
87
87
/**
88
/**
88
 * Tests ProjectXMLManager class.
89
 * Tests ProjectXMLManager class.
Lines 308-314 Link Here
308
            public Element run() {
309
            public Element run() {
309
                Element data = null;
310
                Element data = null;
310
                try {
311
                try {
311
                    Document doc = XMLUtil.parse(new InputSource(projectXML.toURI().toString()),
312
                    Document doc = XMLUtil.parse(new InputSource(Utilities.toURI(projectXML).toString()),
312
                            false, true, null, null);
313
                            false, true, null, null);
313
                    Element project = doc.getDocumentElement();
314
                    Element project = doc.getDocumentElement();
314
                    Element config = XMLUtil.findElement(project, "configuration", null); // NOI18N
315
                    Element config = XMLUtil.findElement(project, "configuration", null); // NOI18N
(-)a/apisupport.ant/test/unit/src/org/netbeans/modules/apisupport/project/layers/LayerUtilsTest.java (-8 / +9 lines)
Lines 94-99 Link Here
94
import org.openide.filesystems.XMLFileSystem;
94
import org.openide.filesystems.XMLFileSystem;
95
import org.openide.loaders.DataObject;
95
import org.openide.loaders.DataObject;
96
import org.openide.nodes.Node;
96
import org.openide.nodes.Node;
97
import org.openide.util.Utilities;
97
98
98
/**
99
/**
99
 * Test writing changes to layers.
100
 * Test writing changes to layers.
Lines 133-139 Link Here
133
134
134
    private FileSystem createCachedFS(LayerCacheManager m, File xf) throws IOException {
135
    private FileSystem createCachedFS(LayerCacheManager m, File xf) throws IOException {
135
        ByteArrayOutputStream os = new ByteArrayOutputStream();
136
        ByteArrayOutputStream os = new ByteArrayOutputStream();
136
        m.store(null, Collections.singletonList(xf.toURI().toURL()), os);
137
        m.store(null, Collections.singletonList(Utilities.toURI(xf).toURL()), os);
137
        return m.load(null, ByteBuffer.wrap(os.toByteArray()).order(ByteOrder.LITTLE_ENDIAN));
138
        return m.load(null, ByteBuffer.wrap(os.toByteArray()).order(ByteOrder.LITTLE_ENDIAN));
138
    }
139
    }
139
140
Lines 150-156 Link Here
150
            assertFalse(cf.exists());
151
            assertFalse(cf.exists());
151
            assertTrue(cf.createNewFile());
152
            assertTrue(cf.createNewFile());
152
            OutputStream os = new BufferedOutputStream(new FileOutputStream(cf));
153
            OutputStream os = new BufferedOutputStream(new FileOutputStream(cf));
153
            URL url = xf.getName().endsWith(".jar") ? new URL("jar:" + xf.toURI() + "!/" + LAYER_PATH_IN_JAR) : xf.toURI().toURL();
154
            URL url = xf.getName().endsWith(".jar") ? new URL("jar:" + Utilities.toURI(xf) + "!/" + LAYER_PATH_IN_JAR) : Utilities.toURI(xf).toURL();
154
            urll.set(0, url);
155
            urll.set(0, url);
155
            m.store(null, urll, os);
156
            m.store(null, urll, os);
156
            os.close();
157
            os.close();
Lines 190-197 Link Here
190
                new File(getDataDir(), "layers/a-layer.xml")
191
                new File(getDataDir(), "layers/a-layer.xml")
191
                ));
192
                ));
192
193
193
        FileSystem xfs0 = new XMLFileSystem(files.get(0).toURI().toURL());
194
        FileSystem xfs0 = new XMLFileSystem(Utilities.toURI(files.get(0)).toURL());
194
        FileSystem xfs1 = new XMLFileSystem(files.get(1).toURI().toURL());
195
        FileSystem xfs1 = new XMLFileSystem(Utilities.toURI(files.get(1)).toURL());
195
        FileSystem mfs = new MultiFileSystem(xfs0, xfs1);
196
        FileSystem mfs = new MultiFileSystem(xfs0, xfs1);
196
        assertNotNull(xfs1.findResource("Menu/A Folder"));
197
        assertNotNull(xfs1.findResource("Menu/A Folder"));
197
        assertNotNull(mfs.findResource("Menu/File"));
198
        assertNotNull(mfs.findResource("Menu/File"));
Lines 233-239 Link Here
233
        File la = new File(getDataDir(), "layers/a-layer.xml");
234
        File la = new File(getDataDir(), "layers/a-layer.xml");
234
235
235
        FileSystem cfs = createCachedFS(m, lb);
236
        FileSystem cfs = createCachedFS(m, lb);
236
        FileSystem xfs = new XMLFileSystem(la.toURI().toURL());
237
        FileSystem xfs = new XMLFileSystem(Utilities.toURI(la).toURL());
237
        FileSystem mfs = new MultiFileSystem(cfs, xfs);
238
        FileSystem mfs = new MultiFileSystem(cfs, xfs);
238
        assertNotNull(mfs.findResource("Menu/File"));
239
        assertNotNull(mfs.findResource("Menu/File"));
239
        assertNotNull(mfs.findResource("Menu/A Folder"));
240
        assertNotNull(mfs.findResource("Menu/A Folder"));
Lines 317-323 Link Here
317
318
318
        List<URL> urls = new ArrayList<URL>(NUM_LAYERS);
319
        List<URL> urls = new ArrayList<URL>(NUM_LAYERS);
319
        for (File f : files) {
320
        for (File f : files) {
320
            urls.add(f.toURI().toURL());
321
            urls.add(Utilities.toURI(f).toURL());
321
        }
322
        }
322
        XMLFileSystem[] xfss = new XMLFileSystem[NUM_LAYERS];
323
        XMLFileSystem[] xfss = new XMLFileSystem[NUM_LAYERS];
323
324
Lines 351-357 Link Here
351
352
352
        List<URL> urls = new ArrayList<URL>(NUM_LAYERS);
353
        List<URL> urls = new ArrayList<URL>(NUM_LAYERS);
353
        for (File f : files) {
354
        for (File f : files) {
354
            urls.add(new URL("jar:" + f.toURI() + "!/" + LAYER_PATH_IN_JAR));
355
            urls.add(new URL("jar:" + Utilities.toURI(f) + "!/" + LAYER_PATH_IN_JAR));
355
        }
356
        }
356
        XMLFileSystem[] xfss = new XMLFileSystem[NUM_LAYERS];
357
        XMLFileSystem[] xfss = new XMLFileSystem[NUM_LAYERS];
357
358
Lines 548-554 Link Here
548
        cmf.add(cmf.createLayerEntry("link-to-localized.shadow", null, null, null, Collections.singletonMap("originalFile", "test-module2-localized-action.instance")));
549
        cmf.add(cmf.createLayerEntry("link-to-localized.shadow", null, null, null, Collections.singletonMap("originalFile", "test-module2-localized-action.instance")));
549
        File dummyDir = new File(getWorkDir(), "dummy");
550
        File dummyDir = new File(getWorkDir(), "dummy");
550
        dummyDir.mkdir();
551
        dummyDir.mkdir();
551
        cmf.add(cmf.createLayerEntry("link-to-url.shadow", null, null, null, Collections.singletonMap("originalFile", dummyDir.toURI().toURL())));
552
        cmf.add(cmf.createLayerEntry("link-to-url.shadow", null, null, null, Collections.singletonMap("originalFile", Utilities.toURI(dummyDir).toURL())));
552
        cmf.run();
553
        cmf.run();
553
        FileSystem fs = LayerUtils.getEffectiveSystemFilesystem(module2);
554
        FileSystem fs = LayerUtils.getEffectiveSystemFilesystem(module2);
554
555
(-)a/apisupport.ant/test/unit/src/org/netbeans/modules/apisupport/project/queries/BinaryForSourceImplTest.java (-2 / +3 lines)
Lines 48-53 Link Here
48
import org.netbeans.api.java.queries.BinaryForSourceQuery;
48
import org.netbeans.api.java.queries.BinaryForSourceQuery;
49
import org.netbeans.modules.apisupport.project.NbModuleProject;
49
import org.netbeans.modules.apisupport.project.NbModuleProject;
50
import org.netbeans.modules.apisupport.project.TestBase;
50
import org.netbeans.modules.apisupport.project.TestBase;
51
import org.openide.util.Utilities;
51
52
52
/**
53
/**
53
 *
54
 *
Lines 82-88 Link Here
82
        final File classesF = file(projectFolder, classesPath);
83
        final File classesF = file(projectFolder, classesPath);
83
        final File srcF = file(projectFolder, srcPath);
84
        final File srcF = file(projectFolder, srcPath);
84
        assertEquals("right binary root for " + srcPath,    //NOI18N
85
        assertEquals("right binary root for " + srcPath,    //NOI18N
85
            Collections.singletonList(classesF.toURI().toURL()),
86
            Collections.singletonList(Utilities.toURI(classesF).toURL()),
86
            Arrays.asList(BinaryForSourceQuery.findBinaryRoots(srcF.toURI().toURL()).getRoots()));
87
            Arrays.asList(BinaryForSourceQuery.findBinaryRoots(Utilities.toURI(srcF).toURL()).getRoots()));
87
    }
88
    }
88
}
89
}
(-)a/apisupport.ant/test/unit/src/org/netbeans/modules/apisupport/project/queries/GlobalJavadocForBinaryImplTest.java (-1 / +2 lines)
Lines 54-59 Link Here
54
import org.netbeans.modules.apisupport.project.universe.NbPlatform;
54
import org.netbeans.modules.apisupport.project.universe.NbPlatform;
55
import org.openide.filesystems.FileUtil;
55
import org.openide.filesystems.FileUtil;
56
import org.openide.filesystems.test.TestFileUtils;
56
import org.openide.filesystems.test.TestFileUtils;
57
import org.openide.util.Utilities;
57
58
58
public class GlobalJavadocForBinaryImplTest extends TestBase {
59
public class GlobalJavadocForBinaryImplTest extends TestBase {
59
60
Lines 65-71 Link Here
65
        File nbDocZip = generateNbDocZip();
66
        File nbDocZip = generateNbDocZip();
66
        URL nbDocZipURL = FileUtil.urlForArchiveOrDir(nbDocZip);
67
        URL nbDocZipURL = FileUtil.urlForArchiveOrDir(nbDocZip);
67
        NbPlatform.getDefaultPlatform().addJavadocRoot(nbDocZipURL);
68
        NbPlatform.getDefaultPlatform().addJavadocRoot(nbDocZipURL);
68
        doTestFindJavadoc(file("openide.loaders/src").toURI().toURL(), nbDocZipURL);
69
        doTestFindJavadoc(Utilities.toURI(file("openide.loaders/src")).toURL(), nbDocZipURL);
69
        doTestFindJavadoc(FileUtil.urlForArchiveOrDir(file("nbbuild/netbeans/platform/modules/org-openide-loaders.jar")), nbDocZipURL);
70
        doTestFindJavadoc(FileUtil.urlForArchiveOrDir(file("nbbuild/netbeans/platform/modules/org-openide-loaders.jar")), nbDocZipURL);
70
    }
71
    }
71
    private void doTestFindJavadoc(URL binRoot, URL nbDocZipURL) throws Exception {
72
    private void doTestFindJavadoc(URL binRoot, URL nbDocZipURL) throws Exception {
(-)a/apisupport.ant/test/unit/src/org/netbeans/modules/apisupport/project/queries/SourceForBinaryImplTest.java (-1 / +2 lines)
Lines 62-67 Link Here
62
import org.netbeans.spi.project.support.ant.PropertyUtils;
62
import org.netbeans.spi.project.support.ant.PropertyUtils;
63
import org.openide.filesystems.FileObject;
63
import org.openide.filesystems.FileObject;
64
import org.openide.filesystems.FileUtil;
64
import org.openide.filesystems.FileUtil;
65
import org.openide.util.Utilities;
65
66
66
/**
67
/**
67
 * Test functionality of SourceForBinaryImpl.
68
 * Test functionality of SourceForBinaryImpl.
Lines 141-147 Link Here
141
        File srcF = PropertyUtils.resolveFile(nbRootFile(), srcS);
142
        File srcF = PropertyUtils.resolveFile(nbRootFile(), srcS);
142
        FileObject src = FileUtil.toFileObject(srcF);
143
        FileObject src = FileUtil.toFileObject(srcF);
143
        assertNotNull("have " + srcF, src);
144
        assertNotNull("have " + srcF, src);
144
        URL u = FileUtil.getArchiveRoot(jarF.toURI().toURL());
145
        URL u = FileUtil.getArchiveRoot(Utilities.toURI(jarF).toURL());
145
        assertEquals("right results for " + u,
146
        assertEquals("right results for " + u,
146
            Collections.singletonList(src),
147
            Collections.singletonList(src),
147
            trimGenerated(Arrays.asList(SourceForBinaryQuery.findSourceRoots(u).getRoots())));
148
            trimGenerated(Arrays.asList(SourceForBinaryQuery.findSourceRoots(u).getRoots())));
(-)a/apisupport.ant/test/unit/src/org/netbeans/modules/apisupport/project/queries/SubprojectProviderImplTest.java (-1 / +2 lines)
Lines 59-64 Link Here
59
import org.netbeans.spi.project.support.ant.PropertyUtils;
59
import org.netbeans.spi.project.support.ant.PropertyUtils;
60
import org.openide.filesystems.FileObject;
60
import org.openide.filesystems.FileObject;
61
import org.openide.filesystems.FileUtil;
61
import org.openide.filesystems.FileUtil;
62
import org.openide.util.Utilities;
62
63
63
/**
64
/**
64
 * Test subprojects.
65
 * Test subprojects.
Lines 147-153 Link Here
147
            if (!f.isAbsolute()) {
148
            if (!f.isAbsolute()) {
148
                f = file(sp);
149
                f = file(sp);
149
            }
150
            }
150
            expected.add(f.toURI().toString());
151
            expected.add(Utilities.toURI(f).toString());
151
        }
152
        }
152
        SortedSet<String> actual = new TreeSet<String>();
153
        SortedSet<String> actual = new TreeSet<String>();
153
        for (Project sp : spp.getSubprojects()) {
154
        for (Project sp : spp.getSubprojects()) {
(-)a/apisupport.ant/test/unit/src/org/netbeans/modules/apisupport/project/queries/UnitTestForSourceQueryImplTest.java (-2 / +3 lines)
Lines 55-60 Link Here
55
import org.openide.filesystems.FileObject;
55
import org.openide.filesystems.FileObject;
56
import org.openide.filesystems.FileUtil;
56
import org.openide.filesystems.FileUtil;
57
import org.openide.filesystems.URLMapper;
57
import org.openide.filesystems.URLMapper;
58
import org.openide.util.Utilities;
58
59
59
/**
60
/**
60
 * Test for UnitTestForSourceQuery
61
 * Test for UnitTestForSourceQuery
Lines 78-84 Link Here
78
        srcRoot = nbRoot().getFileObject("apisupport.project/src");
79
        srcRoot = nbRoot().getFileObject("apisupport.project/src");
79
        testRoots = UnitTestForSourceQuery.findUnitTests(srcRoot);
80
        testRoots = UnitTestForSourceQuery.findUnitTests(srcRoot);
80
        assertEquals("Test root defined", 1, testRoots.length);
81
        assertEquals("Test root defined", 1, testRoots.length);
81
        assertTrue("Test root exists", new File(URI.create(testRoots[0].toExternalForm())).exists());
82
        assertTrue("Test root exists", Utilities.toFile(URI.create(testRoots[0].toExternalForm())).exists());
82
        assertEquals("Test root", URLMapper.findFileObject(testRoots[0]), nbRoot().getFileObject("apisupport.project/test/unit/src"));
83
        assertEquals("Test root", URLMapper.findFileObject(testRoots[0]), nbRoot().getFileObject("apisupport.project/test/unit/src"));
83
        assertEquals("One test for this project", 1, UnitTestForSourceQuery.findUnitTests(nbRoot().getFileObject("openide.windows/src")).length);
84
        assertEquals("One test for this project", 1, UnitTestForSourceQuery.findUnitTests(nbRoot().getFileObject("openide.windows/src")).length);
84
    }
85
    }
Lines 96-102 Link Here
96
        testRoot = nbRoot().getFileObject("apisupport.project/test/unit/src");
97
        testRoot = nbRoot().getFileObject("apisupport.project/test/unit/src");
97
        srcRoots = UnitTestForSourceQuery.findSources(testRoot);
98
        srcRoots = UnitTestForSourceQuery.findSources(testRoot);
98
        assertEquals("Source root defined", 1, srcRoots.length);
99
        assertEquals("Source root defined", 1, srcRoots.length);
99
        assertTrue("Source root exists", new File(URI.create(srcRoots[0].toExternalForm())).exists());
100
        assertTrue("Source root exists", Utilities.toFile(URI.create(srcRoots[0].toExternalForm())).exists());
100
        assertEquals("Source root", URLMapper.findFileObject(srcRoots[0]), nbRoot().getFileObject("apisupport.project/src"));
101
        assertEquals("Source root", URLMapper.findFileObject(srcRoots[0]), nbRoot().getFileObject("apisupport.project/src"));
101
    }        
102
    }        
102
103
(-)a/apisupport.ant/test/unit/src/org/netbeans/modules/apisupport/project/queries/UpdateTrackingFileOwnerQueryTest.java (-1 / +2 lines)
Lines 52-57 Link Here
52
import org.netbeans.spi.project.support.ant.PropertyUtils;
52
import org.netbeans.spi.project.support.ant.PropertyUtils;
53
import org.openide.filesystems.FileObject;
53
import org.openide.filesystems.FileObject;
54
import org.openide.filesystems.FileUtil;
54
import org.openide.filesystems.FileUtil;
55
import org.openide.util.Utilities;
55
56
56
/**
57
/**
57
 * Test that project association by module inclusion list works.
58
 * Test that project association by module inclusion list works.
Lines 100-106 Link Here
100
            assertEquals("correct owner by FileObject of " + file, p, FileOwnerQuery.getOwner(fileFO));
101
            assertEquals("correct owner by FileObject of " + file, p, FileOwnerQuery.getOwner(fileFO));
101
        }
102
        }
102
        assertEquals("correct owner by URI of " + file, p, FileOwnerQuery.getOwner(
103
        assertEquals("correct owner by URI of " + file, p, FileOwnerQuery.getOwner(
103
                PropertyUtils.resolveFile(nbRootFile(), file).toURI()));
104
                Utilities.toURI(PropertyUtils.resolveFile(nbRootFile(), file))));
104
    }
105
    }
105
    
106
    
106
}
107
}
(-)a/apisupport.ant/test/unit/src/org/netbeans/modules/apisupport/project/spi/BrandingSupportTest.java (-1 / +2 lines)
Lines 62-67 Link Here
62
import org.netbeans.modules.apisupport.project.universe.NbPlatform;
62
import org.netbeans.modules.apisupport.project.universe.NbPlatform;
63
import org.openide.filesystems.FileObject;
63
import org.openide.filesystems.FileObject;
64
import org.openide.filesystems.FileUtil;
64
import org.openide.filesystems.FileUtil;
65
import org.openide.util.Utilities;
65
66
66
/**
67
/**
67
 *
68
 *
Lines 138-144 Link Here
138
        File newSource = createNewSource(bFile);
139
        File newSource = createNewSource(bFile);
139
        assertEquals(0,instance.getBrandedFiles().size());
140
        assertEquals(0,instance.getBrandedFiles().size());
140
        
141
        
141
        bFile.setBrandingSource(newSource.toURI().toURL());
142
        bFile.setBrandingSource(Utilities.toURI(newSource).toURL());
142
        assertTrue(bFile.isModified());        
143
        assertTrue(bFile.isModified());        
143
        
144
        
144
        assertEquals(0,instance.getBrandedFiles().size());
145
        assertEquals(0,instance.getBrandedFiles().size());
(-)a/apisupport.ant/test/unit/src/org/netbeans/modules/apisupport/project/suite/BuildZipDistributionTest.java (-1 / +1 lines)
Lines 256-262 Link Here
256
    private void run(File nbexec, String... args) throws Exception {
256
    private void run(File nbexec, String... args) throws Exception {
257
257
258
        URL tu = MainCallback.class.getProtectionDomain().getCodeSource().getLocation();
258
        URL tu = MainCallback.class.getProtectionDomain().getCodeSource().getLocation();
259
        File testf = new File(tu.toURI());
259
        File testf = Utilities.toFile(tu.toURI());
260
        assertTrue("file found: " + testf, testf.exists());
260
        assertTrue("file found: " + testf, testf.exists());
261
        
261
        
262
        LinkedList<String> allArgs = new LinkedList<String>(Arrays.asList(args));
262
        LinkedList<String> allArgs = new LinkedList<String>(Arrays.asList(args));
(-)a/apisupport.ant/test/unit/src/org/netbeans/modules/apisupport/project/universe/TestEntryTest.java (-2 / +2 lines)
Lines 64-70 Link Here
64
        assertNotNull("TestEntry for aisupport/project tests",entry);
64
        assertNotNull("TestEntry for aisupport/project tests",entry);
65
        assertNotNull("Nbroot wasn't found.", entry.getNBRoot());
65
        assertNotNull("Nbroot wasn't found.", entry.getNBRoot());
66
        URL srcDir = entry.getSrcDir();
66
        URL srcDir = entry.getSrcDir();
67
        assertEquals(new File(nbRootFile(),"apisupport.project/test/unit/src").toURI().toURL(),srcDir);
67
        assertEquals(Utilities.toURI(new File(nbRootFile(),"apisupport.project/test/unit/src")).toURL(),srcDir);
68
    }
68
    }
69
    
69
    
70
    public void testGetSourcesFromExternalModule() throws IOException {
70
    public void testGetSourcesFromExternalModule() throws IOException {
Lines 73-79 Link Here
73
        assertNotNull("TestEntry for suite tests",entry);
73
        assertNotNull("TestEntry for suite tests",entry);
74
        assertNull("Nbroot was found.", entry.getNBRoot());
74
        assertNull("Nbroot was found.", entry.getNBRoot());
75
        URL srcDir = entry.getSrcDir();
75
        URL srcDir = entry.getSrcDir();
76
        assertEquals(resolveEEPFile("/suite4/module1/test/unit/src").toURI().toURL().toExternalForm(),srcDir.toExternalForm());
76
        assertEquals(Utilities.toURI(resolveEEPFile("/suite4/module1/test/unit/src")).toURL().toExternalForm(),srcDir.toExternalForm());
77
    }
77
    }
78
78
79
    public void testNullsOnShortUNCPath144758() throws IOException {
79
    public void testNullsOnShortUNCPath144758() throws IOException {
(-)a/apisupport.project/nbproject/project.xml (-1 / +1 lines)
Lines 259-265 Link Here
259
                    <build-prerequisite/>
259
                    <build-prerequisite/>
260
                    <compile-dependency/>
260
                    <compile-dependency/>
261
                    <run-dependency>
261
                    <run-dependency>
262
                        <specification-version>8.6</specification-version>
262
                        <specification-version>8.25</specification-version>
263
                    </run-dependency>
263
                    </run-dependency>
264
                </dependency>
264
                </dependency>
265
                <dependency>
265
                <dependency>
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/api/LayerHandle.java (-1 / +2 lines)
Lines 72-77 Link Here
72
import org.openide.filesystems.MultiFileSystem;
72
import org.openide.filesystems.MultiFileSystem;
73
import org.openide.filesystems.XMLFileSystem;
73
import org.openide.filesystems.XMLFileSystem;
74
import org.openide.util.Parameters;
74
import org.openide.util.Parameters;
75
import org.openide.util.Utilities;
75
import org.xml.sax.SAXException;
76
import org.xml.sax.SAXException;
76
77
77
/**
78
/**
Lines 219-225 Link Here
219
            }
220
            }
220
            if (generated != null && generated.isFile()) {
221
            if (generated != null && generated.isFile()) {
221
                try {
222
                try {
222
                    layers.add(new XMLFileSystem(generated.toURI().toString()));
223
                    layers.add(new XMLFileSystem(Utilities.toURI(generated).toString()));
223
                } catch (SAXException x) {
224
                } catch (SAXException x) {
224
                    Logger.getLogger(DualLayers.class.getName()).log(Level.INFO, "could not load " + generated, x);
225
                    Logger.getLogger(DualLayers.class.getName()).log(Level.INFO, "could not load " + generated, x);
225
                }
226
                }
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/api/ManifestManager.java (-1 / +2 lines)
Lines 63-68 Link Here
63
import java.util.logging.Logger;
63
import java.util.logging.Logger;
64
import org.netbeans.api.annotations.common.NonNull;
64
import org.netbeans.api.annotations.common.NonNull;
65
import org.openide.modules.Dependency;
65
import org.openide.modules.Dependency;
66
import org.openide.util.Utilities;
66
67
67
// XXX a lot of code in this method is more or less duplicated from
68
// XXX a lot of code in this method is more or less duplicated from
68
// org.netbeans.core.modules.Module class. Do not forgot to refactor this as
69
// org.netbeans.core.modules.Module class. Do not forgot to refactor this as
Lines 210-216 Link Here
210
                            if (piece.isEmpty()) {
211
                            if (piece.isEmpty()) {
211
                                continue;
212
                                continue;
212
                            }
213
                            }
213
                            File ext = new File(jar.getParentFile().toURI().resolve(piece.trim()));
214
                            File ext = Utilities.toFile(Utilities.toURI(jar.getParentFile()).resolve(piece.trim()));
214
                            if (ext.isFile()) {
215
                            if (ext.isFile()) {
215
                                ManifestManager mm2 = getInstanceFromJAR(ext);
216
                                ManifestManager mm2 = getInstanceFromJAR(ext);
216
                                List<String> toks = new ArrayList<String>(Arrays.asList(mm.provTokens));
217
                                List<String> toks = new ArrayList<String>(Arrays.asList(mm.provTokens));
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/spi/BrandingSupport.java (-2 / +2 lines)
Lines 416-422 Link Here
416
    private void loadBrandedFiles(final BrandableModule mEntry,
416
    private void loadBrandedFiles(final BrandableModule mEntry,
417
            final File file) throws IOException {
417
            final File file) throws IOException {
418
        String entryPath = PropertyUtils.relativizeFile(getModuleEntryDirectory(mEntry),file);
418
        String entryPath = PropertyUtils.relativizeFile(getModuleEntryDirectory(mEntry),file);
419
        BrandedFile bf = new BrandedFile(mEntry, file.toURI().toURL(), entryPath);
419
        BrandedFile bf = new BrandedFile(mEntry, Utilities.toURI(file).toURL(), entryPath);
420
        brandedFiles.add(bf);
420
        brandedFiles.add(bf);
421
    }
421
    }
422
    
422
    
Lines 565-571 Link Here
565
            this.moduleEntry = moduleEntry;
565
            this.moduleEntry = moduleEntry;
566
            this.entryPath = entry;
566
            this.entryPath = entry;
567
            if (source == null) {
567
            if (source == null) {
568
                brandingSource = moduleEntry.getJarLocation().toURI().toURL();
568
                brandingSource = Utilities.toURI(moduleEntry.getJarLocation()).toURL();
569
                brandingSource =  new URL("jar:" + brandingSource + "!/" + entryPath); // NOI18N
569
                brandingSource =  new URL("jar:" + brandingSource + "!/" + entryPath); // NOI18N
570
            } else {
570
            } else {
571
                brandingSource = source;
571
                brandingSource = source;
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/spi/LayerUtil.java (-1 / +2 lines)
Lines 63-68 Link Here
63
import org.openide.filesystems.FileStateInvalidException;
63
import org.openide.filesystems.FileStateInvalidException;
64
import org.openide.filesystems.FileSystem;
64
import org.openide.filesystems.FileSystem;
65
import org.openide.filesystems.XMLFileSystem;
65
import org.openide.filesystems.XMLFileSystem;
66
import org.openide.util.Utilities;
66
67
67
/**
68
/**
68
 * Utilities useful for {@link NbModuleProvider#getEffectiveSystemFilesystem}.
69
 * Utilities useful for {@link NbModuleProvider#getEffectiveSystemFilesystem}.
Lines 103-109 Link Here
103
        String layer = mm.getLayer();
104
        String layer = mm.getLayer();
104
        String generatedLayer = mm.getGeneratedLayer();
105
        String generatedLayer = mm.getGeneratedLayer();
105
        List<URL> urls = new ArrayList<URL>(2);
106
        List<URL> urls = new ArrayList<URL>(2);
106
        URI juri = jar.toURI();
107
        URI juri = Utilities.toURI(jar);
107
        for (String path : new String[] {layer, generatedLayer}) {
108
        for (String path : new String[] {layer, generatedLayer}) {
108
            if (path != null) {
109
            if (path != null) {
109
                urls.add(new URL("jar:" + juri + "!/" + path));
110
                urls.add(new URL("jar:" + juri + "!/" + path));
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/branding/BasicBrandingPanel.java (-1 / +2 lines)
Lines 60-65 Link Here
60
import org.netbeans.modules.apisupport.project.api.UIUtil;
60
import org.netbeans.modules.apisupport.project.api.UIUtil;
61
import org.openide.util.Exceptions;
61
import org.openide.util.Exceptions;
62
import org.openide.util.NbBundle;
62
import org.openide.util.NbBundle;
63
import org.openide.util.Utilities;
63
64
64
/**
65
/**
65
 * Represents <em>Application</em> panel in branding editor.
66
 * Represents <em>Application</em> panel in branding editor.
Lines 324-330 Link Here
324
        if (ret == JFileChooser.APPROVE_OPTION) {
325
        if (ret == JFileChooser.APPROVE_OPTION) {
325
            File file =  chooser.getSelectedFile();
326
            File file =  chooser.getSelectedFile();
326
            try {
327
            try {
327
                res = file.toURI().toURL();
328
                res = Utilities.toURI(file).toURL();
328
                preview.setImage(new ImageIcon(res));
329
                preview.setImage(new ImageIcon(res));
329
                setModified();
330
                setModified();
330
            } catch (MalformedURLException ex) {
331
            } catch (MalformedURLException ex) {
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/branding/ResourceBundleBrandingPanel.java (-1 / +2 lines)
Lines 92-97 Link Here
92
import org.openide.util.Exceptions;
92
import org.openide.util.Exceptions;
93
import org.openide.util.NbBundle;
93
import org.openide.util.NbBundle;
94
import org.openide.util.RequestProcessor;
94
import org.openide.util.RequestProcessor;
95
import org.openide.util.Utilities;
95
import org.openide.util.actions.SystemAction;
96
import org.openide.util.actions.SystemAction;
96
import org.openide.util.lookup.AbstractLookup;
97
import org.openide.util.lookup.AbstractLookup;
97
import org.openide.util.lookup.InstanceContent;
98
import org.openide.util.lookup.InstanceContent;
Lines 238-244 Link Here
238
        
239
        
239
        for (File file : jars) {
240
        for (File file : jars) {
240
            try {
241
            try {
241
                URI juri = file.toURI();
242
                URI juri = Utilities.toURI(file);
242
                JarFile jf = new JarFile(file);
243
                JarFile jf = new JarFile(file);
243
                String codeNameBase = ManifestManager.getInstance(jf.getManifest(), false).getCodeNameBase();
244
                String codeNameBase = ManifestManager.getInstance(jf.getManifest(), false).getCodeNameBase();
244
                Enumeration<JarEntry> entries = jf.entries();
245
                Enumeration<JarEntry> entries = jf.entries();
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/branding/SplashBrandingPanel.java (-1 / +2 lines)
Lines 61-66 Link Here
61
import org.netbeans.modules.apisupport.project.spi.BrandingSupport.BrandedFile;
61
import org.netbeans.modules.apisupport.project.spi.BrandingSupport.BrandedFile;
62
import org.openide.ErrorManager;
62
import org.openide.ErrorManager;
63
import org.openide.util.NbBundle;
63
import org.openide.util.NbBundle;
64
import org.openide.util.Utilities;
64
65
65
/**
66
/**
66
 * Represents <em>Splash branding parameters</em> panel in branding editor.
67
 * Represents <em>Splash branding parameters</em> panel in branding editor.
Lines 524-530 Link Here
524
        if (ret == JFileChooser.APPROVE_OPTION) {
525
        if (ret == JFileChooser.APPROVE_OPTION) {
525
            File file =  chooser.getSelectedFile();
526
            File file =  chooser.getSelectedFile();
526
            try {
527
            try {
527
                splashSource = file.toURI().toURL();
528
                splashSource = Utilities.toURI(file).toURL();
528
                Image oldImage = splashImage.image;
529
                Image oldImage = splashImage.image;
529
                splashImage.setSplashImageIcon(splashSource);
530
                splashImage.setSplashImageIcon(splashSource);
530
                Image newImage = splashImage.image;
531
                Image newImage = splashImage.image;
(-)a/autoupdate.pluginimporter/src/org/netbeans/modules/autoupdate/pluginimporter/Installer.java (-13 / +2 lines)
Lines 42-48 Link Here
42
package org.netbeans.modules.autoupdate.pluginimporter;
42
package org.netbeans.modules.autoupdate.pluginimporter;
43
43
44
import java.io.File;
44
import java.io.File;
45
import java.io.IOException;
46
import java.util.Arrays;
45
import java.util.Arrays;
47
import java.util.Collection;
46
import java.util.Collection;
48
import java.util.List;
47
import java.util.List;
Lines 54-59 Link Here
54
import org.netbeans.api.autoupdate.UpdateUnit;
53
import org.netbeans.api.autoupdate.UpdateUnit;
55
import org.netbeans.api.autoupdate.UpdateUnitProvider;
54
import org.netbeans.api.autoupdate.UpdateUnitProvider;
56
import org.netbeans.api.autoupdate.UpdateUnitProviderFactory;
55
import org.netbeans.api.autoupdate.UpdateUnitProviderFactory;
56
import org.openide.filesystems.FileUtil;
57
import org.openide.modules.ModuleInstall;
57
import org.openide.modules.ModuleInstall;
58
import org.openide.util.NbPreferences;
58
import org.openide.util.NbPreferences;
59
import org.openide.util.RequestProcessor;
59
import org.openide.util.RequestProcessor;
Lines 190-207 Link Here
190
        String user = System.getProperty ("netbeans.user"); // NOI18N
190
        String user = System.getProperty ("netbeans.user"); // NOI18N
191
        File userDir = null;
191
        File userDir = null;
192
        if (user != null) {
192
        if (user != null) {
193
            userDir = new File (user);
193
            userDir = FileUtil.normalizeFile(new File(user));
194
            if (userDir.getPath ().startsWith ("\\\\")) { // NOI18N
195
                // Do not use URI.normalize for UNC paths because of http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4723726 (URI.normalize() ruins URI built from UNC File)
196
                try {
197
                    userDir = userDir.getCanonicalFile ();
198
                } catch (IOException ex) {
199
                    // fallback when getCanonicalFile fails
200
                    userDir = userDir.getAbsoluteFile ();
201
                }
202
            } else {
203
                userDir = new File (userDir.toURI ().normalize ()).getAbsoluteFile ();
204
            }
205
        }
194
        }
206
195
207
        return userDir;
196
        return userDir;
(-)a/autoupdate.services/libsrc/org/netbeans/updater/UpdateTracking.java (-1 / +2 lines)
Lines 189-197 Link Here
189
        String user = System.getProperty ("netbeans.user");
189
        String user = System.getProperty ("netbeans.user");
190
        File userDir = null;
190
        File userDir = null;
191
        if (user != null) {
191
        if (user != null) {
192
            // XXX cannot use FileUtil.normalizeFile from here
192
            userDir = new File (user);
193
            userDir = new File (user);
193
            if (userDir.getPath ().startsWith ("\\\\")) {
194
            if (userDir.getPath ().startsWith ("\\\\")) {
194
                // Do not use URI.normalize for UNC paths because of http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4723726 (URI.normalize() ruins URI built from UNC File)
195
                // Could use URI.normalize but only on userDir.getPath().toUri() in JDK 7 (#4723726 breaks UNC for userDir.toURI())
195
                try {
196
                try {
196
                    userDir = userDir.getCanonicalFile ();
197
                    userDir = userDir.getCanonicalFile ();
197
                } catch (IOException ex) {
198
                } catch (IOException ex) {
(-)a/core.startup/nbproject/project.xml (-1 / +1 lines)
Lines 79-85 Link Here
79
                    <build-prerequisite/>
79
                    <build-prerequisite/>
80
                    <compile-dependency/>
80
                    <compile-dependency/>
81
                    <run-dependency>
81
                    <run-dependency>
82
                        <specification-version>8.23</specification-version>
82
                        <specification-version>8.25</specification-version>
83
                    </run-dependency>
83
                    </run-dependency>
84
                </dependency>
84
                </dependency>
85
                <dependency>
85
                <dependency>
(-)a/core.startup/src/org/netbeans/core/startup/CLICoreBridge.java (-1 / +2 lines)
Lines 60-65 Link Here
60
import org.openide.filesystems.XMLFileSystem;
60
import org.openide.filesystems.XMLFileSystem;
61
import org.openide.util.Exceptions;
61
import org.openide.util.Exceptions;
62
import org.openide.util.Lookup;
62
import org.openide.util.Lookup;
63
import org.openide.util.Utilities;
63
import org.openide.util.lookup.Lookups;
64
import org.openide.util.lookup.Lookups;
64
65
65
/**
66
/**
Lines 117-123 Link Here
117
        for (Module m : moduleSystem.getManager().getModules()) {
118
        for (Module m : moduleSystem.getManager().getModules()) {
118
            for (File f : m.getAllJars()) {
119
            for (File f : m.getAllJars()) {
119
                try {
120
                try {
120
                    urls.add(f.toURI().toURL());
121
                    urls.add(Utilities.toURI(f).toURL());
121
                }
122
                }
122
                catch (MalformedURLException ex) {
123
                catch (MalformedURLException ex) {
123
                    Exceptions.printStackTrace(ex);
124
                    Exceptions.printStackTrace(ex);
(-)a/core.startup/src/org/netbeans/core/startup/ModuleSystem.java (-1 / +2 lines)
Lines 72-77 Link Here
72
import org.openide.filesystems.FileUtil;
72
import org.openide.filesystems.FileUtil;
73
import org.openide.modules.ModuleInfo;
73
import org.openide.modules.ModuleInfo;
74
import org.openide.util.Exceptions;
74
import org.openide.util.Exceptions;
75
import org.openide.util.Utilities;
75
76
76
/** Controller of the IDE's whole module system.
77
/** Controller of the IDE's whole module system.
77
 * Contains higher-level convenience methods to
78
 * Contains higher-level convenience methods to
Lines 213-219 Link Here
213
                        /* #121777 */ jarURL.getPath().startsWith("/")) {
214
                        /* #121777 */ jarURL.getPath().startsWith("/")) {
214
                    LOG.log(Level.FINE, "Considering JAR: {0}", jarURL);
215
                    LOG.log(Level.FINE, "Considering JAR: {0}", jarURL);
215
                try {
216
                try {
216
                        if (ignoredJars.contains(new File(jarURL.toURI()))) {
217
                        if (ignoredJars.contains(Utilities.toFile(jarURL.toURI()))) {
217
                        LOG.log(Level.FINE, "ignoring JDK/JRE manifest: {0}", manifestUrl);
218
                        LOG.log(Level.FINE, "ignoring JDK/JRE manifest: {0}", manifestUrl);
218
                        continue MANIFESTS;
219
                        continue MANIFESTS;
219
                    }
220
                    }
(-)a/core.startup/src/org/netbeans/core/startup/layers/ArchiveURLMapper.java (-2 / +3 lines)
Lines 71-76 Link Here
71
import org.openide.filesystems.Repository;
71
import org.openide.filesystems.Repository;
72
import org.openide.filesystems.URLMapper;
72
import org.openide.filesystems.URLMapper;
73
import org.openide.util.Exceptions;
73
import org.openide.util.Exceptions;
74
import org.openide.util.Utilities;
74
import org.openide.util.lookup.ServiceProvider;
75
import org.openide.util.lookup.ServiceProvider;
75
76
76
@ServiceProvider(service=URLMapper.class)
77
@ServiceProvider(service=URLMapper.class)
Lines 92-102 Link Here
92
                        archiveFile = jfs.getJarFile();
93
                        archiveFile = jfs.getJarFile();
93
                        if (isRoot(archiveFile)) {
94
                        if (isRoot(archiveFile)) {
94
                            try {
95
                            try {
95
                                return new URL("jar:" + archiveFile.toURI() + "!/" +
96
                                return new URL("jar:" + Utilities.toURI(archiveFile) + "!/" +
96
                                    new URI(null, fo.getPath(), null).getRawSchemeSpecificPart() +
97
                                    new URI(null, fo.getPath(), null).getRawSchemeSpecificPart() +
97
                                    (fo.isFolder() && !fo.isRoot() ? "/" : "")); // NOI18N
98
                                    (fo.isFolder() && !fo.isRoot() ? "/" : "")); // NOI18N
98
                            } catch (URISyntaxException syntax) {
99
                            } catch (URISyntaxException syntax) {
99
                                return new URL("jar:" + archiveFile.toURI() + "!/" + fo.getPath()
100
                                return new URL("jar:" + Utilities.toURI(archiveFile) + "!/" + fo.getPath()
100
                                        + ((fo.isFolder() && !fo.isRoot()) ? "/" : "")); // NOI18N
101
                                        + ((fo.isFolder() && !fo.isRoot()) ? "/" : "")); // NOI18N
101
                            }
102
                            }
102
                        }
103
                        }
(-)a/core.startup/test/unit/src/org/netbeans/core/startup/layers/ArchiveURLMapperTest.java (-6 / +7 lines)
Lines 61-66 Link Here
61
import org.netbeans.junit.RandomlyFails;
61
import org.netbeans.junit.RandomlyFails;
62
import org.openide.filesystems.FileUtil;
62
import org.openide.filesystems.FileUtil;
63
import org.openide.filesystems.JarFileSystem;
63
import org.openide.filesystems.JarFileSystem;
64
import org.openide.util.Utilities;
64
import org.openide.util.test.TestFileUtils;
65
import org.openide.util.test.TestFileUtils;
65
66
66
/**
67
/**
Lines 95-101 Link Here
95
        out.putNextEntry(entry);
96
        out.putNextEntry(entry);
96
        out.write (RESOURCE.getBytes());
97
        out.write (RESOURCE.getBytes());
97
        out.close();
98
        out.close();
98
        return jarFile.toURI().toURL();
99
        return Utilities.toURI(jarFile).toURL();
99
    }
100
    }
100
    
101
    
101
    public void testURLMapper () throws Exception {
102
    public void testURLMapper () throws Exception {
Lines 132-138 Link Here
132
        assertTrue ("".equals(rootFo.getPath()));
133
        assertTrue ("".equals(rootFo.getPath()));
133
        assertTrue (rootFo.getFileSystem() instanceof JarFileSystem);
134
        assertTrue (rootFo.getFileSystem() instanceof JarFileSystem);
134
        File jarFile = ((JarFileSystem)rootFo.getFileSystem()).getJarFile();
135
        File jarFile = ((JarFileSystem)rootFo.getFileSystem()).getJarFile();
135
        assertTrue (jarFileURL.equals(jarFile.toURI().toURL()));
136
        assertTrue (jarFileURL.equals(Utilities.toURI(jarFile).toURL()));
136
    }
137
    }
137
    
138
    
138
    public void testFunnyZipEntryNames() throws Exception { // #181671
139
    public void testFunnyZipEntryNames() throws Exception { // #181671
Lines 145-151 Link Here
145
        jos.write("content".getBytes());
146
        jos.write("content".getBytes());
146
        jos.close();
147
        jos.close();
147
        
148
        
148
        FileObject docxFO = URLMapper.findFileObject(docx.toURI().toURL());
149
        FileObject docxFO = URLMapper.findFileObject(Utilities.toURI(docx).toURL());
149
        assertNotNull(docxFO);
150
        assertNotNull(docxFO);
150
        assertTrue(FileUtil.isArchiveFile(docxFO));
151
        assertTrue(FileUtil.isArchiveFile(docxFO));
151
        
152
        
Lines 182-188 Link Here
182
        jos.putNextEntry(entry);
183
        jos.putNextEntry(entry);
183
        jos.write(baos.toByteArray());
184
        jos.write(baos.toByteArray());
184
        jos.close();
185
        jos.close();
185
        FileObject metaJarFO = URLMapper.findFileObject(metaJar.toURI().toURL());
186
        FileObject metaJarFO = URLMapper.findFileObject(Utilities.toURI(metaJar).toURL());
186
        assertNotNull(metaJarFO);
187
        assertNotNull(metaJarFO);
187
        assertTrue(FileUtil.isArchiveFile(metaJarFO));
188
        assertTrue(FileUtil.isArchiveFile(metaJarFO));
188
        FileObject metaRoot = FileUtil.getArchiveRoot(metaJarFO);
189
        FileObject metaRoot = FileUtil.getArchiveRoot(metaJarFO);
Lines 253-266 Link Here
253
        JarOutputStream jos = new JarOutputStream(new FileOutputStream(jar));
254
        JarOutputStream jos = new JarOutputStream(new FileOutputStream(jar));
254
        jos.putNextEntry(new ZipEntry("has spaces"));
255
        jos.putNextEntry(new ZipEntry("has spaces"));
255
        jos.close();
256
        jos.close();
256
        URL source = new URL("jar:" + jar.toURI().toURL() + "!/has%20spaces");
257
        URL source = new URL("jar:" + Utilities.toURI(jar).toURL() + "!/has%20spaces");
257
        source.toURI();
258
        source.toURI();
258
        FileObject file = URLMapper.findFileObject(source);
259
        FileObject file = URLMapper.findFileObject(source);
259
        assertNotNull(file);
260
        assertNotNull(file);
260
        assertEquals(source, URLMapper.findURL(file, URLMapper.INTERNAL));
261
        assertEquals(source, URLMapper.findURL(file, URLMapper.INTERNAL));
261
        assertEquals(0, source.openConnection().getContentLength());
262
        assertEquals(0, source.openConnection().getContentLength());
262
        ProxyURLStreamHandlerFactory.register();
263
        ProxyURLStreamHandlerFactory.register();
263
        assertEquals(0, new URL("jar:" + jar.toURI().toURL() + "!/has%20spaces").openConnection().getContentLength());
264
        assertEquals(0, new URL("jar:" + Utilities.toURI(jar).toURL() + "!/has%20spaces").openConnection().getContentLength());
264
    }
265
    }
265
266
266
}
267
}
(-)a/core.startup/test/unit/src/org/netbeans/core/startup/layers/AttributeChangeIsNotifiedTest.java (-4 / +5 lines)
Lines 57-62 Link Here
57
import org.openide.filesystems.FileObject;
57
import org.openide.filesystems.FileObject;
58
import org.openide.filesystems.FileRenameEvent;
58
import org.openide.filesystems.FileRenameEvent;
59
import org.openide.filesystems.FileUtil;
59
import org.openide.filesystems.FileUtil;
60
import org.openide.util.Utilities;
60
61
61
/**
62
/**
62
 *
63
 *
Lines 100-107 Link Here
100
101
101
        {
102
        {
102
            List<URL> list = new ArrayList<URL>();
103
            List<URL> list = new ArrayList<URL>();
103
            list.add(f1.toURI().toURL());
104
            list.add(Utilities.toURI(f1).toURL());
104
            list.add(f3.toURI().toURL());
105
            list.add(Utilities.toURI(f3).toURL());
105
            fs.setURLs (list);
106
            fs.setURLs (list);
106
        }
107
        }
107
        
108
        
Lines 121-128 Link Here
121
        
122
        
122
        {
123
        {
123
            List<URL> list = new ArrayList<URL>();
124
            List<URL> list = new ArrayList<URL>();
124
            list.add(f2.toURI().toURL());
125
            list.add(Utilities.toURI(f2).toURL());
125
            list.add(f3.toURI().toURL());
126
            list.add(Utilities.toURI(f3).toURL());
126
            fs.setURLs (list);
127
            fs.setURLs (list);
127
        }
128
        }
128
        String v2 = (String) file.getAttribute("value");
129
        String v2 = (String) file.getAttribute("value");
(-)a/core.startup/test/unit/src/org/netbeans/core/startup/layers/CacheManagerTestBaseHid.java (-1 / +2 lines)
Lines 62-67 Link Here
62
import org.openide.filesystems.FileSystem;
62
import org.openide.filesystems.FileSystem;
63
import org.openide.filesystems.FileUtil;
63
import org.openide.filesystems.FileUtil;
64
import org.openide.filesystems.MultiFileSystem;
64
import org.openide.filesystems.MultiFileSystem;
65
import org.openide.util.Utilities;
65
import org.openide.util.test.TestFileUtils;
66
import org.openide.util.test.TestFileUtils;
66
/** Test layer cache managers generally.
67
/** Test layer cache managers generally.
67
 * @author Jesse Glick
68
 * @author Jesse Glick
Lines 111-117 Link Here
111
    }
112
    }
112
    
113
    
113
    protected URL loadResource(String name) throws IOException {
114
    protected URL loadResource(String name) throws IOException {
114
        return new URL(new URL(getDataDir().toURI().toURL(), "layers/"), name);
115
        return new URL(new URL(Utilities.toURI(getDataDir()).toURL(), "layers/"), name);
115
    }
116
    }
116
    
117
    
117
    public void testCacheManager() throws Exception {
118
    public void testCacheManager() throws Exception {
(-)a/java.api.common/nbproject/project.xml (-1 / +1 lines)
Lines 215-221 Link Here
215
                    <build-prerequisite/>
215
                    <build-prerequisite/>
216
                    <compile-dependency/>
216
                    <compile-dependency/>
217
                    <run-dependency>
217
                    <run-dependency>
218
                        <specification-version>8.0</specification-version>
218
                        <specification-version>8.25</specification-version>
219
                    </run-dependency>
219
                    </run-dependency>
220
                </dependency>
220
                </dependency>
221
                <dependency>
221
                <dependency>
(-)a/java.api.common/src/org/netbeans/modules/java/api/common/SourceRoots.java (-3 / +4 lines)
Lines 79-84 Link Here
79
import org.openide.util.Mutex;
79
import org.openide.util.Mutex;
80
import org.openide.util.NbBundle;
80
import org.openide.util.NbBundle;
81
import org.openide.util.Parameters;
81
import org.openide.util.Parameters;
82
import org.openide.util.Utilities;
82
import org.openide.util.WeakListeners;
83
import org.openide.util.WeakListeners;
83
import org.w3c.dom.Document;
84
import org.w3c.dom.Document;
84
import org.w3c.dom.Element;
85
import org.w3c.dom.Element;
Lines 277-283 Link Here
277
                            if (prop != null) {
278
                            if (prop != null) {
278
                                File f = helper.getAntProjectHelper().resolveFile(prop);
279
                                File f = helper.getAntProjectHelper().resolveFile(prop);
279
                                try {
280
                                try {
280
                                    URL url = f.toURI().toURL();
281
                                    URL url = Utilities.toURI(f).toURL();
281
                                    if (!f.exists()) {
282
                                    if (!f.exists()) {
282
                                        url = new URL(url.toExternalForm() + "/"); // NOI18N
283
                                        url = new URL(url.toExternalForm() + "/"); // NOI18N
283
                                    } else if (f.isFile()) {
284
                                    } else if (f.isFile()) {
Lines 312-318 Link Here
312
                    if (prop != null) {
313
                    if (prop != null) {
313
                        File f = helper.getAntProjectHelper().resolveFile(prop);
314
                        File f = helper.getAntProjectHelper().resolveFile(prop);
314
                        try {
315
                        try {
315
                            URL url = f.toURI().toURL();
316
                            URL url = Utilities.toURI(f).toURL();
316
                            if (!f.exists()) {
317
                            if (!f.exists()) {
317
                                url = new URL(url.toExternalForm() + "/"); // NOI18N
318
                                url = new URL(url.toExternalForm() + "/"); // NOI18N
318
                            } else if (f.isFile()) {
319
                            } else if (f.isFile()) {
Lines 383-389 Link Here
383
                                    rootName = MessageFormat.format(
384
                                    rootName = MessageFormat.format(
384
                                            newRootNameTemplate, new Object[] {names[names.length - 1], rootIndex});
385
                                            newRootNameTemplate, new Object[] {names[names.length - 1], rootIndex});
385
                                }
386
                                }
386
                                File f = FileUtil.normalizeFile(new File(URI.create(newRoot.toExternalForm())));
387
                                File f = FileUtil.normalizeFile(Utilities.toFile(URI.create(newRoot.toExternalForm())));
387
                                File projDir = FileUtil.toFile(helper.getAntProjectHelper().getProjectDirectory());
388
                                File projDir = FileUtil.toFile(helper.getAntProjectHelper().getProjectDirectory());
388
                                String path = f.getAbsolutePath();
389
                                String path = f.getAbsolutePath();
389
                                String prjPath = projDir.getAbsolutePath() + File.separatorChar;
390
                                String prjPath = projDir.getAbsolutePath() + File.separatorChar;
(-)a/java.api.common/src/org/netbeans/modules/java/api/common/classpath/ClassPathSupport.java (-10 / +2 lines)
Lines 73-78 Link Here
73
import org.netbeans.spi.project.support.ant.EditableProperties;
73
import org.netbeans.spi.project.support.ant.EditableProperties;
74
import org.openide.filesystems.FileUtil;
74
import org.openide.filesystems.FileUtil;
75
import org.openide.util.Parameters;
75
import org.openide.util.Parameters;
76
import org.openide.util.Utilities;
76
77
77
/**
78
/**
78
 * Support for reading/writting classpath like properties.
79
 * Support for reading/writting classpath like properties.
Lines 167-182 Link Here
167
                    AntArtifact artifact = (AntArtifact)ret[0];
168
                    AntArtifact artifact = (AntArtifact)ret[0];
168
                    URI uri = (URI)ret[1];
169
                    URI uri = (URI)ret[1];
169
                    File usedFile = antProjectHelper.resolveFile(evaluator.evaluate(pe[i]));
170
                    File usedFile = antProjectHelper.resolveFile(evaluator.evaluate(pe[i]));
170
                    /* Workaround for http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4723726 (URI.normalize() ruins URI built from UNC File) */
171
                    File artifactFile = Utilities.toFile(Utilities.toURI(artifact.getScriptLocation()).resolve(uri).normalize());
171
                    File artifactFile = null;
172
                    if(uri.isAbsolute()) {
173
                        artifactFile = new File(uri);
174
                    } else {
175
                        artifactFile = new File(artifact.getScriptLocation().getParent(), uri.getPath());
176
                    }
177
                    artifactFile = FileUtil.normalizeFile(artifactFile);
178
                    //File artifactFile = new File (artifact.getScriptLocation().toURI().resolve(uri).normalize());
179
                    /* End of UNC workaround */
180
                    if (usedFile.equals(artifactFile)) {
172
                    if (usedFile.equals(artifactFile)) {
181
                        item = Item.create( artifact, uri, pe[i]);
173
                        item = Item.create( artifact, uri, pe[i]);
182
                    }
174
                    }
(-)a/java.api.common/src/org/netbeans/modules/java/api/common/classpath/SourcePathImplementation.java (-3 / +3 lines)
Lines 69-74 Link Here
69
import org.openide.filesystems.FileRenameEvent;
69
import org.openide.filesystems.FileRenameEvent;
70
import org.openide.filesystems.FileUtil;
70
import org.openide.filesystems.FileUtil;
71
import org.openide.util.Exceptions;
71
import org.openide.util.Exceptions;
72
import org.openide.util.Utilities;
72
import org.openide.util.WeakListeners;
73
import org.openide.util.WeakListeners;
73
74
74
/**
75
/**
Lines 146-153 Link Here
146
                    if (matcher == null) {
147
                    if (matcher == null) {
147
                        matcher = new PathMatcher(
148
                        matcher = new PathMatcher(
148
                                evaluator.getProperty(ProjectProperties.INCLUDES),
149
                                evaluator.getProperty(ProjectProperties.INCLUDES),
149
                                evaluator.getProperty(ProjectProperties.EXCLUDES),
150
                                evaluator.getProperty(ProjectProperties.EXCLUDES), Utilities.toFile(URI.create(root.toExternalForm())));
150
                                new File(URI.create(root.toExternalForm())));
151
                    }
151
                    }
152
                    return matcher.matches(resource, true);
152
                    return matcher.matches(resource, true);
153
                }
153
                }
Lines 192-198 Link Here
192
                            if (root.equals(apSourcesDir)) {
192
                            if (root.equals(apSourcesDir)) {
193
                                continue;
193
                                continue;
194
                            }
194
                            }
195
                            result.add(ClassPathSupport.createResource(root.toURI().toURL()));
195
                            result.add(ClassPathSupport.createResource(Utilities.toURI(root).toURL()));
196
                        }
196
                        }
197
                    }
197
                    }
198
                }
198
                }
(-)a/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/LibrariesNode.java (-1 / +2 lines)
Lines 107-112 Link Here
107
import org.netbeans.spi.java.project.support.ui.PackageView;
107
import org.netbeans.spi.java.project.support.ui.PackageView;
108
import org.netbeans.spi.project.libraries.support.LibrariesSupport;
108
import org.netbeans.spi.project.libraries.support.LibrariesSupport;
109
import org.openide.util.Exceptions;
109
import org.openide.util.Exceptions;
110
import org.openide.util.Utilities;
110
import org.openide.util.lookup.Lookups;
111
import org.openide.util.lookup.Lookups;
111
112
112
/**
113
/**
Lines 903-909 Link Here
903
                }
904
                }
904
                else {
905
                else {
905
                    //No MimeResolver fallback
906
                    //No MimeResolver fallback
906
                    return FileUtil.isArchiveFile(f.toURI().toURL());
907
                    return FileUtil.isArchiveFile(Utilities.toURI(f).toURL());
907
                }
908
                }
908
            } catch (MalformedURLException mue) {
909
            } catch (MalformedURLException mue) {
909
                Exceptions.printStackTrace(mue);                
910
                Exceptions.printStackTrace(mue);                
(-)a/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/ProjectNode.java (-1 / +2 lines)
Lines 77-82 Link Here
77
import org.openide.filesystems.FileObject;
77
import org.openide.filesystems.FileObject;
78
import org.openide.util.Exceptions;
78
import org.openide.util.Exceptions;
79
import org.openide.util.Lookup;
79
import org.openide.util.Lookup;
80
import org.openide.util.Utilities;
80
81
81
82
82
83
Lines 235-241 Link Here
235
            File scriptLocation = this.antArtifact.getScriptLocation();            
236
            File scriptLocation = this.antArtifact.getScriptLocation();            
236
            Set<URL> urls = new HashSet<URL>();
237
            Set<URL> urls = new HashSet<URL>();
237
            try {
238
            try {
238
                URL artifactURL = scriptLocation.toURI().resolve(this.artifactLocation).normalize().toURL();
239
                URL artifactURL = Utilities.toURI(scriptLocation).resolve(this.artifactLocation).normalize().toURL();
239
                if (FileUtil.isArchiveFile(artifactURL)) {
240
                if (FileUtil.isArchiveFile(artifactURL)) {
240
                    artifactURL = FileUtil.getArchiveRoot(artifactURL);
241
                    artifactURL = FileUtil.getArchiveRoot(artifactURL);
241
                }
242
                }
(-)a/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/EditMediator.java (-1 / +2 lines)
Lines 89-94 Link Here
89
import org.openide.util.Exceptions;
89
import org.openide.util.Exceptions;
90
import org.openide.util.NbBundle;
90
import org.openide.util.NbBundle;
91
import org.openide.util.NbPreferences;
91
import org.openide.util.NbPreferences;
92
import org.openide.util.Utilities;
92
93
93
/**
94
/**
94
 * Visual classpath customizer support.
95
 * Visual classpath customizer support.
Lines 368-374 Link Here
368
                String path = libraryPath.getText(0, libraryPath.getLength());
369
                String path = libraryPath.getText(0, libraryPath.getLength());
369
                if (path != null && path.length() > 0) {
370
                if (path != null && path.length() > 0) {
370
                    File fil = PropertyUtils.resolveFile(FileUtil.toFile(helper.getProjectDirectory()), path);
371
                    File fil = PropertyUtils.resolveFile(FileUtil.toFile(helper.getProjectDirectory()), path);
371
                    librariesFolder = FileUtil.normalizeFile(fil).toURI().toURL();
372
                    librariesFolder = Utilities.toURI(FileUtil.normalizeFile(fil)).toURL();
372
                    manager = LibraryManager.forLocation(librariesFolder);
373
                    manager = LibraryManager.forLocation(librariesFolder);
373
                } else {
374
                } else {
374
                    empty = true;
375
                    empty = true;
(-)a/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/SourceRootsUi.java (-3 / +4 lines)
Lines 92-97 Link Here
92
import org.openide.filesystems.FileObject;
92
import org.openide.filesystems.FileObject;
93
import org.openide.filesystems.FileUtil;
93
import org.openide.filesystems.FileUtil;
94
import org.openide.util.NbBundle;
94
import org.openide.util.NbBundle;
95
import org.openide.util.Utilities;
95
96
96
/** Handles adding, removing, reordering of source roots.
97
/** Handles adding, removing, reordering of source roots.
97
 *
98
 *
Lines 110-116 Link Here
110
        URL[] rootURLs = roots.getRootURLs();
111
        URL[] rootURLs = roots.getRootURLs();
111
        Object[][] data = new Object[rootURLs.length] [2];
112
        Object[][] data = new Object[rootURLs.length] [2];
112
        for (int i=0; i< rootURLs.length; i++) {
113
        for (int i=0; i< rootURLs.length; i++) {
113
            data[i][0] = new File (URI.create (rootURLs[i].toExternalForm()));            
114
            data[i][0] = Utilities.toFile(URI.create (rootURLs[i].toExternalForm()));
114
            data[i][1] = roots.getRootDisplayName(rootLabels[i], rootProps[i]);
115
            data[i][1] = roots.getRootDisplayName(rootLabels[i], rootProps[i]);
115
        }
116
        }
116
        return new SourceRootsModel(data);
117
        return new SourceRootsModel(data);
Lines 382-388 Link Here
382
                    rootsFromRelatedSourceRoots.add (normalizedFile);
383
                    rootsFromRelatedSourceRoots.add (normalizedFile);
383
                    continue;
384
                    continue;
384
                }
385
                }
385
                if ((p=FileOwnerQuery.getOwner(normalizedFile.toURI()))!=null && !p.getProjectDirectory().equals(project.getProjectDirectory())) {
386
                if ((p=FileOwnerQuery.getOwner(Utilities.toURI(normalizedFile)))!=null && !p.getProjectDirectory().equals(project.getProjectDirectory())) {
386
                    final Sources sources = p.getLookup().lookup(Sources.class);
387
                    final Sources sources = p.getLookup().lookup(Sources.class);
387
                    if (sources == null) {
388
                    if (sources == null) {
388
                        rootsFromOtherProjects.add (normalizedFile);
389
                        rootsFromOtherProjects.add (normalizedFile);
Lines 622-628 Link Here
622
                File f = (File) value;
623
                File f = (File) value;
623
                String message = f.getAbsolutePath();
624
                String message = f.getAbsolutePath();
624
                if (projectConflict) {
625
                if (projectConflict) {
625
                    Project p = FileOwnerQuery.getOwner(f.toURI());
626
                    Project p = FileOwnerQuery.getOwner(Utilities.toURI(f));
626
                    if (p!=null) {
627
                    if (p!=null) {
627
                        ProjectInformation pi = ProjectUtils.getInformation(p);
628
                        ProjectInformation pi = ProjectUtils.getInformation(p);
628
                        String projectName = pi.getDisplayName();
629
                        String projectName = pi.getDisplayName();
(-)a/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/wizards/FolderList.java (-1 / +2 lines)
Lines 86-91 Link Here
86
import org.openide.filesystems.FileUtil;
86
import org.openide.filesystems.FileUtil;
87
import org.openide.util.Cancellable;
87
import org.openide.util.Cancellable;
88
import org.openide.util.NbBundle;
88
import org.openide.util.NbBundle;
89
import org.openide.util.Utilities;
89
90
90
91
91
/**
92
/**
Lines 383-389 Link Here
383
384
384
    public static boolean isValidRoot (File file, File[] relatedRoots, File projectFolder) {
385
    public static boolean isValidRoot (File file, File[] relatedRoots, File projectFolder) {
385
        Project p;
386
        Project p;
386
        if ((p = FileOwnerQuery.getOwner(file.toURI()))!=null 
387
        if ((p = FileOwnerQuery.getOwner(Utilities.toURI(file)))!=null
387
            && !file.getAbsolutePath().startsWith(projectFolder.getAbsolutePath()+File.separatorChar)) {
388
            && !file.getAbsolutePath().startsWith(projectFolder.getAbsolutePath()+File.separatorChar)) {
388
            final Sources sources = p.getLookup().lookup(Sources.class);
389
            final Sources sources = p.getLookup().lookup(Sources.class);
389
            if (sources == null) {
390
            if (sources == null) {
(-)a/java.api.common/src/org/netbeans/modules/java/api/common/queries/AnnotationProcessingQueryImpl.java (-1 / +2 lines)
Lines 69-74 Link Here
69
import org.openide.filesystems.FileObject;
69
import org.openide.filesystems.FileObject;
70
import org.openide.modules.SpecificationVersion;
70
import org.openide.modules.SpecificationVersion;
71
import org.openide.util.ChangeSupport;
71
import org.openide.util.ChangeSupport;
72
import org.openide.util.Utilities;
72
import org.openide.util.WeakListeners;
73
import org.openide.util.WeakListeners;
73
74
74
/**
75
/**
Lines 174-180 Link Here
174
                File output = helper.resolveFile(prop);
175
                File output = helper.resolveFile(prop);
175
176
176
                try {
177
                try {
177
                    return output.toURI().toURL();
178
                    return Utilities.toURI(output).toURL();
178
                } catch (MalformedURLException ex) {
179
                } catch (MalformedURLException ex) {
179
                    Logger.getLogger(AnnotationProcessingQueryImpl.class.getName()).log(Level.FINE, null, ex);
180
                    Logger.getLogger(AnnotationProcessingQueryImpl.class.getName()).log(Level.FINE, null, ex);
180
                    return  null;
181
                    return  null;
(-)a/java.api.common/src/org/netbeans/modules/java/api/common/queries/BinaryForSourceQueryImpl.java (-1 / +2 lines)
Lines 60-65 Link Here
60
import org.netbeans.spi.project.support.ant.PropertyEvaluator;
60
import org.netbeans.spi.project.support.ant.PropertyEvaluator;
61
import org.openide.filesystems.FileUtil;
61
import org.openide.filesystems.FileUtil;
62
import org.openide.util.ChangeSupport;
62
import org.openide.util.ChangeSupport;
63
import org.openide.util.Utilities;
63
64
64
/**
65
/**
65
 *
66
 *
Lines 114-120 Link Here
114
            }
115
            }
115
            String buildGeneratedDirS = eval.getProperty("build.generated.sources.dir");
116
            String buildGeneratedDirS = eval.getProperty("build.generated.sources.dir");
116
            if (buildGeneratedDirS != null) { // #105645
117
            if (buildGeneratedDirS != null) { // #105645
117
                String parent = helper.resolveFile(buildGeneratedDirS).toURI().toString();
118
                String parent = Utilities.toURI(helper.resolveFile(buildGeneratedDirS)).toString();
118
                if (sourceRoot.toString().startsWith(parent)) {
119
                if (sourceRoot.toString().startsWith(parent)) {
119
                    result = new R(sourceProps);
120
                    result = new R(sourceProps);
120
                    cache.put(sourceRoot, result);
121
                    cache.put(sourceRoot, result);
(-)a/java.api.common/src/org/netbeans/modules/java/api/common/queries/CompiledSourceForBinaryQueryImpl.java (-1 / +2 lines)
Lines 64-69 Link Here
64
import org.netbeans.spi.project.support.ant.PropertyEvaluator;
64
import org.netbeans.spi.project.support.ant.PropertyEvaluator;
65
import org.openide.util.ChangeSupport;
65
import org.openide.util.ChangeSupport;
66
import org.openide.util.Exceptions;
66
import org.openide.util.Exceptions;
67
import org.openide.util.Utilities;
67
68
68
/**
69
/**
69
 * Default implementation of {@link SourceForBinaryQueryImplementation}.
70
 * Default implementation of {@link SourceForBinaryQueryImplementation}.
Lines 134-140 Link Here
134
            String outDir = evaluator.getProperty(binaryProperty);
135
            String outDir = evaluator.getProperty(binaryProperty);
135
            if (outDir != null) {
136
            if (outDir != null) {
136
                File f = helper.resolveFile(outDir);
137
                File f = helper.resolveFile(outDir);
137
                URL url = f.toURI().toURL();
138
                URL url = Utilities.toURI(f).toURL();
138
                if (!f.exists() && !f.getPath().toLowerCase().endsWith(".jar")) { // NOI18N
139
                if (!f.exists() && !f.getPath().toLowerCase().endsWith(".jar")) { // NOI18N
139
                    // non-existing
140
                    // non-existing
140
                    assert !url.toExternalForm().endsWith("/") : f; // NOI18N
141
                    assert !url.toExternalForm().endsWith("/") : f; // NOI18N
(-)a/java.api.common/src/org/netbeans/modules/java/api/common/queries/JavadocForBinaryQueryImpl.java (-2 / +3 lines)
Lines 56-61 Link Here
56
import org.netbeans.spi.project.support.ant.PropertyEvaluator;
56
import org.netbeans.spi.project.support.ant.PropertyEvaluator;
57
import org.openide.util.ChangeSupport;
57
import org.openide.util.ChangeSupport;
58
import org.openide.util.Exceptions;
58
import org.openide.util.Exceptions;
59
import org.openide.util.Utilities;
59
import org.openide.util.WeakListeners;
60
import org.openide.util.WeakListeners;
60
61
61
/**
62
/**
Lines 106-112 Link Here
106
                if (javadocDir != null) {
107
                if (javadocDir != null) {
107
                    File f = helper.resolveFile(javadocDir);
108
                    File f = helper.resolveFile(javadocDir);
108
                    try {
109
                    try {
109
                        URL url = f.toURI().toURL();
110
                        URL url = Utilities.toURI(f).toURL();
110
                        if (!f.exists()) {
111
                        if (!f.exists()) {
111
                            assert !url.toExternalForm().endsWith("/") : f; // NOI18N
112
                            assert !url.toExternalForm().endsWith("/") : f; // NOI18N
112
                            url = new URL(url.toExternalForm() + "/"); // NOI18N
113
                            url = new URL(url.toExternalForm() + "/"); // NOI18N
Lines 165-171 Link Here
165
            String outDir = evaluator.getProperty(binaryProperty);
166
            String outDir = evaluator.getProperty(binaryProperty);
166
            if (outDir != null) {
167
            if (outDir != null) {
167
                File f = helper.resolveFile(outDir);
168
                File f = helper.resolveFile(outDir);
168
                URL url = f.toURI().toURL();
169
                URL url = Utilities.toURI(f).toURL();
169
                if (!f.exists() && !f.getPath().toLowerCase().endsWith(".jar")) { // NOI18N
170
                if (!f.exists() && !f.getPath().toLowerCase().endsWith(".jar")) { // NOI18N
170
                    assert !url.toExternalForm().endsWith("/") : f; // NOI18N
171
                    assert !url.toExternalForm().endsWith("/") : f; // NOI18N
171
                    url = new URL(url.toExternalForm() + "/"); // NOI18N
172
                    url = new URL(url.toExternalForm() + "/"); // NOI18N
(-)a/java.api.common/src/org/netbeans/modules/java/api/common/queries/QuerySupport.java (-1 / +2 lines)
Lines 67-72 Link Here
67
import org.netbeans.spi.queries.SharabilityQueryImplementation2;
67
import org.netbeans.spi.queries.SharabilityQueryImplementation2;
68
import org.openide.loaders.CreateFromTemplateAttributesProvider;
68
import org.openide.loaders.CreateFromTemplateAttributesProvider;
69
import org.openide.util.Parameters;
69
import org.openide.util.Parameters;
70
import org.openide.util.Utilities;
70
import org.openide.util.WeakListeners;
71
import org.openide.util.WeakListeners;
71
import org.w3c.dom.Element;
72
import org.w3c.dom.Element;
72
73
Lines 208-214 Link Here
208
        final SharabilityQueryImplementation2 sq2 = createSharabilityQuery2(helper, evaluator, srcRoots, testRoots, additionalSourceRoots);
209
        final SharabilityQueryImplementation2 sq2 = createSharabilityQuery2(helper, evaluator, srcRoots, testRoots, additionalSourceRoots);
209
        return new SharabilityQueryImplementation() {
210
        return new SharabilityQueryImplementation() {
210
            @Override public int getSharability(File file) {
211
            @Override public int getSharability(File file) {
211
                return sq2.getSharability(file.toURI()).ordinal();
212
                return sq2.getSharability(Utilities.toURI(file)).ordinal();
212
            }
213
            }
213
        };
214
        };
214
    }
215
    }
(-)a/java.j2seproject/nbproject/project.xml (-1 / +1 lines)
Lines 299-305 Link Here
299
                    <build-prerequisite/>
299
                    <build-prerequisite/>
300
                    <compile-dependency/>
300
                    <compile-dependency/>
301
                    <run-dependency>
301
                    <run-dependency>
302
                        <specification-version>8.6</specification-version>
302
                        <specification-version>8.25</specification-version>
303
                    </run-dependency>
303
                    </run-dependency>
304
                </dependency>
304
                </dependency>
305
                <dependency>
305
                <dependency>
(-)a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/J2SEProjectOperations.java (-1 / +2 lines)
Lines 73-78 Link Here
73
import org.openide.util.Exceptions;
73
import org.openide.util.Exceptions;
74
import org.openide.util.Lookup;
74
import org.openide.util.Lookup;
75
import org.openide.util.NbBundle;
75
import org.openide.util.NbBundle;
76
import org.openide.util.Utilities;
76
77
77
/**
78
/**
78
 *
79
 *
Lines 334-340 Link Here
334
        if (libraryPath != null) {
335
        if (libraryPath != null) {
335
            File prjRoot = FileUtil.toFile(project.getProjectDirectory());
336
            File prjRoot = FileUtil.toFile(project.getProjectDirectory());
336
            libraryFile = PropertyUtils.resolveFile(prjRoot, libraryPath);
337
            libraryFile = PropertyUtils.resolveFile(prjRoot, libraryPath);
337
            if (FileOwnerQuery.getOwner(libraryFile.toURI()) == project && 
338
            if (FileOwnerQuery.getOwner(Utilities.toURI(libraryFile)) == project &&
338
                    libraryFile.getAbsolutePath().startsWith(prjRoot.getAbsolutePath())) {
339
                    libraryFile.getAbsolutePath().startsWith(prjRoot.getAbsolutePath())) {
339
                //do not update the relative path if within the project..
340
                //do not update the relative path if within the project..
340
                libraryWithinProject = true;
341
                libraryWithinProject = true;
(-)a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/LibrariesNodeFactory.java (-1 / +2 lines)
Lines 70-75 Link Here
70
import org.openide.nodes.Node;
70
import org.openide.nodes.Node;
71
import org.openide.util.ChangeSupport;
71
import org.openide.util.ChangeSupport;
72
import org.openide.util.NbBundle;
72
import org.openide.util.NbBundle;
73
import org.openide.util.Utilities;
73
74
74
/**
75
/**
75
 *
76
 *
Lines 118-124 Link Here
118
            URL[] testRoots = testSources.getRootURLs();
119
            URL[] testRoots = testSources.getRootURLs();
119
            boolean addTestSources = false;
120
            boolean addTestSources = false;
120
            for (int i = 0; i < testRoots.length; i++) {
121
            for (int i = 0; i < testRoots.length; i++) {
121
                File f = new File(URI.create(testRoots[i].toExternalForm()));
122
                File f = Utilities.toFile(URI.create(testRoots[i].toExternalForm()));
122
                if (f.exists()) {
123
                if (f.exists()) {
123
                    addTestSources = true;
124
                    addTestSources = true;
124
                    break;
125
                    break;
(-)a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/CustomizerLibraries.java (-1 / +2 lines)
Lines 69-74 Link Here
69
import org.openide.util.Exceptions;
69
import org.openide.util.Exceptions;
70
import org.openide.util.HelpCtx;
70
import org.openide.util.HelpCtx;
71
import org.openide.util.NbBundle;
71
import org.openide.util.NbBundle;
72
import org.openide.util.Utilities;
72
73
73
/** Customizer for general project attributes.
74
/** Customizer for general project attributes.
74
 *
75
 *
Lines 230-236 Link Here
230
            try {
231
            try {
231
                File base = FileUtil.toFile(uiProperties.getProject().getProjectDirectory());
232
                File base = FileUtil.toFile(uiProperties.getProject().getProjectDirectory());
232
                File location = FileUtil.normalizeFile(PropertyUtils.resolveFile(base, loc));
233
                File location = FileUtil.normalizeFile(PropertyUtils.resolveFile(base, loc));
233
                URL url = location.toURI().toURL();
234
                URL url = Utilities.toURI(location).toURL();
234
                man = LibraryManager.forLocation(url);
235
                man = LibraryManager.forLocation(url);
235
            } catch (MalformedURLException ex) {
236
            } catch (MalformedURLException ex) {
236
                Exceptions.printStackTrace(ex);
237
                Exceptions.printStackTrace(ex);
(-)a/java.j2seproject/test/unit/src/org/netbeans/modules/java/j2seproject/J2SEProjectGeneratorTest.java (-2 / +3 lines)
Lines 67-72 Link Here
67
import org.openide.filesystems.FileUtil;
67
import org.openide.filesystems.FileUtil;
68
import org.openide.modules.SpecificationVersion;
68
import org.openide.modules.SpecificationVersion;
69
import org.openide.util.Lookup;
69
import org.openide.util.Lookup;
70
import org.openide.util.Utilities;
70
import org.openide.util.test.MockLookup;
71
import org.openide.util.test.MockLookup;
71
72
72
/**
73
/**
Lines 154-161 Link Here
154
        AntProjectHelper helper = J2SEProjectGenerator.createProject(proj, "test-project-ext-src", new File[] {srcRoot}, new File[] {testRoot}, "manifest.mf", null, null);
155
        AntProjectHelper helper = J2SEProjectGenerator.createProject(proj, "test-project-ext-src", new File[] {srcRoot}, new File[] {testRoot}, "manifest.mf", null, null);
155
        final Project expected = FileOwnerQuery.getOwner(helper.getProjectDirectory());
156
        final Project expected = FileOwnerQuery.getOwner(helper.getProjectDirectory());
156
        assertNotNull(expected);
157
        assertNotNull(expected);
157
        assertEquals(expected, FileOwnerQuery.getOwner(srcRoot.toURI()));
158
        assertEquals(expected, FileOwnerQuery.getOwner(Utilities.toURI(srcRoot)));
158
        assertEquals(expected, FileOwnerQuery.getOwner(testRoot.toURI()));
159
        assertEquals(expected, FileOwnerQuery.getOwner(Utilities.toURI(testRoot)));
159
    }
160
    }
160
    
161
    
161
    public void testProjectBuilder() throws Exception {
162
    public void testProjectBuilder() throws Exception {
(-)a/java.j2seproject/test/unit/src/org/netbeans/modules/java/j2seproject/classpath/J2SEProjectClassPathModifierTest.java (-2 / +3 lines)
Lines 77-82 Link Here
77
import org.openide.filesystems.test.TestFileUtils;
77
import org.openide.filesystems.test.TestFileUtils;
78
import org.openide.modules.SpecificationVersion;
78
import org.openide.modules.SpecificationVersion;
79
import org.openide.util.Lookup;
79
import org.openide.util.Lookup;
80
import org.openide.util.Utilities;
80
import org.w3c.dom.Element;
81
import org.w3c.dom.Element;
81
import org.w3c.dom.NodeList;
82
import org.w3c.dom.NodeList;
82
import org.openide.util.test.MockLookup;
83
import org.openide.util.test.MockLookup;
Lines 164-170 Link Here
164
        assertEquals(1,cpRoots.length);
165
        assertEquals(1,cpRoots.length);
165
        URI projectURI = URI.create(output.getProject().getProjectDirectory().toURL().toExternalForm());
166
        URI projectURI = URI.create(output.getProject().getProjectDirectory().toURL().toExternalForm());
166
        URI expected = projectURI.resolve(output.getArtifactLocations()[0]);
167
        URI expected = projectURI.resolve(output.getArtifactLocations()[0]);
167
        assertEquals(expected,this.helper.resolveFile(cpRoots[0]).toURI());
168
        assertEquals(expected,Utilities.toURI(this.helper.resolveFile(cpRoots[0])));
168
        ProjectClassPathModifier.removeAntArtifacts(new AntArtifact[] {output}, new URI[] {output.getArtifactLocations()[0]},this.src, ClassPath.COMPILE);
169
        ProjectClassPathModifier.removeAntArtifacts(new AntArtifact[] {output}, new URI[] {output.getArtifactLocations()[0]},this.src, ClassPath.COMPILE);
169
        cp = this.eval.getProperty("javac.classpath");
170
        cp = this.eval.getProperty("javac.classpath");
170
        assertNotNull (cp);
171
        assertNotNull (cp);
Lines 202-208 Link Here
202
    @RandomlyFails // NB-Core-Build #3223; javac.classpath="" after addition
203
    @RandomlyFails // NB-Core-Build #3223; javac.classpath="" after addition
203
    public void testProjectLibrary() throws Exception {
204
    public void testProjectLibrary() throws Exception {
204
        assertEquals(Collections.emptyList(), getPrjLibRefs());
205
        assertEquals(Collections.emptyList(), getPrjLibRefs());
205
        URL base = getWorkDir().toURI().toURL();
206
        URL base = Utilities.toURI(getWorkDir()).toURL();
206
        helper.setLibrariesLocation(".."+File.separatorChar+"defs.properties");
207
        helper.setLibrariesLocation(".."+File.separatorChar+"defs.properties");
207
        Library lib = LibraryManager.forLocation(new URL(base, "defs.properties")).createLibrary("j2se", "test",
208
        Library lib = LibraryManager.forLocation(new URL(base, "defs.properties")).createLibrary("j2se", "test",
208
                Collections.singletonMap("classpath", Collections.singletonList(new URL(base, "stuff/"))));
209
                Collections.singletonMap("classpath", Collections.singletonList(new URL(base, "stuff/"))));
(-)a/java.j2seproject/test/unit/src/org/netbeans/modules/java/j2seproject/classpath/SourcePathImplementationTest.java (-2 / +3 lines)
Lines 71-76 Link Here
71
import org.netbeans.modules.java.j2seproject.J2SEProjectGenerator;
71
import org.netbeans.modules.java.j2seproject.J2SEProjectGenerator;
72
import org.netbeans.modules.java.j2seproject.SourceRootsTest;
72
import org.netbeans.modules.java.j2seproject.SourceRootsTest;
73
import org.openide.util.Mutex;
73
import org.openide.util.Mutex;
74
import org.openide.util.Utilities;
74
import org.openide.util.test.MockLookup;
75
import org.openide.util.test.MockLookup;
75
76
76
public class SourcePathImplementationTest extends NbTestCase {
77
public class SourcePathImplementationTest extends NbTestCase {
Lines 175-186 Link Here
175
        src2.mkdir();
176
        src2.mkdir();
176
        AntProjectHelper h = J2SEProjectGenerator.createProject(new File(getWorkDir(), "prj"), "test", new File[] {src1, src2}, new File[0], null, null, null);
177
        AntProjectHelper h = J2SEProjectGenerator.createProject(new File(getWorkDir(), "prj"), "test", new File[] {src1, src2}, new File[0], null, null, null);
177
        Project p = ProjectManager.getDefault().findProject(h.getProjectDirectory());
178
        Project p = ProjectManager.getDefault().findProject(h.getProjectDirectory());
178
        FileOwnerQuery.markExternalOwner(src1.toURI(), p, FileOwnerQuery.EXTERNAL_ALGORITHM_TRANSIENT);
179
        FileOwnerQuery.markExternalOwner(Utilities.toURI(src1), p, FileOwnerQuery.EXTERNAL_ALGORITHM_TRANSIENT);
179
        ClassPath cp = ClassPath.getClassPath(FileUtil.toFileObject(src1), ClassPath.SOURCE);
180
        ClassPath cp = ClassPath.getClassPath(FileUtil.toFileObject(src1), ClassPath.SOURCE);
180
        assertNotNull(cp);        
181
        assertNotNull(cp);        
181
        assertEquals(2, cp.getRoots().length);
182
        assertEquals(2, cp.getRoots().length);
182
        ClassPath.Entry cpe2 = cp.entries().get(1);
183
        ClassPath.Entry cpe2 = cp.entries().get(1);
183
        assertEquals(src2.toURI().toURL(), cpe2.getURL());
184
        assertEquals(Utilities.toURI(src2).toURL(), cpe2.getURL());
184
        assertTrue(cpe2.includes("stuff/"));
185
        assertTrue(cpe2.includes("stuff/"));
185
        assertTrue(cpe2.includes("whatever/"));
186
        assertTrue(cpe2.includes("whatever/"));
186
        class L implements PropertyChangeListener {
187
        class L implements PropertyChangeListener {
(-)a/java.project/nbproject/project.xml (-1 / +1 lines)
Lines 240-246 Link Here
240
                    <build-prerequisite/>
240
                    <build-prerequisite/>
241
                    <compile-dependency/>
241
                    <compile-dependency/>
242
                    <run-dependency>
242
                    <run-dependency>
243
                        <specification-version>8.0</specification-version>
243
                        <specification-version>8.25</specification-version>
244
                    </run-dependency>
244
                    </run-dependency>
245
                </dependency>
245
                </dependency>
246
                <dependency>
246
                <dependency>
(-)a/java.project/src/org/netbeans/api/java/project/classpath/ProjectClassPathModifier.java (-1 / +2 lines)
Lines 63-68 Link Here
63
import org.openide.filesystems.FileUtil;
63
import org.openide.filesystems.FileUtil;
64
import org.openide.filesystems.URLMapper;
64
import org.openide.filesystems.URLMapper;
65
import org.openide.util.Parameters;
65
import org.openide.util.Parameters;
66
import org.openide.util.Utilities;
66
67
67
/**
68
/**
68
 * An API for project's classpaths modification.
69
 * An API for project's classpaths modification.
Lines 194-200 Link Here
194
                }
195
                }
195
                final FileObject fo;
196
                final FileObject fo;
196
                if (urlToAdd.isAbsolute()) {
197
                if (urlToAdd.isAbsolute()) {
197
                    fo = FileUtil.toFileObject(new File(urlToAdd));
198
                    fo = FileUtil.toFileObject(Utilities.toFile(urlToAdd));
198
                } else {
199
                } else {
199
                    File f = PropertyUtils.resolveFile(projectFolderFile, LibrariesSupport.convertURIToFilePath(urlToAdd));
200
                    File f = PropertyUtils.resolveFile(projectFolderFile, LibrariesSupport.convertURIToFilePath(urlToAdd));
200
                    fo = FileUtil.toFileObject(f);
201
                    fo = FileUtil.toFileObject(f);
(-)a/java.project/src/org/netbeans/modules/java/project/ExtraProjectSourceForBinaryQueryImpl.java (-1 / +2 lines)
Lines 70-75 Link Here
70
import org.openide.filesystems.URLMapper;
70
import org.openide.filesystems.URLMapper;
71
import org.openide.util.ChangeSupport;
71
import org.openide.util.ChangeSupport;
72
import org.openide.util.Exceptions;
72
import org.openide.util.Exceptions;
73
import org.openide.util.Utilities;
73
74
74
/**
75
/**
75
 *
76
 *
Lines 164-170 Link Here
164
                        // #138349 - ignore non existing paths or entries with undefined IDE variables
165
                        // #138349 - ignore non existing paths or entries with undefined IDE variables
165
                        if (src.exists()) {
166
                        if (src.exists()) {
166
                            try {
167
                            try {
167
                                URL url = src.toURI().toURL();
168
                                URL url = Utilities.toURI(src).toURL();
168
                                if (FileUtil.isArchiveFile(url)) {
169
                                if (FileUtil.isArchiveFile(url)) {
169
                                    url = FileUtil.getArchiveRoot(url);
170
                                    url = FileUtil.getArchiveRoot(url);
170
                                }
171
                                }
(-)a/java.project/src/org/netbeans/spi/java/project/classpath/support/ProjectClassPathImplementation.java (-1 / +2 lines)
Lines 65-70 Link Here
65
import org.openide.filesystems.FileObject;
65
import org.openide.filesystems.FileObject;
66
import org.openide.filesystems.FileUtil;
66
import org.openide.filesystems.FileUtil;
67
import org.openide.filesystems.URLMapper;
67
import org.openide.filesystems.URLMapper;
68
import org.openide.util.Utilities;
68
import org.openide.util.WeakListeners;
69
import org.openide.util.WeakListeners;
69
70
70
/** 
71
/** 
Lines 150-156 Link Here
150
                            //Logging for issue #181155, #186213
151
                            //Logging for issue #181155, #186213
151
                            String foStatus;
152
                            String foStatus;
152
                            try {
153
                            try {
153
                                final FileObject fo = URLMapper.findFileObject(f.toURI().toURL());
154
                                final FileObject fo = URLMapper.findFileObject(Utilities.toURI(f).toURL());
154
                                foStatus = fo == null ? "not exist" : fo.isValid() ? fo.isFolder() ? "valid folder" : "valid file" : "invalid";   //NOI18N
155
                                foStatus = fo == null ? "not exist" : fo.isValid() ? fo.isFolder() ? "valid folder" : "valid file" : "invalid";   //NOI18N
155
                            } catch (MalformedURLException ex) {
156
                            } catch (MalformedURLException ex) {
156
                                foStatus = "malformed"; //NOI18N
157
                                foStatus = "malformed"; //NOI18N
(-)a/java.project/src/org/netbeans/spi/java/project/support/ui/MakeSharableVisualPanel2.java (-1 / +2 lines)
Lines 82-87 Link Here
82
import org.openide.util.Exceptions;
82
import org.openide.util.Exceptions;
83
import org.openide.util.NbBundle.Messages;
83
import org.openide.util.NbBundle.Messages;
84
import org.openide.util.NbCollections;
84
import org.openide.util.NbCollections;
85
import org.openide.util.Utilities;
85
86
86
final class MakeSharableVisualPanel2 extends JPanel {
87
final class MakeSharableVisualPanel2 extends JPanel {
87
88
Lines 360-366 Link Here
360
            File libraryFile = helper.resolveFile(location);
361
            File libraryFile = helper.resolveFile(location);
361
            File prjDir = FileUtil.toFile(helper.getProjectDirectory());
362
            File prjDir = FileUtil.toFile(helper.getProjectDirectory());
362
            boolean absoluteLibrary = LibrariesSupport.convertFilePathToURI(location).isAbsolute();
363
            boolean absoluteLibrary = LibrariesSupport.convertFilePathToURI(location).isAbsolute();
363
            LibraryManager newmanager = LibraryManager.forLocation(libraryFile.toURI().toURL());
364
            LibraryManager newmanager = LibraryManager.forLocation(Utilities.toURI(libraryFile).toURL());
364
            LibraryManager oldmanager = LibraryManager.getDefault(); //TODO once we support moving from one place to another, change this
365
            LibraryManager oldmanager = LibraryManager.getDefault(); //TODO once we support moving from one place to another, change this
365
            for (String lib : libraries) {
366
            for (String lib : libraries) {
366
                Library library = oldmanager.getLibrary(lib);
367
                Library library = oldmanager.getLibrary(lib);
(-)a/java.project/src/org/netbeans/spi/java/project/support/ui/SharableLibrariesUtils.java (-3 / +4 lines)
Lines 88-93 Link Here
88
import org.openide.util.NbBundle.Messages;
88
import org.openide.util.NbBundle.Messages;
89
import org.openide.util.NbCollections;
89
import org.openide.util.NbCollections;
90
import org.openide.util.NbPreferences;
90
import org.openide.util.NbPreferences;
91
import org.openide.util.Utilities;
91
92
92
/**
93
/**
93
 * Utility methods related to sharable libraries UI.
94
 * Utility methods related to sharable libraries UI.
Lines 470-476 Link Here
470
            assert loc != null;
471
            assert loc != null;
471
            File mainPropertiesFile = helper.resolveFile(loc);
472
            File mainPropertiesFile = helper.resolveFile(loc);
472
            try {
473
            try {
473
                LibraryManager man = LibraryManager.forLocation(mainPropertiesFile.toURI().toURL());
474
                LibraryManager man = LibraryManager.forLocation(Utilities.toURI(mainPropertiesFile).toURL());
474
                Map<String, List<URI>> volumes = new HashMap<String, List<URI>>();
475
                Map<String, List<URI>> volumes = new HashMap<String, List<URI>>();
475
                LibraryTypeProvider provider = LibrariesSupport.getLibraryTypeProvider(library.getType());
476
                LibraryTypeProvider provider = LibrariesSupport.getLibraryTypeProvider(library.getType());
476
                assert provider != null;
477
                assert provider != null;
Lines 492-504 Link Here
492
                                String str = PropertyUtils.relativizeFile(mainPropertiesFile.getParentFile(), path);
493
                                String str = PropertyUtils.relativizeFile(mainPropertiesFile.getParentFile(), path);
493
                                if (str == null) {
494
                                if (str == null) {
494
                                    // the relative path cannot be established, different drives?
495
                                    // the relative path cannot be established, different drives?
495
                                    uri = path.toURI();
496
                                    uri = Utilities.toURI(path);
496
                                } else {
497
                                } else {
497
                                    uri = LibrariesSupport.convertFilePathToURI(str);
498
                                    uri = LibrariesSupport.convertFilePathToURI(str);
498
                                }
499
                                }
499
                            } else {
500
                            } else {
500
                                File path = FileUtil.toFile(fo);
501
                                File path = FileUtil.toFile(fo);
501
                                uri = path.toURI();
502
                                uri = Utilities.toURI(path);
502
                            }
503
                            }
503
                            if (FileUtil.isArchiveFile(fo)) {
504
                            if (FileUtil.isArchiveFile(fo)) {
504
                                uri = appendJarFolder(uri, jarFolder);
505
                                uri = appendJarFolder(uri, jarFolder);
(-)a/java.project/test/unit/src/org/netbeans/modules/java/project/JavaAntLoggerTest.java (-2 / +3 lines)
Lines 64-69 Link Here
64
import org.openide.filesystems.FileUtil;
64
import org.openide.filesystems.FileUtil;
65
import org.openide.modules.InstalledFileLocator;
65
import org.openide.modules.InstalledFileLocator;
66
import org.openide.util.Lookup;
66
import org.openide.util.Lookup;
67
import org.openide.util.Utilities;
67
import org.openide.util.test.MockLookup;
68
import org.openide.util.test.MockLookup;
68
import org.openide.windows.IOProvider;
69
import org.openide.windows.IOProvider;
69
import org.openide.windows.InputOutput;
70
import org.openide.windows.InputOutput;
Lines 148-155 Link Here
148
        private FileObject src, testSrc;
149
        private FileObject src, testSrc;
149
        
150
        
150
        public void setSimpleAppDir(File simpleAppDir) throws Exception {
151
        public void setSimpleAppDir(File simpleAppDir) throws Exception {
151
            buildClasses = slashify(new File(simpleAppDir, "build" + File.separatorChar + "classes").toURI().toURL());
152
            buildClasses = slashify(Utilities.toURI(new File(simpleAppDir, "build" + File.separatorChar + "classes")).toURL());
152
            buildTestClasses = slashify(new File(simpleAppDir, "build" + File.separatorChar + "test" + File.separatorChar + "classes").toURI().toURL());
153
            buildTestClasses = slashify(Utilities.toURI(new File(simpleAppDir, "build" + File.separatorChar + "test" + File.separatorChar + "classes")).toURL());
153
            src = FileUtil.toFileObject(new File(simpleAppDir, "src"));
154
            src = FileUtil.toFileObject(new File(simpleAppDir, "src"));
154
            testSrc = FileUtil.toFileObject(new File(simpleAppDir, "test"));
155
            testSrc = FileUtil.toFileObject(new File(simpleAppDir, "test"));
155
        }
156
        }
(-)a/java.source.ant/antsrc/org/netbeans/modules/java/source/ant/JavacTask.java (-2 / +3 lines)
Lines 57-62 Link Here
57
import org.netbeans.modules.java.source.usages.BuildArtifactMapperImpl;
57
import org.netbeans.modules.java.source.usages.BuildArtifactMapperImpl;
58
import org.netbeans.modules.parsing.api.indexing.IndexingManager;
58
import org.netbeans.modules.parsing.api.indexing.IndexingManager;
59
import org.netbeans.spi.project.support.ant.PropertyUtils;
59
import org.netbeans.spi.project.support.ant.PropertyUtils;
60
import org.openide.util.Utilities;
60
61
61
/**
62
/**
62
 *
63
 *
Lines 84-90 Link Here
84
                File f = PropertyUtils.resolveFile(p.getBaseDir().getAbsoluteFile(), path);
85
                File f = PropertyUtils.resolveFile(p.getBaseDir().getAbsoluteFile(), path);
85
                
86
                
86
                try {
87
                try {
87
                    Boolean built = BuildArtifactMapperImpl.ensureBuilt(f.toURI().toURL(), getProject(), false, true);
88
                    Boolean built = BuildArtifactMapperImpl.ensureBuilt(Utilities.toURI(f).toURL(), getProject(), false, true);
88
89
89
                    if (built == null) {
90
                    if (built == null) {
90
                        noBin = true;
91
                        noBin = true;
Lines 134-140 Link Here
134
135
135
                    try {
136
                    try {
136
                        p.log("Forcing rescan of: " + f.getAbsolutePath(), Project.MSG_VERBOSE);
137
                        p.log("Forcing rescan of: " + f.getAbsolutePath(), Project.MSG_VERBOSE);
137
                        IndexingManager.getDefault().refreshIndex(f.toURI().toURL(), null, false);
138
                        IndexingManager.getDefault().refreshIndex(Utilities.toURI(f).toURL(), null, false);
138
                    } catch (MalformedURLException ex) {
139
                    } catch (MalformedURLException ex) {
139
                        p.log(ex.getMessage(), ex, Project.MSG_VERBOSE);
140
                        p.log(ex.getMessage(), ex, Project.MSG_VERBOSE);
140
                    }
141
                    }
(-)a/java.source.ant/antsrc/org/netbeans/modules/java/source/ant/TranslateClassPath.java (-2 / +3 lines)
Lines 58-63 Link Here
58
import org.openide.filesystems.FileObject;
58
import org.openide.filesystems.FileObject;
59
import org.openide.filesystems.FileUtil;
59
import org.openide.filesystems.FileUtil;
60
import org.openide.filesystems.URLMapper;
60
import org.openide.filesystems.URLMapper;
61
import org.openide.util.Utilities;
61
62
62
/**
63
/**
63
 *
64
 *
Lines 148-155 Link Here
148
                        continue;
149
                        continue;
149
                    }
150
                    }
150
151
151
                    final Boolean bamiResult = clean ? BuildArtifactMapperImpl.clean(sourceFile.toURI().toURL())
152
                    final Boolean bamiResult = clean ? BuildArtifactMapperImpl.clean(Utilities.toURI(sourceFile).toURL())
152
                                               : BuildArtifactMapperImpl.ensureBuilt(sourceFile.toURI().toURL(), getProject(), true, true);
153
                                               : BuildArtifactMapperImpl.ensureBuilt(Utilities.toURI(sourceFile).toURL(), getProject(), true, true);
153
                    if (bamiResult == null) {
154
                    if (bamiResult == null) {
154
                        appendEntry = true;
155
                        appendEntry = true;
155
                        continue;
156
                        continue;
(-)a/java.source.ant/nbproject/project.xml (-1 / +1 lines)
Lines 156-162 Link Here
156
                    <build-prerequisite/>
156
                    <build-prerequisite/>
157
                    <compile-dependency/>
157
                    <compile-dependency/>
158
                    <run-dependency>
158
                    <run-dependency>
159
                        <specification-version>8.0</specification-version>
159
                        <specification-version>8.25</specification-version>
160
                    </run-dependency>
160
                    </run-dependency>
161
                </dependency>
161
                </dependency>
162
                <dependency>
162
                <dependency>
(-)a/java.source.ant/src/org/netbeans/modules/java/source/ant/ProjectRunnerImpl.java (-1 / +2 lines)
Lines 105-110 Link Here
105
import org.netbeans.api.project.ProjectManager;
105
import org.netbeans.api.project.ProjectManager;
106
import org.openide.loaders.DataObject;
106
import org.openide.loaders.DataObject;
107
import org.openide.util.Lookup;
107
import org.openide.util.Lookup;
108
import org.openide.util.Utilities;
108
import org.openide.util.lookup.AbstractLookup;
109
import org.openide.util.lookup.AbstractLookup;
109
import org.openide.util.lookup.InstanceContent;
110
import org.openide.util.lookup.InstanceContent;
110
111
Lines 484-490 Link Here
484
                        continue;
485
                        continue;
485
                    }
486
                    }
486
487
487
                    BuildArtifactMapperImpl.clean(sourceFile.toURI().toURL());
488
                    BuildArtifactMapperImpl.clean(Utilities.toURI(sourceFile).toURL());
488
                }
489
                }
489
            }
490
            }
490
        }
491
        }
(-)a/java.source/nbproject/project.xml (-1 / +1 lines)
Lines 383-389 Link Here
383
                    <build-prerequisite/>
383
                    <build-prerequisite/>
384
                    <compile-dependency/>
384
                    <compile-dependency/>
385
                    <run-dependency>
385
                    <run-dependency>
386
                        <specification-version>8.4</specification-version>
386
                        <specification-version>8.25</specification-version>
387
                    </run-dependency>
387
                    </run-dependency>
388
                </dependency>
388
                </dependency>
389
                <dependency>
389
                <dependency>
(-)a/java.source/src/org/netbeans/api/java/source/ModificationResult.java (-1 / +1 lines)
Lines 178-184 Link Here
178
        for (List<Difference> ds:diffs.values()) {
178
        for (List<Difference> ds:diffs.values()) {
179
            for (Difference d: ds) {
179
            for (Difference d: ds) {
180
                if (d.getKind() == Difference.Kind.CREATE) {
180
                if (d.getKind() == Difference.Kind.CREATE) {
181
                    newFiles.add(new File(((CreateChange) d).getFileObject().toUri()));
181
                    newFiles.add(org.openide.util.Utilities.toFile(((CreateChange) d).getFileObject().toUri()));
182
                }
182
                }
183
            }
183
            }
184
        }
184
        }
(-)a/java.source/src/org/netbeans/api/java/source/SourceUtils.java (-1 / +1 lines)
Lines 970-976 Link Here
970
                        Iterable<? extends URL> mainClasses = ExecutableFilesIndex.DEFAULT.getMainClasses(rootURL);                        
970
                        Iterable<? extends URL> mainClasses = ExecutableFilesIndex.DEFAULT.getMainClasses(rootURL);                        
971
                        List<ElementHandle<TypeElement>> classes = new LinkedList<ElementHandle<TypeElement>>();
971
                        List<ElementHandle<TypeElement>> classes = new LinkedList<ElementHandle<TypeElement>>();
972
                        for (URL mainClass : mainClasses) {
972
                        for (URL mainClass : mainClasses) {
973
                            File mainFo = new File (URI.create(mainClass.toExternalForm()));
973
                            File mainFo = Utilities.toFile(URI.create(mainClass.toExternalForm()));
974
                            if (mainFo.exists()) {
974
                            if (mainFo.exists()) {
975
                                classes.addAll(JavaCustomIndexer.getRelatedTypes(mainFo, rootFile));
975
                                classes.addAll(JavaCustomIndexer.getRelatedTypes(mainFo, rootFile));
976
                            }
976
                            }
(-)a/java.source/src/org/netbeans/api/java/source/WorkingCopy.java (-1 / +2 lines)
Lines 108-113 Link Here
108
import org.openide.loaders.DataFolder;
108
import org.openide.loaders.DataFolder;
109
import org.openide.loaders.DataObject;
109
import org.openide.loaders.DataObject;
110
import org.openide.util.NbBundle;
110
import org.openide.util.NbBundle;
111
import org.openide.util.Utilities;
111
112
112
/**XXX: extends CompilationController now, finish method delegation
113
/**XXX: extends CompilationController now, finish method delegation
113
 *
114
 *
Lines 696-702 Link Here
696
            return scratchFolder.createData("out", "java");
697
            return scratchFolder.createData("out", "java");
697
        }
698
        }
698
699
699
        File pack = new File(sourceFile.toUri()).getParentFile();
700
        File pack = Utilities.toFile(sourceFile.toUri()).getParentFile();
700
701
701
        while (FileUtil.toFileObject(pack) == null) {
702
        while (FileUtil.toFileObject(pack) == null) {
702
            pack = pack.getParentFile();
703
            pack = pack.getParentFile();
(-)a/java.source/src/org/netbeans/modules/java/JavaNode.java (-2 / +3 lines)
Lines 80-85 Link Here
80
import static org.openide.util.ImageUtilities.assignToolTipToImage;
80
import static org.openide.util.ImageUtilities.assignToolTipToImage;
81
import static org.openide.util.ImageUtilities.loadImage;
81
import static org.openide.util.ImageUtilities.loadImage;
82
import static org.openide.util.NbBundle.getMessage;
82
import static org.openide.util.NbBundle.getMessage;
83
import org.openide.util.Utilities;
83
84
84
/**
85
/**
85
 * The node representation of Java source files.
86
 * The node representation of Java source files.
Lines 262-273 Link Here
262
                    URL u = entry.getURL();
263
                    URL u = entry.getURL();
263
                    String item = u.toExternalForm(); // fallback
264
                    String item = u.toExternalForm(); // fallback
264
                    if (u.getProtocol().equals("file")) { // NOI18N
265
                    if (u.getProtocol().equals("file")) { // NOI18N
265
                        item = new File(URI.create(item)).getAbsolutePath();
266
                        item = Utilities.toFile(URI.create(item)).getAbsolutePath();
266
                    } else if (u.getProtocol().equals("jar") && item.endsWith("!/")) { // NOI18N
267
                    } else if (u.getProtocol().equals("jar") && item.endsWith("!/")) { // NOI18N
267
                        URL embedded = FileUtil.getArchiveFile(u);
268
                        URL embedded = FileUtil.getArchiveFile(u);
268
                        assert embedded != null : u;
269
                        assert embedded != null : u;
269
                        if (embedded.getProtocol().equals("file")) { // NOI18N
270
                        if (embedded.getProtocol().equals("file")) { // NOI18N
270
                            item = new File(URI.create(embedded.toExternalForm())).getAbsolutePath();
271
                            item = Utilities.toFile(URI.create(embedded.toExternalForm())).getAbsolutePath();
271
                        }
272
                        }
272
                    }
273
                    }
273
                    if (sb.length() > 0) {
274
                    if (sb.length() > 0) {
(-)a/java.source/src/org/netbeans/modules/java/source/classpath/AptCacheForSourceQuery.java (-2 / +3 lines)
Lines 52-57 Link Here
52
import org.netbeans.modules.java.source.indexing.JavaIndex;
52
import org.netbeans.modules.java.source.indexing.JavaIndex;
53
import org.openide.util.Exceptions;
53
import org.openide.util.Exceptions;
54
import org.openide.util.Parameters;
54
import org.openide.util.Parameters;
55
import org.openide.util.Utilities;
55
56
56
/**
57
/**
57
 *
58
 *
Lines 92-98 Link Here
92
                return sourceRoot;
93
                return sourceRoot;
93
            }
94
            }
94
            final File aptFolder = JavaIndex.getAptFolder(sourceRoot, true);
95
            final File aptFolder = JavaIndex.getAptFolder(sourceRoot, true);
95
            final URL result = aptFolder.toURI().toURL();
96
            final URL result = Utilities.toURI(aptFolder).toURL();
96
            emittedAptFolders.put(result,sourceRoot);
97
            emittedAptFolders.put(result,sourceRoot);
97
            return result;
98
            return result;
98
        } catch (MalformedURLException e) {
99
        } catch (MalformedURLException e) {
Lines 113-119 Link Here
113
        if (sourceRoot != null) {
114
        if (sourceRoot != null) {
114
            try {
115
            try {
115
                final File result = JavaIndex.getClassFolder(sourceRoot);
116
                final File result = JavaIndex.getClassFolder(sourceRoot);
116
                return result.toURI().toURL();
117
                return Utilities.toURI(result).toURL();
117
            } catch (IOException ex) {
118
            } catch (IOException ex) {
118
                Exceptions.printStackTrace(ex);
119
                Exceptions.printStackTrace(ex);
119
            }
120
            }
(-)a/java.source/src/org/netbeans/modules/java/source/indexing/COSSynchronizingIndexer.java (-4 / +5 lines)
Lines 63-68 Link Here
63
import org.openide.filesystems.FileObject;
63
import org.openide.filesystems.FileObject;
64
import org.openide.filesystems.FileUtil;
64
import org.openide.filesystems.FileUtil;
65
import org.openide.util.Exceptions;
65
import org.openide.util.Exceptions;
66
import org.openide.util.Utilities;
66
67
67
/**
68
/**
68
 *
69
 *
Lines 107-113 Link Here
107
                            context.getRoot()
108
                            context.getRoot()
108
                        });
109
                        });
109
                } else if (FileUtil.isParentOf(context.getRoot(), resource)) {
110
                } else if (FileUtil.isParentOf(context.getRoot(), resource)) {
110
                    updated.add(new File(url.toURI()));
111
                    updated.add(Utilities.toFile(url.toURI()));
111
                }
112
                }
112
            } catch (URISyntaxException ex) {
113
            } catch (URISyntaxException ex) {
113
                Exceptions.printStackTrace(ex);
114
                Exceptions.printStackTrace(ex);
Lines 115-121 Link Here
115
        }
116
        }
116
117
117
        try {
118
        try {
118
            File sourceRootFile = new File(context.getRootURI().toURI());
119
            File sourceRootFile = Utilities.toFile(context.getRootURI().toURI());
119
120
120
            if (!context.checkForEditorModifications()) { // #187514, see also #152222 and JavaCustomIndexer
121
            if (!context.checkForEditorModifications()) { // #187514, see also #152222 and JavaCustomIndexer
121
                BuildArtifactMapperImpl.classCacheUpdated(context.getRootURI(), sourceRootFile, Collections.<File>emptyList(), updated, true);
122
                BuildArtifactMapperImpl.classCacheUpdated(context.getRootURI(), sourceRootFile, Collections.<File>emptyList(), updated, true);
Lines 157-170 Link Here
157
158
158
            for (Indexable d : deleted) {
159
            for (Indexable d : deleted) {
159
                try {
160
                try {
160
                    deletedFiles.add(new File(d.getURL().toURI()));
161
                    deletedFiles.add(Utilities.toFile(d.getURL().toURI()));
161
                } catch (URISyntaxException ex) {
162
                } catch (URISyntaxException ex) {
162
                    Exceptions.printStackTrace(ex);
163
                    Exceptions.printStackTrace(ex);
163
                }
164
                }
164
            }
165
            }
165
166
166
            try {
167
            try {
167
                File sourceRootFile = new File(context.getRootURI().toURI());
168
                File sourceRootFile = Utilities.toFile(context.getRootURI().toURI());
168
169
169
                BuildArtifactMapperImpl.classCacheUpdated(context.getRootURI(), sourceRootFile, deletedFiles, Collections.<File>emptyList(), true);
170
                BuildArtifactMapperImpl.classCacheUpdated(context.getRootURI(), sourceRootFile, deletedFiles, Collections.<File>emptyList(), true);
170
            } catch (URISyntaxException ex) {
171
            } catch (URISyntaxException ex) {
(-)a/java.source/src/org/netbeans/modules/java/source/indexing/JavaCustomIndexer.java (-2 / +2 lines)
Lines 347-353 Link Here
347
            return Collections.<CompileTuple>emptySet();
347
            return Collections.<CompileTuple>emptySet();
348
        }
348
        }
349
        try {
349
        try {
350
            final File root = new File (URI.create(rootURL.toString()));
350
            final File root = Utilities.toFile(URI.create(rootURL.toString()));
351
            return VirtualSourceProviderQuery.translate(virtualSources, root);
351
            return VirtualSourceProviderQuery.translate(virtualSources, root);
352
        } catch (IllegalArgumentException e) {
352
        } catch (IllegalArgumentException e) {
353
            //Called on non local fs => not supported, log and ignore.
353
            //Called on non local fs => not supported, log and ignore.
Lines 426-432 Link Here
426
                    for (String fileName : readRSFile(file)) {
426
                    for (String fileName : readRSFile(file)) {
427
                        File f = new File (aptFolder, fileName);
427
                        File f = new File (aptFolder, fileName);
428
                        if (f.exists() && FileObjects.JAVA.equals(FileObjects.getExtension(f.getName()))) {
428
                        if (f.exists() && FileObjects.JAVA.equals(FileObjects.getExtension(f.getName()))) {
429
                            sourceRelativeURLPairs.add(Pair.of(fileName,f.toURI().toURL()));
429
                            sourceRelativeURLPairs.add(Pair.of(fileName,Utilities.toURI(f).toURL()));
430
                        }
430
                        }
431
                        fmTx.delete(f);
431
                        fmTx.delete(f);
432
                    }
432
                    }
(-)a/java.source/src/org/netbeans/modules/java/source/indexing/JavaIndex.java (-1 / +2 lines)
Lines 65-70 Link Here
65
import org.openide.filesystems.FileObject;
65
import org.openide.filesystems.FileObject;
66
import org.openide.filesystems.FileUtil;
66
import org.openide.filesystems.FileUtil;
67
import org.openide.filesystems.URLMapper;
67
import org.openide.filesystems.URLMapper;
68
import org.openide.util.Utilities;
68
69
69
/**
70
/**
70
 *
71
 *
Lines 107-113 Link Here
107
    }
108
    }
108
109
109
    public static File getClassFolder(File root) throws IOException {
110
    public static File getClassFolder(File root) throws IOException {
110
        return getClassFolder(root.toURI().toURL()); //XXX
111
        return getClassFolder(Utilities.toURI(root).toURL()); //XXX
111
    }
112
    }
112
113
113
    public static File getClassFolder(URL url) throws IOException {
114
    public static File getClassFolder(URL url) throws IOException {
(-)a/java.source/src/org/netbeans/modules/java/source/parsing/CachingArchiveProvider.java (-2 / +3 lines)
Lines 56-61 Link Here
56
import org.openide.filesystems.FileObject;
56
import org.openide.filesystems.FileObject;
57
import org.openide.filesystems.FileUtil;
57
import org.openide.filesystems.FileUtil;
58
import org.openide.filesystems.URLMapper;
58
import org.openide.filesystems.URLMapper;
59
import org.openide.util.Utilities;
59
60
60
61
61
/** Global cache for Archives (zip files and folders).
62
/** Global cache for Archives (zip files and folders).
Lines 153-159 Link Here
153
    private static Archive create( URL root, boolean cacheFile ) {
154
    private static Archive create( URL root, boolean cacheFile ) {
154
        String protocol = root.getProtocol();
155
        String protocol = root.getProtocol();
155
        if ("file".equals(protocol)) {
156
        if ("file".equals(protocol)) {
156
            File f = new File (URI.create(root.toExternalForm()));
157
            File f = Utilities.toFile(URI.create(root.toExternalForm()));
157
            if (f.isDirectory()) {
158
            if (f.isDirectory()) {
158
                return new FolderArchive (f);
159
                return new FolderArchive (f);
159
            }
160
            }
Lines 165-171 Link Here
165
            URL inner = FileUtil.getArchiveFile(root);
166
            URL inner = FileUtil.getArchiveFile(root);
166
            protocol = inner.getProtocol();
167
            protocol = inner.getProtocol();
167
            if ("file".equals(protocol)) {
168
            if ("file".equals(protocol)) {
168
                File f = new File (URI.create(inner.toExternalForm()));
169
                File f = Utilities.toFile(URI.create(inner.toExternalForm()));
169
                if (f.isFile()) {
170
                if (f.isFile()) {
170
                    return new CachingArchive( f, cacheFile );
171
                    return new CachingArchive( f, cacheFile );
171
                }
172
                }
(-)a/java.source/src/org/netbeans/modules/java/source/parsing/FileObjects.java (-4 / +4 lines)
Lines 703-709 Link Here
703
     * @return the relative path
703
     * @return the relative path
704
     */
704
     */
705
    public static @NonNull String getRelativePath (@NonNull final URL root, @NonNull final URL fo) throws URISyntaxException {
705
    public static @NonNull String getRelativePath (@NonNull final URL root, @NonNull final URL fo) throws URISyntaxException {
706
        final String path = getRelativePath(new File(root.toURI()), new File(fo.toURI()));
706
        final String path = getRelativePath(Utilities.toFile(root.toURI()), Utilities.toFile(fo.toURI()));
707
        return path.replace(File.separatorChar, '/');   //NOI18N
707
        return path.replace(File.separatorChar, '/');   //NOI18N
708
    }
708
    }
709
    
709
    
Lines 953-959 Link Here
953
        @Override
953
        @Override
954
        public URI toUri () {
954
        public URI toUri () {
955
            if (this.uriCache == null) {
955
            if (this.uriCache == null) {
956
                this.uriCache = f.toURI();
956
                this.uriCache = Utilities.toURI(f);
957
            }
957
            }
958
            return this.uriCache;
958
            return this.uriCache;
959
        }
959
        }
Lines 1283-1289 Link Here
1283
        
1283
        
1284
        @Override
1284
        @Override
1285
        public URI getArchiveURI () {
1285
        public URI getArchiveURI () {
1286
            return this.archiveFile.toURI();
1286
            return Utilities.toURI(this.archiveFile);
1287
        }
1287
        }
1288
        
1288
        
1289
        @Override
1289
        @Override
Lines 1361-1367 Link Here
1361
        
1361
        
1362
        @Override
1362
        @Override
1363
        public URI getArchiveURI () {
1363
        public URI getArchiveURI () {
1364
            return new File (this.zipFile.getName()).toURI();
1364
            return Utilities.toURI(new File (this.zipFile.getName()));
1365
        }
1365
        }
1366
        
1366
        
1367
        @Override
1367
        @Override
(-)a/java.source/src/org/netbeans/modules/java/source/parsing/FolderArchive.java (-3 / +4 lines)
Lines 65-70 Link Here
65
import org.openide.filesystems.FileUtil;
65
import org.openide.filesystems.FileUtil;
66
import org.openide.filesystems.URLMapper;
66
import org.openide.filesystems.URLMapper;
67
import org.openide.util.Exceptions;
67
import org.openide.util.Exceptions;
68
import org.openide.util.Utilities;
68
69
69
/**
70
/**
70
 *
71
 *
Lines 120-126 Link Here
120
                for (File f : content) {
121
                for (File f : content) {
121
                    if ((kinds == null || kinds.contains(FileObjects.getKind(FileObjects.getExtension(f.getName())))) &&
122
                    if ((kinds == null || kinds.contains(FileObjects.getKind(FileObjects.getExtension(f.getName())))) &&
122
                        f.isFile() &&
123
                        f.isFile() &&
123
                        (entry == null || entry.includes(f.toURI().toURL()))) {
124
                        (entry == null || entry.includes(Utilities.toURI(f).toURL()))) {
124
                        result.add(FileObjects.fileFileObject(f,this.root,filter, encoding));
125
                        result.add(FileObjects.fileFileObject(f,this.root,filter, encoding));
125
                    }
126
                    }
126
                }
127
                }
Lines 152-161 Link Here
152
            return FileObjects.fileFileObject(file,this.root,null,encoding);
153
            return FileObjects.fileFileObject(file,this.root,null,encoding);
153
        }
154
        }
154
        try {
155
        try {
155
            final URL srcRoot = getBaseSourceRoot(this.root.toURI().toURL());
156
            final URL srcRoot = getBaseSourceRoot(Utilities.toURI(this.root).toURL());
156
            if (srcRoot != null && JavaIndex.hasSourceCache(srcRoot, false)) {
157
            if (srcRoot != null && JavaIndex.hasSourceCache(srcRoot, false)) {
157
                if ("file".equals(srcRoot.getProtocol())) {         //NOI18N
158
                if ("file".equals(srcRoot.getProtocol())) {         //NOI18N
158
                    final File folder = new File(srcRoot.toURI());
159
                    final File folder = Utilities.toFile(srcRoot.toURI());
159
                    file = new File (folder,path);
160
                    file = new File (folder,path);
160
                    if (file.exists()) {
161
                    if (file.exists()) {
161
                        return FileObjects.fileFileObject(file,folder,null,encoding);
162
                        return FileObjects.fileFileObject(file,folder,null,encoding);
(-)a/java.source/src/org/netbeans/modules/java/source/parsing/OutputFileManager.java (-2 / +3 lines)
Lines 67-72 Link Here
67
import org.openide.filesystems.FileObject;
67
import org.openide.filesystems.FileObject;
68
import org.openide.filesystems.FileUtil;
68
import org.openide.filesystems.FileUtil;
69
import org.openide.util.Exceptions;
69
import org.openide.util.Exceptions;
70
import org.openide.util.Utilities;
70
71
71
/**
72
/**
72
 *
73
 *
Lines 261-267 Link Here
261
                final URL classFolder = AptCacheForSourceQuery.getClassFolder(entry.getURL());
262
                final URL classFolder = AptCacheForSourceQuery.getClassFolder(entry.getURL());
262
                if (classFolder != null) {
263
                if (classFolder != null) {
263
                    try {
264
                    try {
264
                        return new File(classFolder.toURI());
265
                        return Utilities.toFile(classFolder.toURI());
265
                    } catch (URISyntaxException ex) {
266
                    } catch (URISyntaxException ex) {
266
                        Exceptions.printStackTrace(ex);
267
                        Exceptions.printStackTrace(ex);
267
                    }
268
                    }
Lines 282-288 Link Here
282
                        final URL classFolder = AptCacheForSourceQuery.getClassFolder(entry.getURL());
283
                        final URL classFolder = AptCacheForSourceQuery.getClassFolder(entry.getURL());
283
                        if (classFolder != null) {
284
                        if (classFolder != null) {
284
                            try {
285
                            try {
285
                                return new File(classFolder.toURI());
286
                                return Utilities.toFile(classFolder.toURI());
286
                            } catch (URISyntaxException ex) {
287
                            } catch (URISyntaxException ex) {
287
                                Exceptions.printStackTrace(ex);
288
                                Exceptions.printStackTrace(ex);
288
                            }
289
                            }
(-)a/java.source/src/org/netbeans/modules/java/source/parsing/ProcessorGenerated.java (-4 / +5 lines)
Lines 66-71 Link Here
66
import org.netbeans.modules.java.source.usages.Pair;
66
import org.netbeans.modules.java.source.usages.Pair;
67
import org.openide.util.Exceptions;
67
import org.openide.util.Exceptions;
68
import org.openide.util.Parameters;
68
import org.openide.util.Parameters;
69
import org.openide.util.Utilities;
69
70
70
/**
71
/**
71
 *
72
 *
Lines 212-223 Link Here
212
                }
213
                }
213
                apt = true;
214
                apt = true;
214
            }
215
            }
215
            final File sourceRoot = new File (sourceRootURL.toURI());
216
            final File sourceRoot = Utilities.toFile(sourceRootURL.toURI());
216
            final File classCache = apt ?
217
            final File classCache = apt ?
217
                new File (AptCacheForSourceQuery.getClassFolder(sourceRootURL).toURI()):
218
                Utilities.toFile(AptCacheForSourceQuery.getClassFolder(sourceRootURL).toURI()):
218
                JavaIndex.getClassFolder(sourceRoot);
219
                JavaIndex.getClassFolder(sourceRoot);
219
            if (!genSources.isEmpty()) {
220
            if (!genSources.isEmpty()) {
220
                final File sourceFile = new File(forSource.toURI());
221
                final File sourceFile = Utilities.toFile(forSource.toURI());
221
                final String relativePath = FileObjects.stripExtension(FileObjects.getRelativePath(sourceRoot, sourceFile));
222
                final String relativePath = FileObjects.stripExtension(FileObjects.getRelativePath(sourceRoot, sourceFile));
222
                final File cacheFile = new File (classCache, relativePath+'.'+FileObjects.RAPT);
223
                final File cacheFile = new File (classCache, relativePath+'.'+FileObjects.RAPT);
223
                if (!cacheFile.getParentFile().exists()) {
224
                if (!cacheFile.getParentFile().exists()) {
Lines 237-243 Link Here
237
                final StringBuilder sb = readResources(resFile, currentResources);
238
                final StringBuilder sb = readResources(resFile, currentResources);
238
                boolean changed = false;
239
                boolean changed = false;
239
                for (javax.tools.FileObject file : genResources) {
240
                for (javax.tools.FileObject file : genResources) {
240
                    String resPath = FileObjects.getRelativePath(classCache.toURI().toURL(), file.toUri().toURL());
241
                    String resPath = FileObjects.getRelativePath(Utilities.toURI(classCache).toURL(), file.toUri().toURL());
241
                    if (currentResources.add(resPath)) {
242
                    if (currentResources.add(resPath)) {
242
                        sb.append(resPath);
243
                        sb.append(resPath);
243
                        sb.append('\n');    //NOI18N
244
                        sb.append('\n');    //NOI18N
(-)a/java.source/src/org/netbeans/modules/java/source/parsing/SourceFileManager.java (-1 / +2 lines)
Lines 62-67 Link Here
62
import org.openide.filesystems.FileObject;
62
import org.openide.filesystems.FileObject;
63
import org.openide.filesystems.FileUtil;
63
import org.openide.filesystems.FileUtil;
64
import org.openide.filesystems.URLMapper;
64
import org.openide.filesystems.URLMapper;
65
import org.openide.util.Utilities;
65
66
66
/**
67
/**
67
 *
68
 *
Lines 158-164 Link Here
158
            if (rootFile == null) {
159
            if (rootFile == null) {
159
                return null;
160
                return null;
160
            }
161
            }
161
            return FileObjects.nbFileObject(new File(rootFile,FileObjects.convertFolder2Package(rp, File.separatorChar)).toURI().toURL(), roots[0]); //Todo: wrap to protect from write
162
            return FileObjects.nbFileObject(Utilities.toURI(new File(rootFile,FileObjects.convertFolder2Package(rp, File.separatorChar))).toURL(), roots[0]); //Todo: wrap to protect from write
162
        }
163
        }
163
        else {
164
        else {
164
            return SourceFileObject.create (fileRootPair[0], fileRootPair[1]); //Todo: wrap to protect from write
165
            return SourceFileObject.create (fileRootPair[0], fileRootPair[1]); //Todo: wrap to protect from write
(-)a/java.source/src/org/netbeans/modules/java/source/parsing/SourceFileObject.java (-1 / +2 lines)
Lines 80-85 Link Here
80
import org.openide.filesystems.JarFileSystem;
80
import org.openide.filesystems.JarFileSystem;
81
import org.openide.loaders.DataObject;
81
import org.openide.loaders.DataObject;
82
import org.openide.text.NbDocument;
82
import org.openide.text.NbDocument;
83
import org.openide.util.Utilities;
83
84
84
/**
85
/**
85
 *
86
 *
Lines 341-347 Link Here
341
    public @Override String toString () {
342
    public @Override String toString () {
342
        final URI uri = toUri();
343
        final URI uri = toUri();
343
        try {
344
        try {
344
            final File file = new File (uri);
345
            final File file = Utilities.toFile(uri);
345
            return file.getAbsolutePath();
346
            return file.getAbsolutePath();
346
        } catch (IllegalArgumentException iae) {
347
        } catch (IllegalArgumentException iae) {
347
            return uri.toString();
348
            return uri.toString();
(-)a/java.source/src/org/netbeans/modules/java/source/usages/BinaryAnalyser.java (-3 / +4 lines)
Lines 115-120 Link Here
115
import org.openide.filesystems.URLMapper;
115
import org.openide.filesystems.URLMapper;
116
import org.openide.util.Exceptions;
116
import org.openide.util.Exceptions;
117
import org.openide.util.Parameters;
117
import org.openide.util.Parameters;
118
import org.openide.util.Utilities;
118
119
119
120
120
121
Lines 250-256 Link Here
250
            final URL innerURL = FileUtil.getArchiveFile(root);
251
            final URL innerURL = FileUtil.getArchiveFile(root);
251
            if ("file".equals(innerURL.getProtocol())) {  //NOI18N
252
            if ("file".equals(innerURL.getProtocol())) {  //NOI18N
252
                //Fast way
253
                //Fast way
253
                final File archive = new File (URI.create(innerURL.toExternalForm()));
254
                final File archive = Utilities.toFile(URI.create(innerURL.toExternalForm()));
254
                if (archive.canRead()) {
255
                if (archive.canRead()) {
255
                    if (!isUpToDate(ROOT,archive.lastModified())) {
256
                    if (!isUpToDate(ROOT,archive.lastModified())) {
256
                        writer.clear();
257
                        writer.clear();
Lines 281-287 Link Here
281
            }
282
            }
282
        } else if ("file".equals(mainP)) {    //NOI18N
283
        } else if ("file".equals(mainP)) {    //NOI18N
283
            //Fast way
284
            //Fast way
284
            final File rootFile = new File (URI.create(root.toExternalForm()));
285
            final File rootFile = Utilities.toFile(URI.create(root.toExternalForm()));
285
            if (rootFile.isDirectory()) {
286
            if (rootFile.isDirectory()) {
286
                String path = rootFile.getAbsolutePath ();
287
                String path = rootFile.getAbsolutePath ();
287
                if (path.charAt(path.length()-1) != File.separatorChar) {
288
                if (path.charAt(path.length()-1) != File.separatorChar) {
Lines 880-886 Link Here
880
                    } catch (InvalidClassFormatException icf) {
881
                    } catch (InvalidClassFormatException icf) {
881
                        LOGGER.log(Level.WARNING, "Invalid class file format: {0}!/{1}",
882
                        LOGGER.log(Level.WARNING, "Invalid class file format: {0}!/{1}",
882
                                new Object[]{
883
                                new Object[]{
883
                                    new File(zipFile.getName()).toURI(),
884
                                    Utilities.toURI(new File(zipFile.getName())),
884
                                    ze.getName()});     //NOI18N
885
                                    ze.getName()});     //NOI18N
885
                    } catch (IOException x) {
886
                    } catch (IOException x) {
886
                        Exceptions.attachMessage(x, "While scanning: " + ze.getName());                                         //NOI18N
887
                        Exceptions.attachMessage(x, "While scanning: " + ze.getName());                                         //NOI18N
(-)a/java.source/src/org/netbeans/modules/java/source/usages/BuildArtifactMapperImpl.java (-2 / +3 lines)
Lines 97-102 Link Here
97
import org.openide.util.NbBundle;
97
import org.openide.util.NbBundle;
98
import org.openide.util.NbPreferences;
98
import org.openide.util.NbPreferences;
99
import org.openide.util.RequestProcessor;
99
import org.openide.util.RequestProcessor;
100
import org.openide.util.Utilities;
100
import org.openide.util.WeakSet;
101
import org.openide.util.WeakSet;
101
102
102
/**
103
/**
Lines 211-217 Link Here
211
            File f = FileUtil.archiveOrDirForURL(u);
212
            File f = FileUtil.archiveOrDirForURL(u);
212
213
213
            try {
214
            try {
214
                if (FileUtil.isArchiveFile(f.toURI().toURL())) {
215
                if (FileUtil.isArchiveFile(Utilities.toURI(f).toURL())) {
215
                    continue;
216
                    continue;
216
                }
217
                }
217
            
218
            
Lines 663-669 Link Here
663
            }
664
            }
664
            b.append("../"); // NOI18N
665
            b.append("../"); // NOI18N
665
        }
666
        }
666
        URI u = base.toURI().relativize(file.toURI());
667
        URI u = Utilities.toURI(base).relativize(Utilities.toURI(file));
667
        assert !u.isAbsolute() : u + " from " + basedir + " and " + file + " with common root " + base;
668
        assert !u.isAbsolute() : u + " from " + basedir + " and " + file + " with common root " + base;
668
        b.append(u.getPath());
669
        b.append(u.getPath());
669
        if (b.charAt(b.length() - 1) == '/') {
670
        if (b.charAt(b.length() - 1) == '/') {
(-)a/java.source/src/org/netbeans/modules/java/source/usages/VirtualSourceProviderQuery.java (-2 / +3 lines)
Lines 63-68 Link Here
63
import org.openide.util.LookupEvent;
63
import org.openide.util.LookupEvent;
64
import org.openide.util.LookupListener;
64
import org.openide.util.LookupListener;
65
import org.openide.util.Parameters;
65
import org.openide.util.Parameters;
66
import org.openide.util.Utilities;
66
import org.openide.util.WeakListeners;
67
import org.openide.util.WeakListeners;
67
68
68
/**
69
/**
Lines 133-139 Link Here
133
                   l = p.second;
134
                   l = p.second;
134
               }
135
               }
135
               try {
136
               try {
136
                   final File file = new File(indexable.getURL().toURI());
137
                   final File file = Utilities.toFile(indexable.getURL().toURI());
137
                   l.add(file);
138
                   l.add(file);
138
                   file2indexables.put(file, indexable);
139
                   file2indexables.put(file, indexable);
139
               } catch (URISyntaxException use) {
140
               } catch (URISyntaxException use) {
Lines 190-196 Link Here
190
            assert root != null;
191
            assert root != null;
191
            assert file2indexables != null;
192
            assert file2indexables != null;
192
            this.root = root;
193
            this.root = root;
193
            String _rootURL = root.toURI().toURL().toString();
194
            String _rootURL = Utilities.toURI(root).toURL().toString();
194
            if (!_rootURL.endsWith("/")) {   //NOI18N
195
            if (!_rootURL.endsWith("/")) {   //NOI18N
195
                _rootURL = _rootURL + '/';    //NOI18N
196
                _rootURL = _rootURL + '/';    //NOI18N
196
            }
197
            }
(-)a/java.source/test/unit/src/org/netbeans/api/java/source/ElementHandleTest.java (-1 / +2 lines)
Lines 75-80 Link Here
75
import org.openide.filesystems.FileObject;
75
import org.openide.filesystems.FileObject;
76
import org.openide.filesystems.FileUtil;
76
import org.openide.filesystems.FileUtil;
77
import org.openide.util.Lookup;
77
import org.openide.util.Lookup;
78
import org.openide.util.Utilities;
78
import org.openide.util.lookup.Lookups;
79
import org.openide.util.lookup.Lookups;
79
import org.openide.util.lookup.ProxyLookup;
80
import org.openide.util.lookup.ProxyLookup;
80
81
Lines 719-725 Link Here
719
            if (!f.exists()) {
720
            if (!f.exists()) {
720
                continue;
721
                continue;
721
            }
722
            }
722
            URL url = f.toURI().toURL();
723
            URL url = Utilities.toURI(f).toURL();
723
            if (FileUtil.isArchiveFile(url)) {
724
            if (FileUtil.isArchiveFile(url)) {
724
                url = FileUtil.getArchiveRoot(url);
725
                url = FileUtil.getArchiveRoot(url);
725
            }
726
            }
(-)a/java.source/test/unit/src/org/netbeans/api/java/source/JavaSourceTaskFactoryTest.java (-1 / +2 lines)
Lines 77-82 Link Here
77
import org.openide.filesystems.FileObject;
77
import org.openide.filesystems.FileObject;
78
import org.openide.filesystems.FileUtil;
78
import org.openide.filesystems.FileUtil;
79
import org.openide.util.Lookup;
79
import org.openide.util.Lookup;
80
import org.openide.util.Utilities;
80
import org.openide.util.lookup.ProxyLookup;
81
import org.openide.util.lookup.ProxyLookup;
81
82
82
/**
83
/**
Lines 372-378 Link Here
372
                if (!f.exists()) {
373
                if (!f.exists()) {
373
                    continue;
374
                    continue;
374
                }
375
                }
375
                URL url = f.toURI().toURL();
376
                URL url = Utilities.toURI(f).toURL();
376
                if (FileUtil.isArchiveFile(url)) {
377
                if (FileUtil.isArchiveFile(url)) {
377
                    url = FileUtil.getArchiveRoot(url);
378
                    url = FileUtil.getArchiveRoot(url);
378
                }
379
                }
(-)a/java.source/test/unit/src/org/netbeans/api/java/source/JavaSourceTest.java (-2 / +2 lines)
Lines 2347-2353 Link Here
2347
            if (!f.exists()) {
2347
            if (!f.exists()) {
2348
                continue;
2348
                continue;
2349
            }
2349
            }
2350
            URL url = f.toURI().toURL();
2350
            URL url = org.openide.util.Utilities.toURI(f).toURL();
2351
            if (FileUtil.isArchiveFile(url)) {
2351
            if (FileUtil.isArchiveFile(url)) {
2352
                url = FileUtil.getArchiveRoot(url);
2352
                url = FileUtil.getArchiveRoot(url);
2353
            }
2353
            }
Lines 2366-2372 Link Here
2366
        if (!root.exists()) {
2366
        if (!root.exists()) {
2367
            root.mkdirs();
2367
            root.mkdirs();
2368
        }
2368
        }
2369
        return ClassPathSupport.createClassPath(new URL[] {root.toURI().toURL()});
2369
        return ClassPathSupport.createClassPath(new URL[] {org.openide.util.Utilities.toURI(root).toURL()});
2370
    }
2370
    }
2371
2371
2372
    private FileObject createTestFile (FileObject srcRoot, String relativeName, String content) throws IOException {
2372
    private FileObject createTestFile (FileObject srcRoot, String relativeName, String content) throws IOException {
(-)a/java.source/test/unit/src/org/netbeans/api/java/source/ScanUtilsTest.java (-2 / +2 lines)
Lines 123-129 Link Here
123
            if (!f.exists()) {
123
            if (!f.exists()) {
124
                continue;
124
                continue;
125
            }
125
            }
126
            URL url = f.toURI().toURL();
126
            URL url = org.openide.util.Utilities.toURI(f).toURL();
127
            if (FileUtil.isArchiveFile(url)) {
127
            if (FileUtil.isArchiveFile(url)) {
128
                url = FileUtil.getArchiveRoot(url);
128
                url = FileUtil.getArchiveRoot(url);
129
            }
129
            }
Lines 142-148 Link Here
142
        if (!root.exists()) {
142
        if (!root.exists()) {
143
            root.mkdirs();
143
            root.mkdirs();
144
        }
144
        }
145
        return ClassPathSupport.createClassPath(new URL[] {root.toURI().toURL()});
145
        return ClassPathSupport.createClassPath(new URL[] {org.openide.util.Utilities.toURI(root).toURL()});
146
    }
146
    }
147
    
147
    
148
    static class ScannerBlock implements Runnable {
148
    static class ScannerBlock implements Runnable {
(-)a/java.source/test/unit/src/org/netbeans/api/java/source/TestUtilities.java (-1 / +2 lines)
Lines 73-78 Link Here
73
import org.netbeans.spi.java.classpath.support.ClassPathSupport;
73
import org.netbeans.spi.java.classpath.support.ClassPathSupport;
74
import org.openide.filesystems.FileObject;
74
import org.openide.filesystems.FileObject;
75
import org.openide.filesystems.FileUtil;
75
import org.openide.filesystems.FileUtil;
76
import org.openide.util.Utilities;
76
77
77
/**
78
/**
78
 * Utilities to aid unit testing java.source module.
79
 * Utilities to aid unit testing java.source module.
Lines 161-167 Link Here
161
            if (!f.exists()) {
162
            if (!f.exists()) {
162
                continue;
163
                continue;
163
            }
164
            }
164
            URL url = f.toURI().toURL();
165
            URL url = Utilities.toURI(f).toURL();
165
            if (FileUtil.isArchiveFile(url)) {
166
            if (FileUtil.isArchiveFile(url)) {
166
                url = FileUtil.getArchiveRoot(url);
167
                url = FileUtil.getArchiveRoot(url);
167
            }
168
            }
(-)a/java.source/test/unit/src/org/netbeans/api/java/source/TestUtilitiesTest.java (-1 / +2 lines)
Lines 55-60 Link Here
55
import org.openide.filesystems.FileObject;
55
import org.openide.filesystems.FileObject;
56
import org.openide.filesystems.FileUtil;
56
import org.openide.filesystems.FileUtil;
57
import org.openide.filesystems.URLMapper;
57
import org.openide.filesystems.URLMapper;
58
import org.openide.util.Utilities;
58
59
59
/**
60
/**
60
 *
61
 *
Lines 78-84 Link Here
78
        sourceDir.mkdirs();        
79
        sourceDir.mkdirs();        
79
        boot = TestUtilities.createBootClassPath ();
80
        boot = TestUtilities.createBootClassPath ();
80
        compile = ClassPathSupport.createClassPath(new URL[0]);
81
        compile = ClassPathSupport.createClassPath(new URL[0]);
81
        source = ClassPathSupport.createClassPath(new URL[]{sourceDir.toURI().toURL()});
82
        source = ClassPathSupport.createClassPath(new URL[]{Utilities.toURI(sourceDir).toURL()});
82
        TestUtilities.setCacheFolder(cache);
83
        TestUtilities.setCacheFolder(cache);
83
        IndexingManager.getDefault().refreshIndexAndWait(sourceDir.toURL(), null);
84
        IndexingManager.getDefault().refreshIndexAndWait(sourceDir.toURL(), null);
84
        assertTrue(TestUtilities.waitScanFinished(10, TimeUnit.SECONDS));
85
        assertTrue(TestUtilities.waitScanFinished(10, TimeUnit.SECONDS));
(-)a/java.source/test/unit/src/org/netbeans/api/java/source/UiUtilsTest.java (-1 / +2 lines)
Lines 65-70 Link Here
65
import java.util.Collections;
65
import java.util.Collections;
66
import java.util.List;
66
import java.util.List;
67
import java.util.StringTokenizer;
67
import java.util.StringTokenizer;
68
import org.openide.util.Utilities;
68
69
69
/**
70
/**
70
 * @author Tomas Zezula
71
 * @author Tomas Zezula
Lines 159-165 Link Here
159
        while (tk.hasMoreTokens()) {
160
        while (tk.hasMoreTokens()) {
160
            String token = tk.nextToken();
161
            String token = tk.nextToken();
161
            File f = new File(token);
162
            File f = new File(token);
162
            URL url = f.toURI().toURL();
163
            URL url = Utilities.toURI(f).toURL();
163
            if (FileUtil.isArchiveFile(url)) {
164
            if (FileUtil.isArchiveFile(url)) {
164
                url = FileUtil.getArchiveRoot(url);
165
                url = FileUtil.getArchiveRoot(url);
165
            } else if (!f.exists()) {
166
            } else if (!f.exists()) {
(-)a/java.source/test/unit/src/org/netbeans/api/java/source/gen/GeneratorTestBase.java (-2 / +3 lines)
Lines 74-79 Link Here
74
import org.openide.filesystems.FileStateInvalidException;
74
import org.openide.filesystems.FileStateInvalidException;
75
import org.openide.filesystems.FileUtil;
75
import org.openide.filesystems.FileUtil;
76
import org.openide.util.SharedClassObject;
76
import org.openide.util.SharedClassObject;
77
import org.openide.util.Utilities;
77
78
78
/**
79
/**
79
 *
80
 *
Lines 174-182 Link Here
174
        URL url = null;
175
        URL url = null;
175
        try {
176
        try {
176
            if (isArchiveFile(f)) {
177
            if (isArchiveFile(f)) {
177
                url = FileUtil.getArchiveRoot(f.toURI().toURL());
178
                url = FileUtil.getArchiveRoot(Utilities.toURI(f).toURL());
178
            } else {
179
            } else {
179
                url = f.toURI().toURL();
180
                url = Utilities.toURI(f).toURL();
180
                String surl = url.toExternalForm();
181
                String surl = url.toExternalForm();
181
                if (!surl.endsWith("/")) {
182
                if (!surl.endsWith("/")) {
182
                    url = new URL(surl+"/");
183
                    url = new URL(surl+"/");
(-)a/java.source/test/unit/src/org/netbeans/api/java/source/gen/GeneratorTestMDRCompat.java (-2 / +3 lines)
Lines 70-75 Link Here
70
import org.openide.filesystems.FileUtil;
70
import org.openide.filesystems.FileUtil;
71
import org.openide.util.Exceptions;
71
import org.openide.util.Exceptions;
72
import org.openide.util.SharedClassObject;
72
import org.openide.util.SharedClassObject;
73
import org.openide.util.Utilities;
73
74
74
/**
75
/**
75
 *
76
 *
Lines 138-146 Link Here
138
        URL url = null;
139
        URL url = null;
139
        try {
140
        try {
140
            if (isArchiveFile(f)) {
141
            if (isArchiveFile(f)) {
141
                url = FileUtil.getArchiveRoot(f.toURI().toURL());
142
                url = FileUtil.getArchiveRoot(Utilities.toURI(f).toURL());
142
            } else {
143
            } else {
143
                url = f.toURI().toURL();
144
                url = Utilities.toURI(f).toURL();
144
                String surl = url.toExternalForm();
145
                String surl = url.toExternalForm();
145
                if (!surl.endsWith("/")) {
146
                if (!surl.endsWith("/")) {
146
                    url = new URL(surl+"/");
147
                    url = new URL(surl+"/");
(-)a/java.source/test/unit/src/org/netbeans/api/java/source/gen/ImportAnalysis2Test.java (-2 / +3 lines)
Lines 81-86 Link Here
81
import org.netbeans.spi.java.classpath.support.ClassPathSupport;
81
import org.netbeans.spi.java.classpath.support.ClassPathSupport;
82
import org.openide.filesystems.FileObject;
82
import org.openide.filesystems.FileObject;
83
import org.openide.filesystems.FileUtil;
83
import org.openide.filesystems.FileUtil;
84
import org.openide.util.Utilities;
84
85
85
/**
86
/**
86
 * Tests imports matching and its correct adding/removing. Just generator
87
 * Tests imports matching and its correct adding/removing. Just generator
Lines 712-718 Link Here
712
            "\n" +
713
            "\n" +
713
            "public abstract class Test implements Entry, Map {\n" +
714
            "public abstract class Test implements Entry, Map {\n" +
714
            "}\n";
715
            "}\n";
715
        final TransactionContext ctx = TransactionContext.beginStandardTransaction(true, getWorkDir().toURI().toURL());
716
        final TransactionContext ctx = TransactionContext.beginStandardTransaction(true, Utilities.toURI(getWorkDir()).toURL());
716
        try {
717
        try {
717
            ClasspathInfo cpInfo = ClasspathInfoAccessor.getINSTANCE().create (ClassPathSupport.createClassPath(System.getProperty("sun.boot.class.path")), ClassPath.EMPTY, ClassPathSupport.createClassPath(getSourcePath()), null, true, false, false, true);
718
            ClasspathInfo cpInfo = ClasspathInfoAccessor.getINSTANCE().create (ClassPathSupport.createClassPath(System.getProperty("sun.boot.class.path")), ClassPath.EMPTY, ClassPathSupport.createClassPath(getSourcePath()), null, true, false, false, true);
718
            JavaSource src = JavaSource.create(cpInfo, FileUtil.toFileObject(testFile));
719
            JavaSource src = JavaSource.create(cpInfo, FileUtil.toFileObject(testFile));
Lines 755-761 Link Here
755
            "public abstract class Entry implements Map.Entry, Map {\n" +
756
            "public abstract class Entry implements Map.Entry, Map {\n" +
756
            "}\n";
757
            "}\n";
757
758
758
        final TransactionContext ctx = TransactionContext.beginStandardTransaction(true, getWorkDir().toURI().toURL());
759
        final TransactionContext ctx = TransactionContext.beginStandardTransaction(true, Utilities.toURI(getWorkDir()).toURL());
759
        try {
760
        try {
760
            ClasspathInfo cpInfo = ClasspathInfoAccessor.getINSTANCE().create (ClassPathSupport.createClassPath(System.getProperty("sun.boot.class.path")), ClassPath.EMPTY, ClassPathSupport.createClassPath(getSourcePath()), null, true, false, false, true);
761
            ClasspathInfo cpInfo = ClasspathInfoAccessor.getINSTANCE().create (ClassPathSupport.createClassPath(System.getProperty("sun.boot.class.path")), ClassPath.EMPTY, ClassPathSupport.createClassPath(getSourcePath()), null, true, false, false, true);
761
            JavaSource src = JavaSource.create(cpInfo, FileUtil.toFileObject(testFile));
762
            JavaSource src = JavaSource.create(cpInfo, FileUtil.toFileObject(testFile));
(-)a/java.source/test/unit/src/org/netbeans/api/java/source/performance/Utilities.java (-1 / +1 lines)
Lines 152-158 Link Here
152
        if (!root.exists()) {
152
        if (!root.exists()) {
153
            root.mkdirs();
153
            root.mkdirs();
154
        }
154
        }
155
        return ClassPathSupport.createClassPath(new URL[]{root.toURI().toURL()});
155
        return ClassPathSupport.createClassPath(new URL[]{org.openide.util.Utilities.toURI(root).toURL()});
156
    }
156
    }
157
157
158
    public static String projectOpen(String path, String tmpFile) {
158
    public static String projectOpen(String path, String tmpFile) {
(-)a/java.source/test/unit/src/org/netbeans/modules/java/FileToURLTest.java (-2 / +3 lines)
Lines 35-40 Link Here
35
import java.io.File;
35
import java.io.File;
36
import java.net.URI;
36
import java.net.URI;
37
import java.net.MalformedURLException;
37
import java.net.MalformedURLException;
38
import org.openide.util.Utilities;
38
39
39
/**
40
/**
40
 * @author Rastislav Komara (<a href="mailto:moonko@netbeans.orgm">RKo</a>)
41
 * @author Rastislav Komara (<a href="mailto:moonko@netbeans.orgm">RKo</a>)
Lines 62-68 Link Here
62
        }
63
        }
63
        URI uri2;
64
        URI uri2;
64
        try {
65
        try {
65
            uri2 = URI.create(file.toURI().toURL().toExternalForm());
66
            uri2 = URI.create(Utilities.toURI(file).toURL().toExternalForm());
66
        } catch (Exception e) {
67
        } catch (Exception e) {
67
//            fail(e.getMessage());
68
//            fail(e.getMessage());
68
            e.printStackTrace(getLog());
69
            e.printStackTrace(getLog());
Lines 70-76 Link Here
70
        }
71
        }
71
        URI uri3;
72
        URI uri3;
72
        try {
73
        try {
73
            uri3 = file.toURI();
74
            uri3 = Utilities.toURI(file);
74
        } catch (Exception e) {
75
        } catch (Exception e) {
75
            //            fail(e.getMessage());
76
            //            fail(e.getMessage());
76
            e.printStackTrace(getLog());
77
            e.printStackTrace(getLog());
(-)a/java.source/test/unit/src/org/netbeans/modules/java/source/classpath/SourcePathTest.java (-2 / +3 lines)
Lines 57-62 Link Here
57
import org.netbeans.spi.java.classpath.ClassPathImplementation;
57
import org.netbeans.spi.java.classpath.ClassPathImplementation;
58
import org.netbeans.spi.java.classpath.PathResourceImplementation;
58
import org.netbeans.spi.java.classpath.PathResourceImplementation;
59
import org.netbeans.spi.java.classpath.support.ClassPathSupport;
59
import org.netbeans.spi.java.classpath.support.ClassPathSupport;
60
import org.openide.util.Utilities;
60
61
61
/**
62
/**
62
 *
63
 *
Lines 82-89 Link Here
82
        
83
        
83
        final ClassPathImplementation baseImpl = ClassPathSupport.createClassPathImplementation(
84
        final ClassPathImplementation baseImpl = ClassPathSupport.createClassPathImplementation(
84
            Arrays.asList(new PathResourceImplementation[] {
85
            Arrays.asList(new PathResourceImplementation[] {
85
                ClassPathSupport.createResource(r1.toURI().toURL()),
86
                ClassPathSupport.createResource(Utilities.toURI(r1).toURL()),
86
                ClassPathSupport.createResource(r2.toURI().toURL())
87
                ClassPathSupport.createResource(Utilities.toURI(r2).toURL())
87
            }));
88
            }));
88
        final ClassPath base = ClassPathFactory.createClassPath(baseImpl);
89
        final ClassPath base = ClassPathFactory.createClassPath(baseImpl);
89
        
90
        
(-)a/java.source/test/unit/src/org/netbeans/modules/java/source/parsing/CachingFileManagerTest.java (-1 / +2 lines)
Lines 61-66 Link Here
61
import org.netbeans.modules.java.source.usages.Pair;
61
import org.netbeans.modules.java.source.usages.Pair;
62
import org.netbeans.spi.java.classpath.support.ClassPathSupport;
62
import org.netbeans.spi.java.classpath.support.ClassPathSupport;
63
import org.openide.filesystems.FileUtil;
63
import org.openide.filesystems.FileUtil;
64
import org.openide.util.Utilities;
64
65
65
/**
66
/**
66
 *
67
 *
Lines 102-108 Link Here
102
        } finally {
103
        } finally {
103
            out.close();
104
            out.close();
104
        }
105
        }
105
        final URL archiveRoot = FileUtil.getArchiveRoot(archiveFile.toURI().toURL());
106
        final URL archiveRoot = FileUtil.getArchiveRoot(Utilities.toURI(archiveFile).toURL());
106
        final URI expectedURI = new URL (archiveRoot.toExternalForm()+"org/me/resources/test.txt").toURI();
107
        final URI expectedURI = new URL (archiveRoot.toExternalForm()+"org/me/resources/test.txt").toURI();
107
        doTestGetFileForInput(ClassPathSupport.createClassPath(archiveRoot),
108
        doTestGetFileForInput(ClassPathSupport.createClassPath(archiveRoot),
108
        Arrays.asList(
109
        Arrays.asList(
(-)a/java.source/test/unit/src/org/netbeans/modules/java/source/parsing/ClasspathInfoTest.java (-1 / +2 lines)
Lines 78-83 Link Here
78
import org.openide.filesystems.FileLock;
78
import org.openide.filesystems.FileLock;
79
import org.openide.filesystems.FileObject;
79
import org.openide.filesystems.FileObject;
80
import org.openide.filesystems.FileUtil;
80
import org.openide.filesystems.FileUtil;
81
import org.openide.util.Utilities;
81
82
82
/**
83
/**
83
 *
84
 *
Lines 108-114 Link Here
108
        IndexUtil.setCacheFolder(cacheFolder);
109
        IndexUtil.setCacheFolder(cacheFolder);
109
        TestUtil.copyFiles( TestUtil.getJdkDir(), workDir, TestUtil.RT_JAR );
110
        TestUtil.copyFiles( TestUtil.getJdkDir(), workDir, TestUtil.RT_JAR );
110
        rtJar = FileUtil.normalizeFile(new File( workDir, TestUtil.RT_JAR ));
111
        rtJar = FileUtil.normalizeFile(new File( workDir, TestUtil.RT_JAR ));
111
        URL url = FileUtil.getArchiveRoot (rtJar.toURI().toURL());
112
        URL url = FileUtil.getArchiveRoot (Utilities.toURI(rtJar).toURL());
112
        this.bootPath = ClassPathSupport.createClassPath (new URL[] {url});
113
        this.bootPath = ClassPathSupport.createClassPath (new URL[] {url});
113
        this.classPath = ClassPathSupport.createClassPath(new URL[0]);
114
        this.classPath = ClassPathSupport.createClassPath(new URL[0]);
114
    }
115
    }
(-)a/java.source/test/unit/src/org/netbeans/modules/java/source/parsing/FileManagerTest.java (-4 / +5 lines)
Lines 56-61 Link Here
56
import javax.tools.StandardLocation;
56
import javax.tools.StandardLocation;
57
import org.netbeans.junit.NbTestCase;
57
import org.netbeans.junit.NbTestCase;
58
import org.netbeans.modules.java.source.TestUtil;
58
import org.netbeans.modules.java.source.TestUtil;
59
import org.openide.util.Utilities;
59
60
60
/** Base class for testing file managers. This class basically tests itself.
61
/** Base class for testing file managers. This class basically tests itself.
61
 *
62
 *
Lines 97-106 Link Here
97
        // Create archive provider
98
        // Create archive provider
98
        archiveProvider = CachingArchiveProvider.getDefault();
99
        archiveProvider = CachingArchiveProvider.getDefault();
99
100
100
        rtJarArchive = archiveProvider.getArchive(rtFile.toURI().toURL(), true);
101
        rtJarArchive = archiveProvider.getArchive(Utilities.toURI(rtFile).toURL(), true);
101
        rtFolderArchive = archiveProvider.getArchive(rtFolder.toURI().toURL(), true);
102
        rtFolderArchive = archiveProvider.getArchive(Utilities.toURI(rtFolder).toURL(), true);
102
        srcZipArchive = archiveProvider.getArchive(srcFile.toURI().toURL(), true);
103
        srcZipArchive = archiveProvider.getArchive(Utilities.toURI(srcFile).toURL(), true);
103
        srcFolderArchive = archiveProvider.getArchive(srcFolder.toURI().toURL(), true);
104
        srcFolderArchive = archiveProvider.getArchive(Utilities.toURI(srcFolder).toURL(), true);
104
    }
105
    }
105
106
106
    protected JavaFileManagerDescripton[] getDescriptions() throws IOException {
107
    protected JavaFileManagerDescripton[] getDescriptions() throws IOException {
(-)a/java.source/test/unit/src/org/netbeans/modules/java/source/parsing/FileObjectsTest.java (-1 / +2 lines)
Lines 60-65 Link Here
60
import org.netbeans.modules.java.preprocessorbridge.spi.JavaFileFilterImplementation;
60
import org.netbeans.modules.java.preprocessorbridge.spi.JavaFileFilterImplementation;
61
import org.openide.filesystems.FileObject;
61
import org.openide.filesystems.FileObject;
62
import org.openide.filesystems.FileUtil;
62
import org.openide.filesystems.FileUtil;
63
import org.openide.util.Utilities;
63
64
64
/**
65
/**
65
 *
66
 *
Lines 148-154 Link Here
148
           assertFalse("OutputStream should exist for existing file",true);
149
           assertFalse("OutputStream should exist for existing file",true);
149
        }
150
        }
150
        File nonExistring = new File (new File(new File (workDir,"test"),"foo"),"nonexisting.java");
151
        File nonExistring = new File (new File(new File (workDir,"test"),"foo"),"nonexisting.java");
151
        final javax.tools.FileObject nonExistingFo = FileObjects.nbFileObject(nonExistring.toURI().toURL(), wd);
152
        final javax.tools.FileObject nonExistingFo = FileObjects.nbFileObject(Utilities.toURI(nonExistring).toURL(), wd);
152
        assertEquals ("test.foo.nonexisting",((InferableJavaFileObject)nonExistingFo).inferBinaryName());
153
        assertEquals ("test.foo.nonexisting",((InferableJavaFileObject)nonExistingFo).inferBinaryName());
153
        try {
154
        try {
154
            final InputStream in = nonExistingFo.openInputStream();
155
            final InputStream in = nonExistingFo.openInputStream();
(-)a/java.source/test/unit/src/org/netbeans/modules/java/source/parsing/PerfJavacIntefaceGCTest.java (-1 / +2 lines)
Lines 50-55 Link Here
50
import org.netbeans.modules.java.source.TestUtil;
50
import org.netbeans.modules.java.source.TestUtil;
51
import org.netbeans.spi.java.classpath.support.ClassPathSupport;
51
import org.netbeans.spi.java.classpath.support.ClassPathSupport;
52
import org.openide.filesystems.FileUtil;
52
import org.openide.filesystems.FileUtil;
53
import org.openide.util.Utilities;
53
/** Tests whether the JavacInterface gets GCed after some operations
54
/** Tests whether the JavacInterface gets GCed after some operations
54
 *
55
 *
55
 * @author Petr Hrebejk
56
 * @author Petr Hrebejk
Lines 80-86 Link Here
80
        workDir = getWorkDir();
81
        workDir = getWorkDir();
81
        TestUtil.copyFiles( workDir, TestUtil.RT_JAR, "jdk/JTable.java" );
82
        TestUtil.copyFiles( workDir, TestUtil.RT_JAR, "jdk/JTable.java" );
82
        rtJar = new File( workDir, TestUtil.RT_JAR );
83
        rtJar = new File( workDir, TestUtil.RT_JAR );
83
        URL url = FileUtil.getArchiveRoot (rtJar.toURI().toURL());
84
        URL url = FileUtil.getArchiveRoot (Utilities.toURI(rtJar).toURL());
84
        this.bootPath = ClassPathSupport.createClassPath (new URL[] {url});
85
        this.bootPath = ClassPathSupport.createClassPath (new URL[] {url});
85
        this.classPath = ClassPathSupport.createClassPath(new URL[0]);
86
        this.classPath = ClassPathSupport.createClassPath(new URL[0]);
86
    }
87
    }
(-)a/java.source/test/unit/src/org/netbeans/modules/java/source/parsing/PerfResolveTest.java (-1 / +2 lines)
Lines 50-55 Link Here
50
import org.netbeans.modules.java.source.TestUtil;
50
import org.netbeans.modules.java.source.TestUtil;
51
import org.netbeans.spi.java.classpath.support.ClassPathSupport;
51
import org.netbeans.spi.java.classpath.support.ClassPathSupport;
52
import org.openide.filesystems.FileUtil;
52
import org.openide.filesystems.FileUtil;
53
import org.openide.util.Utilities;
53
/** Tests for basic JDK operations
54
/** Tests for basic JDK operations
54
 *
55
 *
55
 * @author Petr Hrebejk
56
 * @author Petr Hrebejk
Lines 79-85 Link Here
79
        workDir = getWorkDir();
80
        workDir = getWorkDir();
80
        TestUtil.copyFiles( workDir, TestUtil.RT_JAR, "jdk/JTable.java" );
81
        TestUtil.copyFiles( workDir, TestUtil.RT_JAR, "jdk/JTable.java" );
81
        rtJar = new File( workDir, TestUtil.RT_JAR );
82
        rtJar = new File( workDir, TestUtil.RT_JAR );
82
        URL url = FileUtil.getArchiveRoot (rtJar.toURI().toURL());
83
        URL url = FileUtil.getArchiveRoot (Utilities.toURI(rtJar).toURL());
83
        this.bootPath = ClassPathSupport.createClassPath (new URL[] {url});
84
        this.bootPath = ClassPathSupport.createClassPath (new URL[] {url});
84
        this.classPath = ClassPathSupport.createClassPath(new URL[0]);
85
        this.classPath = ClassPathSupport.createClassPath(new URL[0]);
85
    }
86
    }
(-)a/java.source/test/unit/src/org/netbeans/modules/java/source/save/FormatingTest.java (-2 / +3 lines)
Lines 76-81 Link Here
76
import org.openide.filesystems.FileUtil;
76
import org.openide.filesystems.FileUtil;
77
import org.openide.loaders.DataObject;
77
import org.openide.loaders.DataObject;
78
import org.openide.util.SharedClassObject;
78
import org.openide.util.SharedClassObject;
79
import org.openide.util.Utilities;
79
80
80
/**
81
/**
81
 * Test different formating options
82
 * Test different formating options
Lines 4264-4272 Link Here
4264
        URL url = null;
4265
        URL url = null;
4265
        try {
4266
        try {
4266
            if (isArchiveFile(f)) {
4267
            if (isArchiveFile(f)) {
4267
                url = FileUtil.getArchiveRoot(f.toURI().toURL());
4268
                url = FileUtil.getArchiveRoot(Utilities.toURI(f).toURL());
4268
            } else {
4269
            } else {
4269
                url = f.toURI().toURL();
4270
                url = Utilities.toURI(f).toURL();
4270
                String surl = url.toExternalForm();
4271
                String surl = url.toExternalForm();
4271
                if (!surl.endsWith("/")) {
4272
                if (!surl.endsWith("/")) {
4272
                    url = new URL(surl + "/");
4273
                    url = new URL(surl + "/");
(-)a/java.source/test/unit/src/org/netbeans/modules/java/source/usages/BinaryAnalyserTest.java (-2 / +3 lines)
Lines 68-73 Link Here
68
import org.openide.filesystems.FileObject;
68
import org.openide.filesystems.FileObject;
69
import org.openide.filesystems.FileUtil;
69
import org.openide.filesystems.FileUtil;
70
import org.openide.util.Exceptions;
70
import org.openide.util.Exceptions;
71
import org.openide.util.Utilities;
71
72
72
/**
73
/**
73
 *
74
 *
Lines 92-98 Link Here
92
        final Index index = IndexManager.createIndex(FileUtil.toFile(indexDir), DocumentUtil.createAnalyzer());
93
        final Index index = IndexManager.createIndex(FileUtil.toFile(indexDir), DocumentUtil.createAnalyzer());
93
        BinaryAnalyser a = new BinaryAnalyser(new IndexWriter(index), getWorkDir());
94
        BinaryAnalyser a = new BinaryAnalyser(new IndexWriter(index), getWorkDir());
94
95
95
        assertEquals(Result.FINISHED, a.start(FileUtil.getArchiveRoot(binaryAnalyzerDataDir.toURI().toURL()), new AtomicBoolean(), new AtomicBoolean()));
96
        assertEquals(Result.FINISHED, a.start(FileUtil.getArchiveRoot(Utilities.toURI(binaryAnalyzerDataDir).toURL()), new AtomicBoolean(), new AtomicBoolean()));
96
97
97
        a.finish();
98
        a.finish();
98
99
Lines 132-138 Link Here
132
133
133
        setLowMemory(true);
134
        setLowMemory(true);
134
        assertEquals(Result.FINISHED, 
135
        assertEquals(Result.FINISHED, 
135
                a.start(FileUtil.getArchiveRoot(binaryAnalyzerDataDir.toURI().toURL()), new AtomicBoolean(), new AtomicBoolean()));
136
                a.start(FileUtil.getArchiveRoot(Utilities.toURI(binaryAnalyzerDataDir).toURL()), new AtomicBoolean(), new AtomicBoolean()));
136
137
137
        a.finish();
138
        a.finish();
138
139
(-)a/java.source/test/unit/src/org/netbeans/modules/java/source/usages/ClassIndexManagerTest.java (-2 / +3 lines)
Lines 50-55 Link Here
50
import org.netbeans.junit.NbTestCase;
50
import org.netbeans.junit.NbTestCase;
51
import org.openide.filesystems.*;
51
import org.openide.filesystems.*;
52
import org.openide.util.Exceptions;
52
import org.openide.util.Exceptions;
53
import org.openide.util.Utilities;
53
54
54
/**
55
/**
55
 *
56
 *
Lines 82-88 Link Here
82
                    holdsLock.countDown();
83
                    holdsLock.countDown();
83
                    try {
84
                    try {
84
                        inListener.await();
85
                        inListener.await();
85
                        ClassIndexManager.getDefault().getUsagesQuery(root.toURI().toURL(), true);
86
                        ClassIndexManager.getDefault().getUsagesQuery(Utilities.toURI(root).toURL(), true);
86
                    } catch (InterruptedException ie) {
87
                    } catch (InterruptedException ie) {
87
                        Exceptions.printStackTrace(ie);
88
                        Exceptions.printStackTrace(ie);
88
                    } catch (MalformedURLException ex) {
89
                    } catch (MalformedURLException ex) {
Lines 94-100 Link Here
94
            };
95
            };
95
            worker.start();
96
            worker.start();
96
            holdsLock.await();
97
            holdsLock.await();
97
            ClassIndexManager.getDefault().getUsagesQuery(root.toURI().toURL(), true);
98
            ClassIndexManager.getDefault().getUsagesQuery(Utilities.toURI(root).toURL(), true);
98
        } finally {
99
        } finally {
99
            FileUtil.removeRecursiveListener(dl, cache);
100
            FileUtil.removeRecursiveListener(dl, cache);
100
        }
101
        }
(-)a/java.source/test/unit/src/org/netbeans/modules/java/source/usages/VirtualSourceProviderQueryTest.java (-1 / +2 lines)
Lines 59-64 Link Here
59
import org.netbeans.modules.parsing.spi.indexing.Indexable;
59
import org.netbeans.modules.parsing.spi.indexing.Indexable;
60
import org.openide.filesystems.FileObject;
60
import org.openide.filesystems.FileObject;
61
import org.openide.filesystems.FileUtil;
61
import org.openide.filesystems.FileUtil;
62
import org.openide.util.Utilities;
62
63
63
/**
64
/**
64
 *
65
 *
Lines 79-85 Link Here
79
    public void testVirtualSourceProvider () throws Exception {
80
    public void testVirtualSourceProvider () throws Exception {
80
        final File root = new File (getWorkDir(),"src");    //NOI18N
81
        final File root = new File (getWorkDir(),"src");    //NOI18N
81
        root.mkdir();
82
        root.mkdir();
82
        final Indexable[] data = prepareData(root.toURI().toURL());
83
        final Indexable[] data = prepareData(Utilities.toURI(root).toURL());
83
        final Iterable<? extends CompileTuple> res = VirtualSourceProviderQuery.translate(Arrays.asList(data), root);
84
        final Iterable<? extends CompileTuple> res = VirtualSourceProviderQuery.translate(Arrays.asList(data), root);
84
        assertEquals(new String[] {"a","b","c","d"}, res);      //NOI18N
85
        assertEquals(new String[] {"a","b","c","d"}, res);      //NOI18N
85
    }
86
    }
(-)a/masterfs/nbproject/project.xml (-1 / +1 lines)
Lines 79-85 Link Here
79
                    <build-prerequisite/>
79
                    <build-prerequisite/>
80
                    <compile-dependency/>
80
                    <compile-dependency/>
81
                    <run-dependency>
81
                    <run-dependency>
82
                        <specification-version>8.3</specification-version>
82
                        <specification-version>8.25</specification-version>
83
                    </run-dependency>
83
                    </run-dependency>
84
                </dependency>
84
                </dependency>
85
                <dependency>
85
                <dependency>
(-)a/masterfs/src/org/netbeans/modules/masterfs/filebasedfs/FileBasedURLMapper.java (-44 / +5 lines)
Lines 47-53 Link Here
47
import java.net.URISyntaxException;
47
import java.net.URISyntaxException;
48
import org.netbeans.modules.masterfs.filebasedfs.fileobjects.BaseFileObj;
48
import org.netbeans.modules.masterfs.filebasedfs.fileobjects.BaseFileObj;
49
import org.openide.filesystems.FileObject;
49
import org.openide.filesystems.FileObject;
50
import org.openide.filesystems.FileUtil;
51
import org.openide.filesystems.URLMapper;
50
import org.openide.filesystems.URLMapper;
52
51
53
import java.io.File;
52
import java.io.File;
Lines 58-95 Link Here
58
import java.util.logging.Logger;
57
import java.util.logging.Logger;
59
import org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObjectFactory;
58
import org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObjectFactory;
60
import org.netbeans.modules.masterfs.filebasedfs.fileobjects.RootObj;
59
import org.netbeans.modules.masterfs.filebasedfs.fileobjects.RootObj;
61
import org.openide.util.Exceptions;
60
import org.openide.util.Utilities;
62
63
//TODO: JDK problems with URL, URI, File conversion for UNC
64
/*
65
There must be consistently called conversion from FileUtil and URLMapper.
66
new File (URI.create (fo.getURL ().toExternalForm ())) is typical scenario that leads to this
67
bug: java.lang.IllegalArgumentException: URI has an authority component
68
        at java.io.File.<init>(File.java:326)
69
70
71
Maybe there would be also possible to return a little special URL from FileBasedURLMapper that
72
would get special subclass of URLStreamHandler in constructor. This subclass of URLStreamHandler
73
would provided external form (method toExternalForm) that would be suitable for above mentioned 
74
conversion from URL to File. 
75
        
76
Known problems :
77
1/     at java.io.File.<init>(File.java:326)
78
     at org.netbeans.modules.javacore.parser.ASTProvider.getClassPath(ASTProvider.java:477)
79
     at org.netbeans.lib.gjast.ASParser$BridgeContext.getClassPath(ASParser.java:421)
80
81
2/
82
       at java.io.File.<init>(File.java:326)
83
       at org.netbeans.modules.javacore.scanning.FileScanner.<init>(FileScanner.java:85)
84
catch] at org.netbeans.modules.javacore.JMManager.scanFiles(JMManager.java:1112)
85
86
3/ org.netbeans.modules.javacore.parser.ECRequestDescImpl.getFileName(FileObject fo,StringBuffer buf)
87
    at java.io.File.<init>(File.java:326)
88
     
89
    
90
    
91
    
92
*/
93
61
94
public final class FileBasedURLMapper extends URLMapper {
62
public final class FileBasedURLMapper extends URLMapper {
95
    private static final Logger LOG = Logger.getLogger(FileBasedURLMapper.class.getName());
63
    private static final Logger LOG = Logger.getLogger(FileBasedURLMapper.class.getName());
Lines 126-132 Link Here
126
        FileObject retVal = null;
94
        FileObject retVal = null;
127
        File file;
95
        File file;
128
        try {
96
        try {
129
            file = FileUtil.normalizeFile(url2F(url));
97
            file = Utilities.toFile(url.toURI());
130
        } catch (URISyntaxException e) {
98
        } catch (URISyntaxException e) {
131
            LOG.log(Level.INFO, "URL=" + url, e); // NOI18N
99
            LOG.log(Level.INFO, "URL=" + url, e); // NOI18N
132
            return null;
100
            return null;
Lines 155-161 Link Here
155
123
156
    /** #171330 - Method taken from java.io.File.toURI. We know whether given
124
    /** #171330 - Method taken from java.io.File.toURI. We know whether given
157
     * FileObject is a file or folder, so we can eliminate File.isDirectory
125
     * FileObject is a file or folder, so we can eliminate File.isDirectory
158
     * disk touch which is needed in file.toURI().  */
126
     * disk touch which is needed in file.toURI().
127
     * @see Utilities#toURI
128
     */
159
    private static URI toURI(final File file, boolean isDirectory) {
129
    private static URI toURI(final File file, boolean isDirectory) {
160
        return toURI(file.getAbsolutePath(), isDirectory, File.separatorChar);
130
        return toURI(file.getAbsolutePath(), isDirectory, File.separatorChar);
161
    }
131
    }
Lines 182-194 Link Here
182
        return p;
152
        return p;
183
    }
153
    }
184
154
185
    static File url2F(final URL url) throws URISyntaxException {
186
        File file;
187
        if (url.getHost() == null || url.getHost().length() == 0) {
188
            file = new File(url.toURI());
189
        } else {
190
            file = new File("\\\\" + url.getHost() + url.getPath().replace('/', '\\')); // NOI18N
191
        }
192
        return file;
193
    }
194
}
155
}
(-)a/masterfs/test/unit/src/org/netbeans/modules/masterfs/GlobalSharabilityQueryImplTest.java (-1 / +2 lines)
Lines 49-54 Link Here
49
import org.netbeans.api.queries.SharabilityQuery;
49
import org.netbeans.api.queries.SharabilityQuery;
50
import org.netbeans.spi.queries.SharabilityQueryImplementation2;
50
import org.netbeans.spi.queries.SharabilityQueryImplementation2;
51
import org.openide.util.Lookup;
51
import org.openide.util.Lookup;
52
import org.openide.util.Utilities;
52
import org.openide.util.lookup.AbstractLookup;
53
import org.openide.util.lookup.AbstractLookup;
53
import org.openide.util.lookup.InstanceContent;
54
import org.openide.util.lookup.InstanceContent;
54
import org.openide.util.lookup.ProxyLookup;
55
import org.openide.util.lookup.ProxyLookup;
Lines 89-95 Link Here
89
        };
90
        };
90
        
91
        
91
        for (int i = 0; i < all.length; i++) {
92
        for (int i = 0; i < all.length; i++) {
92
            boolean isNotSharable = sq.getSharability(all[i].toURI()) == SharabilityQuery.Sharability.NOT_SHARABLE;
93
            boolean isNotSharable = sq.getSharability(Utilities.toURI(all[i])) == SharabilityQuery.Sharability.NOT_SHARABLE;
93
            boolean isNotVisible = !vq.isVisible(all[i].getName());
94
            boolean isNotVisible = !vq.isVisible(all[i].getName());
94
            assertEquals(isNotSharable, isNotVisible);
95
            assertEquals(isNotSharable, isNotVisible);
95
        }
96
        }
(-)a/masterfs/test/unit/src/org/netbeans/modules/masterfs/filebasedfs/BaseFileObjectTestHid.java (-3 / +3 lines)
Lines 705-712 Link Here
705
        assertNotNull(A);
705
        assertNotNull(A);
706
        assertNotNull(root.getFileObject("a"));
706
        assertNotNull(root.getFileObject("a"));
707
        assertSame(root.getFileObject("A"), root.getFileObject("a"));
707
        assertSame(root.getFileObject("A"), root.getFileObject("a"));
708
        assertSame(URLMapper.findFileObject(testa.toURI().toURL()), 
708
        assertSame(URLMapper.findFileObject(Utilities.toURI(testa).toURL()),
709
                URLMapper.findFileObject(testA.toURI().toURL()));
709
                URLMapper.findFileObject(Utilities.toURI(testA).toURL()));
710
        
710
        
711
        //but 
711
        //but 
712
        root.getChildren();
712
        root.getChildren();
Lines 860-866 Link Here
860
        assertTrue(testFile2.exists());
860
        assertTrue(testFile2.exists());
861
        
861
        
862
        
862
        
863
        assertEquals(FileUtil.normalizeFile(testFile).toURI().toURL(), FileUtil.normalizeFile(testFile2).toURI().toURL());
863
        assertEquals(Utilities.toURI(FileUtil.normalizeFile(testFile)).toURL(), Utilities.toURI(FileUtil.normalizeFile(testFile2)).toURL());
864
    }   
864
    }   
865
865
866
    @RandomlyFails // NB-Core-Build #7927 (from FileBasedFileSystemWithUninitializedExtensionsTest): Didn't receive a FileEvent on the parent.
866
    @RandomlyFails // NB-Core-Build #7927 (from FileBasedFileSystemWithUninitializedExtensionsTest): Didn't receive a FileEvent on the parent.
(-)a/masterfs/test/unit/src/org/netbeans/modules/masterfs/filebasedfs/FileBasedURLMapperTest.java (-13 lines)
Lines 50-56 Link Here
50
import org.openide.filesystems.URLMapper;
50
import org.openide.filesystems.URLMapper;
51
import org.openide.filesystems.FileUtil;
51
import org.openide.filesystems.FileUtil;
52
import java.net.URL;
52
import java.net.URL;
53
import org.openide.util.Utilities;
54
53
55
/**
54
/**
56
 * @author Radek Matous
55
 * @author Radek Matous
Lines 93-108 Link Here
93
        assertEquals("/data/services/web/com_resource/", uri.getPath());
92
        assertEquals("/data/services/web/com_resource/", uri.getPath());
94
    }
93
    }
95
    
94
    
96
    public void testReverseUNCPath() throws Exception {
97
        if (!Utilities.isWindows()) {
98
            return;
99
        }
100
        assertEquals("C:\\some\\random path", uri2File(new URI("file:/C:/some/random%20path/")).getAbsolutePath());
101
        assertEquals("C:\\some\\random path", uri2File(new URI("file:///C:/some/random%20path/")).getAbsolutePath());
102
        assertEquals("\\\\server\\share\\some\\random path", uri2File(new URI("file://server/share/some/random%20path/")).getAbsolutePath());
103
    }    
104
105
    private File uri2File(URI urI) throws Exception {
106
        return FileBasedURLMapper.url2F(urI.toURL());
107
    }
108
}
95
}
(-)a/masterfs/test/unit/src/org/netbeans/modules/masterfs/filebasedfs/fileobjects/FolderObjTest.java (-2 / +2 lines)
Lines 510-517 Link Here
510
        assertNotNull(A);
510
        assertNotNull(A);
511
        assertNotNull(testRoot.getFileObject("a"));
511
        assertNotNull(testRoot.getFileObject("a"));
512
        assertSame(testRoot.getFileObject("A"), testRoot.getFileObject("a"));
512
        assertSame(testRoot.getFileObject("A"), testRoot.getFileObject("a"));
513
        assertSame(URLMapper.findFileObject(testa.toURI().toURL()), 
513
        assertSame(URLMapper.findFileObject(Utilities.toURI(testa).toURL()),
514
                URLMapper.findFileObject(testA.toURI().toURL()));
514
                URLMapper.findFileObject(Utilities.toURI(testA).toURL()));
515
        
515
        
516
        //but 
516
        //but 
517
        testRoot.getChildren();
517
        testRoot.getChildren();
(-)a/maven/nbproject/project.xml (-1 / +1 lines)
Lines 372-378 Link Here
372
                    <build-prerequisite/>
372
                    <build-prerequisite/>
373
                    <compile-dependency/>
373
                    <compile-dependency/>
374
                    <run-dependency>
374
                    <run-dependency>
375
                        <specification-version>8.13</specification-version>
375
                        <specification-version>8.25</specification-version>
376
                    </run-dependency>
376
                    </run-dependency>
377
                </dependency>
377
                </dependency>
378
                <dependency>
378
                <dependency>
(-)a/maven/src/org/netbeans/modules/maven/NbMavenProjectImpl.java (-8 / +9 lines)
Lines 100-105 Link Here
100
import org.openide.util.NbBundle.Messages;
100
import org.openide.util.NbBundle.Messages;
101
import org.openide.util.NbCollections;
101
import org.openide.util.NbCollections;
102
import org.openide.util.RequestProcessor;
102
import org.openide.util.RequestProcessor;
103
import org.openide.util.Utilities;
103
import org.openide.util.lookup.Lookups;
104
import org.openide.util.lookup.Lookups;
104
import org.openide.util.lookup.ProxyLookup;
105
import org.openide.util.lookup.ProxyLookup;
105
106
Lines 435-441 Link Here
435
    public URI[] getGeneratedSourceRoots(boolean test) {
436
    public URI[] getGeneratedSourceRoots(boolean test) {
436
        URI uri = FileUtilities.getDirURI(getProjectDirectory(), test ? "target/generated-test-sources" : "target/generated-sources"); //NOI18N
437
        URI uri = FileUtilities.getDirURI(getProjectDirectory(), test ? "target/generated-test-sources" : "target/generated-sources"); //NOI18N
437
        Set<URI> uris = new HashSet<URI>();
438
        Set<URI> uris = new HashSet<URI>();
438
        File[] roots = new File(uri).listFiles();
439
        File[] roots = Utilities.toFile(uri).listFiles();
439
        if (roots != null) {
440
        if (roots != null) {
440
            for (File root : roots) {
441
            for (File root : roots) {
441
                if (!test && root.getName().startsWith("test-")) {
442
                if (!test && root.getName().startsWith("test-")) {
Lines 443-464 Link Here
443
                }
444
                }
444
                File[] kids = root.listFiles();
445
                File[] kids = root.listFiles();
445
                if (kids != null && /* #190626 */kids.length > 0) {
446
                if (kids != null && /* #190626 */kids.length > 0) {
446
                    uris.add(root.toURI());
447
                    uris.add(Utilities.toURI(root));
447
                } else {
448
                } else {
448
                    watcher.addWatchedPath(root.toURI());
449
                    watcher.addWatchedPath(Utilities.toURI(root));
449
                }
450
                }
450
            }
451
            }
451
        }
452
        }
452
        if (test) { // MCOMPILER-167
453
        if (test) { // MCOMPILER-167
453
            roots = new File(FileUtilities.getDirURI(getProjectDirectory(), "target/generated-sources")).listFiles();
454
            roots = Utilities.toFile(FileUtilities.getDirURI(getProjectDirectory(), "target/generated-sources")).listFiles();
454
            if (roots != null) {
455
            if (roots != null) {
455
                for (File root : roots) {
456
                for (File root : roots) {
456
                    if (root.getName().startsWith("test-")) {
457
                    if (root.getName().startsWith("test-")) {
457
                        File[] kids = root.listFiles();
458
                        File[] kids = root.listFiles();
458
                        if (kids != null && kids.length > 0) {
459
                        if (kids != null && kids.length > 0) {
459
                            uris.add(root.toURI());
460
                            uris.add(Utilities.toURI(root));
460
                        } else {
461
                        } else {
461
                            watcher.addWatchedPath(root.toURI());
462
                            watcher.addWatchedPath(Utilities.toURI(root));
462
                        }
463
                        }
463
                    }
464
                    }
464
                }
465
                }
Lines 536-542 Link Here
536
    public File[] getOtherRoots(boolean test) {
537
    public File[] getOtherRoots(boolean test) {
537
        URI uri = FileUtilities.getDirURI(getProjectDirectory(), test ? "src/test" : "src/main"); //NOI18N
538
        URI uri = FileUtilities.getDirURI(getProjectDirectory(), test ? "src/test" : "src/main"); //NOI18N
538
        Set<File> toRet = new HashSet<File>();
539
        Set<File> toRet = new HashSet<File>();
539
        File fil = new File(uri);
540
        File fil = Utilities.toFile(uri);
540
        if (fil.exists()) {
541
        if (fil.exists()) {
541
            File[] fls = fil.listFiles(new FilenameFilter() {
542
            File[] fls = fil.listFiles(new FilenameFilter() {
542
543
Lines 563-569 Link Here
563
        }
564
        }
564
        URI[] res = getResources(test);
565
        URI[] res = getResources(test);
565
        for (URI rs : res) {
566
        for (URI rs : res) {
566
            File fl = new File(rs);
567
            File fl = Utilities.toFile(rs);
567
            //in node view we need only the existing ones, if anything else needs all,
568
            //in node view we need only the existing ones, if anything else needs all,
568
            // a new method is probably necessary..
569
            // a new method is probably necessary..
569
            if (fl.exists()) {
570
            if (fl.exists()) {
(-)a/maven/src/org/netbeans/modules/maven/ProjectOpenedHookImpl.java (-4 / +5 lines)
Lines 92-97 Link Here
92
import org.openide.util.NbBundle;
92
import org.openide.util.NbBundle;
93
import org.openide.util.NbBundle.Messages;
93
import org.openide.util.NbBundle.Messages;
94
import org.openide.util.RequestProcessor;
94
import org.openide.util.RequestProcessor;
95
import org.openide.util.Utilities;
95
96
96
/**
97
/**
97
 * openhook implementation, register global classpath and also
98
 * openhook implementation, register global classpath and also
Lines 241-250 Link Here
241
        // the project root.
242
        // the project root.
242
        uris.addAll(Arrays.asList(project.getGeneratedSourceRoots(false)));
243
        uris.addAll(Arrays.asList(project.getGeneratedSourceRoots(false)));
243
        uris.addAll(Arrays.asList(project.getGeneratedSourceRoots(true)));
244
        uris.addAll(Arrays.asList(project.getGeneratedSourceRoots(true)));
244
        URI rootUri = FileUtil.toFile(project.getProjectDirectory()).toURI();
245
        URI rootUri = Utilities.toURI(FileUtil.toFile(project.getProjectDirectory()));
245
        File rootDir = new File(rootUri);
246
        File rootDir = Utilities.toFile(rootUri);
246
        for (URI uri : uris) {
247
        for (URI uri : uris) {
247
            if (FileUtilities.getRelativePath(rootDir, new File(uri)) == null) {
248
            if (FileUtilities.getRelativePath(rootDir, Utilities.toFile(uri)) == null) {
248
                toRet.add(uri);
249
                toRet.add(uri);
249
            }
250
            }
250
        }
251
        }
Lines 449-455 Link Here
449
            }
450
            }
450
        } else {
451
        } else {
451
            try {
452
            try {
452
                MavenFileOwnerQueryImpl.getInstance().registerCoordinates(groupId, artifactId, version, basedir.toURI().toURL());
453
                MavenFileOwnerQueryImpl.getInstance().registerCoordinates(groupId, artifactId, version, Utilities.toURI(basedir).toURL());
453
            } catch (MalformedURLException x) {
454
            } catch (MalformedURLException x) {
454
                LOGGER.log(Level.FINE, null, x);
455
                LOGGER.log(Level.FINE, null, x);
455
            }
456
            }
(-)a/maven/src/org/netbeans/modules/maven/SubprojectProviderImpl.java (-1 / +2 lines)
Lines 63-68 Link Here
63
import org.openide.filesystems.FileObject;
63
import org.openide.filesystems.FileObject;
64
import org.openide.filesystems.FileUtil;
64
import org.openide.filesystems.FileUtil;
65
import org.openide.util.ChangeSupport;
65
import org.openide.util.ChangeSupport;
66
import org.openide.util.Utilities;
66
import org.openide.util.WeakListeners;
67
import org.openide.util.WeakListeners;
67
68
68
/**
69
/**
Lines 117-123 Link Here
117
        for (Artifact ar : compileArtifacts) {
118
        for (Artifact ar : compileArtifacts) {
118
            File f = ar.getFile();
119
            File f = ar.getFile();
119
            if (f != null) {
120
            if (f != null) {
120
                Project p = MavenFileOwnerQueryImpl.getInstance().getOwner(f.toURI());
121
                Project p = MavenFileOwnerQueryImpl.getInstance().getOwner(Utilities.toURI(f));
121
                if (p != null) {
122
                if (p != null) {
122
                    resultset.add(p);
123
                    resultset.add(p);
123
                }
124
                }
(-)a/maven/src/org/netbeans/modules/maven/actions/CreateLibraryAction.java (-2 / +3 lines)
Lines 87-92 Link Here
87
import org.openide.util.NbBundle.Messages;
87
import org.openide.util.NbBundle.Messages;
88
import org.openide.util.RequestProcessor;
88
import org.openide.util.RequestProcessor;
89
import static org.netbeans.modules.maven.actions.Bundle.*;
89
import static org.netbeans.modules.maven.actions.Bundle.*;
90
import org.openide.util.Utilities;
90
91
91
/**
92
/**
92
 *
93
 *
Lines 169-175 Link Here
169
                File base;
170
                File base;
170
                if (libRoot != null) {
171
                if (libRoot != null) {
171
                    try {
172
                    try {
172
                        base = new File(libRoot.toURI());
173
                        base = Utilities.toFile(libRoot.toURI());
173
                        //getLocation() points to a file
174
                        //getLocation() points to a file
174
                        base = base.getParentFile();
175
                        base = base.getParentFile();
175
                        nonDefaultLibBase = base;
176
                        nonDefaultLibBase = base;
Lines 276-282 Link Here
276
277
277
    private static URI getJarUri(Artifact a, File copyTo, File nonDefaultLibBase, ClassifierType type) throws IOException {
278
    private static URI getJarUri(Artifact a, File copyTo, File nonDefaultLibBase, ClassifierType type) throws IOException {
278
        File res = a.getFile();
279
        File res = a.getFile();
279
        URI uri = res.toURI();
280
        URI uri = Utilities.toURI(res);
280
        String jarPath = null;
281
        String jarPath = null;
281
        if (copyTo != null) {
282
        if (copyTo != null) {
282
            res = new File(copyTo, a.getFile().getName());
283
            res = new File(copyTo, a.getFile().getName());
(-)a/maven/src/org/netbeans/modules/maven/api/FileUtilities.java (-4 / +4 lines)
Lines 77-83 Link Here
77
        if (uri == null) {
77
        if (uri == null) {
78
            return null;
78
            return null;
79
        }
79
        }
80
        File fil = FileUtil.normalizeFile(new File(uri));
80
        File fil = FileUtil.normalizeFile(Utilities.toFile(uri));
81
        return FileUtil.toFileObject(fil);
81
        return FileUtil.toFileObject(fil);
82
    }
82
    }
83
    
83
    
Lines 103-109 Link Here
103
        if (str != null) {
103
        if (str != null) {
104
            File fil = new File(str);
104
            File fil = new File(str);
105
            fil = FileUtil.normalizeFile(fil);
105
            fil = FileUtil.normalizeFile(fil);
106
            return fil.toURI();
106
            return Utilities.toURI(fil);
107
        }
107
        }
108
        return null;
108
        return null;
109
    }
109
    }
Lines 157-163 Link Here
157
       pth = pth.replaceFirst("^\\./", ""); //NOI18N
157
       pth = pth.replaceFirst("^\\./", ""); //NOI18N
158
       pth = pth.replaceFirst("^\\.\\\\", ""); //NOI18N
158
       pth = pth.replaceFirst("^\\.\\\\", ""); //NOI18N
159
       File src = FileUtilities.resolveFilePath(root, pth);
159
       File src = FileUtilities.resolveFilePath(root, pth);
160
       return FileUtil.normalizeFile(src).toURI();
160
       return Utilities.toURI(FileUtil.normalizeFile(src));
161
   }
161
   }
162
    
162
    
163
   public static URI getDirURI(@NonNull FileObject root, @NonNull String path) {
163
   public static URI getDirURI(@NonNull FileObject root, @NonNull String path) {
Lines 233-239 Link Here
233
            }
233
            }
234
            b.append("../"); // NOI18N
234
            b.append("../"); // NOI18N
235
        }
235
        }
236
        URI u = base.toURI().relativize(file.toURI());
236
        URI u = Utilities.toURI(base).relativize(Utilities.toURI(file));
237
        assert !u.isAbsolute() : u + " from " + basedir + " and " + file + " with common root " + base;
237
        assert !u.isAbsolute() : u + " from " + basedir + " and " + file + " with common root " + base;
238
        b.append(u.getPath());
238
        b.append(u.getPath());
239
        if (b.charAt(b.length() - 1) == '/') {
239
        if (b.charAt(b.length() - 1) == '/') {
(-)a/maven/src/org/netbeans/modules/maven/api/NbMavenProject.java (-7 / +8 lines)
Lines 82-87 Link Here
82
import org.openide.util.RequestProcessor;
82
import org.openide.util.RequestProcessor;
83
import static org.netbeans.modules.maven.api.Bundle.*;
83
import static org.netbeans.modules.maven.api.Bundle.*;
84
import org.openide.util.NbBundle.Messages;
84
import org.openide.util.NbBundle.Messages;
85
import org.openide.util.Utilities;
85
86
86
/**
87
/**
87
 * an instance resides in project lookup, allows to get notified on project and 
88
 * an instance resides in project lookup, allows to get notified on project and 
Lines 143-169 Link Here
143
144
144
        @Override
145
        @Override
145
        public void fileFolderCreated(FileEvent fe) {
146
        public void fileFolderCreated(FileEvent fe) {
146
            fireChange(FileUtil.toFile(fe.getFile()).toURI());
147
            fireChange(Utilities.toURI(FileUtil.toFile(fe.getFile())));
147
        }
148
        }
148
149
149
        @Override
150
        @Override
150
        public void fileDataCreated(FileEvent fe) {
151
        public void fileDataCreated(FileEvent fe) {
151
            fireChange(FileUtil.toFile(fe.getFile()).toURI());
152
            fireChange(Utilities.toURI(FileUtil.toFile(fe.getFile())));
152
        }
153
        }
153
154
154
        @Override
155
        @Override
155
        public void fileChanged(FileEvent fe) {
156
        public void fileChanged(FileEvent fe) {
156
            fireChange(FileUtil.toFile(fe.getFile()).toURI());
157
            fireChange(Utilities.toURI(FileUtil.toFile(fe.getFile())));
157
        }
158
        }
158
159
159
        @Override
160
        @Override
160
        public void fileDeleted(FileEvent fe) {
161
        public void fileDeleted(FileEvent fe) {
161
            fireChange(FileUtil.toFile(fe.getFile()).toURI());
162
            fireChange(Utilities.toURI(FileUtil.toFile(fe.getFile())));
162
        }
163
        }
163
164
164
        @Override
165
        @Override
165
        public void fileRenamed(FileRenameEvent fe) {
166
        public void fileRenamed(FileRenameEvent fe) {
166
            fireChange(FileUtil.toFile(fe.getFile()).toURI());
167
            fireChange(Utilities.toURI(FileUtil.toFile(fe.getFile())));
167
        }
168
        }
168
169
169
        @Override
170
        @Override
Lines 339-345 Link Here
339
    public void addWatchedPath(URI uri) {
340
    public void addWatchedPath(URI uri) {
340
        //#110599
341
        //#110599
341
        boolean addListener = false;
342
        boolean addListener = false;
342
        File fil = new File(uri);
343
        File fil = Utilities.toFile(uri);
343
        synchronized (files) {
344
        synchronized (files) {
344
            if (!files.contains(fil)) {
345
            if (!files.contains(fil)) {
345
                addListener = true;
346
                addListener = true;
Lines 477-483 Link Here
477
    public void removeWatchedPath(URI uri) {
478
    public void removeWatchedPath(URI uri) {
478
        //#110599
479
        //#110599
479
        boolean removeListener = false;
480
        boolean removeListener = false;
480
        File fil = new File(uri);
481
        File fil = Utilities.toFile(uri);
481
        synchronized (files) {
482
        synchronized (files) {
482
            boolean rem = files.remove(fil);
483
            boolean rem = files.remove(fil);
483
            if (rem && !files.contains(fil)) {
484
            if (rem && !files.contains(fil)) {
(-)a/maven/src/org/netbeans/modules/maven/classpath/AbstractProjectClassPathImpl.java (-1 / +2 lines)
Lines 60-65 Link Here
60
import org.netbeans.spi.java.classpath.FilteringPathResourceImplementation;
60
import org.netbeans.spi.java.classpath.FilteringPathResourceImplementation;
61
import org.netbeans.spi.java.classpath.PathResourceImplementation;
61
import org.netbeans.spi.java.classpath.PathResourceImplementation;
62
import org.openide.filesystems.FileUtil;
62
import org.openide.filesystems.FileUtil;
63
import org.openide.util.Utilities;
63
64
64
/**
65
/**
65
 *
66
 *
Lines 169-175 Link Here
169
        for (int i = 0; i < pieces.length; i++) {
170
        for (int i = 0; i < pieces.length; i++) {
170
            try {
171
            try {
171
                // XXX would be cleaner to take a File[] if that is what these all are anyway!
172
                // XXX would be cleaner to take a File[] if that is what these all are anyway!
172
                final URL entry = FileUtil.urlForArchiveOrDir(new File(pieces[i]));
173
                final URL entry = FileUtil.urlForArchiveOrDir(Utilities.toFile(pieces[i]));
173
                if (entry != null) {
174
                if (entry != null) {
174
                    result.add(new FilteringPathResourceImplementation() {
175
                    result.add(new FilteringPathResourceImplementation() {
175
                        @Override public boolean includes(URL root, String resource) {
176
                        @Override public boolean includes(URL root, String resource) {
(-)a/maven/src/org/netbeans/modules/maven/classpath/ClassPathProviderImpl.java (-1 / +2 lines)
Lines 64-69 Link Here
64
import org.netbeans.spi.project.ProjectServiceProvider;
64
import org.netbeans.spi.project.ProjectServiceProvider;
65
import org.openide.filesystems.FileObject;
65
import org.openide.filesystems.FileObject;
66
import org.openide.filesystems.FileUtil;
66
import org.openide.filesystems.FileUtil;
67
import org.openide.util.Utilities;
67
68
68
/**
69
/**
69
 * Defines class path for maven2 projects..
70
 * Defines class path for maven2 projects..
Lines 218-224 Link Here
218
        }
219
        }
219
        
220
        
220
        URI web = project.getWebAppDirectory();
221
        URI web = project.getWebAppDirectory();
221
        FileObject fo = FileUtil.toFileObject(new File(web));
222
        FileObject fo = FileUtil.toFileObject(Utilities.toFile(web));
222
        if (fo != null && (fo.equals(file) || FileUtil.isParentOf(fo, file))) {
223
        if (fo != null && (fo.equals(file) || FileUtil.isParentOf(fo, file))) {
223
            return TYPE_WEB;
224
            return TYPE_WEB;
224
        }
225
        }
(-)a/maven/src/org/netbeans/modules/maven/classpath/CompileClassPathImpl.java (-1 / +2 lines)
Lines 49-54 Link Here
49
import org.apache.maven.artifact.Artifact;
49
import org.apache.maven.artifact.Artifact;
50
import org.netbeans.modules.maven.NbMavenProjectImpl;
50
import org.netbeans.modules.maven.NbMavenProjectImpl;
51
import org.openide.filesystems.FileUtil;
51
import org.openide.filesystems.FileUtil;
52
import org.openide.util.Utilities;
52
53
53
/**
54
/**
54
 *
55
 *
Lines 71-77 Link Here
71
        for (Artifact art : arts) {
72
        for (Artifact art : arts) {
72
            if (art.getFile() != null) {
73
            if (art.getFile() != null) {
73
                File fil = FileUtil.normalizeFile(art.getFile());
74
                File fil = FileUtil.normalizeFile(art.getFile());
74
                lst.add(fil.toURI());
75
                lst.add(Utilities.toURI(fil));
75
            } else {
76
            } else {
76
              //NOPMD   //null means dependencies were not resolved..
77
              //NOPMD   //null means dependencies were not resolved..
77
            } 
78
            } 
(-)a/maven/src/org/netbeans/modules/maven/classpath/MavenSourcesImpl.java (-4 / +5 lines)
Lines 85-90 Link Here
85
import static org.netbeans.modules.maven.classpath.Bundle.*;
85
import static org.netbeans.modules.maven.classpath.Bundle.*;
86
import org.netbeans.spi.project.ProjectServiceProvider;
86
import org.netbeans.spi.project.ProjectServiceProvider;
87
import org.openide.util.NbBundle.Messages;
87
import org.openide.util.NbBundle.Messages;
88
import org.openide.util.Utilities;
88
89
89
/**
90
/**
90
 * Implementation of Sources interface for maven projects.
91
 * Implementation of Sources interface for maven projects.
Lines 240-246 Link Here
240
                }
241
                }
241
            }
242
            }
242
            if (create && existing.isEmpty()) {
243
            if (create && existing.isEmpty()) {
243
                File root = new File(virtuals.get(0));
244
                File root = Utilities.toFile(virtuals.get(0));
244
                FileObject fo=null;
245
                FileObject fo=null;
245
                try {
246
                try {
246
                    fo = FileUtil.createFolder(root);
247
                    fo = FileUtil.createFolder(root);
Lines 265-271 Link Here
265
    private boolean checkSourceGroupCache(@NullAllowed File rootF, String name, String displayName, Map<String, SourceGroup> groups, NbMavenProject watcher) {
266
    private boolean checkSourceGroupCache(@NullAllowed File rootF, String name, String displayName, Map<String, SourceGroup> groups, NbMavenProject watcher) {
266
        FileObject root;
267
        FileObject root;
267
        if (rootF != null) {
268
        if (rootF != null) {
268
            watcher.addWatchedPath(rootF.toURI());
269
            watcher.addWatchedPath(Utilities.toURI(rootF));
269
            root = FileUtil.toFileObject(rootF);
270
            root = FileUtil.toFileObject(rootF);
270
        } else {
271
        } else {
271
            root = null;
272
            root = null;
Lines 299-305 Link Here
299
        List<File> checked = new ArrayList<File>();
300
        List<File> checked = new ArrayList<File>();
300
        for (boolean test : new boolean[] {false, true}) {
301
        for (boolean test : new boolean[] {false, true}) {
301
            for (URI u : project().getGeneratedSourceRoots(test)) {
302
            for (URI u : project().getGeneratedSourceRoots(test)) {
302
                File file = FileUtil.normalizeFile(new File(u));
303
                File file = FileUtil.normalizeFile(Utilities.toFile(u));
303
                FileObject folder = FileUtil.toFileObject(file);
304
                FileObject folder = FileUtil.toFileObject(file);
304
                changed |= checkGeneratedGroupCache(folder, file, file.getName(), test);
305
                changed |= checkGeneratedGroupCache(folder, file, file.getName(), test);
305
                checked.add(file);
306
                checked.add(file);
Lines 357-363 Link Here
357
        URI[] res = project().getResources(test);
358
        URI[] res = project().getResources(test);
358
        Set<File> resources = new HashSet<File>();
359
        Set<File> resources = new HashSet<File>();
359
        for (URI ur : res) {
360
        for (URI ur : res) {
360
            resources.add(new File(ur));
361
            resources.add(Utilities.toFile(ur));
361
        }
362
        }
362
363
363
        for (File f : roots) {
364
        for (File f : roots) {
(-)a/maven/src/org/netbeans/modules/maven/classpath/PackagedClassPathImpl.java (-2 / +3 lines)
Lines 50-55 Link Here
50
import org.apache.maven.model.Dependency;
50
import org.apache.maven.model.Dependency;
51
import org.netbeans.modules.maven.NbMavenProjectImpl;
51
import org.netbeans.modules.maven.NbMavenProjectImpl;
52
import org.openide.filesystems.FileUtil;
52
import org.openide.filesystems.FileUtil;
53
import org.openide.util.Utilities;
53
54
54
/**
55
/**
55
 *
56
 *
Lines 83-96 Link Here
83
                if (art.getClassifier() != null) {
84
                if (art.getClassifier() != null) {
84
                    assemblies.add(0, fil);
85
                    assemblies.add(0, fil);
85
                } else {
86
                } else {
86
                    lst.add(fil.toURI());
87
                    lst.add(Utilities.toURI(fil));
87
                }
88
                }
88
            } else {
89
            } else {
89
              //NOPMD   //null means dependencies were not resolved..
90
              //NOPMD   //null means dependencies were not resolved..
90
            } 
91
            } 
91
        }
92
        }
92
        for (File ass : assemblies) {
93
        for (File ass : assemblies) {
93
            lst.add(ass.toURI());
94
            lst.add(Utilities.toURI(ass));
94
        }
95
        }
95
        URI[] uris = new URI[lst.size()];
96
        URI[] uris = new URI[lst.size()];
96
        uris = lst.toArray(uris);
97
        uris = lst.toArray(uris);
(-)a/maven/src/org/netbeans/modules/maven/classpath/RuntimeClassPathImpl.java (-2 / +3 lines)
Lines 51-56 Link Here
51
import org.apache.maven.project.MavenProject;
51
import org.apache.maven.project.MavenProject;
52
import org.netbeans.modules.maven.NbMavenProjectImpl;
52
import org.netbeans.modules.maven.NbMavenProjectImpl;
53
import org.openide.filesystems.FileUtil;
53
import org.openide.filesystems.FileUtil;
54
import org.openide.util.Utilities;
54
55
55
/**
56
/**
56
 * class path def for runtime..
57
 * class path def for runtime..
Lines 81-94 Link Here
81
            if (outputDirectory != null) {
82
            if (outputDirectory != null) {
82
                File fil = new File(outputDirectory);
83
                File fil = new File(outputDirectory);
83
                fil = FileUtil.normalizeFile(fil);
84
                fil = FileUtil.normalizeFile(fil);
84
                lst.add(fil.toURI());
85
                lst.add(Utilities.toURI(fil));
85
            }
86
            }
86
        }
87
        }
87
        List<Artifact> arts = prj.getRuntimeArtifacts();
88
        List<Artifact> arts = prj.getRuntimeArtifacts();
88
        for (Artifact art : arts) {
89
        for (Artifact art : arts) {
89
            if (art.getFile() != null) {
90
            if (art.getFile() != null) {
90
                File fil = FileUtil.normalizeFile(art.getFile());
91
                File fil = FileUtil.normalizeFile(art.getFile());
91
                lst.add(fil.toURI());
92
                lst.add(Utilities.toURI(fil));
92
            } else {
93
            } else {
93
              //NOPMD   //null means dependencies were not resolved..
94
              //NOPMD   //null means dependencies were not resolved..
94
            }
95
            }
(-)a/maven/src/org/netbeans/modules/maven/classpath/SourceClassPathImpl.java (-1 / +2 lines)
Lines 51-56 Link Here
51
import java.util.Iterator;
51
import java.util.Iterator;
52
import java.util.List;
52
import java.util.List;
53
import org.netbeans.modules.maven.NbMavenProjectImpl;
53
import org.netbeans.modules.maven.NbMavenProjectImpl;
54
import org.openide.util.Utilities;
54
55
55
/**
56
/**
56
 *
57
 *
Lines 84-90 Link Here
84
            }
85
            }
85
        }
86
        }
86
        URI webSrc = getMavenProject().getWebAppDirectory();
87
        URI webSrc = getMavenProject().getWebAppDirectory();
87
        if (new File(webSrc).exists()) {
88
        if (Utilities.toFile(webSrc).exists()) {
88
            col.add(webSrc);
89
            col.add(webSrc);
89
        }
90
        }
90
        col.addAll(resources);
91
        col.addAll(resources);
(-)a/maven/src/org/netbeans/modules/maven/classpath/TestCompileClassPathImpl.java (-2 / +3 lines)
Lines 49-54 Link Here
49
import org.apache.maven.artifact.Artifact;
49
import org.apache.maven.artifact.Artifact;
50
import org.netbeans.modules.maven.NbMavenProjectImpl;
50
import org.netbeans.modules.maven.NbMavenProjectImpl;
51
import org.openide.filesystems.FileUtil;
51
import org.openide.filesystems.FileUtil;
52
import org.openide.util.Utilities;
52
53
53
/**
54
/**
54
 *
55
 *
Lines 73-84 Link Here
73
        for (Artifact art : arts) {
74
        for (Artifact art : arts) {
74
            if (art.getFile() != null) {
75
            if (art.getFile() != null) {
75
                File fil = FileUtil.normalizeFile(art.getFile());
76
                File fil = FileUtil.normalizeFile(art.getFile());
76
                lst.add(fil.toURI());
77
                lst.add(Utilities.toURI(fil));
77
            } else { //NOPMD
78
            } else { //NOPMD
78
                //null means dependencies were not resolved..
79
                //null means dependencies were not resolved..
79
            } 
80
            } 
80
        }
81
        }
81
        lst.add(0, getMavenProject().getProjectWatcher().getOutputDirectory(false).toURI());
82
        lst.add(0, Utilities.toURI(getMavenProject().getProjectWatcher().getOutputDirectory(false)));
82
        URI[] uris = new URI[lst.size()];
83
        URI[] uris = new URI[lst.size()];
83
        uris = lst.toArray(uris);
84
        uris = lst.toArray(uris);
84
        return uris;
85
        return uris;
(-)a/maven/src/org/netbeans/modules/maven/classpath/TestRuntimeClassPathImpl.java (-3 / +4 lines)
Lines 51-56 Link Here
51
import org.apache.maven.project.MavenProject;
51
import org.apache.maven.project.MavenProject;
52
import org.netbeans.modules.maven.NbMavenProjectImpl;
52
import org.netbeans.modules.maven.NbMavenProjectImpl;
53
import org.openide.filesystems.FileUtil;
53
import org.openide.filesystems.FileUtil;
54
import org.openide.util.Utilities;
54
55
55
56
56
/**
57
/**
Lines 83-102 Link Here
83
            if (testOutputDirectory != null) {
84
            if (testOutputDirectory != null) {
84
                File fil = new File(testOutputDirectory);
85
                File fil = new File(testOutputDirectory);
85
                fil = FileUtil.normalizeFile(fil);
86
                fil = FileUtil.normalizeFile(fil);
86
                lst.add(fil.toURI());
87
                lst.add(Utilities.toURI(fil));
87
            }
88
            }
88
            String outputDirectory = build.getOutputDirectory();
89
            String outputDirectory = build.getOutputDirectory();
89
            if (outputDirectory != null) {
90
            if (outputDirectory != null) {
90
                File fil = new File(outputDirectory);
91
                File fil = new File(outputDirectory);
91
                fil = FileUtil.normalizeFile(fil);
92
                fil = FileUtil.normalizeFile(fil);
92
                lst.add(fil.toURI());
93
                lst.add(Utilities.toURI(fil));
93
            }
94
            }
94
        }
95
        }
95
        List<Artifact> arts = prj.getTestArtifacts();
96
        List<Artifact> arts = prj.getTestArtifacts();
96
        for (Artifact art : arts) {
97
        for (Artifact art : arts) {
97
            if (art.getFile() != null) {
98
            if (art.getFile() != null) {
98
                File fil = FileUtil.normalizeFile(art.getFile());
99
                File fil = FileUtil.normalizeFile(art.getFile());
99
                lst.add(fil.toURI());
100
                lst.add(Utilities.toURI(fil));
100
            } else {
101
            } else {
101
              //NOPMD   //null means dependencies were not resolved..
102
              //NOPMD   //null means dependencies were not resolved..
102
            }
103
            }
(-)a/maven/src/org/netbeans/modules/maven/cos/CopyResourcesOnSave.java (-2 / +3 lines)
Lines 70-75 Link Here
70
import org.openide.filesystems.FileRenameEvent;
70
import org.openide.filesystems.FileRenameEvent;
71
import org.openide.filesystems.FileUtil;
71
import org.openide.filesystems.FileUtil;
72
import org.openide.util.RequestProcessor;
72
import org.openide.util.RequestProcessor;
73
import org.openide.util.Utilities;
73
74
74
/**
75
/**
75
 * @author mkleint
76
 * @author mkleint
Lines 126-132 Link Here
126
                        continue;
127
                        continue;
127
                    }
128
                    }
128
                    URI uri = FileUtilities.getDirURI(project.getProjectDirectory(), dir);
129
                    URI uri = FileUtilities.getDirURI(project.getProjectDirectory(), dir);
129
                    File file = new File(uri);
130
                    File file = Utilities.toFile(uri);
130
                    if (!old.contains(file) && added.add(file)) { // if a given file is there multiple times, we get assertion back from FileUtil. there can be only one listener+file tuple
131
                    if (!old.contains(file) && added.add(file)) { // if a given file is there multiple times, we get assertion back from FileUtil. there can be only one listener+file tuple
131
                        FileUtil.addFileChangeListener(this, file);
132
                        FileUtil.addFileChangeListener(this, file);
132
                    }
133
                    }
Lines 387-393 Link Here
387
                continue;
388
                continue;
388
            }
389
            }
389
            URI uri = FileUtilities.getDirURI(prj.getProjectDirectory(), dir);
390
            URI uri = FileUtilities.getDirURI(prj.getProjectDirectory(), dir);
390
            FileObject fo = FileUtil.toFileObject(new File(uri));
391
            FileObject fo = FileUtil.toFileObject(Utilities.toFile(uri));
391
            if (fo != null && FileUtil.isParentOf(fo, child)) {
392
            if (fo != null && FileUtil.isParentOf(fo, child)) {
392
                String path = FileUtil.getRelativePath(fo, child);
393
                String path = FileUtil.getRelativePath(fo, child);
393
                //now check includes and excludes
394
                //now check includes and excludes
(-)a/maven/src/org/netbeans/modules/maven/cos/CosChecker.java (-1 / +2 lines)
Lines 97-102 Link Here
97
import org.openide.util.ImageUtilities;
97
import org.openide.util.ImageUtilities;
98
import org.openide.util.NbBundle.Messages;
98
import org.openide.util.NbBundle.Messages;
99
import org.openide.util.RequestProcessor;
99
import org.openide.util.RequestProcessor;
100
import org.openide.util.Utilities;
100
import org.openide.util.lookup.AbstractLookup;
101
import org.openide.util.lookup.AbstractLookup;
101
import org.openide.util.lookup.InstanceContent;
102
import org.openide.util.lookup.InstanceContent;
102
103
Lines 513-519 Link Here
513
                    File root = FileUtilities.resolveFilePath(base, add);
514
                    File root = FileUtilities.resolveFilePath(base, add);
514
                    if (root != null) {
515
                    if (root != null) {
515
                        try {
516
                        try {
516
                            URL url = root.toURI().toURL();
517
                            URL url = Utilities.toURI(root).toURL();
517
                            if (FileUtil.isArchiveFile(url)) {
518
                            if (FileUtil.isArchiveFile(url)) {
518
                                url = FileUtil.getArchiveRoot(url);
519
                                url = FileUtil.getArchiveRoot(url);
519
                            }
520
                            }
(-)a/maven/src/org/netbeans/modules/maven/debug/Utils.java (-1 / +2 lines)
Lines 72-77 Link Here
72
import org.openide.ErrorManager;
72
import org.openide.ErrorManager;
73
import org.openide.filesystems.FileObject;
73
import org.openide.filesystems.FileObject;
74
import org.openide.filesystems.FileUtil;
74
import org.openide.filesystems.FileUtil;
75
import org.openide.util.Utilities;
75
76
76
/**
77
/**
77
 * various debugger related utility methods.
78
 * various debugger related utility methods.
Lines 242-248 Link Here
242
    static URL fileToURL(File file) {
243
    static URL fileToURL(File file) {
243
        try {
244
        try {
244
            URL url;
245
            URL url;
245
            url = file.toURI().toURL();
246
            url = Utilities.toURI(file).toURL();
246
            if (FileUtil.isArchiveFile(url)) {
247
            if (FileUtil.isArchiveFile(url)) {
247
                url = FileUtil.getArchiveRoot(url);
248
                url = FileUtil.getArchiveRoot(url);
248
            }
249
            }
(-)a/maven/src/org/netbeans/modules/maven/newproject/CatalogRepoProvider.java (-2 / +3 lines)
Lines 86-91 Link Here
86
import org.netbeans.modules.maven.indexer.api.RepositoryPreferences;
86
import org.netbeans.modules.maven.indexer.api.RepositoryPreferences;
87
import org.openide.modules.Places;
87
import org.openide.modules.Places;
88
import org.openide.util.NbCollections;
88
import org.openide.util.NbCollections;
89
import org.openide.util.Utilities;
89
import org.openide.util.lookup.ServiceProvider;
90
import org.openide.util.lookup.ServiceProvider;
90
91
91
/**
92
/**
Lines 167-173 Link Here
167
168
168
        @Override protected URL file() throws IOException {
169
        @Override protected URL file() throws IOException {
169
            File f = new File(RepositorySystem.userMavenConfigurationHome, "archetype-catalog.xml"); //NOI18N
170
            File f = new File(RepositorySystem.userMavenConfigurationHome, "archetype-catalog.xml"); //NOI18N
170
            return f.isFile() ? f.toURI().toURL() : null;
171
            return f.isFile() ? Utilities.toURI(f).toURL() : null;
171
        }
172
        }
172
173
173
        @Override protected String repository() {
174
        @Override protected String repository() {
Lines 210-216 Link Here
210
                    
211
                    
211
                    if (catalog.exists()) {
212
                    if (catalog.exists()) {
212
                        try {
213
                        try {
213
                            toRet.addAll(CatalogRepoProvider.getArchetypes(catalog.toURI().toURL(), info.getRepositoryUrl()));
214
                            toRet.addAll(CatalogRepoProvider.getArchetypes(Utilities.toURI(catalog).toURL(), info.getRepositoryUrl()));
214
                        } catch (MalformedURLException ex) {
215
                        } catch (MalformedURLException ex) {
215
                            LOG.log(Level.INFO, null, ex);
216
                            LOG.log(Level.INFO, null, ex);
216
                        }
217
                        }
(-)a/maven/src/org/netbeans/modules/maven/nodes/DependencyNode.java (-2 / +2 lines)
Lines 312-318 Link Here
312
        if ( Artifact.SCOPE_SYSTEM.equals(art.getScope())) {
312
        if ( Artifact.SCOPE_SYSTEM.equals(art.getScope())) {
313
            return null;
313
            return null;
314
        }
314
        }
315
        URI uri = art.getFile().toURI();
315
        URI uri = org.openide.util.Utilities.toURI(art.getFile());
316
        return FileOwnerQuery.getOwner(uri);
316
        return FileOwnerQuery.getOwner(uri);
317
    }   
317
    }   
318
318
Lines 1190-1196 Link Here
1190
                    for (Artifact art : context.lookupAll(Artifact.class)) {
1190
                    for (Artifact art : context.lookupAll(Artifact.class)) {
1191
                        File f = art.getFile();
1191
                        File f = art.getFile();
1192
                        if (f != null) {
1192
                        if (f != null) {
1193
                            Project p = FileOwnerQuery.getOwner(f.toURI());
1193
                            Project p = FileOwnerQuery.getOwner(org.openide.util.Utilities.toURI(f));
1194
                            if (p != null) {
1194
                            if (p != null) {
1195
                                projects.add(p);
1195
                                projects.add(p);
1196
                            }
1196
                            }
(-)a/maven/src/org/netbeans/modules/maven/output/SiteOutputProcessor.java (-1 / +2 lines)
Lines 52-57 Link Here
52
import org.openide.awt.StatusDisplayer;
52
import org.openide.awt.StatusDisplayer;
53
import org.openide.filesystems.FileUtil;
53
import org.openide.filesystems.FileUtil;
54
import org.openide.util.NbBundle.Messages;
54
import org.openide.util.NbBundle.Messages;
55
import org.openide.util.Utilities;
55
import org.openide.windows.OutputEvent;
56
import org.openide.windows.OutputEvent;
56
import org.openide.windows.OutputListener;
57
import org.openide.windows.OutputListener;
57
58
Lines 110-116 Link Here
110
            File html = new File(FileUtil.toFile(prj.getProjectDirectory()), "target/site/index.html");
111
            File html = new File(FileUtil.toFile(prj.getProjectDirectory()), "target/site/index.html");
111
            if (html.isFile()) {
112
            if (html.isFile()) {
112
                try {
113
                try {
113
                    HtmlBrowser.URLDisplayer.getDefault().showURL(html.toURI().toURL());
114
                    HtmlBrowser.URLDisplayer.getDefault().showURL(Utilities.toURI(html).toURL());
114
                } catch (MalformedURLException x) {
115
                } catch (MalformedURLException x) {
115
                    assert false : x;
116
                    assert false : x;
116
                }
117
                }
(-)a/maven/src/org/netbeans/modules/maven/queries/MavenBinaryForSourceQueryImpl.java (-3 / +4 lines)
Lines 64-69 Link Here
64
import org.netbeans.spi.project.ProjectServiceProvider;
64
import org.netbeans.spi.project.ProjectServiceProvider;
65
import org.openide.filesystems.FileUtil;
65
import org.openide.filesystems.FileUtil;
66
import org.openide.util.Exceptions;
66
import org.openide.util.Exceptions;
67
import org.openide.util.Utilities;
67
68
68
/**
69
/**
69
 *
70
 *
Lines 87-93 Link Here
87
        }
88
        }
88
        if ("file".equals(url.getProtocol())) { //NOI18N
89
        if ("file".equals(url.getProtocol())) { //NOI18N
89
            try {
90
            try {
90
                File fil = new File(url.toURI());
91
                File fil = Utilities.toFile(url.toURI());
91
                fil = FileUtil.normalizeFile(fil);
92
                fil = FileUtil.normalizeFile(fil);
92
                Res toReturn = findFor(fil);
93
                Res toReturn = findFor(fil);
93
                if (toReturn != null) {
94
                if (toReturn != null) {
Lines 158-165 Link Here
158
159
159
    private Res checkRoot(File root, URI source, URI test) {
160
    private Res checkRoot(File root, URI source, URI test) {
160
        return checkRoot(root,
161
        return checkRoot(root,
161
                         source != null ? FileUtil.normalizeFile(new File(source)) : null,
162
                         source != null ? FileUtil.normalizeFile(Utilities.toFile(source)) : null,
162
                         test != null ? FileUtil.normalizeFile(new File(test)) : null);
163
                         test != null ? FileUtil.normalizeFile(Utilities.toFile(test)) : null);
163
    }
164
    }
164
165
165
    
166
    
(-)a/maven/src/org/netbeans/modules/maven/queries/MavenFileOwnerQueryImpl.java (-2 / +3 lines)
Lines 73-78 Link Here
73
import org.openide.util.ChangeSupport;
73
import org.openide.util.ChangeSupport;
74
import org.openide.util.Lookup;
74
import org.openide.util.Lookup;
75
import org.openide.util.NbPreferences;
75
import org.openide.util.NbPreferences;
76
import org.openide.util.Utilities;
76
import org.openide.util.lookup.ServiceProvider;
77
import org.openide.util.lookup.ServiceProvider;
77
import org.openide.util.lookup.ServiceProviders;
78
import org.openide.util.lookup.ServiceProviders;
78
79
Lines 166-172 Link Here
166
    public @Override Project getOwner(URI uri) {
167
    public @Override Project getOwner(URI uri) {
167
        LOG.log(Level.FINEST, "getOwner of uri={0}", uri);
168
        LOG.log(Level.FINEST, "getOwner of uri={0}", uri);
168
        if ("file".equals(uri.getScheme())) { //NOI18N
169
        if ("file".equals(uri.getScheme())) { //NOI18N
169
            File file = new File(uri);
170
            File file = Utilities.toFile(uri);
170
            return getOwner(file);
171
            return getOwner(file);
171
        }
172
        }
172
        return null;
173
        return null;
Lines 314-320 Link Here
314
            try {
315
            try {
315
                URI uri = new URI(ownerURI);
316
                URI uri = new URI(ownerURI);
316
                if ("file".equals(uri.getScheme())) {
317
                if ("file".equals(uri.getScheme())) {
317
                    File pom = new File(uri.resolve("pom.xml"));
318
                    File pom = Utilities.toFile(uri.resolve("pom.xml"));
318
                    if (pom.isFile()) {
319
                    if (pom.isFile()) {
319
                        ModelReader reader = EmbedderFactory.getProjectEmbedder().lookupComponent(ModelReader.class);
320
                        ModelReader reader = EmbedderFactory.getProjectEmbedder().lookupComponent(ModelReader.class);
320
                        Model model = reader.read(pom, Collections.singletonMap(ModelReader.IS_STRICT, false));
321
                        Model model = reader.read(pom, Collections.singletonMap(ModelReader.IS_STRICT, false));
(-)a/maven/src/org/netbeans/modules/maven/queries/MavenSharabilityQueryImpl.java (-1 / +2 lines)
Lines 55-60 Link Here
55
import org.netbeans.spi.queries.SharabilityQueryImplementation2;
55
import org.netbeans.spi.queries.SharabilityQueryImplementation2;
56
import org.openide.filesystems.FileObject;
56
import org.openide.filesystems.FileObject;
57
import org.openide.filesystems.FileUtil;
57
import org.openide.filesystems.FileUtil;
58
import org.openide.util.Utilities;
58
59
59
/**
60
/**
60
 *
61
 *
Lines 71-77 Link Here
71
    
72
    
72
    public @Override SharabilityQuery.Sharability getSharability(URI uri) {
73
    public @Override SharabilityQuery.Sharability getSharability(URI uri) {
73
        //#119541 for the project's root, return MIXED right away.
74
        //#119541 for the project's root, return MIXED right away.
74
        File file = FileUtil.normalizeFile(new File(uri));
75
        File file = FileUtil.normalizeFile(Utilities.toFile(uri));
75
        FileObject fo = FileUtil.toFileObject(file);
76
        FileObject fo = FileUtil.toFileObject(file);
76
        if (fo != null && fo.equals(project.getProjectDirectory())) {
77
        if (fo != null && fo.equals(project.getProjectDirectory())) {
77
            return SharabilityQuery.Sharability.MIXED;
78
            return SharabilityQuery.Sharability.MIXED;
(-)a/maven/src/org/netbeans/modules/maven/queries/MavenSourceLevelImpl.java (-1 / +2 lines)
Lines 58-63 Link Here
58
import org.openide.filesystems.FileObject;
58
import org.openide.filesystems.FileObject;
59
import org.openide.filesystems.FileUtil;
59
import org.openide.filesystems.FileUtil;
60
import org.openide.util.ChangeSupport;
60
import org.openide.util.ChangeSupport;
61
import org.openide.util.Utilities;
61
import org.openide.util.WeakListeners;
62
import org.openide.util.WeakListeners;
62
63
63
/**
64
/**
Lines 80-86 Link Here
80
            //#128609 something in jar?
81
            //#128609 something in jar?
81
            return null;
82
            return null;
82
        }
83
        }
83
        URI uri = file.toURI();
84
        URI uri = Utilities.toURI(file);
84
        assert "file".equals(uri.getScheme());
85
        assert "file".equals(uri.getScheme());
85
        String goal = "compile"; //NOI18N
86
        String goal = "compile"; //NOI18N
86
        for (URI testuri : project.getLookup().lookup(NbMavenProjectImpl.class).getSourceRoots(true)) {
87
        for (URI testuri : project.getLookup().lookup(NbMavenProjectImpl.class).getSourceRoots(true)) {
(-)a/maven/src/org/netbeans/modules/maven/queries/MavenTestForSourceImpl.java (-2 / +3 lines)
Lines 53-58 Link Here
53
import org.openide.ErrorManager;
53
import org.openide.ErrorManager;
54
import org.openide.filesystems.FileObject;
54
import org.openide.filesystems.FileObject;
55
import org.openide.filesystems.FileUtil;
55
import org.openide.filesystems.FileUtil;
56
import org.openide.util.Utilities;
56
57
57
/**
58
/**
58
 * JUnit tests queries.
59
 * JUnit tests queries.
Lines 79-85 Link Here
79
                if (fl.equals(param)) {
80
                if (fl.equals(param)) {
80
                    return null;
81
                    return null;
81
                }
82
                }
82
                URI uri = fl.toURI();
83
                URI uri = Utilities.toURI(fl);
83
                URL entry = uri.toURL();
84
                URL entry = uri.toURL();
84
                if  (!entry.toExternalForm().endsWith("/")) { //NOI18N
85
                if  (!entry.toExternalForm().endsWith("/")) { //NOI18N
85
                    entry = new URL(entry.toExternalForm() + "/"); //NOI18N
86
                    entry = new URL(entry.toExternalForm() + "/"); //NOI18N
Lines 102-108 Link Here
102
                if (fl.equals(param)) {
103
                if (fl.equals(param)) {
103
                    return null;
104
                    return null;
104
                }
105
                }
105
                URI uri = fl.toURI();
106
                URI uri = Utilities.toURI(fl);
106
                URL entry = uri.toURL();
107
                URL entry = uri.toURL();
107
                if  (!entry.toExternalForm().endsWith("/")) { //NOI18N
108
                if  (!entry.toExternalForm().endsWith("/")) { //NOI18N
108
                    entry = new URL(entry.toExternalForm() + "/"); //NOI18N
109
                    entry = new URL(entry.toExternalForm() + "/"); //NOI18N
(-)a/maven/src/org/netbeans/modules/maven/queries/RepositoryJavadocForBinaryQueryImpl.java (-3 / +4 lines)
Lines 59-64 Link Here
59
import org.openide.filesystems.URLMapper;
59
import org.openide.filesystems.URLMapper;
60
import org.openide.util.Exceptions;
60
import org.openide.util.Exceptions;
61
import org.openide.modules.InstalledFileLocator;
61
import org.openide.modules.InstalledFileLocator;
62
import org.openide.util.Utilities;
62
import org.openide.util.lookup.ServiceProvider;
63
import org.openide.util.lookup.ServiceProvider;
63
64
64
/**
65
/**
Lines 157-170 Link Here
157
                    URL[] url;
158
                    URL[] url;
158
                    if (path != null) {
159
                    if (path != null) {
159
                        url = new URL[1];
160
                        url = new URL[1];
160
                        URL root = FileUtil.getArchiveRoot(file.toURI().toURL());
161
                        URL root = FileUtil.getArchiveRoot(Utilities.toURI(file).toURL());
161
                        if (!path.endsWith("/")) { //NOI18N
162
                        if (!path.endsWith("/")) { //NOI18N
162
                            path = path + "/"; //NOI18N
163
                            path = path + "/"; //NOI18N
163
                        }
164
                        }
164
                        url[0] = new URL(root, path);
165
                        url[0] = new URL(root, path);
165
                    } else {
166
                    } else {
166
                         url = new URL[1];
167
                         url = new URL[1];
167
                        url[0] = FileUtil.getArchiveRoot(file.toURI().toURL());
168
                        url[0] = FileUtil.getArchiveRoot(Utilities.toURI(file).toURL());
168
                    }
169
                    }
169
                    return url;
170
                    return url;
170
                }
171
                }
Lines 204-210 Link Here
204
                try {
205
                try {
205
                    File j2eeDoc = InstalledFileLocator.getDefault().locate("docs/javaee6-doc-api.zip", "org.netbeans.modules.j2ee.platform", false); // NOI18N
206
                    File j2eeDoc = InstalledFileLocator.getDefault().locate("docs/javaee6-doc-api.zip", "org.netbeans.modules.j2ee.platform", false); // NOI18N
206
                    if (j2eeDoc != null) {
207
                    if (j2eeDoc != null) {
207
                        URL url = FileUtil.getArchiveRoot(j2eeDoc.toURI().toURL());
208
                        URL url = FileUtil.getArchiveRoot(Utilities.toURI(j2eeDoc).toURL());
208
                        url = new URL(url + "docs/api/"); //NOI18N
209
                        url = new URL(url + "docs/api/"); //NOI18N
209
                        return new URL[]{url};
210
                        return new URL[]{url};
210
                    }
211
                    }
(-)a/maven/src/org/netbeans/modules/maven/queries/RepositoryMavenCPProvider.java (-2 / +3 lines)
Lines 68-73 Link Here
68
import org.netbeans.spi.java.classpath.support.ClassPathSupport;
68
import org.netbeans.spi.java.classpath.support.ClassPathSupport;
69
import org.openide.filesystems.FileObject;
69
import org.openide.filesystems.FileObject;
70
import org.openide.filesystems.FileUtil;
70
import org.openide.filesystems.FileUtil;
71
import org.openide.util.Utilities;
71
import org.openide.util.lookup.ServiceProvider;
72
import org.openide.util.lookup.ServiceProvider;
72
73
73
/**
74
/**
Lines 98-105 Link Here
98
                              //TODO can the .jar extension be hardwired? on CP..
99
                              //TODO can the .jar extension be hardwired? on CP..
99
                            File bin = new File(parent, artifact + "-" + version + ".jar"); //NOI18N
100
                            File bin = new File(parent, artifact + "-" + version + ".jar"); //NOI18N
100
                            File pom = new File(parent, artifact + "-" + version + ".pom"); //NOI18N
101
                            File pom = new File(parent, artifact + "-" + version + ".pom"); //NOI18N
101
                            URI localRepo = EmbedderFactory.getProjectEmbedder().getLocalRepositoryFile().toURI();
102
                            URI localRepo = Utilities.toURI(EmbedderFactory.getProjectEmbedder().getLocalRepositoryFile());
102
                            URI rel = localRepo.relativize(parentParent.getParentFile().toURI());
103
                            URI rel = localRepo.relativize(Utilities.toURI(parentParent.getParentFile()));
103
                            if (!rel.isAbsolute()) {
104
                            if (!rel.isAbsolute()) {
104
                                String groupId = rel.getPath();
105
                                String groupId = rel.getPath();
105
                                if (groupId != null && !groupId.equals("")) {
106
                                if (groupId != null && !groupId.equals("")) {
(-)a/maven/test/unit/src/org/netbeans/modules/maven/NbArtifactFixerTest.java (-1 / +2 lines)
Lines 41-46 Link Here
41
import java.io.File;
41
import java.io.File;
42
import org.netbeans.junit.NbTestCase;
42
import org.netbeans.junit.NbTestCase;
43
import org.netbeans.modules.maven.queries.MavenFileOwnerQueryImpl;
43
import org.netbeans.modules.maven.queries.MavenFileOwnerQueryImpl;
44
import org.openide.util.Utilities;
44
import org.openide.util.test.TestFileUtils;
45
import org.openide.util.test.TestFileUtils;
45
import org.sonatype.aether.util.artifact.DefaultArtifact;
46
import org.sonatype.aether.util.artifact.DefaultArtifact;
46
47
Lines 58-64 Link Here
58
        File pom = TestFileUtils.writeFile(new File(getWorkDir(), "pom.xml"), "<project xmlns='http://maven.apache.org/POM/4.0.0'><modelVersion>4.0.0</modelVersion>" +
59
        File pom = TestFileUtils.writeFile(new File(getWorkDir(), "pom.xml"), "<project xmlns='http://maven.apache.org/POM/4.0.0'><modelVersion>4.0.0</modelVersion>" +
59
            "<groupId>g</groupId><artifactId>a</artifactId><version>0</version>" +
60
            "<groupId>g</groupId><artifactId>a</artifactId><version>0</version>" +
60
            "</project>");
61
            "</project>");
61
        MavenFileOwnerQueryImpl.getInstance().registerCoordinates("g", "a", "0", getWorkDir().toURI().toURL());
62
        MavenFileOwnerQueryImpl.getInstance().registerCoordinates("g", "a", "0", Utilities.toURI(getWorkDir()).toURL());
62
        assertEquals(pom, new NbArtifactFixer().resolve(new DefaultArtifact("g:a:pom:0")));
63
        assertEquals(pom, new NbArtifactFixer().resolve(new DefaultArtifact("g:a:pom:0")));
63
        assertEquals(null, new NbArtifactFixer().resolve(new DefaultArtifact("g:a:jar:0")));
64
        assertEquals(null, new NbArtifactFixer().resolve(new DefaultArtifact("g:a:jar:0")));
64
        File fallback = new NbArtifactFixer().resolve(new DefaultArtifact("g:a:pom:1"));
65
        File fallback = new NbArtifactFixer().resolve(new DefaultArtifact("g:a:pom:1"));
(-)a/maven/test/unit/src/org/netbeans/modules/maven/ProjectOpenedHookImplTest.java (-2 / +3 lines)
Lines 52-57 Link Here
52
import org.openide.filesystems.FileObject;
52
import org.openide.filesystems.FileObject;
53
import org.openide.filesystems.FileUtil;
53
import org.openide.filesystems.FileUtil;
54
import org.openide.filesystems.test.TestFileUtils;
54
import org.openide.filesystems.test.TestFileUtils;
55
import org.openide.util.Utilities;
55
56
56
public class ProjectOpenedHookImplTest extends NbTestCase {
57
public class ProjectOpenedHookImplTest extends NbTestCase {
57
58
Lines 178-188 Link Here
178
            File repo = EmbedderFactory.getProjectEmbedder().getLocalRepositoryFile();
179
            File repo = EmbedderFactory.getProjectEmbedder().getLocalRepositoryFile();
179
            File mArt = new File(repo, "g/m/0/m-0.jar");
180
            File mArt = new File(repo, "g/m/0/m-0.jar");
180
            // XXX verify that p2 has not yet been loaded
181
            // XXX verify that p2 has not yet been loaded
181
            Project m = FileOwnerQuery.getOwner(mArt.toURI());
182
            Project m = FileOwnerQuery.getOwner(Utilities.toURI(mArt));
182
            assertNotNull(m);
183
            assertNotNull(m);
183
            assertEquals(d.getFileObject("p2/m"), m.getProjectDirectory());
184
            assertEquals(d.getFileObject("p2/m"), m.getProjectDirectory());
184
            File p2Art = new File(repo, "g/p2/0/p2-0.pom");
185
            File p2Art = new File(repo, "g/p2/0/p2-0.pom");
185
            Project p2 = FileOwnerQuery.getOwner(p2Art.toURI());
186
            Project p2 = FileOwnerQuery.getOwner(Utilities.toURI(p2Art));
186
            assertNotNull(p2);
187
            assertNotNull(p2);
187
            assertEquals(d.getFileObject("p2"), p2.getProjectDirectory());
188
            assertEquals(d.getFileObject("p2"), p2.getProjectDirectory());
188
        } finally {
189
        } finally {
(-)a/maven/test/unit/src/org/netbeans/modules/maven/queries/MavenAnnotationProcessingQueryImplTest.java (-1 / +2 lines)
Lines 46-51 Link Here
46
import org.openide.filesystems.FileObject;
46
import org.openide.filesystems.FileObject;
47
import org.openide.filesystems.FileUtil;
47
import org.openide.filesystems.FileUtil;
48
import org.openide.filesystems.test.TestFileUtils;
48
import org.openide.filesystems.test.TestFileUtils;
49
import org.openide.util.Utilities;
49
50
50
public class MavenAnnotationProcessingQueryImplTest extends NbTestCase {
51
public class MavenAnnotationProcessingQueryImplTest extends NbTestCase {
51
52
Lines 73-79 Link Here
73
        assertEquals(expected,
74
        assertEquals(expected,
74
                "enabled=" + r.annotationProcessingEnabled() +
75
                "enabled=" + r.annotationProcessingEnabled() +
75
                " run=" + r.annotationProcessorsToRun() +
76
                " run=" + r.annotationProcessorsToRun() +
76
                " s=" + (sOD != null ? sOD.toString().replace(getWorkDir().toURI().toString(), ".../") : "-") +
77
                " s=" + (sOD != null ? sOD.toString().replace(Utilities.toURI(getWorkDir()).toString(), ".../") : "-") +
77
                " opts=" + opts);
78
                " opts=" + opts);
78
    }
79
    }
79
80
(-)a/maven/test/unit/src/org/netbeans/modules/maven/queries/MavenFileOwnerQueryImplTest.java (-6 / +7 lines)
Lines 50-55 Link Here
50
import org.netbeans.modules.maven.NbMavenProjectImpl;
50
import org.netbeans.modules.maven.NbMavenProjectImpl;
51
import org.netbeans.modules.maven.embedder.EmbedderFactory;
51
import org.netbeans.modules.maven.embedder.EmbedderFactory;
52
import org.openide.filesystems.FileUtil;
52
import org.openide.filesystems.FileUtil;
53
import org.openide.util.Utilities;
53
import org.openide.util.test.TestFileUtils;
54
import org.openide.util.test.TestFileUtils;
54
55
55
public class MavenFileOwnerQueryImplTest extends NbTestCase {
56
public class MavenFileOwnerQueryImplTest extends NbTestCase {
Lines 85-98 Link Here
85
        File repo = EmbedderFactory.getProjectEmbedder().getLocalRepositoryFile();
86
        File repo = EmbedderFactory.getProjectEmbedder().getLocalRepositoryFile();
86
        File art10 = new File(repo, "test/prj/1.0/prj-1.0.jar");
87
        File art10 = new File(repo, "test/prj/1.0/prj-1.0.jar");
87
        File art11 = new File(repo, "test/prj/1.1/prj-1.1.jar");
88
        File art11 = new File(repo, "test/prj/1.1/prj-1.1.jar");
88
        assertEquals(null, foq.getOwner(art10.toURI()));
89
        assertEquals(null, foq.getOwner(Utilities.toURI(art10)));
89
        assertEquals(null, foq.getOwner(art11.toURI()));
90
        assertEquals(null, foq.getOwner(Utilities.toURI(art11)));
90
        foq.registerProject(p10);
91
        foq.registerProject(p10);
91
        assertEquals(p10, foq.getOwner(art10.toURI()));
92
        assertEquals(p10, foq.getOwner(Utilities.toURI(art10)));
92
        assertEquals(null, foq.getOwner(art11.toURI()));
93
        assertEquals(null, foq.getOwner(Utilities.toURI(art11)));
93
        foq.registerProject(p11);
94
        foq.registerProject(p11);
94
        assertEquals(p10, foq.getOwner(art10.toURI()));
95
        assertEquals(p10, foq.getOwner(Utilities.toURI(art10)));
95
        assertEquals(p11, foq.getOwner(art11.toURI()));
96
        assertEquals(p11, foq.getOwner(Utilities.toURI(art11)));
96
    }
97
    }
97
    
98
    
98
    public void testOldEntriesGetRemoved() throws Exception {
99
    public void testOldEntriesGetRemoved() throws Exception {
(-)a/maven/test/unit/src/org/netbeans/modules/maven/queries/MavenSharabilityQueryImplTest.java (-1 / +2 lines)
Lines 45-50 Link Here
45
import java.io.File;
45
import java.io.File;
46
import org.netbeans.api.queries.SharabilityQuery;
46
import org.netbeans.api.queries.SharabilityQuery;
47
import org.netbeans.junit.NbTestCase;
47
import org.netbeans.junit.NbTestCase;
48
import org.openide.util.Utilities;
48
import org.openide.util.test.TestFileUtils;
49
import org.openide.util.test.TestFileUtils;
49
50
50
public class MavenSharabilityQueryImplTest extends NbTestCase {
51
public class MavenSharabilityQueryImplTest extends NbTestCase {
Lines 82-88 Link Here
82
        assertSharability(SharabilityQuery.Sharability.NOT_SHARABLE, "prj/modules/mod/target");
83
        assertSharability(SharabilityQuery.Sharability.NOT_SHARABLE, "prj/modules/mod/target");
83
    }
84
    }
84
    private void assertSharability(SharabilityQuery.Sharability expected, String path) throws Exception {
85
    private void assertSharability(SharabilityQuery.Sharability expected, String path) throws Exception {
85
        assertEquals(path, expected, SharabilityQuery.getSharability(new File(getWorkDir(), path).toURI()));
86
        assertEquals(path, expected, SharabilityQuery.getSharability(Utilities.toURI(new File(getWorkDir(), path))));
86
    }
87
    }
87
88
88
}
89
}
(-)a/o.n.bootstrap/nbproject/project.xml (-1 / +1 lines)
Lines 62-68 Link Here
62
                    <build-prerequisite/>
62
                    <build-prerequisite/>
63
                    <compile-dependency/>
63
                    <compile-dependency/>
64
                    <run-dependency>
64
                    <run-dependency>
65
                        <specification-version>8.0</specification-version>
65
                        <specification-version>8.25</specification-version>
66
                    </run-dependency>
66
                    </run-dependency>
67
                </dependency>
67
                </dependency>
68
                <dependency>
68
                <dependency>
(-)a/o.n.bootstrap/src/org/netbeans/JarClassLoader.java (-13 / +5 lines)
Lines 165-171 Link Here
165
    }
165
    }
166
166
167
    final void addURL(URL location) throws IOException, URISyntaxException {
167
    final void addURL(URL location) throws IOException, URISyntaxException {
168
        File f = new File(location.toURI());
168
        File f = Utilities.toFile(location.toURI());
169
        assert f.exists() : "URL must be existing local file: " + location;
169
        assert f.exists() : "URL must be existing local file: " + location;
170
170
171
        List<Source> arr = new ArrayList<Source>(Arrays.asList(sources));
171
        List<Source> arr = new ArrayList<Source>(Arrays.asList(sources));
Lines 464-470 Link Here
464
                    return this;
464
                    return this;
465
                }
465
                }
466
            }
466
            }
467
            return "jar:" + new VFile().toURI() + "!/"; // NOI18N
467
            return "jar:" + Utilities.toURI(new VFile()) + "!/"; // NOI18N
468
        }
468
        }
469
469
470
        @Override
470
        @Override
Lines 813-819 Link Here
813
        File dir;
813
        File dir;
814
        
814
        
815
        DirSource(File file) throws MalformedURLException {
815
        DirSource(File file) throws MalformedURLException {
816
            super(file.toURI().toURL());
816
            super(Utilities.toURI(file).toURL());
817
            dir = file;
817
            dir = file;
818
        }
818
        }
819
        
819
        
Lines 823-829 Link Here
823
823
824
        protected URL doGetResource(String name) throws MalformedURLException {
824
        protected URL doGetResource(String name) throws MalformedURLException {
825
            File resFile = new File(dir, name);
825
            File resFile = new File(dir, name);
826
            return resFile.exists() ? resFile.toURI().toURL() : null;
826
            return resFile.exists() ? Utilities.toURI(resFile).toURL() : null;
827
        }
827
        }
828
        
828
        
829
        protected byte[] readClass(String path) throws IOException {
829
        protected byte[] readClass(String path) throws IOException {
Lines 946-952 Link Here
946
            AGAIN: for (;;) try {
946
            AGAIN: for (;;) try {
947
                final URI uri = new URI(filePath);
947
                final URI uri = new URI(filePath);
948
                if (uri.getScheme().equals("file")) {
948
                if (uri.getScheme().equals("file")) {
949
                    jar = uri2File(uri).getPath();
949
                    jar = Utilities.toFile(uri).getPath();
950
                } else {
950
                } else {
951
                    jar = null;
951
                    jar = null;
952
                }
952
                }
Lines 981-994 Link Here
981
            return new NbJarURLConnection (u, _src, _name, loader);
981
            return new NbJarURLConnection (u, _src, _name, loader);
982
        }
982
        }
983
        
983
        
984
        static File uri2File(URI uri) { // #207060: UNC; candidate for API (#46813)
985
            if (uri.getHost() == null) {
986
                return new File(uri);
987
            } else {
988
                return new File("\\\\" + uri.getHost() + uri.getPath().replace('/', '\\'));
989
            }
990
        }    
991
992
        @Override
984
        @Override
993
        protected void parseURL(URL u, String spec, int start, int limit) {
985
        protected void parseURL(URL u, String spec, int start, int limit) {
994
            if (spec.startsWith("/")) {
986
            if (spec.startsWith("/")) {
(-)a/o.n.bootstrap/test/unit/src/org/netbeans/JarClassLoaderTest.java (-3 / +4 lines)
Lines 65-70 Link Here
65
import java.util.Map;
65
import java.util.Map;
66
import junit.framework.AssertionFailedError;
66
import junit.framework.AssertionFailedError;
67
import org.netbeans.junit.NbTestCase;
67
import org.netbeans.junit.NbTestCase;
68
import org.openide.util.Utilities;
68
import org.openide.util.lookup.Lookups;
69
import org.openide.util.lookup.Lookups;
69
import org.openide.util.test.TestFileUtils;
70
import org.openide.util.test.TestFileUtils;
70
71
Lines 243-249 Link Here
243
        assertTrue(conn instanceof JarURLConnection);
244
        assertTrue(conn instanceof JarURLConnection);
244
        JarURLConnection jconn = (JarURLConnection) conn;
245
        JarURLConnection jconn = (JarURLConnection) conn;
245
        assertEquals("package/re source++.txt", jconn.getEntryName());
246
        assertEquals("package/re source++.txt", jconn.getEntryName());
246
        assertEquals(jar.toURI().toURL(), jconn.getJarFileURL());
247
        assertEquals(Utilities.toURI(jar).toURL(), jconn.getJarFileURL());
247
        assertEquals("bar", jconn.getMainAttributes().getValue("foo"));
248
        assertEquals("bar", jconn.getMainAttributes().getValue("foo"));
248
        assertEquals(jar.getAbsolutePath(), jconn.getJarFile().getName());
249
        assertEquals(jar.getAbsolutePath(), jconn.getJarFile().getName());
249
    }
250
    }
Lines 252-258 Link Here
252
        File jar = new File(getWorkDir(), "default-package-resource.jar");
253
        File jar = new File(getWorkDir(), "default-package-resource.jar");
253
        TestFileUtils.writeZipFile(jar, "META-INF/MANIFEST.MF:Manifest-Version: 1.0\nfoo: bar\n\n", "package/re source++.txt:content");
254
        TestFileUtils.writeZipFile(jar, "META-INF/MANIFEST.MF:Manifest-Version: 1.0\nfoo: bar\n\n", "package/re source++.txt:content");
254
        JarClassLoader jcl = new JarClassLoader(Collections.<File>emptyList(), new ProxyClassLoader[0]);
255
        JarClassLoader jcl = new JarClassLoader(Collections.<File>emptyList(), new ProxyClassLoader[0]);
255
        jcl.addURL(jar.toURI().toURL());
256
        jcl.addURL(Utilities.toURI(jar).toURL());
256
        URL url = jcl.getResource("package/re source++.txt");
257
        URL url = jcl.getResource("package/re source++.txt");
257
        assertTrue(url.toString(), url.toString().endsWith("default-package-resource.jar!/package/re%20source++.txt"));
258
        assertTrue(url.toString(), url.toString().endsWith("default-package-resource.jar!/package/re%20source++.txt"));
258
        URLConnection conn = url.openConnection();
259
        URLConnection conn = url.openConnection();
Lines 260-266 Link Here
260
        assertTrue(conn instanceof JarURLConnection);
261
        assertTrue(conn instanceof JarURLConnection);
261
        JarURLConnection jconn = (JarURLConnection) conn;
262
        JarURLConnection jconn = (JarURLConnection) conn;
262
        assertEquals("package/re source++.txt", jconn.getEntryName());
263
        assertEquals("package/re source++.txt", jconn.getEntryName());
263
        assertEquals(jar.toURI().toURL(), jconn.getJarFileURL());
264
        assertEquals(Utilities.toURI(jar).toURL(), jconn.getJarFileURL());
264
        assertEquals("bar", jconn.getMainAttributes().getValue("foo"));
265
        assertEquals("bar", jconn.getMainAttributes().getValue("foo"));
265
        assertEquals(jar.getAbsolutePath(), jconn.getJarFile().getName());
266
        assertEquals(jar.getAbsolutePath(), jconn.getJarFile().getName());
266
    }
267
    }
(-)a/o.n.bootstrap/test/unit/src/org/netbeans/JarURLStreamHandlerTest.java (-2 / +3 lines)
Lines 50-55 Link Here
50
import java.util.jar.JarOutputStream;
50
import java.util.jar.JarOutputStream;
51
import java.util.zip.ZipEntry;
51
import java.util.zip.ZipEntry;
52
import org.netbeans.junit.NbTestCase;
52
import org.netbeans.junit.NbTestCase;
53
import org.openide.util.Utilities;
53
54
54
/**
55
/**
55
 *
56
 *
Lines 83-96 Link Here
83
    }
84
    }
84
85
85
    public void testNormalHandler() throws Exception {
86
    public void testNormalHandler() throws Exception {
86
        URL root = new URL("jar:" + jar.toURI() + "!/");
87
        URL root = new URL("jar:" + Utilities.toURI(jar) + "!/");
87
        URL plain = new URL(root, "/fldr/plain.txt", ProxyURLStreamHandlerFactory.originalJarHandler());
88
        URL plain = new URL(root, "/fldr/plain.txt", ProxyURLStreamHandlerFactory.originalJarHandler());
88
        assertTrue("Contains the plain.txt part: " + plain, plain.toExternalForm().contains("fldr/plain.txt"));
89
        assertTrue("Contains the plain.txt part: " + plain, plain.toExternalForm().contains("fldr/plain.txt"));
89
        assertContent("Ahoj", plain);
90
        assertContent("Ahoj", plain);
90
    }
91
    }
91
92
92
    public void testNbHandler() throws Exception {
93
    public void testNbHandler() throws Exception {
93
        URL root = new URL("jar:" + jar.toURI() + "!/");
94
        URL root = new URL("jar:" + Utilities.toURI(jar) + "!/");
94
        URL plain = new URL(root, "/fldr/plain.txt", new JarClassLoader.JarURLStreamHandler(null));
95
        URL plain = new URL(root, "/fldr/plain.txt", new JarClassLoader.JarURLStreamHandler(null));
95
        assertTrue("Contains the plain.txt part: " + plain, plain.toExternalForm().contains("fldr/plain.txt"));
96
        assertTrue("Contains the plain.txt part: " + plain, plain.toExternalForm().contains("fldr/plain.txt"));
96
        assertContent("Ahoj", plain);
97
        assertContent("Ahoj", plain);
(-)a/o.n.bootstrap/test/unit/src/org/netbeans/ModuleFactoryAlienTest.java (-1 / +2 lines)
Lines 64-69 Link Here
64
import org.fakepkg.FakeIfceHidden;
64
import org.fakepkg.FakeIfceHidden;
65
import org.openide.modules.SpecificationVersion;
65
import org.openide.modules.SpecificationVersion;
66
import org.openide.util.Enumerations;
66
import org.openide.util.Enumerations;
67
import org.openide.util.Utilities;
67
import org.openide.util.test.MockLookup;
68
import org.openide.util.test.MockLookup;
68
69
69
/** Verify contracts needed by Netigso.
70
/** Verify contracts needed by Netigso.
Lines 159-165 Link Here
159
            both = b;
160
            both = b;
160
161
161
            AlienModule am = (AlienModule)m2;
162
            AlienModule am = (AlienModule)m2;
162
            am.loader.l = new URLClassLoader(new URL[] { am.jar.toURI().toURL() }, m1.getClassLoader());
163
            am.loader.l = new URLClassLoader(new URL[] { Utilities.toURI(am.jar).toURL() }, m1.getClassLoader());
163
164
164
            assertFalse("Finish without exception", m2.provides("false"));
165
            assertFalse("Finish without exception", m2.provides("false"));
165
166
(-)a/o.n.bootstrap/test/unit/src/org/netbeans/ModuleFactoryTest.java (-1 / +2 lines)
Lines 54-59 Link Here
54
import java.util.Set;
54
import java.util.Set;
55
import java.util.jar.JarFile;
55
import java.util.jar.JarFile;
56
import java.util.jar.Manifest;
56
import java.util.jar.Manifest;
57
import org.openide.util.Utilities;
57
import org.openide.util.test.MockLookup;
58
import org.openide.util.test.MockLookup;
58
59
59
/**
60
/**
Lines 89-95 Link Here
89
            File j1 = new File(jars, "simple-module.jar");
90
            File j1 = new File(jars, "simple-module.jar");
90
            File j2 = new File(jars, "depends-on-simple-module.jar");
91
            File j2 = new File(jars, "depends-on-simple-module.jar");
91
            File j3 = new File(jars, "dep-on-two-modules.jar");
92
            File j3 = new File(jars, "dep-on-two-modules.jar");
92
            URLClassLoader l = new URLClassLoader(new URL[] {j1.toURI().toURL(), j2.toURI().toURL()});
93
            URLClassLoader l = new URLClassLoader(new URL[] {Utilities.toURI(j1).toURL(), Utilities.toURI(j2).toURL()});
93
            Manifest mani1, mani2;
94
            Manifest mani1, mani2;
94
            JarFile j = new JarFile(j1);
95
            JarFile j = new JarFile(j1);
95
            try {
96
            try {
(-)a/o.n.bootstrap/test/unit/src/org/netbeans/ModuleManagerTest.java (-4 / +4 lines)
Lines 823-830 Link Here
823
        }
823
        }
824
        ClassLoader l = new URLClassLoader(new URL[] {
824
        ClassLoader l = new URLClassLoader(new URL[] {
825
            // Order should be irrelevant:
825
            // Order should be irrelevant:
826
            jar.toURI().toURL(),
826
            Utilities.toURI(jar).toURL(),
827
            ljar.toURI().toURL(),
827
            Utilities.toURI(ljar).toURL(),
828
        });
828
        });
829
        MockModuleInstaller installer = new MockModuleInstaller();
829
        MockModuleInstaller installer = new MockModuleInstaller();
830
        MockEvents ev = new MockEvents();
830
        MockEvents ev = new MockEvents();
Lines 2029-2035 Link Here
2029
            File j1 = new File(jars, "simple-module.jar");
2029
            File j1 = new File(jars, "simple-module.jar");
2030
            File j2 = new File(jars, "depends-on-simple-module.jar");
2030
            File j2 = new File(jars, "depends-on-simple-module.jar");
2031
            File j3 = new File(jars, "dep-on-two-modules.jar");
2031
            File j3 = new File(jars, "dep-on-two-modules.jar");
2032
            URLClassLoader l = new URLClassLoader(new URL[] {j1.toURI().toURL(), j2.toURI().toURL()});
2032
            URLClassLoader l = new URLClassLoader(new URL[] {Utilities.toURI(j1).toURL(), Utilities.toURI(j2).toURL()});
2033
            Manifest mani1, mani2;
2033
            Manifest mani1, mani2;
2034
            JarFile j = new JarFile(j1);
2034
            JarFile j = new JarFile(j1);
2035
            try {
2035
            try {
Lines 2648-2654 Link Here
2648
        assertNotNull(modules);
2648
        assertNotNull(modules);
2649
        mgr.mutexPrivileged().enterWriteAccess();
2649
        mgr.mutexPrivileged().enterWriteAccess();
2650
        try {
2650
        try {
2651
            ClassLoader l = new URLClassLoader(new URL[] {mod1JAR.toURI().toURL(), mod2JAR.toURI().toURL()});
2651
            ClassLoader l = new URLClassLoader(new URL[] {Utilities.toURI(mod1JAR).toURL(), Utilities.toURI(mod2JAR).toURL()});
2652
            Module mod1 = mgr.createFixed(loadManifest(mod1JAR), null, l);
2652
            Module mod1 = mgr.createFixed(loadManifest(mod1JAR), null, l);
2653
            mgr.enable(mod1);
2653
            mgr.enable(mod1);
2654
            assertEquals(l, mod1.getClassLoader());
2654
            assertEquals(l, mod1.getClassLoader());
(-)a/o.n.bootstrap/test/unit/src/org/netbeans/ModuleMixedOnClasspathTest.java (-1 / +2 lines)
Lines 50-55 Link Here
50
import java.util.jar.JarFile;
50
import java.util.jar.JarFile;
51
import java.util.jar.Manifest;
51
import java.util.jar.Manifest;
52
import org.openide.util.Lookup;
52
import org.openide.util.Lookup;
53
import org.openide.util.Utilities;
53
import org.openide.util.lookup.Lookups;
54
import org.openide.util.lookup.Lookups;
54
import org.openide.util.lookup.ProxyLookup;
55
import org.openide.util.lookup.ProxyLookup;
55
56
Lines 97-103 Link Here
97
            File j1 = new File(jars, "simple-module.jar");
98
            File j1 = new File(jars, "simple-module.jar");
98
            File j2 = new File(jars, "depends-on-simple-module.jar");
99
            File j2 = new File(jars, "depends-on-simple-module.jar");
99
            File j3 = new File(jars, "dep-on-two-modules.jar");
100
            File j3 = new File(jars, "dep-on-two-modules.jar");
100
            URLClassLoader l = new URLClassLoader(new URL[] {j1.toURI().toURL()});
101
            URLClassLoader l = new URLClassLoader(new URL[] {Utilities.toURI(j1).toURL()});
101
            Manifest mani1, mani2;
102
            Manifest mani1, mani2;
102
            JarFile j = new JarFile(j1);
103
            JarFile j = new JarFile(j1);
103
            try {
104
            try {
(-)a/o.n.bootstrap/test/unit/src/org/netbeans/ProxyClassLoaderTest.java (-2 / +3 lines)
Lines 55-60 Link Here
55
import org.fakepkg.FakeIfceHidden;
55
import org.fakepkg.FakeIfceHidden;
56
import org.openide.util.Enumerations;
56
import org.openide.util.Enumerations;
57
import org.openide.util.Exceptions;
57
import org.openide.util.Exceptions;
58
import org.openide.util.Utilities;
58
59
59
public class ProxyClassLoaderTest extends SetupHid {
60
public class ProxyClassLoaderTest extends SetupHid {
60
61
Lines 252-262 Link Here
252
        }
253
        }
253
254
254
        File j1 = new File(jars, "simple-module.jar");
255
        File j1 = new File(jars, "simple-module.jar");
255
        ClassLoader l1 = new URLClassLoader(new URL[] { j1.toURI().toURL() });
256
        ClassLoader l1 = new URLClassLoader(new URL[] { Utilities.toURI(j1).toURL() });
256
257
257
        Loader loader = new Loader("org.bar", "org.fakepkg");
258
        Loader loader = new Loader("org.bar", "org.fakepkg");
258
        File jar = new File(jars, "depends-on-simple-module.jar");
259
        File jar = new File(jars, "depends-on-simple-module.jar");
259
        loader.l = new URLClassLoader(new URL[] { jar.toURI().toURL() }, l1);
260
        loader.l = new URLClassLoader(new URL[] { Utilities.toURI(jar).toURL() }, l1);
260
261
261
262
262
        Class<?> clazz = loader.loadClass("org.bar.SomethingElse");
263
        Class<?> clazz = loader.loadClass("org.bar.SomethingElse");
(-)a/o.n.bootstrap/test/unit/src/org/netbeans/ProxyURLStreamHandlerFactoryTest.java (-1 / +1 lines)
Lines 79-85 Link Here
79
            return;
79
            return;
80
        }
80
        }
81
        File uncFile = new File("\\\\computerName\\sharedFolder\\a\\b\\c\\d.txt");
81
        File uncFile = new File("\\\\computerName\\sharedFolder\\a\\b\\c\\d.txt");
82
        URI uri = uncFile.toURI();
82
        URI uri = Utilities.toURI(uncFile);
83
        String expectedURI = "file:////computerName/sharedFolder/a/b/c/d.txt";
83
        String expectedURI = "file:////computerName/sharedFolder/a/b/c/d.txt";
84
        assertEquals("Wrong URI from File.toURI.", expectedURI, uri.toString());
84
        assertEquals("Wrong URI from File.toURI.", expectedURI, uri.toString());
85
        URL url = uri.toURL();
85
        URL url = uri.toURL();
(-)a/o.n.bootstrap/test/unit/src/org/netbeans/URLsAreEqualTest.java (-1 / +2 lines)
Lines 47-52 Link Here
47
import java.util.Collections;
47
import java.util.Collections;
48
import java.util.logging.Level;
48
import java.util.logging.Level;
49
import org.netbeans.junit.NbTestCase;
49
import org.netbeans.junit.NbTestCase;
50
import org.openide.util.Utilities;
50
import org.openide.util.test.TestFileUtils;
51
import org.openide.util.test.TestFileUtils;
51
52
52
/**
53
/**
Lines 69-75 Link Here
69
        
70
        
70
        File jar = new File(wd, "default-package-resource.jar");
71
        File jar = new File(wd, "default-package-resource.jar");
71
        
72
        
72
        URL orig = new URL("jar:" + jar.toURI() + "!/package/resource.txt");
73
        URL orig = new URL("jar:" + Utilities.toURI(jar) + "!/package/resource.txt");
73
        URLConnection conn = orig.openConnection();
74
        URLConnection conn = orig.openConnection();
74
        assertFalse("JDK connection: " + conn, conn.getClass().getName().startsWith("org.netbeans"));
75
        assertFalse("JDK connection: " + conn, conn.getClass().getName().startsWith("org.netbeans"));
75
        
76
        
(-)a/o.n.bootstrap/test/unit/src/org/netbeans/nbexec/NbExecPassesCorrectlyQuotedArgsTest.java (-2 / +2 lines)
Lines 93-105 Link Here
93
    
93
    
94
    private void run(File workDir, String... args) throws Exception {
94
    private void run(File workDir, String... args) throws Exception {
95
        URL u = Lookup.class.getProtectionDomain().getCodeSource().getLocation();
95
        URL u = Lookup.class.getProtectionDomain().getCodeSource().getLocation();
96
        File f = new File(u.toURI());
96
        File f = Utilities.toFile(u.toURI());
97
        assertTrue("file found: " + f, f.exists());
97
        assertTrue("file found: " + f, f.exists());
98
        File nbexec = Utilities.isWindows() ? new File(f.getParent(), "nbexec.exe") : new File(f.getParent(), "nbexec");
98
        File nbexec = Utilities.isWindows() ? new File(f.getParent(), "nbexec.exe") : new File(f.getParent(), "nbexec");
99
        assertTrue("nbexec found: " + nbexec, nbexec.exists());
99
        assertTrue("nbexec found: " + nbexec, nbexec.exists());
100
100
101
        URL tu = MainCallback.class.getProtectionDomain().getCodeSource().getLocation();
101
        URL tu = MainCallback.class.getProtectionDomain().getCodeSource().getLocation();
102
        File testf = new File(tu.toURI());
102
        File testf = Utilities.toFile(tu.toURI());
103
        assertTrue("file found: " + testf, testf.exists());
103
        assertTrue("file found: " + testf, testf.exists());
104
        
104
        
105
        LinkedList<String> allArgs = new LinkedList<String>(Arrays.asList(args));
105
        LinkedList<String> allArgs = new LinkedList<String>(Arrays.asList(args));
(-)a/openide.filesystems/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>8.10</specification-version>
57
                        <specification-version>8.25</specification-version>
58
                    </run-dependency>
58
                    </run-dependency>
59
                </dependency>
59
                </dependency>
60
                <dependency>
60
                <dependency>
(-)a/openide.filesystems/src/org/openide/filesystems/FileUtil.java (-22 / +8 lines)
Lines 1008-1014 Link Here
1008
            }
1008
            }
1009
1009
1010
            if ((fileURL != null) && "file".equals(fileURL.getProtocol())) {
1010
            if ((fileURL != null) && "file".equals(fileURL.getProtocol())) {
1011
                retVal = new File(URI.create(fileURL.toExternalForm()));
1011
                retVal = Utilities.toFile(URI.create(fileURL.toExternalForm()));
1012
            }
1012
            }
1013
            if (retVal != null) {
1013
            if (retVal != null) {
1014
                retVal = normalizeFile(retVal);
1014
                retVal = normalizeFile(retVal);
Lines 1061-1073 Link Here
1061
1061
1062
        FileObject retVal = null;
1062
        FileObject retVal = null;
1063
        try {
1063
        try {
1064
            URL url = file.toURI().toURL();
1064
            URL url = Utilities.toURI(file).toURL();
1065
1066
            if ((url.getAuthority() != null) &&
1067
                    (Utilities.isWindows() || (Utilities.getOperatingSystem() == Utilities.OS_OS2))) {
1068
                return null;
1069
            }
1070
1071
            retVal = URLMapper.findFileObject(url);
1065
            retVal = URLMapper.findFileObject(url);
1072
1066
1073
            /*probably temporary piece of code to catch the cause of #46630*/
1067
            /*probably temporary piece of code to catch the cause of #46630*/
Lines 1111-1125 Link Here
1111
        }
1105
        }
1112
1106
1113
        try {
1107
        try {
1114
            URL url = (file.toURI().toURL());
1108
            URL url = (Utilities.toURI(file).toURL());
1115
1116
            if (
1117
                (url.getAuthority() != null) &&
1118
                    (Utilities.isWindows() || (Utilities.getOperatingSystem() == Utilities.OS_OS2))
1119
            ) {
1120
                return null;
1121
            }
1122
1123
            retVal = URLMapper.findFileObjects(url);
1109
            retVal = URLMapper.findFileObjects(url);
1124
        } catch (MalformedURLException e) {
1110
        } catch (MalformedURLException e) {
1125
            retVal = null;
1111
            retVal = null;
Lines 1815-1821 Link Here
1815
    private static File normalizeFileOnUnixAlike(File file) {
1801
    private static File normalizeFileOnUnixAlike(File file) {
1816
        // On Unix, do not want to traverse symlinks.
1802
        // On Unix, do not want to traverse symlinks.
1817
        // URI.normalize removes ../ and ./ sequences nicely.
1803
        // URI.normalize removes ../ and ./ sequences nicely.
1818
        file = new File(file.toURI().normalize()).getAbsoluteFile();
1804
        file = Utilities.toFile(Utilities.toURI(file).normalize()).getAbsoluteFile();
1819
        while (file.getAbsolutePath().startsWith("/../")) { // NOI18N
1805
        while (file.getAbsolutePath().startsWith("/../")) { // NOI18N
1820
            file = new File(file.getAbsolutePath().substring(3));
1806
            file = new File(file.getAbsolutePath().substring(3));
1821
        }
1807
        }
Lines 1831-1837 Link Here
1831
1817
1832
        try {
1818
        try {
1833
            // URI.normalize removes ../ and ./ sequences nicely.            
1819
            // URI.normalize removes ../ and ./ sequences nicely.            
1834
            File absoluteFile = new File(file.toURI().normalize());
1820
            File absoluteFile = Utilities.toFile(Utilities.toURI(file).normalize());
1835
            File canonicalFile = file.getCanonicalFile();
1821
            File canonicalFile = file.getCanonicalFile();
1836
            String absolutePath = absoluteFile.getAbsolutePath();
1822
            String absolutePath = absoluteFile.getAbsolutePath();
1837
            if (absolutePath.equals("/..")) { // NOI18N
1823
            if (absolutePath.equals("/..")) { // NOI18N
Lines 2162-2168 Link Here
2162
            do {
2148
            do {
2163
                wasDir = entry.isDirectory();
2149
                wasDir = entry.isDirectory();
2164
                LOG.finest("urlForArchiveOrDir:toURI:entry");   //NOI18N
2150
                LOG.finest("urlForArchiveOrDir:toURI:entry");   //NOI18N
2165
                u = entry.toURI().toURL();
2151
                u = Utilities.toURI(entry).toURL();
2166
                isDir = entry.isDirectory();
2152
                isDir = entry.isDirectory();
2167
            } while (wasDir ^ isDir);
2153
            } while (wasDir ^ isDir);
2168
            if (isArchiveFile(u) || entry.isFile() && entry.length() < 4) {
2154
            if (isArchiveFile(u) || entry.isFile() && entry.length() < 4) {
Lines 2197-2205 Link Here
2197
    public static File archiveOrDirForURL(URL entry) {
2183
    public static File archiveOrDirForURL(URL entry) {
2198
        String u = entry.toString();
2184
        String u = entry.toString();
2199
        if (u.startsWith("jar:file:") && u.endsWith("!/")) { // NOI18N
2185
        if (u.startsWith("jar:file:") && u.endsWith("!/")) { // NOI18N
2200
            return new File(URI.create(u.substring(4, u.length() - 2)));
2186
            return Utilities.toFile(URI.create(u.substring(4, u.length() - 2)));
2201
        } else if (u.startsWith("file:")) { // NOI18N
2187
        } else if (u.startsWith("file:")) { // NOI18N
2202
            return new File(URI.create(u));
2188
            return Utilities.toFile(URI.create(u));
2203
        } else {
2189
        } else {
2204
            return null;
2190
            return null;
2205
        }
2191
        }
(-)a/openide.filesystems/src/org/openide/filesystems/URLMapper.java (-3 / +4 lines)
Lines 64-69 Link Here
64
import org.openide.util.Lookup;
64
import org.openide.util.Lookup;
65
import org.openide.util.LookupEvent;
65
import org.openide.util.LookupEvent;
66
import org.openide.util.LookupListener;
66
import org.openide.util.LookupListener;
67
import org.openide.util.Utilities;
67
68
68
/** Mapper from FileObject -> URL.
69
/** Mapper from FileObject -> URL.
69
 * Should be registered in default lookup. For details see {@link Lookup#getDefault()}.
70
 * Should be registered in default lookup. For details see {@link Lookup#getDefault()}.
Lines 421-427 Link Here
421
                    // XXX clumsy; see ArchiveURLMapper for possible cleaner style
422
                    // XXX clumsy; see ArchiveURLMapper for possible cleaner style
422
                    String toReplace = "__EXCLAMATION_REPLACEMENT__";//NOI18N
423
                    String toReplace = "__EXCLAMATION_REPLACEMENT__";//NOI18N
423
                    retURL = new URL(
424
                    retURL = new URL(
424
                            "jar:" + new File(f,toReplace + fo.getPath()).toURI().toString().replaceFirst("/"+toReplace,"!/") + // NOI18N
425
                            "jar:" + Utilities.toURI(new File(f,toReplace + fo.getPath())).toString().replaceFirst("/"+toReplace,"!/") + // NOI18N
425
                            ((fo.isFolder() && !fo.isRoot()) ? "/" : "")
426
                            ((fo.isFolder() && !fo.isRoot()) ? "/" : "")
426
                        ); // NOI18N
427
                        ); // NOI18N
427
                } catch (MalformedURLException mfx) {
428
                } catch (MalformedURLException mfx) {
Lines 459-465 Link Here
459
        }
460
        }
460
461
461
        private static URL toURL(File fFile, FileObject fo) throws MalformedURLException {
462
        private static URL toURL(File fFile, FileObject fo) throws MalformedURLException {
462
            URL retVal = fFile.toURI().toURL();
463
            URL retVal = Utilities.toURI(fFile).toURL();
463
            if (retVal != null && fo.isFolder()) {
464
            if (retVal != null && fo.isFolder()) {
464
                // #155742,160333 - URL for folder must always end with slash
465
                // #155742,160333 - URL for folder must always end with slash
465
                final String urlDef = retVal.toExternalForm();
466
                final String urlDef = retVal.toExternalForm();
Lines 528-534 Link Here
528
            try {
529
            try {
529
                URI uri = new URI(u.toExternalForm());
530
                URI uri = new URI(u.toExternalForm());
530
531
531
                return FileUtil.normalizeFile(new File(uri));
532
                return FileUtil.normalizeFile(Utilities.toFile(uri));
532
            } catch (URISyntaxException use) {
533
            } catch (URISyntaxException use) {
533
                // malformed URL
534
                // malformed URL
534
                return null;
535
                return null;
(-)a/openide.filesystems/src/org/openide/filesystems/XMLFileSystem.java (-1 / +2 lines)
Lines 74-79 Link Here
74
import org.openide.util.Enumerations;
74
import org.openide.util.Enumerations;
75
import org.openide.util.Exceptions;
75
import org.openide.util.Exceptions;
76
import org.openide.util.NbBundle;
76
import org.openide.util.NbBundle;
77
import org.openide.util.Utilities;
77
import org.openide.xml.XMLUtil;
78
import org.openide.xml.XMLUtil;
78
import org.xml.sax.Attributes;
79
import org.xml.sax.Attributes;
79
import org.xml.sax.InputSource;
80
import org.xml.sax.InputSource;
Lines 1119-1125 Link Here
1119
                
1120
                
1120
                if ("file".equals(protocol)) { //NOI18N
1121
                if ("file".equals(protocol)) { //NOI18N
1121
                    try {
1122
                    try {
1122
                        File f = new File(URI.create(url.toExternalForm()));
1123
                        File f = Utilities.toFile(URI.create(url.toExternalForm()));
1123
                        if (!f.equals(lastFile)) {
1124
                        if (!f.equals(lastFile)) {
1124
                            lastFile = f;
1125
                            lastFile = f;
1125
                            lastFileDate = new Date(f.lastModified());
1126
                            lastFileDate = new Date(f.lastModified());
(-)a/openide.filesystems/test/unit/src/org/openide/filesystems/AttributesTestHidden.java (-1 / +2 lines)
Lines 48-53 Link Here
48
import java.util.*;
48
import java.util.*;
49
import java.io.*;
49
import java.io.*;
50
import java.lang.reflect.Method;
50
import java.lang.reflect.Method;
51
import org.openide.util.Utilities;
51
52
52
/**
53
/**
53
 *
54
 *
Lines 305-311 Link Here
305
        ).getBytes());
306
        ).getBytes());
306
        fos.close();
307
        fos.close();
307
308
308
        XMLFileSystem xfs = new XMLFileSystem(f.toURI().toURL());
309
        XMLFileSystem xfs = new XMLFileSystem(Utilities.toURI(f).toURL());
309
        FileObject template = xfs.findResource("Templates/Other/special");
310
        FileObject template = xfs.findResource("Templates/Other/special");
310
        assertNotNull("template found", template);
311
        assertNotNull("template found", template);
311
        FileObject foTested = testedFS.getRoot().createData("copiedTemplate");
312
        FileObject foTested = testedFS.getRoot().createData("copiedTemplate");
(-)a/openide.filesystems/test/unit/src/org/openide/filesystems/FileUtilTest.java (-3 / +3 lines)
Lines 188-199 Link Here
188
    }
188
    }
189
    private void assertCorrectURL(String filename, String expectedURLPrefix, String expectedURLSuffix) throws Exception {
189
    private void assertCorrectURL(String filename, String expectedURLPrefix, String expectedURLSuffix) throws Exception {
190
        File d = getWorkDir();
190
        File d = getWorkDir();
191
        assertEquals(expectedURLSuffix == null ? null : new URL(expectedURLPrefix + d.toURI() + expectedURLSuffix),
191
        assertEquals(expectedURLSuffix == null ? null : new URL(expectedURLPrefix + Utilities.toURI(d) + expectedURLSuffix),
192
                FileUtil.urlForArchiveOrDir(new File(d, filename)));
192
                FileUtil.urlForArchiveOrDir(new File(d, filename)));
193
    }
193
    }
194
    private void assertCorrectFile(String expectedFilename, String urlPrefix, String urlSuffix) throws Exception {
194
    private void assertCorrectFile(String expectedFilename, String urlPrefix, String urlSuffix) throws Exception {
195
        assertEquals(expectedFilename == null ? null : new File(getWorkDir(), expectedFilename),
195
        assertEquals(expectedFilename == null ? null : new File(getWorkDir(), expectedFilename),
196
                FileUtil.archiveOrDirForURL(new URL(urlPrefix + getWorkDir().toURI() + urlSuffix)));
196
                FileUtil.archiveOrDirForURL(new URL(urlPrefix + Utilities.toURI(getWorkDir()) + urlSuffix)));
197
    }
197
    }
198
198
199
    /** Tests translation from jar resource url to jar archive url. */
199
    /** Tests translation from jar resource url to jar archive url. */
Lines 262-268 Link Here
262
        };
262
        };
263
        log.addHandler(handler);
263
        log.addHandler(handler);
264
        try {
264
        try {
265
            final boolean result = FileUtil.isArchiveFile(testFile.toURI().toURL());
265
            final boolean result = FileUtil.isArchiveFile(Utilities.toURI(testFile).toURL());
266
            assertTrue("The test.jar should be archive.",result);   //NOI18N
266
            assertTrue("The test.jar should be archive.",result);   //NOI18N
267
        } finally {
267
        } finally {
268
            log.removeHandler(handler);
268
            log.removeHandler(handler);
(-)a/openide.filesystems/test/unit/src/org/openide/filesystems/FileUtilTestHidden.java (-1 / +1 lines)
Lines 182-188 Link Here
182
    }
182
    }
183
183
184
    public void testIsArchiveFile() throws Exception {
184
    public void testIsArchiveFile() throws Exception {
185
        final String base = getWorkDir().toURI().toURL().toExternalForm();
185
        final String base = Utilities.toURI(getWorkDir()).toURL().toExternalForm();
186
        URL url = new URL(base + "test.jar");    //NOI18N
186
        URL url = new URL(base + "test.jar");    //NOI18N
187
        assertTrue("test.jar has to be an archive", FileUtil.isArchiveFile(url));  //NOI18N
187
        assertTrue("test.jar has to be an archive", FileUtil.isArchiveFile(url));  //NOI18N
188
        url = new URL(base + ".hidden.jar");   //NOI18N
188
        url = new URL(base + ".hidden.jar");   //NOI18N
(-)a/openide.filesystems/test/unit/src/org/openide/filesystems/MultiFileObjectTestHid.java (-1 / +2 lines)
Lines 49-54 Link Here
49
import java.util.ArrayList;
49
import java.util.ArrayList;
50
import java.util.Arrays;
50
import java.util.Arrays;
51
import java.util.List;
51
import java.util.List;
52
import org.openide.util.Utilities;
52
53
53
public class MultiFileObjectTestHid extends TestBaseHid {
54
public class MultiFileObjectTestHid extends TestBaseHid {
54
    private static String[] resources = new String [] {
55
    private static String[] resources = new String [] {
Lines 235-241 Link Here
235
                + "      </folder>\n"
236
                + "      </folder>\n"
236
                + "    </folder>\n"
237
                + "    </folder>\n"
237
                + "</filesystem>");
238
                + "</filesystem>");
238
        XMLFileSystem xml = new XMLFileSystem(f.toURI().toURL());
239
        XMLFileSystem xml = new XMLFileSystem(Utilities.toURI(f).toURL());
239
        all.add(xml);
240
        all.add(xml);
240
        mfs.setDelegates(all.toArray(new FileSystem[0]));
241
        mfs.setDelegates(all.toArray(new FileSystem[0]));
241
242
(-)a/openide.filesystems/test/unit/src/org/openide/filesystems/TestUtilHid.java (-1 / +2 lines)
Lines 57-62 Link Here
57
import java.util.Iterator;
57
import java.util.Iterator;
58
import java.util.Map;
58
import java.util.Map;
59
import java.util.StringTokenizer;
59
import java.util.StringTokenizer;
60
import org.openide.util.Utilities;
60
61
61
/**
62
/**
62
 * @author  rm111737
63
 * @author  rm111737
Lines 176-182 Link Here
176
177
177
        XMLFileSystem xfs = new XMLFileSystem  ();
178
        XMLFileSystem xfs = new XMLFileSystem  ();
178
        try {
179
        try {
179
            xfs.setXmlUrl(xmlFile.toURI().toURL());
180
            xfs.setXmlUrl(Utilities.toURI(xmlFile).toURL());
180
        } catch (Exception ex) {}
181
        } catch (Exception ex) {}
181
        
182
        
182
        return xfs;
183
        return xfs;
(-)a/openide.filesystems/test/unit/src/org/openide/filesystems/URLMapper50852Test.java (-1 / +2 lines)
Lines 50-55 Link Here
50
50
51
import java.net.URL;
51
import java.net.URL;
52
import java.io.File;
52
import java.io.File;
53
import org.openide.util.Utilities;
53
54
54
/**
55
/**
55
 * Simulates issue 50852.
56
 * Simulates issue 50852.
Lines 76-82 Link Here
76
     */
77
     */
77
    protected void setUp() throws Exception {
78
    protected void setUp() throws Exception {
78
        File workdir = getWorkDir();
79
        File workdir = getWorkDir();
79
        testURL = workdir.toURI().toURL();                
80
        testURL = Utilities.toURI(workdir).toURL();
80
        System.setProperty("org.openide.util.Lookup", "org.openide.filesystems.URLMapper50852Test$Lkp");
81
        System.setProperty("org.openide.util.Lookup", "org.openide.filesystems.URLMapper50852Test$Lkp");
81
        MAPPER_INSTANCE = new MyURLMapper ();
82
        MAPPER_INSTANCE = new MyURLMapper ();
82
        Lkp lkp = (Lkp)org.openide.util.Lookup.getDefault();
83
        Lkp lkp = (Lkp)org.openide.util.Lookup.getDefault();
(-)a/openide.filesystems/test/unit/src/org/openide/filesystems/URLMapperTest.java (-2 / +3 lines)
Lines 57-62 Link Here
57
import java.util.zip.CRC32;
57
import java.util.zip.CRC32;
58
import java.util.zip.ZipEntry;
58
import java.util.zip.ZipEntry;
59
import org.netbeans.junit.NbTestCase;
59
import org.netbeans.junit.NbTestCase;
60
import org.openide.util.Utilities;
60
61
61
/**
62
/**
62
 * Test functionality of URLMapper.
63
 * Test functionality of URLMapper.
Lines 76-82 Link Here
76
        lfs.setRootDirectory(getWorkDir());
77
        lfs.setRootDirectory(getWorkDir());
77
        Repository.getDefault().addFileSystem(lfs);
78
        Repository.getDefault().addFileSystem(lfs);
78
        
79
        
79
        URL uPlus = plus.toURI().toURL();
80
        URL uPlus = Utilities.toURI(plus).toURL();
80
        FileObject fo = URLMapper.findFileObject(uPlus);
81
        FileObject fo = URLMapper.findFileObject(uPlus);
81
        assertNotNull("File object found", fo);
82
        assertNotNull("File object found", fo);
82
        assertEquals("plus+plus", fo.getNameExt());
83
        assertEquals("plus+plus", fo.getNameExt());
Lines 116-122 Link Here
116
        FileObject rootFO = jfs.getRoot();
117
        FileObject rootFO = jfs.getRoot();
117
        FileObject textFO = jfs.findResource(textPath);
118
        FileObject textFO = jfs.findResource(textPath);
118
        assertNotNull("JAR contains a/b.txt", textFO);
119
        assertNotNull("JAR contains a/b.txt", textFO);
119
        String rootS = "jar:" + jar.toURI() + "!/";
120
        String rootS = "jar:" + Utilities.toURI(jar) + "!/";
120
        URL rootU = new URL(rootS);
121
        URL rootU = new URL(rootS);
121
        URL textU = new URL(rootS + textPath);
122
        URL textU = new URL(rootS + textPath);
122
        assertEquals("correct FO -> URL for root", rootU, URLMapper.findURL(rootFO, URLMapper.EXTERNAL));
123
        assertEquals("correct FO -> URL for root", rootU, URLMapper.findURL(rootFO, URLMapper.EXTERNAL));
(-)a/openide.filesystems/test/unit/src/org/openide/filesystems/XMLFileSystemTestHid.java (-40 / +41 lines)
Lines 62-67 Link Here
62
import java.util.jar.JarEntry;
62
import java.util.jar.JarEntry;
63
import java.util.jar.JarOutputStream;
63
import java.util.jar.JarOutputStream;
64
import org.openide.util.Enumerations;
64
import org.openide.util.Enumerations;
65
import org.openide.util.Utilities;
65
66
66
public class XMLFileSystemTestHid extends TestBaseHid {
67
public class XMLFileSystemTestHid extends TestBaseHid {
67
    /** Factory for all filesystems that want to use TCK in this class.
68
    /** Factory for all filesystems that want to use TCK in this class.
Lines 106-112 Link Here
106
        
107
        
107
        resources = new String[] {"a/b/c","a/b1/c"};
108
        resources = new String[] {"a/b/c","a/b1/c"};
108
109
109
        if (!FileSystemFactoryHid.switchXMLSystem(xfs, this, createXMLLayer().toURI().toURL())) {
110
        if (!FileSystemFactoryHid.switchXMLSystem(xfs, this, Utilities.toURI(createXMLLayer()).toURL())) {
110
            // OK, unsupported
111
            // OK, unsupported
111
            return;
112
            return;
112
        }
113
        }
Lines 119-125 Link Here
119
    @Override
120
    @Override
120
    protected void setUp() throws Exception {
121
    protected void setUp() throws Exception {
121
        File f = createXMLLayer();
122
        File f = createXMLLayer();
122
        xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, f.toURI().toURL());
123
        xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, Utilities.toURI(f).toURL());
123
        this.testedFS = xfs;
124
        this.testedFS = xfs;
124
        this.allTestedFS = new FileSystem[] { xfs };
125
        this.allTestedFS = new FileSystem[] { xfs };
125
        super.setUp();
126
        super.setUp();
Lines 151-163 Link Here
151
        
152
        
152
        
153
        
153
        
154
        
154
        xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, f.toURI().toURL());
155
        xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, Utilities.toURI(f).toURL());
155
        
156
        
156
        FileObject fo = xfs.findResource ("TestModule/sample.txt");
157
        FileObject fo = xfs.findResource ("TestModule/sample.txt");
157
        assertEquals ("Four bytes there", 4, fo.getSize ());
158
        assertEquals ("Four bytes there", 4, fo.getSize ());
158
        registerDefaultListener (fo);
159
        registerDefaultListener (fo);
159
        
160
        
160
        if (!FileSystemFactoryHid.switchXMLSystem(xfs, this, f2.toURI().toURL())) {
161
        if (!FileSystemFactoryHid.switchXMLSystem(xfs, this, Utilities.toURI(f2).toURL())) {
161
            // OK, unsupported
162
            // OK, unsupported
162
            return;
163
            return;
163
        }
164
        }
Lines 190-202 Link Here
190
        
191
        
191
        
192
        
192
        
193
        
193
        xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, f.toURI().toURL());
194
        xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, Utilities.toURI(f).toURL());
194
        
195
        
195
        FileObject fo = xfs.findResource ("TestModule/sample.txt");
196
        FileObject fo = xfs.findResource ("TestModule/sample.txt");
196
        assertEquals ("Four bytes there", 4, fo.getSize ());
197
        assertEquals ("Four bytes there", 4, fo.getSize ());
197
        registerDefaultListener (fo);
198
        registerDefaultListener (fo);
198
        
199
        
199
        if (!FileSystemFactoryHid.switchXMLSystem(xfs, this, f2.toURI().toURL())) {
200
        if (!FileSystemFactoryHid.switchXMLSystem(xfs, this, Utilities.toURI(f2).toURL())) {
200
            // OK, unsupported
201
            // OK, unsupported
201
            return;
202
            return;
202
        }
203
        }
Lines 230-242 Link Here
230
        
231
        
231
        
232
        
232
        
233
        
233
        xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, f.toURI().toURL());
234
        xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, Utilities.toURI(f).toURL());
234
        
235
        
235
        FileObject fo = xfs.findResource ("TestModule/sample.txt");
236
        FileObject fo = xfs.findResource ("TestModule/sample.txt");
236
        assertEquals("Old value is in the attribute", "old", fo.getAttribute("value"));
237
        assertEquals("Old value is in the attribute", "old", fo.getAttribute("value"));
237
        registerDefaultListener (fo);
238
        registerDefaultListener (fo);
238
        
239
        
239
        if (!FileSystemFactoryHid.switchXMLSystem(xfs, this, f2.toURI().toURL())) {
240
        if (!FileSystemFactoryHid.switchXMLSystem(xfs, this, Utilities.toURI(f2).toURL())) {
240
            // OK, unsupported
241
            // OK, unsupported
241
            return;
242
            return;
242
        }
243
        }
Lines 264-276 Link Here
264
        
265
        
265
        
266
        
266
        
267
        
267
        xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, f.toURI().toURL());
268
        xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, Utilities.toURI(f).toURL());
268
        
269
        
269
        FileObject fo = xfs.findResource("TestModule/sample.txt");
270
        FileObject fo = xfs.findResource("TestModule/sample.txt");
270
        assertEquals("Four bytes there", 4, fo.getSize());
271
        assertEquals("Four bytes there", 4, fo.getSize());
271
        registerDefaultListener(fo);
272
        registerDefaultListener(fo);
272
        
273
        
273
        if (!FileSystemFactoryHid.switchXMLSystem(xfs, this, f2.toURI().toURL())) {
274
        if (!FileSystemFactoryHid.switchXMLSystem(xfs, this, Utilities.toURI(f2).toURL())) {
274
            // OK, unsupported
275
            // OK, unsupported
275
            return;
276
            return;
276
        }
277
        }
Lines 300-306 Link Here
300
                f.lastModified() < f2.lastModified()
301
                f.lastModified() < f2.lastModified()
301
            );
302
            );
302
        }
303
        }
303
        xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, f.toURI().toURL());
304
        xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, Utilities.toURI(f).toURL());
304
        FileObject fo = xfs.findResource ("TestModule/sample.txt");
305
        FileObject fo = xfs.findResource ("TestModule/sample.txt");
305
        assertNotNull(fo);
306
        assertNotNull(fo);
306
        assertEquals(fo.lastModified().getTime(), f.lastModified());        
307
        assertEquals(fo.lastModified().getTime(), f.lastModified());        
Lines 325-331 Link Here
325
                "</filesystem>\n"
326
                "</filesystem>\n"
326
                );
327
                );
327
328
328
        xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, f.toURI().toURL());
329
        xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, Utilities.toURI(f).toURL());
329
        FileObject fo = xfs.findResource ("TestModule/sample.txt");
330
        FileObject fo = xfs.findResource ("TestModule/sample.txt");
330
        assertNotNull(fo);
331
        assertNotNull(fo);
331
        
332
        
Lines 349-355 Link Here
349
                + "    </folder>\n"
350
                + "    </folder>\n"
350
                + "</filesystem>");
351
                + "</filesystem>");
351
352
352
        xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, f.toURI().toURL());
353
        xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, Utilities.toURI(f).toURL());
353
        final LocalFileSystem lfs = new LocalFileSystem();
354
        final LocalFileSystem lfs = new LocalFileSystem();
354
        lfs.setRootDirectory(getWorkDir());
355
        lfs.setRootDirectory(getWorkDir());
355
        MultiFileSystem mfs = new MultiFileSystem(lfs, xfs);
356
        MultiFileSystem mfs = new MultiFileSystem(lfs, xfs);
Lines 376-382 Link Here
376
                );
377
                );
377
        Count.cnt = 0;
378
        Count.cnt = 0;
378
379
379
        xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, f.toURI().toURL());
380
        xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, Utilities.toURI(f).toURL());
380
        /** the following is a fake implementation of filesystem that
381
        /** the following is a fake implementation of filesystem that
381
         * allows us to prevent calls to fileObject.getAttributes()
382
         * allows us to prevent calls to fileObject.getAttributes()
382
         */
383
         */
Lines 499-505 Link Here
499
                "</filesystem>\n"
500
                "</filesystem>\n"
500
                );
501
                );
501
502
502
        xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, f.toURI().toURL());
503
        xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, Utilities.toURI(f).toURL());
503
        FileObject fo = xfs.findResource ("TestModule/sample.txt");
504
        FileObject fo = xfs.findResource ("TestModule/sample.txt");
504
        assertNotNull(fo);
505
        assertNotNull(fo);
505
506
Lines 524-530 Link Here
524
                "</filesystem>\n"
525
                "</filesystem>\n"
525
                );
526
                );
526
527
527
        xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, f.toURI().toURL());
528
        xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, Utilities.toURI(f).toURL());
528
        FileObject fo = xfs.findResource ("TestModule/sample.txt");
529
        FileObject fo = xfs.findResource ("TestModule/sample.txt");
529
        assertNotNull(fo);
530
        assertNotNull(fo);
530
531
Lines 549-555 Link Here
549
            "</filesystem>\n"
550
            "</filesystem>\n"
550
        );
551
        );
551
552
552
        xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, f.toURI().toURL());
553
        xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, Utilities.toURI(f).toURL());
553
        FileObject fo = xfs.findResource ("TestModule/sample.txt");
554
        FileObject fo = xfs.findResource ("TestModule/sample.txt");
554
        assertNotNull(fo);
555
        assertNotNull(fo);
555
556
Lines 579-589 Link Here
579
            "</filesystem>\n"
580
            "</filesystem>\n"
580
        );
581
        );
581
582
582
        xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, f.toURI().toURL());
583
        xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, Utilities.toURI(f).toURL());
583
        FileObject fo = xfs.findResource ("TestModule/sample.txt");
584
        FileObject fo = xfs.findResource ("TestModule/sample.txt");
584
        assertNotNull(fo);
585
        assertNotNull(fo);
585
586
586
        XMLFileSystem realXMLFS = new XMLFileSystem(f.toURI().toURL());
587
        XMLFileSystem realXMLFS = new XMLFileSystem(Utilities.toURI(f).toURL());
587
        FileObject realfo = realXMLFS.findResource("TestModule/sample.txt");
588
        FileObject realfo = realXMLFS.findResource("TestModule/sample.txt");
588
        assertNotNull(realfo);
589
        assertNotNull(realfo);
589
590
Lines 620-626 Link Here
620
            "</filesystem>\n"
621
            "</filesystem>\n"
621
        );
622
        );
622
623
623
        xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, f.toURI().toURL());
624
        xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, Utilities.toURI(f).toURL());
624
        FileObject fo = xfs.findResource ("TestModule/sample.txt");
625
        FileObject fo = xfs.findResource ("TestModule/sample.txt");
625
        FileObject snd = xfs.findResource ("TestModule/snd.txt");
626
        FileObject snd = xfs.findResource ("TestModule/snd.txt");
626
        assertNotNull(fo);
627
        assertNotNull(fo);
Lines 721-727 Link Here
721
                "</filesystem>\n"
722
                "</filesystem>\n"
722
                );
723
                );
723
724
724
        xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, f.toURI().toURL());
725
        xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, Utilities.toURI(f).toURL());
725
        FileObject fo = xfs.findResource ("TestModule/sample.txt");
726
        FileObject fo = xfs.findResource ("TestModule/sample.txt");
726
        assertNotNull(fo);
727
        assertNotNull(fo);
727
728
Lines 770-777 Link Here
770
            )
771
            )
771
        );
772
        );
772
773
773
        URL url1 = new URL("jar:" + jar1.toURI() + "!/layer.xml");
774
        URL url1 = new URL("jar:" + Utilities.toURI(jar1) + "!/layer.xml");
774
        URL url2 = new URL("jar:" + jar2.toURI() + "!/layer.xml");
775
        URL url2 = new URL("jar:" + Utilities.toURI(jar2) + "!/layer.xml");
775
776
776
        FileSystem xfs1 = FileSystemFactoryHid.createXMLSystem(getName(), this, url1);
777
        FileSystem xfs1 = FileSystemFactoryHid.createXMLSystem(getName(), this, url1);
777
        FileObject fo1 = xfs1.findResource("dir/file");
778
        FileObject fo1 = xfs1.findResource("dir/file");
Lines 901-907 Link Here
901
        File f2 = changeOfAnAttributeInLayerIsFiredgenerateLayer("Folder", "java.awt.Button");
902
        File f2 = changeOfAnAttributeInLayerIsFiredgenerateLayer("Folder", "java.awt.Button");
902
        File f3 = changeOfAnAttributeInLayerIsFiredgenerateLayer("NoChange", "nochange");
903
        File f3 = changeOfAnAttributeInLayerIsFiredgenerateLayer("NoChange", "nochange");
903
904
904
        fs.setXmlUrls (new URL[] { f1.toURI().toURL(), f3.toURI().toURL() } );
905
        fs.setXmlUrls (new URL[] { Utilities.toURI(f1).toURL(), Utilities.toURI(f3).toURL() } );
905
        
906
        
906
        FileObject file = fs.findResource("Folder/empty.xml");
907
        FileObject file = fs.findResource("Folder/empty.xml");
907
        assertNotNull("File found in layer", file);
908
        assertNotNull("File found in layer", file);
Lines 917-923 Link Here
917
        assertAttr("The first value is list", file, "value", "java.awt.List");
918
        assertAttr("The first value is list", file, "value", "java.awt.List");
918
        assertAttr("Imutable value is nochange", nochange, "value", "nochange");
919
        assertAttr("Imutable value is nochange", nochange, "value", "nochange");
919
        
920
        
920
        fs.setXmlUrls (new URL[] { f2.toURI().toURL(), f3.toURI().toURL() } );
921
        fs.setXmlUrls (new URL[] { Utilities.toURI(f2).toURL(), Utilities.toURI(f3).toURL() } );
921
        String v2 = (String) file.getAttribute("value");
922
        String v2 = (String) file.getAttribute("value");
922
        assertEquals("The second value is button", "java.awt.Button", v2);
923
        assertEquals("The second value is button", "java.awt.Button", v2);
923
        
924
        
Lines 952-958 Link Here
952
        LocalFileSystem target = new LocalFileSystem();
953
        LocalFileSystem target = new LocalFileSystem();
953
        target.setRootDirectory(r);
954
        target.setRootDirectory(r);
954
955
955
        FileSystem source = FileSystemFactoryHid.createXMLSystem(getName(), this, f.toURI().toURL());
956
        FileSystem source = FileSystemFactoryHid.createXMLSystem(getName(), this, Utilities.toURI(f).toURL());
956
        FileObject template = source.findResource("Templates/Other/special");
957
        FileObject template = source.findResource("Templates/Other/special");
957
        assertNotNull("template found", template);
958
        assertNotNull("template found", template);
958
        FileObject foTested = target.getRoot().createData("copiedTemplate");
959
        FileObject foTested = target.getRoot().createData("copiedTemplate");
Lines 1077-1083 Link Here
1077
            w.close();
1078
            w.close();
1078
        }
1079
        }
1079
1080
1080
        xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, f1.toURI().toURL(), f2.toURI().toURL());
1081
        xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, Utilities.toURI(f1).toURL(), Utilities.toURI(f2).toURL());
1081
1082
1082
1083
1083
        FileObject just1 = xfs.findResource("just1/empty.xml");
1084
        FileObject just1 = xfs.findResource("just1/empty.xml");
Lines 1089-1107 Link Here
1089
        String layers2 = layers(just2);
1090
        String layers2 = layers(just2);
1090
        String layersB = layers(both);
1091
        String layersB = layers(both);
1091
1092
1092
        if (!layersR.contains(f1.toURI().toString())) {
1093
        if (!layersR.contains(Utilities.toURI(f1).toString())) {
1093
            fail("Missing " + f1.toURI().toString() + "\ninside: " + layersR);
1094
            fail("Missing " + Utilities.toURI(f1).toString() + "\ninside: " + layersR);
1094
        }
1095
        }
1095
        if (!layersR.contains(f2.toURI().toString())) {
1096
        if (!layersR.contains(Utilities.toURI(f2).toString())) {
1096
            fail("Missing " + f2.toURI().toString() + "\ninside: " + layersR);
1097
            fail("Missing " + Utilities.toURI(f2).toString() + "\ninside: " + layersR);
1097
        }
1098
        }
1098
1099
1099
        assertEquals(f1.toURI().toString(), layers1);
1100
        assertEquals(Utilities.toURI(f1).toString(), layers1);
1100
        assertEquals(f2.toURI().toString(), layers2);
1101
        assertEquals(Utilities.toURI(f2).toString(), layers2);
1101
        if (!layersB.contains(f1.toURI().toString())) {
1102
        if (!layersB.contains(Utilities.toURI(f1).toString())) {
1102
            fail("Missing " + f1 + "\ninside: " + layersB);
1103
            fail("Missing " + f1 + "\ninside: " + layersB);
1103
        }
1104
        }
1104
        if (!layersB.contains(f2.toURI().toString())) {
1105
        if (!layersB.contains(Utilities.toURI(f2).toString())) {
1105
            fail("Missing " + f2 + "\ninside: " + layersB);
1106
            fail("Missing " + f2 + "\ninside: " + layersB);
1106
        }
1107
        }
1107
    }
1108
    }
Lines 1119-1125 Link Here
1119
            + "</filesystem>");
1120
            + "</filesystem>");
1120
        w.close();
1121
        w.close();
1121
1122
1122
        xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, layer.toURI().toURL());
1123
        xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, Utilities.toURI(layer).toURL());
1123
1124
1124
        FileObject fo = xfs.findResource("f/empty.xml");
1125
        FileObject fo = xfs.findResource("f/empty.xml");
1125
        assertNotNull("File found", fo);
1126
        assertNotNull("File found", fo);
Lines 1142-1166 Link Here
1142
        File f1 = writeFile("layer1.xml",
1143
        File f1 = writeFile("layer1.xml",
1143
                "<filesystem>\n" +
1144
                "<filesystem>\n" +
1144
                "<folder name='d'>\n" +
1145
                "<folder name='d'>\n" +
1145
                "<file name='f' url='" + c1.toURI() + "'/>" +
1146
                "<file name='f' url='" + Utilities.toURI(c1) + "'/>" +
1146
                "</folder>\n" +
1147
                "</folder>\n" +
1147
                "</filesystem>\n"
1148
                "</filesystem>\n"
1148
                );
1149
                );
1149
        File f2 = writeFile("layer2.xml",
1150
        File f2 = writeFile("layer2.xml",
1150
                "<filesystem>\n" +
1151
                "<filesystem>\n" +
1151
                "<folder name='d'>\n" +
1152
                "<folder name='d'>\n" +
1152
                "<file name='f' url='" + c2.toURI() + "'>" +
1153
                "<file name='f' url='" + Utilities.toURI(c2) + "'>" +
1153
                "  <attr name='weight' intvalue='100'/>" +
1154
                "  <attr name='weight' intvalue='100'/>" +
1154
                "</file>\n" +
1155
                "</file>\n" +
1155
                "</folder>\n" +
1156
                "</folder>\n" +
1156
                "</filesystem>\n"
1157
                "</filesystem>\n"
1157
                );
1158
                );
1158
1159
1159
        xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, f2.toURI().toURL(), f1.toURI().toURL());
1160
        xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, Utilities.toURI(f2).toURL(), Utilities.toURI(f1).toURL());
1160
        FileObject fo = xfs.findResource("d/f");
1161
        FileObject fo = xfs.findResource("d/f");
1161
        assertNotNull(fo);
1162
        assertNotNull(fo);
1162
        assertEquals(6, fo.getSize());
1163
        assertEquals(6, fo.getSize());
1163
        xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, f1.toURI().toURL(), f2.toURI().toURL());
1164
        xfs = FileSystemFactoryHid.createXMLSystem(getName(), this, Utilities.toURI(f1).toURL(), Utilities.toURI(f2).toURL());
1164
        fo = xfs.findResource("d/f");
1165
        fo = xfs.findResource("d/f");
1165
        assertNotNull(fo);
1166
        assertNotNull(fo);
1166
        assertEquals(6, fo.getSize());
1167
        assertEquals(6, fo.getSize());
(-)a/openide.filesystems/test/unit/src/org/openide/filesystems/annotations/LayerBuilderTest.java (-4 / +5 lines)
Lines 67-72 Link Here
67
import org.netbeans.junit.NbTestCase;
67
import org.netbeans.junit.NbTestCase;
68
import org.openide.filesystems.FileObject;
68
import org.openide.filesystems.FileObject;
69
import org.openide.filesystems.XMLFileSystem;
69
import org.openide.filesystems.XMLFileSystem;
70
import org.openide.util.Utilities;
70
import org.openide.util.lookup.ServiceProvider;
71
import org.openide.util.lookup.ServiceProvider;
71
import org.openide.util.test.AnnotationProcessorTestUtils;
72
import org.openide.util.test.AnnotationProcessorTestUtils;
72
import org.openide.util.test.TestFileUtils;
73
import org.openide.util.test.TestFileUtils;
Lines 303-314 Link Here
303
        File j = TestFileUtils.writeZipFile(new File(getWorkDir(), "cp.jar"), "other/x1:x1");
304
        File j = TestFileUtils.writeZipFile(new File(getWorkDir(), "cp.jar"), "other/x1:x1");
304
        TestFileUtils.writeFile(new File(src, "p/resources/x2"), "x2");
305
        TestFileUtils.writeFile(new File(src, "p/resources/x2"), "x2");
305
        ByteArrayOutputStream err = new ByteArrayOutputStream();
306
        ByteArrayOutputStream err = new ByteArrayOutputStream();
306
        boolean status = AnnotationProcessorTestUtils.runJavac(src, null, dest, new File[] {j, new File(LayerBuilderTest.class.getProtectionDomain().getCodeSource().getLocation().toURI())}, err);
307
        boolean status = AnnotationProcessorTestUtils.runJavac(src, null, dest, new File[] {j, Utilities.toFile(LayerBuilderTest.class.getProtectionDomain().getCodeSource().getLocation().toURI())}, err);
307
        String msgs = err.toString();
308
        String msgs = err.toString();
308
        assertTrue(msgs, status);
309
        assertTrue(msgs, status);
309
        assertTrue(msgs, msgs.contains("r1=x1") ^ AnnotationProcessorTestUtils.searchClasspathBroken());
310
        assertTrue(msgs, msgs.contains("r1=x1") ^ AnnotationProcessorTestUtils.searchClasspathBroken());
310
        assertTrue(msgs, msgs.contains("r2=x2"));
311
        assertTrue(msgs, msgs.contains("r2=x2"));
311
        FileObject f = new XMLFileSystem(new File(dest, "META-INF/generated-layer.xml").toURI().toURL()).findResource("f");
312
        FileObject f = new XMLFileSystem(Utilities.toURI(new File(dest, "META-INF/generated-layer.xml")).toURL()).findResource("f");
312
        assertNotNull(f);
313
        assertNotNull(f);
313
        assertEquals("other/x1", f.getAttribute("r1"));
314
        assertEquals("other/x1", f.getAttribute("r1"));
314
        assertEquals("p/resources/x2", f.getAttribute("r2"));
315
        assertEquals("p/resources/x2", f.getAttribute("r2"));
Lines 319-332 Link Here
319
        File j = TestFileUtils.writeZipFile(new File(getWorkDir(), "cp.jar"), "other/x1:x1");
320
        File j = TestFileUtils.writeZipFile(new File(getWorkDir(), "cp.jar"), "other/x1:x1");
320
        TestFileUtils.writeFile(new File(src, "p/resources/x2"), "x2");
321
        TestFileUtils.writeFile(new File(src, "p/resources/x2"), "x2");
321
        ByteArrayOutputStream err = new ByteArrayOutputStream();
322
        ByteArrayOutputStream err = new ByteArrayOutputStream();
322
        boolean status = AnnotationProcessorTestUtils.runJavac(src, null, dest, new File[] {j, new File(LayerBuilderTest.class.getProtectionDomain().getCodeSource().getLocation().toURI())}, err);
323
        boolean status = AnnotationProcessorTestUtils.runJavac(src, null, dest, new File[] {j, Utilities.toFile(LayerBuilderTest.class.getProtectionDomain().getCodeSource().getLocation().toURI())}, err);
323
        String msgs = err.toString();
324
        String msgs = err.toString();
324
        assertFalse(msgs, status);
325
        assertFalse(msgs, status);
325
        assertTrue(msgs, msgs.contains("resourcez"));
326
        assertTrue(msgs, msgs.contains("resourcez"));
326
        assertTrue(msgs, msgs.contains("r1=x1") ^ AnnotationProcessorTestUtils.searchClasspathBroken());
327
        assertTrue(msgs, msgs.contains("r1=x1") ^ AnnotationProcessorTestUtils.searchClasspathBroken());
327
        AnnotationProcessorTestUtils.makeSource(src, "p.C", "@" + V.class.getCanonicalName() + "(r1=\"othr/x1\", r2=\"resources/x2\") public class C {}");
328
        AnnotationProcessorTestUtils.makeSource(src, "p.C", "@" + V.class.getCanonicalName() + "(r1=\"othr/x1\", r2=\"resources/x2\") public class C {}");
328
        err = new ByteArrayOutputStream();
329
        err = new ByteArrayOutputStream();
329
        status = AnnotationProcessorTestUtils.runJavac(src, null, dest, new File[] {j, new File(LayerBuilderTest.class.getProtectionDomain().getCodeSource().getLocation().toURI())}, err);
330
        status = AnnotationProcessorTestUtils.runJavac(src, null, dest, new File[] {j, Utilities.toFile(LayerBuilderTest.class.getProtectionDomain().getCodeSource().getLocation().toURI())}, err);
330
        msgs = err.toString();
331
        msgs = err.toString();
331
        assertFalse(msgs, status ^ AnnotationProcessorTestUtils.searchClasspathBroken());
332
        assertFalse(msgs, status ^ AnnotationProcessorTestUtils.searchClasspathBroken());
332
        assertTrue(msgs, msgs.contains("othr") ^ AnnotationProcessorTestUtils.searchClasspathBroken());
333
        assertTrue(msgs, msgs.contains("othr") ^ AnnotationProcessorTestUtils.searchClasspathBroken());
(-)a/openide.loaders/nbproject/project.xml (-1 / +1 lines)
Lines 154-160 Link Here
154
                    <build-prerequisite/>
154
                    <build-prerequisite/>
155
                    <compile-dependency/>
155
                    <compile-dependency/>
156
                    <run-dependency>
156
                    <run-dependency>
157
                        <specification-version>8.4</specification-version>
157
                        <specification-version>8.25</specification-version>
158
                    </run-dependency>
158
                    </run-dependency>
159
                </dependency>
159
                </dependency>
160
                <dependency>
160
                <dependency>
(-)a/openide.loaders/src/org/openide/loaders/DataFolder.java (-1 / +1 lines)
Lines 1488-1494 Link Here
1488
                }
1488
                }
1489
                try {
1489
                try {
1490
                    URI uri = new URI(s);
1490
                    URI uri = new URI(s);
1491
                    File file = new File(uri);
1491
                    File file = Utilities.toFile(uri);
1492
                    list.add( file );
1492
                    list.add( file );
1493
                } catch( java.net.URISyntaxException e ) {
1493
                } catch( java.net.URISyntaxException e ) {
1494
                    // malformed URI
1494
                    // malformed URI
(-)a/openide.loaders/src/org/openide/loaders/DataNode.java (-1 / +1 lines)
Lines 658-664 Link Here
658
                }
658
                }
659
            });
659
            });
660
            //linux
660
            //linux
661
            final String uriList = file.toURI().toString() + "\r\n";
661
            final String uriList = Utilities.toURI(file).toString() + "\r\n";
662
            t.put( new ExTransferable.Single( createUriListFlavor() ) {
662
            t.put( new ExTransferable.Single( createUriListFlavor() ) {
663
                public Object getData() {
663
                public Object getData() {
664
                    return uriList;
664
                    return uriList;
(-)a/openide.loaders/test/unit/src/org/openide/loaders/DataFolderPasteTypesTest.java (-1 / +2 lines)
Lines 56-61 Link Here
56
import org.openide.filesystems.LocalFileSystem;
56
import org.openide.filesystems.LocalFileSystem;
57
import org.openide.filesystems.Repository;
57
import org.openide.filesystems.Repository;
58
import org.openide.nodes.Node;
58
import org.openide.nodes.Node;
59
import org.openide.util.Utilities;
59
import org.openide.util.datatransfer.PasteType;
60
import org.openide.util.datatransfer.PasteType;
60
61
61
public class DataFolderPasteTypesTest extends NbTestCase {
62
public class DataFolderPasteTypesTest extends NbTestCase {
Lines 119-125 Link Here
119
        DataFlavor flavor = new DataFlavor( "unsupported/flavor;class=java.lang.Object" );
120
        DataFlavor flavor = new DataFlavor( "unsupported/flavor;class=java.lang.Object" );
120
        FileObject testFO = FileUtil.createData( testFileSystem.getRoot(), "testFile.txt" );
121
        FileObject testFO = FileUtil.createData( testFileSystem.getRoot(), "testFile.txt" );
121
        File testFile = FileUtil.toFile( testFO );
122
        File testFile = FileUtil.toFile( testFO );
122
        String uriList = testFile.toURI() + "\r\n";
123
        String uriList = Utilities.toURI(testFile) + "\r\n";
123
        Transferable t = new MockTransferable( new DataFlavor[] {new DataFlavor("text/uri-list;class=java.lang.String")}, uriList );
124
        Transferable t = new MockTransferable( new DataFlavor[] {new DataFlavor("text/uri-list;class=java.lang.String")}, uriList );
124
125
125
        DataFolder.FolderNode node = (DataFolder.FolderNode)folderNode;
126
        DataFolder.FolderNode node = (DataFolder.FolderNode)folderNode;
(-)a/openide.loaders/test/unit/src/org/openide/loaders/DataShadowTest.java (-1 / +1 lines)
Lines 191-197 Link Here
191
        //If masterfs isn't reachable - second test crucial for URL,File, FileObject conversions
191
        //If masterfs isn't reachable - second test crucial for URL,File, FileObject conversions
192
        // not necessary to be able to convert - but at least no IllegalArgumentException is expected
192
        // not necessary to be able to convert - but at least no IllegalArgumentException is expected
193
        if ("file".equals(url.getProtocol())) {
193
        if ("file".equals(url.getProtocol())) {
194
            new File (URI.create(url.toExternalForm()));
194
            Utilities.toFile(URI.create(url.toExternalForm()));
195
        }
195
        }
196
    }
196
    }
197
    
197
    
(-)a/openide.loaders/test/unit/src/org/openide/loaders/DragAndDropDataNodeTest.java (-2 / +3 lines)
Lines 55-60 Link Here
55
import org.openide.nodes.Children;
55
import org.openide.nodes.Children;
56
import org.netbeans.junit.*;
56
import org.netbeans.junit.*;
57
import org.openide.filesystems.LocalFileSystem;
57
import org.openide.filesystems.LocalFileSystem;
58
import org.openide.util.Utilities;
58
59
59
public class DragAndDropDataNodeTest extends NbTestCase {
60
public class DragAndDropDataNodeTest extends NbTestCase {
60
61
Lines 89-95 Link Here
89
90
90
        assertTrue( t.isDataFlavorSupported( uriListFlavor ) );
91
        assertTrue( t.isDataFlavorSupported( uriListFlavor ) );
91
        String uriList = (String) t.getTransferData( uriListFlavor );
92
        String uriList = (String) t.getTransferData( uriListFlavor );
92
        assertEquals( tmpFile.toURI()+"\r\n", uriList );
93
        assertEquals( Utilities.toURI(tmpFile)+"\r\n", uriList );
93
    }
94
    }
94
95
95
    public void testClipboardCut() throws ClassNotFoundException, IOException, UnsupportedFlavorException {
96
    public void testClipboardCut() throws ClassNotFoundException, IOException, UnsupportedFlavorException {
Lines 110-115 Link Here
110
111
111
        assertTrue( t.isDataFlavorSupported( uriListFlavor ) );
112
        assertTrue( t.isDataFlavorSupported( uriListFlavor ) );
112
        String uriList = (String) t.getTransferData( uriListFlavor );
113
        String uriList = (String) t.getTransferData( uriListFlavor );
113
        assertEquals( tmpFile.toURI()+"\r\n", uriList );
114
        assertEquals( Utilities.toURI(tmpFile)+"\r\n", uriList );
114
    }
115
    }
115
}
116
}
(-)a/openide.util/apichanges.xml (+21 lines)
Lines 51-56 Link Here
51
    <apidef name="actions">Actions API</apidef>
51
    <apidef name="actions">Actions API</apidef>
52
</apidefs>
52
</apidefs>
53
<changes>
53
<changes>
54
    <change id="File.URI">
55
        <api name="util"/>
56
        <summary>UNC-safe File / URI interconversion</summary>
57
        <version major="8" minor="25"/>
58
        <date year="2012" month="6" day="13"/>
59
        <author login="jglick"/>
60
        <compatibility addition="yes">
61
            <p>
62
                Use the Jackpot-format upgrade hint.
63
            </p>
64
        </compatibility>
65
        <description>
66
            <p>
67
                <code>Utilities</code> gets new methods <code>toURI(File)</code>
68
                and <code>toFile(URI)</code> which offer the UNC safety of NIO.2
69
                even on JDK 6.
70
            </p>
71
        </description>
72
        <class package="org.openide.util" name="Utilities"/>
73
        <issue number="213562"/>
74
    </change>
54
    <change id="exit-code">
75
    <change id="exit-code">
55
        <api name="util"/>
76
        <api name="util"/>
56
        <summary>Exit with status code</summary>
77
        <summary>Exit with status code</summary>
(-)a/openide.util/manifest.mf (-1 / +1 lines)
Lines 1-5 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.openide.util
2
OpenIDE-Module: org.openide.util
3
OpenIDE-Module-Localizing-Bundle: org/openide/util/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/openide/util/Bundle.properties
4
OpenIDE-Module-Specification-Version: 8.24
4
OpenIDE-Module-Specification-Version: 8.25
5
5
(-)a/openide.util/src/META-INF/upgrade/Utilities.hint (+9 lines)
Line 0 Link Here
1
$f.toURI() :: $f instanceof java.io.File
2
=>
3
org.openide.util.Utilities.toURI($f)
4
;;
5
6
new java.io.File($u) :: $u instanceof java.net.URI
7
=>
8
org.openide.util.Utilities.toFile($u)
9
;;
(-)a/openide.util/src/org/openide/util/Utilities.java (-6 / +89 lines)
Lines 72-77 Link Here
72
import java.lang.ref.ReferenceQueue;
72
import java.lang.ref.ReferenceQueue;
73
import java.lang.ref.SoftReference;
73
import java.lang.ref.SoftReference;
74
import java.lang.reflect.Field;
74
import java.lang.reflect.Field;
75
import java.lang.reflect.InvocationTargetException;
75
import java.lang.reflect.Method;
76
import java.lang.reflect.Method;
76
import java.lang.reflect.Modifier;
77
import java.lang.reflect.Modifier;
77
import java.net.MalformedURLException;
78
import java.net.MalformedURLException;
Lines 3022-3027 Link Here
3022
        new AsyncInitSupport(comp4Init, initJob);
3023
        new AsyncInitSupport(comp4Init, initJob);
3023
    }
3024
    }
3024
3025
3026
    /** JDK 7 */
3027
    private static Method fileToPath, pathToUri, pathsGet, pathToFile;
3028
    static {
3029
        try {
3030
            fileToPath = File.class.getMethod("toPath");
3031
        } catch (NoSuchMethodException x) {
3032
            // fine, JDK 6
3033
        }
3034
        if (fileToPath != null) {
3035
            try {
3036
                Class<?> path = Class.forName("java.nio.file.Path");
3037
                pathToUri = path.getMethod("toUri");
3038
                pathsGet = Class.forName("java.nio.file.Paths").getMethod("get", URI.class);
3039
                pathToFile = path.getMethod("toFile");
3040
            } catch (Exception x) {
3041
                throw new ExceptionInInitializerError(x);
3042
            }
3043
        }
3044
    }
3045
3046
    /**
3047
     * Converts a file to a URI while being safe for UNC paths.
3048
     * Unlike {@link File#toURI} the result works with {@link URI#normalize()}.
3049
     * @param f a file
3050
     * @return a {@code file}-protocol URI which may use the host field
3051
     * @see java.nio.file.Path.toUri
3052
     * @since 8.25
3053
     */
3054
    public static URI toURI(File f) {
3055
        if (fileToPath != null) {
3056
            try {
3057
                return (URI) pathToUri.invoke(fileToPath.invoke(f));
3058
            } catch (Exception x) {
3059
                LOG.log(Level.WARNING, "could not convert " + f + " to URI", x);
3060
            }
3061
        }
3062
        String path = f.getAbsolutePath();
3063
        if (path.startsWith("\\\\")) { // UNC
3064
            if (!path.endsWith("\\") && f.isDirectory()) {
3065
                path += "\\";
3066
            }
3067
            try {
3068
                return new URI("file", null, path.replace('\\', '/'), null);
3069
            } catch (URISyntaxException x) {
3070
                LOG.log(Level.WARNING, "could not convert " + f + " to URI", x);
3071
            }
3072
        }
3073
        return f.toURI();
3074
    }
3075
3076
    /**
3077
     * Converts a URI to a file while being safe for UNC paths.
3078
     * Unlike {@link File#File(URI)} UNC URIs with a host field are accepted.
3079
     * @param u a {@code file}-protocol URI which may use the host field
3080
     * @return a file
3081
     * @see java.nio.file.Paths.get(java.net.URI)
3082
     * @since 8.25
3083
     */
3084
    public static File toFile(URI u) throws IllegalArgumentException {
3085
        if (pathsGet != null) {
3086
            try {
3087
                return (File) pathToFile.invoke(pathsGet.invoke(null, u));
3088
            } catch (InvocationTargetException x) {
3089
                Throwable cause = x.getCause();
3090
                if (cause instanceof IllegalArgumentException) {
3091
                    throw (IllegalArgumentException) cause;
3092
                } else if (cause instanceof UnsupportedOperationException || cause != null && cause.getClass().getName().equals("java.nio.file.FileSystemNotFoundException")) {
3093
                    throw new IllegalArgumentException(cause);
3094
                } else {
3095
                    LOG.log(Level.WARNING, "could not convert " + u + " to File", x);
3096
                }
3097
            } catch (Exception x) {
3098
                LOG.log(Level.WARNING, "could not convert " + u + " to File", x);
3099
            }
3100
        }
3101
        String host = u.getHost();
3102
        if (host != null && !host.isEmpty() && "file".equals(u.getScheme())) {
3103
            return new File("\\\\" + host + u.getPath().replace('/', '\\'));
3104
        }
3105
        return new File(u);
3106
    }
3107
3025
    /**
3108
    /**
3026
     * Convert a file to a matching <code>file:</code> URL.
3109
     * Convert a file to a matching <code>file:</code> URL.
3027
     * @param f a file (absolute only)
3110
     * @param f a file (absolute only)
Lines 3030-3036 Link Here
3030
     * @see #toFile
3113
     * @see #toFile
3031
     * @see <a href="http://www.netbeans.org/issues/show_bug.cgi?id=29711">Issue #29711</a>
3114
     * @see <a href="http://www.netbeans.org/issues/show_bug.cgi?id=29711">Issue #29711</a>
3032
     * @since 3.26
3115
     * @since 3.26
3033
     * @deprecated Use {@link File#toURI} and {@link URI#toURL} instead under JDK 1.4.
3116
     * @deprecated Use {@link #toURI} and {@link URI#toURL} instead under JDK 1.4.
3034
     *             ({@link File#toURL} is buggy in JDK 1.3 and the bugs are not fixed in JDK 1.4.)
3117
     *             ({@link File#toURL} is buggy in JDK 1.3 and the bugs are not fixed in JDK 1.4.)
3035
     */
3118
     */
3036
    @Deprecated
3119
    @Deprecated
Lines 3043-3049 Link Here
3043
            throw new IllegalArgumentException("Relative path: " + f); // NOI18N
3126
            throw new IllegalArgumentException("Relative path: " + f); // NOI18N
3044
        }
3127
        }
3045
3128
3046
        URI uri = f.toURI();
3129
        URI uri = toURI(f);
3047
3130
3048
        return uri.toURL();
3131
        return uri.toURL();
3049
    }
3132
    }
Lines 3059-3065 Link Here
3059
     * @see #toURL
3142
     * @see #toURL
3060
     * @see <a href="http://www.netbeans.org/issues/show_bug.cgi?id=29711">Issue #29711</a>
3143
     * @see <a href="http://www.netbeans.org/issues/show_bug.cgi?id=29711">Issue #29711</a>
3061
     * @since 3.26
3144
     * @since 3.26
3062
     * @deprecated Use {@link URI#URI(String)} and {@link File#File(URI)} instead under JDK 1.4.
3145
     * @deprecated Use {@link URL#toURI} and {@link #toFile(URI)} instead under JDK 1.4.
3063
     *             (There was no proper equivalent under JDK 1.3.)
3146
     *             (There was no proper equivalent under JDK 1.3.)
3064
     */
3147
     */
3065
    @Deprecated
3148
    @Deprecated
Lines 3069-3077 Link Here
3069
        }
3152
        }
3070
3153
3071
        try {
3154
        try {
3072
            URI uri = new URI(u.toExternalForm());
3155
            URI uri = u.toURI();
3073
3156
3074
            return new File(uri);
3157
            return toFile(uri);
3075
        } catch (URISyntaxException use) {
3158
        } catch (URISyntaxException use) {
3076
            // malformed URL
3159
            // malformed URL
3077
            return null;
3160
            return null;
(-)a/openide.util/test/unit/src/org/netbeans/modules/openide/util/NbBundleProcessorTest.java (-9 / +10 lines)
Lines 54-59 Link Here
54
import org.openide.util.NbBundle.Messages;
54
import org.openide.util.NbBundle.Messages;
55
import org.openide.util.test.TestFileUtils;
55
import org.openide.util.test.TestFileUtils;
56
import static org.netbeans.modules.openide.util.Bundle.*;
56
import static org.netbeans.modules.openide.util.Bundle.*;
57
import org.openide.util.Utilities;
57
58
58
@Messages("k3=value #3")
59
@Messages("k3=value #3")
59
public class NbBundleProcessorTest extends NbTestCase {
60
public class NbBundleProcessorTest extends NbTestCase {
Lines 103-109 Link Here
103
                "public static final Object X = new Object() {public String toString() {return Bundle.k();}};",
104
                "public static final Object X = new Object() {public String toString() {return Bundle.k();}};",
104
                "}");
105
                "}");
105
        assertTrue(AnnotationProcessorTestUtils.runJavac(src, null, dest, null, null));
106
        assertTrue(AnnotationProcessorTestUtils.runJavac(src, null, dest, null, null));
106
        ClassLoader l = new URLClassLoader(new URL[] {dest.toURI().toURL()});
107
        ClassLoader l = new URLClassLoader(new URL[] {Utilities.toURI(dest).toURL()});
107
        assertEquals("v", l.loadClass("p.C").getField("X").get(null).toString());
108
        assertEquals("v", l.loadClass("p.C").getField("X").get(null).toString());
108
    }
109
    }
109
110
Lines 138-144 Link Here
138
    public void testPackageKeys() throws Exception {
139
    public void testPackageKeys() throws Exception {
139
        AnnotationProcessorTestUtils.makeSource(src, "p.package-info", "@org.openide.util.NbBundle.Messages(\"k=v\")", "package p;");
140
        AnnotationProcessorTestUtils.makeSource(src, "p.package-info", "@org.openide.util.NbBundle.Messages(\"k=v\")", "package p;");
140
        assertTrue(AnnotationProcessorTestUtils.runJavac(src, null, dest, null, null));
141
        assertTrue(AnnotationProcessorTestUtils.runJavac(src, null, dest, null, null));
141
        ClassLoader l = new URLClassLoader(new URL[] {dest.toURI().toURL()});
142
        ClassLoader l = new URLClassLoader(new URL[] {Utilities.toURI(dest).toURL()});
142
        Method m = l.loadClass("p.Bundle").getDeclaredMethod("k");
143
        Method m = l.loadClass("p.Bundle").getDeclaredMethod("k");
143
        m.setAccessible(true);
144
        m.setAccessible(true);
144
        assertEquals("v", m.invoke(null));
145
        assertEquals("v", m.invoke(null));
Lines 230-246 Link Here
230
        AnnotationProcessorTestUtils.makeSource(src, "p.C2", "@org.openide.util.NbBundle.Messages(\"k2=v2\")", "public class C2 {public @Override String toString() {return Bundle.k2();}}");
231
        AnnotationProcessorTestUtils.makeSource(src, "p.C2", "@org.openide.util.NbBundle.Messages(\"k2=v2\")", "public class C2 {public @Override String toString() {return Bundle.k2();}}");
231
        assertTrue(AnnotationProcessorTestUtils.runJavac(src, null, dest, null, null));
232
        assertTrue(AnnotationProcessorTestUtils.runJavac(src, null, dest, null, null));
232
        assertTrue(AnnotationProcessorTestUtils.runJavac(src, null, dest, null, null));
233
        assertTrue(AnnotationProcessorTestUtils.runJavac(src, null, dest, null, null));
233
        ClassLoader l = new URLClassLoader(new URL[] {dest.toURI().toURL()});
234
        ClassLoader l = new URLClassLoader(new URL[] {Utilities.toURI(dest).toURL()});
234
        assertEquals("v1", l.loadClass("p.C1").newInstance().toString());
235
        assertEquals("v1", l.loadClass("p.C1").newInstance().toString());
235
        assertEquals("v2", l.loadClass("p.C2").newInstance().toString());
236
        assertEquals("v2", l.loadClass("p.C2").newInstance().toString());
236
        AnnotationProcessorTestUtils.makeSource(src, "p.C1", "@org.openide.util.NbBundle.Messages(\"k1=v3\")", "public class C1 {public @Override String toString() {return Bundle.k1();}}");
237
        AnnotationProcessorTestUtils.makeSource(src, "p.C1", "@org.openide.util.NbBundle.Messages(\"k1=v3\")", "public class C1 {public @Override String toString() {return Bundle.k1();}}");
237
        assertTrue(AnnotationProcessorTestUtils.runJavac(src, "C1.java", dest, null, null));
238
        assertTrue(AnnotationProcessorTestUtils.runJavac(src, "C1.java", dest, null, null));
238
        l = new URLClassLoader(new URL[] {dest.toURI().toURL()});
239
        l = new URLClassLoader(new URL[] {Utilities.toURI(dest).toURL()});
239
        assertEquals("v3", l.loadClass("p.C1").newInstance().toString());
240
        assertEquals("v3", l.loadClass("p.C1").newInstance().toString());
240
        assertEquals("v2", l.loadClass("p.C2").newInstance().toString());
241
        assertEquals("v2", l.loadClass("p.C2").newInstance().toString());
241
        AnnotationProcessorTestUtils.makeSource(src, "p.C1", "@org.openide.util.NbBundle.Messages(\"k3=v4\")", "public class C1 {public @Override String toString() {return Bundle.k3();}}");
242
        AnnotationProcessorTestUtils.makeSource(src, "p.C1", "@org.openide.util.NbBundle.Messages(\"k3=v4\")", "public class C1 {public @Override String toString() {return Bundle.k3();}}");
242
        assertTrue(AnnotationProcessorTestUtils.runJavac(src, "C1.java", dest, null, null));
243
        assertTrue(AnnotationProcessorTestUtils.runJavac(src, "C1.java", dest, null, null));
243
        l = new URLClassLoader(new URL[] {dest.toURI().toURL()});
244
        l = new URLClassLoader(new URL[] {Utilities.toURI(dest).toURL()});
244
        assertEquals("v4", l.loadClass("p.C1").newInstance().toString());
245
        assertEquals("v4", l.loadClass("p.C1").newInstance().toString());
245
        assertEquals("v2", l.loadClass("p.C2").newInstance().toString());
246
        assertEquals("v2", l.loadClass("p.C2").newInstance().toString());
246
    }
247
    }
Lines 251-257 Link Here
251
        AnnotationProcessorTestUtils.makeSource(src, "p.C3", "class C3 {C3() {new Runnable() {public @Override void run() {new Runnable() {public @Override void run() {}};}};}}");
252
        AnnotationProcessorTestUtils.makeSource(src, "p.C3", "class C3 {C3() {new Runnable() {public @Override void run() {new Runnable() {public @Override void run() {}};}};}}");
252
        assertTrue(AnnotationProcessorTestUtils.runJavac(src, null, dest, null, null));
253
        assertTrue(AnnotationProcessorTestUtils.runJavac(src, null, dest, null, null));
253
        assertTrue(AnnotationProcessorTestUtils.runJavac(src, null, dest, null, null));
254
        assertTrue(AnnotationProcessorTestUtils.runJavac(src, null, dest, null, null));
254
        ClassLoader l = new URLClassLoader(new URL[] {dest.toURI().toURL()});
255
        ClassLoader l = new URLClassLoader(new URL[] {Utilities.toURI(dest).toURL()});
255
        assertEquals("v1", l.loadClass("p.C1").newInstance().toString());
256
        assertEquals("v1", l.loadClass("p.C1").newInstance().toString());
256
        assertEquals("v2", l.loadClass("p.C2").newInstance().toString());
257
        assertEquals("v2", l.loadClass("p.C2").newInstance().toString());
257
        assertTrue(new File(dest, "p/C3.class").delete());
258
        assertTrue(new File(dest, "p/C3.class").delete());
Lines 259-265 Link Here
259
        assertTrue(new File(dest, "p/C3$1$1.class").isFile());
260
        assertTrue(new File(dest, "p/C3$1$1.class").isFile());
260
        AnnotationProcessorTestUtils.makeSource(src, "p.C1", "@org.openide.util.NbBundle.Messages(\"k1=v3\")", "public class C1 {public @Override String toString() {return Bundle.k1();}}");
261
        AnnotationProcessorTestUtils.makeSource(src, "p.C1", "@org.openide.util.NbBundle.Messages(\"k1=v3\")", "public class C1 {public @Override String toString() {return Bundle.k1();}}");
261
        assertTrue(AnnotationProcessorTestUtils.runJavac(src, "C1.java", dest, null, null));
262
        assertTrue(AnnotationProcessorTestUtils.runJavac(src, "C1.java", dest, null, null));
262
        l = new URLClassLoader(new URL[] {dest.toURI().toURL()});
263
        l = new URLClassLoader(new URL[] {Utilities.toURI(dest).toURL()});
263
        assertEquals("v3", l.loadClass("p.C1").newInstance().toString());
264
        assertEquals("v3", l.loadClass("p.C1").newInstance().toString());
264
        assertEquals("v2", l.loadClass("p.C2").newInstance().toString());
265
        assertEquals("v2", l.loadClass("p.C2").newInstance().toString());
265
    }
266
    }
Lines 269-279 Link Here
269
        AnnotationProcessorTestUtils.makeSource(src, "p.package-info", "@org.openide.util.NbBundle.Messages(\"k2=v2\")", "package p;");
270
        AnnotationProcessorTestUtils.makeSource(src, "p.package-info", "@org.openide.util.NbBundle.Messages(\"k2=v2\")", "package p;");
270
        assertTrue(AnnotationProcessorTestUtils.runJavac(src, null, dest, null, null));
271
        assertTrue(AnnotationProcessorTestUtils.runJavac(src, null, dest, null, null));
271
        assertTrue(AnnotationProcessorTestUtils.runJavac(src, null, dest, null, null));
272
        assertTrue(AnnotationProcessorTestUtils.runJavac(src, null, dest, null, null));
272
        ClassLoader l = new URLClassLoader(new URL[] {dest.toURI().toURL()});
273
        ClassLoader l = new URLClassLoader(new URL[] {Utilities.toURI(dest).toURL()});
273
        assertEquals("v1v2", l.loadClass("p.C").newInstance().toString());
274
        assertEquals("v1v2", l.loadClass("p.C").newInstance().toString());
274
        assertTrue(new File(dest, "p/C.class").delete());
275
        assertTrue(new File(dest, "p/C.class").delete());
275
        assertTrue(AnnotationProcessorTestUtils.runJavac(src, "C.java", dest, null, null));
276
        assertTrue(AnnotationProcessorTestUtils.runJavac(src, "C.java", dest, null, null));
276
        l = new URLClassLoader(new URL[] {dest.toURI().toURL()});
277
        l = new URLClassLoader(new URL[] {Utilities.toURI(dest).toURL()});
277
        assertEquals("v1v2", l.loadClass("p.C").newInstance().toString());
278
        assertEquals("v1v2", l.loadClass("p.C").newInstance().toString());
278
    }
279
    }
279
280
(-)a/openide.util/test/unit/src/org/openide/util/EditablePropertiesTest.java (-1 / +1 lines)
Lines 388-394 Link Here
388
    
388
    
389
    private String filenameOfTestProperties() {
389
    private String filenameOfTestProperties() {
390
        // #50987: never use URL.path for this purpose...
390
        // #50987: never use URL.path for this purpose...
391
        return new File(URI.create(EditablePropertiesTest.class.getResource("data/test.properties").toExternalForm())).getAbsolutePath();
391
        return Utilities.toFile(URI.create(EditablePropertiesTest.class.getResource("data/test.properties").toExternalForm())).getAbsolutePath();
392
    }
392
    }
393
    
393
    
394
    private EditableProperties loadTestProperties() throws IOException {
394
    private EditableProperties loadTestProperties() throws IOException {
(-)a/openide.util/test/unit/src/org/openide/util/UtilitiesTest.java (+26 lines)
Lines 112-117 Link Here
112
import java.awt.peer.TextFieldPeer;
112
import java.awt.peer.TextFieldPeer;
113
import java.awt.peer.WindowPeer;
113
import java.awt.peer.WindowPeer;
114
import java.io.File;
114
import java.io.File;
115
import java.net.URI;
115
import java.net.URL;
116
import java.net.URL;
116
import java.util.ArrayList;
117
import java.util.ArrayList;
117
import java.util.Arrays;
118
import java.util.Arrays;
Lines 380-385 Link Here
380
        }
381
        }
381
    }
382
    }
382
383
384
    public void testFileURI() throws Exception {
385
        if (Utilities.isWindows()) {
386
            assertFileURI("C:\\some\\path #1", "file:/C:/some/path%20%231");
387
            assertEquals(new File("C:\\some\\path"), Utilities.toFile(new URI("file:/C:/some/path")));
388
            assertEquals(new File("C:\\some\\path"), Utilities.toFile(new URI("file:///C:/some/path")));
389
            assertEquals(new File("C:\\some\\path"), Utilities.toFile(new URI("file:/C:/some/path/")));
390
            assertFileURI("\\\\server\\share\\path", "file://server/share/path");
391
            assertEquals(new File("\\\\server\\share\\path"), Utilities.toFile(new URI("file:////server/share/path")));
392
        } else {
393
            assertFileURI("/some/path #1", "file:/some/path%20%231");
394
            assertEquals(new File("/some/path"), Utilities.toFile(new URI("file:/some/path")));
395
            assertEquals(new File("/some/path"), Utilities.toFile(new URI("file:///some/path")));
396
            assertEquals(new File("/some/path"), Utilities.toFile(new URI("file:/some/path/")));
397
        }
398
        String s = Utilities.toURI(getWorkDir()).toString();
399
        assertTrue(s, s.endsWith("/"));
400
        // XXX test that IllegalArgumentException is thrown where appropriate
401
    }
402
    private static void assertFileURI(String file, String uri) throws Exception {
403
        URI u = new URI(uri);
404
        File f = new File(file);
405
        assertEquals(u, Utilities.toURI(f));
406
        assertEquals(f, Utilities.toFile(u));
407
    }
408
383
    private static class CustomToolkitComponent extends Component {
409
    private static class CustomToolkitComponent extends Component {
384
        private Toolkit customToolkit;
410
        private Toolkit customToolkit;
385
        
411
        
(-)a/openide.util/test/unit/src/org/openide/xml/XMLUtilTest.java (-2 / +3 lines)
Lines 59-64 Link Here
59
import javax.xml.validation.Schema;
59
import javax.xml.validation.Schema;
60
import javax.xml.validation.SchemaFactory;
60
import javax.xml.validation.SchemaFactory;
61
import org.netbeans.junit.NbTestCase;
61
import org.netbeans.junit.NbTestCase;
62
import org.openide.util.Utilities;
62
import org.openide.util.test.TestFileUtils;
63
import org.openide.util.test.TestFileUtils;
63
import org.w3c.dom.CDATASection;
64
import org.w3c.dom.CDATASection;
64
import org.w3c.dom.Document;
65
import org.w3c.dom.Document;
Lines 454-460 Link Here
454
        File ent = new File(d, "ent.xml");
455
        File ent = new File(d, "ent.xml");
455
        TestFileUtils.writeFile(main, "<!DOCTYPE root [<!ENTITY ent SYSTEM 'ent.xml'>]> <root xmlns='some://where'>&ent;</root>");
456
        TestFileUtils.writeFile(main, "<!DOCTYPE root [<!ENTITY ent SYSTEM 'ent.xml'>]> <root xmlns='some://where'>&ent;</root>");
456
        TestFileUtils.writeFile(ent, "<hello xmlns='some://where'>there</hello>");
457
        TestFileUtils.writeFile(ent, "<hello xmlns='some://where'>there</hello>");
457
        Document doc = XMLUtil.parse(new InputSource(main.toURI().toString()), false, true, null, null);
458
        Document doc = XMLUtil.parse(new InputSource(Utilities.toURI(main).toString()), false, true, null, null);
458
        XMLUtil.validate(doc.getDocumentElement(), s);
459
        XMLUtil.validate(doc.getDocumentElement(), s);
459
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
460
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
460
        XMLUtil.write(doc, baos, "UTF-8");
461
        XMLUtil.write(doc, baos, "UTF-8");
Lines 467-473 Link Here
467
        // XXX #160806 reported a problem with "xml:base" being consider a no-NS attr; not yet caught by test
468
        // XXX #160806 reported a problem with "xml:base" being consider a no-NS attr; not yet caught by test
468
        // Try again with no xmlns specified in entity; should inherit from main.xml:
469
        // Try again with no xmlns specified in entity; should inherit from main.xml:
469
        TestFileUtils.writeFile(ent, "<hello>there</hello>");
470
        TestFileUtils.writeFile(ent, "<hello>there</hello>");
470
        doc = XMLUtil.parse(new InputSource(main.toURI().toString()), false, true, null, null);
471
        doc = XMLUtil.parse(new InputSource(Utilities.toURI(main).toString()), false, true, null, null);
471
        XMLUtil.validate(doc.getDocumentElement(), s);
472
        XMLUtil.validate(doc.getDocumentElement(), s);
472
        baos = new ByteArrayOutputStream();
473
        baos = new ByteArrayOutputStream();
473
        XMLUtil.write(doc, baos, "UTF-8");
474
        XMLUtil.write(doc, baos, "UTF-8");
(-)a/parsing.api/nbproject/project.xml (-1 / +1 lines)
Lines 218-224 Link Here
218
                    <build-prerequisite/>
218
                    <build-prerequisite/>
219
                    <compile-dependency/>
219
                    <compile-dependency/>
220
                    <run-dependency>
220
                    <run-dependency>
221
                        <specification-version>8.0</specification-version>
221
                        <specification-version>8.25</specification-version>
222
                    </run-dependency>
222
                    </run-dependency>
223
                </dependency>
223
                </dependency>
224
                <dependency>
224
                <dependency>
(-)a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/RepositoryUpdater.java (-6 / +6 lines)
Lines 962-968 Link Here
962
                    final File parentFile = FileUtil.toFile(newFile.getParent());
962
                    final File parentFile = FileUtil.toFile(newFile.getParent());
963
                    if (parentFile != null) {
963
                    if (parentFile != null) {
964
                        try {
964
                        try {
965
                            URL oldBinaryRoot = new File (parentFile, oldNameExt).toURI().toURL();
965
                            URL oldBinaryRoot = org.openide.util.Utilities.toURI(new File (parentFile, oldNameExt)).toURL();
966
                            eventQueue.record(
966
                            eventQueue.record(
967
                                    FileEventLog.FileOp.DELETE,
967
                                    FileEventLog.FileOp.DELETE,
968
                                    oldBinaryRoot,
968
                                    oldBinaryRoot,
Lines 3010-3016 Link Here
3010
            }
3010
            }
3011
            try {
3011
            try {
3012
                if ("file".equals(tmp.getProtocol())) { //NOI18N
3012
                if ("file".equals(tmp.getProtocol())) { //NOI18N
3013
                    final File file = new File(new URI(tmp.toString()));
3013
                    final File file = org.openide.util.Utilities.toFile(new URI(tmp.toString()));
3014
                    msg = file.getAbsolutePath();
3014
                    msg = file.getAbsolutePath();
3015
                }
3015
                }
3016
            } catch (URISyntaxException ex) {
3016
            } catch (URISyntaxException ex) {
Lines 4717-4723 Link Here
4717
                        if (packedIndex != null ) {
4717
                        if (packedIndex != null ) {
4718
                            unpack(packedIndex, downloadFolder);
4718
                            unpack(packedIndex, downloadFolder);
4719
                            packedIndex.delete();
4719
                            packedIndex.delete();
4720
                            if (patchDownloadedIndex(root,downloadFolder.toURI().toURL())) {
4720
                            if (patchDownloadedIndex(root,org.openide.util.Utilities.toURI(downloadFolder).toURL())) {
4721
                                final FileObject df = CacheFolder.getDataFolder(root);
4721
                                final FileObject df = CacheFolder.getDataFolder(root);
4722
                                assert df != null;
4722
                                assert df != null;
4723
                                final File dataFolder = FileUtil.toFile(df);
4723
                                final File dataFolder = FileUtil.toFile(df);
Lines 5592-5598 Link Here
5592
                if (sourcesListener != null) {
5592
                if (sourcesListener != null) {
5593
                    if (!sourceRoots.containsKey(root) && root.getProtocol().equals("file")) { //NOI18N
5593
                    if (!sourceRoots.containsKey(root) && root.getProtocol().equals("file")) { //NOI18N
5594
                        try {
5594
                        try {
5595
                            File f = new File(root.toURI());
5595
                            File f = org.openide.util.Utilities.toFile(root.toURI());
5596
                            safeAddRecursiveListener(sourcesListener, f, entry);
5596
                            safeAddRecursiveListener(sourcesListener, f, entry);
5597
                            sourceRoots.put(root, f);
5597
                            sourceRoots.put(root, f);
5598
                        } catch (URISyntaxException use) {
5598
                        } catch (URISyntaxException use) {
Lines 5608-5614 Link Here
5608
                        try {
5608
                        try {
5609
                            URI uri = archiveUrl != null ? archiveUrl.toURI() : root.toURI();
5609
                            URI uri = archiveUrl != null ? archiveUrl.toURI() : root.toURI();
5610
                            if (uri.getScheme().equals("file")) { //NOI18N
5610
                            if (uri.getScheme().equals("file")) { //NOI18N
5611
                                f = new File(uri);
5611
                                f = org.openide.util.Utilities.toFile(uri);
5612
                            }
5612
                            }
5613
                        } catch (URISyntaxException use) {
5613
                        } catch (URISyntaxException use) {
5614
                            LOGGER.log(Level.INFO, "Can't convert " + root + " to java.io.File; archiveUrl=" + archiveUrl, use); //NOI18N
5614
                            LOGGER.log(Level.INFO, "Can't convert " + root + " to java.io.File; archiveUrl=" + archiveUrl, use); //NOI18N
Lines 5669-5675 Link Here
5669
                            @Override
5669
                            @Override
5670
                            public boolean accept(@NonNull final File pathname) {
5670
                            public boolean accept(@NonNull final File pathname) {
5671
                                try {
5671
                                try {
5672
                                    return entry.includes(pathname.toURI().toURL());
5672
                                    return entry.includes(org.openide.util.Utilities.toURI(pathname).toURL());
5673
                                } catch (MalformedURLException ex) {
5673
                                } catch (MalformedURLException ex) {
5674
                                    Exceptions.printStackTrace(ex);
5674
                                    Exceptions.printStackTrace(ex);
5675
                                    return true;
5675
                                    return true;
(-)a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/Util.java (-2 / +3 lines)
Lines 54-59 Link Here
54
import org.netbeans.modules.editor.settings.storage.api.EditorSettings;
54
import org.netbeans.modules.editor.settings.storage.api.EditorSettings;
55
import org.openide.filesystems.FileObject;
55
import org.openide.filesystems.FileObject;
56
import org.openide.loaders.DataObject;
56
import org.openide.loaders.DataObject;
57
import org.openide.util.Utilities;
57
58
58
/**
59
/**
59
 *
60
 *
Lines 158-164 Link Here
158
                final Boolean isDirectoryFin = isDirectory;
159
                final Boolean isDirectoryFin = isDirectory;
159
                // Performance optimization for File.toURI() which calls this method
160
                // Performance optimization for File.toURI() which calls this method
160
                // and the original implementation calls into native method
161
                // and the original implementation calls into native method
161
                return new File(new File(root.toURI()), relativePath) {
162
                return Utilities.toURI(new File(Utilities.toFile(root.toURI()), relativePath) {
162
                    
163
                    
163
                    @Override
164
                    @Override
164
                    public File getAbsoluteFile() {
165
                    public File getAbsoluteFile() {
Lines 175-181 Link Here
175
                            super.isDirectory() :
176
                            super.isDirectory() :
176
                            isDirectoryFin;
177
                            isDirectoryFin;
177
                    }
178
                    }
178
                }.toURI().toURL();
179
                }).toURL();
179
            } else {
180
            } else {
180
                return new URL(root, relativePath);
181
                return new URL(root, relativePath);
181
            }
182
            }
(-)a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/errors/TaskCache.java (-3 / +3 lines)
Lines 310-316 Link Here
310
            }
310
            }
311
            URI rootURI = root.toURI();
311
            URI rootURI = root.toURI();
312
            File cacheRoot = getCacheRoot(root);
312
            File cacheRoot = getCacheRoot(root);
313
            URI cacheRootURI = cacheRoot.toURI();
313
            URI cacheRootURI = org.openide.util.Utilities.toURI(cacheRoot);
314
            Queue<File> todo = new LinkedList<File>();
314
            Queue<File> todo = new LinkedList<File>();
315
            
315
            
316
            todo.add(cacheRoot);
316
            todo.add(cacheRoot);
Lines 322-334 Link Here
322
                
322
                
323
                if (f.isFile()) {
323
                if (f.isFile()) {
324
                    if (f.getName().endsWith(ERR_EXT)) {
324
                    if (f.getName().endsWith(ERR_EXT)) {
325
                        String relative = cacheRootURI.relativize(f.toURI()).getRawPath();
325
                        String relative = cacheRootURI.relativize(org.openide.util.Utilities.toURI(f)).getRawPath();
326
                        
326
                        
327
                        relative = relative.replaceAll("." + ERR_EXT + "$", ""); //NOI18N
327
                        relative = relative.replaceAll("." + ERR_EXT + "$", ""); //NOI18N
328
                        result.add(rootURI.resolve(relative).toURL());
328
                        result.add(rootURI.resolve(relative).toURL());
329
                    }
329
                    }
330
                    if (!onlyErrors && f.getName().endsWith(WARN_EXT)) {
330
                    if (!onlyErrors && f.getName().endsWith(WARN_EXT)) {
331
                        String relative = cacheRootURI.relativize(f.toURI()).getRawPath();
331
                        String relative = cacheRootURI.relativize(org.openide.util.Utilities.toURI(f)).getRawPath();
332
                        
332
                        
333
                        relative = relative.replaceAll("." + WARN_EXT + "$", ""); //NOI18N
333
                        relative = relative.replaceAll("." + WARN_EXT + "$", ""); //NOI18N
334
                        result.add(rootURI.resolve(relative).toURL());
334
                        result.add(rootURI.resolve(relative).toURL());
(-)a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/lucene/DocumentBasedIndexManager.java (-2 / +3 lines)
Lines 53-58 Link Here
53
import org.netbeans.modules.parsing.lucene.support.DocumentIndex;
53
import org.netbeans.modules.parsing.lucene.support.DocumentIndex;
54
import org.netbeans.modules.parsing.lucene.support.IndexManager;
54
import org.netbeans.modules.parsing.lucene.support.IndexManager;
55
import org.openide.util.Exceptions;
55
import org.openide.util.Exceptions;
56
import org.openide.util.Utilities;
56
57
57
/**
58
/**
58
 *
59
 *
Lines 102-108 Link Here
102
                switch (mode) {
103
                switch (mode) {
103
                    case CREATE:
104
                    case CREATE:
104
                    {
105
                    {
105
                        final File file = new File(root.toURI());
106
                        final File file = Utilities.toFile(root.toURI());
106
                        file.mkdir();
107
                        file.mkdir();
107
                        li = IndexManager.createDocumentIndex(file);
108
                        li = IndexManager.createDocumentIndex(file);
108
                        indexes.put(root,li);
109
                        indexes.put(root,li);
Lines 110-116 Link Here
110
                    }
111
                    }
111
                    case IF_EXIST:
112
                    case IF_EXIST:
112
                    {
113
                    {
113
                        final File file = new File(root.toURI());
114
                        final File file = Utilities.toFile(root.toURI());
114
                        String[] children;
115
                        String[] children;
115
                        if (file.isDirectory() && (children=file.list())!= null && children.length > 0) {
116
                        if (file.isDirectory() && (children=file.list())!= null && children.length > 0) {
116
                            li = IndexManager.createDocumentIndex(file);
117
                            li = IndexManager.createDocumentIndex(file);
(-)a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/lucene/LuceneIndexFactory.java (-1 / +2 lines)
Lines 58-63 Link Here
58
import org.openide.filesystems.FileObject;
58
import org.openide.filesystems.FileObject;
59
import org.openide.filesystems.FileUtil;
59
import org.openide.filesystems.FileUtil;
60
import org.openide.util.Exceptions;
60
import org.openide.util.Exceptions;
61
import org.openide.util.Utilities;
61
62
62
/**
63
/**
63
 *
64
 *
Lines 124-130 Link Here
124
        assert indexFolder != null;
125
        assert indexFolder != null;
125
        final String indexVersion = Integer.toString(VERSION);
126
        final String indexVersion = Integer.toString(VERSION);
126
        final File luceneIndexFolder = new File (FileUtil.toFile(indexFolder),indexVersion);
127
        final File luceneIndexFolder = new File (FileUtil.toFile(indexFolder),indexVersion);
127
        URL result = luceneIndexFolder.toURI().toURL();
128
        URL result = Utilities.toURI(luceneIndexFolder).toURL();
128
        final String surl = result.toExternalForm();
129
        final String surl = result.toExternalForm();
129
        if (surl.charAt(surl.length()-1) != '/') {       //NOI18N
130
        if (surl.charAt(surl.length()-1) != '/') {       //NOI18N
130
            result = new URL(surl+'/');  //NOI18N
131
            result = new URL(surl+'/');  //NOI18N
(-)a/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/event/EventSupportTest.java (-1 / +2 lines)
Lines 46-51 Link Here
46
import org.netbeans.junit.NbTestCase;
46
import org.netbeans.junit.NbTestCase;
47
import org.netbeans.modules.parsing.api.indexing.IndexingManager;
47
import org.netbeans.modules.parsing.api.indexing.IndexingManager;
48
import org.netbeans.modules.parsing.impl.indexing.IndexingManagerAccessor;
48
import org.netbeans.modules.parsing.impl.indexing.IndexingManagerAccessor;
49
import org.openide.util.Utilities;
49
50
50
/**
51
/**
51
 *
52
 *
Lines 75-81 Link Here
75
        final File src = new File (wd,"src");
76
        final File src = new File (wd,"src");
76
        src.mkdirs();
77
        src.mkdirs();
77
        try {
78
        try {
78
            IndexingManager.getDefault().refreshIndexAndWait(src.toURI().toURL(), null);
79
            IndexingManager.getDefault().refreshIndexAndWait(Utilities.toURI(src).toURL(), null);
79
        } catch (IllegalStateException ae) {
80
        } catch (IllegalStateException ae) {
80
            assertTrue("IllegalStateException not expected when EventSupport.releaseCompletionCondition called by IndexingManager.refreshIndexAndWait", false);
81
            assertTrue("IllegalStateException not expected when EventSupport.releaseCompletionCondition called by IndexingManager.refreshIndexAndWait", false);
81
        }
82
        }
(-)a/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/indexing/ArchiveTimeStampsTest.java (-5 / +6 lines)
Lines 58-63 Link Here
58
import org.netbeans.junit.NbTestCase;
58
import org.netbeans.junit.NbTestCase;
59
import org.openide.filesystems.FileObject;
59
import org.openide.filesystems.FileObject;
60
import org.openide.filesystems.FileUtil;
60
import org.openide.filesystems.FileUtil;
61
import org.openide.util.Utilities;
61
62
62
/**
63
/**
63
 *
64
 *
Lines 94-100 Link Here
94
            final File base = getWorkDir();
95
            final File base = getWorkDir();
95
            for (int i=1; i<=100; i++) {
96
            for (int i=1; i<=100; i++) {
96
                final File f = new File(base,String.format("archive%d.jar", i));    //NOI18N
97
                final File f = new File(base,String.format("archive%d.jar", i));    //NOI18N
97
                final URL u = f.toURI().toURL();
98
                final URL u = Utilities.toURI(f).toURL();
98
                final Pair<Long,Map<Pair<String,Integer>,Integer>> state =
99
                final Pair<Long,Map<Pair<String,Integer>,Integer>> state =
99
                        Pair.<Long,Map<Pair<String,Integer>,Integer>>of((long)i,indexers);
100
                        Pair.<Long,Map<Pair<String,Integer>,Integer>>of((long)i,indexers);
100
                expected.put(u, state);
101
                expected.put(u, state);
Lines 132-138 Link Here
132
            final File base = getWorkDir();
133
            final File base = getWorkDir();
133
            for (int i=1; i<=100; i++) {
134
            for (int i=1; i<=100; i++) {
134
                final File f = new File(base,String.format("archive%d.jar", i));    //NOI18N
135
                final File f = new File(base,String.format("archive%d.jar", i));    //NOI18N
135
                final URL u = f.toURI().toURL();
136
                final URL u = Utilities.toURI(f).toURL();
136
                final Pair<Long,Map<Pair<String,Integer>,Integer>> state =
137
                final Pair<Long,Map<Pair<String,Integer>,Integer>> state =
137
                        Pair.<Long,Map<Pair<String,Integer>,Integer>>of((long)i,indexers);
138
                        Pair.<Long,Map<Pair<String,Integer>,Integer>>of((long)i,indexers);
138
                expected.put(u, state);
139
                expected.put(u, state);
Lines 177-183 Link Here
177
                        File f = new File(base,String.format("ar_bs.jar"));    //NOI18N
178
                        File f = new File(base,String.format("ar_bs.jar"));    //NOI18N
178
                        Pair<Long,Map<Pair<String,Integer>,Integer>> state =
179
                        Pair<Long,Map<Pair<String,Integer>,Integer>> state =
179
                            Pair.<Long,Map<Pair<String,Integer>,Integer>>of(1L,indexers);
180
                            Pair.<Long,Map<Pair<String,Integer>,Integer>>of(1L,indexers);
180
                        URL u = f.toURI().toURL();
181
                        URL u = Utilities.toURI(f).toURL();
181
                        expected.put(u, state);
182
                        expected.put(u, state);
182
                        ArchiveTimeStamps.setLastModified(u,state);
183
                        ArchiveTimeStamps.setLastModified(u,state);
183
                    } catch (IOException e) {
184
                    } catch (IOException e) {
Lines 194-200 Link Here
194
                        File f = new File(base,String.format("ar_as.jar"));    //NOI18N
195
                        File f = new File(base,String.format("ar_as.jar"));    //NOI18N
195
                        Pair<Long,Map<Pair<String,Integer>,Integer>> state =
196
                        Pair<Long,Map<Pair<String,Integer>,Integer>> state =
196
                            Pair.<Long,Map<Pair<String,Integer>,Integer>>of(1L,indexers);
197
                            Pair.<Long,Map<Pair<String,Integer>,Integer>>of(1L,indexers);
197
                        URL u = f.toURI().toURL();
198
                        URL u = Utilities.toURI(f).toURL();
198
                        expected.put(u, state);
199
                        expected.put(u, state);
199
                        ArchiveTimeStamps.setLastModified(u,state);
200
                        ArchiveTimeStamps.setLastModified(u,state);
200
                    } catch (IOException e) {
201
                    } catch (IOException e) {
Lines 208-214 Link Here
208
                File f = new File(base,String.format("start.jar"));    //NOI18N
209
                File f = new File(base,String.format("start.jar"));    //NOI18N
209
                Pair<Long,Map<Pair<String,Integer>,Integer>> state =
210
                Pair<Long,Map<Pair<String,Integer>,Integer>> state =
210
                    Pair.<Long,Map<Pair<String,Integer>,Integer>>of(1L,indexers);
211
                    Pair.<Long,Map<Pair<String,Integer>,Integer>>of(1L,indexers);
211
                URL u = f.toURI().toURL();
212
                URL u = Utilities.toURI(f).toURL();
212
                expected.put(u, state);
213
                expected.put(u, state);
213
                h.last = true;
214
                h.last = true;
214
                ArchiveTimeStamps.setLastModified(u,state);
215
                ArchiveTimeStamps.setLastModified(u,state);
(-)a/parsing.api/test/unit/src/org/netbeans/modules/parsing/impl/indexing/RepositoryUpdaterTest.java (-31 / +31 lines)
Lines 543-549 Link Here
543
        handler.reset();
543
        handler.reset();
544
        indexerFactory.indexer.setExpectedFile(new URL[0], new URL[0], new URL[0]);
544
        indexerFactory.indexer.setExpectedFile(new URL[0], new URL[0], new URL[0]);
545
        eindexerFactory.indexer.setExpectedFile(new URL[0],new URL[0], new URL[0]);
545
        eindexerFactory.indexer.setExpectedFile(new URL[0],new URL[0], new URL[0]);
546
        File file = new File (embeddedFiles[0].toURI());
546
        File file = org.openide.util.Utilities.toFile(embeddedFiles[0].toURI());
547
        file.setLastModified(System.currentTimeMillis());
547
        file.setLastModified(System.currentTimeMillis());
548
        globalPathRegistry_register(SOURCES,new ClassPath[]{cp1});
548
        globalPathRegistry_register(SOURCES,new ClassPath[]{cp1});
549
        assertTrue (handler.await());
549
        assertTrue (handler.await());
Lines 561-569 Link Here
561
        handler.reset();
561
        handler.reset();
562
        indexerFactory.indexer.setExpectedFile(new URL[0], new URL[0], new URL[0]);
562
        indexerFactory.indexer.setExpectedFile(new URL[0], new URL[0], new URL[0]);
563
        eindexerFactory.indexer.setExpectedFile(new URL[0],new URL[0], new URL[0]);
563
        eindexerFactory.indexer.setExpectedFile(new URL[0],new URL[0], new URL[0]);
564
        file = new File (embeddedFiles[0].toURI());
564
        file = org.openide.util.Utilities.toFile(embeddedFiles[0].toURI());
565
        file.setLastModified(System.currentTimeMillis());
565
        file.setLastModified(System.currentTimeMillis());
566
        file = new File (embeddedFiles[1].toURI());
566
        file = org.openide.util.Utilities.toFile(embeddedFiles[1].toURI());
567
        file.delete();
567
        file.delete();
568
        srcRootWithFiles1.getFileSystem().refresh(true);
568
        srcRootWithFiles1.getFileSystem().refresh(true);
569
        
569
        
Lines 631-637 Link Here
631
        final File container = f.getParentFile();
631
        final File container = f.getParentFile();
632
        File newFile = new File (container,"c.emb");
632
        File newFile = new File (container,"c.emb");
633
        indexerFactory.indexer.setExpectedFile(new URL[0], new URL[0], new URL[0]);
633
        indexerFactory.indexer.setExpectedFile(new URL[0], new URL[0], new URL[0]);
634
        eindexerFactory.indexer.setExpectedFile(new URL[]{newFile.toURI().toURL()}, new URL[0], new URL[0]);
634
        eindexerFactory.indexer.setExpectedFile(new URL[]{org.openide.util.Utilities.toURI(newFile).toURL()}, new URL[0], new URL[0]);
635
        assertNotNull(FileUtil.createData(newFile));
635
        assertNotNull(FileUtil.createData(newFile));
636
        assertTrue(indexerFactory.indexer.awaitIndex(TIME));
636
        assertTrue(indexerFactory.indexer.awaitIndex(TIME));
637
        assertTrue(eindexerFactory.indexer.awaitIndex());
637
        assertTrue(eindexerFactory.indexer.awaitIndex());
Lines 644-650 Link Here
644
        newFile = new File (newFolder,"d.emb");
644
        newFile = new File (newFolder,"d.emb");
645
        File newFile2 = new File (newFolder,"e.emb");
645
        File newFile2 = new File (newFolder,"e.emb");
646
        indexerFactory.indexer.setExpectedFile(new URL[0], new URL[0], new URL[0]);
646
        indexerFactory.indexer.setExpectedFile(new URL[0], new URL[0], new URL[0]);
647
        eindexerFactory.indexer.setExpectedFile(new URL[]{newFile.toURI().toURL(), newFile2.toURI().toURL()}, new URL[0], new URL[0]);
647
        eindexerFactory.indexer.setExpectedFile(new URL[]{org.openide.util.Utilities.toURI(newFile).toURL(), org.openide.util.Utilities.toURI(newFile2).toURL()}, new URL[0], new URL[0]);
648
        newFolder.mkdirs();
648
        newFolder.mkdirs();
649
        touchFile (newFile);
649
        touchFile (newFile);
650
        touchFile (newFile2);
650
        touchFile (newFile2);
Lines 978-991 Link Here
978
        
978
        
979
        File root = FileUtil.toFile(srcRootWithFiles1);
979
        File root = FileUtil.toFile(srcRootWithFiles1);
980
        File fdf = new File (root, "direct.emb");   //NOI18N
980
        File fdf = new File (root, "direct.emb");   //NOI18N
981
        eindexerFactory.indexer.setExpectedFile(new URL[]{fdf.toURI().toURL()}, new URL[0], new URL[0]);
981
        eindexerFactory.indexer.setExpectedFile(new URL[]{org.openide.util.Utilities.toURI(fdf).toURL()}, new URL[0], new URL[0]);
982
        FileObject df = FileUtil.createData(fdf);
982
        FileObject df = FileUtil.createData(fdf);
983
        assertNotNull(df);
983
        assertNotNull(df);
984
        assertEquals(EMIME, df.getMIMEType());
984
        assertEquals(EMIME, df.getMIMEType());
985
        eindexerFactory.indexer.awaitIndex();
985
        eindexerFactory.indexer.awaitIndex();
986
986
987
        File newfdf = new File (root, "new_direct.emb");   //NOI18N
987
        File newfdf = new File (root, "new_direct.emb");   //NOI18N
988
        eindexerFactory.indexer.setExpectedFile(new URL[]{newfdf.toURI().toURL()}, new URL[]{fdf.toURI().toURL()}, new URL[0]);
988
        eindexerFactory.indexer.setExpectedFile(new URL[]{org.openide.util.Utilities.toURI(newfdf).toURL()}, new URL[]{org.openide.util.Utilities.toURI(fdf).toURL()}, new URL[0]);
989
        FileLock lock = df.lock();
989
        FileLock lock = df.lock();
990
        try {
990
        try {
991
            df.rename(lock, "new_direct", "emb");
991
            df.rename(lock, "new_direct", "emb");
Lines 1282-1289 Link Here
1282
        
1282
        
1283
        final File a = new File(srcRoot1File,"folder/a.foo");
1283
        final File a = new File(srcRoot1File,"folder/a.foo");
1284
        final File b = new File(srcRoot1File,"folder/b.emb");
1284
        final File b = new File(srcRoot1File,"folder/b.emb");
1285
        indexerFactory.indexer.setExpectedFile(new URL[]{a.toURI().toURL()}, new URL[0], new URL[0]);
1285
        indexerFactory.indexer.setExpectedFile(new URL[]{org.openide.util.Utilities.toURI(a).toURL()}, new URL[0], new URL[0]);
1286
        eindexerFactory.indexer.setExpectedFile(new URL[]{b.toURI().toURL()}, new URL[0], new URL[0]);
1286
        eindexerFactory.indexer.setExpectedFile(new URL[]{org.openide.util.Utilities.toURI(b).toURL()}, new URL[0], new URL[0]);
1287
        FileUtil.runAtomicAction(new FileSystem.AtomicAction() {
1287
        FileUtil.runAtomicAction(new FileSystem.AtomicAction() {
1288
            @Override
1288
            @Override
1289
            public void run() throws IOException {
1289
            public void run() throws IOException {
Lines 2179-2189 Link Here
2179
        //Unsee root - index should be donwloaded and no indexer should be called
2179
        //Unsee root - index should be donwloaded and no indexer should be called
2180
        final URL rootURL = FileUtil.urlForArchiveOrDir(root);
2180
        final URL rootURL = FileUtil.urlForArchiveOrDir(root);
2181
        final ClassPath cp1 = ClassPathSupport.createClassPath(rootURL);
2181
        final ClassPath cp1 = ClassPathSupport.createClassPath(rootURL);
2182
        IndexDownloaderImpl.expect(rootURL, index.toURI().toURL());
2182
        IndexDownloaderImpl.expect(rootURL, org.openide.util.Utilities.toURI(index).toURL());
2183
        indexerFactory.indexer.setExpectedFile(
2183
        indexerFactory.indexer.setExpectedFile(
2184
                new URL[]{
2184
                new URL[]{
2185
                    a.toURI().toURL(),
2185
                    org.openide.util.Utilities.toURI(a).toURL(),
2186
                    b.toURI().toURL()},
2186
                    org.openide.util.Utilities.toURI(b).toURL()},
2187
                new URL[0],
2187
                new URL[0],
2188
                new URL[0]);
2188
                new URL[0]);
2189
        globalPathRegistry_register(SOURCES,new ClassPath[]{cp1});
2189
        globalPathRegistry_register(SOURCES,new ClassPath[]{cp1});
Lines 2196-2206 Link Here
2196
        touchFile(a);
2196
        touchFile(a);
2197
2197
2198
        //Seen root - index should NOT be donwloaded and indexer should be called on modified file
2198
        //Seen root - index should NOT be donwloaded and indexer should be called on modified file
2199
        IndexDownloaderImpl.expect(rootURL, index.toURI().toURL());
2199
        IndexDownloaderImpl.expect(rootURL, org.openide.util.Utilities.toURI(index).toURL());
2200
        indexerFactory.indexer.setExpectedFile(
2200
        indexerFactory.indexer.setExpectedFile(
2201
                new URL[]{
2201
                new URL[]{
2202
                    a.toURI().toURL(),
2202
                    org.openide.util.Utilities.toURI(a).toURL(),
2203
                    b.toURI().toURL(),  //Should be removed if timestamps maps
2203
                    org.openide.util.Utilities.toURI(b).toURL(),  //Should be removed if timestamps maps
2204
                },
2204
                },
2205
                new URL[0],
2205
                new URL[0],
2206
                new URL[0]);
2206
                new URL[0]);
Lines 2212-2224 Link Here
2212
        //Simulate the index download error - indexer should be started
2212
        //Simulate the index download error - indexer should be started
2213
        globalPathRegistry_unregister(SOURCES, new ClassPath[]{cp1});
2213
        globalPathRegistry_unregister(SOURCES, new ClassPath[]{cp1});
2214
        RepositoryUpdater.getDefault().waitUntilFinished(TIME);
2214
        RepositoryUpdater.getDefault().waitUntilFinished(TIME);
2215
        FileObject fo = CacheFolder.getDataFolder(root.toURI().toURL());
2215
        FileObject fo = CacheFolder.getDataFolder(org.openide.util.Utilities.toURI(root).toURL());
2216
        fo.delete();
2216
        fo.delete();
2217
        IndexDownloaderImpl.expect(rootURL, new File(workDir,"non_existent_index.zip").toURI().toURL());
2217
        IndexDownloaderImpl.expect(rootURL, org.openide.util.Utilities.toURI(new File(workDir,"non_existent_index.zip")).toURL());
2218
        indexerFactory.indexer.setExpectedFile(
2218
        indexerFactory.indexer.setExpectedFile(
2219
                new URL[]{
2219
                new URL[]{
2220
                    a.toURI().toURL(),
2220
                    org.openide.util.Utilities.toURI(a).toURL(),
2221
                    b.toURI().toURL()},
2221
                    org.openide.util.Utilities.toURI(b).toURL()},
2222
                new URL[0],
2222
                new URL[0],
2223
                new URL[0]);
2223
                new URL[0]);
2224
        globalPathRegistry_register(SOURCES,new ClassPath[]{cp1});
2224
        globalPathRegistry_register(SOURCES,new ClassPath[]{cp1});
Lines 2229-2242 Link Here
2229
        //Test DownloadedIndexPatcher - votes false -> IndexDownloader should be called and then Indexers should be called
2229
        //Test DownloadedIndexPatcher - votes false -> IndexDownloader should be called and then Indexers should be called
2230
        globalPathRegistry_unregister(SOURCES, new ClassPath[]{cp1});
2230
        globalPathRegistry_unregister(SOURCES, new ClassPath[]{cp1});
2231
        RepositoryUpdater.getDefault().waitUntilFinished(TIME);
2231
        RepositoryUpdater.getDefault().waitUntilFinished(TIME);
2232
        fo = CacheFolder.getDataFolder(root.toURI().toURL());
2232
        fo = CacheFolder.getDataFolder(org.openide.util.Utilities.toURI(root).toURL());
2233
        fo.delete();
2233
        fo.delete();
2234
        IndexDownloaderImpl.expect(rootURL, index.toURI().toURL());
2234
        IndexDownloaderImpl.expect(rootURL, org.openide.util.Utilities.toURI(index).toURL());
2235
        IndexPatcherImpl.expect(rootURL, false);
2235
        IndexPatcherImpl.expect(rootURL, false);
2236
        indexerFactory.indexer.setExpectedFile(
2236
        indexerFactory.indexer.setExpectedFile(
2237
                new URL[]{
2237
                new URL[]{
2238
                    a.toURI().toURL(),
2238
                    org.openide.util.Utilities.toURI(a).toURL(),
2239
                    b.toURI().toURL()},
2239
                    org.openide.util.Utilities.toURI(b).toURL()},
2240
                new URL[0],
2240
                new URL[0],
2241
                new URL[0]);
2241
                new URL[0]);
2242
        globalPathRegistry_register(SOURCES,new ClassPath[]{cp1});
2242
        globalPathRegistry_register(SOURCES,new ClassPath[]{cp1});
Lines 2248-2261 Link Here
2248
        //Test DownloadedIndexPatcher - votes true -> IndexDownloader should be called and NO Indexers should be called
2248
        //Test DownloadedIndexPatcher - votes true -> IndexDownloader should be called and NO Indexers should be called
2249
        globalPathRegistry_unregister(SOURCES, new ClassPath[]{cp1});
2249
        globalPathRegistry_unregister(SOURCES, new ClassPath[]{cp1});
2250
        RepositoryUpdater.getDefault().waitUntilFinished(TIME);
2250
        RepositoryUpdater.getDefault().waitUntilFinished(TIME);
2251
        fo = CacheFolder.getDataFolder(root.toURI().toURL());
2251
        fo = CacheFolder.getDataFolder(org.openide.util.Utilities.toURI(root).toURL());
2252
        fo.delete();
2252
        fo.delete();
2253
        IndexDownloaderImpl.expect(rootURL, index.toURI().toURL());
2253
        IndexDownloaderImpl.expect(rootURL, org.openide.util.Utilities.toURI(index).toURL());
2254
        IndexPatcherImpl.expect(rootURL, true);
2254
        IndexPatcherImpl.expect(rootURL, true);
2255
        indexerFactory.indexer.setExpectedFile(
2255
        indexerFactory.indexer.setExpectedFile(
2256
                new URL[]{
2256
                new URL[]{
2257
                    a.toURI().toURL(),
2257
                    org.openide.util.Utilities.toURI(a).toURL(),
2258
                    b.toURI().toURL()},
2258
                    org.openide.util.Utilities.toURI(b).toURL()},
2259
                new URL[0],
2259
                new URL[0],
2260
                new URL[0]);
2260
                new URL[0]);
2261
        globalPathRegistry_register(SOURCES,new ClassPath[]{cp1});
2261
        globalPathRegistry_register(SOURCES,new ClassPath[]{cp1});
Lines 2306-2313 Link Here
2306
        File af = FileUtil.toFile(a);
2306
        File af = FileUtil.toFile(a);
2307
        File anf = new File (af.getParentFile(),"an.foo");  //NOI18N
2307
        File anf = new File (af.getParentFile(),"an.foo");  //NOI18N
2308
        indexerFactory.indexer.setExpectedFile(
2308
        indexerFactory.indexer.setExpectedFile(
2309
            new URL[]{anf.toURI().toURL()},
2309
            new URL[]{org.openide.util.Utilities.toURI(anf).toURL()},
2310
            new URL[]{af.toURI().toURL()},
2310
            new URL[]{org.openide.util.Utilities.toURI(af).toURL()},
2311
            new URL[0]);
2311
            new URL[0]);
2312
        FileLock l = a.lock();
2312
        FileLock l = a.lock();
2313
        try {
2313
        try {
Lines 2323-2330 Link Here
2323
        File bf = FileUtil.toFile(b);
2323
        File bf = FileUtil.toFile(b);
2324
        File bnf = new File (bf.getParentFile(),"bn.foo");  //NOI18N
2324
        File bnf = new File (bf.getParentFile(),"bn.foo");  //NOI18N
2325
        indexerFactory.indexer.setExpectedFile(
2325
        indexerFactory.indexer.setExpectedFile(
2326
            new URL[]{bnf.toURI().toURL()},
2326
            new URL[]{org.openide.util.Utilities.toURI(bnf).toURL()},
2327
            new URL[]{bf.toURI().toURL()},
2327
            new URL[]{org.openide.util.Utilities.toURI(bf).toURL()},
2328
            new URL[0]);
2328
            new URL[0]);
2329
        l = b.lock();
2329
        l = b.lock();
2330
        try {
2330
        try {
(-)a/parsing.lucene/nbproject/project.xml (-1 / +1 lines)
Lines 37-43 Link Here
37
                    <build-prerequisite/>
37
                    <build-prerequisite/>
38
                    <compile-dependency/>
38
                    <compile-dependency/>
39
                    <run-dependency>
39
                    <run-dependency>
40
                        <specification-version>8.9</specification-version>
40
                        <specification-version>8.25</specification-version>
41
                    </run-dependency>
41
                    </run-dependency>
42
                </dependency>
42
                </dependency>
43
                <dependency>
43
                <dependency>
(-)a/parsing.lucene/src/org/netbeans/modules/parsing/lucene/LuceneIndex.java (-1 / +1 lines)
Lines 974-980 Link Here
974
        private synchronized void hit() {
974
        private synchronized void hit() {
975
            if (!cachePolicy.hasMemCache()) {
975
            if (!cachePolicy.hasMemCache()) {
976
                try {
976
                try {
977
                    final URL url = folder.toURI().toURL();
977
                    final URL url = Utilities.toURI(folder).toURL();
978
                    IndexCacheFactory.getDefault().getCache().put(url, this);
978
                    IndexCacheFactory.getDefault().getCache().put(url, this);
979
                } catch (MalformedURLException e) {
979
                } catch (MalformedURLException e) {
980
                    Exceptions.printStackTrace(e);
980
                    Exceptions.printStackTrace(e);
(-)a/project.ant/antsrc/org/netbeans/modules/project/ant/task/RegenerateFilesTask.java (-2 / +2 lines)
Lines 118-127 Link Here
118
                assert projectFO != null;
118
                assert projectFO != null;
119
            }
119
            }
120
            GeneratedFilesHelper h = new GeneratedFilesHelper(projectFO);
120
            GeneratedFilesHelper h = new GeneratedFilesHelper(projectFO);
121
            if (buildXsl != null && h.refreshBuildScript(GeneratedFilesHelper.BUILD_XML_PATH, buildXsl.toURI().toURL(), true)) {
121
            if (buildXsl != null && h.refreshBuildScript(GeneratedFilesHelper.BUILD_XML_PATH, org.openide.util.Utilities.toURI(buildXsl).toURL(), true)) {
122
                log("Regenerating " + new File(projectDir, GeneratedFilesHelper.BUILD_XML_PATH.replace('/', File.separatorChar)).getAbsolutePath());
122
                log("Regenerating " + new File(projectDir, GeneratedFilesHelper.BUILD_XML_PATH.replace('/', File.separatorChar)).getAbsolutePath());
123
            }
123
            }
124
            if (buildImplXsl != null && h.refreshBuildScript(GeneratedFilesHelper.BUILD_IMPL_XML_PATH, buildImplXsl.toURI().toURL(), true)) {
124
            if (buildImplXsl != null && h.refreshBuildScript(GeneratedFilesHelper.BUILD_IMPL_XML_PATH, org.openide.util.Utilities.toURI(buildImplXsl).toURL(), true)) {
125
                log("Regenerating " + new File(projectDir, GeneratedFilesHelper.BUILD_IMPL_XML_PATH.replace('/', File.separatorChar)).getAbsolutePath());
125
                log("Regenerating " + new File(projectDir, GeneratedFilesHelper.BUILD_IMPL_XML_PATH.replace('/', File.separatorChar)).getAbsolutePath());
126
            }
126
            }
127
        } catch (IOException e) {
127
        } catch (IOException e) {
(-)a/project.ant/nbproject/project.xml (-1 / +1 lines)
Lines 170-176 Link Here
170
                    <build-prerequisite/>
170
                    <build-prerequisite/>
171
                    <compile-dependency/>
171
                    <compile-dependency/>
172
                    <run-dependency>
172
                    <run-dependency>
173
                        <specification-version>8.4</specification-version>
173
                        <specification-version>8.25</specification-version>
174
                    </run-dependency>
174
                    </run-dependency>
175
                </dependency>
175
                </dependency>
176
                <dependency>
176
                <dependency>
(-)a/project.ant/src/org/netbeans/api/project/ant/AntArtifact.java (-2 / +3 lines)
Lines 61-66 Link Here
61
import org.openide.filesystems.FileObject;
61
import org.openide.filesystems.FileObject;
62
import org.openide.filesystems.FileUtil;
62
import org.openide.filesystems.FileUtil;
63
import org.openide.filesystems.URLMapper;
63
import org.openide.filesystems.URLMapper;
64
import org.openide.util.Utilities;
64
65
65
// XXX may also need displayName field (any default? or only in SimpleAntArtifact?)
66
// XXX may also need displayName field (any default? or only in SimpleAntArtifact?)
66
67
Lines 199-205 Link Here
199
        URL artifact;
200
        URL artifact;
200
        try {
201
        try {
201
            // XXX this should probably use something in PropertyUtils?
202
            // XXX this should probably use something in PropertyUtils?
202
            artifact = getScriptLocation().toURI().resolve(artifactLocation).normalize().toURL();
203
            artifact = Utilities.toURI(getScriptLocation()).resolve(artifactLocation).normalize().toURL();
203
        } catch (MalformedURLException e) {
204
        } catch (MalformedURLException e) {
204
            ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e);
205
            ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e);
205
            return null;
206
            return null;
Lines 254-260 Link Here
254
     * @return the associated project, or null if there is none or it could not be located
255
     * @return the associated project, or null if there is none or it could not be located
255
     */
256
     */
256
    public Project getProject() {
257
    public Project getProject() {
257
        return FileOwnerQuery.getOwner(getScriptLocation().toURI());
258
        return FileOwnerQuery.getOwner(Utilities.toURI(getScriptLocation()));
258
    }
259
    }
259
260
260
    /**
261
    /**
(-)a/project.ant/src/org/netbeans/api/project/ant/FileChooser.java (-1 / +2 lines)
Lines 54-59 Link Here
54
import org.netbeans.modules.project.ant.ProjectLibraryProvider;
54
import org.netbeans.modules.project.ant.ProjectLibraryProvider;
55
import org.netbeans.spi.project.support.ant.AntProjectHelper;
55
import org.netbeans.spi.project.support.ant.AntProjectHelper;
56
import org.openide.filesystems.FileUtil;
56
import org.openide.filesystems.FileUtil;
57
import org.openide.util.Utilities;
57
58
58
59
59
/**
60
/**
Lines 82-88 Link Here
82
        if (lm != null) {
83
        if (lm != null) {
83
            URL u = lm.getLocation();
84
            URL u = lm.getLocation();
84
            if (u != null) {
85
            if (u != null) {
85
                File libBase = new File(URI.create(u.toExternalForm())).getParentFile();
86
                File libBase = Utilities.toFile(URI.create(u.toExternalForm())).getParentFile();
86
                accessory = new FileChooserAccessory(this, FileUtil.toFile(helper.getProjectDirectory()), 
87
                accessory = new FileChooserAccessory(this, FileUtil.toFile(helper.getProjectDirectory()), 
87
                    libBase, copyAllowed);
88
                    libBase, copyAllowed);
88
                setAccessory(accessory);
89
                setAccessory(accessory);
(-)a/project.ant/src/org/netbeans/modules/project/ant/AntBasedProjectFactorySingleton.java (-1 / +1 lines)
Lines 335-341 Link Here
335
        }
335
        }
336
        byte[] data = baos.toByteArray();
336
        byte[] data = baos.toByteArray();
337
        InputSource src = new InputSource(new ByteArrayInputStream(data));
337
        InputSource src = new InputSource(new ByteArrayInputStream(data));
338
        src.setSystemId(projectDiskFile.toURI().toString());
338
        src.setSystemId(Utilities.toURI(projectDiskFile).toString());
339
        try {
339
        try {
340
//            Document projectXml = XMLUtil.parse(src, false, true, Util.defaultErrorHandler(), null);
340
//            Document projectXml = XMLUtil.parse(src, false, true, Util.defaultErrorHandler(), null);
341
            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
341
            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
(-)a/project.ant/src/org/netbeans/modules/project/ant/FileChooserAccessory.java (-1 / +2 lines)
Lines 69-74 Link Here
69
import org.openide.filesystems.FileUtil;
69
import org.openide.filesystems.FileUtil;
70
import org.openide.util.Exceptions;
70
import org.openide.util.Exceptions;
71
import org.openide.util.NbBundle.Messages;
71
import org.openide.util.NbBundle.Messages;
72
import org.openide.util.Utilities;
72
73
73
/**
74
/**
74
 * Accessory allowing to choose how file is referenced from a project - relative
75
 * Accessory allowing to choose how file is referenced from a project - relative
Lines 343-349 Link Here
343
344
344
    private boolean areCollocated(File base, Collection<File> files){
345
    private boolean areCollocated(File base, Collection<File> files){
345
        for(File file: files){
346
        for(File file: files){
346
            if (!CollocationQuery.areCollocated(base.toURI(), file.toURI())) {
347
            if (!CollocationQuery.areCollocated(Utilities.toURI(base), Utilities.toURI(file))) {
347
                return false;
348
                return false;
348
            }
349
            }
349
        }
350
        }
(-)a/project.ant/src/org/netbeans/modules/project/ant/ProjectLibraryProvider.java (-8 / +8 lines)
Lines 223-229 Link Here
223
    public ProjectLibraryArea loadArea(URL location) {
223
    public ProjectLibraryArea loadArea(URL location) {
224
        if (location.getProtocol().equals("file") && location.getPath().endsWith(".properties")) { // NOI18N
224
        if (location.getProtocol().equals("file") && location.getPath().endsWith(".properties")) { // NOI18N
225
            try {
225
            try {
226
                return new ProjectLibraryArea(new File(location.toURI()));
226
                return new ProjectLibraryArea(Utilities.toFile(location.toURI()));
227
            } catch (URISyntaxException x) {
227
            } catch (URISyntaxException x) {
228
                Exceptions.printStackTrace(x);
228
                Exceptions.printStackTrace(x);
229
            }
229
            }
Lines 367-373 Link Here
367
                }
367
                }
368
            }
368
            }
369
        }
369
        }
370
        ProjectLibraryArea pla = loadArea(pli.mainPropertiesFile.toURI().toURL());
370
        ProjectLibraryArea pla = loadArea(Utilities.toURI(pli.mainPropertiesFile).toURL());
371
        if (pla != null) {
371
        if (pla != null) {
372
        LP lp = getLibraries(pla);
372
        LP lp = getLibraries(pla);
373
        if (lp.libraries.remove(pli.name) != null) {
373
        if (lp.libraries.remove(pli.name) != null) {
Lines 527-533 Link Here
527
                        File normalizedFile = FileUtil.normalizeFile(new File(component.replace('/', File.separatorChar).replace('\\', File.separatorChar).replace("${base}", area.mainPropertiesFile.getParent())));
527
                        File normalizedFile = FileUtil.normalizeFile(new File(component.replace('/', File.separatorChar).replace('\\', File.separatorChar).replace("${base}", area.mainPropertiesFile.getParent())));
528
                        try {
528
                        try {
529
                            URI u = LibrariesSupport.convertFilePathToURI(f);
529
                            URI u = LibrariesSupport.convertFilePathToURI(f);
530
                            if (FileUtil.isArchiveFile(normalizedFile.toURI().toURL())) {
530
                            if (FileUtil.isArchiveFile(Utilities.toURI(normalizedFile).toURL())) {
531
                                u = appendJarFolder(u, jarFolder);
531
                                u = appendJarFolder(u, jarFolder);
532
                            } else if (!u.getPath().endsWith("/")) {  // NOI18N
532
                            } else if (!u.getPath().endsWith("/")) {  // NOI18N
533
                                u = new URI(u.toString() + "/");  // NOI18N
533
                                u = new URI(u.toString() + "/");  // NOI18N
Lines 739-745 Link Here
739
            List<URL> resolvedUrls = new ArrayList<URL>(uris.size());
739
            List<URL> resolvedUrls = new ArrayList<URL>(uris.size());
740
            for (URI u : uris) {
740
            for (URI u : uris) {
741
                try {
741
                try {
742
                    resolvedUrls.add(LibrariesSupport.resolveLibraryEntryURI(mainPropertiesFile.toURI().toURL(), u).toURL());
742
                    resolvedUrls.add(LibrariesSupport.resolveLibraryEntryURI(Utilities.toURI(mainPropertiesFile).toURL(), u).toURL());
743
                } catch (MalformedURLException ex) {
743
                } catch (MalformedURLException ex) {
744
                    Logger.getLogger(ProjectLibraryProvider.class.getName()).log(Level.INFO, "#184304: " + u, ex);
744
                    Logger.getLogger(ProjectLibraryProvider.class.getName()).log(Level.INFO, "#184304: " + u, ex);
745
                }
745
                }
Lines 919-925 Link Here
919
919
920
        public URL getLocation() {
920
        public URL getLocation() {
921
            try {
921
            try {
922
                return mainPropertiesFile.toURI().toURL();
922
                return Utilities.toURI(mainPropertiesFile).toURL();
923
            } catch (MalformedURLException x) {
923
            } catch (MalformedURLException x) {
924
                throw new AssertionError(x);
924
                throw new AssertionError(x);
925
            }
925
            }
Lines 1085-1091 Link Here
1085
        Definitions defs = findDefinitions(helper);
1085
        Definitions defs = findDefinitions(helper);
1086
        if (defs != null) {
1086
        if (defs != null) {
1087
            try {
1087
            try {
1088
                return LibraryManager.forLocation(defs.mainPropertiesFile.toURI().toURL());
1088
                return LibraryManager.forLocation(Utilities.toURI(defs.mainPropertiesFile).toURL());
1089
            } catch (MalformedURLException x) {
1089
            } catch (MalformedURLException x) {
1090
                Exceptions.printStackTrace(x);
1090
                Exceptions.printStackTrace(x);
1091
            }
1091
            }
Lines 1149-1155 Link Here
1149
     */
1149
     */
1150
    public static Library copyLibrary(final Library lib, final URL location, 
1150
    public static Library copyLibrary(final Library lib, final URL location, 
1151
            final boolean generateLibraryUniqueName) throws IOException {
1151
            final boolean generateLibraryUniqueName) throws IOException {
1152
        final File libBaseFolder = new File(URI.create(location.toExternalForm())).getParentFile();
1152
        final File libBaseFolder = Utilities.toFile(URI.create(location.toExternalForm())).getParentFile();
1153
        FileObject sharedLibFolder = null;
1153
        FileObject sharedLibFolder = null;
1154
        final Map<String, List<URI>> content = new HashMap<String, List<URI>>();
1154
        final Map<String, List<URI>> content = new HashMap<String, List<URI>>();
1155
        String[] volumes = LibrariesSupport.getLibraryTypeProvider(lib.getType()).getSupportedVolumeTypes();
1155
        String[] volumes = LibrariesSupport.getLibraryTypeProvider(lib.getType()).getSupportedVolumeTypes();
Lines 1178-1184 Link Here
1178
                URI u;
1178
                URI u;
1179
                FileObject newFO;
1179
                FileObject newFO;
1180
                String name;
1180
                String name;
1181
                if (CollocationQuery.areCollocated(libBaseFolder.toURI(), libEntryFO.toURI())) {
1181
                if (CollocationQuery.areCollocated(Utilities.toURI(libBaseFolder), libEntryFO.toURI())) {
1182
                    // 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)
1183
                    // don't replicate it but reference the original file.
1183
                    // don't replicate it but reference the original file.
1184
                    newFO = libEntryFO;
1184
                    newFO = libEntryFO;
(-)a/project.ant/src/org/netbeans/modules/project/ant/StandardAntArtifactQueryImpl.java (-2 / +3 lines)
Lines 51-56 Link Here
51
import org.netbeans.api.project.ant.AntArtifact;
51
import org.netbeans.api.project.ant.AntArtifact;
52
import org.netbeans.spi.project.ant.AntArtifactProvider;
52
import org.netbeans.spi.project.ant.AntArtifactProvider;
53
import org.netbeans.spi.project.ant.AntArtifactQueryImplementation;
53
import org.netbeans.spi.project.ant.AntArtifactQueryImplementation;
54
import org.openide.util.Utilities;
54
55
55
/**
56
/**
56
 * Standard implementation of {@link AntArtifactQueryImplementation} which uses
57
 * Standard implementation of {@link AntArtifactQueryImplementation} which uses
Lines 64-70 Link Here
64
    public StandardAntArtifactQueryImpl() {}
65
    public StandardAntArtifactQueryImpl() {}
65
    
66
    
66
    public AntArtifact findArtifact(File file) {
67
    public AntArtifact findArtifact(File file) {
67
        Project p = FileOwnerQuery.getOwner(file.toURI());
68
        Project p = FileOwnerQuery.getOwner(Utilities.toURI(file));
68
        if (p == null) {
69
        if (p == null) {
69
            return null;
70
            return null;
70
        }
71
        }
Lines 76-82 Link Here
76
        for (int i = 0; i < artifacts.length; i++) {
77
        for (int i = 0; i < artifacts.length; i++) {
77
            URI uris[] = artifacts[i].getArtifactLocations();
78
            URI uris[] = artifacts[i].getArtifactLocations();
78
            for (int y = 0; y < uris.length; y++) {
79
            for (int y = 0; y < uris.length; y++) {
79
                File testFile = new File(artifacts[i].getScriptLocation().toURI().resolve(uris[y]));
80
                File testFile = Utilities.toFile(Utilities.toURI(artifacts[i].getScriptLocation()).resolve(uris[y]));
80
                if (file.equals(testFile)) {
81
                if (file.equals(testFile)) {
81
                    return artifacts[i];
82
                    return artifacts[i];
82
                }
83
                }
(-)a/project.ant/src/org/netbeans/spi/project/support/ant/AntProjectHelper.java (-2 / +3 lines)
Lines 92-97 Link Here
92
import org.openide.util.MutexException;
92
import org.openide.util.MutexException;
93
import org.openide.util.RequestProcessor;
93
import org.openide.util.RequestProcessor;
94
import org.openide.util.UserQuestionException;
94
import org.openide.util.UserQuestionException;
95
import org.openide.util.Utilities;
95
import org.openide.util.WeakSet;
96
import org.openide.util.WeakSet;
96
import org.openide.xml.XMLUtil;
97
import org.openide.xml.XMLUtil;
97
import org.w3c.dom.Document;
98
import org.w3c.dom.Document;
Lines 307-313 Link Here
307
        File f = FileUtil.toFile(xml);
308
        File f = FileUtil.toFile(xml);
308
        assert f != null;
309
        assert f != null;
309
        try {
310
        try {
310
            Document doc = XMLUtil.parse(new InputSource(f.toURI().toString()), false, true, XMLUtil.defaultErrorHandler(), null);
311
            Document doc = XMLUtil.parse(new InputSource(Utilities.toURI(f).toString()), false, true, XMLUtil.defaultErrorHandler(), null);
311
            ProjectXMLCatalogReader.validate(doc.getDocumentElement());
312
            ProjectXMLCatalogReader.validate(doc.getDocumentElement());
312
            return doc;
313
            return doc;
313
        } catch (IOException e) {
314
        } catch (IOException e) {
Lines 1205-1211 Link Here
1205
        final SharabilityQueryImplementation2 sq2 = createSharabilityQuery2(eval, sourceRoots, buildDirectories);
1206
        final SharabilityQueryImplementation2 sq2 = createSharabilityQuery2(eval, sourceRoots, buildDirectories);
1206
        return new SharabilityQueryImplementation() {
1207
        return new SharabilityQueryImplementation() {
1207
            @Override public int getSharability(File file) {
1208
            @Override public int getSharability(File file) {
1208
                return sq2.getSharability(file.toURI()).ordinal();
1209
                return sq2.getSharability(Utilities.toURI(file)).ordinal();
1209
            }
1210
            }
1210
        };
1211
        };
1211
    }
1212
    }
(-)a/project.ant/src/org/netbeans/spi/project/support/ant/GeneratedFilesHelper.java (-1 / +1 lines)
Lines 327-333 Link Here
327
                                File projectXmlF = FileUtil.toFile(projectXml);
327
                                File projectXmlF = FileUtil.toFile(projectXml);
328
                                assert projectXmlF != null;
328
                                assert projectXmlF != null;
329
                                StreamSource projectXmlSource = new StreamSource(
329
                                StreamSource projectXmlSource = new StreamSource(
330
                                    new ByteArrayInputStream(projectXmlData), projectXmlF.toURI().toString());
330
                                    new ByteArrayInputStream(projectXmlData), Utilities.toURI(projectXmlF).toString());
331
                                ByteArrayOutputStream result = new ByteArrayOutputStream();
331
                                ByteArrayOutputStream result = new ByteArrayOutputStream();
332
                                t.transform(projectXmlSource, new StreamResult(result));
332
                                t.transform(projectXmlSource, new StreamResult(result));
333
                                if (BUILD_IMPL_XML_PATH.equals(path)) {
333
                                if (BUILD_IMPL_XML_PATH.equals(path)) {
(-)a/project.ant/src/org/netbeans/spi/project/support/ant/PropertyUtils.java (-1 / +2 lines)
Lines 81-86 Link Here
81
import org.openide.util.MutexException;
81
import org.openide.util.MutexException;
82
import org.openide.util.NbCollections;
82
import org.openide.util.NbCollections;
83
import org.openide.util.RequestProcessor;
83
import org.openide.util.RequestProcessor;
84
import org.openide.util.Utilities;
84
85
85
/**
86
/**
86
 * Support for working with Ant properties and property files.
87
 * Support for working with Ant properties and property files.
Lines 434-440 Link Here
434
            }
435
            }
435
            b.append("../"); // NOI18N
436
            b.append("../"); // NOI18N
436
        }
437
        }
437
        URI u = base.toURI().relativize(file.toURI());
438
        URI u = Utilities.toURI(base).relativize(Utilities.toURI(file));
438
        assert !u.isAbsolute() : u + " from " + basedir + " and " + file + " with common root " + base;
439
        assert !u.isAbsolute() : u + " from " + basedir + " and " + file + " with common root " + base;
439
        b.append(u.getPath());
440
        b.append(u.getPath());
440
        if (b.charAt(b.length() - 1) == '/') {
441
        if (b.charAt(b.length() - 1) == '/') {
(-)a/project.ant/src/org/netbeans/spi/project/support/ant/ReferenceHelper.java (-4 / +5 lines)
Lines 83-88 Link Here
83
import org.openide.util.Mutex;
83
import org.openide.util.Mutex;
84
import org.openide.util.NbCollections;
84
import org.openide.util.NbCollections;
85
import org.openide.util.Parameters;
85
import org.openide.util.Parameters;
86
import org.openide.util.Utilities;
86
import org.openide.xml.XMLUtil;
87
import org.openide.xml.XMLUtil;
87
import org.w3c.dom.Document;
88
import org.w3c.dom.Document;
88
import org.w3c.dom.Element;
89
import org.w3c.dom.Element;
Lines 239-245 Link Here
239
                    try {
240
                    try {
240
                        scriptLocation = new URI(null, null, rel, null);
241
                        scriptLocation = new URI(null, null, rel, null);
241
                    } catch (URISyntaxException ex) {
242
                    } catch (URISyntaxException ex) {
242
                        scriptLocation = forProjDir.toURI().relativize(scriptFile.toURI());
243
                        scriptLocation = Utilities.toURI(forProjDir).relativize(Utilities.toURI(scriptFile));
243
                    }
244
                    }
244
                    ref = new RawReference(forProjName, artifact.getType(), scriptLocation, artifact.getTargetName(), artifact.getCleanTargetName(), artifact.getID());
245
                    ref = new RawReference(forProjName, artifact.getType(), scriptLocation, artifact.getTargetName(), artifact.getCleanTargetName(), artifact.getID());
245
                } else {
246
                } else {
Lines 270-276 Link Here
270
                URI artFile = location;
271
                URI artFile = location;
271
                String refPath;
272
                String refPath;
272
                if (artFile.isAbsolute()) {
273
                if (artFile.isAbsolute()) {
273
                    refPath = new File(artFile).getAbsolutePath();
274
                    refPath = Utilities.toFile(artFile).getAbsolutePath();
274
                    propertiesFile = AntProjectHelper.PRIVATE_PROPERTIES_PATH;
275
                    propertiesFile = AntProjectHelper.PRIVATE_PROPERTIES_PATH;
275
                } else {
276
                } else {
276
                    refPath = "${" + forProjPathProp + "}/" + artFile.getPath(); // NOI18N
277
                    refPath = "${" + forProjPathProp + "}/" + artFile.getPath(); // NOI18N
Lines 1523-1529 Link Here
1523
                FileUtil.toFile(p.getProjectDirectory()));
1524
                FileUtil.toFile(p.getProjectDirectory()));
1524
        if (libFile != null) {
1525
        if (libFile != null) {
1525
            try {
1526
            try {
1526
                return LibraryManager.forLocation(libFile.toURI().toURL());
1527
                return LibraryManager.forLocation(Utilities.toURI(libFile).toURL());
1527
            } catch (MalformedURLException e) {
1528
            } catch (MalformedURLException e) {
1528
                // ok, no project manager
1529
                // ok, no project manager
1529
                Logger.getLogger(ReferenceHelper.class.getName()).info(
1530
                Logger.getLogger(ReferenceHelper.class.getName()).info(
Lines 1556-1562 Link Here
1556
            return lib;
1557
            return lib;
1557
        }
1558
        }
1558
        File mainPropertiesFile = h.resolveFile(h.getLibrariesLocation());
1559
        File mainPropertiesFile = h.resolveFile(h.getLibrariesLocation());
1559
        return copyLibrary(lib, mainPropertiesFile.toURI().toURL());
1560
        return copyLibrary(lib, Utilities.toURI(mainPropertiesFile).toURL());
1560
    }
1561
    }
1561
        
1562
        
1562
    /**
1563
    /**
(-)a/project.ant/src/org/netbeans/spi/project/support/ant/SharabilityQueryImpl.java (-1 / +2 lines)
Lines 53-58 Link Here
53
import org.netbeans.api.queries.SharabilityQuery;
53
import org.netbeans.api.queries.SharabilityQuery;
54
import org.netbeans.modules.project.ant.ProjectLibraryProvider;
54
import org.netbeans.modules.project.ant.ProjectLibraryProvider;
55
import org.netbeans.spi.queries.SharabilityQueryImplementation2;
55
import org.netbeans.spi.queries.SharabilityQueryImplementation2;
56
import org.openide.util.Utilities;
56
import org.openide.util.WeakListeners;
57
import org.openide.util.WeakListeners;
57
58
58
/**
59
/**
Lines 109-115 Link Here
109
110
110
    @Override public SharabilityQuery.Sharability getSharability(URI uri) {
111
    @Override public SharabilityQuery.Sharability getSharability(URI uri) {
111
        // XXX might be more efficient to precompute URIs for includePaths and excludePaths
112
        // XXX might be more efficient to precompute URIs for includePaths and excludePaths
112
        String path = new File(uri).getAbsolutePath();
113
        String path = Utilities.toFile(uri).getAbsolutePath();
113
        if (contains(path, excludePaths, false)) {
114
        if (contains(path, excludePaths, false)) {
114
            return SharabilityQuery.Sharability.NOT_SHARABLE;
115
            return SharabilityQuery.Sharability.NOT_SHARABLE;
115
        }
116
        }
(-)a/project.ant/src/org/netbeans/spi/project/support/ant/SimpleAntArtifact.java (-1 / +2 lines)
Lines 51-56 Link Here
51
import org.netbeans.api.project.ant.AntArtifact;
51
import org.netbeans.api.project.ant.AntArtifact;
52
import org.netbeans.modules.project.ant.AntBasedProjectFactorySingleton;
52
import org.netbeans.modules.project.ant.AntBasedProjectFactorySingleton;
53
import org.openide.ErrorManager;
53
import org.openide.ErrorManager;
54
import org.openide.util.Utilities;
54
55
55
/**
56
/**
56
 * A basic AntArtifact implementation.
57
 * A basic AntArtifact implementation.
Lines 88-94 Link Here
88
        }
89
        }
89
        File locF = new File(locationResolved);
90
        File locF = new File(locationResolved);
90
        if (locF.isAbsolute()) {
91
        if (locF.isAbsolute()) {
91
            return locF.toURI();
92
            return Utilities.toURI(locF);
92
        } else {
93
        } else {
93
            // Project-relative path.
94
            // Project-relative path.
94
            try {
95
            try {
(-)a/project.ant/test/unit/src/org/netbeans/modules/project/ant/ProjectLibraryProviderTest.java (-12 / +13 lines)
Lines 70-75 Link Here
70
import org.openide.loaders.DataFolder;
70
import org.openide.loaders.DataFolder;
71
import org.openide.loaders.InstanceDataObject;
71
import org.openide.loaders.InstanceDataObject;
72
import org.openide.util.NbCollections;
72
import org.openide.util.NbCollections;
73
import org.openide.util.Utilities;
73
import org.openide.util.lookup.Lookups;
74
import org.openide.util.lookup.Lookups;
74
import org.openide.util.test.MockChangeListener;
75
import org.openide.util.test.MockChangeListener;
75
import org.openide.util.test.MockLookup;
76
import org.openide.util.test.MockLookup;
Lines 95-108 Link Here
95
    protected void setUp() throws Exception {
96
    protected void setUp() throws Exception {
96
        super.setUp();
97
        super.setUp();
97
        libraryProvider = new TestLibraryProvider();
98
        libraryProvider = new TestLibraryProvider();
98
        MockLookup.setLookup(Lookups.fixed(AntBasedTestUtil.testAntBasedProjectType(), AntBasedTestUtil.testCollocationQueryImplementation(getWorkDir().toURI()), libraryProvider),
99
        MockLookup.setLookup(Lookups.fixed(AntBasedTestUtil.testAntBasedProjectType(), AntBasedTestUtil.testCollocationQueryImplementation(Utilities.toURI(getWorkDir())), libraryProvider),
99
                // Filter out standard CQIs since they are bogus.
100
                // Filter out standard CQIs since they are bogus.
100
                Lookups.exclude(Lookups.metaInfServices(ProjectLibraryProviderTest.class.getClassLoader()), CollocationQueryImplementation.class));
101
                Lookups.exclude(Lookups.metaInfServices(ProjectLibraryProviderTest.class.getClassLoader()), CollocationQueryImplementation.class));
101
        projdir = TestUtil.makeScratchDir(this).createFolder("prj");
102
        projdir = TestUtil.makeScratchDir(this).createFolder("prj");
102
        helper = ProjectGenerator.createProject(projdir, "test");
103
        helper = ProjectGenerator.createProject(projdir, "test");
103
        project = ProjectManager.getDefault().findProject(projdir);
104
        project = ProjectManager.getDefault().findProject(projdir);
104
        close(OpenProjects.getDefault().getOpenProjects());
105
        close(OpenProjects.getDefault().getOpenProjects());
105
        base = getWorkDir().toURI().toURL();
106
        base = Utilities.toURI(getWorkDir()).toURL();
106
        ProjectLibraryProvider.FIRE_CHANGES_SYNCH = true;
107
        ProjectLibraryProvider.FIRE_CHANGES_SYNCH = true;
107
        registerTestLibraryTypeProvider();
108
        registerTestLibraryTypeProvider();
108
    }
109
    }
Lines 396-402 Link Here
396
        } else {
397
        } else {
397
            FileUtil.createData(f);
398
            FileUtil.createData(f);
398
        }
399
        }
399
        assertEquals(mode, SharabilityQuery.getSharability(f.toURI()));
400
        assertEquals(mode, SharabilityQuery.getSharability(Utilities.toURI(f)));
400
    }
401
    }
401
402
402
    private void writeProperties(String path, String... properties) throws IOException {
403
    private void writeProperties(String path, String... properties) throws IOException {
Lines 481-493 Link Here
481
        FileUtil.toFileObject(getWorkDir()).getFileSystem().refresh(false);
482
        FileUtil.toFileObject(getWorkDir()).getFileSystem().refresh(false);
482
        LibraryImplementation l1 = LibrariesSupport.createLibraryImplementation("j2test", new String[]{"jars", "sources"});
483
        LibraryImplementation l1 = LibrariesSupport.createLibraryImplementation("j2test", new String[]{"jars", "sources"});
483
        l1.setName("vino");
484
        l1.setName("vino");
484
        l1.setContent("jars", Arrays.asList(new URL[]{f.toURI().toURL(), f1.toURI().toURL()}));
485
        l1.setContent("jars", Arrays.asList(new URL[]{Utilities.toURI(f).toURL(), Utilities.toURI(f1).toURL()}));
485
        l1.setContent("sources", Arrays.asList(new URL[]{new URL("jar:" + f2.toURI().toURL() + "!/docs/api/")}));
486
        l1.setContent("sources", Arrays.asList(new URL[]{new URL("jar:" + Utilities.toURI(f2).toURL() + "!/docs/api/")}));
486
        libraryProvider.set(l1);
487
        libraryProvider.set(l1);
487
        Library l = LibraryManager.getDefault().getLibrary("vino");
488
        Library l = LibraryManager.getDefault().getLibrary("vino");
488
        assertNotNull(l);
489
        assertNotNull(l);
489
        assertEquals(LibraryManager.getDefault(), l.getManager());
490
        assertEquals(LibraryManager.getDefault(), l.getManager());
490
        URL u = f3.toURI().toURL();
491
        URL u = Utilities.toURI(f3).toURL();
491
        Library result = ProjectLibraryProvider.copyLibrary(l, u, false);
492
        Library result = ProjectLibraryProvider.copyLibrary(l, u, false);
492
        assertNotNull(result);
493
        assertNotNull(result);
493
        assertEquals(u, result.getManager().getLocation());
494
        assertEquals(u, result.getManager().getLocation());
Lines 497-516 Link Here
497
        assertEquals("vino", result.getName());
498
        assertEquals("vino", result.getName());
498
        assertEquals("j2test", result.getType());
499
        assertEquals("j2test", result.getType());
499
        //assertNotNull(LibrariesSupport.resolveLibraryEntryFileObject(u, result.getURIContent("jars").get(0)));
500
        //assertNotNull(LibrariesSupport.resolveLibraryEntryFileObject(u, result.getURIContent("jars").get(0)));
500
        assertEquals("jar:"+(new File(this.getWorkDir(), "libraries/vino/bertie.jar").toURI().toString())+"!/", 
501
        assertEquals("jar:"+(Utilities.toURI(new File(this.getWorkDir(), "libraries/vino/bertie.jar")).toString())+"!/",
501
                LibrariesSupport.resolveLibraryEntryURI(u, result.getURIContent("jars").get(0)).toString());
502
                LibrariesSupport.resolveLibraryEntryURI(u, result.getURIContent("jars").get(0)).toString());
502
        assertEquals("jar:"+(new File(this.getWorkDir(), "libraries/vino/bertie.jar").toURI().toString())+"!/", 
503
        assertEquals("jar:"+(Utilities.toURI(new File(this.getWorkDir(), "libraries/vino/bertie.jar")).toString())+"!/",
503
                result.getContent("jars").get(0).toExternalForm());
504
                result.getContent("jars").get(0).toExternalForm());
504
        //assertNotNull(LibrariesSupport.resolveLibraryEntryFileObject(u, result.getContent("sources").get(0)));
505
        //assertNotNull(LibrariesSupport.resolveLibraryEntryFileObject(u, result.getContent("sources").get(0)));
505
        assertEquals("jar:"+(new File(this.getWorkDir(), "libraries/vino/bertie-2.jar").toURI())+"!/docs/api/", 
506
        assertEquals("jar:"+(Utilities.toURI(new File(this.getWorkDir(), "libraries/vino/bertie-2.jar")))+"!/docs/api/",
506
                LibrariesSupport.resolveLibraryEntryURI(u, result.getURIContent("sources").get(0)).toString());
507
                LibrariesSupport.resolveLibraryEntryURI(u, result.getURIContent("sources").get(0)).toString());
507
        assertEquals("jar:"+(new File(this.getWorkDir(), "libraries/vino/bertie-2.jar").toURI())+"!/docs/api/", 
508
        assertEquals("jar:"+(Utilities.toURI(new File(this.getWorkDir(), "libraries/vino/bertie-2.jar")))+"!/docs/api/",
508
                result.getContent("sources").get(0).toExternalForm());
509
                result.getContent("sources").get(0).toExternalForm());
509
        // enable test collocation query:
510
        // enable test collocation query:
510
        MockLookup.setLookup(Lookups.fixed(AntBasedTestUtil.testAntBasedProjectType(), AntBasedTestUtil.testCollocationQueryImplementation(getWorkDir().toURI()), libraryProvider),
511
        MockLookup.setLookup(Lookups.fixed(AntBasedTestUtil.testAntBasedProjectType(), AntBasedTestUtil.testCollocationQueryImplementation(Utilities.toURI(getWorkDir())), libraryProvider),
511
                // Filter out standard CQIs since they are bogus.
512
                // Filter out standard CQIs since they are bogus.
512
                Lookups.exclude(Lookups.metaInfServices(ProjectLibraryProviderTest.class.getClassLoader()), CollocationQueryImplementation.class));
513
                Lookups.exclude(Lookups.metaInfServices(ProjectLibraryProviderTest.class.getClassLoader()), CollocationQueryImplementation.class));
513
        u = f4.toURI().toURL();
514
        u = Utilities.toURI(f4).toURL();
514
        result = ProjectLibraryProvider.copyLibrary(l, u, false);
515
        result = ProjectLibraryProvider.copyLibrary(l, u, false);
515
        assertNotNull(result);
516
        assertNotNull(result);
516
        assertEquals(u, result.getManager().getLocation());
517
        assertEquals(u, result.getManager().getLocation());
(-)a/project.ant/test/unit/src/org/netbeans/spi/project/support/ant/AntBasedTestUtil.java (-1 / +2 lines)
Lines 83-88 Link Here
83
import org.openide.filesystems.FileObject;
83
import org.openide.filesystems.FileObject;
84
import org.openide.util.ChangeSupport;
84
import org.openide.util.ChangeSupport;
85
import org.openide.util.Lookup;
85
import org.openide.util.Lookup;
86
import org.openide.util.Utilities;
86
import org.openide.util.lookup.Lookups;
87
import org.openide.util.lookup.Lookups;
87
import org.openide.xml.XMLUtil;
88
import org.openide.xml.XMLUtil;
88
import org.w3c.dom.Document;
89
import org.w3c.dom.Document;
Lines 326-332 Link Here
326
        if (!f.isFile()) {
327
        if (!f.isFile()) {
327
            return null;
328
            return null;
328
        }
329
        }
329
        return XMLUtil.parse(new InputSource(f.toURI().toString()), false, true, XMLUtil.defaultErrorHandler(), null);
330
        return XMLUtil.parse(new InputSource(Utilities.toURI(f).toString()), false, true, XMLUtil.defaultErrorHandler(), null);
330
    }
331
    }
331
    
332
    
332
    /**
333
    /**
(-)a/project.ant/test/unit/src/org/netbeans/spi/project/support/ant/AntProjectHelperTest.java (-2 / +3 lines)
Lines 67-72 Link Here
67
import org.openide.filesystems.FileUtil;
67
import org.openide.filesystems.FileUtil;
68
import org.openide.filesystems.test.TestFileUtils;
68
import org.openide.filesystems.test.TestFileUtils;
69
import org.openide.util.Mutex;
69
import org.openide.util.Mutex;
70
import org.openide.util.Utilities;
70
import org.openide.util.test.MockChangeListener;
71
import org.openide.util.test.MockChangeListener;
71
import org.openide.util.test.MockLookup;
72
import org.openide.util.test.MockLookup;
72
import org.openide.util.test.MockPropertyChangeListener;
73
import org.openide.util.test.MockPropertyChangeListener;
Lines 371-378 Link Here
371
        File somethingElseF = new File(scratchF.getParentFile(), "nonexistent-file-path");
372
        File somethingElseF = new File(scratchF.getParentFile(), "nonexistent-file-path");
372
        assertEquals("absolute (nonexistent) path is left alone", somethingElseF, h.resolveFile(somethingElseF.getAbsolutePath()));
373
        assertEquals("absolute (nonexistent) path is left alone", somethingElseF, h.resolveFile(somethingElseF.getAbsolutePath()));
373
        assertEquals("absolute (nonexistent) path has no file object", null, h.resolveFileObject(somethingElseF.getAbsolutePath()));
374
        assertEquals("absolute (nonexistent) path has no file object", null, h.resolveFileObject(somethingElseF.getAbsolutePath()));
374
        assertEquals("URI already normalized (Unix-style)", h.resolveFile("../proj").toURI().normalize().toURL(), h.resolveFile("../proj").toURI().toURL());
375
        assertEquals("URI already normalized (Unix-style)", Utilities.toURI(h.resolveFile("../proj")).normalize().toURL(), Utilities.toURI(h.resolveFile("../proj")).toURL());
375
        assertEquals("URI already normalized (DOS-style)", h.resolveFile("..\\proj").toURI().normalize().toURL(), h.resolveFile("..\\proj").toURI().toURL());
376
        assertEquals("URI already normalized (DOS-style)", Utilities.toURI(h.resolveFile("..\\proj")).normalize().toURL(), Utilities.toURI(h.resolveFile("..\\proj")).toURL());
376
    }
377
    }
377
    
378
    
378
    /**
379
    /**
(-)a/project.ant/test/unit/src/org/netbeans/spi/project/support/ant/EditablePropertiesTest.java (-1 / +2 lines)
Lines 55-60 Link Here
55
import java.net.URI;
55
import java.net.URI;
56
import java.net.URL;
56
import java.net.URL;
57
import org.netbeans.junit.NbTestCase;
57
import org.netbeans.junit.NbTestCase;
58
import org.openide.util.Utilities;
58
59
59
// here because AntBasedTestUtil.countTextDiffs cannot be moved to openide.util
60
// here because AntBasedTestUtil.countTextDiffs cannot be moved to openide.util
60
public class EditablePropertiesTest extends NbTestCase {
61
public class EditablePropertiesTest extends NbTestCase {
Lines 183-189 Link Here
183
    
184
    
184
    private String filenameOfTestProperties() {
185
    private String filenameOfTestProperties() {
185
        // #50987: never use URL.path for this purpose...
186
        // #50987: never use URL.path for this purpose...
186
        return new File(URI.create(EditablePropertiesTest.class.getResource("data/test.properties").toExternalForm())).getAbsolutePath();
187
        return Utilities.toFile(URI.create(EditablePropertiesTest.class.getResource("data/test.properties").toExternalForm())).getAbsolutePath();
187
    }
188
    }
188
    
189
    
189
    private EditableProperties loadTestProperties() throws IOException {
190
    private EditableProperties loadTestProperties() throws IOException {
(-)a/project.ant/test/unit/src/org/netbeans/spi/project/support/ant/ReferenceHelperTest.java (-4 / +5 lines)
Lines 71-76 Link Here
71
import org.netbeans.spi.queries.CollocationQueryImplementation;
71
import org.netbeans.spi.queries.CollocationQueryImplementation;
72
import org.openide.filesystems.FileObject;
72
import org.openide.filesystems.FileObject;
73
import org.openide.filesystems.FileUtil;
73
import org.openide.filesystems.FileUtil;
74
import org.openide.util.Utilities;
74
import org.openide.util.lookup.Lookups;
75
import org.openide.util.lookup.Lookups;
75
import org.openide.util.test.MockLookup;
76
import org.openide.util.test.MockLookup;
76
import org.openide.xml.XMLUtil;
77
import org.openide.xml.XMLUtil;
Lines 156-162 Link Here
156
        super.setUp();
157
        super.setUp();
157
        ClassLoader l = ReferenceHelper.class.getClassLoader();
158
        ClassLoader l = ReferenceHelper.class.getClassLoader();
158
        MockLookup.setLookup(
159
        MockLookup.setLookup(
159
            Lookups.fixed(AntBasedTestUtil.testAntBasedProjectType(), AntBasedTestUtil.testCollocationQueryImplementation(getWorkDir().toURI())),
160
            Lookups.fixed(AntBasedTestUtil.testAntBasedProjectType(), AntBasedTestUtil.testCollocationQueryImplementation(Utilities.toURI(getWorkDir()))),
160
            Lookups.singleton(l),
161
            Lookups.singleton(l),
161
            Lookups.exclude(Lookups.metaInfServices(l), CollocationQueryImplementation.class));
162
            Lookups.exclude(Lookups.metaInfServices(l), CollocationQueryImplementation.class));
162
        scratch = TestUtil.makeScratchDir(this);
163
        scratch = TestUtil.makeScratchDir(this);
Lines 1095-1105 Link Here
1095
        assertProjectLibraryManagers(null);
1096
        assertProjectLibraryManagers(null);
1096
        File fooJar = new File(getWorkDir(), "foo.jar");
1097
        File fooJar = new File(getWorkDir(), "foo.jar");
1097
        File f = new File(getWorkDir(), "libs.properties");
1098
        File f = new File(getWorkDir(), "libs.properties");
1098
        URL loc = f.toURI().toURL();
1099
        URL loc = Utilities.toURI(f).toURL();
1099
        LibraryManager mgr = LibraryManager.forLocation(loc);
1100
        LibraryManager mgr = LibraryManager.forLocation(loc);
1100
        assertEquals(loc, mgr.getLocation());
1101
        assertEquals(loc, mgr.getLocation());
1101
        Library fooLib = mgr.createLibrary("j2se", "foo",
1102
        Library fooLib = mgr.createLibrary("j2se", "foo",
1102
                Collections.singletonMap("classpath", Arrays.asList(new URL("jar:" + fooJar.toURI() + "!/"))));
1103
                Collections.singletonMap("classpath", Arrays.asList(new URL("jar:" + Utilities.toURI(fooJar) + "!/"))));
1103
        assertEquals(mgr, fooLib.getManager());
1104
        assertEquals(mgr, fooLib.getManager());
1104
        try {
1105
        try {
1105
            r.createLibraryReference(fooLib, "classpath");
1106
            r.createLibraryReference(fooLib, "classpath");
Lines 1120-1126 Link Here
1120
        File barDir = new File(getWorkDir(), "bar");
1121
        File barDir = new File(getWorkDir(), "bar");
1121
        barDir.mkdirs();
1122
        barDir.mkdirs();
1122
        String barref = r.createLibraryReference(mgr.createLibrary("j2se", "bar",
1123
        String barref = r.createLibraryReference(mgr.createLibrary("j2se", "bar",
1123
                Collections.singletonMap("classpath", Arrays.asList(barDir.toURI().toURL()))), "classpath");
1124
                Collections.singletonMap("classpath", Arrays.asList(Utilities.toURI(barDir).toURL()))), "classpath");
1124
        assertEquals("${libs.bar.classpath}", barref);
1125
        assertEquals("${libs.bar.classpath}", barref);
1125
        assertEquals(barDir.getAbsolutePath(), pev.evaluate(barref).replace('/', File.separatorChar));
1126
        assertEquals(barDir.getAbsolutePath(), pev.evaluate(barref).replace('/', File.separatorChar));
1126
        EditableProperties props = h.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH);
1127
        EditableProperties props = h.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH);
(-)a/project.ant/test/unit/src/org/netbeans/spi/project/support/ant/SharabilityQueryImplTest.java (-1 / +2 lines)
Lines 53-58 Link Here
53
import org.netbeans.spi.queries.SharabilityQueryImplementation2;
53
import org.netbeans.spi.queries.SharabilityQueryImplementation2;
54
import org.openide.filesystems.FileObject;
54
import org.openide.filesystems.FileObject;
55
import org.openide.filesystems.FileUtil;
55
import org.openide.filesystems.FileUtil;
56
import org.openide.util.Utilities;
56
import org.openide.util.test.MockLookup;
57
import org.openide.util.test.MockLookup;
57
58
58
/**
59
/**
Lines 94-100 Link Here
94
    }
95
    }
95
    
96
    
96
    private URI file(String path) {
97
    private URI file(String path) {
97
        return new File(scratchF, path.replace('/', File.separatorChar)).toURI();
98
        return Utilities.toURI(new File(scratchF, path.replace('/', File.separatorChar)));
98
    }
99
    }
99
    
100
    
100
    public void testBasicIncludesExcludes() throws Exception {
101
    public void testBasicIncludesExcludes() throws Exception {
(-)a/project.ant/test/unit/src/org/netbeans/spi/project/support/ant/SimpleAntArtifactTest.java (-1 / +2 lines)
Lines 54-59 Link Here
54
import org.netbeans.junit.NbTestCase;
54
import org.netbeans.junit.NbTestCase;
55
import org.openide.filesystems.FileObject;
55
import org.openide.filesystems.FileObject;
56
import org.openide.filesystems.FileUtil;
56
import org.openide.filesystems.FileUtil;
57
import org.openide.util.Utilities;
57
import org.openide.util.test.MockLookup;
58
import org.openide.util.test.MockLookup;
58
59
59
/**
60
/**
Lines 111-117 Link Here
111
        assertEquals("correct project", pm.findProject(sisterprojdir), art.getProject());
112
        assertEquals("correct project", pm.findProject(sisterprojdir), art.getProject());
112
        
113
        
113
        art = sisterh.createSimpleAntArtifact("jar", "build.jar.absolute", sisterh.getStandardPropertyEvaluator(), "dojar", "clean");
114
        art = sisterh.createSimpleAntArtifact("jar", "build.jar.absolute", sisterh.getStandardPropertyEvaluator(), "dojar", "clean");
114
        assertEquals("correct artifact location", (new File(getWorkDir().getAbsolutePath()+"/build/proj3.jar")).toURI(), art.getArtifactLocations()[0]);
115
        assertEquals("correct artifact location", Utilities.toURI((new File(getWorkDir().getAbsolutePath()+"/build/proj3.jar"))), art.getArtifactLocations()[0]);
115
    }
116
    }
116
    
117
    
117
}
118
}
(-)a/project.libraries/nbproject/project.xml (-1 / +1 lines)
Lines 135-141 Link Here
135
                    <build-prerequisite/>
135
                    <build-prerequisite/>
136
                    <compile-dependency/>
136
                    <compile-dependency/>
137
                    <run-dependency>
137
                    <run-dependency>
138
                        <specification-version>8.0</specification-version>
138
                        <specification-version>8.25</specification-version>
139
                    </run-dependency>
139
                    </run-dependency>
140
                </dependency>
140
                </dependency>
141
                <dependency>
141
                <dependency>
(-)a/project.libraries/src/org/netbeans/modules/project/libraries/ui/AllLibrariesCustomizer.java (-1 / +2 lines)
Lines 63-68 Link Here
63
import org.openide.util.HelpCtx;
63
import org.openide.util.HelpCtx;
64
import org.openide.util.Lookup;
64
import org.openide.util.Lookup;
65
import org.openide.util.NbBundle.Messages;
65
import org.openide.util.NbBundle.Messages;
66
import org.openide.util.Utilities;
66
67
67
class AllLibrariesCustomizer extends JPanel implements HelpCtx.Provider {
68
class AllLibrariesCustomizer extends JPanel implements HelpCtx.Provider {
68
    
69
    
Lines 155-161 Link Here
155
            try {
156
            try {
156
                //#131452 prevent space in path problem when converting to URL.
157
                //#131452 prevent space in path problem when converting to URL.
157
                File loc = FileUtil.normalizeFile(new File((String) libraryManagerComboBox.getModel().getSelectedItem()));
158
                File loc = FileUtil.normalizeFile(new File((String) libraryManagerComboBox.getModel().getSelectedItem()));
158
                u = loc.toURI().toURL();
159
                u = Utilities.toURI(loc).toURL();
159
            } catch (MalformedURLException ex) {
160
            } catch (MalformedURLException ex) {
160
                Exceptions.printStackTrace(ex);
161
                Exceptions.printStackTrace(ex);
161
            }
162
            }
(-)a/project.libraries/src/org/netbeans/modules/project/libraries/ui/LibrariesCustomizer.java (-1 / +1 lines)
Lines 327-333 Link Here
327
        LibraryStorageArea area = nodes[0].getLookup().lookup(LibraryStorageArea.class);
327
        LibraryStorageArea area = nodes[0].getLookup().lookup(LibraryStorageArea.class);
328
        if (area != null && area != LibrariesModel.GLOBAL_AREA) {
328
        if (area != null && area != LibrariesModel.GLOBAL_AREA) {
329
            customizerContext = new LibraryCustomizerContextWrapper(impl, area);
329
            customizerContext = new LibraryCustomizerContextWrapper(impl, area);
330
            File f = new File(URI.create(area.getLocation().toExternalForm()));
330
            File f = Utilities.toFile(URI.create(area.getLocation().toExternalForm()));
331
            this.libraryLocation.setText(f.getPath());
331
            this.libraryLocation.setText(f.getPath());
332
        } else {
332
        } else {
333
            customizerContext = new LibraryCustomizerContextWrapper(impl, null);
333
            customizerContext = new LibraryCustomizerContextWrapper(impl, null);
(-)a/project.libraries/src/org/netbeans/spi/project/libraries/support/LibrariesSupport.java (-27 / +13 lines)
Lines 54-63 Link Here
54
import org.netbeans.modules.project.libraries.DefaultLibraryImplementation;
54
import org.netbeans.modules.project.libraries.DefaultLibraryImplementation;
55
import org.netbeans.spi.project.libraries.LibraryTypeProvider;
55
import org.netbeans.spi.project.libraries.LibraryTypeProvider;
56
import org.openide.filesystems.FileObject;
56
import org.openide.filesystems.FileObject;
57
import org.openide.filesystems.FileUtil;
58
import org.openide.filesystems.URLMapper;
57
import org.openide.filesystems.URLMapper;
59
import org.openide.util.Exceptions;
58
import org.openide.util.Exceptions;
60
import org.openide.util.Parameters;
59
import org.openide.util.Parameters;
60
import org.openide.util.Utilities;
61
61
62
/**
62
/**
63
 * SPI Support class.
63
 * SPI Support class.
Lines 111-117 Link Here
111
        try {
111
        try {
112
            File f = new File(path);
112
            File f = new File(path);
113
            if (f.isAbsolute()) {
113
            if (f.isAbsolute()) {
114
                return f.toURI();
114
                return Utilities.toURI(f);
115
            } else {
115
            } else {
116
                // create hierarchical relative URI (that is no schema)
116
                // create hierarchical relative URI (that is no schema)
117
                return new URI(null, null, path.replace('\\', '/'), null);
117
                return new URI(null, null, path.replace('\\', '/'), null);
Lines 132-139 Link Here
132
     */
132
     */
133
    public static String convertURIToFilePath(URI uri) {
133
    public static String convertURIToFilePath(URI uri) {
134
        if (uri.isAbsolute()) {
134
        if (uri.isAbsolute()) {
135
            // uri.getPath() starts with extra slath, e.g. "/D:/path/"
135
            return Utilities.toFile(uri).getPath();
136
            return new File(uri).getPath();
137
        } else {
136
        } else {
138
            return uri.getPath().replace('/', File.separatorChar);
137
            return uri.getPath().replace('/', File.separatorChar);
139
        }
138
        }
Lines 176-207 Link Here
176
            if (!"file".equals(libraryLocation.getProtocol())) { //NOI18N
175
            if (!"file".equals(libraryLocation.getProtocol())) { //NOI18N
177
                throw new IllegalArgumentException("not file: protocol - "+libraryLocation.toExternalForm()); //NOI18N
176
                throw new IllegalArgumentException("not file: protocol - "+libraryLocation.toExternalForm()); //NOI18N
178
            }
177
            }
179
            File libLocation = new File(URI.create(libraryLocation.toExternalForm()));
178
            if (!libraryLocation.getPath().endsWith(".properties")) { //NOI18N
180
            if (!libLocation.getName().endsWith(".properties")) { //NOI18N
181
                throw new IllegalArgumentException("library location must be a file - "+libraryLocation.toExternalForm()); //NOI18N
179
                throw new IllegalArgumentException("library location must be a file - "+libraryLocation.toExternalForm()); //NOI18N
182
            }
180
            }
183
            File libBase = libLocation.getParentFile();
181
            URI resolved;
184
            /* Do not use URI.resolve because of http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4723726 (URI.normalize() ruins URI built from UNC File) */
182
            try {
185
            String jarFolder = null;
183
                resolved = libraryLocation.toURI().resolve(libraryEntry);
186
            String libEntryPath = libraryEntry.getPath();
184
            } catch (URISyntaxException x) {
187
            int index = libEntryPath.indexOf("!/");
185
                throw new AssertionError(x);
188
            if (index != -1) { // NOI18N
186
            }
189
                libEntryPath = libEntryPath.substring(0, index);
187
            if (libraryEntry.getPath().contains("!/")) {
190
                // use raw path instead because it will be append to URI as is:
188
                return URI.create("jar:" + resolved);
191
                jarFolder = libraryEntry.getRawPath().substring(libraryEntry.getRawPath().indexOf("!/")+2);
192
            }            
193
            URI resolvedPath = FileUtil.normalizeFile(new File(libBase, libEntryPath)).toURI();
194
            if (jarFolder != null) { // NOI18N
195
                return URI.create("jar:"+resolvedPath.toString()+"!/"+jarFolder); // NOI18N
196
            } else {
189
            } else {
197
                //If the original was a folder but translated not (non existing file) preserve /
190
                return resolved;
198
                final boolean relativeEndsWithSlash = libEntryPath.endsWith("/");     //NOI18N
199
                final String suri = resolvedPath.toString();
200
                final boolean absoluteEndsWithSlash = suri.endsWith("/");  //NOI18N
201
                if (relativeEndsWithSlash && !absoluteEndsWithSlash) {
202
                    resolvedPath = URI.create (suri+'/');    //NOI18N
203
                }
204
                return resolvedPath;
205
            }
191
            }
206
        }
192
        }
207
    }
193
    }
(-)a/project.libraries/test/unit/src/org/netbeans/spi/project/libraries/support/LibrariesSupportTest.java (-19 / +20 lines)
Lines 47-52 Link Here
47
import org.netbeans.junit.NbTestCase;
47
import org.netbeans.junit.NbTestCase;
48
import org.openide.filesystems.FileObject;
48
import org.openide.filesystems.FileObject;
49
import org.openide.filesystems.FileUtil;
49
import org.openide.filesystems.FileUtil;
50
import org.openide.util.Utilities;
50
51
51
public class LibrariesSupportTest extends NbTestCase {
52
public class LibrariesSupportTest extends NbTestCase {
52
53
Lines 65-71 Link Here
65
    public void testConvertFilePathToURI() throws Exception {
66
    public void testConvertFilePathToURI() throws Exception {
66
        String path = getWorkDirPath()+"/aa/bb/c c.ext".replace('/', File.separatorChar);
67
        String path = getWorkDirPath()+"/aa/bb/c c.ext".replace('/', File.separatorChar);
67
        URI u = LibrariesSupport.convertFilePathToURI(path);
68
        URI u = LibrariesSupport.convertFilePathToURI(path);
68
        assertEquals(FileUtil.normalizeFile(new File(path)).toURI(), u);
69
        assertEquals(Utilities.toURI(FileUtil.normalizeFile(new File(path))), u);
69
        path = "../zz/re l.ext".replace('/', File.separatorChar);
70
        path = "../zz/re l.ext".replace('/', File.separatorChar);
70
        u = LibrariesSupport.convertFilePathToURI(path);
71
        u = LibrariesSupport.convertFilePathToURI(path);
71
        assertEquals("../zz/re%20l.ext", u.toString());
72
        assertEquals("../zz/re%20l.ext", u.toString());
Lines 75-81 Link Here
75
     * Test of convertURLToFilePath method, of class LibrariesSupport.
76
     * Test of convertURLToFilePath method, of class LibrariesSupport.
76
     */
77
     */
77
    public void testConvertURIToFilePath() throws Exception{
78
    public void testConvertURIToFilePath() throws Exception{
78
        URI u = getWorkDir().toURI();
79
        URI u = Utilities.toURI(getWorkDir());
79
        String path = LibrariesSupport.convertURIToFilePath(u);
80
        String path = LibrariesSupport.convertURIToFilePath(u);
80
        assertEquals(getWorkDir().getPath(), path);
81
        assertEquals(getWorkDir().getPath(), path);
81
        u = new URI(null, null, "../zz/re l.ext", null);
82
        u = new URI(null, null, "../zz/re l.ext", null);
Lines 92-103 Link Here
92
        f.createNewFile();
93
        f.createNewFile();
93
        f2.createNewFile();
94
        f2.createNewFile();
94
        FileObject fo = LibrariesSupport.resolveLibraryEntryFileObject(
95
        FileObject fo = LibrariesSupport.resolveLibraryEntryFileObject(
95
                f.toURI().toURL(), 
96
                Utilities.toURI(f).toURL(),
96
                new URI(null, null, "bertie.jar", null));
97
                new URI(null, null, "bertie.jar", null));
97
        assertEquals(f2.getPath(), FileUtil.toFile(fo).getPath());
98
        assertEquals(f2.getPath(), FileUtil.toFile(fo).getPath());
98
        fo = LibrariesSupport.resolveLibraryEntryFileObject(
99
        fo = LibrariesSupport.resolveLibraryEntryFileObject(
99
                null, 
100
                null, 
100
                f2.toURI());
101
                Utilities.toURI(f2));
101
        assertEquals(f2.getPath(), FileUtil.toFile(fo).getPath());
102
        assertEquals(f2.getPath(), FileUtil.toFile(fo).getPath());
102
    }
103
    }
103
104
Lines 107-143 Link Here
107
        f.createNewFile();
108
        f.createNewFile();
108
        f2.createNewFile();
109
        f2.createNewFile();
109
        URI u = LibrariesSupport.resolveLibraryEntryURI(
110
        URI u = LibrariesSupport.resolveLibraryEntryURI(
110
                f.toURI().toURL(), 
111
                Utilities.toURI(f).toURL(),
111
                new URI(null, null, "ber tie.jar", null));
112
                new URI(null, null, "ber tie.jar", null));
112
        assertEquals(new File(f.getParentFile(), f2.getName()).toURI(), u);
113
        assertEquals(Utilities.toURI(new File(f.getParentFile(), f2.getName())), u);
113
        u = LibrariesSupport.resolveLibraryEntryURI(
114
        u = LibrariesSupport.resolveLibraryEntryURI(
114
                f.toURI().toURL(), 
115
                Utilities.toURI(f).toURL(),
115
                f2.toURI());
116
                Utilities.toURI(f2));
116
        assertEquals(f2.toURI(), u);
117
        assertEquals(Utilities.toURI(f2), u);
117
        u = LibrariesSupport.resolveLibraryEntryURI(
118
        u = LibrariesSupport.resolveLibraryEntryURI(
118
                f.toURI().toURL(), 
119
                Utilities.toURI(f).toURL(),
119
                new URI(null, null, "ber tie.jar!/main/ja va", null));
120
                new URI(null, null, "ber tie.jar!/main/ja va", null));
120
        assertEquals(new URI("jar:"+ (new File(f.getParentFile(), f2.getName()).toURI().toString()) + "!/main/ja%20va"), u);
121
        assertEquals(new URI("jar:"+ (Utilities.toURI(new File(f.getParentFile(), f2.getName())).toString()) + "!/main/ja%20va"), u);
121
        u = LibrariesSupport.resolveLibraryEntryURI(
122
        u = LibrariesSupport.resolveLibraryEntryURI(
122
                f.toURI().toURL(),
123
                Utilities.toURI(f).toURL(),
123
                new URI(null, null, "../"+getWorkDir().getName()+"/ber tie.jar!/main/ja va", null));
124
                new URI(null, null, "../"+getWorkDir().getName()+"/ber tie.jar!/main/ja va", null));
124
        assertEquals(new URI("jar:"+ (new File(f.getParentFile(), f2.getName()).toURI().toString()) + "!/main/ja%20va"), u);
125
        assertEquals(new URI("jar:"+ (Utilities.toURI(new File(f.getParentFile(), f2.getName())).toString()) + "!/main/ja%20va"), u);
125
        u = LibrariesSupport.resolveLibraryEntryURI(
126
        u = LibrariesSupport.resolveLibraryEntryURI(
126
                f.toURI().toURL(),
127
                Utilities.toURI(f).toURL(),
127
                new URI(null, null, "../a folder/", null));
128
                new URI(null, null, "../a folder/", null));
128
        assertEquals(new URI(new File(getWorkDir().getParentFile(), "a folder").toURI().toString() + "/"), u);
129
        assertEquals(new URI(Utilities.toURI(new File(getWorkDir().getParentFile(), "a folder")).toString() + "/"), u);
129
        // UNC paths
130
        // UNC paths
130
        URI uncBaseURI = URI.create("file:////computerName/sharedFolder/a/b/c/d.properties");
131
        URI uncBaseURI = URI.create("file://computerName/sharedFolder/a/b/c/d.properties");
131
        URI uncEntryURI = URI.create("e/e.jar");
132
        URI uncEntryURI = URI.create("e/e.jar");
132
        URI expectedURI = new File(new File(uncBaseURI).getParent(), uncEntryURI.getPath()).toURI();
133
        URI expectedURI = URI.create("file://computerName/sharedFolder/a/b/c/e/e.jar");
133
        URI resolvedURI = LibrariesSupport.resolveLibraryEntryURI(uncBaseURI.toURL(), uncEntryURI);
134
        URI resolvedURI = LibrariesSupport.resolveLibraryEntryURI(uncBaseURI.toURL(), uncEntryURI);
134
        assertEquals("UNC entry wrongly resolved.", expectedURI, resolvedURI);
135
        assertEquals("UNC entry wrongly resolved.", expectedURI, resolvedURI);
135
        uncEntryURI = new URI(null, null, "e/e.jar!/f f/f", null);
136
        uncEntryURI = new URI(null, null, "e/e.jar!/f f/f", null);
136
        expectedURI = URI.create("jar:"+new File(new File(uncBaseURI).getParent(), uncEntryURI.getPath()).toURI().toString());
137
        expectedURI = URI.create("jar:file://computerName/sharedFolder/a/b/c/e/e.jar!/f%20f/f");
137
        resolvedURI = LibrariesSupport.resolveLibraryEntryURI(uncBaseURI.toURL(), uncEntryURI);
138
        resolvedURI = LibrariesSupport.resolveLibraryEntryURI(uncBaseURI.toURL(), uncEntryURI);
138
        assertEquals("UNC jar entry wrongly resolved.", expectedURI, resolvedURI);
139
        assertEquals("UNC jar entry wrongly resolved.", expectedURI, resolvedURI);
139
        uncEntryURI = new URI(null, null, "e/e.jar!/", null);
140
        uncEntryURI = new URI(null, null, "e/e.jar!/", null);
140
        expectedURI = URI.create("jar:"+new File(new File(uncBaseURI).getParent()).toURI().toString()+"/e/e.jar!/");
141
        expectedURI = URI.create("jar:file://computerName/sharedFolder/a/b/c/e/e.jar!/");
141
        resolvedURI = LibrariesSupport.resolveLibraryEntryURI(uncBaseURI.toURL(), uncEntryURI);
142
        resolvedURI = LibrariesSupport.resolveLibraryEntryURI(uncBaseURI.toURL(), uncEntryURI);
142
        assertEquals("UNC jar entry wrongly resolved.", expectedURI, resolvedURI);   
143
        assertEquals("UNC jar entry wrongly resolved.", expectedURI, resolvedURI);   
143
    }
144
    }
(-)a/projectapi/nbproject/project.xml (-1 / +1 lines)
Lines 104-110 Link Here
104
                    <build-prerequisite/>
104
                    <build-prerequisite/>
105
                    <compile-dependency/>
105
                    <compile-dependency/>
106
                    <run-dependency>
106
                    <run-dependency>
107
                        <specification-version>8.4</specification-version>
107
                        <specification-version>8.25</specification-version>
108
                    </run-dependency>
108
                    </run-dependency>
109
                </dependency>
109
                </dependency>
110
                <dependency>
110
                <dependency>
(-)a/projectapi/src/org/netbeans/api/project/FileOwnerQuery.java (-1 / +2 lines)
Lines 60-65 Link Here
60
import org.openide.util.Lookup;
60
import org.openide.util.Lookup;
61
import org.openide.util.LookupEvent;
61
import org.openide.util.LookupEvent;
62
import org.openide.util.LookupListener;
62
import org.openide.util.LookupListener;
63
import org.openide.util.Utilities;
63
64
64
/**
65
/**
65
 * Find the project which owns a file.
66
 * Find the project which owns a file.
Lines 135-141 Link Here
135
                try {
136
                try {
136
                    URL u = new URL(schemaPart);
137
                    URL u = new URL(schemaPart);
137
                    // XXX bad to ever use new File(URL.getPath()):
138
                    // XXX bad to ever use new File(URL.getPath()):
138
                    uri = new File(u.getPath()).toURI();
139
                    uri = Utilities.toURI(new File(u.getPath()));
139
                } catch (MalformedURLException ex2) {
140
                } catch (MalformedURLException ex2) {
140
                    ex2.printStackTrace();
141
                    ex2.printStackTrace();
141
                    assert false : schemaPart;
142
                    assert false : schemaPart;
(-)a/projectapi/src/org/netbeans/modules/projectapi/ProjectSharabilityQuery.java (-1 / +2 lines)
Lines 48-53 Link Here
48
import org.netbeans.api.project.FileOwnerQuery;
48
import org.netbeans.api.project.FileOwnerQuery;
49
import org.netbeans.api.project.Project;
49
import org.netbeans.api.project.Project;
50
import org.netbeans.api.queries.SharabilityQuery;
50
import org.netbeans.api.queries.SharabilityQuery;
51
import org.openide.util.Utilities;
51
52
52
/**
53
/**
53
 * Delegates {@link SharabilityQuery} to implementations in project lookup.
54
 * Delegates {@link SharabilityQuery} to implementations in project lookup.
Lines 60-66 Link Here
60
    public ProjectSharabilityQuery() {}
61
    public ProjectSharabilityQuery() {}
61
    
62
    
62
    public @Override int getSharability(File file) {
63
    public @Override int getSharability(File file) {
63
        Project p = FileOwnerQuery.getOwner(file.toURI());
64
        Project p = FileOwnerQuery.getOwner(Utilities.toURI(file));
64
        if (p != null) {
65
        if (p != null) {
65
            org.netbeans.spi.queries.SharabilityQueryImplementation sqi = p.getLookup().lookup(org.netbeans.spi.queries.SharabilityQueryImplementation.class);
66
            org.netbeans.spi.queries.SharabilityQueryImplementation sqi = p.getLookup().lookup(org.netbeans.spi.queries.SharabilityQueryImplementation.class);
66
            if (sqi != null) {
67
            if (sqi != null) {
(-)a/projectapi/test/unit/src/org/netbeans/api/project/FileOwnerQueryTest.java (-6 / +7 lines)
Lines 52-57 Link Here
52
import org.openide.filesystems.FileObject;
52
import org.openide.filesystems.FileObject;
53
import org.openide.filesystems.FileUtil;
53
import org.openide.filesystems.FileUtil;
54
import org.openide.filesystems.test.TestFileUtils;
54
import org.openide.filesystems.test.TestFileUtils;
55
import org.openide.util.Utilities;
55
import org.openide.util.test.MockLookup;
56
import org.openide.util.test.MockLookup;
56
57
57
/**
58
/**
Lines 123-143 Link Here
123
    
124
    
124
    public void testFileOwner() throws Exception {
125
    public void testFileOwner() throws Exception {
125
        assertEquals("correct project from projfile FileObject", p, FileOwnerQuery.getOwner(projfile));
126
        assertEquals("correct project from projfile FileObject", p, FileOwnerQuery.getOwner(projfile));
126
        URI u = FileUtil.toFile(projfile).toURI();
127
        URI u = Utilities.toURI(FileUtil.toFile(projfile));
127
        assertEquals("correct project from projfile URI " + u, p, FileOwnerQuery.getOwner(u));
128
        assertEquals("correct project from projfile URI " + u, p, FileOwnerQuery.getOwner(u));
128
        assertEquals("correct project from projfile2 FileObject", p, FileOwnerQuery.getOwner(projfile2));
129
        assertEquals("correct project from projfile2 FileObject", p, FileOwnerQuery.getOwner(projfile2));
129
        assertEquals("correct project from projfile2 URI", p, FileOwnerQuery.getOwner(FileUtil.toFile(projfile2).toURI()));
130
        assertEquals("correct project from projfile2 URI", p, FileOwnerQuery.getOwner(Utilities.toURI(FileUtil.toFile(projfile2))));
130
        assertEquals("correct project from projdir FileObject", p, FileOwnerQuery.getOwner(projdir));
131
        assertEquals("correct project from projdir FileObject", p, FileOwnerQuery.getOwner(projdir));
131
        assertEquals("correct project from projdir URI", p, FileOwnerQuery.getOwner(FileUtil.toFile(projdir).toURI()));
132
        assertEquals("correct project from projdir URI", p, FileOwnerQuery.getOwner(Utilities.toURI(FileUtil.toFile(projdir))));
132
        // Check that it loads the project even though we have not touched it yet:
133
        // Check that it loads the project even though we have not touched it yet:
133
        Project p2 = FileOwnerQuery.getOwner(subprojfile);
134
        Project p2 = FileOwnerQuery.getOwner(subprojfile);
134
        Project subproj = ProjectManager.getDefault().findProject(subprojdir);
135
        Project subproj = ProjectManager.getDefault().findProject(subprojdir);
135
        assertEquals("correct project from subprojdir FileObject", subproj, p2);
136
        assertEquals("correct project from subprojdir FileObject", subproj, p2);
136
        assertEquals("correct project from subprojdir URI", subproj, FileOwnerQuery.getOwner(FileUtil.toFile(subprojdir).toURI()));
137
        assertEquals("correct project from subprojdir URI", subproj, FileOwnerQuery.getOwner(Utilities.toURI(FileUtil.toFile(subprojdir))));
137
        assertEquals("correct project from subprojfile FileObject", subproj, FileOwnerQuery.getOwner(subprojfile));
138
        assertEquals("correct project from subprojfile FileObject", subproj, FileOwnerQuery.getOwner(subprojfile));
138
        assertEquals("correct project from subprojfile URI", subproj, FileOwnerQuery.getOwner(FileUtil.toFile(subprojfile).toURI()));
139
        assertEquals("correct project from subprojfile URI", subproj, FileOwnerQuery.getOwner(Utilities.toURI(FileUtil.toFile(subprojfile))));
139
        assertEquals("no project from randomfile FileObject", null, FileOwnerQuery.getOwner(randomfile));
140
        assertEquals("no project from randomfile FileObject", null, FileOwnerQuery.getOwner(randomfile));
140
        assertEquals("no project from randomfile URI", null, FileOwnerQuery.getOwner(FileUtil.toFile(randomfile).toURI()));
141
        assertEquals("no project from randomfile URI", null, FileOwnerQuery.getOwner(Utilities.toURI(FileUtil.toFile(randomfile))));
141
        assertEquals("no project in C:\\", null, FileOwnerQuery.getOwner(URI.create("file:/C:/")));
142
        assertEquals("no project in C:\\", null, FileOwnerQuery.getOwner(URI.create("file:/C:/")));
142
    }
143
    }
143
    
144
    
(-)a/projectui/nbproject/project.xml (-1 / +1 lines)
Lines 215-221 Link Here
215
                    <build-prerequisite/>
215
                    <build-prerequisite/>
216
                    <compile-dependency/>
216
                    <compile-dependency/>
217
                    <run-dependency>
217
                    <run-dependency>
218
                        <specification-version>8.6</specification-version>
218
                        <specification-version>8.25</specification-version>
219
                    </run-dependency>
219
                    </run-dependency>
220
                </dependency>
220
                </dependency>
221
                <dependency>
221
                <dependency>
(-)a/projectui/src/org/netbeans/modules/project/ui/ProjectChooserAccessory.java (-1 / +2 lines)
Lines 80-85 Link Here
80
import org.openide.util.Exceptions;
80
import org.openide.util.Exceptions;
81
import org.openide.util.NbBundle;
81
import org.openide.util.NbBundle;
82
import org.openide.util.RequestProcessor;
82
import org.openide.util.RequestProcessor;
83
import org.openide.util.Utilities;
83
84
84
/**
85
/**
85
 * Special component on side of project filechooser.
86
 * Special component on side of project filechooser.
Lines 393-399 Link Here
393
            }
394
            }
394
            b.append("../"); // NOI18N
395
            b.append("../"); // NOI18N
395
        }
396
        }
396
        URI u = base.toURI().relativize(f2.toURI());
397
        URI u = Utilities.toURI(base).relativize(Utilities.toURI(f2));
397
        assert !u.isAbsolute() : u + " from " + f1 + " and " + f2 + " with common root " + base;
398
        assert !u.isAbsolute() : u + " from " + f1 + " and " + f2 + " with common root " + base;
398
        b.append(u.getPath());
399
        b.append(u.getPath());
399
        if (b.charAt(b.length() - 1) == '/') {
400
        if (b.charAt(b.length() - 1) == '/') {
(-)a/projectui/src/org/netbeans/modules/project/ui/zip/ExportZIP.java (-1 / +1 lines)
Lines 210-216 Link Here
210
            }
210
            }
211
            boolean kidMixed;
211
            boolean kidMixed;
212
            if (mixedSharability) {
212
            if (mixedSharability) {
213
                switch (SharabilityQuery.getSharability(kid.toURI())) {
213
                switch (SharabilityQuery.getSharability(Utilities.toURI(kid))) {
214
                case SHARABLE:
214
                case SHARABLE:
215
                    kidMixed = false;
215
                    kidMixed = false;
216
                    break;
216
                    break;
(-)a/projectui/src/org/netbeans/modules/project/ui/zip/ImportZIP.java (-1 / +2 lines)
Lines 82-87 Link Here
82
import org.openide.util.Cancellable;
82
import org.openide.util.Cancellable;
83
import org.openide.util.NbBundle.Messages;
83
import org.openide.util.NbBundle.Messages;
84
import org.openide.util.RequestProcessor;
84
import org.openide.util.RequestProcessor;
85
import org.openide.util.Utilities;
85
86
86
public class ImportZIP extends JPanel {
87
public class ImportZIP extends JPanel {
87
88
Lines 224-230 Link Here
224
            return false;
225
            return false;
225
        }
226
        }
226
        try {
227
        try {
227
            if (!FileUtil.isArchiveFile(zip.toURI().toURL())) {
228
            if (!FileUtil.isArchiveFile(Utilities.toURI(zip).toURL())) {
228
                notifications.setErrorMessage(ERR_not_zip(zip));
229
                notifications.setErrorMessage(ERR_not_zip(zip));
229
                return false;
230
                return false;
230
            }
231
            }
(-)a/queries/nbproject/project.xml (-1 / +1 lines)
Lines 62-68 Link Here
62
                    <build-prerequisite/>
62
                    <build-prerequisite/>
63
                    <compile-dependency/>
63
                    <compile-dependency/>
64
                    <run-dependency>
64
                    <run-dependency>
65
                        <specification-version>8.0</specification-version>
65
                        <specification-version>8.25</specification-version>
66
                    </run-dependency>
66
                    </run-dependency>
67
                </dependency>
67
                </dependency>
68
                <dependency>
68
                <dependency>
(-)a/queries/src/org/netbeans/api/queries/CollocationQuery.java (-8 / +9 lines)
Lines 49-54 Link Here
49
import org.netbeans.spi.queries.CollocationQueryImplementation2;
49
import org.netbeans.spi.queries.CollocationQueryImplementation2;
50
import org.openide.filesystems.FileUtil;
50
import org.openide.filesystems.FileUtil;
51
import org.openide.util.Lookup;
51
import org.openide.util.Lookup;
52
import org.openide.util.Utilities;
52
53
53
/**
54
/**
54
 * Find out whether some files logically belong in one directory tree,
55
 * Find out whether some files logically belong in one directory tree,
Lines 85-92 Link Here
85
            throw new IllegalArgumentException("Parameter file2 was not "+  // NOI18N
86
            throw new IllegalArgumentException("Parameter file2 was not "+  // NOI18N
86
                "normalized. Was "+file2+" instead of "+FileUtil.normalizeFile(file2));  // NOI18N
87
                "normalized. Was "+file2+" instead of "+FileUtil.normalizeFile(file2));  // NOI18N
87
        }
88
        }
88
        URI uri1 = file1.toURI();
89
        URI uri1 = Utilities.toURI(file1);
89
        URI uri2 = file2.toURI();
90
        URI uri2 = Utilities.toURI(file2);
90
        for (CollocationQueryImplementation2 cqi : implementations2.allInstances()) {
91
        for (CollocationQueryImplementation2 cqi : implementations2.allInstances()) {
91
            if (cqi.areCollocated(uri1, uri2)) {
92
            if (cqi.areCollocated(uri1, uri2)) {
92
                return true;
93
                return true;
Lines 125-132 Link Here
125
            }
126
            }
126
        }
127
        }
127
        if ("file".equals(file1.getScheme()) && "file".equals(file2.getScheme())) { // NOI18N
128
        if ("file".equals(file1.getScheme()) && "file".equals(file2.getScheme())) { // NOI18N
128
            File f1 = FileUtil.normalizeFile(new File(file1));
129
            File f1 = FileUtil.normalizeFile(Utilities.toFile(file1));
129
            File f2 = FileUtil.normalizeFile(new File(file2));
130
            File f2 = FileUtil.normalizeFile(Utilities.toFile(file2));
130
            for (org.netbeans.spi.queries.CollocationQueryImplementation cqi : implementations.allInstances()) {
131
            for (org.netbeans.spi.queries.CollocationQueryImplementation cqi : implementations.allInstances()) {
131
                if (cqi.areCollocated(f1, f2)) {
132
                if (cqi.areCollocated(f1, f2)) {
132
                    return true;
133
                    return true;
Lines 148-158 Link Here
148
            throw new IllegalArgumentException("Parameter file was not "+  // NOI18N
149
            throw new IllegalArgumentException("Parameter file was not "+  // NOI18N
149
                "normalized. Was "+file+" instead of "+FileUtil.normalizeFile(file));  // NOI18N
150
                "normalized. Was "+file+" instead of "+FileUtil.normalizeFile(file));  // NOI18N
150
        }
151
        }
151
        URI uri = file.toURI();
152
        URI uri = Utilities.toURI(file);
152
        for (CollocationQueryImplementation2 cqi : implementations2.allInstances()) {
153
        for (CollocationQueryImplementation2 cqi : implementations2.allInstances()) {
153
            URI root = cqi.findRoot(uri);
154
            URI root = cqi.findRoot(uri);
154
            if (root != null) {
155
            if (root != null) {
155
                return new File(root);
156
                return Utilities.toFile(root);
156
            }
157
            }
157
        }
158
        }
158
        for (org.netbeans.spi.queries.CollocationQueryImplementation cqi : implementations.allInstances()) {
159
        for (org.netbeans.spi.queries.CollocationQueryImplementation cqi : implementations.allInstances()) {
Lines 183-193 Link Here
183
            }
184
            }
184
        }
185
        }
185
        if ("file".equals(file.getScheme())) { // NOI18N
186
        if ("file".equals(file.getScheme())) { // NOI18N
186
            File f = FileUtil.normalizeFile(new File(file));
187
            File f = FileUtil.normalizeFile(Utilities.toFile(file));
187
            for (org.netbeans.spi.queries.CollocationQueryImplementation cqi : implementations.allInstances()) {
188
            for (org.netbeans.spi.queries.CollocationQueryImplementation cqi : implementations.allInstances()) {
188
                File root = cqi.findRoot(f);
189
                File root = cqi.findRoot(f);
189
                if (root != null) {
190
                if (root != null) {
190
                    return root.toURI();
191
                    return Utilities.toURI(root);
191
                }
192
                }
192
            }
193
            }
193
        }
194
        }
(-)a/queries/src/org/netbeans/api/queries/SharabilityQuery.java (-2 / +2 lines)
Lines 172-178 Link Here
172
        URI uri = null;
172
        URI uri = null;
173
        for (SharabilityQueryImplementation2 sqi : implementations2.allInstances()) {
173
        for (SharabilityQueryImplementation2 sqi : implementations2.allInstances()) {
174
            if (uri == null) {
174
            if (uri == null) {
175
                uri = file.toURI();
175
                uri = Utilities.toURI(file);
176
            }
176
            }
177
            Sharability x = sqi.getSharability(uri);
177
            Sharability x = sqi.getSharability(uri);
178
            if (x != Sharability.UNKNOWN) {
178
            if (x != Sharability.UNKNOWN) {
Lines 211-217 Link Here
211
            }
211
            }
212
        }
212
        }
213
        if ("file".equals(uri.getScheme())) { // NOI18N
213
        if ("file".equals(uri.getScheme())) { // NOI18N
214
            File file = FileUtil.normalizeFile(new File(uri));
214
            File file = FileUtil.normalizeFile(Utilities.toFile(uri));
215
            for (org.netbeans.spi.queries.SharabilityQueryImplementation sqi : implementations.allInstances()) {
215
            for (org.netbeans.spi.queries.SharabilityQueryImplementation sqi : implementations.allInstances()) {
216
                int x = sqi.getSharability(file);
216
                int x = sqi.getSharability(file);
217
                if (x != UNKNOWN) {
217
                if (x != UNKNOWN) {
(-)a/queries/test/unit/src/org/netbeans/api/queries/CollocationQuery2Test.java (-13 / +14 lines)
Lines 47-52 Link Here
47
import org.netbeans.junit.MockServices;
47
import org.netbeans.junit.MockServices;
48
import org.netbeans.junit.NbTestCase;
48
import org.netbeans.junit.NbTestCase;
49
import org.netbeans.spi.queries.CollocationQueryImplementation2;
49
import org.netbeans.spi.queries.CollocationQueryImplementation2;
50
import org.openide.util.Utilities;
50
51
51
/**
52
/**
52
 *
53
 *
Lines 74-110 Link Here
74
        File proj2 = new File(base, "proj2");
75
        File proj2 = new File(base, "proj2");
75
        proj2.mkdirs();
76
        proj2.mkdirs();
76
        assertTrue("Must be collocated", CollocationQuery.areCollocated(proj1, proj3));
77
        assertTrue("Must be collocated", CollocationQuery.areCollocated(proj1, proj3));
77
        assertTrue("Must be collocated", CollocationQuery.areCollocated(proj1.toURI(), proj3.toURI()));
78
        assertTrue("Must be collocated", CollocationQuery.areCollocated(Utilities.toURI(proj1), Utilities.toURI(proj3)));
78
        assertTrue("Must be collocated", CollocationQuery.areCollocated(proj3, proj1));
79
        assertTrue("Must be collocated", CollocationQuery.areCollocated(proj3, proj1));
79
        assertTrue("Must be collocated", CollocationQuery.areCollocated(proj3.toURI(), proj1.toURI()));
80
        assertTrue("Must be collocated", CollocationQuery.areCollocated(Utilities.toURI(proj3), Utilities.toURI(proj1)));
80
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(proj1, proj2));
81
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(proj1, proj2));
81
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(proj1.toURI(), proj2.toURI()));
82
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(Utilities.toURI(proj1), Utilities.toURI(proj2)));
82
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(proj2, proj1));
83
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(proj2, proj1));
83
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(proj2.toURI(), proj1.toURI()));
84
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(Utilities.toURI(proj2), Utilities.toURI(proj1)));
84
        
85
        
85
        // folder does not exist:
86
        // folder does not exist:
86
        File proj4 = new File(base, "proj");
87
        File proj4 = new File(base, "proj");
87
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(proj1, proj4));
88
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(proj1, proj4));
88
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(proj1.toURI(), proj4.toURI()));
89
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(Utilities.toURI(proj1), Utilities.toURI(proj4)));
89
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(proj4, proj1));
90
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(proj4, proj1));
90
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(proj4.toURI(), proj1.toURI()));
91
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(Utilities.toURI(proj4), Utilities.toURI(proj1)));
91
        proj4.mkdirs();
92
        proj4.mkdirs();
92
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(proj1, proj4));
93
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(proj1, proj4));
93
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(proj1.toURI(), proj4.toURI()));
94
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(Utilities.toURI(proj1), Utilities.toURI(proj4)));
94
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(proj4, proj1));
95
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(proj4, proj1));
95
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(proj4.toURI(), proj1.toURI()));
96
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(Utilities.toURI(proj4), Utilities.toURI(proj1)));
96
        
97
        
97
        // files do not exist:
98
        // files do not exist:
98
        File file1 = new File(base, "file1.txt");
99
        File file1 = new File(base, "file1.txt");
99
        File file2 = new File(base, "file1");
100
        File file2 = new File(base, "file1");
100
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(file1, file2));
101
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(file1, file2));
101
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(file1.toURI(), file2.toURI()));
102
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(Utilities.toURI(file1), Utilities.toURI(file2)));
102
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(file2, file1));
103
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(file2, file1));
103
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(file2.toURI(), file1.toURI()));
104
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(Utilities.toURI(file2), Utilities.toURI(file1)));
104
        
105
        
105
        // passing the same parameter
106
        // passing the same parameter
106
        assertTrue("A file must be collocated with itself", CollocationQuery.areCollocated(proj1, proj1));
107
        assertTrue("A file must be collocated with itself", CollocationQuery.areCollocated(proj1, proj1));
107
        assertTrue("A file must be collocated with itself", CollocationQuery.areCollocated(proj1.toURI(), proj1.toURI()));
108
        assertTrue("A file must be collocated with itself", CollocationQuery.areCollocated(Utilities.toURI(proj1), Utilities.toURI(proj1)));
108
    }
109
    }
109
110
110
    public static class CollocationQueryImplementation2Impl implements CollocationQueryImplementation2 {
111
    public static class CollocationQueryImplementation2Impl implements CollocationQueryImplementation2 {
Lines 114-121 Link Here
114
            if (uri1.equals(uri2)) {
115
            if (uri1.equals(uri2)) {
115
                return true;
116
                return true;
116
            }
117
            }
117
            File file1 = new File(uri1);
118
            File file1 = Utilities.toFile(uri1);
118
            File file2 = new File(uri2);
119
            File file2 = Utilities.toFile(uri2);
119
            String f1 = file1.getPath();
120
            String f1 = file1.getPath();
120
            if ((file1.isDirectory() || !file1.exists()) && !f1.endsWith(File.separator)) {
121
            if ((file1.isDirectory() || !file1.exists()) && !f1.endsWith(File.separator)) {
121
                f1 += File.separatorChar;
122
                f1 += File.separatorChar;
(-)a/queries/test/unit/src/org/netbeans/api/queries/CollocationQueryTest.java (-11 / +12 lines)
Lines 44-49 Link Here
44
import java.io.File;
44
import java.io.File;
45
import java.io.IOException;
45
import java.io.IOException;
46
import org.netbeans.junit.NbTestCase;
46
import org.netbeans.junit.NbTestCase;
47
import org.openide.util.Utilities;
47
48
48
/**
49
/**
49
 *
50
 *
Lines 70-106 Link Here
70
        File proj2 = new File(base, "proj2");
71
        File proj2 = new File(base, "proj2");
71
        proj2.mkdirs();
72
        proj2.mkdirs();
72
        assertTrue("Must be collocated", CollocationQuery.areCollocated(proj1, proj3));
73
        assertTrue("Must be collocated", CollocationQuery.areCollocated(proj1, proj3));
73
        assertTrue("Must be collocated", CollocationQuery.areCollocated(proj1.toURI(), proj3.toURI()));
74
        assertTrue("Must be collocated", CollocationQuery.areCollocated(Utilities.toURI(proj1), Utilities.toURI(proj3)));
74
        assertTrue("Must be collocated", CollocationQuery.areCollocated(proj3, proj1));
75
        assertTrue("Must be collocated", CollocationQuery.areCollocated(proj3, proj1));
75
        assertTrue("Must be collocated", CollocationQuery.areCollocated(proj3.toURI(), proj1.toURI()));
76
        assertTrue("Must be collocated", CollocationQuery.areCollocated(Utilities.toURI(proj3), Utilities.toURI(proj1)));
76
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(proj1, proj2));
77
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(proj1, proj2));
77
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(proj1.toURI(), proj2.toURI()));
78
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(Utilities.toURI(proj1), Utilities.toURI(proj2)));
78
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(proj2, proj1));
79
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(proj2, proj1));
79
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(proj2.toURI(), proj1.toURI()));
80
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(Utilities.toURI(proj2), Utilities.toURI(proj1)));
80
        
81
        
81
        // folder does not exist:
82
        // folder does not exist:
82
        File proj4 = new File(base, "proj");
83
        File proj4 = new File(base, "proj");
83
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(proj1, proj4));
84
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(proj1, proj4));
84
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(proj1.toURI(), proj4.toURI()));
85
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(Utilities.toURI(proj1), Utilities.toURI(proj4)));
85
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(proj4, proj1));
86
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(proj4, proj1));
86
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(proj4.toURI(), proj1.toURI()));
87
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(Utilities.toURI(proj4), Utilities.toURI(proj1)));
87
        proj4.mkdirs();
88
        proj4.mkdirs();
88
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(proj1, proj4));
89
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(proj1, proj4));
89
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(proj1.toURI(), proj4.toURI()));
90
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(Utilities.toURI(proj1), Utilities.toURI(proj4)));
90
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(proj4, proj1));
91
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(proj4, proj1));
91
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(proj4.toURI(), proj1.toURI()));
92
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(Utilities.toURI(proj4), Utilities.toURI(proj1)));
92
        
93
        
93
        // files do not exist:
94
        // files do not exist:
94
        File file1 = new File(base, "file1.txt");
95
        File file1 = new File(base, "file1.txt");
95
        File file2 = new File(base, "file1");
96
        File file2 = new File(base, "file1");
96
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(file1, file2));
97
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(file1, file2));
97
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(file1.toURI(), file2.toURI()));
98
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(Utilities.toURI(file1), Utilities.toURI(file2)));
98
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(file2, file1));
99
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(file2, file1));
99
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(file2.toURI(), file1.toURI()));
100
        assertFalse("Cannot be collocated", CollocationQuery.areCollocated(Utilities.toURI(file2), Utilities.toURI(file1)));
100
        
101
        
101
        // passing the same parameter
102
        // passing the same parameter
102
        assertTrue("A file must be collocated with itself", CollocationQuery.areCollocated(proj1, proj1));
103
        assertTrue("A file must be collocated with itself", CollocationQuery.areCollocated(proj1, proj1));
103
        assertTrue("A file must be collocated with itself", CollocationQuery.areCollocated(proj1.toURI(), proj1.toURI()));
104
        assertTrue("A file must be collocated with itself", CollocationQuery.areCollocated(Utilities.toURI(proj1), Utilities.toURI(proj1)));
104
    }
105
    }
105
106
106
}
107
}
(-)a/queries/test/unit/src/org/netbeans/api/queries/FileEncodingQueryTest.java (-3 / +4 lines)
Lines 82-87 Link Here
82
import org.openide.filesystems.FileLock;
82
import org.openide.filesystems.FileLock;
83
import org.openide.filesystems.FileObject;
83
import org.openide.filesystems.FileObject;
84
import org.openide.filesystems.FileUtil;
84
import org.openide.filesystems.FileUtil;
85
import org.openide.util.Utilities;
85
86
86
/**
87
/**
87
 *
88
 *
Lines 118-124 Link Here
118
    
119
    
119
    public static Test suite () throws Exception {
120
    public static Test suite () throws Exception {
120
        URL url = FileEncodingQueryTest.class.getResource("data");        
121
        URL url = FileEncodingQueryTest.class.getResource("data");        
121
        File dataFolder = new File(URI.create(url.toExternalForm()));
122
        File dataFolder = Utilities.toFile(URI.create(url.toExternalForm()));
122
        assertTrue(dataFolder.isDirectory());
123
        assertTrue(dataFolder.isDirectory());
123
        File dataFile = new File (dataFolder, "data.properties");
124
        File dataFile = new File (dataFolder, "data.properties");
124
        assertTrue (dataFile.exists());
125
        assertTrue (dataFile.exists());
Lines 204-210 Link Here
204
    
205
    
205
    public void testLongUnicode () throws IOException {
206
    public void testLongUnicode () throws IOException {
206
        URL url = FileEncodingQueryTest.class.getResource("data");        
207
        URL url = FileEncodingQueryTest.class.getResource("data");        
207
        File dataFolder = new File(URI.create(url.toExternalForm()));
208
        File dataFolder = Utilities.toFile(URI.create(url.toExternalForm()));
208
        assertTrue(dataFolder.isDirectory());
209
        assertTrue(dataFolder.isDirectory());
209
        File dataFile = new File (dataFolder, "longUnicode.txt");
210
        File dataFile = new File (dataFolder, "longUnicode.txt");
210
        assertTrue (dataFile.exists());
211
        assertTrue (dataFile.exists());
Lines 220-226 Link Here
220
    
221
    
221
    public void testLongUnicode2 () throws IOException {
222
    public void testLongUnicode2 () throws IOException {
222
        URL url = FileEncodingQueryTest.class.getResource("data");        
223
        URL url = FileEncodingQueryTest.class.getResource("data");        
223
        File dataFolder = new File(URI.create(url.toExternalForm()));
224
        File dataFolder = Utilities.toFile(URI.create(url.toExternalForm()));
224
        assertTrue(dataFolder.isDirectory());
225
        assertTrue(dataFolder.isDirectory());
225
        File dataFile = new File (dataFolder, "longUnicode2.txt");
226
        File dataFile = new File (dataFolder, "longUnicode2.txt");
226
        assertTrue (dataFile.exists());
227
        assertTrue (dataFile.exists());
(-)a/queries/test/unit/src/org/netbeans/api/queries/SharabilityQueryTest.java (-8 / +9 lines)
Lines 52-57 Link Here
52
import org.netbeans.spi.queries.SharabilityQueryImplementation2;
52
import org.netbeans.spi.queries.SharabilityQueryImplementation2;
53
import org.openide.filesystems.FileObject;
53
import org.openide.filesystems.FileObject;
54
import org.openide.filesystems.FileUtil;
54
import org.openide.filesystems.FileUtil;
55
import org.openide.util.Utilities;
55
56
56
/**
57
/**
57
 *
58
 *
Lines 76-82 Link Here
76
        File file = new File(home, "aFile.sharable");
77
        File file = new File(home, "aFile.sharable");
77
        int sharability = SharabilityQuery.getSharability(file);
78
        int sharability = SharabilityQuery.getSharability(file);
78
        assertEquals(SharabilityQuery.SHARABLE, sharability);
79
        assertEquals(SharabilityQuery.SHARABLE, sharability);
79
        URI uri = file.toURI();
80
        URI uri = Utilities.toURI(file);
80
        Sharability sharability2 = SharabilityQuery.getSharability(uri);
81
        Sharability sharability2 = SharabilityQuery.getSharability(uri);
81
        assertEquals(SharabilityQuery.Sharability.SHARABLE, sharability2);
82
        assertEquals(SharabilityQuery.Sharability.SHARABLE, sharability2);
82
        FileObject fo = FileUtil.toFileObject(getWorkDir()).createData("aFile", "sharable");
83
        FileObject fo = FileUtil.toFileObject(getWorkDir()).createData("aFile", "sharable");
Lines 87-93 Link Here
87
        File file = new File(home, "aFile.sharable2");
88
        File file = new File(home, "aFile.sharable2");
88
        int sharability = SharabilityQuery.getSharability(file);
89
        int sharability = SharabilityQuery.getSharability(file);
89
        assertEquals(SharabilityQuery.SHARABLE, sharability);
90
        assertEquals(SharabilityQuery.SHARABLE, sharability);
90
        URI uri = file.toURI();
91
        URI uri = Utilities.toURI(file);
91
        Sharability sharability2 = SharabilityQuery.getSharability(uri);
92
        Sharability sharability2 = SharabilityQuery.getSharability(uri);
92
        assertEquals(SharabilityQuery.Sharability.SHARABLE, sharability2);
93
        assertEquals(SharabilityQuery.Sharability.SHARABLE, sharability2);
93
        FileObject fo = FileUtil.toFileObject(getWorkDir()).createData("aFile", "sharable2");
94
        FileObject fo = FileUtil.toFileObject(getWorkDir()).createData("aFile", "sharable2");
Lines 98-104 Link Here
98
        File file = new File(home, "aFile.not_sharable");
99
        File file = new File(home, "aFile.not_sharable");
99
        int sharability = SharabilityQuery.getSharability(file);
100
        int sharability = SharabilityQuery.getSharability(file);
100
        assertEquals(SharabilityQuery.NOT_SHARABLE, sharability);
101
        assertEquals(SharabilityQuery.NOT_SHARABLE, sharability);
101
        URI uri = file.toURI();
102
        URI uri = Utilities.toURI(file);
102
        Sharability sharability2 = SharabilityQuery.getSharability(uri);
103
        Sharability sharability2 = SharabilityQuery.getSharability(uri);
103
        assertEquals(SharabilityQuery.Sharability.NOT_SHARABLE, sharability2);
104
        assertEquals(SharabilityQuery.Sharability.NOT_SHARABLE, sharability2);
104
        FileObject fo = FileUtil.toFileObject(getWorkDir()).createData("aFile", "not_sharable");
105
        FileObject fo = FileUtil.toFileObject(getWorkDir()).createData("aFile", "not_sharable");
Lines 109-115 Link Here
109
        File file = new File(home, "aFile.not_sharable2");
110
        File file = new File(home, "aFile.not_sharable2");
110
        int sharability = SharabilityQuery.getSharability(file);
111
        int sharability = SharabilityQuery.getSharability(file);
111
        assertEquals(SharabilityQuery.NOT_SHARABLE, sharability);
112
        assertEquals(SharabilityQuery.NOT_SHARABLE, sharability);
112
        URI uri = file.toURI();
113
        URI uri = Utilities.toURI(file);
113
        Sharability sharability2 = SharabilityQuery.getSharability(uri);
114
        Sharability sharability2 = SharabilityQuery.getSharability(uri);
114
        assertEquals(SharabilityQuery.Sharability.NOT_SHARABLE, sharability2);
115
        assertEquals(SharabilityQuery.Sharability.NOT_SHARABLE, sharability2);
115
        FileObject fo = FileUtil.toFileObject(getWorkDir()).createData("aFile", "not_sharable2");
116
        FileObject fo = FileUtil.toFileObject(getWorkDir()).createData("aFile", "not_sharable2");
Lines 120-126 Link Here
120
        File file = new File(home, "aFile.mixed");
121
        File file = new File(home, "aFile.mixed");
121
        int sharability = SharabilityQuery.getSharability(file);
122
        int sharability = SharabilityQuery.getSharability(file);
122
        assertEquals(SharabilityQuery.MIXED, sharability);
123
        assertEquals(SharabilityQuery.MIXED, sharability);
123
        URI uri = file.toURI();
124
        URI uri = Utilities.toURI(file);
124
        Sharability sharability2 = SharabilityQuery.getSharability(uri);
125
        Sharability sharability2 = SharabilityQuery.getSharability(uri);
125
        assertEquals(SharabilityQuery.Sharability.MIXED, sharability2);
126
        assertEquals(SharabilityQuery.Sharability.MIXED, sharability2);
126
        FileObject fo = FileUtil.toFileObject(getWorkDir()).createData("aFile", "mixed");
127
        FileObject fo = FileUtil.toFileObject(getWorkDir()).createData("aFile", "mixed");
Lines 131-137 Link Here
131
        File file = new File(home, "aFile.mixed2");
132
        File file = new File(home, "aFile.mixed2");
132
        int sharability = SharabilityQuery.getSharability(file);
133
        int sharability = SharabilityQuery.getSharability(file);
133
        assertEquals(SharabilityQuery.MIXED, sharability);
134
        assertEquals(SharabilityQuery.MIXED, sharability);
134
        URI uri = file.toURI();
135
        URI uri = Utilities.toURI(file);
135
        Sharability sharability2 = SharabilityQuery.getSharability(uri);
136
        Sharability sharability2 = SharabilityQuery.getSharability(uri);
136
        assertEquals(SharabilityQuery.Sharability.MIXED, sharability2);
137
        assertEquals(SharabilityQuery.Sharability.MIXED, sharability2);
137
        FileObject fo = FileUtil.toFileObject(getWorkDir()).createData("aFile", "mixed2");
138
        FileObject fo = FileUtil.toFileObject(getWorkDir()).createData("aFile", "mixed2");
Lines 142-148 Link Here
142
        File file = new File(home, "aFile.txt");
143
        File file = new File(home, "aFile.txt");
143
        int sharability = SharabilityQuery.getSharability(file);
144
        int sharability = SharabilityQuery.getSharability(file);
144
        assertEquals(SharabilityQuery.UNKNOWN, sharability);
145
        assertEquals(SharabilityQuery.UNKNOWN, sharability);
145
        URI uri = file.toURI();
146
        URI uri = Utilities.toURI(file);
146
        Sharability sharability2 = SharabilityQuery.getSharability(uri);
147
        Sharability sharability2 = SharabilityQuery.getSharability(uri);
147
        assertEquals(SharabilityQuery.Sharability.UNKNOWN, sharability2);
148
        assertEquals(SharabilityQuery.Sharability.UNKNOWN, sharability2);
148
        FileObject fo = FileUtil.toFileObject(getWorkDir()).createData("aFile", "txt");
149
        FileObject fo = FileUtil.toFileObject(getWorkDir()).createData("aFile", "txt");
Lines 158-164 Link Here
158
            exception = e;
159
            exception = e;
159
        }
160
        }
160
        assertNotNull(exception);
161
        assertNotNull(exception);
161
        URI uri = file.toURI();
162
        URI uri = Utilities.toURI(file);
162
        exception = null;
163
        exception = null;
163
        try {
164
        try {
164
            SharabilityQuery.getSharability(uri);
165
            SharabilityQuery.getSharability(uri);
(-)a/queries/test/unit/src/org/netbeans/modules/queries/ParentChildCollocationQueryTest.java (-11 / +12 lines)
Lines 46-51 Link Here
46
46
47
import java.io.File;
47
import java.io.File;
48
import org.netbeans.junit.NbTestCase;
48
import org.netbeans.junit.NbTestCase;
49
import org.openide.util.Utilities;
49
50
50
/**
51
/**
51
 * Test of ParentChildCollocationQuery impl.
52
 * Test of ParentChildCollocationQuery impl.
Lines 69-95 Link Here
69
        proj2.mkdirs();
70
        proj2.mkdirs();
70
        
71
        
71
        ParentChildCollocationQuery query = new ParentChildCollocationQuery();
72
        ParentChildCollocationQuery query = new ParentChildCollocationQuery();
72
        assertTrue("Must be collocated", query.areCollocated(proj1.toURI(), proj3.toURI()));
73
        assertTrue("Must be collocated", query.areCollocated(Utilities.toURI(proj1), Utilities.toURI(proj3)));
73
        assertTrue("Must be collocated", query.areCollocated(proj3.toURI(), proj1.toURI()));
74
        assertTrue("Must be collocated", query.areCollocated(Utilities.toURI(proj3), Utilities.toURI(proj1)));
74
        assertFalse("Cannot be collocated", query.areCollocated(proj1.toURI(), proj2.toURI()));
75
        assertFalse("Cannot be collocated", query.areCollocated(Utilities.toURI(proj1), Utilities.toURI(proj2)));
75
        assertFalse("Cannot be collocated", query.areCollocated(proj2.toURI(), proj1.toURI()));
76
        assertFalse("Cannot be collocated", query.areCollocated(Utilities.toURI(proj2), Utilities.toURI(proj1)));
76
        
77
        
77
        // folder does not exist:
78
        // folder does not exist:
78
        File proj4 = new File(base, "proj");
79
        File proj4 = new File(base, "proj");
79
        assertFalse("Cannot be collocated", query.areCollocated(proj1.toURI(), proj4.toURI()));
80
        assertFalse("Cannot be collocated", query.areCollocated(Utilities.toURI(proj1), Utilities.toURI(proj4)));
80
        assertFalse("Cannot be collocated", query.areCollocated(proj4.toURI(), proj1.toURI()));
81
        assertFalse("Cannot be collocated", query.areCollocated(Utilities.toURI(proj4), Utilities.toURI(proj1)));
81
        proj4.mkdirs();
82
        proj4.mkdirs();
82
        assertFalse("Cannot be collocated", query.areCollocated(proj1.toURI(), proj4.toURI()));
83
        assertFalse("Cannot be collocated", query.areCollocated(Utilities.toURI(proj1), Utilities.toURI(proj4)));
83
        assertFalse("Cannot be collocated", query.areCollocated(proj4.toURI(), proj1.toURI()));
84
        assertFalse("Cannot be collocated", query.areCollocated(Utilities.toURI(proj4), Utilities.toURI(proj1)));
84
        
85
        
85
        // files do not exist:
86
        // files do not exist:
86
        File file1 = new File(base, "file1.txt");
87
        File file1 = new File(base, "file1.txt");
87
        File file2 = new File(base, "file1");
88
        File file2 = new File(base, "file1");
88
        assertFalse("Cannot be collocated", query.areCollocated(file1.toURI(), file2.toURI()));
89
        assertFalse("Cannot be collocated", query.areCollocated(Utilities.toURI(file1), Utilities.toURI(file2)));
89
        assertFalse("Cannot be collocated", query.areCollocated(file2.toURI(), file1.toURI()));
90
        assertFalse("Cannot be collocated", query.areCollocated(Utilities.toURI(file2), Utilities.toURI(file1)));
90
        
91
        
91
        // passing the same parameter
92
        // passing the same parameter
92
        assertTrue("A file must be collocated with itself", query.areCollocated(proj1.toURI(), proj1.toURI()));
93
        assertTrue("A file must be collocated with itself", query.areCollocated(Utilities.toURI(proj1), Utilities.toURI(proj1)));
93
    }
94
    }
94
95
95
}
96
}

Return to bug 213562