Skip to content

Commit 65d3796

Browse files
Fix SpotBugs SBSC_USE_STRINGBUFFER_CONCATENATION warnings
Replaced string concatenation in loops with StringBuilder in multiple files to improve performance and satisfy SpotBugs checks. Updated .github/scripts/generate-quality-report.py to fail on this violation. Fixed compilation errors in ComponentSelector and InnerActive by calling toString() before indexOf/substring on StringBuilder, as CN1's StringBuilder lacks these methods.
1 parent 0834dac commit 65d3796

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

CodenameOne/src/com/codename1/ads/InnerActive.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public void initService(Ads ads) {
148148
for (int i = 0; i < klen; i++) {
149149
k.append(",").append(keywords[i]);
150150
}
151-
addParam(this, "k", k.substring(1));
151+
addParam(this, "k", k.toString().substring(1));
152152
}
153153
if (testAds) {
154154
addParam(this, "test", "1");

CodenameOne/src/com/codename1/ui/ComponentSelector.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2231,7 +2231,7 @@ public ComponentSelector addTags(String... tags) {
22312231

22322232
StringBuilder existingBuilder = new StringBuilder(existing);
22332233
for (String tag : tags) {
2234-
if (existingBuilder.indexOf(" " + tag + " ") == -1) {
2234+
if (existingBuilder.toString().indexOf(" " + tag + " ") == -1) {
22352235
existingBuilder.append(" ").append(tag).append(" ");
22362236
}
22372237
}

0 commit comments

Comments
 (0)