svn commit: r746917 - in /commons/sandbox/compress/trunk/src/test: java/org/apache/commons/compress/archivers/zip/UTF8ZipFilesTest.java resources/utf8-7zip-test.zip resources/utf8-winzip-test.zip
Author: bodewig Date: Mon Feb 23 08:21:40 2009 New Revision: 746917 URL: http://svn.apache.org/viewvc?rev=746917view=rev Log: EFS-Flag interop test using 7-Zip created file submitted by wolfgang Glas. SANDBOX-176 Added: commons/sandbox/compress/trunk/src/test/resources/utf8-7zip-test.zip (with props) commons/sandbox/compress/trunk/src/test/resources/utf8-winzip-test.zip (with props) Modified: commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/UTF8ZipFilesTest.java Modified: commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/UTF8ZipFilesTest.java URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/UTF8ZipFilesTest.java?rev=746917r1=746916r2=746917view=diff == --- commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/UTF8ZipFilesTest.java (original) +++ commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/UTF8ZipFilesTest.java Mon Feb 23 08:21:40 2009 @@ -22,6 +22,9 @@ import java.io.FileInputStream; import java.io.IOException; import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.net.URL; +import java.net.URISyntaxException; import java.nio.charset.Charset; import java.nio.charset.UnsupportedCharsetException; import java.util.Enumeration; @@ -36,22 +39,38 @@ private static final String EURO_FOR_DOLLAR_TXT = \u20AC_for_Dollar.txt; private static final String OIL_BARREL_TXT = \u00D6lf\u00E4sser.txt; -public void testUtf8FileRoundtrip() throws IOException { +public void xtestUtf8FileRoundtrip() throws IOException { testFileRoundtrip(UTF_8, true); } -public void testUtf8FileRoundtripNoEFS() throws IOException { +public void xtestUtf8FileRoundtripNoEFS() throws IOException { testFileRoundtrip(UTF_8, false); } -public void testCP437FileRoundtrip() throws IOException { +public void xtestCP437FileRoundtrip() throws IOException { testFileRoundtrip(CP437, false); } -public void testASCIIFileRoundtrip() throws IOException { +public void xtestASCIIFileRoundtrip() throws IOException { testFileRoundtrip(US_ASCII, false); } +/** + * 7-ZIP created archive, uses EFS to signal UTF-8 filenames. + */ +public void testReadEFS() throws IOException, URISyntaxException { +URL zip = getClass().getResource(/utf8-7zip-test.zip); +File archive = new File(new URI(zip.toString())); +ZipFile zf = null; +try { +zf = new ZipFile(archive); +assertNotNull(zf.getEntry(ASCII_TXT)); +assertNotNull(zf.getEntry(EURO_FOR_DOLLAR_TXT)); +} finally { +ZipFile.closeQuietly(zf); +} +} + private static void testFileRoundtrip(String encoding, boolean withEFS) throws IOException { Added: commons/sandbox/compress/trunk/src/test/resources/utf8-7zip-test.zip URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/test/resources/utf8-7zip-test.zip?rev=746917view=auto == Binary file - no diff available. Propchange: commons/sandbox/compress/trunk/src/test/resources/utf8-7zip-test.zip -- svn:mime-type = application/octet-stream Added: commons/sandbox/compress/trunk/src/test/resources/utf8-winzip-test.zip URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/test/resources/utf8-winzip-test.zip?rev=746917view=auto == Binary file - no diff available. Propchange: commons/sandbox/compress/trunk/src/test/resources/utf8-winzip-test.zip -- svn:mime-type = application/octet-stream
svn commit: r746933 - in /commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip: ZipEncodingHelper.java ZipFile.java
Author: bodewig Date: Mon Feb 23 09:01:59 2009 New Revision: 746933 URL: http://svn.apache.org/viewvc?rev=746933view=rev Log: use NIO to decode names as well Modified: commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipEncodingHelper.java commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java Modified: commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipEncodingHelper.java URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipEncodingHelper.java?rev=746933r1=746932r2=746933view=diff == --- commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipEncodingHelper.java (original) +++ commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipEncodingHelper.java Mon Feb 23 09:01:59 2009 @@ -168,4 +168,18 @@ return enc.canEncode(name); } + +/** + * Decode a filename or a comment from a byte array. + * + * @param name The filename or comment. + * @param encoding A valid encoding name. The standard zip + * encoding is codeCP437/code, + * codeUTF-8/code is supported in ZIP file + * version code6.3/code or later. + */ +static final String decodeName(byte[] name, String encoding) { +Charset cs = Charset.forName(encoding); +return cs.decode(ByteBuffer.wrap(name)).toString(); +} } Modified: commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java?rev=746933r1=746932r2=746933view=diff == --- commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java (original) +++ commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java Mon Feb 23 09:01:59 2009 @@ -538,9 +538,15 @@ return new String(bytes); } else { try { -return new String(bytes, enc); -} catch (UnsupportedEncodingException uee) { -throw new ZipException(uee.getMessage()); +return ZipEncodingHelper.decodeName(bytes, encoding); +} catch (java.nio.charset.UnsupportedCharsetException ex) { +// Java 1.4's NIO doesn't recognize a few names that +// String.getBytes does +try { +return new String(bytes, enc); +} catch (UnsupportedEncodingException uee) { +throw new ZipException(uee.getMessage()); +} } } }
svn commit: r746940 - /commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/UTF8ZipFilesTest.java
Author: bodewig Date: Mon Feb 23 09:22:00 2009 New Revision: 746940 URL: http://svn.apache.org/viewvc?rev=746940view=rev Log: re-enable tests disabled by accident. 7ZIP uses CP437 by default Modified: commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/UTF8ZipFilesTest.java Modified: commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/UTF8ZipFilesTest.java URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/UTF8ZipFilesTest.java?rev=746940r1=746939r2=746940view=diff == --- commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/UTF8ZipFilesTest.java (original) +++ commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/UTF8ZipFilesTest.java Mon Feb 23 09:22:00 2009 @@ -43,29 +43,33 @@ testFileRoundtrip(UTF_8, true); } -public void xtestUtf8FileRoundtripNoEFS() throws IOException { +public void testUtf8FileRoundtripNoEFS() throws IOException { testFileRoundtrip(UTF_8, false); } -public void xtestCP437FileRoundtrip() throws IOException { +public void testCP437FileRoundtrip() throws IOException { testFileRoundtrip(CP437, false); } -public void xtestASCIIFileRoundtrip() throws IOException { +public void testASCIIFileRoundtrip() throws IOException { testFileRoundtrip(US_ASCII, false); } -/** +/* * 7-ZIP created archive, uses EFS to signal UTF-8 filenames. + * + * 7-ZIP doesn't use EFS for strings that can be encoded in CP437 + * - which is true for OIL_BARREL_TXT. */ -public void testReadEFS() throws IOException, URISyntaxException { +public void testRead7ZipArchive() throws IOException, URISyntaxException { URL zip = getClass().getResource(/utf8-7zip-test.zip); File archive = new File(new URI(zip.toString())); ZipFile zf = null; try { -zf = new ZipFile(archive); +zf = new ZipFile(archive, CP437); assertNotNull(zf.getEntry(ASCII_TXT)); assertNotNull(zf.getEntry(EURO_FOR_DOLLAR_TXT)); +assertNotNull(zf.getEntry(OIL_BARREL_TXT)); } finally { ZipFile.closeQuietly(zf); }
svn commit: r747005 - /commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
Author: bodewig Date: Mon Feb 23 13:14:39 2009 New Revision: 747005 URL: http://svn.apache.org/viewvc?rev=747005view=rev Log: use desired encoding when decoding a file name Modified: commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java (contents, props changed) Modified: commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java?rev=747005r1=747004r2=747005view=diff == --- commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java (original) +++ commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java Mon Feb 23 13:14:39 2009 @@ -538,7 +538,7 @@ return new String(bytes); } else { try { -return ZipEncodingHelper.decodeName(bytes, encoding); +return ZipEncodingHelper.decodeName(bytes, enc); } catch (java.nio.charset.UnsupportedCharsetException ex) { // Java 1.4's NIO doesn't recognize a few names that // String.getBytes does Propchange: commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java -- --- svn:mergeinfo (original) +++ svn:mergeinfo Mon Feb 23 13:14:39 2009 @@ -1 +1 @@ -/ant/core/trunk/src/main/org/apache/tools/zip/ZipFile.java:738844,738853,739300,741089 +/ant/core/trunk/src/main/org/apache/tools/zip/ZipFile.java:738844,738853,739300,741089,747002
svn commit: r747009 - /commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilTest.java
Author: sebb Date: Mon Feb 23 13:24:38 2009 New Revision: 747009 URL: http://svn.apache.org/viewvc?rev=747009view=rev Log: Remove unnecessary throws clause Modified: commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilTest.java Modified: commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilTest.java URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilTest.java?rev=747009r1=747008r2=747009view=diff == --- commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilTest.java (original) +++ commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilTest.java Mon Feb 23 13:24:38 2009 @@ -31,7 +31,7 @@ public class EnvironmentUtilTest extends TestCase { -public void testToStrings() throws IOException { +public void testToStrings() { TestUtil.assertEquals(null, EnvironmentUtils.toStrings(null), false); Map env = new HashMap();
svn commit: r747013 - /commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/environment/EnvironmentUtils.java
Author: sebb Date: Mon Feb 23 13:37:43 2009 New Revision: 747013 URL: http://svn.apache.org/viewvc?rev=747013view=rev Log: Update Javadoc. Fix local variable name typo. Modified: commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/environment/EnvironmentUtils.java Modified: commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/environment/EnvironmentUtils.java URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/environment/EnvironmentUtils.java?rev=747013r1=747012r2=747013view=diff == --- commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/environment/EnvironmentUtils.java (original) +++ commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/environment/EnvironmentUtils.java Mon Feb 23 13:37:43 2009 @@ -84,13 +84,14 @@ /** * Add a key/value pair to the given environment. + * If the key matches an existing key, the previous setting is replaced. * * @param environment the current environment * @param keyAndValue the key/value pair */ public static void addVariableToEnvironment(Map environment, String keyAndValue) { - String[] parsedVarible = parseEnvironmentVariable(keyAndValue); - environment.put(parsedVarible[0], parsedVarible[1]); + String[] parsedVariable = parseEnvironmentVariable(keyAndValue); + environment.put(parsedVariable[0], parsedVariable[1]); } /**
svn commit: r747014 - /commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilTest.java
Author: sebb Date: Mon Feb 23 13:38:34 2009 New Revision: 747014 URL: http://svn.apache.org/viewvc?rev=747014view=rev Log: Check that case is preserved for values, and that values are replaced Modified: commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilTest.java Modified: commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilTest.java URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilTest.java?rev=747014r1=747013r2=747014view=diff == --- commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilTest.java (original) +++ commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilTest.java Mon Feb 23 13:38:34 2009 @@ -93,6 +93,12 @@ assertEquals(bar, procEnvironment.get(FOO)); assertEquals(bar, procEnvironment.get(Foo)); assertEquals(bar, procEnvironment.get(foo)); + +// Check that case is preserved for values, and that values are replaced +EnvironmentUtils.addVariableToEnvironment( procEnvironment, foo=bAr ); +assertEquals(bAr, procEnvironment.get(FOO)); +assertEquals(bAr, procEnvironment.get(Foo)); +assertEquals(bAr, procEnvironment.get(foo)); } }
svn commit: r747018 - /commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilTest.java
Author: sebb Date: Mon Feb 23 13:47:04 2009 New Revision: 747018 URL: http://svn.apache.org/viewvc?rev=747018view=rev Log: Case-insensitive variables apply to all OSes Modified: commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilTest.java Modified: commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilTest.java URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilTest.java?rev=747018r1=747017r2=747018view=diff == --- commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilTest.java (original) +++ commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilTest.java Mon Feb 23 13:47:04 2009 @@ -93,8 +93,11 @@ assertEquals(bar, procEnvironment.get(FOO)); assertEquals(bar, procEnvironment.get(Foo)); assertEquals(bar, procEnvironment.get(foo)); - -// Check that case is preserved for values, and that values are replaced +} + +public void testCaseInsensitiveVariableLookup() throws Exception { +Map procEnvironment = EnvironmentUtils.getProcEnvironment(); +// Check that case is preserved for values EnvironmentUtils.addVariableToEnvironment( procEnvironment, foo=bAr ); assertEquals(bAr, procEnvironment.get(FOO)); assertEquals(bAr, procEnvironment.get(Foo));
svn commit: r747028 - /commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/util/MapUtils.java
Author: sebb Date: Mon Feb 23 14:24:45 2009 New Revision: 747028 URL: http://svn.apache.org/viewvc?rev=747028view=rev Log: No point creating Map if we're not going to use it. Modified: commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/util/MapUtils.java Modified: commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/util/MapUtils.java URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/util/MapUtils.java?rev=747028r1=747027r2=747028view=diff == --- commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/util/MapUtils.java (original) +++ commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/util/MapUtils.java Mon Feb 23 14:24:45 2009 @@ -59,12 +59,12 @@ */ public static Map prefix(Map source, String prefix) { -Map result = new HashMap(); - if(source == null) { return null; } +Map result = new HashMap(); + Iterator iter = source.entrySet().iterator(); while(iter.hasNext()) {
svn commit: r747051 - /commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/launcher/CommandLauncherProxy.java
Author: sebb Date: Mon Feb 23 15:33:45 2009 New Revision: 747051 URL: http://svn.apache.org/viewvc?rev=747051view=rev Log: Make private field final for better thread safety Modified: commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/launcher/CommandLauncherProxy.java Modified: commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/launcher/CommandLauncherProxy.java URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/launcher/CommandLauncherProxy.java?rev=747051r1=747050r2=747051view=diff == --- commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/launcher/CommandLauncherProxy.java (original) +++ commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/launcher/CommandLauncherProxy.java Mon Feb 23 15:33:45 2009 @@ -33,7 +33,7 @@ myLauncher = launcher; } -private CommandLauncher myLauncher; +private final CommandLauncher myLauncher; /** * Launches the given command in a new process. Delegates this method to the
svn commit: r747049 - /commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/environment/EnvironmentUtils.java
Author: sebb Date: Mon Feb 23 15:32:40 2009 New Revision: 747049 URL: http://svn.apache.org/viewvc?rev=747049view=rev Log: Make private static field final for better thread safety Modified: commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/environment/EnvironmentUtils.java Modified: commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/environment/EnvironmentUtils.java URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/environment/EnvironmentUtils.java?rev=747049r1=747048r2=747049view=diff == --- commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/environment/EnvironmentUtils.java (original) +++ commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/environment/EnvironmentUtils.java Mon Feb 23 15:32:40 2009 @@ -30,7 +30,7 @@ public class EnvironmentUtils { - private static DefaultProcessingEnvironment procEnvironment; + private static final DefaultProcessingEnvironment procEnvironment; static { if (OS.isFamilyOpenVms()) {
svn commit: r747054 - /commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/ExecuteWatchdog.java
Author: sebb Date: Mon Feb 23 15:50:05 2009 New Revision: 747054 URL: http://svn.apache.org/viewvc?rev=747054view=rev Log: Other accesses to watch and process are synchronized Make private field final Modified: commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/ExecuteWatchdog.java Modified: commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/ExecuteWatchdog.java URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/ExecuteWatchdog.java?rev=747054r1=747053r2=747054view=diff == --- commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/ExecuteWatchdog.java (original) +++ commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/ExecuteWatchdog.java Mon Feb 23 15:50:05 2009 @@ -49,7 +49,7 @@ private boolean killedProcess; /** Will tell us whether timeout has occurred. */ -private Watchdog watchdog; +private final Watchdog watchdog; /** * Creates a new watchdog with a given timeout. @@ -172,7 +172,7 @@ /** * reset the monitor flag and the process. */ -protected void cleanUp() { +protected synchronized void cleanUp() { watch = false; process = null; }
svn commit: r747056 - in /commons/proper/exec/trunk/src/main/java/org/apache/commons/exec: CommandLine.java DefaultExecutor.java ExecuteException.java LogOutputStream.java PumpStreamHandler.java Strea
Author: sebb Date: Mon Feb 23 16:03:17 2009 New Revision: 747056 URL: http://svn.apache.org/viewvc?rev=747056view=rev Log: Make private variables final where possible Modified: commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/CommandLine.java commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/DefaultExecutor.java commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/ExecuteException.java commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/LogOutputStream.java commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/PumpStreamHandler.java commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/StreamPumper.java commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/Watchdog.java Modified: commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/CommandLine.java URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/CommandLine.java?rev=747056r1=747055r2=747056view=diff == --- commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/CommandLine.java (original) +++ commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/CommandLine.java Mon Feb 23 16:03:17 2009 @@ -34,12 +34,12 @@ /** * The arguments of the command. */ -private Vector arguments = new Vector(); +private final Vector arguments = new Vector(); /** * The program to execute. */ -private String executable; +private final String executable; /** * A map of name value pairs used to expand command line arguments @@ -96,7 +96,7 @@ */ public CommandLine(String executable) { this.isFile=false; -setExecutable(executable); +this.executable=getExecutable(executable); } /** @@ -106,7 +106,7 @@ */ public CommandLine(File executable) { this.isFile=true; -setExecutable(executable.getAbsolutePath()); +this.executable=getExecutable(executable.getAbsolutePath()); } /** @@ -391,18 +391,18 @@ } /** - * Set the executable - the argument is trimmed and '/' and '\\' are + * Get the executable - the argument is trimmed and '/' and '\\' are * replaced with the platform specific file seperator char * * @param executable the executable */ -private void setExecutable(final String executable) { +private String getExecutable(final String executable) { if (executable == null) { throw new IllegalArgumentException(Executable can not be null); } else if(executable.trim().length() == 0) { throw new IllegalArgumentException(Executable can not be empty); } else { -this.executable = StringUtils.fixFileSeparatorChar(executable); +return StringUtils.fixFileSeparatorChar(executable); } } } Modified: commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/DefaultExecutor.java URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/DefaultExecutor.java?rev=747056r1=747055r2=747056view=diff == --- commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/DefaultExecutor.java (original) +++ commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/DefaultExecutor.java Mon Feb 23 16:03:17 2009 @@ -58,7 +58,7 @@ private int[] exitValues; /** launches the command in a new process */ -private CommandLauncher launcher; +private final CommandLauncher launcher; /** optional cleanup of started processes */ private ProcessDestroyer processDestroyer; Modified: commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/ExecuteException.java URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/ExecuteException.java?rev=747056r1=747055r2=747056view=diff == --- commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/ExecuteException.java (original) +++ commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/ExecuteException.java Mon Feb 23 16:03:17 2009 @@ -33,12 +33,12 @@ /** * The underlying cause of this exception. */ - private Throwable cause; + private final Throwable cause; /** * The exit value returned by the failed process */ - private int exitValue; + private final int exitValue; /** * Construct a new exception with the specified detail message. @@ -49,6 +49,7 @@ */ public ExecuteException(final String message, int exitValue) { super(message + (Exit value: + exitValue + )); +this.cause = null;
svn commit: r747060 - /commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilTest.java
Author: sebb Date: Mon Feb 23 16:09:54 2009 New Revision: 747060 URL: http://svn.apache.org/viewvc?rev=747060view=rev Log: Duh - only run case-insensitive key lookup on Windows Modified: commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilTest.java Modified: commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilTest.java URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilTest.java?rev=747060r1=747059r2=747060view=diff == --- commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilTest.java (original) +++ commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilTest.java Mon Feb 23 16:09:54 2009 @@ -99,8 +99,6 @@ Map procEnvironment = EnvironmentUtils.getProcEnvironment(); // Check that case is preserved for values EnvironmentUtils.addVariableToEnvironment( procEnvironment, foo=bAr ); -assertEquals(bAr, procEnvironment.get(FOO)); -assertEquals(bAr, procEnvironment.get(Foo)); assertEquals(bAr, procEnvironment.get(foo)); }
svn commit: r747071 - /commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/utils/CompressUtils.java
Author: bodewig Date: Mon Feb 23 16:33:10 2009 New Revision: 747071 URL: http://svn.apache.org/viewvc?rev=747071view=rev Log: remove unused class. SANDBOX-287 Removed: commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/utils/CompressUtils.java
svn commit: r747130 - in /commons/proper/exec/trunk/src/main/java/org/apache/commons/exec: CommandLine.java PumpStreamHandler.java
Author: sgoeschl Date: Mon Feb 23 20:42:57 2009 New Revision: 747130 URL: http://svn.apache.org/viewvc?rev=747130view=rev Log: Minor javadoc improvements Modified: commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/CommandLine.java commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/PumpStreamHandler.java Modified: commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/CommandLine.java URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/CommandLine.java?rev=747130r1=747129r2=747130view=diff == --- commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/CommandLine.java (original) +++ commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/CommandLine.java Mon Feb 23 20:42:57 2009 @@ -395,6 +395,7 @@ * replaced with the platform specific file seperator char * * @param executable the executable + * @return the platform-specific executable string */ private String getExecutable(final String executable) { if (executable == null) { Modified: commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/PumpStreamHandler.java URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/PumpStreamHandler.java?rev=747130r1=747129r2=747130view=diff == --- commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/PumpStreamHandler.java (original) +++ commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/PumpStreamHandler.java Mon Feb 23 20:42:57 2009 @@ -255,6 +255,10 @@ /** * Creates a stream pumper to copy the given input stream to the given * output stream. + * + * @param is the input stream to copy from + * @param os the output stream to copy into + * @return the stream pumper thread */ protected Thread createPump(final InputStream is, final OutputStream os) { return createPump(is, os, false); @@ -263,6 +267,11 @@ /** * Creates a stream pumper to copy the given input stream to the given * output stream. + * + * @param is the input stream to copy from + * @param os the output stream to copy into + * @param closeWhenExhausted close the output stream when the input stream is exhausted + * @return the stream pumper thread */ protected Thread createPump(final InputStream is, final OutputStream os, final boolean closeWhenExhausted) {
svn commit: r747132 - /commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilTest.java
Author: sgoeschl Date: Mon Feb 23 20:49:37 2009 New Revision: 747132 URL: http://svn.apache.org/viewvc?rev=747132view=rev Log: Minor javadoc improvements Modified: commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilTest.java Modified: commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilTest.java URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilTest.java?rev=747132r1=747131r2=747132view=diff == --- commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilTest.java (original) +++ commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilTest.java Mon Feb 23 20:49:37 2009 @@ -31,21 +31,20 @@ public class EnvironmentUtilTest extends TestCase { +/** + * Tests the behaviour of the EnvironmentUtils.toStrings() + * when using a codenull/code environment. + */ public void testToStrings() { +// check for a non-existing environment when passing null TestUtil.assertEquals(null, EnvironmentUtils.toStrings(null), false); - +// check for an environment when filling in two variables Map env = new HashMap(); - TestUtil.assertEquals(new String[0], EnvironmentUtils.toStrings(env), false); - env.put(foo2, bar2); env.put(foo, bar); - String[] envStrings = EnvironmentUtils.toStrings(env); - String[] expected = new String[]{foo=bar, foo2=bar2}; - - TestUtil.assertEquals(expected, envStrings, false); } @@ -57,7 +56,7 @@ public void testGetProcEnvironment() throws IOException { Map procEnvironment = EnvironmentUtils.getProcEnvironment(); // we assume that there is at least one environment variable -// for this process +// for this process, i.e. $JAVA_HOME assertTrue(procEnvironment.size() 0); String[] envArgs = EnvironmentUtils.toStrings(procEnvironment); for(int i=0; ienvArgs.length; i++) { @@ -94,7 +93,13 @@ assertEquals(bar, procEnvironment.get(Foo)); assertEquals(bar, procEnvironment.get(foo)); } - + +/** + * Accessing environment variables is case-sensitive or not depending + * on the operating system but the values of the environment variable + * are always case-sensitive. So make sure that this assumption holds + * on all operating systems. + */ public void testCaseInsensitiveVariableLookup() throws Exception { Map procEnvironment = EnvironmentUtils.getProcEnvironment(); // Check that case is preserved for values
svn commit: r747158 - in /commons/proper/exec/trunk/src: changes/changes.xml main/java/org/apache/commons/exec/environment/OpenVmsProcessingEnvironment.java
Author: sgoeschl Date: Mon Feb 23 22:05:06 2009 New Revision: 747158 URL: http://svn.apache.org/viewvc?rev=747158view=rev Log: [EXEC-37] Removed useless synchronized statement in OpenVmsProcessingEnvironment.createProcEnvironment() since the method is only called from a synchronized public method. Modified: commons/proper/exec/trunk/src/changes/changes.xml commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/environment/OpenVmsProcessingEnvironment.java Modified: commons/proper/exec/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/changes/changes.xml?rev=747158r1=747157r2=747158view=diff == --- commons/proper/exec/trunk/src/changes/changes.xml (original) +++ commons/proper/exec/trunk/src/changes/changes.xml Mon Feb 23 22:05:06 2009 @@ -24,6 +24,10 @@ /properties body release version=1.0.0 date=As in SVN description=Sandbox release + action dev=sgoeschl type=fix due-to=Sebastien Bazleyissue=EXEC-37 +Removed useless synchronized statement in +OpenVmsProcessingEnvironment.createProcEnvironment + /action action dev=sgoeschl type=fix issue=EXEC-33 Using System.in for child process will actually hang your application - see JIRA for more details. Since there is no easy fix an Modified: commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/environment/OpenVmsProcessingEnvironment.java URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/environment/OpenVmsProcessingEnvironment.java?rev=747158r1=747157r2=747158view=diff == --- commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/environment/OpenVmsProcessingEnvironment.java (original) +++ commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/environment/OpenVmsProcessingEnvironment.java Mon Feb 23 22:05:06 2009 @@ -37,7 +37,7 @@ * @return a amp containing the environment variables * @throws IOException the operation failed */ -protected synchronized Map createProcEnvironment() throws IOException { +protected Map createProcEnvironment() throws IOException { if (procEnvironment == null) { procEnvironment = new HashMap();
svn commit: r747161 - /commons/proper/exec/trunk/src/changes/changes.xml
Author: sgoeschl Date: Mon Feb 23 22:09:44 2009 New Revision: 747161 URL: http://svn.apache.org/viewvc?rev=747161view=rev Log: Fixed broken changes.xml - typo ... Modified: commons/proper/exec/trunk/src/changes/changes.xml Modified: commons/proper/exec/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/changes/changes.xml?rev=747161r1=747160r2=747161view=diff == --- commons/proper/exec/trunk/src/changes/changes.xml (original) +++ commons/proper/exec/trunk/src/changes/changes.xml Mon Feb 23 22:09:44 2009 @@ -24,7 +24,7 @@ /properties body release version=1.0.0 date=As in SVN description=Sandbox release - action dev=sgoeschl type=fix due-to=Sebastien Bazleyissue=EXEC-37 + action dev=sgoeschl type=fix due-to=Sebastien Bazley issue=EXEC-37 Removed useless synchronized statement in OpenVmsProcessingEnvironment.createProcEnvironment /action
svn commit: r747184 - /commons/sandbox/money/trunk/pom.xml
Author: mbenson Date: Mon Feb 23 22:51:34 2009 New Revision: 747184 URL: http://svn.apache.org/viewvc?rev=747184view=rev Log: remove tabs Modified: commons/sandbox/money/trunk/pom.xml Modified: commons/sandbox/money/trunk/pom.xml URL: http://svn.apache.org/viewvc/commons/sandbox/money/trunk/pom.xml?rev=747184r1=747183r2=747184view=diff == --- commons/sandbox/money/trunk/pom.xml (original) +++ commons/sandbox/money/trunk/pom.xml Mon Feb 23 22:51:34 2009 @@ -29,18 +29,16 @@ nameCommons Money (Sandbox)/name urlhttp://commons.apache.org/sandbox/money//url inceptionYear2009/inceptionYear - description -Commons Money - /description + descriptionCommons Money/description dependencies - dependency - groupIdorg.testng/groupId - artifactIdtestng/artifactId - version5.8/version - classifierjdk15/classifier - scopetest/scope - /dependency +dependency + groupIdorg.testng/groupId + artifactIdtestng/artifactId + version5.8/version + classifierjdk15/classifier + scopetest/scope + /dependency /dependencies developers @@ -60,8 +58,8 @@ urlhttp://svn.apache.org/repos/asf/commons/sandbox/money/trunk/url /scm dependencyManagement - dependencies - /dependencies +dependencies +/dependencies /dependencyManagement distributionManagement @@ -80,8 +78,8 @@ /properties build - sourceDirectorysrc/main/java/sourceDirectory - testSourceDirectorysrc/test/java/testSourceDirectory +sourceDirectorysrc/main/java/sourceDirectory +testSourceDirectorysrc/test/java/testSourceDirectory /build reporting
svn commit: r747190 - in /commons/proper/exec/trunk: NOTICE.txt build.xml src/changes/changes.xml
Author: sgoeschl Date: Mon Feb 23 23:10:56 2009 New Revision: 747190 URL: http://svn.apache.org/viewvc?rev=747190view=rev Log: Preparing the next release candidate ... Modified: commons/proper/exec/trunk/NOTICE.txt commons/proper/exec/trunk/build.xml commons/proper/exec/trunk/src/changes/changes.xml Modified: commons/proper/exec/trunk/NOTICE.txt URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/NOTICE.txt?rev=747190r1=747189r2=747190view=diff == --- commons/proper/exec/trunk/NOTICE.txt (original) +++ commons/proper/exec/trunk/NOTICE.txt Mon Feb 23 23:10:56 2009 @@ -1,5 +1,5 @@ Apache Commons Exec -Copyright 2005-2008 The Apache Software Foundation +Copyright 2005-2009 The Apache Software Foundation This product includes software developed by The Apache Software Foundation (http://www.apache.org/). Modified: commons/proper/exec/trunk/build.xml URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/build.xml?rev=747190r1=747189r2=747190view=diff == --- commons/proper/exec/trunk/build.xml (original) +++ commons/proper/exec/trunk/build.xml Mon Feb 23 23:10:56 2009 @@ -112,6 +112,9 @@ /copy !-- make the shell script files readable/executable -- chmod dir=${maven.build.directory}/dist perm=ugo+rx includes=**/*.sh/ +!-- copy the various legal files -- +copy file=${basedir}/NOTICE.txt tofile=${maven.build.directory}/dist/NOTICE.txt/ +copy file=${basedir}/LICENSE.txt tofile=${maven.build.directory}/dist/LICENSE.txt/ /target !-- Create a zip containing the test environment -- Modified: commons/proper/exec/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/changes/changes.xml?rev=747190r1=747189r2=747190view=diff == --- commons/proper/exec/trunk/src/changes/changes.xml (original) +++ commons/proper/exec/trunk/src/changes/changes.xml Mon Feb 23 23:10:56 2009 @@ -23,7 +23,7 @@ author email=sgoes...@apache.orgSiegfried Goeschl/author /properties body -release version=1.0.0 date=As in SVN description=Sandbox release +release version=1.0.0 date=As in SVN description=First Public Release action dev=sgoeschl type=fix due-to=Sebastien Bazley issue=EXEC-37 Removed useless synchronized statement in OpenVmsProcessingEnvironment.createProcEnvironment
svn commit: r747191 - /commons/proper/exec/trunk/src/changes/changes.xml
Author: sgoeschl Date: Mon Feb 23 23:15:08 2009 New Revision: 747191 URL: http://svn.apache.org/viewvc?rev=747191view=rev Log: Preparing the next release candidate ... Modified: commons/proper/exec/trunk/src/changes/changes.xml Modified: commons/proper/exec/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/changes/changes.xml?rev=747191r1=747190r2=747191view=diff == --- commons/proper/exec/trunk/src/changes/changes.xml (original) +++ commons/proper/exec/trunk/src/changes/changes.xml Mon Feb 23 23:15:08 2009 @@ -23,7 +23,7 @@ author email=sgoes...@apache.orgSiegfried Goeschl/author /properties body -release version=1.0.0 date=As in SVN description=First Public Release +release version=1.0.0 date=2009-02-24 description=First Public Release action dev=sgoeschl type=fix due-to=Sebastien Bazley issue=EXEC-37 Removed useless synchronized statement in OpenVmsProcessingEnvironment.createProcEnvironment
svn commit: r747195 - /commons/proper/exec/tags/EXEC_1_0_0/
Author: sgoeschl Date: Mon Feb 23 23:21:25 2009 New Revision: 747195 URL: http://svn.apache.org/viewvc?rev=747195view=rev Log: Preparing next release candidate ... Removed: commons/proper/exec/tags/EXEC_1_0_0/
svn commit: r747202 - /commons/proper/exec/trunk/pom.xml
Author: sgoeschl Date: Mon Feb 23 23:30:46 2009 New Revision: 747202 URL: http://svn.apache.org/viewvc?rev=747202view=rev Log: [maven-release-plugin] prepare release EXEC_1_0_0 Modified: commons/proper/exec/trunk/pom.xml Modified: commons/proper/exec/trunk/pom.xml URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/pom.xml?rev=747202r1=747201r2=747202view=diff == --- commons/proper/exec/trunk/pom.xml (original) +++ commons/proper/exec/trunk/pom.xml Mon Feb 23 23:30:46 2009 @@ -27,7 +27,7 @@ nameCommons Exec/name groupIdorg.apache.commons/groupId artifactIdcommons-exec/artifactId - version1.0.0-SNAPSHOT/version + version1.0.0/version descriptionA library to reliably execute external processes from within the JVM/description urlhttp://commons.apache.org/exec//url @@ -81,9 +81,9 @@ /contributors scm - connectionscm:svn:http://svn.apache.org/repos/asf/commons/proper/exec/trunk/connection - developerConnectionscm:svn:https://svn.apache.org/repos/asf/commons/proper/exec/trunk/developerConnection -urlhttp://svn.apache.org/viewvc/commons/proper/exec/trunk/url + connectionscm:svn:http://svn.apache.org/repos/asf/commons/proper/exec/tags/EXEC_1_0_0/connection + developerConnectionscm:svn:https://svn.apache.org/repos/asf/commons/proper/exec/tags/EXEC_1_0_0/developerConnection +urlhttp://svn.apache.org/viewvc/commons/proper/exec/tags/EXEC_1_0_0/url /scm build
svn commit: r747205 - /commons/proper/exec/trunk/pom.xml
Author: sgoeschl Date: Mon Feb 23 23:31:15 2009 New Revision: 747205 URL: http://svn.apache.org/viewvc?rev=747205view=rev Log: [maven-release-plugin] prepare for next development iteration Modified: commons/proper/exec/trunk/pom.xml Modified: commons/proper/exec/trunk/pom.xml URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/pom.xml?rev=747205r1=747204r2=747205view=diff == --- commons/proper/exec/trunk/pom.xml (original) +++ commons/proper/exec/trunk/pom.xml Mon Feb 23 23:31:15 2009 @@ -27,7 +27,7 @@ nameCommons Exec/name groupIdorg.apache.commons/groupId artifactIdcommons-exec/artifactId - version1.0.0/version + version1.0.1-SNAPSHOT/version descriptionA library to reliably execute external processes from within the JVM/description urlhttp://commons.apache.org/exec//url @@ -81,9 +81,9 @@ /contributors scm - connectionscm:svn:http://svn.apache.org/repos/asf/commons/proper/exec/tags/EXEC_1_0_0/connection - developerConnectionscm:svn:https://svn.apache.org/repos/asf/commons/proper/exec/tags/EXEC_1_0_0/developerConnection -urlhttp://svn.apache.org/viewvc/commons/proper/exec/tags/EXEC_1_0_0/url + connectionscm:svn:http://svn.apache.org/repos/asf/commons/proper/exec/trunk/connection + developerConnectionscm:svn:https://svn.apache.org/repos/asf/commons/proper/exec/trunk/developerConnection +urlhttp://svn.apache.org/viewvc/commons/proper/exec/trunk/url /scm build
svn commit: r747219 - /commons/proper/exec/trunk/findbugs-exclude-filter.xml
Author: sebb Date: Mon Feb 23 23:41:50 2009 New Revision: 747219 URL: http://svn.apache.org/viewvc?rev=747219view=rev Log: Add svn:eol Modified: commons/proper/exec/trunk/findbugs-exclude-filter.xml (props changed) Propchange: commons/proper/exec/trunk/findbugs-exclude-filter.xml -- svn:eol-style = native