Dear Developers,

We are a team of researchers from the Hong Kong University of Science and
Technology (HKUST). Currently, we are studying how crowdsourcing can help
developers to build a higher quality software.

One of the subjects that we used is Apache Commons Email. From our
experiment, we identified a few areas in a particular file "EmailTest.java"
that might be proned to NullPointerException being thrown.

The following 7 methods are identified as "NullPointerException Prone":
1) testAddToWithEncoding()
2) testAddTo2()
3) testAddCc2()
4) testAddBccWithEncoding()
5) testAddBcc2()
6) testAddReplyToWithEncoding()
7) testAddReplyTo2()
All the above methods encompassed a for loop that checks for the length of
the object
"VALID_EMAILS" in its condition.

Our reference from the Stack Overflow community pointed out that a null
check to the object of a for loop is preferred to prevent the occurrence of
NPE. The Stack Overflow reference to this is at "
http://stackoverflow.com/questions/10565323";.

We would like to propose an additional change for your kind consideration:
1) Having an extra assertion to check if the object "VALID_EMAILS" is null

By having this new assertion, unnecessary NPE can be avoided.

We hope that you can consider this and let us know about any thoughts. This
will be a tremendous help to us in our continuing research to building a
better software and to help the open-source community as a whole.

Please do not hesitate to contact me @ fche...@cse.ust.hk if there are any
queries.

Thanks a lot and have a great week ahead!

-- 
Warmest Regards,
    Fuxiang

Reply via email to