svn commit: r819444 [18/27] - in /struts/struts2/trunk/plugins/embeddedjsp: ./ src/main/java/org/apache/struts2/el/ src/main/java/org/apache/struts2/el/lang/ src/main/java/org/apache/struts2/el/parser
Added: struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/TldLocationsCache.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/TldLocationsCache.java?rev=819444&view=auto == --- struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/TldLocationsCache.java (added) +++ struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/TldLocationsCache.java Mon Sep 28 01:55:26 2009 @@ -0,0 +1,565 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.struts2.jasper.compiler; + +import java.io.InputStream; +import java.io.File; +import java.net.JarURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLClassLoader; +import java.net.URLConnection; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; +import java.util.StringTokenizer; +import java.util.jar.JarEntry; +import java.util.jar.JarFile; +import org.xml.sax.InputSource; + +import javax.servlet.ServletContext; + +import org.apache.struts2.jasper.Constants; +import org.apache.struts2.jasper.JasperException; +import org.apache.struts2.jasper.xmlparser.ParserUtils; +import org.apache.struts2.jasper.xmlparser.TreeNode; +import org.apache.juli.logging.Log; +import org.apache.juli.logging.LogFactory; +import org.apache.commons.io.FileUtils; + +/** + * A container for all tag libraries that are defined "globally" + * for the web application. + * + * Tag Libraries can be defined globally in one of two ways: + * 1. Via elements in web.xml: + * the uri and location of the tag-library are specified in + * the element. + * 2. Via packaged jar files that contain .tld files + * within the META-INF directory, or some subdirectory + * of it. The taglib is 'global' if it has the + * element defined. + * + * A mapping between the taglib URI and its associated TaglibraryInfoImpl + * is maintained in this container. + * Actually, that's what we'd like to do. However, because of the + * way the classes TagLibraryInfo and TagInfo have been defined, + * it is not currently possible to share an instance of TagLibraryInfo + * across page invocations. A bug has been submitted to the spec lead. + * In the mean time, all we do is save the 'location' where the + * TLD associated with a taglib URI can be found. + * + * When a JSP page has a taglib directive, the mappings in this container + * are first searched (see method getLocation()). + * If a mapping is found, then the location of the TLD is returned. + * If no mapping is found, then the uri specified + * in the taglib directive is to be interpreted as the location for + * the TLD of this tag library. + * + * @author Pierre Delisle + * @author Jan Luehe + */ + +public class TldLocationsCache { + +// Logger +private Log log = LogFactory.getLog(TldLocationsCache.class); + +/** + * The types of URI one may specify for a tag library + */ +public static final int ABS_URI = 0; +public static final int ROOT_REL_URI = 1; +public static final int NOROOT_REL_URI = 2; + +private static final String WEB_XML = "/WEB-INF/web.xml"; +private static final String FILE_PROTOCOL = "file:"; +private static final String JAR_FILE_SUFFIX = ".jar"; + +// Names of JARs that are known not to contain any TLDs +private static HashSet noTldJars; + +/** + * The mapping of the 'global' tag library URI to the location (resource + * path) of the TLD associated with that tag library. The location is + * returned as a String array: + *[0] The location + *[1] If the location is a jar file, this is the location of the tld. + */ +private Hashtable mappings; + +private boolean initialized; +private ServletContext ctxt; +private boolean redeployMode; + +//* +// Constructor and Initilizations + +/* +
[OSS Bamboo] Struts 2 SVN - Main Build (Java 6) build 984 has FAILED (2 tests failed). Change made by Musachy Barroso
--- STRUTS-MAINJ6-984 failed. --- Code has been updated by Musachy Barroso. 2/1125 tests failed. http://opensource.bamboo.atlassian.com/browse/STRUTS-MAINJ6-984/ -- Code Changes -- Musachy Barroso (819444): >Update to Jasper 6.0.20 -- Tests -- Failed Tests (2) - EmbeddedJSPResultTest: Embedded (New) - EmbeddedJSPResultTest: Embedded absolute path (New) -- Error Summary -- [INFO] [ERROR] BUILD FAILURE [INFO] [INFO] There are test failures. [INFO] [INFO] For more information, run Maven with the -e switch -- This message is automatically generated by Atlassian Bamboo
[OSS Bamboo] Struts 2 SVN - Main Build build 1232 has FAILED (2 tests failed). Change made by Musachy Barroso
--- STRUTS-MAIN-1232 failed. --- Code has been updated by Musachy Barroso. 2/1125 tests failed. http://opensource.bamboo.atlassian.com/browse/STRUTS-MAIN-1232/ -- Code Changes -- Musachy Barroso (819444): >Update to Jasper 6.0.20 -- Tests -- Failed Tests (2) - EmbeddedJSPResultTest: Embedded (New) - EmbeddedJSPResultTest: Embedded absolute path (New) -- Error Summary -- [INFO] [ERROR] BUILD FAILURE [INFO] [INFO] There are test failures. [INFO] [INFO] For more information, run Maven with the -e switch -- This message is automatically generated by Atlassian Bamboo
svn commit: r819369 - in /struts/struts2/trunk/plugins/embeddedjsp: pom.xml src/main/java/org/apache/struts2/jasper/JspC.java src/main/java/org/apache/struts2/jasper/runtime/HttpJspBase.java
Author: musachy Date: Sun Sep 27 18:41:02 2009 New Revision: 819369 URL: http://svn.apache.org/viewvc?rev=819369&view=rev Log: Remove references to commons-logging Modified: struts/struts2/trunk/plugins/embeddedjsp/pom.xml struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/JspC.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/runtime/HttpJspBase.java Modified: struts/struts2/trunk/plugins/embeddedjsp/pom.xml URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/embeddedjsp/pom.xml?rev=819369&r1=819368&r2=819369&view=diff == --- struts/struts2/trunk/plugins/embeddedjsp/pom.xml (original) +++ struts/struts2/trunk/plugins/embeddedjsp/pom.xml Sun Sep 27 18:41:02 2009 @@ -21,7 +21,8 @@ * under the License. */ --> -http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd";> +http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd";> 4.0.0 org.apache.struts @@ -33,13 +34,14 @@ struts2-embeddedjsp-plugin jar Struts 2 Embedded JSP Plugin - + scm:svn:http://svn.apache.org/repos/asf/struts/struts2/trunk/plugins/embeddedjsp/ - scm:svn:https://svn.apache.org/repos/asf/struts/struts2/trunk/plugins/embeddedjsp/ + scm:svn:https://svn.apache.org/repos/asf/struts/struts2/trunk/plugins/embeddedjsp/ + http://svn.apache.org/viewcvs.cgi/struts/struts2/trunk/plugins/embeddedjsp/ - + junit @@ -52,12 +54,6 @@ spring-test 2.5.6 test - - -commons-logging -commons-logging - - org.springframework @@ -82,7 +78,7 @@ request 1.0.1 test - + javax.servlet jsp-api @@ -100,6 +96,12 @@ commons-el 1.0 provided + + +commons-logging +commons-logging + + taglibs Modified: struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/JspC.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/JspC.java?rev=819369&r1=819368&r2=819369&view=diff == --- struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/JspC.java (original) +++ struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/JspC.java Sun Sep 27 18:41:02 2009 @@ -20,7 +20,6 @@ import com.opensymphony.xwork2.util.finder.ClassLoaderInterface; import com.opensymphony.xwork2.util.logging.Logger; import com.opensymphony.xwork2.util.logging.LoggerFactory; -import org.apache.commons.logging.LogFactory; import org.apache.struts2.jasper.compiler.Compiler; import org.apache.struts2.jasper.compiler.*; import org.apache.struts2.jasper.servlet.JspCServletContext; @@ -927,10 +926,6 @@ rootCause.printStackTrace(); } throw je; -} finally { -if (loader != null) { -LogFactory.release(loader); -} } } Modified: struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/runtime/HttpJspBase.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/runtime/HttpJspBase.java?rev=819369&r1=819368&r2=819369&view=diff == --- struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/runtime/HttpJspBase.java (original) +++ struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/runtime/HttpJspBase.java Sun Sep 27 18:41:02 2009 @@ -28,6 +28,8 @@ import javax.servlet.jsp.JspFactory; import java.io.IOException; +import com.opensymphony.xwork2.util.logging.LoggerFactory; + /** * This is the super class of all JSP-generated servlets. * @@ -59,7 +61,7 @@ factory.getClass().getClassLoader().loadClass(basePackage + "servlet.JspServletWrapper"); } catch (ClassNotFoundException ex) { - org.apache.commons.logging.LogFactory.getLog(HttpJspBase.class) +LoggerFactory.getLogger(HttpJspBase.class
[OSS Bamboo] Struts 2 SVN - Main Build (Java 6) build 980 has FAILED (2 tests failed, no failures were new). Change made by Musachy Barroso
--- STRUTS-MAINJ6-980 failed. --- Code has been updated by Musachy Barroso. 2/1125 tests failed. http://opensource.bamboo.atlassian.com/browse/STRUTS-MAINJ6-980/ -- Code Changes -- Musachy Barroso (819369): >Remove references to commons-logging -- Tests -- Failed Tests (2) - EmbeddedJSPResultTest: Embedded (Existing) - EmbeddedJSPResultTest: Embedded absolute path (Existing) -- Error Summary -- [INFO] [ERROR] BUILD FAILURE [INFO] [INFO] There are test failures. [INFO] [INFO] For more information, run Maven with the -e switch -- This message is automatically generated by Atlassian Bamboo
[OSS Bamboo] Struts 2 SVN - Main Build build 1228 has FAILED (2 tests failed, no failures were new). Change made by Musachy Barroso
--- STRUTS-MAIN-1228 failed. --- Code has been updated by Musachy Barroso. 2/1125 tests failed. http://opensource.bamboo.atlassian.com/browse/STRUTS-MAIN-1228/ -- Code Changes -- Musachy Barroso (819369): >Remove references to commons-logging -- Tests -- Failed Tests (2) - EmbeddedJSPResultTest: Embedded (Existing) - EmbeddedJSPResultTest: Embedded absolute path (Existing) -- Error Summary -- [INFO] [ERROR] BUILD FAILURE [INFO] [INFO] There are test failures. [INFO] [INFO] For more information, run Maven with the -e switch -- This message is automatically generated by Atlassian Bamboo
svn commit: r819433 - /struts/struts2/trunk/plugins/embeddedjsp/pom.xml
Author: musachy Date: Mon Sep 28 00:40:39 2009 New Revision: 819433 URL: http://svn.apache.org/viewvc?rev=819433&view=rev Log: add commons-el dep and remove jsp-api dep Modified: struts/struts2/trunk/plugins/embeddedjsp/pom.xml Modified: struts/struts2/trunk/plugins/embeddedjsp/pom.xml URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/embeddedjsp/pom.xml?rev=819433&r1=819432&r2=819433&view=diff == --- struts/struts2/trunk/plugins/embeddedjsp/pom.xml (original) +++ struts/struts2/trunk/plugins/embeddedjsp/pom.xml Mon Sep 28 00:40:39 2009 @@ -81,12 +81,6 @@ javax.servlet -jsp-api -2.0 -provided - - -javax.servlet servlet-api 2.4 provided @@ -95,13 +89,6 @@ commons-el commons-el 1.0 -provided - - -commons-logging -commons-logging - - taglibs
svn commit: r819434 - /struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/
Author: musachy Date: Mon Sep 28 00:41:18 2009 New Revision: 819434 URL: http://svn.apache.org/viewvc?rev=819434&view=rev Log: removing jasper 5 Removed: struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/
svn commit: r819435 [4/23] - in /struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper: ./ compiler/ compiler/tagplugin/ el/ runtime/ security/ servlet/ tagplugins/ tagplugi
Added: struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/ErrorDispatcher.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/ErrorDispatcher.java?rev=819435&view=auto == --- struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/ErrorDispatcher.java (added) +++ struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/ErrorDispatcher.java Mon Sep 28 00:43:34 2009 @@ -0,0 +1,615 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jasper.compiler; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.StringReader; +import java.net.MalformedURLException; +import java.util.ArrayList; + +import org.apache.jasper.JasperException; +import org.apache.jasper.JspCompilationContext; +import org.xml.sax.SAXException; + +/** + * Class responsible for dispatching JSP parse and javac compilation errors + * to the configured error handler. + * + * This class is also responsible for localizing any error codes before they + * are passed on to the configured error handler. + * + * In the case of a Java compilation error, the compiler error message is + * parsed into an array of JavacErrorDetail instances, which is passed on to + * the configured error handler. + * + * @author Jan Luehe + * @author Kin-man Chung + */ +public class ErrorDispatcher { + +// Custom error handler +private ErrorHandler errHandler; + +// Indicates whether the compilation was initiated by JspServlet or JspC +private boolean jspcMode = false; + + +/* + * Constructor. + * + * @param jspcMode true if compilation has been initiated by JspC, false + * otherwise + */ +public ErrorDispatcher(boolean jspcMode) { + // XXX check web.xml for custom error handler + errHandler = new DefaultErrorHandler(); +this.jspcMode = jspcMode; +} + +/* + * Dispatches the given JSP parse error to the configured error handler. + * + * The given error code is localized. If it is not found in the + * resource bundle for localized error messages, it is used as the error + * message. + * + * @param errCode Error code + */ +public void jspError(String errCode) throws JasperException { + dispatch(null, errCode, null, null); +} + +/* + * Dispatches the given JSP parse error to the configured error handler. + * + * The given error code is localized. If it is not found in the + * resource bundle for localized error messages, it is used as the error + * message. + * + * @param where Error location + * @param errCode Error code + */ +public void jspError(Mark where, String errCode) throws JasperException { + dispatch(where, errCode, null, null); +} + +/* + * Dispatches the given JSP parse error to the configured error handler. + * + * The given error code is localized. If it is not found in the + * resource bundle for localized error messages, it is used as the error + * message. + * + * @param n Node that caused the error + * @param errCode Error code + */ +public void jspError(Node n, String errCode) throws JasperException { + dispatch(n.getStart(), errCode, null, null); +} + +/* + * Dispatches the given JSP parse error to the configured error handler. + * + * The given error code is localized. If it is not found in the + * resource bundle for localized error messages, it is used as the error + * message. + * + * @param errCode Error code + * @param arg Argument for parametric replacement + */ +public void jspError(String errCode, String arg) throws JasperException { + dispatch(null, errCode, new Object[] {arg}, null); +} + +/* + * Dispatches the given JSP parse error to the configured error handler. + * + * The given error code is localized. If it is not found in the + * resource bundle for localized error messages, it is used
svn commit: r819435 [1/23] - in /struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper: ./ compiler/ compiler/tagplugin/ el/ runtime/ security/ servlet/ tagplugins/ tagplugi
Author: musachy Date: Mon Sep 28 00:43:34 2009 New Revision: 819435 URL: http://svn.apache.org/viewvc?rev=819435&view=rev Log: importing jasper 6.0.20, this code will not compile Added: struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/ struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/Constants.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/EmbeddedServletOptions.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/JasperException.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/JspC.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/JspCompilationContext.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/Options.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/ struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/AntCompiler.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/BeanRepository.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/Collector.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/Compiler.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/DefaultErrorHandler.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/Dumper.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/ELFunctionMapper.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/ELNode.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/ELParser.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/ErrorDispatcher.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/ErrorHandler.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/Generator.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/ImplicitTagLibraryInfo.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/JDTCompiler.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/JasperTagInfo.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/JavacErrorDetail.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/JspConfig.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/JspDocumentParser.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/JspReader.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/JspRuntimeContext.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/JspUtil.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/Localizer.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/Mark.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/Node.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/PageDataImpl.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/PageInfo.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/Parser.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/ParserController.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/ScriptingVariabler.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/ServletWriter.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/SmapGenerator.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/SmapStratum.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/SmapUtil.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/TagConstants.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/TagFileProcessor.java struts/struts2/trunk/plugins/embeddedjsp/src/main/java
svn commit: r819435 [8/23] - in /struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper: ./ compiler/ compiler/tagplugin/ el/ runtime/ security/ servlet/ tagplugins/ tagplugi
Added: struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/JspUtil.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/JspUtil.java?rev=819435&view=auto == --- struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/JspUtil.java (added) +++ struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/JspUtil.java Mon Sep 28 00:43:34 2009 @@ -0,0 +1,1176 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jasper.compiler; + +import java.io.CharArrayWriter; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.UnsupportedEncodingException; +import java.util.Vector; +import java.util.jar.JarFile; +import java.util.zip.ZipEntry; + +import javax.el.FunctionMapper; +import javax.servlet.jsp.el.ExpressionEvaluator; + + +import org.apache.el.ExpressionFactoryImpl; +import org.apache.jasper.Constants; +import org.apache.jasper.JasperException; +import org.apache.jasper.JspCompilationContext; +import org.apache.jasper.el.ExpressionEvaluatorImpl; +import org.xml.sax.Attributes; + +/** + * This class has all the utility method(s). + * Ideally should move all the bean containers here. + * + * @author Mandar Raje. + * @author Rajiv Mordani. + * @author Danno Ferrin + * @author Pierre Delisle + * @author Shawn Bayern + * @author Mark Roth + */ +public class JspUtil { + +private static final String WEB_INF_TAGS = "/WEB-INF/tags/"; +private static final String META_INF_TAGS = "/META-INF/tags/"; + +// Delimiters for request-time expressions (JSP and XML syntax) +private static final String OPEN_EXPR = "<%="; +private static final String CLOSE_EXPR = "%>"; +private static final String OPEN_EXPR_XML = "%="; +private static final String CLOSE_EXPR_XML = "%"; + +private static int tempSequenceNumber = 0; + +//private static ExpressionEvaluatorImpl expressionEvaluator +//= new ExpressionEvaluatorImpl(); + +//tc6 +private final static ExpressionEvaluator expressionEvaluator = +new ExpressionEvaluatorImpl(new ExpressionFactoryImpl()); + +private static final String javaKeywords[] = { +"abstract", "assert", "boolean", "break", "byte", "case", +"catch", "char", "class", "const", "continue", +"default", "do", "double", "else", "enum", "extends", +"final", "finally", "float", "for", "goto", +"if", "implements", "import", "instanceof", "int", +"interface", "long", "native", "new", "package", +"private", "protected", "public", "return", "short", +"static", "strictfp", "super", "switch", "synchronized", +"this", "throws", "transient", "try", "void", +"volatile", "while" }; + +public static final int CHUNKSIZE = 1024; + +public static char[] removeQuotes(char []chars) { +CharArrayWriter caw = new CharArrayWriter(); +for (int i = 0; i < chars.length; i++) { +if (chars[i] == '%' && chars[i+1] == '\\' && +chars[i+2] == '>') { +caw.write('%'); +caw.write('>'); +i = i + 2; +} else { +caw.write(chars[i]); +} +} +return caw.toCharArray(); +} + +public static char[] escapeQuotes (char []chars) { +// Prescan to convert %\> to %> +String s = new String(chars); +while (true) { +int n = s.indexOf("%\\>"); +if (n < 0) +break; +StringBuffer sb = new StringBuffer(s.substring(0, n)); +sb.append("%>"); +sb.append(s.substring(n + 3)); +s = sb.toString(); +} +chars = s.toCharArray(); +return (chars); + + +// Escape all backslashes not inside a Java string literal +/* +CharArrayWriter caw = new CharArrayWriter(); +boolean inJavaString = false; +for (int i = 0; i < chars.length; i++
svn commit: r819435 [10/23] - in /struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper: ./ compiler/ compiler/tagplugin/ el/ runtime/ security/ servlet/ tagplugins/ tagplug
Added: struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/PageDataImpl.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/PageDataImpl.java?rev=819435&view=auto == --- struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/PageDataImpl.java (added) +++ struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/PageDataImpl.java Mon Sep 28 00:43:34 2009 @@ -0,0 +1,711 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jasper.compiler; + +import java.io.InputStream; +import java.io.ByteArrayInputStream; +import java.io.CharArrayWriter; +import java.io.UnsupportedEncodingException; +import java.util.ListIterator; +import javax.servlet.jsp.tagext.PageData; +import org.xml.sax.Attributes; +import org.xml.sax.helpers.AttributesImpl; +import org.apache.jasper.JasperException; + +/** + * An implementation of javax.servlet.jsp.tagext.PageData which + * builds the XML view of a given page. + * + * The XML view is built in two passes: + * + * During the first pass, the FirstPassVisitor collects the attributes of the + * top-level jsp:root and those of the jsp:root elements of any included + * pages, and adds them to the jsp:root element of the XML view. + * In addition, any taglib directives are converted into xmlns: attributes and + * added to the jsp:root element of the XML view. + * This pass ignores any nodes other than JspRoot and TaglibDirective. + * + * During the second pass, the SecondPassVisitor produces the XML view, using + * the combined jsp:root attributes determined in the first pass and any + * remaining pages nodes (this pass ignores any JspRoot and TaglibDirective + * nodes). + * + * @author Jan Luehe + */ +class PageDataImpl extends PageData implements TagConstants { + +private static final String JSP_VERSION = "2.0"; +private static final String CDATA_START_SECTION = "\n"; + +// string buffer used to build XML view +private StringBuffer buf; + +/** + * Constructor. + * + * @param page the page nodes from which to generate the XML view + */ +public PageDataImpl(Node.Nodes page, Compiler compiler) + throws JasperException { + + // First pass + FirstPassVisitor firstPass = new FirstPassVisitor(page.getRoot(), + compiler.getPageInfo()); + page.visit(firstPass); + + // Second pass + buf = new StringBuffer(); + SecondPassVisitor secondPass + = new SecondPassVisitor(page.getRoot(), buf, compiler, + firstPass.getJspIdPrefix()); + page.visit(secondPass); +} + +/** + * Returns the input stream of the XML view. + * + * @return the input stream of the XML view + */ +public InputStream getInputStream() { + // Turn StringBuffer into InputStream +try { +return new ByteArrayInputStream(buf.toString().getBytes("UTF-8")); +} catch (UnsupportedEncodingException uee) { + // should never happen +throw new RuntimeException(uee.toString()); +} +} + +/* + * First-pass Visitor for JspRoot nodes (representing jsp:root elements) + * and TablibDirective nodes, ignoring any other nodes. + * + * The purpose of this Visitor is to collect the attributes of the + * top-level jsp:root and those of the jsp:root elements of any included + * pages, and add them to the jsp:root element of the XML view. + * In addition, this Visitor converts any taglib directives into xmlns: + * attributes and adds them to the jsp:root element of the XML view. + */ +static class FirstPassVisitor + extends Node.Visitor implements TagConstants { + + private Node.Root root; + private AttributesImpl rootAttrs; + private PageInfo pageInfo; + + // Prefix for the 'id' attribute + private String jspIdPrefix; + + /* +* Constructor +
svn commit: r819435 [14/23] - in /struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper: ./ compiler/ compiler/tagplugin/ el/ runtime/ security/ servlet/ tagplugins/ tagplug
Added: struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/TldLocationsCache.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/TldLocationsCache.java?rev=819435&view=auto == --- struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/TldLocationsCache.java (added) +++ struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/TldLocationsCache.java Mon Sep 28 00:43:34 2009 @@ -0,0 +1,549 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jasper.compiler; + +import java.io.InputStream; +import java.net.JarURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLClassLoader; +import java.net.URLConnection; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; +import java.util.StringTokenizer; +import java.util.jar.JarEntry; +import java.util.jar.JarFile; +import org.xml.sax.InputSource; + +import javax.servlet.ServletContext; + +import org.apache.jasper.Constants; +import org.apache.jasper.JasperException; +import org.apache.jasper.xmlparser.ParserUtils; +import org.apache.jasper.xmlparser.TreeNode; +import org.apache.juli.logging.Log; +import org.apache.juli.logging.LogFactory; + +/** + * A container for all tag libraries that are defined "globally" + * for the web application. + * + * Tag Libraries can be defined globally in one of two ways: + * 1. Via elements in web.xml: + * the uri and location of the tag-library are specified in + * the element. + * 2. Via packaged jar files that contain .tld files + * within the META-INF directory, or some subdirectory + * of it. The taglib is 'global' if it has the + * element defined. + * + * A mapping between the taglib URI and its associated TaglibraryInfoImpl + * is maintained in this container. + * Actually, that's what we'd like to do. However, because of the + * way the classes TagLibraryInfo and TagInfo have been defined, + * it is not currently possible to share an instance of TagLibraryInfo + * across page invocations. A bug has been submitted to the spec lead. + * In the mean time, all we do is save the 'location' where the + * TLD associated with a taglib URI can be found. + * + * When a JSP page has a taglib directive, the mappings in this container + * are first searched (see method getLocation()). + * If a mapping is found, then the location of the TLD is returned. + * If no mapping is found, then the uri specified + * in the taglib directive is to be interpreted as the location for + * the TLD of this tag library. + * + * @author Pierre Delisle + * @author Jan Luehe + */ + +public class TldLocationsCache { + +// Logger +private Log log = LogFactory.getLog(TldLocationsCache.class); + +/** + * The types of URI one may specify for a tag library + */ +public static final int ABS_URI = 0; +public static final int ROOT_REL_URI = 1; +public static final int NOROOT_REL_URI = 2; + +private static final String WEB_XML = "/WEB-INF/web.xml"; +private static final String FILE_PROTOCOL = "file:"; +private static final String JAR_FILE_SUFFIX = ".jar"; + +// Names of JARs that are known not to contain any TLDs +private static HashSet noTldJars; + +/** + * The mapping of the 'global' tag library URI to the location (resource + * path) of the TLD associated with that tag library. The location is + * returned as a String array: + *[0] The location + *[1] If the location is a jar file, this is the location of the tld. + */ +private Hashtable mappings; + +private boolean initialized; +private ServletContext ctxt; +private boolean redeployMode; + +//* +// Constructor and Initilizations + +/* + * Initializes the set of JARs that are known not to contain any TLDs + */ +static { +no
[OSS Bamboo] Struts 2 SVN - Main Build (Java 6) build 981 has FAILED (0 tests failed). Change made by Musachy Barroso
--- STRUTS-MAINJ6-981 failed. --- Code has been updated by Musachy Barroso. No failed tests found, a possible compilation error. http://opensource.bamboo.atlassian.com/browse/STRUTS-MAINJ6-981/ -- Code Changes -- Musachy Barroso (819434): >removing jasper 5 Musachy Barroso (819433): >add commons-el dep and remove jsp-api dep -- Error Summary -- [INFO] [ERROR] BUILD FAILURE [INFO] [INFO] Compilation failure /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAINJ6/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[34,32] package org.apache.struts2.jasper does not exist /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAINJ6/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[35,32] package org.apache.struts2.jasper does not exist /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAINJ6/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[36,41] package org.apache.struts2.jasper.compiler does not exist /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAINJ6/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[41,24] package javax.servlet.jsp does not exist /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAINJ6/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[42,24] package javax.servlet.jsp does not exist /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAINJ6/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[224,12] cannot find symbol symbol : class JspC location: class org.apache.struts2.JSPLoader /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAINJ6/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[224,52] cannot find symbol symbol : class JasperException location: class org.apache.struts2.JSPLoader /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAINJ6/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPRuntime.java:[29,24] package javax.servlet.jsp does not exist /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAINJ6/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[77,8] cannot find symbol symbol : class JspC location: class org.apache.struts2.JSPLoader /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAINJ6/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[191,32] cannot find symbol symbol : class JspPage location: class org.apache.struts2.JSPLoader /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAINJ6/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[225,8] cannot find symbol symbol : class JspC location: class org.apache.struts2.JSPLoader /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAINJ6/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[225,24] cannot find symbol symbol : class JspC location: class org.apache.struts2.JSPLoader /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAINJ6/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPRuntime.java:[64,8] cannot find symbol symbol : class HttpJspPage location: class org.apache.struts2.JSPRuntime /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAINJ6/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPRuntime.java:[64,28] cannot find symbol symbol : class HttpJspPage location: class org.apache.struts2.JSPRuntime [INFO] [INFO] For more information, run Maven with the -e switch -- This message is automatically generated by Atlassian Bamboo
[OSS Bamboo] Struts 2 SVN - Main Build build 1229 has FAILED (0 tests failed). Change made by Musachy Barroso
--- STRUTS-MAIN-1229 failed. --- Code has been updated by Musachy Barroso. No failed tests found, a possible compilation error. http://opensource.bamboo.atlassian.com/browse/STRUTS-MAIN-1229/ -- Code Changes -- Musachy Barroso (819434): >removing jasper 5 Musachy Barroso (819433): >add commons-el dep and remove jsp-api dep -- Error Summary -- [INFO] [ERROR] BUILD FAILURE [INFO] [INFO] Compilation failure /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAIN/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[34,32] package org.apache.struts2.jasper does not exist /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAIN/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[35,32] package org.apache.struts2.jasper does not exist /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAIN/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[36,41] package org.apache.struts2.jasper.compiler does not exist /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAIN/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[41,24] package javax.servlet.jsp does not exist /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAIN/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[42,24] package javax.servlet.jsp does not exist /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAIN/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[224,12] cannot find symbol symbol : class JspC location: class org.apache.struts2.JSPLoader /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAIN/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[224,52] cannot find symbol symbol : class JasperException location: class org.apache.struts2.JSPLoader /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAIN/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPRuntime.java:[29,24] package javax.servlet.jsp does not exist /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAIN/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[77,8] cannot find symbol symbol : class JspC location: class org.apache.struts2.JSPLoader /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAIN/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[191,32] cannot find symbol symbol : class JspPage location: class org.apache.struts2.JSPLoader /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAIN/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[225,8] cannot find symbol symbol : class JspC location: class org.apache.struts2.JSPLoader /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAIN/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[225,24] cannot find symbol symbol : class JspC location: class org.apache.struts2.JSPLoader /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAIN/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPRuntime.java:[64,8] cannot find symbol symbol : class HttpJspPage location: class org.apache.struts2.JSPRuntime /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAIN/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPRuntime.java:[64,28] cannot find symbol symbol : class HttpJspPage location: class org.apache.struts2.JSPRuntime [INFO] [INFO] For more information, run Maven with the -e switch -- This message is automatically generated by Atlassian Bamboo
[OSS Bamboo] Struts 2 SVN - Main Build (Java 6) build 982 has FAILED (0 tests failed). Change made by Musachy Barroso
--- STRUTS-MAINJ6-982 failed. --- Code has been updated by Musachy Barroso. No failed tests found, a possible compilation error. http://opensource.bamboo.atlassian.com/browse/STRUTS-MAINJ6-982/ -- Code Changes -- Musachy Barroso (819435): >importing jasper 6.0.20, this code will not compile -- Error Summary -- [INFO] [ERROR] BUILD FAILURE [INFO] [INFO] Compilation failure Failure executing javac, but could not parse the error: The system is out of resources. Consult the following stack trace for details. java.lang.OutOfMemoryError: PermGen space at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:621) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$000(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at org.codehaus.plexus.compiler.javac.IsolatedClassLoader.loadClass(IsolatedClassLoader.java:56) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) at com.sun.tools.javac.jvm.ClassReader.(ClassReader.java:206) at com.sun.tools.javac.jvm.ClassReader.instance(ClassReader.java:168) at com.sun.tools.javac.main.JavaCompiler. (JavaCompiler.java:293) at com.sun.tools.javac.main.JavaCompiler.instance(JavaCompiler.java:72) at com.sun.tools.javac.main.Main.compile(Main.java:340) at com.sun.tools.javac.main.Main.compile(Main.java:279) at com.sun.tools.javac.main.Main.compile(Main.java:270) at com.sun.tools.javac.Main.compile(Main.java:87) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.plexus.compiler.javac.JavacCompiler.compileInProcess(JavacCompiler.java:420) at org.codehaus.plexus.compiler.javac.JavacCompiler.compile(JavacCompiler.java:141) at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:493) at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:114) at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:447) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:459) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278) Failure executing javac, but could not parse the error: The system is out of resources. Consult the following stack trace for details. java.lang.OutOfMemoryError: PermGen space at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:621) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$000(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at org.codehaus.plexus.compiler.javac.IsolatedClassLoader.loadClass(IsolatedClassLoader.java:56) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) at com.sun.tools.javac.jvm.ClassReader. (ClassReader.java:206) at com.sun.tools.javac.jvm.ClassReader.instance(ClassReader.java:168) at com.sun.tools.javac.main.JavaCompiler. (JavaCompiler.java:293) at com.sun.tools.javac.main.JavaCompiler.instance(
[OSS Bamboo] Struts 2 SVN - Main Build build 1230 has FAILED (0 tests failed). Change made by Musachy Barroso
--- STRUTS-MAIN-1230 failed. --- Code has been updated by Musachy Barroso. No failed tests found, a possible compilation error. http://opensource.bamboo.atlassian.com/browse/STRUTS-MAIN-1230/ -- Code Changes -- Musachy Barroso (819435): >importing jasper 6.0.20, this code will not compile -- This message is automatically generated by Atlassian Bamboo
svn commit: r819443 - /struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/
Author: musachy Date: Mon Sep 28 01:46:14 2009 New Revision: 819443 URL: http://svn.apache.org/viewvc?rev=819443&view=rev Log: remove jasper source Removed: struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/
[OSS Bamboo] Struts 2 SVN - Main Build (Java 6) build 983 has FAILED (0 tests failed). Change made by Musachy Barroso
--- STRUTS-MAINJ6-983 failed. --- Code has been updated by Musachy Barroso. No failed tests found, a possible compilation error. http://opensource.bamboo.atlassian.com/browse/STRUTS-MAINJ6-983/ -- Code Changes -- Musachy Barroso (819443): >remove jasper source -- Error Summary -- [INFO] [ERROR] BUILD FAILURE [INFO] [INFO] Compilation failure /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAINJ6/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[34,32] package org.apache.struts2.jasper does not exist /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAINJ6/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[35,32] package org.apache.struts2.jasper does not exist /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAINJ6/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[36,41] package org.apache.struts2.jasper.compiler does not exist /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAINJ6/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[41,24] package javax.servlet.jsp does not exist /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAINJ6/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[42,24] package javax.servlet.jsp does not exist /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAINJ6/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[224,12] cannot find symbol symbol : class JspC location: class org.apache.struts2.JSPLoader /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAINJ6/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[224,52] cannot find symbol symbol : class JasperException location: class org.apache.struts2.JSPLoader /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAINJ6/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPRuntime.java:[29,24] package javax.servlet.jsp does not exist /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAINJ6/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[77,8] cannot find symbol symbol : class JspC location: class org.apache.struts2.JSPLoader /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAINJ6/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[191,32] cannot find symbol symbol : class JspPage location: class org.apache.struts2.JSPLoader /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAINJ6/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[225,8] cannot find symbol symbol : class JspC location: class org.apache.struts2.JSPLoader /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAINJ6/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[225,24] cannot find symbol symbol : class JspC location: class org.apache.struts2.JSPLoader /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAINJ6/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPRuntime.java:[64,8] cannot find symbol symbol : class HttpJspPage location: class org.apache.struts2.JSPRuntime /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAINJ6/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPRuntime.java:[64,28] cannot find symbol symbol : class HttpJspPage location: class org.apache.struts2.JSPRuntime [INFO] [INFO] For more information, run Maven with the -e switch -- This message is automatically generated by Atlassian Bamboo
[OSS Bamboo] Struts 2 SVN - Main Build build 1231 has FAILED (0 tests failed). Change made by Musachy Barroso
--- STRUTS-MAIN-1231 failed. --- Code has been updated by Musachy Barroso. No failed tests found, a possible compilation error. http://opensource.bamboo.atlassian.com/browse/STRUTS-MAIN-1231/ -- Code Changes -- Musachy Barroso (819443): >remove jasper source -- Error Summary -- [INFO] [ERROR] BUILD FAILURE [INFO] [INFO] Compilation failure /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAIN/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[34,32] package org.apache.struts2.jasper does not exist /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAIN/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[35,32] package org.apache.struts2.jasper does not exist /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAIN/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[36,41] package org.apache.struts2.jasper.compiler does not exist /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAIN/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[41,24] package javax.servlet.jsp does not exist /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAIN/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[42,24] package javax.servlet.jsp does not exist /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAIN/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[224,12] cannot find symbol symbol : class JspC location: class org.apache.struts2.JSPLoader /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAIN/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[224,52] cannot find symbol symbol : class JasperException location: class org.apache.struts2.JSPLoader /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAIN/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPRuntime.java:[29,24] package javax.servlet.jsp does not exist /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAIN/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[77,8] cannot find symbol symbol : class JspC location: class org.apache.struts2.JSPLoader /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAIN/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[191,32] cannot find symbol symbol : class JspPage location: class org.apache.struts2.JSPLoader /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAIN/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[225,8] cannot find symbol symbol : class JspC location: class org.apache.struts2.JSPLoader /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAIN/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java:[225,24] cannot find symbol symbol : class JspC location: class org.apache.struts2.JSPLoader /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAIN/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPRuntime.java:[64,8] cannot find symbol symbol : class HttpJspPage location: class org.apache.struts2.JSPRuntime /opt/j2ee/domains/bamboo.atlassian.com/opensource/home/xml-data/build-dir/STRUTS-MAIN/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPRuntime.java:[64,28] cannot find symbol symbol : class HttpJspPage location: class org.apache.struts2.JSPRuntime [INFO] [INFO] For more information, run Maven with the -e switch -- This message is automatically generated by Atlassian Bamboo
svn commit: r819444 [10/27] - in /struts/struts2/trunk/plugins/embeddedjsp: ./ src/main/java/org/apache/struts2/el/ src/main/java/org/apache/struts2/el/lang/ src/main/java/org/apache/struts2/el/parser
Added: struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/ImplicitTagLibraryInfo.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/ImplicitTagLibraryInfo.java?rev=819444&view=auto == --- struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/ImplicitTagLibraryInfo.java (added) +++ struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/ImplicitTagLibraryInfo.java Mon Sep 28 01:55:26 2009 @@ -0,0 +1,218 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.struts2.jasper.compiler; + +import java.io.InputStream; +import java.util.Collection; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.Set; +import java.util.Vector; + +import javax.servlet.jsp.tagext.FunctionInfo; +import javax.servlet.jsp.tagext.TagFileInfo; +import javax.servlet.jsp.tagext.TagInfo; +import javax.servlet.jsp.tagext.TagLibraryInfo; + +import org.apache.struts2.jasper.JasperException; +import org.apache.struts2.jasper.JspCompilationContext; +import org.apache.struts2.jasper.xmlparser.ParserUtils; +import org.apache.struts2.jasper.xmlparser.TreeNode; + +/** + * Class responsible for generating an implicit tag library containing tag + * handlers corresponding to the tag files in "/WEB-INF/tags/" or a + * subdirectory of it. + * + * @author Jan Luehe + */ +class ImplicitTagLibraryInfo extends TagLibraryInfo { + +private static final String WEB_INF_TAGS = "/WEB-INF/tags"; +private static final String TAG_FILE_SUFFIX = ".tag"; +private static final String TAGX_FILE_SUFFIX = ".tagx"; +private static final String TAGS_SHORTNAME = "tags"; +private static final String TLIB_VERSION = "1.0"; +private static final String JSP_VERSION = "2.0"; +private static final String IMPLICIT_TLD = "implicit.tld"; + +// Maps tag names to tag file paths +private Hashtable tagFileMap; + +private ParserController pc; +private PageInfo pi; +private Vector vec; + +/** + * Constructor. + */ +public ImplicitTagLibraryInfo(JspCompilationContext ctxt, +ParserController pc, +PageInfo pi, +String prefix, +String tagdir, +ErrorDispatcher err) throws JasperException { +super(prefix, null); +this.pc = pc; +this.pi = pi; +this.tagFileMap = new Hashtable(); +this.vec = new Vector(); + +// Implicit tag libraries have no functions: +this.functions = new FunctionInfo[0]; + +tlibversion = TLIB_VERSION; +jspversion = JSP_VERSION; + +if (!tagdir.startsWith(WEB_INF_TAGS)) { +err.jspError("jsp.error.invalid.tagdir", tagdir); +} + +// Determine the value of the subelement of the +// "imaginary" element +if (tagdir.equals(WEB_INF_TAGS) +|| tagdir.equals( WEB_INF_TAGS + "/")) { +shortname = TAGS_SHORTNAME; +} else { +shortname = tagdir.substring(WEB_INF_TAGS.length()); +shortname = shortname.replace('/', '-'); +} + +// Populate mapping of tag names to tag file paths +Set dirList = ctxt.getResourcePaths(tagdir); +if (dirList != null) { +Iterator it = dirList.iterator(); +while (it.hasNext()) { +String path = (String) it.next(); +if (path.endsWith(TAG_FILE_SUFFIX) +|| path.endsWith(TAGX_FILE_SUFFIX)) { +/* + * Use the filename of the tag file, without the .tag or + * .tagx extension, respectively, as the subelement + * of the "imaginary" element + */ +String suffix = path.endsWith(TAG_FILE_SUFFIX) ? +TAG_FILE_SUFFIX : TAGX_FILE_SUFFIX; +String tagName = path.substring(path.lastIndexOf("/") + 1); +tagName = tagName.substring(
svn commit: r819444 [8/27] - in /struts/struts2/trunk/plugins/embeddedjsp: ./ src/main/java/org/apache/struts2/el/ src/main/java/org/apache/struts2/el/lang/ src/main/java/org/apache/struts2/el/parser/
Added: struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/ELNode.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/ELNode.java?rev=819444&view=auto == --- struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/ELNode.java (added) +++ struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/ELNode.java Mon Sep 28 01:55:26 2009 @@ -0,0 +1,255 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.struts2.jasper.compiler; + +import java.util.*; +import javax.servlet.jsp.tagext.FunctionInfo; +import org.apache.struts2.jasper.JasperException; + +/** + * This class defines internal representation for an EL Expression + * + * It currently only defines functions. It can be expanded to define + * all the components of an EL expression, if need to. + * + * @author Kin-man Chung + */ + +abstract class ELNode { + +abstract public void accept(Visitor v) throws JasperException; + +/** + * Child classes + */ + + +/** + * Represents an EL expression: anything in ${ and }. + */ +public static class Root extends ELNode { + + private ELNode.Nodes expr; +private char type; + + Root(ELNode.Nodes expr, char type) { + this.expr = expr; +this.type = type; + } + + public void accept(Visitor v) throws JasperException { + v.visit(this); + } + + public ELNode.Nodes getExpression() { + return expr; + } + +public char getType() { +return type; +} +} + +/** + * Represents text outside of EL expression. + */ +public static class Text extends ELNode { + + private String text; + + Text(String text) { + this.text = text; + } + + public void accept(Visitor v) throws JasperException { + v.visit(this); + } + + public String getText() { + return text; + } +} + +/** + * Represents anything in EL expression, other than functions, including + * function arguments etc + */ +public static class ELText extends ELNode { + + private String text; + + ELText(String text) { + this.text = text; + } + + public void accept(Visitor v) throws JasperException { + v.visit(this); + } + + public String getText() { + return text; + } +} + +/** + * Represents a function + * Currently only include the prefix and function name, but not its + * arguments. + */ +public static class Function extends ELNode { + + private String prefix; + private String name; + private String uri; + private FunctionInfo functionInfo; + private String methodName; + private String[] parameters; + + Function(String prefix, String name) { + this.prefix = prefix; + this.name = name; + } + + public void accept(Visitor v) throws JasperException { + v.visit(this); + } + + public String getPrefix() { + return prefix; + } + + public String getName() { + return name; + } + + public void setUri(String uri) { + this.uri = uri; + } + + public String getUri() { + return uri; + } + + public void setFunctionInfo(FunctionInfo f) { + this.functionInfo = f; + } + + public FunctionInfo getFunctionInfo() { + return functionInfo; + } + + public void setMethodName(String methodName) { + this.methodName = methodName; + } + + public String getMethodName() { + return methodName; + } + + public void setParameters(String[] parameters) { + this.parameters = parameters; + } + + public String[] getParameters() { + return parameters; + } +} + +/** + * An ordered list of ELNode. + */ +public static class Nodes { + +
svn commit: r819444 [12/27] - in /struts/struts2/trunk/plugins/embeddedjsp: ./ src/main/java/org/apache/struts2/el/ src/main/java/org/apache/struts2/el/lang/ src/main/java/org/apache/struts2/el/parser
Added: struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/JspUtil.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/JspUtil.java?rev=819444&view=auto == --- struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/JspUtil.java (added) +++ struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/JspUtil.java Mon Sep 28 01:55:26 2009 @@ -0,0 +1,1177 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.struts2.jasper.compiler; + +import java.io.CharArrayWriter; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.UnsupportedEncodingException; +import java.util.Vector; +import java.util.jar.JarFile; +import java.util.zip.ZipEntry; + +import javax.el.FunctionMapper; +import javax.servlet.jsp.el.ExpressionEvaluator; + + +import org.apache.struts2.el.ExpressionFactoryImpl; +import org.apache.struts2.jasper.Constants; +import org.apache.struts2.jasper.JasperException; +import org.apache.struts2.jasper.JspCompilationContext; +import org.apache.struts2.jasper.el.ExpressionEvaluatorImpl; +import org.xml.sax.Attributes; + +/** + * This class has all the utility method(s). + * Ideally should move all the bean containers here. + * + * @author Mandar Raje. + * @author Rajiv Mordani. + * @author Danno Ferrin + * @author Pierre Delisle + * @author Shawn Bayern + * @author Mark Roth + */ +public class JspUtil { + +private static final String WEB_INF_TAGS = "/WEB-INF/tags/"; +private static final String META_INF_TAGS = "/META-INF/tags/"; + +// Delimiters for request-time expressions (JSP and XML syntax) +private static final String OPEN_EXPR = "<%="; +private static final String CLOSE_EXPR = "%>"; +private static final String OPEN_EXPR_XML = "%="; +private static final String CLOSE_EXPR_XML = "%"; + +private static int tempSequenceNumber = 0; + +//private static ExpressionEvaluatorImpl expressionEvaluator +//= new ExpressionEvaluatorImpl(); + +//tc6 +private final static ExpressionEvaluator expressionEvaluator = +new ExpressionEvaluatorImpl(new ExpressionFactoryImpl()); + +private static final String javaKeywords[] = { +"abstract", "assert", "boolean", "break", "byte", "case", +"catch", "char", "class", "const", "continue", +"default", "do", "double", "else", "enum", "extends", +"final", "finally", "float", "for", "goto", +"if", "implements", "import", "instanceof", "int", +"interface", "long", "native", "new", "package", +"private", "protected", "public", "return", "short", +"static", "strictfp", "super", "switch", "synchronized", +"this", "throws", "transient", "try", "void", +"volatile", "while" }; + +public static final int CHUNKSIZE = 1024; + +public static char[] removeQuotes(char []chars) { +CharArrayWriter caw = new CharArrayWriter(); +for (int i = 0; i < chars.length; i++) { +if (chars[i] == '%' && chars[i+1] == '\\' && +chars[i+2] == '>') { +caw.write('%'); +caw.write('>'); +i = i + 2; +} else { +caw.write(chars[i]); +} +} +return caw.toCharArray(); +} + +public static char[] escapeQuotes (char []chars) { +// Prescan to convert %\> to %> +String s = new String(chars); +while (true) { +int n = s.indexOf("%\\>"); +if (n < 0) +break; +StringBuffer sb = new StringBuffer(s.substring(0, n)); +sb.append("%>"); +sb.append(s.substring(n + 3)); +s = sb.toString(); +} +chars = s.toCharArray(); +return (chars); + + +// Escape all backslashes not inside a Java string literal +/* +CharArrayWriter caw = new CharArrayWriter(); +boolean inJavaString = false
svn commit: r819444 [14/27] - in /struts/struts2/trunk/plugins/embeddedjsp: ./ src/main/java/org/apache/struts2/el/ src/main/java/org/apache/struts2/el/lang/ src/main/java/org/apache/struts2/el/parser
Added: struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/PageDataImpl.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/PageDataImpl.java?rev=819444&view=auto == --- struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/PageDataImpl.java (added) +++ struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/compiler/PageDataImpl.java Mon Sep 28 01:55:26 2009 @@ -0,0 +1,711 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.struts2.jasper.compiler; + +import java.io.InputStream; +import java.io.ByteArrayInputStream; +import java.io.CharArrayWriter; +import java.io.UnsupportedEncodingException; +import java.util.ListIterator; +import javax.servlet.jsp.tagext.PageData; +import org.xml.sax.Attributes; +import org.xml.sax.helpers.AttributesImpl; +import org.apache.struts2.jasper.JasperException; + +/** + * An implementation of javax.servlet.jsp.tagext.PageData which + * builds the XML view of a given page. + * + * The XML view is built in two passes: + * + * During the first pass, the FirstPassVisitor collects the attributes of the + * top-level jsp:root and those of the jsp:root elements of any included + * pages, and adds them to the jsp:root element of the XML view. + * In addition, any taglib directives are converted into xmlns: attributes and + * added to the jsp:root element of the XML view. + * This pass ignores any nodes other than JspRoot and TaglibDirective. + * + * During the second pass, the SecondPassVisitor produces the XML view, using + * the combined jsp:root attributes determined in the first pass and any + * remaining pages nodes (this pass ignores any JspRoot and TaglibDirective + * nodes). + * + * @author Jan Luehe + */ +class PageDataImpl extends PageData implements TagConstants { + +private static final String JSP_VERSION = "2.0"; +private static final String CDATA_START_SECTION = "\n"; + +// string buffer used to build XML view +private StringBuffer buf; + +/** + * Constructor. + * + * @param page the page nodes from which to generate the XML view + */ +public PageDataImpl(Node.Nodes page, Compiler compiler) + throws JasperException { + + // First pass + FirstPassVisitor firstPass = new FirstPassVisitor(page.getRoot(), + compiler.getPageInfo()); + page.visit(firstPass); + + // Second pass + buf = new StringBuffer(); + SecondPassVisitor secondPass + = new SecondPassVisitor(page.getRoot(), buf, compiler, + firstPass.getJspIdPrefix()); + page.visit(secondPass); +} + +/** + * Returns the input stream of the XML view. + * + * @return the input stream of the XML view + */ +public InputStream getInputStream() { + // Turn StringBuffer into InputStream +try { +return new ByteArrayInputStream(buf.toString().getBytes("UTF-8")); +} catch (UnsupportedEncodingException uee) { + // should never happen +throw new RuntimeException(uee.toString()); +} +} + +/* + * First-pass Visitor for JspRoot nodes (representing jsp:root elements) + * and TablibDirective nodes, ignoring any other nodes. + * + * The purpose of this Visitor is to collect the attributes of the + * top-level jsp:root and those of the jsp:root elements of any included + * pages, and add them to the jsp:root element of the XML view. + * In addition, this Visitor converts any taglib directives into xmlns: + * attributes and adds them to the jsp:root element of the XML view. + */ +static class FirstPassVisitor + extends Node.Visitor implements TagConstants { + + private Node.Root root; + private AttributesImpl rootAttrs; + private PageInfo pageInfo; + + // Prefix for the 'id' attribute + private String jspIdPrefix; + + /* +* C