Author: epbernard
Date: 2009-02-24 10:52:58 -0500 (Tue, 24 Feb 2009)
New Revision: 16024
Added:
beanvalidation/trunk/validation-api/src/main/java/javax/validation/ConstraintDeclarationException.java
beanvalidation/trunk/validation-api/src/main/java/javax/validation/ConstraintDefinitionException.java
beanvalidation/trunk/validation-api/src/main/java/javax/validation/GroupDefinitionException.java
beanvalidation/trunk/validation-api/src/main/java/javax/validation/UnexpectedTypeException.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/AmbiguousConstraintUsageException.java
Removed:
beanvalidation/trunk/validation-api/src/main/java/javax/validation/AmbiguousConstraintUsageException.java
beanvalidation/trunk/validation-api/src/main/java/javax/validation/UnexpectedTypeForConstraintException.java
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/GroupTest.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/validatorresolution/Bar.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/validatorresolution/ValidatorResolutionTest.java
Log:
BVAL-52 add exceptions classes
Deleted:
beanvalidation/trunk/validation-api/src/main/java/javax/validation/AmbiguousConstraintUsageException.java
===================================================================
---
beanvalidation/trunk/validation-api/src/main/java/javax/validation/AmbiguousConstraintUsageException.java 2009-02-24
15:19:02 UTC (rev 16023)
+++
beanvalidation/trunk/validation-api/src/main/java/javax/validation/AmbiguousConstraintUsageException.java 2009-02-24
15:52:58 UTC (rev 16024)
@@ -1,44 +0,0 @@
-// $Id$
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2008, Red Hat Middleware LLC, and individual contributors
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
http://www.apache.org/licenses/LICENSE-2.0
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-package javax.validation;
-
-import javax.validation.ValidationException;
-
-/**
- * Exception raised in the case that the constraint validator resolution returns more
than one possible validators for
- * a given type.
- *
- * @author Hardy Ferentschik
- */
-public class AmbiguousConstraintUsageException extends ValidationException {
- public AmbiguousConstraintUsageException(String message) {
- super( message );
- }
-
- public AmbiguousConstraintUsageException() {
- super();
- }
-
- public AmbiguousConstraintUsageException(String message, Throwable cause) {
- super( message, cause );
- }
-
- public AmbiguousConstraintUsageException(Throwable cause) {
- super( cause );
- }
-}
Added:
beanvalidation/trunk/validation-api/src/main/java/javax/validation/ConstraintDeclarationException.java
===================================================================
---
beanvalidation/trunk/validation-api/src/main/java/javax/validation/ConstraintDeclarationException.java
(rev 0)
+++
beanvalidation/trunk/validation-api/src/main/java/javax/validation/ConstraintDeclarationException.java 2009-02-24
15:52:58 UTC (rev 16024)
@@ -0,0 +1,24 @@
+package javax.validation;
+
+/**
+ * Exception raised if a constraint declaration is not legal
+ *
+ * @author Emmanuel Bernard
+ */
+public class ConstraintDeclarationException extends ValidationException {
+ public ConstraintDeclarationException(String message) {
+ super( message );
+ }
+
+ public ConstraintDeclarationException() {
+ super();
+ }
+
+ public ConstraintDeclarationException(String message, Throwable cause) {
+ super( message, cause );
+ }
+
+ public ConstraintDeclarationException(Throwable cause) {
+ super( cause );
+ }
+}
\ No newline at end of file
Added:
beanvalidation/trunk/validation-api/src/main/java/javax/validation/ConstraintDefinitionException.java
===================================================================
---
beanvalidation/trunk/validation-api/src/main/java/javax/validation/ConstraintDefinitionException.java
(rev 0)
+++
beanvalidation/trunk/validation-api/src/main/java/javax/validation/ConstraintDefinitionException.java 2009-02-24
15:52:58 UTC (rev 16024)
@@ -0,0 +1,24 @@
+package javax.validation;
+
+/**
+ * Exception raised if a constraint definition is not legal
+ *
+ * @author Emmanuel Bernard
+ */
+public class ConstraintDefinitionException extends ValidationException {
+ public ConstraintDefinitionException(String message) {
+ super( message );
+ }
+
+ public ConstraintDefinitionException() {
+ super();
+ }
+
+ public ConstraintDefinitionException(String message, Throwable cause) {
+ super( message, cause );
+ }
+
+ public ConstraintDefinitionException(Throwable cause) {
+ super( cause );
+ }
+}
\ No newline at end of file
Added:
beanvalidation/trunk/validation-api/src/main/java/javax/validation/GroupDefinitionException.java
===================================================================
---
beanvalidation/trunk/validation-api/src/main/java/javax/validation/GroupDefinitionException.java
(rev 0)
+++
beanvalidation/trunk/validation-api/src/main/java/javax/validation/GroupDefinitionException.java 2009-02-24
15:52:58 UTC (rev 16024)
@@ -0,0 +1,24 @@
+package javax.validation;
+
+/**
+ * Exception raised if a group definition is not legal
+ *
+ * @author Emmanuel Bernard
+ */
+public class GroupDefinitionException extends ValidationException {
+ public GroupDefinitionException(String message) {
+ super( message );
+ }
+
+ public GroupDefinitionException() {
+ super();
+ }
+
+ public GroupDefinitionException(String message, Throwable cause) {
+ super( message, cause );
+ }
+
+ public GroupDefinitionException(Throwable cause) {
+ super( cause );
+ }
+}
\ No newline at end of file
Copied:
beanvalidation/trunk/validation-api/src/main/java/javax/validation/UnexpectedTypeException.java
(from rev 16021,
beanvalidation/trunk/validation-api/src/main/java/javax/validation/UnexpectedTypeForConstraintException.java)
===================================================================
---
beanvalidation/trunk/validation-api/src/main/java/javax/validation/UnexpectedTypeException.java
(rev 0)
+++
beanvalidation/trunk/validation-api/src/main/java/javax/validation/UnexpectedTypeException.java 2009-02-24
15:52:58 UTC (rev 16024)
@@ -0,0 +1,44 @@
+// $Id$
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
http://www.apache.org/licenses/LICENSE-2.0
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package javax.validation;
+
+import javax.validation.ValidationException;
+
+/**
+ * Exception raised in the case that the constraint validator resolution
+ * cannot determine a suitable validators for a given type.
+ *
+ * @author Hardy Ferentschik
+ */
+public class UnexpectedTypeException extends ConstraintDeclarationException {
+ public UnexpectedTypeException(String message) {
+ super( message );
+ }
+
+ public UnexpectedTypeException() {
+ super();
+ }
+
+ public UnexpectedTypeException(String message, Throwable cause) {
+ super( message, cause );
+ }
+
+ public UnexpectedTypeException(Throwable cause) {
+ super( cause );
+ }
+}
\ No newline at end of file
Property changes on:
beanvalidation/trunk/validation-api/src/main/java/javax/validation/UnexpectedTypeException.java
___________________________________________________________________
Name: svn:keywords
+ Id
Deleted:
beanvalidation/trunk/validation-api/src/main/java/javax/validation/UnexpectedTypeForConstraintException.java
===================================================================
---
beanvalidation/trunk/validation-api/src/main/java/javax/validation/UnexpectedTypeForConstraintException.java 2009-02-24
15:19:02 UTC (rev 16023)
+++
beanvalidation/trunk/validation-api/src/main/java/javax/validation/UnexpectedTypeForConstraintException.java 2009-02-24
15:52:58 UTC (rev 16024)
@@ -1,44 +0,0 @@
-// $Id$
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2008, Red Hat Middleware LLC, and individual contributors
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
http://www.apache.org/licenses/LICENSE-2.0
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-package javax.validation;
-
-import javax.validation.ValidationException;
-
-/**
- * Exception raised in the case that the constraint validator resolution cannot determine
a suitable validators for
- * a given type.
- *
- * @author Hardy Ferentschik
- */
-public class UnexpectedTypeForConstraintException extends ValidationException {
- public UnexpectedTypeForConstraintException(String message) {
- super( message );
- }
-
- public UnexpectedTypeForConstraintException() {
- super();
- }
-
- public UnexpectedTypeForConstraintException(String message, Throwable cause) {
- super( message, cause );
- }
-
- public UnexpectedTypeForConstraintException(Throwable cause) {
- super( cause );
- }
-}
\ No newline at end of file
Added:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/AmbiguousConstraintUsageException.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/AmbiguousConstraintUsageException.java
(rev 0)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/AmbiguousConstraintUsageException.java 2009-02-24
15:52:58 UTC (rev 16024)
@@ -0,0 +1,45 @@
+// $Id: AmbiguousConstraintUsageException.java 15902 2009-02-05 11:53:49Z
hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
http://www.apache.org/licenses/LICENSE-2.0
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.hibernate.validation;
+
+import javax.validation.ValidationException;
+import javax.validation.UnexpectedTypeException;
+
+/**
+ * Exception raised in the case that the constraint validator resolution returns more
than one possible validators for
+ * a given type.
+ *
+ * @author Hardy Ferentschik
+ */
+public class AmbiguousConstraintUsageException extends UnexpectedTypeException {
+ public AmbiguousConstraintUsageException(String message) {
+ super( message );
+ }
+
+ public AmbiguousConstraintUsageException() {
+ super();
+ }
+
+ public AmbiguousConstraintUsageException(String message, Throwable cause) {
+ super( message, cause );
+ }
+
+ public AmbiguousConstraintUsageException(Throwable cause) {
+ super( cause );
+ }
+}
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/GroupTest.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/GroupTest.java 2009-02-24
15:19:02 UTC (rev 16023)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/GroupTest.java 2009-02-24
15:52:58 UTC (rev 16024)
@@ -174,16 +174,6 @@
1,
constraintViolations.size()
);
-
- ConstraintViolation constraintViolation = constraintViolations.iterator().next();
- Set<Class<?>> expected = new HashSet<Class<?>>();
- expected.add( First.class );
- expected.add( Second.class );
- assertEquals(
- "The constraint should be invalid for both groups",
- expected,
- constraintViolation.getGroups()
- );
}
@Test
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/validatorresolution/Bar.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/validatorresolution/Bar.java 2009-02-24
15:19:02 UTC (rev 16023)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/validatorresolution/Bar.java 2009-02-24
15:52:58 UTC (rev 16024)
@@ -23,7 +23,7 @@
* @author Hardy Ferentschik
*/
public class Bar {
- // validating Bar actually raises an UnexpectedTypeForConstraintException - @Size is not
defined for Integer
+ // validating Bar actually raises an UnexpectedTypeException - @Size is not defined for
Integer
@Size
private Integer value = 0;
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/validatorresolution/ValidatorResolutionTest.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/validatorresolution/ValidatorResolutionTest.java 2009-02-24
15:19:02 UTC (rev 16023)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/validatorresolution/ValidatorResolutionTest.java 2009-02-24
15:52:58 UTC (rev 16024)
@@ -18,10 +18,10 @@
package org.hibernate.validation.engine.validatorresolution;
import java.util.Set;
-import javax.validation.AmbiguousConstraintUsageException;
+import org.hibernate.validation.AmbiguousConstraintUsageException;
import javax.validation.ConstraintViolation;
import javax.validation.Validator;
-import javax.validation.UnexpectedTypeForConstraintException;
+import javax.validation.UnexpectedTypeException;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertEquals;
@@ -72,7 +72,7 @@
validator.validate( bar );
fail();
}
- catch ( UnexpectedTypeForConstraintException e ) {
+ catch ( UnexpectedTypeException e ) {
assertEquals( "No validator could be found for type: java.lang.Integer",
e.getMessage() );
}
}