# This patch file was generated by NetBeans IDE # Following Index: paths are relative to: /space/jarda/netbeans/ergonomics/openide.filesystems/src/org/openide/filesystems # This patch can be applied using context Tools: Patch action on respective folder. # It uses platform neutral UTF-8 encoding and \n newlines. # Above lines and this line are ignored by the patching process. Index: FileUtil.java --- FileUtil.java Base (BASE) +++ FileUtil.java Locally Modified (Based On LOCAL) @@ -819,6 +819,7 @@ return data; } + private static final Map toFile = new WeakHashMap(); /** Finds appropriate java.io.File to FileObject if possible. * If not possible then null is returned. * This is the inverse operation of {@link #toFileObject}. @@ -827,6 +828,11 @@ * @since 1.29 */ public static File toFile(FileObject fo) { + File cache = toFile.get(fo); + if (cache != null) { + return cache; + } + File retVal = (File) fo.getAttribute("java.io.File"); // NOI18N; if (retVal == null) { @@ -842,9 +848,15 @@ } } - return (retVal != null) ? normalizeFile(retVal) : null; + if (retVal != null) { + retVal = normalizeFile(retVal); } + toFile.put(fo, retVal); + + return retVal; + } + /** * Converts a disk file to a matching file object. * This is the inverse operation of {@link #toFile}.