roller-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sean Pritchard <spritch...@militaryhire.com>
Subject Re: Error when accessing webapp without trailing slash
Date Sun, 16 Nov 2014 22:45:28 GMT
As a follow up, I edited the error.jsp to dump the stack trace.  Here it it
(partial)

java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at java.lang.String.substring(String.java:1875)
    at
org.apache.roller.weblogger.ui.rendering.WeblogRequestMapper.handleRequest(WeblogRequestMapper.java:112)
    at
org.apache.roller.weblogger.ui.rendering.filters.RequestMappingFilter.doFilter(RequestMappingFilter.java:120)
    at
com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:89)
    at
org.apache.roller.weblogger.ui.core.filters.InitFilter.doFilter(InitFilter.java:73)

The error seems to be happening on the last line of this snippet from
WeblogRequestMapper:

        // figure out potential weblog handle
        String servlet = request.getRequestURI();
        String pathInfo = null;

        if(servlet != null && servlet.trim().length() > 1) {

            if(request.getContextPath() != null) {
                servlet =
servlet.substring(request.getContextPath().length());
            }

            // strip off the leading slash
            servlet = servlet.substring(1); //line 112

Seems like the assumption is that at least a "/" remains in servlet at this
point.  Without launching an argument about spec compliance, it seems this
could be easily fixed by changing the last line to:

if(servlet.startsWith("/")) {
    servlet = servlet.substring(1);
}

I will probably make that change locally to work around this issue, but it
would be helpful if the change were included in future releases.

Regards,
Sean







On Sun, Nov 16, 2014 at 4:19 PM, Sean Pritchard <spritchard@militaryhire.com
> wrote:

> Hello,
>
> I've recently installed and started using Roller 5.1.1.  I deployed it to
> the Resin 4 app server.
>
> I renamed roller.war to blog.war to deploy to the path /blog/.  But I'm
> running into a problem where if I request the blog at
> http://hostname/blog/ it works fine.  But if I remove the trailing slash
> http://hostname/blog, I get the following error:
>
> Unexpected Exception Status Code 500  Message String index out of range:
> -1  Type
>  Exception Roller has encountered and logged an unexpected exception.
> In checking the roller.log, I see no evidence of an exception.  I tried
> changing the roller logging levels to DEBUG
>
> log4j.logger.org.apache.roller=DEBUG
> log4j.logger.net.java.roller=DEBUG
>
> But still no stack trace.  From the log, I'm guessing the problem is
> happening in the WeblogRequestMapper.  My two clues are at 16:03:13,361
> where the session is released immediately after evaluating the path /blog.
> Or perhaps at 16:03:14,138 where the request is not mapped.
>
> DEBUG 2014-11-16 16:03:13,333 CharEncodingFilter:doFilter - Processing
> CharEncodingFilter
> DEBUG 2014-11-16 16:03:13,334 CharEncodingFilter:doFilter - Set request
> character encoding to UTF-8
> DEBUG 2014-11-16 16:03:13,358 BootstrapFilter:doFilter - Entered /blog
> DEBUG 2014-11-16 16:03:13,359 WebloggerConfig:getProperty - Fetching
> property [installation.type=manual]
> DEBUG 2014-11-16 16:03:13,359 PersistenceSessionFilter:doFilter - Entered
> /blog
> DEBUG 2014-11-16 16:03:13,360 InitFilter:doFilter - relPath = /blog
> DEBUG 2014-11-16 16:03:13,360 InitFilter:doFilter - absPath =
> http://localhost:8080/blog
> DEBUG 2014-11-16 16:03:13,360 RequestMappingFilter:doFilter - entering
> DEBUG 2014-11-16 16:03:13,361 RequestMappingFilter:doFilter - trying
> mapper org.apache.roller.weblogger.ui.rendering.WeblogRequestMapper
> DEBUG 2014-11-16 16:03:13,361 WeblogRequestMapper:handleRequest -
> evaluating [/blog]
> DEBUG 2014-11-16 16:03:13,361 PersistenceSessionFilter:doFilter -
> Releasing Roller Session
> DEBUG 2014-11-16 16:03:14,127 CharEncodingFilter:doFilter - Processing
> CharEncodingFilter
> DEBUG 2014-11-16 16:03:14,128 CharEncodingFilter:doFilter - Set request
> character encoding to UTF-8
> DEBUG 2014-11-16 16:03:14,129 BootstrapFilter:doFilter - Entered
> /blog/roller-ui/styles/roller.css
> DEBUG 2014-11-16 16:03:14,129 WebloggerConfig:getProperty - Fetching
> property [installation.type=manual]
> DEBUG 2014-11-16 16:03:14,130 PersistenceSessionFilter:doFilter - Entered
> /blog/roller-ui/styles/roller.css
> DEBUG 2014-11-16 16:03:14,132 WebloggerConfig:getProperty - Fetching
> property [cache.salt.enabled=true]
> DEBUG 2014-11-16 16:03:14,132 WebloggerConfig:getProperty - Fetching
> property [cache.salt.size=5000]
> DEBUG 2014-11-16 16:03:14,132 WebloggerConfig:getProperty - Fetching
> property [cache.salt.timeout=3600]
> INFO  2014-11-16 16:03:14,132 SaltCache:<init> - {id=cache.salt,
> enabled=true, timeout=3600, size=5000}
> DEBUG 2014-11-16 16:03:14,133 CacheManager:constructCache - Constructing
> new cache with props {id=cache.salt, enabled=true, timeout=3600, size=5000}
> DEBUG 2014-11-16 16:03:14,133 ExpiringLRUCacheFactoryImpl:constructCache -
> new cache constructed. size=5000, timeout=3600
> DEBUG 2014-11-16 16:03:14,136 SaltCache:put - PUT kY1lSl8jyUyRCMfhyj8Z
> DEBUG 2014-11-16 16:03:14,136 RequestMappingFilter:doFilter - entering
> DEBUG 2014-11-16 16:03:14,137 RequestMappingFilter:doFilter - trying
> mapper org.apache.roller.weblogger.ui.rendering.WeblogRequestMapper
> DEBUG 2014-11-16 16:03:14,137 WeblogRequestMapper:handleRequest -
> evaluating [/blog/roller-ui/styles/roller.css]
> DEBUG 2014-11-16 16:03:14,137 WeblogRequestMapper:handleRequest -
> potential weblog handle = roller-ui
> DEBUG 2014-11-16 16:03:14,137 WeblogRequestMapper:handleRequest - SKIPPED
> roller-ui
> DEBUG 2014-11-16 16:03:14,138 RequestMappingFilter:doFilter - request not
> mapped
> DEBUG 2014-11-16 16:03:14,172 RequestMappingFilter:doFilter - exiting
> DEBUG 2014-11-16 16:03:14,173 PersistenceSessionFilter:doFilter -
> Releasing Roller Session
> DEBUG 2014-11-16 16:03:14,173 PersistenceSessionFilter:doFilter - Exiting
> /blog/roller-ui/styles/roller.css
> DEBUG 2014-11-16 16:03:14,173 BootstrapFilter:doFilter - Exiting
> /blog/roller-ui/styles/roller.css
>
> Have any of you run into this problem and know how to fix it?
>
> Thanks in advance,
> Sean
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message