DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18105>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18105

problem with TarEntry class and linux

           Summary: problem with TarEntry class and linux
           Product: Ant
           Version: 1.5.2
          Platform: PC
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: Normal
          Priority: Other
         Component: Core
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


there's a problem in the TarEntry class :
...................................................................................................................
    public TarEntry(File file) {

        this();

        

        this.file = file;

        

        String name = file.getPath();

        String osname = System.getProperty("os.name");

        

        if (osname != null) {

        

            // Strip off drive letters!

            // REVIEW Would a better check be "(File.separator == '\')"?

            String win32Prefix = "Windows";

            String prefix = osname.substring(0, win32Prefix.length());
...................................................................................................................
when using linux, osname = "Linux" and its length is < win32Prefix.length()
So, when invoking 'osname.substring(0, win32Prefix.length());' an exception is
returned :

Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String
index out of range: 7
        at java.lang.String.substring(String.java:1477)
        at org.apache.tools.tar.TarEntry.<init>(TarEntry.java:210)
        ...

In fact, with such a bug linux is incompatible with ant and Tar* classes...

Reply via email to