Browse Source

more obsolete Java version checks

master
Stefan Bodewig 9 years ago
parent
commit
3c930b9323
3 changed files with 7 additions and 23 deletions
  1. +4
    -18
      src/main/org/apache/tools/ant/Diagnostics.java
  2. +0
    -1
      src/tests/junit/org/apache/tools/ant/taskdefs/SignJarTest.java
  3. +3
    -4
      src/tests/junit/org/apache/tools/ant/util/JavaEnvUtilsTest.java

+ 4
- 18
src/main/org/apache/tools/ant/Diagnostics.java View File

@@ -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());
}

}

+ 0
- 1
src/tests/junit/org/apache/tools/ant/taskdefs/SignJarTest.java View File

@@ -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");


+ 3
- 4
src/tests/junit/org/apache/tools/ant/util/JavaEnvUtilsTest.java View File

@@ -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));
}


Loading…
Cancel
Save