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

Print this page

        

@@ -54,15 +54,10 @@
  * @since 1.5
  */
 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.
      *
      * @param reason a <code>String</code> object giving a description

@@ -126,11 +121,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.class.cast(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 +142,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;
 }