This is an automated email from the ASF dual-hosted git repository.
jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git
The following commit(s) were added to refs/heads/master by this push:
new 1c8866b68a SonarQube bug fixes
1c8866b68a is described below
commit 1c8866b68aa8ea29e02c6e95011260286d1179ac
Author: James Bognar <[email protected]>
AuthorDate: Wed Feb 18 13:34:52 2026 -0500
SonarQube bug fixes
---
.../main/java/org/apache/juneau/commons/utils/StringUtils.java | 7 +++++--
.../org/apache/juneau/rest/processor/ThrowableProcessor.java | 9 ++-------
scripts/prompt-pgp-passphrase.py | 10 +++-------
3 files changed, 10 insertions(+), 16 deletions(-)
diff --git
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/utils/StringUtils.java
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/utils/StringUtils.java
index baa91e07f0..0d95716bb1 100644
---
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/utils/StringUtils.java
+++
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/utils/StringUtils.java
@@ -2384,7 +2384,8 @@ public class StringUtils {
* @return Just the authority portion of the URI.
*/
@SuppressWarnings({
- "java:S3776" // Cognitive complexity acceptable for state
machine-based URI parser
+ "java:S3516", // Returns s or s.substring(0,i) - different
values per parse path
+ "java:S3776" // Cognitive complexity acceptable for state
machine-based URI parser
})
public static String getAuthorityUri(String s) {
@@ -2836,7 +2837,8 @@ public class StringUtils {
* @return The interpolated string with variables replaced, or the
original template if variables is null or empty.
*/
@SuppressWarnings({
- "java:S135" // Multiple break statements in mutually exclusive
branches - necessary for early termination
+ "java:S135", // Multiple break statements in mutually
exclusive branches - necessary for early termination
+ "java:S3516" // Returns varying result based on template and
variables
})
public static String interpolate(String template, Map<String,Object>
variables) {
if (template == null)
@@ -3546,6 +3548,7 @@ public class StringUtils {
* @param threshold The similarity threshold (0.0 to 1.0).
* @return <jk>true</jk> if the similarity is greater than or equal to
the threshold, <jk>false</jk> otherwise.
*/
+ @SuppressWarnings("java:S3516") // Result varies based on
similarity(str1, str2) and threshold
public static boolean isSimilar(String str1, String str2, double
threshold) {
return similarity(str1, str2) >= threshold;
}
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/processor/ThrowableProcessor.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/processor/ThrowableProcessor.java
index d79a4715b7..a030105104 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/processor/ThrowableProcessor.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/processor/ThrowableProcessor.java
@@ -35,15 +35,10 @@ public class ThrowableProcessor implements
ResponseProcessor {
@Override /* Overridden from ResponseProcessor */
public int process(RestOpSession opSession) throws IOException {
-
RestResponse res = opSession.getResponse();
Throwable t = res.getContent(Throwable.class);
-
- if (t == null)
- return NEXT;
-
- res.addHeader(Thrown.of(t));
-
+ if (t != null)
+ res.addHeader(Thrown.of(t));
return NEXT; // Continue processing as bean.
}
}
\ No newline at end of file
diff --git a/scripts/prompt-pgp-passphrase.py b/scripts/prompt-pgp-passphrase.py
index de2402cc5f..8196036264 100755
--- a/scripts/prompt-pgp-passphrase.py
+++ b/scripts/prompt-pgp-passphrase.py
@@ -34,7 +34,7 @@ import tempfile
def prompt_pgp_passphrase():
"""
Make a dummy PGP call to prompt for passphrase early in the execution.
-
+
This ensures the user is prompted for their PGP passphrase at the beginning
rather than waiting until signing is needed near the end of the process.
"""
@@ -44,7 +44,7 @@ def prompt_pgp_passphrase():
with tempfile.NamedTemporaryFile(mode='w', delete=False,
suffix='.txt') as tmp:
tmp.write("dummy")
tmp_path = tmp.name
-
+
try:
# Attempt to sign the dummy file (this will prompt for passphrase)
# Don't use --batch so it will prompt interactively for passphrase
@@ -63,20 +63,16 @@ def prompt_pgp_passphrase():
except OSError:
pass
print("✅ PGP passphrase entered successfully")
- return True
except subprocess.TimeoutExpired:
print("⚠ PGP passphrase prompt timed out (this is okay if signing
isn't needed)")
- return True
except FileNotFoundError:
print("⚠ gpg command not found - skipping PGP passphrase prompt")
- return True
except Exception as e:
# If signing fails for any reason, that's okay - we're just trying
to prompt early
print(f"⚠ Could not prompt for PGP passphrase: {e}")
- return True
except Exception as e:
print(f"⚠ Could not set up PGP passphrase prompt: {e}")
- return True
+ return True # Never block the build; we're best-effort
def main():