Bug in org.webdocwf.util.xml.XmlResultSet.java

View: New views
2 Messages — Rating Filter:   Alert me  

Bug in org.webdocwf.util.xml.XmlResultSet.java

by BriceFisher :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Bug in org.webdocwf.util.xml.XmlResultSet.java

The code in org.webdocwf.util.xml.XmlResultSet.java:wasNull() looks for lastIndexRead >=0.  lastIndexRead is initialized to -1.  However, it is never incremented in any of the getters, so code like this:

while (rs.next()) {
  String s = rs.getString();
  if (rs.wasNull()) {
  }
}

Always throws an exception with "No previous getter method called".



--
You receive this message as a subscriber of the octopus@... mailing list.
To unsubscribe: mailto:octopus-unsubscribe@...
For general help: mailto:sympa@...?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

RE: Bug in org.webdocwf.util.xml.XmlResultSet.java

by BriceFisher :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Bug in org.webdocwf.util.xml.XmlResultSet.java
Patch to fix:
 
--- Octopus/Octopus-src/modules/XMLjdbc/src/src/org/webdocwf/util/xml/XmlResultSet.java     2006-06-23 04:40:52.000000000 -0600
+++ XMLjdbc/src/src/org/webdocwf/util/xml/XmlResultSet.java 2007-06-19 09:40:18.797775400 -0600
@@ -127,6 +127,7 @@
 
   public String getString(int i) throws SQLException {
     try {
+        lastIndexRead = i;
       return this.columnValues[i-1].toString();
     }catch(Exception e) { throw new SQLException("Error ResultSet.getString( in
dex ) : "+e.getMessage()); }
   }
@@ -450,6 +451,7 @@
   }
   if( colIndex == -1 )
     throw new SQLException("Column "+columnName+" not found.");
+  lastIndexRead = colIndex;
   return this.columnValues[colIndex];
 }


From: Fisher, Brice A [mailto:bafishe@...]
Sent: Monday, June 18, 2007 4:08 PM
To: octopus@...
Subject: [octopus] Bug in org.webdocwf.util.xml.XmlResultSet.java

The code in org.webdocwf.util.xml.XmlResultSet.java:wasNull() looks for lastIndexRead >=0.  lastIndexRead is initialized to -1.  However, it is never incremented in any of the getters, so code like this:

while (rs.next()) {
  String s = rs.getString();
  if (rs.wasNull()) {
  }
}

Always throws an exception with "No previous getter method called".



--
You receive this message as a subscriber of the octopus@... mailing list.
To unsubscribe: mailto:octopus-unsubscribe@...
For general help: mailto:sympa@...?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws