Skip to main content

[truezip-issues] [JIRA] Updated: (TRUEZIP-339) Exception when creating an archive in the root folder (Windows)

  • From: "Christian Schlichtherle (JIRA)" <jira-no-reply@...>
  • To: issues@...
  • Subject: [truezip-issues] [JIRA] Updated: (TRUEZIP-339) Exception when creating an archive in the root folder (Windows)
  • Date: Thu, 23 Jan 2014 12:11:49 +0000 (UTC)
  • Auto-submitted: auto-generated


     [ 
https://java.net/jira/browse/TRUEZIP-339?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Christian Schlichtherle updated TRUEZIP-339:
--------------------------------------------

    Fix Version/s: TrueZIP 7.7.6
      Environment: Oracle JDK 1.7.0_51 on Windows 7 and Mac OS X 10.9.1.  
(was: Windows 7)

I've added a workaround to the code base. Please pull the source code 
repository and build yourself using

$ mvn clean install


> Exception when creating an archive in the root folder (Windows)
> ---------------------------------------------------------------
>
>                 Key: TRUEZIP-339
>                 URL: https://java.net/jira/browse/TRUEZIP-339
>             Project: TrueZIP
>          Issue Type: Bug
>          Components: TrueZIP Driver FILE
>    Affects Versions: TrueZIP 7.7.5
>         Environment: Oracle JDK 1.7.0_51 on Windows 7 and Mac OS X 10.9.1.
>            Reporter: qui.tiqe
>            Assignee: Christian Schlichtherle
>            Priority: Minor
>             Fix For: TrueZIP 7.7.6
>
>
> When creating an archive in the root folder of a Windows drive (e.g. C:\), 
> TrueZIP throws an exception when using Java 7. The following sample code 
> reproduces the issue:
> {code:title=QTrueZipExportToRoot.java|borderStyle=solid}
> import java.io.BufferedWriter;
> import java.nio.charset.Charset;
> import java.nio.file.Files;
> import java.nio.file.Path;
> import java.nio.file.Paths;
> import de.schlichtherle.truezip.file.TVFS;
> import de.schlichtherle.truezip.nio.file.TPath;
> public class QTrueZipExportToRoot
> {
>   private static final Charset ENCODING = Charset.forName("UTF-8");
>   private static final String ARCHIVE_PATH = "C:\\TestTrueZipRootIssue.zip";
>   
>   public static void main(String[] args)
>   {
>     try
>     {
>       Path archivePath = Paths.get(ARCHIVE_PATH);
>       
>       // Ensure that the file does not already exist
>       if ( Files.exists(archivePath) )
>       {
>         Files.delete(archivePath);
>       }
>             
>       // Create the archive, add a file to it, and write to the file within 
> the archive
>       TPath archiveFile = new TPath(archivePath);
>       Files.createDirectory(archiveFile);
>       TPath newFilePath = archiveFile.resolve("File1");
>       Files.createFile(newFilePath);
>       
>       try ( BufferedWriter writer = Files.newBufferedWriter(newFilePath, 
> ENCODING) )
>       {
>         writer.write("abcd");
>       }
>       
>       // Commit all pending changes
>       TVFS.umount();
>       
>       // Delete the archive if it exists
>       if ( Files.exists( archivePath ) )
>       {
>         Files.delete( archivePath );
>       }
>       
>       System.out.println("Test completed successfully.");
>     }
>     catch (Exception e)
>     {
>       e.printStackTrace();
>     }
>   }
> }
> {code}
> This exception is thrown:
> {noformat}
> java.nio.file.FileAlreadyExistsException: D:\TestTrueZipRootIssue.zip
>       at 
> de.schlichtherle.truezip.nio.file.TFileSystem.createDirectory(TFileSystem.java:362)
>       at 
> de.schlichtherle.truezip.nio.file.TPath.createDirectory(TPath.java:970)
>       at 
> de.schlichtherle.truezip.nio.file.TFileSystemProvider.createDirectory(TFileSystemProvider.java:315)
>       at java.nio.file.Files.createDirectory(Unknown Source)
>       at QTrueZipExportToRoot.main(QTrueZipExportToRoot.java:31)
> Caused by: java.io.IOException: Root directory does not exist
>       at java.nio.file.Files.createDirectories(Unknown Source)
>       at 
> de.schlichtherle.truezip.fs.nio.file.FileOutputSocket.begin(FileOutputSocket.java:109)
>       at 
> de.schlichtherle.truezip.fs.nio.file.FileOutputSocket.newOutputStream(FileOutputSocket.java:222)
>       at 
> de.schlichtherle.truezip.fs.archive.zip.OptionOutputSocket.newOutputStream(OptionOutputSocket.java:48)
>       at 
> de.schlichtherle.truezip.fs.archive.zip.ZipDriver.newOutputShop(ZipDriver.java:586)
>       at 
> de.schlichtherle.truezip.fs.archive.zip.ZipDriver.newOutputShop0(ZipDriver.java:576)
>       at 
> de.schlichtherle.truezip.fs.archive.zip.ZipDriver.newOutputShop(ZipDriver.java:561)
>       at 
> de.schlichtherle.truezip.fs.FsTargetArchiveController.makeOutputArchive(FsTargetArchiveController.java:247)
>       at 
> de.schlichtherle.truezip.fs.FsTargetArchiveController.mount0(FsTargetArchiveController.java:182)
>       at 
> de.schlichtherle.truezip.fs.FsTargetArchiveController.mount(FsTargetArchiveController.java:155)
>       at 
> de.schlichtherle.truezip.fs.FsFileSystemArchiveController$ResetFileSystem.autoMount(FsFileSystemArchiveController.java:85)
>       at 
> de.schlichtherle.truezip.fs.FsFileSystemArchiveController.autoMount(FsFileSystemArchiveController.java:37)
>       at 
> de.schlichtherle.truezip.fs.FsBasicArchiveController.mknod(FsBasicArchiveController.java:319)
>       at 
> de.schlichtherle.truezip.fs.FsContextController.mknod(FsContextController.java:178)
>       at 
> de.schlichtherle.truezip.fs.FsDecoratingController.mknod(FsDecoratingController.java:120)
>       at 
> de.schlichtherle.truezip.fs.FsCacheController.mknod(FsCacheController.java:157)
>       at 
> de.schlichtherle.truezip.fs.FsSyncController.mknod(FsSyncController.java:201)
>       at 
> de.schlichtherle.truezip.fs.FsLockController$1Mknod.call(FsLockController.java:207)
>       at 
> de.schlichtherle.truezip.fs.FsLockController$1Mknod.call(FsLockController.java:204)
>       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.mknod(FsLockController.java:211)
>       at 
> de.schlichtherle.truezip.fs.FsDecoratingController.mknod(FsDecoratingController.java:120)
>       at 
> de.schlichtherle.truezip.fs.FsDecoratingController.mknod(FsDecoratingController.java:120)
>       at 
> de.schlichtherle.truezip.fs.FsFalsePositiveArchiveController$1Mknod.call(FsFalsePositiveArchiveController.java:431)
>       at 
> de.schlichtherle.truezip.fs.FsFalsePositiveArchiveController$1Mknod.call(FsFalsePositiveArchiveController.java:426)
>       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.mknod(FsFalsePositiveArchiveController.java:436)
>       at 
> de.schlichtherle.truezip.nio.file.TFileSystem.createDirectory(TFileSystem.java:355)
>       ... 4 more
> {noformat} 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://java.net/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


[truezip-issues] [JIRA] Created: (TRUEZIP-339) Exception when creating an archive in the root folder (Windows)

qui.tiqe (JIRA) 01/16/2014

[truezip-issues] [JIRA] Updated: (TRUEZIP-339) Exception when creating an archive in the root folder (Windows)

Christian Schlichtherle (JIRA) 01/18/2014

[truezip-issues] [JIRA] Resolved: (TRUEZIP-339) Exception when creating an archive in the root folder (Windows)

Christian Schlichtherle (JIRA) 01/18/2014

[truezip-issues] [JIRA] Commented: (TRUEZIP-339) Exception when creating an archive in the root folder (Windows)

qui.tiqe (JIRA) 01/21/2014

[truezip-issues] [JIRA] Reopened: (TRUEZIP-339) Exception when creating an archive in the root folder (Windows)

Christian Schlichtherle (JIRA) 01/23/2014

[truezip-issues] [JIRA] Updated: (TRUEZIP-339) Exception when creating an archive in the root folder (Windows)

Christian Schlichtherle (JIRA) 01/23/2014

[truezip-issues] [JIRA] Closed: (TRUEZIP-339) Exception when creating an archive in the root folder (Windows)

Christian Schlichtherle (JIRA) 01/23/2014
 
 
Close
loading
Please Confirm
Close