[ 
https://issues.apache.org/jira/browse/OPENEJB-1059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12742593#action_12742593
 ] 

David Blevins commented on OPENEJB-1059:
----------------------------------------

The broken code from DeploymentLoader with added comments:

    @SuppressWarnings({"unchecked"})
    protected static void addPersistenceUnits(AppModule appModule, URL... urls) 
{
        try {
            // any class loader will do here since we are not calling class 
loading methods of resource finder
            ResourceFinder finder = new ResourceFinder("", 
ClassLoader.getSystemClassLoader(), urls);
            
            // OPENEJB-1059: Anything in the appModule.getAltDDs() map has 
already been processed by the 
            // altdd code, so anything in here should not cause OPENEJB-1059
            List<URL> persistenceUrls = (List<URL>) 
appModule.getAltDDs().get("persistence.xml");
            if (persistenceUrls == null) {
                persistenceUrls = new ArrayList<URL>();
                appModule.getAltDDs().put("persistence.xml", persistenceUrls);
            }
            
            // OPENEJB-1059: This would definitely cause the OPENEJB-1059 issue.
            // Something similar to what is do in discoverModuleType might work
            // i.e. it does Map<String, URL> descriptors = 
altDDSources(finder.getResourcesMap("META-INF/"), false);
            // though we would want to log.  Tricky thing is we don't want to 
log the replacement twice.
            // Maybe we need update the logging so that it doesn't log if the 
url it's replacing is the same.
            // All this is a little strange as here the other entries in the 
altDd map are [fileName => URL] entries
            // but the persistence.xml entry is [fileName => List<URL>].  Would 
really have to look closely at the
            // code to see if that posses a challenge.
            persistenceUrls.addAll(finder.findAll("META-INF/persistence.xml"));
        } catch (IOException e) {
            logger.warning("Cannot load persistence-units from 
'META-INF/persistence.xml' : " + e.getMessage(), e);
        }
    }


> altdd support seems broken for persistence.xml files
> ----------------------------------------------------
>
>                 Key: OPENEJB-1059
>                 URL: https://issues.apache.org/jira/browse/OPENEJB-1059
>             Project: OpenEJB
>          Issue Type: Bug
>    Affects Versions: 3.1.1
>         Environment: win xp
>            Reporter: Jean-Louis MONTEIRO
>             Fix For: 3.1.2
>
>
> As reported by Marrck in the user's list 
> http://www.nabble.com/openejb.altdd.prefix-not-working-for-persistence.xml-to24926543.html
> altdd support potentially contains a bug with persistence.xml files.
> The issue seems located in DeploymentLoader.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to