String conn;
String midlet;
String filter;
String strSuiteId;
int id;
MIDletSuite next = null;
/*
* Parse the comma separated values -
* " connection, midlet, filter, id"
* " midlet, wakeup, midlet suite ID"
*/
int comma1 = name.indexOf(',', 0);
int comma2 = name.indexOf(',', comma1 + 1);
int comma3 = name.indexOf(',', comma2 + 1);
if (comma3 == -1) {
/* Alarm was triggered */
conn = null;
midlet = name.substring(0, comma1).trim();
strSuiteId = name.substring(comma2+1).trim();
} else {
conn = name.substring(0, comma1).trim();
midlet = name.substring(comma1+1, comma2).trim();
filter = name.substring(comma2+1, comma3).trim();
strSuiteId = name.substring(comma3+1).trim();
}
try {
/*
* IMPL_NOTE: here it's assumed that when a suiteId is converted
* to string the padding zeroes are placed _before_ the value,
* for ex., suiteId 3 is converted into "00000003".
* MIDletSuiteStorage.stringToSuiteId() API should be added later.
*/
id = Integer.parseInt(strSuiteId);
} catch (NumberFormatException nfe) {
id = MIDletSuite.UNUSED_SUITE_ID;
}
try {
/*
* Check to see if the MIDlet is already started.
*/
if (midletProxyList.isMidletInList(id, midlet)) {
if (conn != null) {
checkInConnectionInternal(conn);
}
return;
}
next = storage.getMIDletSuite(id, false);
if (next == null) {
if (conn != null) {
checkInConnectionInternal(conn);
}
return;
}
if ((next.getPushOptions() & PUSH_OPT_WHEN_ONLY_APP) != 0 &&
!onlyAppManagerRunning()) {
if (conn != null) {
checkInConnectionInternal(conn);
}
return;
}
if (!next.permissionToInterrupt(conn)) {
// user does not want the interruption
if (conn != null) {
checkInConnectionInternal(conn);
}
return;
}
if (MIDletSuiteUtils.execute(classSecurityToken, id, midlet,
null)) {
/* We are in SVM mode, destroy all running MIDlets. */
MIDletStateHandler.getMidletStateHandler().destroySuite();
} else if (mvmSingleMidletMode) {
destroyAppMidlets();
}
} catch (Throwable e) {
// Could not launch requested push entry
if (conn != null) {
checkInConnectionInternal(conn);
}
if (Logging.TRACE_ENABLED) {
Logging.trace(e, null);
}
} finally {
if (next != null) {
next.close();
}
}
}