﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
4020	"""JSON object expected ',' or '}'"" error on FMU load"	anatoly.trosinenko@…	Adeel Asghar	"I try to load FMU generated by OpenModelica using JavaFMI library on Ubuntu 16.04 64 bit.
When loading with locale set to {{{ru_RU.UTF-8}}} I get the following error:
{{{
JSON object expected ',' or '}', got: ""lineEnd"":2,""colStar
}}}
When I specify {{{LANG=C}}} it works well.

HOW TO REPRODUCE:

1) Compile the following model using OpenModelica 1.9.6:
{{{#!modelica
model Trivial
  Real x;
equation
  x = time;
end Trivial;
}}}

2) Load it using the following Java code (uses JavaFMI 2.16.10 library) with {{{LANG=ru_RU.UTF-8}}}:

{{{#!java
import org.javafmi.wrapper.generic.Simulation;

public class Test {
    public static void main(String args[]) {
        Simulation sim = new Simulation(""/tmp/Trivial.fmu"");
        sim.init(0.0, 1.0);
        sim.terminate();
    }
}
}}}

3) Repeat step 2 with {{{LANG=C}}}

EXPECTED BEHAVIOR:

Nothing is printed to terminal, program finishes correctly on both steps 2 and 3.

REAL BEHAVIOR:

On step 2, error message {{{JSON object expected ',' or '}', got: ""lineEnd"":2,""colStar}}} is printed to terminal and program terminates with SIGABRT.
On step 3 it works as expected.

DEBUGGING:

It seems that the problem is with the function {{{skipValue()}}} from file {{{simulation_info_json.c}}} that can be found inside an FMU in {{{include/simulation}}} directory.
It has the following code:
{{{
    char *endptr = NULL;
    strtod(str,&endptr);
    if (str == endptr) {
      fprintf(stderr, ""Not a number, got %.20s\n"", str);
       abort();
    }
    return endptr;
}}}
When using Russian locale, decimal delimiter is not point but comma, so when {{{strtod}}} is used to skip an integer in the middle of JSON object, it skips field delimiter too, that confuses {{{skipObjectRest()}}}."	defect	new	normal	Future	FMI				
