[kaffe] CVS kaffe (dalibor): Fix for Jetty 4.2.14

Kaffe CVS cvs-commits at kaffe.org
Wed Nov 12 16:30:03 PST 2003


PatchSet 4162 
Date: 2003/11/13 00:28:01
Author: dalibor
Branch: HEAD
Tag: (none) 
Log:
Fix for Jetty 4.2.14

I've fixed the file URL connection to override getPermission from
URLConnection as Helmer suggested to return a FilePermission.

Jetty 4.2.14 works fine for me when I give pass it a -Dbuild.compiler=kjc on
startup.

Members: 
	ChangeLog:1.1754->1.1755 
	libraries/javalib/gnu/java/net/protocol/file/Connection.java:1.1->1.2 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.1754 kaffe/ChangeLog:1.1755
--- kaffe/ChangeLog:1.1754	Wed Nov 12 22:48:58 2003
+++ kaffe/ChangeLog	Thu Nov 13 00:28:01 2003
@@ -1,3 +1,15 @@
+2003-11-13  Dalibor Topic <robilad at kaffe.org>
+
+	* libraries/javalib/gnu/java/net/protocol/file/Connection.java:
+	Added imports for java.io.FilePermission and 
+	java.security.Permission.
+	(permission) New field.
+	(DEFAULT_PERMISSION) New constant.
+	(Connection) Create a FilePermission with permission to read 
+	from file.
+	(getPermission) Overwrite getPermission to return a 
+	FilePermission.
+
 2003-11-12 Ito Kazumitsu <kaz at maczuka.gcd.org>
 
 	libraries/javalib/profiles/allatonce/all.files,
Index: kaffe/libraries/javalib/gnu/java/net/protocol/file/Connection.java
diff -u kaffe/libraries/javalib/gnu/java/net/protocol/file/Connection.java:1.1 kaffe/libraries/javalib/gnu/java/net/protocol/file/Connection.java:1.2
--- kaffe/libraries/javalib/gnu/java/net/protocol/file/Connection.java:1.1	Wed Oct 29 18:30:49 2003
+++ kaffe/libraries/javalib/gnu/java/net/protocol/file/Connection.java	Thu Nov 13 00:28:03 2003
@@ -44,12 +44,14 @@
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
+import java.io.FilePermission;
 import java.io.InputStream;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.net.ProtocolException;
 import java.net.URL;
 import java.net.URLConnection;
+import java.security.Permission;
 import java.util.AbstractSet;
 import java.util.Iterator;
 import java.util.Set;
@@ -79,7 +81,17 @@
    * OutputStream if we are writing to the file
    */
   private BufferedOutputStream outputStream;
-  
+
+  /**
+   * FilePermission to read the file
+   */
+  private FilePermission permission;
+
+  /**
+   * Default permission for a file
+   */
+  private static final String DEFAULT_PERMISSION = "read";
+
   /**
    * Calls superclass constructor to initialize.
    */
@@ -89,6 +101,8 @@
     
     /* Set up some variables */
     doOutput = false;
+
+    permission = new FilePermission(getURL().getFile(), DEFAULT_PERMISSION);
   }
   
   /**
@@ -193,6 +207,19 @@
       }
   }
 
+
+  /**
+   * This method returns a <code>Permission</code> object representing the
+   * permissions required to access this URL.  This method returns a
+   * <code>java.io.FilePermission</code> for the file's path with a read
+   * permission.
+   *
+   * @return A Permission object
+   */
+  public Permission getPermission() throws IOException
+  {
+    return permission;
+  }
 
   /**
    * Does the resource pointed to actually exist?




More information about the kaffe mailing list