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

NullPointerException in FilteredRowSetImpl object when filter is set to null

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 6
    • 5.0
    • core-libs
    • b91
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      1.5.0-b64

      ADDITIONAL OS VERSION INFORMATION :
      This bug appears in the generic classes for the FilteredRowSetImpl class.

      A DESCRIPTION OF THE PROBLEM :
      NullPointerException in FilteredRowSetImpl object when filter is set to null and when executing any of the "update" methods. I verified the bug in the source code. The class does not check for a null value and tries to execute a method of the Predicate object even though it is null.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Create a FilteredRowSetImpl object and attach it to a resultset.
      2. Set the filter to null.
      3. Execute one of the "update" methods.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The RowSet would be updated.
      ACTUAL -
      NullPointerException is thrown.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      NullPointerException thrown by the FilteredRowSetImpl object/class.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------

      public static void updateFilteredRowSet(frs FilteredRowSetImpl, String dsName, String command, String updateCol, String updateVal) throws SQLException{
          frs.setDataSourceName(dsName);
          frs.setCommand(command);
          frs.execute();
          frs.setFilter(null);
          frs.beforeFirst();
          if(frs.next()){
              frs.updateString(updateCol, updateVal);
          }
          frs.close();
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      The class if almost useless and I may as well use iteration to find needed rows instead of a filter since I cannot open up the filter. I suppose, however, I could create a Predicate that always returned true.
      ###@###.### 2005-03-02 10:16:00 GMT

            ssharmasunw Sushmita Sharma (Inactive)
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: