[ 
https://issues.apache.org/jira/browse/MATH-1419?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16050411#comment-16050411
 ] 

Hang Park commented on MATH-1419:
---------------------------------

[~erans] Oh, I just made a PR right before.. at [link 
https://github.com/apache/commons-math/pull/62|https://github.com/apache/commons-math/pull/62],
 duplicated.

But, you should also change order of string format position in English and 
French! I made it, so check above PR. Thanks!

> Invalid usage of exception in PolynomialSplineFunction
> ------------------------------------------------------
>
>                 Key: MATH-1419
>                 URL: https://issues.apache.org/jira/browse/MATH-1419
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.6.1
>            Reporter: Hang Park
>            Priority: Trivial
>              Labels: easyfix
>             Fix For: 4.0
>
>   Original Estimate: 10m
>  Remaining Estimate: 10m
>
> In PolynomialSplineFunction constructor, it tests whether length of knots is 
> smaller than 2 or not. If <2, it throws NumberIsTooSmallException like below:
> {code:java}
> if (knots.length < 2) {
>     throw new 
> NumberIsTooSmallException(LocalizedFormats.NOT_ENOUGH_POINTS_IN_SPLINE_PARTITION,
>                                                                2, 
> knots.length, false);
>         }
> {code}
> But definition of above exception has parameters of the form:
> {code:java}
> /**
>  * Construct the exception with a specific context.
>  *
>  * @param specific Specific context pattern.
>  * @param wrong Value that is smaller than the minimum.
>  * @param min Minimum.
>  * @param boundIsAllowed Whether {@code min} is included in the allowed range.
>  */
> public NumberIsTooSmallException(Localizable specific,
>                                  Number wrong,
>                                  Number min,
>                                  boolean boundIsAllowed) {
>     super(specific, wrong, min);
>     this.min = min;
>     this.boundIsAllowed = boundIsAllowed;
> }
> {code}
> h3. In my opinion, *2, knots.length, false* should be *knots.length, 2, true*
> since 2 is the minimum value and knots.length is the wrong value in this 
> case. Moreover, boolean should be set by true because 2 is also acceptable.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to