-
Type: Bug
-
Resolution: Done
-
Priority: Minor - P4
-
Affects Version/s: 1.0
-
Component/s: None
-
Labels:None
-
Environment:All
I generally log all queries in my development environment, but can't log queries involving regular expressions withour getting a "json can't serialize type " exception thrown.
I've modified a copy of the source code to include:
if (o instanceof Pattern)
{ buf.append("/").append(o.toString()).append("/").append(Bytes.patternFlags( ((Pattern)o).flags() )); return; }just before the throw at the end of serialize(Object,StringBuilder) in JSON.java and it seems to do the job. I'm not sure if you need an equivalent section in parse (since I'm not sure when json gets parsed)
I also added a rudmentary unit test in JSONTest.java:
@org.testng.annotations.Test
public void testPattern()
I would try to commit a patch, but I've never done that before, and I use windows and git thinks I've changed file permissions on several of the files.