ODE
  1. ODE
  2. ODE-445

NPE if config directory is not a valid directory

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.3.2
    • Component/s: BPEL Runtime
    • Labels:
      None

      Description

      Today, noticed that all the join correlation test cases break with NullPointerException.

      1. ode-445.2.patch
        5 kB
        Sean Ahn
      2. ode-445.2.trunk.patch
        3 kB
        Sean Ahn
      3. ode-445.patch
        1 kB
        Sean Ahn
      4. ode-445.trunk.patch
        1 kB
        Sean Ahn

        Activity

        Hide
        Alexis Midon added a comment -

        committed in 1.X and trunk

        Show
        Alexis Midon added a comment - committed in 1.X and trunk
        Hide
        Alexis Midon added a comment -


        The fix tests existence of the work/app/config directories and throws an exception if necessary.

        Show
        Alexis Midon added a comment - The fix tests existence of the work/app/config directories and throws an exception if necessary.
        Hide
        Sean Ahn added a comment -

        Attached second patch for the trunk.

        Show
        Sean Ahn added a comment - Attached second patch for the trunk.
        Hide
        Sean Ahn added a comment -

        Attached second patch that's to be applied on top of the first patch.

        The logic now checks if the directory exists and it's really a directory:

        if( !_configDir.exists() )

        { __log.error("The specified config directory does not exist:" + _configDir.getAbsolutePath() + "!!"); }

        else if( !_configDir.isDirectory() )

        { __log.error("The specified config directory is not a directory but a regular file:" + _configDir.getAbsolutePath() + "!!"); }

        else {
        // list and sort endpoint config files
        File[] files = _configDir.listFiles(new FileFilter() {
        public boolean accept(File path)

        { return path.getName().endsWith(".endpoint") && path.isFile(); }

        });
        if( files != null )

        { Arrays.sort(files); propFiles.addAll(Arrays.asList(files)); }

        }

        Show
        Sean Ahn added a comment - Attached second patch that's to be applied on top of the first patch. The logic now checks if the directory exists and it's really a directory: if( !_configDir.exists() ) { __log.error("The specified config directory does not exist:" + _configDir.getAbsolutePath() + "!!"); } else if( !_configDir.isDirectory() ) { __log.error("The specified config directory is not a directory but a regular file:" + _configDir.getAbsolutePath() + "!!"); } else { // list and sort endpoint config files File[] files = _configDir.listFiles(new FileFilter() { public boolean accept(File path) { return path.getName().endsWith(".endpoint") && path.isFile(); } }); if( files != null ) { Arrays.sort(files); propFiles.addAll(Arrays.asList(files)); } }
        Hide
        Alexis Midon added a comment -

        I think the patch is not fully correct. Actually the exception occurs because the denoted path [1] does not exist (and so is not a directory) not because there is no endpoint config files.
        The fix would be to test the existence of the directory earlier in the code path, when the config directory is set.

        [1] /home/alexis/w/ode/br-ode-1.X.git/axis2-war/target/test-classes/webapp/WEB-INF/conf.hib

        Show
        Alexis Midon added a comment - I think the patch is not fully correct. Actually the exception occurs because the denoted path [1] does not exist (and so is not a directory) not because there is no endpoint config files. The fix would be to test the existence of the directory earlier in the code path, when the config directory is set. [1] /home/alexis/w/ode/br-ode-1.X.git/axis2-war/target/test-classes/webapp/WEB-INF/conf.hib
        Hide
        Sean Ahn added a comment -

        Thanks, Alex for applying the patches.

        That happens only for the join correlation test cases: e.g. CorrelationJoinHibTest.

        Show
        Sean Ahn added a comment - Thanks, Alex for applying the patches. That happens only for the join correlation test cases: e.g. CorrelationJoinHibTest.
        Hide
        Alex Boisvert added a comment -

        Maybe we should consider issuing a warning in the case listFiles() returns null?

        Show
        Alex Boisvert added a comment - Maybe we should consider issuing a warning in the case listFiles() returns null?
        Hide
        Alex Boisvert added a comment -

        Patch applied to Ode 1.x branch:

        boisvert@boog:~/svn/ode/1.1$ svn commit -m "ODE-445: No endpoint config files results in a null pointer exception" axis2/src/main/java/org/apache/ode/axis2/ODEService.java bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java

        Sending axis2/src/main/java/org/apache/ode/axis2/ODEService.java
        Sending bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java
        Transmitting file data ..
        Committed revision 722484.

        and trunk:

        boisvert@boog:~/svn/ode/trunk$ svn commit -m "ODE-445: No endpoint config files results in a null pointer exception" axis2/src/main/java/org/apache/ode/axis2/ODEService.java bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java
        Sending axis2/src/main/java/org/apache/ode/axis2/ODEService.java
        Sending bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java
        Transmitting file data ..
        Committed revision 722486.

        Show
        Alex Boisvert added a comment - Patch applied to Ode 1.x branch: boisvert@boog:~/svn/ode/1.1$ svn commit -m " ODE-445 : No endpoint config files results in a null pointer exception" axis2/src/main/java/org/apache/ode/axis2/ODEService.java bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java Sending axis2/src/main/java/org/apache/ode/axis2/ODEService.java Sending bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java Transmitting file data .. Committed revision 722484. and trunk: boisvert@boog:~/svn/ode/trunk$ svn commit -m " ODE-445 : No endpoint config files results in a null pointer exception" axis2/src/main/java/org/apache/ode/axis2/ODEService.java bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java Sending axis2/src/main/java/org/apache/ode/axis2/ODEService.java Sending bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java Transmitting file data .. Committed revision 722486.
        Hide
        Alexis Midon added a comment - - edited

        Surprising exception because java.io.File#listFiles "returns null if this abstract pathname does not denote a directory, or if an I/O error occurs.:
        Meaning either _configDir is not a directory or that an unreported I/O exception occured.

        Could you please reproduce the bug and see in which case we are ?

        http://java.sun.com/j2se/1.5.0/docs/api/java/io/File.html#listFiles(java.io.FileFilter)

        Show
        Alexis Midon added a comment - - edited Surprising exception because java.io.File#listFiles "returns null if this abstract pathname does not denote a directory, or if an I/O error occurs.: Meaning either _configDir is not a directory or that an unreported I/O exception occured. Could you please reproduce the bug and see in which case we are ? http://java.sun.com/j2se/1.5.0/docs/api/java/io/File.html#listFiles(java.io.FileFilter )
        Hide
        Sean Ahn added a comment -

        Attached a patch for the trunk.

        Show
        Sean Ahn added a comment - Attached a patch for the trunk.
        Hide
        Sean Ahn added a comment -

        1. We are eating up the original error stack trace for this specific case in the ODEService class.
        2. When no endpoint configuration files found, we pass in the null result to an ArrayList.sort() method.

        I think somewhere else something has been changed probably related to endpoint configuration, and, that caused this problem. But, I do not want to find out what and who. Instead, this is the real fix on the problem.

        Show
        Sean Ahn added a comment - 1. We are eating up the original error stack trace for this specific case in the ODEService class. 2. When no endpoint configuration files found, we pass in the null result to an ArrayList.sort() method. I think somewhere else something has been changed probably related to endpoint configuration, and, that caused this problem. But, I do not want to find out what and who. Instead, this is the real fix on the problem.

          People

          • Assignee:
            Alexis Midon
            Reporter:
            Sean Ahn
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development