Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWinston Prakash2015-09-18 14:04:40 -0400
committerWinston Prakash2015-09-18 14:04:40 -0400
commit0475557eddc56b8830d319d5ce260291097dcabc (patch)
treebca873b32f7336adaf59e670b8f28f3cdc798f66
parent41b7d41ba50774a276149d646e5c6a117fbbb3e2 (diff)
downloadorg.eclipse.hudson.core-0475557eddc56b8830d319d5ce260291097dcabc.tar.gz
org.eclipse.hudson.core-0475557eddc56b8830d319d5ce260291097dcabc.tar.xz
org.eclipse.hudson.core-0475557eddc56b8830d319d5ce260291097dcabc.zip
Bug fix: 472217 - Proxy settings not saved
-rw-r--r--hudson-core/src/main/java/org/eclipse/hudson/plugins/PluginCenter.java50
-rw-r--r--hudson-core/src/main/resources/org/eclipse/hudson/plugins/PluginCenter/index.jelly56
2 files changed, 59 insertions, 47 deletions
diff --git a/hudson-core/src/main/java/org/eclipse/hudson/plugins/PluginCenter.java b/hudson-core/src/main/java/org/eclipse/hudson/plugins/PluginCenter.java
index 76a27496..83afea67 100644
--- a/hudson-core/src/main/java/org/eclipse/hudson/plugins/PluginCenter.java
+++ b/hudson-core/src/main/java/org/eclipse/hudson/plugins/PluginCenter.java
@@ -62,14 +62,14 @@ final public class PluginCenter {
private final ProxyConfiguration proxyConfig;
private List<PluginInstallationJob> installationsJobs = new CopyOnWriteArrayList<PluginInstallationJob>();
private final ExecutorService installerService = Executors.newSingleThreadExecutor(
- new DaemonThreadFactory(new ThreadFactory() {
- @Override
- public Thread newThread(Runnable r) {
- Thread t = new Thread(r);
- t.setName("Plugin center installer thread");
- return t;
- }
- }));
+ new DaemonThreadFactory(new ThreadFactory() {
+ @Override
+ public Thread newThread(Runnable r) {
+ Thread t = new Thread(r);
+ t.setName("Plugin center installer thread");
+ return t;
+ }
+ }));
private final HudsonSecurityManager hudsonSecurityManager;
private final File hudsonHomeDir;
@@ -149,23 +149,23 @@ final public class PluginCenter {
}
public boolean isInstalled(AvailablePluginInfo availablePlugin) {
- if (installedPluginManager.isInstalled(availablePlugin.getName())){
+ if (installedPluginManager.isInstalled(availablePlugin.getName())) {
InstalledPluginInfo installedPluginInfo = installedPluginManager.getInstalledPlugin(availablePlugin.getName());
return !installedPluginInfo.isFailedToLoad();
- }else{
+ } else {
return false;
}
}
-
+
public boolean isFailedtoLoad(AvailablePluginInfo availablePlugin) {
- if (installedPluginManager.isInstalled(availablePlugin.getName())){
+ if (installedPluginManager.isInstalled(availablePlugin.getName())) {
InstalledPluginInfo installedPluginInfo = installedPluginManager.getInstalledPlugin(availablePlugin.getName());
return installedPluginInfo.isFailedToLoad();
- }else{
+ } else {
return false;
}
}
-
+
public boolean isNewerCoreRequired(AvailablePluginInfo availablePlugin) {
if (availablePlugin.getRequiredCoreVersion() != null) {
return Hudson.getVersion().isOlderThan(availablePlugin.getRequiredCoreVersion());
@@ -370,12 +370,12 @@ final public class PluginCenter {
}
public HttpResponse doProxyConfigure(
- @QueryParameter("proxy.server") String server,
- @QueryParameter("proxy.port") String port,
- @QueryParameter("proxy.noProxyFor") String noProxyFor,
- @QueryParameter("proxy.userName") String userName,
- @QueryParameter("proxy.password") String password,
- @QueryParameter("proxy.authNeeded") String authNeeded) throws IOException {
+ @QueryParameter("proxy.server") String server,
+ @QueryParameter("proxy.port") String port,
+ @QueryParameter("proxy.noProxyFor") String noProxyFor,
+ @QueryParameter("proxy.userName") String userName,
+ @QueryParameter("proxy.password") String password,
+ @QueryParameter("proxy.authNeeded") String authNeeded) throws IOException {
if (!hudsonSecurityManager.hasPermission(Permission.HUDSON_ADMINISTER)) {
return HttpResponses.forbidden();
@@ -396,7 +396,7 @@ final public class PluginCenter {
}
private boolean setProxy(String server, String port, String noProxyFor,
- String userName, String password, String authNeeded) throws IOException {
+ String userName, String password, String authNeeded) throws IOException {
server = Util.fixEmptyAndTrim(server);
if ((server != null) && !"".equals(server)) {
@@ -413,12 +413,12 @@ final public class PluginCenter {
}
proxyConfig.configure(server, portNumber, Util.fixEmptyAndTrim(noProxyFor),
- Util.fixEmptyAndTrim(userName), Util.fixEmptyAndTrim(password), "on".equals(Util.fixNull(authNeeded)));
+ Util.fixEmptyAndTrim(userName), Util.fixEmptyAndTrim(password), "on".equals(Util.fixNull(authNeeded)));
return true;
} else {
proxyConfig.getXmlFile().delete();
- proxyConfig.name = null;
+ proxyConfig.configure(null, -1, null, null, null, false);
return false;
}
}
@@ -452,7 +452,7 @@ final public class PluginCenter {
proxyConfig.openUrl(updateCenterRemoteUrl);
} catch (Exception exc) {
return new ErrorHttpResponse("Could not connect to " + updateSiteManager.getUpdateSiteUrl() + ". "
- + "If you are behind a firewall set HTTP proxy and try again.");
+ + "If you are behind a firewall set HTTP proxy and try again.");
}
try {
@@ -472,7 +472,7 @@ final public class PluginCenter {
public void shutdown() {
List<Runnable> running = installerService.shutdownNow();
if (!running.isEmpty()) {
- logger.warn("shutdown with "+running.size()+" jobs pending");
+ logger.warn("shutdown with " + running.size() + " jobs pending");
}
}
diff --git a/hudson-core/src/main/resources/org/eclipse/hudson/plugins/PluginCenter/index.jelly b/hudson-core/src/main/resources/org/eclipse/hudson/plugins/PluginCenter/index.jelly
index 0c7c4112..030b775e 100644
--- a/hudson-core/src/main/resources/org/eclipse/hudson/plugins/PluginCenter/index.jelly
+++ b/hudson-core/src/main/resources/org/eclipse/hudson/plugins/PluginCenter/index.jelly
@@ -44,19 +44,19 @@
<span>
Hudson must be restarted for the plugin changes to take effect.<br/>
<j:invokeStatic var="lifecycle"
- className="hudson.lifecycle.Lifecycle"
- method="get" />
+ className="hudson.lifecycle.Lifecycle"
+ method="get" />
<j:choose>
- <j:when test="${lifecycle.safeRestartable}">
- <f:form method="post" action="restart" name="restart">
- <f:submit value="Restart" />
- </f:form>
- </j:when>
- <j:otherwise>
- <span>
- Manual restart required. See <a href="http://wiki.eclipse.org/Hudson-ci/features/Restart_Within_Hudson">Restart Within Hudson</a>.
- </span>
- </j:otherwise>
+ <j:when test="${lifecycle.safeRestartable}">
+ <f:form method="post" action="restart" name="restart">
+ <f:submit value="Restart" />
+ </f:form>
+ </j:when>
+ <j:otherwise>
+ <span>
+ Manual restart required. See <a href="http://wiki.eclipse.org/Hudson-ci/features/Restart_Within_Hudson">Restart Within Hudson</a>.
+ </span>
+ </j:otherwise>
</j:choose>
</span>
</div>
@@ -130,7 +130,7 @@
</j:if>
<br/>
<span id="pluginUpdateMsg">
- <!-- Plugin update operation message injected -->
+ <!-- Plugin update operation message injected -->
</span>
<br style="clear:both"/>
</div>
@@ -254,7 +254,7 @@
<div class="excerpt" style="padding-top: 5px;">
<j:out value="${it.markupFormatter.translate(p.description)}" />
<j:if test="${it.isNewerCoreRequired(p)}">
- <br/>
+ <br/>
<span class="warning"> This plugin requires newer version of Hudson - ${p.requiredCore}</span>
</j:if>
</div>
@@ -316,7 +316,7 @@
<div class="excerpt" style="padding-top: 5px;">
<j:out value="${it.markupFormatter.translate(p.description)}" />
<j:if test="${it.isNewerCoreRequired(p)}">
- <br/>
+ <br/>
<span class="warning"> This plugin requires newer version of Hudson - ${p.requiredCore}</span>
</j:if>
</div>
@@ -378,7 +378,7 @@
<div class="excerpt" style="padding-top: 5px;">
<j:out value="${it.markupFormatter.translate(p.description)}" />
<j:if test="${it.isNewerCoreRequired(p)}">
- <br/>
+ <br/>
<span class="warning"> This plugin requires newer version of Hudson - ${p.requiredCore}</span>
</j:if>
</div>
@@ -431,7 +431,7 @@
</div>
<br/>
<span id="pluginInstallMsg">
- <!-- Plugin install operation message injected -->
+ <!-- Plugin install operation message injected -->
</span>
<br style="clear:both"/>
@@ -509,7 +509,7 @@
</ul>
<br/>
<span id="pluginActionMsg">
- <!-- Plugin Enable/Disable operation message injected -->
+ <!-- Plugin Enable/Disable operation message injected -->
</span>
</div>
<div id="advancedTab">
@@ -530,15 +530,27 @@
<input type="text" name="proxy.server" value="${it.proxyConfig.name}" />
<br/>
+
<label for="proxy.port">Proxy Port</label>
- <input type="text" name="proxy.port" value="${it.proxyConfig.port}" />
+ <j:if test="${it.proxyConfig.port &gt; 0}">
+ <input type="text" name="proxy.port" value="${it.proxyConfig.port}" />
+ </j:if>
+ <j:if test="${it.proxyConfig.port &lt; 1}">
+ <input type="text" name="proxy.port" />
+ </j:if>
<br/>
<label for="proxy.noProxyFor">No Proxy for</label>
<input type="text" name="proxy.noProxyFor" value="${it.proxyConfig.noProxyFor}" />
<br/>
- <input style="width: 10px;" id="proxyAuth" name="proxy.authNeeded" type="checkbox" checked="${it.proxyConfig.authNeeded}"/>
+
+ <j:if test="${it.proxyConfig.authNeeded}">
+ <input style="width: 10px;" id="proxyAuth" name="proxy.authNeeded" type="checkbox" checked="true"/>
+ </j:if>
+ <j:if test="${!it.proxyConfig.authNeeded}">
+ <input style="width: 10px;" id="proxyAuth" name="proxy.authNeeded" type="checkbox"/>
+ </j:if>
Proxy Needs Authorization
<br/>
@@ -559,7 +571,7 @@
</div>
<br style="clear:both"/>
<span id="proxyMsg">
- <!-- Proxy operation message injected here -->
+ <!-- Proxy operation message injected here -->
</span>
</form>
@@ -592,7 +604,7 @@
<div id="progressbar"></div>
<span id="pluginUploadMsg">
- <!-- Plugin upload operation message injected -->
+ <!-- Plugin upload operation message injected -->
</span>
<br style="clear:both"/>

Back to the top