Commons VFS
  1. Commons VFS
  2. VFS-11

[VFS] copyFrom keep the file with imaginary type

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Incomplete
    • Affects Version/s: Nightly Builds
    • Fix Version/s: None
    • Labels:
      None
    • Environment:

      Operating System: other
      Platform: Other

      Description

      If you copy a file to a file that did not exist using the FileObject.copyFrom
      method then the destination file is created but it's status is still imaginary.

      I had the problem when using the <v-copy> task to copy the content of war file
      to a file system with the keepladtmodifiedtime option. Because the file was
      still imaginary after the copy the SetLastModified method failed.

        Activity

        Hide
        Mario Ivankovits added a comment -

        No Problem! I am happy you found it.

        Show
        Mario Ivankovits added a comment - No Problem! I am happy you found it.
        Hide
        Anthony Goubard added a comment -

        I did some more tests and at the end saw that this problem with the fact that I
        change the AbstractFileSystem.java to not put the imaginary files in the cache
        (I don't remember why I did it as it was a long time ago).

        Sorry for having submitted an invalid bug.

        Show
        Anthony Goubard added a comment - I did some more tests and at the end saw that this problem with the fact that I change the AbstractFileSystem.java to not put the imaginary files in the cache (I don't remember why I did it as it was a long time ago). Sorry for having submitted an invalid bug.
        Hide
        Mario Ivankovits added a comment -

        Hi!

        I tried to reproduce it with the following code snipped:

        FileObject existFile = VFS.getManager().resolveFile("/home/im/tmp/exists.txt");
        FileObject newFile = VFS.getManager().resolveFile("/home/im/tmp/new.txt");
        System.err.println("Exists:" + existFile.exists());
        System.err.println("New:" + newFile.exists());
        newFile.copyFrom(existFile, Selectors.SELECT_SELF);
        newFile.getContent().setLastModifiedTime(0L);
        System.err.println("Exists:" + existFile.exists());
        System.err.println("New:" + newFile.exists());

        and it worked as expected.
        Could you please try again. And maybe post the ant-task (only the v-copy stuff)

        Thanks!

        Show
        Mario Ivankovits added a comment - Hi! I tried to reproduce it with the following code snipped: FileObject existFile = VFS.getManager().resolveFile("/home/im/tmp/exists.txt"); FileObject newFile = VFS.getManager().resolveFile("/home/im/tmp/new.txt"); System.err.println("Exists:" + existFile.exists()); System.err.println("New:" + newFile.exists()); newFile.copyFrom(existFile, Selectors.SELECT_SELF); newFile.getContent().setLastModifiedTime(0L); System.err.println("Exists:" + existFile.exists()); System.err.println("New:" + newFile.exists()); and it worked as expected. Could you please try again. And maybe post the ant-task (only the v-copy stuff) Thanks!
        Hide
        Anthony Goubard added a comment -

        Created an attachment (id=17609)
        Fix of this bug

        I've fixed the problem by calling createFile() when the selector is
        SEFL_SELECTOR.

        Show
        Anthony Goubard added a comment - Created an attachment (id=17609) Fix of this bug I've fixed the problem by calling createFile() when the selector is SEFL_SELECTOR.

          People

          • Assignee:
            Unassigned
            Reporter:
            Anthony Goubard
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development