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] Updated: (HARMONY-4794) [classlib][luni] unable to create file with Asian characters in name
Date Wed, 26 Sep 2007 16:05:50 GMT

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

Alexei Zakharov updated HARMONY-4794:
-------------------------------------

    Attachment: H4794.patch

Attached patch brings the power of Unicode to our file manipulation routines. After applying
it Harmony will be able to create & open & delete files with non-ASCII symbols in
names. I'm going to discuss this patch in dev list and probably commit it after M3 is released.
Patch for the test is on the way.

> [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
>         Attachments: H4794.patch
>
>
> 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