[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug(s) in java.lang.String
From: |
Mark Wielaard |
Subject: |
Re: Bug(s) in java.lang.String |
Date: |
31 Jul 2002 21:20:58 +0200 |
Hi,
On Wed, 2002-07-31 at 17:57, Stephen Crawley wrote:
> the Kissme VM goes into an infinite loop. The problem is in the private
> "upperCaseIndex" method that performs a binary search of a table encoded
> as a char array represented by the String value CharData.UPPER_SPECIAL.
> The problem is that this method is accessing the table via the String's
> value attribute, but it is not taking account of the String's 'offset'.
> In Kissme, this String's 'value' is part of a larger char array and
> the 'offset' is non-zero.
How does CharData.UPPER_SPECIAL end up being part of another String?
Is it the compiler or the VM doing something "smart"?
> I suspect that other methods of String, etc that make use of CharData
> could be making the same mistake.
As far as I can see non of the code expects the char[] to be not zero
based. I believe it was never intended that the Strings were actually
used as real Strings. It was just a way to store char arrays.
Another solution would be to encode the values in CharData not as
Strings but as actual char[] but that might be a lot less efficient
(source code may explode I mean, it shouldn't matter for the class
file).
Cheers,
Mark