|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
helma 1.6.2 adoption issueHi,
one of our apps breaks after updating to helma 1.6.2. A StackOverflow comes when the app calls stripTags(): /** * Overwrites Helma's stripTags-method, since we dont * want to convert everything to a String. */ if (!this["__stripTags__"]) this["__stripTags__"] = this["stripTags"]; function stripTags(obj) { if (isNull(obj) || isUndefined(obj) || isDate(obj) || isBoolean(obj)) { return obj; } else if (isArray(obj)) { return obj.collect(function(item) { return stripTags(item); }); } else { return Packages.org.mortbay.util.StringUtil.replace(__stripTags__(obj + ""), '<', '<'); } } stripTags() calls itself endless as soon as it comes into the else case. I understand this (I think) , BUT this code exists and runs perfectly for over one year. I don't understand why it worked in earlier helma version (1.6.0 i.e.) I really curious about your feedback about this. thanks for you time, -- klemens mantzos web developer | vienna - http://knallgrau.at/ _______________________________________________ Helma-dev mailing list Helma-dev@... http://helma.org/mailman/listinfo/helma-dev |
|
|
Re: helma 1.6.2 adoption issueHi Klemens,
this is indeed a funky bug. (Except it isn't a bug, at least not a Helma bug :-) What's happening is that __stripTags__ and stripTags are indeed the same (scripted) functions. The reason is that Rhino, when evaluating a script file on a scope, actually tries to define the function properties __before__ evaluating the script, so scriptTags already contains the scripted function when you check/set __scriptTags__. I first wondered what code change might have triggered this behaviour, because I didn't make that many changed between 1.6.1 and 1.6.2 in the scripting layer. Turns out that it was that global native functions aren't defined as READONLY anymore in 1.6.2. That used to help fend off that first round of defining the functions before evaluation. http://dev.helma.org/trac/helma/changeset/8795 There's an easy workaround. Just do not define your scripted function using the name it's going to use. For example, you might just want to define it inline: if (!this["__stripTags__"]) { this['__stripTags__'] = this['stripTags']; this['stripTags'] = function(obj) { ... }; } Hope that helps, hannes 2008/4/22 Klemens <klemens@...>: > Hi, > > one of our apps breaks after updating to helma 1.6.2. A StackOverflow > comes when the app calls stripTags(): > > /** > * Overwrites Helma's stripTags-method, since we dont > * want to convert everything to a String. > */ > if (!this["__stripTags__"]) this["__stripTags__"] = this["stripTags"]; > function stripTags(obj) { > if (isNull(obj) || isUndefined(obj) || isDate(obj) || isBoolean(obj)) { > return obj; > } else if (isArray(obj)) { > return obj.collect(function(item) { return stripTags(item); }); > } else { > return Packages.org.mortbay.util.StringUtil.replace(__stripTags__(obj > + ""), '<', '<'); > } > } > > stripTags() calls itself endless as soon as it comes into the else > case. I understand this (I think) , BUT this code exists and runs > perfectly for over one year. I don't understand > why it worked in earlier helma version (1.6.0 i.e.) > > I really curious about your feedback about this. > > thanks for you time, > -- > klemens mantzos > web developer | vienna - http://knallgrau.at/ > _______________________________________________ > Helma-dev mailing list > Helma-dev@... > http://helma.org/mailman/listinfo/helma-dev > Helma-dev mailing list Helma-dev@... http://helma.org/mailman/listinfo/helma-dev |
| Free Forum Powered by Nabble | Forum Help |