You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by ah...@apache.org on 2005/10/02 00:48:37 UTC

svn commit: r293038 - in /maven/maven-1/plugins/trunk/javadoc: project.xml src/main/org/apache/maven/javadoc/JavadocWarningsTextToXml.java src/test/org/apache/maven/javadoc/JavadocWarningsTextToXmlTest.java

Author: aheritier
Date: Sat Oct  1 15:48:27 2005
New Revision: 293038

URL: http://svn.apache.org/viewcvs?rev=293038&view=rev
Log:
Don't use commons-collections 3.1 which is binary incompatible with commons-collections 2.1 (bundled in maven 1.0.2)
downgrade to 3.0

Modified:
    maven/maven-1/plugins/trunk/javadoc/project.xml
    maven/maven-1/plugins/trunk/javadoc/src/main/org/apache/maven/javadoc/JavadocWarningsTextToXml.java
    maven/maven-1/plugins/trunk/javadoc/src/test/org/apache/maven/javadoc/JavadocWarningsTextToXmlTest.java

Modified: maven/maven-1/plugins/trunk/javadoc/project.xml
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/javadoc/project.xml?rev=293038&r1=293037&r2=293038&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/javadoc/project.xml (original)
+++ maven/maven-1/plugins/trunk/javadoc/project.xml Sat Oct  1 15:48:27 2005
@@ -140,7 +140,7 @@
     <dependency>
       <groupId>commons-collections</groupId>
       <artifactId>commons-collections</artifactId>
-      <version>3.1</version>
+      <version>3.0</version>
       <type>jar</type>
       <properties/>
     </dependency>

Modified: maven/maven-1/plugins/trunk/javadoc/src/main/org/apache/maven/javadoc/JavadocWarningsTextToXml.java
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/javadoc/src/main/org/apache/maven/javadoc/JavadocWarningsTextToXml.java?rev=293038&r1=293037&r2=293038&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/javadoc/src/main/org/apache/maven/javadoc/JavadocWarningsTextToXml.java (original)
+++ maven/maven-1/plugins/trunk/javadoc/src/main/org/apache/maven/javadoc/JavadocWarningsTextToXml.java Sat Oct  1 15:48:27 2005
@@ -17,26 +17,6 @@
  * ====================================================================
  */
 
-import org.apache.commons.collections.set.ListOrderedSet;
-import org.apache.commons.lang.StringEscapeUtils;
-import org.apache.commons.lang.StringUtils;
-
-/* ====================================================================
- *   Copyright 2001-2004 The Apache Software Foundation.
- *
- *   Licensed under the Apache License, Version 2.0 (the "License");
- *   you may not use this file except in compliance with the License.
- *   You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing, software
- *   distributed under the License is distributed on an "AS IS" BASIS,
- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *   See the License for the specific language governing permissions and
- *   limitations under the License.
- * ====================================================================
- */
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileNotFoundException;
@@ -46,13 +26,17 @@
 import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
 import java.io.UnsupportedEncodingException;
-
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.TreeMap;
+import java.util.TreeSet;
+
+import org.apache.commons.collections.SetUtils;
+import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.commons.lang.StringUtils;
 
 /**
  * Converts the javadoc warnings into an xml (xdoc format) file.
@@ -103,20 +87,20 @@
      * @throws IOException if an exception occurs opening, reading, or writing
      *         files
      */
-    public static void main(final String[] args)
+    public static void main( final String[] args )
         throws IOException
     {
-        if (args.length != ARGS_LENGTH)
+        if ( args.length != ARGS_LENGTH )
         {
-            throw new IllegalArgumentException("Wrong number of arguments");
+            throw new IllegalArgumentException( "Wrong number of arguments" );
         }
 
         JavadocWarningsTextToXml runner = new JavadocWarningsTextToXml();
         int i = 0;
 
-        runner.setInputFileName(args[i++]);
-        runner.setOutputFileName(args[i++]);
-        runner.setOutputEncoding(args[i++]);
+        runner.setInputFileName( args[i++] );
+        runner.setOutputFileName( args[i++] );
+        runner.setOutputEncoding( args[i++] );
         runner.build();
     }
 
@@ -126,12 +110,11 @@
      *
      * @param inputFileNameValue the input file name
      */
-    public void setInputFileName(final String inputFileNameValue)
+    public void setInputFileName( final String inputFileNameValue )
     {
-        if (this.isVerbose())
+        if ( this.isVerbose() )
         {
-            System.out.println("Setting input file name: '" + inputFileNameValue
-                + "'");
+            System.out.println( "Setting input file name: '" + inputFileNameValue + "'" );
         }
 
         this.inputFileName = inputFileNameValue;
@@ -152,7 +135,7 @@
      *
      * @param outputEncodingValue the output encoding
      */
-    public void setOutputEncoding(final String outputEncodingValue)
+    public void setOutputEncoding( final String outputEncodingValue )
     {
         this.outputEncoding = outputEncodingValue;
     }
@@ -172,12 +155,11 @@
      *
      * @param outputFileNameValue the output file name
      */
-    public void setOutputFileName(final String outputFileNameValue)
+    public void setOutputFileName( final String outputFileNameValue )
     {
-        if (this.isVerbose())
+        if ( this.isVerbose() )
         {
-            System.out.println("Setting output file name: '" + outputFileNameValue
-                + "'");
+            System.out.println( "Setting output file name: '" + outputFileNameValue + "'" );
         }
 
         this.outputFileName = outputFileNameValue;
@@ -198,13 +180,13 @@
      *
      * @param verboseValue the verbose mode.
      */
-    public void setVerbose(final boolean verboseValue)
+    public void setVerbose( final boolean verboseValue )
     {
         this.verbose = verboseValue;
 
-        if (this.isVerbose())
+        if ( this.isVerbose() )
         {
-            System.out.println("verbose is true");
+            System.out.println( "verbose is true" );
         }
     }
 
@@ -219,22 +201,20 @@
     public void build()
         throws FileNotFoundException, IOException, UnsupportedEncodingException
     {
-        if (StringUtils.isBlank(getInputFileName()))
+        if ( StringUtils.isBlank( getInputFileName() ) )
         {
-            throw new IllegalArgumentException(
-                "Input file name must be specified");
+            throw new IllegalArgumentException( "Input file name must be specified" );
         }
 
-        if (StringUtils.isBlank(getOutputFileName()))
+        if ( StringUtils.isBlank( getOutputFileName() ) )
         {
-            throw new IllegalArgumentException(
-                "Output file name must be specified");
+            throw new IllegalArgumentException( "Output file name must be specified" );
         }
 
         String[] lines = this.readInput();
-        Map fileMap = this.buildMap(lines);
+        Map fileMap = this.buildMap( lines );
 
-        this.buildOutput(fileMap);
+        this.buildOutput( fileMap );
     }
 
     /**
@@ -252,73 +232,66 @@
      * @param input the lines
      * @return the Map of files with javadoc errors.
      */
-    private Map buildMap(final String[] input)
+    private Map buildMap( final String[] input )
     {
-        if (this.isVerbose())
+        if ( this.isVerbose() )
         {
-            System.out.println("Building map from " + input.length
-                + " input line(s)");
+            System.out.println( "Building map from " + input.length + " input line(s)" );
         }
 
         Map files = new TreeMap();
 
-        for (int i = 0; i < input.length; i++)
+        for ( int i = 0; i < input.length; i++ )
         {
             String line = input[i];
 
-            if (this.isVerbose())
+            if ( this.isVerbose() )
             {
-                System.out.println("Parsing line " + line);
+                System.out.println( "Parsing line " + line );
             }
 
             try
             {
                 // Break up line into pieces
-                int javaDocStart = line.indexOf("[javadoc]");
+                int javaDocStart = line.indexOf( "[javadoc]" );
                 int fileNameStart = javaDocStart += PADDING;
-                int warningStart = line.indexOf("warning - ");
+                int warningStart = line.indexOf( "warning - " );
                 int fileNameEnd = warningStart - 1;
-                String fileNameAndLineNumber = line.substring(fileNameStart,
-                        fileNameEnd);
-                int lastColon = fileNameAndLineNumber.lastIndexOf(':');
-                int nextToLastColon = fileNameAndLineNumber.lastIndexOf(':',
-                        lastColon - 1);
-                String fileName = fileNameAndLineNumber.substring(0,
-                        nextToLastColon);
-                String lineNumber = fileNameAndLineNumber.substring(nextToLastColon
-                        + 1, lastColon);
+                String fileNameAndLineNumber = line.substring( fileNameStart, fileNameEnd );
+                int lastColon = fileNameAndLineNumber.lastIndexOf( ':' );
+                int nextToLastColon = fileNameAndLineNumber.lastIndexOf( ':', lastColon - 1 );
+                String fileName = fileNameAndLineNumber.substring( 0, nextToLastColon );
+                String lineNumber = fileNameAndLineNumber.substring( nextToLastColon + 1, lastColon );
                 int msgStart = warningStart + PADDING;
-                String msg = line.substring(msgStart);
+                String msg = line.substring( msgStart );
 
                 // Get the messages for the file
-                Map fileMessages = (Map) files.get(fileName);
+                Map fileMessages = (Map) files.get( fileName );
 
-                if (fileMessages == null)
+                if ( fileMessages == null )
                 {
                     fileMessages = new TreeMap();
-                    files.put(fileName, fileMessages);
+                    files.put( fileName, fileMessages );
                 }
 
                 // Get the messages for the line
-                Set lineMessages = (Set) fileMessages.get(new Integer(
-                            lineNumber));
+                Set lineMessages = (Set) fileMessages.get( new Integer( lineNumber ) );
 
-                if (lineMessages == null)
+                if ( lineMessages == null )
                 {
-                    lineMessages = new ListOrderedSet();
+                    lineMessages = SetUtils.orderedSet( new TreeSet() );
 
-                    fileMessages.put(new Integer(lineNumber), lineMessages);
+                    fileMessages.put( new Integer( lineNumber ), lineMessages );
                 }
 
                 // Put the message into the line messages set
-                lineMessages.add(msg);
+                lineMessages.add( msg );
             }
-            catch (Throwable t)
+            catch ( Throwable t )
             {
-                System.err.println("*** WARNING: exception parsing line '"
-                    + line + "': " + t.getMessage());
+                System.err.println( "*** WARNING: exception parsing line '" + line + "': " + t.getMessage() );
 
-                if (this.isVerbose())
+                if ( this.isVerbose() )
                 {
                     t.printStackTrace();
                 }
@@ -334,21 +307,21 @@
      * @throws FileNotFoundException If the file cannot be created.
      * @throws UnsupportedEncodingException If the encoding isn't supported.
      */
-    private void buildOutput(final Map fileMap)
+    private void buildOutput( final Map fileMap )
         throws FileNotFoundException, UnsupportedEncodingException
     {
-        File output = new File(this.outputFileName);
+        File output = new File( this.outputFileName );
         File dir = output.getParentFile();
 
-        if (dir != null)
+        if ( dir != null )
         {
             dir.mkdirs();
         }
 
-        PrintWriter out = new PrintWriter(new OutputStreamWriter(
-                    new FileOutputStream(output), this.getOutputEncoding()));
+        PrintWriter out = new PrintWriter( new OutputStreamWriter( new FileOutputStream( output ), this
+            .getOutputEncoding() ) );
 
-        writeOutput(fileMap, out);
+        writeOutput( fileMap, out );
         out.flush();
         out.close();
     }
@@ -362,35 +335,33 @@
     private String[] readInput()
         throws FileNotFoundException, IOException
     {
-        if (this.isVerbose())
+        if ( this.isVerbose() )
         {
-            System.out.println("Reading '" + getInputFileName() + "'");
+            System.out.println( "Reading '" + getInputFileName() + "'" );
         }
 
-        BufferedReader reader = new BufferedReader(new FileReader(
-                    getInputFileName()));
+        BufferedReader reader = new BufferedReader( new FileReader( getInputFileName() ) );
 
         List lines = new ArrayList();
         String line = null;
 
-        while ((line = reader.readLine()) != null)
+        while ( ( line = reader.readLine() ) != null )
         {
             // Look for lines containing the string "warning - "
-            if (line.indexOf("warning - ") >= 0)
+            if ( line.indexOf( "warning - " ) >= 0 )
             {
-                lines.add(line);
+                lines.add( line );
             }
         }
 
         reader.close();
 
-        if (this.isVerbose())
+        if ( this.isVerbose() )
         {
-            System.out.println("Read " + lines.size()
-                + " line(s) from input file");
+            System.out.println( "Read " + lines.size() + " line(s) from input file" );
         }
 
-        return (String[]) lines.toArray(new String[lines.size()]);
+        return (String[]) lines.toArray( new String[lines.size()] );
     }
 
     /**
@@ -398,53 +369,47 @@
      * @param fileMap The filemap to translate in XML.
      * @param out The output to write.
      */
-    private void writeOutput(final Map fileMap, final PrintWriter out)
+    private void writeOutput( final Map fileMap, final PrintWriter out )
     {
-        if (this.isVerbose())
+        if ( this.isVerbose() )
         {
-            System.out.println("Writing to output file '" + this.outputFileName);
+            System.out.println( "Writing to output file '" + this.outputFileName );
         }
 
-        out.println("<?xml version=\"1.0\" encoding=\""
-            + this.getOutputEncoding() + "\"?>");
-        out.println("<javadoc>");
+        out.println( "<?xml version=\"1.0\" encoding=\"" + this.getOutputEncoding() + "\"?>" );
+        out.println( "<javadoc>" );
 
-        for (Iterator fileMapIterator = fileMap.keySet().iterator();
-            fileMapIterator.hasNext();)
+        for ( Iterator fileMapIterator = fileMap.keySet().iterator(); fileMapIterator.hasNext(); )
         {
             String fileName = (String) fileMapIterator.next();
 
-            out.println("<file name=\"" + fileName + "\">");
+            out.println( "<file name=\"" + fileName + "\">" );
 
-            Map fileMessages = (Map) fileMap.get(fileName);
+            Map fileMessages = (Map) fileMap.get( fileName );
 
-            for (Iterator fileMessagesIterator = fileMessages.entrySet()
-                                                             .iterator();
-                fileMessagesIterator.hasNext();)
+            for ( Iterator fileMessagesIterator = fileMessages.entrySet().iterator(); fileMessagesIterator.hasNext(); )
             {
                 Map.Entry entry = (Map.Entry) fileMessagesIterator.next();
                 Integer lineNumber = (Integer) entry.getKey();
                 Set lineMessages = (Set) entry.getValue();
 
-                for (Iterator lineMessagesIterator = lineMessages.iterator();
-                    lineMessagesIterator.hasNext();)
+                for ( Iterator lineMessagesIterator = lineMessages.iterator(); lineMessagesIterator.hasNext(); )
                 {
                     String msg = (String) lineMessagesIterator.next();
 
-                    out.println("<error line=\"" + lineNumber
-                        + "\" severity=\"warning\" message=\""
-                        + StringEscapeUtils.escapeXml(msg) + "\"/>");
+                    out.println( "<error line=\"" + lineNumber + "\" severity=\"warning\" message=\""
+                        + StringEscapeUtils.escapeXml( msg ) + "\"/>" );
                 }
             }
 
-            out.println("</file>");
+            out.println( "</file>" );
         }
 
-        out.println("</javadoc>");
+        out.println( "</javadoc>" );
 
-        if (this.isVerbose())
+        if ( this.isVerbose() )
         {
-            System.out.println("Finished writing output file");
+            System.out.println( "Finished writing output file" );
         }
     }
 }

Modified: maven/maven-1/plugins/trunk/javadoc/src/test/org/apache/maven/javadoc/JavadocWarningsTextToXmlTest.java
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/javadoc/src/test/org/apache/maven/javadoc/JavadocWarningsTextToXmlTest.java?rev=293038&r1=293037&r2=293038&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/javadoc/src/test/org/apache/maven/javadoc/JavadocWarningsTextToXmlTest.java (original)
+++ maven/maven-1/plugins/trunk/javadoc/src/test/org/apache/maven/javadoc/JavadocWarningsTextToXmlTest.java Sat Oct  1 15:48:27 2005
@@ -16,15 +16,15 @@
  *   limitations under the License.
  * ====================================================================
  */
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import junit.textui.TestRunner;
-
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FileReader;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
 
 /**
  * Test case.



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


RE: svn commit: r293038 - in /maven/maven-1/plugins/trunk/javadoc: project.xml src/main/org/apache/maven/javadoc/JavadocWarningsTextToXml.java src/test/org/apache/maven/javadoc/JavadocWarningsTextToXmlTest.java

Posted by Arnaud HERITIER <ah...@gmail.com>.
It was duplicated twice in this file ...

Don't ask me why ;-)

Arnaud


> -----Message d'origine-----
> De : Brett Porter [mailto:brett@apache.org] 
> Envoyé : dimanche 2 octobre 2005 00:53
> À : Maven Developers List
> Objet : Re: svn commit: r293038 - in 
> /maven/maven-1/plugins/trunk/javadoc: project.xml 
> src/main/org/apache/maven/javadoc/JavadocWarningsTextToXml.jav
> a src/test/org/apache/maven/javadoc/JavadocWarningsTextToXmlTest.java
> 
> why remove the license?
> 
> - Brett
> 
> aheritier@apache.org wrote:
> 
> >Modified: 
> >maven/maven-1/plugins/trunk/javadoc/src/main/org/apache/maven
> /javadoc/J
> >avadocWarningsTextToXml.java
> >URL: 
> >http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/jav
> adoc/src/m
> >ain/org/apache/maven/javadoc/JavadocWarningsTextToXml.java?re
v=293038&r
> >1=293037&r2=293038&view=diff 
> >=============================================================
> ==========
> >=======
> >--- 
> >maven/maven-1/plugins/trunk/javadoc/src/main/org/apache/maven
> /javadoc/J
> >avadocWarningsTextToXml.java (original)
> >+++ 
> maven/maven-1/plugins/trunk/javadoc/src/main/org/apache/maven/javad
> >+++ oc/JavadocWarningsTextToXml.java Sat Oct  1 15:48:27 2005
> >@@ -17,26 +17,6 @@
> >  * 
> >====================================================================
> >  */
> > 
> >-import org.apache.commons.collections.set.ListOrderedSet;
> >-import org.apache.commons.lang.StringEscapeUtils;
> >-import org.apache.commons.lang.StringUtils;
> >-
> >-/* 
> ====================================================================
> >- *   Copyright 2001-2004 The Apache Software Foundation.
> >- *
> >- *   Licensed under the Apache License, Version 2.0 (the "License");
> >- *   you may not use this file except in compliance with 
> the License.
> >- *   You may obtain a copy of the License at
> >- *
> >- *       http://www.apache.org/licenses/LICENSE-2.0
> >- *
> >- *   Unless required by applicable law or agreed to in 
> writing, software
> >- *   distributed under the License is distributed on an "AS 
> IS" BASIS,
> >- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 
> express or implied.
> >- *   See the License for the specific language governing 
> permissions and
> >- *   limitations under the License.
> >- * 
> >====================================================================
> >- */
> > import java.io.BufferedReader;
> > import java.io.File;
> > import java.io.FileNotFoundException;
> >@@ -46,13 +26,17 @@
> > import java.io.OutputStreamWriter;
> > import java.io.PrintWriter;
> > import java.io.UnsupportedEncodingException;
> >-
> > import java.util.ArrayList;
> > import java.util.Iterator;
> > import java.util.List;
> > import java.util.Map;
> > import java.util.Set;
> > import java.util.TreeMap;
> >+import java.util.TreeSet;
> >+
> >+import org.apache.commons.collections.SetUtils;
> >+import org.apache.commons.lang.StringEscapeUtils;
> >+import org.apache.commons.lang.StringUtils;
> > 
> >  
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org For 
> additional commands, e-mail: dev-help@maven.apache.org
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: svn commit: r293038 - in /maven/maven-1/plugins/trunk/javadoc: project.xml src/main/org/apache/maven/javadoc/JavadocWarningsTextToXml.java src/test/org/apache/maven/javadoc/JavadocWarningsTextToXmlTest.java

Posted by Brett Porter <br...@apache.org>.
why remove the license?

- Brett

aheritier@apache.org wrote:

>Modified: maven/maven-1/plugins/trunk/javadoc/src/main/org/apache/maven/javadoc/JavadocWarningsTextToXml.java
>URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/javadoc/src/main/org/apache/maven/javadoc/JavadocWarningsTextToXml.java?rev=293038&r1=293037&r2=293038&view=diff
>==============================================================================
>--- maven/maven-1/plugins/trunk/javadoc/src/main/org/apache/maven/javadoc/JavadocWarningsTextToXml.java (original)
>+++ maven/maven-1/plugins/trunk/javadoc/src/main/org/apache/maven/javadoc/JavadocWarningsTextToXml.java Sat Oct  1 15:48:27 2005
>@@ -17,26 +17,6 @@
>  * ====================================================================
>  */
> 
>-import org.apache.commons.collections.set.ListOrderedSet;
>-import org.apache.commons.lang.StringEscapeUtils;
>-import org.apache.commons.lang.StringUtils;
>-
>-/* ====================================================================
>- *   Copyright 2001-2004 The Apache Software Foundation.
>- *
>- *   Licensed under the Apache License, Version 2.0 (the "License");
>- *   you may not use this file except in compliance with the License.
>- *   You may obtain a copy of the License at
>- *
>- *       http://www.apache.org/licenses/LICENSE-2.0
>- *
>- *   Unless required by applicable law or agreed to in writing, software
>- *   distributed under the License is distributed on an "AS IS" BASIS,
>- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>- *   See the License for the specific language governing permissions and
>- *   limitations under the License.
>- * ====================================================================
>- */
> import java.io.BufferedReader;
> import java.io.File;
> import java.io.FileNotFoundException;
>@@ -46,13 +26,17 @@
> import java.io.OutputStreamWriter;
> import java.io.PrintWriter;
> import java.io.UnsupportedEncodingException;
>-
> import java.util.ArrayList;
> import java.util.Iterator;
> import java.util.List;
> import java.util.Map;
> import java.util.Set;
> import java.util.TreeMap;
>+import java.util.TreeSet;
>+
>+import org.apache.commons.collections.SetUtils;
>+import org.apache.commons.lang.StringEscapeUtils;
>+import org.apache.commons.lang.StringUtils;
> 
>  
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org