General defensiveness about the bootstrap ClassLoader (i.e. null ClassLoader)

Issue: SPR-11721
(cherry picked from commit 59cef3c)
This commit is contained in:
Juergen Hoeller
2014-04-28 00:26:18 +02:00
parent ce1954da1e
commit 6cb45f714e
20 changed files with 124 additions and 129 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -98,7 +98,7 @@ public class StandardTypeLocator implements TypeLocator {
public Class<?> findType(String typeName) throws EvaluationException {
String nameToLookup = typeName;
try {
return this.classLoader.loadClass(nameToLookup);
return ClassUtils.forName(nameToLookup, this.classLoader);
}
catch (ClassNotFoundException ey) {
// try any registered prefixes before giving up
@@ -106,7 +106,7 @@ public class StandardTypeLocator implements TypeLocator {
for (String prefix : this.knownPackagePrefixes) {
try {
nameToLookup = prefix + "." + typeName;
return this.classLoader.loadClass(nameToLookup);
return ClassUtils.forName(nameToLookup, this.classLoader);
}
catch (ClassNotFoundException ex) {
// might be a different prefix