Permalink
Browse files

Merge pull request #467 from marceloemanoel/master

Change on validation of upload size limit. Fixes #445
  • Loading branch information...
lucascs committed Oct 16, 2012
2 parents f5097d5 + 50f82c3 commit e4715188380427c29a480ba5f2e545d2ef6eff91
@@ -42,6 +42,7 @@
import br.com.caelum.vraptor.interceptor.ResourceLookupInterceptor;
import br.com.caelum.vraptor.ioc.RequestScoped;
import br.com.caelum.vraptor.resource.ResourceMethod;
+import br.com.caelum.vraptor.validator.I18nMessage;
import br.com.caelum.vraptor.validator.Validations;
import com.google.common.base.Strings;
@@ -147,12 +148,7 @@ private boolean isNotEmpty(FileItem item) {
* @param e
*/
protected void reportSizeLimitExceeded(final SizeLimitExceededException e) {
- validator.checking(new Validations() {
- {
- that(false, "upload", "file.limit.exceeded", e.getActualSize(), e.getPermittedSize());
- }
- });
-
+ validator.add(new I18nMessage("upload", "file.limit.exceeded", e.getActualSize(), e.getPermittedSize()));
logger.warn("The file size limit was exceeded.", e);
}
@@ -36,6 +36,7 @@
import br.com.caelum.vraptor.http.InvalidParameterException;
import br.com.caelum.vraptor.http.MutableRequest;
import br.com.caelum.vraptor.resource.ResourceMethod;
+import br.com.caelum.vraptor.validator.I18nMessage;
import br.com.caelum.vraptor.validator.Validations;
/**
@@ -240,7 +241,7 @@ public void shouldValidateWhenSizeLimitExceededExceptionOccurs() throws Exceptio
interceptor.intercept(stack, method, instance);
- verify(validator).checking(any(Validations.class));
+ verify(validator).add(any(I18nMessage.class));
}
@Test

0 comments on commit e471518

Please sign in to comment.