OPENJPA-1076 cleanup code formatting and add some comments about the current behavior of returning exceptions instead of null

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@798616 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Donald Woods 2009-07-28 17:42:47 +00:00
parent a31b0ee95d
commit b7b0b15777
2 changed files with 12 additions and 5 deletions

View File

@ -805,8 +805,8 @@
<!-- TestPMMemory creates heapdumps etc and there's no real asserts within the test. -->
<exclude>org/apache/openjpa/persistence/kernel/TestPMMemory.java</exclude>
<!-- You can exclude the lockmgr test to save ~15 mins.
<exclude>org/apache/openjpa/persistence/lockmgr/*.java</exclude>
-->
<exclude>org/apache/openjpa/persistence/lockmgr/*.java</exclude>
<!-- ================================================================== -->
<!-- Critera & MetaModel tests are *temporarily* excluded to wait for -->
<!-- spec to stabilize on Result Processing API -->

View File

@ -88,24 +88,31 @@ public class PersistenceProviderImpl
try {
Object poolValue = Configurations.removeProperty(EMF_POOL, m);
ConfigurationProvider cp = pd.load(resource, name, m);
if (cp == null)
if (cp == null) {
return null;
}
BrokerFactory factory = getBrokerFactory(cp, poolValue, null);
OpenJPAConfiguration conf = factory.getConfiguration();
_log = conf.getLog(OpenJPAConfiguration.LOG_RUNTIME);
if(pd.checkPuNameCollisions(_log,name)==true){
if(pd.checkPuNameCollisions(_log,name)==true) {
;//return null;
}
loadAgent(_log, conf);
// TODO - Can this be moved back to BrokerImpl.initialize()?
// Create appropriate LifecycleEventManager
loadValidator(_log, conf);
return JPAFacadeHelper.toEntityManagerFactory(factory);
} catch (Exception e) {
_log.error(_loc.get("create-emf-error", name), e);
throw PersistenceExceptions.toPersistenceException(e);
//return null;
/*
* Maintain 1.x behavior of throwing exceptions, even though
* JPA2 9.2 - createEMF "must" return null for PU it can't handle
*/
throw PersistenceExceptions.toPersistenceException(e);
}
}