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

The class javax.sql.rowset.serial.SerialBlob does not meet specification

XMLWordPrintable

    • beta
    • sparc
    • solaris_2.6



      Name: ssR10000 Date: 09/16/2003


      Filed By : SPB JCK team (###@###.###)
      JDK : java full version "1.5.0-beta-b18"
      JCK : 1.5
      Platform[s] : Solaris
      switch/Mode :
      JCK test owner : http://javaweb.eng/jct/sqe/JCK-tck/usr/owners.jto


      Problem description
      ===================
      There is following problems with SerialBlob class:

      1. Following method throws an exception if start==0:
      The spec. says:
      * Returns the position in this <code>SerialBlob</code> object where
      * the given pattern of bytes begins, starting the search at the
      * specified position.
      ...
      * @param start the position of the byte in this
      * <code>SerialBlob</code> object from which to begin
      * the search; the first position is <code>0?1</code>;
      * must not be less than <code>0</code> nor greater than
      * the length of this <code>SerialBlob</code> object

      we can pass 'start' == 0 because it is not less than 0 but in this case
      method will throw an exception.

          public long position(byte[] pattern, long start) throws SerialException {
              int pos = (int)(start - 1);
      // SSW: pos is -1 here if start = 0
              long beginpos;
              int i = 0;
              long patlen = pattern.length;

              if (start < 0 || start > len) {
                  return -1;
              }
                 
              while (pos < len) {
                  i = 0;
                  beginpos = pos + 1;
                  while (pattern[i++] == buf[pos++]) {
      // SSW: buf[-1] throws ArrayIndexOutOfBoundsException
                      if (i == patlen) {
                          return beginpos;
                      }
                  }
              }
              return -1;
          }

      2. The same with next one:
          public long position(Blob pattern, long start)

      because it is just a wrapper for public long position(byte[] pattern, long start)

      3. public java.io.OutputStream setBinaryStream(long pos)

      It is looks just like factory method to get an OutputStream

      A JCK test failed due to these problems:
      api/javax_sql/rowset/serial/SerialBlob/index.html#Main[SerialBlob2007]




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

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

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: