Google Answers Logo
View Question
 
Q: infinite loop in java jdk ( No Answer,   1 Comment )
Question  
Subject: infinite loop in java jdk
Category: Computers > Programming
Asked by: beavis-ga
List Price: $2.00
Posted: 16 Nov 2003 03:16 PST
Expires: 16 Dec 2003 03:16 PST
Question ID: 276368
Sun's ISO-2022-JP decoder has a bad bug that causes it to go into an
infinite loop. I need a simple fix (I don't want to build my own
version of the JDK or anything).

This code demonstrates the problem:
import javax.mail.internet.*;

class JP {
  public static void main(String args[]) throws Exception {
    String s = "=?ISO-2022-JP?B?GyRAGyRCJT8lJiVzJWEhPCVrGyhC?=";
    System.out.println(MimeUtility.decodeText(s));
  }
}


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

Here is a stack trace (from kill -QUIT). The code seems to be stuck in
decodeLoop().

"main" prio=1 tid=0x08052990 nid=0x25c5 runnable [bfffd000..bfffd6fc]
        at sun.nio.cs.ext.ISO2022_JP$Decoder.decodeArrayLoop(ISO2022_JP.java:147)
        at sun.nio.cs.ext.ISO2022_JP$Decoder.decodeLoop(ISO2022_JP.java:344)
        at java.nio.charset.CharsetDecoder.decode(CharsetDecoder.java:536)
        at java.lang.StringCoding$CharsetSD.decode(StringCoding.java:186)
        at java.lang.StringCoding.decode(StringCoding.java:224)
        at java.lang.String.<init>(String.java:320)
        at javax.mail.internet.MimeUtility.decodeWord(MimeUtility.java:693)
        at javax.mail.internet.MimeUtility.decodeText(MimeUtility.java:448)
        at JP.main(JP.java:7)
Answer  
There is no answer at this time.

Comments  
Subject: Re: infinite loop in java jdk
From: rmenon-ga on 01 Dec 2003 00:56 PST
 
Hi,
     I tried this with JDK 1.3.1 . It seems to work quite alright .

regards

Remesh
http://www.i-unknown.net

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy