https://issues.apache.org/bugzilla/show_bug.cgi?id=48035

           Summary: Tar task doesn't create one-file archives
           Product: Ant
           Version: 1.7.0
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core tasks
        AssignedTo: [email protected]
        ReportedBy: [email protected]


When tar task is used to create an archive consisting of one file, it doesn't
work under some circumstances. I've used debugger to find the problem. It's in
this code in Tar.java (lines 567-572_:

                Vector files = (Vector) basedirToFilesMap.get(base);
                if (files == null) {
                    files = new Vector();
                    basedirToFilesMap.put(base, new Vector());
                }
                files.add(r.getName());

Here files var is filled with "new Vector()" and then another fresh Vector
instance is put into the basedirToFilesMap. Then file name is added to the
first Vector instance which is useless as it should ad an entry to the second
Vector instance, which is used later.

Correct code:

                Vector files = (Vector) basedirToFilesMap.get(base);
                if (files == null) {
                    files = new Vector();
                    basedirToFilesMap.put(base, files);
                }
                files.add(r.getName());

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Reply via email to