Title:
Error with queryName.removeRows function when using CachedWithin parameter when creating query
| View in TrackerStatus/Resolution/Reason: Closed/Fixed/
Reporter/Name(from Bugbase): Claire Harmony / Claire Harmony (Claire Harmony)
Created: 06/29/2016
Versions: 2016
Failure Type:
Found In Build/Fixed In Build: CF2016_Update1 / 299788
Priority/Frequency: Major / All users will encounter
Locale/System: ALL / Win 2008 Server R2 64 bit
Vote Count: 0
Problem Description: In versions prior to 2016, it's possible to use the underlying java function "removeRows" on a query to remove a row when using cached queries. In 2016, this is throwing an error:
java.lang.ArrayIndexOutOfBoundsException, Message=N >= 0
where N is the java index of the record attempting to be deleted, when trying to remove a row that is known to be in the query.
Steps to Reproduce:
<CFOUTPUT>
STEP 1: LOAD RECORDS INTO A QUERY<br>
<CFQUERY NAME="GetSounds" DATASOURCE="#application.MainDB#" Maxrows=10 CachedWithin="#CreateTimeSpan(0, 0, 0, 10)#">
SELECT *
FROM sound WITH (NOLOCK)
ORDER BY sound_iid
</CFQUERY>
GetSounds.recordCount=#GetSounds.recordCount#<br>
<br>
STEP 2: LOOP THROUGH RECORDSET AND DELETE EACH RECORD ONE BY ONE, SHOWING THE NEW NUMBER OF RECORDS REMAINING IN THE QUERY AFTER EACH DELETE<br>
<CFLOOP index="currentRow" from="#GetSounds.recordCount#" to="1" step="-1">
<CFTRY>
<CFSET GetSounds.removeRows(JavaCast("int", (currentRow - 1)), JavaCast("int", (1)))>
<CFCATCH type="any">
Error=#cfcatch.type#, Message=#cfcatch.message#<br>
</CFCATCH>
</CFTRY>
Records remaining after delete=#GetSounds.recordCount#<br>
</CFLOOP>
</CFOUTPUT>
Actual Result: An error occurs during each call to the "removeRows" function, and the row is not deleted, as follows:
Error=java.lang.ArrayIndexOutOfBoundsException, Message=9 >= 0
Records remaining after delete=10
Error=java.lang.ArrayIndexOutOfBoundsException, Message=8 >= 0
Records remaining after delete=10
Error=java.lang.ArrayIndexOutOfBoundsException, Message=7 >= 0
Records remaining after delete=10
Error=java.lang.ArrayIndexOutOfBoundsException, Message=6 >= 0
Records remaining after delete=10
Error=java.lang.ArrayIndexOutOfBoundsException, Message=5 >= 0
Records remaining after delete=10
Error=java.lang.ArrayIndexOutOfBoundsException, Message=4 >= 0
Records remaining after delete=10
Error=java.lang.ArrayIndexOutOfBoundsException, Message=3 >= 0
Records remaining after delete=10
Error=java.lang.ArrayIndexOutOfBoundsException, Message=2 >= 0
Records remaining after delete=10
Error=java.lang.ArrayIndexOutOfBoundsException, Message=1 >= 0
Records remaining after delete=10
Error=java.lang.ArrayIndexOutOfBoundsException, Message=0 >= 0
Records remaining after delete=10
Expected Result:
Records remaining after delete=9
Records remaining after delete=8
Records remaining after delete=7
Records remaining after delete=6
Records remaining after delete=5
Records remaining after delete=4
Records remaining after delete=3
Records remaining after delete=2
Records remaining after delete=1
Records remaining after delete=0
Any Workarounds: NONE!
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 4169466
External Customer Info:
External Company:
External Customer Name: Claire Harmony
External Customer Email:
External Test Config: My Hardware and Environment details: Windows Server 2008 R2 64-bit
Attachments:
Comments: