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.
NIO2 is part of JDK7 and JDK7 is around the corner. There are many things that can be done to align filesystem API and NIO2. This issue is supposed to track them. The first goal is to write a bridge to expose any FileObject based solution via NIO2 path API.
I would say the first priority would be to use the native parts of NIO.2 to improve the functionality and reliability of existing NB code paths: - create a Notifier impl delegating to WatchService - use Files.probeContentType from a low-priority MIMEResolver - define File FileUtil.fromURL(URL) and URL FileUtil.toURL(File), using Path.toUri and Paths.get(URI) on JDK 7 and using File.toURI and new File(URI) plus special UNC handling on JDK 6, and use them throughout the NB code base wherever URL's (or URI's) are being interconverted with File's - define FileUtil methods delegating to Path.resolve/relativize on JDK 7 (and some near-equivalent on JDK 6) and use them in various places, e.g. project.ant - use Files.copy(..., COPY_ATTRIBUTES) for FileObject.copy in masterfs - use Path.normalize/realPath in FileUtil.normalizeFile
Created attachment 109169 [details] Test to verify netigso
(In reply to Jaroslav Tulach from comment #0) > The first goal is to write a bridge to expose any FileObject based solution > via NIO2 path API. http://bits.netbeans.org/8.0/javadoc/org-openide-filesystems/org/openide/filesystems/FileObject.html should either implement http://docs.oracle.com/javase/7/docs/api/java/nio/file/Path.html or have a method toPath like File has http://docs.oracle.com/javase/7/docs/api/java/io/File.html#toPath() The important question I ask myself is: How will we know our implementation of the Path interface is good enough? My favourite answer: We should have a TCK that works with Path interface (in the openide.filesystems module) and run it (at least) twice: once on Path objects provided by masterfs's FileObjects and once on plain java.io.File.toPath implementation. If they behave the same we can have enough confidence that our Path implementation is compatible enough.