ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject [1/2] ant git commit: more obsolete Java version checks
Date Sat, 09 Apr 2016 11:39:32 GMT
Repository: ant
Updated Branches:
  refs/heads/master 39a534544 -> afdf355c6


more obsolete Java version checks


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

Branch: refs/heads/master
Commit: 3c930b93232641709b6d829167a3ddaaf8a2bed5
Parents: 39a5345
Author: Stefan Bodewig <bodewig@apache.org>
Authored: Sat Apr 9 13:01:10 2016 +0200
Committer: Stefan Bodewig <bodewig@apache.org>
Committed: Sat Apr 9 13:01:10 2016 +0200

----------------------------------------------------------------------
 src/main/org/apache/tools/ant/Diagnostics.java  | 22 ++++----------------
 .../apache/tools/ant/taskdefs/SignJarTest.java  |  1 -
 .../apache/tools/ant/util/JavaEnvUtilsTest.java |  7 +++----
 3 files changed, 7 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/3c930b93/src/main/org/apache/tools/ant/Diagnostics.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/Diagnostics.java b/src/main/org/apache/tools/ant/Diagnostics.java
index 6389f6e..fe20764 100644
--- a/src/main/org/apache/tools/ant/Diagnostics.java
+++ b/src/main/org/apache/tools/ant/Diagnostics.java
@@ -42,6 +42,7 @@ import org.apache.tools.ant.util.FileUtils;
 import org.apache.tools.ant.util.JAXPUtils;
 import org.apache.tools.ant.util.JavaEnvUtils;
 import org.apache.tools.ant.util.ProxySetup;
+import org.apache.tools.ant.util.java15.ProxyDiagnostics;
 import org.xml.sax.XMLReader;
 
 /**
@@ -691,25 +692,10 @@ public final class Diagnostics {
         printProperty(out, ProxySetup.SOCKS_PROXY_USERNAME);
         printProperty(out, ProxySetup.SOCKS_PROXY_PASSWORD);
 
-        if (JavaEnvUtils.getJavaVersionNumber() < JAVA_1_5_NUMBER) {
-            return;
-        }
         printProperty(out, ProxySetup.USE_SYSTEM_PROXIES);
-        final String proxyDiagClassname = "org.apache.tools.ant.util.java15.ProxyDiagnostics";
-        try {
-            Class<?> proxyDiagClass = Class.forName(proxyDiagClassname);
-            Object instance = proxyDiagClass.newInstance();
-            out.println("Java1.5+ proxy settings:");
-            out.println(instance.toString());
-        } catch (ClassNotFoundException e) {
-            //not included, do nothing
-        } catch (IllegalAccessException e) {
-            //not included, do nothing
-        } catch (InstantiationException e) {
-            //not included, do nothing
-        } catch (NoClassDefFoundError e) {
-            // not included, to nothing
-        }
+        ProxyDiagnostics proxyDiag = new ProxyDiagnostics();
+        out.println("Java1.5+ proxy settings:");
+        out.println(proxyDiag.toString());
     }
 
 }

http://git-wip-us.apache.org/repos/asf/ant/blob/3c930b93/src/tests/junit/org/apache/tools/ant/taskdefs/SignJarTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/SignJarTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/SignJarTest.java
index 95585fd..93d5e78 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/SignJarTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/SignJarTest.java
@@ -106,7 +106,6 @@ public class SignJarTest {
 
     @Test
     public void testTsaLocalhost() {
-        Assume.assumeTrue("Only runs on Java 1.5+", JavaEnvUtils.getJavaVersionNumber()>=15);
         try {
             buildRule.executeTarget("testTsaLocalhost");
             fail("Should have thrown exception - no TSA at localhost:0");

http://git-wip-us.apache.org/repos/asf/ant/blob/3c930b93/src/tests/junit/org/apache/tools/ant/util/JavaEnvUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/JavaEnvUtilsTest.java b/src/tests/junit/org/apache/tools/ant/util/JavaEnvUtilsTest.java
index 14387e7..d153d63 100644
--- a/src/tests/junit/org/apache/tools/ant/util/JavaEnvUtilsTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/JavaEnvUtilsTest.java
@@ -115,12 +115,11 @@ public class JavaEnvUtilsTest {
         assertTrue(j+" is normalized and in the JDK dir",
                    j.startsWith(javaHomeParent));
 
-        if ((Os.isFamily("mac") && JavaEnvUtils.getJavaVersionNumber() <= JavaEnvUtils.VERSION_1_6)
-            || JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_1_9)) {
-            assertTrue(j+" is normalized and in the JRE dir",
+        if (JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_1_9)) {
+            assertTrue(j + " is normalized and in the JRE dir",
                        j.startsWith(javaHome));
         } else {
-            assertTrue(j+" is normalized and not in the JRE dir",
+            assertTrue(j + " is normalized and not in the JRE dir",
                        !j.startsWith(javaHome));
         }
 


Mime
View raw message