Author: tveronezi
Date: Thu Nov 17 22:51:35 2011
New Revision: 1203408
URL: http://svn.apache.org/viewvc?rev=1203408&view=rev
Log:
fix: https://issues.apache.org/jira/browse/OPENEJB-1710
Modified:
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
Modified:
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
URL:
http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java?rev=1203408&r1=1203407&r2=1203408&view=diff
==============================================================================
---
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
(original)
+++
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
Thu Nov 17 22:51:35 2011
@@ -1193,7 +1193,21 @@ public class DeploymentLoader implements
// 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");
+ List<URL> persistenceUrls = null;
+ try {
+ persistenceUrls = (List<URL>)
appModule.getAltDDs().get("persistence.xml");
+ } catch (ClassCastException e) {
+ //That happens when we are trying to deploy an ear file.
+ final Object value = appModule.getAltDDs().get("persistence.xml");
+ if(!URL.class.isInstance(value)) {
+ throw e;
+ }
+
+ persistenceUrls = new ArrayList<URL>();
+ persistenceUrls.add(URL.class.cast(value));
+
+ appModule.getAltDDs().put("persistence.xml", persistenceUrls);
+ }
if (persistenceUrls == null) {
persistenceUrls = new ArrayList<URL>();
appModule.getAltDDs().put("persistence.xml", persistenceUrls);