changeset 2417:4f6026a597d4

Fixes policy evaluation to match the proprietary JDK.
author andrew
date Fri, 23 Jul 2010 09:24:22 +0100
parents 4ca5c38b3e2c
children 77aec8a143cb
files src/share/classes/sun/security/provider/PolicyFile.java
diffstat 1 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/sun/security/provider/PolicyFile.java	Fri Jul 23 00:17:05 2010 +0100
+++ b/src/share/classes/sun/security/provider/PolicyFile.java	Fri Jul 23 09:24:22 2010 +0100
@@ -1793,6 +1793,27 @@
 
         CodeSource canonCs = cs;
         URL u = cs.getLocation();
+        
+        // If this is a jar protocol url, collapse it to a 
+        // file protocol to process it as per the javadocs
+        if (u != null && u.getProtocol().equals("jar")) {
+            try {
+                String fileURL = "";
+            
+                // remove the initial jar:
+                fileURL = u.getPath();
+            
+                // remove the part after the !
+                fileURL = fileURL.substring(0, fileURL.indexOf('!'));
+                
+                u = new URL(fileURL);
+
+            } catch (Exception e) {
+                // Fail silently. In this case, url stays what it was above
+            }
+            
+        }
+        
         if (u != null && u.getProtocol().equals("file")) {
             boolean isLocalFile = false;
             String host = u.getHost();