diff --git a/hibernate-core/src/main/java/org/hibernate/NonUniqueObjectException.java b/hibernate-core/src/main/java/org/hibernate/NonUniqueObjectException.java index a2b57e76e1..720af4130b 100644 --- a/hibernate-core/src/main/java/org/hibernate/NonUniqueObjectException.java +++ b/hibernate-core/src/main/java/org/hibernate/NonUniqueObjectException.java @@ -6,7 +6,7 @@ */ package org.hibernate; -import org.hibernate.pretty.MessageHelper; +import static org.hibernate.pretty.MessageHelper.infoString; /** * This exception is thrown when an operation would break session-scoped identity. @@ -57,6 +57,6 @@ public class NonUniqueObjectException extends HibernateException { @Override public String getMessage() { - return super.getMessage() + " : " + MessageHelper.infoString( entityName, identifier ); + return super.getMessage() + ": " + infoString( entityName, identifier ); } } diff --git a/hibernate-core/src/main/java/org/hibernate/PropertyValueException.java b/hibernate-core/src/main/java/org/hibernate/PropertyValueException.java index d6e4f19dd8..5020d939ee 100644 --- a/hibernate-core/src/main/java/org/hibernate/PropertyValueException.java +++ b/hibernate-core/src/main/java/org/hibernate/PropertyValueException.java @@ -6,7 +6,7 @@ */ package org.hibernate; -import org.hibernate.internal.util.StringHelper; +import static org.hibernate.internal.util.StringHelper.qualify; /** * Thrown when the (illegal) value of a property can not be persisted. @@ -47,6 +47,6 @@ public class PropertyValueException extends HibernateException { @Override public String getMessage() { - return super.getMessage() + " : " + StringHelper.qualify( entityName, propertyName ); + return super.getMessage() + ": " + qualify( entityName, propertyName ); } } diff --git a/hibernate-core/src/main/java/org/hibernate/StaleObjectStateException.java b/hibernate-core/src/main/java/org/hibernate/StaleObjectStateException.java index e23b18992c..621041fb2e 100644 --- a/hibernate-core/src/main/java/org/hibernate/StaleObjectStateException.java +++ b/hibernate-core/src/main/java/org/hibernate/StaleObjectStateException.java @@ -6,7 +6,7 @@ */ package org.hibernate; -import org.hibernate.pretty.MessageHelper; +import static org.hibernate.pretty.MessageHelper.infoString; /** * A specialized {@link StaleStateException} that carries information about @@ -38,7 +38,7 @@ public class StaleObjectStateException extends StaleStateException { } public String getMessage() { - return super.getMessage() + " : " + MessageHelper.infoString( entityName, identifier ); + return super.getMessage() + ": " + infoString( entityName, identifier ); } } diff --git a/hibernate-core/src/main/java/org/hibernate/TransientPropertyValueException.java b/hibernate-core/src/main/java/org/hibernate/TransientPropertyValueException.java index 83ab4d5ca4..caea0ae8d2 100644 --- a/hibernate-core/src/main/java/org/hibernate/TransientPropertyValueException.java +++ b/hibernate-core/src/main/java/org/hibernate/TransientPropertyValueException.java @@ -6,7 +6,7 @@ */ package org.hibernate; -import org.hibernate.internal.util.StringHelper; +import static org.hibernate.internal.util.StringHelper.qualify; /** * Thrown when a property cannot be persisted because it is an association @@ -69,7 +69,7 @@ public class TransientPropertyValueException extends TransientObjectException { @Override public String getMessage() { - return super.getMessage() + " : " - + StringHelper.qualify( propertyOwnerEntityName, propertyName ) + " -> " + transientEntityName; + return super.getMessage() + ": " + + qualify( propertyOwnerEntityName, propertyName ) + " -> " + transientEntityName; } } diff --git a/hibernate-core/src/main/java/org/hibernate/UnresolvableObjectException.java b/hibernate-core/src/main/java/org/hibernate/UnresolvableObjectException.java index 9cf5df0a05..2735626008 100644 --- a/hibernate-core/src/main/java/org/hibernate/UnresolvableObjectException.java +++ b/hibernate-core/src/main/java/org/hibernate/UnresolvableObjectException.java @@ -6,7 +6,7 @@ */ package org.hibernate; -import org.hibernate.pretty.MessageHelper; +import static org.hibernate.pretty.MessageHelper.infoString; /** * Thrown when Hibernate could not resolve an object by id, especially when @@ -60,7 +60,7 @@ public class UnresolvableObjectException extends HibernateException { @Override public String getMessage() { - return super.getMessage() + ": " + MessageHelper.infoString( entityName, identifier ); + return super.getMessage() + ": " + infoString( entityName, identifier ); } } diff --git a/hibernate-core/src/main/java/org/hibernate/boot/MappingException.java b/hibernate-core/src/main/java/org/hibernate/boot/MappingException.java index 70190de9fa..0b62016cca 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/MappingException.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/MappingException.java @@ -28,11 +28,10 @@ public class MappingException extends org.hibernate.MappingException { @Override public String getMessage() { - String message = super.getMessage(); - if (origin != null) { - message += " : origin(" + origin.getName() + ")"; - } - return message; + final String message = super.getMessage(); + return origin != null + ? message + " [" + origin.getName() + "]" + : message; } public Origin getOrigin() {