Author: mnuttall
Date: Thu Apr 17 08:33:06 2014
New Revision: 1588161

URL: http://svn.apache.org/r1588161
Log:
Aries-1173: 'No persistence descriptors' message confuses more people than it 
helps

Modified:
    
aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/impl/PersistenceBundleHelper.java

Modified: 
aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/impl/PersistenceBundleHelper.java
URL: 
http://svn.apache.org/viewvc/aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/impl/PersistenceBundleHelper.java?rev=1588161&r1=1588160&r2=1588161&view=diff
==============================================================================
--- 
aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/impl/PersistenceBundleHelper.java
 (original)
+++ 
aries/trunk/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/impl/PersistenceBundleHelper.java
 Thu Apr 17 08:33:06 2014
@@ -131,7 +131,15 @@ public class PersistenceBundleHelper
       }     
     }
     
-    if (persistenceXmlFiles.isEmpty()) {
+    // Aries-1173: we always used to warn if persistenceXmlFiles.isEmpty(), 
but this caused many
+    // 'false positives' in which WABs with no persistence.xml by design 
generated warnings. 
+    // MN changing this so that the warning is only issued when the 
Meta-Persistence header is present: 
+    // i.e. there's good reason to believe that something is missing. 
Developers of WABs with no
+    // Meta-Persistence header, and missing persistence.xml files, will 
typically receive a resource
+    // injection failure at runtime with enough information to help identify 
the problem.
+    // (If logging is turned up to INFO, the 
wab.without.meta.persistence.header message issued 
+    // above should also be of help.)
+    if (persistenceXmlFiles.isEmpty() && metaPersistence != null) {
       _logger.warn(NLS.MESSAGES.getMessage("no.persistence.descriptor", 
bundleIdentity, locations.toString()));
     }
 


Reply via email to