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 git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@293038 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
518f4fbddb
commit
a0fa5497cc
@ -140,7 +140,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-collections</groupId>
|
<groupId>commons-collections</groupId>
|
||||||
<artifactId>commons-collections</artifactId>
|
<artifactId>commons-collections</artifactId>
|
||||||
<version>3.1</version>
|
<version>3.0</version>
|
||||||
<type>jar</type>
|
<type>jar</type>
|
||||||
<properties/>
|
<properties/>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|||||||
@ -17,26 +17,6 @@ package org.apache.maven.javadoc;
|
|||||||
* ====================================================================
|
* ====================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
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.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
@ -46,13 +26,17 @@ import java.io.IOException;
|
|||||||
import java.io.OutputStreamWriter;
|
import java.io.OutputStreamWriter;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeMap;
|
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.
|
* Converts the javadoc warnings into an xml (xdoc format) file.
|
||||||
@ -130,8 +114,7 @@ public class JavadocWarningsTextToXml
|
|||||||
{
|
{
|
||||||
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;
|
this.inputFileName = inputFileNameValue;
|
||||||
@ -176,8 +159,7 @@ public class JavadocWarningsTextToXml
|
|||||||
{
|
{
|
||||||
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;
|
this.outputFileName = outputFileNameValue;
|
||||||
@ -221,14 +203,12 @@ public class JavadocWarningsTextToXml
|
|||||||
{
|
{
|
||||||
if ( StringUtils.isBlank( getInputFileName() ) )
|
if ( StringUtils.isBlank( getInputFileName() ) )
|
||||||
{
|
{
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException( "Input file name must be specified" );
|
||||||
"Input file name must be specified");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( StringUtils.isBlank( getOutputFileName() ) )
|
if ( StringUtils.isBlank( getOutputFileName() ) )
|
||||||
{
|
{
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException( "Output file name must be specified" );
|
||||||
"Output file name must be specified");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] lines = this.readInput();
|
String[] lines = this.readInput();
|
||||||
@ -256,8 +236,7 @@ public class JavadocWarningsTextToXml
|
|||||||
{
|
{
|
||||||
if ( this.isVerbose() )
|
if ( this.isVerbose() )
|
||||||
{
|
{
|
||||||
System.out.println("Building map from " + input.length
|
System.out.println( "Building map from " + input.length + " input line(s)" );
|
||||||
+ " input line(s)");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Map files = new TreeMap();
|
Map files = new TreeMap();
|
||||||
@ -278,15 +257,11 @@ public class JavadocWarningsTextToXml
|
|||||||
int fileNameStart = javaDocStart += PADDING;
|
int fileNameStart = javaDocStart += PADDING;
|
||||||
int warningStart = line.indexOf( "warning - " );
|
int warningStart = line.indexOf( "warning - " );
|
||||||
int fileNameEnd = warningStart - 1;
|
int fileNameEnd = warningStart - 1;
|
||||||
String fileNameAndLineNumber = line.substring(fileNameStart,
|
String fileNameAndLineNumber = line.substring( fileNameStart, fileNameEnd );
|
||||||
fileNameEnd);
|
|
||||||
int lastColon = fileNameAndLineNumber.lastIndexOf( ':' );
|
int lastColon = fileNameAndLineNumber.lastIndexOf( ':' );
|
||||||
int nextToLastColon = fileNameAndLineNumber.lastIndexOf(':',
|
int nextToLastColon = fileNameAndLineNumber.lastIndexOf( ':', lastColon - 1 );
|
||||||
lastColon - 1);
|
String fileName = fileNameAndLineNumber.substring( 0, nextToLastColon );
|
||||||
String fileName = fileNameAndLineNumber.substring(0,
|
String lineNumber = fileNameAndLineNumber.substring( nextToLastColon + 1, lastColon );
|
||||||
nextToLastColon);
|
|
||||||
String lineNumber = fileNameAndLineNumber.substring(nextToLastColon
|
|
||||||
+ 1, lastColon);
|
|
||||||
int msgStart = warningStart + PADDING;
|
int msgStart = warningStart + PADDING;
|
||||||
String msg = line.substring( msgStart );
|
String msg = line.substring( msgStart );
|
||||||
|
|
||||||
@ -300,12 +275,11 @@ public class JavadocWarningsTextToXml
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the messages for the line
|
// Get the messages for the line
|
||||||
Set lineMessages = (Set) fileMessages.get(new Integer(
|
Set lineMessages = (Set) fileMessages.get( new Integer( lineNumber ) );
|
||||||
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 );
|
||||||
}
|
}
|
||||||
@ -315,8 +289,7 @@ public class JavadocWarningsTextToXml
|
|||||||
}
|
}
|
||||||
catch ( Throwable t )
|
catch ( Throwable t )
|
||||||
{
|
{
|
||||||
System.err.println("*** WARNING: exception parsing line '"
|
System.err.println( "*** WARNING: exception parsing line '" + line + "': " + t.getMessage() );
|
||||||
+ line + "': " + t.getMessage());
|
|
||||||
|
|
||||||
if ( this.isVerbose() )
|
if ( this.isVerbose() )
|
||||||
{
|
{
|
||||||
@ -345,8 +318,8 @@ public class JavadocWarningsTextToXml
|
|||||||
dir.mkdirs();
|
dir.mkdirs();
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintWriter out = new PrintWriter(new OutputStreamWriter(
|
PrintWriter out = new PrintWriter( new OutputStreamWriter( new FileOutputStream( output ), this
|
||||||
new FileOutputStream(output), this.getOutputEncoding()));
|
.getOutputEncoding() ) );
|
||||||
|
|
||||||
writeOutput( fileMap, out );
|
writeOutput( fileMap, out );
|
||||||
out.flush();
|
out.flush();
|
||||||
@ -367,8 +340,7 @@ public class JavadocWarningsTextToXml
|
|||||||
System.out.println( "Reading '" + getInputFileName() + "'" );
|
System.out.println( "Reading '" + getInputFileName() + "'" );
|
||||||
}
|
}
|
||||||
|
|
||||||
BufferedReader reader = new BufferedReader(new FileReader(
|
BufferedReader reader = new BufferedReader( new FileReader( getInputFileName() ) );
|
||||||
getInputFileName()));
|
|
||||||
|
|
||||||
List lines = new ArrayList();
|
List lines = new ArrayList();
|
||||||
String line = null;
|
String line = null;
|
||||||
@ -386,8 +358,7 @@ public class JavadocWarningsTextToXml
|
|||||||
|
|
||||||
if ( this.isVerbose() )
|
if ( this.isVerbose() )
|
||||||
{
|
{
|
||||||
System.out.println("Read " + lines.size()
|
System.out.println( "Read " + lines.size() + " line(s) from input file" );
|
||||||
+ " line(s) from input file");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (String[]) lines.toArray( new String[lines.size()] );
|
return (String[]) lines.toArray( new String[lines.size()] );
|
||||||
@ -405,12 +376,10 @@ public class JavadocWarningsTextToXml
|
|||||||
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=\""
|
out.println( "<?xml version=\"1.0\" encoding=\"" + this.getOutputEncoding() + "\"?>" );
|
||||||
+ this.getOutputEncoding() + "\"?>");
|
|
||||||
out.println( "<javadoc>" );
|
out.println( "<javadoc>" );
|
||||||
|
|
||||||
for (Iterator fileMapIterator = fileMap.keySet().iterator();
|
for ( Iterator fileMapIterator = fileMap.keySet().iterator(); fileMapIterator.hasNext(); )
|
||||||
fileMapIterator.hasNext();)
|
|
||||||
{
|
{
|
||||||
String fileName = (String) fileMapIterator.next();
|
String fileName = (String) fileMapIterator.next();
|
||||||
|
|
||||||
@ -418,21 +387,17 @@ public class JavadocWarningsTextToXml
|
|||||||
|
|
||||||
Map fileMessages = (Map) fileMap.get( fileName );
|
Map fileMessages = (Map) fileMap.get( fileName );
|
||||||
|
|
||||||
for (Iterator fileMessagesIterator = fileMessages.entrySet()
|
for ( Iterator fileMessagesIterator = fileMessages.entrySet().iterator(); fileMessagesIterator.hasNext(); )
|
||||||
.iterator();
|
|
||||||
fileMessagesIterator.hasNext();)
|
|
||||||
{
|
{
|
||||||
Map.Entry entry = (Map.Entry) fileMessagesIterator.next();
|
Map.Entry entry = (Map.Entry) fileMessagesIterator.next();
|
||||||
Integer lineNumber = (Integer) entry.getKey();
|
Integer lineNumber = (Integer) entry.getKey();
|
||||||
Set lineMessages = (Set) entry.getValue();
|
Set lineMessages = (Set) entry.getValue();
|
||||||
|
|
||||||
for (Iterator lineMessagesIterator = lineMessages.iterator();
|
for ( Iterator lineMessagesIterator = lineMessages.iterator(); lineMessagesIterator.hasNext(); )
|
||||||
lineMessagesIterator.hasNext();)
|
|
||||||
{
|
{
|
||||||
String msg = (String) lineMessagesIterator.next();
|
String msg = (String) lineMessagesIterator.next();
|
||||||
|
|
||||||
out.println("<error line=\"" + lineNumber
|
out.println( "<error line=\"" + lineNumber + "\" severity=\"warning\" message=\""
|
||||||
+ "\" severity=\"warning\" message=\""
|
|
||||||
+ StringEscapeUtils.escapeXml( msg ) + "\"/>" );
|
+ StringEscapeUtils.escapeXml( msg ) + "\"/>" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,16 +16,16 @@ package org.apache.maven.javadoc;
|
|||||||
* limitations under the License.
|
* 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.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
|
|
||||||
|
import junit.framework.Test;
|
||||||
|
import junit.framework.TestCase;
|
||||||
|
import junit.framework.TestSuite;
|
||||||
|
import junit.textui.TestRunner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test case.
|
* Test case.
|
||||||
*
|
*
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user