Cloned object also clones new data, how to prevent that?
<p>EDIT:</p>

<p><strong>Thanks guys, got it! appears that the explode() function was called from the old object, rather then it's new clone! :)</strong></p>

<hr>

<p>I have a hashtable of such objects</p>

<pre><code>class rlBodyDataObj implements Cloneable {
...
World w;
Body b;
...
protected rlBodyDataObj clone() throws CloneNotSupportedException {
return (rlBodyDataObj) super.clone();
}
</code></pre>

<p>when needed, I make a clone of a needed object from the hashtable</p>

<pre><code>    rlBodyDataObj rlbo_master = bdoTable.get(name) ;
    rlBodyDataObj rlbo = null;
        try {
        rlbo = (rlBodyDataObj) rlbo_master.clone();
        } catch (CloneNotSupportedException e) { e.printStackTrace(); }
        ...
        rlbo.w = w;
        rlbo.b = body;
</code></pre>

<p>and pass the World and Body objects to my ALREADY CLONED rlBodyDataObj object.</p>

<p>Yet when I try to access this world and body object from with the rlBodyDataObj object, I get a NullPointException, as if they are cloned blanks.</p>

<p>Any ideas how to fix that?</p>

<p>Thanks!</p>
