You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by jt...@apache.org on 2020/12/26 14:40:00 UTC
[netbeans-html4j] 05/25: Only attempt to mangle the encoding on
pre-JDK11 virtual machines
This is an automated email from the ASF dual-hosted git repository.
jtulach pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans-html4j.git
commit f72cb974515ed9115722f0452f44bfa3a5628519
Author: Jaroslav Tulach <ja...@apidesign.org>
AuthorDate: Wed Dec 9 05:59:06 2020 +0100
Only attempt to mangle the encoding on pre-JDK11 virtual machines
---
.../main/java/net/java/html/json/tests/JSONTest.java | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/json-tck/src/main/java/net/java/html/json/tests/JSONTest.java b/json-tck/src/main/java/net/java/html/json/tests/JSONTest.java
index 6aaf236..f88a201 100644
--- a/json-tck/src/main/java/net/java/html/json/tests/JSONTest.java
+++ b/json-tck/src/main/java/net/java/html/json/tests/JSONTest.java
@@ -51,14 +51,16 @@ public final class JSONTest {
private String url;
static {
- try {
- System.setProperty("file.encoding", "windows-1251");
- Field f = Charset.class.getDeclaredField("defaultCharset");
- f.setAccessible(true);
- f.set(null, null);
- assertEquals(Charset.defaultCharset().toString(), "windows-1251", "Encoding has been changed");
- } catch (Throwable t) {
- t.printStackTrace();
+ if (System.getProperty("java.version").startsWith("1.")) {
+ try {
+ System.setProperty("file.encoding", "windows-1251");
+ Field f = Charset.class.getDeclaredField("defaultCharset");
+ f.setAccessible(true);
+ f.set(null, null);
+ assertEquals(Charset.defaultCharset().toString(), "windows-1251", "Encoding has been changed");
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists