glassfish
  1. glassfish
  2. GLASSFISH-11850

NPE from deploy verifier with CMP1.1 app with invalid field type

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.1
    • Fix Version/s: 3.1
    • Component/s: verifier
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      11,850

      Description

      Following NPE occurs in verifier when deploying CMP1.1 app with invalid field type:

      Error Name :
      com.sun.enterprise.tools.verifier.tests.ejb.entity.cmp.CmpFieldsJavaTypesAssigned
      Error Description : java.lang.RuntimeException: java.lang.NullPointerException

      at com.sun.enterprise.tools.verifier.tests.ejb.EjbTest.check(EjbTest.java:94)

      The problem is in the following checks:

      if ((RmiIIOPUtils.isValidRmiIDLPrimitiveType(fc)) ||
      (descriptor.getRemoteClassName().equals(fc.getName())) ||
      (descriptor.getHomeClassName().equals(fc.getName())) ||
      (EjbUtils.isValidSerializableType(fc))||
      (descriptor.getLocalClassName().equals(fc.getName())) ||
      (descriptor.getLocalHomeClassName().equals(fc.getName()))) {

      CMP1.1 beans have no local interfaces so null.equals leads to NPE.

        Activity

        Hide
        Dies Koper added a comment -

        Created an attachment (id=4328)
        proposed patch (GFv3.x)

        Show
        Dies Koper added a comment - Created an attachment (id=4328) proposed patch (GFv3.x)
        Hide
        Dies Koper added a comment -

        After the patch, the verifier reports the correct failure message:

        Test Name : tests.ejb.entity.cmp.CmpFieldsJavaTypesAssigned
        Test Assertion : Java types assigned to the container-managed fields are
        restricted to the following: Java primitive types, Java serializable types, and
        references of enterprise beans' remote or home interfaces.
        Test Description : For [
        C:\glassfish\domains\domain1\applications\j2ee-modules\ejb1#ManCMP ]
        Error: Field [ test ] defined within entity bean class [ cmp11.ManBean ] was
        assigned an invalid type. Container-managed fields must be assigned in the
        entity bean class with Java types restricted to the following: Java primitive
        types, Java serializable types, and references of enterprise beans remote or
        home interfaces.

        Test Name : tests.ejb.entity.cmp.CmpFields
        Test Assertion : Container-managed field has valid type.
        Test Description : For [
        C:\glassfish\domains\domain1\applications\j2ee-modules\ejb1#ManCMP ]
        Error: Invalid type assigned to container-managed field [ test ] found in bean [
        cmp11.ManBean ].

        Show
        Dies Koper added a comment - After the patch, the verifier reports the correct failure message: Test Name : tests.ejb.entity.cmp.CmpFieldsJavaTypesAssigned Test Assertion : Java types assigned to the container-managed fields are restricted to the following: Java primitive types, Java serializable types, and references of enterprise beans' remote or home interfaces. Test Description : For [ C:\glassfish\domains\domain1\applications\j2ee-modules\ejb1#ManCMP ] Error: Field [ test ] defined within entity bean class [ cmp11.ManBean ] was assigned an invalid type. Container-managed fields must be assigned in the entity bean class with Java types restricted to the following: Java primitive types, Java serializable types, and references of enterprise beans remote or home interfaces. Test Name : tests.ejb.entity.cmp.CmpFields Test Assertion : Container-managed field has valid type. Test Description : For [ C:\glassfish\domains\domain1\applications\j2ee-modules\ejb1#ManCMP ] Error: Invalid type assigned to container-managed field [ test ] found in bean [ cmp11.ManBean ].
        Hide
        Dies Koper added a comment -

        Fixed in V3.1 trunk.

        Sending
        verifier\verifier-impl\src\main\java\com\sun\enterprise\tools\verifier\tests\ejb\entity\cmp\CmpFieldsJavaTypesAssigned.java
        Transmitting file data .
        Committed revision 36741.

        Show
        Dies Koper added a comment - Fixed in V3.1 trunk. Sending verifier\verifier-impl\src\main\java\com\sun\enterprise\tools\verifier\tests\ejb\entity\cmp\CmpFieldsJavaTypesAssigned.java Transmitting file data . Committed revision 36741.

          People

          • Assignee:
            Mitesh Meswani
            Reporter:
            Dies Koper
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: