ArrayIndexOutOfBoundsException in CriteriaLoader.java
- Dominant language
- Groovy
- Stars
- 2.9k
- Forks
- 975
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 92
Description
### Steps to Reproduce
1. define following domain class
`class mytest {
def my_data = "123"
static hasMany = [childItems: mytest]
}`
2. execute the following code
def mytest = new mytest()
mytest.save(failOnError: true, flush: true)
def tests = mytest.where { childItems.contains(mytest) }.findAll()
### Expected Behaviour
yield an empty collection
### Actual Behaviour
java.lang.ArrayIndexOutOfBoundsException in CriteriaLoader.java getResultRow line 161
`result[i] = types[i].nullSafeGet( rs, columnAliases[pos], session, null );`
columnAliases is an Array with 0 entries, while pos = 0 tries to retrieve the first element
### Environment Information
- **Operating System**: Ubuntu 16.04
- **GORM Version:** gormVersion=6.1.10.RELEASE
- **Grails Version (if using Grails):** 3.3.8
- **JDK Version:** 1.8.0_201
Contributor guide
Research direction
Start with CriteriaLoader.java, especially getResultRow around line 161, and reproduce the reported self-referential childItems query using the supplied domain class. Trace how columnAliases and pos are produced for this criteria query; done means the query returns an empty collection without an ArrayIndexOutOfBoundsException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- groovy
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100