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

api/javax_sql/rowset/impl/JoinRowSet/index.html#JoinRowSet[toCollectionTest] fails on b98

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P2 P2
    • None
    • 6
    • core-libs
    • None
    • generic
    • generic

      JCK : JCK6.0 b30
      J2SE : FAIL - mustang b98
      Platform[s] : FAIL - seems to be all
      switch/Mode : FAIL - default

      Three tests fail on b98:
      api/javax_sql/rowset/impl/JoinRowSet/index.html#JoinRowSet[toCollectionTest1] api/javax_sql/rowset/impl/JoinRowSet/index.html#JoinRowSet[toCollectionTest2] api/javax_sql/rowset/impl/JoinRowSet/index.html#JoinRowSet[toCollectionTest]

      The problem is that toCollection(), toCollection(int) and toCollection(String) return empty collection for com.sun.rowset.JoinRowSetImpl.

      steps to reproduce:

      compile and run code:

      import java.io.PrintWriter;
      import java.sql.*;
      import javax.sql.*;
      import javax.sql.rowset.*;
      import java.math.BigDecimal;


      public class JoinRowSetTest{

      public static void main (String[] args){

              try {
      CachedRowSet crs = (CachedRowSet)getRowSetImpl();
      java.util.Collection coll = crs.toCollection();
      System.out.println("Collection size is: "+coll.size());
      System.out.println("Rowset size is: "+crs.size());

              } catch (Exception e) {
      e.printStackTrace();
        return;
              }
      }


          protected static RowSet getRowSetImpl() throws Exception {
              try {
                  RowSet rs = newInstance();
                  initRowSet(rs);
                  return rs;
              } catch (SQLException e) {
                  e.printStackTrace();
      throw new RuntimeException(e);
              }
          }

          protected static void initRowSet(RowSet rs) throws SQLException {
              CachedRowSet crs = (CachedRowSet) rs;
              RowSetMetaDataImpl rsmdi = new RowSetMetaDataImpl();
              crs.setType(RowSet.TYPE_SCROLL_INSENSITIVE);

              rsmdi.setColumnCount(18);
              

              rsmdi.setColumnName(1, "_bit_");
              rsmdi.setColumnName(2, "_object_");
              rsmdi.setColumnName(3, "_char_");
              rsmdi.setColumnName(4, "_date_");
              rsmdi.setColumnName(5, "_decimal_");
              rsmdi.setColumnName(6, "_double_");
              rsmdi.setColumnName(7, "_float_");
              rsmdi.setColumnName(8, "_integer_");
              rsmdi.setColumnName(9, "_numeric_");
              rsmdi.setColumnName(10, "_real_");
              rsmdi.setColumnName(11, "_ref_");
              rsmdi.setColumnName(12, "_smallint_");
              rsmdi.setColumnName(13, "_time_");
              rsmdi.setColumnName(14, "_timestamp_");
              rsmdi.setColumnName(15, "_timyint_");
              rsmdi.setColumnName(16, "_varchar_");
              rsmdi.setColumnName(17, "_bin_");
              rsmdi.setColumnName(18, "_bigint_");


              rsmdi.setNullable(1, ResultSetMetaData.columnNoNulls);
              rsmdi.setNullable(2, ResultSetMetaData.columnNullable);
              rsmdi.setNullable(3, ResultSetMetaData.columnNullable);
              rsmdi.setNullable(11, ResultSetMetaData.columnNullable);

              
              rsmdi.setColumnType(1, Types.BIT);
              rsmdi.setColumnType(2, Types.JAVA_OBJECT);
              rsmdi.setColumnType(3, Types.CHAR);
              rsmdi.setColumnType(4, Types.DATE);
              rsmdi.setColumnType(5, Types.DECIMAL);
              rsmdi.setColumnType(6, Types.DOUBLE);
              rsmdi.setColumnType(7, Types.FLOAT);
              rsmdi.setColumnType(8, Types.INTEGER);
              rsmdi.setColumnType(9, Types.NUMERIC);
              rsmdi.setColumnType(10, Types.REAL);
              rsmdi.setColumnType(11, Types.REF);
              rsmdi.setColumnType(12, Types.SMALLINT);
              rsmdi.setColumnType(13, Types.TIME);
              rsmdi.setColumnType(14, Types.TIMESTAMP);
              rsmdi.setColumnType(15, Types.TINYINT);
              rsmdi.setColumnType(16, Types.VARCHAR);
              rsmdi.setColumnType(17, Types.BINARY);
              rsmdi.setColumnType(18, Types.BIGINT);
              crs.setMetaData(rsmdi);

              // ========== add a few rows
              final byte[] buf = {0x01, 0x02};
              
              crs.moveToInsertRow();

              crs.updateBoolean(1, false);
      // crs.updateBoolean(2, true);
              crs.updateString(3, "Char value");
              crs.updateDate(4, new Date(432423434L));
              crs.updateBigDecimal(5, new BigDecimal(0));
              crs.updateDouble(6, 3.14);
              crs.updateDouble(7, 3.1415);
              crs.updateInt(8, 13);
              crs.updateBigDecimal(9, new BigDecimal(0));
              crs.updateFloat(10, 0.0f);
              crs.updateNull(11);
              crs.updateShort(12, (short )0 );
              crs.updateTime(13, new Time(34324));
              crs.updateTimestamp(14, new Timestamp(34322));
              crs.updateByte(15, (byte)1);
              crs.updateString(16, "varchar value");
              crs.updateBytes(17, buf);
              crs.updateLong(18, Long.MAX_VALUE - 1);
              crs.insertRow();

              crs.moveToInsertRow();

              crs.updateBoolean(1, false);
        // crs.updateBoolean(2, true);
              crs.updateString(3, "Char value 1");
              crs.updateDate(4, new Date(436576L));
              crs.updateBigDecimal(5, new BigDecimal(10));
              crs.updateDouble(6, 3.14);
              crs.updateDouble(7, 3.1415);
              crs.updateInt(8, 13);
              crs.updateBigDecimal(9, new BigDecimal(15));
              crs.updateFloat(10, 10.0f);
              crs.updateNull(11);
              crs.updateShort(12, (short )13 );
              crs.updateTime(13, new Time(777));
              crs.updateTimestamp(14, new Timestamp(45654));
              crs.updateByte(15, (byte)17);
              crs.updateString(16, "varchar value 1");
              crs.updateBytes(17, buf);
              crs.updateLong(18, Long.MAX_VALUE);
              crs.insertRow();

              crs.moveToCurrentRow();
              crs.beforeFirst();


          }

          protected static RowSet newInstance() throws Exception {
                  return (RowSet)(Class.forName("com.sun.rowset.JoinRowSetImpl").newInstance());
          }




      }

            Unassigned Unassigned
            pastepan Pavel Stepanov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: