[webbeans-commits] Webbeans SVN: r2386 - ri/trunk/impl/src/main/java/org/jboss/webbeans/xml.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Fri Apr 10 09:14:38 EDT 2009


Author: vitold
Date: 2009-04-10 09:14:38 -0400 (Fri, 10 Apr 2009)
New Revision: 2386

Modified:
   ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java
Log:
minor

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java	2009-04-10 12:08:49 UTC (rev 2385)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java	2009-04-10 13:14:38 UTC (rev 2386)
@@ -83,11 +83,22 @@
          
          if(child.getName().equalsIgnoreCase(XmlConstants.ARRAY))
          {
-            if(child.elements().size() != 1)
-               throw new DefinitionException("<Array> element must have only one child");
-            
-            Element arrayChild = (Element)child.elements().get(0);
-            ParseXmlHelper.loadElementClass(arrayChild, Object.class, environment, packagesMap);
+            boolean haveNotAnnotation = false;
+            Iterator<?> arrayIterator = child.elementIterator();
+            while(arrayIterator.hasNext())
+            {
+               Element arrayChild = (Element)arrayIterator.next();
+               AnnotatedClass<?> arrayChildType = ParseXmlHelper.loadElementClass(arrayChild, Object.class, environment, packagesMap); 
+               boolean isAnnotation = arrayChildType.getRawType().isAnnotation();
+               if(!isAnnotation)
+               {
+                  if(haveNotAnnotation)
+                     throw new DefinitionException("<Array> element have second child which is not annotation, it is '" + arrayChild.getName() + "'");
+                  haveNotAnnotation = true;
+               }
+            }
+            if(!haveNotAnnotation)
+               throw new DefinitionException("<Array> element must have one child elemen which is not annotation");
          }
          else
             checkChildrenForArray(child);




More information about the weld-commits mailing list