[JSCIENCE-69] AlternateUnit constructor results in a NPE if the 'parent' argument is a non-standard unit Created: 28/Nov/07  Updated: 31/Jan/11

Status: Open
Project: jscience
Component/s: www
Affects Version/s: current
Fix Version/s: Version 6.0

Type: Bug Priority: Blocker
Reporter: shanmann Assignee: jscience-issues
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: All
Platform: All

Issuezilla Id: 69


This issue was noticed in JScience v4.3.1.

If the parent argument to the AlternateUnit constructor is not a standard unit,
this results in a NullPointerException. I believe this occurs because the
string expression argument to 'new UnsupportedException(...)' references 'this',
when maybe it should use 'parent'.

The relevent code snippet from AlternateUnit(String symbol, Unit<?> parent) is
shown below.

if (!parent.isStandardUnit())
throw new UnsupportedOperationException(this
+ " is not a standard unit");

Generated at Sun Nov 29 14:35:09 UTC 2015 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.