public ERXValidationException convertException(NSValidation.ValidationException eov, Object value) { ERXValidationException erve = null; if (log.isDebugEnabled()) log.debug("Converting exception: " + eov + " value: " + (value != null ? value : "<NULL>")); if (!(eov instanceof ERXValidationException)) { String message = eov.getMessage(); EOEnterpriseObject eo = (EOEnterpriseObject)eov.object();  for (Enumeration e = _mappings.allKeys().objectEnumerator(); e.hasMoreElements();) {  String key = (String)e.nextElement(); String type = (String)_mappings.objectForKey(key); if (message.lastIndexOf(key) >= 0) { String property = eov.key(); if(property == null && message.indexOf("Removal") == 0) {  property = (String)(NSArray.componentsSeparatedByString(message, "'").objectAtIndex(3)); } erve = createException(eo, property, value, type); break; } } NSArray additionalExceptions = eov.additionalExceptions(); if (erve == null) { log.error("Unable to convert validation exception: " + eov); } else if (additionalExceptions != null && additionalExceptions.count() > 0) { NSMutableArray erveAddtionalExceptions = new NSMutableArray(); for (Enumeration e = additionalExceptions.objectEnumerator(); e.hasMoreElements();) { ERXValidationException erven = convertException((NSValidation.ValidationException)e.nextElement()); if (erven != null) erveAddtionalExceptions.addObject(erven); } if (erveAddtionalExceptions.count() > 0) erve.setAdditionalExceptions(erveAddtionalExceptions); } } else { log.warn("Attempting to convert validation exception: " + eov + " that is already of type ERXValidationException"); erve = (ERXValidationException)eov; } return erve;
public ERXValidationException convertException(NSValidation.ValidationException eov) { return convertException(eov, null);
    public ERXValidationException convertException(NSValidation.ValidationException eov, Object value) {        ERXValidationException erve = null;        if (log.isDebugEnabled())            log.debug("Converting exception: " + eov + " value: " + (value != null ? value : "<NULL>"));        if (!(eov instanceof ERXValidationException)) {            String message = eov.getMessage();            EOEnterpriseObject eo = (EOEnterpriseObject)eov.object();            //NSDictionary userInfo = eov.userInfo() != null ? (NSDictionary)eov.userInfo() : NSDictionary.EmptyDictionary;            for (Enumeration e = _mappings.allKeys().objectEnumerator(); e.hasMoreElements();) {                //EOEnterpriseObject eo = (EOEnterpriseObject)userInfo.objectForKey(NSValidation.ValidationException.ValidatedObjectUserInfoKey);                String key = (String)e.nextElement();                String type = (String)_mappings.objectForKey(key);                if (message.lastIndexOf(key) >= 0) {                    String property = eov.key();                    if(property == null && message.indexOf("Removal") == 0) {                        //FIXME: (ak) pattern matching?                        property = (String)(NSArray.componentsSeparatedByString(message, "'").objectAtIndex(3));                    }                    erve = createException(eo, property, value, type);                    break;                }            }            NSArray additionalExceptions = eov.additionalExceptions();            if (erve == null) {                log.error("Unable to convert validation exception: " + eov);            } else if (additionalExceptions != null && additionalExceptions.count() > 0) {                NSMutableArray erveAddtionalExceptions = new NSMutableArray();                for (Enumeration e = additionalExceptions.objectEnumerator(); e.hasMoreElements();) {                    ERXValidationException erven = convertException((NSValidation.ValidationException)e.nextElement());                    if (erven != null)                        erveAddtionalExceptions.addObject(erven);                }                if (erveAddtionalExceptions.count() > 0)                    erve.setAdditionalExceptions(erveAddtionalExceptions);            }        } else {            log.warn("Attempting to convert validation exception: " + eov + " that is already of type ERXValidationException");            erve = (ERXValidationException)eov;        }        return erve;    }