-
Notifications
You must be signed in to change notification settings - Fork 10
Description
Hi,
I have not tested this issue extensively and it could be the issue of my logging implementation.
I have a System.LoggerFinder implementation, which correctly uses MessageFormat akin to the official JDK one, and experiences this issue.
In the following file/line:
| logger.log(Level.TRACE,() -> "protocol "+protocol+" uri "+uri+" headers "+headers); |
the log entry seems to send {} somewhere in the log, presumably some part of the request?
[27/12/2025 23:46:10 | Tracing | avaje-jex-http-21 | robaho.net.httpserver.-190685534] closing connection: [80.57725]
[27/12/2025 23:46:10 | Tracing | avaje-jex-http-21 | robaho.net.httpserver] closing connection: remote /127.0.0.1:57725
[27/12/2025 23:46:10 | Tracing | avaje-jex-http-21 | robaho.net.httpserver.-190685534] exchange finished [80.57725]
[27/12/2025 23:46:10 | Tracing | avaje-jex-http-22 | robaho.net.httpserver.-190685534] accepted connection: Socket[addr=/127.0.0.1,port=57726,localport=80]
[27/12/2025 23:46:10 | Tracing | avaje-jex-http-22 | robaho.net.httpserver.-190685534] reading request
[27/12/2025 23:46:10 | Tracing | avaje-jex-http-22 | robaho.net.httpserver.-190685534] exchange started [80.57726]
[27/12/2025 23:46:10 | Diagnosis | avaje-jex-http-22 | robaho.net.httpserver.-190685534] Exchange request line: GET / HTTP/1.1
[27/12/2025 23:46:10 | Warning | avaje-jex-http-22 | robaho.net.httpserver.-190685534] ServerImpl unexpected exception
java.lang.IllegalArgumentException: can't parse argument number: {}
at java.base/java.text.MessageFormat.setFormatFromPattern(MessageFormat.java:1644)
at java.base/java.text.MessageFormat.applyPatternImpl(MessageFormat.java:660)
at java.base/java.text.MessageFormat.<init>(MessageFormat.java:516)
...
at robaho.httpserver/robaho.net.httpserver.ServerImpl$Exchange.runPerRequest(ServerImpl.java:772)
at robaho.httpserver/robaho.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:637)
at robaho.httpserver/robaho.net.httpserver.ServerImpl$Dispatcher.acceptConnection(ServerImpl.java:426)
at robaho.httpserver/robaho.net.httpserver.ServerImpl$Dispatcher.lambda$run$0(ServerImpl.java:349)
at java.base/java.util.concurrent.ThreadPerTaskExecutor$TaskRunner.run(ThreadPerTaskExecutor.java:291)
at java.base/java.lang.VirtualThread.run(VirtualThread.java:462)
Caused by: java.lang.NumberFormatException: For input string: " {} "
at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
at java.base/java.lang.Integer.parseInt(Integer.java:565)
at java.base/java.lang.Integer.parseInt(Integer.java:662)
at java.base/java.text.MessageFormat.setFormatFromPattern(MessageFormat.java:1642)
... 13 more
This appears to clash with MessageFormat for me? The IllegalArgumentException appears to prevent my application from starting.
Removing robaho/httpserver from the module-path has my application working again.
I believe this could be solved if we leverage the formatter.
(and I don't think we need to use the Supplier lambda, if using formatter, as it won't call toString if level disabled)
- logger.log(Level.TRACE,() -> "protocol "+protocol+" uri "+uri+" headers "+headers);
+ logger.log(Level.TRACE, "protocol {0} uri {1} headers {2}", protocol, uri, headers);CC @SentryMan