0 Replies Latest reply on Apr 27, 2009 12:26 PM by Murat ALPAY

    Exception in RedirectHandler

    Murat ALPAY Newbie

      on my platform I am running to the following exception :

      SEVERE: Servlet.service() for servlet default threw exception
      java.lang.StringIndexOutOfBoundsException: String index out of range: -1
           at java.lang.String.substring(String.java:1768)
           at org.jboss.seam.exception.RedirectHandler.handle(RedirectHandler.java:39)

      what happens is user tries to call a unauthorized function which results in a AuthorizationException. The exception is handled in the pages.xml:

           <exception class="org.jboss.seam.security.AuthorizationException">
                     <message>You don't have permission to do this</message>

      What I was expecting to see is user being redirected to the same page and a error message being printed in the h:messages tag.

      The offending line:

      (RedirectHandler.java:39) is : viewId = servletPath.substring(0, servletPath.lastIndexOf('.')) + Pages.getSuffix();

      changing that line to simply :

      viewId = servletPath;

      solves the problem on my case. I should note that I am also using the URL rewriting and the request I make is is like /example/photo/index