Fix #100 - HAPI failed to initialize in an environment without Woodstox
on the classpath. Will deploy a new snapshot shortly.
This commit is contained in:
parent
a474870a1e
commit
37e2abb4e2
|
@ -210,10 +210,14 @@ public class XmlUtil {
|
||||||
* Note that these properties are Woodstox specific and they cause a crash in environments where SJSXP is
|
* Note that these properties are Woodstox specific and they cause a crash in environments where SJSXP is
|
||||||
* being used (e.g. glassfish) so we don't set them there.
|
* being used (e.g. glassfish) so we don't set them there.
|
||||||
*/
|
*/
|
||||||
|
try {
|
||||||
if (inputFactory instanceof com.ctc.wstx.stax.WstxInputFactory) {
|
Class.forName("com.ctc.wstx.stax.WstxOutputFactory");
|
||||||
// inputFactory.setProperty(WstxInputFactory.IS_REPLACING_ENTITY_REFERENCES, false);
|
if (inputFactory instanceof com.ctc.wstx.stax.WstxInputFactory) {
|
||||||
inputFactory.setProperty(WstxInputProperties.P_UNDECLARED_ENTITY_RESOLVER, XML_RESOLVER);
|
// inputFactory.setProperty(WstxInputFactory.IS_REPLACING_ENTITY_REFERENCES, false);
|
||||||
|
inputFactory.setProperty(WstxInputProperties.P_UNDECLARED_ENTITY_RESOLVER, XML_RESOLVER);
|
||||||
|
}
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
ourLog.debug("WstxOutputFactory (Woodstox) not found on classpath");
|
||||||
}
|
}
|
||||||
ourInputFactory = inputFactory;
|
ourInputFactory = inputFactory;
|
||||||
}
|
}
|
||||||
|
@ -317,8 +321,13 @@ public class XmlUtil {
|
||||||
* Note that these properties are Woodstox specific and they cause a crash in environments where SJSXP is
|
* Note that these properties are Woodstox specific and they cause a crash in environments where SJSXP is
|
||||||
* being used (e.g. glassfish) so we don't set them there.
|
* being used (e.g. glassfish) so we don't set them there.
|
||||||
*/
|
*/
|
||||||
if (outputFactory instanceof WstxOutputFactory) {
|
try {
|
||||||
outputFactory.setProperty(XMLOutputFactory2.P_TEXT_ESCAPER, new MyEscaper());
|
Class.forName("com.ctc.wstx.stax.WstxOutputFactory");
|
||||||
|
if (outputFactory instanceof WstxOutputFactory) {
|
||||||
|
outputFactory.setProperty(XMLOutputFactory2.P_TEXT_ESCAPER, new MyEscaper());
|
||||||
|
}
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
ourLog.debug("WstxOutputFactory (Woodstox) not found on classpath");
|
||||||
}
|
}
|
||||||
ourOutputFactory = outputFactory;
|
ourOutputFactory = outputFactory;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,17 +41,43 @@
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>hapi-fhir-base</artifactId>
|
<artifactId>hapi-fhir-base</artifactId>
|
||||||
<version>0.9-SNAPSHOT</version>
|
<version>0.9-SNAPSHOT</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>woodstox-core-asl</artifactId>
|
||||||
|
<groupId>org.codehaus.woodstox</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>hapi-fhir-structures-dstu</artifactId>
|
<artifactId>hapi-fhir-structures-dstu</artifactId>
|
||||||
<version>0.9-SNAPSHOT</version>
|
<version>0.9-SNAPSHOT</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>woodstox-core-asl</artifactId>
|
||||||
|
<groupId>org.codehaus.woodstox</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>hapi-fhir-structures-dev</artifactId>
|
<artifactId>hapi-fhir-structures-dev</artifactId>
|
||||||
<version>0.9-SNAPSHOT</version>
|
<version>0.9-SNAPSHOT</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>woodstox-core-asl</artifactId>
|
||||||
|
<groupId>org.codehaus.woodstox</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.hamcrest</groupId>
|
||||||
|
<artifactId>java-hamcrest</artifactId>
|
||||||
|
<version>${hamcrest_version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package ca.uhn.fhir.parser;
|
||||||
|
|
||||||
import static org.junit.Assert.assertThat;
|
import static org.junit.Assert.assertThat;
|
||||||
|
|
||||||
|
import org.hamcrest.Matchers;
|
||||||
import org.hamcrest.core.StringContains;
|
import org.hamcrest.core.StringContains;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -23,11 +24,13 @@ public class MultiVersionXmlParserTest {
|
||||||
String str;
|
String str;
|
||||||
str = FhirContext.forDstu1().newXmlParser().encodeResourceToString(p);
|
str = FhirContext.forDstu1().newXmlParser().encodeResourceToString(p);
|
||||||
ourLog.info(str);
|
ourLog.info(str);
|
||||||
assertThat(str,StringContains.containsString("<extension url=\"http://foo#ext\"><valueQuantity><value value=\"2.2\"/><comparator value=\"<\"/><units value=\"g/L\"/></valueQuantity></extension>"));
|
assertThat(str, Matchers.stringContainsInOrder("<extension url=\"http://foo#ext\"><valueQuantity><value value=\"2.2\"", "<comparator value=\"<\"", "<units value=\"g/L\"",
|
||||||
|
"</valueQuantity></extension>"));
|
||||||
|
|
||||||
str = FhirContext.forDev().newXmlParser().encodeResourceToString(p);
|
str = FhirContext.forDev().newXmlParser().encodeResourceToString(p);
|
||||||
ourLog.info(str);
|
ourLog.info(str);
|
||||||
assertThat(str,StringContains.containsString("<extension url=\"http://foo#ext\"><valueQuantity><value value=\"2.2\"/><comparator value=\"<\"/><units value=\"g/L\"/></valueQuantity></extension>"));
|
assertThat(str, Matchers.stringContainsInOrder("<extension url=\"http://foo#ext\"><valueQuantity><value value=\"2.2\"", "<comparator value=\"<\"", "<units value=\"g/L\"",
|
||||||
|
"</valueQuantity></extension>"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
package ca.uhn.fhir.testmindeps;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class SetupTest {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ensure that Woodstox is not on the classpath (we're testing that the library works ok without it
|
||||||
|
* elsewhere)
|
||||||
|
*/
|
||||||
|
@Test(expected=ClassNotFoundException.class)
|
||||||
|
public void testValidateEnvironment() throws ClassNotFoundException {
|
||||||
|
Class.forName("com.ctc.wstx.stax.WstxOutputFactory");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -118,7 +118,7 @@ public class TinderJpaRestServerMojo extends AbstractMojo {
|
||||||
throw new MojoFailureException("Failed to generate server", e);
|
throw new MojoFailureException("Failed to generate server", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
myProject.addCompileSourceRoot(directoryBase.getAbsolutePath());
|
myProject.addCompileSourceRoot(targetDirectory.getAbsolutePath());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
VelocityContext ctx = new VelocityContext();
|
VelocityContext ctx = new VelocityContext();
|
||||||
|
|
4
pom.xml
4
pom.xml
|
@ -123,6 +123,10 @@
|
||||||
<id>twilson650</id>
|
<id>twilson650</id>
|
||||||
<name>Tom Wilson</name>
|
<name>Tom Wilson</name>
|
||||||
</developer>
|
</developer>
|
||||||
|
<developer>
|
||||||
|
<id>sweetnavelorange</id>
|
||||||
|
<name>James Butler</name>
|
||||||
|
</developer>
|
||||||
</developers>
|
</developers>
|
||||||
|
|
||||||
<licenses>
|
<licenses>
|
||||||
|
|
|
@ -96,6 +96,11 @@
|
||||||
DateClientParam#second() incorrectly used DAY precision instead
|
DateClientParam#second() incorrectly used DAY precision instead
|
||||||
of SECOND precision. Thanks to Tom Wilson for the pull request!
|
of SECOND precision. Thanks to Tom Wilson for the pull request!
|
||||||
</action>
|
</action>
|
||||||
|
<action type="fix" issue="100" due-to="sweetnavelorange">
|
||||||
|
Fix issue where HAPI failed to initialize correctly if Woodstox library was not on the classpath, even
|
||||||
|
if StAX API was configured to use a different provider. Thanks to
|
||||||
|
James Butler for reporting and figuring out where the issue was!
|
||||||
|
</action>
|
||||||
</release>
|
</release>
|
||||||
<release version="0.8" date="2014-Dec-17">
|
<release version="0.8" date="2014-Dec-17">
|
||||||
<action type="add">
|
<action type="add">
|
||||||
|
|
Loading…
Reference in New Issue