OpenTreeOfLife / taxomachine

taxonomy graphdb
Other
7 stars 4 forks source link

string comparisons #14

Closed jar398 closed 11 years ago

jar398 commented 11 years ago

In TaxonomySynthesizer.java :

                    if (endNodeName == "")
                        endNodeName = (String) rel.getEndNode().getProperty("name");

                    if ((String) rel.getEndNode().getProperty("name") != endNodeName)
                        foundConflict = true;

Comparing strings by identity (==) is almost always the wrong thing. You can easily have "" != "" and "Rana" != "Rana".

I don't understand why the names are being compared at all, as opposed to the identity of the nodes? I would expect neo4j to preserve Node identity, in which case just say: endNode = ..., and if (rel.getEndNode() != endNode) ...

blackrim commented 11 years ago

Yeah, good catch. That is an old function and I removed it as we aren't using it for anything so I just removed it.