harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vladimir Strigun (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-21) File constructor produces wrong path to absolute path specified relative to root
Date Fri, 30 Dec 2005 14:48:02 GMT
    [ http://issues.apache.org/jira/browse/HARMONY-21?page=comments#action_12361427 ] 

Vladimir Strigun commented on HARMONY-21:
-----------------------------------------

Unfortunately, I have regression with my fix. Next test is failed with my fix:

import java.io.*;

public class Test  {
    public static void main(String[] args) throws Exception {
        System.err.println(new File("\\\\\\a\b").isAbsolute() ? "PASSED" : "FAILED");
    } 
}
=======================
But I have another fix for it. I've check it with different scenarions and it looks like fix
doesn't broke anything. Anyway, we should add additional regression test for the issue.
Here is the fix:
254c254
<                               if ((foundSlash && i == uncIndex && path.charAt(0)
== '/' && pathChar != '\\') || !foundSlash) {
---
>                               if ((foundSlash && i == uncIndex) || !foundSlash)
{
256a257
>                                   if(path.charAt(0) == '/' && pathChar == '\\'
&& separatorChar == '\\' && i == 1) newLength--;


Sorry about it. 

> File constructor produces wrong path to absolute path specified relative to root
> --------------------------------------------------------------------------------
>
>          Key: HARMONY-21
>          URL: http://issues.apache.org/jira/browse/HARMONY-21
>      Project: Harmony
>         Type: Bug
>   Components: Classlib
>     Reporter: Tim Ellison
>     Assignee: Tim Ellison

>
> Specifying an absolute path relative to the root directory produces the wrong final pathname.
> Here's a simple test illustrating the problem:
> 	public void test_File_Constructor() {
> 		File path = new File("/dir/file");
> 		File root = new File("/");
> 		File file = new File(root, "/dir/file");
> 		assertEquals("wrong path result ", path.getPath(), file.getPath());
> 	}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message