<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:59:58 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-3592] BSON Descriminator does not work after a mongo client is closed</title>
                <link>https://jira.mongodb.org/browse/JAVA-3592</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;BSON Discriminator annotation does not seem to work properly after a mongo client is closed.&lt;/p&gt;

&lt;p&gt;I have created a repo replicating the bug which you can find here: &lt;a href=&quot;https://github.com/jerouris/Mongo-bson-discrimination-bug&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/jerouris/Mongo-bson-discrimination-bug&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</description>
                <environment></environment>
        <key id="1094443">JAVA-3592</key>
            <summary>BSON Descriminator does not work after a mongo client is closed</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="13202">Works as Designed</resolution>
                                        <assignee username="ross@mongodb.com">Ross Lawley</assignee>
                                    <reporter username="jerouris@gmail.com">Jerry DIMITRIOU</reporter>
                        <labels>
                    </labels>
                <created>Wed, 15 Jan 2020 13:11:43 +0000</created>
                <updated>Fri, 27 Oct 2023 13:21:01 +0000</updated>
                            <resolved>Wed, 15 Jan 2020 14:39:43 +0000</resolved>
                                    <version>3.12.0</version>
                                                    <component>Codecs</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="2731386" author="ross@10gen.com" created="Wed, 15 Jan 2020 14:39:43 +0000"  >&lt;p&gt;Thanks &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=jerouris%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;jerouris@gmail.com&quot;&gt;jerouris@gmail.com&lt;/a&gt;, will look to improve the error messaging and documentation.&lt;/p&gt;</comment>
                            <comment id="2731355" author="jerouris@gmail.com" created="Wed, 15 Jan 2020 14:32:40 +0000"  >&lt;p&gt;Hi Ross,&lt;/p&gt;

&lt;p&gt;OK, I got it! This means that &lt;tt&gt;@BsonDiscriminator&lt;/tt&gt; annotations and &lt;tt&gt;PojoCodecProvider.builder().automatic(true)&lt;/tt&gt; does not work well together, because the automatic scanner will register the class lazily on insert.&lt;/p&gt;

&lt;p&gt;I&apos;ve changed the code of the PojoCodecProvider to:&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;PojoCodecProvider&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;         .builder()&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;         .register(&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&quot;discriminatorbug&quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;)&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;         .build())&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;and the classes are now properly registered. I would recommend having that remark somewhere in the docs. There are also &lt;a href=&quot;https://github.com/micronaut-projects/micronaut-mongodb/issues/10&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;others &lt;/a&gt;having the same issue, not knowing how easy it is to fix.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;The issue can be closed.&lt;/p&gt;</comment>
                            <comment id="2730132" author="ross@10gen.com" created="Wed, 15 Jan 2020 13:51:23 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=jerouris%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;jerouris@gmail.com&quot;&gt;jerouris@gmail.com&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Thanks for the ticket and the excellent repro case! The issue here is the use of shortnames for the discriminator for the classes that have not been explicitly registered by the POJO Codec.  The automatic POJO codec registry can only handle classes its seen and as you recreate the registry to simulate a restart, then any reference to these short forms have been lost.  &lt;/p&gt;

&lt;p&gt;In this case you either have to remove the shortnames - so that the full class path is used and they can be loaded by the automatic POJO codec registry, orr explicitly register any classes that use shorten names for their discriminator.&lt;/p&gt;

&lt;p&gt;I hope that helps,&lt;/p&gt;

&lt;p&gt;Ross&lt;/p&gt;</comment>
                            <comment id="2730085" author="ross@10gen.com" created="Wed, 15 Jan 2020 13:42:09 +0000"  >&lt;p&gt;The error is: &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;org.bson.codecs.configuration.CodecConfigurationException: An exception occurred when decoding using the AutomaticPojoCodec.&lt;br/&gt;
Decoding into a &apos;TheAbstractClass&apos; failed with the following exception:&lt;/p&gt;

&lt;p&gt;Failed to decode &apos;TheAbstractClass&apos;. Decoding errored with: A class could not be found for the discriminator: &apos;FirstConcreteClass&apos;.&lt;/p&gt;

&lt;p&gt;A custom Codec or PojoCodec may need to be explicitly configured and registered to handle this type.&lt;/p&gt;&lt;/blockquote&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|hw619b:</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>