IOException incorrectly printed when using Java 9 on Windows 10 set to locale and Japanese

An exception is thrown in this particular block.

   try
   {
       transport.m_readListener.onReadTransport(transport);
   }
   catch (IOException e)
   {
       ->onIOException(e,transport);
   }

The onIOException () method puts it in the log:

    private void onIOException(IOException e, AbstractConnection connection)
    {
        String reason = e.getMessage();
        ...
        log.error("Closing ",connection," because ",reason);
    }

The Reason variable in Java 8 shows the correct Japanese phrase:

Reason: 既存 の 接 続 は リ モ ート ホ ス ト に 強制 的 に 切断 さ れ ま し た (meaning: An existing connection was forcibly disconnected from the remote host)

When launched on Java 9, the exception message now does not work:

reason: 譌 「蟄 倥? ョ 謗 ・ 邯 壹? ッ 繝 ェ 繝 「繝 シ 繝? 繝 帙 せ 繝 医 ↓ 蠑 キ蛻 カ 逧? 縺 ォ 蛻? 譁 ュ 縺 輔 l 縺 セ 縺 励 ◆ 縲?

A block of code that checks to see if the Socket port is open is inside a try catch block that catches an IOException. Message from IOException received via

    String reason = e.getMessage();
    if (null == reason) reason = e.toString();

java.locale.providers = COMPAT, CLDR, SPI, Java 8, . - ? - ? !

+4
1

( , - )

Java 9 - -. getBytes() . Java 8 [-26, -105, -94, -27, -83,...], Java 9 [[ CN05], -83, -116, -17, -67,...]. , , Java 9, , Java 8, . , , - , ?

-XX: - CompactStrings, , .

0

Source: https://habr.com/ru/post/1690944/


All Articles