This is an automated email from the ASF dual-hosted git repository.

elecharny pushed a commit to branch 2.2.X
in repository https://gitbox.apache.org/repos/asf/mina.git


The following commit(s) were added to refs/heads/2.2.X by this push:
     new 2e8daeb6d Fixed a failing test with Java 17
2e8daeb6d is described below

commit 2e8daeb6dba230c9436a3ceac9910d11d78d1d1f
Author: emmanuel lecharny <elecha...@apache.org>
AuthorDate: Thu Sep 14 05:00:09 2023 +0200

    Fixed a failing test with Java 17
---
 .../src/test/java/org/apache/mina/core/buffer/IoBufferTest.java     | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git 
a/mina-core/src/test/java/org/apache/mina/core/buffer/IoBufferTest.java 
b/mina-core/src/test/java/org/apache/mina/core/buffer/IoBufferTest.java
index 444584d24..cfc2d7104 100644
--- a/mina-core/src/test/java/org/apache/mina/core/buffer/IoBufferTest.java
+++ b/mina-core/src/test/java/org/apache/mina/core/buffer/IoBufferTest.java
@@ -34,6 +34,7 @@ import java.nio.charset.CharacterCodingException;
 import java.nio.charset.Charset;
 import java.nio.charset.CharsetDecoder;
 import java.nio.charset.CharsetEncoder;
+import java.nio.charset.CoderMalfunctionError;
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Date;
@@ -1104,7 +1105,10 @@ public class IoBufferTest {
             duplicate.putString("A very very very very looooooong string", 
Charset.forName("ISO-8859-1").newEncoder());
             fail("ReadOnly buffer's can't be expanded");
         } catch (ReadOnlyBufferException e) {
-            // Expected an Exception, signifies test success
+            // In Java 8 or 11, it expects an Exception, signifies test success
+            assertTrue(true);
+        } catch (CoderMalfunctionError cme) {
+            // In Java 17, it expects an Error, signifies test success
             assertTrue(true);
         }
     }

Reply via email to