public inbox for java-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Anthony Green <green@redhat.com>
To: java-patches@gcc.gnu.org
Subject: [Fwd: Patch: file resources require canonicalized names]
Date: Fri, 16 Sep 2005 22:59:00 -0000	[thread overview]
Message-ID: <1126911585.3011.36.camel@dhcp-172-16-25-146.sfbay.redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 198 bytes --]

I just checked a comparable patch into FSF HEAD for
libgcj/java/net/URLClassLoader.java, but not
libgcj/classpath/java/net/URLClassLoader.java.  I hope that was the
right thing to do.

Thanks,

AG


[-- Attachment #2: Forwarded message - Patch: file resources require canonicalized names --]
[-- Type: message/rfc822, Size: 1548 bytes --]

From: Anthony Green <green@redhat.com>
To: classpath-patches <classpath-patches@gnu.org>
Subject: Patch: file resources require canonicalized names
Date: Fri, 16 Sep 2005 15:51:50 -0700
Message-ID: <1126911109.3011.33.camel@dhcp-172-16-25-146.sfbay.redhat.com>

I just checked in the following patch, which was approved by tromey.

2005-09-15  Anthony Green  <green@redhat.com>

	PR libgcj/20198
	* java/net/URLClassLoader.java (FileURLLoader.getResource): File
	resources should all have canonicalized names.


Index: java/net/URLClassLoader.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/net/URLClassLoader.java,v
retrieving revision 1.36
diff -u -r1.36 URLClassLoader.java
--- java/net/URLClassLoader.java	9 Sep 2005 21:42:58 -0000	1.36
+++ java/net/URLClassLoader.java	16 Sep 2005 22:48:33 -0000
@@ -535,9 +535,16 @@
     /** get resource with the name "name" in the file url */
     Resource getResource(String name)
     {
-      File file = new File(dir, name);
-      if (file.exists() && !file.isDirectory())
-        return new FileResource(this, name, file);
+      try 
+	{
+	  File file = new File(dir, name).getCanonicalFile();
+	  if (file.exists() && !file.isDirectory())
+	    return new FileResource(this, file.path(), file);
+	}
+      catch (IOException e)
+	{
+	  // Fall through...
+	}
       return null;
     }
   }


             reply	other threads:[~2005-09-16 22:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-16 22:59 Anthony Green [this message]
2005-09-17  0:16 ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1126911585.3011.36.camel@dhcp-172-16-25-146.sfbay.redhat.com \
    --to=green@redhat.com \
    --cc=java-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).