Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-2836

Property validation does not report classname in context

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 1.7 M3, 1.6.2
    • 1.4.1, 1.7 M2
    • {Unused} Core
    • None
    • validation object property

    Description

      ...
                  XWikiValidationStatus.addErrorToContext((getObject() == null) ? "" : getObject()
                      .getClassName(), getName(), getTranslatedPrettyName(context),
                      getValidationMessage(), context);
                  return false;
              } catch (Exception e) {
                  XWikiValidationStatus.addExceptionToContext(getObject()
                          .getClassName(), getName(), e,
                      context);
                  return false;
      ...
      

      This is an excerpt from public boolean validateProperty(BaseProperty property, XWikiContext context) in PropertyClass.java.
      As you may seen, it reports getObject().getClassName() for the className argument of add...ToContext(), but since this is a propertyClass, getObject() returns a BaseClass, and the name of the class in not in getClassName() (which is null) but in getName().
      So the fix should be:

      ...
                  XWikiValidationStatus.addErrorToContext((getObject() == null) ? "" : getObject()
                      .getName(), getName(), getTranslatedPrettyName(context),
                      getValidationMessage(), context);
                  return false;
              } catch (Exception e) {
                  XWikiValidationStatus.addExceptionToContext((getObject() == null) ? "" : getObject()
                          .getName(), getName(), e,
                      context);
                  return false;
      ...
      

      Hope this helps.

      Attachments

        Activity

          People

            tmortagne Thomas Mortagne
            softec Denis Gervalle
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: