Write to disk in Platform based JUnit tests

"mhaslinger" <[email protected]>
Newsgroups gmane.comp.java.netbeans.modules.openide.devel
Message-ID <[email protected]>
I am using createData(). But with the other parameter set
Here some code parts which I use:


Code:

FileObject fo = FileUtil.getConfigRoot().createData(FILENAME, EXTENSION);
      lock = fo.lock();
      try (PrintWriter to = new PrintWriter(fo.getOutputStream(lock))) {
        to.println("some stuff");
        to.flush();
      } finally {
        lock.releaseLock();
      }




This creates the file an later I need to get the URL but as "file://"


Code:

FileObject fo = FileUtil.getConfigRoot().getFileObject(FILENAME, EXTENSION); //this work
URI uri = Utilities.toURI(FileUtil.toFile(fo)).toString(); //this will be processed by external code than - it Fails as toFile(..) creates null




We are using ant for building which should not be any difference to the code itself.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.