glassfish
  1. glassfish
  2. GLASSFISH-2573

NPE near setPrimitiveParameterValue with oracledd

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 9.1pe
    • Fix Version/s: 9.1pe
    • Component/s: jdbc
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      2,573

      Description

      9.1pe_b36

      A datatypes test failed on 9.1pe_b36 with Oracle and Datadirect driver 3.607.
      This test passed on 9.1pe_b33e with same Oracle and Datadirect driver.
      The test also passed on 9.1pe_b36 with Derby.

      @Entity
      public class TestEntity1
      implements java.io.Serializable{
      // ...
      protected Short shortData;
      protected java.sql.Date sqlDateData;
      // ....
      }

      public class TestClient {
      // ...
      String dateString = "";
      java.util.Date utildate = null;
      Locale currentLocale=new Locale("en","US");
      DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT,currentLocale);
      dateString = "09/15/76";
      utildate = df.parse(dateString);
      System.out.println("time1="+ new java.sql.Date(utildate.getTime()));
      TestEntity1 te1 = new TestEntity1(new Short(Short.MAX_VALUE),
      new java.sql.Date(utildate.getTime()), input+"1");
      // ...
      Double result = (Double)em.createQuery(
      "SELECT avg(te.shortData) from TestEntity1 te ").getSingleResult();
      // exception ???
      }

      Exception in thread "main" javax.persistence.RollbackException:
      java.lang.NullPointerException
      at oracle.toplink.essentials.internal.ejb.cmp3.transaction.base.
      EntityTransactionImpl.commit(EntityTransactionImpl.java:105)
      at oracle.toplink.essentials.internal.ejb.cmp3.transaction.
      EntityTransactionImpl.commit(EntityTransactionImpl.java:45)
      at TestClient.main(TestClient.java:45)
      Caused by: java.lang.NullPointerException
      at com.sun.sql.jdbc.base.BaseData.applyCalender(Unknown Source)
      at com.sun.sql.jdbc.base.BasePreparedStatement.setDate(Unknown Source)
      at oracle.toplink.essentials.platform.database.oracle.
      OraclePlatform.setPrimitiveParameterValue(OraclePlatform.java:575)
      at oracle.toplink.essentials.internal.databaseaccess.DatabasePlatform.
      setParameterValueInDatabaseCall(DatabasePlatform.java:1407)

        Activity

        Hide
        sherryshen added a comment -

        Created an attachment (id=786)
        Test case with README and test results

        Show
        sherryshen added a comment - Created an attachment (id=786) Test case with README and test results
        Hide
        pkrogh added a comment -

        The java docs for PreparedStatement setDate(...) say this:
        ...If no Calendar object is specified, the driver uses the default timezone,
        which is that of the virtual machine running the application...

        This appears to be a bug in the datadirect driver. I get a null pointer
        exception when I call statement.setDate(index,(java.sql.Date)parameter,null)
        (which the java docs say should work).

        The issue appears to be with the null. Passing in a new Calendar instance
        appears to get by the NPE, but this is not how I believe this method is
        intended to be used. Also, it is not clear to me how passing a new Calendar
        instance would behave on other drivers.

        I am not clear how to mark a bug as a third party issue in this issue tracker...

        Show
        pkrogh added a comment - The java docs for PreparedStatement setDate(...) say this: ...If no Calendar object is specified, the driver uses the default timezone, which is that of the virtual machine running the application... This appears to be a bug in the datadirect driver. I get a null pointer exception when I call statement.setDate(index,(java.sql.Date)parameter,null) (which the java docs say should work). The issue appears to be with the null. Passing in a new Calendar instance appears to get by the NPE, but this is not how I believe this method is intended to be used. Also, it is not clear to me how passing a new Calendar instance would behave on other drivers. I am not clear how to mark a bug as a third party issue in this issue tracker...
        Hide
        marina vatkina added a comment -

        Reassigning to Lance

        Show
        marina vatkina added a comment - Reassigning to Lance
        Hide
        lancea added a comment -

        The new 3623 build of the Sun/DD drivers fixes this issue and has been validated.

        Show
        lancea added a comment - The new 3623 build of the Sun/DD drivers fixes this issue and has been validated.
        Hide
        sherryshen added a comment -

        Verified the fix with Oracle datadirect driver 3623.jar and AS9.1pe_b39.

        Show
        sherryshen added a comment - Verified the fix with Oracle datadirect driver 3623.jar and AS9.1pe_b39.

          People

          • Assignee:
            lancea
            Reporter:
            sherryshen
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: