Project: javamail
Repository: mercurial
Revision: 857
Author: shannon
Date: 2016-08-30 22:44:55 UTC
Link:
Log Message:
------------
Fix javac finally warnings - bug 7010
update copyright year; update CHANGES.txt - bug 7010
Eliminate @SuppressWarnings for rawtypes/unchecked warnings on public API - bug 7010
Update public API to use generics - bug 8415
(really was part of previous change)
update copyright dates from previous change
update COMPAT.txt
Fix MailDateFormat issues - bug 6949
MailDateFormat changes for version 1.6 - bug 6949
update copyright years
add @since
update minimum Android version to 19 because of Throwable.addSuppressed
MimeMessage.updateHeaders should set the Date header - bug 6074
First draft of JavaMail 1.6 API changes document for JCP MR.
Revisions:
----------
850
851
852
853
854
855
856
857
Modified Paths:
---------------
mail/pom.xml
mail/src/main/java/com/sun/mail/imap/IMAPFolder.java
mail/src/main/java/com/sun/mail/imap/IMAPStore.java
mail/src/main/java/com/sun/mail/pop3/POP3Folder.java
mail/src/main/java/com/sun/mail/pop3/POP3Store.java
mail/src/main/java/com/sun/mail/pop3/Protocol.java
mail/src/main/java/com/sun/mail/util/SocketFetcher.java
doc/release/CHANGES.txt
mail/src/main/java/com/sun/mail/imap/IMAPBodyPart.java
mail/src/main/java/com/sun/mail/imap/IMAPMessage.java
mail/src/main/java/com/sun/mail/pop3/POP3Message.java
mail/src/main/java/javax/mail/Multipart.java
mail/src/main/java/javax/mail/Part.java
mail/src/main/java/javax/mail/Service.java
mail/src/main/java/javax/mail/internet/InternetHeaders.java
mail/src/main/java/javax/mail/internet/MimeBodyPart.java
mail/src/main/java/javax/mail/internet/MimeMessage.java
mail/src/main/java/javax/mail/internet/MimePart.java
mail/src/main/java/javax/mail/internet/ParameterList.java
mail/src/main/java/javax/mail/internet/PreencodedMimeBodyPart.java
mail/src/test/java/javax/mail/internet/InternetHeadersTest.java
mail/src/test/java/javax/mail/internet/MimeMessageTest.java
mail/src/test/java/javax/mail/internet/ParameterListDecode.java
doc/release/COMPAT.txt
mail/src/main/java/javax/mail/internet/MailDateFormat.java
mail/src/test/java/javax/mail/internet/MailDateFormatTest.java
android/pom.xml
Added Paths:
------------
doc/spec/JavaMail-1.6-changes.txt
Diffs:
------
diff -r e1c884d868d1 -r 9c340f7715c3 mail/pom.xml
--- a/mail/pom.xml Wed Aug 24 16:55:06 2016 -0700
+++ b/mail/pom.xml Sat Apr 16 18:06:39 2016 +0200
@@ -144,7 +144,6 @@
<target>1.7</target>
<compilerArgs>
<arg>-Xlint</arg>
- <arg>-Xlint:-finally</arg>
<arg>-Xlint:-options</arg>
<arg>-Xlint:-path</arg>
<arg>-Werror</arg>
diff -r e1c884d868d1 -r 9c340f7715c3 mail/src/main/java/com/sun/mail/imap/IMAPFolder.java
--- a/mail/src/main/java/com/sun/mail/imap/IMAPFolder.java Wed Aug 24 16:55:06 2016 -0700
+++ b/mail/src/main/java/com/sun/mail/imap/IMAPFolder.java Sat Apr 16 18:06:39 2016 +0200
@@ -1056,12 +1056,9 @@
} catch (ProtocolException pex) {
// got a BAD or a BYE; connection may be bad, close it
try {
- protocol.logout();
- } catch (ProtocolException pex2) {
- // ignore
+ throw logoutAndThrow(pex.getMessage(), pex);
} finally {
releaseProtocol(false);
- throw new MessagingException(pex.getMessage(), pex);
}
}
@@ -1070,24 +1067,9 @@
((IMAPStore)store).allowReadOnlySelect()) {
; // all ok, allow it
} else { // otherwise, it's an error
- try {
- // close mailbox and return connection
- protocol.close();
- releaseProtocol(true);
- } catch (ProtocolException pex) {
- // something went wrong, close connection
- try {
- protocol.logout();
- } catch (ProtocolException pex2) {
- // ignore
- } finally {
- releaseProtocol(false);
- }
- } finally {
- throw new ReadOnlyFolderException(this,
- "Cannot open in desired mode");
- }
-
+ ReadOnlyFolderException ife = new ReadOnlyFolderException(
+ this, "Cannot open in desired mode");
+ throw cleanupAndThrow(ife);
}
}
@@ -1145,6 +1127,55 @@
return openEvents;
}
+ private MessagingException cleanupAndThrow(MessagingException ife) {
+ try {
+ try {
+ // close mailbox and return connection
+ protocol.close();
+ releaseProtocol(true);
+ } catch (ProtocolException pex) {
+ // something went wrong, close connection
+ try {
+ addSuppressed(ife, logoutAndThrow(pex.getMessage(), pex));
+ } finally {
+ releaseProtocol(false);
+ }
+ }
+ } catch (Throwable thr) {
+ addSuppressed(ife, thr);
+ }
+ return ife;
+ }
+
+ private MessagingException logoutAndThrow(String why, ProtocolException t) {
+ MessagingException ife = new MessagingException(why, t);
+ try {
+ protocol.logout();
+ } catch (Throwable thr) {
+ addSuppressed(ife, thr);
+ }
+ return ife;
+ }
+
+ private void addSuppressed(Throwable ife, Throwable thr) {
+ if (isRecoverable(thr)) {
+ ife.addSuppressed(thr);
+ } else {
+ thr.addSuppressed(ife);
+ if (thr instanceof Error) {
+ throw (Error) thr;
+ }
+ if (thr instanceof RuntimeException) {
+ throw (RuntimeException) thr;
+ }
+ throw new RuntimeException("unexpected exception", thr);
+ }
+ }
+
+ private boolean isRecoverable(Throwable t) {
+ return (t instanceof Exception) || (t instanceof LinkageError);
+ }
+
/**
* Prefetch attributes, based on the given FetchProfile.
*/
diff -r e1c884d868d1 -r 9c340f7715c3 mail/src/main/java/com/sun/mail/imap/IMAPStore.java
--- a/mail/src/main/java/com/sun/mail/imap/IMAPStore.java Wed Aug 24 16:55:06 2016 -0700
+++ b/mail/src/main/java/com/sun/mail/imap/IMAPStore.java Sat Apr 16 18:06:39 2016 +0200
@@ -1056,11 +1056,11 @@
try {
p.removeResponseHandler(nonStoreResponseHandler);
p.disconnect();
- } finally {
+ } catch (RuntimeException ignored) {
// don't let any exception stop us
- p = null;
- continue; // try again, from the top
}
+ p = null;
+ continue; // try again, from the top
}
}
@@ -1084,11 +1084,11 @@
try {
p.removeResponseHandler(nonStoreResponseHandler);
p.disconnect();
- } finally {
+ } catch (RuntimeException ignored) {
// don't let any exception stop us
- p = null;
- continue; // try again, from the top
}
+ p = null;
+ continue; // try again, from the top
}
}
diff -r e1c884d868d1 -r 9c340f7715c3 mail/src/main/java/com/sun/mail/pop3/POP3Folder.java
--- a/mail/src/main/java/com/sun/mail/pop3/POP3Folder.java Wed Aug 24 16:55:06 2016 -0700
+++ b/mail/src/main/java/com/sun/mail/pop3/POP3Folder.java Sat Apr 16 18:06:39 2016 +0200
@@ -308,9 +308,8 @@
close(false);
} catch (MessagingException mex) {
// ignore it
- } finally {
- return false;
}
+ return false;
}
return true;
}
diff -r e1c884d868d1 -r 9c340f7715c3 mail/src/main/java/com/sun/mail/pop3/POP3Store.java
--- a/mail/src/main/java/com/sun/mail/pop3/POP3Store.java Wed Aug 24 16:55:06 2016 -0700
+++ b/mail/src/main/java/com/sun/mail/pop3/POP3Store.java Sat Apr 16 18:06:39 2016 +0200
@@ -249,9 +249,8 @@
super.close(); // notifies listeners
} catch (MessagingException mex) {
// ignore it
- } finally {
- return false;
}
+ return false;
}
}
@@ -275,21 +274,13 @@
p.setCapabilities(p.capa());
} else if (requireStartTLS) {
logger.fine("STLS required but failed");
- try {
- p.quit();
- } catch (IOException ioex) {
- } finally {
- throw new EOFException("STLS required but failed");
- }
+ throw cleanupAndThrow(p,
+ new EOFException("STLS required but failed"));
}
} else if (requireStartTLS) {
logger.fine("STLS required but not supported");
- try {
- p.quit();
- } catch (IOException ioex) {
- } finally {
- throw new EOFException("STLS required but not supported");
- }
+ throw cleanupAndThrow(p,
+ new EOFException("STLS required but not supported"));
}
}
@@ -312,12 +303,7 @@
String msg = null;
if ((msg = p.login(user, passwd)) != null) {
- try {
- p.quit();
- } catch (IOException ioex) {
- } finally {
- throw new EOFException(msg);
- }
+ throw cleanupAndThrow(p, new EOFException(msg));
}
/*
@@ -337,6 +323,30 @@
return p;
}
+ private static IOException cleanupAndThrow(Protocol p, IOException ife) {
+ try {
+ p.quit();
+ } catch (Throwable thr) {
+ if (isRecoverable(thr)) {
+ ife.addSuppressed(thr);
+ } else {
+ thr.addSuppressed(ife);
+ if (thr instanceof Error) {
+ throw (Error) thr;
+ }
+ if (thr instanceof RuntimeException) {
+ throw (RuntimeException) thr;
+ }
+ throw new RuntimeException("unexpected exception", thr);
+ }
+ }
+ return ife;
+ }
+
+ private static boolean isRecoverable(Throwable t) {
+ return (t instanceof Exception) || (t instanceof LinkageError);
+ }
+
synchronized void closePort(POP3Folder owner) {
if (portOwner == owner) {
port = null;
diff -r e1c884d868d1 -r 9c340f7715c3 mail/src/main/java/com/sun/mail/pop3/Protocol.java
--- a/mail/src/main/java/com/sun/mail/pop3/Protocol.java Wed Aug 24 16:55:06 2016 -0700
+++ b/mail/src/main/java/com/sun/mail/pop3/Protocol.java Sat Apr 16 18:06:39 2016 +0200
@@ -113,19 +113,11 @@
initStreams();
r = simpleCommand(null);
} catch (IOException ioe) {
- try {
- socket.close();
- } finally {
- throw ioe;
- }
+ throw cleanupAndThrow(socket, ioe);
}
if (!r.ok) {
- try {
- socket.close();
- } finally {
- throw new IOException("Connect failed");
- }
+ throw cleanupAndThrow(socket, new IOException("Connect failed"));
}
if (enableAPOP && r.data != null) {
int challStart = r.data.indexOf('<'); // start of challenge
@@ -145,6 +137,30 @@
logger.config("PIPELINING enabled");
}
+ private static IOException cleanupAndThrow(Socket socket, IOException ife) {
+ try {
+ socket.close();
+ } catch (Throwable thr) {
+ if (isRecoverable(thr)) {
+ ife.addSuppressed(thr);
+ } else {
+ thr.addSuppressed(ife);
+ if (thr instanceof Error) {
+ throw (Error) thr;
+ }
+ if (thr instanceof RuntimeException) {
+ throw (RuntimeException) thr;
+ }
+ throw new RuntimeException("unexpected exception", thr);
+ }
+ }
+ return ife;
+ }
+
+ private static boolean isRecoverable(Throwable t) {
+ return (t instanceof Exception) || (t instanceof LinkageError);
+ }
+
/**
* Get the value of a boolean property.
* Print out the value if logging is enabled.
diff -r e1c884d868d1 -r 9c340f7715c3 mail/src/main/java/com/sun/mail/util/SocketFetcher.java
--- a/mail/src/main/java/com/sun/mail/util/SocketFetcher.java Wed Aug 24 16:55:06 2016 -0700
+++ b/mail/src/main/java/com/sun/mail/util/SocketFetcher.java Sat Apr 16 18:06:39 2016 +0200
@@ -607,15 +607,36 @@
if (sf instanceof MailSSLSocketFactory) {
MailSSLSocketFactory msf = (MailSSLSocketFactory)sf;
if (!msf.isServerTrusted(host, sslsocket)) {
- try {
- sslsocket.close();
- } finally {
- throw new IOException("Server is not trusted: " + host);
- }
+ throw cleanupAndThrow(sslsocket,
+ new IOException("Server is not trusted: " + host));
}
}
}
+ private static IOException cleanupAndThrow(Socket socket, IOException ife) {
+ try {
+ socket.close();
+ } catch (Throwable thr) {
+ if (isRecoverable(thr)) {
+ ife.addSuppressed(thr);
+ } else {
+ thr.addSuppressed(ife);
+ if (thr instanceof Error) {
+ throw (Error) thr;
+ }
+ if (thr instanceof RuntimeException) {
+ throw (RuntimeException) thr;
+ }
+ throw new RuntimeException("unexpected exception", thr);
+ }
+ }
+ return ife;
+ }
+
+ private static boolean isRecoverable(Throwable t) {
+ return (t instanceof Exception) || (t instanceof LinkageError);
+ }
+
/**
* Check the server from the Socket connection against the server name(s)
* as expressed in the server certificate (RFC 2595 check).
diff -r 9c340f7715c3 -r 1f6b2c17e291 doc/release/CHANGES.txt
--- a/doc/release/CHANGES.txt Sat Apr 16 18:06:39 2016 +0200
+++ b/doc/release/CHANGES.txt Tue Aug 30 12:14:07 2016 -0700
@@ -19,6 +19,7 @@
----------------------------
The following bugs have been fixed in the 1.5.6 release.
+K 7010 Fix javac warnings
K 8398 MailSessionDefinition should use the Repeatable annotation for Java EE 8
K 8399 IdleManager fails on Android
K 8403 Test fails: javax.mail.internet.GetLocalAddressTest
diff -r 9c340f7715c3 -r 1f6b2c17e291 mail/src/main/java/com/sun/mail/util/SocketFetcher.java
--- a/mail/src/main/java/com/sun/mail/util/SocketFetcher.java Sat Apr 16 18:06:39 2016 +0200
+++ b/mail/src/main/java/com/sun/mail/util/SocketFetcher.java Tue Aug 30 12:14:07 2016 -0700
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * Copyright (c) 1997-2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997-2016 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
diff -r 1f6b2c17e291 -r b3bc79e5f6c5 mail/src/main/java/com/sun/mail/imap/IMAPBodyPart.java
--- a/mail/src/main/java/com/sun/mail/imap/IMAPBodyPart.java Tue Aug 30 12:14:07 2016 -0700
+++ b/mail/src/main/java/com/sun/mail/imap/IMAPBodyPart.java Sat Apr 16 19:06:32 2016 +0200
@@ -243,7 +243,6 @@
try {
// Write out the header
- @SuppressWarnings("unchecked")
Enumeration<String> hdrLines
= super.getAllHeaderLines();
while (hdrLines.hasMoreElements())
@@ -336,20 +335,17 @@
throw new IllegalWriteException("IMAPBodyPart is read-only");
}
- @SuppressWarnings("unchecked")
public Enumeration<Header> getAllHeaders() throws MessagingException {
loadHeaders();
return super.getAllHeaders();
}
- @SuppressWarnings("unchecked")
public Enumeration<Header> getMatchingHeaders(String[] names)
throws MessagingException {
loadHeaders();
return super.getMatchingHeaders(names);
}
- @SuppressWarnings("unchecked")
public Enumeration<Header> getNonMatchingHeaders(String[] names)
throws MessagingException {
loadHeaders();
@@ -360,20 +356,17 @@
throw new IllegalWriteException("IMAPBodyPart is read-only");
}
- @SuppressWarnings("unchecked")
public Enumeration<String> getAllHeaderLines() throws MessagingException {
loadHeaders();
return super.getAllHeaderLines();
}
- @SuppressWarnings("unchecked")
public Enumeration<String> getMatchingHeaderLines(String[] names)
throws MessagingException {
loadHeaders();
return super.getMatchingHeaderLines(names);
}
- @SuppressWarnings("unchecked")
public Enumeration<String> getNonMatchingHeaderLines(String[] names)
throws MessagingException {
loadHeaders();
diff -r 1f6b2c17e291 -r b3bc79e5f6c5 mail/src/main/java/com/sun/mail/imap/IMAPMessage.java
--- a/mail/src/main/java/com/sun/mail/imap/IMAPMessage.java Tue Aug 30 12:14:07 2016 -0700
+++ b/mail/src/main/java/com/sun/mail/imap/IMAPMessage.java Sat Apr 16 19:06:32 2016 +0200
@@ -938,7 +938,6 @@
/**
* Get all headers.
*/
- @SuppressWarnings("unchecked")
public Enumeration<Header> getAllHeaders() throws MessagingException {
checkExpunged();
loadHeaders();
@@ -948,7 +947,6 @@
/**
* Get matching headers.
*/
- @SuppressWarnings("unchecked")
public Enumeration<Header> getMatchingHeaders(String[] names)
throws MessagingException {
checkExpunged();
@@ -959,7 +957,6 @@
/**
* Get non-matching headers.
*/
- @SuppressWarnings("unchecked")
public Enumeration<Header> getNonMatchingHeaders(String[] names)
throws MessagingException {
checkExpunged();
@@ -974,7 +971,6 @@
/**
* Get all header-lines.
*/
- @SuppressWarnings("unchecked")
public Enumeration<String> getAllHeaderLines() throws MessagingException {
checkExpunged();
loadHeaders();
@@ -984,7 +980,6 @@
/**
* Get all matching header-lines.
*/
- @SuppressWarnings("unchecked")
public Enumeration<String> getMatchingHeaderLines(String[] names)
throws MessagingException {
checkExpunged();
@@ -995,7 +990,6 @@
/**
* Get all non-matching headerlines.
*/
- @SuppressWarnings("unchecked")
public Enumeration<String> getNonMatchingHeaderLines(String[] names)
throws MessagingException {
checkExpunged();
@@ -1277,7 +1271,6 @@
* object, because InternetHeaders is not thread
* safe.
*/
- @SuppressWarnings("unchecked")
Enumeration<Header> e = h.getAllHeaders();
while (e.hasMoreElements()) {
Header he = e.nextElement();
diff -r 1f6b2c17e291 -r b3bc79e5f6c5 mail/src/main/java/com/sun/mail/pop3/POP3Message.java
--- a/mail/src/main/java/com/sun/mail/pop3/POP3Message.java Tue Aug 30 12:14:07 2016 -0700
+++ b/mail/src/main/java/com/sun/mail/pop3/POP3Message.java Sat Apr 16 19:06:32 2016 +0200
@@ -450,7 +450,6 @@
* @exception MessagingException for failures
* @see javax.mail.internet.MimeUtility
*/
- @SuppressWarnings("unchecked")
public Enumeration<Header> getAllHeaders() throws MessagingException {
if (headers == null)
loadHeaders();
@@ -463,7 +462,6 @@
*
* @exception MessagingException for failures
*/
- @SuppressWarnings("unchecked")
public Enumeration<Header> getMatchingHeaders(String[] names)
throws MessagingException {
if (headers == null)
@@ -477,7 +475,6 @@
*
* @exception MessagingException for failures
*/
- @SuppressWarnings("unchecked")
public Enumeration<Header> getNonMatchingHeaders(String[] names)
throws MessagingException {
if (headers == null)
@@ -506,7 +503,6 @@
*
* @exception MessagingException for failures
*/
- @SuppressWarnings("unchecked")
public Enumeration<String> getAllHeaderLines() throws MessagingException {
if (headers == null)
loadHeaders();
@@ -520,7 +516,6 @@
*
* @exception MessagingException for failures
*/
- @SuppressWarnings("unchecked")
public Enumeration<String> getMatchingHeaderLines(String[] names)
throws MessagingException {
if (headers == null)
@@ -535,7 +530,6 @@
*
* @exception MessagingException for failures
*/
- @SuppressWarnings("unchecked")
public Enumeration<String> getNonMatchingHeaderLines(String[] names)
throws MessagingException {
if (headers == null)
diff -r 1f6b2c17e291 -r b3bc79e5f6c5 mail/src/main/java/javax/mail/Multipart.java
--- a/mail/src/main/java/javax/mail/Multipart.java Tue Aug 30 12:14:07 2016 -0700
+++ b/mail/src/main/java/javax/mail/Multipart.java Sat Apr 16 19:06:32 2016 +0200
@@ -69,8 +69,7 @@
/**
* Vector of BodyPart objects.
*/
- @SuppressWarnings("rawtypes")
- protected Vector parts = new Vector(); // Holds BodyParts
+ protected Vector<BodyPart> parts = new Vector<>(); // Holds BodyParts
/**
* This field specifies the content-type of this multipart
@@ -156,7 +155,7 @@
if (parts == null)
throw new IndexOutOfBoundsException("No such BodyPart");
- return (BodyPart)parts.elementAt(index);
+ return parts.elementAt(index);
}
/**
@@ -197,7 +196,7 @@
if (parts == null)
throw new IndexOutOfBoundsException("No such BodyPart");
- BodyPart part = (BodyPart)parts.elementAt(index);
+ BodyPart part = parts.elementAt(index);
parts.removeElementAt(index);
part.setParent(null);
}
@@ -212,7 +211,6 @@
* of existing values
* @exception MessagingException for other failures
*/
- @SuppressWarnings("unchecked")
public synchronized void addBodyPart(BodyPart part)
throws MessagingException {
if (parts == null)
@@ -236,7 +234,6 @@
* of existing values
* @exception MessagingException for other failures
*/
- @SuppressWarnings("unchecked")
public synchronized void addBodyPart(BodyPart part, int index)
throws MessagingException {
if (parts == null)
diff -r 1f6b2c17e291 -r b3bc79e5f6c5 mail/src/main/java/javax/mail/Part.java
--- a/mail/src/main/java/javax/mail/Part.java Tue Aug 30 12:14:07 2016 -0700
+++ b/mail/src/main/java/javax/mail/Part.java Sat Apr 16 19:06:32 2016 +0200
@@ -449,8 +449,7 @@
* @return enumeration of Header objects
* @exception MessagingException for failures
*/
- @SuppressWarnings("rawtypes")
- public Enumeration getAllHeaders() throws MessagingException;
+ public Enumeration<Header> getAllHeaders() throws MessagingException;
/**
* Return matching headers from this part as an Enumeration of
@@ -460,8 +459,7 @@
* @return enumeration of Header objects
* @exception MessagingException for failures
*/
- @SuppressWarnings("rawtypes")
- public Enumeration getMatchingHeaders(String[] header_names)
+ public Enumeration<Header> getMatchingHeaders(String[] header_names)
throws MessagingException;
/**
@@ -472,7 +470,6 @@
* @return enumeration of Header objects
* @exception MessagingException for failures
*/
- @SuppressWarnings("rawtypes")
- public Enumeration getNonMatchingHeaders(String[] header_names)
+ public Enumeration<Header> getNonMatchingHeaders(String[] header_names)
throws MessagingException;
}
diff -r 1f6b2c17e291 -r b3bc79e5f6c5 mail/src/main/java/javax/mail/Service.java
--- a/mail/src/main/java/javax/mail/Service.java Tue Aug 30 12:14:07 2016 -0700
+++ b/mail/src/main/java/javax/mail/Service.java Sat Apr 16 19:06:32 2016 +0200
@@ -637,8 +637,8 @@
* @param event the event
* @param vector the vector of listeners
*/
- @SuppressWarnings("rawtypes")
- protected void queueEvent(MailEvent event, Vector vector) {
+ protected void queueEvent(MailEvent event,
+ Vector<? extends EventListener> vector) {
/*
* Copy the vector in order to freeze the state of the set
* of EventListeners the event should be delivered to prior
diff -r 1f6b2c17e291 -r b3bc79e5f6c5 mail/src/main/java/javax/mail/internet/InternetHeaders.java
--- a/mail/src/main/java/javax/mail/internet/InternetHeaders.java Tue Aug 30 12:14:07 2016 -0700
+++ b/mail/src/main/java/javax/mail/internet/InternetHeaders.java Sat Apr 16 19:06:32 2016 +0200
@@ -297,14 +297,12 @@
*
* @since JavaMail 1.4
*/
- @SuppressWarnings("rawtypes")
- protected List headers;
+ protected List<InternetHeader> headers;
/**
* Create an empty InternetHeaders object. Placeholder entries
* are inserted to indicate the preferred order of headers.
*/
- @SuppressWarnings("unchecked")
public InternetHeaders() {
headers = new ArrayList<InternetHeader>(40);
headers.add(new InternetHeader("Return-Path", null));
@@ -440,7 +438,6 @@
* @return array of header values, or null if none
*/
public String[] getHeader(String name) {
- @SuppressWarnings("unchecked")
Iterator<InternetHeader> e = headers.iterator();
// XXX - should we just step through in index order?
List<String> v = new ArrayList<String>(); // accumulate return values
@@ -502,7 +499,7 @@
boolean found = false;
for (int i = 0; i < headers.size(); i++) {
- InternetHeader h = (InternetHeader)headers.get(i);
+ InternetHeader h = headers.get(i);
if (name.equalsIgnoreCase(h.getName())) {
if (!found) {
int j;
@@ -540,7 +537,6 @@
* @param name header name
* @param value header value
*/
- @SuppressWarnings("unchecked")
public void addHeader(String name, String value) {
int pos = headers.size();
boolean addReverse =
@@ -549,7 +545,7 @@
if (addReverse)
pos = 0;
for (int i = headers.size() - 1; i >= 0; i--) {
- InternetHeader h = (InternetHeader)headers.get(i);
+ InternetHeader h = headers.get(i);
if (name.equalsIgnoreCase(h.getName())) {
if (addReverse) {
pos = i;
@@ -571,7 +567,7 @@
*/
public void removeHeader(String name) {
for (int i = 0; i < headers.size(); i++) {
- InternetHeader h = (InternetHeader)headers.get(i);
+ InternetHeader h = headers.get(i);
if (name.equalsIgnoreCase(h.getName())) {
h.line = null;
//headers.remove(i);
@@ -586,8 +582,7 @@
*
* @return Enumeration of Header objects
*/
- @SuppressWarnings({"rawtypes", "unchecked"})
- public Enumeration getAllHeaders() {
+ public Enumeration<Header> getAllHeaders() {
return (new MatchHeaderEnum(headers, null, false));
}
@@ -597,8 +592,7 @@
* @param names the headers to return
* @return Enumeration of matching Header objects
*/
- @SuppressWarnings({"rawtypes", "unchecked"})
- public Enumeration getMatchingHeaders(String[] names) {
+ public Enumeration<Header> getMatchingHeaders(String[] names) {
return (new MatchHeaderEnum(headers, names, true));
}
@@ -608,8 +602,7 @@
* @param names the headers to not return
* @return Enumeration of non-matching Header objects
*/
- @SuppressWarnings({"rawtypes", "unchecked"})
- public Enumeration getNonMatchingHeaders(String[] names) {
+ public Enumeration<Header> getNonMatchingHeaders(String[] names) {
return (new MatchHeaderEnum(headers, names, false));
}
@@ -623,13 +616,11 @@
*
* @param line raw RFC822 header line
*/
- @SuppressWarnings("unchecked")
public void addHeaderLine(String line) {
try {
char c = line.charAt(0);
if (c == ' ' || c == '\t') {
- InternetHeader h =
- (InternetHeader)headers.get(headers.size() - 1);
+ InternetHeader h = headers.get(headers.size() - 1);
h.line += "\r\n" + line;
} else
headers.add(new InternetHeader(line));
@@ -646,8 +637,7 @@
*
* @return Enumeration of Strings of all header lines
*/
- @SuppressWarnings("rawtypes")
- public Enumeration getAllHeaderLines() {
+ public Enumeration<String> getAllHeaderLines() {
return (getNonMatchingHeaderLines(null));
}
@@ -657,8 +647,7 @@
* @param names the headers to return
* @return Enumeration of Strings of all matching header lines
*/
- @SuppressWarnings({"rawtypes", "unchecked"})
- public Enumeration getMatchingHeaderLines(String[] names) {
+ public Enumeration<String> getMatchingHeaderLines(String[] names) {
return (new MatchStringEnum(headers, names, true));
}
@@ -668,8 +657,7 @@
* @param names the headers to not return
* @return Enumeration of Strings of all non-matching header lines
*/
- @SuppressWarnings({"rawtypes", "unchecked"})
- public Enumeration getNonMatchingHeaderLines(String[] names) {
+ public Enumeration<String> getNonMatchingHeaderLines(String[] names) {
return (new MatchStringEnum(headers, names, false));
}
}
diff -r 1f6b2c17e291 -r b3bc79e5f6c5 mail/src/main/java/javax/mail/internet/MimeBodyPart.java
--- a/mail/src/main/java/javax/mail/internet/MimeBodyPart.java Tue Aug 30 12:14:07 2016 -0700
+++ b/mail/src/main/java/javax/mail/internet/MimeBodyPart.java Sat Apr 16 19:06:32 2016 +0200
@@ -1033,8 +1033,7 @@
* Return all the headers from this Message as an Enumeration of
* Header objects.
*/
- @SuppressWarnings("rawtypes")
- public Enumeration getAllHeaders() throws MessagingException {
+ public Enumeration<Header> getAllHeaders() throws MessagingException {
return headers.getAllHeaders();
}
@@ -1042,8 +1041,7 @@
* Return matching headers from this Message as an Enumeration of
* Header objects.
*/
- @SuppressWarnings("rawtypes")
- public Enumeration getMatchingHeaders(String[] names)
+ public Enumeration<Header> getMatchingHeaders(String[] names)
throws MessagingException {
return headers.getMatchingHeaders(names);
}
@@ -1052,8 +1050,7 @@
* Return non-matching headers from this Message as an
* Enumeration of Header objects.
*/
- @SuppressWarnings("rawtypes")
- public Enumeration getNonMatchingHeaders(String[] names)
+ public Enumeration<Header> getNonMatchingHeaders(String[] names)
throws MessagingException {
return headers.getNonMatchingHeaders(names);
}
@@ -1070,8 +1067,7 @@
* line is a raw RFC 822 header line, containing both the "name"
* and "value" field.
*/
- @SuppressWarnings("rawtypes")
- public Enumeration getAllHeaderLines() throws MessagingException {
+ public Enumeration<String> getAllHeaderLines() throws MessagingException {
return headers.getAllHeaderLines();
}
@@ -1080,8 +1076,7 @@
* A Header line is a raw RFC 822 header line, containing both
* the "name" and "value" field.
*/
- @SuppressWarnings("rawtypes")
- public Enumeration getMatchingHeaderLines(String[] names)
+ public Enumeration<String> getMatchingHeaderLines(String[] names)
throws MessagingException {
return headers.getMatchingHeaderLines(names);
}
@@ -1091,8 +1086,7 @@
* A Header line is a raw RFC 822 header line, containing both
* the "name" and "value" field.
*/
- @SuppressWarnings("rawtypes")
- public Enumeration getNonMatchingHeaderLines(String[] names)
+ public Enumeration<String> getNonMatchingHeaderLines(String[] names)
throws MessagingException {
return headers.getNonMatchingHeaderLines(names);
}
@@ -1613,7 +1607,6 @@
}
// First, write out the header
- @SuppressWarnings("unchecked")
Enumeration<String> hdrLines
= part.getNonMatchingHeaderLines(ignoreList);
while (hdrLines.hasMoreElements())
diff -r 1f6b2c17e291 -r b3bc79e5f6c5 mail/src/main/java/javax/mail/internet/MimeMessage.java
--- a/mail/src/main/java/javax/mail/internet/MimeMessage.java Tue Aug 30 12:14:07 2016 -0700
+++ b/mail/src/main/java/javax/mail/internet/MimeMessage.java Sat Apr 16 19:06:32 2016 +0200
@@ -1853,7 +1853,6 @@
// Else, the content is untouched, so we can just output it
// First, write out the header
- @SuppressWarnings("unchecked")
Enumeration<String> hdrLines = getNonMatchingHeaderLines(ignoreList);
LineOutputStream los = new LineOutputStream(os);
while (hdrLines.hasMoreElements())
@@ -1989,8 +1988,7 @@
* @exception MessagingException for failures
* @see javax.mail.internet.MimeUtility
*/
- @SuppressWarnings("rawtypes")
- public Enumeration getAllHeaders() throws MessagingException {
+ public Enumeration<Header> getAllHeaders() throws MessagingException {
return headers.getAllHeaders();
}
@@ -2001,8 +1999,7 @@
*
* @exception MessagingException for failures
*/
- @SuppressWarnings("rawtypes")
- public Enumeration getMatchingHeaders(String[] names)
+ public Enumeration<Header> getMatchingHeaders(String[] names)
throws MessagingException {
return headers.getMatchingHeaders(names);
}
@@ -2014,8 +2011,7 @@
*
* @exception MessagingException for failures
*/
- @SuppressWarnings("rawtypes")
- public Enumeration getNonMatchingHeaders(String[] names)
+ public Enumeration<Header> getNonMatchingHeaders(String[] names)
throws MessagingException {
return headers.getNonMatchingHeaders(names);
}
@@ -2040,8 +2036,7 @@
*
* @exception MessagingException for failures
*/
- @SuppressWarnings("rawtypes")
- public Enumeration getAllHeaderLines() throws MessagingException {
+ public Enumeration<String> getAllHeaderLines() throws MessagingException {
return headers.getAllHeaderLines();
}
@@ -2052,8 +2047,7 @@
*
* @exception MessagingException for failures
*/
- @SuppressWarnings("rawtypes")
- public Enumeration getMatchingHeaderLines(String[] names)
+ public Enumeration<String> getMatchingHeaderLines(String[] names)
throws MessagingException {
return headers.getMatchingHeaderLines(names);
}
@@ -2065,8 +2059,7 @@
*
* @exception MessagingException for failures
*/
- @SuppressWarnings("rawtypes")
- public Enumeration getNonMatchingHeaderLines(String[] names)
+ public Enumeration<String> getNonMatchingHeaderLines(String[] names)
throws MessagingException {
return headers.getNonMatchingHeaderLines(names);
}
diff -r 1f6b2c17e291 -r b3bc79e5f6c5 mail/src/main/java/javax/mail/internet/MimePart.java
--- a/mail/src/main/java/javax/mail/internet/MimePart.java Tue Aug 30 12:14:07 2016 -0700
+++ b/mail/src/main/java/javax/mail/internet/MimePart.java Sat Apr 16 19:06:32 2016 +0200
@@ -108,8 +108,7 @@
* @return an Enumeration of Strings
* @exception MessagingException for failures
*/
- @SuppressWarnings("rawtypes")
- public Enumeration getAllHeaderLines() throws MessagingException;
+ public Enumeration<String> getAllHeaderLines() throws MessagingException;
/**
* Get matching header lines as an Enumeration of Strings.
@@ -120,8 +119,7 @@
* @return an Enumeration of Strings
* @exception MessagingException for failures
*/
- @SuppressWarnings("rawtypes")
- public Enumeration getMatchingHeaderLines(String[] names)
+ public Enumeration<String> getMatchingHeaderLines(String[] names)
throws MessagingException;
/**
@@ -133,8 +131,7 @@
* @return an Enumeration of Strings
* @exception MessagingException for failures
*/
- @SuppressWarnings("rawtypes")
- public Enumeration getNonMatchingHeaderLines(String[] names)
+ public Enumeration<String> getNonMatchingHeaderLines(String[] names)
throws MessagingException;
/**
diff -r 1f6b2c17e291 -r b3bc79e5f6c5 mail/src/main/java/javax/mail/internet/ParameterList.java
--- a/mail/src/main/java/javax/mail/internet/ParameterList.java Tue Aug 30 12:14:07 2016 -0700
+++ b/mail/src/main/java/javax/mail/internet/ParameterList.java Sat Apr 16 19:06:32 2016 +0200
@@ -624,8 +624,7 @@
*
* @return Enumeration of all parameter names in this list.
*/
- @SuppressWarnings("rawtypes")
- public Enumeration getNames() {
+ public Enumeration<String> getNames() {
return new ParamEnum(list.keySet().iterator());
}
diff -r 1f6b2c17e291 -r b3bc79e5f6c5 mail/src/main/java/javax/mail/internet/PreencodedMimeBodyPart.java
--- a/mail/src/main/java/javax/mail/internet/PreencodedMimeBodyPart.java Tue Aug 30 12:14:07 2016 -0700
+++ b/mail/src/main/java/javax/mail/internet/PreencodedMimeBodyPart.java Sat Apr 16 19:06:32 2016 +0200
@@ -103,7 +103,6 @@
}
// First, write out the header
- @SuppressWarnings("unchecked")
Enumeration<String> hdrLines = getAllHeaderLines();
while (hdrLines.hasMoreElements())
los.writeln(hdrLines.nextElement());
diff -r 1f6b2c17e291 -r b3bc79e5f6c5 mail/src/test/java/javax/mail/internet/InternetHeadersTest.java
--- a/mail/src/test/java/javax/mail/internet/InternetHeadersTest.java Tue Aug 30 12:14:07 2016 -0700
+++ b/mail/src/test/java/javax/mail/internet/InternetHeadersTest.java Sat Apr 16 19:06:32 2016 +0200
@@ -97,7 +97,6 @@
throws Exception {
assertEquals(1, ih.getHeader("Subject").length);
assertEquals("test", ih.getHeader("Subject")[0]);
- @SuppressWarnings("unchecked")
Enumeration<Header> e = ih.getAllHeaders();
while (e.hasMoreElements()) {
Header h = e.nextElement();
@@ -130,7 +129,6 @@
throws Exception {
assertEquals(1, ih.getHeader("Subject").length);
assertEquals("test", ih.getHeader("Subject")[0]);
- @SuppressWarnings("unchecked")
Enumeration<Header> e = ih.getAllHeaders();
while (e.hasMoreElements()) {
Header h = e.nextElement();
diff -r 1f6b2c17e291 -r b3bc79e5f6c5 mail/src/test/java/javax/mail/internet/MimeMessageTest.java
--- a/mail/src/test/java/javax/mail/internet/MimeMessageTest.java Tue Aug 30 12:14:07 2016 -0700
+++ b/mail/src/test/java/javax/mail/internet/MimeMessageTest.java Sat Apr 16 19:06:32 2016 +0200
@@ -213,7 +213,6 @@
InternetAddress[] addrs = InternetAddress.parse(
"long-address1_at_example.com, long-address2_at_example.com, joe_at_foobar.com");
msg.setReplyTo(addrs); // use Reply-To because it's a long header name
- @SuppressWarnings("unchecked")
Enumeration<String> e
= msg.getMatchingHeaderLines(new String[] { "Reply-To" });
String line = e.nextElement();
diff -r 1f6b2c17e291 -r b3bc79e5f6c5 mail/src/test/java/javax/mail/internet/ParameterListDecode.java
--- a/mail/src/test/java/javax/mail/internet/ParameterListDecode.java Tue Aug 30 12:14:07 2016 -0700
+++ b/mail/src/test/java/javax/mail/internet/ParameterListDecode.java Sat Apr 16 19:06:32 2016 +0200
@@ -290,7 +290,6 @@
errors++;
}
}
- @SuppressWarnings("unchecked")
Enumeration<String> e = pl.getNames();
for (int i = 0; e.hasMoreElements(); i++) {
String name = e.nextElement();
diff -r b3bc79e5f6c5 -r 56798cb398f6 doc/release/CHANGES.txt
--- a/doc/release/CHANGES.txt Sat Apr 16 19:06:32 2016 +0200
+++ b/doc/release/CHANGES.txt Tue Aug 30 12:59:12 2016 -0700
@@ -24,6 +24,7 @@
K 8399 IdleManager fails on Android
K 8403 Test fails: javax.mail.internet.GetLocalAddressTest
K 8405 MboxFolder.expunge can corrupt mailbox file
+K 8415 Update public API to use generics
CHANGES IN THE 1.5.6 RELEASE
diff -r b3bc79e5f6c5 -r 56798cb398f6 doc/release/COMPAT.txt
--- a/doc/release/COMPAT.txt Sat Apr 16 19:06:32 2016 +0200
+++ b/doc/release/COMPAT.txt Tue Aug 30 12:59:12 2016 -0700
@@ -4,8 +4,8 @@
JavaMail(TM) API ${mail.version} release
------------------------------
-The JavaMail 1.5 specification is fully compatible with the JavaMail
-1.4 specification, with the exceptions listed below.
+The JavaMail 1.6 specification is fully compatible with the JavaMail
+1.5 specification, with the exceptions listed below.
In addition, changes in the implementation may impact
applications that depend on behavior beyond what is defined by the
@@ -14,6 +14,31 @@
with this release of the JavaMail API.
+-- JavaMail 1.6 --
+
+- Public API updated to use generics
+
+ Methods in the following classes have been updated to use generics.
+ This change should be binary compatible but may require source
+ code changes in applications.
+
+ javax.mail.Multipart
+ javax.mail.Part
+ javax.mail.Service
+ javax.mail.internet.InternetHeaders
+ javax.mail.internet.MimeBodyPart
+ javax.mail.internet.MimeMessage
+ javax.mail.internet.MimePart
+ javax.mail.internet.ParameterList
+
+- JDK 1.7 or newer required
+
+ The JavaMail reference implementation now requires JDK 1.7
+ or newer. It is expected that the large majority of users
+ are already using JDK 1.7 or newer.
+
+
+
-- JavaMail 1.5.6 --
- finalizers close sockets abruptly
diff -r b3bc79e5f6c5 -r 56798cb398f6 mail/src/main/java/com/sun/mail/imap/IMAPBodyPart.java
--- a/mail/src/main/java/com/sun/mail/imap/IMAPBodyPart.java Sat Apr 16 19:06:32 2016 +0200
+++ b/mail/src/main/java/com/sun/mail/imap/IMAPBodyPart.java Tue Aug 30 12:59:12 2016 -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-2016 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
diff -r b3bc79e5f6c5 -r 56798cb398f6 mail/src/main/java/com/sun/mail/imap/IMAPMessage.java
--- a/mail/src/main/java/com/sun/mail/imap/IMAPMessage.java Sat Apr 16 19:06:32 2016 +0200
+++ b/mail/src/main/java/com/sun/mail/imap/IMAPMessage.java Tue Aug 30 12:59:12 2016 -0700
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * Copyright (c) 1997-2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997-2016 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
diff -r b3bc79e5f6c5 -r 56798cb398f6 mail/src/main/java/com/sun/mail/pop3/POP3Message.java
--- a/mail/src/main/java/com/sun/mail/pop3/POP3Message.java Sat Apr 16 19:06:32 2016 +0200
+++ b/mail/src/main/java/com/sun/mail/pop3/POP3Message.java Tue Aug 30 12:59:12 2016 -0700
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * Copyright (c) 1997-2013 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997-2016 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
diff -r b3bc79e5f6c5 -r 56798cb398f6 mail/src/main/java/javax/mail/Multipart.java
--- a/mail/src/main/java/javax/mail/Multipart.java Sat Apr 16 19:06:32 2016 +0200
+++ b/mail/src/main/java/javax/mail/Multipart.java Tue Aug 30 12:59:12 2016 -0700
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * Copyright (c) 1997-2013 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997-2016 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
diff -r b3bc79e5f6c5 -r 56798cb398f6 mail/src/main/java/javax/mail/Part.java
--- a/mail/src/main/java/javax/mail/Part.java Sat Apr 16 19:06:32 2016 +0200
+++ b/mail/src/main/java/javax/mail/Part.java Tue Aug 30 12:59:12 2016 -0700
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * Copyright (c) 1997-2013 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997-2016 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
diff -r b3bc79e5f6c5 -r 56798cb398f6 mail/src/main/java/javax/mail/Service.java
--- a/mail/src/main/java/javax/mail/Service.java Sat Apr 16 19:06:32 2016 +0200
+++ b/mail/src/main/java/javax/mail/Service.java Tue Aug 30 12:59:12 2016 -0700
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * Copyright (c) 1997-2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997-2016 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
diff -r b3bc79e5f6c5 -r 56798cb398f6 mail/src/main/java/javax/mail/internet/InternetHeaders.java
--- a/mail/src/main/java/javax/mail/internet/InternetHeaders.java Sat Apr 16 19:06:32 2016 +0200
+++ b/mail/src/main/java/javax/mail/internet/InternetHeaders.java Tue Aug 30 12:59:12 2016 -0700
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * Copyright (c) 1997-2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997-2016 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
diff -r b3bc79e5f6c5 -r 56798cb398f6 mail/src/main/java/javax/mail/internet/MimePart.java
--- a/mail/src/main/java/javax/mail/internet/MimePart.java Sat Apr 16 19:06:32 2016 +0200
+++ b/mail/src/main/java/javax/mail/internet/MimePart.java Tue Aug 30 12:59:12 2016 -0700
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * Copyright (c) 1997-2013 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997-2016 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
diff -r b3bc79e5f6c5 -r 56798cb398f6 mail/src/main/java/javax/mail/internet/ParameterList.java
--- a/mail/src/main/java/javax/mail/internet/ParameterList.java Sat Apr 16 19:06:32 2016 +0200
+++ b/mail/src/main/java/javax/mail/internet/ParameterList.java Tue Aug 30 12:59:12 2016 -0700
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * Copyright (c) 1997-2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997-2016 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
diff -r b3bc79e5f6c5 -r 56798cb398f6 mail/src/main/java/javax/mail/internet/PreencodedMimeBodyPart.java
--- a/mail/src/main/java/javax/mail/internet/PreencodedMimeBodyPart.java Sat Apr 16 19:06:32 2016 +0200
+++ b/mail/src/main/java/javax/mail/internet/PreencodedMimeBodyPart.java Tue Aug 30 12:59:12 2016 -0700
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * Copyright (c) 1997-2013 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997-2016 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
diff -r b3bc79e5f6c5 -r 56798cb398f6 mail/src/test/java/javax/mail/internet/InternetHeadersTest.java
--- a/mail/src/test/java/javax/mail/internet/InternetHeadersTest.java Sat Apr 16 19:06:32 2016 +0200
+++ b/mail/src/test/java/javax/mail/internet/InternetHeadersTest.java Tue Aug 30 12:59:12 2016 -0700
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * Copyright (c) 2011-2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011-2016 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
diff -r b3bc79e5f6c5 -r 56798cb398f6 mail/src/test/java/javax/mail/internet/ParameterListDecode.java
--- a/mail/src/test/java/javax/mail/internet/ParameterListDecode.java Sat Apr 16 19:06:32 2016 +0200
+++ b/mail/src/test/java/javax/mail/internet/ParameterListDecode.java Tue Aug 30 12:59:12 2016 -0700
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * Copyright (c) 1997-2013 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997-2016 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
diff -r 56798cb398f6 -r c53a0c3792d5 mail/src/main/java/javax/mail/internet/MailDateFormat.java
--- a/mail/src/main/java/javax/mail/internet/MailDateFormat.java Tue Aug 30 12:59:12 2016 -0700
+++ b/mail/src/main/java/javax/mail/internet/MailDateFormat.java Tue Aug 30 13:59:52 2016 +0200
@@ -48,6 +48,7 @@
import java.util.Locale;
import java.util.TimeZone;
import java.util.logging.Level;
+import java.text.DateFormatSymbols;
import java.text.SimpleDateFormat;
import java.text.NumberFormat;
import java.text.FieldPosition;
@@ -198,10 +199,10 @@
*
* @return a clone of this instance
*/
-// @Override
-// public MailDateFormat clone() {
-// return (MailDateFormat) super.clone();
-// }
+ @Override
+ public MailDateFormat clone() {
+ return (MailDateFormat) super.clone();
+ }
/**
* Formats the given date in the format specified by
@@ -280,11 +281,11 @@
*
* @throws UnsupportedOperationException if this method is invoked
*/
-// @Override
-// public void applyLocalizedPattern(String pattern) {
-// throw new UnsupportedOperationException("Method "
-// + "applyLocalizedPattern() shouldn't be called");
-// }
+ @Override
+ public void applyLocalizedPattern(String pattern) {
+ throw new UnsupportedOperationException("Method "
+ + "applyLocalizedPattern() shouldn't be called");
+ }
/**
* This method always throws an UnsupportedOperationException and should not
@@ -292,11 +293,11 @@
*
* @throws UnsupportedOperationException if this method is invoked
*/
-// @Override
-// public void applyPattern(String pattern) {
-// throw new UnsupportedOperationException("Method "
-// + "applyPattern() shouldn't be called");
-// }
+ @Override
+ public void applyPattern(String pattern) {
+ throw new UnsupportedOperationException("Method "
+ + "applyPattern() shouldn't be called");
+ }
/**
* This method allows serialization to change the pattern.
@@ -314,11 +315,11 @@
* parsed
* @throws UnsupportedOperationException if this method is invoked
*/
-// @Override
-// public Date get2DigitYearStart() {
-// throw new UnsupportedOperationException("Method "
-// + "get2DigitYearStart() shouldn't be called");
-// }
+ @Override
+ public Date get2DigitYearStart() {
+ throw new UnsupportedOperationException("Method "
+ + "get2DigitYearStart() shouldn't be called");
+ }
/**
* This method always throws an UnsupportedOperationException and should not
@@ -327,11 +328,11 @@
*
* @throws UnsupportedOperationException if this method is invoked
*/
-// @Override
-// public void set2DigitYearStart(Date startDate) {
-// throw new UnsupportedOperationException("Method "
-// + "set2DigitYearStart() shouldn't be called");
-// }
+ @Override
+ public void set2DigitYearStart(Date startDate) {
+ throw new UnsupportedOperationException("Method "
+ + "set2DigitYearStart() shouldn't be called");
+ }
/**
* This method always throws an UnsupportedOperationException and should not
@@ -339,11 +340,11 @@
*
* @throws UnsupportedOperationException if this method is invoked
*/
-// @Override
-// public void setDateFormatSymbols(DateFormatSymbols newFormatSymbols) {
-// throw new UnsupportedOperationException("Method "
-// + "setDateFormatSymbols() shouldn't be called");
-// }
+ @Override
+ public void setDateFormatSymbols(DateFormatSymbols newFormatSymbols) {
+ throw new UnsupportedOperationException("Method "
+ + "setDateFormatSymbols() shouldn't be called");
+ }
/**
* Returns the date, as specified by the parameters.
@@ -420,8 +421,7 @@
LOGGER.log(Level.FINE, "Bad date: '" + text + "'", e);
}
pos.setErrorIndex(pos.getIndex());
- // to prevent DateFormat::parse from throwing ParseException:
- pos.setIndex(startPosition + 1);
+ pos.setIndex(startPosition);
return null;
}
}
diff -r 56798cb398f6 -r c53a0c3792d5 mail/src/test/java/javax/mail/internet/MailDateFormatTest.java
--- a/mail/src/test/java/javax/mail/internet/MailDateFormatTest.java Tue Aug 30 12:59:12 2016 -0700
+++ b/mail/src/test/java/javax/mail/internet/MailDateFormatTest.java Tue Aug 30 13:59:52 2016 +0200
@@ -61,7 +61,6 @@
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import org.junit.Ignore;
import org.junit.Test;
/**
@@ -297,7 +296,6 @@
* Parsing - FWS (folding white space)
*/
@Test
- @Ignore("until parse throws ParseException instead of returning null (1.6)")
public void mustFailOrSkipCfws() {
String input = "(3 Jan 2015 00:00 +0000) 1 Jan 2015 00:00 +0000";
try {
@@ -359,17 +357,15 @@
* Parsing - year
*/
@Test
- @Ignore("until the next major release (1.6)")
- public void lenientMustRejectSingleDigitYears() {
- mustFail(getLenient(), "1 Jan 1 00:00 +0000", 6);
+ public void lenientMustAcceptSingleDigitYears() {
+ mustPass(getLenient(), "1 Jan 1 00:00 +0000");
}
@Test
- @Ignore("until the next major release (1.6)")
- public void lenientMustRejectYearsBetween1000and1899() {
+ public void lenientMustAcceptYearsBetween1000and1899() {
mustPass(getLenient(), "1 Jan 999 00:00 +0000");
- mustFail(getLenient(), "1 Jan 1000 00:00 +0000", 6);
- mustFail(getLenient(), "1 Jan 1899 00:00 +0000", 6);
+ mustPass(getLenient(), "1 Jan 1000 00:00 +0000");
+ mustPass(getLenient(), "1 Jan 1899 00:00 +0000");
mustPass(getStrict(), "1 Jan 1900 00:00 +0000");
}
@@ -461,7 +457,6 @@
}
@Test(expected = UnsupportedOperationException.class)
- @Ignore("until the next spec change (1.6)")
public void mus
[truncated due to length]