Skip to content

Commit dbfaa9d

Browse files
committed
chore: bump plugin-api to 4.1.13
1 parent 2b5ad4d commit dbfaa9d

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>org.ligoj.api</groupId>
66
<artifactId>plugin-parent</artifactId>
7-
<version>4.1.12</version>
7+
<version>4.1.13</version>
88
<relativePath/>
99
</parent>
1010

src/main/java/org/ligoj/app/plugin/qa/sonar/SonarPluginResource.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import lombok.extern.slf4j.Slf4j;
1212
import org.apache.commons.lang3.ObjectUtils;
1313
import org.apache.commons.lang3.StringUtils;
14+
import org.apache.commons.lang3.Strings;
1415
import org.apache.commons.lang3.math.NumberUtils;
1516
import org.ligoj.app.api.SubscriptionStatusWithData;
1617
import org.ligoj.app.plugin.qa.QaResource;
@@ -133,7 +134,7 @@ public void link(final int subscription) throws Exception {
133134
*/
134135
protected SonarProject validateProject(final Map<String, String> parameters) throws IOException {
135136
// Get project's configuration
136-
final var id = ObjectUtils.defaultIfNull(parameters.get(PARAMETER_PROJECT), "0");
137+
final var id = ObjectUtils.getIfNull(parameters.get(PARAMETER_PROJECT), "0");
137138
final var result = getProject(parameters, id);
138139
if (result == null) {
139140
// Invalid id
@@ -149,7 +150,7 @@ protected SonarProject validateProject(final Map<String, String> parameters) thr
149150
* @return the detected SonarQube version.
150151
*/
151152
protected String validateAdminAccess(final Map<String, String> parameters) {
152-
final var url = StringUtils.appendIfMissing(parameters.get(PARAMETER_URL), "/") + "sessions/new";
153+
final var url = Strings.CS.appendIfMissing(parameters.get(PARAMETER_URL), "/") + "sessions/new";
153154

154155
try (final var curlProcessor = new CurlProcessor(CurlProcessor.DEFAULT_CALLBACK, CurlProcessor.DEFAULT_CONNECTION_TIMEOUT,
155156
CurlProcessor.DEFAULT_RESPONSE_TIMEOUT, true, null, null)) {
@@ -210,7 +211,7 @@ protected String getResource(final String version, final Map<String, String> par
210211
*/
211212
protected String getResource(final CurlProcessor processor, final String url, final String resource) {
212213
// Get the resource using the preempted authentication
213-
return processor.get(StringUtils.appendIfMissing(url, "/") + resource);
214+
return processor.get(Strings.CS.appendIfMissing(url, "/") + resource);
214215
}
215216

216217
@Override
@@ -280,7 +281,7 @@ protected SonarProject getProject(final Map<String, String> parameters, final St
280281
}
281282
}
282283
} else {
283-
project = objectMapper.readValue(StringUtils.removeEnd(StringUtils.removeStart(projectAsJson, "["), "]"), SonarProject.class);
284+
project = objectMapper.readValue(Strings.CS.removeEnd(Strings.CS.removeStart(projectAsJson, "["), "]"), SonarProject.class);
284285
}
285286

286287
// Map nicely the measures
@@ -308,7 +309,7 @@ private List<SonarBranch> getSonarBranches(final String version, final Map<Strin
308309
if (b2.isMain()) {
309310
return 1;
310311
}
311-
return StringUtils.compare(b2.getAnalysisDate(), b1.getAnalysisDate());
312+
return Strings.CS.compare(b2.getAnalysisDate(), b1.getAnalysisDate());
312313
}).limit(maxBranches).toList();
313314
final var branchMetrics = getParameter(parameters, PARAMETER_METRICS_BRANCHES, defaultMetrics);
314315
if (!branchMetrics.isBlank()) {
@@ -339,7 +340,7 @@ private Map<String, Integer> sanitizeMeasures(SonarProject project) {
339340
* Remove the wrapping '{..}' and return the first property
340341
*/
341342
private String unwrap(final String original) {
342-
return original == null ? null : StringUtils.removeEnd(original
343+
return original == null ? null : Strings.CS.removeEnd(original
343344
.replace("\n", "").replace("\r", "")
344345
.replaceFirst("\\{[ \t]*\"[a-zA-Z0-9_-]+\"[ \t]*:[ \t]*", ""), "}");
345346
}

0 commit comments

Comments
 (0)