Hi, See comments inline, Eric

On 07/16/2012 10:10 AM, Tze-Kei Lee wrote:
Hi,

I am writing a custom hook on smtp with return code DENTSOFY |
DISCONNECT, but the SMTPResponse throws exception with stacktrace:
java.lang.IllegalArgumentException: Invalid Response format. Format
should be [Code Description]
      at 
org.apache.james.protocols.smtp.SMTPResponse.extractCode(SMTPResponse.java:69)
      at 
org.apache.james.protocols.smtp.SMTPResponse.<init>(SMTPResponse.java:59)
      at 
org.apache.james.protocols.smtp.core.AbstractHookableCmdHandler.calcDefaultSMTPResponse(AbstractHookableCmdHandler.java:202)
      at 
org.apache.james.protocols.smtp.core.AbstractHookableCmdHandler.processHooks(AbstractHookableCmdHandler.java:136)

Tracing AbstractHookableCmdHandler.calcDefaultSMTPResponse i found
that it's rCode == HookReturnCode.DENYSOFT instead of (rCode & code)
== code, so I got two questions here

1. Is this intentional that DENYSOFT should be used alone ?

DENYSOFT can't be used in combination with DECLINED, nor OK, nor DENY.
You can combine it with DISCONNECT.

2. in AbstractHookableCmdHandler:202, SMTPResponse is constructed with
empty string which will trigger the exception above. Is this
intentional ?


If you return DENYSOFT, you shouldn't come to new SMTPResponse("") (AbstractHookableCmdHandler:189 should return a correctly constructed SMTPReponse).

Now your question remains in case we have a DISCONNECT which returns SMTPResponse(""). I tried to follow the DISCONNECT processing, but I still don't have everything to fix this. Don't hesitate to come with a proposal.

Best Regards

Tze-Kei

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



--
eric | http://about.echarles.net | @echarles


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

Reply via email to