Merge from ../branches/1.1.x. svn merge -c 657162 ../branches/1.1.x

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@666921 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Patrick Linskey 2008-06-12 00:00:06 +00:00
parent 06ab9692d5
commit 90332224f7
2 changed files with 23 additions and 6 deletions

View File

@ -28,6 +28,8 @@ import java.io.ObjectOutputStream;
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 @@ public class CacheMarshallerImpl
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(),

View File

@ -572,7 +572,9 @@ cache-marshaller-input-url-and-resource-specified: An InputURL and an \
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 \