Help! How can I neutralize a BigDecimal?

john's Avatar


28 Jan, 2017 06:33 AM

Here is a bug that was hard to find:

I was doing a json query of address locations using Google's Maps Geocoding API. I fed it a list of 400 city names and it failed on city 335.

The latitude and longitude looked perfectly normal for that city, but I eventually discovered that the class of the longitude was java.math.BigDecimal. All the other latitudes and longitudes were java.lang.Double. For some reason, Google decided to send that one value as a BigDecimal.

NodeBox does not seem to like BigDecimals. The longitude lookup on the json query result returned the value but I can't do anything with it. If I feed it into a number or integer or string node, I get a type mismatch error. If I feed it into a make point node I get a null point error. If I try using a compare node I get "java.lang.Double cannot be cast to java.math.BigDecimal". I can't add 0 to it or round it. I can't cull the list based on class because the equals node gets a type mismatch on class lookups.

Help! Is there anything I can do to neutralize this radioactive number?



  1. Support Staff 1 Posted by john on 29 Jan, 2017 07:22 AM

    john's Avatar

    In case you want to test this I am attaching an example.

    This network takes any address and uses a free Google API to return latitude and longitude, which it plots as a red dot on a grid.

    Most city names work fine (London, Paris, etc.). But if you change the city to Slough (a town in the UK near London) you'll get an error. This happens because Google returns a bigDecimal instead of the usual langDouble for Slough's longitude. (To verify this, attach a lookup node to the output of the "longitude" node and set the lookup key to "class".)

    I've been thinking what the easiest way to fix this would be. I notice that other languages handle this sort of problem by converting troublesome values to strings, which can then be turned back into supported numerical formats as needed.

    I tried doing this with NodeBox, but the string node turned up its nose at a bigDecimal. I think you should be able to cast just about anything to a string. If the string node would accept a bigDouble that would give me a reasonable workaround.


  2. Support Staff 2 Posted by john on 09 Feb, 2017 08:24 PM

    john's Avatar

    Anybody there?

  3. Support Staff 3 Posted by john on 27 Feb, 2017 11:01 PM

    john's Avatar

    Is anyone on staff reviewing this forum? This is not an urgent issue, but I would appreciate an acknowledgement that my comments were read and understood.

    Do you agree that string nodes should accept all formats including bigDoubles? If so, can you at least add that to the issues list? Or even better, just transparently convert bigDoubles to floating points. Or at least throw a meaningful error.

    Also, please see the related thread Geocoding Null Error. This problem has occurred before and is hard to spot.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

16 May, 2024 02:11 AM
16 May, 2024 01:58 AM
14 May, 2024 01:29 AM
13 May, 2024 12:36 AM
12 May, 2024 07:46 PM


05 May, 2024 04:38 PM
03 May, 2024 06:50 AM
03 May, 2024 12:30 AM
03 May, 2024 12:09 AM
19 Apr, 2024 04:41 AM
16 Apr, 2024 06:18 PM