This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
The nbinst URL provides URL which resolves to the files under the netbeans installation folders. This URL is required by the libraries API to allow modules to define libraries independently on the netbeans installation. For example the URL: nbinst://modules/ext/junit.jar is resolved into file /opt/NetBeans/modules/ext/junit.jar if the NetBeans is installed in the /opt/NetBeans folder. The addition of this URL protocol does not affect any existing APIs. The code does not expose any APIs, but it defines a new URL protocol. The code is covered by unit test.
Created attachment 14123 [details] Diff File
Rather than using URLDecoder you may wish to convert to a URI and use its getPath method which decodes automatically. I'm not sure. Checking for fo.isFolder() should be done in connect(). getOutputStream() is probably unnecessary - no one should be writing to an IDE installation file. The test should be added to the stable (code) config in core/test/cfg-unit.xml, not dev. I'm not sure I understand how the test registers its TestInstalledFileLocator. Probably it needs to set the default lookup, using the system property. Also setUp should confirm that there is a TestInstalledFileLocator using an assertion, not just continue quietly if it was not registered. Before calling getWorkDir() you should call cleanWorkDir(). This should be done in setUp, not tearDown - if the test fails you probably want to see what files it was working on at the time. Don't use assertTrue(x == y); use assertEquals(x, y) (in the proper order). Also always give a message to JUnit assertions. Should be a test to check that the host field is used correctly.
OK, I've changed URLDecoder.decode () into URI. Moved isFolder test into connect and removed the getOutputStream() method. I have also changed the FileUtil.fromFile () in the decodeURL to URLMapper.findFileObjects(). This solves the absence of the MasterFS during the start up. The test registers InstalledFileLocater in its META-INF/services/. I will add the test testing the host part of the URL.
Created attachment 14146 [details] Diff File
Javadoc comments: "The host part is optional, if presents it specifies the name of the supplying module." - specifically, code name base. "relative path from the ${netbeans.home}, ${netbeans.user} or ${netbeans.dirs}" - or whatever InstalledFileLocator decides. BTW also need apichanges.xml patch etc. for the commit, though this is not needed for the review. testFindFileObject is confusing. (1) Use assertEquals and assertNull and assertNotNull where appropriate. (2) Not necessary to check that URLMapper static methods do not return null - that is for URLMapperTest. (3) If fos.length == 1 you should also check that fos[0] is in fact correct. Typo in "testURLConenction". cleanUp method is useless - just use clearWorkDir(). Otherwise looks fine to me.
I guess it's been reviewed as much as it's going to be. Can be implemented.
Done.