You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Michael Dick (JIRA)" <ji...@apache.org> on 2007/01/29 23:29:49 UTC

[jira] Created: (OPENJPA-116) EntityManager.getDelegate should throw an IllegalStateException

EntityManager.getDelegate should throw an IllegalStateException 
----------------------------------------------------------------

                 Key: OPENJPA-116
                 URL: https://issues.apache.org/jira/browse/OPENJPA-116
             Project: OpenJPA
          Issue Type: Bug
            Reporter: Michael Dick
            Priority: Minor


EntityManager.getDelegate() should throw an IllegalStateException if the EntityManager has been closed. 

I noticed then when debugging other problems. According to the javadoc http://java.sun.com/javaee/5/docs/api/javax/persistence/EntityManager.html#getDelegate() we need to throw an exception if the EM has been closed. 

In case I missed anything here's what I did to reproduce the problem. 


        EntityManagerFactory _emf = Persistence.createEntityManagerFactory("test");

        EntityManager em = _emf.createEntityManager();

        em.close();

        try {
            Object o = em.getDelegate();
            fail();
        }
        catch(IllegalStateException ise) {
            System.out.println("Caught expected exception");
        }



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (OPENJPA-116) EntityManager.getDelegate should throw an IllegalStateException

Posted by "Kevin Sutter (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-116?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kevin Sutter reassigned OPENJPA-116:
------------------------------------

    Assignee: Kevin Sutter

> EntityManager.getDelegate should throw an IllegalStateException 
> ----------------------------------------------------------------
>
>                 Key: OPENJPA-116
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-116
>             Project: OpenJPA
>          Issue Type: Bug
>            Reporter: Michael Dick
>         Assigned To: Kevin Sutter
>            Priority: Minor
>         Attachments: openjpa-116-patch.txt
>
>
> EntityManager.getDelegate() should throw an IllegalStateException if the EntityManager has been closed. 
> I noticed then when debugging other problems. According to the javadoc http://java.sun.com/javaee/5/docs/api/javax/persistence/EntityManager.html#getDelegate() we need to throw an exception if the EM has been closed. 
> In case I missed anything here's what I did to reproduce the problem. 
>         EntityManagerFactory _emf = Persistence.createEntityManagerFactory("test");
>         EntityManager em = _emf.createEntityManager();
>         em.close();
>         try {
>             Object o = em.getDelegate();
>             fail();
>         }
>         catch(IllegalStateException ise) {
>             System.out.println("Caught expected exception");
>         }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (OPENJPA-116) EntityManager.getDelegate should throw an IllegalStateException

Posted by "Kevin Sutter (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-116?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kevin Sutter resolved OPENJPA-116.
----------------------------------

    Resolution: Fixed

This issue was temporarily resolved with the patch that Mike provided.  Abe has since changed the processing in this area of the code and, thus, the actual call to assertOpen() has been replaced with the assertNotCloseInvoked() method, but the same result still happens.

> EntityManager.getDelegate should throw an IllegalStateException 
> ----------------------------------------------------------------
>
>                 Key: OPENJPA-116
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-116
>             Project: OpenJPA
>          Issue Type: Bug
>            Reporter: Michael Dick
>         Assigned To: Kevin Sutter
>            Priority: Minor
>         Attachments: openjpa-116-patch.txt
>
>
> EntityManager.getDelegate() should throw an IllegalStateException if the EntityManager has been closed. 
> I noticed then when debugging other problems. According to the javadoc http://java.sun.com/javaee/5/docs/api/javax/persistence/EntityManager.html#getDelegate() we need to throw an exception if the EM has been closed. 
> In case I missed anything here's what I did to reproduce the problem. 
>         EntityManagerFactory _emf = Persistence.createEntityManagerFactory("test");
>         EntityManager em = _emf.createEntityManager();
>         em.close();
>         try {
>             Object o = em.getDelegate();
>             fail();
>         }
>         catch(IllegalStateException ise) {
>             System.out.println("Caught expected exception");
>         }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-116) EntityManager.getDelegate should throw an IllegalStateException

Posted by "Michael Dick (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-116?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Dick updated OPENJPA-116:
---------------------------------

    Attachment: openjpa-116-patch.txt

> EntityManager.getDelegate should throw an IllegalStateException 
> ----------------------------------------------------------------
>
>                 Key: OPENJPA-116
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-116
>             Project: OpenJPA
>          Issue Type: Bug
>            Reporter: Michael Dick
>            Priority: Minor
>         Attachments: openjpa-116-patch.txt
>
>
> EntityManager.getDelegate() should throw an IllegalStateException if the EntityManager has been closed. 
> I noticed then when debugging other problems. According to the javadoc http://java.sun.com/javaee/5/docs/api/javax/persistence/EntityManager.html#getDelegate() we need to throw an exception if the EM has been closed. 
> In case I missed anything here's what I did to reproduce the problem. 
>         EntityManagerFactory _emf = Persistence.createEntityManagerFactory("test");
>         EntityManager em = _emf.createEntityManager();
>         em.close();
>         try {
>             Object o = em.getDelegate();
>             fail();
>         }
>         catch(IllegalStateException ise) {
>             System.out.println("Caught expected exception");
>         }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.