openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p..@apache.org
Subject svn commit: r563705 - in /openjpa/trunk/openjpa-persistence/src/main: java/org/apache/openjpa/persistence/PersistenceProviderImpl.java resources/org/apache/openjpa/persistence/localizer.properties
Date Wed, 08 Aug 2007 00:05:41 GMT
Author: pcl
Date: Tue Aug  7 17:05:40 2007
New Revision: 563705

URL: http://svn.apache.org/viewvc?view=rev&rev=563705
Log:
Tolerate container failure better, now that we can handle non-enhanced types.

Modified:
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java
    openjpa/trunk/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/localizer.properties

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java?view=diff&rev=563705&r1=563704&r2=563705
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java
Tue Aug  7 17:05:40 2007
@@ -37,6 +37,7 @@
 import org.apache.openjpa.kernel.BrokerFactory;
 import org.apache.openjpa.lib.conf.ConfigurationProvider;
 import org.apache.openjpa.lib.conf.Configurations;
+import org.apache.openjpa.lib.util.Localizer;
 import org.apache.openjpa.meta.MetaDataModes;
 import org.apache.openjpa.meta.MetaDataRepository;
 import org.apache.openjpa.util.ClassResolver;
@@ -53,6 +54,9 @@
 
     static final String CLASS_TRANSFORMER_OPTIONS = "ClassTransformerOptions";
 
+    private static final Localizer _loc = Localizer.forPackage(
+        PersistenceProviderImpl.class);
+
     /**
      * Loads the entity manager specified by <code>name</code>, applying
      * the properties in <code>m</code> as overrides to the properties defined
@@ -91,10 +95,16 @@
                 return null;
 
             // add enhancer
+            Exception transformerException = null;
             String ctOpts = (String) Configurations.getProperty
                 (CLASS_TRANSFORMER_OPTIONS, pui.getProperties());
-            pui.addTransformer(new ClassTransformerImpl(cp, ctOpts, 
-                pui.getNewTempClassLoader()));
+            try {
+                pui.addTransformer(new ClassTransformerImpl(cp, ctOpts,
+                    pui.getNewTempClassLoader()));
+            } catch (Exception e) {
+                // fail gracefully
+                transformerException = e;
+            }
 
             // if the BrokerImpl hasn't been specified, switch to the
             // non-finalizing one, since anything claiming to be a container
@@ -107,6 +117,11 @@
 
             BrokerFactory factory = Bootstrap.newBrokerFactory(cp, 
                 pui.getClassLoader());
+            if (transformerException != null)
+                factory.getConfiguration().getLog(
+                    OpenJPAConfiguration.LOG_RUNTIME).warn(
+                        _loc.get("transformer-registration-error", pui),
+                        transformerException);
             return OpenJPAPersistence.toEntityManagerFactory(factory);
         } catch (Exception e) {
             throw PersistenceExceptions.toPersistenceException(e);

Modified: openjpa/trunk/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/localizer.properties
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/localizer.properties?view=diff&rev=563705&r1=563704&r2=563705
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/localizer.properties
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/localizer.properties
Tue Aug  7 17:05:40 2007
@@ -125,6 +125,9 @@
     searching for persistent properties. This method will be ignored. If you \
     intended for this to be persistent, please add a corresponding setter, \
     or switch to field access for this type hierarchy.
+transformer-registration-error: An error occurred while registering a \
+    ClassTransformer with {0}. The error is logged along with this warning. \
+    Load-time class transformation will not be available.
 
 EntityManagerFactory-name: EntityManagerFactory implementation
 EntityManagerFactory-desc: Allows extension of standard \



Mime
View raw message