United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6467887 api/javax_sql/rowset/impl/JoinRowSet/index.html#JoinRowSet[createCopySchemaTest] fails on b98
JDK-6467887 : api/javax_sql/rowset/impl/JoinRowSet/index.html#JoinRowSet[createCopySchemaTest] fails on b98

Details
Type:
Bug
Submit Date:
2006-09-06
Status:
Closed
Updated Date:
2012-03-22
Project Name:
JDK
Resolved Date:
2008-01-10
Component:
core-libs
OS:
generic
Sub-Component:
javax.sql
CPU:
generic
Priority:
P2
Resolution:
Fixed
Affected Versions:
6
Fixed Versions:
6u1 (b01)

Related Reports
Backport:

Sub Tasks

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

api/javax_sql/rowset/impl/JoinRowSet/index.html#JoinRowSet[createCopySchemaTest] fails because createCopySchema for JoinRowSet also copies data, i/e/ constructs non-empty recordset hence violates specification.

Steps to reproduce: 
run the following code:

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


public class CachedRowSetTest{

public static void main (String[] args){

        try {
	   CachedRowSet crs = (CachedRowSet)getRowSetImpl();
           CachedRowSet newRs = crs.createCopySchema();
	   System.out.println("New size is: "+newRs.size()+" should be empty");

        } 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());
    }




}

                                    

Comments
EVALUATION

createCopySchema should create an empty copy. This will be looked into, but is not critical.
                                     
2006-09-12
EVALUATION

Fix has been provided to tck team to test
                                     
2006-11-14



Hardware and Software, Engineered to Work Together