Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-dev] RE:210380: (test cases patch) Persistence unit not found when persistence.xml is in file path with spaces

EclipseLink members,
    The following jpa.test patch is available for review for the following bug.
    This change modifies the jpa.test build.xml script.
 
https://bugs.eclipse.org/210280
https://bugs.eclipse.org/bugs/attachment.cgi?id=93372&action="">
 
    New Jars:
        eclipselink-pu with spaces.jar
        eclipselink-pu-with-multibyte-á-char.jar
    New Test Cases:   
        Testing for PU with names and/or paths containing %20 spaces or multibyte chars such as &C3A1; = á
 
     * UC1 - EM has no spaces or multi-byte chars in name or path
     * UC2 - EM has spaces hex(20) in EM name but not in path
     * UC3/4 are fixed by 210280 - the other UC tests are for regression
     * UC3 - EM has spaces in path but not in the EM name
     * UC4 - EM has spaces in path and EM name
     * UC5 - EM has multi-byte hex(C3A1) chars in EM name but not in path
     * Keep resource with spaces and multibyte chars separate
     * UC6 - EM has multi-byte chars in path but not EM name
     * UC7 - EM has multi-byte chars in path and EM name
     * UC8 - EM has spaces and multi-byte chars in EM name but not in path
     * UC9 - EM has spaces and multi-byte chars in path and EM name

    thank you
    /michael
-----Original Message-----
From: Michael O'Brien [mailto:michael.obrien@xxxxxxxxxx]
Sent: Thursday, March 20, 2008 16:41
To: 'Eclipselink-Dev (E-mail)'
Subject: 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