Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-186

Enterprise WebBeans throw incorrect Exception when method throws a RuntimeException

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Minor
    • 1.0.0.CR1
    • 1.0.0.PREVIEW1
    • None
    • None

    Description

      If you create an enterprise web bean with a logical error, i.e. attempting to play with the transaction from within a method or attempt to access a table that does not exist, you get a stack trace that only mentions:

      java.lang.IllegalArgumentException: enterpriseBeanInstance.setDestroyed() called with non-boolean argument

      This is incorrect, or at least undesirable, because there's no clear indication where the error actually lies.

      Examples of the poor programming:
      Referencing an entity bean that has @Table("some_non_existent_table")
      Starting a transaction:

      entityManager.getTransaction().begin();
      Query q = entityManager.createQuery("select i from Image i where i.skuAssociated = :sku").setParameter("sku", sku);
      List<Image> results = q.getResultList();
      entityManager.getTransaction().commit();
      return results;

      Essentially, anything that can cause a RuntimeException (or child of) to be thrown from within the methods of a Stateful EJB.

      To test:

      Create a standard EJB w/ a similar programming problem and see that it does not throw this exception.
      Create an enterprise web bean w/out this programming problem and see that it does not throw this exception.

      Attachments

        Activity

          People

            pmuiratbleepbleep Pete Muir (Inactive)
            meetoblivion_jira John Ament (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: