JDK-4103067 : javac raises StringIndexOutOfBoundsException to meet malformed
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 1.1.6
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_2.5.1
  • CPU: sparc
  • Submitted: 1998-01-09
  • Updated: 1998-04-14
  • Resolved: 1998-04-14
Related Reports
Duplicate :  
Relates :  
Relates :  
Description

Name: ccC48265			Date: 01/09/98


javac of JDK1.1.6B raises StringIndexOutOfBoundsException
when it meets malformed encoding character in a source.
( this bug is related with BUGID:4037914. )

For example, in test directory of JAE sources,
exception is following. (in Japanese environment)

% setenv LANG ja
% cd /usr/local/JAE1.1.6B-src/test
% javac java/intltest/BreakIteratorTest.java
java.lang.StringIndexOutOfBoundsException: String index out of range: -125
        at java.lang.String.charAt(String.java)
        at sun.io.ByteToCharEUC_JP.getUnicode(ByteToCharEUC_JP.java:81)
        at sun.io.ByteToCharEUC_JP.convert(ByteToCharEUC_JP.java:159)
        at java.io.InputStreamReader.convertInto(InputStreamReader.java)
        at java.io.InputStreamReader.fill(InputStreamReader.java)
        at java.io.InputStreamReader.read(InputStreamReader.java)
        at java.io.BufferedReader.fill(BufferedReader.java)
        at java.io.BufferedReader.read(BufferedReader.java)
        at sun.tools.java.ScannerInputStream.read(ScannerInputStream.java)
        at sun.tools.java.Scanner.xscan(Scanner.java)
        at sun.tools.java.Scanner.scan(Scanner.java)
        at sun.tools.java.Parser.scan(Parser.java)
        at sun.tools.java.Parser.expect(Parser.java)
        at sun.tools.java.Parser.parseStatement(Parser.java)
        at sun.tools.java.Parser.parseBlockStatement(Parser.java)
        at sun.tools.java.Parser.parseStatement(Parser.java)
        at sun.tools.java.Parser.parseField(Parser.java)
        at sun.tools.java.Parser.parseClassBody(Parser.java)
        at sun.tools.java.Parser.parseNamedClass(Parser.java)
        at sun.tools.java.Parser.parseClass(Parser.java)
        at sun.tools.java.Parser.parseFile(Parser.java)
        at sun.tools.javac.BatchEnvironment.parseFile(BatchEnvironment.java)
        at sun.tools.javac.Main.compile(Main.java)
        at sun.tools.javac.Main.main(Main.java)
error: An error has occurred in the compiler; please file a bug report 
(http://java.sun.com/cgi-bin/bugreport.cgi).
1 error

P.S.
In JDK1.2Z:
% javac java/intltest/BreakIteratorTest.java
java/intltest/BreakIteratorTest.java:433: The source file encoding may be 
different with this platform encoding. Please use -encoding option to adjust 
file encoding, or apply native2ascii utility to make source file ASCII 
encoding.
java/intltest/BreakIteratorTest.java:433: '}' expected.
2 errors

In JDK1.1.5:
% javac java/intltest/BreakIteratorTest.java
I/O exception
2 errors
(Review ID: 22897)
======================================================================

Comments
EVALUATION This appears to have the same root cause as 4113395: ByteToCharEUC_JP code converter throws StringIndexOutOfBoundsException That bug has "Release summary: 1.2beta3", but this submission claims it is a regression in 1.1.6, which suggests that that one, and/or 4087261, is also a regression in 1.1.6 of equivalent severity. I am unable to confirm the situation without a japanese locale, and I'm unwilling to close any bugs as duplicate without someone from I18N to confirm what is going on. So for the moment I'm changing the responsible engineer to be the same as 4113395, with the expectation that this bug will be closed as a duplicate and that one marked as a 1.1.6 regression. david.stoutamire@Eng 1998-02-26 This is indeed a duplicate of 4113395 and 4121358. mark.son-bell@eng 1998-04-13
26-02-1998