Changeset 1562


Ignore:
Timestamp:
Feb 25, 2011, 11:16:09 AM (9 years ago)
Author:
t.w.abma@…
Message:
  • added extra check in mapping step for date fields, someone entering a non-date value now catches a setFieldValue(...) exception
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/dbnp/importer/ImporterController.groovy

    r1556 r1562  
    559559                                // Set the fields for this entity by retrieving values from the params
    560560                                entity.giveFields().each { field ->
     561
     562                    // field is a date field, try to set it with the value, if someone enters a non-date value it throws
     563                    // an error, this should be caught to prevent a complete breakdown
     564                    if (field.type == org.dbnp.gdt.TemplateFieldType.DATE) {
     565                        try {
     566                            entity.setFieldValue(field.toString(), params["entity_" + entity.getIdentifier() + "_" + field.escapedName()])
     567                        } catch (Exception e)   { log.error ".importer wizard could not set date field with value: " +
     568                                                    params["entity_" + entity.getIdentifier() + "_" + field.escapedName()]
     569                                                }
     570                    } else
     571
    561572                                        // field of type ontology and value "#invalidterm"?
    562573                                        if (field.type == org.dbnp.gdt.TemplateFieldType.ONTOLOGYTERM &&
Note: See TracChangeset for help on using the changeset viewer.