Revision: 4222 http://vexi.svn.sourceforge.net/vexi/?rev=4222&view=rev Author: mkpg2 Date: 2011-09-11 22:45:22 +0000 (Sun, 11 Sep 2011) Log Message: ----------- Avoid java exception. Print warning instead if stack frame unexpectedly unavailable.
Modified Paths: -------------- trunk/org.vexi-library.js/src/main/java/org/vexi/js/script.js trunk/org.vexi-library.js/src/main/jpp/org/ibex/js/JSU.jpp Modified: trunk/org.vexi-library.js/src/main/java/org/vexi/js/script.js =================================================================== --- trunk/org.vexi-library.js/src/main/java/org/vexi/js/script.js 2011-09-11 21:48:13 UTC (rev 4221) +++ trunk/org.vexi-library.js/src/main/java/org/vexi/js/script.js 2011-09-11 22:45:22 UTC (rev 4222) @@ -17,14 +17,18 @@ var lastFile; var printIndent = function(sf) { - var file = sf[0]; - var ln = sf[1]+""; - if (file!=lastFile) { - lastFile = file; - print(file+":\n"); + if(sf==null){ + print("WARNING: stackframe unavailable"); + }else{ + var file = sf[0]; + var ln = sf[1]+""; + if (file!=lastFile) { + lastFile = file; + print(file+":\n"); + } + ln = indent.substring(0, indentLength-(ln.length+2)) + ln; + print(ln+": "); } - ln = indent.substring(0, indentLength-(ln.length+2)) + ln; - print(ln+": "); }; var printMultiLine = function(text) { @@ -177,11 +181,7 @@ var trace = function(o, options) { var sf = stackframe(1); - if (sf==null) { - print("WARNING: stackframe(1) null - it should never be null"); - }else { - printIndent(sf); - } + printIndent(sf); var a = format(o, options); printMultiLine(a); Modified: trunk/org.vexi-library.js/src/main/jpp/org/ibex/js/JSU.jpp =================================================================== --- trunk/org.vexi-library.js/src/main/jpp/org/ibex/js/JSU.jpp 2011-09-11 21:48:13 UTC (rev 4221) +++ trunk/org.vexi-library.js/src/main/jpp/org/ibex/js/JSU.jpp 2011-09-11 22:45:22 UTC (rev 4222) @@ -199,18 +199,23 @@ static public JS stackframe(int fromtop){ - Interpreter cx = Scheduler.findCurrent().findCurrentInterpreter(); - // HACKish - String[] sf = cx.stack.stackframe(fromtop).split(":",2); - String source = sf[0]; - String line = sf[1]; - if(line.indexOf(' ')!=-1){ - line = line.split(" ")[0]; - } - JSArray r = new JSArray(2); - r.add(JSU.S(source)); - r.add(JSU.S(line)); - return r; + Interpreter cx = Scheduler.findCurrent().findCurrentInterpreter(); + // HACKish + String sfLine = cx.stack.stackframe(fromtop); + if(sfLine==null){ + return null; + }else{ + String[] sf = sfLine.split(":",2); + String source = sf[0]; + String line = sf[1]; + if(line.indexOf(' ')!=-1){ + line = line.split(" ")[0]; + } + JSArray r = new JSArray(2); + r.add(JSU.S(source)); + r.add(JSU.S(line)); + return r; + } } static public final int NULL = 1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Using storage to extend the benefits of virtualization and iSCSI Virtualization increases hardware utilization and delivers a new level of agility. Learn what those decisions are and how to modernize your storage and backup environments for virtualization. http://www.accelacomm.com/jaw/sfnl/114/51434361/ _______________________________________________ Vexi-svn mailing list Vexi-svn@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/vexi-svn