Results 1 to 2 of 2

Thread: FieldSet.readDate is lenient

  1. #1
    Join Date
    Jul 2005
    Posts
    156

    Default FieldSet.readDate is lenient

    Hello,

    I've just used fieldSet#readDate methods.
    If I use pattern='yyyyMMdd' and read the value '4010822' everything is ok, even if there's only 3 digits for the year.

    Following code :
    Code:
    DefaultFieldSet lFieldSet = new DefaultFieldSet(new String[] {"4010822"});
    System.out.println(lFieldSet.readDate(0,"yyyyMMdd"));
    Outputs :
    Code:
    Sun Oct 02 00:00:00 CEST 4016
    I've just decorated the default FieldSet with my own and added a readStrict method which uses SimpleDateFormat with setLenient (false).

    Shouldn't it be better for everyone to add the non lenient version in Spring Batch (or at least a boolean / sthing like that) ?

    Here's the code if someone needs it (not very much actually)
    Attached Files Attached Files

  2. #2
    Join Date
    Jun 2005
    Posts
    4,241

    Default

    See http://jira.springframework.org/browse/BATCH-555. I think the correct setting is lenient=false with no option (at least for now).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •