Commit 875da31182092a22e269f85a85cc93b08f5fc212
Exists in
master
Merge branch '2.4.0' of git@github.com:demoiselle/framework.git into 2.4.0
Showing
2 changed files
with
14 additions
and
9 deletions
Show diff stats
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/ConfigurationImpl.java
@@ -49,10 +49,17 @@ public class ConfigurationImpl implements Serializable { | @@ -49,10 +49,17 @@ public class ConfigurationImpl implements Serializable { | ||
49 | private boolean loaded = false; | 49 | private boolean loaded = false; |
50 | 50 | ||
51 | @SuppressWarnings("unused") | 51 | @SuppressWarnings("unused") |
52 | - private synchronized void load(Object instance) { | 52 | + private synchronized void load(Object instance) throws Throwable { |
53 | if (!loaded) { | 53 | if (!loaded) { |
54 | - Beans.getReference(ConfigurationLoader.class).load(instance); | ||
55 | loaded = true; | 54 | loaded = true; |
55 | + | ||
56 | + try { | ||
57 | + Beans.getReference(ConfigurationLoader.class).load(instance); | ||
58 | + | ||
59 | + } catch (Throwable cause) { | ||
60 | + loaded = false; | ||
61 | + throw cause; | ||
62 | + } | ||
56 | } | 63 | } |
57 | } | 64 | } |
58 | } | 65 | } |
impl/core/src/test/java/configuration/field/beanvalidation/ConfigurationBeanValidationFieldTest.java
@@ -42,8 +42,6 @@ import static junit.framework.Assert.fail; | @@ -42,8 +42,6 @@ import static junit.framework.Assert.fail; | ||
42 | import javax.inject.Inject; | 42 | import javax.inject.Inject; |
43 | import javax.validation.ConstraintViolationException; | 43 | import javax.validation.ConstraintViolationException; |
44 | 44 | ||
45 | -import junit.framework.Assert; | ||
46 | - | ||
47 | import org.jboss.arquillian.container.test.api.Deployment; | 45 | import org.jboss.arquillian.container.test.api.Deployment; |
48 | import org.jboss.arquillian.junit.Arquillian; | 46 | import org.jboss.arquillian.junit.Arquillian; |
49 | import org.jboss.shrinkwrap.api.spec.JavaArchive; | 47 | import org.jboss.shrinkwrap.api.spec.JavaArchive; |
@@ -107,14 +105,14 @@ public class ConfigurationBeanValidationFieldTest { | @@ -107,14 +105,14 @@ public class ConfigurationBeanValidationFieldTest { | ||
107 | propertyBeanValidationWithEmptyNotNullFieldConfig.getIntAttributeNull(); | 105 | propertyBeanValidationWithEmptyNotNullFieldConfig.getIntAttributeNull(); |
108 | fail(); | 106 | fail(); |
109 | } catch (ConfigurationException cause) { | 107 | } catch (ConfigurationException cause) { |
110 | - Assert.assertEquals(ConstraintViolationException.class, cause.getCause().getClass()); | 108 | + assertEquals(ConstraintViolationException.class, cause.getCause().getClass()); |
111 | } | 109 | } |
112 | 110 | ||
113 | try { | 111 | try { |
114 | xmlBeanValidationWithEmptyNotNullFieldConfig.getIntAttributeNull(); | 112 | xmlBeanValidationWithEmptyNotNullFieldConfig.getIntAttributeNull(); |
115 | fail(); | 113 | fail(); |
116 | } catch (ConfigurationException cause) { | 114 | } catch (ConfigurationException cause) { |
117 | - Assert.assertEquals(ConstraintViolationException.class, cause.getCause().getClass()); | 115 | + assertEquals(ConstraintViolationException.class, cause.getCause().getClass()); |
118 | } | 116 | } |
119 | } | 117 | } |
120 | 118 | ||
@@ -124,14 +122,14 @@ public class ConfigurationBeanValidationFieldTest { | @@ -124,14 +122,14 @@ public class ConfigurationBeanValidationFieldTest { | ||
124 | propertyBeanValidationWithEmptyNotNullFieldConfig.getStringAttributeNull(); | 122 | propertyBeanValidationWithEmptyNotNullFieldConfig.getStringAttributeNull(); |
125 | fail(); | 123 | fail(); |
126 | } catch (ConfigurationException cause) { | 124 | } catch (ConfigurationException cause) { |
127 | - Assert.assertEquals(ConstraintViolationException.class, cause.getCause().getClass()); | 125 | + assertEquals(ConstraintViolationException.class, cause.getCause().getClass()); |
128 | } | 126 | } |
129 | 127 | ||
130 | try { | 128 | try { |
131 | xmlBeanValidationWithEmptyNotNullFieldConfig.getStringAttributeNull(); | 129 | xmlBeanValidationWithEmptyNotNullFieldConfig.getStringAttributeNull(); |
132 | fail(); | 130 | fail(); |
133 | } catch (ConfigurationException cause) { | 131 | } catch (ConfigurationException cause) { |
134 | - Assert.assertEquals(ConstraintViolationException.class, cause.getCause().getClass()); | 132 | + assertEquals(ConstraintViolationException.class, cause.getCause().getClass()); |
135 | } | 133 | } |
136 | } | 134 | } |
137 | 135 | ||
@@ -141,7 +139,7 @@ public class ConfigurationBeanValidationFieldTest { | @@ -141,7 +139,7 @@ public class ConfigurationBeanValidationFieldTest { | ||
141 | propertyWithTwoConstrainViolations.getAttributeWithTwoConstrainValidations(); | 139 | propertyWithTwoConstrainViolations.getAttributeWithTwoConstrainValidations(); |
142 | fail(); | 140 | fail(); |
143 | } catch (ConfigurationException cause) { | 141 | } catch (ConfigurationException cause) { |
144 | - Assert.assertEquals(ConstraintViolationException.class, cause.getCause().getClass()); | 142 | + assertEquals(ConstraintViolationException.class, cause.getCause().getClass()); |
145 | } | 143 | } |
146 | } | 144 | } |
147 | } | 145 | } |