Use IllegalArgumentException, not InvalidParameterException
Because IllegalArgumentException is the standard one. Change-Id: Ib4d0bfa88a3d4218148a7cb248d9baa2124a72ba
This commit is contained in:
parent
7e1fa63d75
commit
54c91f00d7
|
@ -31,8 +31,6 @@ import android.os.Parcel;
|
|||
import android.os.Parcelable;
|
||||
import android.util.Log;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
|
||||
public class Mailbox extends EmailContent implements SyncColumns, MailboxColumns, Parcelable {
|
||||
public static final String TABLE_NAME = "Mailbox";
|
||||
@SuppressWarnings("hiding")
|
||||
|
@ -407,7 +405,7 @@ public class Mailbox extends EmailContent implements SyncColumns, MailboxColumns
|
|||
*/
|
||||
public static boolean canMoveFrom(Context context, long mailboxId) {
|
||||
if (mailboxId < 0) {
|
||||
throw new InvalidParameterException();
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
Uri url = ContentUris.withAppendedId(Mailbox.CONTENT_URI, mailboxId);
|
||||
int type = Utility.getFirstRowInt(context, url, MAILBOX_TYPE_PROJECTION,
|
||||
|
|
|
@ -58,7 +58,6 @@ import android.util.Log;
|
|||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
|
@ -797,7 +796,7 @@ public class Controller {
|
|||
public EmailAsyncTask<Void, Void, Void> moveMessages(final long[] messageIds,
|
||||
final long newMailboxId) {
|
||||
if (messageIds == null || messageIds.length == 0) {
|
||||
throw new InvalidParameterException();
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
return EmailAsyncTask.runAsyncParallel(new Runnable() {
|
||||
public void run() {
|
||||
|
|
|
@ -24,7 +24,6 @@ import android.content.Context;
|
|||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
|
@ -194,14 +193,14 @@ public class RefreshManager {
|
|||
|
||||
public void registerListener(Listener listener) {
|
||||
if (listener == null) {
|
||||
throw new InvalidParameterException();
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
mListeners.add(listener);
|
||||
}
|
||||
|
||||
public void unregisterListener(Listener listener) {
|
||||
if (listener == null) {
|
||||
throw new InvalidParameterException();
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
mListeners.remove(listener);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ import com.android.emailcommon.Logging;
|
|||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
|
@ -84,7 +83,7 @@ public class Throttle {
|
|||
/* package */ Throttle(String name, Runnable callback, Handler handler,int minTimeout,
|
||||
int maxTimeout, Clock clock, Timer timer) {
|
||||
if (maxTimeout < minTimeout) {
|
||||
throw new InvalidParameterException();
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
mName = name;
|
||||
mCallback = callback;
|
||||
|
|
|
@ -50,7 +50,6 @@ import android.view.MenuItem;
|
|||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
|
@ -113,7 +112,7 @@ public class EmailActivity extends Activity implements View.OnClickListener {
|
|||
public static Intent createOpenMailboxIntent(Activity fromActivity, long accountId,
|
||||
long mailboxId) {
|
||||
if (accountId == -1 || mailboxId == -1) {
|
||||
throw new InvalidParameterException();
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
Intent i = IntentUtilities.createRestartAppIntent(fromActivity, EmailActivity.class);
|
||||
i.putExtra(EXTRA_ACCOUNT_ID, accountId);
|
||||
|
@ -132,7 +131,7 @@ public class EmailActivity extends Activity implements View.OnClickListener {
|
|||
public static Intent createOpenMessageIntent(Activity fromActivity, long accountId,
|
||||
long mailboxId, long messageId) {
|
||||
if (accountId == -1 || mailboxId == -1 || messageId == -1) {
|
||||
throw new InvalidParameterException();
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
Intent i = IntentUtilities.createRestartAppIntent(fromActivity, EmailActivity.class);
|
||||
i.putExtra(EXTRA_ACCOUNT_ID, accountId);
|
||||
|
|
|
@ -52,7 +52,6 @@ import android.widget.AdapterView;
|
|||
import android.widget.AdapterView.OnItemClickListener;
|
||||
import android.widget.ListView;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
|
@ -218,7 +217,7 @@ public class MailboxListFragment extends ListFragment implements OnItemClickList
|
|||
*/
|
||||
public static MailboxListFragment newInstance(long accountId, long parentMailboxId) {
|
||||
if (accountId == Account.PSEUDO_ACCOUNT_ID_NONE) {
|
||||
throw new InvalidParameterException();
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
final MailboxListFragment instance = new MailboxListFragment();
|
||||
final Bundle args = new Bundle();
|
||||
|
|
|
@ -27,8 +27,6 @@ import android.net.Uri;
|
|||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
|
||||
/**
|
||||
* A {@link MessageViewFragmentBase} subclass for file based messages. (aka EML files)
|
||||
*/
|
||||
|
@ -84,7 +82,7 @@ public class MessageFileViewFragment extends MessageViewFragmentBase {
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
if (fileEmailUri == null) {
|
||||
throw new InvalidParameterException();
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
mFileEmailUri = fileEmailUri;
|
||||
}
|
||||
|
|
|
@ -69,7 +69,6 @@ import android.widget.ListView;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -249,17 +248,17 @@ public class MessageListFragment extends ListFragment
|
|||
public static MessageListFragment newInstance(long accountId, long mailboxId) {
|
||||
// sanity check
|
||||
if ((accountId == Account.PSEUDO_ACCOUNT_ID_NONE) || (mailboxId == Mailbox.NO_MAILBOX)) {
|
||||
throw new InvalidParameterException();
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
if (accountId == Account.ACCOUNT_ID_COMBINED_VIEW) {
|
||||
// must be a combined mailbox.
|
||||
if (mailboxId >= 0) {
|
||||
throw new InvalidParameterException();
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
} else {
|
||||
// must be a regular mailbox.
|
||||
if (mailboxId <= 0) {
|
||||
throw new InvalidParameterException();
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
}
|
||||
final MessageListFragment instance = new MessageListFragment();
|
||||
|
|
|
@ -41,8 +41,6 @@ import android.widget.CheckBox;
|
|||
import android.widget.CompoundButton;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
|
||||
/**
|
||||
* A {@link MessageViewFragmentBase} subclass for regular email messages. (regular as in "not eml
|
||||
* files").
|
||||
|
@ -139,7 +137,7 @@ public class MessageViewFragment extends MessageViewFragmentBase
|
|||
*/
|
||||
public static MessageViewFragment newInstance(long messageId) {
|
||||
if (messageId == -1) {
|
||||
throw new InvalidParameterException();
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
final MessageViewFragment instance = new MessageViewFragment();
|
||||
final Bundle args = new Bundle();
|
||||
|
|
|
@ -39,8 +39,6 @@ import android.os.Bundle;
|
|||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
|
||||
/**
|
||||
* "Move (messages) to" dialog.
|
||||
*
|
||||
|
@ -79,7 +77,7 @@ public class MoveMessageToDialog extends DialogFragment implements DialogInterfa
|
|||
public static <T extends Fragment & Callback> MoveMessageToDialog newInstance(long[] messageIds,
|
||||
T callbackFragment) {
|
||||
if (messageIds.length == 0) {
|
||||
throw new InvalidParameterException();
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
if (callbackFragment == null) {
|
||||
throw new IllegalArgumentException(); // fail fast
|
||||
|
|
|
@ -29,14 +29,12 @@ import com.android.emailcommon.utility.EmailAsyncTask;
|
|||
import com.android.emailcommon.utility.Utility;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Fragment;
|
||||
import android.app.FragmentManager;
|
||||
import android.app.FragmentTransaction;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.Set;
|
||||
import java.util.Stack;
|
||||
|
||||
|
@ -679,7 +677,7 @@ class UIControllerTwoPane extends UIControllerBase implements
|
|||
}
|
||||
preFragmentTransactionCheck();
|
||||
if (accountId == NO_ACCOUNT) {
|
||||
throw new InvalidParameterException();
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
// TODO Check if the current fragment has been initialized with the same parameters, and
|
||||
|
@ -734,7 +732,7 @@ class UIControllerTwoPane extends UIControllerBase implements
|
|||
}
|
||||
preFragmentTransactionCheck();
|
||||
if (mailboxId == 0 || mailboxId == -1) {
|
||||
throw new InvalidParameterException();
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
// TODO Check if the current fragment has been initialized with the same parameters, and
|
||||
|
@ -772,7 +770,7 @@ class UIControllerTwoPane extends UIControllerBase implements
|
|||
}
|
||||
preFragmentTransactionCheck();
|
||||
if (messageId == NO_MESSAGE) {
|
||||
throw new InvalidParameterException();
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
// TODO Check if the current fragment has been initialized with the same parameters, and
|
||||
|
|
|
@ -23,8 +23,6 @@ import com.android.emailcommon.provider.Mailbox;
|
|||
import android.content.AsyncTaskLoader;
|
||||
import android.content.Context;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
|
||||
|
||||
/**
|
||||
* Loader to load {@link Mailbox} and {@link Account}.
|
||||
|
@ -55,7 +53,7 @@ public class MailboxAccountLoader extends AsyncTaskLoader<MailboxAccountLoader.R
|
|||
public MailboxAccountLoader(Context context, long mailboxId) {
|
||||
super(context);
|
||||
if (mailboxId == -1) {
|
||||
throw new InvalidParameterException();
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
mContext = context;
|
||||
mMailboxId = mailboxId;
|
||||
|
|
Loading…
Reference in New Issue