changeset 108:e8935edceafa

8073722: Get rid of JavaME related property read permission Summary: SecurityException is caught Reviewed-by: alkonsta
author snazarki
date Tue, 24 Feb 2015 15:13:16 +0300
parents 42408fd53ee7
children f7d96bd932d8
files src/share/classes/com/oracle/dio/uart/impl/UARTImpl.java
diffstat 1 files changed, 24 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/oracle/dio/uart/impl/UARTImpl.java	Fri Feb 20 13:51:40 2015 +0400
+++ b/src/share/classes/com/oracle/dio/uart/impl/UARTImpl.java	Tue Feb 24 15:13:16 2015 +0300
@@ -25,43 +25,25 @@
 
 package com.oracle.dio.uart.impl;
 
-import java.util.StringTokenizer;
-
-import jdk.dio.ClosedDeviceException;
-import jdk.dio.DeviceNotFoundException;
-
-import jdk.dio.InputRoundListener;
-import jdk.dio.OutputRoundListener;
-import jdk.dio.RoundCompletionEvent;
-
-import jdk.dio.Device;
-import jdk.dio.DeviceManager;
-import jdk.dio.DeviceDescriptor;
-import jdk.dio.DeviceConfig;
-import jdk.dio.UnavailableDeviceException;
-import jdk.dio.InvalidDeviceConfigException;
-import jdk.dio.UnsupportedAccessModeException;
-
 import java.io.*;
 import java.nio.ByteBuffer;
-
-import jdk.dio.uart.*;
-
-import com.oracle.dio.power.impl.PowerManagedBase;
-import com.oracle.dio.utils.Constants;
-import com.oracle.dio.utils.Configuration;
-import com.oracle.dio.utils.ExceptionMessage;
-import com.oracle.dio.utils.Logging;
-
+import java.security.AccessControlException;
+import java.security.AccessController;
 import java.util.Hashtable;
+import java.util.StringTokenizer;
 import java.util.Timer;
 import java.util.TimerTask;
 
+import com.oracle.dio.power.impl.PowerManagedBase;
+import com.oracle.dio.utils.Configuration;
+import com.oracle.dio.utils.Constants;
+import com.oracle.dio.utils.ExceptionMessage;
+import com.oracle.dio.utils.Logging;
 import com.oracle.dio.utils.PrivilegeController;
 import com.oracle.dio.utils.PrivilegedAction;
 
-import java.security.AccessController;
-import jdk.dio.DevicePermission;
+import jdk.dio.*;
+import jdk.dio.uart.*;
 
 import romizer.*;
 
@@ -202,21 +184,22 @@
                 devNum = 0;
             }
             // first port in list is DEFAULT port
-            String ports = Configuration.getProperty("microedition.commports");
-            if (ports == null) {
-                ports = Configuration.getProperty("jdk.dio.uart.ports");
+            try {
+                String ports = Configuration.getProperty("microedition.commports");
+                if (null != ports) {
+                    StringTokenizer t = new StringTokenizer(ports, ",");
+                    while(devNum-- > 0 && t.hasMoreTokens()) {
+                        t.nextToken();
+                    }
+                    // if no more tokens - returns null
+                    if (t.hasMoreTokens()) {
+                        securityName = t.nextToken();
+                    }
+                }
+            } catch (AccessControlException  e) {
+                // SE app must not be aware about ME property
             }
 
-            if (null != ports) {
-                StringTokenizer t = new StringTokenizer(ports, ",");
-                while(devNum-- > 0 && t.hasMoreTokens()) {
-                    t.nextToken();
-                }
-                // if no more tokens - returns null
-                if (t.hasMoreTokens()) {
-                    securityName = t.nextToken();
-                }
-            }
         }
 
         return securityName;