Hi,
I noticed this in QueryAtomContainer.java
/** * Adds an atom to this container. * *@param atom The atom to be added to this container */ public void addAtom(IAtom atom) { if (contains(atom)) { return; } if (atomCount + 1 >= atoms.length) { growAtomArray(); } atom.addListener(this); atoms[atomCount] = atom; atomCount++; notifyChanged(); } /** * Adds a Bond to this AtomContainer. * *@param bond The bond to added to this container */ public void addBond(IBond bond) { if (bondCount >= bonds.length) growBondArray(); bonds[bondCount] = bond; ++bondCount; notifyChanged(); }
And that it allows null atoms & bonds to be added. Is this intentional? It causes exceptions to be thrown in the get methods if a null is found before the "end" of the loops.
Yes, don't add null bonds then :-). It's the same with the other implementations not just query. Where are you getting null bonds introduced?
J
On 18 Jun 2013, at 16:16, Duece99 duece99@users.sf.net wrote:
Related
Bugs:
#1306I fixed the bug in my code that was introducing the null bonds anyway. I just think it odd that no warnings or exceptions are thrown saying that a null bond has been introduced or whatever.
Yes it should, but it doesn't. Not sure if that will change anytime soon.
J
On 18 Jun 2013, at 16:34, Duece99 duece99@users.sf.net wrote:
Related
Bugs:
#1306At some point it was decided to have code not check all possible things users could get wrong in the input... (it was very many)... Thus, CDK users are expected to check themselves the provide sensible input... a null bond is indeed not... Part of this discussion is that additional checking also requires additional computation, slowing the CDK down...
Maybe it is time to reconsider this?
Diff:
Closed - possible solution is to use lang asserts which can be turned on and off.