PR: MPJUNITREPORT-11
Submitted by: Cyrille Le Clerc Keep nested exceptions in truncated stack traces. git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@393632 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9784d2b04c
commit
5439a84afd
@ -0,0 +1,176 @@
|
|||||||
|
package org.apache.maven.plugins.junitreport;
|
||||||
|
|
||||||
|
/* ====================================================================
|
||||||
|
* Copyright 2006 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.
|
||||||
|
* ====================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Created on Jun 5, 2005
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Util class for exceptions
|
||||||
|
* </p>
|
||||||
|
* <p>
|
||||||
|
* Inspired from {@link org.apache.maven.util.StringTool}
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:cleclerc@pobox.com">Cyrille Le Clerc </a>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class ExceptionTool
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Splits the provided text into an array, separator String specified.
|
||||||
|
* </p>
|
||||||
|
* <p>
|
||||||
|
* This method is different of {@link java.util.StringTokenizer} that only
|
||||||
|
* accept chars as separator but not strings
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param text
|
||||||
|
* the string to split
|
||||||
|
* @param separator
|
||||||
|
* the spearator
|
||||||
|
* @return An array containing the split string
|
||||||
|
*/
|
||||||
|
public String[] split( String text, String separator )
|
||||||
|
{
|
||||||
|
if ( text == null )
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
List result = new ArrayList();
|
||||||
|
int fromIndex = 0;
|
||||||
|
int idx;
|
||||||
|
|
||||||
|
while ( ( idx = text.indexOf( separator, fromIndex ) ) != -1 )
|
||||||
|
{
|
||||||
|
String subString = text.substring( fromIndex, idx );
|
||||||
|
|
||||||
|
result.add( subString );
|
||||||
|
fromIndex = idx + separator.length();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( fromIndex != text.length() )
|
||||||
|
{
|
||||||
|
// add last element
|
||||||
|
String subString = text.substring( fromIndex );
|
||||||
|
|
||||||
|
result.add( subString );
|
||||||
|
}
|
||||||
|
|
||||||
|
return (String[]) result.toArray( new String[result.size()] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Splits the given <code>stacktrace</code> into an array of simple (not
|
||||||
|
* nested) stack traces. The nesting stack trace is included in the result
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param nestedStackTrace
|
||||||
|
* the nested stack trace to split
|
||||||
|
* @return An array of un-nested stacktraces
|
||||||
|
*/
|
||||||
|
public String[] splitNestedStackTraces( String nestedStackTrace )
|
||||||
|
{
|
||||||
|
String separator = "Caused by: ";
|
||||||
|
String[] result = split( nestedStackTrace, separator );
|
||||||
|
|
||||||
|
// prefix nested stack traces by "Caused by: "
|
||||||
|
for ( int i = 1; i < result.length; i++ )
|
||||||
|
{
|
||||||
|
result[i] = separator + result[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Truncates the given stacktrace just before the first occurance of the
|
||||||
|
* given <code>searchedString</code>
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param stackTrace
|
||||||
|
* the stacktrace to truncate
|
||||||
|
* @param searchedString
|
||||||
|
* e.g. "at org.apache.commons.jelly.tags.ant.AntTag.doTag"
|
||||||
|
* @return The truncated stacktrace
|
||||||
|
*/
|
||||||
|
public String truncateStackTrace( String stackTrace, String searchedString )
|
||||||
|
{
|
||||||
|
StringBuffer result = new StringBuffer();
|
||||||
|
int fromIndex = 0;
|
||||||
|
int idxSearchedString = stackTrace.indexOf( searchedString, fromIndex );
|
||||||
|
String suffix;
|
||||||
|
|
||||||
|
if ( idxSearchedString == -1 )
|
||||||
|
{
|
||||||
|
idxSearchedString = stackTrace.length();
|
||||||
|
suffix = "";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
suffix = "... more";
|
||||||
|
}
|
||||||
|
|
||||||
|
String currentStack =
|
||||||
|
stackTrace.substring( fromIndex, idxSearchedString );
|
||||||
|
|
||||||
|
result.append( currentStack + suffix );
|
||||||
|
|
||||||
|
return result.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Splits the given <code>stackTrace</code> into nested stack traces and
|
||||||
|
* truncates each of the nested stacktrace (including the nesting
|
||||||
|
* stacktrace) then re-concatenates the string to return it
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param netstedStackTrace
|
||||||
|
* the nested stacktrace to truncate
|
||||||
|
* @param searchedString
|
||||||
|
* e.g. "at org.apache.commons.jelly.tags.ant.AntTag.doTag"
|
||||||
|
* @return The truncated stacktrace
|
||||||
|
*/
|
||||||
|
public String truncateNestedStackTrace( String netstedStackTrace,
|
||||||
|
String searchedString )
|
||||||
|
{
|
||||||
|
String[] stackTraces = splitNestedStackTraces( netstedStackTrace );
|
||||||
|
StringBuffer result = new StringBuffer();
|
||||||
|
|
||||||
|
for ( int i = 0; i < stackTraces.length; i++ )
|
||||||
|
{
|
||||||
|
String nestedStackTrace = stackTraces[i];
|
||||||
|
String truncatedNestedStackTrace =
|
||||||
|
truncateStackTrace( nestedStackTrace, searchedString );
|
||||||
|
|
||||||
|
result.append( truncatedNestedStackTrace + "\r\n" );
|
||||||
|
}
|
||||||
|
|
||||||
|
return result.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>org.apache.maven.plugins.junitreport</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>
|
||||||
|
Contains utility classes for the junit-report plugin.
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@ -30,7 +30,7 @@
|
|||||||
xmlns:ant="jelly:ant"
|
xmlns:ant="jelly:ant"
|
||||||
trim="false">
|
trim="false">
|
||||||
|
|
||||||
<j:useBean var="stringTool" class="org.apache.maven.util.StringTool"/>
|
<j:useBean var="exceptionTool" class="org.apache.maven.plugins.junitreport.ExceptionTool"/>
|
||||||
|
|
||||||
<define:taglib uri="junit">
|
<define:taglib uri="junit">
|
||||||
<define:tag name="nav">
|
<define:tag name="nav">
|
||||||
@ -402,8 +402,8 @@ ${current.attributeValue('message')}
|
|||||||
<!-- removing stacktrace generated by maven -->
|
<!-- removing stacktrace generated by maven -->
|
||||||
<!-- no way to preserve newlines, jelly strips out everything -->
|
<!-- no way to preserve newlines, jelly strips out everything -->
|
||||||
<code>
|
<code>
|
||||||
${stringTool.splitStringAtLastDelim(stringTool.splitStringAtLastDelim(failure.text, 'at org.apache.commons.jelly.tags.ant.AntTag.doTag').get(0),
|
${exceptionTool.truncateNestedStackTrace(exceptionTool.truncateNestedStackTrace(failure.text, 'at org.apache.commons.jelly.tags.ant.AntTag.doTag'),
|
||||||
'at sun.reflect.NativeMethodAccessorImpl.invoke0(').get(0)}
|
'at sun.reflect.NativeMethodAccessorImpl.invoke0(')}
|
||||||
</code>
|
</code>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@ -0,0 +1,290 @@
|
|||||||
|
package org.apache.maven.plugins.junitreport;
|
||||||
|
|
||||||
|
/* ====================================================================
|
||||||
|
* Copyright 2006 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.
|
||||||
|
* ====================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Created on Jun 5, 2005
|
||||||
|
*/
|
||||||
|
|
||||||
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author <a href="mailto:cleclerc@pobox.com">Cyrille Le Clerc </a>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class ExceptionToolTest extends TestCase
|
||||||
|
{
|
||||||
|
private String[] m_nestedStackTraces =
|
||||||
|
new String[]
|
||||||
|
{
|
||||||
|
"java.lang.Exception: The nested Exception\r\n"
|
||||||
|
+ " at com.mycompany.test.MyTest.testNestedException(MyTest.java:16)\r\n"
|
||||||
|
+ " at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n"
|
||||||
|
+ " at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)\r\n"
|
||||||
|
+ " at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.tags.ant.AntTag.doTag(AntTag.java:195)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:233)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.tags.core.IfTag.doTag(IfTag.java:88)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)\r\n"
|
||||||
|
+ " at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTag.java:79)\r\n"
|
||||||
|
+ " at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:110)\r\n"
|
||||||
|
+ " at com.werken.werkz.Goal.fire(Goal.java:639)\r\n"
|
||||||
|
+ " at com.werken.werkz.Goal.attain(Goal.java:575)\r\n"
|
||||||
|
+ " at com.werken.werkz.WerkzProject.attainGoal(WerkzProject.java:193)\r\n"
|
||||||
|
+ " at org.apache.maven.jelly.tags.werkz.MavenAttainGoalTag.doTag(MavenAttainGoalTag.java:127)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:233)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.tags.core.IfTag.doTag(IfTag.java:88)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)\r\n"
|
||||||
|
+ " at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTag.java:79)\r\n"
|
||||||
|
+ " at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:110)\r\n"
|
||||||
|
+ " at com.werken.werkz.Goal.fire(Goal.java:639)\r\n"
|
||||||
|
+ " at com.werken.werkz.Goal.attain(Goal.java:575)\r\n"
|
||||||
|
+ " at com.werken.werkz.Goal.attainPrecursors(Goal.java:488)\r\n"
|
||||||
|
+ " at com.werken.werkz.Goal.attain(Goal.java:573)\r\n"
|
||||||
|
+ " at com.werken.werkz.WerkzProject.attainGoal(WerkzProject.java:193)\r\n"
|
||||||
|
+ " at org.apache.maven.jelly.tags.werkz.MavenAttainGoalTag.doTag(MavenAttainGoalTag.java:127)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:233)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.tags.core.IfTag.doTag(IfTag.java:88)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:233)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.tags.core.ForEachTag.doTag(ForEachTag.java:145)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)\r\n"
|
||||||
|
+ " at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTag.java:79)\r\n"
|
||||||
|
+ " at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:110)\r\n"
|
||||||
|
+ " at com.werken.werkz.Goal.fire(Goal.java:639)\r\n"
|
||||||
|
+ " at com.werken.werkz.Goal.attain(Goal.java:575)\r\n"
|
||||||
|
+ " at com.werken.werkz.WerkzProject.attainGoal(WerkzProject.java:193)\r\n"
|
||||||
|
+ " at org.apache.maven.jelly.tags.werkz.MavenAttainGoalTag.doTag(MavenAttainGoalTag.java:127)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)\r\n"
|
||||||
|
+ " at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTag.java:79)\r\n"
|
||||||
|
+ " at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:110)\r\n"
|
||||||
|
+ " at com.werken.werkz.Goal.fire(Goal.java:639)\r\n"
|
||||||
|
+ " at com.werken.werkz.Goal.attain(Goal.java:575)\r\n"
|
||||||
|
+ " at org.apache.maven.plugin.PluginManager.attainGoals(PluginManager.java:671)\r\n"
|
||||||
|
+ " at org.apache.maven.MavenSession.attainGoals(MavenSession.java:263)\r\n"
|
||||||
|
+ " at org.apache.maven.cli.App.doMain(App.java:488)\r\n"
|
||||||
|
+ " at org.apache.maven.cli.App.main(App.java:1239)\r\n"
|
||||||
|
+ " at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n"
|
||||||
|
+ " at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)\r\n"
|
||||||
|
+ " at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)\r\n"
|
||||||
|
+ " at com.werken.forehead.Forehead.run(Forehead.java:551)\r\n"
|
||||||
|
+ " at com.werken.forehead.Forehead.main(Forehead.java:581)\r\n",
|
||||||
|
"Caused by: java.lang.Exception: The cause Exception\r\n"
|
||||||
|
+ " at com.mycompany.test.MyTest.testNestedException(MyTest.java:15)\r\n"
|
||||||
|
+ " ... 76 more\r\n"
|
||||||
|
};
|
||||||
|
private String m_nestedStackTrace =
|
||||||
|
m_nestedStackTraces[0] + m_nestedStackTraces[1];
|
||||||
|
private String[] m_truncatedNestedStackTraces =
|
||||||
|
new String[]
|
||||||
|
{
|
||||||
|
"java.lang.Exception: The nested Exception\r\n"
|
||||||
|
+ " at com.mycompany.test.MyTest.testNestedException(MyTest.java:16)\r\n"
|
||||||
|
+ " at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n"
|
||||||
|
+ " at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)\r\n"
|
||||||
|
+ " at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)\r\n",
|
||||||
|
"Caused by: java.lang.Exception: The cause Exception\r\n"
|
||||||
|
+ " at com.mycompany.test.MyTest.testNestedException(MyTest.java:15)\r\n"
|
||||||
|
+ " ... 76 more\r\n"
|
||||||
|
};
|
||||||
|
private String m_truncatedNestedStackTrace =
|
||||||
|
m_truncatedNestedStackTraces[0] + " ... more\r\n"
|
||||||
|
+ m_truncatedNestedStackTraces[1] + "\r\n";
|
||||||
|
private String m_stackTrace =
|
||||||
|
"java.lang.Exception: The Exception\r\n"
|
||||||
|
+ " at com.mycompany.test.MyTest.testNestedException(MyTest.java:16)\r\n"
|
||||||
|
+ " at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n"
|
||||||
|
+ " at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)\r\n"
|
||||||
|
+ " at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.tags.ant.AntTag.doTag(AntTag.java:195)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:233)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.tags.core.IfTag.doTag(IfTag.java:88)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)\r\n"
|
||||||
|
+ " at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTag.java:79)\r\n"
|
||||||
|
+ " at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:110)\r\n"
|
||||||
|
+ " at com.werken.werkz.Goal.fire(Goal.java:639)\r\n"
|
||||||
|
+ " at com.werken.werkz.Goal.attain(Goal.java:575)\r\n"
|
||||||
|
+ " at com.werken.werkz.WerkzProject.attainGoal(WerkzProject.java:193)\r\n"
|
||||||
|
+ " at org.apache.maven.jelly.tags.werkz.MavenAttainGoalTag.doTag(MavenAttainGoalTag.java:127)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:233)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.tags.core.IfTag.doTag(IfTag.java:88)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)\r\n"
|
||||||
|
+ " at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTag.java:79)\r\n"
|
||||||
|
+ " at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:110)\r\n"
|
||||||
|
+ " at com.werken.werkz.Goal.fire(Goal.java:639)\r\n"
|
||||||
|
+ " at com.werken.werkz.Goal.attain(Goal.java:575)\r\n"
|
||||||
|
+ " at com.werken.werkz.Goal.attainPrecursors(Goal.java:488)\r\n"
|
||||||
|
+ " at com.werken.werkz.Goal.attain(Goal.java:573)\r\n"
|
||||||
|
+ " at com.werken.werkz.WerkzProject.attainGoal(WerkzProject.java:193)\r\n"
|
||||||
|
+ " at org.apache.maven.jelly.tags.werkz.MavenAttainGoalTag.doTag(MavenAttainGoalTag.java:127)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:233)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.tags.core.IfTag.doTag(IfTag.java:88)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:233)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.tags.core.ForEachTag.doTag(ForEachTag.java:145)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)\r\n"
|
||||||
|
+ " at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTag.java:79)\r\n"
|
||||||
|
+ " at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:110)\r\n"
|
||||||
|
+ " at com.werken.werkz.Goal.fire(Goal.java:639)\r\n"
|
||||||
|
+ " at com.werken.werkz.Goal.attain(Goal.java:575)\r\n"
|
||||||
|
+ " at com.werken.werkz.WerkzProject.attainGoal(WerkzProject.java:193)\r\n"
|
||||||
|
+ " at org.apache.maven.jelly.tags.werkz.MavenAttainGoalTag.doTag(MavenAttainGoalTag.java:127)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)\r\n"
|
||||||
|
+ " at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)\r\n"
|
||||||
|
+ " at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTag.java:79)\r\n"
|
||||||
|
+ " at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:110)\r\n"
|
||||||
|
+ " at com.werken.werkz.Goal.fire(Goal.java:639)\r\n"
|
||||||
|
+ " at com.werken.werkz.Goal.attain(Goal.java:575)\r\n"
|
||||||
|
+ " at org.apache.maven.plugin.PluginManager.attainGoals(PluginManager.java:671)\r\n"
|
||||||
|
+ " at org.apache.maven.MavenSession.attainGoals(MavenSession.java:263)\r\n"
|
||||||
|
+ " at org.apache.maven.cli.App.doMain(App.java:488)\r\n"
|
||||||
|
+ " at org.apache.maven.cli.App.main(App.java:1239)\r\n"
|
||||||
|
+ " at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n"
|
||||||
|
+ " at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)\r\n"
|
||||||
|
+ " at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)\r\n"
|
||||||
|
+ " at com.werken.forehead.Forehead.run(Forehead.java:551)\r\n"
|
||||||
|
+ " at com.werken.forehead.Forehead.main(Forehead.java:581)\r\n";
|
||||||
|
private String m_truncatedStackTrace =
|
||||||
|
"java.lang.Exception: The Exception\r\n"
|
||||||
|
+ " at com.mycompany.test.MyTest.testNestedException(MyTest.java:16)\r\n"
|
||||||
|
+ " at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n"
|
||||||
|
+ " at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)\r\n"
|
||||||
|
+ " at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)\r\n"
|
||||||
|
+ " ... more";
|
||||||
|
|
||||||
|
public static void main( String[] args )
|
||||||
|
{
|
||||||
|
junit.textui.TestRunner.run( ExceptionToolTest.class );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testSplitNestedStackTraces()
|
||||||
|
{
|
||||||
|
ExceptionTool exceptionTool = new ExceptionTool();
|
||||||
|
String[] stackTraces =
|
||||||
|
exceptionTool.splitNestedStackTraces( m_nestedStackTrace );
|
||||||
|
|
||||||
|
for ( int i = 0; i < stackTraces.length; i++ )
|
||||||
|
{
|
||||||
|
String actual = stackTraces[i];
|
||||||
|
String expected = m_nestedStackTraces[i];
|
||||||
|
|
||||||
|
assertEquals( "nestedStack " + i, expected, actual );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testTruncateStackTrace()
|
||||||
|
{
|
||||||
|
String searchedString =
|
||||||
|
"at org.apache.commons.jelly.tags.ant.AntTag.doTag";
|
||||||
|
ExceptionTool exceptionTool = new ExceptionTool();
|
||||||
|
String expected = m_truncatedStackTrace;
|
||||||
|
String actual =
|
||||||
|
exceptionTool.truncateStackTrace( m_stackTrace, searchedString );
|
||||||
|
|
||||||
|
assertEquals( expected, actual );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testTruncateNestedStackTrace()
|
||||||
|
{
|
||||||
|
String searchedString =
|
||||||
|
"at org.apache.commons.jelly.tags.ant.AntTag.doTag";
|
||||||
|
ExceptionTool exceptionTool = new ExceptionTool();
|
||||||
|
String expected = m_truncatedNestedStackTrace;
|
||||||
|
String actual =
|
||||||
|
exceptionTool.truncateNestedStackTrace( m_nestedStackTrace,
|
||||||
|
searchedString );
|
||||||
|
|
||||||
|
assertEquals( expected, actual );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testSplit()
|
||||||
|
{
|
||||||
|
String str =
|
||||||
|
"value 1 separator value 2 separator value 3 separator value 4 separator value 5";
|
||||||
|
String[] expected =
|
||||||
|
new String[]
|
||||||
|
{
|
||||||
|
"value 1 ", " value 2 ", " value 3 ", " value 4 ", " value 5"
|
||||||
|
};
|
||||||
|
ExceptionTool exceptionTool = new ExceptionTool();
|
||||||
|
String[] actual = exceptionTool.split( str, "separator" );
|
||||||
|
|
||||||
|
assertEquals( "result size", expected.length, actual.length );
|
||||||
|
|
||||||
|
for ( int i = 0; i < actual.length; i++ )
|
||||||
|
{
|
||||||
|
assertEquals( "value " + i, expected[i], actual[i] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testSplitWithNoTrailingValue()
|
||||||
|
{
|
||||||
|
String str =
|
||||||
|
"value 1 separator value 2 separator value 3 separator value 4 separator value 5separator";
|
||||||
|
String[] expected =
|
||||||
|
new String[]
|
||||||
|
{
|
||||||
|
"value 1 ", " value 2 ", " value 3 ", " value 4 ", " value 5"
|
||||||
|
};
|
||||||
|
ExceptionTool exceptionTool = new ExceptionTool();
|
||||||
|
String[] actual = exceptionTool.split( str, "separator" );
|
||||||
|
|
||||||
|
assertEquals( "result size", expected.length, actual.length );
|
||||||
|
|
||||||
|
for ( int i = 0; i < actual.length; i++ )
|
||||||
|
{
|
||||||
|
assertEquals( "value " + i, expected[i], actual[i] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testSplitWithNoSeparator()
|
||||||
|
{
|
||||||
|
String str = "value 1 ";
|
||||||
|
String[] expected = new String[] { "value 1 " };
|
||||||
|
ExceptionTool exceptionTool = new ExceptionTool();
|
||||||
|
String[] actual = exceptionTool.split( str, "separator" );
|
||||||
|
|
||||||
|
assertEquals( "result size", expected.length, actual.length );
|
||||||
|
|
||||||
|
for ( int i = 0; i < actual.length; i++ )
|
||||||
|
{
|
||||||
|
assertEquals( "value " + i, expected[i], actual[i] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>org.apache.maven.plugins.junitreport</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>
|
||||||
|
Test classes for org.apache.maven.plugins.junitreport
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@ -26,6 +26,7 @@
|
|||||||
</properties>
|
</properties>
|
||||||
<body>
|
<body>
|
||||||
<release version="1.5.1-SNAPSHOT" date="in SVN">
|
<release version="1.5.1-SNAPSHOT" date="in SVN">
|
||||||
|
<action dev="ltheussl" type="add" issue="MPJUNITREPORT-11" due-to="Cyrille Le Clerc">Keep nested exceptions in truncated stack traces.</action>
|
||||||
<action dev="ltheussl" type="add" issue="MPJUNITREPORT-6" due-to="Cyrille Le Clerc">Include System.out/System.err in the generated report.</action>
|
<action dev="ltheussl" type="add" issue="MPJUNITREPORT-6" due-to="Cyrille Le Clerc">Include System.out/System.err in the generated report.</action>
|
||||||
<action dev="ltheussl" type="fix" issue="MPJUNITREPORT-8">Add description for default goal.</action>
|
<action dev="ltheussl" type="fix" issue="MPJUNITREPORT-8">Add description for default goal.</action>
|
||||||
<action dev="aheritier" type="update" issue="MAVEN-1712">Update dependencies to match ones in maven 1.1 core and to unify them between plugins. The following dependencies are updated :
|
<action dev="aheritier" type="update" issue="MAVEN-1712">Update dependencies to match ones in maven 1.1 core and to unify them between plugins. The following dependencies are updated :
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user