You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (previousId != null && previousId != currentId) {
Lines 311 – 315:
final Long previousId = obj.getId();
IObject result = (IObject) filter.filter(null, obj);
result = (IObject) session.merge(result);
final Long currentId = result.getId();
if (previousId != null && previousId != currentId) {
Regarding line 315 and the 2'nd != operator.
I think since previousId and currentId are both Long objects, the != operator compares the object references and not the values. The equals() method should be used.
I think line 315 should be :
if (previousId != null && !previousId.equals(currentId) {
Example snippet:
Long a = (long)1000;
Long b = (long)(999 + 1);
System.out.println("compare != is " + (a!=b));
System.out.println("!equals is " + !a.equals(b));
Output:
compare != is true
!equals is false
False should be the correct output
The text was updated successfully, but these errors were encountered:
omero-server/src/main/java/ome/logic/UpdateImpl.java
Line 315 in d64ded2
Lines 311 – 315:
final Long previousId = obj.getId();
IObject result = (IObject) filter.filter(null, obj);
result = (IObject) session.merge(result);
final Long currentId = result.getId();
if (previousId != null && previousId != currentId) {
Regarding line 315 and the 2'nd != operator.
I think since previousId and currentId are both Long objects, the != operator compares the object references and not the values. The equals() method should be used.
I think line 315 should be :
if (previousId != null && !previousId.equals(currentId) {
Example snippet:
Output:
compare != is true
!equals is false
False should be the correct output
The text was updated successfully, but these errors were encountered: