changeset 149:30bb431d877e

8080838: new DevicePermission("\\:-1:\:-1", "open").implies(new DevicePermission("\\:-1:\:-1", "open")) causes an infinite loop Summary: Fixed permission name parser Reviewed-by: snazarki Contributed-by: olga.milovskaya@oracle.com
author snazarki
date Thu, 21 May 2015 13:17:27 +0300
parents 06ce348f358a
children 808c0befc3bd
files src/share/classes/jdk/dio/DeviceMgmtPermission.java src/share/classes/jdk/dio/DevicePermission.java
diffstat 2 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/jdk/dio/DeviceMgmtPermission.java	Thu May 21 13:12:21 2015 +0300
+++ b/src/share/classes/jdk/dio/DeviceMgmtPermission.java	Thu May 21 13:17:27 2015 +0300
@@ -210,9 +210,9 @@
 
         if (!ActionFactory.implies(myActions, permission.getActions())) return false;
 
-        int idx = 0;
+        int idx = -1;
         String name = permission.getName();
-        while (-1 != (idx = name.indexOf(':', idx))) {
+        while (-1 != (idx = name.indexOf(':', idx + 1))) {
             if (idx == 0 || '\\' != name.charAt(idx - 1) ) {
                 break;
             }
@@ -226,9 +226,9 @@
             thatID = name.substring(idx + 1);
         }
 
-        idx = 0;
+        idx = -1;
         name = getName();
-        while (-1 != (idx = name.indexOf(':', idx))) {
+        while (-1 != (idx = name.indexOf(':', idx + 1))) {
             if (idx == 0 || '\\' != name.charAt(idx - 1) ) {
                 break;
             }
--- a/src/share/classes/jdk/dio/DevicePermission.java	Thu May 21 13:12:21 2015 +0300
+++ b/src/share/classes/jdk/dio/DevicePermission.java	Thu May 21 13:17:27 2015 +0300
@@ -266,9 +266,9 @@
 
         if (!ActionFactory.implies(myActions, permission.getActions())) return false;
 
-        int idx = 0;
+        int idx = -1;
         String name = permission.getName();
-        while (-1 != (idx = name.indexOf(':', idx))) {
+        while (-1 != (idx = name.indexOf(':', idx + 1))) {
             if (idx == 0 || '\\' != name.charAt(idx - 1) ) {
                 break;
             }
@@ -282,9 +282,9 @@
             thatChannel = name.substring(idx + 1);
         }
 
-        idx = 0;
+        idx = -1;
         name = getName();
-        while (-1 != (idx = name.indexOf(':', idx))) {
+        while (-1 != (idx = name.indexOf(':', idx + 1))) {
             if (idx == 0 || '\\' != name.charAt(idx - 1) ) {
                 break;
             }