title: Why is my custom constraintValidator throwing null pointer?
body: <p>I'm creating a custom <code>ConstraintValidator</code> to validate that my JodaTime object's hours are within a certain window when entered from a spring form.</p>
  
  <p>My annotation:</p>
  
  <pre><code>@Target({ElementType.METHOD, ElementType.FIELD})
  @Documented
  @Constraint(validatedBy = InputHoursValidator.class)
  @Retention(RetentionPolicy.RUNTIME)
  public @interface InputHoursConstraint {
  String message() default "";
  
  Class&lt;?&gt;[] groups() default {};
  
  Class&lt;? extends Payload&gt;[] payload() default {};
  
  }
  </code></pre>
  
  <p>My Validator</p>
  
  <pre><code>public class InputHoursValidator implements ConstraintValidator&lt;InputHoursConstraint, DateTime&gt; {
  private static final DateTimeFormatter HOURS_TIME_FORMAT = DateTimeFormat.forPattern("hh:mma");
  private static final String EARLIEST_START_TIME = "5:00pm";
  private static final String LATEST_END_TIME = "4:00am";
  
  @Override
  public void initialize(InputHoursConstraint constraintAnnotation) {
  
  }
  
  @Override
  public boolean isValid(DateTime value, ConstraintValidatorContext context) {
      return !value.isBefore(DateTime.parse(EARLIEST_START_TIME, HOURS_TIME_FORMAT))
              &amp;&amp; !value.isAfter(DateTime.parse(LATEST_END_TIME, HOURS_TIME_FORMAT).plusDays(1));
  
  }
  
  
  }
  </code></pre>
  
  <p>And my mojo with the annotation</p>
  
  <pre><code>public class HoursTrackingForm {
  
  @NotNull(message = "Please enter a valid time in AM or PM")
  @DateTimeFormat(pattern = "hh:mma")
  @InputHoursConstraint(message = "Start time was before 5:00pm or after 4:00am")
  private DateTime startTime;
  
  @NotNull(message = "Please enter a valid time in AM or PM")
  @DateTimeFormat(pattern = "hh:mma")
  @InputHoursConstraint(message = "End time was before 5:00pm or after 4:00am")
  private DateTime endTime;
  
  //getters and setters
  }
  </code></pre>
  
  <p>It all looks fine to me but when I submit my object for validation,  DateTime in the validator is always null.</p>