# This patch file was generated by NetBeans IDE # This patch can be applied using context Tools: Apply Diff Patch action on respective folder. # It uses platform neutral UTF-8 encoding. # Above lines and this line are ignored by the patching process. Index: openide/fs/src/org/openide/filesystems/FileLock.java --- openide/fs/src/org/openide/filesystems/FileLock.java Base (1.7) +++ openide/fs/src/org/openide/filesystems/FileLock.java Locally Modified (Based On 1.7) @@ -18,11 +18,7 @@ */ package org.openide.filesystems; -import java.io.ByteArrayOutputStream; -import java.util.logging.Level; -import java.util.logging.Logger; - /** Represents an acquired lock on a FileObject. * Typical usage includes locking the file in the editor on first * modification, and then using this object to ensure exclusive access when @@ -55,10 +51,8 @@ /** Determines if lock is locked or if it was released. */ private boolean locked = true; - private Throwable lockedBy; public FileLock() { - assert (lockedBy = new Throwable()) != null; } // =============================================================================== @@ -94,26 +88,4 @@ public boolean isValid() { return locked; } - - /** Finalize this object. Calls {@link #releaseLock} to release the lock if the program - * for some reason failed to. - */ - public void finalize() { - assert (!isValid()) : assertMessageForInvalidLocks(); - releaseLock(); } - - private String assertMessageForInvalidLocks() { - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - - if (lockedBy != null) { - Logger.getLogger(FileLock.class.getName()).log(Level.WARNING, null, - new Exception("Not released lock for file: " + - toString() + - " (traped in finalizer)").initCause(lockedBy));//NOI18N - } - - releaseLock(); - return bos.toString(); - } -} Index: openide/fs/src/org/openide/filesystems/FileObject.java --- openide/fs/src/org/openide/filesystems/FileObject.java Base (1.20) +++ openide/fs/src/org/openide/filesystems/FileObject.java Locally Modified (Based On 1.20) @@ -633,18 +633,20 @@ * @exception IllegalArgumentException if this is not a folder */ public FileObject getFileObject(String relativePath) { - if (relativePath.startsWith("/")) { + if ("".equals(relativePath)) { //NOI18N + return this; + } + if (relativePath.length() > 0 && relativePath.charAt(0) == '/') { relativePath = relativePath.substring(1); } - FileObject myObj = this; - StringTokenizer st = new StringTokenizer(relativePath, "/"); - - while ((myObj != null) && st.hasMoreTokens()) { - String nameExt = st.nextToken(); - myObj = myObj.getFileObject(nameExt, null); + String[] paths = relativePath.split ("/"); + for (String nameExt : paths) { + if (myObj == null) { + break; } - + myObj = myObj.getFileObject (nameExt, null); + } return myObj; } Index: openide/fs/src/org/openide/filesystems/XMLFileSystem.java --- openide/fs/src/org/openide/filesystems/XMLFileSystem.java Base (1.18) +++ openide/fs/src/org/openide/filesystems/XMLFileSystem.java Locally Modified (Based On 1.18) @@ -1107,8 +1107,8 @@ private static final int ATTR_CODE = "attr".hashCode(); // NOI18N private ResourceElem rootElem; private boolean validate = false; - Stack resElemStack = new Stack(); - Stack elementStack = new Stack(); + UnsyncStack resElemStack = new UnsyncStack(); + UnsyncStack elementStack = new UnsyncStack(); URL urlContext; private Map dtdMap; private ResourceElem topRE; @@ -1260,11 +1260,11 @@ public void startDocument() throws SAXException { super.startDocument(); - resElemStack = new Stack(); + resElemStack = new UnsyncStack(); resElemStack.push(rootElem); topRE = rootElem; - elementStack = new Stack(); + elementStack = new UnsyncStack(); elementStack.push(""); // NOI18N } @@ -1274,4 +1274,26 @@ elementStack.pop(); } } + + //Replaces use of java.util.Stack, which is synchronized + private static final class UnsyncStack extends ArrayList { + public void push (T t) { + super.add (0, t); } + + public T pop () { + if (isEmpty()) { + return null; + } else { + T result = get(0); + remove (0); + return result; + } + } + + public T peek() { + return isEmpty() ? null : get(0); + } + + } +}