You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sebb (JIRA)" <ji...@apache.org> on 2010/10/01 18:37:33 UTC
[jira] Created: (MATH-424)
MultiDimensionMismatchException.getWrongDimensions() fails to clone the
array
MultiDimensionMismatchException.getWrongDimensions() fails to clone the array
-----------------------------------------------------------------------------
Key: MATH-424
URL: https://issues.apache.org/jira/browse/MATH-424
Project: Commons Math
Issue Type: Bug
Reporter: Sebb
MultiDimensionMismatchException.getWrongDimensions() returns a pointer to the array, which allows callers to modify it.
The constructor takes care to clone the input array, so presumably the getter should do so too?
Same applies to getExpectedDimensions()
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (MATH-424)
MultiDimensionMismatchException.getWrongDimensions() fails to clone the
array
Posted by "Gilles (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MATH-424?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12916949#action_12916949 ]
Gilles commented on MATH-424:
-----------------------------
I knew about this one. I didn't "clone" because I figured out that one should be pretty pervert to fiddle with data coming from an exception. At that point, the only sane thing would be to examine/print the content...
So this is an optimization to avoid copying the data several times (see the accessor methods in the subclass {{MatrixDimensionMismatchException}}).
> MultiDimensionMismatchException.getWrongDimensions() fails to clone the array
> -----------------------------------------------------------------------------
>
> Key: MATH-424
> URL: https://issues.apache.org/jira/browse/MATH-424
> Project: Commons Math
> Issue Type: Bug
> Reporter: Sebb
>
> MultiDimensionMismatchException.getWrongDimensions() returns a pointer to the array, which allows callers to modify it.
> The constructor takes care to clone the input array, so presumably the getter should do so too?
> Same applies to getExpectedDimensions()
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (MATH-424)
MultiDimensionMismatchException.getWrongDimensions() fails to clone the
array
Posted by "Sebb (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MATH-424?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12916967#action_12916967 ]
Sebb commented on MATH-424:
---------------------------
Another way to avoid copying yet still provide read-only access to the array would be to use an indexed getter.
That would be safe even for "insane" code.
> MultiDimensionMismatchException.getWrongDimensions() fails to clone the array
> -----------------------------------------------------------------------------
>
> Key: MATH-424
> URL: https://issues.apache.org/jira/browse/MATH-424
> Project: Commons Math
> Issue Type: Bug
> Reporter: Sebb
>
> MultiDimensionMismatchException.getWrongDimensions() returns a pointer to the array, which allows callers to modify it.
> The constructor takes care to clone the input array, so presumably the getter should do so too?
> Same applies to getExpectedDimensions()
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (MATH-424)
MultiDimensionMismatchException.getWrongDimensions() fails to clone the
array
Posted by "Gilles (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MATH-424?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gilles resolved MATH-424.
-------------------------
Resolution: Fixed
Resolved as suggested (revision 1003606).
> MultiDimensionMismatchException.getWrongDimensions() fails to clone the array
> -----------------------------------------------------------------------------
>
> Key: MATH-424
> URL: https://issues.apache.org/jira/browse/MATH-424
> Project: Commons Math
> Issue Type: Bug
> Reporter: Sebb
> Assignee: Gilles
>
> MultiDimensionMismatchException.getWrongDimensions() returns a pointer to the array, which allows callers to modify it.
> The constructor takes care to clone the input array, so presumably the getter should do so too?
> Same applies to getExpectedDimensions()
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.