Uploaded image for project: 'XWork'
  1. XWork
  2. XW-700

DefaultValidatorFactory throws exception

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.1.2
    • 2.1.4
    • Validators
    • None

    Description

      The start of my web application (Struts2 with Xwork 2.1.2 over Tomcat 6, Fedora Core 10) sometimes throws an exception

      ERROR [main] com.opensymphony.xwork2.validator.DefaultValidatorFactory error- Unable to load file:/root/

      java.lang.NullPointerException

      at java.util.Arrays$ArrayList.<init>(Arrays.java:3357)

      at java.util.Arrays.asList(Arrays.java:3343)

      at com.opensymphony.xwork2.validator.DefaultValidatorFactory.parseValidators(DefaultValidatorFactory.java:117)

      at com.opensymphony.xwork2.validator.DefaultValidatorFactory.<init>(DefaultValidatorFactory.java:44)

      Looking at the souce, the problem seems to happen when

      Iterator<URL> urls = ClassLoaderUtil.getResources("", DefaultValidatorFactory.class, false);

      returns a directory which is not readable by the present user.

      That happened to me, because I start the container (tomcat) by a script run by root that makes a 'su' to a 'tomcat' user.

      Afterwards, the above line returned, among others, the 'current directory', that happens to be /root/ , which is unreadable by 'tomcat', and then java.util.Arrays.asList(null) fails badly.

      I think a simple check ( f.listFiles() != null) would suffice.

      Hernán González

      Attachments

        Activity

          People

            rainerh Rainer Hermanns
            leonbloy Hernan J. Gonzalez
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: