Repository: mercurial
Revision: 100
Author: Bill Shannon <bill.shannon_at_sun.com>
Date: 2009-01-17 00:08:21 UTC
Log Message:
-----------
Add messages to exceptions.
Modified Paths:
--------------
mail/src/main/java/com/sun/mail/iap/ResponseInputStream.java
mail/src/main/java/com/sun/mail/imap/IMAPFolder.java
mail/src/main/java/javax/mail/Service.java
mail/src/main/java/javax/mail/URLName.java
mail/src/main/java/javax/mail/internet/ContentDisposition.java
mail/src/main/java/javax/mail/internet/ContentType.java
mail/src/main/java/javax/mail/internet/MimePartDataSource.java
Diffs:
-----
diff -r 3d41b11075f7 -r be330336cf8c
mail/src/main/java/com/sun/mail/iap/ResponseInputStream.java
--- a/mail/src/main/java/com/sun/mail/iap/ResponseInputStream.java
Mon Dec 15 12:58:27 2008 -0800
+++ b/mail/src/main/java/com/sun/mail/iap/ResponseInputStream.java
Fri Jan 16 16:08:21 2009 -0800
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the
GNU
* General Public License Version 2 only ("GPL") or the Common
Development
@@ -108,7 +108,7 @@
}
if (b == -1)
- throw new IOException(); // connection broken ?
+ throw new IOException("Connection dropped by server?");
// Now lets check for literals : {<digits>}CRLF
// Note: index needs to >= 5 for the above sequence to
occur
diff -r 3d41b11075f7 -r be330336cf8c
mail/src/main/java/com/sun/mail/imap/IMAPFolder.java
--- a/mail/src/main/java/com/sun/mail/imap/IMAPFolder.java Mon Dec
15 12:58:27 2008 -0800
+++ b/mail/src/main/java/com/sun/mail/imap/IMAPFolder.java Fri Jan
16 16:08:21 2009 -0800
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the
GNU
* General Public License Version 2 only ("GPL") or the Common
Development
@@ -423,7 +423,7 @@
*/
private void checkRange(int msgno) throws MessagingException {
if (msgno < 1) // message-numbers start at 1
- throw new IndexOutOfBoundsException();
+ throw new IndexOutOfBoundsException("message number < 1");
if (msgno <= total)
return;
diff -r 3d41b11075f7 -r be330336cf8c
mail/src/main/java/javax/mail/Service.java
--- a/mail/src/main/java/javax/mail/Service.java Mon Dec 15
12:58:27 2008 -0800
+++ b/mail/src/main/java/javax/mail/Service.java Fri Jan 16
16:08:21 2009 -0800
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the
GNU
* General Public License Version 2 only ("GPL") or the Common
Development
@@ -319,7 +319,7 @@
if (authEx != null)
throw authEx;
else
- throw new AuthenticationFailedException();
+ throw new AuthenticationFailedException("failed to
connect");
}
setURLName(new URLName(protocol, host, port, file, user,
password));
diff -r 3d41b11075f7 -r be330336cf8c
mail/src/main/java/javax/mail/URLName.java
--- a/mail/src/main/java/javax/mail/URLName.java Mon Dec 15
12:58:27 2008 -0800
+++ b/mail/src/main/java/javax/mail/URLName.java Fri Jan 16
16:08:21 2009 -0800
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the
GNU
* General Public License Version 2 only ("GPL") or the Common
Development
@@ -645,7 +645,9 @@
sb.append((char)Integer.parseInt(
s.substring(i+1,i+3),16));
} catch (NumberFormatException e) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(
+ "Illegal URL encoded value: " +
+ s.substring(i,i+3));
}
i += 2;
break;
diff -r 3d41b11075f7 -r be330336cf8c
mail/src/main/java/javax/mail/internet/ContentDisposition.java
--- a/mail/src/main/java/javax/mail/internet/ContentDisposition.java
Mon Dec 15 12:58:27 2008 -0800
+++ b/mail/src/main/java/javax/mail/internet/ContentDisposition.java
Fri Jan 16 16:08:21 2009 -0800
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the
GNU
* General Public License Version 2 only ("GPL") or the Common
Development
@@ -86,7 +86,8 @@
// First "disposition" ..
tk = h.next();
if (tk.getType() != HeaderTokenizer.Token.ATOM)
- throw new ParseException();
+ throw new ParseException("Expected disposition, got " +
+ tk.getValue());
disposition = tk.getValue();
// Then parameters ..
diff -r 3d41b11075f7 -r be330336cf8c
mail/src/main/java/javax/mail/internet/ContentType.java
--- a/mail/src/main/java/javax/mail/internet/ContentType.java Mon Dec
15 12:58:27 2008 -0800
+++ b/mail/src/main/java/javax/mail/internet/ContentType.java Fri Jan
16 16:08:21 2009 -0800
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the
GNU
* General Public License Version 2 only ("GPL") or the Common
Development
@@ -88,18 +88,20 @@
// First "type" ..
tk = h.next();
if (tk.getType() != HeaderTokenizer.Token.ATOM)
- throw new ParseException();
+ throw new ParseException("Expected MIME type, got " +
+ tk.getValue());
primaryType = tk.getValue();
// The '/' separator ..
tk = h.next();
if ((char)tk.getType() != '/')
- throw new ParseException();
+ throw new ParseException("Expected '/', got " +
tk.getValue());
// Then "subType" ..
tk = h.next();
if (tk.getType() != HeaderTokenizer.Token.ATOM)
- throw new ParseException();
+ throw new ParseException("Expected MIME subtype, got " +
+ tk.getValue());
subType = tk.getValue();
// Finally parameters ..
diff -r 3d41b11075f7 -r be330336cf8c
mail/src/main/java/javax/mail/internet/MimePartDataSource.java
--- a/mail/src/main/java/javax/mail/internet/MimePartDataSource.java
Mon Dec 15 12:58:27 2008 -0800
+++ b/mail/src/main/java/javax/mail/internet/MimePartDataSource.java
Fri Jan 16 16:08:21 2009 -0800
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
- * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the
GNU
* General Public License Version 2 only ("GPL") or the Common
Development
@@ -150,7 +150,7 @@
* This implementation throws the UnknownServiceException.
*/
public OutputStream getOutputStream() throws IOException {
- throw new UnknownServiceException();
+ throw new UnknownServiceException("Writing not supported");
}
/**