[hibernate-issues] [Hibernate-JIRA] Created: (HHH-6442) JarVisitorFactory is reconstructing URLs without the URLStreamHandler association

Andrew Lee Rubinger (JIRA) noreply at atlassian.com
Thu Jul 14 14:27:14 EDT 2011


JarVisitorFactory is reconstructing URLs without the URLStreamHandler association
---------------------------------------------------------------------------------

                 Key: HHH-6442
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6442
             Project: Hibernate Core
          Issue Type: Bug
          Components: entity-manager
    Affects Versions: 4.0.0.Beta3
            Reporter: Andrew Lee Rubinger


Problem in:

https://github.com/ALRubinger/hibernate-core/blob/master/hibernate-entitymanager/src/main/java/org/hibernate/ejb/packaging/JarVisitorFactory.java#L88

URLs, in order to be opened, must have an associated stream handler for a known protocol.  In the case that the protocol is not handled by Java built-in, the handler must either be attached to the URL instance or able to be looked up through the (IMO horribly designed) URL handler registration process.

This line reconstructs a URL (which may have the URLStreamHandler association in place) into a new instance, leaving behind the handler in the process.  Nonstandard protocols will cease to work, as we now see in this test case from ShrinkWrap, for example:

{code}final URL resource = shrinkWrapClassLoader.getResource(resourceName);
      // Great, we already have a working URL.

      // Now reconstruct the URL by composition of its pieces
      try
      {
         new URL(resource.getProtocol(), resource.getHost(), resource.getPort(), resource.getFile());
      }
      catch (final MalformedURLException murle)
      {
         // Blow up
         Assert.fail("Malformed URL should not be received when reconstructing a new URL from pieces of the one we already have");
      }{code}

Recommend we fix at the Hibernate level to properly resolve issues such as:

https://issues.jboss.org/browse/ARQ-510

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list