jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java
changeset 16857 1e094a236e0e
parent 14342 8435a30053c1
child 17699 dfa52f56753b
--- a/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java	Fri Apr 12 12:03:00 2013 -0700
+++ b/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java	Fri Apr 12 12:12:53 2013 -0700
@@ -466,7 +466,10 @@
             if (eSrc.type == Entry.NEW || eSrc.type == Entry.FILECH)
             {
                 u.type = eSrc.type;    // make it the same type
-                if (!deletesrc) {      // if it's not "rename", just take the data
+                if (deletesrc) {       // if it's a "rename", take the data
+                    u.bytes = eSrc.bytes;
+                    u.file = eSrc.file;
+                } else {               // if it's not "rename", copy the data
                     if (eSrc.bytes != null)
                         u.bytes = Arrays.copyOf(eSrc.bytes, eSrc.bytes.length);
                     else if (eSrc.file != null) {
@@ -1118,7 +1121,7 @@
             if (old != null) {
                 removeFromTree(old);
             }
-            if (e.type == Entry.NEW || e.type == Entry.FILECH) {
+            if (e.type == Entry.NEW || e.type == Entry.FILECH || e.type == Entry.COPY) {
                 IndexNode parent = inodes.get(LOOKUPKEY.as(getParent(e.name)));
                 e.sibling = parent.child;
                 parent.child = e;
@@ -2326,12 +2329,12 @@
     private void removeFromTree(IndexNode inode) {
         IndexNode parent = inodes.get(LOOKUPKEY.as(getParent(inode.name)));
         IndexNode child = parent.child;
-        if (child == inode) {
+        if (child.equals(inode)) {
             parent.child = child.sibling;
         } else {
             IndexNode last = child;
             while ((child = child.sibling) != null) {
-                if (child == inode) {
+                if (child.equals(inode)) {
                     last.sibling = child.sibling;
                     break;
                 } else {