src/java.sql.rowset/share/classes/javax/sql/rowset/RowSetWarning.java

Print this page

        

@@ -126,11 +126,19 @@
      *         <code>RowSetWarning</code> object is chained to this one,
      *         <code>null</code> is returned (default value)
      * @see #setNextWarning
      */
     public RowSetWarning getNextWarning() {
-        return rwarning;
+        try {
+            return ((RowSetWarning)getNextException());
+        } catch (ClassCastException ex) {
+            // 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");
+        }
+        
     }
 
     /**
      * Sets <i>warning</i> as the next warning, that is, the warning chained
      * to this <code>RowSetWarning</code> object.

@@ -139,10 +147,10 @@
      *     next warning; if the <code>RowSetWarning</code> is null, this
      *     represents the finish point in the warning chain
      * @see #getNextWarning
      */
     public void setNextWarning(RowSetWarning warning) {
-        rwarning = warning;
+        setNextException(warning);
     }
 
     static final long serialVersionUID = 6678332766434564774L;
 }