datamapper / do

DataObjects
147 stars 74 forks source link

Case sensitive error message test #81

Open dkubb opened 9 years ago

dkubb commented 9 years ago

See: https://github.com/datamapper/do/blob/master/do_jdbc/src/main/java/data_objects/Command.java#L324

In the above code the system checks if the error message is equal to "query does not return results". I'm seeing errors in DM's specs because the error is now being returned as "Query does not return results".

Locally I made the following change:

diff --git a/do_jdbc/src/main/java/data_objects/Command.java b/do_jdbc/src/main/java/data_objects/Command.java
index 6edac92..70be2bc 100644
--- a/do_jdbc/src/main/java/data_objects/Command.java
+++ b/do_jdbc/src/main/java/data_objects/Command.java
@@ -321,7 +321,7 @@ public class Command extends DORubyObject {
         } catch (SQLException sqle) {
             // XXX sqlite3 jdbc driver happily throws an exception if the result set is empty :P
             // this sets up a minimal empty reader
-            if (sqle.getMessage().equals("query does not return results")) {
+            if (sqle.getMessage().toLowerCase().equals("query does not return results")) {

                 // pass the response to the Reader
                 reader.resultSet = resultSet;

And it seemed to resolve the problem I was seeing in the specs.

If there's no problem with this kind of fix I can submit a PR with this change.