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 0fd2124bd5 Fix flaky Jetty redirect test, reword TODO refs, harden gpg
resolution
0fd2124bd5 is described below
commit 0fd2124bd572c6888c9215f4684c82da6b4c43d5
Author: James Bognar <[email protected]>
AuthorDate: Mon Aug 10 10:10:52 2026 -0400
Fix flaky Jetty redirect test, reword TODO refs, harden gpg resolution
- JettyHttpTransport_RedirectCredentials_Test: force "Connection: close" on
the 302 response so Jetty's HttpClient opens a fresh connection for the
redirected request instead of racing to reuse a socket that the JDK's
com.sun.net.httpserver may already be tearing down (flaky EOFException in
CI).
- McpDispatchResult / McpResourceTemplateRegistry_Test: reword comments to
drop
the stale internal work-item numbers (TODO-336 cleanup).
- prompt-pgp-passphrase.py: resolve the gpg binary robustly via PATH,
git config gpg.program, and common Homebrew/Linux install locations rather
than assuming "gpg" is on PATH.
---
...ettyHttpTransport_RedirectCredentials_Test.java | 4 +++
.../juneau/rest/server/mcp/McpDispatchResult.java | 2 +-
.../mcp/McpResourceTemplateRegistry_Test.java | 2 +-
scripts/prompt-pgp-passphrase.py | 38 +++++++++++++++++++++-
4 files changed, 43 insertions(+), 3 deletions(-)
diff --git
a/juneau-rest/juneau-rest-client-jetty/src/test/java/org/apache/juneau/rest/client/JettyHttpTransport_RedirectCredentials_Test.java
b/juneau-rest/juneau-rest-client-jetty/src/test/java/org/apache/juneau/rest/client/JettyHttpTransport_RedirectCredentials_Test.java
index abfa839c47..c6ec05e404 100644
---
a/juneau-rest/juneau-rest-client-jetty/src/test/java/org/apache/juneau/rest/client/JettyHttpTransport_RedirectCredentials_Test.java
+++
b/juneau-rest/juneau-rest-client-jetty/src/test/java/org/apache/juneau/rest/client/JettyHttpTransport_RedirectCredentials_Test.java
@@ -81,6 +81,10 @@ class JettyHttpTransport_RedirectCredentials_Test {
private static void redirect(HttpExchange exchange, String location)
throws IOException {
exchange.getResponseHeaders().add("Location", location);
+ // Force connection close so Jetty's HttpClient always opens a
fresh connection for the redirected
+ // request instead of racing to reuse this connection, which
com.sun.net.httpserver may already be
+ // tearing down (observed as a same-origin-redirect
EOFException on the reused socket).
+ exchange.getResponseHeaders().set("Connection", "close");
exchange.sendResponseHeaders(302, -1);
exchange.close();
}
diff --git
a/juneau-rest/juneau-rest-server-mcp/src/main/java/org/apache/juneau/rest/server/mcp/McpDispatchResult.java
b/juneau-rest/juneau-rest-server-mcp/src/main/java/org/apache/juneau/rest/server/mcp/McpDispatchResult.java
index 738659804d..c601a91594 100644
---
a/juneau-rest/juneau-rest-server-mcp/src/main/java/org/apache/juneau/rest/server/mcp/McpDispatchResult.java
+++
b/juneau-rest/juneau-rest-server-mcp/src/main/java/org/apache/juneau/rest/server/mcp/McpDispatchResult.java
@@ -28,7 +28,7 @@ package org.apache.juneau.rest.server.mcp;
*
* <p>
* Introduced so callers {@code switch}/{@code instanceof}-pattern-match over
a closed, compiler-checked
- * set of outcomes instead of casting the historical {@code Object}-typed
return value (work item 331).
+ * set of outcomes instead of casting the historical {@code Object}-typed
return value.
*
* @since 10.0.0
*/
diff --git
a/juneau-rest/juneau-rest-server-mcp/src/test/java/org/apache/juneau/rest/server/mcp/McpResourceTemplateRegistry_Test.java
b/juneau-rest/juneau-rest-server-mcp/src/test/java/org/apache/juneau/rest/server/mcp/McpResourceTemplateRegistry_Test.java
index f9ea27bc78..b7b98ce6cd 100644
---
a/juneau-rest/juneau-rest-server-mcp/src/test/java/org/apache/juneau/rest/server/mcp/McpResourceTemplateRegistry_Test.java
+++
b/juneau-rest/juneau-rest-server-mcp/src/test/java/org/apache/juneau/rest/server/mcp/McpResourceTemplateRegistry_Test.java
@@ -335,7 +335,7 @@ class McpResourceTemplateRegistry_Test {
}
//-----------------------------------------------------------------------------------------------------------------
- // G: coverage for work item 316 - the per-handler compiled
McpUriTemplateMatcher cache
+ // G: coverage for the per-handler compiled McpUriTemplateMatcher cache
//-----------------------------------------------------------------------------------------------------------------
@Nested class G_compiledMatcherCache {
diff --git a/scripts/prompt-pgp-passphrase.py b/scripts/prompt-pgp-passphrase.py
index 8196036264..b664a5cecc 100755
--- a/scripts/prompt-pgp-passphrase.py
+++ b/scripts/prompt-pgp-passphrase.py
@@ -26,11 +26,44 @@ Usage: python3 scripts/prompt-pgp-passphrase.py
"""
import os
+import shutil
import subprocess
import sys
import tempfile
+def _resolve_gpg():
+ """
+ Resolve a usable path to the gpg binary.
+
+ Tries, in order: a PATH lookup, the path configured via
+ `git config --get gpg.program`, and a few common install locations
+ (Homebrew on Apple Silicon/Intel, and the typical Linux location).
+ Returns None if no usable gpg binary can be found.
+ """
+ found = shutil.which("gpg")
+ if found:
+ return found
+
+ try:
+ result = subprocess.run(
+ ["git", "config", "--get", "gpg.program"],
+ capture_output=True,
+ text=True
+ )
+ configured = result.stdout.strip()
+ if configured and os.path.isfile(configured) and os.access(configured,
os.X_OK):
+ return configured
+ except (OSError, subprocess.SubprocessError):
+ pass
+
+ for candidate in ("/opt/homebrew/bin/gpg", "/usr/local/bin/gpg",
"/usr/bin/gpg"):
+ if os.path.isfile(candidate) and os.access(candidate, os.X_OK):
+ return candidate
+
+ return None
+
+
def prompt_pgp_passphrase():
"""
Make a dummy PGP call to prompt for passphrase early in the execution.
@@ -46,11 +79,14 @@ def prompt_pgp_passphrase():
tmp_path = tmp.name
try:
+ gpg_path = _resolve_gpg()
+ if gpg_path is None:
+ raise FileNotFoundError("gpg command not found")
# Attempt to sign the dummy file (this will prompt for passphrase)
# Don't use --batch so it will prompt interactively for passphrase
# Use --yes to auto-confirm overwrite prompts, but allow
passphrase prompt
subprocess.run(
- ["gpg", "--yes", "--clearsign", tmp_path],
+ [gpg_path, "--yes", "--clearsign", tmp_path],
capture_output=False, # Don't capture output so user can see
the prompt
text=True,
timeout=60 # 60 second timeout for passphrase entry