18
18
*/
19
19
package org .apache .maven .plugins .invoker ;
20
20
21
- import java .text .DecimalFormat ;
22
- import java .text .DecimalFormatSymbols ;
23
- import java .text .MessageFormat ;
24
- import java .text .NumberFormat ;
25
21
import java .util .List ;
26
22
import java .util .Locale ;
27
23
@@ -37,21 +33,6 @@ public class InvokerReportRenderer extends AbstractMavenReportRenderer {
37
33
private final Log log ;
38
34
private final List <BuildJob > buildJobs ;
39
35
40
- /**
41
- * The number format used to print percent values in the report locale.
42
- */
43
- private NumberFormat percentFormat ;
44
-
45
- /**
46
- * The number format used to print time values in the report locale.
47
- */
48
- private NumberFormat secondsFormat ;
49
-
50
- /**
51
- * The format used to print build name and description.
52
- */
53
- private MessageFormat nameAndDescriptionFormat ;
54
-
55
36
public InvokerReportRenderer (Sink sink , I18N i18n , Locale locale , Log log , List <BuildJob > buildJobs ) {
56
37
super (sink );
57
38
this .i18n = i18n ;
@@ -84,11 +65,6 @@ private String formatI18nString(String key, Object... args) {
84
65
85
66
@ Override
86
67
protected void renderBody () {
87
- DecimalFormatSymbols symbols = new DecimalFormatSymbols (locale );
88
- percentFormat = new DecimalFormat (getI18nString ("format.percent" ), symbols );
89
- secondsFormat = new DecimalFormat (getI18nString ("format.seconds" ), symbols );
90
- nameAndDescriptionFormat = new MessageFormat (getI18nString ("format.name_with_description" ));
91
-
92
68
startSection (getTitle ());
93
69
paragraph (getI18nString ("description" ));
94
70
@@ -139,9 +115,9 @@ private void renderSectionSummary() {
139
115
Integer .toString (totalFailures ),
140
116
Integer .toString (totalSkipped ),
141
117
(totalSuccess + totalFailures > 0 )
142
- ? percentFormat . format (totalSuccess / (float ) (totalSuccess + totalFailures ))
118
+ ? formatI18nString ( "value.successrate" , (totalSuccess / (float ) (totalSuccess + totalFailures ) ))
143
119
: "" ,
144
- secondsFormat . format ( totalTime )
120
+ formatI18nString ( "value.time" , totalTime )
145
121
});
146
122
147
123
endTable ();
@@ -175,7 +151,7 @@ private void renderBuildJob(BuildJob buildJob) {
175
151
getBuildJobReportName (buildJob ),
176
152
// FIXME image
177
153
buildJob .getResult (),
178
- secondsFormat . format ( buildJob .getTime ()),
154
+ formatI18nString ( "value.time" , buildJob .getTime ()),
179
155
buildJob .getFailureMessage ()
180
156
});
181
157
}
@@ -187,7 +163,7 @@ private String getBuildJobReportName(BuildJob buildJob) {
187
163
boolean emptyJobDescription = buildJobDescription == null || buildJobDescription .isEmpty ();
188
164
boolean isReportJobNameComplete = !emptyJobName && !emptyJobDescription ;
189
165
if (isReportJobNameComplete ) {
190
- return getFormattedName ( buildJobName , buildJobDescription );
166
+ return formatI18nString ( "text.name_with_description" , buildJobName , buildJobDescription );
191
167
} else {
192
168
String buildJobProject = buildJob .getProject ();
193
169
if (!emptyJobName ) {
@@ -203,8 +179,4 @@ private static String incompleteNameWarning(String missing, String pom) {
203
179
return "Incomplete job name-description: " + missing + " is missing. POM (" + pom
204
180
+ ") will be used in place of job name!" ;
205
181
}
206
-
207
- private String getFormattedName (String name , String description ) {
208
- return nameAndDescriptionFormat .format (new Object [] {name , description });
209
- }
210
182
}
0 commit comments