Skip to main content

[truezip-users] Issue in copying files into existing archive using Path

  • From: Abhijeet Desai <desaiabhijeet89@...>
  • To: users@...
  • Subject: [truezip-users] Issue in copying files into existing archive using Path
  • Date: Mon, 1 Jul 2013 16:23:54 +0200

Hi,

I am using the below code to create the archive :


TConfig current = TConfig.get();
    TArchiveDetector tArchiveDetector = new TArchiveDetector("xyz", new
ZipDriver( IOPoolLocator.SINGLETON));
    current.getOutputPreferences().set(FsOutputOption.GROW);
    current.setArchiveDetector(tArchiveDetector);

    TPath path = new TPath("C:\\test\\test.xyz");
    try {
      FileSystem fs = FileSystems.newFileSystem(path,
ClassLoader.getSystemClassLoader());
      System.out.println("Read Only: "+ fs.isReadOnly());
      TPath path2 = new TPath("C:\\test\\1.txt");
      Files.copy(path2, fs.getPath("/1.txt"));
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      try {
        TVFS.umount();
      } catch (Exception e) {
        e.printStackTrace();
      }
    }



"test.xyz" archive is created successfully.

then i run the same code just changing the file to be copied to "2.txt".

TConfig current = TConfig.current();
    TArchiveDetector tArchiveDetector = new TArchiveDetector("xyz", new
ZipDriver());
    current.setAccessPreference(FsAccessOption.GROW, true);
    current.setArchiveDetector(tArchiveDetector);

    TPath path = new TPath("C:\\test\\test.xyz");
    try {
      FileSystem fs = FileSystems.newFileSystem(path,
ClassLoader.getSystemClassLoader());
      System.out.println("Read Only: "+ fs.isReadOnly());
      TPath path2 = new TPath("C:\\test\\2.txt");
      Files.copy(path2, fs.getPath("/2.txt"));
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      try {
        TVFS.umount();
      } catch (Exception e) {
        e.printStackTrace();
      }
    }

Althought the  fs.isReadOnly() returns false I get the below exception:

Read Only: false
de.schlichtherle.truezip.fs.FsReadOnlyArchiveFileSystemException: This is a
read-only archive file system!
at
de.schlichtherle.truezip.fs.FsReadOnlyArchiveFileSystem.mknod(FsReadOnlyArchiveFileSystem.java:54)
at
de.schlichtherle.truezip.fs.FsBasicArchiveController$1Output.mknod(FsBasicArchiveController.java:273)
at
de.schlichtherle.truezip.fs.FsBasicArchiveController$1Output.newOutputStream(FsBasicArchiveController.java:233)
at
de.schlichtherle.truezip.fs.FsContextController$Output.newOutputStream(FsContextController.java:322)
at
de.schlichtherle.truezip.fs.FsResourceController$Output.newOutputStream(FsResourceController.java:280)
at
de.schlichtherle.truezip.socket.DelegatingOutputSocket.newOutputStream(DelegatingOutputSocket.java:57)
at
de.schlichtherle.truezip.fs.FsSyncController$Output.newOutputStream(FsSyncController.java:451)
at
de.schlichtherle.truezip.fs.FsLockController$Output$1NewOutputStream.call(FsLockController.java:509)
at
de.schlichtherle.truezip.fs.FsLockController$Output$1NewOutputStream.call(FsLockController.java:506)
at
de.schlichtherle.truezip.fs.FsLockController.locked(FsLockController.java:328)
at
de.schlichtherle.truezip.fs.FsLockController.writeLocked(FsLockController.java:268)
at
de.schlichtherle.truezip.fs.FsLockController$Output.newOutputStream(FsLockController.java:513)
at
de.schlichtherle.truezip.fs.FsFinalizeController$Output.newOutputStream(FsFinalizeController.java:209)
at
de.schlichtherle.truezip.fs.FsFalsePositiveArchiveController$1Output$NewOutputStream.call(FsFalsePositiveArchiveController.java:409)
at
de.schlichtherle.truezip.fs.FsFalsePositiveArchiveController$1Output$NewOutputStream.call(FsFalsePositiveArchiveController.java:402)
at
de.schlichtherle.truezip.fs.FsFalsePositiveArchiveController$TryChild.call(FsFalsePositiveArchiveController.java:507)
at
de.schlichtherle.truezip.fs.FsFalsePositiveArchiveController.call(FsFalsePositiveArchiveController.java:104)
at
de.schlichtherle.truezip.fs.FsFalsePositiveArchiveController$1Output.newOutputStream(FsFalsePositiveArchiveController.java:399)
at de.schlichtherle.truezip.socket.IOSocket.copy(IOSocket.java:107)
at
de.schlichtherle.truezip.nio.file.TFileSystemProvider.copy(TFileSystemProvider.java:379)
at
de.schlichtherle.truezip.nio.file.TFileSystemProvider.copy(TFileSystemProvider.java:326)
at java.nio.file.Files.copy(Files.java:1219)
at Test.test(Test.java:133)
at Test.main(Test.java:37)


I had the same issue while using the TrueVFS jar as well. I thought it
might be an issue with that so I tried using
truezip-samples-7.7.2-jar-with-dependencies.jar

Not sure if I am missing something here.

Any help regarding this will be appreciated.

Thanks !!

Cheers,
Abhi


[truezip-users] Issue in copying files into existing archive using Path

Abhijeet Desai 07/01/2013

[truezip-users] Re: Issue in copying files into existing archive using Path

Christian Schlichtherle 07/01/2013

[truezip-users] Re: Issue in copying files into existing archive using Path

Abhijeet Desai 07/01/2013

[truezip-users] Re: Issue in copying files into existing archive using Path

Christian Schlichtherle 07/04/2013

[truezip-users] Re: Issue in copying files into existing archive using Path

Abhijeet Desai 07/04/2013

[truezip-users] Re: Issue in copying files into existing archive using Path

Christian Schlichtherle 07/04/2013

[truezip-users] Re: Issue in copying files into existing archive using Path

Abhijeet Desai 07/04/2013

[truezip-users] Re: Issue in copying files into existing archive using Path

Christian Schlichtherle 07/04/2013
 
 
Close
loading
Please Confirm
Close