File tree Expand file tree Collapse file tree 4 files changed +33
-5
lines changed
main/java/org/apache/maven/plugin/compiler Expand file tree Collapse file tree 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' )
2121assert logFile. exists()
2222content = logFile. text
2323
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' )
2020assert logFile. exists()
2121content = logFile. text
2222
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`.
2329assert content. contains( ' COMPILATION ERROR:' )
2430assert content. contains( ' CompilationFailureException' ) // In debug level logs.
2531assert ! 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' )
2121assert logFile. exists()
2222content = logFile. text
2323
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`.
2533assert content. contains( ' COMPILATION ERROR:' )
2634assert content. contains( ' CompilationFailureException' ) // In debug level logs.
Original file line number Diff line number Diff line change @@ -164,7 +164,13 @@ final boolean run(
164164 builder .redirectOutput (dest );
165165 return start (builder , out ) == 0 ;
166166 } 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 )));
168174 output .delete ();
169175 }
170176 }
You can’t perform that action at this time.
0 commit comments