Author: pcl
Date: Wed Jun 11 17:00:06 2008
New Revision: 666921
URL: http://svn.apache.org/viewvc?rev=666921&view=rev
Log:
Merge from ../branches/1.1.x. svn merge -c 657162 ../branches/1.1.x
Modified:
openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/CacheMarshallerImpl.java
openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/conf/localizer.properties
Modified:
openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/CacheMarshallerImpl.java
URL:
http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/CacheMarshallerImpl.java?rev=666921&r1=666920&r2=666921&view=diff
==============================================================================
---
openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/CacheMarshallerImpl.java
(original)
+++
openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/CacheMarshallerImpl.java
Wed Jun 11 17:00:06 2008
@@ -28,6 +28,8 @@
import java.io.OutputStream;
import java.net.URL;
import java.util.Enumeration;
+import java.util.List;
+import java.util.ArrayList;
import org.apache.openjpa.lib.conf.Configurable;
import org.apache.openjpa.lib.conf.Configuration;
@@ -218,15 +220,28 @@
try {
ClassLoader cl = _conf.getClassResolverInstance()
.getClassLoader(getClass(), null);
+ List list = new ArrayList();
for (Enumeration e = cl.getResources(_inputResourceLocation);
- e.hasMoreElements(); ) {
- if (_inputURL == null)
- _inputURL = (URL) e.nextElement();
- else
+ e.hasMoreElements(); )
+ list.add(e);
+
+ if (list.size() > 1) {
+ if (_consumeErrors) {
+ if (_log.isWarnEnabled())
+ _log.warn(_loc.get(
+ "cache-marshaller-multiple-resources-warn",
+ getId(), _inputResourceLocation, list)
+ .getMessage());
+ } else {
throw new IllegalStateException(
_loc.get("cache-marshaller-multiple-resources",
- getId(), _inputResourceLocation).getMessage());
+ getId(), _inputResourceLocation, list)
+ .getMessage());
+ }
}
+
+ if (!list.isEmpty())
+ _inputURL = (URL) list.get(0);
} catch (IOException ioe) {
IllegalStateException ise = new IllegalStateException(
_loc.get("cache-marshaller-bad-url", getId(),
Modified:
openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/conf/localizer.properties
URL:
http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/conf/localizer.properties?rev=666921&r1=666920&r2=666921&view=diff
==============================================================================
---
openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/conf/localizer.properties
(original)
+++
openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/conf/localizer.properties
Wed Jun 11 17:00:06 2008
@@ -572,7 +572,9 @@
InputResource were specified for CacheMarshaller {0}. At most one of these
\
can be specified.
cache-marshaller-multiple-resources: Multiple resources exist for resource \
- location {1} for CacheMarshaller {0}.
+ location {1} for CacheMarshaller {0}: {2}.
+cache-marshaller-multiple-resources-warn: Multiple resources exist for
resource\
+ location {1} for CacheMarshaller {0}: {2}. The first one will be used.
cache-marshaller-bad-url: An error occurred while loading resource location \
{1} for CacheMarshaller {0}.
cache-marshaller-null-validation-policy: No ValidationPolicy was set for \