diff -r 35baca0e7a2e -r 023eef975703 javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/PrepareInstallation.java --- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/PrepareInstallation.java Tue Jul 06 20:36:19 2010 +0300 +++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/PrepareInstallation.java Fri Jul 09 16:35:45 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -37,6 +37,7 @@ import com.nokia.mj.impl.installer.utils.SysUtil; import com.nokia.mj.impl.security.midp.authentication.AuthenticationModule; import com.nokia.mj.impl.security.midp.authentication.OcspSettings; +import com.nokia.mj.impl.fileutils.FileURL; import com.nokia.mj.impl.utils.Uid; public class PrepareInstallation extends ExeStep @@ -170,6 +171,11 @@ { aBall.iJarUrl = jarArg; } + else if (isFileUrl(jarArg)) + { + aBall.iJarFilename = getFileFromUrl(jarArg); + Log.log("Jar " + aBall.iJarFilename + " from URL " + jarArg); + } else { aBall.iJarFilename = jarArg; @@ -181,6 +187,11 @@ { aBall.iJadUrl = jadArg; } + else if (isFileUrl(jadArg)) + { + aBall.iJadFilename = getFileFromUrl(jadArg); + Log.log("Jad " + aBall.iJadFilename + " from URL " + jadArg); + } else { aBall.iJadFilename = jadArg; @@ -346,4 +357,36 @@ Log.log("ocspSettings: " + ocspSettings); return ocspSettings; } + + /** + * Returns true if given URL is a file URL, false otherwise. + */ + private static boolean isFileUrl(String aUrl) + { + if (aUrl == null || aUrl.length() == 0) + { + return false; + } + return aUrl.toLowerCase().startsWith("file://"); + } + + /** + * Returns a file path from file URL. + * + * @throws InstallerException if URL is invalid. + */ + private static String getFileFromUrl(String aUrl) + { + String filePath = null; + try + { + FileURL fileUrl = new FileURL(aUrl); + filePath = fileUrl.getFullPath(); + } + catch (Throwable t) + { + InstallerException.internalError("Invalid file URL: " + aUrl, t); + } + return filePath; + } }