#1380 - Make javax.xml an optional dependency (as it is not part of JDK from 9 onwards)

This commit is contained in:
rob bygrave
2018-05-21 01:06:26 +12:00
parent 85d3caf079
commit 4b91f5fe0b
3 changed files with 35 additions and 27 deletions
@@ -34,8 +34,9 @@ class InternalConfigXmlRead {
InternalConfigXmlRead(ServerConfig serverConfig) {
this.serverConfig = serverConfig;
this.classLoader = serverConfig.getClassLoadConfig().getClassLoader();
init();
if (serverConfig.getClassLoadConfig().isJavaxJAXBPresent()) {
init();
}
}
private void init() {
@@ -73,10 +74,12 @@ class InternalConfigXmlRead {
* Return the named queries for Dto beans.
*/
Map<Class<?>, DtoNamedQueries> readDtoMapping() {
for (XmEbean mapping : xmlEbeanList) {
List<XmDto> dtoList = mapping.getDto();
for (XmDto dto : dtoList) {
readDtoMapping(dto);
if (xmlEbeanList != null) {
for (XmEbean mapping : xmlEbeanList) {
List<XmDto> dtoList = mapping.getDto();
for (XmDto dto : dtoList) {
readDtoMapping(dto);
}
}
}
@@ -394,12 +394,13 @@ public class BeanDescriptorManager implements BeanDescriptorMap {
}
private void readXmlMapping(List<XmEbean> mappings) {
ClassLoader classLoader = serverConfig.getClassLoadConfig().getClassLoader();
for (XmEbean mapping : mappings) {
List<XmEntity> entityDeploy = mapping.getEntity();
for (XmEntity deploy : entityDeploy) {
readEntityMapping(classLoader, deploy);
if (mappings != null) {
ClassLoader classLoader = serverConfig.getClassLoadConfig().getClassLoader();
for (XmEbean mapping : mappings) {
List<XmEntity> entityDeploy = mapping.getEntity();
for (XmEntity deploy : entityDeploy) {
readEntityMapping(classLoader, deploy);
}
}
}
}
@@ -143,6 +143,8 @@ public final class DefaultTypeManager implements TypeManager {
private final boolean java7Present;
private final boolean objectMapperPresent;
private final boolean postgres;
private final boolean offlineMigrationGeneration;
@@ -184,7 +186,7 @@ public final class DefaultTypeManager implements TypeManager {
this.nativeMap = new ConcurrentHashMap<>();
this.logicalMap = new ConcurrentHashMap<>();
boolean objectMapperPresent = config.getClassLoadConfig().isJacksonObjectMapperPresent();
this.objectMapperPresent = config.getClassLoadConfig().isJacksonObjectMapperPresent();
this.objectMapper = (objectMapperPresent) ? initObjectMapper(config) : null;
this.extraTypeFactory = new DefaultTypeFactory(config);
@@ -405,20 +407,22 @@ public final class DefaultTypeManager implements TypeManager {
}
}
if (type.equals(JsonNode.class)) {
switch (dbType) {
case Types.VARCHAR:
return jsonNodeVarchar;
case Types.BLOB:
return jsonNodeBlob;
case Types.CLOB:
return jsonNodeClob;
case DbPlatformType.JSONB:
return jsonNodeJsonb;
case DbPlatformType.JSON:
return jsonNodeJson;
default:
return jsonNodeJson;
if (objectMapperPresent) {
if (type.equals(JsonNode.class)) {
switch (dbType) {
case Types.VARCHAR:
return jsonNodeVarchar;
case Types.BLOB:
return jsonNodeBlob;
case Types.CLOB:
return jsonNodeClob;
case DbPlatformType.JSONB:
return jsonNodeJsonb;
case DbPlatformType.JSON:
return jsonNodeJson;
default:
return jsonNodeJson;
}
}
}