зеркало из https://github.com/mozilla/gecko-dev.git
Fix bug:
Subject: Fatal error executing in IBM J9 VM Resent-Date: Mon, 9 Jul 2001 15:35:32 -0700 (PDT) Resent-From: mozilla-jseng@mozilla.org Date: 9 Jul 2001 15:33:38 -0700 From: bdemchak@tpsoft.com (Barry Demchak) Organization: http://groups.google.com/ To: mozilla-jseng@mozilla.org Newsgroups: netscape.public.mozilla.jseng Hi -- I've encountered an error in either Rhino or the IBM J9 VM's runtime support -- I'm not sure which -- but the end result is an unhandled exception. I'm quite willing to believe that it's already been dealt with. If so, will someone point me to the solution? I'm using: IBM's J9 on Windows 2000, IBM's IDE v1.3 on Windows 2000, Rhino v1.5 from mozilla.org The exception is java.lang.StringIndexOutOfBoundsException. It occurs in Context.getSourcePositionFromStack just after the call to RuntimeException.printStackTrace. The code is expecting a code reference that looks something like "(Example.js:50)" where "50" is the line number. (I gather that's what the Sun VM returns???) Instead, J9 is returning a code reference that looks like: "java.lang.RuntimeException\n\n\n\nStack trace:\n\n java/lang/Throwable.<int>()V\n\n" etc, etc, etc. The error occurs because the Colon variable's value is less than the Open variable's value in Context.getSourcePositionFromStack. When the s.substring is evaulated, there's a negative string length ... boom. I've patched an "if" statement in the getSourcePositionFromStack code so that instead of: if (c == '\n' && open != -1 && close != -1 && colon != -1) I have: if (c == '\n' && open != -1 && close != -1 && colon != -1 && open < colon && colon < close) Certainly, there's a better fix, but it's sufficient to keep me going. So, I have several questions ... being new to open source and this forum: 1) Is this a real bug ... a real Rhino bug?? 2) Has this already been found? 3) Has this already been fixed? 4) If not, what's the proper protocol for reporting it? 5) What's the proper protocol for fixing it? This shows up *very* quickly when trying to run a script under J9. When it occurs, Rhino is trying to issue a warning about some shady JavaScript code. If this is a real bug and hasn't been fixed, I would infer that there aren't a lot of people trying to run this under J9. Would that be a fair statement? If so, can anyone comment as to why that would be?? Thanks!
This commit is contained in:
Родитель
0ee98640dd
Коммит
08f4af156e
|
@ -1840,7 +1840,9 @@ public class Context {
|
|||
open = i;
|
||||
else if (c == ')')
|
||||
close = i;
|
||||
else if (c == '\n' && open != -1 && close != -1 && colon != -1) {
|
||||
else if (c == '\n' && open != -1 && close != -1 && colon != -1 &&
|
||||
open < colon && colon < close)
|
||||
{
|
||||
String fileStr = s.substring(open + 1, colon);
|
||||
if (fileStr.endsWith(".js")) {
|
||||
String lineStr = s.substring(colon + 1, close);
|
||||
|
|
Загрузка…
Ссылка в новой задаче