CSSParser icon indicating copy to clipboard operation
CSSParser copied to clipboard

Sometimes String values parsed as Floats

Open LeoSchleicher opened this issue 8 years ago • 1 comments

.. breaking all possible things. For example, I have color value such a '#abcdef' parsed as '4.00164130740909e+175' string. Unfortunately, I can't write a test with 100% catch. This error comes really sometimes and every time on different rules. It may be a multithreading issue.

I have a small workaround, but as I don't undersand Katana internals, I'm not 100 sure it works properly.

https://github.com/LeoSchleicher/CSSParser/commit/6c793130f4bcad0e40a90a51595338c2b7d02e3f

LeoSchleicher avatar Oct 09 '17 07:10 LeoSchleicher

No, I was completely wrong. Katana value.value.string is always not null. The Problem is that on my test devices some string values appears in allowed float range (>= Double.leastNormalMagnitude) and some of them jumped above 1.0e+200.

So, as next workaround I check if float is in range from 1.0e-10 to 1.0e+10, then assume it as float, otherwise as string.

LeoSchleicher avatar Oct 09 '17 09:10 LeoSchleicher