[Fwd: My Mistake in ScriptRuntime method]]]
   Date:
        Tue, 16 Jan 2001 15:48:26 +0100
   From:
        Igor Bukanov <igor@icesoft.no>
     To:
        Norris Boyd <nboyd@atg.com>




Hi, Norris!

With my previous patch to fix in
org/mozilla/javascript/ScriptRuntime.java Integer.MIN_VALUE as index
problem I also added a bug to the unrelated code: I tried to minimize
object creation and unfortunately that untested "optimization" slippet
into my patch as well.

I replaced the lines 290, 291 in toNumber(String s) method from

String sub = s.substring(start, end+1);
if (sub.equals("Infinity"))

to

if (s.regionMatches(start, "Infinity", 0, 8))

But that should be
if (start + 7 == end && s.regionMatches(start, "Infinity", 0, 8))

Sory for troubles, Igor





290c290
<             if (s.regionMatches(start, "Infinity", 0, 8))
---
>             if (start + 7 == end && s.regionMatches(start, "Infinity", 0, 8))
This commit is contained in:
nboyd%atg.com 2001-01-16 20:20:36 +00:00
parent 86b8efd7cb
commit 08a188c69b
2 changed files with 2 additions and 2 deletions

View File

@ -287,7 +287,7 @@ public class ScriptRuntime {
// check for "Infinity"
if (startChar == '+' || startChar == '-')
start++;
if (s.regionMatches(start, "Infinity", 0, 8))
if (start + 7 == end && s.regionMatches(start, "Infinity", 0, 8))
return startChar == '-'
? Double.NEGATIVE_INFINITY
: Double.POSITIVE_INFINITY;

View File

@ -287,7 +287,7 @@ public class ScriptRuntime {
// check for "Infinity"
if (startChar == '+' || startChar == '-')
start++;
if (s.regionMatches(start, "Infinity", 0, 8))
if (start + 7 == end && s.regionMatches(start, "Infinity", 0, 8))
return startChar == '-'
? Double.NEGATIVE_INFINITY
: Double.POSITIVE_INFINITY;