You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Zvi Avraham <zv...@netmanage.co.il> on 2000/01/15 19:11:11 UTC
Re: cvs commit: xml-cocoon/src/org/apache/cocoon/processor/xsp
XSPUtil.java
Ricardo,
When trying "First XSP Page" sample and then clicking on "dynamically syntax
highlighted" link,
I get NullPointerException. I think the problem is that context parameter is null.I
guess that this b/c XSPProcessor have no access to ServletContext ...
Zvi
Error found handling the request.
java.lang.NullPointerException
at org.apache.cocoon.Utils.getBasename(Utils.java:246)
at
org.apache.cocoon.processor.xsp.XSPUtil.relativeFilename(XSPUtil.java:135)
at
org.apache.cocoon.processor.xsp.XSPUtil.relativeFilename(XSPUtil.java:147)
at
_D_._tomcat._cocoon._cocoon._samples._xsp._view_source.populateDocument(_view_source.java:319)
at
org.apache.cocoon.processor.xsp.XSPPage.getDocument(XSPPage.java:96)
at
org.apache.cocoon.processor.xsp.XSPProcessor.process(XSPProcessor.java:428)
at org.apache.cocoon.Engine.handle(Engine.java:284)
at org.apache.cocoon.Cocoon.service(Cocoon.java:145)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
at
org.apache.tomcat.core.ServiceInvocationHandler.method(ServletWrapper.java:626)
at
org.apache.tomcat.core.ServletWrapper.handleInvocation(ServletWrapper.java:534)
at
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:378)
at org.apache.tomcat.core.Context.handleRequest(Context.java:644)
at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:440)
at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:144)
at
org.apache.tomcat.service.TcpConnectionThread.run(TcpEndpoint.java:304)
at java.lang.Thread.run(Unknown Source)
ricardo@locus.apache.org wrote:
> ricardo 00/01/15 03:19:26
>
> Modified: src/org/apache/cocoon/processor/xsp XSPUtil.java
> Log:
> Removed requestRealPath in favor of Utils.getBasename
>
> Revision Changes Path
> 1.10 +5 -24 xml-cocoon/src/org/apache/cocoon/processor/xsp/XSPUtil.java
>
> Index: XSPUtil.java
> ===================================================================
> RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/processor/xsp/XSPUtil.java,v
> retrieving revision 1.9
> retrieving revision 1.10
> diff -u -r1.9 -r1.10
> --- XSPUtil.java 2000/01/15 04:41:10 1.9
> +++ XSPUtil.java 2000/01/15 11:19:25 1.10
> @@ -1,4 +1,4 @@
> -/*-- $Id: XSPUtil.java,v 1.9 2000/01/15 04:41:10 ricardo Exp $ --
> +/*-- $Id: XSPUtil.java,v 1.10 2000/01/15 11:19:25 ricardo Exp $ --
>
> ============================================================================
> The Apache Software License, Version 1.1
> @@ -59,9 +59,11 @@
> import javax.servlet.*;
> import javax.servlet.http.*;
>
> +import org.apache.cocoon.Utils;
> +
> /**
> * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
> - * @version $Revision: 1.9 $ $Date: 2000/01/15 04:41:10 $
> + * @version $Revision: 1.10 $ $Date: 2000/01/15 11:19:25 $
> */
> public class XSPUtil {
> public static String pathComponent(String filename) {
> @@ -130,7 +132,7 @@
> (
> new File(
> new File(
> - requestRealPath(request, context)
> + Utils.getBasename(request, context)
> ).getParent(),
> filename
> )
> @@ -143,27 +145,6 @@
> ) throws IOException
> {
> return relativeFilename(filename, request, null);
> - }
> -
> - public static String requestRealPath(
> - HttpServletRequest request,
> - ServletContext context
> - )
> - throws IOException
> - {
> - if (context != null) {
> - String path = context.getRealPath(request.getRequestURI()); // From 2.1
> -
> - if (path != null) {
> - return path;
> - }
> - }
> -
> - if (request.getPathInfo() == null) {
> - return request.getRealPath(request.getRequestURI());
> - } else {
> - return request.getPathTranslated();
> - }
> }
>
> public static boolean isAlphaNumeric(char c) {
>
>
>
RE: cvs commit: xml-cocoon/src/org/apache/cocoon/processor/xsp XSPUtil.java
Posted by Ricardo Rocha <ri...@apache.org>.
> When trying "First XSP Page" sample and then clicking on
> "dynamically syntax highlighted" link, I get NullPointerException.
> I think the problem is that context parameter is null. I guess that
> this b/c XSPProcessor have no access to ServletContext ...
> Zvi
Thanks Zvi. Yes, view-source.xml must pass the context object as
well. I'll fix the sample and XSPUtil (to remove the variant of
relativeFilename that accepts a null context object)