Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
1.1
-
None
Description
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");