Error when compiling project, java.lang.StackOverflowError

Hello, I got an error when I compiling my project. The message is:

Exception in thread "Thread-13495" java.lang.StackOverflowError
at java.util.regex.Pattern$GroupHead.match(Pattern.java:4658)
at java.util.regex.Pattern$Loop.match(Pattern.java:4785)
at java.util.regex.Pattern$GroupTail.match(Pattern.java:4717)... (and it continues)

I attach the functions causing this error message. I guess something is wrong with this line:

  statusDiv.innerHTML = \" <input type=\"button\" value=\"ON\" style=\"background-color: #00cc00; color: #ffffff;\" />  \";\n\

But sometimes it compiles the code without error message. I dont have an idea, its not much transparent put html code into c string.

htmlpage.c (1.9 KB)

The usual way to get a stack overflow error from the compiler is to have a string start with a double quote character but not be terminated. However, I could not find this problem in the attached file, and it wouldn't be intermittent.

However, I will point out that code like this:

  second()<10 ? s+=":0" : s+=":"; s+=second();

will lead to a different sort of problem if it happens to be executed just as the time changes. It would be better to save the value of second() and minute() and use the saved value for any decisions and for any concatenation onto a String. A similar problem exists for hour() as well. [Imagine that hour() is sampled at 10:59:59.999999 but then the time rolls over to 11:00:00 before minute() and second() get executed. The result could look like 10:00:00 when it is really 11:00:00, and the issue will be very hard to observe.]

Whatever you are using to get the time should have a way to get hours and minutes and seconds atomically.

vaj408: Thank you for reply, it was a really bug.

Besides that, I solved the problem using another type of filling String variable:

String s= "<!doctype html>"
  "<html>"
  "<head>"
  "<meta charset=\"utf-8\">" .....and so on

if someone have similar problem I recommend try to rewrite the code like this. And it is more transparent.

htmlpage2.c (2.26 KB)