jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/RowSetWarning.java
changeset 27183 5260f53ce305
parent 25991 e48157b42439
equal deleted inserted replaced
27182:4525d13b8af1 27183:5260f53ce305
    52  * <code>RowSetWarning</code> object.
    52  * <code>RowSetWarning</code> object.
    53  *
    53  *
    54  * @since 1.5
    54  * @since 1.5
    55  */
    55  */
    56 public class RowSetWarning extends SQLException {
    56 public class RowSetWarning extends SQLException {
    57 
       
    58     /**
       
    59      * RowSetWarning object handle.
       
    60      */
       
    61      private RowSetWarning rwarning;
       
    62 
    57 
    63     /**
    58     /**
    64      * Constructs a <code>RowSetWarning</code> object
    59      * Constructs a <code>RowSetWarning</code> object
    65      * with the given value for the reason; SQLState defaults to null,
    60      * with the given value for the reason; SQLState defaults to null,
    66      * and vendorCode defaults to 0.
    61      * and vendorCode defaults to 0.
   126      *         <code>RowSetWarning</code> object is chained to this one,
   121      *         <code>RowSetWarning</code> object is chained to this one,
   127      *         <code>null</code> is returned (default value)
   122      *         <code>null</code> is returned (default value)
   128      * @see #setNextWarning
   123      * @see #setNextWarning
   129      */
   124      */
   130     public RowSetWarning getNextWarning() {
   125     public RowSetWarning getNextWarning() {
   131         return rwarning;
   126         SQLException warning = getNextException();
       
   127         if (  warning == null || warning instanceof RowSetWarning) {
       
   128             return (RowSetWarning)warning;
       
   129         } else {
       
   130             // The chained value isn't a RowSetWarning.
       
   131             // This is a programming error by whoever added it to
       
   132             // the RowSetWarning chain.  We throw a Java "Error".
       
   133             throw new Error("RowSetWarning chain holds value that is not a RowSetWarning: ");
       
   134         }
   132     }
   135     }
   133 
   136 
   134     /**
   137     /**
   135      * Sets <i>warning</i> as the next warning, that is, the warning chained
   138      * Sets <i>warning</i> as the next warning, that is, the warning chained
   136      * to this <code>RowSetWarning</code> object.
   139      * to this <code>RowSetWarning</code> object.
   139      *     next warning; if the <code>RowSetWarning</code> is null, this
   142      *     next warning; if the <code>RowSetWarning</code> is null, this
   140      *     represents the finish point in the warning chain
   143      *     represents the finish point in the warning chain
   141      * @see #getNextWarning
   144      * @see #getNextWarning
   142      */
   145      */
   143     public void setNextWarning(RowSetWarning warning) {
   146     public void setNextWarning(RowSetWarning warning) {
   144         rwarning = warning;
   147         setNextException(warning);
   145     }
   148     }
   146 
   149 
   147     static final long serialVersionUID = 6678332766434564774L;
   150     static final long serialVersionUID = 6678332766434564774L;
   148 }
   151 }