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

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.bo