Enable Annotation processing for Tags even when pooling is disabled.
authorbillbarker <billbarker@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 4 May 2006 04:49:09 +0000 (04:49 +0000)
committerbillbarker <billbarker@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 4 May 2006 04:49:09 +0000 (04:49 +0000)
Of course, this will be horrible slow at least until Jasper looks for metadata-complete.

Also style fixes on the tagPoolHandler Vector.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@399545 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/jasper/compiler/Generator.java

index 5a8a377..0728488 100644 (file)
@@ -93,7 +93,7 @@ class Generator {
 \r
     private PageInfo pageInfo;\r
 \r
-    private Vector tagHandlerPoolNames;\r
+    private Vector<String> tagHandlerPoolNames;\r
 \r
     private GenBuffer charArrayBuffer;\r
 \r
@@ -385,7 +385,7 @@ class Generator {
         out.pushIndent();\r
         if (isPoolingEnabled) {\r
             for (int i = 0; i < tagHandlerPoolNames.size(); i++) {\r
-                out.printin((String) tagHandlerPoolNames.elementAt(i));\r
+                out.printin(tagHandlerPoolNames.elementAt(i));\r
                 out\r
                         .print(" = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(");\r
                 if (ctxt.isTagFile()) {\r
@@ -422,8 +422,20 @@ class Generator {
         \r
         if (isPoolingEnabled) {\r
             for (int i = 0; i < tagHandlerPoolNames.size(); i++) {\r
-                out.printin((String) tagHandlerPoolNames.elementAt(i));\r
-                out.println(".release();");\r
+                out.printin("Tag handler = ");\r
+                out.printin(tagHandlerPoolNames.elementAt(i));\r
+                out.println(";");\r
+                out.println("handler.release();");\r
+                out.println("try {");\r
+                out.pushIndent();\r
+                out.println("org.apache.jasper.runtime.AnnotationProcessor.preDestroy(handler);");\r
+                out.popIndent();\r
+                out.println("} catch (Exception e) {");\r
+                out.pushIndent();\r
+                out.println("log(\"Error processing preDestroy on tag instance of \" ");\r
+                out.println(" + handler.getClass().getName());");\r
+                out.popIndent();\r
+                out.println("}");\r
             }\r
         }\r
         \r
@@ -2143,6 +2155,9 @@ class Generator {
                 out.print("new ");\r
                 out.print(tagHandlerClassName);\r
                 out.println("();");\r
+                out.printin("org.apache.jasper.runtime.AnnotationProcessor.postConstruct(");\r
+                out.print(tagHandlerVar);\r
+                out.println(");");\r
             }\r
 \r
             // includes setting the context\r
@@ -2288,6 +2303,19 @@ class Generator {
                 } else {\r
                     out.printin(tagHandlerVar);\r
                     out.println(".release();");\r
+                    out.println("try {");\r
+                    out.pushIndent();\r
+                    out.printin("org.apache.jasper.runtime.AnnotationProcessor.preDestroy(");\r
+                    out.print(tagHandlerVar);\r
+                    out.println(");");\r
+                    out.popIndent();\r
+                    out.println("} catch (Exception e) {");\r
+                    out.pushIndent();\r
+                    out.println("log(\"Error processing preDestroy on tag instance of \" +");\r
+                    out.printin(tagHandlerVar);\r
+                    out.println(".getClass().getName());");\r
+                    out.popIndent();\r
+                    out.println("}");\r
                 }\r
             }\r
             if (isTagFile || isFragment) {\r
@@ -2330,6 +2358,17 @@ class Generator {
             } else {\r
                 out.printin(tagHandlerVar);\r
                 out.println(".release();");\r
+                out.println("try {");\r
+                out.pushIndent();\r
+                out.printin("org.apache.jasper.runtime.AnnotationProcessor.preDestroy(");\r
+                out.print(tagHandlerVar);\r
+                out.println(");");\r
+                out.println("} catch (Exception e) {");\r
+                out.println("log(\"Error processing preDestroy on tag instance of \" +");\r
+                out.printin(tagHandlerVar);\r
+                out.println(".getClass().getName());");\r
+                out.popIndent();\r
+                out.println("}");\r
             }\r
 \r
             if (n.implementsTryCatchFinally()) {\r