<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:51:40 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-174] prevent stack overflow in case of erroneous cyclic reference</title>
                <link>https://jira.mongodb.org/browse/JAVA-174</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;Synthetic example, but possible real case: &lt;/p&gt;

&lt;p&gt;Domain class &lt;br/&gt;
---------------------------------------------&lt;/p&gt;

&lt;p&gt;public class E3 extends ReflectionDBObject {&lt;br/&gt;
    private String stringData;&lt;br/&gt;
    private E4 e4data;&lt;/p&gt;

&lt;p&gt;    public E3() {&lt;br/&gt;
    }&lt;/p&gt;

&lt;p&gt;    public E3(String stringData, E4 e4data) &lt;/p&gt;
{
        this.stringData = stringData;
        this.e4data = e4data;
    }

&lt;p&gt;    public String getStringData() &lt;/p&gt;
{
        return stringData;
    }

&lt;p&gt;    public void setStringData(String stringData) &lt;/p&gt;
{
        this.stringData = stringData;
    }

&lt;p&gt;    public E4 getE4data() &lt;/p&gt;
{
        return e4data;
    }

&lt;p&gt;    public void setE4data(E4 e4data) &lt;/p&gt;
{
        this.e4data = e4data;
    }
&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;Domain class&lt;br/&gt;
---------------------------------------------&lt;/p&gt;

&lt;p&gt;public class E4 extends ReflectionDBObject {&lt;br/&gt;
    private int integerData;&lt;br/&gt;
    private E3 e3data;&lt;/p&gt;

&lt;p&gt;    public E4() {&lt;br/&gt;
    }&lt;/p&gt;

&lt;p&gt;    public E4(int integerData, E3 e3data) &lt;/p&gt;
{
        this.integerData = integerData;
        this.e3data = e3data;
    }

&lt;p&gt;    public int getIntegerData() &lt;/p&gt;
{
        return integerData;
    }

&lt;p&gt;    public void setIntegerData(int integerData) &lt;/p&gt;
{
        this.integerData = integerData;
    }

&lt;p&gt;    public E3 getE3data() &lt;/p&gt;
{
        return e3data;
    }

&lt;p&gt;    public void setE3data(E3 e3data) &lt;/p&gt;
{
        this.e3data = e3data;
    }
&lt;p&gt;}&lt;/p&gt;


&lt;p&gt;Application code&lt;br/&gt;
---------------------------------------------&lt;/p&gt;

&lt;p&gt;E3 e3 = new E3();&lt;br/&gt;
E4 e4 = new E4(4, e3);&lt;br/&gt;
e3.setE4data(e4);&lt;br/&gt;
e3.setStringData(&quot;e3&quot;);&lt;/p&gt;

&lt;p&gt;coll.save(e3);&lt;/p&gt;

&lt;p&gt;---------------------------------------------&lt;/p&gt;

&lt;p&gt;Exception in thread &quot;main&quot; java.lang.StackOverflowError&lt;br/&gt;
...&lt;br/&gt;
	at com.mongodb.ReflectionDBObject$JavaWrapper.get(ReflectionDBObject.java:155)&lt;br/&gt;
	at com.mongodb.ReflectionDBObject.get(ReflectionDBObject.java:31)&lt;br/&gt;
	at com.mongodb.DBCollection._checkKeys(DBCollection.java:852)&lt;br/&gt;
	at com.mongodb.DBCollection._checkKeys(DBCollection.java:853)&lt;br/&gt;
	at com.mongodb.DBCollection._checkKeys(DBCollection.java:853)&lt;br/&gt;
...&lt;/p&gt;
</description>
                <environment></environment>
        <key id="13271">JAVA-174</key>
            <summary>prevent stack overflow in case of erroneous cyclic reference</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</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="2">Won&apos;t Fix</resolution>
                                        <assignee username="antoine">Antoine Girbal</assignee>
                                    <reporter username="ilya">Ilya Brodotsky</reporter>
                        <labels>
                    </labels>
                <created>Wed, 6 Oct 2010 10:02:29 +0000</created>
                <updated>Tue, 25 Jun 2013 11:07:40 +0000</updated>
                            <resolved>Tue, 15 Feb 2011 22:29:32 +0000</resolved>
                                    <version>2.1</version>
                                    <fixVersion>2.5</fixVersion>
                                    <component>Codecs</component>
                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="23967" author="antoine" created="Tue, 15 Feb 2011 22:29:20 +0000"  >&lt;p&gt;thanks for reporting issue.&lt;br/&gt;
Fixing it would require keeping a hashmap of already checked objects.&lt;br/&gt;
This would clutter the code and slow down operations.&lt;br/&gt;
The case you describe should be a fail-fast, meaning that the error will happen right away when cyclical references are inserted, and the user will be able to work around it during dev phase.&lt;br/&gt;
I dont think this needs a fix.&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|hrgion:</customfieldvalue>

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