Skip to Content.
Sympa Menu

freetds - [JDBC] serious bug that swallows error messages

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Stefan Bodewig <bodewig AT bost.de>
  • To: <freetds AT franklin.oit.unc.edu>
  • Cc: freetds-jdbc-bugs AT internetcds.com
  • Subject: [JDBC] serious bug that swallows error messages
  • Date: 21 Sep 2000 17:58:06 +0200

When an error message is immediately followed by a warning, the error
won't result in a SQLException in certain situation.

The appended unittest shows the bug, the appended patch fixes it.

Stefan

Attachment: inserts.java
Description: Binary data

Index: ResultSet_base.java
===================================================================
RCS file: /Repository/freetds_jdbc/ResultSet_base.java,v
retrieving revision 1.4
diff -u -b -r1.4 ResultSet_base.java
--- ResultSet_base.java	2000/07/17 04:41:06	1.4
+++ ResultSet_base.java	2000/09/21 15:54:14
@@ -1499,7 +1499,11 @@
             else if (tds.isMessagePacket() || tds.isErrorPacket())
             {
                PacketMsgResult  tmp = (PacketMsgResult)tds.processSubPacket();
-               exception = warningChain.addOrReturn(tmp);
+               SQLException inner = warningChain.addOrReturn(tmp);
+               if (exception == null) 
+               {
+                  exception = inner;
+               }
             }
             else
             {
Index: Statement.java
===================================================================
RCS file: /Repository/freetds_jdbc/Statement.java,v
retrieving revision 1.24
diff -u -b -r1.24 Statement.java
--- Statement.java	2000/07/17 04:41:06	1.24
+++ Statement.java	2000/09/21 15:54:15
@@ -616,7 +616,11 @@
             else if (tds.isMessagePacket() || tds.isErrorPacket())
             {
                PacketMsgResult  tmp = (PacketMsgResult)tds.processSubPacket();
-               exception = warningChain.addOrReturn(tmp);
+               SQLException inner = warningChain.addOrReturn(tmp);
+               if (exception == null) 
+               {
+                  exception = inner;
+               }
             }
             else 
             {
@@ -725,7 +729,11 @@
             }
             else if (tmp instanceof PacketMsgResult)
             {
-               exception = warningChain.addOrReturn((PacketMsgResult)tmp);
+               SQLException inner = warningChain.addOrReturn((PacketMsgResult)tmp);
+               if (exception == null) 
+               {
+                  exception = inner;
+               }
             }
             else if (tmp instanceof PacketUnknown)
             {


  • [JDBC] serious bug that swallows error messages, Stefan Bodewig, 09/21/2000

Archive powered by MHonArc 2.6.24.

Top of Page