We're updating the issue view to help you get more done. 

AbstractCachedDomainDataAccess.clearCache() throws MissingFormatArgumentException at DEBUG level

Description

While running my application with logging level set to DEBUG, the application throws java.util.MissingFormatArgumentException when org.hibernate.action.internal.BulkOperationCleanupAction was trying to clean up.

The stack trace (see at the bottom) reveals a bug in a class named AbstractCachedDomainDataAccess, which was introduced since 5.3. Please refer to the source code here.

It's obvious that parameter was missed in the statement, and that eventually caused below invocation (Slf4jLocationAwareLogger.doLogf in my case as I'm using Slf4j.

Root cause

1 2 // Eventually that will call String.format at runtime... String.format( "Clearing cache data map [region=`%s`]" );

I can change my logging settings to avoid this issue. However, it would still be great to fix it in case checking DEBUG output is required.

Stacktrace

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 org.hibernate.AssertionFailure: Exception releasing cache locks at org.hibernate.engine.spi.ActionQueue$AfterTransactionCompletionProcessQueue.afterTransactionCompletion(ActionQueue.java:990) at org.hibernate.engine.spi.ActionQueue.afterTransactionCompletion(ActionQueue.java:513) at org.hibernate.internal.SessionImpl.afterTransactionCompletion(SessionImpl.java:2501) at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.afterTransactionCompletion(JdbcCoordinatorImpl.java:479) at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.afterCompletionCallback(JdbcResourceLocalTransactionCoordinatorImpl.java:198) at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.access$400(JdbcResourceLocalTransactionCoordinatorImpl.java:39) at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl.commit(JdbcResourceLocalTransactionCoordinatorImpl.java:273) at org.hibernate.engine.transaction.internal.TransactionImpl.commit(TransactionImpl.java:98) at org.springframework.orm.hibernate5.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:582) // ... omit ... at java.lang.Thread.run(Thread.java:748) Caused by: java.util.MissingFormatArgumentException: Format specifier '%s' at java.util.Formatter.format(Formatter.java:2519) at java.util.Formatter.format(Formatter.java:2455) at java.lang.String.format(String.java:2940) at org.jboss.logging.Slf4jLocationAwareLogger.doLogf(Slf4jLocationAwareLogger.java:81) at org.jboss.logging.Logger.debugf(Logger.java:701) at org.hibernate.cache.spi.support.AbstractCachedDomainDataAccess.clearCache(AbstractCachedDomainDataAccess.java:43) at org.hibernate.cache.spi.support.AbstractEntityDataAccess.unlockRegion(AbstractEntityDataAccess.java:60) at org.hibernate.action.internal.BulkOperationCleanupAction$EntityCleanup.release(BulkOperationCleanupAction.java:226) at org.hibernate.action.internal.BulkOperationCleanupAction$EntityCleanup.access$300(BulkOperationCleanupAction.java:213) at org.hibernate.action.internal.BulkOperationCleanupAction$1.doAfterTransactionCompletion(BulkOperationCleanupAction.java:185) at org.hibernate.engine.spi.ActionQueue$AfterTransactionCompletionProcessQueue.afterTransactionCompletion(ActionQueue.java:983) ... 66 more

Environment

None

Status

Assignee

Guillaume Smet

Reporter

Bin Chen

backPortable

Backport?

Components

Fix versions

Affects versions

5.3.1
5.3.2
5.3.3
5.3.4
5.3.5

Priority

Minor