FHIR Chat · decimal error in Location example · IG creation

Stream: IG creation

Topic: decimal error in Location example


view this post on Zulip Eric Haas (Jul 23 2019 at 22:41):

This is a brand new error that cropped up today.

I get the following error in this IG: http://build.fhir.org/ig/HL7/davinci-alerts/branches/master/index.html

Location/hl7east: Location.position.longitude   error   The value '-72.519854' is not a valid decimal

are there some new requriements for decimals like these?

view this post on Zulip Grahame Grieve (Jul 24 2019 at 12:04):

I don't see this?

view this post on Zulip Grahame Grieve (Jul 24 2019 at 12:05):

not when building locally anyway. do you see it locally?

view this post on Zulip Grahame Grieve (Jul 24 2019 at 12:09):

@James Agnew this looks like some Java localization issue to me. Here's the code in question:

    public static boolean isDecimal(String string) {
      if (isBlank(string)) {
        return false;
      }
      boolean havePeriod = false;
      for (char next : string.toCharArray()) {
        if (next == '.') {
          if (havePeriod) {
            return false;
          }
          havePeriod = true;
        } else if (!Character.isDigit(next)) {
          return false;
        }
      }
      return true;
    }

view this post on Zulip Grahame Grieve (Jul 24 2019 at 12:09):

is there some localization issue there I can't see?

view this post on Zulip Rick Geimer (Jul 24 2019 at 15:57):

That code seems to fail on "-" (the leading minus sign) based on my eyeball parser. I guess it expects decimals to be positive?

view this post on Zulip Eric Haas (Jul 24 2019 at 18:56):

Also in my local machine as well

view this post on Zulip Eric Haas (Jul 24 2019 at 18:57):

Only cropped up yesterday with a ig pub update

view this post on Zulip James Agnew (Jul 24 2019 at 20:07):

Yeah, I'd agree with Rick. That code won't understand the - and will return false as a result.

view this post on Zulip Grahame Grieve (Jul 24 2019 at 21:37):

duh. foolish on my part. But I didn't think in that direction since I didn't get the error. Not sure why not. I've fixed, will release shortly


Last updated: Apr 12 2022 at 19:14 UTC