geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rick McGuire (JIRA)" <j...@apache.org>
Subject [jira] Created: (GERONIMO-4126) NPE if null argument specified for InternetHeaders.getMatchingHeaders()
Date Wed, 18 Jun 2008 12:10:45 GMT
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.


Mime
View raw message