You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ag...@apache.org on 2014/09/25 21:05:01 UTC
git commit: SUREFIRE-1023 fix potential
StringIndexOutOfBoundsException in SurefireReportGenerator when coming across
unusual failure stacktraces
Repository: maven-surefire
Updated Branches:
refs/heads/master 7f2c1fb11 -> bad7cb910
SUREFIRE-1023 fix potential StringIndexOutOfBoundsException in SurefireReportGenerator when coming across unusual failure stacktraces
Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/bad7cb91
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/bad7cb91
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/bad7cb91
Branch: refs/heads/master
Commit: bad7cb910c0164dc9ffb4700dabbd8e8f4b61023
Parents: 7f2c1fb
Author: Andreas Gudian <ag...@apache.org>
Authored: Thu Sep 25 21:03:57 2014 +0200
Committer: Andreas Gudian <ag...@apache.org>
Committed: Thu Sep 25 21:03:57 2014 +0200
----------------------------------------------------------------------
.../surefire/report/SurefireReportGenerator.java | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/bad7cb91/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportGenerator.java
----------------------------------------------------------------------
diff --git a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportGenerator.java b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportGenerator.java
index 5e8b842..944832a 100644
--- a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportGenerator.java
+++ b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportGenerator.java
@@ -666,19 +666,24 @@ public class SurefireReportGenerator
{
StringTokenizer tokenizer = new StringTokenizer( source );
- String lineNo = "";
-
while ( tokenizer.hasMoreTokens() )
{
String token = tokenizer.nextToken();
if ( token.startsWith( className ) )
{
int idx = token.indexOf( ":" );
- lineNo = token.substring( idx + 1, token.indexOf( ")" ) );
- break;
+ if ( idx >= 0 )
+ {
+ int closeIdx = token.lastIndexOf( ")" );
+
+ if ( closeIdx > idx + 1 )
+ {
+ return token.substring( idx + 1, closeIdx );
+ }
+ }
}
}
- return lineNo;
+ return "";
}
private void constructHotLinks( Sink sink, ResourceBundle bundle )