fix error messages in InstantiationExceptions

This commit is contained in:
Gavin 2022-12-24 11:09:54 +01:00 committed by Gavin King
parent 2355f98586
commit 608e4ef6d6
7 changed files with 14 additions and 14 deletions

View File

@ -52,7 +52,7 @@ public class EmbeddableInstantiatorPojoIndirecting extends AbstractPojoInstantia
return constructor.newInstance( values );
}
catch ( Exception e ) {
throw new InstantiationException( "Could not instantiate entity: ", getMappedPojoClass(), e );
throw new InstantiationException( "Could not instantiate entity", getMappedPojoClass(), e );
}
}
@ -77,7 +77,7 @@ public class EmbeddableInstantiatorPojoIndirecting extends AbstractPojoInstantia
return constructor.newInstance( values );
}
catch ( Exception e ) {
throw new InstantiationException( "Could not instantiate entity: ", getMappedPojoClass(), e );
throw new InstantiationException( "Could not instantiate entity", getMappedPojoClass(), e );
}
}
}

View File

@ -50,7 +50,7 @@ public class EmbeddableInstantiatorPojoStandard extends AbstractPojoInstantiator
public Object instantiate(ValueAccess valuesAccess, SessionFactoryImplementor sessionFactory) {
if ( isAbstract() ) {
throw new InstantiationException(
"Cannot instantiate abstract class or interface: ", getMappedPojoClass()
"Cannot instantiate abstract class or interface", getMappedPojoClass()
);
}
@ -76,7 +76,7 @@ public class EmbeddableInstantiatorPojoStandard extends AbstractPojoInstantiator
return instance;
}
catch ( Exception e ) {
throw new InstantiationException( "Could not instantiate entity: ", getMappedPojoClass(), e );
throw new InstantiationException( "Could not instantiate entity", getMappedPojoClass(), e );
}
}
}

View File

@ -49,7 +49,7 @@ public class EmbeddableInstantiatorRecordIndirecting extends EmbeddableInstantia
return constructor.newInstance( values );
}
catch ( Exception e ) {
throw new InstantiationException( "Could not instantiate entity: ", getMappedPojoClass(), e );
throw new InstantiationException( "Could not instantiate entity", getMappedPojoClass(), e );
}
}
@ -78,7 +78,7 @@ public class EmbeddableInstantiatorRecordIndirecting extends EmbeddableInstantia
return constructor.newInstance( values );
}
catch ( Exception e ) {
throw new InstantiationException( "Could not instantiate entity: ", getMappedPojoClass(), e );
throw new InstantiationException( "Could not instantiate entity", getMappedPojoClass(), e );
}
}
}

View File

@ -38,7 +38,7 @@ public class EmbeddableInstantiatorRecordStandard extends AbstractPojoInstantiat
return constructor.newInstance( valuesAccess.getValues() );
}
catch ( Exception e ) {
throw new InstantiationException( "Could not instantiate entity: ", getMappedPojoClass(), e );
throw new InstantiationException( "Could not instantiate entity", getMappedPojoClass(), e );
}
}
}

View File

@ -95,17 +95,17 @@ public class EntityInstantiatorPojoStandard extends AbstractEntityInstantiatorPo
@Override
public Object instantiate(SessionFactoryImplementor sessionFactory) {
if ( isAbstract() ) {
throw new InstantiationException( "Cannot instantiate abstract class or interface: ", getMappedPojoClass() );
throw new InstantiationException( "Cannot instantiate abstract class or interface", getMappedPojoClass() );
}
else if ( constructor == null ) {
throw new InstantiationException( "No default constructor for entity: ", getMappedPojoClass() );
throw new InstantiationException( "No default constructor for entity", getMappedPojoClass() );
}
else {
try {
return applyInterception( constructor.newInstance( (Object[]) null ) );
}
catch ( Exception e ) {
throw new InstantiationException( "Could not instantiate entity: ", getMappedPojoClass(), e );
throw new InstantiationException( "Could not instantiate entity", getMappedPojoClass(), e );
}
}
}

View File

@ -113,7 +113,7 @@ public class ManagedBeanRegistryInitiator implements StandardServiceInitiator<Ma
return (BeanContainer) containerClass.newInstance();
}
catch (Exception e) {
throw new InstantiationException( "Unable to instantiate specified BeanContainer : " + containerClass.getName(), containerClass, e );
throw new InstantiationException( "Unable to instantiate specified BeanContainer", containerClass, e );
}
}

View File

@ -90,20 +90,20 @@ public class PojoInstantiator implements Instantiator, Serializable {
public Object instantiate() {
if ( isAbstract ) {
throw new InstantiationException( "Cannot instantiate abstract class or interface: ", mappedClass );
throw new InstantiationException( "Cannot instantiate abstract class or interface", mappedClass );
}
else if ( optimizer != null ) {
return optimizer.newInstance();
}
else if ( constructor == null ) {
throw new InstantiationException( "No default constructor for entity: ", mappedClass );
throw new InstantiationException( "No default constructor for entity", mappedClass );
}
else {
try {
return applyInterception( constructor.newInstance( (Object[]) null ) );
}
catch ( Exception e ) {
throw new InstantiationException( "Could not instantiate entity: ", mappedClass, e );
throw new InstantiationException( "Could not instantiate entity", mappedClass, e );
}
}
}