Skip to content

Commit 3d8ee40

Browse files
authored
Merge pull request #6 from MicroFocus/luiza_defect_1117010_proxy_settings_improvements
defect #1117010 [Regression_Eagles_Push2] [JiraPlugin] Proxy Setting trim host and not auto-populate password field when empty
2 parents ff0c1c8 + 2025487 commit 3d8ee40

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

src/main/java/com/microfocus/octane/plugins/admin/ConfigResource.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,13 @@ public Response getDataForWorkspaceDialog(@QueryParam("space-conf-id") String sp
8888
.map(e -> new KeyValueItem(e.getId(), e.getName()))
8989
.collect(Collectors.toList());
9090

91-
9291
Collection<KeyValueItem> select2IssueTypes = ComponentAccessor.getConstantsManager().getAllIssueTypeObjects()
93-
.stream().map(e -> new KeyValueItem(e.getName(), e.getName())).sorted(Comparator.comparing(o -> o.getId())).collect(Collectors.toList());
92+
.stream().map(e -> new KeyValueItem(e.getName(), e.getName())).sorted(Comparator.comparing(KeyValueItem::getId)).collect(Collectors.toList());
9493

9594
Collection<KeyValueItem> select2Projects = ComponentAccessor.getProjectManager().getProjectObjects()
9695
.stream()
9796
.filter(e -> !usedJiraProjects.contains(e.getKey()))
98-
.map(e -> new KeyValueItem(e.getKey(), e.getKey())).sorted(Comparator.comparing(o -> o.getId()))
97+
.map(e -> new KeyValueItem(e.getKey(), e.getKey())).sorted(Comparator.comparing(KeyValueItem::getId))
9998
.collect(Collectors.toList());
10099

101100
Map<String, Object> data = new HashMap<>();
@@ -234,7 +233,13 @@ public Response getProxy() {
234233
outgoing.setHost(config.getHost());
235234
outgoing.setPort(config.getPort() == null ? "" : config.getPort().toString());
236235
outgoing.setUsername(config.getUsername());
237-
outgoing.setPassword(PluginConstants.PASSWORD_REPLACE);
236+
237+
if (StringUtils.isNotEmpty(config.getPassword())) {
238+
outgoing.setPassword(PluginConstants.PASSWORD_REPLACE);
239+
} else {
240+
outgoing.setPassword("");
241+
}
242+
238243
outgoing.setNonProxyHost(config.getNonProxyHost());
239244
}
240245

@@ -276,7 +281,7 @@ public Response getSpaceConfigurations() {
276281
}
277282

278283
List<SpaceConfigurationOutgoing> outgoing = ConfigurationManager.getInstance().getSpaceConfigurations()
279-
.stream().map(c -> ConfigurationUtil.convertToOutgoing(c)).collect(Collectors.toList());
284+
.stream().map(ConfigurationUtil::convertToOutgoing).collect(Collectors.toList());
280285

281286
return Response.ok(outgoing).build();
282287
}

src/main/java/com/microfocus/octane/plugins/configuration/ConfigurationManager.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,21 +144,26 @@ public void saveProxyConfiguration(ProxyConfigurationOutgoing proxyOutgoing) {
144144
proxy = new ProxyConfiguration();
145145
}
146146

147-
proxy.setHost(proxyOutgoing.getHost());
147+
String host = proxyOutgoing.getHost();
148148
Integer port = null;
149149
if (StringUtils.isNotEmpty(proxyOutgoing.getHost()) && StringUtils.isNotEmpty(proxyOutgoing.getPort())) {
150+
host = host.trim();
151+
150152
try {
151153
port = Integer.parseInt(proxyOutgoing.getPort());
152154
} catch (NumberFormatException e) {
153155
//do nothing
154156
}
155157
}
158+
159+
proxy.setHost(host);
156160
proxy.setPort(port);
157161
proxy.setUsername(proxyOutgoing.getUsername());
158162

159163
if (!proxyOutgoing.getPassword().equals(PluginConstants.PASSWORD_REPLACE)) {
160164
proxy.setPassword(proxyOutgoing.getPassword());
161165
}
166+
162167
proxy.setNonProxyHost(proxyOutgoing.getNonProxyHost());
163168
getConfiguration().setProxy(proxy);
164169
persistConfiguration();

0 commit comments

Comments
 (0)