harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexei Zakharov (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-4794) [classlib][luni] unable to create file with Asian characters in name
Date Fri, 14 Sep 2007 07:34:32 GMT
[classlib][luni] unable to create file with Asian characters in name
--------------------------------------------------------------------

                 Key: HARMONY-4794
                 URL: https://issues.apache.org/jira/browse/HARMONY-4794
             Project: Harmony
          Issue Type: Bug
          Components: App-Oriented Bug Reports, Classlib
         Environment: WinXP
            Reporter: Alexei Zakharov
            Assignee: Alexei Zakharov


Looks like Harmony is unable to create file if its name contains non-ASCII characters. Please
see the test case below.

TestAsianFileName.java
---
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;

public class TestAsianFileName {
    static final String FILENAME="\u30d5\u30a1\u30a4\u30eb1.txt";

    public static void main(String argv[]) throws Exception {
        final String CONTENT = "A pretty predicament";
        final String CNTNT_CHARSET = "ISO-8859-1"; 

        File f = new File(FILENAME);
        FileOutputStream fos = new FileOutputStream(f);
        FileInputStream fis;
 
        f.createNewFile();
        fos.write(CONTENT.getBytes(CNTNT_CHARSET));
        fos.close();
        
        if (f.exists()) {
            byte tmp[] = new byte[256];
            String wasRed;
            int n;
            
            fis = new FileInputStream(f);
            n = fis.read(tmp);
            wasRed = new String(tmp, 0, n, CNTNT_CHARSET);
            if (!CONTENT.equals(wasRed)) {
                System.out.println("FAIL: invalid content was red");
                return;
            }
        } else {
            System.out.println("FAIL: file does not exist");
            return;
        }
        
        System.out.println("PASS");
    }

}

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


Mime
View raw message