Note that there are some explanatory texts on larger screens.

plurals
  1. POClass Cast exception error: trying to write the into the file
    primarykey
    data
    text
    <p>I am trying to export the file but an getting the following exception:</p> <blockquote> <p>An unexpected error occurred: java.lang.Exception: sailpoint.tools.GeneralException: The application script threw an exception: java.lang.ClassCastException: Cannot cast sailpoint.tools.xml.PersistentArrayList to java.lang.String BSF info: Export File - Abc at line: 0 column: columnNo</p> </blockquote> <p>My code is below:</p> <pre><code> import java.io.FileWriter; import java.io.File; import java.io.BufferedWriter; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.*; String appname = "Abc"; String path = "//home/exportfile//"; String filename = path+"ApplicationExport-"+appname+".txt"; String ret = "false"; QueryOptions ops = new QueryOptions(); Filter [] filters = new Filter[1]; filters[0] = Filter.eq("application.name", appname); ops.add(filters); List props = new ArrayList(); props.add("identity.name"); //Do search Iterator it = context.search(Link.class, ops, props); //Build file and export header row BufferedWriter out = new BufferedWriter(new FileWriter(filename)); out.write("IdentityName,UserName,WorkforceID,Organization"); out.newLine(); //Iterate Search Results if (it!=null) { while ( it.hasNext() ) { //Get link and create object Object [] record = it.next(); String identityName = (String) record[0]; Identity user = (Identity) context.getObject(Identity.class, identityName); //Get Identity attributes for export String workforceid = (String) user.getAttribute("workforceID"); //Get application attributes for export String userid=""; String org=""; List links = user.getLinks(); if (links!=null) { Iterator lit = links.iterator(); while (lit.hasNext()) { Link l = lit.next(); String lname = l.getApplicationName(); if (lname.equalsIgnoreCase(appname)) { userid = (String) l.getAttribute("User Name"); org= (String) l.getAttribute("Organization"); } } } //Output file out.write(identityName+","+userid+","+workforceid+","+org); out.newLine(); out.flush(); } ret="true"; } //Close file and return out.close(); return ret; </code></pre> <p>While running the above code i am getting the cast exception error: since the Organization attribute is Multivalued.i.e.: in that attribute you can have more than one value.</p> <p>any help to correct this code would be greatly appreciated.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload