NPE if null argument specified for InternetHeaders.getMatchingHeaders() -----------------------------------------------------------------------
Key: GERONIMO-4126 URL: https://issues.apache.org/jira/browse/GERONIMO-4126 Project: Geronimo Issue Type: Bug Security Level: public (Regular issues) Reporter: Rick McGuire Assignee: Rick McGuire Priority: Minor Fix For: 2.2 The InternetHeaders getMatchingHeaders(), getNonMatchingHeaders(), etc. methods give an NPE if a null match list is provided. The Sun implementation treats this the same as an empty array. The following simple program can demonstrate the problem: import javax.mail.internet.InternetHeaders; import javax.mail.Header; import java.util.Enumeration; public class TestMatchHeaders { static public void main(String [] args) { InternetHeaders headers = new InternetHeaders(); headers.setHeader("Subject", "Hello"); headers.setHeader("From", "Me"); Enumeration e = headers.getMatchingHeaderLines(null); System.out.println(">>>>> Matching lines"); while (e.hasMoreElements()) { System.out.println((String)e.nextElement()); } e = headers.getNonMatchingHeaderLines(null); System.out.println(">>>>> Non-Matching lines"); while (e.hasMoreElements()) { System.out.println((String)e.nextElement()); } } } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.