111
111
* @since 15-Aug-2009 09:09:29
112
112
*/
113
113
public abstract class AbstractInvokerMojo extends AbstractMojo {
114
+ private static final float ONE_SECOND = 1000.0f ;
115
+
114
116
/**
115
117
* The zero-based column index where to print the invoker result.
116
118
*/
@@ -1534,7 +1536,7 @@ private void runBuild(
1534
1536
try {
1535
1537
int selection = getSelection (invokerProperties , actualJreVersion );
1536
1538
if (selection == 0 ) {
1537
- long milliseconds = System .currentTimeMillis ();
1539
+ long startTime = System .currentTimeMillis ();
1538
1540
boolean executed ;
1539
1541
1540
1542
FileLogger buildLogger = setupBuildLogFile (basedir );
@@ -1546,8 +1548,8 @@ private void runBuild(
1546
1548
executed = runBuild (
1547
1549
basedir , interpolatedPomFile , settingsFile , actualJavaHome , invokerProperties , buildLogger );
1548
1550
} finally {
1549
- milliseconds = System .currentTimeMillis () - milliseconds ;
1550
- buildJob .setTime (milliseconds / 1000.0 );
1551
+ long elapsedTime = System .currentTimeMillis () - startTime ;
1552
+ buildJob .setTime (elapsedTime / ONE_SECOND );
1551
1553
1552
1554
if (buildLogger != null ) {
1553
1555
buildLogger .close ();
@@ -1697,7 +1699,7 @@ private void writeJunitReport(BuildJob buildJob, String safeFileName) throws Moj
1697
1699
File reportFile = new File (reportsDirectory , "TEST-" + safeFileName + ".xml" );
1698
1700
Xpp3Dom testsuite = new Xpp3Dom ("testsuite" );
1699
1701
testsuite .setAttribute ("name" , junitPackageName + "." + safeFileName );
1700
- testsuite .setAttribute ("time" , Double .toString (buildJob .getTime ()));
1702
+ testsuite .setAttribute ("time" , Float .toString (buildJob .getTime ()));
1701
1703
1702
1704
// set default value for required attributes
1703
1705
testsuite .setAttribute ("tests" , "1" );
@@ -1729,7 +1731,7 @@ private void writeJunitReport(BuildJob buildJob, String safeFileName) throws Moj
1729
1731
}
1730
1732
testcase .setAttribute ("classname" , junitPackageName + "." + safeFileName );
1731
1733
testcase .setAttribute ("name" , safeFileName );
1732
- testcase .setAttribute ("time" , Double .toString (buildJob .getTime ()));
1734
+ testcase .setAttribute ("time" , Float .toString (buildJob .getTime ()));
1733
1735
Xpp3Dom systemOut = new Xpp3Dom ("system-out" );
1734
1736
testcase .addChild (systemOut );
1735
1737
@@ -1755,13 +1757,13 @@ private void writeJunitReport(BuildJob buildJob, String safeFileName) throws Moj
1755
1757
}
1756
1758
1757
1759
/**
1758
- * Formats the specified build duration time.
1760
+ * Formats the specified elapsed time.
1759
1761
*
1760
- * @param seconds The duration of the build.
1762
+ * @param time The eapsed time of the build.
1761
1763
* @return The formatted time, never <code>null</code>.
1762
1764
*/
1763
- private String formatTime (double seconds ) {
1764
- return secFormat .format (seconds );
1765
+ private String formatTime (float time ) {
1766
+ return secFormat .format (time );
1765
1767
}
1766
1768
1767
1769
/**
@@ -1882,8 +1884,8 @@ private boolean runBuild(
1882
1884
1883
1885
int getParallelThreadsCount () {
1884
1886
if (parallelThreads .endsWith ("C" )) {
1885
- double parallelThreadsMultiple =
1886
- Double . parseDouble (parallelThreads .substring (0 , parallelThreads .length () - 1 ));
1887
+ float parallelThreadsMultiple =
1888
+ Float . parseFloat (parallelThreads .substring (0 , parallelThreads .length () - 1 ));
1887
1889
return (int ) (parallelThreadsMultiple * Runtime .getRuntime ().availableProcessors ());
1888
1890
} else {
1889
1891
return Integer .parseInt (parallelThreads );
0 commit comments