You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by jh...@apache.org on 2008/06/10 15:49:32 UTC

svn commit: r666109 - /struts/maven/trunk/struts-annotations/src/main/java/org/apache/struts/annotations/taglib/apt/TagAnnotationProcessor.java

Author: jholmes
Date: Tue Jun 10 06:49:31 2008
New Revision: 666109

URL: http://svn.apache.org/viewvc?rev=666109&view=rev
Log:
Update the generated taglib TLD file XML to conform to the XSD it is supposed to.

This fixes jira ticket WW-2674.

Modified:
    struts/maven/trunk/struts-annotations/src/main/java/org/apache/struts/annotations/taglib/apt/TagAnnotationProcessor.java

Modified: struts/maven/trunk/struts-annotations/src/main/java/org/apache/struts/annotations/taglib/apt/TagAnnotationProcessor.java
URL: http://svn.apache.org/viewvc/struts/maven/trunk/struts-annotations/src/main/java/org/apache/struts/annotations/taglib/apt/TagAnnotationProcessor.java?rev=666109&r1=666108&r2=666109&view=diff
==============================================================================
--- struts/maven/trunk/struts-annotations/src/main/java/org/apache/struts/annotations/taglib/apt/TagAnnotationProcessor.java (original)
+++ struts/maven/trunk/struts-annotations/src/main/java/org/apache/struts/annotations/taglib/apt/TagAnnotationProcessor.java Tue Jun 10 06:49:31 2008
@@ -118,7 +118,7 @@
             // add to map
             tags.put(typeName, tag);
         }
-        
+
         //find attributes to be skipped
         for (Declaration declaration : skipDeclarations) {
             //types will be ignored when hierarchy is scanned
@@ -221,12 +221,12 @@
             BeanInfo info = Introspector.getBeanInfo(clazz);
             PropertyDescriptor[] props = info.getPropertyDescriptors();
             List<String> skipAttributes = tag.getSkipAttributes();
-            
+
             //iterate over class fields
             for(int i = 0; i < props.length; ++i) {
                 PropertyDescriptor prop = props[i];
                 Method writeMethod = prop.getWriteMethod();
-               
+
                 //make sure it is public
                 if(writeMethod != null && Modifier.isPublic(writeMethod.getModifiers())) {
                     //can't use the genertic getAnnotation 'cause the class it not on this jar
@@ -246,7 +246,7 @@
             throw new RuntimeException(e);
         }
     }
-    
+
     private Annotation getAnnotation(String typeName, Annotation[] annotations) {
         for(int i = 0; i < annotations.length; i++) {
             if(annotations[i].annotationType().getName().equals(typeName))
@@ -325,6 +325,8 @@
 	    tagLib.setAttribute("version", getOption("jspVersion"));
             document.appendChild(tagLib);
             // tag lib attributes
+            appendTextNode(document, tagLib, "description",
+                    getOption("description"), true);
             appendTextNode(document, tagLib, "tlib-version",
                     getOption("tlibVersion"), false);
             appendTextNode(document, tagLib, "short-name",
@@ -332,8 +334,6 @@
             appendTextNode(document, tagLib, "uri", getOption("uri"), false);
             appendTextNode(document, tagLib, "display-name",
                     getOption("displayName"), false);
-            appendTextNode(document, tagLib, "description",
-                    getOption("description"), true);
 
             // create tags
             for (Map.Entry<String, Tag> entry : tags.entrySet()) {
@@ -383,13 +383,13 @@
     private void createElement(Document doc, Element tagLibElement, Tag tag) {
         Element tagElement = doc.createElement("tag");
         tagLibElement.appendChild(tagElement);
+        appendTextNode(doc, tagElement, "description", tag.getDescription(),
+                true);
         appendTextNode(doc, tagElement, "name", tag.getName(), false);
         appendTextNode(doc, tagElement, "tag-class", tag.getTldTagClass(),
                 false);
         appendTextNode(doc, tagElement, "body-content",
                 tag.getTldBodyContent(), false);
-        appendTextNode(doc, tagElement, "description", tag.getDescription(),
-                true);
 
         // save attributes
         for (TagAttribute attribute : tag.getAttributes()) {
@@ -403,14 +403,14 @@
             TagAttribute attribute) {
         Element attributeElement = doc.createElement("attribute");
         tagElement.appendChild(attributeElement);
+        appendTextNode(doc, attributeElement, "description", attribute
+                .getDescription(), true);
         appendTextNode(doc, attributeElement, "name", attribute.getName(),
                 false);
         appendTextNode(doc, attributeElement, "required", String
                 .valueOf(attribute.isRequired()), false);
         appendTextNode(doc, attributeElement, "rtexprvalue", String
                 .valueOf(attribute.isRtexprvalue()), false);
-        appendTextNode(doc, attributeElement, "description", attribute
-                .getDescription(), true);
     }
 
     private void appendTextNode(Document doc, Element element, String name,