[
https://issues.apache.org/jira/browse/MATH-1419?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Gilles resolved MATH-1419.
--------------------------
Resolution: Fixed
Fix Version/s: (was: 3.7)
Changed in commit 1b53f09c3a9dcd64dd281c1955b062fc28999366
Thanks for the report and fix!
> 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)