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 2011/01/06 15:50:46 UTC
[jira] Created: (MATH-467)
HarmonicCoefficientsGuesser.sortObservations() potentlal NPE warning
HarmonicCoefficientsGuesser.sortObservations() potentlal NPE warning
--------------------------------------------------------------------
Key: MATH-467
URL: https://issues.apache.org/jira/browse/MATH-467
Project: Commons Math
Issue Type: Bug
Affects Versions: 3.0
Reporter: Sebb
Priority: Minor
HarmonicCoefficientsGuesser.sortObservations()
generates an NPE warning from Eclipse which thinks that mI can be null in the while condition.
The code looks like:
{code}
WeightedObservedPoint mI = observations[i];
while ((i >= 0) && (curr.getX() < mI.getX())) {
observations[i + 1] = mI;
if (i-- != 0) {
mI = observations[i];
} else {
mI = null;
}
}
// mI is not used further
{code}
It looks to me as though the "mI = null" statement is either redundant or wrong - why would one want to replace one of the observations with null during a sort?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (MATH-467)
HarmonicCoefficientsGuesser.sortObservations() potentlal NPE warning
Posted by "Luc Maisonobe (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MATH-467?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Luc Maisonobe resolved MATH-467.
--------------------------------
Resolution: Fixed
You are right. The else statement is not needed.
Fixed in subversion repository as of r1056034 for branch 2.X and as of r1056035 for trunk
> HarmonicCoefficientsGuesser.sortObservations() potentlal NPE warning
> --------------------------------------------------------------------
>
> Key: MATH-467
> URL: https://issues.apache.org/jira/browse/MATH-467
> Project: Commons Math
> Issue Type: Bug
> Affects Versions: 2.2, 3.0
> Reporter: Sebb
> Priority: Minor
>
> HarmonicCoefficientsGuesser.sortObservations()
> generates an NPE warning from Eclipse which thinks that mI can be null in the while condition.
> The code looks like:
> {code}
> WeightedObservedPoint mI = observations[i];
> while ((i >= 0) && (curr.getX() < mI.getX())) {
> observations[i + 1] = mI;
> if (i-- != 0) {
> mI = observations[i];
> } else {
> mI = null;
> }
> }
> // mI is not used further
> {code}
> It looks to me as though the "mI = null" statement is either redundant or wrong - why would one want to replace one of the observations with null during a sort?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (MATH-467)
HarmonicCoefficientsGuesser.sortObservations() potentlal NPE warning
Posted by "Sebb (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MATH-467?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sebb updated MATH-467:
----------------------
Affects Version/s: 2.2
> HarmonicCoefficientsGuesser.sortObservations() potentlal NPE warning
> --------------------------------------------------------------------
>
> Key: MATH-467
> URL: https://issues.apache.org/jira/browse/MATH-467
> Project: Commons Math
> Issue Type: Bug
> Affects Versions: 2.2, 3.0
> Reporter: Sebb
> Priority: Minor
>
> HarmonicCoefficientsGuesser.sortObservations()
> generates an NPE warning from Eclipse which thinks that mI can be null in the while condition.
> The code looks like:
> {code}
> WeightedObservedPoint mI = observations[i];
> while ((i >= 0) && (curr.getX() < mI.getX())) {
> observations[i + 1] = mI;
> if (i-- != 0) {
> mI = observations[i];
> } else {
> mI = null;
> }
> }
> // mI is not used further
> {code}
> It looks to me as though the "mI = null" statement is either redundant or wrong - why would one want to replace one of the observations with null during a sort?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] [Closed] (MATH-467)
HarmonicCoefficientsGuesser.sortObservations() potentlal NPE warning
Posted by "Luc Maisonobe (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MATH-467?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Luc Maisonobe closed MATH-467.
------------------------------
Closing issue as it was included in version 2.2, which has been released
> HarmonicCoefficientsGuesser.sortObservations() potentlal NPE warning
> --------------------------------------------------------------------
>
> Key: MATH-467
> URL: https://issues.apache.org/jira/browse/MATH-467
> Project: Commons Math
> Issue Type: Bug
> Affects Versions: 2.2, 3.0
> Reporter: Sebb
> Priority: Minor
>
> HarmonicCoefficientsGuesser.sortObservations()
> generates an NPE warning from Eclipse which thinks that mI can be null in the while condition.
> The code looks like:
> {code}
> WeightedObservedPoint mI = observations[i];
> while ((i >= 0) && (curr.getX() < mI.getX())) {
> observations[i + 1] = mI;
> if (i-- != 0) {
> mI = observations[i];
> } else {
> mI = null;
> }
> }
> // mI is not used further
> {code}
> It looks to me as though the "mI = null" statement is either redundant or wrong - why would one want to replace one of the observations with null during a sort?
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira