<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:51:25 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[JAVA-57] JSON serialize can&apos;t handle regex patterns</title>
                <link>https://jira.mongodb.org/browse/JAVA-57</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;I generally log all queries in my development environment, but can&apos;t log queries involving regular expressions withour getting a &quot;json can&apos;t serialize type  &quot; exception thrown.&lt;/p&gt;

&lt;p&gt;I&apos;ve modified a copy of the source code to include:&lt;/p&gt;

&lt;p&gt;        if (o instanceof Pattern) &lt;/p&gt;
{
            buf.append(&quot;/&quot;).append(o.toString()).append(&quot;/&quot;).append(Bytes.patternFlags( ((Pattern)o).flags() ));
            return;
        }

&lt;p&gt;just before the throw at the end of serialize(Object,StringBuilder) in JSON.java and it seems to do the job. I&apos;m not sure if you need an equivalent section in parse (since I&apos;m not sure when json gets parsed)&lt;/p&gt;

&lt;p&gt;I also added a rudmentary unit test in JSONTest.java:&lt;/p&gt;

&lt;p&gt;    @org.testng.annotations.Test&lt;br/&gt;
    public void testPattern() &lt;/p&gt;
{
        Pattern pattern = Pattern.compile(&quot;^Hello$&quot;, Pattern.CASE_INSENSITIVE);
        assertEquals(&quot;/^Hello$/i&quot;, JSON.serialize(pattern));
    }

&lt;p&gt;I would try to commit a patch, but I&apos;ve never done that before, and I use windows and git thinks I&apos;ve changed file permissions on several of the files.&lt;/p&gt;</description>
                <environment>All</environment>
        <key id="10928">JAVA-57</key>
            <summary>JSON serialize can&apos;t handle regex patterns</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="4" iconUrl="https://jira.mongodb.org/images/icons/priorities/minor.svg">Minor - P4</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="9">Done</resolution>
                                        <assignee username="eliot">Eliot Horowitz</assignee>
                                    <reporter username="keithbranton">Keith Branton</reporter>
                        <labels>
                    </labels>
                <created>Mon, 30 Nov 2009 17:31:58 +0000</created>
                <updated>Wed, 13 Jan 2010 15:51:02 +0000</updated>
                            <resolved>Mon, 30 Nov 2009 23:28:04 +0000</resolved>
                                    <version>1.0</version>
                                    <fixVersion>1.1</fixVersion>
                                                        <votes>0</votes>
                                    <watches>0</watches>
                                                                                                                <comments>
                            <comment id="11255" author="auto" created="Mon, 30 Nov 2009 23:28:02 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Eliot Horowitz&apos;, &apos;email&apos;: &apos;eliot@10gen.com&apos;}
&lt;p&gt;Message: make JSON support regex &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-57&quot; title=&quot;JSON serialize can&amp;#39;t handle regex patterns&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-57&quot;&gt;&lt;del&gt;JAVA-57&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href=&quot;http://github.com/mongodb/mongo-java-driver/commit/48fbd2ad5b3d7d2c8fde2cb9bec2da55958e30e2&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://github.com/mongodb/mongo-java-driver/commit/48fbd2ad5b3d7d2c8fde2cb9bec2da55958e30e2&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hrhdh3:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>14983</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>