ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 18105] New: - problem with TarEntry class and linux
Date Tue, 18 Mar 2003 14:20:55 GMT
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: dev@ant.apache.org
        ReportedBy: yann.richet@irsn.fr


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...

Mime
View raw message