Uploaded image for project: 'Axis2'
  1. Axis2
  2. AXIS2-5747

NullPointerException in DeploymentFileData.getName on failed tests

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.7.1
    • 1.7.2
    • kernel
    • None
    • Windows 8.1 x86-64, jdk1.7.0_80 x86-64

    Description

      I tried to build 1.7.1 from src using mvn and get the following NullPointerException:

      Running org.apache.axis2.transport.http.SimpleHTTPServerTest
      Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.318 sec <<< FAILURE!
      org.apache.axis2.transport.testkit.ManagedTestSuite@4fbc7c5c(org.apache.axis2.transport.testkit.ManagedTestSuite)  Time elapsed: 0.317 sec  <<< ERROR!
      java.lang.NullPointerException: null
              at org.apache.axis2.deployment.repository.util.DeploymentFileData.getName(DeploymentFileData.java:85)
              at org.apache.axis2.deployment.ModuleDeployer.deoloyFromUrl(ModuleDeployer.java:239)
              at org.apache.axis2.deployment.ModuleDeployer.deploy(ModuleDeployer.java:120)
              at org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:144)
              at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:585)
              at org.apache.axis2.deployment.repository.util.WSInfoList.update(WSInfoList.java:164)
              at org.apache.axis2.deployment.RepositoryListener.update(RepositoryListener.java:377)
              at org.apache.axis2.deployment.DeploymentEngine.loadRepositoryFromURL(DeploymentEngine.java:303)
              at org.apache.axis2.transport.CustomAxisConfigurator.getAxisConfiguration(CustomAxisConfigurator.java:46)
              at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:64)
              at org.apache.axis2.transport.UtilsTransportServer.<init>(UtilsTransportServer.java:51)
              at org.apache.axis2.transport.testkit.axis2.endpoint.AxisTestEndpointContext.setUp(AxisTestEndpointContext.java:59)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:606)
              at org.apache.axis2.transport.testkit.tests.TestResource$MethodInvocation.execute(TestResource.java:53)
              at org.apache.axis2.transport.testkit.tests.TestResource.setUp(TestResource.java:172)
              at org.apache.axis2.transport.testkit.tests.TestResourceSet.setUp(TestResourceSet.java:151)
              at org.apache.axis2.transport.testkit.tests.TestResourceSet.setUp(TestResourceSet.java:132)
              at org.apache.axis2.transport.testkit.ManagedTestSuite.run(ManagedTestSuite.java:105)
      

      ModuleDeployer.deoloyFromUrl is failing for some reason and instead of logging a proper error message it tries to access deploymentFileData.getName(), which throws a NPE.

      public String getName() {
          return file.getName(); // No need to check for null due to constructor check
      }
      

      Please recognize the comment, which makes false claims about a null-check:

      public DeploymentFileData(File file) {
          this.file = file;
      }
      

      So from my point of view getName or the CTR needs to be made null safe, so the caller can easier log error messages when things fail for any resons, like in my test run. Currently the NPE is hiding the root cause for the failing test.

      The code is still the same in trunk, but I don't know if the test fails there as well, because it fails in my case for other reasons already before that test.

      Attachments

        1. DeploymentFileData.java.patch
          2 kB
          Thorsten Schöning

        Activity

          People

            veithen Andreas Veithen
            tschoening Thorsten Schöning
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: