Re: [PATCH] Small fix for Jetty 4.2.14

2003-11-13 Thread Mark Wielaard
Hi,

On Thu, 2003-11-13 at 01:29, Dalibor Topic wrote:
 Hi,
 
 attached is a small fix for Jetty 4.2.14 that is needed to get Jetty to 
 work with Classpath's file URL Connection. Jetty otherwise breaks on 
 startup and complains that webapps/templates can not be found, despite 
 that it exists. Jetty wants to access the path of the file permission on 
 a file URL connection to determine the existence of a file, apparently.
 
 The fix overwrites getPermission the file URL connection to return a 
 FilePermission with the file path and a read permission.

Thanks. I also wrote a Mauve test for this.
(The test still fails because our file Handler.parseURL() seem broken.
But if that is fixed, your patch makes the new Mauve test succeed.)

2003-11-13  Dalibor Topic [EMAIL PROTECTED]
 
 * 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.
 

Applied as follows:

2003-11-13  Dalibor Topic [EMAIL PROTECTED]

   * gnu/java/net/protocol/file/Connection.java (permission): New field.
   (DEFAULT_PERMISSION): New constant.
   (Connection): Create a FilePermission with permission to read file.
   (getPermission): Overwrite getPermission to return a FilePermission.

You don't need to mention really trivial changes such as new imports.
Note the placement of the ':' between what was changed and the
description of the change.

Maybe kaffe could in the long run switch to a separate ChangeLog file in
the libraries/javalib directory so that we can even share the complete
ChangeLog messages between the projects as we already do with gcj
libjava.

Cheers,

Mark


signature.asc
Description: This is a digitally signed message part
___
Classpath mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/classpath


[PATCH] Small fix for Jetty 4.2.14

2003-11-12 Thread Dalibor Topic
Hi,

attached is a small fix for Jetty 4.2.14 that is needed to get Jetty to 
work with Classpath's file URL Connection. Jetty otherwise breaks on 
startup and complains that webapps/templates can not be found, despite 
that it exists. Jetty wants to access the path of the file permission on 
a file URL connection to determine the existence of a file, apparently.

The fix overwrites getPermission the file URL connection to return a 
FilePermission with the file path and a read permission.

cheers,
dalibor topic
2003-11-13  Dalibor Topic [EMAIL PROTECTED]

   * 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.
Index: libraries/javalib/gnu/java/net/protocol/file/Connection.java
===
RCS file: 
/cvs/kaffe/kaffe/libraries/javalib/gnu/java/net/protocol/file/Connection.java,v
retrieving revision 1.1
diff -u -r1.1 Connection.java
--- libraries/javalib/gnu/java/net/protocol/file/Connection.java29 Oct 2003 
18:30:49 -  1.1
+++ libraries/javalib/gnu/java/net/protocol/file/Connection.java13 Nov 2003 
00:20:38 -
@@ -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 codePermission/code object representing the
+   * permissions required to access this URL.  This method returns a
+   * codejava.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?
___
Classpath mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/classpath