Mercurial > hg > monetdb-java
changeset 749:a604e71a875e
UTF-8 is a standard character set always available on Java, so use it where needed.
author | Martin van Dinther <martin.van.dinther@monetdbsolutions.com> |
---|---|
date | Thu, 16 Mar 2023 16:38:01 +0100 (2023-03-16) |
parents | 50b8cc8200cd |
children | 02ad91fb3438 |
files | tests/JDBC_API_Tester.java |
diffstat | 1 files changed, 5 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/JDBC_API_Tester.java +++ b/tests/JDBC_API_Tester.java @@ -11,7 +11,7 @@ import java.sql.*; import java.io.StringReader; import java.math.BigDecimal; import java.math.BigInteger; -import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; @@ -2034,7 +2034,7 @@ final public class JDBC_API_Tester { sb.setLength(0); // clear the output log buffer byte[] errorBytes = new byte[] { (byte) 0xe2, (byte) 0x80, (byte) 0xa7 }; - String errorStr = new String(errorBytes, Charset.forName("UTF-8")); + String errorStr = new String(errorBytes, StandardCharsets.UTF_8); StringBuilder repeatedErrorStr = new StringBuilder(); for (int i = 0; i < 8170;i++) { repeatedErrorStr.append(errorStr); @@ -2470,17 +2470,17 @@ final public class JDBC_API_Tester { .append(" parameters\n"); String val = "0123456789abcdef"; pstmt.setString(1, val); - pstmt.setBytes(2, val.getBytes("UTF-8")); + pstmt.setBytes(2, val.getBytes(StandardCharsets.UTF_8)); sb.append("3 Insert data row 1\n"); pstmt.execute(); val = "~!@#$%^&*()_+`1-=][{}\\|';:,<.>/?"; pstmt.setString(1, val); - pstmt.setBytes(2, val.getBytes("UTF-8")); + pstmt.setBytes(2, val.getBytes(StandardCharsets.UTF_8)); sb.append("4 Insert data row 2\n"); pstmt.execute(); val = "\u00e0\u004f\u20f0\u0020\u00ea\u003a\u0069\u0010\u00a2\u00d8\u0008\u0001\u002b\u0030\u019c\u129e"; pstmt.setString(1, val); - pstmt.setBytes(2, val.getBytes("UTF-8")); + pstmt.setBytes(2, val.getBytes(StandardCharsets.UTF_8)); sb.append("4 Insert data row 3\n"); pstmt.execute(); pstmt.close(); @@ -2519,8 +2519,6 @@ final public class JDBC_API_Tester { pstmt = null; } catch (SQLException e) { sb.append("FAILED: ").append(e.getMessage()).append("\n"); - } catch (java.io.UnsupportedEncodingException e) { - sb.append("FAILED: ").append(e.getMessage()).append("\n"); } closeStmtResSet(pstmt, rs);