javaserverfaces
  1. javaserverfaces
  2. JAVASERVERFACES-2387

Mojarra 2.1.x fails to start if there are a META-INF/faces-config.xml with blanks in their path

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.7
    • Fix Version/s: 2.1.8, 2.2.0-m02
    • Component/s: None
    • Labels:
      None
    • Environment:

      JDK 6, Jsf-api 2.1.7 & jsf-impl 2.1.7 (Mojarra), Tomcat 7.0, eclipse indigo

      Description

      Hi,

      When I put my project in the directory C:\Program Files\...\myproject, (with a white space in program Files), the console logs errors when the application start in tomcat :

       
      Error tomcat
      GRAVE: Critical error during deployment: 
      com.sun.faces.config.ConfigurationException: java.util.concurrent.ExecutionException: javax.faces.FacesException: java.net.URISyntaxException: Illegal character in path at index 16: file:/C:/Program Files/Developpements/eclipse-indigo/workspace2/JavaServerFaces2/target/classes/META-INF/sphinx-el-functions.taglib.xml
      	at com.sun.faces.config.ConfigManager.getConfigDocuments(ConfigManager.java:662)
      [...]
      
      Caused by: java.net.URISyntaxException: Illegal character in path at index 16: file:/C:/Program Files/Developpements/eclipse-indigo/workspace2/JavaServerFaces2/target/classes/META-INF/sphinx-el-functions.taglib.xml
      	at java.net.URI$Parser.fail(URI.java:2809)
      	at java.net.URI$Parser.checkChars(URI.java:2982)
      	at java.net.URI$Parser.parseHierarchical(URI.java:3066)
      	at java.net.URI$Parser.parse(URI.java:3014)
      	at java.net.URI.<init>(URI.java:578)
      	at com.sun.faces.config.configprovider.MetaInfFaceletTaglibraryConfigProvider.pruneURLs(MetaInfFaceletTaglibraryConfigProvider.java:144)
      	... 16 more
      [...]
      GRAVE: Unexpected exception when attempting to tear down the Mojarra runtime
      java.lang.IllegalStateException: Could not find backup for factory javax.faces.application.ApplicationFactory.
      

      When I move my project in the directory C:\temp\myprojet (directories without white space), everything is fine! We can do that easily in eclipse with the option Refactor/Move (Alt+Shift+V) on the project.
      I joined the war file in this jira.

      The first Jira of this problem is http://java.net/jira/browse/JAVASERVERFACES-2057?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=337794

      Thanks

      1. changebundle.txt
        2 kB
        Manfred Riem
      2. Issue2387.diff
        1 kB
        Manfred Riem

        Activity

        Hide
        BHMulder added a comment -

        This issue still exists for WEB-INF locations, even in 2.1.13. I have tested and verified this with JSF 2.1.13 and Websphere 8.
        The problem is that this issue was fixed only for META-INF locations: the basic Base
        Also, I see lots of places where URL.toExternalForm is used to initialize an URI, without any consideration of escaping invalid characters. As such, this issue should be cloned or reopened.

        Steps to reproduce:

        • Install Websphere in 'Program Files' location
        • Place faces-config.xml in your applications WEB-INF/ directory
        • Start and check your error log: the application seems to start but will fail on attempting to access any webpage.

        Problem location:
        BaseWebConfigResourceProvider uses

         result = new URI(url.toExternalForm());
        

        in its getContextURLForPath method.

        Show
        BHMulder added a comment - This issue still exists for WEB-INF locations, even in 2.1.13. I have tested and verified this with JSF 2.1.13 and Websphere 8. The problem is that this issue was fixed only for META-INF locations: the basic Base Also, I see lots of places where URL.toExternalForm is used to initialize an URI, without any consideration of escaping invalid characters. As such, this issue should be cloned or reopened. Steps to reproduce: Install Websphere in 'Program Files' location Place faces-config.xml in your applications WEB-INF/ directory Start and check your error log: the application seems to start but will fail on attempting to access any webpage. Problem location: BaseWebConfigResourceProvider uses result = new URI(url.toExternalForm()); in its getContextURLForPath method.
        Hide
        Neil Griffin added a comment -

        Agreed – I was just able to reproduce this with Mojarra 2.1.19 and WebSphere 8.0 running on Windows XP.

        Here is the fix for loading WEB-INF/faces-config.xml when it lives inside of "C:\Program Files"

        Index: jsf-ri/src/main/java/com/sun/faces/config/configprovider/BaseWebConfigResourceProvider.java
        ===================================================================
        — jsf-ri/src/main/java/com/sun/faces/config/configprovider/BaseWebConfigResourceProvider.java (revision 11648)
        +++ jsf-ri/src/main/java/com/sun/faces/config/configprovider/BaseWebConfigResourceProvider.java (working copy)
        @@ -119,7 +119,9 @@
        try {
        URL url = context.getResource(path);
        if (null != url)

        { - result = new URI(url.toExternalForm()); + String urlString = url.toExternalForm(); + urlString = urlString.replaceAll(" ", "%20"); + result = new URI(urlString); }

        } catch (MalformedURLException mue) {
        throw new FacesException(mue);

        Show
        Neil Griffin added a comment - Agreed – I was just able to reproduce this with Mojarra 2.1.19 and WebSphere 8.0 running on Windows XP. Here is the fix for loading WEB-INF/faces-config.xml when it lives inside of "C:\Program Files" Index: jsf-ri/src/main/java/com/sun/faces/config/configprovider/BaseWebConfigResourceProvider.java =================================================================== — jsf-ri/src/main/java/com/sun/faces/config/configprovider/BaseWebConfigResourceProvider.java (revision 11648) +++ jsf-ri/src/main/java/com/sun/faces/config/configprovider/BaseWebConfigResourceProvider.java (working copy) @@ -119,7 +119,9 @@ try { URL url = context.getResource(path); if (null != url) { - result = new URI(url.toExternalForm()); + String urlString = url.toExternalForm(); + urlString = urlString.replaceAll(" ", "%20"); + result = new URI(urlString); } } catch (MalformedURLException mue) { throw new FacesException(mue);
        Hide
        Neil Griffin added a comment -

        Opened new issue: JAVASERVERFACES-2765

        Show
        Neil Griffin added a comment - Opened new issue: JAVASERVERFACES-2765
        Hide
        Ed Burns added a comment -

        r11679 | mriem | 2013-03-01 10:02:59 -0500 (Fri, 01 Mar 2013) | 1 line

        Fixes http://java.net/jira/browse/JAVASERVERFACES-2765, r=mriem, another fix for Windows directory path issues
        ------------------------------------

        Show
        Ed Burns added a comment - r11679 | mriem | 2013-03-01 10:02:59 -0500 (Fri, 01 Mar 2013) | 1 line Fixes http://java.net/jira/browse/JAVASERVERFACES-2765 , r=mriem, another fix for Windows directory path issues ------------------------------------
        Hide
        Ed Burns added a comment -

        r11679 is the revision on the 2.1.x branch.

        Show
        Ed Burns added a comment - r11679 is the revision on the 2.1.x branch.

          People

          • Assignee:
            Manfred Riem
            Reporter:
            margasy
          • Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: