Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4914863

javax.sql.rowset.BaseRowSet.setXXX(int, ..) throws NPE

XMLWordPrintable

    • beta
    • sparc
    • solaris_2.6



      Name: sdR10048 Date: 08/29/2003


      Filed By : SPB JCK team (###@###.###)
      JDK : java full version "1.5.0-beta-b16"
      Tests fail:
      api/javax_sql/rowset/BaseRowSet/index.html#Params1[BaseRowSet0007]
      api/javax_sql/rowset/BaseRowSet/index.html#Params1[BaseRowSet0009]
      api/javax_sql/rowset/BaseRowSet/index.html#Params1[BaseRowSet0011]
      api/javax_sql/rowset/BaseRowSet/index.html#Params1[BaseRowSet0013]
      api/javax_sql/rowset/BaseRowSet/index.html#Params1[BaseRowSet0015]
      api/javax_sql/rowset/BaseRowSet/index.html#Params2[BaseRowSet0017]
      api/javax_sql/rowset/BaseRowSet/index.html#Params2[BaseRowSet0019]
      api/javax_sql/rowset/BaseRowSet/index.html#Params2[BaseRowSet0021]
      api/javax_sql/rowset/BaseRowSet/index.html#Params4[BaseRowSet0029]
      api/javax_sql/rowset/BaseRowSet/index.html#Params4[BaseRowSet0030]

      Specification excerpt:
      ======================
      --------- J2SE API spec v.1.5 ---------
      ...
      public void setArray(int parameterIndex,
                           java.sql.Array x)
                    throws java.sql.SQLException
      Sets the designated parameter to an Array object in the Java programming
      language. The driver converts this to an SQL ARRAY value when
      it sends it to the database.

      The parameter value set by this method is stored internally and will
      be supplied as the appropriate parameter in this JDBC RowSet's
      command when the method execute is called.

      Primitives and object instances values to be used as JDBC RowSet
      command parameters are stored internally as object instances in
      an internal Vector object instance. Subsequent calls to getParams
      ouput an object array of the current command parameters that is
      a direct representation of the current internal command parameters.

      Parameters:
      parameterIndex - the ordinal number of the placeholder parameter
      in this RowSet object's command that is to be set.
      The first parameter is 1, the second is 2, and so on; must be 1
      or greater
      x - an Array object representing an SQL ARRAY value
      Throws:
      java.sql.SQLException - if an error occurs or the parameter index is out of bounds...
      ---------- end-of-excerpt ---------------

      Problem description
      ===================
      Methods:
         setArray
         setBigDecimal
         setByte
         setDate
         setDouble
         setFloat
         setInt
         setLong
         setString
      throw NullPointerException. See demo:

      Demo:
      import javax.sql.rowset.*;
      import javax.sql.*;
      import java.sql.*;

      public class T {

          public static void main(String[] args) {
              MyBaseRowSet rs = new MyBaseRowSet();
              try {
                  rs.setDate(1, new Date(0));
              } catch (Exception e) {
                  e.printStackTrace();
              }
          }
      }

      class MyBaseRowSet extends BaseRowSet {

          public MyBaseRowSet() {
              super();
          }
      }

      Demo's output:
      java.lang.NullPointerException
              at javax.sql.rowset.BaseRowSet.setDate(BaseRowSet.java:1632)
              at T.main(T.java:10)

      ======================================================================

            ahandasunw Amit Handa (Inactive)
            dsvsunw Dsv Dsv (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: