title: Groovy Date parsing error
body: <p>I have a piece of code in my program where I am trying to parse a date and then set it equal to a property on an object like this:</p>
  
  <pre><code>if (newIndividualRecord.dateOfBirth == null || newIndividualRecord.dateOfBirth == "-")
      newIndividualRecord.dateOfBirth = null
  else {
      ​def date = { -&gt;    
          try  {    
              Date.parse('dd-MM-yyyy', newIndividualRecord.dateOfBirth)
          }
          catch(e) {
              newIndividualRecord.dateOfBirth = null
              /* Should an incorrectly formatted date be reported as an error here? */
          } 
      }()​
      if (date.getClass() == java.util.Date)
          newIndividualRecord.dateOfBirth = date
  }
  </code></pre>
  
  <p>I am getting this error regarding the line which reads as <code>​def date = { -&gt;</code> :</p>
  
  <pre><code>| Error 2014-07-29 20:46:15,892 [http-bio-8080-exec-7] ERROR errors.GrailsExceptionResolver  - MissingPropertyException occurred when processing request: [POST] /FatcaOne_0/customer/upload - parameters:
  dataTypegrp: 1
  fileTypegrp: 1
  No such property: ​ for class: java.util.Date
  Possible solutions: day. Stacktrace follows:
  Message: No such property: ​ for class: java.util.Date
  Possible solutions: day
      Line | Method
  -&gt;&gt;  788 | $tt__processNewIndividualRecordFlags in com.twc.fatcaone.FileImportService$$EOlRGIsK
  </code></pre>
  
  <p>I can't seem to figure out what this error means. Any help would be greatly appreciated. Thank you.</p>