Findbugs Warnings

Description

Dear all,

We are conducting a study about the relevance of the warnings reported by the FindBugs tool when executed over several open-source systems.

Particularly, in the case of Hibernate, we would like to confirm the relevance of the following warning reported by the tool (for version 3.5.0.beta1):

Location: org.hibernate.engine.StatefulPersistenceContext getNaturalIdSnapshot - Line: 298
Warning: Using pointer equality to compare different types. The method uses using pointer equality to compare two references that seem to be of different types. The result of this comparison will always be false at runtime.

Since this warning seemed relevant to us, we would like to confirm our classification with Hibernate's developers.

Best regards,

Marco Tulio Valente
Brazil

Environment

None

Activity

Show:
Gail Badner
April 22, 2010, 12:59 AM

The lines numbers have changed, but I think I see the problem in StatefulPersistenceContext getNaturalIdSnapshot:

Object[] entitySnapshot = getDatabaseSnapshot( id, persister );
if ( entitySnapshot == NO_ROW ) {
return null;
}

entitySnapshot is Object[]
NO_ROW is a MarkerObject

As you say, entitySnapshot will never be equal to NO_ROW.

It looks like the code should be:

Object[] entitySnapshot = getDatabaseSnapshot( id, persister );
if ( entitySnapshot == null ) {
return null;
}

Gail Badner
May 12, 2010, 4:18 AM

Marco, thanks for bringing this to our attention. This bug is also described by HHH-3884, which fell through the cracks.

Steve Ebersole
March 21, 2011, 7:08 PM

Bulk closing stale resolved issues

Assignee

Gail Badner

Reporter

Marco Tulio Valente

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Minor
Configure