United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6467707 api/javax_sql/rowset/impl/FilteredRowSet/index.html#FilteredRowSet[absoluteTest] fails
JDK-6467707 : api/javax_sql/rowset/impl/FilteredRowSet/index.html#FilteredRowSet[absoluteTest] fails

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:
P3
Resolution:
Fixed
Affected Versions:
6
Fixed Versions:
6u1 (b01)

Related Reports
Backport:
Relates:

Sub Tasks

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

Test api/javax_sql/rowset/impl/FilteredRowSet/index.html#FilteredRowSet[absoluteTest] fails because absolute(1) doesn't return true for non-empty result set.

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 RowsetTest{

public static void main (String[] args){

        try {
	   RowSet rs = getRowSetImpl();
	   System.out.println("Initialized...");

	   System.out.println("absolute(1) is: "+rs.absolute(1));

        } catch (Exception e) {
	    e.printStackTrace();
 	    return;
        }
        System.out.println("OK");


}


    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.FilteredRowSetImpl").newInstance());
    }




}
foxed in 6u1 not in JDK7

                                    

Comments
EVALUATION

The test correct, it checks that absolute(1/-1) returns false only on empty resultset. If  resultset is not empty and propertly configured absolute(1/-1) must move cursor to the specified position.
                                     
2006-09-06
EVALUATION

needs waiver request
                                     
2006-09-11
EVALUATION

fix has been provided to the TCK team to test
                                     
2006-11-14



Hardware and Software, Engineered to Work Together