javaruntimes/midp/runtime/javasrc/javax/microedition/midlet/MIDlet.java
branchRCL_3
changeset 83 26b2b12093af
parent 77 7cee158cb8cd
--- a/javaruntimes/midp/runtime/javasrc/javax/microedition/midlet/MIDlet.java	Wed Sep 15 12:05:25 2010 +0300
+++ b/javaruntimes/midp/runtime/javasrc/javax/microedition/midlet/MIDlet.java	Wed Oct 13 14:23:59 2010 +0300
@@ -25,18 +25,14 @@
 import com.nokia.mj.impl.rt.ui.RuntimeUi;
 import com.nokia.mj.impl.rt.ui.RuntimeUiFactory;
 
-import com.nokia.mj.impl.rt.midp.SchemeHandlerBase;
-
 import com.nokia.mj.impl.rt.support.ApplicationInfo;
 
 import com.nokia.mj.impl.security.midp.authorization.AccessControllerFactoryImpl;
 import com.nokia.mj.impl.security.midp.authorization.AccessControllerImpl;
 import com.nokia.mj.impl.security.utils.SecurityPromptMessage;
 
-import com.nokia.mj.impl.utils.Id;
 import com.nokia.mj.impl.utils.Logger;
 
-
 /**
  * A class to be extended by the MIDlet applcation. See MIDP spec for
  * further details.
@@ -59,8 +55,6 @@
      */
     private static boolean mConstructionAllowed = true;
 
-    private static final int DOMAIN_MANUFACTURER_OR_OPERATOR = 1;
-
     /*** ----------------------------- PUBLIC ------------------------------ */
 
     /**
@@ -144,7 +138,6 @@
     {
         Logger.PLOG(Logger.EJavaRuntime,
                     "MIDlet.platformRequest(): " + url);
-
         if (null == url)
         {
             throw new NullPointerException(
@@ -159,30 +152,24 @@
             return false;
         }
 
-        ApplicationInfo appInfo = ApplicationInfo.getInstance();
-        String domain = appInfo.getProtectionDomain();
-
-        // Handling for java scheme.
-        /*if (url.startsWith("java://"))
-        {
-            String handlerName = parseHandlerName(url);
-
-            if (handlerName.equals("taskmanager"))
-            {
-                // Check application is bound either Manufacturer or Operator domain.
-                enforceSecurityDomain(DOMAIN_MANUFACTURER_OR_OPERATOR, domain);
-            }
-
-            return invokeSchemeHandler(handlerName, url);
-        }*/
-
         // If the platform request is used to start arbitrary native application,
         // check that MIDlet is in manufacturer or operator domain
         if (startsArbitraryNativeApp(url))
         {
-            enforceSecurityDomain(DOMAIN_MANUFACTURER_OR_OPERATOR, domain);
+            ApplicationInfo appInfo = ApplicationInfo.getInstance();
+            String domain = appInfo.getProtectionDomain();
+            if ((ApplicationInfo.MANUFACTURER_DOMAIN.equals(domain) != true) &&
+                    (ApplicationInfo.OPERATOR_DOMAIN.equals(domain) != true))
+            {
+                Logger.WLOG(Logger.EJavaRuntime,
+                            "Only manufacturer or operator domain MIDlets can start arbitrary native apps.");
+
+                throw new ConnectionNotFoundException(
+                    "Request allowed only for manufacturer or operator MIDlets");
+            }
         }
 
+
         Logger.ILOG(Logger.EJavaRuntime,
                     "Before handleConfirmationNote()");
 
@@ -295,7 +282,7 @@
     }
 
 
-    private boolean showNote(String aAppName, Id aConfirmationQueryId)
+    private boolean showNote(String aAppName,String aConfirmationQueryId)
     {
         SecurityPromptMessage msg = SecurityPromptMessage.getInstance();
         String queryTxt = msg.getText(aConfirmationQueryId,null);
@@ -335,7 +322,9 @@
             mNoPromptSchemes = new Hashtable();
             mNoPromptSchemes.put("cti:","");
             mNoPromptSchemes.put("mailto:","");
+            mNoPromptSchemes.put("mms:","");
             mNoPromptSchemes.put("mmsto:","");
+            mNoPromptSchemes.put("rtsp:","");
             mNoPromptSchemes.put("sms:","");
             mNoPromptSchemes.put("tel:","");
         }
@@ -374,72 +363,6 @@
         return false;
     }
 
-    private String parseHandlerName(String url) throws ConnectionNotFoundException
-    {
-        // Parse handler name from URL. Remove java:// prefix.
-        String handlerName = url.substring(7).trim();
-
-        // name format: handlername?query
-        int nameEndIndex = handlerName.indexOf('?');
-
-        if (nameEndIndex != -1)
-        {
-            handlerName = handlerName.substring(0, nameEndIndex);
-            return handlerName;
-        }
-        else
-        {
-            throw new ConnectionNotFoundException("Handler not found for URL");
-        }
-    }
-
-    private boolean invokeSchemeHandler(String handlerName, String url)
-        throws ConnectionNotFoundException
-    {
-        try
-        {
-            // Avoid loading whatever class from the system using handler
-            // as package name.
-            Class clazz = Class.forName("com.nokia.mj.impl.rt." + handlerName + ".SchemeHandler");
-
-            SchemeHandlerBase handler = (SchemeHandlerBase)clazz.newInstance();
-
-            handler.execute(url);
-            return false;  // No need to close MIDlet.
-        }
-        catch (Throwable t)
-        {
-            Logger.ELOG(Logger.EJavaRuntime, "Cannot invoke scheme handler: " + t.toString());
-            // ClassNotFoundException, IllegalAccessException or InstantionException.
-            throw new ConnectionNotFoundException("Handler not found for URL");
-        }
-    }
-
-    private void enforceSecurityDomain(int type, String domain)
-        throws ConnectionNotFoundException
-    {
-        if (DOMAIN_MANUFACTURER_OR_OPERATOR == type)
-        {
-            if ((ApplicationInfo.MANUFACTURER_DOMAIN.equals(domain) != true) &&
-                    (ApplicationInfo.OPERATOR_DOMAIN.equals(domain) != true))
-            {
-                Logger.WLOG(Logger.EJavaRuntime,
-                            "Only manufacturer or operator domain MIDlets can invoke scheme");
-
-                throw new ConnectionNotFoundException(
-                    "Request allowed only for manufacturer or operator MIDlets");
-            }
-        }
-        else
-        {
-            Logger.ELOG(Logger.EJavaRuntime,
-                        "Security enforcement failed: unknown domain category");
-
-            throw new ConnectionNotFoundException(
-                "Security enforcement failed: unknown domain category");
-        }
-    }
-
     /*** ----------------------------- NATIVE ----------------------------- */
 
     private native void _managePlatformRequest(String url);