You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2016/09/04 14:34:40 UTC

[1/2] ant git commit: don't try reflection when we know it doesn't work

Repository: ant
Updated Branches:
  refs/heads/master 703aceddb -> ffd3d14c5


don't try reflection when we know it doesn't work

https://bz.apache.org/bugzilla/show_bug.cgi?id=60060


Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/1d7b6241
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/1d7b6241
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/1d7b6241

Branch: refs/heads/master
Commit: 1d7b624155b06f665c8b99014227bc1f87f9ec54
Parents: 2cec63f
Author: Stefan Bodewig <bo...@apache.org>
Authored: Sun Sep 4 16:33:21 2016 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Sun Sep 4 16:33:21 2016 +0200

----------------------------------------------------------------------
 .../ant/taskdefs/optional/TraXLiaison.java      | 29 +++++++++++++-------
 1 file changed, 19 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/1d7b6241/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java b/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java
index fea97d2..182059c 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java
@@ -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;
@@ -428,15 +429,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);
 
@@ -461,7 +454,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
@@ -676,4 +668,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);
+                }
+            }
+        }
+    }
+
 }


[2/2] ant git commit: Merge branch '1.9.x'

Posted by bo...@apache.org.
Merge branch '1.9.x'


Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/ffd3d14c
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/ffd3d14c
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/ffd3d14c

Branch: refs/heads/master
Commit: ffd3d14c5541f914fb7d275d66d083b54bee7fdb
Parents: 703aced 1d7b624
Author: Stefan Bodewig <bo...@apache.org>
Authored: Sun Sep 4 16:34:27 2016 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Sun Sep 4 16:34:27 2016 +0200

----------------------------------------------------------------------
 .../ant/taskdefs/optional/TraXLiaison.java      | 29 +++++++++++++-------
 1 file changed, 19 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/ffd3d14c/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java
----------------------------------------------------------------------