Repository: mercurial
Revision: 81
Author: Bill Shannon <bill.shannon_at_sun.com>
Date: 2008-09-09 00:04:27 UTC
Log Message:
-----------
Fix possible NPE in MimeMessage if flags is not set in copy
constructor.
Modified Paths:
--------------
doc/release/CHANGES.txt
mail/src/main/java/com/sun/mail/imap/IMAPMessage.java
mail/src/main/java/javax/mail/internet/MimeMessage.java
Diffs:
-----
diff -r d4706c5f00be -r b0d2e756e0dc doc/release/CHANGES.txt
--- a/doc/release/CHANGES.txt Mon Sep 08 17:03:21 2008 -0700
+++ b/doc/release/CHANGES.txt Mon Sep 08 17:04:27 2008 -0700
@@ -44,6 +44,7 @@
<no id> add mail.<protocol>.socketFactory and
.ssl.socketFactory properties
<no id> add mail.<protocol>.ssl.enable property
<no id> add mail.mime.parameters.strict property to control
ParameterList parse
+<no id> fix possible NPE in MimeMessage if flags is not set in
copy constructor
CHANGES IN THE 1.4.1 RELEASE
diff -r d4706c5f00be -r b0d2e756e0dc
mail/src/main/java/com/sun/mail/imap/IMAPMessage.java
--- a/mail/src/main/java/com/sun/mail/imap/IMAPMessage.java Mon Sep
08 17:03:21 2008 -0700
+++ b/mail/src/main/java/com/sun/mail/imap/IMAPMessage.java Mon Sep
08 17:04:27 2008 -0700
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the
GNU
* General Public License Version 2 only ("GPL") or the Common
Development
@@ -1337,6 +1337,9 @@
checkExpunged();
flags = p.fetchFlags(getSequenceNumber());
+ // make sure flags is always set, even if server is
broken
+ if (flags == null)
+ flags = new Flags();
} catch (ConnectionException cex) {
throw new FolderClosedException(folder,
cex.getMessage());
} catch (ProtocolException pex) {
diff -r d4706c5f00be -r b0d2e756e0dc
mail/src/main/java/javax/mail/internet/MimeMessage.java
--- a/mail/src/main/java/javax/mail/internet/MimeMessage.java Mon Sep
08 17:03:21 2008 -0700
+++ b/mail/src/main/java/javax/mail/internet/MimeMessage.java Mon Sep
08 17:04:27 2008 -0700
@@ -221,6 +221,8 @@
public MimeMessage(MimeMessage source) throws MessagingException {
super(source.session);
flags = source.getFlags();
+ if (flags == null) // make sure flags is always set
+ flags = new Flags();
ByteArrayOutputStream bos;
int size = source.getSize();
if (size > 0)