[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5746) Return value check missing for List.get(int)

Suresh Thummalapenta (JIRA) noreply at atlassian.com
Sun Nov 21 16:23:13 EST 2010


Return value check missing for List.get(int)
--------------------------------------------

                 Key: HHH-5746
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5746
             Project: Hibernate Core
          Issue Type: Bug
          Components: core
    Affects Versions: 3.6.0
            Reporter: Suresh Thummalapenta
            Priority: Minor


We developed a mining-based approach that recovers specifications for APIs of JavaSDK and uses those specifications to detect defects statically. In our study, we found that at various places, return checks are missing in the core component of Hibernate. It would be great if you could analyze and fix those issues.

List.get(int) can result in IndexOutOfBoundsException when the index value is outside the range. To avoid this exception, it is better to have a condition check on the size of the list before invoking the get method.

Class: HqlSqlWalker.java
Method: lookupNonQualifiedProperty, Line 598
Method: postProcessDML, Line 679

Class: PersistentBag.java
Method: getSnapshotElement, Line 405
public Object getSnapshotElement(Object entry, int i) {
	List sn = (List) getSnapshot();
	return sn.get(i); 
}

Class: StandardQueryCache.java
Method: get, line 128

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list