Skip to content

Commit 940601e

Browse files
Improve and standardize user facing strings
1 parent b11910b commit 940601e

3 files changed

Lines changed: 15 additions & 15 deletions

File tree

src/main/java/com/codedx/bambooplugin/CodeDxScanTaskConfigurator.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,17 @@ public void validate(final ActionParametersMap params, final ErrorCollection err
9696

9797
final String analysisName = params.getString("analysisName");
9898
if (StringUtils.isEmpty(analysisName)) {
99-
errorCollection.addError("analysisName", "Missing Code Dx Analysis Name.");
99+
errorCollection.addError("analysisName", "Missing analysis name");
100100
}
101101

102102
final String selectedProjectId = params.getString("selectedProjectId");
103103
if (StringUtils.isEmpty(selectedProjectId)) {
104-
errorCollection.addError("selectedProjectId", "Missing Selected Project.");
104+
errorCollection.addError("selectedProjectId", "Missing selected project");
105105
}
106106

107107
final String includePaths = params.getString("includePaths");
108108
if (StringUtils.isEmpty(includePaths)) {
109-
errorCollection.addError("includePaths", "Missing source and binary files.");
109+
errorCollection.addError("includePaths", "Missing source and binary files");
110110
}
111111

112112
final String useDefaults = params.getString("useDefaults");
@@ -118,15 +118,15 @@ public void validate(final ActionParametersMap params, final ErrorCollection err
118118
try {
119119
new URL(url);
120120
} catch (MalformedURLException e) {
121-
errorCollection.addError("url", "Invalid URL");
121+
errorCollection.addError("url", "Malformed URL");
122122
}
123123
} else {
124-
errorCollection.addError("url", "Missing Code Dx URL.");
124+
errorCollection.addError("url", "Missing Code Dx URL");
125125
}
126126

127127
final String apiKey = params.getString("apiKey");
128128
if (StringUtils.isEmpty(apiKey)) {
129-
errorCollection.addError("apiKey", "Missing Code Dx Api Key.");
129+
errorCollection.addError("apiKey", "Missing Code Dx API key");
130130
}
131131
}
132132
}
@@ -149,7 +149,7 @@ private static List<Project> getProjectList(Map<String, Object> context) {
149149
}
150150

151151
if (url == null || apiKey == null || url.isEmpty() || apiKey.isEmpty()) {
152-
context.put("reachabilityMessage", "CodeDx URL and API key are not configured");
152+
context.put("reachabilityMessage", "Code Dx URL and API key are not configured");
153153
return new ArrayList<Project>();
154154
}
155155

@@ -166,7 +166,7 @@ private static List<Project> getProjectList(Map<String, Object> context) {
166166
} catch (ApiException e) {
167167
e.printStackTrace();
168168
} catch (ProcessingException e) {
169-
context.put("reachabilityMessage", "CodeDx is unreachable");
169+
context.put("reachabilityMessage", "Connection refused. Please confirm that the URL is correct and that the Code Dx server is running.");
170170
}
171171

172172
return new ArrayList<Project>();
@@ -306,7 +306,7 @@ public void populateContextForEdit(Map<String, Object> context, TaskDefinition t
306306
failedSave = null;
307307
}
308308

309-
// Helper
309+
// Private helpers
310310
private static String emptyIfNull(String value) {
311311
if (value == null) {
312312
return "";

src/main/java/com/codedx/bambooplugin/ProjectRefresherServlet.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws S
6565
new URL(credentials.getUrl());
6666
} catch (MalformedURLException e) {
6767
resp.setStatus(404);
68-
resp.getOutputStream().print("Invalid URL");
68+
resp.getOutputStream().print("Malformed Code Dx URL");
6969
return;
7070
}
7171

@@ -104,7 +104,7 @@ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws S
104104
return;
105105
} catch (ProcessingException e) {
106106
resp.setStatus(404);
107-
resp.getOutputStream().print("Connection refused. Please confirm the URL is correct and the Code Dx server is running.");
107+
resp.getOutputStream().print("Connection refused. Please confirm that the URL is correct and that the Code Dx server is running.");
108108
return;
109109
}
110110

@@ -116,7 +116,7 @@ private static String getBetterErrorMessage(Throwable cause) {
116116
String betterMessage = cause.getMessage();
117117

118118
if (cause instanceof ConnectException)
119-
betterMessage = "Connection failed, is the URL/port correct?";
119+
betterMessage = "Connection refused. Please confirm that the URL is correct and that the Code Dx server is running.";
120120
else if (cause instanceof SSLHandshakeException)
121121
betterMessage = "The SSL Certificate presented by the server is invalid. If this is expected, please input the SHA1 fingerprint in the advanced options";
122122
else if (cause instanceof UnknownHostException)

src/main/resources/configureCodeDxTask.ftl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
</div>
9797
<div id="url-warning" style="color:#C4A000;">
9898
<i class="fas fa-exclamation-triangle"></i>
99-
<span>HTTP is considered insecure, it is recommended that you use HTTPS.</span>
99+
<span>HTTP is considered insecure. It is recommended that you use HTTPS.</span>
100100
</div>
101101

102102
<!--Code Dx API Key-->
@@ -449,10 +449,10 @@
449449
}
450450
451451
if (projects.length > 0) {
452-
updateReachabilityMessage("Projects refreshed successfully.", false);
452+
updateReachabilityMessage("Projects refreshed successfully", false);
453453
projectSelect.disabled = false;
454454
} else {
455-
updateReachabilityMessage("No projects available for this API token.", true);
455+
updateReachabilityMessage("No projects available for this API token", true);
456456
projectSelect.disabled = true;
457457
}
458458
},

0 commit comments

Comments
 (0)