You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xbean-scm@geronimo.apache.org by db...@apache.org on 2011/03/27 08:05:03 UTC

svn commit: r1085880 - /geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/AnnotationFinder.java

Author: dblevins
Date: Sun Mar 27 06:05:03 2011
New Revision: 1085880

URL: http://svn.apache.org/viewvc?rev=1085880&view=rev
Log:
Tweaking error handling

Modified:
    geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/AnnotationFinder.java

Modified: geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/AnnotationFinder.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/AnnotationFinder.java?rev=1085880&r1=1085879&r2=1085880&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/AnnotationFinder.java (original)
+++ geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/AnnotationFinder.java Sun Mar 27 06:05:03 2011
@@ -97,7 +97,7 @@ public class AnnotationFinder implements
      * @return
      * @throws java.io.IOException
      */
-    public AnnotationFinder link() throws IOException, ClassNotFoundException {
+    public AnnotationFinder link() {
         for (ClassInfo classInfo : classInfos.values().toArray(new ClassInfo[classInfos.size()])) {
 
             linkParent(classInfo);
@@ -126,7 +126,7 @@ public class AnnotationFinder implements
      * @throws ClassNotFoundException
      * @throws IOException
      */
-    private void resolveAnnotations(List<String> scanned) throws ClassNotFoundException, IOException {
+    private void resolveAnnotations(List<String> scanned) {
 
         // Get a list of the annotations that exist before we start
         List<String> annotations = new ArrayList<String>(annotated.keySet());
@@ -138,18 +138,18 @@ public class AnnotationFinder implements
 
         for (ClassInfo classInfo : classInfos.values()) {
             if (isMetaRoot(classInfo)) {
-                metaroots.add((Class<? extends Annotation>) classInfo.get());
+                try {
+                    metaroots.add((Class<? extends Annotation>) classInfo.get());
+                } catch (ClassNotFoundException e) {
+                    classesNotLoaded.add(classInfo.getName());
+                }
             }
         }
 
         for (Class<? extends Annotation> metaroot : metaroots) {
             List<Info> infoList = annotated.get(metaroot.getName());
             for (Info info : infoList) {
-                try {
-                    readClassDef(info.getName() + "$$");
-                } catch (ClassNotFoundException e) {
-                    // we don't care, this is only a convenience
-                }
+                readClassDef(info.getName() + "$$");
             }
         }
 
@@ -172,7 +172,7 @@ public class AnnotationFinder implements
         return true;
     }
 
-    private void linkParent(ClassInfo classInfo) throws IOException, ClassNotFoundException {
+    private void linkParent(ClassInfo classInfo) {
         if (classInfo.superType == null) return;
         if (classInfo.superType.equals("java.lang.Object")) return;
 
@@ -205,7 +205,7 @@ public class AnnotationFinder implements
         }
     }
 
-    private void linkInterfaces(ClassInfo classInfo) throws IOException, ClassNotFoundException {
+    private void linkInterfaces(ClassInfo classInfo) {
         final List<ClassInfo> infos = new ArrayList<ClassInfo>();
 
         if (classInfo.clazz != null) {
@@ -772,9 +772,14 @@ public class AnnotationFinder implements
         return infos;
     }
 
-    protected void readClassDef(String className) throws ClassNotFoundException, IOException {
+    protected void readClassDef(String className) {
         if (classInfos.containsKey(className)) return;
-        readClassDef(archive.getBytecode(className));
+        try {
+            readClassDef(archive.getBytecode(className));
+        } catch (Exception e) {
+            if (className.endsWith("$$")) return;
+            classesNotLoaded.add(className);
+        }
     }
 
     protected void readClassDef(InputStream in) throws IOException {