Issue Details (XML | Word | Printable)

Key: JAMES-476
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Stefano Bagnara
Reporter: Bernd Fondermann
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
JAMES Server

NPE in RemoteDelivery

Created: 13/Apr/06 05:44 PM   Updated: 21/Nov/07 08:31 AM
Return to search
Component/s: Remote Delivery
Affects Version/s: 2.3.0
Fix Version/s: 2.3.0

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works remotedelivery.patch 2006-04-13 05:57 PM Bernd Fondermann 4 kB

Resolution Date: 28/Apr/06 05:55 AM


 Description  « Hide
I get the following exception in RemoteDelivery.getGatewaySMTPHostAddresses():

java.lang.NullPointerException
at org.apache.james.transport.mailets.RemoteDelivery$1.hasNext(RemoteDelivery.java:1331)
at org.apache.james.transport.mailets.RemoteDelivery.deliver(RemoteDelivery.java:453)
at org.apache.james.transport.mailets.RemoteDelivery.run(RemoteDelivery.java:1098)
at java.lang.Thread.run(Thread.java:595)

in hasNext(), the break condition is not complete (missing addresses == null check)

I'm working on a patch.

RemoteDelivery config in question:

         <mailet match="All" class="RemoteDelivery">
            <outgoing> file://var/mail/outgoing/ </outgoing>

            <delayTime> 5 minutes </delayTime>
            <delayTime> 10 minutes </delayTime>
            <delayTime> 45 minutes </delayTime>
            <delayTime> 2 hours </delayTime>
            <delayTime> 3 hours </delayTime>
            <delayTime> 6 hours </delayTime>
            <maxRetries> 25 </maxRetries>

            <deliveryThreads> 1 </deliveryThreads>

            <sendpartial>false</sendpartial>
            
            <bounceProcessor>bounces</bounceProcessor>
            <gateway>localhost</gateway>
            <gatewayPort>2525</gatewayPort>
         </mailet>


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Bernd Fondermann made changes - 13/Apr/06 05:57 PM
Field Original Value New Value
Attachment remotedelivery.patch [ 12325288 ]
Stefano Bagnara added a comment - 15/Apr/06 09:57 PM
How could it happen to have a message with no recipients in the outgoing spool?
IIRC RemoteDelivery store a copy of serviced Mail for each domain of the recipients. If the message has no recipients it should not write anything to the outgoing spool.

Bernd Fondermann added a comment - 18/Apr/06 05:28 PM
how is this question related to the reported little bug? in this case here, where a gateway is defined, the message and its recepients are not visited. instead, the deliver() method calls getGatewaySMTPHostAddresses() and i get the NPE right there.

IMO, the bugfix can be justified by looking only at getGatewaySMTPHostAddresses() and no calling code.

but first, to get a better understanding of this important mailet, i'll write some unit tests.

Stefano Bagnara added a comment - 18/Apr/06 06:06 PM
I was just wondering how it would be possible to have a message with no recipients. I wasn't "rejecting" the bug/patch ;-)

I didn't consider the "gateway" configuration: it now makes much more sense.

Repository Revision Date User Message
ASF #397667 Thu Apr 27 22:54:22 UTC 2006 bago Fix for NPE in remotedelivery using gateway option and having no recipients in the message (JAMES-476)
Bug report and patch provided by Bernd Foremann
Files Changed
MODIFY /james/server/trunk/src/java/org/apache/james/transport/mailets/RemoteDelivery.java

Stefano Bagnara added a comment - 28/Apr/06 05:55 AM
Applied.
Another option (better?) would be to set it to GHOST in the service method and avoid storing the message in the outgoing spool.

Stefano Bagnara made changes - 28/Apr/06 05:55 AM
Resolution Fixed [ 1 ]
Status Open [ 1 ] Resolved [ 5 ]
Assignee Stefano Bagnara [ bago ]
Danny Angus added a comment - 21/Nov/07 08:31 AM
Closing issue fixed in released version.

Danny Angus made changes - 21/Nov/07 08:31 AM
Status Resolved [ 5 ] Closed [ 6 ]