openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Heath Thomann (Created) (JIRA)" <>
Subject [jira] [Created] (OPENJPA-2102) URLs which contains spaces are not properly handled by OpenJPA.
Date Wed, 28 Dec 2011 04:57:30 GMT
URLs which contains spaces are not properly handled by OpenJPA.

                 Key: OPENJPA-2102
             Project: OpenJPA
          Issue Type: Bug
    Affects Versions: 2.0.3, 2.1.2, 2.2.0
            Reporter: Heath Thomann
            Assignee: Heath Thomann
            Priority: Minor

Take the following lines of code in AbstractCFMetaDataFactory:

if (puUrlString != null && urlString.indexOf(puUrlString) != -1)

When either 'urlString' of puUrlString is encoded, and the other is not, the 'indexOf' will
fail even if the URLs are the same if both are either encoded or decoded.  Let me explain:
The 'urlString' is effectively obtained from the ClassLoader, and the puUrlString is obtained
from the OpenJPA configuration.  If the user's URL path contains spaces in it (' '), the URL
may be encoded with '%20' (see the URL and URI javadoc).  The Classloader is likely to return
encoded URLs.  However, given that the two URLs come from different places, it is not guaranteed
that both URLs will be encoded.  If one URL is encoded (e.g. encoded with a %20 for spaces)
and the other URL is not encoded (e.g. the URL contains spaces), the above 'indexOf' will
fail even though technically the two URLs may ultimately represent the same location when
both are encoded (or decoded).  When the 'indexOf' fails the URL is not added to the list
of URLs to process which has downstream effects in that necessary meta data is missing.  For
example, in the issue I'm working I saw the following exception due to missing meta data:

Caused by: org.apache.openjpa.persistence.ArgumentException: Type       
"class testcases.res.ejb.subscriber.SubscriberBehavior" loaded by[appwar:RES Test      
   Local ClassPath: .......                         
   does not have persistence metadata.     
 at org.apache.openjpa.jdbc.meta.MappingTool.getMapping(                                                               
 at org.apache.openjpa.jdbc.meta.MappingTool.buildSchema(                                                               
 at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(                                            
 at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(                                            
 at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.newBrokerImpl(                                            
 at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(                                        
 at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(                                      
 at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(                  


Heath Thomann

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message