[hibernate-issues] [Hibernate-JIRA] Updated: (EJB-226) JarVistor.getVisitor does not handle paths containing spaces correctly for an exploded par

Emmanuel Bernard (JIRA) noreply at atlassian.com
Fri Nov 24 07:30:04 EST 2006


     [ http://opensource.atlassian.com/projects/hibernate/browse/EJB-226?page=all ]

Emmanuel Bernard updated EJB-226:
---------------------------------

    Fix Version: 3.2.1

> JarVistor.getVisitor does not handle paths containing spaces correctly for an exploded par
> ------------------------------------------------------------------------------------------
>
>          Key: EJB-226
>          URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-226
>      Project: Hibernate Entity Manager
>         Type: Bug

>   Components: EntityManager
>     Versions: 3.2.0.cr2
>  Environment: Hibernate 3.2.0,  Hibernate Annotations 3.2.0.cr2 on Windows XP
>     Reporter: Michael Falco
>      Fix For: 3.2.1

>
>
> I found from the JIRA database that EJB-178 and EJB-181 were written regarding the issue of the Entity Manager not handling paths with spaces in them correctly, and they both are in the 'resolved' state.  However, in 3.2.0.cr2 of the EntityManager, I still get  this error when running the PackagedEntityManagerTest testExplodedPar JUnit test from a root directory that contains spaces:
> 12:20:34,331 DEBUG JarVisitor:192 - Searching mapped entities in jar/par: file:/D:/User%20Data/Eclipse_Workspaces/Test/HibernateEntityManagerTest/build/testresources/explodedpar.par
> 12:20:34,346  WARN FileZippedJarVisitor:37 - Unable to find file (ignored): file:/D:/User%20Data/Eclipse_Workspaces/Test/HibernateEntityManagerTest/build/testresources/explodedpar.par
> java.util.zip.ZipException: Access is denied
> 	at java.util.zip.ZipFile.open(Native Method)
> 	at java.util.zip.ZipFile.<init>(ZipFile.java:203)
> 	at java.util.jar.JarFile.<init>(JarFile.java:132)
> 	at java.util.jar.JarFile.<init>(JarFile.java:70)
> 	at org.hibernate.ejb.packaging.FileZippedJarVisitor.doProcessElements(FileZippedJarVisitor.java:34)
> 	at org.hibernate.ejb.packaging.JarVisitor.getMatchingEntries(JarVisitor.java:215)
> 	at org.hibernate.ejb.Ejb3Configuration.addMetadataFromVisitor(Ejb3Configuration.java:251)
> 	at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:227)
> 	at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:120)
> 	at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:37)
> 	at org.hibernate.ejb.test.PackagedEntityManagerTest.testExplodedPar(PackagedEntityManagerTest.java:110)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at junit.framework.TestCase.runTest(TestCase.java:154)
> 	at junit.framework.TestCase.runBare(TestCase.java:127)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at junit.framework.TestSuite.runTest(TestSuite.java:208)
> 	at junit.framework.TestSuite.run(TestSuite.java:203)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> After looking at the EJB-178 and EJB-181 errors and the code, it appears that what happened was that EJB-178 was closed as a duplicate of EJB-181, but they are not the same error.  It is the same jarUrl.getFile()  call that causes the problem, but it is in different code:  EJB-178 covers the org.hibernate.ejb.packaging.JarVisitor.getVisitor() method, whereas EJB-181 covers the  org.hibernate.ejb.packaging.ExplodedJarVisitor.doProcessElements() .
> The source code shows that EJB-181 was fixed but EJB-178 was not.  I put the fix in to the JarVisitor.getVisitor() method (changed jar Url.getFile() to jarUrl.toURI().getSchemeSpecificPart() and added exception handling) and rebuilt the Entity Manager jar.  I then reran the PackagedEntityManagerTest testExplodedPar JUnit test using the new jar, and the JUnit passed.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira




More information about the hibernate-issues mailing list