harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jesse Wilson (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-6290) BufferedReader.readLine() breaks at EBCDIC newline, violating the spec
Date Wed, 05 Aug 2009 12:24:14 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-6290?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12739446#action_12739446

Jesse Wilson commented on HARMONY-6290:

Oliver, I don't think your example shows us anything. The RI may read the entire file as a
single line, and println the string "Hello<NEL>World", which may print up as two lines
in whichever terminal emulator you're using.

There are two opportunities for the NEL character to be interpretted by Java:
1 - when the file is converted from a stream of bytes into a stream of chars by the InputStreamReader
(which knows about the EBCDIC encoding)
2 - when the stream of characters is converted to a stream of lines by the BufferedReader
(which does not know any encoding)

I'm not at all interested in #1. Support for converting streams of bytes into streams of characters
works just fine. Perhaps the EBCDIC decoder should decode the byte 0x85 into the Java newline
character, "\n".

But according to the spec, using a BufferedReader to read through the String "Hello<NEL>World"
should yield a single line. Please see the attached test case which demonstrates the inconsistency
between Hy and the RI.

> BufferedReader.readLine() breaks at EBCDIC newline, violating the spec
> ----------------------------------------------------------------------
>                 Key: HARMONY-6290
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6290
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: SVN Revision: 800827
>            Reporter: Jesse Wilson
>         Attachments: readLine_no_EBCDIC.patch
>   Original Estimate: 0.33h
>  Remaining Estimate: 0.33h
> The spec says that BufferedReader.readLine() considers only "\r", "\n" and "\r\n" to
be line separators. We must not permit additional separator characters. I admit that the RI's
behaviour is surprising, and incompatible with it's own Pattern and Scanner classes. But this
is the specified behaviour; the doc explicitly calls out which character sequences are used
as newlines. It does not permit additional characters to break lines. 
> For users reading EBCDIC-encoded files, a better practice is to read through the files
using a Scanner. That way, the application will behave the same when executed on either Harmony
or on the RI.
> #Android

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

View raw message