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

javax.sql.rowset.BaseRowSet.notifyXXX throw ClassCastException

XMLWordPrintable

    • rc
    • sparc
    • solaris_2.6
    • Verified

        Name: sdR10048 Date: 08/28/2003


        Filed By : SPB JCK team (###@###.###)
        JDK : java full version "1.5.0-beta-b16"
        JCK : 1.5
        JCK test owner : http://javaweb.eng/jct/sqe/JCK-tck/usr/owners.jto
        Failing Test [s] :
            api/javax_sql/rowset/BaseRowSet/index.html#Listen[BaseRowSet2037]
            api/javax_sql/rowset/BaseRowSet/index.html#Listen[BaseRowSet2038]
            api/javax_sql/rowset/BaseRowSet/index.html#Listen[BaseRowSet2039]
            api/javax_sql/rowset/BaseRowSet/index.html#Listen[BaseRowSet2040]


        Specification excerpt:
        ======================
        --------- J2SE API spec v.1.5 ---------
        ...
        protected void notifyCursorMoved()

             Notifies all of the listeners registered with this
             RowSet object that its cursor has moved.
             
             When an application calls a method to move the cursor,
             that method moves the cursor and then calls this method
             internally. An application never invokes this method directly.

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

        Problem description
        ===================
        The methods:
        javax.sql.rowset.BaseRowSet.notifyCursorMoved
        javax.sql.rowset.BaseRowSet.notifyRowChanged
        javax.sql.rowset.BaseRowSet.notifyRowSetChanged

        throw ClassCastException if registered listeners list is not empty.

            
        Minimized test:
        ===============
        ------- T.java -------
        import javax.sql.rowset.*;
        import javax.sql.*;

        public class T {

            public static void main(String[] args) {
                MyBaseRowSet rs = new MyBaseRowSet();
                rs.addRowSetListener(new FakeRSAdapter());
                rs.notifyCursorMoved();
            }
        }

        class MyBaseRowSet extends BaseRowSet {

            public MyBaseRowSet() {
                super();
            }

            public void initParams() {
                super.initParams();
            }

            public void notifyCursorMoved() {
                super.notifyCursorMoved();
            }

            public void notifyRowChanged() {
           G super.notifyRowChanged();
            }

            public void notifyRowSetChanged() {
                super.notifyRowSetChanged();
            }
        }

        class FakeRSAdapter implements RowSetListener {

            public void cursorMoved(RowSetEvent e) {
            }

            public void rowChanged(RowSetEvent e) {
            }

            public void rowSetChanged(RowSetEvent e) {
            }
        }

        ------- end-of-T.java -------

        Minimized test output:
        ======================
        C:\TEMP\5>c:\java\bin\java T
        Exception in thread "main" java.lang.ClassCastException: MyBaseRowSet
                at javax.sql.rowset.BaseRowSet.notifyCursorMoved(BaseRowSet.java:479)
                at MyBaseRowSet.notifyCursorMoved(T.java:24)
                at T.main(T.java:9)

        JCK test source location:
        ==========================
        At this time (28 aug 2003) these testcases aren't in JCK15 ws yet.

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

              lancea Lance Andersen
              dsvsunw Dsv Dsv (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: