diff options
author | Robert Schuster <theBohemian@gmx.net> | 2007-12-10 22:27:25 +0000 |
---|---|---|
committer | Robert Schuster <theBohemian@gmx.net> | 2007-12-10 22:27:25 +0000 |
commit | bdd763459eca110e8a35daf3693066124ddfe9b7 (patch) | |
tree | 6d1e6715556b0c470ccc278fe00dac389b7cc4ad /tools | |
parent | 3434285884f7d132950e6dab717bb22ab2018fc8 (diff) | |
download | classpath-bdd763459eca110e8a35daf3693066124ddfe9b7.tar.gz |
2007-12-10 Robert Schuster <robertschuster@fsfe.org>
PR classpath/32516:
* tools/gnu/classpath/tools/jar/Entry.java:
(Entry(File, String)): Added loop to remove all dot-file separator
prefixes.
(Entry(File)): Call Entry(File, String) constructor variant.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/gnu/classpath/tools/jar/Entry.java | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/tools/gnu/classpath/tools/jar/Entry.java b/tools/gnu/classpath/tools/jar/Entry.java index aa8679aab..b9108798a 100644 --- a/tools/gnu/classpath/tools/jar/Entry.java +++ b/tools/gnu/classpath/tools/jar/Entry.java @@ -1,5 +1,5 @@ /* Entry.java - represent a single file to write to a jar - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006, 2007 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -49,12 +49,22 @@ public class Entry public Entry(File file, String name) { this.file = file; - this.name = name; + + /* Removes any './' prefixes automatically. Those caused trouble + * in (boot) classpath use-cases. See #32516. + */ + int start = 0; + while (name.length() > start + 2 + && name.codePointAt(start) == '.' + && name.codePointAt(start + 1) == File.separatorChar) + start += 2; + + this.name = name.substring(start); } public Entry(File file) { - this.file = file; - this.name = file.toString(); + this(file, file.toString()); } + } |