James Hughes
2008-12-04 13:27:23 UTC
Hello,
I couldn't get any information on this elsewhere and I am confused. Why does x.round() throw an NPE when it's not null (see below)?
groovy> def x = 300*(365/12)
groovy> x
Result: 9125.0000000100
------
groovy> def x = 300*(365/12)
groovy> x.class
Result: class java.math.BigDecimal
-------
groovy> def x = 300*(365/12)
groovy> x.round()
Exception thrown: java.lang.NullPointerException
java.lang.NullPointerException
at Script18.run(Script18:2)
--------------------------------------------------------------------
This e-mail is intended solely for the addressee and is strictly confidential; if you are not the addressee please destroy the message and all copies. Any opinion or information contained in this email or its attachments that does not relate to the business of Kainos
is personal to the sender and is not given by or endorsed by Kainos. Kainos is the trading name of Kainos Software Limited, registered in Northern Ireland under company number: NI19370, having its registered offices at: Kainos House, 4-6 Upper Crescent, Belfast, BT7 1NT,
Northern Ireland. Registered in the UK for VAT under number: 454598802 and registered in Ireland for VAT under number: 9950340E. This email has been scanned for all known viruses by MessageLabs but is not guaranteed to be virus free; further terms and conditions may be
found on our website - www.kainos.com
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
I couldn't get any information on this elsewhere and I am confused. Why does x.round() throw an NPE when it's not null (see below)?
groovy> def x = 300*(365/12)
groovy> x
Result: 9125.0000000100
------
groovy> def x = 300*(365/12)
groovy> x.class
Result: class java.math.BigDecimal
-------
groovy> def x = 300*(365/12)
groovy> x.round()
Exception thrown: java.lang.NullPointerException
java.lang.NullPointerException
at Script18.run(Script18:2)
--------------------------------------------------------------------
This e-mail is intended solely for the addressee and is strictly confidential; if you are not the addressee please destroy the message and all copies. Any opinion or information contained in this email or its attachments that does not relate to the business of Kainos
is personal to the sender and is not given by or endorsed by Kainos. Kainos is the trading name of Kainos Software Limited, registered in Northern Ireland under company number: NI19370, having its registered offices at: Kainos House, 4-6 Upper Crescent, Belfast, BT7 1NT,
Northern Ireland. Registered in the UK for VAT under number: 454598802 and registered in Ireland for VAT under number: 9950340E. This email has been scanned for all known viruses by MessageLabs but is not guaranteed to be virus free; further terms and conditions may be
found on our website - www.kainos.com
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email