ClassCastException After Upgrading IDM

0 Likes
Environment:

  • Identity Manager 4.6.2

  • User Application

  • Provisioning Request Definitions (workflow)


Symptom:

  • Upgrade IDM

  • java.lang.ClassCastException: com.novell.soa.script.mozilla.javascript.ConsString cannot be cast to java.lang.String


Issue:

  • IDM 4.6.2 uses a later version of Rhino that changes the way it supports "string" coercion.

    • Rhino version “rhino-js-1.7R4” and later has changed the way it handles "string" coercion.

      • When you concatenate a "string" with another variable containing a string (or a variable cast to a string from another object), you don't actually have a "String" object. Instead, you have a "ConsString" (java.lang.Object prototype, which implements java.lang.CharSequence). Technically, you have a serialized character sequence. But Rhino's latest implementation does not allow such coercion anymore, since Java doesn't technically support coercion and JavaScript does.

    • Essentially, when you concatenate a Java "String" (IDM server / workflow activities) with a JavaScript "String" (Client; workflow form), and return the result to the server (Rhino), it now throws an exception.



  • FYI: Mozilla has declared that they don’t consider this a bug and therefore won’t be changing that behavior.




Solution:

  • Explicitly cast (using ".toString()") the results of any concatenated “Strings”, when concatenated with a data type that is not technically a JavaScript "String".

  • Explicitly cast (using ".toString()") each item being concatenated, prior to performing a concatenation.

Labels:

How To-Best Practice
Comment List
Parents Comment Children
No Data
Related
Recommended