Using ClassUtils.forName rather than Class.forName
This commit is contained in:
@@ -30,6 +30,7 @@ import javax.xml.soap.SOAPMessage;
|
||||
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.xml.namespace.QNameUtils;
|
||||
import org.w3c.dom.Element;
|
||||
@@ -56,7 +57,7 @@ public abstract class SaajUtils {
|
||||
|
||||
static {
|
||||
try {
|
||||
Class.forName(SAAJ_13_CLASS_NAME);
|
||||
ClassUtils.forName(SAAJ_13_CLASS_NAME);
|
||||
saajVersion = SAAJ_13;
|
||||
}
|
||||
catch (ClassNotFoundException ex) {
|
||||
|
||||
@@ -21,6 +21,7 @@ import javax.xml.bind.UnmarshalException;
|
||||
import javax.xml.bind.ValidationException;
|
||||
|
||||
import org.springframework.oxm.XmlMappingException;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
* Generic utility methods for working with JAXB. Mainly for internal use within the framework.
|
||||
@@ -39,7 +40,7 @@ public abstract class JaxbUtils {
|
||||
|
||||
static {
|
||||
try {
|
||||
Class.forName(JAXB_2_CLASS_NAME);
|
||||
ClassUtils.forName(JAXB_2_CLASS_NAME);
|
||||
jaxbVersion = JAXB_2;
|
||||
}
|
||||
catch (ClassNotFoundException ex1) {
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package org.springframework.xml;
|
||||
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
* Helper class used to find the current version of JAXP. We cannot depend on the Java version, since JAXP can be
|
||||
* upgraded idenpendantly of the Java version.
|
||||
@@ -45,17 +47,17 @@ public abstract class JaxpVersion {
|
||||
|
||||
static {
|
||||
try {
|
||||
Class.forName(JAXP_14_CLASS_NAME);
|
||||
ClassUtils.forName(JAXP_14_CLASS_NAME);
|
||||
jaxpVersion = JAXP_14;
|
||||
}
|
||||
catch (ClassNotFoundException ex1) {
|
||||
try {
|
||||
Class.forName(JAXP_13_CLASS_NAME);
|
||||
ClassUtils.forName(JAXP_13_CLASS_NAME);
|
||||
jaxpVersion = JAXP_13;
|
||||
}
|
||||
catch (ClassNotFoundException ex2) {
|
||||
try {
|
||||
Class.forName(JAXP_11_CLASS_NAME);
|
||||
ClassUtils.forName(JAXP_11_CLASS_NAME);
|
||||
jaxpVersion = JAXP_11;
|
||||
}
|
||||
catch (ClassNotFoundException ex3) {
|
||||
@@ -66,7 +68,7 @@ public abstract class JaxpVersion {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the major JAXP version. This means we can do things like if <code>(getJaxpVersion() < JAXP_13)</code>.
|
||||
* Gets the JAXP version. This means we can do things like if <code>(getJaxpVersion() < JAXP_13)</code>.
|
||||
*
|
||||
* @return a code comparable to the JAXP_XX codes in this class
|
||||
* @see #JAXP_10
|
||||
|
||||
@@ -22,6 +22,7 @@ import java.util.Map;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.xml.JaxpVersion;
|
||||
|
||||
/**
|
||||
@@ -52,7 +53,7 @@ public abstract class XPathExpressionFactory {
|
||||
logger.info("JAXP 1.3 available");
|
||||
}
|
||||
try {
|
||||
Class.forName(JAXEN_CLASS_NAME);
|
||||
ClassUtils.forName(JAXEN_CLASS_NAME);
|
||||
jaxenAvailable = true;
|
||||
logger.info("Jaxen available");
|
||||
}
|
||||
@@ -60,7 +61,7 @@ public abstract class XPathExpressionFactory {
|
||||
jaxenAvailable = false;
|
||||
}
|
||||
try {
|
||||
Class.forName(XALAN_XPATH_CLASS_NAME);
|
||||
ClassUtils.forName(XALAN_XPATH_CLASS_NAME);
|
||||
xalanXPathAvailable = true;
|
||||
logger.info("Xalan available");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user