openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1209808 - in /openwebbeans/trunk/webbeans-impl/src/main: java/org/apache/webbeans/corespi/scanner/AbstractMetaDataDiscovery.java resources/openwebbeans/Messages.properties
Date Sat, 03 Dec 2011 00:50:29 GMT
Author: struberg
Date: Sat Dec  3 00:50:28 2011
New Revision: 1209808

URL: http://svn.apache.org/viewvc?rev=1209808&view=rev
Log:
OWB-629 catch away NoClassDefFound errors

This is needed to treat optional beans until
they are defined in the spec. 

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/AbstractMetaDataDiscovery.java
    openwebbeans/trunk/webbeans-impl/src/main/resources/openwebbeans/Messages.properties

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/AbstractMetaDataDiscovery.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/AbstractMetaDataDiscovery.java?rev=1209808&r1=1209807&r2=1209808&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/AbstractMetaDataDiscovery.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/AbstractMetaDataDiscovery.java
Sat Dec  3 00:50:28 2011
@@ -206,7 +206,26 @@ public abstract class AbstractMetaDataDi
             {
                 for(String str : strSet)
                 {
-                    classSet.add(ClassUtil.getClassFromName(str));   
+                    try
+                    {
+                        Class<?> clazz = ClassUtil.getClassFromName(str);
+                        if (clazz != null)
+                        {
+                            
+                            // try to provoke a NoClassDefFoundError exception which is thrown

+                            // if some dependencies of the class are missing
+                            clazz.getDeclaredFields();
+                            clazz.getDeclaredMethods();
+                            
+                            // we can add this class cause it has been loaded completely
+                            classSet.add(clazz);
+                            
+                        }
+                    }
+                    catch (NoClassDefFoundError e)
+                    {
+                        logger.warn("WARN_0018", str, e.toString());
+                    }
                 }
             }   
         }    

Modified: openwebbeans/trunk/webbeans-impl/src/main/resources/openwebbeans/Messages.properties
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/resources/openwebbeans/Messages.properties?rev=1209808&r1=1209807&r2=1209808&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/resources/openwebbeans/Messages.properties (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/resources/openwebbeans/Messages.properties Sat
Dec  3 00:50:28 2011
@@ -56,6 +56,7 @@ WARN_0014 = Could not find [{0}] with na
 WARN_0015 = Trying to serialize non-passivation capable bean proxy \: [{0}]
 WARN_0016 = Stereotypes can not annotated with @Typed but stereotype \: [{0}] has annotated,
non-portable behaviour results.
 WARN_0017 = Stereotypes can not define qualifier other than @Named but stereotype \: [{0}]
has defined [{1}] , non-portable behaviour results.  
+WARN_0018 = Ignoring class [{0}] because it could not be loaded: {1} 
 
 
 #error messages:



Mime
View raw message