Skip to content

Commit

Permalink
[CONTINUUM-1346] Fix time parsing error in test results when time is …
Browse files Browse the repository at this point in the history
…greater than 1000s

git-svn-id: https://svn.apache.org/repos/asf/maven/continuum/trunk@563538 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Emmanuel Venisse committed Aug 7, 2007
1 parent c33a1db commit e69e9ee
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,14 @@
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.text.NumberFormat;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;

/**
Expand Down Expand Up @@ -316,7 +319,20 @@ private TestResult getTestResults( File workingDir )
int suiteFailureCount = Integer.parseInt( parser.getAttributeValue( null, "errors" ) ) +
Integer.parseInt( parser.getAttributeValue( null, "failures" ) );

long suiteTotalTime = (long) ( 1000 * Double.parseDouble( parser.getAttributeValue( null, "time" ) ) );
String time = parser.getAttributeValue( null, "time" );
NumberFormat nf = NumberFormat.getInstance( Locale.ENGLISH );
double dTime = 0;

try
{
dTime = nf.parse( time ).doubleValue();
}
catch ( ParseException nfe )
{
getLogger().warn( "Can't parse time value (" + time + ") in " + xmlFile.getAbsolutePath() );
}

long suiteTotalTime = (long) ( 1000 * dTime );

// TODO: add tests attribute to testsuite element so we only
// have to parse the rest of the file if there are failures
Expand Down

0 comments on commit e69e9ee

Please sign in to comment.