Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
git-svn-id: http://anonsvn.jboss.org/repos/weld/ri/trunk@2386 1c488680-804c-0410-94cd-c6b725194a0e
  • Loading branch information
Victor Yarmolovich committed Apr 10, 2009
1 parent f0f493d commit 39c7384
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java
Expand Up @@ -83,11 +83,22 @@ private void checkChildrenForArray(Element element)

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);
Expand Down

0 comments on commit 39c7384

Please sign in to comment.