Remove "throws" declarations that didn't actually get thrown. Remove a

couple of try blocks that only caught throws we didn't throw. IntelliJ
optimization.
This commit is contained in:
Jesse Vincent 2010-12-01 03:02:13 +00:00
parent 81f12f0e05
commit c79ea226a5
21 changed files with 68 additions and 136 deletions

View File

@ -53,7 +53,7 @@ public class K9 extends Application
* The application instance. Never <code>null</code>.
* @throws Exception
*/
void initializeComponent(K9 application) throws Exception;
void initializeComponent(K9 application);
}
public static Application app = null;

View File

@ -2090,8 +2090,7 @@ public class MessageView extends K9Activity implements OnClickListener
}
}
private Bitmap getPreviewIcon(Attachment attachment) throws MessagingException
{
private Bitmap getPreviewIcon(Attachment attachment) {
try
{
return BitmapFactory.decodeStream(

View File

@ -3206,8 +3206,7 @@ public class MessagingController implements Runnable
* Check if the attachment has already been downloaded. If it has there's no reason to
* download it, so we just tell the listener that it's ready to go.
*/
try
{
if (part.getBody() != null)
{
for (MessagingListener l : getListeners())
@ -3230,14 +3229,8 @@ public class MessagingController implements Runnable
}
return;
}
}
catch (MessagingException me)
{
/*
* If the header isn't there the attachment isn't downloaded yet, so just continue
* on.
*/
}
for (MessagingListener l : getListeners())
{

View File

@ -61,7 +61,7 @@ public abstract class Folder
* was requested with.
* @return
*/
public abstract OpenMode getMode() throws MessagingException;
public abstract OpenMode getMode();
public abstract boolean create(FolderType type) throws MessagingException;
@ -151,7 +151,7 @@ public abstract class Folder
public abstract String getName();
public abstract Flag[] getPermanentFlags() throws MessagingException;
public abstract Flag[] getPermanentFlags();
/**
*

View File

@ -84,7 +84,7 @@ public abstract class Message implements Part, Body
return mFolder;
}
public abstract String getSubject() throws MessagingException;
public abstract String getSubject();
public abstract void setSubject(String subject) throws MessagingException;
@ -115,11 +115,11 @@ public abstract class Message implements Part, Body
});
}
public abstract Address[] getFrom() throws MessagingException;
public abstract Address[] getFrom();
public abstract void setFrom(Address from) throws MessagingException;
public abstract Address[] getReplyTo() throws MessagingException;
public abstract Address[] getReplyTo();
public abstract void setReplyTo(Address[] from) throws MessagingException;
@ -131,7 +131,7 @@ public abstract class Message implements Part, Body
public abstract void setReferences(String references) throws MessagingException;
public abstract Body getBody() throws MessagingException;
public abstract Body getBody();
public abstract String getContentType() throws MessagingException;

View File

@ -14,48 +14,39 @@ public abstract class Multipart implements Body
protected String mContentType;
public void addBodyPart(BodyPart part) throws MessagingException
{
public void addBodyPart(BodyPart part) {
mParts.add(part);
}
public void addBodyPart(BodyPart part, int index) throws MessagingException
{
public void addBodyPart(BodyPart part, int index) {
mParts.add(index, part);
}
public BodyPart getBodyPart(int index) throws MessagingException
{
public BodyPart getBodyPart(int index) {
return mParts.get(index);
}
public String getContentType() throws MessagingException
{
public String getContentType() {
return mContentType;
}
public int getCount() throws MessagingException
{
public int getCount() {
return mParts.size();
}
public boolean removeBodyPart(BodyPart part) throws MessagingException
{
public boolean removeBodyPart(BodyPart part) {
return mParts.remove(part);
}
public void removeBodyPart(int index) throws MessagingException
{
public void removeBodyPart(int index) {
mParts.remove(index);
}
public Part getParent() throws MessagingException
{
public Part getParent() {
return mParent;
}
public void setParent(Part parent) throws MessagingException
{
public void setParent(Part parent) {
this.mParent = parent;
}

View File

@ -12,7 +12,7 @@ public interface Part
public void setHeader(String name, String value) throws MessagingException;
public Body getBody() throws MessagingException;
public Body getBody();
public String getContentType() throws MessagingException;
@ -22,7 +22,7 @@ public interface Part
public String[] getHeader(String name) throws MessagingException;
public int getSize() throws MessagingException;
public int getSize();
public boolean isMimeType(String mimeType) throws MessagingException;

View File

@ -101,7 +101,7 @@ public abstract class Store
return (LocalStore) store;
}
public abstract Folder getFolder(String name) throws MessagingException;
public abstract Folder getFolder(String name);
public abstract List<? extends Folder> getPersonalNamespaces(boolean forceListAll) throws MessagingException;

View File

@ -33,5 +33,5 @@ public abstract class Transport
public abstract void sendMessage(Message message) throws MessagingException;
public abstract void close() throws MessagingException;
public abstract void close();
}

View File

@ -24,8 +24,7 @@ public class BinaryTempFileBody implements Body
mTempDirectory = tempDirectory;
}
public BinaryTempFileBody() throws IOException
{
public BinaryTempFileBody() {
if (mTempDirectory == null)
{
throw new

View File

@ -39,8 +39,7 @@ public class MimeBodyPart extends BodyPart
setBody(body);
}
protected String getFirstHeader(String name) throws MessagingException
{
protected String getFirstHeader(String name) {
return mHeader.getFirstHeader(name);
}
@ -64,8 +63,7 @@ public class MimeBodyPart extends BodyPart
mHeader.removeHeader(name);
}
public Body getBody() throws MessagingException
{
public Body getBody() {
return mBody;
}
@ -149,8 +147,7 @@ public class MimeBodyPart extends BodyPart
return getMimeType().equals(mimeType);
}
public int getSize() throws MessagingException
{
public int getSize() {
return mSize;
}

View File

@ -111,8 +111,7 @@ public class MimeHeader
mFields.removeAll(removeFields);
}
public void writeTo(OutputStream out) throws IOException, MessagingException
{
public void writeTo(OutputStream out) throws IOException {
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out), 1024);
for (Field field : mFields)
{

View File

@ -121,8 +121,7 @@ public class MimeMessage extends Message
addSentDate(sentDate);
}
public void setInternalSentDate(Date sentDate) throws MessagingException
{
public void setInternalSentDate(Date sentDate) {
this.mSentDate = sentDate;
}
@ -161,8 +160,7 @@ public class MimeMessage extends Message
return MimeUtility.getHeaderParameter(getContentType(), null);
}
public int getSize() throws MessagingException
{
public int getSize() {
return mSize;
}
@ -255,8 +253,7 @@ public class MimeMessage extends Message
* Returns the unfolded, decoded value of the Subject header.
*/
@Override
public String getSubject() throws MessagingException
{
public String getSubject() {
return MimeUtility.unfoldAndDecode(getFirstHeader("Subject"));
}
@ -267,8 +264,7 @@ public class MimeMessage extends Message
}
@Override
public Address[] getFrom() throws MessagingException
{
public Address[] getFrom() {
if (mFrom == null)
{
String list = MimeUtility.unfold(getFirstHeader("From"));
@ -299,8 +295,7 @@ public class MimeMessage extends Message
}
@Override
public Address[] getReplyTo() throws MessagingException
{
public Address[] getReplyTo() {
if (mReplyTo == null)
{
mReplyTo = Address.parse(MimeUtility.unfold(getFirstHeader("Reply-to")));
@ -410,8 +405,7 @@ public class MimeMessage extends Message
}
@Override
public Body getBody() throws MessagingException
{
public Body getBody() {
return mBody;
}
@ -649,14 +643,8 @@ public class MimeMessage extends Message
{
sb.append((char)b);
}
try
{
((MimeMultipart)stack.peek()).setPreamble(sb.toString());
}
catch (MessagingException me)
{
throw new Error(me);
}
((MimeMultipart)stack.peek()).setPreamble(sb.toString());
}
public void raw(InputStream is) throws IOException

View File

@ -54,24 +54,20 @@ public class MimeMultipart extends Multipart
return sb.toString().toUpperCase();
}
public String getPreamble() throws MessagingException
{
public String getPreamble() {
return mPreamble;
}
public void setPreamble(String preamble) throws MessagingException
{
public void setPreamble(String preamble) {
this.mPreamble = preamble;
}
@Override
public String getContentType() throws MessagingException
{
public String getContentType() {
return mContentType;
}
public void setSubType(String subType) throws MessagingException
{
public void setSubType(String subType) {
this.mSubType = subType;
mContentType = String.format("multipart/%s; boundary=\"%s\"", subType, mBoundary);
}

View File

@ -216,8 +216,7 @@ public class ImapStore extends Store
}
@Override
public Folder getFolder(String name) throws MessagingException
{
public Folder getFolder(String name) {
ImapFolder folder;
synchronized (mFolderCache)
{
@ -667,8 +666,7 @@ public class ImapStore extends Store
}
@Override
public OpenMode getMode() throws MessagingException
{
public OpenMode getMode() {
return mMode;
}
@ -1497,8 +1495,7 @@ public class ImapStore extends Store
}
@Override
public Flag[] getPermanentFlags() throws MessagingException
{
public Flag[] getPermanentFlags() {
return PERMANENT_FLAGS;
}
@ -2015,9 +2012,7 @@ public class ImapStore extends Store
}
}
private MessagingException ioExceptionHandler(ImapConnection connection, IOException ioe)
throws MessagingException
{
private MessagingException ioExceptionHandler(ImapConnection connection, IOException ioe) {
Log.e(K9.LOG_TAG, "IOException for " + getLogId(), ioe);
if (connection != null)
{
@ -2587,8 +2582,7 @@ public class ImapStore extends Store
return readResponse(null);
}
private ImapResponse readResponse(ImapResponseParser.IImapResponseCallback callback) throws IOException, MessagingException
{
private ImapResponse readResponse(ImapResponseParser.IImapResponseCallback callback) throws IOException {
try
{
ImapResponse response = mParser.readResponse(callback);
@ -2865,7 +2859,7 @@ public class ImapStore extends Store
}
private void sendContinuation(String continuation)
throws MessagingException, IOException
throws IOException
{
ImapConnection conn = mConnection;
if (conn != null)

View File

@ -947,8 +947,7 @@ public class LocalStore extends Store implements Serializable, LocalStoreMigrati
}
@Override
public LocalFolder getFolder(String name) throws MessagingException
{
public LocalFolder getFolder(String name) {
return new LocalFolder(name);
}
@ -1805,8 +1804,7 @@ public class LocalStore extends Store implements Serializable, LocalStoreMigrati
}
@Override
public OpenMode getMode() throws MessagingException
{
public OpenMode getMode() {
return OpenMode.READ_WRITE;
}
@ -3572,8 +3570,7 @@ public class LocalStore extends Store implements Serializable, LocalStoreMigrati
}
@Override
public Flag[] getPermanentFlags() throws MessagingException
{
public Flag[] getPermanentFlags() {
return PERMANENT_FLAGS;
}
@ -5892,8 +5889,7 @@ public class LocalStore extends Store implements Serializable, LocalStoreMigrati
super(body);
}
public LocalTextBody(String body, String bodyForDisplay) throws MessagingException
{
public LocalTextBody(String body, String bodyForDisplay) {
super(body);
this.mBodyForDisplay = bodyForDisplay;
}
@ -5931,8 +5927,7 @@ public class LocalStore extends Store implements Serializable, LocalStoreMigrati
{
}
LocalMessage(String uid, Folder folder) throws MessagingException
{
LocalMessage(String uid, Folder folder) {
this.mUid = uid;
this.mFolder = folder;
}
@ -6344,8 +6339,7 @@ public class LocalStore extends Store implements Serializable, LocalStoreMigrati
}
}
private void updateFolderCountsOnFlag(Flag flag, boolean set) throws MessagingException
{
private void updateFolderCountsOnFlag(Flag flag, boolean set) {
/*
* Update the unread count on the folder.
*/

View File

@ -147,8 +147,7 @@ public class Pop3Store extends Store
}
@Override
public Folder getFolder(String name) throws MessagingException
{
public Folder getFolder(String name) {
Folder folder = mFolders.get(name);
if (folder == null)
{
@ -330,8 +329,7 @@ public class Pop3Store extends Store
}
@Override
public OpenMode getMode() throws MessagingException
{
public OpenMode getMode() {
return OpenMode.READ_WRITE;
}
@ -863,8 +861,7 @@ public class Pop3Store extends Store
}
@Override
public Flag[] getPermanentFlags() throws MessagingException
{
public Flag[] getPermanentFlags() {
return PERMANENT_FLAGS;
}
@ -985,8 +982,7 @@ public class Pop3Store extends Store
mOut.flush();
}
private Pop3Capabilities getCapabilities() throws IOException, MessagingException
{
private Pop3Capabilities getCapabilities() throws IOException {
Pop3Capabilities capabilities = new Pop3Capabilities();
try
{
@ -1103,8 +1099,7 @@ public class Pop3Store extends Store
class Pop3Message extends MimeMessage
{
public Pop3Message(String uid, Pop3Folder folder) throws MessagingException
{
public Pop3Message(String uid, Pop3Folder folder) {
mUid = uid;
mFolder = folder;
mSize = -1;

View File

@ -550,8 +550,7 @@ public class StorageManager
* @return Whether the specified file matches a filesystem root.
* @throws IOException
*/
public static boolean isMountPoint(final File file) throws IOException
{
public static boolean isMountPoint(final File file) {
for (final File root : File.listRoots())
{
if (root.equals(file))

View File

@ -349,8 +349,7 @@ public class WebDavStore extends Store
}
@Override
public Folder getFolder(String name) throws MessagingException
{
public Folder getFolder(String name) {
WebDavFolder folder;
if ((folder = this.mFolderList.get(name)) == null)
@ -1273,8 +1272,7 @@ public class WebDavStore extends Store
}
@Override
public OpenMode getMode() throws MessagingException
{
public OpenMode getMode() {
return OpenMode.READ_WRITE;
}
@ -1748,8 +1746,7 @@ public class WebDavStore extends Store
}
@Override
public Flag[] getPermanentFlags() throws MessagingException
{
public Flag[] getPermanentFlags() {
return PERMANENT_FLAGS;
}
@ -1855,15 +1852,9 @@ public class WebDavStore extends Store
try
{
ByteArrayOutputStream out;
try
{
out = new ByteArrayOutputStream(message.getSize());
}
catch (MessagingException e)
{
Log.e(K9.LOG_TAG, "MessagingException while getting size of message: " + e);
out = new ByteArrayOutputStream();
}
out = new ByteArrayOutputStream(message.getSize());
open(OpenMode.READ_WRITE);
EOLConvertingOutputStream msgOut = new EOLConvertingOutputStream(
new BufferedOutputStream(out, 1024));
@ -1952,8 +1943,7 @@ public class WebDavStore extends Store
private String mUrl = "";
WebDavMessage(String uid, Folder folder) throws MessagingException
{
WebDavMessage(String uid, Folder folder) {
this.mUid = uid;
this.mFolder = folder;
}

View File

@ -72,8 +72,7 @@ public class Editor implements android.content.SharedPreferences.Editor
}
}
public void commitChanges() throws Exception
{
public void commitChanges() {
long startTime = System.currentTimeMillis();
Log.i(K9.LOG_TAG, "Committing preference changes");
Runnable committer = new Runnable()

View File

@ -982,8 +982,7 @@ public class MessageProvider extends ContentProvider
K9.registerApplicationAware(new K9.ApplicationAware()
{
@Override
public void initializeComponent(final K9 application) throws Exception
{
public void initializeComponent(final K9 application) {
Log.v(K9.LOG_TAG, "Registering content resolver notifier");
MessagingController.getInstance(application).addListener(new MessagingListener()