Author: hardy.ferentschik
Date: 2009-08-25 10:06:14 -0400 (Tue, 25 Aug 2009)
New Revision: 17411
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/groups/Group.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/groups/GroupChainGenerator.java
Log:
HV-212
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/groups/Group.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/groups/Group.java 2009-08-25
14:02:05 UTC (rev 17410)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/groups/Group.java 2009-08-25
14:06:14 UTC (rev 17411)
@@ -48,10 +48,6 @@
return group;
}
- public boolean partOfSequence() {
- return sequence != null;
- }
-
public Class<?> getSequence() {
return sequence;
}
@@ -70,10 +66,6 @@
if ( group != null ? !group.equals( group1.group ) : group1.group != null ) {
return false;
}
- if ( sequence != null ? !sequence.equals( group1.sequence ) : group1.sequence != null )
{
- return false;
- }
-
return true;
}
@@ -83,9 +75,7 @@
@Override
public int hashCode() {
- int result = group != null ? group.hashCode() : 0;
- result = 31 * result + ( sequence != null ? sequence.hashCode() : 0 );
- return result;
+ return group != null ? group.hashCode() : 0;
}
@Override
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/groups/GroupChainGenerator.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/groups/GroupChainGenerator.java 2009-08-25
14:02:05 UTC (rev 17410)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/groups/GroupChainGenerator.java 2009-08-25
14:06:14 UTC (rev 17411)
@@ -22,9 +22,9 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import javax.validation.GroupDefinitionException;
import javax.validation.GroupSequence;
import javax.validation.ValidationException;
-import javax.validation.GroupDefinitionException;
/**
* Used to determine the execution order.
@@ -65,7 +65,7 @@
for ( Class<?> extendedInterface : clazz.getInterfaces() ) {
Group group = new Group( extendedInterface );
chain.insertGroup( group );
- insertInheritedGroups(extendedInterface, chain);
+ insertInheritedGroups( extendedInterface, chain );
}
}
@@ -96,10 +96,19 @@
}
else {
List<Group> tmpSequence = resolveSequence( clazz, processedSequences );
- resolvedGroupSequence.addAll( tmpSequence );
+ addTmpSequence( resolvedGroupSequence, tmpSequence );
}
}
resolvedSequences.put( group, resolvedGroupSequence );
return resolvedGroupSequence;
}
+
+ private void addTmpSequence(List<Group> resolvedGroupSequence, List<Group>
tmpSequence) {
+ for ( Group tmpGroup : tmpSequence ) {
+ if ( resolvedGroupSequence.contains( tmpGroup ) &&
resolvedGroupSequence.indexOf( tmpGroup ) < resolvedGroupSequence.size() - 1 ) {
+ throw new GroupDefinitionException( "Unable to expand group sequence." );
+ }
+ resolvedGroupSequence.add( tmpGroup );
+ }
+ }
}
Show replies by date