commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hang Park (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (MATH-1419) Invalid usage of exception in PolynomialSplineFunction
Date Thu, 15 Jun 2017 12:50:00 GMT

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

Hang Park edited comment on MATH-1419 at 6/15/17 12:49 PM:
-----------------------------------------------------------

[~erans] Oh, I just made a PR right before.. at [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!


was (Author: hangpark):
[~erans] Oh, I just made a PR right before.. at [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)

Mime
View raw message