File tree 4 files changed +33
-5
lines changed
main/java/org/apache/maven/plugin/compiler 4 files changed +33
-5
lines changed Original file line number Diff line number Diff line change @@ -21,5 +21,14 @@ def logFile = new File( basedir, 'build.log' )
21
21
assert logFile. exists()
22
22
content = logFile. text
23
23
24
- assert content. contains( ' package org.jenkinsci.test.acceptance.controller does not exist' )
25
- assert content. contains( ' package org.jenkinsci.test.acceptance.log does not exist' )
24
+ /*
25
+ * The messages expected by this test were:
26
+ *
27
+ * - package org.jenkinsci.test.acceptance.controller does not exist
28
+ * - package org.jenkinsci.test.acceptance.log does not exist
29
+ *
30
+ * But we cannot test the full messages as shown above because they may be localized.
31
+ * Test only the package name on the assumption that they will be present in all locales.
32
+ */
33
+ assert content. contains( ' org.jenkinsci.test.acceptance.controller' )
34
+ assert content. contains( ' org.jenkinsci.test.acceptance.log' )
Original file line number Diff line number Diff line change @@ -20,7 +20,12 @@ def logFile = new File( basedir, 'build.log' )
20
20
assert logFile. exists()
21
21
content = logFile. text
22
22
23
+ /*
24
+ * The message expected by this test was "unchecked call to add(E) as a member of the raw type List".
25
+ * But we cannot test that message because it is locale-dependent. Check only a few keywords instead.
26
+ */
27
+ assert content. contains( ' add(E)' )
28
+ assert content. contains( ' List' ) // May be `List` or `java.util.List`.
23
29
assert content. contains( ' COMPILATION ERROR:' )
24
30
assert content. contains( ' CompilationFailureException' ) // In debug level logs.
25
31
assert ! content. contains( ' invalid flag' )
26
- assert content. contains( ' unchecked call to add(E) as a member of the raw type ' ) // List or java.util.List
Original file line number Diff line number Diff line change @@ -21,6 +21,14 @@ def logFile = new File( basedir, 'build.log' )
21
21
assert logFile. exists()
22
22
content = logFile. text
23
23
24
- assert content. contains( ' [WARNING] unchecked call' )
24
+ /*
25
+ * The message expected by this test was "[WARNING] unchecked call" (the full message
26
+ * is actually "unchecked call to add(E) as a member of the raw type java.util.List").
27
+ * But we cannot test that message because it is locale-dependent.
28
+ * Check only a few keywords instead.
29
+ */
30
+ assert content. contains( ' [WARNING]' )
31
+ assert content. contains( ' add(E)' )
32
+ assert content. contains( ' List' ) // May be `List` or `java.util.List`.
25
33
assert content. contains( ' COMPILATION ERROR:' )
26
34
assert content. contains( ' CompilationFailureException' ) // In debug level logs.
Original file line number Diff line number Diff line change @@ -164,7 +164,13 @@ final boolean run(
164
164
builder .redirectOutput (dest );
165
165
return start (builder , out ) == 0 ;
166
166
} finally {
167
- out .append (Files .readString (output .toPath ()));
167
+ /*
168
+ * Need to use the native encoding because it is the encoding used by the native process.
169
+ * This is not necessarily the default encoding of the JVM, which is "file.encoding".
170
+ * This property is available since Java 17.
171
+ */
172
+ String cs = System .getProperty ("native.encoding" );
173
+ out .append (Files .readString (output .toPath (), Charset .forName (cs )));
168
174
output .delete ();
169
175
}
170
176
}
You can’t perform that action at this time.
0 commit comments