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

IllegalArgumentException should be specified for javax.sql.*Event constructors

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 6
    • 6
    • core-libs
    • None
    • beta
    • generic
    • generic
    • Not verified

      It would be good to specify the behavior of javax.sql.StatementEvent, javax.sql.ConnectionEvent, javax.sql.RowSetEvent constructors if first given param is null. For example, the spec says nothing about the null param value for javax.sql.StatementEvent:

      ------------------------------------------------------------------------------------------
      public StatementEvent(PooledConnection con,
                            PreparedStatement statement)

          Constructs a StatementEvent with the specified PooledConnection and PreparedStatement. The SQLException contained in the event defaults to null.

          Parameters:
              con - The PooledConnection that the closed or invalid PreparedStatementis associated with.
              statement - The PreparedStatement that is bieng closed or is invalid

      ------------------------------------------------------------------------------------------

      But the constructor throws IllegalArgumentException:

      ------------
      import javax.sql.StatementEvent;
      public class Test {
          
          /** Creates a new instance of Test */

          
          public static void main(String[] argv) {
              try {
                  StatementEvent a = new StatementEvent(null, null);
              } catch (IllegalArgumentException e) {
                  System.out.println("Unexpected " + e);
              }
          }
      }
      -----------
      run-single:
      Unexpected java.lang.IllegalArgumentException: null source

            lancea Lance Andersen
            agavrilosunw Alexey Gavrilov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: