<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 09:00:35 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-3851] JsonReader EN locale assumption leads to NPE in natively compiled Java</title>
                <link>https://jira.mongodb.org/browse/JAVA-3851</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;GraalVM native images only supports a single locale, which is leading to an NPE in the mongodb driver, see &lt;a href=&quot;https://github.com/quarkusio/quarkus/issues/11524&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;this quarkus issue&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The problem is in the JsonReader, which assumes EN as an available locale. When the user changes the language to something else, e.g. Italian, the NPE appears. JsonReader  should assume the locale provided by the user and not EN.&lt;/p&gt;

&lt;p&gt;I&apos;ve created a temporary substitution that avoids the problem by returning a date as soon as its found (without checking the length), see &lt;a href=&quot;https://github.com/galderz/quarkus/blob/t_jsonreader_11524/extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/runtime/graal/BsonSubstitutions.java#L56&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;. I&apos;m unsure whether such fix would work for mongodb in general. The real fix should be to use the language provided by the user, and then it&apos;d be no problems.&lt;/p&gt;</description>
                <environment></environment>
        <key id="1498903">JAVA-3851</key>
            <summary>JsonReader EN locale assumption leads to NPE in natively compiled Java</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</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="13201">Fixed</resolution>
                                        <assignee username="jeff.yemin@mongodb.com">Jeffrey Yemin</assignee>
                                    <reporter username="galder@redhat.com">Galder Zamarre&#241;o</reporter>
                        <labels>
                    </labels>
                <created>Fri, 2 Oct 2020 13:13:36 +0000</created>
                <updated>Sat, 28 Oct 2023 11:21:33 +0000</updated>
                            <resolved>Tue, 3 Nov 2020 00:20:18 +0000</resolved>
                                    <version>4.1.0</version>
                                    <fixVersion>4.2.0</fixVersion>
                                    <component>JSON</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="3472864" author="xgen-internal-githook" created="Tue, 3 Nov 2020 00:11:58 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Jeff Yemin&apos;, &apos;email&apos;: &apos;jeff.yemin@mongodb.com&apos;, &apos;username&apos;: &apos;jyemin&apos;}
&lt;p&gt;Message: Replace SimpleDateFormat with DateDateFormatter for ISODate string parsing&lt;/p&gt;

&lt;p&gt;The JsonReader class already uses java.time.format.DateTimeFormatter for parsing&lt;br/&gt;
date strings from relaxed extended JSON. But for historical reasons it still&lt;br/&gt;
used the older java.text.SimpleDateFormat for parsing ISODate strings from shell&lt;br/&gt;
mode JSON.&lt;/p&gt;

&lt;p&gt;This patch replaces the SimpleDateFormat usage with DateTimeFormatter, which will&lt;br/&gt;
preserve the existing behavior, but also remove a dependency on Locale.ENGLISH&lt;br/&gt;
time zones, which has caused problems for some users of GraalVM (which in some&lt;br/&gt;
configurations does not include any of the resources associated with Locale.ENGLISH.&lt;/p&gt;

&lt;p&gt;Note that SimpleDateFormat is still used when parsing date strings for the shell-mode&lt;br/&gt;
Date constructor, but that is less commonly used and in addition the current shell&lt;br/&gt;
support is not localizable and is tied to English-language usage.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-3851&quot; title=&quot;JsonReader EN locale assumption leads to NPE in natively compiled Java&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-3851&quot;&gt;&lt;del&gt;JAVA-3851&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/commit/e8808e359184dbda314515afa24b75a96e4e69fa&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/e8808e359184dbda314515afa24b75a96e4e69fa&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3464219" author="JIRAUSER1256945" created="Tue, 27 Oct 2020 07:44:38 +0000"  >&lt;p&gt;This is not so much about Quarkus, but GraalVM in general. It only includes resource bundles for the local locale when building native executables, see&#160;&lt;a href=&quot;https://github.com/oracle/graal/issues/911&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/oracle/graal/issues/911&lt;/a&gt;.&#160;Time and timezones can be translated using these resource bundles.&lt;/p&gt;

&lt;p&gt;If the user has a different locale to ENGLISH, would things work fine when mongodb is accessed via a natively compiled java application? In some cases, like &lt;a href=&quot;https://github.com/quarkusio/quarkus/issues/11524,&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/quarkusio/quarkus/issues/11524,&lt;/a&gt;&#160;it seems to break, but fortunately a workaround was found. Maybe other workarounds can be found.&lt;/p&gt;</comment>
                            <comment id="3463784" author="jeff.yemin" created="Mon, 26 Oct 2020 20:24:49 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=galder%40redhat.com&quot; class=&quot;user-hover&quot; rel=&quot;galder@redhat.com&quot;&gt;galder@redhat.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Glad to hear that this can be worked around in Quarkus itself for now.  Regarding my question from earlier:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;I also noticed that there are hundreds of places in the JDK itself that reference Locale.ENGLISH. I haven&apos;t investigated the usages deeply, but it seems likely that at least one of them could cause application issues if that Locale is unavailable. Are you sure that it&apos;s a safe assumption to say that Locale.ENGLISH should not generally be required?&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Similarly, &lt;tt&gt;Locale.ROOT&lt;/tt&gt; is also used all over the place in the JDK.&lt;/p&gt;

&lt;p&gt;Can you or someone else from the Quarkus team respond?  I&apos;d like to know the answer before we invest in addressing this.&lt;/p&gt;</comment>
                            <comment id="3423436" author="jeff.yemin" created="Fri, 2 Oct 2020 18:01:38 +0000"  >&lt;p&gt;I posted a proposed workaround to the original reporter at &lt;a href=&quot;https://github.com/quarkusio/quarkus/issues/11524&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/quarkusio/quarkus/issues/11524&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3423241" author="jeff.yemin" created="Fri, 2 Oct 2020 16:30:06 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=galder%40redhat.com&quot; class=&quot;user-hover&quot; rel=&quot;galder@redhat.com&quot;&gt;galder@redhat.com&lt;/a&gt; thanks for reporting this, as we really want MongoDB to work well with both Quarkus and GraalVM.&lt;/p&gt;

&lt;p&gt;I also noticed that there are hundreds of places in the JDK itself that reference &lt;tt&gt;Locale.ENGLISH&lt;/tt&gt;.  I haven&apos;t investigated the usages deeply, but it seems likely that at least one of them could cause application issues if that Locale is unavailable. Are you sure that it&apos;s a safe assumption to say that &lt;tt&gt;Locale.ENGLISH&lt;/tt&gt; should not generally be required?&lt;/p&gt;

&lt;p&gt;Regarding your workaround, I don&apos;t think it&apos;s correct.  It avoids the exception by breaking out of the loop before it gets to the format string that contains the time zone.  This will cause the method to return a date that is stripped of everything but the date.  For example, the string &lt;tt&gt;2013-10-04T12:07:30.443Z&lt;/tt&gt; will return the date &lt;tt&gt;1380859200000&lt;/tt&gt; instead of &lt;tt&gt;1380888450443&lt;/tt&gt;.  &lt;/p&gt;

&lt;p&gt;If we can figure out a substitution that does work correctly, also note that there are two other methods in &lt;tt&gt;JsonReader&lt;/tt&gt; that rely on &lt;tt&gt;Locale.ENGLISH&lt;/tt&gt;.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                        <customfield id="customfield_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10038"><![CDATA[Fully Compatible]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <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|hr69y7:</customfieldvalue>

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