Author: rdonkin
Date: Wed Sep 19 13:07:47 2007
New Revision: 577431
URL: http://svn.apache.org/viewvc?rev=577431&view=rev
Log:
Fixed NPE MIME4J-28. Fix suggested by Ron Lissack in
https://issues.apache.org/jira/browse/MIME4J-28.
Modified:
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Header.java
Modified:
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Header.java
URL:
http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Header.java?rev=577431&r1=577430&r2=577431&view=diff
==============================================================================
---
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Header.java
(original)
+++
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/Header.java
Wed Sep 19 13:07:47 2007
@@ -125,9 +125,16 @@
* @param name the field name (e.g. From, Subject).
* @return the list of fields.
*/
- public List getFields(String name) {
- List l = (List) fieldMap.get(name.toLowerCase());
- return Collections.unmodifiableList(l);
+ public List getFields(final String name) {
+ final String lowerCaseName = name.toLowerCase();
+ final List l = (List) fieldMap.get(lowerCaseName);
+ final List results;
+ if (l == null || l.isEmpty()) {
+ results = Collections.EMPTY_LIST;
+ } else {
+ results = Collections.unmodifiableList(l);
+ }
+ return results;
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]