Uploaded image for project: 'JSPWiki'
  1. JSPWiki
  2. JSPWIKI-870

JSPWiki does not start, if tomcat directory path contains a white space

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.10.1
    • Fix Version/s: 2.10.2
    • Labels:
    • Environment:

      Bug found on a mac, but is probably platform independent.

      Description

      As described, JSPWiki does not start if run from a directory containing a white space in its path. The problem is, that the policy file is not found/accepted.
      The jspwiki.log contains the following stack trace:

      org.apache.wiki.api.exceptions.WikiException: JSPWiki: Unable to load and setup properties from jspwiki.properties. Failed to start managers: File /Programme/tomcat%20test/webapps/JSPWiki/WEB-INF/jspwiki.policy does not exist, or the SecurityManager prohibited access to it.
      at org.apache.wiki.WikiEngine.<init>(WikiEngine.java:440)
      at org.apache.wiki.WikiEngine.getInstance(WikiEngine.java:370)
      at org.apache.wiki.ui.WikiServletFilter.init(WikiServletFilter.java:82)
      at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
      ..

      As you can imagine, the problem is the %20 in tomcat%20test. The security manager will check if this file exists, but because of the %20, does not find anything. Of course, the correct file path would be "/Programme/tomcat test/webapps/JSPWiki/WEB-INF/jspwiki.policy".

      I debugged a little bit and think a fix could be very easy: In the AuthorizationManager, the policyFile is instantiated in line 499 using
      File policyFile = new File( policyURL.getPath() );
      The URL contains the encoded white space and getPath() unfortunately does not decode.
      Either the returned path is decoded manually or the URL is transformed into a URI (using toURI()) and then getPath() is called on the URI which returns a decoded path.
      Since this bug was not present in JSPWiki 2.8.x, I guess this URL was an URI in the past...

      Help very much appreciated, this is currently pretty much a blocker for us...

        Issue Links

          Activity

          Hide
          metskem Harry Metske added a comment -

          Fixed in 2.10.2-svn-8

          Show
          metskem Harry Metske added a comment - Fixed in 2.10.2-svn-8
          Hide
          astriffler Albrecht Striffler added a comment -

          You are right, there normally isn't any need to have a space in the location of the tomcat. My example above was just for testing exactly this bug.
          The reason why I care: I imagine a lot of people who think about using JSPWiki (or KnowWE, see d3web.de) try it out first on their private computers. There, in case of Windows, tomcat is often installed in something like C:\Program Files\tomcat... for all those people, JSPWiki will not start at the moment, and the reason why is hard to guess for most.
          I think many will move on quite quickly, if a program doesn't work at the first (or second) try.

          We used JSPWiki 2.8.x as a basis for KnowWE for something like 5 years and having white spaces in the tomcat location was never a problem. We know, because many of our developers had spaces in their IDE workspace location, causing a lot of problems when we transitioned from 2.8.x to 2.10.x. With 2.10.x, we were no longer able to start KnowWE from within the IDE...
          I've also never heard of problems with other webapps and white spaces...

          Show
          astriffler Albrecht Striffler added a comment - You are right, there normally isn't any need to have a space in the location of the tomcat. My example above was just for testing exactly this bug. The reason why I care: I imagine a lot of people who think about using JSPWiki (or KnowWE, see d3web.de) try it out first on their private computers. There, in case of Windows, tomcat is often installed in something like C:\Program Files\tomcat... for all those people, JSPWiki will not start at the moment, and the reason why is hard to guess for most. I think many will move on quite quickly, if a program doesn't work at the first (or second) try. We used JSPWiki 2.8.x as a basis for KnowWE for something like 5 years and having white spaces in the tomcat location was never a problem. We know, because many of our developers had spaces in their IDE workspace location, causing a lot of problems when we transitioned from 2.8.x to 2.10.x. With 2.10.x, we were no longer able to start KnowWE from within the IDE... I've also never heard of problems with other webapps and white spaces...
          Hide
          gmazza Glen Mazza added a comment -

          Albrecht, why would you put a space in your location for Tomcat? That usually brings up lots of headaches with WARs, not just JSPWiki...

          Show
          gmazza Glen Mazza added a comment - Albrecht, why would you put a space in your location for Tomcat? That usually brings up lots of headaches with WARs, not just JSPWiki...
          Hide
          metskem Harry Metske added a comment -

          Albrecht, thanks for reporting. I will check it out the next few days. (or maybe one of the other committers can fix it).

          Show
          metskem Harry Metske added a comment - Albrecht, thanks for reporting. I will check it out the next few days. (or maybe one of the other committers can fix it).

            People

            • Assignee:
              metskem Harry Metske
              Reporter:
              astriffler Albrecht Striffler
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development