diff options
author | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2011-03-06 18:17:35 +0000 |
---|---|---|
committer | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2011-03-06 18:17:35 +0000 |
commit | c66bb894bbb5b92fee599155b29d9081567e379a (patch) | |
tree | 71dcb693753060fac4ed976fe5abb37275b621a5 | |
parent | 749bd1d71b3ae5a64bde7440a87808536ee24823 (diff) | |
download | classpath-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-- | ChangeLog | 8 | ||||
-rw-r--r-- | java/security/ProtectionDomain.java | 10 |
2 files changed, 17 insertions, 1 deletions
@@ -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 |