Creating a list in a rule

Hello, I am very new to sailpoint and trying to create some methods to create a random 3letters4numbers String while making sure that the 4 letters are not a vulgar word or acronym. I got these methods working in regular Java but when i bring over to sailpoint it fails. I removed code until in found out where it was erroring and it was erroring on creating the list. I assume there is a special way to create a list of strings in sailpoint that i do not know or could find documentation on. please see my sailpoint instance information and a snippet of the code that i am using to create a list. any help would be appreciated.

Identity IQ version:

Version 8.1p2 573234b5be3-20201216-122000
E-Fixes None
Schema Version 8.1-10
Source Repository Location RC_8.1p2
Builder jenkins

Errors:

- Maximum refresh exceptions reached

- BeanShell script error: bsh.ParseException: Parse error at line 1092, column 51. Encountered: > BSF info: AD-Methods-Library-Rule-AHS at line: 0 column: columnNo

Snippet of Code:

List<String> badWords = new ArrayList<>();
badWords.add(“azz”);
badWords.add(“fuc”);
badWords.add(“fuk”);

When the list is removed from code there are no errors but as soon as its added i get the above errors, so i am pretty sure there is something wrong with how the list is being created.

You just need a slight tweak and then the following should work:

List badWords = new ArrayList();

badWords.add(“azz”);

badWords.add(“fuc”);

badWords.add(“fuk”);

Thank you so much! This appears to be working now.

Please remember!

Generics <> aren’t supported in IIQ Beanshell (may be it has more to do with xml scripting). Beanshell is intelligent to know the type.

Even if you have List of Map which in java is usually List<HashMap<String,String>> l = new ArrayList<>();, still in IIQ Beanshell, you must write List l=new ArrayList();

Ah the bad words list. We’ve got a good list going from over the years and that’s always a fun time coming up with them.