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

BaseRowSet.setAsciiStream doesnt throw SQLException

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P3 P3
    • None
    • 5.0
    • core-libs
    • sparc
    • solaris_2.6



      Name: vsR10316 Date: 05/06/2004


      Filed By : SPB JCK team (###@###.###)
      JDK :
      JCK : 1.5
      Platform[s] : Solaris
      switch/Mode :
      JCK test owner : http://javaweb.eng/jct/sqe/JCK-tck/usr/owners.jto
      Failing Test [s] : N/A


      Specification excerpt:
      ======================
      --------- J2SE API spec v.1.5 ---------
      ...
      javax.sql.rowset.BaseRowSet

      setAsciiStream

      public void setAsciiStream(int parameterIndex,
                                 InputStream x,
                                 int length)
                          throws SQLException

          Sets the designated parameter to the given java.io.InputStream
      object, which will have the specified number of bytes. The contents of
      the stream will be read and sent to the database. This method throws an
      SQLException object if the number of bytes read and sent to the database
      is not equal to length.

      ...
      ...
      ---------- end-of-excerpt ---------------

      Problem description
      ===================
      As defined in last sentence in specification excerpt this method should
      throw an SQLException object if the number of bytes read and sent to the
      database is not equal to length but it doesn't.
      Same for setBinaryStream and setCharacterStream methods.


      Minimized test:
      ===============
      ------- Test.java -------
      package test;

      import java.io.FileInputStream;

      import javax.sql.rowset.BaseRowSet;
      public class Test {

          public static void main(String [] arg) {
          try {
      /*
      The SimpleRowSet class is subclass of BaseRowSet implementing JdbcRowSet
      with stub implementation for all methods defined in JdbcRowSet and
      default constructor with invocation of initParams() method.
      */
              BaseRowSet rs = new SimpleRowSet();
      /*
      File "javadoc.xml" should be present and has size smaller than 200000
      */
              rs.setAsciiStream(1, new FileInputStream("javadoc.xml"), 200000);
              System.out.println("Error. SQLException should be thrown.");
              } catch (SQLException e) {
               e.printStackTrace();
              }
          }
      }
      ------- end-of-Test.java -------

      Minimized test output:
      ======================
      Started ...
      Error. SQLException should be thrown.


      JCK test source location:
      ==========================
      /java/re/jck/1.5/promoted/latest/JCK-runtime-15/tests

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

            ahandasunw Amit Handa (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: