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.
After implementation of issue 18220 it has been realized that pluggable mapping is also needed from URL to FileObject, I suggest to implement it by adding methods: static FileObject findFileObject (URL url); abstract FileObject getFileObject (URL url); both able to return null. Please do it now before the URLMapper appears in the 3.4 release.
Implemented. Diff will be attached. If no objections, then I will integrate it into trunk, notice in API changes. Perhaps should be also announced on openide-dev.
Created attachment 5876 [details] Diff provided
The name of the method shall be findFileObjects, if it returns array, I guess. The results of all URLMappers should be merged together, if more than one mapper is willing to contribute or it should be documented that the first one wins.
You are right. Then also second method shold be renamed to getFileObjects.
Some comments on patch: 1. Contract in findFileObject is hard to follow. Suggest splitting it up into separate points: a. Zero or more FOs may be returned. b. For a URL gotten from one of the FO -> URL methods, at least one FO must be returned. c. For each returned FO, it must be true that that FO -> URL gives the exact URL which was passed in. 2. new File(url.getFile()).getCanonicalFile() is not guaranteed to work by the Java platform APIs. There is no guaranteed correct solution on JDK 1.3. On JDK 1.4, there is: new File(URI). Agree with Yarda re. renames of the two new methods, and merging of results being desirable.
1.b. I hasitate if contract can contain: For a URL gotten from one of the FO -> URL methods, at least one FO must be returned. There is a problem, because if e.g.(FO instanceof MFO) and delegate from XMLFileSystem with defined url= in layer, then no problem FO -> URL, but backward URL -> FO seems to me pretty complicated.
I guess you're right, that's too hard to guarantee.
Already fixed
verified. Created qa-unit test: testFindFOfromURL
Resolved for 3.4.x or earlier, no new info since then -> closing.