Skip to content

Commit

Permalink
Merge pull request #6873 from NotedSalmon/FISH-9175-spotbugs-concaten…
Browse files Browse the repository at this point in the history
…ated-strings-in-loop

FISH-9175 spotbugs concatenated strings in loop
  • Loading branch information
NotedSalmon authored Aug 9, 2024
2 parents 2dc8fdb + f74d019 commit 54138a4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* only if the new code is made subject to such option by the copyright
* holder.
*/
// Portions Copyright [2016-2022] [Payara Foundation and/or its affiliates]
// Portions Copyright [2016-2024] [Payara Foundation and/or its affiliates]

package org.glassfish.enterprise.iiop.impl;

Expand Down Expand Up @@ -952,19 +952,19 @@ private String[] getORBInitRef(String endpoints) {

private String getCorbalocURL(Object[] list) {

String corbalocURL = "";
StringBuilder corbalocURL = new StringBuilder();
//convert list into corbaloc url
for (int i = 0; i < list.length; i++) {
logger.log(Level.INFO, "list[i] ==> {0}", list[i]);
if (corbalocURL.equals("")) {
corbalocURL = IIOP_URL + ((String) list[i]).trim();
if (corbalocURL.length()==0) {
corbalocURL.append(IIOP_URL).append(((String) list[i]).trim());
} else {
corbalocURL = corbalocURL + "," +
IIOP_URL + ((String) list[i]).trim();
corbalocURL.append(",").append(IIOP_URL).append(((String) list[i]).trim());
}
}
logger.log(Level.INFO, "corbaloc url ==> {0}", corbalocURL);
return corbalocURL;
String corbalocURLString = corbalocURL.toString();
logger.info(() -> "corbaloc url ==> " + corbalocURLString);
return corbalocURLString;
}

String getIIOPEndpoints() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) [2018-2023] Payara Foundation and/or its affiliates. All rights reserved.
* Copyright (c) [2018-2024] Payara Foundation and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
Expand Down Expand Up @@ -366,10 +366,11 @@ private static String toName(MetricID metric, String suffix) {
}
if (name.indexOf('.') > 0) {
String[] words = name.split("\\.");
name = "";
StringBuilder nameBuilder = new StringBuilder();
for (String word : words) {
name += toFirstLetterUpperCase(word);
nameBuilder.append(toFirstLetterUpperCase(word));
}
name += nameBuilder.toString();
}
}
name = toFirstLetterUpperCase(name);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) [2016-2021] Payara Foundation and/or its affiliates. All rights reserved.
* Copyright (c) [2016-2024] Payara Foundation and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
Expand Down Expand Up @@ -202,21 +202,23 @@ public void execute(AdminCommandContext context)

// Skip if neither verbose or logOutput were selected
if (verbose || logOutput) {
String output = "";
StringBuilder output = new StringBuilder();

// Combine the success messages into one String
for (String successMessage : successMessages) {
output += "\n" + successMessage;
output.append("\n").append(successMessage);
}

String outputString = output.toString();

// Only print out the messages if verbose was chosen
if (verbose) {
actionReport.setMessage(output);
actionReport.setMessage(outputString);
}

// Only log the messages if logOutput was chosen
if (logOutput) {
Logger.getLogger(SendAsadminCommand.class.getName()).log(Level.INFO, output);
Logger.getLogger(SendAsadminCommand.class.getName()).info(()->outputString);
}
}

Expand Down

0 comments on commit 54138a4

Please sign in to comment.