[jira] [Comment Edited] (IGNITE-9160) FindBugs: NPE and CCE on equals() methods
[ https://issues.apache.org/jira/browse/IGNITE-9160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16949530#comment-16949530 ] Nikolai Kulagin edited comment on IGNITE-9160 at 10/11/19 3:07 PM: --- [~mmuzaf], I created new pull request [#6967|https://github.com/apache/ignite/pull/6967], added [^reproduce.txt] with a test method for reproducing bugs in equals methods, and added [^check.txt] with a test method for checking fixes. was (Author: zzzadruga): [~mmuzaf], I created new pull request [#6967|[https://github.com/apache/ignite/pull/6967]], added [^reproduce.txt] with a test method for reproducing bugs in equals methods, and added [^check.txt] with a test method for checking fixes. > FindBugs: NPE and CCE on equals() methods > - > > Key: IGNITE-9160 > URL: https://issues.apache.org/jira/browse/IGNITE-9160 > Project: Ignite > Issue Type: Bug > Components: cache >Affects Versions: 2.6 >Reporter: Nikolai Kulagin >Assignee: Nikolai Kulagin >Priority: Minor > Labels: newbie > Fix For: 2.9 > > Attachments: check.txt, reproduce.txt > > Time Spent: 10m > Remaining Estimate: 0h > > Some classes have Incorrect equals() method: > {code:java} > // GridDhtPartitionMap.java > @Override public boolean equals(Object o) { > if (this == o) > return true; > GridDhtPartitionMap other = (GridDhtPartitionMap)o; > return other.nodeId.equals(nodeId) && other.updateSeq == updateSeq; > }{code} > In this case, we can get CCE > {code:java} > GridDhtPartitionMap gridDhtPartMap = new GridDhtPartitionMap(); > gridDhtPartMap.equals(new Object()); > -- > Exception in thread "main" java.lang.ClassCastException: java.lang.Object > cannot be cast to > org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap > at > org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap.equals(GridDhtPartitionMap.java:319) > at ru.zzzadruga.Ignite.main(Ignite.java:9){code} > Or NPE > {code:java} > GridDhtPartitionMap gridDhtPartMap = new GridDhtPartitionMap(); > gridDhtPartMap.equals(null); > -- > Exception in thread "main" java.lang.NullPointerException > at > org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap.equals(GridDhtPartitionMap.java:321) > at ru.zzzadruga.Ignite.main(Ignite.java:9){code} > The following code will prevent this > {code:java} > if (o == null || getClass() != o.getClass()) > return false;{code} > + List of classes with similar problems: + > * *GridTopic$T1-T8* - NPE > * *GridCachePreloadLifecycleAbstractTest -* NPE > * *GridDhtPartitionFullMap -* NPE and CCE > * *GridDhtPartitionMap -* NPE and CCE > * *OptimizedMarshallerSelfTest -* NPE and CCE > * *GatewayProtectedCacheProxy -* NPE and CCE > * *GridNearOptimisticTxPrepareFuture -* NPE and CCE > * *GridCacheDistributedQueryManager -* NPE and CCE > * *GridServiceMethodReflectKey -* NPE and CCE > * *GridListSetSelfTest -* NPE and CCE > * *GridTestKey -* NPE and CCE > * *GridCacheMvccCandidate -* CCE > * *GridDhtPartitionExchangeId -* CCE > * *GridTuple6 -* CCE -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Comment Edited] (IGNITE-9160) FindBugs: NPE and CCE on equals() methods
[ https://issues.apache.org/jira/browse/IGNITE-9160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16949530#comment-16949530 ] Nikolai Kulagin edited comment on IGNITE-9160 at 10/11/19 3:06 PM: --- [~mmuzaf], I created new pull request [#6967|[https://github.com/apache/ignite/pull/6967]], added [^reproduce.txt] with a test method for reproducing bugs in equals methods, and added [^check.txt] with a test method for checking fixes. was (Author: zzzadruga): [~mmuzaf], I created new pull request #6967, added [^reproduce.txt] with a test method for reproducing bugs in equals methods, and added [^check.txt] with a test method for checking fixes. > FindBugs: NPE and CCE on equals() methods > - > > Key: IGNITE-9160 > URL: https://issues.apache.org/jira/browse/IGNITE-9160 > Project: Ignite > Issue Type: Bug > Components: cache >Affects Versions: 2.6 >Reporter: Nikolai Kulagin >Assignee: Nikolai Kulagin >Priority: Minor > Labels: newbie > Fix For: 2.9 > > Attachments: check.txt, reproduce.txt > > Time Spent: 10m > Remaining Estimate: 0h > > Some classes have Incorrect equals() method: > {code:java} > // GridDhtPartitionMap.java > @Override public boolean equals(Object o) { > if (this == o) > return true; > GridDhtPartitionMap other = (GridDhtPartitionMap)o; > return other.nodeId.equals(nodeId) && other.updateSeq == updateSeq; > }{code} > In this case, we can get CCE > {code:java} > GridDhtPartitionMap gridDhtPartMap = new GridDhtPartitionMap(); > gridDhtPartMap.equals(new Object()); > -- > Exception in thread "main" java.lang.ClassCastException: java.lang.Object > cannot be cast to > org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap > at > org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap.equals(GridDhtPartitionMap.java:319) > at ru.zzzadruga.Ignite.main(Ignite.java:9){code} > Or NPE > {code:java} > GridDhtPartitionMap gridDhtPartMap = new GridDhtPartitionMap(); > gridDhtPartMap.equals(null); > -- > Exception in thread "main" java.lang.NullPointerException > at > org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap.equals(GridDhtPartitionMap.java:321) > at ru.zzzadruga.Ignite.main(Ignite.java:9){code} > The following code will prevent this > {code:java} > if (o == null || getClass() != o.getClass()) > return false;{code} > + List of classes with similar problems: + > * *GridTopic$T1-T8* - NPE > * *GridCachePreloadLifecycleAbstractTest -* NPE > * *GridDhtPartitionFullMap -* NPE and CCE > * *GridDhtPartitionMap -* NPE and CCE > * *OptimizedMarshallerSelfTest -* NPE and CCE > * *GatewayProtectedCacheProxy -* NPE and CCE > * *GridNearOptimisticTxPrepareFuture -* NPE and CCE > * *GridCacheDistributedQueryManager -* NPE and CCE > * *GridServiceMethodReflectKey -* NPE and CCE > * *GridListSetSelfTest -* NPE and CCE > * *GridTestKey -* NPE and CCE > * *GridCacheMvccCandidate -* CCE > * *GridDhtPartitionExchangeId -* CCE > * *GridTuple6 -* CCE -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Comment Edited] (IGNITE-9160) FindBugs: NPE and CCE on equals() methods
[ https://issues.apache.org/jira/browse/IGNITE-9160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16820009#comment-16820009 ] Nikolai Kulagin edited comment on IGNITE-9160 at 4/17/19 11:59 AM: --- [~dpavlov], I changed instanceofs to getClass was (Author: zzzadruga): [~dpavlov], Dmitriy, I changed instanceofs to getClass > FindBugs: NPE and CCE on equals() methods > - > > Key: IGNITE-9160 > URL: https://issues.apache.org/jira/browse/IGNITE-9160 > Project: Ignite > Issue Type: Bug > Components: cache >Affects Versions: 2.6 >Reporter: Nikolai Kulagin >Assignee: Nikolai Kulagin >Priority: Minor > Labels: newbie > Fix For: 2.8 > > > Some classes have Incorrect equals() method: > {code:java} > // GridDhtPartitionMap.java > @Override public boolean equals(Object o) { > if (this == o) > return true; > GridDhtPartitionMap other = (GridDhtPartitionMap)o; > return other.nodeId.equals(nodeId) && other.updateSeq == updateSeq; > }{code} > In this case, we can get CCE > {code:java} > GridDhtPartitionMap gridDhtPartMap = new GridDhtPartitionMap(); > gridDhtPartMap.equals(new Object()); > -- > Exception in thread "main" java.lang.ClassCastException: java.lang.Object > cannot be cast to > org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap > at > org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap.equals(GridDhtPartitionMap.java:319) > at ru.zzzadruga.Ignite.main(Ignite.java:9){code} > Or NPE > {code:java} > GridDhtPartitionMap gridDhtPartMap = new GridDhtPartitionMap(); > gridDhtPartMap.equals(null); > -- > Exception in thread "main" java.lang.NullPointerException > at > org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap.equals(GridDhtPartitionMap.java:321) > at ru.zzzadruga.Ignite.main(Ignite.java:9){code} > The following code will prevent this > {code:java} > if (o == null || getClass() != o.getClass()) > return false;{code} > + List of classes with similar problems: + > * *GridTopic$T1-T8* - NPE > * *GridCachePreloadLifecycleAbstractTest -* NPE > * *GridDhtPartitionFullMap -* NPE and CCE > * *GridDhtPartitionMap -* NPE and CCE > * *OptimizedMarshallerSelfTest -* NPE and CCE > * *GatewayProtectedCacheProxy -* NPE and CCE > * *GridNearOptimisticTxPrepareFuture -* NPE and CCE > * *GridCacheDistributedQueryManager -* NPE and CCE > * *GridServiceMethodReflectKey -* NPE and CCE > * *GridListSetSelfTest -* NPE and CCE > * *GridTestKey -* NPE and CCE > * *GridCacheMvccCandidate -* CCE > * *GridDhtPartitionExchangeId -* CCE > * *GridTuple6 -* CCE -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Comment Edited] (IGNITE-9160) FindBugs: NPE and CCE on equals() methods
[ https://issues.apache.org/jira/browse/IGNITE-9160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16594672#comment-16594672 ] Nikolai Kulagin edited comment on IGNITE-9160 at 8/28/18 1:22 PM: -- Fix equals() methods. PR: https://github.com/apache/ignite/pull/4478 CI: https://ci.ignite.apache.org/viewLog.html?buildId=1717616&tab=buildResultsDiv&buildTypeId=IgniteTests24Java8_RunAll Upsource: https://reviews.ignite.apache.org/ignite/review/IGNT-CR-736 Project is buildable, tests are ok, flacky as usual. [~garus.d.g], please, review my change. was (Author: zzzadruga): Fix equals() methods. PR: https://github.com/apache/ignite/pull/4478 CI: https://ci.ignite.apache.org/viewLog.html?buildId=1717616&tab=buildResultsDiv&buildTypeId=IgniteTests24Java8_RunAll Project is buildable, tests are ok, flacky as usual. [~garus.d.g], please, review my change. > FindBugs: NPE and CCE on equals() methods > - > > Key: IGNITE-9160 > URL: https://issues.apache.org/jira/browse/IGNITE-9160 > Project: Ignite > Issue Type: Bug > Components: cache >Affects Versions: 2.6 >Reporter: Nikolai Kulagin >Assignee: Nikolai Kulagin >Priority: Minor > Labels: newbie > Fix For: 2.7 > > > Some classes have Incorrect equals() method: > {code:java} > // GridDhtPartitionMap.java > @Override public boolean equals(Object o) { > if (this == o) > return true; > GridDhtPartitionMap other = (GridDhtPartitionMap)o; > return other.nodeId.equals(nodeId) && other.updateSeq == updateSeq; > }{code} > In this case, we can get CCE > {code:java} > GridDhtPartitionMap gridDhtPartMap = new GridDhtPartitionMap(); > gridDhtPartMap.equals(new Object()); > -- > Exception in thread "main" java.lang.ClassCastException: java.lang.Object > cannot be cast to > org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap > at > org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap.equals(GridDhtPartitionMap.java:319) > at ru.zzzadruga.Ignite.main(Ignite.java:9){code} > Or NPE > {code:java} > GridDhtPartitionMap gridDhtPartMap = new GridDhtPartitionMap(); > gridDhtPartMap.equals(null); > -- > Exception in thread "main" java.lang.NullPointerException > at > org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap.equals(GridDhtPartitionMap.java:321) > at ru.zzzadruga.Ignite.main(Ignite.java:9){code} > The following code will prevent this > {code:java} > if (o == null || getClass() != o.getClass()) > return false;{code} > + List of classes with similar problems: + > * *GridTopic$T1-T8* - NPE > * *GridCachePreloadLifecycleAbstractTest -* NPE > * *GridDhtPartitionFullMap -* NPE and CCE > * *GridDhtPartitionMap -* NPE and CCE > * *OptimizedMarshallerSelfTest -* NPE and CCE > * *GatewayProtectedCacheProxy -* NPE and CCE > * *GridNearOptimisticTxPrepareFuture -* NPE and CCE > * *GridCacheDistributedQueryManager -* NPE and CCE > * *GridServiceMethodReflectKey -* NPE and CCE > * *GridListSetSelfTest -* NPE and CCE > * *GridTestKey -* NPE and CCE > * *GridCacheMvccCandidate -* CCE > * *GridDhtPartitionExchangeId -* CCE > * *GridTuple6 -* CCE -- This message was sent by Atlassian JIRA (v7.6.3#76005)