I’m trying to retrieve a default validation error-message using MessageSource. The code I’m working with uses reflection to retrieve the value of the message parameter. On a constraint that does not override the message parameter, I would like to retrieve the default error message. When I invoke the message method on the validation annotation, I get {org.hibernate.validator.constraints.NotBlank.message} (for example, for
Tag: validation
Java InputReader. Detect if file being read is binary?
I had posted a question in regards to this code. I found that JTextArea does not support the binary type data that is loaded. So my new question is how can I go about detecting the ‘bad’ file and canceling the file I/O and telling the user that they need to select a new file? Answer For those who read
Is there an implementation of JSR-303 (bean validation) available?
I know there are non-standard frameworks such as commons-validator, and hibernate validator. I wanted to know if someone knows an implementation of the official standard. Answer Hibernate Validator is the reference implementation of JSR-303
How to sanity check a date in Java
I find it curious that the most obvious way to create Date objects in Java has been deprecated and appears to have been “substituted” with a not so obvious to use lenient calendar. How do you check that a date, given as a combination of day, month, and year, is a valid date? For instance, 2008-02-31 (as in yyyy-mm-dd) would