first fix for MPJAVADOC-42: instead of failing due to an exception, a WARNING message is logged to the console
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@116024 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
1 parent
c70f3a5e93
commit
3da9f7d33a
1 file changed
+62
-50
@@ -43,7 +43,7 @@ import java.util.TreeMap;
|
||||
* Converts the javadoc warnings into an xml (xdoc format) file.
|
||||
*
|
||||
* @author Steven Caswell (stevencaswell at apache.org)
|
||||
* @version $Id: JavadocWarningsTextToXml.java,v 1.1 2004/08/21 18:42:04 aheritier Exp $
|
||||
* @version $Id: JavadocWarningsTextToXml.java,v 1.2 2004/09/02 03:37:21 felipeal Exp $
|
||||
*/
|
||||
public class JavadocWarningsTextToXml {
|
||||
//~ Static fields/initializers ----------------------------------------------
|
||||
@@ -230,60 +230,72 @@ public class JavadocWarningsTextToXml {
|
||||
|
||||
for (int i = 0; i < input.length; i++) {
|
||||
String line = input[i];
|
||||
|
||||
// Break up line into pieces
|
||||
int javaDocStart = line.indexOf("[javadoc]");
|
||||
int fileNameStart = javaDocStart += PADDING;
|
||||
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
|
||||
);
|
||||
int msgStart = warningStart + PADDING;
|
||||
String msg = line.substring(msgStart);
|
||||
|
||||
// Get the messages for the file
|
||||
Map fileMessages = (Map) files.get(fileName);
|
||||
|
||||
if (fileMessages == null) {
|
||||
fileMessages = new TreeMap();
|
||||
files.put(
|
||||
fileName,
|
||||
fileMessages
|
||||
if (this.isVerbose()) {
|
||||
System.out.println(
|
||||
"Parsing line " + line
|
||||
);
|
||||
}
|
||||
try {
|
||||
// Break up line into pieces
|
||||
int javaDocStart = line.indexOf("[javadoc]");
|
||||
int fileNameStart = javaDocStart += PADDING;
|
||||
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
|
||||
);
|
||||
int msgStart = warningStart + PADDING;
|
||||
String msg = line.substring(msgStart);
|
||||
|
||||
// Get the messages for the line
|
||||
Set lineMessages = (Set) fileMessages.get(new Integer(lineNumber));
|
||||
// Get the messages for the file
|
||||
Map fileMessages = (Map) files.get(fileName);
|
||||
|
||||
if (lineMessages == null) {
|
||||
lineMessages = new LinkedHashSet();
|
||||
fileMessages.put(
|
||||
new Integer(lineNumber),
|
||||
lineMessages
|
||||
);
|
||||
if (fileMessages == null) {
|
||||
fileMessages = new TreeMap();
|
||||
files.put(
|
||||
fileName,
|
||||
fileMessages
|
||||
);
|
||||
}
|
||||
|
||||
// Get the messages for the line
|
||||
Set lineMessages = (Set) fileMessages.get(new Integer(lineNumber));
|
||||
|
||||
if (lineMessages == null) {
|
||||
lineMessages = new LinkedHashSet();
|
||||
fileMessages.put(
|
||||
new Integer(lineNumber),
|
||||
lineMessages
|
||||
);
|
||||
}
|
||||
|
||||
// Put the message into the line messages set
|
||||
lineMessages.add(msg);
|
||||
} catch( Throwable t ) {
|
||||
System.err.println("*** WARNING: exception parsing line '" + line +
|
||||
"': " + t.getMessage() );
|
||||
if (this.isVerbose()) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
// Put the message into the line messages set
|
||||
lineMessages.add(msg);
|
||||
}
|
||||
} // for
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user