commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From S├ębastien Brisard <sebastien.bris...@m4x.org>
Subject Re: [Math] About "NullArgumentException"
Date Mon, 10 Sep 2012 18:47:35 GMT
Hi
What should I do there?
I'm trying to work on MATH-854. It turns out that FieldElement<T>.add
throws a NAE. Should I catch it below, and rethrow it with a more
detailed message (including the entry index)?

Best,
S├ębastien


    /** {@inheritDoc} */
    public FieldVector<T> add(FieldVector<T> v)
            throws DimensionMismatchException {
        try {
            return add((ArrayFieldVector<T>) v);
        } catch (ClassCastException cce) {
            checkVectorDimensions(v);
            T[] out = buildArray(data.length);
            for (int i = 0; i < data.length; i++) {
                out[i] = data[i].add(v.getEntry(i));
                // SHOULD I CATCH NAE HERE?
            }
            return new ArrayFieldVector<T>(field, out, false);
        }
    }


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message