diff options
author | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2008-06-03 14:02:11 +0000 |
---|---|---|
committer | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2008-06-03 14:02:11 +0000 |
commit | fc51dcf0d2d49ce24ea8d31af1535a646ae09577 (patch) | |
tree | 823f4e81dec9755ad0e1615ad2628127d87e077d /tools/gnu | |
parent | 56852c182521a715fadd4acbbb8bc6abe73a4d87 (diff) | |
download | classpath-fc51dcf0d2d49ce24ea8d31af1535a646ae09577.tar.gz |
Reverting the gjar patch so Schuster's patch will work...
2008-06-03 Andrew John Hughes <gnu_andrew@member.fsf.org>
* tools/gnu/classpath/tools/getopt/OptionException.java,
* tools/gnu/classpath/tools/jar/Main.java:
Revert previous changes to allow Schuster's patch to
do the same.
Diffstat (limited to 'tools/gnu')
-rw-r--r-- | tools/gnu/classpath/tools/getopt/OptionException.java | 6 | ||||
-rw-r--r-- | tools/gnu/classpath/tools/jar/Main.java | 78 |
2 files changed, 26 insertions, 58 deletions
diff --git a/tools/gnu/classpath/tools/getopt/OptionException.java b/tools/gnu/classpath/tools/getopt/OptionException.java index 2d7f77a55..a09d716f4 100644 --- a/tools/gnu/classpath/tools/getopt/OptionException.java +++ b/tools/gnu/classpath/tools/getopt/OptionException.java @@ -49,10 +49,4 @@ public class OptionException { super(message); } - - public OptionException(String message, Throwable cause) - { - super(message, cause); - } - } diff --git a/tools/gnu/classpath/tools/jar/Main.java b/tools/gnu/classpath/tools/jar/Main.java index 073f231c3..d52028fef 100644 --- a/tools/gnu/classpath/tools/jar/Main.java +++ b/tools/gnu/classpath/tools/jar/Main.java @@ -47,16 +47,10 @@ import gnu.classpath.tools.getopt.Parser; import java.io.BufferedReader; import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.InputStream; import java.io.InputStreamReader; import java.io.IOException; - import java.text.MessageFormat; import java.util.ArrayList; -import java.util.LinkedList; -import java.util.Queue; import java.util.zip.ZipOutputStream; public class Main @@ -73,6 +67,9 @@ public class Main /** The zip storage mode. */ int storageMode = ZipOutputStream.DEFLATED; + /** True if we should read file names from stdin. */ + boolean readNamesFromStdin = false; + /** True for verbose mode. */ boolean verbose = false; @@ -88,9 +85,6 @@ public class Main /** Used only while parsing, holds the first argument for -C. */ String changedDirectory; - /** A queue of input streams from which to read lists of files. */ - private final Queue<InputStream> fileLists = new LinkedList<InputStream>(); - void setArchiveFile(String filename) throws OptionException { if (archiveFile != null) @@ -105,32 +99,18 @@ public class Main class HandleFile extends FileArgumentCallback { - @Override public void notifyFile(String fileArgument) - throws OptionException { - if (fileArgument.charAt(0) == '@') - try - { - fileLists.offer(new FileInputStream(fileArgument.substring(1))); - } - catch (FileNotFoundException e) - { - throw new OptionException("File " + fileArgument + " not found.", e); - } + Entry entry; + if (changedDirectory != null) + { + entry = new Entry(new File(changedDirectory, fileArgument), + fileArgument); + changedDirectory = null; + } else - { - Entry entry; - if (changedDirectory != null) - { - entry = new Entry(new File(changedDirectory, fileArgument), - fileArgument); - changedDirectory = null; - } - else - entry = new Entry(new File(fileArgument)); - entries.add(entry); - } + entry = new Entry(new File(fileArgument)); + entries.add(entry); } } @@ -196,7 +176,7 @@ public class Main { Parser p = new JarParser("jar"); //$NON-NLS-1$ p.setHeader(Messages.getString("Main.Usage")); //$NON-NLS-1$ - + OptionGroup grp = new OptionGroup(Messages.getString("Main.OpMode")); //$NON-NLS-1$ grp.add(new ModeOption('c', Messages.getString("Main.Create"), Creator.class)); //$NON-NLS-1$ grp.add(new ModeOption('x', Messages.getString("Main.Extract"), Extractor.class)); //$NON-NLS-1$ @@ -258,7 +238,7 @@ public class Main { public void parsed(String argument) throws OptionException { - fileLists.offer(System.in); + readNamesFromStdin = true; } }); p.add(grp); @@ -266,26 +246,19 @@ public class Main return p; } - /** - * Read the names of additional class files from - * {@code stdin} and/or files prefixed with {@code '@'}. - */ private void readNames() { - for (InputStream is : fileLists) + String line; + try + { + BufferedReader br + = new BufferedReader(new InputStreamReader(System.in)); + while ((line = br.readLine()) != null) + entries.add(new Entry(new File(line))); + } + catch (IOException _) { - String line; - try - { - BufferedReader br - = new BufferedReader(new InputStreamReader(is)); - while ((line = br.readLine()) != null) - entries.add(new Entry(new File(line))); - } - catch (IOException _) - { - // Ignore. - } + // Ignore. } } @@ -297,7 +270,8 @@ public class Main if (args.length > 0 && args[0].charAt(0) != '-') args[0] = '-' + args[0]; p.parse(args, new HandleFile()); - readNames(); + if (readNamesFromStdin) + readNames(); Action t = (Action) operationMode.newInstance(); t.run(this); } |