Skip to content

Commit 55180ff

Browse files
committed
fix infoString()
1 parent 06b5145 commit 55180ff

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

hibernate-core/src/main/java/org/hibernate/engine/spi/EntityKey.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@
1111

1212
import org.hibernate.AssertionFailure;
1313
import org.hibernate.persister.entity.EntityPersister;
14-
import org.hibernate.pretty.MessageHelper;
1514
import org.hibernate.type.Type;
1615

1716
import org.checkerframework.checker.nullness.qual.Nullable;
1817

18+
import static org.hibernate.pretty.MessageHelper.infoString;
19+
1920
/**
2021
* Uniquely identifies of an entity instance in a particular Session by identifier.
2122
* Note that it's only safe to be used within the scope of a Session: it doesn't consider for example the tenantId
@@ -117,7 +118,7 @@ public int hashCode() {
117118

118119
@Override
119120
public String toString() {
120-
return "EntityKey" + MessageHelper.infoString( this.persister, identifier, persister.getFactory() );
121+
return "EntityKey" + infoString( this.persister, identifier, persister.getFactory() );
121122
}
122123

123124
/**

hibernate-core/src/main/java/org/hibernate/pretty/MessageHelper.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,17 +87,15 @@ public static String infoString(
8787
info.append( " with null id" );
8888
}
8989
else {
90-
info.append( " with id '" ).append( id ).append( "'" );
90+
info.append( " with id '" );
9191
if ( idType == null ) {
9292
info.append( id );
9393
}
94+
else if ( factory != null ) {
95+
info.append( idType.toLoggableString( id, factory ) );
96+
}
9497
else {
95-
if ( factory != null ) {
96-
info.append( idType.toLoggableString( id, factory ) );
97-
}
98-
else {
99-
info.append( "<not loggable>" );
100-
}
98+
info.append( "<not loggable>" );
10199
}
102100
info.append( "'" );
103101
}

0 commit comments

Comments
 (0)