Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-dev] Fix for bug 210280:(ready for review) Persistence unit not found when persistence.xml is in file path with spaces

EclipseLink committers,
    The following JPA patch is available for review.
 
    https://bugs.eclipse.org/210280
 
    Description:
        When a PU is in a path that includes spaces, these spaces are represented internally in URL objects as an encoded %20.
        This encoding is causing problems later when finding the PU.
        The problem turned out to be that the key lookup was using the decoded (" ") version - while the insert into the HashMap<String, EntityManagerSetupImpl> used an encoded ("%20") key - the EMSetup was never found.
 

The fix is to replace the following line with one that reuses the already decoded [puName] which does not use %20 for spaces.
before:
EntityManagerFactoryProvider.addEntityManagerSetupImpl(persistenceUnitInfo.getPersistenceUnitRootUrl()+persistenceUnitInfo.getPersistenceUnitName(),
emSetupImpl);
after:
EntityManagerFactoryProvider.addEntityManagerSetupImpl(puName, emSetupImpl);
 

    Code Reviewed by:
        Andrei I.
 
    Please review when you have a chance and send any feedback, thank you
    thank you
    /michael

 

Back to the top