commits@javamail.java.net

[javamail~mercurial:569] Update HIGHESTMODSEQ on any OK response.

From: <shannon_at_java.net>
Date: Wed, 15 May 2013 21:59:18 +0000

Project: javamail
Repository: mercurial
Revision: 569
Author: shannon
Date: 2013-05-14 21:07:13 UTC
Link:

Log Message:
------------
Update version to 1.5.1-SNAPSHOT.
update ant build to more-or-less work - bug 5901
Fix javadoc error.
Two bugs fixed in 1.4.7 were listed under 1.5.0 as well, remove them.
Fix reference to Gmail IMAP extensions.
Fix typo in javadoc.
Allow PROXYAUTH user to change after initial connection so that (e.g.)
admin can manipulate mailboxes for multiple users while reusing connection.
Add support for the QRESYNC, CONDSTORE, and WITHIN IMAP extensions.
Update some copyrights and the exclude list.
Remove debugging println.
Fix synchronization bug in SharedFileInputStream - bug 5934.
Update HIGHESTMODSEQ on any OK response.


Revisions:
----------
558
559
560
561
562
563
564
565
566
567
568
569


Modified Paths:
---------------
client/pom.xml
demo/pom.xml
dsn/pom.xml
gimap/pom.xml
imap/pom.xml
javadoc/pom.xml
logging/pom.xml
mail/pom.xml
mailapi/pom.xml
mailapijar/pom.xml
mbox/native/pom.xml
mbox/pom.xml
oldmail/pom.xml
outlook/pom.xml
parent-distrib/pom.xml
pom.xml
pop3/pom.xml
publish/pom.xml
servlet/pom.xml
smtp/pom.xml
taglib/pom.xml
webapp/pom.xml
build.properties
build.xml
mail/src/main/java/com/sun/mail/util/logging/MailHandler.java
doc/release/CHANGES.txt
gimap/src/main/java/com/sun/mail/gimap/package.html
mail/src/main/java/javax/mail/search/ReceivedDateTerm.java
mail/src/main/java/com/sun/mail/imap/IMAPStore.java
mail/src/main/java/com/sun/mail/iap/Argument.java
mail/src/main/java/com/sun/mail/iap/Response.java
mail/src/main/java/com/sun/mail/imap/IMAPFolder.java
mail/src/main/java/com/sun/mail/imap/IMAPMessage.java
mail/src/main/java/com/sun/mail/imap/Utility.java
mail/src/main/java/com/sun/mail/imap/package.html
mail/src/main/java/com/sun/mail/imap/protocol/FetchResponse.java
mail/src/main/java/com/sun/mail/imap/protocol/IMAPProtocol.java
mail/src/main/java/com/sun/mail/imap/protocol/MailboxInfo.java
mail/src/main/java/com/sun/mail/imap/protocol/SearchSequence.java
mail/src/main/java/com/sun/mail/imap/protocol/Status.java
mail/src/main/java/com/sun/mail/imap/protocol/UIDSet.java
copyright-exclude
mail/src/main/java/javax/mail/Service.java
mail/src/main/java/javax/mail/internet/MimeBodyPart.java
mail/src/test/java/com/sun/mail/imap/protocol/UIDSetTest.java
mail/src/main/java/javax/mail/util/SharedFileInputStream.java


Added Paths:
------------
mail/src/main/java/com/sun/mail/imap/MessageVanishedEvent.java
mail/src/main/java/com/sun/mail/imap/OlderTerm.java
mail/src/main/java/com/sun/mail/imap/ResyncData.java
mail/src/main/java/com/sun/mail/imap/YoungerTerm.java
mail/src/main/java/com/sun/mail/imap/protocol/MODSEQ.java
mail/src/test/java/com/sun/mail/imap/protocol/UIDSetTest.java
mail/src/test/resources/com/sun/mail/imap/protocol/uiddata


Diffs:
------
diff -r 0b866cffd059 -r 53213cc152a1 client/pom.xml
--- a/client/pom.xml Mon Apr 08 11:56:26 2013 -0700
+++ b/client/pom.xml Mon Apr 22 14:10:03 2013 -0700
@@ -48,7 +48,7 @@
     <parent>
         <groupId>com.sun.mail</groupId>
         <artifactId>all</artifactId>
- <version>1.5.0</version>
+ <version>1.5.1-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.sun.mail</groupId>

diff -r 0b866cffd059 -r 53213cc152a1 demo/pom.xml
--- a/demo/pom.xml Mon Apr 08 11:56:26 2013 -0700
+++ b/demo/pom.xml Mon Apr 22 14:10:03 2013 -0700
@@ -48,7 +48,7 @@
     <parent>
         <groupId>com.sun.mail</groupId>
         <artifactId>all</artifactId>
- <version>1.5.0</version>
+ <version>1.5.1-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.sun.mail</groupId>

diff -r 0b866cffd059 -r 53213cc152a1 dsn/pom.xml
--- a/dsn/pom.xml Mon Apr 08 11:56:26 2013 -0700
+++ b/dsn/pom.xml Mon Apr 22 14:10:03 2013 -0700
@@ -48,7 +48,7 @@
     <parent>
         <groupId>com.sun.mail</groupId>
         <artifactId>all</artifactId>
- <version>1.5.0</version>
+ <version>1.5.1-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.sun.mail</groupId>

diff -r 0b866cffd059 -r 53213cc152a1 gimap/pom.xml
--- a/gimap/pom.xml Mon Apr 08 11:56:26 2013 -0700
+++ b/gimap/pom.xml Mon Apr 22 14:10:03 2013 -0700
@@ -48,7 +48,7 @@
     <parent>
         <groupId>com.sun.mail</groupId>
         <artifactId>all</artifactId>
- <version>1.5.0</version>
+ <version>1.5.1-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.sun.mail</groupId>

diff -r 0b866cffd059 -r 53213cc152a1 imap/pom.xml
--- a/imap/pom.xml Mon Apr 08 11:56:26 2013 -0700
+++ b/imap/pom.xml Mon Apr 22 14:10:03 2013 -0700
@@ -48,7 +48,7 @@
     <parent>
         <groupId>com.sun.mail</groupId>
         <artifactId>parent-distrib</artifactId>
- <version>1.5.0</version>
+ <version>1.5.1-SNAPSHOT</version>
         <relativePath>../parent-distrib/pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>

diff -r 0b866cffd059 -r 53213cc152a1 javadoc/pom.xml
--- a/javadoc/pom.xml Mon Apr 08 11:56:26 2013 -0700
+++ b/javadoc/pom.xml Mon Apr 22 14:10:03 2013 -0700
@@ -48,13 +48,13 @@
     <parent>
         <groupId>com.sun.mail</groupId>
         <artifactId>all</artifactId>
- <version>1.5.0</version>
+ <version>1.5.1-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.sun.mail</groupId>
     <artifactId>javadoc</artifactId>
     <packaging>pom</packaging>
- <version>1.5.0</version>
+ <version>1.5.1-SNAPSHOT</version>
     <name>JavaMail API javadocs</name>
     <description>${project.name}</description>
 

diff -r 0b866cffd059 -r 53213cc152a1 logging/pom.xml
--- a/logging/pom.xml Mon Apr 08 11:56:26 2013 -0700
+++ b/logging/pom.xml Mon Apr 22 14:10:03 2013 -0700
@@ -48,7 +48,7 @@
     <parent>
         <groupId>com.sun.mail</groupId>
         <artifactId>all</artifactId>
- <version>1.5.0</version>
+ <version>1.5.1-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.sun.mail</groupId>

diff -r 0b866cffd059 -r 53213cc152a1 mail/pom.xml
--- a/mail/pom.xml Mon Apr 08 11:56:26 2013 -0700
+++ b/mail/pom.xml Mon Apr 22 14:10:03 2013 -0700
@@ -48,7 +48,7 @@
     <parent>
         <groupId>com.sun.mail</groupId>
         <artifactId>all</artifactId>
- <version>1.5.0</version>
+ <version>1.5.1-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.sun.mail</groupId>

diff -r 0b866cffd059 -r 53213cc152a1 mailapi/pom.xml
--- a/mailapi/pom.xml Mon Apr 08 11:56:26 2013 -0700
+++ b/mailapi/pom.xml Mon Apr 22 14:10:03 2013 -0700
@@ -56,7 +56,7 @@
     <parent>
         <groupId>com.sun.mail</groupId>
         <artifactId>all</artifactId>
- <version>1.5.0</version>
+ <version>1.5.1-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.sun.mail</groupId>

diff -r 0b866cffd059 -r 53213cc152a1 mailapijar/pom.xml
--- a/mailapijar/pom.xml Mon Apr 08 11:56:26 2013 -0700
+++ b/mailapijar/pom.xml Mon Apr 22 14:10:03 2013 -0700
@@ -55,7 +55,7 @@
     <parent>
         <groupId>com.sun.mail</groupId>
         <artifactId>all</artifactId>
- <version>1.5.0</version>
+ <version>1.5.1-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <groupId>javax.mail</groupId>

diff -r 0b866cffd059 -r 53213cc152a1 mbox/native/pom.xml
--- a/mbox/native/pom.xml Mon Apr 08 11:56:26 2013 -0700
+++ b/mbox/native/pom.xml Mon Apr 22 14:10:03 2013 -0700
@@ -48,7 +48,7 @@
     <parent>
         <groupId>com.sun.mail</groupId>
         <artifactId>all</artifactId>
- <version>1.5.0</version>
+ <version>1.5.1-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>

diff -r 0b866cffd059 -r 53213cc152a1 mbox/pom.xml
--- a/mbox/pom.xml Mon Apr 08 11:56:26 2013 -0700
+++ b/mbox/pom.xml Mon Apr 22 14:10:03 2013 -0700
@@ -48,7 +48,7 @@
     <parent>
         <groupId>com.sun.mail</groupId>
         <artifactId>all</artifactId>
- <version>1.5.0</version>
+ <version>1.5.1-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.sun.mail</groupId>

diff -r 0b866cffd059 -r 53213cc152a1 oldmail/pom.xml
--- a/oldmail/pom.xml Mon Apr 08 11:56:26 2013 -0700
+++ b/oldmail/pom.xml Mon Apr 22 14:10:03 2013 -0700
@@ -53,7 +53,7 @@
     <parent>
         <groupId>com.sun.mail</groupId>
         <artifactId>all</artifactId>
- <version>1.5.0</version>
+ <version>1.5.1-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <groupId>javax.mail</groupId>

diff -r 0b866cffd059 -r 53213cc152a1 outlook/pom.xml
--- a/outlook/pom.xml Mon Apr 08 11:56:26 2013 -0700
+++ b/outlook/pom.xml Mon Apr 22 14:10:03 2013 -0700
@@ -48,7 +48,7 @@
     <parent>
         <groupId>com.sun.mail</groupId>
         <artifactId>all</artifactId>
- <version>1.5.0</version>
+ <version>1.5.1-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.sun.mail</groupId>

diff -r 0b866cffd059 -r 53213cc152a1 parent-distrib/pom.xml
--- a/parent-distrib/pom.xml Mon Apr 08 11:56:26 2013 -0700
+++ b/parent-distrib/pom.xml Mon Apr 22 14:10:03 2013 -0700
@@ -48,7 +48,7 @@
     <parent>
         <groupId>com.sun.mail</groupId>
         <artifactId>all</artifactId>
- <version>1.5.0</version>
+ <version>1.5.1-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.sun.mail</groupId>

diff -r 0b866cffd059 -r 53213cc152a1 pom.xml
--- a/pom.xml Mon Apr 08 11:56:26 2013 -0700
+++ b/pom.xml Mon Apr 22 14:10:03 2013 -0700
@@ -54,7 +54,7 @@
     <groupId>com.sun.mail</groupId>
     <artifactId>all</artifactId>
     <packaging>pom</packaging>
- <version>1.5.0</version>
+ <version>1.5.1-SNAPSHOT</version>
     <name>JavaMail API distribution</name>
     <description>${project.name}</description>
     <url>http://javamail.java.net</url>
@@ -85,9 +85,9 @@
     </organization>
 
     <properties>
- <mail.version>1.5.0</mail.version>
+ <mail.version>1.5.1-SNAPSHOT</mail.version>
         <!-- like mail.version, but with underscores instead of dots -->
- <mail.zipversion>1_5_0</mail.zipversion>
+ <mail.zipversion>1_5_1-SNAPSHOT</mail.zipversion>
         <mail.spec.version>1.5</mail.spec.version>
         <activation-api.version>1.1</activation-api.version>
         <!-- defaults that are overridden in mail module -->

diff -r 0b866cffd059 -r 53213cc152a1 pop3/pom.xml
--- a/pop3/pom.xml Mon Apr 08 11:56:26 2013 -0700
+++ b/pop3/pom.xml Mon Apr 22 14:10:03 2013 -0700
@@ -48,7 +48,7 @@
     <parent>
         <groupId>com.sun.mail</groupId>
         <artifactId>parent-distrib</artifactId>
- <version>1.5.0</version>
+ <version>1.5.1-SNAPSHOT</version>
         <relativePath>../parent-distrib/pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>

diff -r 0b866cffd059 -r 53213cc152a1 publish/pom.xml
--- a/publish/pom.xml Mon Apr 08 11:56:26 2013 -0700
+++ b/publish/pom.xml Mon Apr 22 14:10:03 2013 -0700
@@ -48,13 +48,13 @@
     <parent>
         <groupId>com.sun.mail</groupId>
         <artifactId>all</artifactId>
- <version>1.5.0</version>
+ <version>1.5.1-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.sun.mail</groupId>
     <artifactId>publish</artifactId>
     <packaging>pom</packaging>
- <version>1.5.0</version>
+ <version>1.5.1-SNAPSHOT</version>
     <name>JavaMail API publish project</name>
 
     <build>
@@ -89,44 +89,44 @@
         <dependency>
             <groupId>com.sun.mail</groupId>
             <artifactId>javax.mail</artifactId>
- <version>1.5.0</version>
+ <version>1.5.1-SNAPSHOT</version>
         </dependency>
     <!--
         <dependency>
             <groupId>com.sun.mail</groupId>
             <artifactId>demo</artifactId>
- <version>1.5.0</version>
+ <version>1.5.1-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>com.sun.mail</groupId>
             <artifactId>client</artifactId>
- <version>1.5.0</version>
+ <version>1.5.1-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>com.sun.mail</groupId>
             <artifactId>servlet</artifactId>
- <version>1.5.0</version>
+ <version>1.5.1-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>com.sun.mail</groupId>
             <artifactId>webapp</artifactId>
             <type>war</type>
- <version>1.5.0</version>
+ <version>1.5.1-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>com.sun.mail</groupId>
             <artifactId>taglib</artifactId>
- <version>1.5.0</version>
+ <version>1.5.1-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>com.sun.mail</groupId>
             <artifactId>logging</artifactId>
- <version>1.5.0</version>
+ <version>1.5.1-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>com.sun.mail</groupId>
             <artifactId>outlook</artifactId>
- <version>1.5.0</version>
+ <version>1.5.1-SNAPSHOT</version>
         </dependency>
     -->
     </dependencies>

diff -r 0b866cffd059 -r 53213cc152a1 servlet/pom.xml
--- a/servlet/pom.xml Mon Apr 08 11:56:26 2013 -0700
+++ b/servlet/pom.xml Mon Apr 22 14:10:03 2013 -0700
@@ -48,7 +48,7 @@
     <parent>
         <groupId>com.sun.mail</groupId>
         <artifactId>all</artifactId>
- <version>1.5.0</version>
+ <version>1.5.1-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.sun.mail</groupId>

diff -r 0b866cffd059 -r 53213cc152a1 smtp/pom.xml
--- a/smtp/pom.xml Mon Apr 08 11:56:26 2013 -0700
+++ b/smtp/pom.xml Mon Apr 22 14:10:03 2013 -0700
@@ -48,7 +48,7 @@
     <parent>
         <groupId>com.sun.mail</groupId>
         <artifactId>parent-distrib</artifactId>
- <version>1.5.0</version>
+ <version>1.5.1-SNAPSHOT</version>
         <relativePath>../parent-distrib/pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>

diff -r 0b866cffd059 -r 53213cc152a1 taglib/pom.xml
--- a/taglib/pom.xml Mon Apr 08 11:56:26 2013 -0700
+++ b/taglib/pom.xml Mon Apr 22 14:10:03 2013 -0700
@@ -48,7 +48,7 @@
     <parent>
         <groupId>com.sun.mail</groupId>
         <artifactId>all</artifactId>
- <version>1.5.0</version>
+ <version>1.5.1-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.sun.mail</groupId>

diff -r 0b866cffd059 -r 53213cc152a1 webapp/pom.xml
--- a/webapp/pom.xml Mon Apr 08 11:56:26 2013 -0700
+++ b/webapp/pom.xml Mon Apr 22 14:10:03 2013 -0700
@@ -48,7 +48,7 @@
     <parent>
         <groupId>com.sun.mail</groupId>
         <artifactId>all</artifactId>
- <version>1.5.0</version>
+ <version>1.5.1-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.sun.mail</groupId>


diff -r 53213cc152a1 -r 1f71ec773fc9 build.properties
--- a/build.properties Mon Apr 22 14:10:03 2013 -0700
+++ b/build.properties Mon Apr 22 14:13:47 2013 -0700
@@ -1,7 +1,7 @@
 #
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 #
-# Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997-2013 Oracle and/or its affiliates. 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
@@ -47,6 +47,10 @@
 src.dsn.dir=dsn/src/main/java
 resources.dsn.dir=dsn/src/main/resources
 component.classes.dsn.dir=dsn/target/classes
+# gimap
+src.gimap.dir=gimap/src/main/java
+resources.gimap.dir=gimap/src/main/resources
+component.classes.gimap.dir=gimap/target/classes
 # imap
 resources.imap.dir=imap/src/main/resources
 component.classes.imap.dir=imap/target/classes
@@ -82,26 +86,25 @@
 resources.legal.dir=mail/src/main/resources
 #
 maven.netbeans.exec.build=target/classes
-# XXX - following only works within Oracle
-spec.dir=/net/anybodys.sfbay/export6/javamail/spec
 
 # needed to build everything on JDK 1.5
 activation.jar=activation.jar
 # needed to build servlet and webapp demo programs
 javaee.jar=javaee.jar
 # external URL references for javadocs
-javase.url=http://java.sun.com/j2se/1.4.2/docs/api/
-jaf.url=http://java.sun.com/javase/technologies/desktop/javabeans/glasgow/javadocs/
+javase.url=http://docs.oracle.com/javase/1.5.0/docs/api
+jaf.url=http://docs.oracle.com/javase/6/docs/api
 
 ### Additonal Component Properties for standalone release ###
 release.dir=target/release
-release.specversion=1.4
-release.version=1.4.4ea
+release.specversion=1.5
+release.version=1.5.1-SNAPSHOT
 release.mail.jar=${release.dir}/mail.jar
 release.mailapi.jar=${release.dir}/lib/mailapi.jar
 release.imap.jar=${release.dir}/lib/imap.jar
 release.smtp.jar=${release.dir}/lib/smtp.jar
 release.pop3.jar=${release.dir}/lib/pop3.jar
+release.gimap.jar=${release.dir}/lib/gimap.jar
 release.dsn.jar=${release.dir}/lib/dsn.jar
 release.mbox.jar=${release.dir}/lib/mbox.jar
 release.docs.dir=${release.dir}/docs
@@ -122,8 +125,8 @@
 javac.debug=on
 javac.optimize=off
 javac.deprecation=off
-javac.source=1.4
-javac.target=1.4
+javac.source=1.5
+javac.target=1.5
 
 ### Use ant.verbose=-verbose for debugging ant targets
 ant.verbose=

diff -r 53213cc152a1 -r 1f71ec773fc9 build.xml
--- a/build.xml Mon Apr 22 14:10:03 2013 -0700
+++ b/build.xml Mon Apr 22 14:13:47 2013 -0700
@@ -3,7 +3,7 @@
 
     DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 
- Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 1997-2013 Oracle and/or its affiliates. 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
@@ -44,6 +44,16 @@
 <!DOCTYPE project [
   <!ENTITY commonBuild SYSTEM "ant-common.xml">
 ]>
+
+<!--
+
+ NOTE: JavaMail is now built using Maven:
+ https://java.net/projects/javamail/pages/BuildInstructions
+
+ This ant build file is obsolete and may not work.
+
+-->
+
 <project name="JavaMail" default="all" basedir=".">
 
 <!-- ========== Initialize Properties =================================== -->
@@ -95,7 +105,8 @@
                source="${javac.source}"
                deprecation="${javac.deprecation}"
                failonerror="true"
- target="${javac.target}">
+ target="${javac.target}"
+ includeantruntime="false">
             <classpath>
                 <pathelement location="${activation.jar}"/>
             </classpath>
@@ -159,6 +170,15 @@
                 <filter token="mail.version" value="${release.version}"/>
             </filterset>
         </copy>
+ <mkdir dir="${component.classes.gimap.dir}/manifest"/>
+ <copy file="${resources.gimap.dir}/META-INF/MANIFEST.MF"
+ tofile="${component.classes.gimap.dir}/manifest/MANIFEST.MF">
+ <filterset begintoken="{" endtoken="}">
+ <filter token="mail.spec.version"
+ value="${release.specversion}"/>
+ <filter token="mail.version" value="${release.version}"/>
+ </filterset>
+ </copy>
     </target>
 
     <!--
@@ -179,6 +199,28 @@
     </target>
     -->
 
+ <!-- gimap compile -->
+ <target name="gimapcompile" depends="init"
+ description="Compile com/sun/mail/gimap sources">
+
+ <mkdir dir="${component.classes.gimap.dir}"/>
+ <javac srcdir="${src.gimap.dir}"
+ destdir="${component.classes.gimap.dir}"
+ debug="${javac.debug}"
+ optimize="${javac.optimize}"
+ source="${javac.source}"
+ deprecation="${javac.deprecation}"
+ failonerror="true"
+ target="${javac.target}"
+ includeantruntime="false">
+ <classpath>
+ <pathelement location="${component.classes.dir}"/>
+ <pathelement location="${activation.jar}"/>
+ </classpath>
+ <include name="com/sun/mail/gimap/**"/>
+ </javac>
+ </target>
+
     <!-- dsn compile -->
     <target name="dsncompile" depends="init"
             description="Compile com/sun/mail/dsn sources">
@@ -191,7 +233,8 @@
                source="${javac.source}"
                deprecation="${javac.deprecation}"
                failonerror="true"
- target="${javac.target}">
+ target="${javac.target}"
+ includeantruntime="false">
             <classpath>
                 <pathelement location="${component.classes.dir}"/>
                 <pathelement location="${activation.jar}"/>
@@ -212,7 +255,8 @@
                source="${javac.source}"
                deprecation="${javac.deprecation}"
                failonerror="true"
- target="${javac.target}">
+ target="${javac.target}"
+ includeantruntime="false">
             <classpath>
                 <pathelement location="${component.classes.dir}"/>
                 <pathelement location="${activation.jar}"/>
@@ -228,7 +272,8 @@
                source="${javac.source}"
                deprecation="${javac.deprecation}"
                failonerror="true"
- target="${javac.target}">
+ target="${javac.target}"
+ includeantruntime="false">
             <classpath>
                 <pathelement location="${component.classes.dir}"/>
                 <pathelement location="${activation.jar}"/>
@@ -244,7 +289,8 @@
                source="${javac.source}"
                deprecation="${javac.deprecation}"
                failonerror="true"
- target="${javac.target}">
+ target="${javac.target}"
+ includeantruntime="false">
             <classpath>
                 <pathelement location="${component.classes.dir}"/>
                 <pathelement location="${activation.jar}"/>
@@ -261,7 +307,8 @@
                source="${javac.source}"
                deprecation="${javac.deprecation}"
                failonerror="true"
- target="${javac.target}">
+ target="${javac.target}"
+ includeantruntime="false">
             <classpath>
                 <pathelement location="${component.classes.dir}"/>
                 <pathelement location="${component.classes.demo.dir}"/>
@@ -281,6 +328,7 @@
         <delete includeEmptyDirs="true" failonerror="false">
             <fileset dir="${component.classes.dir}"/>
             <fileset dir="${component.classes.dsn.dir}"/>
+ <fileset dir="${component.classes.gimap.dir}"/>
             <fileset dir="${component.classes.demo.dir}"/>
             <fileset dir="${component.classes.client.dir}"/>
             <fileset dir="${component.classes.servlet.dir}"/>
@@ -326,7 +374,7 @@
 
     <!-- Build all jars needed for release -->
     <target name="jars"
- depends="jar, mailapijar, pop3jar, imapjar, smtpjar, dsnjar"/>
+ depends="jar, mailapijar, pop3jar, imapjar, smtpjar, gimapjar, dsnjar"/>
 
     <!-- Assemble mail.jar -->
     <target name="jar" depends="init, compile, cook-manifest">
@@ -398,6 +446,20 @@
         </jar>
      </target>
 
+ <target name="gimapjar" depends="init, gimapcompile, cook-manifest">
+ <mkdir dir="${release.dir}/lib"/>
+ <jar jarfile="${release.gimap.jar}"
+ manifest="${component.classes.gimap.dir}/manifest/MANIFEST.MF">
+ <metainf dir="${resources.legal.dir}/META-INF"
+ includes="LICENSE.txt"/>
+ <metainf dir="${resources.gimap.dir}/META-INF"
+ includes="mailcap"/>
+ <fileset dir="${component.classes.gimap.dir}">
+ <include name="com/sun/mail/gimap/*.class"/>
+ </fileset>
+ </jar>
+ </target>
+
      <target name="dsnjar" depends="init, dsncompile, cook-manifest">
         <mkdir dir="${release.dir}/lib"/>
         <jar jarfile="${release.dsn.jar}"
@@ -436,8 +498,6 @@
         <mkdir dir="${release.docs.dir}"/>
         <copy todir="${release.docs.dir}">
             <fileset dir="${basedir}/doc/spec" includes="*.txt" />
- <fileset dir="${spec.dir}"
- includes="JavaMail-1.4.pdf,Providers.pdf" />
         </copy>
         <!--
             To allow us to generate javadocs that only include some
@@ -471,7 +531,9 @@
                     com/sun/mail/smtp/SMTPSenderFailedException.java,
                     com/sun/mail/smtp/SMTPTransport.java,
                     com/sun/mail/smtp/SMTPSSLTransport.java,
+ com/sun/mail/util/MailConnectException.java,
                     com/sun/mail/util/MailSSLSocketFactory.java,
+ com/sun/mail/util/ReadableMime.java,
                     com/sun/mail/util/logging/MailHandler.java
                 "/>
             <fileset dir="${src.dsn.dir}"
@@ -483,6 +545,17 @@
                     com/sun/mail/dsn/MultipartReport.java,
                     com/sun/mail/dsn/Report.java
                 "/>
+ <fileset dir="${src.dsn.dir}"
+ includes="
+ com/sun/mail/gimap/package.html,
+ com/sun/mail/gimap/GmailStore.java,
+ com/sun/mail/gimap/GmailSSLStore.java,
+ com/sun/mail/gimap/GmailFolder.java,
+ com/sun/mail/gimap/GmailMessage.java,
+ com/sun/mail/gimap/GmailMsgIdTerm.java,
+ com/sun/mail/gimap/GmailThrIdTerm.java,
+ com/sun/mail/gimap/GmailRawSearchTerm.java
+ "/>
         </copy>
         <mkdir dir="${release.javadocs.dir}"/>
         <javadoc packagenames="javax.mail, javax.mail.internet,
@@ -491,11 +564,12 @@
                                com.sun.mail.imap,
                                com.sun.mail.pop3,
                                com.sun.mail.smtp,
+ com.sun.mail.gimap,
                                com.sun.mail.util, com.sun.mail.util.logging,
                                com.sun.mail.dsn"
             destdir="${release.javadocs.dir}"
             sourcepath="${release.dir}/javadoc"
- classpath="${activation.jar}:${release.mail.jar}:${release.dsn.jar}"
+ classpath="${activation.jar}:${release.mail.jar}:${release.dsn.jar}:${release.gimap.jar}"
             author="false"
             version="false"
             use="true"
@@ -504,6 +578,16 @@
             doctitle="JavaMail API documentation">
             <group title="JavaMail API Packages" packages="javax.*"/>
             <group title="Sun-specific Packages" packages="com.sun.*"/>
+ <bottom>
+<![CDATA[Copyright &#169; 1996-2013,
+ <a href="http://www.oracle.com">Oracle</a>
+ and/or its affiliates. All Rights Reserved.
+ Use is subject to
+ <a href="{_at_docRoot}/doc-files/speclicense.html" target="_top">license terms<
+ /a>.
+]]>
+
+ </bottom>
             <!-- following can really slow down javadoc generation
             <link href="${javase.url}"/>
             <link href="${jaf.url}"/>


diff -r 1f71ec773fc9 -r 9cf24a84128a mail/src/main/java/com/sun/mail/util/logging/MailHandler.java
--- a/mail/src/main/java/com/sun/mail/util/logging/MailHandler.java Mon Apr 22 14:13:47 2013 -0700
+++ b/mail/src/main/java/com/sun/mail/util/logging/MailHandler.java Fri Apr 26 13:57:22 2013 -0700
@@ -205,7 +205,7 @@
  * recipients that provide support for the application, system, and/or
  * supporting infrastructure. The empty string can be used to specify no
  * send-to address which overrides the default behavior. (defaults to
- * {_at_linkplain javax.mail.internet.InternetAddress.getLocalAddress
+ * {_at_linkplain javax.mail.internet.InternetAddress#getLocalAddress
  * local address}.)
  *
  * <li>&lt;handler-name&gt;.mail.sender a single address


diff -r 9cf24a84128a -r 5d42fe9b3c96 doc/release/CHANGES.txt
--- a/doc/release/CHANGES.txt Fri Apr 26 13:57:22 2013 -0700
+++ b/doc/release/CHANGES.txt Fri Apr 26 13:58:16 2013 -0700
@@ -35,8 +35,6 @@
 K 5770 make MimeMultipart fields protected to allow subclassing
 K 5818 need simple way to override MIME type and encoding of attachment
 K 5819 enable RFC 2231 support by default
-K 5829 NullPointerException when accessing the content of a message attachment
-K 5830 IMAPProtocol.sasllogin uses old constructor for IMAPSaslAuthenticator
 K 5847 Exception when parsing bad address with unclosed quote in mail header
 K 5861 when failing to connect to a server, provide more detail in exception
 


diff -r 5d42fe9b3c96 -r 632ef5266f2c gimap/src/main/java/com/sun/mail/gimap/package.html
--- a/gimap/src/main/java/com/sun/mail/gimap/package.html Fri Apr 26 13:58:16 2013 -0700
+++ b/gimap/src/main/java/com/sun/mail/gimap/package.html Fri Apr 26 13:59:45 2013 -0700
@@ -46,12 +46,13 @@
 </HEAD>
 <BODY BGCOLOR="white">
 
-An EXPERIMENTAL IMAP protocol provider that supports the Gmail-specific
-protocol extensions.
+An EXPERIMENTAL IMAP protocol provider that supports the
+<A HREF="https://developers.google.com/google-apps/gmail/imap_extensions"
+TARGET="_top">
+Gmail-specific IMAP protocol extensions
+</A>.
 This provider supports all the features of the IMAP provider, plus
 additional Gmail-specific features.
-The Gmail-specific IMAP protocol extensions are described
-<A HREF="https://developers.google.com/google-apps/gmail/imap_extensions">here</A>.
 This provider can be used by including gimap.jar in your CLASSPATH
 along with mail.jar, and by using the "gimap" protocol instead of
 the "imap" protocol.


diff -r 632ef5266f2c -r 0cb62429801c mail/src/main/java/javax/mail/search/ReceivedDateTerm.java
--- a/mail/src/main/java/javax/mail/search/ReceivedDateTerm.java Fri Apr 26 13:59:45 2013 -0700
+++ b/mail/src/main/java/javax/mail/search/ReceivedDateTerm.java Fri Apr 26 14:10:59 2013 -0700
@@ -1,7 +1,7 @@
 /*
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
  *
- * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997-2013 Oracle and/or its affiliates. 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
@@ -67,7 +67,7 @@
      * The match method.
      *
      * @param msg the date comparator is applied to this Message's
- * sent date
+ * received date
      * @return true if the comparison succeeds, otherwise false
      */
     public boolean match(Message msg) {


diff -r 0cb62429801c -r 031191c915c4 mail/src/main/java/com/sun/mail/imap/IMAPStore.java
--- a/mail/src/main/java/com/sun/mail/imap/IMAPStore.java Fri Apr 26 14:10:59 2013 -0700
+++ b/mail/src/main/java/com/sun/mail/imap/IMAPStore.java Tue May 07 13:16:27 2013 -0700
@@ -904,6 +904,32 @@
                     }
                 }
 
+ // if proxyAuthUser has changed, switch to new user
+ if (proxyAuthUser != null &&
+ !proxyAuthUser.equals(p.getProxyAuthUser())) {
+ try {
+ /*
+ * Swap in a special response handler that will handle
+ * alerts, but won't cause the store to be closed and
+ * cleaned up if the connection is dead.
+ */
+ p.removeResponseHandler(this);
+ p.addResponseHandler(nonStoreResponseHandler);
+ p.proxyauth(proxyAuthUser);
+ p.removeResponseHandler(nonStoreResponseHandler);
+ p.addResponseHandler(this);
+ } catch (ProtocolException pex) {
+ try {
+ p.removeResponseHandler(nonStoreResponseHandler);
+ p.disconnect();
+ } finally {
+ // don't let any exception stop us
+ p = null;
+ continue; // try again, from the top
+ }
+ }
+ }
+
                 // remove the store as a response handler.
                 p.removeResponseHandler(this);
             }
@@ -983,6 +1009,11 @@
                         "connection available -- size: " +
                         pool.authenticatedConnections.size());
                 p = (IMAPProtocol)pool.authenticatedConnections.firstElement();
+
+ // if proxyAuthUser has changed, switch to new user
+ if (proxyAuthUser != null &&
+ !proxyAuthUser.equals(p.getProxyAuthUser()))
+ p.proxyauth(proxyAuthUser);
             }
  
             if (pool.storeConnectionInUse) {
@@ -1320,6 +1351,29 @@
     }
 
     /**
+ * Set the user name to be used with the PROXYAUTH command.
+ * The PROXYAUTH user name can also be set using the
+ * <code>mail.imap.proxyauth.user<code> property when this
+ * Store is created.
+ *
+ * @param user the user name to set
+ * @since JavaMail 1.5.1
+ */
+ public void setProxyAuthUser(String user) {
+ proxyAuthUser = user;
+ }
+
+ /**
+ * Get the user name to be used with the PROXYAUTH command.
+ *
+ * @return the user name
+ * @since JavaMail 1.5.1
+ */
+ public String getProxyAuthUser() {
+ return proxyAuthUser;
+ }
+
+ /**
      * Check whether this store is connected. Override superclass
      * method, to actually ping our server connection.
      */
@@ -1408,7 +1462,7 @@
              * connection, regardless of what happens ..
              *
              * Also note that protocol.logout() results in a BYE
- * response (As per rfc 2060, BYE is a *required* response
+ * response (As per RFC 3501, BYE is a *required* response
              * to LOGOUT). In fact, even if protocol.logout() fails
              * with an IOException (if the server connection is dead),
              * iap.Protocol.command() converts that exception into a


diff -r 031191c915c4 -r 295a06934ad2 doc/release/CHANGES.txt
--- a/doc/release/CHANGES.txt Tue May 07 13:16:27 2013 -0700
+++ b/doc/release/CHANGES.txt Tue May 07 15:19:55 2013 -0700
@@ -14,6 +14,14 @@
         https://kenai.com/bugzilla/
 
 
+ CHANGES IN THE 1.5.1 RELEASE
+ ----------------------------
+The following bugs have been fixed in the 1.5.1 release.
+
+K 5924 IMAP provider should support the QRESYNC extension (RFC 5162)
+K 5925 IMAP provider should support the WITHIN search extension (RFC 5032)
+
+
                   CHANGES IN THE 1.5.0 RELEASE
                   ----------------------------
 The following bugs have been fixed in the 1.5.0 release.

diff -r 031191c915c4 -r 295a06934ad2 javadoc/pom.xml
--- a/javadoc/pom.xml Tue May 07 13:16:27 2013 -0700
+++ b/javadoc/pom.xml Tue May 07 15:19:55 2013 -0700
@@ -90,6 +90,10 @@
                         com/sun/mail/imap/Rights.java,
                         com/sun/mail/imap/Quota.java,
                         com/sun/mail/imap/SortTerm.java,
+ com/sun/mail/imap/ResyncData.java,
+ com/sun/mail/imap/OlderTerm.java,
+ com/sun/mail/imap/YoungerTerm.java,
+ com/sun/mail/imap/MessageVanishedEvent.java,
                         com/sun/mail/pop3/POP3Store.java,
                         com/sun/mail/pop3/POP3SSLStore.java,
                         com/sun/mail/pop3/POP3Folder.java,

diff -r 031191c915c4 -r 295a06934ad2 mail/src/main/java/com/sun/mail/iap/Argument.java
--- a/mail/src/main/java/com/sun/mail/iap/Argument.java Tue May 07 13:16:27 2013 -0700
+++ b/mail/src/main/java/com/sun/mail/iap/Argument.java Tue May 07 15:19:55 2013 -0700
@@ -1,7 +1,7 @@
 /*
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
  *
- * Copyright (c) 1997-2011 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997-2013 Oracle and/or its affiliates. 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
@@ -40,33 +40,34 @@
 
 package com.sun.mail.iap;
 
-import java.util.Vector;
+import java.util.List;
+import java.util.ArrayList;
 import java.io.*;
 import com.sun.mail.util.*;
 
 /**
  * @author John Mani
+ * @author Bill Shannon
  */
 
 public class Argument {
- protected Vector items;
+ protected List items;
 
     /**
      * Constructor
      */
     public Argument() {
- items = new Vector(1);
+ items = new ArrayList(1);
     }
 
     /**
- * append the given Argument to this Argument. All items
+ * Append the given Argument to this Argument. All items
      * from the source argument are copied into this destination
      * argument.
      */
- public void append(Argument arg) {
- items.ensureCapacity(items.size() + arg.items.size());
- for (int i=0; i < arg.items.size(); i++)
- items.addElement(arg.items.elementAt(i));
+ public Argument append(Argument arg) {
+ items.addAll(arg.items);
+ return this;
     }
 
     /**
@@ -78,44 +79,49 @@
      *
      * @param s String to write out
      */
- public void writeString(String s) {
- items.addElement(new AString(ASCIIUtility.getBytes(s)));
+ public Argument writeString(String s) {
+ items.add(new AString(ASCIIUtility.getBytes(s)));
+ return this;
     }
 
     /**
      * Convert the given string into bytes in the specified
      * charset, and write the bytes out as an ASTRING
      */
- public void writeString(String s, String charset)
+ public Argument writeString(String s, String charset)
                 throws UnsupportedEncodingException {
         if (charset == null) // convenience
             writeString(s);
         else
- items.addElement(new AString(s.getBytes(charset)));
+ items.add(new AString(s.getBytes(charset)));
+ return this;
     }
 
     /**
      * Write out given byte[] as a Literal.
      * @param b byte[] to write out
      */
- public void writeBytes(byte[] b) {
- items.addElement(b);
+ public Argument writeBytes(byte[] b) {
+ items.add(b);
+ return this;
     }
 
     /**
      * Write out given ByteArrayOutputStream as a Literal.
      * @param b ByteArrayOutputStream to be written out.
      */
- public void writeBytes(ByteArrayOutputStream b) {
- items.addElement(b);
+ public Argument writeBytes(ByteArrayOutputStream b) {
+ items.add(b);
+ return this;
     }
 
     /**
      * Write out given data as a literal.
      * @param b Literal representing data to be written out.
      */
- public void writeBytes(Literal b) {
- items.addElement(b);
+ public Argument writeBytes(Literal b) {
+ items.add(b);
+ return this;
     }
 
     /**
@@ -124,31 +130,35 @@
      * in the string.
      * @param s String
      */
- public void writeAtom(String s) {
- items.addElement(new Atom(s));
+ public Argument writeAtom(String s) {
+ items.add(new Atom(s));
+ return this;
     }
 
     /**
      * Write out number.
      * @param i number
      */
- public void writeNumber(int i) {
- items.addElement(new Integer(i));
+ public Argument writeNumber(int i) {
+ items.add(new Integer(i));
+ return this;
     }
 
     /**
      * Write out number.
      * @param i number
      */
- public void writeNumber(long i) {
- items.addElement(new Long(i));
+ public Argument writeNumber(long i) {
+ items.add(new Long(i));
+ return this;
     }
 
     /**
      * Write out as parenthesised list.
      */
- public void writeArgument(Argument c) {
- items.addElement(c);
+ public Argument writeArgument(Argument c) {
+ items.add(c);
+ return this;
     }
 
     /*
@@ -163,7 +173,7 @@
             if (i > 0) // write delimiter if not the first item
                 os.write(' ');
 
- Object o = items.elementAt(i);
+ Object o = items.get(i);
             if (o instanceof Atom) {
                 os.writeBytes(((Atom)o).string);
             } else if (o instanceof Number) {

diff -r 031191c915c4 -r 295a06934ad2 mail/src/main/java/com/sun/mail/iap/Response.java
--- a/mail/src/main/java/com/sun/mail/iap/Response.java Tue May 07 13:16:27 2013 -0700
+++ b/mail/src/main/java/com/sun/mail/iap/Response.java Tue May 07 15:19:55 2013 -0700
@@ -216,13 +216,13 @@
 
         /*
          * An ATOM is any CHAR delimited by :
- * SPACE | CTL | '(' | ')' | '{' | '%' | '*' | '"' | '\'
+ * SPACE | CTL | '(' | ')' | '{' | '%' | '*' | '"' | '\' | ']'
          */
         byte b;
         int start = index;
         while (index < size && ((b = buffer[index]) > ' ') &&
                b != '(' && b != ')' && b != '%' && b != '*' &&
- b != '"' && b != '\\' && b != 0x7f &&
+ b != '"' && b != '\\' && b != ']' && b != 0x7f &&
                (delim == '\0' || b != delim))
             index++;
 

diff -r 031191c915c4 -r 295a06934ad2 mail/src/main/java/com/sun/mail/imap/IMAPFolder.java
--- a/mail/src/main/java/com/sun/mail/imap/IMAPFolder.java Tue May 07 13:16:27 2013 -0700
+++ b/mail/src/main/java/com/sun/mail/imap/IMAPFolder.java Tue May 07 15:19:55 2013 -0700
@@ -1,7 +1,7 @@
 /*
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
  *
- * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997-2013 Oracle and/or its affiliates. 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
@@ -43,6 +43,8 @@
 import java.util.Date;
 import java.util.Vector;
 import java.util.Hashtable;
+import java.util.List;
+import java.util.ArrayList;
 import java.util.NoSuchElementException;
 import java.util.logging.Level;
 import java.io.*;
@@ -64,7 +66,9 @@
  *
  * Applications that need to make use of IMAP-specific features may cast
  * a <code>Folder</code> object to an <code>IMAPFolder</code> object and
- * use the methods on this class. The {_at_link #getQuota getQuota} and
+ * use the methods on this class. <p>
+ *
+ * The {_at_link #getQuota getQuota} and
  * {_at_link #setQuota setQuota} methods support the IMAP QUOTA extension.
  * Refer to <A HREF="http://www.ietf.org/rfc/rfc2087.txt">RFC 2087</A>
  * for more information. <p>
@@ -81,6 +85,13 @@
  * Refer to <A HREF="http://www.ietf.org/rfc/rfc5256.txt">RFC 5256</A>
  * for more information. <p>
  *
+ * The {_at_link #open(int,com.sun.mail.imap.ResyncData) open(int,ResyncData)}
+ * method and {_at_link com.sun.mail.imap.ResyncData ResyncData} class supports
+ * the IMAP CONDSTORE and QRESYNC extensions.
+ * Refer to <A HREF="http://www.ietf.org/rfc/rfc4551.txt">RFC 4551</A>
+ * and <A HREF="http://www.ietf.org/rfc/rfc5162.txt">RFC 5162</A>
+ * for more information. <p>
+ *
  * The {_at_link #doCommand doCommand} method and
  * {_at_link IMAPFolder.ProtocolCommand IMAPFolder.ProtocolCommand}
  * interface support use of arbitrary IMAP protocol commands. <p>
@@ -119,7 +130,7 @@
  *
  * The most important thing to note here is that the server can send
  * unsolicited EXPUNGE notifications as part of the responses for "most"
- * commands. Refer RFC2060, sections 5.3 & 5.5 for gory details. Also,
+ * commands. Refer RFC 3501, sections 5.3 & 5.5 for gory details. Also,
  * the server sends these notifications AFTER the message has been
  * expunged. And once a message is expunged, the sequence-numbers of
  * those messages after the expunged one are renumbered. This essentially
@@ -260,6 +271,7 @@
                                             // the server
     private long uidvalidity = -1; // UIDValidity
     private long uidnext = -1; // UIDNext
+ private long highestmodseq = -1; // HIGHESTMODSEQ: RFC 4551 - CONDSTORE
     private boolean doExpungeNotification = true; // used in expunge handler
 
     private Status cachedStatus = null;
@@ -903,12 +915,28 @@
      * Open this folder in the given mode.
      */
     public synchronized void open(int mode) throws MessagingException {
+ open(mode, null);
+ }
+
+ /**
+ * Open this folder in the given mode, with the given
+ * resynchronization data.
+ *
+ * @param mode the open mode (Folder.READ_WRITE or Folder.READ_ONLY)
+ * @param rd the ResyncData instance
+ * @return a List of MailEvent instances, or null if none
+ * @exception MessagingException if the open fails
+ * @since JavaMail 1.5.1
+ */
+ public synchronized List<MailEvent> open(int mode, ResyncData rd)
+ throws MessagingException {
         checkClosed(); // insure that we are not already open
         
         MailboxInfo mi = null;
         // Request store for our own protocol connection.
         protocol = ((IMAPStore)store).getProtocol(this);
 
+ List<MailEvent> openEvents = null;
         synchronized(messageCacheLock) { // Acquire messageCacheLock
 
             /*
@@ -920,10 +948,31 @@
             protocol.addResponseHandler(this);
 
             try {
+ /*
+ * Enable QRESYNC or CONDSTORE if needed and not enabled.
+ * QRESYNC implies CONDSTORE, but servers that support
+ * QRESYNC are not required to support just CONDSTORE
+ * per RFC 5162.
+ */
+ if (rd != null) {
+ if (rd == ResyncData.CONDSTORE) {
+ if (!protocol.isEnabled("CONDSTORE") &&
+ !protocol.isEnabled("QRESYNC")) {
+ if (protocol.hasCapability("CONDSTORE"))
+ protocol.enable("CONDSTORE");
+ else
+ protocol.enable("QRESYNC");
+ }
+ } else {
+ if (!protocol.isEnabled("QRESYNC"))
+ protocol.enable("QRESYNC");
+ }
+ }
+
                 if (mode == READ_ONLY)
- mi = protocol.examine(fullName);
+ mi = protocol.examine(fullName, rd);
                 else
- mi = protocol.select(fullName);
+ mi = protocol.select(fullName, rd);
             } catch (CommandFailedException cex) {
                 /*
                  * Handle SELECT or EXAMINE failure.
@@ -997,10 +1046,35 @@
             recent = mi.recent;
             uidvalidity = mi.uidvalidity;
             uidnext = mi.uidnext;
+ highestmodseq = mi.highestmodseq;
 
             // Create the message cache of appropriate size
             messageCache = new MessageCache(this, (IMAPStore)store, total);
 
+ // process saved responses and return corresponding events
+ if (mi.responses != null) {
+ openEvents = new ArrayList<MailEvent>();
+ for (IMAPResponse ir : mi.responses) {
+ if (ir.keyEquals("VANISHED")) {
+ // "VANISHED" SP ["(EARLIER)"] SP known-uids
+ String[] s = ir.readAtomStringList();
+ // XXX - check that it really is "EARLIER"?
+ String uids = ir.readAtom();
+ UIDSet[] uidset = UIDSet.parseUIDSets(uids);
+ long[] luid = UIDSet.toArray(uidset, uidnext);
+ if (luid != null && luid.length > 0)
+ openEvents.add(
+ new MessageVanishedEvent(this, luid));
+ } else if (ir.keyEquals("FETCH")) {
+ assert ir instanceof FetchResponse :
+ "!ir instanceof FetchResponse";
+ Message msg = processFetchResponse((FetchResponse)ir);
+ if (msg != null)
+ openEvents.add(new MessageChangedEvent(this,
+ MessageChangedEvent.FLAGS_CHANGED, msg));
+ }
+ }
+ }
         } // Release lock
 
         exists = true; // if we opened it, it must exist
@@ -1009,6 +1083,8 @@
 
         // notify listeners
         notifyConnectionListeners(ConnectionEvent.OPENED);
+
+ return openEvents;
     }
 
     /**
@@ -1833,7 +1909,7 @@
                     /* remove this message from the UIDTable */
                     long uid = m.getUID();
                     if (uid != -1)
- uidTable.remove(new Long(uid));
+ uidTable.remove(Long.valueOf(uid));
                 }
             }
 
@@ -2086,7 +2162,7 @@
 
         try {
             synchronized(messageCacheLock) {
- Long l = new Long(uid);
+ Long l = Long.valueOf(uid);
 
                 if (uidTable != null) {
                     // Check in uidTable
@@ -2142,7 +2218,7 @@
                     m = getMessageBySeqNumber(ua[i].seqnum);
                     m.setUID(ua[i].uid);
                     msgs[i] = m;
- uidTable.put(new Long(ua[i].uid), m);
+ uidTable.put(Long.valueOf(ua[i].uid), m);
                 }
             }
         } catch(ConnectionException cex) {
@@ -2172,7 +2248,7 @@
                     Vector v = new Vector(); // to collect unavailable UIDs
                     Long l;
                     for (int i = 0; i < uids.length; i++) {
- if (!uidTable.containsKey(l = new Long(uids[i])))
+ if (!uidTable.containsKey(l = Long.valueOf(uids[i])))
                             // This UID has not been loaded yet.
                             v.addElement(l);
                     }
@@ -2191,14 +2267,14 @@
                     for (int i = 0; i < ua.length; i++) {
                         m = getMessageBySeqNumber(ua[i].seqnum);
                         m.setUID(ua[i].uid);
- uidTable.put(new Long(ua[i].uid), m);
+ uidTable.put(Long.valueOf(ua[i].uid), m);
                     }
                 }
 
                 // Return array of size = uids.length
                 Message[] msgs = new Message[uids.length];
                 for (int i = 0; i < uids.length; i++)
- msgs[i] = (Message)uidTable.get(new Long(uids[i]));
+ msgs[i] = (Message)uidTable.get(Long.valueOf(uids[i]));
                 return msgs;
             }
         } catch(ConnectionException cex) {
@@ -2238,7 +2314,7 @@
                     // insert this message into uidTable
                     if (uidTable == null)
                         uidTable = new Hashtable();
- uidTable.put(new Long(uid), m);
+ uidTable.put(Long.valueOf(uid), m);
                 }
             } catch (ConnectionException cex) {
                 throw new FolderClosedException(this, cex.getMessage());
@@ -2251,6 +2327,60 @@
     }
 
     /**
+ * Get or create Message objects for the UIDs.
+ */
+ private Message[] createMessagesForUIDs(long[] uids) {
+ IMAPMessage[] msgs = new IMAPMessage[uids.length];
+ for (int i = 0; i < uids.length; i++) {
+ IMAPMessage m = null;
+ if (uidTable != null)
+ m = (IMAPMessage)uidTable.get(Long.valueOf(uids[i]));
+ if (m == null) {
+ // fake it, we don't know what message this really is
+ m = newIMAPMessage(-1); // no sequence number
+ m.setUID(uids[i]);
+ m.setExpunged(true);
+ }
+ msgs[i++] = m;
+ }
+ return msgs;
+ }
+
+ /**
+ * Returns the HIGHESTMODSEQ for this folder.
+ *
+ * @see "RFC 4551"
+ * @since JavaMail 1.5.1
+ */
+ public synchronized long getHighestModSeq() throws MessagingException {
+ if (opened) // we already have this information
+ return highestmodseq;
+
+ IMAPProtocol p = null;
+ Status status = null;
+
+ try {
+ p = getStoreProtocol(); // XXX
+ if (!p.hasCapability("CONDSTORE"))
+ throw new BadCommandException("CONDSTORE not supported");
+ String[] item = { "HIGHESTMODSEQ" };
+ status = p.status(fullName, item);
+ } catch (BadCommandException bex) {
+ // Probably a RFC1730 server
+ throw new MessagingException("Cannot obtain HIGHESTMODSEQ", bex);
+ } catch (ConnectionException cex) {
+ // Oops, the store or folder died on us.
+ throwClosedException(cex);
+ } catch (ProtocolException pex) {
+ throw new MessagingException(pex.getMessage(), pex);
+ } finally {
+ releaseStoreProtocol(p);
+ }
+
+ return status.highestmodseq;
+ }
+
+ /**
      * Get the quotas for the quotaroot associated with this
      * folder. Note that many folders may have the same quotaroot.
      * Quotas are controlled on the basis of a quotaroot, not
@@ -2677,22 +2807,35 @@
             if (msgs != null) // Do the notification here.
                 notifyMessageRemovedListeners(false, msgs);
 
+ } else if (ir.keyEquals("VANISHED")) {
+ // after the folder is opened with QRESYNC, a VANISHED response
+ // without the (EARLIER) tag is used instead of the EXPUNGE
+ // response
+
+ // "VANISHED" SP ["(EARLIER)"] SP known-uids
+ String[] s = ir.readAtomStringList();
+ if (s == null) { // no (EARLIER)
+ String uids = ir.readAtom();
+ UIDSet[] uidset = UIDSet.parseUIDSets(uids);
+ // assume no duplicates and no UIDs out of range
+ realTotal -= UIDSet.size(uidset);
+ long[] luid = UIDSet.toArray(uidset);
+ Message[] msgs = createMessagesForUIDs(luid);
+ for (Message m : msgs) {
+ if (m.getMessageNumber() > 0)
+ messageCache.expungeMessage(m.getMessageNumber());
+ }
+ if (doExpungeNotification && hasMessageCountListener) {
+ notifyMessageRemovedListeners(true, msgs);
+ }
+ } // else if (EARLIER), ignore
+
         } else if (ir.keyEquals("FETCH")) {
- // The only unsolicited FETCH response that makes sense
- // to me (for now) is FLAGS updates. Ignore any other junk.
             assert ir instanceof FetchResponse : "!ir instanceof FetchResponse";
- FetchResponse f = (FetchResponse)ir;
- // Get FLAGS response, if present
- Flags flags = (Flags)f.getItem(Flags.class);
-
- if (flags != null) {
- IMAPMessage msg = getMessageBySeqNumber(f.getNumber());
- if (msg != null) { // should always be true
- msg._setFlags(flags);
- notifyMessageChangedListeners(
- MessageChangedEvent.FLAGS_CHANGED, msg);
- }
- }
+ Message msg = processFetchResponse((FetchResponse)ir);
+ if (msg != null)
+ notifyMessageChangedListeners(
+ MessageChangedEvent.FLAGS_CHANGED, msg);
 
         } else if (ir.keyEquals("RECENT")) {
             // update 'recent'
@@ -2701,6 +2844,51 @@
     }
 
     /**
+ * Process a FETCH response.
+ * The only unsolicited FETCH response that makes sense
+ * to me (for now) is FLAGS updates, which might include
+ * UID and MODSEQ information. Ignore any other junk.
+ */
+ private Message processFetchResponse(FetchResponse fr) {
+ IMAPMessage msg = getMessageBySeqNumber(fr.getNumber());
+ if (msg != null) { // should always be true
+ boolean notify = false;
+
+ UID uid = fr.getItem(UID.class);
+ if (uid != null && msg.getUID() != uid.uid) {
+ msg.setUID(uid.uid);
+ if (uidTable == null)
+ uidTable = new Hashtable();
+ uidTable.put(Long.valueOf(uid.uid), msg);
+ notify = true;
+ }
+
+ MODSEQ modseq = fr.getItem(MODSEQ.class);
+ if (modseq != null && msg._getModSeq() != modseq.modseq) {
+ msg.setModSeq(modseq.modseq);
+ /*
+ * XXX - should we update the folder's HIGHESTMODSEQ or not?
+ *
+ if (modseq.modseq > highestmodseq)
+ highestmodseq = modseq.modseq;
+ */
+ notify = true;
+ }
+
+ // Get FLAGS response, if present
+ FLAGS flags = fr.getItem(FLAGS.class);
+ if (flags != null) {
+ msg._setFlags(flags); // assume flags changed
+ notify = true;
+ }
+
+ if (!notify)
+ msg = null;
+ }
+ return msg;
+ }
+
+ /**
      * Handle the given array of Responses.
      *
      * ASSERT: This method must be called only when holding the

diff -r 031191c915c4 -r 295a06934ad2 mail/src/main/java/com/sun/mail/imap/IMAPMessage.java
--- a/mail/src/main/java/com/sun/mail/imap/IMAPMessage.java Tue May 07 13:16:27 2013 -0700
+++ b/mail/src/main/java/com/sun/mail/imap/IMAPMessage.java Tue May 07 15:19:55 2013 -0700
@@ -96,7 +96,10 @@
     private boolean peek; // use BODY.PEEK when fetching content?
 
     // this message's IMAP UID
- private long uid = -1;
+ private volatile long uid = -1;
+
+ // this message's IMAP MODSEQ - RFC 4551 CONDSTORE
+ private volatile long modseq = -1;
 
     // this message's IMAP sectionId (null for toplevel message,
     // non-null for a nested message)
@@ -194,6 +197,13 @@
         super.setMessageNumber(msgnum);
     }
 
+ /**
+ * Return the UID for this message.
+ * Returns -1 if not known; use UIDFolder.getUID() in this case.
+ *
+ * @return the UID
+ * @see javax.mail.UIDFolder#getUID
+ */
     protected long getUID() {
         return uid;
     }
@@ -202,6 +212,43 @@
         this.uid = uid;
     }
 
+ /**
+ * Return the modification sequence number (MODSEQ) for this message.
+ * Returns -1 if not known.
+ *
+ * @return the modification sequence number
+ * @see "RFC 4551"
+ * @since JavaMail 1.5.1
+ */
+ public synchronized long getModSeq() throws MessagingException {
+ if (modseq != -1)
+ return modseq;
+
+ synchronized (getMessageCacheLo
[truncated due to length]