If the <package> or <zip> nodes are not present in the <deploy> a null pointer
exception can occur
--------------------------------------------------------------------------------------------------
Key: ODE-226
URL: https://issues.apache.org/jira/browse/ODE-226
Project: ODE
Issue Type: Bug
Components: Management
Affects Versions: 1.1
Reporter: Douglas Scott Jackson
Priority: Minor
I wanted to post a patch to the code, but wasn't sure how to do so. So, I am
creating an issue and putting the patch here.
The issue is if you send an invalid <deploy> element with only one sub element
(invalid request) or with 2 sub elements where
the second does not have a child element you will get a null pointer exception
rather than a nice error message. For someone
without access to code this will not be very helpful.
i.e.:
<dapi:deploy xmlns:dapi="http://www.apache.org/ode/deployapi">
<dapi:name>xxx</dapi:name>
<dapi:package>uuencoded-zip-file-without-zip-element</dapi:package>
</dapi:deploy>
Here is a patch to fix. I have not figured out how to create a war file in
order to test, so it is untested:
Index:
axis2/src/main/java/org/apache/ode/axis2/service/DeploymentWebService.java
===================================================================
--- axis2/src/main/java/org/apache/ode/axis2/service/DeploymentWebService.java
(revision 611855)
+++ axis2/src/main/java/org/apache/ode/axis2/service/DeploymentWebService.java
(working copy)
@@ -114,8 +114,8 @@
if (operation.equals("deploy")) {
OMElement namePart =
messageContext.getEnvelope().getBody().getFirstElement().g
etFirstElement();
OMElement zipPart = (OMElement)
namePart.getNextOMSibling();
- OMElement zip = zipPart.getFirstElement();
- if (!zipPart.getQName().getLocalPart().equals("package") ||
+ OMElement zip = zipPart == null ? null :
zipPart.getFirstElement();
+ if (zip == null ||
!zipPart.getQName().getLocalPart().equals("package") ||
!zip.getQName().getLocalPart().equals("zip"))
throw new OdeFault("Your message should contain a part
named 'package' with
a zip element");
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.