000031709 - When running an RSA Via Lifecycle and Governance collector, the following error is seen:  Error: String Index out of range: -1

Document created by RSA Customer Support Employee on Jun 14, 2016Last modified by RSA Customer Support on Jan 26, 2018
Version 3Show Document
  • View in full screen mode

Article Content

Article Number000031709
Applies ToRSA Product Set: Identity Management and Governance
RSA Product/Service Type: Enterprise Software
RSA Version/Condition: 6.9.1
Platform: JBoss
IssueWhen running a collector, the following  error  message is seen:
Error:  Caused by java.sql.SQLException: java.lang.StringIndexOutOfBoundsException: String index out of range: -1 

It is also possible to get this error when trying to insert null data into a string.
CauseThis error is caused when a field requires string data, but there is none in the input field.   It has also been seen when an input field does include string data, but a filter or query on the field returns null data. 

ResolutionFix the input data to not contain null data.   If there is some kind of filter or query, verify that this will not return null data with the input data. 
NotesAn example is when the field user.user_name should be an email address or UPN  (such as user@domain.com), but a query included a filter to collect/extract accounts, such as in the example below, where one of the input rows did not have an email address (specifically missing the @ character):

SELECT DISTINCT * FROM (SELECT SUBSTR(user.user_name, 1, INSTR(user.user_name, '@')-1) AS Account FROM App_Roles)

The INSTR function is used to return the position of a substring in a string.  The syntax of INSTR(user.user_name, '@')-1) does not find an @, so it returns null data.