Browse Source

Merge branch '1.9.x'

master
Stefan Bodewig 8 years ago
parent
commit
ffd3d14c55
1 changed files with 19 additions and 10 deletions
  1. +19
    -10
      src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java

+ 19
- 10
src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java View File

@@ -64,6 +64,7 @@ import org.apache.tools.ant.types.resources.FileResource;
import org.apache.tools.ant.types.resources.URLProvider;
import org.apache.tools.ant.util.FileUtils;
import org.apache.tools.ant.util.JAXPUtils;
import org.apache.tools.ant.util.JavaEnvUtils;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
@@ -422,15 +423,7 @@ public class TraXLiaison implements XSLTLiaison4, ErrorListener, XSLTLoggerAware
}
}

try { // #51668, #52382
final Field _isNotSecureProcessing = tfactory.getClass().getDeclaredField("_isNotSecureProcessing");
_isNotSecureProcessing.setAccessible(true);
_isNotSecureProcessing.set(tfactory, Boolean.TRUE);
} catch (final Exception x) {
if (project != null) {
project.log(x.toString(), Project.MSG_DEBUG);
}
}
applyReflectionHackForExtensionMethods();

tfactory.setErrorListener(this);

@@ -455,7 +448,6 @@ public class TraXLiaison implements XSLTLiaison4, ErrorListener, XSLTLoggerAware
return tfactory;
}


/**
* Set the factory name to use instead of JAXP default lookup.
* @param name the fully qualified class name of the factory to use
@@ -670,4 +662,21 @@ public class TraXLiaison implements XSLTLiaison4, ErrorListener, XSLTLoggerAware

traceConfiguration = xsltTask.getTraceConfiguration();
}

private void applyReflectionHackForExtensionMethods() {
// Jigsaw doesn't allow reflection to work, so we can stop trying
if (JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_1_7)
&& !JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_9)) {
try { // #51668, #52382
final Field _isNotSecureProcessing = tfactory.getClass().getDeclaredField("_isNotSecureProcessing");
_isNotSecureProcessing.setAccessible(true);
_isNotSecureProcessing.set(tfactory, Boolean.TRUE);
} catch (final Exception x) {
if (project != null) {
project.log(x.toString(), Project.MSG_DEBUG);
}
}
}
}

}

Loading…
Cancel
Save