Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging an argument with a '{' leads to FORMAT_FAILURE #12634

Closed
vsevel opened this issue Oct 9, 2020 · 7 comments
Closed

Logging an argument with a '{' leads to FORMAT_FAILURE #12634

vsevel opened this issue Oct 9, 2020 · 7 comments
Labels
kind/bug Something isn't working triage/duplicate This issue or pull request already exists

Comments

@vsevel
Copy link
Contributor

vsevel commented Oct 9, 2020

Describe the bug
execute this in a quarkus application:

log.info("{}", "hello{");

Expected behavior

17:58:11,190  INFO com....MyClass hello{

Actual behavior

LogManager error of type FORMAT_FAILURE: Formatting error
java.lang.IllegalArgumentException: Unmatched braces in the pattern.
        at java.base/java.text.MessageFormat.applyPattern(MessageFormat.java:520)
        at java.base/java.text.MessageFormat.<init>(MessageFormat.java:370)
        at java.base/java.text.MessageFormat.format(MessageFormat.java:859)
        at org.jboss.logmanager.ExtFormatter.formatMessageLegacy(ExtFormatter.java:107)
        at org.jboss.logmanager.ExtFormatter.formatMessage(ExtFormatter.java:70)
        at org.jboss.logmanager.formatters.Formatters$16.renderRaw(Formatters.java:781)
        at org.jboss.logmanager.formatters.Formatters$JustifyingFormatStep.render(Formatters.java:221)
        at org.jboss.logmanager.formatters.MultistepFormatter.format(MultistepFormatter.java:86)
        at io.quarkus.runtime.logging.BannerFormatter.format(BannerFormatter.java:56)
        at org.jboss.logmanager.ExtFormatter.format(ExtFormatter.java:32)
        at org.jboss.logmanager.handlers.WriterHandler.doPublish(WriterHandler.java:43)
        at org.jboss.logmanager.ExtHandler.publish(ExtHandler.java:66)
        at org.jboss.logmanager.handlers.DelayedHandler.publishToChildren(DelayedHandler.java:208)
        at org.jboss.logmanager.handlers.DelayedHandler.doPublish(DelayedHandler.java:49)
        at org.jboss.logmanager.ExtHandler.publish(ExtHandler.java:66)
        at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:316)
        at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:324)
        at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:324)
        at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:324)
        at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:324)
        at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:324)
        at org.jboss.logmanager.Logger.logRaw(Logger.java:748)
        at org.jboss.logmanager.Logger.log(Logger.java:706)
        at org.jboss.logging.JBossLogManagerLogger.doLog(JBossLogManagerLogger.java:44)
        at org.jboss.logging.Logger.log(Logger.java:2103)
        at org.jboss.slf4j.JBossLoggerAdapter.log(JBossLoggerAdapter.java:302)
        at org.jboss.slf4j.JBossLoggerAdapter.info(JBossLoggerAdapter.java:180)
        at com...MyClass.run(MyClass.java:78)

It sounds like the argument is interpreted itself as a pattern.

This leads to issues when libraries pass arguments that include tokens that are recognized by the java.text.MessageFormat as pattern reserved symbols.
Such as https://github.com/hierynomus/smbj/blob/master/src/main/java/com/hierynomus/smbj/connection/ConnectionInfo.java#L128-L140

@vsevel vsevel added the kind/bug Something isn't working label Oct 9, 2020
@gastaldi
Copy link
Contributor

gastaldi commented Oct 9, 2020

@vsevel does this happen in Quarkus 1.8.2.Final too?

@gsmet
Copy link
Member

gsmet commented Oct 9, 2020

I think this is a duplicate of #12615 .

Can you try with the just released 1.8.3.Final?

@vsevel
Copy link
Contributor Author

vsevel commented Oct 12, 2020

@gastaldi @gsmet I confirm the problem is on 1.8.2 but not on 1.8.3

@gastaldi
Copy link
Contributor

Closing then as it is fixed in 1.8.3. Thanks!

@vsevel
Copy link
Contributor Author

vsevel commented Oct 12, 2020

@gastaldi well the issue is for 1.9.0.CR1 (which as the problem), not for 1.8.X

@gastaldi
Copy link
Contributor

Ah maybe the fix wasn't available when 1.9.0
CR1 was released? Can you give it a try with the latest master?

@gsmet
Copy link
Member

gsmet commented Oct 12, 2020

Yes, 1.9.0.CR1 does not contain the fix. It will be included in 1.9.0.Final.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working triage/duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants