You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Anton Ivanov (JIRA)" <ji...@apache.org> on 2006/12/04 16:26:24 UTC

[jira] Created: (HARMONY-2439) java.io.OutputStreamWriter.write(int) writes bytes in UTF-8 incorrectly

java.io.OutputStreamWriter.write(int) writes bytes in UTF-8 incorrectly
-----------------------------------------------------------------------

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


java.io.OutputStreamWriter works wrong when calling to its write(int) method if encoding specified is UTF-8.
Following test fails:

import java.io.*;

public class TestOutputStreamWriterUTF8 {

  public static void main(String argv[]) throws Exception {
      ByteArrayOutputStream out;
      OutputStreamWriter writer = null;
      InputStreamReader isr = null;

      try {
          out = new ByteArrayOutputStream();
          writer = new OutputStreamWriter(out, "UTF-8");
          int upper = 9000;

          for (int c = 0; c < upper; ++c) {
              writer.write(c);
          }

          writer.flush();
          byte[] result = out.toByteArray();

          isr = new InputStreamReader(new ByteArrayInputStream(result),"UTF-8");

          int expected = 0;
          for (; expected < upper; ++expected) {
              if (expected != isr.read()) {
                  System.out.println("test FAILED:" + expected +" "+ isr.read());
                  break;
              }
          }
      
          if (expected == upper) {
              System.out.println("test PASSED");
          }

          isr.close();
          writer.close();
       } catch (Exception e) {
          e.printStackTrace();
       }
 }
} 

-- 
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-2439) [classlib][luni] java.io.OutputStreamWriter.write(int) writes bytes in UTF-8 incorrectly

Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-2439?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tim Ellison resolved HARMONY-2439.
----------------------------------

    Resolution: Cannot Reproduce
      Assignee: Tim Ellison

Works for me too.

Happy to re-open it if you still have a problem.


> [classlib][luni] java.io.OutputStreamWriter.write(int) writes bytes in UTF-8 incorrectly
> ----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2439
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2439
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Anton Ivanov
>         Assigned To: Tim Ellison
>
> java.io.OutputStreamWriter works wrong when calling to its write(int) method if encoding specified is UTF-8.
> Following test fails:
> import java.io.*;
> public class TestOutputStreamWriterUTF8 {
>   public static void main(String argv[]) throws Exception {
>       ByteArrayOutputStream out;
>       OutputStreamWriter writer = null;
>       InputStreamReader isr = null;
>       try {
>           out = new ByteArrayOutputStream();
>           writer = new OutputStreamWriter(out, "UTF-8");
>           int upper = 9000;
>           for (int c = 0; c < upper; ++c) {
>               writer.write(c);
>           }
>           writer.flush();
>           byte[] result = out.toByteArray();
>           isr = new InputStreamReader(new ByteArrayInputStream(result),"UTF-8");
>           int expected = 0;
>           for (; expected < upper; ++expected) {
>               if (expected != isr.read()) {
>                   System.out.println("test FAILED:" + expected +" "+ isr.read());
>                   break;
>               }
>           }
>       
>           if (expected == upper) {
>               System.out.println("test PASSED");
>           }
>           isr.close();
>           writer.close();
>        } catch (Exception e) {
>           e.printStackTrace();
>        }
>  }
> } 

-- 
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-2439) [classlib][luni] java.io.OutputStreamWriter.write(int) writes bytes in UTF-8 incorrectly

Posted by "Tony Wu (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-2439?page=comments#action_12460638 ] 
            
Tony Wu commented on HARMONY-2439:
----------------------------------

Hi Anton,
it prints "test PASSED" on my win32xp sp2 with IBM VME. My classlib reversion is r488662.
 would you please help to verify it and post the information of failure if it's still a problem. Thanks a lot.

> [classlib][luni] java.io.OutputStreamWriter.write(int) writes bytes in UTF-8 incorrectly
> ----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2439
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2439
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Anton Ivanov
>
> java.io.OutputStreamWriter works wrong when calling to its write(int) method if encoding specified is UTF-8.
> Following test fails:
> import java.io.*;
> public class TestOutputStreamWriterUTF8 {
>   public static void main(String argv[]) throws Exception {
>       ByteArrayOutputStream out;
>       OutputStreamWriter writer = null;
>       InputStreamReader isr = null;
>       try {
>           out = new ByteArrayOutputStream();
>           writer = new OutputStreamWriter(out, "UTF-8");
>           int upper = 9000;
>           for (int c = 0; c < upper; ++c) {
>               writer.write(c);
>           }
>           writer.flush();
>           byte[] result = out.toByteArray();
>           isr = new InputStreamReader(new ByteArrayInputStream(result),"UTF-8");
>           int expected = 0;
>           for (; expected < upper; ++expected) {
>               if (expected != isr.read()) {
>                   System.out.println("test FAILED:" + expected +" "+ isr.read());
>                   break;
>               }
>           }
>       
>           if (expected == upper) {
>               System.out.println("test PASSED");
>           }
>           isr.close();
>           writer.close();
>        } catch (Exception e) {
>           e.printStackTrace();
>        }
>  }
> } 

-- 
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-2439) [classlib][luni] java.io.OutputStreamWriter.write(int) writes bytes in UTF-8 incorrectly

Posted by "Mikhail Markov (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-2439?page=comments#action_12461414 ] 
            
Mikhail Markov commented on HARMONY-2439:
-----------------------------------------

I also could not reproduce the problem on WinXP both with IBM VME & DRLVM and on Ubuntu 6 with DRLVM.


> [classlib][luni] java.io.OutputStreamWriter.write(int) writes bytes in UTF-8 incorrectly
> ----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2439
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2439
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Anton Ivanov
>
> java.io.OutputStreamWriter works wrong when calling to its write(int) method if encoding specified is UTF-8.
> Following test fails:
> import java.io.*;
> public class TestOutputStreamWriterUTF8 {
>   public static void main(String argv[]) throws Exception {
>       ByteArrayOutputStream out;
>       OutputStreamWriter writer = null;
>       InputStreamReader isr = null;
>       try {
>           out = new ByteArrayOutputStream();
>           writer = new OutputStreamWriter(out, "UTF-8");
>           int upper = 9000;
>           for (int c = 0; c < upper; ++c) {
>               writer.write(c);
>           }
>           writer.flush();
>           byte[] result = out.toByteArray();
>           isr = new InputStreamReader(new ByteArrayInputStream(result),"UTF-8");
>           int expected = 0;
>           for (; expected < upper; ++expected) {
>               if (expected != isr.read()) {
>                   System.out.println("test FAILED:" + expected +" "+ isr.read());
>                   break;
>               }
>           }
>       
>           if (expected == upper) {
>               System.out.println("test PASSED");
>           }
>           isr.close();
>           writer.close();
>        } catch (Exception e) {
>           e.printStackTrace();
>        }
>  }
> } 

-- 
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-2439) [classlib][luni] java.io.OutputStreamWriter.write(int) writes bytes in UTF-8 incorrectly

Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-2439?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tim Ellison closed HARMONY-2439.
--------------------------------


No response, assuming ok.


> [classlib][luni] java.io.OutputStreamWriter.write(int) writes bytes in UTF-8 incorrectly
> ----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2439
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2439
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Anton Ivanov
>         Assigned To: Tim Ellison
>
> java.io.OutputStreamWriter works wrong when calling to its write(int) method if encoding specified is UTF-8.
> Following test fails:
> import java.io.*;
> public class TestOutputStreamWriterUTF8 {
>   public static void main(String argv[]) throws Exception {
>       ByteArrayOutputStream out;
>       OutputStreamWriter writer = null;
>       InputStreamReader isr = null;
>       try {
>           out = new ByteArrayOutputStream();
>           writer = new OutputStreamWriter(out, "UTF-8");
>           int upper = 9000;
>           for (int c = 0; c < upper; ++c) {
>               writer.write(c);
>           }
>           writer.flush();
>           byte[] result = out.toByteArray();
>           isr = new InputStreamReader(new ByteArrayInputStream(result),"UTF-8");
>           int expected = 0;
>           for (; expected < upper; ++expected) {
>               if (expected != isr.read()) {
>                   System.out.println("test FAILED:" + expected +" "+ isr.read());
>                   break;
>               }
>           }
>       
>           if (expected == upper) {
>               System.out.println("test PASSED");
>           }
>           isr.close();
>           writer.close();
>        } catch (Exception e) {
>           e.printStackTrace();
>        }
>  }
> } 

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


[jira] Updated: (HARMONY-2439) [classlib][luni] java.io.OutputStreamWriter.write(int) writes bytes in UTF-8 incorrectly

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

Paulex Yang updated HARMONY-2439:
---------------------------------

    Summary: [classlib][luni] java.io.OutputStreamWriter.write(int) writes bytes in UTF-8 incorrectly  (was: java.io.OutputStreamWriter.write(int) writes bytes in UTF-8 incorrectly)

> [classlib][luni] java.io.OutputStreamWriter.write(int) writes bytes in UTF-8 incorrectly
> ----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2439
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2439
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Anton Ivanov
>
> java.io.OutputStreamWriter works wrong when calling to its write(int) method if encoding specified is UTF-8.
> Following test fails:
> import java.io.*;
> public class TestOutputStreamWriterUTF8 {
>   public static void main(String argv[]) throws Exception {
>       ByteArrayOutputStream out;
>       OutputStreamWriter writer = null;
>       InputStreamReader isr = null;
>       try {
>           out = new ByteArrayOutputStream();
>           writer = new OutputStreamWriter(out, "UTF-8");
>           int upper = 9000;
>           for (int c = 0; c < upper; ++c) {
>               writer.write(c);
>           }
>           writer.flush();
>           byte[] result = out.toByteArray();
>           isr = new InputStreamReader(new ByteArrayInputStream(result),"UTF-8");
>           int expected = 0;
>           for (; expected < upper; ++expected) {
>               if (expected != isr.read()) {
>                   System.out.println("test FAILED:" + expected +" "+ isr.read());
>                   break;
>               }
>           }
>       
>           if (expected == upper) {
>               System.out.println("test PASSED");
>           }
>           isr.close();
>           writer.close();
>        } catch (Exception e) {
>           e.printStackTrace();
>        }
>  }
> } 

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