Browse Source

PR 56678 allow tsa proxy host to be used without tsaurl in signjar

master
Stefan Bodewig 11 years ago
parent
commit
ba170891db
1 changed files with 16 additions and 15 deletions
  1. +16
    -15
      src/main/org/apache/tools/ant/taskdefs/SignJar.java

+ 16
- 15
src/main/org/apache/tools/ant/taskdefs/SignJar.java View File

@@ -549,21 +549,6 @@ public class SignJar extends AbstractJarSignerTask {
if (tsaurl != null) { if (tsaurl != null) {
addValue(cmd, "-tsa"); addValue(cmd, "-tsa");
addValue(cmd, tsaurl); addValue(cmd, tsaurl);

if (tsaproxyhost != null) {
final String connectionType;
if (tsaurl.startsWith("https")) {
connectionType = "https";
} else {
connectionType = "http";
}

addValue(cmd, "-J-D" + connectionType + ".proxyHost=" + tsaproxyhost);

if (tsaproxyport != null) {
addValue(cmd, "-J-D" + connectionType + ".proxyPort=" + tsaproxyport);
}
}
} }


if (tsacert != null) { if (tsacert != null) {
@@ -571,6 +556,14 @@ public class SignJar extends AbstractJarSignerTask {
addValue(cmd, tsacert); addValue(cmd, tsacert);
} }


if (tsaproxyhost != null) {
if (tsaurl == null || tsaurl.startsWith("https")) {
addProxyFor(cmd, "https");
}
if (tsaurl == null || !tsaurl.startsWith("https")) {
addProxyFor(cmd, "http");
}
}
} }


/** /**
@@ -641,4 +634,12 @@ public class SignJar extends AbstractJarSignerTask {
public void setPreserveLastModified(boolean preserveLastModified) { public void setPreserveLastModified(boolean preserveLastModified) {
this.preserveLastModified = preserveLastModified; this.preserveLastModified = preserveLastModified;
} }

private void addProxyFor(final ExecTask cmd, final String scheme) {
addValue(cmd, "-J-D" + scheme + ".proxyHost=" + tsaproxyhost);

if (tsaproxyport != null) {
addValue(cmd, "-J-D" + scheme + ".proxyPort=" + tsaproxyport);
}
}
} }

Loading…
Cancel
Save