[jira] [Commented] (MATH-1117) twod.PolygonsSet.getSize produces NullPointerException if BSPTree has no nodes

2014-04-28 Thread Luc Maisonobe (JIRA)

[ 
https://issues.apache.org/jira/browse/MATH-1117?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13982785#comment-13982785
 ] 

Luc Maisonobe commented on MATH-1117:
-

Yes, these constructors are used outside of their package. Typically, the 
constructor for polygons (in 2D) is called from the split method in SubPlane 
and also from an internal class in OutlineExtractor, both in the 3D package. As 
the methods have been public for a while, they may also be used from user code. 
The call from the split method is a very important one: it is used a very large 
number of times as part of building 3D BSP trees, and here the tree has been 
built using a complex algorithm to ensure it is correct, so we don't want to 
visit all its leafs to check it.

Thanks for the hint about the typos, I have fixed them now.

 twod.PolygonsSet.getSize produces NullPointerException if BSPTree has no nodes
 --

 Key: MATH-1117
 URL: https://issues.apache.org/jira/browse/MATH-1117
 Project: Commons Math
  Issue Type: Bug
Affects Versions: 3.2
 Environment: Mac OS 10.9, Java 6, 7
Reporter: Cyrille Artho
 Fix For: 3.3

 Attachments: Report3.java, Report3_1.java


 org.apache.commons.math3.geometry.euclidean.twod.PolygonsSet.getSize() uses a 
 tree internally:
 final BSPTreeEuclidean2D tree = getTree(false);
 However, if that tree contains no data, it seems that the reference returned 
 is null, which causes a subsequent NullPointerException.
 Probably an exception with a message (tree has no data) would clarify that 
 this is an API usage error.



--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Commented] (MATH-1117) twod.PolygonsSet.getSize produces NullPointerException if BSPTree has no nodes

2014-04-27 Thread Cyrille Artho (JIRA)

[ 
https://issues.apache.org/jira/browse/MATH-1117?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13982671#comment-13982671
 ] 

Cyrille Artho commented on MATH-1117:
-

Thanks for clarifying this one. I guess making these constructors 
package-private may break existing code so the documentation is the best way to 
warn the user.
By the way, the new documentation has a typo in task (currently taks). The 
same typo is also in PolyhedronsSet.java. Of course that's easy to fix :-)

 twod.PolygonsSet.getSize produces NullPointerException if BSPTree has no nodes
 --

 Key: MATH-1117
 URL: https://issues.apache.org/jira/browse/MATH-1117
 Project: Commons Math
  Issue Type: Bug
Affects Versions: 3.2
 Environment: Mac OS 10.9, Java 6, 7
Reporter: Cyrille Artho
 Fix For: 3.3

 Attachments: Report3.java, Report3_1.java


 org.apache.commons.math3.geometry.euclidean.twod.PolygonsSet.getSize() uses a 
 tree internally:
 final BSPTreeEuclidean2D tree = getTree(false);
 However, if that tree contains no data, it seems that the reference returned 
 is null, which causes a subsequent NullPointerException.
 Probably an exception with a message (tree has no data) would clarify that 
 this is an API usage error.



--
This message was sent by Atlassian JIRA
(v6.2#6252)