// Quick check of filter to be spec complaint
if (filter == null) {
throw new IllegalArgumentException("filter is null");
}
final MIDletSuite midletSuite = getMIDletSuite();
/* This method should only be called by running MIDlets. */
if (midletSuite == null) {
throw new IllegalStateException("Not in a MIDlet context");
}
/*
* Validate parameters and Push connection availability
*/
checkMidlet(midletSuite, midlet);
/*
* IMPL_NOTE: as checkRegistration will need to parse
* connection and filter anyway, it might be a good
* idea to save the results
*/
ConnectionRegistry.checkRegistration(c, midlet, filter);
/*
* Check permissions.
*/
try {
midletSuite.checkForPermission(Permissions.PUSH, null);
} catch (InterruptedException ie) {
throw new InterruptedIOException(
"Interrupted while trying to ask the user permission");
}