Completed

SQL format not working, 'Execution Exception: String index out of range: 0' error

Hello, we had a sql script as follows.. 

delete from era_user_roles_t
where USER_ID'@Endpoint_AMS_Acct')

..that was working with no issues until two weeks ago when it started giving this error..

Execution Exception: String index out of range: 0
 

..nothing has changed with the script or data used in the variable.

I updated the script to now be the following..

delete from era_user_roles_t
where USER_ID = '@Endpoint_AMS_Acct'

..and now it works with no errors, did something change with how PROOF handles 'in upper('')'?

Thanks.

 

 

0
6 comments
Avatar
Rex Feizi

Stephen, 

Generally, there have been no changes to running the SQL's for a while. 

On the other hand, 

Except for a typo (missing the equal sign) on the first query, I don't see any differences between the 2 queries. Here are both queries copy and pasted from your original posts. Please elaborate, maybe I am missing something.  

delete from era_user_roles_t where USER_ID'@Endpoint_AMS_Acct')

delete from era_user_roles_t where USER_ID = '@Endpoint_AMS_Acct'

0
Comment actions Permalink
Avatar
Akinpelumia

Hi Rex, the script I meant to reference as the one that I used instead was the following..

delete from era_user_roles_t where USER_ID = '@Endpoint_AMS_Acct'

...the script that was failing was the following..

delete from era_user_roles_t where USER_ID in upper('@Endpoint_AMS_Acct')

0
Comment actions Permalink
Avatar
Akinpelumia

Hello, this error is now happening for any existing script where we delete records and the value is in the script as a templatized variable or a regular one... 

delete from era_user_aliases_t
where ext_sys_user_id = '${GM_Credentials.Username}'

..please see screenshot and test case info below; can someone pls take a look at this?

Test case - GMII_MyPortfolio_SmokeTest_FDA

Test case ID - 11373

Template/DataSet -

BT3_ProxyAccts, BT3_OLTPTST_ProxyAcct

GM_Credentials, SA_TEST

0
Comment actions Permalink
Avatar
Joseph Hamdan

Hi Stephen,

Unfortunately we do not have access to your environment. In order for us to assist, would you please provide us with the following:

1. Log from execution exception in local execution or if you have access to the log from cloud execution

2. Can you please print the variable before the step is executed to make sure the variable has the correct value?

3. Could you please go to the query in Subject7 and take a screenshot? I'd like to make sure that there are no typos in it given that it's color coded, we can tell from the screenshot if it has problems.

4. If you hardcode a number in the query and execute, what happens? Does it run properly?

Regards,
Subject7 Team

0
Comment actions Permalink
Avatar
Akinpelumia

Hi Joseph, please see my responses below; FYI, it seems to be working but very inconsistently

1. Log from execution exception in local execution or if you have access to the log from cloud execution - Please see logs from cloud execution below...

021-06-23 14:15:59 [pool-216-thread-1] INFO c.s.p.e.cloud.ExecutionListenerImpl - Test execution id=667392 start, number of steps 200
2021-06-23 14:15:59 [pool-216-thread-1] INFO c.s.p.e.cloud.ExecutionListenerImpl - Step index=0 PASS 0(ms) [Set_Var HALT Static GMII_AdminIC "FD"] message='Set @GMII_AdminIC=FD'
2021-06-23 14:16:04 [pool-216-thread-1] INFO c.s.proof.core.drivers.DriverFactory - Starting GeckoDriver. Version: 0.29.0
2021-06-23 14:16:04 [pool-216-thread-1] INFO c.s.p.e.cloud.ExecutionListenerImpl - Step index=1 PASS 0(ms) [Set_Var HALT Static GSUserID "MALHOTRAS_16"] message='Set @GSUserID=MALHOTRAS_16'
2021-06-23 14:16:04 [pool-216-thread-1] INFO c.s.p.e.cloud.ExecutionListenerImpl - Step index=2 PASS 0(ms) [Set_Var HALT Static GSName "Shashi Malhotra"] message='Set @GSName=Shashi Malhotra'
2021-06-23 14:16:05 [pool-216-thread-1] WARN c.s.p.executor.TestCaseExecutorImpl - java.lang.StringIndexOutOfBoundsException: String index out of range: 0
java.util.concurrent.ExecutionException: java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.util.concurrent.FutureTask.report(Unknown Source)
at java.util.concurrent.FutureTask.get(Unknown Source)
at com.subject7.proof.executor.TestCaseExecutorImpl.execute(TestCaseExecutorImpl.java:181)
at com.subject7.proof.executor.TestCaseExecutorImpl.executeOrSkip(TestCaseExecutorImpl.java:134)
at com.subject7.proof.executor.TestCaseExecutorImpl.executeStepBlock(TestCaseExecutorImpl.java:103)
at com.subject7.proof.executor.TestCaseExecutorImpl.execute(TestCaseExecutorImpl.java:46)
at com.subject7.proof.executor.client.impl.BaseClient.execute(BaseClient.java:108)
at com.subject7.proof.executor.client.impl.BaseClient.execute(BaseClient.java:88)
at com.subject7.proof.executor.client.impl.BaseClient.lambda$start$0(BaseClient.java:74)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.charAt(Unknown Source)
at com.subject7.proof.executor.step.AbstractDbStepExecutor.execute(AbstractDbStepExecutor.java:71)
at com.subject7.proof.executor.step.db.GetDbValueStepExecutor.execute(GetDbValueStepExecutor.java:17)
at com.subject7.proof.executor.step.db.GetDbValueStepExecutor.execute(GetDbValueStepExecutor.java:14)
at com.subject7.proof.executor.TestCaseExecutorImpl.lambda$execute$2(TestCaseExecutorImpl.java:176)
... 4 common frames omitted
2021-06-23 14:16:05 [pool-216-thread-1] INFO c.s.p.e.cloud.ExecutionListenerImpl - Step index=3 ERROR 62(ms) [Get_Db_Value HALT Role_name BT3_ProxyAcct_OLTP QUERY GM_Delete_Mapping] message='Execution Exception: String index out of range: 0'
2021-06-23 14:16:05 [pool-216-thread-1] INFO c.s.p.e.cloud.ExecutionListenerImpl - Test execution id=667392 finished. Status='FAIL', Message='Execution failed at step 3. Message Execution Exception: String index out of range: 0'

2. Can you please print the variable before the step is executed to make sure the variable has the correct value? Please see updated test case's screenshot in local run

3. Could you please go to the query in Subject7 and take a screenshot? I'd like to make sure that there are no typos in it given that it's color coded, we can tell from the screenshot if it has problems. - Please see screenshot below

4. If you hardcode a number in the query and execute, what happens? Does it run properly? - When I try to hardcode '${GM_Credentials.Username}' in the SQL script to the same value in the Dataset 'ERATEST106', upon save I get a PROOF error, please see screenshot below.

0
Comment actions Permalink
Avatar
Joseph Hamdan

Hi Stephen,

This issue was caused by an empty password, but now actual error will appear. Could you please advise if the issue no longer occurs? Please let us know if there's anything else.

Regards,
Subject7 Team

0
Comment actions Permalink

Please sign in to leave a comment.