svn commit: r748453 - /commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/HelpFormatter.java

2009-02-27 Thread bayard
Author: bayard
Date: Fri Feb 27 09:18:38 2009
New Revision: 748453

URL: http://svn.apache.org/viewvc?rev=748453view=rev
Log:
Improving the order of the code - no point using a variable before it is tested

Modified:

commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/HelpFormatter.java

Modified: 
commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/HelpFormatter.java
URL: 
http://svn.apache.org/viewvc/commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/HelpFormatter.java?rev=748453r1=748452r2=748453view=diff
==
--- 
commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/HelpFormatter.java
 (original)
+++ 
commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/HelpFormatter.java
 Fri Feb 27 09:18:38 2009
@@ -819,10 +819,6 @@
 }
 sb.append(rtrim(text.substring(0, pos))).append(defaultNewLine);
 
-// all following lines must be padded with nextLineTabStop space 
-// characters
-final String padding = createPadding(nextLineTabStop);
-
 if (nextLineTabStop = width)
 {
 // stops infinite loop happening
@@ -830,6 +826,10 @@
 - no room for the description);
 }
 
+// all following lines must be padded with nextLineTabStop space 
+// characters
+final String padding = createPadding(nextLineTabStop);
+
 while (true)
 {
 text = padding + text.substring(pos).trim();




svn commit: r748461 - in /commons/proper/cli/branches/cli-1.x/src: java/org/apache/commons/cli/HelpFormatter.java test/org/apache/commons/cli/bug/BugCLI162Test.java

2009-02-27 Thread bayard
Author: bayard
Date: Fri Feb 27 09:34:11 2009
New Revision: 748461

URL: http://svn.apache.org/viewvc?rev=748461view=rev
Log:
Switching from the IllegalStateException to trying hard to work. A better user 
experience and didn't end up with the code being any more evil. CLI-162

Modified:

commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/HelpFormatter.java

commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/bug/BugCLI162Test.java

Modified: 
commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/HelpFormatter.java
URL: 
http://svn.apache.org/viewvc/commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/HelpFormatter.java?rev=748461r1=748460r2=748461view=diff
==
--- 
commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/HelpFormatter.java
 (original)
+++ 
commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/HelpFormatter.java
 Fri Feb 27 09:34:11 2009
@@ -822,8 +822,7 @@
 if (nextLineTabStop = width)
 {
 // stops infinite loop happening
-throw new IllegalStateException(Total width is less than the 
width of the argument and indent  + 
-- no room for the description);
+nextLineTabStop = width - 1;
 }
 
 // all following lines must be padded with nextLineTabStop space 

Modified: 
commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/bug/BugCLI162Test.java
URL: 
http://svn.apache.org/viewvc/commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/bug/BugCLI162Test.java?rev=748461r1=748460r2=748461view=diff
==
--- 
commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/bug/BugCLI162Test.java
 (original)
+++ 
commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/bug/BugCLI162Test.java
 Fri Feb 27 09:34:11 2009
@@ -259,14 +259,44 @@
 yes.\n +
   Footer\n;
 assertEquals( Long arguments did not split as expected, expected, 
sw.toString() );
+}
 
-try {
-formatter.printHelp(new PrintWriter(sw), 22, 
this.getClass().getName(), Header, options, 0, 5, Footer);
-fail(IllegalStateException expected);
-} catch(IllegalStateException ise) {
-// expected
-}
-
+public void testLongLineChunkingIndentIgnored() throws ParseException, 
IOException {
+Options options = new Options();
+options.addOption(x, extralongarg, false, This description is 
Long. );
+HelpFormatter formatter = new HelpFormatter();
+StringWriter sw = new StringWriter();
+formatter.printHelp(new PrintWriter(sw), 22, 
this.getClass().getName(), Header, options, 0, 5, Footer);
+String expected = usage:\n +
+ org.apache.comm\n +
+ ons.cli.bug.Bug\n +
+ CLI162Test\n +
+  Header\n +
+  -x,--extralongarg\n +
+   T\n +
+   h\n +
+   i\n +
+   s\n +
+   d\n +
+   e\n +
+   s\n +
+   c\n +
+   r\n +
+   i\n +
+   p\n +
+   t\n +
+   i\n +
+   o\n +
+   n\n +
+   i\n +
+   s\n +
+   L\n +
+   o\n +
+   n\n +
+   g\n +
+   .\n +
+  Footer\n;
+assertEquals( Long arguments did not split as expected, expected, 
sw.toString() );
 }
 
 }




svn commit: r748463 - in /commons/proper/cli/branches/cli-1.x/src: java/org/apache/commons/cli/HelpFormatter.java test/org/apache/commons/cli/bug/BugCLI162Test.java

2009-02-27 Thread bayard
Author: bayard
Date: Fri Feb 27 09:38:10 2009
New Revision: 748463

URL: http://svn.apache.org/viewvc?rev=748463view=rev
Log:
Adjusting - best is to switch to an indent of 1 than do silly things like 
having every line have 1 character. CLI-162

Modified:

commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/HelpFormatter.java

commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/bug/BugCLI162Test.java

Modified: 
commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/HelpFormatter.java
URL: 
http://svn.apache.org/viewvc/commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/HelpFormatter.java?rev=748463r1=748462r2=748463view=diff
==
--- 
commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/HelpFormatter.java
 (original)
+++ 
commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/HelpFormatter.java
 Fri Feb 27 09:38:10 2009
@@ -822,7 +822,7 @@
 if (nextLineTabStop = width)
 {
 // stops infinite loop happening
-nextLineTabStop = width - 1;
+nextLineTabStop = 1;
 }
 
 // all following lines must be padded with nextLineTabStop space 

Modified: 
commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/bug/BugCLI162Test.java
URL: 
http://svn.apache.org/viewvc/commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/bug/BugCLI162Test.java?rev=748463r1=748462r2=748463view=diff
==
--- 
commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/bug/BugCLI162Test.java
 (original)
+++ 
commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/bug/BugCLI162Test.java
 Fri Feb 27 09:38:10 2009
@@ -267,34 +267,15 @@
 HelpFormatter formatter = new HelpFormatter();
 StringWriter sw = new StringWriter();
 formatter.printHelp(new PrintWriter(sw), 22, 
this.getClass().getName(), Header, options, 0, 5, Footer);
+System.err.println(sw.toString());
 String expected = usage:\n +
  org.apache.comm\n +
  ons.cli.bug.Bug\n +
  CLI162Test\n +
   Header\n +
   -x,--extralongarg\n +
-   T\n +
-   h\n +
-   i\n +
-   s\n +
-   d\n +
-   e\n +
-   s\n +
-   c\n +
-   r\n +
-   i\n +
-   p\n +
-   t\n +
-   i\n +
-   o\n +
-   n\n +
-   i\n +
-   s\n +
-   L\n +
-   o\n +
-   n\n +
-   g\n +
-   .\n +
+   This description is\n +
+   Long.\n +
   Footer\n;
 assertEquals( Long arguments did not split as expected, expected, 
sw.toString() );
 }




svn commit: r748464 - /commons/proper/cli/branches/cli-1.x/pom.xml

2009-02-27 Thread bayard
Author: bayard
Date: Fri Feb 27 09:38:36 2009
New Revision: 748464

URL: http://svn.apache.org/viewvc?rev=748464view=rev
Log:
Moving to RC3

Modified:
commons/proper/cli/branches/cli-1.x/pom.xml

Modified: commons/proper/cli/branches/cli-1.x/pom.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/cli/branches/cli-1.x/pom.xml?rev=748464r1=748463r2=748464view=diff
==
--- commons/proper/cli/branches/cli-1.x/pom.xml (original)
+++ commons/proper/cli/branches/cli-1.x/pom.xml Fri Feb 27 09:38:36 2009
@@ -138,7 +138,7 @@
 commons.jira.idCLI/commons.jira.id
 commons.jira.pid12310463/commons.jira.pid
 !-- The RC version used in the staging repository URL. --
-commons.rc.versionRC2/commons.rc.version
+commons.rc.versionRC3/commons.rc.version
   /properties
 
   build




svn commit: r748466 - /commons/proper/cli/tags/cli-1.2-RC3/

2009-02-27 Thread bayard
Author: bayard
Date: Fri Feb 27 09:42:53 2009
New Revision: 748466

URL: http://svn.apache.org/viewvc?rev=748466view=rev
Log:
Tagging RC3 of CLI-1.2

Added:
commons/proper/cli/tags/cli-1.2-RC3/
  - copied from r748465, commons/proper/cli/branches/cli-1.x/



svn commit: r748556 - in /commons/sandbox/compress/trunk/src: main/java/org/apache/commons/compress/archivers/zip/ZipFile.java test/java/org/apache/commons/compress/archivers/zip/UTF8ZipFilesTest.java

2009-02-27 Thread bodewig
Author: bodewig
Date: Fri Feb 27 15:29:25 2009
New Revision: 748556

URL: http://svn.apache.org/viewvc?rev=748556view=rev
Log:
look for Unicode extra fields by default

Modified:

commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java

commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/UTF8ZipFilesTest.java

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=748556r1=748555r2=748556view=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
 Fri Feb 27 15:29:25 2009
@@ -132,7 +132,7 @@
 
 /**
  * Opens the given file for reading, assuming the specified
- * encoding for file names and ignoring unicode extra fields.
+ * encoding for file names, scanning unicode extra fields.
  *
  * @param name name of the archive.
  * @param encoding the encoding to use for file names, use null
@@ -141,12 +141,12 @@
  * @throws IOException if an error occurs while reading the file.
  */
 public ZipFile(String name, String encoding) throws IOException {
-this(new File(name), encoding, false);
+this(new File(name), encoding, true);
 }
 
 /**
  * Opens the given file for reading, assuming the specified
- * encoding for file names and ignoring unicode extra fields.
+ * encoding for file names and scanning for unicode extra fields.
  *
  * @param f the archive.
  * @param encoding the encoding to use for file names, use null
@@ -155,7 +155,7 @@
  * @throws IOException if an error occurs while reading the file.
  */
 public ZipFile(File f, String encoding) throws IOException {
-this(f, encoding, false);
+this(f, encoding, true);
 }
 
 /**

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=748556r1=748555r2=748556view=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
 Fri Feb 27 15:29:25 2009
@@ -89,7 +89,7 @@
 File archive = new File(new URI(zip.toString()));
 ZipFile zf = null;
 try {
-zf = new ZipFile(archive, CP437);
+zf = new ZipFile(archive, CP437, false);
 assertNotNull(zf.getEntry(ASCII_TXT));
 assertNotNull(zf.getEntry(EURO_FOR_DOLLAR_TXT));
 assertNotNull(zf.getEntry(OIL_BARREL_TXT));
@@ -199,7 +199,7 @@
 throws IOException {
 ZipFile zf = null;
 try {
-zf = new ZipFile(file, encoding);
+zf = new ZipFile(file, encoding, false);
 
 Enumeration e = zf.getEntries();
 while (e.hasMoreElements()) {