summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew John Hughes <gnu_andrew@member.fsf.org>2011-03-06 18:17:35 +0000
committerAndrew John Hughes <gnu_andrew@member.fsf.org>2011-03-06 18:17:35 +0000
commitc66bb894bbb5b92fee599155b29d9081567e379a (patch)
tree71dcb693753060fac4ed976fe5abb37275b621a5
parent749bd1d71b3ae5a64bde7440a87808536ee24823 (diff)
downloadclasspath-c66bb894bbb5b92fee599155b29d9081567e379a.tar.gz
PR classpath/42390: Don't include permissions of the Policy in toString() output if reading them is prohibited.
2011-02-22 Andrew John Hughes <ahughes@redhat.com> PR classpath/42390 * java/security/ProtectionDomain.java: (toString()): Don't include permissions from the policy if we don't have permission to read it.
-rw-r--r--ChangeLog8
-rw-r--r--java/security/ProtectionDomain.java10
2 files changed, 17 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 2b9cb5c4d..823be7929 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-02-22 Andrew John Hughes <ahughes@redhat.com>
+
+ PR classpath/42390
+ * java/security/ProtectionDomain.java:
+ (toString()): Don't include permissions from
+ the policy if we don't have permission to read
+ it.
+
2011-03-02 Pekka Enberg <penberg@kernel.org>
* java/util/regex/Matcher:
diff --git a/java/security/ProtectionDomain.java b/java/security/ProtectionDomain.java
index 9af87c64a..7be5875dc 100644
--- a/java/security/ProtectionDomain.java
+++ b/java/security/ProtectionDomain.java
@@ -255,7 +255,15 @@ public class ProtectionDomain
sb.append(linesep);
if (!staticBinding) // include all but dont force loading Policy.currentPolicy
if (Policy.isLoaded())
- sb.append(Policy.getCurrentPolicy().getPermissions(this));
+ try
+ {
+ sb.append(Policy.getPolicy().getPermissions(this));
+ }
+ catch (SecurityException e)
+ {
+ // We are not allowed access to the policy.
+ sb.append(perms);
+ }
else // fallback on this one's permissions
sb.append(perms);
else