* properly formatted or does not contain the required
*/
private void installStep5()
throws IOException, InvalidJadException {
int bytesDownloaded;
MIDletInfo midletInfo;
String midlet;
// Send out delete notifications that have been queued, first
OtaNotifier.postQueuedDeleteMsgsBackToProvider(state.proxyUsername,
state.proxyPassword);
// Save jar file to temp name; we need to do this to read the
// manifest entry, but, don't want to overwrite an existing
// application in case there are problems with the manifest
state.storageRoot = File.getStorageRoot(state.storageId);
info.jarFilename = state.storageRoot + TMP_FILENAME;
bytesDownloaded = downloadJAR(info.jarFilename);
if (state.exception != null) {
return;
}
try {
state.storage = new RandomAccessStream();
state.installInfo.authPath =
verifier.verifyJar(state.storage, info.jarFilename);
if (state.listener != null) {
state.listener.updateStatus(VERIFYING_SUITE, state);
}
// Create JAR Properties (From .jar file's MANIFEST)
try {
state.manifest = JarReader.readJarEntry(token,
info.jarFilename, MIDletSuite.JAR_MANIFEST);
if (state.manifest == null) {
postInstallMsgBackToProvider(
OtaNotifier.INVALID_JAR_MSG);
throw new
InvalidJadException(InvalidJadException.CORRUPT_JAR,
MIDletSuite.JAR_MANIFEST);
}
} catch (OutOfMemoryError e) {
try {
postInstallMsgBackToProvider(
OtaNotifier.INSUFFICIENT_MEM_MSG);
} catch (Throwable t) {
if (Logging.REPORT_LEVEL <= Logging.WARNING) {
Logging.report(Logging.WARNING, LogChannels.LC_AMS,
"Throwable during posting the install message");
}
}
throw new
InvalidJadException(InvalidJadException.TOO_MANY_PROPS);
} catch (IOException ioe) {
postInstallMsgBackToProvider(
OtaNotifier.INVALID_JAR_MSG);
throw new
InvalidJadException(InvalidJadException.CORRUPT_JAR,
MIDletSuite.JAR_MANIFEST);
}
state.jarProps = new ManifestProperties();
try {
// JarFile jarFile = new JarFile(new java.io.File(info.jarFilename));
// Manifest manifest = jarFile.getManifest();
// state.jarProps.readFromAttributes(manifest.getMainAttributes());
state.jarProps.load(new ByteArrayInputStream(state.manifest));
state.manifest = null;
} catch (OutOfMemoryError e) {
state.manifest = null;
try {
postInstallMsgBackToProvider(
OtaNotifier.INSUFFICIENT_MEM_MSG);
} catch (Throwable t) {
if (Logging.REPORT_LEVEL <= Logging.WARNING) {
Logging.report(Logging.WARNING, LogChannels.LC_AMS,
"Throwable while posting install message ");
}
}
throw new
InvalidJadException(InvalidJadException.TOO_MANY_PROPS);
} catch (InvalidJadException ije) {
state.manifest = null;
try {
postInstallMsgBackToProvider(
OtaNotifier.INVALID_JAR_MSG);
} catch (Throwable t) {
// ignore
}
throw ije;
}
for (int i = 1; ; i++) {
midlet = state.getAppProperty("MIDlet-" + i);
if (midlet == null) {
break;
}
/*
* Verify the MIDlet class is present in the JAR
* An exception thrown if not.
* Do the proper install notify on an exception
*/
try {
midletInfo = new MIDletInfo(midlet);
verifyMIDlet(midletInfo.classname);
} catch (InvalidJadException ije) {
if (ije.getReason() == InvalidJadException.INVALID_VALUE) {
postInstallMsgBackToProvider(