jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/RowSetWarning.java
changeset 27183 5260f53ce305
parent 25991 e48157b42439
--- a/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/RowSetWarning.java	Mon Oct 20 21:18:48 2014 +0000
+++ b/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/RowSetWarning.java	Tue Oct 21 13:41:22 2014 -0400
@@ -56,11 +56,6 @@
 public class RowSetWarning extends SQLException {
 
     /**
-     * RowSetWarning object handle.
-     */
-     private RowSetWarning rwarning;
-
-    /**
      * Constructs a <code>RowSetWarning</code> object
      * with the given value for the reason; SQLState defaults to null,
      * and vendorCode defaults to 0.
@@ -128,7 +123,15 @@
      * @see #setNextWarning
      */
     public RowSetWarning getNextWarning() {
-        return rwarning;
+        SQLException warning = getNextException();
+        if (  warning == null || warning instanceof RowSetWarning) {
+            return (RowSetWarning)warning;
+        } else {
+            // The chained value isn't a RowSetWarning.
+            // This is a programming error by whoever added it to
+            // the RowSetWarning chain.  We throw a Java "Error".
+            throw new Error("RowSetWarning chain holds value that is not a RowSetWarning: ");
+        }
     }
 
     /**
@@ -141,7 +144,7 @@
      * @see #getNextWarning
      */
     public void setNextWarning(RowSetWarning warning) {
-        rwarning = warning;
+        setNextException(warning);
     }
 
     static final long serialVersionUID = 6678332766434564774L;