[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5095?page=c...
]
Matt Benson commented on HHH-5095:
----------------------------------
That's fine, and at such time as I get enough time to research the structure of
Hibernate's existing unit tests I might be able to put something together for that,
but that doesn't change the fact that this particular issue is one that simply reading
the Java code should be able to confirm. The code checks whether a given class is
assignable from BagType.class; thus the only time the result of
AbstractCollectionPersister.getCollectionType() would pass this test is when the result is
an instance of BagType (CollectionType passes the test, but would never be returned as it
is abstract). As I said in my followup comment, a simple instanceof check suffices here
instead of the backward isAssignable() call.
BasicLoader.isBag() checks type assignability wrongly
-----------------------------------------------------
Key: HHH-5095
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5095
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.5.0-Final, 3.5.1
Environment: N/A
Reporter: Matt Benson
Method defined as:
{code}
private boolean isBag(CollectionPersister collectionPersister) {
return collectionPersister.getCollectionType().getClass().isAssignableFrom(
BagType.class );
}
{code}
Will never return true if the returned CollectionType subclasses BagType; should IMO be:
{code}
private boolean isBag(CollectionPersister collectionPersister) {
return BagType.class.isInstance( collectionPersister.getCollectionType() );
}
{code}
My humble apologies for the submission without a test case, but this one feels pretty
simple. Thanks!
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira