JoinRowSet.addRowSet does not throw SQLException if given param is an empty rowset

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P2
    • 6
    • Affects Version/s: 5.0
    • Component/s: core-libs
    • b97
    • generic
    • generic

      The spec for public void JoinRowSet.addRowSet(Joinable rowset) says:
      ...
      Throws:
          java.sql.SQLException - if (1) an empty rowset is added to the to this JoinRowSet object,
      ...

      In fact, java.sql.SQLException is thrown if rowset is empty. See an example below:
      -------------------------------------------------------------------------------
      import com.sun.rowset.CachedRowSetImpl;
      import com.sun.rowset.JoinRowSetImpl;
      import java.sql.SQLException;
      import java.sql.Types;
      import javax.sql.rowset.CachedRowSet;
      import javax.sql.rowset.JoinRowSet;
      import javax.sql.rowset.RowSetMetaDataImpl;

      /**
       *
       * @author aag
       */
      public class NewClass {
          
          /** Creates a new instance of NewClass */
          public static void main(String[] argv) throws SQLException {
              JoinRowSet jrs = new JoinRowSetImpl();
              CachedRowSet crs = new CachedRowSetImpl();
              RowSetMetaDataImpl rsmd = new RowSetMetaDataImpl();
              rsmd.setColumnCount(1);
              rsmd.setColumnName(1, "FIELD1");
              rsmd.setColumnType(1, Types.INTEGER);
              crs.setMetaData(rsmd);
              try {
                  jrs.addRowSet(crs, 1);
                  System.out.println("SQLException was not thrown");
              } catch (SQLException e) {
                  System.out.println("SQLException was thrown");
              }
          }
          
          
      }
      ---------------------------------------------------------------------------
      run-single:
      SQLException was not thrown

            Assignee:
            Sushmita Sharma (Inactive)
            Reporter:
            Alexey Gavrilov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: