Hi, Committed.
Regards, Jeroen 2006-02-12 Jeroen Frijters <[EMAIL PROTECTED]> Fixes PR 26220 * java/io/InputStreamReader.java (InputStreamReader(InputStream)): Use SystemProperties. (InputStreamReader(InputStream,Charset)): Corrected @since tag. Throw NullPointerException if in is null. Added maxBytesPerChar initialisation. (InputStreamReader(InputStream,CharsetDecoder)): Corrected @since tag. Throw NullPointerException if in is null.
Index: java/io/InputStreamReader.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/io/InputStreamReader.java,v retrieving revision 1.28 diff -u -r1.28 InputStreamReader.java --- java/io/InputStreamReader.java 4 Jan 2006 00:11:33 -0000 1.28 +++ java/io/InputStreamReader.java 12 Feb 2006 09:28:09 -0000 @@ -1,5 +1,6 @@ /* InputStreamReader.java -- Reader than transforms bytes to chars - Copyright (C) 1998, 1999, 2001, 2003, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2001, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -38,6 +39,7 @@ package java.io; +import gnu.classpath.SystemProperties; import gnu.java.nio.charset.EncodingHelper; import java.nio.ByteBuffer; @@ -145,7 +147,7 @@ this.in = in; try { - encoding = System.getProperty("file.encoding"); + encoding = SystemProperties.getProperty("file.encoding"); // Don't use NIO if avoidable if(EncodingHelper.isISOLatin1(encoding)) { @@ -231,12 +233,20 @@ * charset to decode the bytes in the InputStream into * characters. * - * @since 1.5 + * @since 1.4 */ public InputStreamReader(InputStream in, Charset charset) { + if (in == null) + throw new NullPointerException(); this.in = in; decoder = charset.newDecoder(); + try { + maxBytesPerChar = charset.newEncoder().maxBytesPerChar(); + } catch(UnsupportedOperationException _){ + maxBytesPerChar = 1f; + } + decoder.onMalformedInput(CodingErrorAction.REPLACE); decoder.onUnmappableCharacter(CodingErrorAction.REPLACE); decoder.reset(); @@ -247,9 +257,11 @@ * Creates an InputStreamReader that uses the given charset decoder * to decode the bytes in the InputStream into characters. * - * @since 1.5 + * @since 1.4 */ public InputStreamReader(InputStream in, CharsetDecoder decoder) { + if (in == null) + throw new NullPointerException(); this.in = in; this.decoder = decoder;