[ 
https://issues.apache.org/jira/browse/AXIS2-5747?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Thorsten Schöning updated AXIS2-5747:
-------------------------------------
    Attachment: DeploymentFileData.java.patch

Returning null in DeploymentFileData.getName leads to another exception:

{CODE}
Running org.apache.axis2.transport.http.SimpleHTTPServerTest
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.325 sec <<< 
FAILURE!
org.apache.axis2.transport.testkit.ManagedTestSuite@6624b64a(org.apache.axis2.transport.testkit.ManagedTestSuite)
  Time elapsed: 0.325 sec  <<< ERROR!
java.lang.NullPointerException: null
        at 
org.apache.axis2.deployment.DeploymentEngine.getAxisServiceName(DeploymentEngine.java:714)
        at 
org.apache.axis2.deployment.ModuleDeployer.deoloyFromUrl(ModuleDeployer.java:247)
        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)
{CODE}

So I'll attach a patch testing file and url first and returning an empty string 
as fallback instead of null. What to return in case of an url probably needs 
review...

> NullPointerException in DeploymentFileData.getName on failed tests
> ------------------------------------------------------------------
>
>                 Key: AXIS2-5747
>                 URL: https://issues.apache.org/jira/browse/AXIS2-5747
>             Project: Axis2
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 1.7.1
>         Environment: Windows 8.1 x86-64, jdk1.7.0_80 x86-64
>            Reporter: Thorsten Schöning
>         Attachments: DeploymentFileData.java.patch
>
>
> I tried to build 1.7.1 from src using mvn and get the following 
> NullPointerException:
> {CODE}
> 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)
> {CODE}
> 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.
> {CODE}
> public String getName() {
>     return file.getName(); // No need to check for null due to constructor 
> check
> }
> {CODE}
> Please recognize the comment, which makes false claims about a null-check:
> {CODE}
> public DeploymentFileData(File file) {
>     this.file = file;
> }
> {CODE}
> 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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to