0 Replies Latest reply on Jan 8, 2007 7:31 PM by Bryan Noll

    Fix for org.jboss.util.file.ArchiveBrowser

    Bryan Noll Newbie

      I'm not sure that this is the best place to post this, but I ran into the problem when doing JPA stuff, so this is where I came. If it needs to be moved, please do so.

      The class org.jboss.util.file.ArchiveBrowser in jboss-archive-browsing-5.0.0alpha-200607201-119.jar seems to puke when the 'getBrowser' method encounters whitespace. It looks like this was a bug once upon a time (as per http://jira.jboss.com/jira/browse/JBCOMMON-1) that has resurfaced.

      The offending lines are:

       File file = null;
       try
       {
       file = new File(new URI(url.toString()));
       }
       catch(URISyntaxException urisyntaxexception)
       {
       throw new RuntimeException("Not a valid URL: " + url, urisyntaxexception);
       }


      The change should be as easy as saying...
      file = new File (new URI(url.toString().replace(" ", "+")));
      


      There may be some utility down in the jboss common code or other open source library that I'm not aware of that encapsulates this functionality.

      This is occurring when trying to run tests in a maven 2 project, and those tests depend on and refer to a jar in my local repo that contains the annotated persistent entities. I'm working on a Windows machine, so unfortunately, that jar lives in 'C:\Documents and Settings', which is causing the problem. I tried it on a mac, where my m2 repo doesn't contain a space, and it works just fine.

      Here is a portion of the stack trace:

      Caused by: java.lang.RuntimeException: Not a valid URL: file:/C:/Documents and Settings/bnoll/.m2/repository/org/appfuse/appfuse-jpa-common-working/2.0-SNAPSHOT/appfuse-jpa-common-working-2.0-SNAPSHOT.jar
      at org.jboss.util.file.ArchiveBrowser.getBrowser(Unknown Source)
      at org.hibernate.ejb.Ejb3Configuration.scanForClasses(Ejb3Configuration.java:610)
      ... 38 more