Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4856364
Votes 1
Synopsis Exception in thread "main" java.lang.InternalError: Converter malfunction
Category java:char_encodings
Reported Against 1.4.1 , mantis-beta
Release Fixed
State 11-Closed, duplicate of 6292315, bug
Priority: 3-Medium
Related Bugs
Submit Date 30-APR-2003
Description


FULL PRODUCT VERSION :
java version "1.4.1_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_02-b06)
Java HotSpot(TM) Client VM (build 1.4.1_02-b06, mixed mode)

java version "1.4.2-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-beta-b19)
Java HotSpot(TM) Client VM (build 1.4.2-beta-b19, mixed mode)


FULL OS VERSION :
 customer  Windows XP [Version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
java.lang.InternalError instead of Exception

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
import java.io.*;
import java.applet.*;
import java.awt.*;

public class ReadString extends Applet{
	public static void crash() {
		byte[] b = new byte[2];
		b[0]=(byte)0xff;
		b[1]=(byte)0xfe;
		ByteArrayInputStream bais = new ByteArrayInputStream(b);
		String s;
		InputStreamReader isr= null;
		try{
		isr = new InputStreamReader(bais,"Unicode");
		}
		catch (java.io.UnsupportedEncodingException e) { e.printStackTrace(); }
		
		BufferedReader in = new BufferedReader( isr   );
		
		try {
			while ( (s = in.readLine()) != null ) {	   System.out.println( s );}
		}

		catch (java.io.IOException e) {	e.printStackTrace(); }
		


	}
	
	public void paint(Graphics g) {
		crash();
	}
	public static void main(String[] a) {
		crash();
		
	}
}

EXPECTED VERSUS ACTUAL BEHAVIOR :
Exception
Exception in thread "main" java.lang.InternalError: Converter malfunction (Unico
de) -- please submit a bug report via http://java.sun.com/cgi-bin/bugreport.cgi
        at sun.nio.cs.StreamDecoder$ConverterSD.malfunction(StreamDecoder.java:2
33)
        at sun.nio.cs.StreamDecoder$ConverterSD.convertInto(StreamDecoder.java:2
49)
        at sun.nio.cs.StreamDecoder$ConverterSD.implRead(StreamDecoder.java:295)

        at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:180)
        at java.io.InputStreamReader.read(InputStreamReader.java:167)
        at java.io.BufferedReader.fill(BufferedReader.java:136)
        at java.io.BufferedReader.readLine(BufferedReader.java:299)
        at java.io.BufferedReader.readLine(BufferedReader.java:362)
        at ReadString.crash(ReadString.java:23)
        at ReadString.main(ReadString.java:36)

ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "main" java.lang.InternalError: Converter malfunction (Unico
de) -- please submit a bug report via http://java.sun.com/cgi-bin/bugreport.cgi
        at sun.nio.cs.StreamDecoder$ConverterSD.malfunction(StreamDecoder.java:2
33)
        at sun.nio.cs.StreamDecoder$ConverterSD.convertInto(StreamDecoder.java:2
49)
        at sun.nio.cs.StreamDecoder$ConverterSD.implRead(StreamDecoder.java:295)

        at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:180)
        at java.io.InputStreamReader.read(InputStreamReader.java:167)
        at java.io.BufferedReader.fill(BufferedReader.java:136)
        at java.io.BufferedReader.readLine(BufferedReader.java:299)
        at java.io.BufferedReader.readLine(BufferedReader.java:362)
        at ReadString.crash(ReadString.java:23)
        at ReadString.main(ReadString.java:36)

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.io.*;
import java.applet.*;
import java.awt.*;

public class ReadString extends Applet{
	public static void crash() {
		byte[] b = new byte[2];
		b[0]=(byte)0xff;
		b[1]=(byte)0xfe;
		ByteArrayInputStream bais = new ByteArrayInputStream(b);
		String s;
		InputStreamReader isr= null;
		try{
		isr = new InputStreamReader(bais,"Unicode");
		}
		catch (java.io.UnsupportedEncodingException e) { e.printStackTrace(); }
		
		BufferedReader in = new BufferedReader( isr   );
		
		try {
			while ( (s = in.readLine()) != null ) {	   System.out.println( s );}
		}

		catch (java.io.IOException e) {	e.printStackTrace(); }
		


	}
	
	public void paint(Graphics g) {
		crash();
	}
	public static void main(String[] a) {
		crash();
		
	}
}
---------- END SOURCE ----------

(Review ID: 185057) 
======================================================================
Work Around
N/A
Evaluation
Not for 1.4.2.  --   xxxxx@xxxxx   2003/4/30

Will reconsider addressing this for 1.5.1 or 1.6 release. 
The "Unicode" supported encoding was maintained for compatibility reasons.
The preferred 16 bit unicode encodings are provided by the nio Charsets
whose canonical names are "UTF-16", "UTF-16BE" and "UTF-16LE".
Since "Unicode" (as a named encoding) support needs to be maintained
for compatibility purposes in 1.6 (at the latest) when the sun.io
legacy converters are removed it will be incumbent upon us to ensure
that the charset provided will never throw unchecked exceptions when 
provided with illegal input. Instead a MalformedInputException ought
to be thrown.
  xxxxx@xxxxx   2003-09-23

(1)legacy sun.io converters have been removed from 6.0, so it's no longer
an issue for it
(2)there is an aged bug in sun.io.ByteToCharUnicode.java, see bug#6292315, need
that get fixed for previous releases. 
Use "isr = new InputStreamReader(bais,"UnicodeLittle");" in testcase for 5.0 to
reproduce the issue.

Close this one as the dup of #6292315

  xxxxx@xxxxx   2005-07-21 23:21:40 GMT
Posted Date : 2005-07-21 23:21:40.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang