You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by "Vladimir Ivanov (JIRA)" <ji...@apache.org> on 2006/01/26 07:08:10 UTC

[jira] Created: (HARMONY-46) Constructor java.io.File(String) creates object with incorrect name if one-letter name is followed by file separator char

Constructor  java.io.File(String) creates object with incorrect name if one-letter name is followed by file separator char
--------------------------------------------------------------------------------------------------------------------------

         Key: HARMONY-46
         URL: http://issues.apache.org/jira/browse/HARMONY-46
     Project: Harmony
        Type: Bug
  Components: Classlib  
    Reporter: Vladimir Ivanov


Constructor  java.io.File(String) creates object with incorrect name if one-letter name is followed by file separator char.

Code to reproduce:
import java.io.*; 
  
public class test29 { 
    public static void main(String args[]) throws Exception { 
	File f1 = new File("a");
	File f2 = new File("a/");
	File f3 = new File("a\\");
	File f4 = new File("aa/");
        System.out.println("f1 name: " + f1.getName() + "\nf2 name: " + f2.getName() + "\nf3 name: " + f3.getName() + "\nf4 name: " + f4.getName()); 
	System.out.println(f1.equals(f2) ? "PASSED" : "FAILED");
    } 
}

Steps to Reproduce: 
1. Build Harmony (check-out on 2006-01-25) j2se subset as described in README.txt. 
2. Compile test29.java using BEA 1.4 javac 
> javac -d . test29.java 
3. Run java using compatible VM (J9) 
> java -showversion test29


Output:
C:\tmp\tmp17>C:\harmony\trunk\deploy\jre\bin\java -showversion test29
java version 1.4.2 (subset)

(c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable.
f1 name: a
f2 name:
f3 name:
f4 name: aa
FAILED

C:\tmp\tmp17>C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion test29
java version "1.4.2_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
BEA WebLogic JRockit(TM) 1.4.2_04 JVM  (build ari-31788-20040616-1132-win-ia32, Native Threads, GC strategy: parallel)

f1 name: a
f2 name: a
f3 name: a
f4 name: aa
PASSED

C:\tmp\tmp17>


junit test:
------------------------ FileTest.java -------------------------------------------------

import java.io.*; 

import junit.framework.*; 
  
public class FileTest extends TestCase { 
    public void testFile_String() { 
	File f1 = new File("a");
	File f2 = new File("a/");
	assertTrue("File name is incorrect! " + f1.getName() + " != " + f2.getName(), f1.equals(f2));
    } 

   public static void main(String[] args) { 
        junit.textui.TestRunner.run(FileTest.class); 
   } 
}


-- 
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


[jira] Closed: (HARMONY-46) Constructor java.io.File(String) creates object with incorrect name if one-letter name is followed by file separator char

Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-46?page=all ]
     
Tim Ellison closed HARMONY-46:
------------------------------


Verified by Vladimir.

> Constructor  java.io.File(String) creates object with incorrect name if one-letter name is followed by file separator char
> --------------------------------------------------------------------------------------------------------------------------
>
>          Key: HARMONY-46
>          URL: http://issues.apache.org/jira/browse/HARMONY-46
>      Project: Harmony
>         Type: Bug
>   Components: Classlib
>     Reporter: Vladimir Ivanov
>     Assignee: Tim Ellison

>
> Constructor  java.io.File(String) creates object with incorrect name if one-letter name is followed by file separator char.
> Code to reproduce:
> import java.io.*; 
>   
> public class test29 { 
>     public static void main(String args[]) throws Exception { 
> 	File f1 = new File("a");
> 	File f2 = new File("a/");
> 	File f3 = new File("a\\");
> 	File f4 = new File("aa/");
>         System.out.println("f1 name: " + f1.getName() + "\nf2 name: " + f2.getName() + "\nf3 name: " + f3.getName() + "\nf4 name: " + f4.getName()); 
> 	System.out.println(f1.equals(f2) ? "PASSED" : "FAILED");
>     } 
> }
> Steps to Reproduce: 
> 1. Build Harmony (check-out on 2006-01-25) j2se subset as described in README.txt. 
> 2. Compile test29.java using BEA 1.4 javac 
> > javac -d . test29.java 
> 3. Run java using compatible VM (J9) 
> > java -showversion test29
> Output:
> C:\tmp\tmp17>C:\harmony\trunk\deploy\jre\bin\java -showversion test29
> java version 1.4.2 (subset)
> (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable.
> f1 name: a
> f2 name:
> f3 name:
> f4 name: aa
> FAILED
> C:\tmp\tmp17>C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion test29
> java version "1.4.2_04"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
> BEA WebLogic JRockit(TM) 1.4.2_04 JVM  (build ari-31788-20040616-1132-win-ia32, Native Threads, GC strategy: parallel)
> f1 name: a
> f2 name: a
> f3 name: a
> f4 name: aa
> PASSED
> C:\tmp\tmp17>
> junit test:
> ------------------------ FileTest.java -------------------------------------------------
> import java.io.*; 
> import junit.framework.*; 
>   
> public class FileTest extends TestCase { 
>     public void testFile_String() { 
> 	File f1 = new File("a");
> 	File f2 = new File("a/");
> 	assertTrue("File name is incorrect! " + f1.getName() + " != " + f2.getName(), f1.equals(f2));
>     } 
>    public static void main(String[] args) { 
>         junit.textui.TestRunner.run(FileTest.class); 
>    } 
> }

-- 
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


[jira] Assigned: (HARMONY-46) Constructor java.io.File(String) creates object with incorrect name if one-letter name is followed by file separator char

Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-46?page=all ]

Tim Ellison reassigned HARMONY-46:
----------------------------------

    Assign To: Tim Ellison

> Constructor  java.io.File(String) creates object with incorrect name if one-letter name is followed by file separator char
> --------------------------------------------------------------------------------------------------------------------------
>
>          Key: HARMONY-46
>          URL: http://issues.apache.org/jira/browse/HARMONY-46
>      Project: Harmony
>         Type: Bug
>   Components: Classlib
>     Reporter: Vladimir Ivanov
>     Assignee: Tim Ellison

>
> Constructor  java.io.File(String) creates object with incorrect name if one-letter name is followed by file separator char.
> Code to reproduce:
> import java.io.*; 
>   
> public class test29 { 
>     public static void main(String args[]) throws Exception { 
> 	File f1 = new File("a");
> 	File f2 = new File("a/");
> 	File f3 = new File("a\\");
> 	File f4 = new File("aa/");
>         System.out.println("f1 name: " + f1.getName() + "\nf2 name: " + f2.getName() + "\nf3 name: " + f3.getName() + "\nf4 name: " + f4.getName()); 
> 	System.out.println(f1.equals(f2) ? "PASSED" : "FAILED");
>     } 
> }
> Steps to Reproduce: 
> 1. Build Harmony (check-out on 2006-01-25) j2se subset as described in README.txt. 
> 2. Compile test29.java using BEA 1.4 javac 
> > javac -d . test29.java 
> 3. Run java using compatible VM (J9) 
> > java -showversion test29
> Output:
> C:\tmp\tmp17>C:\harmony\trunk\deploy\jre\bin\java -showversion test29
> java version 1.4.2 (subset)
> (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable.
> f1 name: a
> f2 name:
> f3 name:
> f4 name: aa
> FAILED
> C:\tmp\tmp17>C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion test29
> java version "1.4.2_04"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
> BEA WebLogic JRockit(TM) 1.4.2_04 JVM  (build ari-31788-20040616-1132-win-ia32, Native Threads, GC strategy: parallel)
> f1 name: a
> f2 name: a
> f3 name: a
> f4 name: aa
> PASSED
> C:\tmp\tmp17>
> junit test:
> ------------------------ FileTest.java -------------------------------------------------
> import java.io.*; 
> import junit.framework.*; 
>   
> public class FileTest extends TestCase { 
>     public void testFile_String() { 
> 	File f1 = new File("a");
> 	File f2 = new File("a/");
> 	assertTrue("File name is incorrect! " + f1.getName() + " != " + f2.getName(), f1.equals(f2));
>     } 
>    public static void main(String[] args) { 
>         junit.textui.TestRunner.run(FileTest.class); 
>    } 
> }

-- 
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


[jira] Commented: (HARMONY-46) Constructor java.io.File(String) creates object with incorrect name if one-letter name is followed by file separator char

Posted by "Vladimir Ivanov (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-46?page=comments#action_12366165 ] 

Vladimir Ivanov commented on HARMONY-46:
----------------------------------------

At revision 377324 it is look OK.

> Constructor  java.io.File(String) creates object with incorrect name if one-letter name is followed by file separator char
> --------------------------------------------------------------------------------------------------------------------------
>
>          Key: HARMONY-46
>          URL: http://issues.apache.org/jira/browse/HARMONY-46
>      Project: Harmony
>         Type: Bug
>   Components: Classlib
>     Reporter: Vladimir Ivanov
>     Assignee: Tim Ellison

>
> Constructor  java.io.File(String) creates object with incorrect name if one-letter name is followed by file separator char.
> Code to reproduce:
> import java.io.*; 
>   
> public class test29 { 
>     public static void main(String args[]) throws Exception { 
> 	File f1 = new File("a");
> 	File f2 = new File("a/");
> 	File f3 = new File("a\\");
> 	File f4 = new File("aa/");
>         System.out.println("f1 name: " + f1.getName() + "\nf2 name: " + f2.getName() + "\nf3 name: " + f3.getName() + "\nf4 name: " + f4.getName()); 
> 	System.out.println(f1.equals(f2) ? "PASSED" : "FAILED");
>     } 
> }
> Steps to Reproduce: 
> 1. Build Harmony (check-out on 2006-01-25) j2se subset as described in README.txt. 
> 2. Compile test29.java using BEA 1.4 javac 
> > javac -d . test29.java 
> 3. Run java using compatible VM (J9) 
> > java -showversion test29
> Output:
> C:\tmp\tmp17>C:\harmony\trunk\deploy\jre\bin\java -showversion test29
> java version 1.4.2 (subset)
> (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable.
> f1 name: a
> f2 name:
> f3 name:
> f4 name: aa
> FAILED
> C:\tmp\tmp17>C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion test29
> java version "1.4.2_04"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
> BEA WebLogic JRockit(TM) 1.4.2_04 JVM  (build ari-31788-20040616-1132-win-ia32, Native Threads, GC strategy: parallel)
> f1 name: a
> f2 name: a
> f3 name: a
> f4 name: aa
> PASSED
> C:\tmp\tmp17>
> junit test:
> ------------------------ FileTest.java -------------------------------------------------
> import java.io.*; 
> import junit.framework.*; 
>   
> public class FileTest extends TestCase { 
>     public void testFile_String() { 
> 	File f1 = new File("a");
> 	File f2 = new File("a/");
> 	assertTrue("File name is incorrect! " + f1.getName() + " != " + f2.getName(), f1.equals(f2));
>     } 
>    public static void main(String[] args) { 
>         junit.textui.TestRunner.run(FileTest.class); 
>    } 
> }

-- 
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


[jira] Resolved: (HARMONY-46) Constructor java.io.File(String) creates object with incorrect name if one-letter name is followed by file separator char

Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-46?page=all ]
     
Tim Ellison resolved HARMONY-46:
--------------------------------

    Resolution: Fixed

Vladimir,

Fixed in LUNI java.io.File at repo revision 375590.

Please check that this fully resolves your problem.


> Constructor  java.io.File(String) creates object with incorrect name if one-letter name is followed by file separator char
> --------------------------------------------------------------------------------------------------------------------------
>
>          Key: HARMONY-46
>          URL: http://issues.apache.org/jira/browse/HARMONY-46
>      Project: Harmony
>         Type: Bug
>   Components: Classlib
>     Reporter: Vladimir Ivanov
>     Assignee: Tim Ellison

>
> Constructor  java.io.File(String) creates object with incorrect name if one-letter name is followed by file separator char.
> Code to reproduce:
> import java.io.*; 
>   
> public class test29 { 
>     public static void main(String args[]) throws Exception { 
> 	File f1 = new File("a");
> 	File f2 = new File("a/");
> 	File f3 = new File("a\\");
> 	File f4 = new File("aa/");
>         System.out.println("f1 name: " + f1.getName() + "\nf2 name: " + f2.getName() + "\nf3 name: " + f3.getName() + "\nf4 name: " + f4.getName()); 
> 	System.out.println(f1.equals(f2) ? "PASSED" : "FAILED");
>     } 
> }
> Steps to Reproduce: 
> 1. Build Harmony (check-out on 2006-01-25) j2se subset as described in README.txt. 
> 2. Compile test29.java using BEA 1.4 javac 
> > javac -d . test29.java 
> 3. Run java using compatible VM (J9) 
> > java -showversion test29
> Output:
> C:\tmp\tmp17>C:\harmony\trunk\deploy\jre\bin\java -showversion test29
> java version 1.4.2 (subset)
> (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable.
> f1 name: a
> f2 name:
> f3 name:
> f4 name: aa
> FAILED
> C:\tmp\tmp17>C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion test29
> java version "1.4.2_04"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
> BEA WebLogic JRockit(TM) 1.4.2_04 JVM  (build ari-31788-20040616-1132-win-ia32, Native Threads, GC strategy: parallel)
> f1 name: a
> f2 name: a
> f3 name: a
> f4 name: aa
> PASSED
> C:\tmp\tmp17>
> junit test:
> ------------------------ FileTest.java -------------------------------------------------
> import java.io.*; 
> import junit.framework.*; 
>   
> public class FileTest extends TestCase { 
>     public void testFile_String() { 
> 	File f1 = new File("a");
> 	File f2 = new File("a/");
> 	assertTrue("File name is incorrect! " + f1.getName() + " != " + f2.getName(), f1.equals(f2));
>     } 
>    public static void main(String[] args) { 
>         junit.textui.TestRunner.run(FileTest.class); 
>    } 
> }

-- 
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