Index: entity-persistence/src/java/oracle/toplink/essentials/ejb/cmp3/EntityManagerFactoryProvider.java =================================================================== RCS file: /cvs/glassfish/entity-persistence/src/java/oracle/toplink/essentials/ejb/cmp3/EntityManagerFactoryProvider.java,v retrieving revision 1.41 diff -c -w -r1.41 EntityManagerFactoryProvider.java *** entity-persistence/src/java/oracle/toplink/essentials/ejb/cmp3/EntityManagerFactoryProvider.java 20 Dec 2006 19:49:44 -0000 1.41 --- entity-persistence/src/java/oracle/toplink/essentials/ejb/cmp3/EntityManagerFactoryProvider.java 21 Dec 2006 18:23:54 -0000 *************** *** 118,126 **** } JavaSECMPInitializer initializer = JavaSECMPInitializer.getJavaSECMPInitializer(nonNullProperties); EntityManagerSetupImpl emSetupImpl = initializer.getEntityManagerSetupImpl(name); ! //gf bug 854 Throw an exception if EntityManagerSetupImpl for the name doesn't exist (e.g. a non-existant PU) if (emSetupImpl == null) { ! throw new PersistenceException(EntityManagerSetupException.puNotExist(name)); } // synchronized to prevent overriding of the class loader --- 118,126 ---- } JavaSECMPInitializer initializer = JavaSECMPInitializer.getJavaSECMPInitializer(nonNullProperties); EntityManagerSetupImpl emSetupImpl = initializer.getEntityManagerSetupImpl(name); ! //gf bug 854 Returns null if EntityManagerSetupImpl for the name doesn't exist (e.g. a non-existant PU) if (emSetupImpl == null) { ! return null; } // synchronized to prevent overriding of the class loader Index: entity-persistence-tests/src/java/oracle/toplink/essentials/testing/tests/cmp3/advanced/EntityManagerJUnitTestSuite.java =================================================================== RCS file: /cvs/glassfish/entity-persistence-tests/src/java/oracle/toplink/essentials/testing/tests/cmp3/advanced/EntityManagerJUnitTestSuite.java,v retrieving revision 1.40 diff -c -w -r1.40 EntityManagerJUnitTestSuite.java *** entity-persistence-tests/src/java/oracle/toplink/essentials/testing/tests/cmp3/advanced/EntityManagerJUnitTestSuite.java 20 Dec 2006 19:51:29 -0000 1.40 --- entity-persistence-tests/src/java/oracle/toplink/essentials/testing/tests/cmp3/advanced/EntityManagerJUnitTestSuite.java 21 Dec 2006 18:23:55 -0000 *************** *** 76,81 **** --- 76,82 ---- import oracle.toplink.essentials.threetier.ServerSession; import oracle.toplink.essentials.exceptions.ValidationException; import oracle.toplink.essentials.tools.schemaframework.OracleSequenceDefinition; + import oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider; public class EntityManagerJUnitTestSuite extends JUnitTestCase { *************** *** 2516,2526 **** public void testCreateEntityManagerFactory2() { EntityManagerFactory emf = null; try{ emf = Persistence.createEntityManagerFactory("default123"); } catch (Exception e) { ! assertTrue("The exception should be an EntityManagerSetupException", e instanceof PersistenceException); ! assertTrue("EntityManagerFactoryProvider.createEntityManagerFactory(String emName, Map properties) threw a wrong exception: " + e.getMessage(), ((EntityManagerSetupException)e.getCause()).getErrorCode() == EntityManagerSetupException.PU_NOT_EXIST); } finally{ if (emf != null) { emf.close(); --- 2517,2538 ---- public void testCreateEntityManagerFactory2() { EntityManagerFactory emf = null; + EntityManagerFactoryProvider provider = new EntityManagerFactoryProvider(); + + try { + emf = provider.createEntityManagerFactory("default123", null); + } catch (Exception e) { + fail("Exception is not expected, but thrown:" + e); + } + assertNull(emf); + try { emf = Persistence.createEntityManagerFactory("default123"); + fail("PersistenceException is expected"); + } catch (PersistenceException ex) { + // expected } catch (Exception e) { ! fail("PersistenceException is expected, but thrown:" + e); } finally{ if (emf != null) { emf.close();