Skip to content
Permalink
Browse files

CONJ-589 : Resolve inconsistency between length() and getSubString() …

…in MariaDbClob.

(cherry picked from commit 5e3edee)
  • Loading branch information...
harawata authored and rusher committed Jul 28, 2018
1 parent 7afc70b commit 50a06aeeb5b6aea28e73993848cff72f59d9458e
@@ -241,6 +241,7 @@ public long length() {
} else if (byteValue < 0xF0) {
i += 3;
} else if (byteValue < 0xF8) {
len++;
i += 4;
} else {
throw new RuntimeException("invalid UTF8");
@@ -18,7 +18,7 @@
@Test
public void length() {
MariaDbClob clob = new MariaDbClob(bytes);
assertEquals(9, clob.length());
assertEquals(10, clob.length());

MariaDbClob clob2 = new MariaDbClob(bytes, 2, 3);
assertEquals(3, clob2.length());
@@ -29,6 +29,7 @@ public void getSubString() throws SQLException {
MariaDbClob clob = new MariaDbClob(bytes);
assertEquals("abcde\uD83D\uDE4F", clob.getSubString(1, 7));
assertEquals("abcde\uD83D\uDE4Ffgh", clob.getSubString(1, 20));
assertEquals("abcde\uD83D\uDE4Ffgh", clob.getSubString(1, (int) clob.length()));
assertEquals("ab", clob.getSubString(1, 2));
assertEquals("\uD83D\uDE4F", clob.getSubString(6, 2));

0 comments on commit 50a06ae

Please sign in to comment.
You can’t perform that action at this time.