You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Alexei Zakharov (JIRA)" <ji...@apache.org> on 2007/03/02 15:14:50 UTC

[jira] Resolved: (HARMONY-3207) [classlib][io] File.toURI does not add a slash at the end of URI for a directory pathname in some cases.

     [ https://issues.apache.org/jira/browse/HARMONY-3207?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexei Zakharov resolved HARMONY-3207.
--------------------------------------

    Resolution: Fixed

Thanks Elena and Mikhail. I've applied the patch at the revision 513774. Please verify.

> [classlib][io] File.toURI does not add a slash at the end of URI for a directory pathname in some cases.
> --------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-3207
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3207
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Elena Semukhina
>         Assigned To: Alexei Zakharov
>         Attachments: H-3207.patch
>
>
> The spec for File.toURI() reads:
> "If it can be determined that the file denoted by this abstract pathname is a directory, then the resulting URI will end with a slash."
> The spec says the same for File.toURL().
> The following test shows up a case when this does not work properly:
> import java.io.*;
> import java.net.URL;
> import java.net.URI;
> public class TestToURI {
> 	public static void main(String args[]) {
> 		File f = new File("");
> 		try {
> 			URI uri = f.toURI();
> 			URL url = f.toURL();
> 			System.out.println("URI = " + uri); 
> 			System.out.println("URL = " + url); 
> 		}
> 		catch (Exception e) {
> 		} 
> 	}
> }
> Output on RI:
> C:\users\esemukhi\test\lang>java -showversion TestToURI
> java version "1.5.0_10"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_10-b03)
> Java HotSpot(TM) Client VM (build 1.5.0_10-b03, mixed mode)
> URI = file:/C:/users/esemukhi/test/lang/
> URL = file:/C:/users/esemukhi/test/lang
> Output on DRLVM:
> C:\users\esemukhi\test\lang>java -showversion TestToURI
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundatio
> n or its licensors, as applicable.
> java version "1.5.0"
> pre-alpha : not complete or compatible
> svn = r509434, (Feb 20 2007), Windows/ia32/msvc 1310, debug build
> http://incubator.apache.org/harmony
> URI = file:/C:/users/esemukhi/test/lang
> URL = file:/C:/users/esemukhi/test/lang
> File.toURL() does not work according to spec on RI as well. If we want to be compatible to RI, we should fix toURI() at least.
> This affects the behavior of java.net.URLClassloader which relies on the terminal slash in a URL in defining its protocol. It now specifies the protocol of the file in the test as "jar" while it should be "file".

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.