You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by ve...@apache.org on 2010/09/29 22:40:23 UTC
svn commit: r1002840 - in
/webservices/commons/trunk/modules/axiom/modules/axiom-api: pom.xml
src/test/java/org/apache/axiom/util/stax/dialect/DialectTest.java
src/test/resources/org/apache/axiom/util/stax/dialect/com.ibm.ws.runtime.properties
Author: veithen
Date: Wed Sep 29 20:40:22 2010
New Revision: 1002840
URL: http://svn.apache.org/viewvc?rev=1002840&view=rev
Log:
Fixed the WAS 7 profile. It was actually testing the right thing, but in the wrong way.
Removed:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/resources/org/apache/axiom/util/stax/dialect/com.ibm.ws.runtime.properties
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-api/pom.xml
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/DialectTest.java
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/pom.xml
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/pom.xml?rev=1002840&r1=1002839&r2=1002840&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/pom.xml (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/pom.xml Wed Sep 29 20:40:22 2010
@@ -283,12 +283,17 @@
<configuration>
<outputDirectory>${project.build.directory}/parsers</outputDirectory>
<resources>
+ <!-- XLXP 1 -->
+ <resource>
+ <directory>${was7.root}/java/jre/lib</directory>
+ <includes>
+ <include>xml.jar</include>
+ </includes>
+ </resource>
+ <!-- XLXP 2 -->
<resource>
<directory>${was7.root}/plugins</directory>
<includes>
- <!-- XLXP 1 -->
- <include>com.ibm.ws.runtime.jar</include>
- <!-- XLXP 2 -->
<include>com.ibm.ws.prereq.xlxp.jar</include>
</includes>
</resource>
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/DialectTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/DialectTest.java?rev=1002840&r1=1002839&r2=1002840&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/DialectTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/dialect/DialectTest.java Wed Sep 29 20:40:22 2010
@@ -164,26 +164,30 @@ public class DialectTest extends TestSui
XMLInputFactory newXMLInputFactory() {
String className = props == null ? null : props.getProperty(XMLInputFactory.class.getName());
+ XMLInputFactory factory;
if (className == null) {
ClassLoader savedClassLoader = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(classLoader);
try {
- XMLInputFactory factory = XMLInputFactory.newInstance();
- if (classLoader != ClassLoader.getSystemClassLoader()
- && factory.getClass().getClassLoader() != classLoader) {
- throw new FactoryConfigurationError("Wrong factory!");
- }
- return factory;
+ factory = XMLInputFactory.newInstance();
} finally {
Thread.currentThread().setContextClassLoader(savedClassLoader);
}
} else {
try {
- return (XMLInputFactory)classLoader.loadClass(className).newInstance();
+ factory = (XMLInputFactory)classLoader.loadClass(className).newInstance();
} catch (Exception ex) {
throw new FactoryConfigurationError(ex);
}
}
+ // Check that the parser has actually been loaded from the expected class loader.
+ // If the parser has been loaded from the JRE, then comparing the class loaders
+ // is not reliable (because it may be null). Hence the check on ParentLastURLClassLoader.
+ if (classLoader instanceof ParentLastURLClassLoader
+ && factory.getClass().getClassLoader() != classLoader) {
+ throw new FactoryConfigurationError("Wrong factory!");
+ }
+ return factory;
}
XMLInputFactory newNormalizedXMLInputFactory() {
@@ -196,26 +200,27 @@ public class DialectTest extends TestSui
XMLOutputFactory newXMLOutputFactory() {
String className = props == null ? null : props.getProperty(XMLOutputFactory.class.getName());
+ XMLOutputFactory factory;
if (className == null) {
ClassLoader savedClassLoader = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(classLoader);
try {
- XMLOutputFactory factory = XMLOutputFactory.newInstance();
- if (classLoader != ClassLoader.getSystemClassLoader()
- && factory.getClass().getClassLoader() != classLoader) {
- throw new FactoryConfigurationError("Wrong factory!");
- }
- return factory;
+ factory = XMLOutputFactory.newInstance();
} finally {
Thread.currentThread().setContextClassLoader(savedClassLoader);
}
} else {
try {
- return (XMLOutputFactory)classLoader.loadClass(className).newInstance();
+ factory = (XMLOutputFactory)classLoader.loadClass(className).newInstance();
} catch (Exception ex) {
throw new FactoryConfigurationError(ex);
}
}
+ if (classLoader != ClassLoader.getSystemClassLoader()
+ && factory.getClass().getClassLoader() != classLoader) {
+ throw new FactoryConfigurationError("Wrong factory!");
+ }
+ return factory;
}
XMLOutputFactory newNormalizedXMLOutputFactory() {