Author: epbernard
Date: 2006-09-29 15:18:26 -0400 (Fri, 29 Sep 2006)
New Revision: 10537
Modified:
trunk/HibernateExt/metadata/src/java/org/hibernate/annotationfactory/AnnotationFactory.java
trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AbstractPropertyHolder.java
trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationBinder.java
trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationConfiguration.java
trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/BinderHelper.java
trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/CollectionBinder.java
trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/MapBinder.java
trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/Version.java
trunk/HibernateExt/metadata/src/java/org/hibernate/lucene/DocumentBuilder.java
trunk/HibernateExt/metadata/src/java/org/hibernate/lucene/event/LuceneEventListener.java
trunk/HibernateExt/metadata/src/java/org/hibernate/reflection/java/EJB3OverridenAnnotationReader.java
trunk/HibernateExt/metadata/src/java/org/hibernate/reflection/java/JavaXFactory.java
trunk/HibernateExt/metadata/src/java/org/hibernate/reflection/java/Pair.java
trunk/HibernateExt/metadata/src/java/org/hibernate/type/ByteArrayBlobType.java
trunk/HibernateExt/metadata/src/java/org/hibernate/type/CharacterArrayClobType.java
trunk/HibernateExt/metadata/src/java/org/hibernate/type/EnumType.java
trunk/HibernateExt/metadata/src/java/org/hibernate/validator/Environment.java
trunk/HibernateExt/metadata/src/java/org/hibernate/validator/event/ValidateEventListener.java
Log:
code cleaning, bug prevention
Modified:
trunk/HibernateExt/metadata/src/java/org/hibernate/annotationfactory/AnnotationFactory.java
===================================================================
---
trunk/HibernateExt/metadata/src/java/org/hibernate/annotationfactory/AnnotationFactory.java 2006-09-29
19:13:51 UTC (rev 10536)
+++
trunk/HibernateExt/metadata/src/java/org/hibernate/annotationfactory/AnnotationFactory.java 2006-09-29
19:18:26 UTC (rev 10537)
@@ -23,6 +23,9 @@
try {
return getProxyInstance( proxyClass, handler );
}
+ catch (RuntimeException e) {
+ throw e;
+ }
catch (Exception e) {
throw new RuntimeException( e );
}
Modified:
trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AbstractPropertyHolder.java
===================================================================
---
trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AbstractPropertyHolder.java 2006-09-29
19:13:51 UTC (rev 10536)
+++
trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AbstractPropertyHolder.java 2006-09-29
19:18:26 UTC (rev 10537)
@@ -75,7 +75,7 @@
*/
public Column[] getOverriddenColumn(String propertyName) {
Column[] override = null;
- if ( override == null && parent != null ) {
+ if ( parent != null ) {
override = parent.getOverriddenColumn( propertyName );
}
if ( override == null && currentPropertyColumnOverride != null ) {
@@ -92,7 +92,7 @@
*/
public JoinColumn[] getOverriddenJoinColumn(String propertyName) {
JoinColumn[] override = null;
- if ( override == null && parent != null ) {
+ if ( parent != null ) {
override = parent.getOverriddenJoinColumn( propertyName );
}
if ( override == null && currentPropertyJoinColumnOverride != null ) {
Modified: trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationBinder.java
===================================================================
---
trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationBinder.java 2006-09-29
19:13:51 UTC (rev 10536)
+++
trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationBinder.java 2006-09-29
19:18:26 UTC (rev 10537)
@@ -791,8 +791,7 @@
for ( int index = 0; index < deep ; index++ ) {
XClass clazz = classesToProcess.get( index );
- InheritanceState state = inheritanceStatePerClass.get( clazz );
-
+
boolean currentHasIdentifier = addElementsOfAClass(
elements, propertyHolder, isPropertyAnnotated,
accessType, clazz, mappings
Modified:
trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationConfiguration.java
===================================================================
---
trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationConfiguration.java 2006-09-29
19:13:51 UTC (rev 10536)
+++
trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationConfiguration.java 2006-09-29
19:18:26 UTC (rev 10537)
@@ -632,7 +632,7 @@
this.precedence = precedence;
}
- private class CacheHolder {
+ private static class CacheHolder {
public CacheHolder(String role, String usage, String region, boolean isClass, boolean
cacheLazy) {
this.role = role;
this.usage = usage;
Modified: trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/BinderHelper.java
===================================================================
--- trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/BinderHelper.java 2006-09-29
19:13:51 UTC (rev 10536)
+++ trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/BinderHelper.java 2006-09-29
19:18:26 UTC (rev 10537)
@@ -408,7 +408,7 @@
params.setProperty( (String) elt.getKey(), (String) elt.getValue() );
}
}
- if ( generatorType == "assigned" ) id.setNullValue( "undefined" );
+ if ( "assigned".equals( generatorType ) ) id.setNullValue(
"undefined" );
id.setIdentifierGeneratorProperties( params );
}
Modified:
trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/CollectionBinder.java
===================================================================
---
trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/CollectionBinder.java 2006-09-29
19:13:51 UTC (rev 10536)
+++
trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/CollectionBinder.java 2006-09-29
19:18:26 UTC (rev 10537)
@@ -22,12 +22,15 @@
import org.hibernate.AssertionFailure;
import org.hibernate.FetchMode;
import org.hibernate.MappingException;
-import org.hibernate.annotations.AccessType;
import org.hibernate.annotations.BatchSize;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CollectionId;
import org.hibernate.annotations.CollectionOfElements;
import org.hibernate.annotations.Fetch;
+import org.hibernate.annotations.Filter;
+import org.hibernate.annotations.FilterJoinTable;
+import org.hibernate.annotations.FilterJoinTables;
+import org.hibernate.annotations.Filters;
import org.hibernate.annotations.ForeignKey;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;
@@ -35,10 +38,6 @@
import org.hibernate.annotations.Sort;
import org.hibernate.annotations.SortType;
import org.hibernate.annotations.Where;
-import org.hibernate.annotations.Filter;
-import org.hibernate.annotations.Filters;
-import org.hibernate.annotations.FilterJoinTable;
-import org.hibernate.annotations.FilterJoinTables;
import org.hibernate.annotations.WhereJoinTable;
import org.hibernate.cfg.AnnotatedClassType;
import org.hibernate.cfg.AnnotationBinder;
@@ -67,11 +66,10 @@
import org.hibernate.mapping.Selectable;
import org.hibernate.mapping.SimpleValue;
import org.hibernate.mapping.Table;
-import org.hibernate.reflection.XAnnotatedElement;
import org.hibernate.reflection.XClass;
import org.hibernate.reflection.XProperty;
+import org.hibernate.util.CollectionHelper;
import org.hibernate.util.StringHelper;
-import org.hibernate.util.CollectionHelper;
/**
* Collection binder
@@ -309,6 +307,12 @@
try {
collection.setComparator( (Comparator) comparator.newInstance() );
}
+ catch (ClassCastException e) {
+ throw new AnnotationException(
+ "Comparator not implementing java.util.Comparator class: "
+ + comparator.getName() + "(" + safeCollectionRole() + ")"
+ );
+ }
catch (Exception e) {
throw new AnnotationException(
"Could not instantiate comparator class: "
@@ -1118,10 +1122,8 @@
if ( AnnotatedClassType.EMBEDDABLE.equals( classType ) ) {
EntityBinder entityBinder = new EntityBinder();
- Embeddable embeddable = (Embeddable) elementClass.getAnnotation( Embeddable.class );
PersistentClass owner = collValue.getOwner();
boolean isPropertyAnnotated;
- AccessType access = ( (XAnnotatedElement) elementClass ).getAnnotation(
AccessType.class );
//FIXME support @Access for collection of elements
//String accessType = access != null ? access.value() : null;
if ( owner.getIdentifierProperty() != null ) {
Modified:
trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/MapBinder.java
===================================================================
---
trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/MapBinder.java 2006-09-29
19:13:51 UTC (rev 10536)
+++
trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/MapBinder.java 2006-09-29
19:18:26 UTC (rev 10537)
@@ -7,16 +7,11 @@
import java.util.Random;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
-import javax.persistence.Embeddable;
import org.hibernate.AnnotationException;
import org.hibernate.AssertionFailure;
import org.hibernate.FetchMode;
import org.hibernate.MappingException;
-import org.hibernate.dialect.HSQLDialect;
-import org.hibernate.sql.Template;
-import org.hibernate.util.StringHelper;
-import org.hibernate.annotations.AccessType;
import org.hibernate.cfg.AnnotatedClassType;
import org.hibernate.cfg.AnnotationBinder;
import org.hibernate.cfg.BinderHelper;
@@ -29,6 +24,7 @@
import org.hibernate.cfg.PropertyHolderBuilder;
import org.hibernate.cfg.PropertyPreloadedData;
import org.hibernate.cfg.SecondPass;
+import org.hibernate.dialect.HSQLDialect;
import org.hibernate.mapping.Collection;
import org.hibernate.mapping.Column;
import org.hibernate.mapping.Component;
@@ -40,12 +36,12 @@
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Property;
import org.hibernate.mapping.SimpleValue;
-import org.hibernate.mapping.Table;
import org.hibernate.mapping.ToOne;
import org.hibernate.mapping.Value;
-import org.hibernate.reflection.XAnnotatedElement;
import org.hibernate.reflection.XClass;
import org.hibernate.reflection.XProperty;
+import org.hibernate.sql.Template;
+import org.hibernate.util.StringHelper;
/**
* Implementation to bind a Map
@@ -167,10 +163,8 @@
if ( AnnotatedClassType.EMBEDDABLE.equals( classType ) ) {
EntityBinder entityBinder = new EntityBinder();
- Embeddable embeddable = (Embeddable) elementClass.getAnnotation( Embeddable.class
);
PersistentClass owner = mapValue.getOwner();
boolean isPropertyAnnotated;
- AccessType access = ( (XAnnotatedElement) elementClass ).getAnnotation(
AccessType.class );
//FIXME support @Access for collection of elements
//String accessType = access != null ? access.value() : null;
if ( owner.getIdentifierProperty() != null ) {
@@ -252,23 +246,18 @@
else if ( element instanceof DependantValue ) {
//TODO this never happen I think
if ( propertyName != null ) {
- Collection coll = (Collection) associatedClass.getRecursiveProperty( propertyName )
- .getValue();
referencedPropertyName = collection.getReferencedPropertyName();
}
else {
throw new AnnotationException( "SecondaryTable JoinColumn cannot reference a
non primary key" );
}
}
- Table table;
Iterator referencedEntityColumns;
if (referencedPropertyName == null) {
- table = associatedClass.getTable();
referencedEntityColumns = associatedClass.getIdentifier().getColumnIterator();
}
else {
Property referencedProperty = associatedClass.getRecursiveProperty(
referencedPropertyName );
- table = referencedProperty.getValue().getTable();
referencedEntityColumns = referencedProperty.getColumnIterator();
}
String alias = "$alias$";
Modified: trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/Version.java
===================================================================
---
trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/Version.java 2006-09-29
19:13:51 UTC (rev 10536)
+++
trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/Version.java 2006-09-29
19:18:26 UTC (rev 10537)
@@ -8,7 +8,7 @@
* @author Emmanuel Bernard
*/
public class Version {
- public static String VERSION = "3.2.0.CR2";
+ public static final String VERSION = "3.2.0.CR2";
private static Log log = LogFactory.getLog( Version.class );
static {
Modified: trunk/HibernateExt/metadata/src/java/org/hibernate/lucene/DocumentBuilder.java
===================================================================
---
trunk/HibernateExt/metadata/src/java/org/hibernate/lucene/DocumentBuilder.java 2006-09-29
19:13:51 UTC (rev 10536)
+++
trunk/HibernateExt/metadata/src/java/org/hibernate/lucene/DocumentBuilder.java 2006-09-29
19:18:26 UTC (rev 10537)
@@ -84,7 +84,7 @@
private Float getBoost(AnnotatedElement element) {
if (element == null) return null;
Boost boost = element.getAnnotation( Boost.class );
- return boost != null ? new Float( boost.value() ) : null;
+ return boost != null ? Float.valueOf( boost.value() ) : null;
}
private Object getValue(Member member, T bean) {
Modified:
trunk/HibernateExt/metadata/src/java/org/hibernate/lucene/event/LuceneEventListener.java
===================================================================
---
trunk/HibernateExt/metadata/src/java/org/hibernate/lucene/event/LuceneEventListener.java 2006-09-29
19:13:51 UTC (rev 10536)
+++
trunk/HibernateExt/metadata/src/java/org/hibernate/lucene/event/LuceneEventListener.java 2006-09-29
19:18:26 UTC (rev 10537)
@@ -76,6 +76,11 @@
try {
analyzer = (Analyzer) analyzerClass.newInstance();
}
+ catch (ClassCastException e) {
+ throw new HibernateException(
+ "Lucene analyzer does not implement " + Analyzer.class.getName() + ":
" + analyzerClassName
+ );
+ }
catch (Exception e) {
throw new HibernateException( "Failed to instantiate lucene analyzer with type
" + analyzerClassName );
}
Modified:
trunk/HibernateExt/metadata/src/java/org/hibernate/reflection/java/EJB3OverridenAnnotationReader.java
===================================================================
---
trunk/HibernateExt/metadata/src/java/org/hibernate/reflection/java/EJB3OverridenAnnotationReader.java 2006-09-29
19:13:51 UTC (rev 10536)
+++
trunk/HibernateExt/metadata/src/java/org/hibernate/reflection/java/EJB3OverridenAnnotationReader.java 2006-09-29
19:18:26 UTC (rev 10537)
@@ -175,7 +175,6 @@
private String className;
private String propertyName;
private PropertyType propertyType;
- private boolean isFieldAccess;
private transient Annotation[] annotations;
private static final String WORD_SEPARATOR = "-";
private transient List<Element> elementsForProperty;
@@ -828,9 +827,6 @@
private void getEmbeddedId(List<Annotation> annotationList, XMLContext.Default
defaults) {
for ( Element element : elementsForProperty ) {
if ( "embedded-id".equals( element.getName() ) ) {
- //boolean properAccessOnMetadataComplete = computeProperAccessOnMetadataComplete(
defaults );
- //boolean properOverridingOnMetadataNonComplete =
computeProperOverridingOnMetadataNonComplete( defaults );
- //if ( properAccessOnMetadataComplete || properOverridingOnMetadataNonComplete ) {
if ( isProcessingId( defaults ) ) {
Annotation annotation = getAttributeOverrides( element, defaults );
if ( annotation != null ) annotationList.add( annotation );
@@ -908,8 +904,6 @@
private void getId(List<Annotation> annotationList, XMLContext.Default defaults)
{
for ( Element element : elementsForProperty ) {
if ( "id".equals( element.getName() ) ) {
- //boolean properAccessOnMetadataComplete = computeProperAccessOnMetadataComplete(
defaults );
- //boolean properOverridingOnMetadataNonComplete =
computeProperOverridingOnMetadataNonComplete( defaults );
boolean processId = isProcessingId( defaults );
if ( processId ) {
Annotation annotation = buildColumns( element );
@@ -985,23 +979,11 @@
return correctAccess || ( ! isExplicit && hasId ) || ( ! isExplicit &&
propertyIsDefault );
}
- private boolean computeProperOverridingOnMetadataNonComplete(XMLContext.Default
defaults) {
- return defaults.canUseJavaAnnotations()
- && super.isAnnotationPresent( Id.class );
- }
-
- private boolean computeProperAccessOnMetadataComplete(XMLContext.Default defaults) {
- return ( ! defaults.canUseJavaAnnotations() )
- && ( ( ! "field".equals( defaults.getAccess() ) && !
PropertyType.FIELD
- .equals( propertyType ) )
- || ( "field".equals( defaults.getAccess() ) &&
PropertyType.FIELD.equals( propertyType ) ) );
- }
-
private Columns buildColumns(Element element) {
List<Element> subelements = element.elements( "column" );
List<Column> columns = new ArrayList<Column>( subelements.size() );
for ( Element subelement : subelements ) {
- columns.add( getColumn( subelement, false ) );
+ columns.add( getColumn( subelement, false, element ) );
}
if ( columns.size() > 0 ) {
AnnotationDescriptor columnsDescr = new AnnotationDescriptor( Columns.class );
@@ -1164,14 +1146,14 @@
AnnotationDescriptor override = new AnnotationDescriptor( AttributeOverride.class );
copyStringAttribute( override, current, "name", true );
Element column = current != null ? current.element( "column" ) : null;
- override.setValue( "column", getColumn( column, true ) );
+ override.setValue( "column", getColumn( column, true, current ) );
overrides.add( (AttributeOverride) AnnotationFactory.create( override ) );
}
}
return overrides;
}
- private Column getColumn(Element element, boolean isMandatory) {
+ private Column getColumn(Element element, boolean isMandatory, Element current) {
//Element subelement = element != null ? element.element( "column" ) : null;
if ( element != null ) {
AnnotationDescriptor column = new AnnotationDescriptor( Column.class );
@@ -1189,7 +1171,7 @@
}
else {
if ( isMandatory ) {
- throw new AnnotationException( element.getPath() + " is mandatory. " +
SCHEMA_VALIDATION );
+ throw new AnnotationException( current.getPath() + ".column is mandatory. "
+ SCHEMA_VALIDATION );
}
return null;
}
@@ -1217,22 +1199,18 @@
if ( access != null ) {
AnnotationDescriptor ad = new AnnotationDescriptor( AccessType.class );
ad.setValue( "value", access );
- isFieldAccess = "field".equals( access );
return AnnotationFactory.create( ad );
}
else if ( defaults.canUseJavaAnnotations() && super.isAnnotationPresent(
AccessType.class ) ) {
AccessType annotation = super.getAnnotation( AccessType.class );
- isFieldAccess = "field".equals( annotation != null ? annotation.value() :
null );
return annotation;
}
else if ( defaults.getAccess() != null ) {
AnnotationDescriptor ad = new AnnotationDescriptor( AccessType.class );
ad.setValue( "value", defaults.getAccess() );
- isFieldAccess = "field".equals( defaults.getAccess() );
return AnnotationFactory.create( ad );
}
else {
- isFieldAccess = false;
return null;
}
}
Modified:
trunk/HibernateExt/metadata/src/java/org/hibernate/reflection/java/JavaXFactory.java
===================================================================
---
trunk/HibernateExt/metadata/src/java/org/hibernate/reflection/java/JavaXFactory.java 2006-09-29
19:13:51 UTC (rev 10536)
+++
trunk/HibernateExt/metadata/src/java/org/hibernate/reflection/java/JavaXFactory.java 2006-09-29
19:18:26 UTC (rev 10537)
@@ -8,15 +8,13 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import javax.persistence.EntityListeners;
import javax.persistence.NamedNativeQuery;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.SqlResultSetMapping;
import javax.persistence.TableGenerator;
-import javax.persistence.EntityListeners;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.dom4j.Element;
import org.hibernate.reflection.ReflectionManager;
import org.hibernate.reflection.XClass;
@@ -40,7 +38,6 @@
*/
public class JavaXFactory implements ReflectionManager {
- private static Log log = LogFactory.getLog( JavaXFactory.class );
private XMLContext xmlContext;
private HashMap defaults;
Modified: trunk/HibernateExt/metadata/src/java/org/hibernate/reflection/java/Pair.java
===================================================================
---
trunk/HibernateExt/metadata/src/java/org/hibernate/reflection/java/Pair.java 2006-09-29
19:13:51 UTC (rev 10536)
+++
trunk/HibernateExt/metadata/src/java/org/hibernate/reflection/java/Pair.java 2006-09-29
19:18:26 UTC (rev 10537)
@@ -19,6 +19,9 @@
@Override
public boolean equals(Object obj) {
+ if ( ! (obj instanceof Pair) ) {
+ return false;
+ }
Pair other = (Pair) obj;
return safeEquals( o1, other.o1 ) && safeEquals( o2, other.o2 );
}
Modified: trunk/HibernateExt/metadata/src/java/org/hibernate/type/ByteArrayBlobType.java
===================================================================
---
trunk/HibernateExt/metadata/src/java/org/hibernate/type/ByteArrayBlobType.java 2006-09-29
19:13:51 UTC (rev 10536)
+++
trunk/HibernateExt/metadata/src/java/org/hibernate/type/ByteArrayBlobType.java 2006-09-29
19:18:26 UTC (rev 10537)
@@ -66,7 +66,7 @@
int length = array.length;
Byte[] copy = new Byte[length];
for ( int index = 0; index < length ; index++ ) {
- copy[index] = new Byte( array[index].byteValue() );
+ copy[index] = Byte.valueOf( array[index].byteValue() );
}
return copy;
}
@@ -168,7 +168,7 @@
int length = bytes.length;
Byte[] result = new Byte[length];
for ( int index = 0; index < length ; index++ ) {
- result[index] = new Byte( bytes[index] );
+ result[index] = Byte.valueOf( bytes[index] );
}
return result;
}
Modified:
trunk/HibernateExt/metadata/src/java/org/hibernate/type/CharacterArrayClobType.java
===================================================================
---
trunk/HibernateExt/metadata/src/java/org/hibernate/type/CharacterArrayClobType.java 2006-09-29
19:13:51 UTC (rev 10536)
+++
trunk/HibernateExt/metadata/src/java/org/hibernate/type/CharacterArrayClobType.java 2006-09-29
19:18:26 UTC (rev 10537)
@@ -67,7 +67,7 @@
for ( int i = reader.read( charbuf ); i > 0 ; i = reader.read( charbuf ) ) {
result.ensureCapacity( result.size() + BUFFER_SIZE );
for ( int charIndex = 0; charIndex < i ; charIndex++ ) {
- result.add( new Character( charbuf[charIndex] ) );
+ result.add( Character.valueOf( charbuf[charIndex] ) );
}
}
}
@@ -117,7 +117,7 @@
int length = array.length;
Character[] copy = new Character[length];
for ( int index = 0; index < length ; index++ ) {
- copy[index] = new Character( array[index].charValue() );
+ copy[index] = Character.valueOf( array[index].charValue() );
}
return copy;
}
Modified: trunk/HibernateExt/metadata/src/java/org/hibernate/type/EnumType.java
===================================================================
--- trunk/HibernateExt/metadata/src/java/org/hibernate/type/EnumType.java 2006-09-29
19:13:51 UTC (rev 10536)
+++ trunk/HibernateExt/metadata/src/java/org/hibernate/type/EnumType.java 2006-09-29
19:18:26 UTC (rev 10537)
@@ -119,7 +119,7 @@
if ( IS_TRACE_ENABLED ) {
log.debug( "Binding '" + ordinal + "' to parameter: " +
index );
}
- st.setObject( index, new Integer( ordinal ), sqlType );
+ st.setObject( index, Integer.valueOf( ordinal ), sqlType );
}
else {
String enumString = ( (Enum) value ).name();
Modified: trunk/HibernateExt/metadata/src/java/org/hibernate/validator/Environment.java
===================================================================
---
trunk/HibernateExt/metadata/src/java/org/hibernate/validator/Environment.java 2006-09-29
19:13:51 UTC (rev 10536)
+++
trunk/HibernateExt/metadata/src/java/org/hibernate/validator/Environment.java 2006-09-29
19:18:26 UTC (rev 10537)
@@ -12,5 +12,5 @@
/**
* Message interpolator class used. The same instance is shared across all
ClassValidators
*/
- public static String MESSAGE_INTERPOLATOR_CLASS =
"hibernate.validator.message_interpolator_class";
+ public static final String MESSAGE_INTERPOLATOR_CLASS =
"hibernate.validator.message_interpolator_class";
}
Modified:
trunk/HibernateExt/metadata/src/java/org/hibernate/validator/event/ValidateEventListener.java
===================================================================
---
trunk/HibernateExt/metadata/src/java/org/hibernate/validator/event/ValidateEventListener.java 2006-09-29
19:13:51 UTC (rev 10536)
+++
trunk/HibernateExt/metadata/src/java/org/hibernate/validator/event/ValidateEventListener.java 2006-09-29
19:18:26 UTC (rev 10537)
@@ -123,12 +123,15 @@
InvalidValue[] invalidValues = element.validator == null ?
null :
element.validator.getInvalidValues( entity );
- for ( InvalidValue invalidValue : invalidValues ) {
- consolidatedInvalidValues.add( invalidValue );
+ if (invalidValues != null) {
+ for ( InvalidValue invalidValue : invalidValues ) {
+ consolidatedInvalidValues.add( invalidValue );
+ }
}
if ( consolidatedInvalidValues.size() > 0 ) {
throw new InvalidStateException(
- consolidatedInvalidValues.toArray( new InvalidValue[]{} ),
entity.getClass().getName()
+ consolidatedInvalidValues.toArray( new
InvalidValue[consolidatedInvalidValues.size()] ),
+ entity.getClass().getName()
);
}
}