Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Archive creation fails if directory name is shorter than 3 characters #64

Open
michaelboyles opened this issue Feb 15, 2018 · 1 comment

Comments

@michaelboyles
Copy link

michaelboyles commented Feb 15, 2018

File.createTempFile is called with the given directory's name as a prefix. If it's too short, this will fail with an IllegalArgumentException. The prefix should be padded so this doesn't happen.

File destinationFile = new File("/var/tmp/1")
File sourceFile = new File("/var/tmp/2")

Archiver arch = ArchiverFactory.createArchiver(ArchiveFormat.TAR, CompressionType.GZIP)
File archiveFile = arch.create("64cacf30-b294-49f4-b166-032a808d73cd", destinationFile, sourceFile)

See: https://stackoverflow.com/questions/48806562/java-io-file-prefix-string-too-short-but-its-not

@axelhuberty
Copy link

The prefix should use the String archive instead of the File destination name. If the value is still too short, simply provide a constant value (jarch), this is a temporary file so this is not important.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants