openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwsut...@apache.org
Subject svn commit: r580087 - in /openjpa: branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ branches/1.0.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/ trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ trunk...
Date Thu, 27 Sep 2007 16:36:51 GMT
Author: kwsutter
Date: Thu Sep 27 09:36:48 2007
New Revision: 580087

URL: http://svn.apache.org/viewvc?rev=580087&view=rev
Log:
OPENJPA-385.  Committing changes for both 1.0.x and 1.1.0 to properly skip and optionally
log malformed .class files.

Modified:
    openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ClassAnnotationMetaDataFilter.java
    openjpa/branches/1.0.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataFactory.java
    openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ClassAnnotationMetaDataFilter.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataFactory.java

Modified: openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ClassAnnotationMetaDataFilter.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ClassAnnotationMetaDataFilter.java?rev=580087&r1=580086&r2=580087&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ClassAnnotationMetaDataFilter.java
(original)
+++ openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ClassAnnotationMetaDataFilter.java
Thu Sep 27 09:36:48 2007
@@ -20,6 +20,9 @@
 
 import java.io.IOException;
 
+import org.apache.openjpa.lib.log.Log;
+import org.apache.openjpa.lib.util.Localizer;
+
 import serp.bytecode.lowlevel.ConstantPoolTable;
 
 /**
@@ -33,6 +36,10 @@
 public class ClassAnnotationMetaDataFilter implements MetaDataFilter {
 
     private final String[] _annos;
+    
+    private static final Localizer _loc = Localizer.forPackage
+        (ClassAnnotationMetaDataFilter.class);
+    private Log _log = null;
 
     /**
      * Constructor; supply annotation to match against.
@@ -86,9 +93,16 @@
                 idx += 4 + table.readInt(idx);
             }
         } catch (ArrayIndexOutOfBoundsException e) {
+            /*
+             * This ArrayIndexOutOfBoundsException indicates an incorrectly
+             * formed .class file. We will eat the exception, log a trace
+             * message (if a log exists), and return "false" to indicate there
+             * was no match.
+             */
             Error cfe = new ClassFormatError(rsrc.getName());
             cfe.initCause(e);
-            throw cfe;
+            if (_log != null && _log.isTraceEnabled())
+                _log.trace(_loc.get("class-arg", rsrc.getName()), cfe);
         }
         return false;
     }
@@ -183,5 +197,13 @@
             skipped += 6 + len;
         }
         return skipped;
+    }
+
+    public Log getLog() {
+        return _log;
+    }
+
+    public void setLog(Log _log) {
+        this._log = _log;
     }
 }

Modified: openjpa/branches/1.0.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataFactory.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataFactory.java?rev=580087&r1=580086&r2=580087&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataFactory.java
(original)
+++ openjpa/branches/1.0.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataFactory.java
Thu Sep 27 09:36:48 2007
@@ -374,8 +374,11 @@
 
     @Override
     protected MetaDataFilter newMetaDataFilter() {
-        return new ClassAnnotationMetaDataFilter(new Class[]{
-            Entity.class, Embeddable.class, MappedSuperclass.class });
+        ClassAnnotationMetaDataFilter camdf = new ClassAnnotationMetaDataFilter(
+                new Class[] { Entity.class, Embeddable.class,
+                        MappedSuperclass.class });
+        camdf.setLog(log);
+        return camdf;
     }
 
     /**

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ClassAnnotationMetaDataFilter.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ClassAnnotationMetaDataFilter.java?rev=580087&r1=580086&r2=580087&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ClassAnnotationMetaDataFilter.java
(original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/ClassAnnotationMetaDataFilter.java
Thu Sep 27 09:36:48 2007
@@ -20,6 +20,9 @@
 
 import java.io.IOException;
 
+import org.apache.openjpa.lib.log.Log;
+import org.apache.openjpa.lib.util.Localizer;
+
 import serp.bytecode.lowlevel.ConstantPoolTable;
 
 /**
@@ -33,6 +36,10 @@
 public class ClassAnnotationMetaDataFilter implements MetaDataFilter {
 
     private final String[] _annos;
+    
+    private static final Localizer _loc = Localizer.forPackage
+        (ClassAnnotationMetaDataFilter.class);
+    private Log _log = null;
 
     /**
      * Constructor; supply annotation to match against.
@@ -86,9 +93,16 @@
                 idx += 4 + table.readInt(idx);
             }
         } catch (ArrayIndexOutOfBoundsException e) {
+            /*
+             * This ArrayIndexOutOfBoundsException indicates an incorrectly
+             * formed .class file. We will eat the exception, log a trace
+             * message (if a log exists), and return "false" to indicate there
+             * was no match.
+             */
             Error cfe = new ClassFormatError(rsrc.getName());
             cfe.initCause(e);
-            throw cfe;
+            if (_log != null && _log.isTraceEnabled())
+                _log.trace(_loc.get("class-arg", rsrc.getName()), cfe);
         }
         return false;
     }
@@ -183,5 +197,13 @@
             skipped += 6 + len;
         }
         return skipped;
+    }
+
+    public Log getLog() {
+        return _log;
+    }
+
+    public void setLog(Log _log) {
+        this._log = _log;
     }
 }

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataFactory.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataFactory.java?rev=580087&r1=580086&r2=580087&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataFactory.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceMetaDataFactory.java
Thu Sep 27 09:36:48 2007
@@ -374,8 +374,11 @@
 
     @Override
     protected MetaDataFilter newMetaDataFilter() {
-        return new ClassAnnotationMetaDataFilter(new Class[]{
-            Entity.class, Embeddable.class, MappedSuperclass.class });
+        ClassAnnotationMetaDataFilter camdf = new ClassAnnotationMetaDataFilter(
+                new Class[] { Entity.class, Embeddable.class,
+                        MappedSuperclass.class });
+        camdf.setLog(log);
+        return camdf;
     }
 
     /**



Mime
View raw message