Skip to content
Snippets Groups Projects
Commit 53f460fe authored by srosse's avatar srosse
Browse files

no-jira: hardened user import against misconfigured user properties handler

parent 0a821e63
No related branches found
No related tags found
No related merge requests found
...@@ -305,15 +305,26 @@ class ImportStep00 extends BasicStep { ...@@ -305,15 +305,26 @@ class ImportStep00 extends BasicStep {
} }
boolean isMandatoryField = um.isMandatoryUserProperty(usageIdentifyer, userPropertyHandler); boolean isMandatoryField = um.isMandatoryUserProperty(usageIdentifyer, userPropertyHandler);
if (isMandatoryField && !StringHelper.containsNonWhitespace(thisValue)) { if (isMandatoryField && !StringHelper.containsNonWhitespace(thisValue)) {
textAreaElement.setErrorKey("error.mandatory", new String[] { String.valueOf(i + 1), translate(userPropertyHandler.i18nFormElementLabelKey()) }); String label = "";
if(userPropertyHandler.i18nFormElementLabelKey() != null) {
label = translate(userPropertyHandler.i18nFormElementLabelKey());
}
textAreaElement.setErrorKey("error.mandatory", new String[] { String.valueOf(i + 1), label });
importDataError = true; importDataError = true;
break; break;
} }
// used for call-back value depending on PropertyHandler // used for call-back value depending on PropertyHandler
ValidationError validationError = new ValidationError(); ValidationError validationError = new ValidationError();
if (!userPropertyHandler.isValidValue(null, thisValue, validationError, getLocale())) { if (!userPropertyHandler.isValidValue(null, thisValue, validationError, getLocale())) {
textAreaElement.setErrorKey("error.lengthorformat", new String[] { String.valueOf(i + 1), translate(userPropertyHandler.i18nFormElementLabelKey()), String error = "unkown";
translate(validationError.getErrorKey(), validationError.getArgs()) }); String label = "";
if(userPropertyHandler.i18nFormElementLabelKey() != null) {
label = translate(userPropertyHandler.i18nFormElementLabelKey());
}
if(validationError.getErrorKey() != null) {
error = translate(validationError.getErrorKey(), validationError.getArgs());
}
textAreaElement.setErrorKey("error.lengthorformat", new String[] { String.valueOf(i + 1), label, error});
importDataError = true; importDataError = true;
break; break;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment