Changeset: a604e71a875e for monetdb-java
URL: https://dev.monetdb.org/hg/monetdb-java/rev/a604e71a875e
Modified Files:
        tests/JDBC_API_Tester.java
Branch: default
Log Message:

UTF-8 is a standard character set always available on Java, so use it where 
needed.


diffs (51 lines):

diff --git a/tests/JDBC_API_Tester.java b/tests/JDBC_API_Tester.java
--- 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);
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to