Nathan Xu (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiZmMyYWJmMTRh...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-13876?atlOrigin=eyJpIjoiZmMyYW...
) HHH-13876 (
https://hibernate.atlassian.net/browse/HHH-13876?atlOrigin=eyJpIjoiZmMyYW...
) Fix an obvious bug in StandardStack implementation (
https://hibernate.atlassian.net/browse/HHH-13876?atlOrigin=eyJpIjoiZmMyYW...
)
Issue Type: Bug Affects Versions: 5.4.9, 5.4.10, 5.4.11, 5.4.12 Assignee: Unassigned
Components: hibernate-core Created: 22/Feb/2020 08:23 AM Priority: Trivial Reporter:
Nathan Xu (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
public class StandardStack<T> implements Stack<T> {
private LinkedList<T> internalStack = new LinkedList<>();
... ....
@Override
public void push(T newCurrent) {
internalStack.addFirst( newCurrent );
}
@Override
public T pop() {
return internalStack.removeFirst();
}
@Override
public T getCurrent() {
return internalStack.peek();
}
@Override
public T getPrevious() {
if ( internalStack.size() < 2 ) {
return null ;
}
return internalStack.get( internalStack.size() - 2 );
}
As you can see, new node is pushed at the beginning of the linked list, so
'getPrevious()' implementation is wrong. We simply return `internalStack.get( 1 )`
(current node corresponds to index of 0).
However, this method has never been used. Also, it has been fixed in v6 for its
implementation has been totally changed.
(
https://hibernate.atlassian.net/browse/HHH-13876#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-13876#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100121- sha1:96a3924 )