db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bernt M. Johnsen" <Bernt.John...@Sun.COM>
Subject Re: [jira] Commented: (DERBY-7) Bug in NULLIF Function
Date Thu, 04 May 2006 20:32:48 GMT
> However, the test resultset.java has since had some work done on it,
> and I'm specifically concerned that you may have missed the changes
> I worked on for DERBY-903, which were committed with revision 378337
> and 379643.
> 
> This eliminates the use of the constructor 'new String(bytes[]),
> which is non-portable...It constructs a string by decoding the bytes
> using the default platform charset. This can lead to encoding
> related problems.  For this case, you should probably use the
> constructor that takes in the encoding. ie new String(byte[], String
> charsetname).

The net result from the two mentioned commits is as far a I can see
the diff below. Myrna: can you confirm?

Index: java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/resultset.java
===================================================================
--- java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/resultset.java     (revision
399685)
+++ java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/resultset.java     (working
copy)
@@ -798,12 +798,9 @@
                                try{
                                row.append(s.getString(i));
                                } catch(SQLException ex){
-                                       if (ex.getSQLState().equals("22005")) {
-                                               if (s.getBytes(i) != null)
-                row.append(new String(s.getBytes(i)));
-                                               else
-                row.append(s.getBytes(i));
-                                       } else throw ex;
+                                       if (ex.getSQLState().equals("22005"))
+                                               row.append("Invalid Conversion Error\n");
+                                       else throw ex;
                                }
                        }
                        row.append("}\n");


-- 
Bernt Marius Johnsen, Database Technology Group, 
Staff Engineer, Technical Lead Derby/Java DB
Sun Microsystems, Trondheim, Norway

Mime
View raw message