Uploaded image for project: 'ModeShape'
  1. ModeShape
  2. MODE-2201

FileRepositoryLookup doesn't work with JAR protocol URLs

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Blocker
    • 3.7.3.Final, 4.0.0.Alpha3
    • 4.0.0.Alpha1, 4.0.0.Alpha2
    • None
    • None

    Description

      In Modeshape 3.x, you could load the repository configuration from a JAR-protocol URL (e.g. a classpath resource provided by Spring),

      (JcrRepository) jcrRepositoryFactory.getRepository(singletonMap(URL, new java.net.URL("jar:file:/Users/cabeer/.m2/repository/org/fcrepo/fcrepo-configs/4.0.0-alpha-6-SNAPSHOT-MS40/fcrepo-configs-4.0.0-alpha-6-SNAPSHOT-MS40.jar!/config/minimal-default/repository.json")));
      

      In 4.0, this same code causes a FileNotFoundException:

      Caused by: javax.jcr.RepositoryException: java.io.FileNotFoundException: jar:file:/Users/cabeer/.m2/repository/org/fcrepo/fcrepo-configs/4.0.0-alpha-6-SNAPSHOT-MS40/fcrepo-configs-4.0.0-alpha-6-SNAPSHOT-MS40.jar!/config/minimal-default/repository.json
      	at org.modeshape.jcr.JcrRepositoriesContainer$FileRepositoryLookup.loadRepositoryConfigurationFrom(JcrRepositoriesContainer.java:258) ~[modeshape-jcr-4.0.0.Alpha2.jar:4.0.0.Alpha2]
      	at org.modeshape.jcr.JcrRepositoriesContainer$FileRepositoryLookup.repository(JcrRepositoriesContainer.java:200) ~[modeshape-jcr-4.0.0.Alpha2.jar:4.0.0.Alpha2]
      	at org.modeshape.jcr.JcrRepositoriesContainer.getRepository(JcrRepositoriesContainer.java:87) ~[modeshape-jcr-4.0.0.Alpha2.jar:4.0.0.Alpha2]
      	at org.modeshape.jcr.JcrRepositoryFactory.getRepository(JcrRepositoryFactory.java:123) ~[modeshape-jcr-4.0.0.Alpha2.jar:4.0.0.Alpha2]
      

      It looks like this regression was introduced by https://github.com/ModeShape/modeshape/commit/e8c2b5280b33408f233f2823c1740ebc6959e6ac#diff-bcb982f4f76f09117e82a5551fab5931L204.

      Before this change, the RepositoryConfiguration.read(URL) method (https://github.com/ModeShape/modeshape/blob/master/modeshape-jcr/src/main/java/org/modeshape/jcr/RepositoryConfiguration.java#L761) was called and correctly resolved the jar:file URL. After the change, RepositoryConfiguration.read( String ) is invoked instead and cannot resolve the URL.

      Attachments

        Activity

          People

            rhauch Randall Hauch (Inactive)
            cbeer_jira Chris Beer (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: