Summary: | exception when using -Dfile.encoding=UTF-8 | ||
---|---|---|---|
Product: | Ant | Reporter: | Abu Abdullah <falcon.sheep> |
Component: | Core | Assignee: | Ant Notifications List <notifications> |
Status: | RESOLVED FIXED | ||
Severity: | major | ||
Priority: | P2 | ||
Version: | 1.8.4 | ||
Target Milestone: | 1.9.0 | ||
Hardware: | All | ||
OS: | All |
Description
Abu Abdullah
2012-09-01 07:16:04 UTC
piece of code: final TarOutputStream tarFile = new TarOutputStream(new FileOutputStream(pathName)); tarFile.setLongFileMode(TarOutputStream.LONGFILE_GNU); .... TarEntry tarEntry = new TarEntry(path); tarEntry.setSize(new File(pre_path+path).length()); tarFile.putNextEntry(tarEntry); in = new FileInputStream(convertPath(choosedAudioPath)+path); while((len = in.read(buf)) > 0) tarFile.write(buf, 0, len); tarFile.closeEntry(); in.close(); (In reply to comment #1) > piece of code: > > final TarOutputStream tarFile = new TarOutputStream(new > FileOutputStream(pathName)); > tarFile.setLongFileMode(TarOutputStream.LONGFILE_GNU); > > .... > > TarEntry tarEntry = new TarEntry(path); > tarEntry.setSize(new File(pre_path+path).length()); > tarFile.putNextEntry(tarEntry); > in = new FileInputStream(convertPath(choosedAudioPath)+path); > while((len = in.read(buf)) > 0) > tarFile.write(buf, 0, len); > > tarFile.closeEntry(); > in.close(); sorry, small mistake. it is: in = new FileInputStream(pre_path+path); instead of: in = new FileInputStream(convertPath(choosedAudioPath)+path); it stops with a non-ASCII names (Arabic file name) while setting -Dfile.encoding=UTF-8. does it support adding UTF8 names? the same bug has been solved in: http://jira.codehaus.org/browse/PLXCOMP-195 please check the patch applied there and consider apply the same to resolve this. When a TAR file is being written, and: 1. One or more filenames are so long that they require GNU mode 2. The platform encoding is UTF-8 3. Any character in a long filename results in a multibyte UTF-8 sequence then an exception is thrown with this text: "Problem creating TAR: request to write 'xxx' bytes exceeds size in header of 'xxx' bytes" This issue is been solved in 1.9 with the new TarOutputStream(FileOutputStream, "UTF8") constructor and setLongFileMode(TarOutputStream.LONGFILE_GNU); |