Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
1.0.0, 2.0.1
-
None
Description
I am using the apacheDS API (org.apache.directory.api:api-all:1.0.0) to forward the DSML messages I received in my app to my local LDAP directory (apacheDS).
When I forward such a message :
<batchRequest xmlns="urn:oasis:names:tc:DSML:2:0:core">
<authRequest principal="a8717135-81e3-4fc2-bcbe-5180d8a274fb@1.1.1.2.2" requestID="4948"/>
...
</batchRequest>
The Dsmlv2Engine.process(OutputStream, OutputStream) method logs
2020-09-07 14:08:41,201 WARN () [org.apache.directory.api.dsmlv2.engine.Dsmlv2Engine] (http-/0.0.0.0:8080-1 ) Failed to process request: java.lang.NullPointerException
at org.apache.directory.api.dsmlv2.response.BindResponseDsml.toDsml(BindResponseDsml.java:64) [api-all-1.0.0.jar:1.0.0]
at org.apache.directory.api.dsmlv2.engine.Dsmlv2Engine.writeResponse(Dsmlv2Engine.java:526) [api-all-1.0.0.jar:1.0.0]
at org.apache.directory.api.dsmlv2.engine.Dsmlv2Engine.processRequest(Dsmlv2Engine.java:598) [api-all-1.0.0.jar:1.0.0]
at org.apache.directory.api.dsmlv2.engine.Dsmlv2Engine.processDSML(Dsmlv2Engine.java:448) [api-all-1.0.0.jar:1.0.0]
at org.apache.directory.api.dsmlv2.engine.Dsmlv2Engine.processDSML(Dsmlv2Engine.java:247) [api-all-1.0.0.jar:1.0.0]
at org.apache.directory.api.dsmlv2.engine.Dsmlv2Engine.processDSML(Dsmlv2Engine.java:230) [api-all-1.0.0.jar:1.0.0]
and the received response is :
<batchResponse xmlns="urn:oasis:names:tc:DSML:2:0:core" requestID="0">
<errorResponse requestID="2" type="gatewayInternalError">
<message>ERR_03003 Internal Error: null</message>
</errorResponse>
</batchResponse>
This seems to happen because the writeResponse method in class Dsmlv2Engine uses
respDsml.toDsml( null );
which throw NullPointerException when trying to do
Element element = root.addElement( "authResponse" );
which seems to be inevitable as we input null.
This happens in version 1.0.0 but also with the 2.0.1 after update of the dependency.
Thanks in advance for your insights.