<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 09:00:49 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-3935] PojoCodecProvider recognition of classes with discriminators only</title>
                <link>https://jira.mongodb.org/browse/JAVA-3935</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;&lt;tt&gt;A custom Codec or PojoCodec may need to be explicitly configured and registered to handle this type.&lt;/tt&gt; exception can be raised when a class without properties (discriminator only) is a base class of one class as well as a nominal type in another class.&lt;/p&gt;</description>
                <environment></environment>
        <key id="1589277">JAVA-3935</key>
            <summary>PojoCodecProvider recognition of classes with discriminators only</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="3">Duplicate</resolution>
                                        <assignee username="ross@mongodb.com">Ross Lawley</assignee>
                                    <reporter username="alex.bevilacqua@mongodb.com">Alex Bevilacqua</reporter>
                        <labels>
                    </labels>
                <created>Wed, 13 Jan 2021 21:19:22 +0000</created>
                <updated>Fri, 5 Feb 2021 15:58:41 +0000</updated>
                            <resolved>Fri, 5 Feb 2021 15:58:41 +0000</resolved>
                                                                    <component>POJO</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="3601701" author="ross@10gen.com" created="Fri, 5 Feb 2021 15:58:04 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=john.lilley%40redpointglobal.com&quot; class=&quot;user-hover&quot; rel=&quot;john.lilley@redpointglobal.com&quot;&gt;john.lilley@redpointglobal.com&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Thanks for the update.  I&apos;ll close this ticket out, please follow &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-4001&quot; title=&quot;Automatic / package based PojoCodecs require fields&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-4001&quot;&gt;JAVA-4001&lt;/a&gt; for the fix for automatic / package based PojoCodecs.&lt;/p&gt;

&lt;p&gt;All the best,&lt;/p&gt;

&lt;p&gt;Ross&lt;/p&gt;</comment>
                            <comment id="3601664" author="john.lilley@redpointglobal.com" created="Fri, 5 Feb 2021 15:46:48 +0000"  >&lt;p&gt;I have verified that the workaround of &lt;tt&gt;useDiscriminator = true&lt;/tt&gt; does fix the issue.&lt;/p&gt;

&lt;p&gt;This is the comment left in my support ticket.&#160; It may be relevant:&lt;/p&gt;

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

&lt;p&gt;My name is **** and I&apos;ll be assisting my colleagues with this case.&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;This is done to provide a user-friendly getter that never returns null, while preserving the Mongodb getter that omits null fields. But my question is, why did this change matter, and is it a valid &quot;fix&quot; to the problem?&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;The root cause of the exception turns out to have nothing to do with the use of discriminators. Rather, it&apos;s that the&#160;&lt;tt&gt;PojoCodecProvider&lt;/tt&gt;&#160;doesn&apos;t recognize classes with no properties as POJOs. Since&#160;&lt;tt&gt;SettingValue&lt;/tt&gt;, the base class for&#160;&lt;tt&gt;SettingValueDashboard&lt;/tt&gt;&#160;and also the nominal type of the value property in the&#160;&lt;tt&gt;SettingClass&lt;/tt&gt;, has no properties, no Codec is found for that class and therefore an exception is thrown.&lt;/p&gt;

&lt;p&gt;To work around this restriction, you can either&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Add at least one property to&#160;&lt;tt&gt;SettingValue&lt;/tt&gt;&lt;/li&gt;
	&lt;li&gt;Change the type of&#160;&lt;tt&gt;Setting.value&lt;/tt&gt;&#160;to&#160;&lt;tt&gt;SettingValueDashboard&lt;/tt&gt;&lt;/li&gt;
&lt;/ul&gt;
</comment>
                            <comment id="3601643" author="ross@10gen.com" created="Fri, 5 Feb 2021 15:41:29 +0000"  >&lt;p&gt;I also added &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-4001&quot; title=&quot;Automatic / package based PojoCodecs require fields&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-4001&quot;&gt;JAVA-4001&lt;/a&gt; - which highlights the issue with automatic / package based PojoCodecs, where ClassModels don&apos;t contain any properties.&lt;/p&gt;

&lt;p&gt;Ross &lt;/p&gt;</comment>
                            <comment id="3601633" author="ross@10gen.com" created="Fri, 5 Feb 2021 15:39:25 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=ross.lawley&quot; class=&quot;user-hover&quot; rel=&quot;ross.lawley&quot;&gt;ross.lawley&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;When using automatic / package based PojoCodecs can sometimes need help with discriminator lookups. We have &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-3707&quot; title=&quot;Support package scanning for Discriminators&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-3707&quot;&gt;JAVA-3707&lt;/a&gt; to improve looking up discriminators.&lt;/p&gt;

&lt;p&gt;Regarding the scratch repo, the issue in the &lt;tt&gt;Setting&lt;/tt&gt; class &lt;tt&gt;@BsonProperty&lt;/tt&gt; defaults to false for fields using discriminators - enabling it should fix your issue.&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;	@BsonProperty(value = &quot;value&quot;, useDiscriminator = true)&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;	public final SettingValue getValue() { &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;		return value;&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;	}&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;Ross&lt;/p&gt;</comment>
                            <comment id="3563805" author="john.lilley@redpointglobal.com" created="Wed, 13 Jan 2021 23:03:05 +0000"  >&lt;p&gt;The attached scratch.zip demonstrates the issue&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="1324090">JAVA-3707</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="1614167">JAVA-4001</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="295278" name="scratch.zip" size="7535" author="john.lilley@redpointglobal.com" created="Wed, 13 Jan 2021 23:02:46 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                    <customfield id="customfield_13552" key="com.go2group.jira.plugin.crm:crm_generic_field">
                        <customfieldname>Case</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[[5002K00000ryVFtQAM]]]></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|hyb3qf:</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>