Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-3850

NullPointerException loading xwork validator since 2.3.4

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.4
    • Fix Version/s: 2.3.7
    • Component/s: None
    • Labels:

      Description

      Since 2.3.4 update, loading xworks validator with
      ActionValidatorManager#getValidators(Class, null) cause
      null pointer exception.

      Here is the stack trace:

      Caused by: java.lang.NullPointerException
      	at com.opensymphony.xwork2.validator.DefaultActionValidatorManager.loadFile(DefaultActionValidatorManager.java:330)
      	at com.opensymphony.xwork2.validator.DefaultActionValidatorManager.buildClassValidatorConfigs(DefaultActionValidatorManager.java:237)
      	at com.opensymphony.xwork2.validator.DefaultActionValidatorManager.buildValidatorConfigs(DefaultActionValidatorManager.java:316)
      	at com.opensymphony.xwork2.validator.DefaultActionValidatorManager.buildValidatorConfigs(DefaultActionValidatorManager.java:297)
      	at com.opensymphony.xwork2.validator.DefaultActionValidatorManager.buildValidatorConfigs(DefaultActionValidatorManager.java:297)
      	at com.opensymphony.xwork2.validator.DefaultActionValidatorManager.getValidators(DefaultActionValidatorManager.java:82)
      	at com.opensymphony.xwork2.validator.DefaultActionValidatorManager.getValidators(DefaultActionValidatorManager.java:74)

      The error occurs when following code is executed:

      URL fileUrl = ClassLoaderUtil.getResource(fileName, clazz);
      if ((checkFile && fileManager.fileNeedsReloading(fileUrl.toString())) || !validatorFileCache.containsKey(fileName)) {

      with fileName = Object-validation.xml
      this file doesn't exists, so getResource returns null.

        Attachments

        1. WW-3850.diff
          2 kB
          Tony Chemit

          Issue Links

            Activity

              People

              • Assignee:
                lukaszlenart Lukasz Lenart
                Reporter:
                chatellier Eric Chatellier
              • Votes:
                1 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: