Skip to content
Browse files

Added check to ensure a DoubleBondStereochemistry is never created wi…

…th more then 2 bonds - this would cause errors with some methods.
  • Loading branch information...
1 parent d20a2a7 commit 3c15de529e0c3286062cf8472d16c8362b56c35e @johnmay committed Oct 31, 2012
Showing with 2 additions and 0 deletions.
  1. +2 −0 src/main/org/openscience/cdk/stereo/
2 src/main/org/openscience/cdk/stereo/
@@ -49,6 +49,8 @@
* <code>ligandBonds[0]</code>, <code>stereoBonds</code>, and <code>ligandBonds[1]</code>.
public DoubleBondStereochemistry(IBond stereoBond, IBond[] ligandBonds, Conformation stereo) {
+ if(ligandBonds.length > 2)
+ throw new IllegalArgumentException("expected two ligand bonds");
this.stereoBond = stereoBond;
this.ligandBonds = ligandBonds;
this.stereo = stereo;

2 comments on commit 3c15de5

egonw commented on 3c15de5 Nov 2, 2012

Applied and pushed.

John, strictly speaking, this too should require a unit test in cdk-1.4.x and master... a test where you do pass 3 bonds, and having the test annotation like @Test(expected=IllegalArgumentException.class)

johnmay commented on 3c15de5 Nov 2, 2012

Yep no problem. I think the rest is test from here on :-)

Please sign in to comment.
Something went wrong with that request. Please try again.