"null" value is wrapped as Undefined.

Attila Szegedi szegedia at gmail.com
Thu Jun 23 08:45:39 UTC 2022


Hi,

I’d like to look into this, but can you tell me how is “$S.isBlank” defined? If it is in Java, what is its method signature?

Thanks,
  Attila.

> On 2022. Jun 6., at 19:17, Se Hee Lee <tosehee at gmail.com> wrote:
> 
> Is there a way to prevent this automatic wrapping?
> 
> In the following line, "oh.customAttribute4" is null, and it's passed into
> isBlank() as "Undefined". And that triggers the ClassCastException. This
> works fine in JDK 1.8.0_91, but fails in all future versions.
> 
> Is there an optional parameter or flag that prevents this from
> happening??????
> 
> We have lots of rules that are based on 'nashorn' scripting engine, and we
> cannot upgrade to future JDK due to this issue.
> 
> if (oh.type == "Sales Order" && $S.isBlank(oh.customAttribute4) &&
> oh.importType != "Transfer Order" && ol.item.customAttribute1 != "true" &&
> $S.containsIgnoreCase(vars.highMovingItems, ol.item.number + ",") ||
> $S.endsWithIgnoreCase(vars.highMovingItems, ol.item.number)) {
> 
> Caused by: java.lang.ClassCastException: Cannot cast
> org.openjdk.nashorn.internal.runtime.Undefined to java.lang.CharSequence
> 
> --
> 
> 
> Se Hee Lee / CTO
> ------------------------------
> 
> 11605 Haynes Bridge Rd, Suite 200 | Alpharetta, GA 30009
> 470-214-3636 | slee at deposco.com | www.deposco.com
> <https://deposco.com/?utm_source=Email%20Signature>
> 
> [image: Twitter]  <https://twitter.com/deposco> [image: Facebook]
> <https://facebook.com/deposco> [image: Google +]
> <https://plus.google.com/+Deposco> [image: LinkedIn]
> <https://www.linkedin.com/company-beta/384437/>
> 
> <https://deposco.com/?utm_source=Email%20Signature>



More information about the nashorn-dev mailing list