GoogleCodeArchive / piccolo2d

Automatically exported from code.google.com/p/piccolo2d
0 stars 0 forks source link

PTransformActivity can throw null pointer exception #134

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a new PTransformActivity
2. call setDestinationTransform(null)
3. Schedule the activity

What is the expected output? What do you see instead?
I'd expect that without a destination transform, it would do nothing with
the target's transform, rather than throw a NPE.

In the setRelativeTargetValue method, it makes reference to destination
wihout first checking it for null (which is can clearly be). Under most
circumstances, this should never happen, but the class makes it too easy to
setup an impossible situation.

Original issue reported on code.google.com by allain.lalonde on 13 Oct 2009 at 3:53

GoogleCodeExporter commented 9 years ago
Should setDestinationTransform throw NPE or IllegalArgumentException when 
passed in
null?  That seems better to me than throwing a NPE later or doing nothing after 
a
null check.  The Piccolo2D API is not very consistent when it comes to null
parameters though.

Original comment by heue...@gmail.com on 21 Oct 2009 at 2:19

GoogleCodeExporter commented 9 years ago
If for some reason a client was setting the destination to null after the 
transform
had completed, throwing a NPE would actually cause a Binary Break.

I say push to 2.0.

Original comment by allain.lalonde on 21 Oct 2009 at 2:41

GoogleCodeExporter commented 9 years ago
The reference I often consult says that adding unchecked exceptions is ok

http://wiki.eclipse.org/Evolving_Java-based_APIs_2

Add unchecked exceptions thrown - Binary compatible

I agree on pushing to 2.0.

Original comment by heue...@gmail.com on 21 Oct 2009 at 3:48

GoogleCodeExporter commented 9 years ago
Committed on release-1.3-branch

$ svn commit -m "Issue 134 ; do not apply transform if destination transform is 
null" .
...
Committed revision 1154.

Original comment by heue...@gmail.com on 1 Nov 2011 at 5:37

GoogleCodeExporter commented 9 years ago

Original comment by heue...@gmail.com on 26 Nov 2013 at 5:42