<br>This is not an issue of exception handling.<br><br>If you use &quot;declare&quot; you&#39;ll have to initialize all collection-typed fields properly<br>before you can call any methods, e.g.<br><br>Set set = new HashSet&lt;?&gt;()<br>
watcher.setValueSet( set );<br>set.add(...)<br><br>-W<br><br><br><br><div class="gmail_quote">2010/8/13 Tina Vießmann <span dir="ltr">&lt;<a href="mailto:tviessmann@stud.hs-bremen.de">tviessmann@stud.hs-bremen.de</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">


  

<div bgcolor="#ffffff" text="#000000">
Hi Edson,<br>
<br>
I can&#39;t provide a test case. But I&#39;ve figured out what the exception
are about. It&#39;s not about the code I&#39;ve posted before. It&#39;s about the
exceptions that the java.util.Set.add() method throws. I&#39;ve attached
the concerned code at the end.<br>
That means for me I have to manage the exception handling. I&#39;ve tried
to google the topic. The best I came up with is a mailing list entry:
<a href="http://drools-java-rules-engine.46999.n3.nabble.com/Exception-handling-policy-td113782.html" target="_blank">http://drools-java-rules-engine.46999.n3.nabble.com/Exception-handling-policy-td113782.html</a> 
Would that be the correct solution? If yes, how do I implement the
handler? I would be thankful for a code example.<br>
<br>
The code that the exception references is:<br>
<blockquote>declare Watcher<br>
    @role ( event )<br>
  <br>
    triggeringValue : Value<br>
    numberOfContainedValues : int<br>
    valueSet : Set  // Set&lt;Value&gt;<br>
end<br>
  <br>
// ....<br>
  <br>
function Watcher generateWatcherEvent(Value firstValue) {<br>
    Watcher watcher = new Watcher();<br>
    watcher.setNumberOfContainedValues(1);<br>
    watcher.setTriggeringValue(firstValue);<br>
    <br>
    // add value to set<br>
    Set set = watcher.getValueSet();<br>
    set.add(firstValue);<br>
    watcher.setValueSet(set);<br>
    <br>
    return watcher;<br>
}<br>
</blockquote>
<br>
Thanks for your help! :)<br>
<br>
Tina<br>
<br>
<br>
Am 13.08.2010 01:14, schrieb Edson Tirelli:
<blockquote type="cite">   Hi Tina,
  <div><br>
  </div>
  <div>   Can you provide a test case?</div>
  <div><br>
  </div>
  <div>   Edson<br>
  <br>
  <div class="gmail_quote">2010/8/12 Tina Vießmann <span dir="ltr">&lt;<a href="mailto:tviessmann@stud.hs-bremen.de" target="_blank">tviessmann@stud.hs-bremen.de</a>&gt;</span><br>
  <blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi
again ...<br>
    <br>
I would like to insert a new generated object into the knowledge base.<br>
It seems that<br>
    insert (new Watcher())<br>
 is working. But<br>
    Watcher watcher = new Watcher();<br>
    insert (watcher);<br>
 isn&#39;t working?<br>
    <br>
Why?<br>
    <br>
Thank you for any explanations. :)<br>
    <div>
    <div><br>
Tina<br>
_______________________________________________<br>
rules-users mailing list<br>
    <a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
    <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
    </div>
    </div>
  </blockquote>
  </div>
  <br>
  <br clear="all">
  <br>
-- <br>
  Edson Tirelli<br>
  JBoss Drools Core Development<br>
  JBoss by Red Hat @ <a href="http://www.jboss.com" target="_blank">www.jboss.com</a><br>
  </div>
  <pre><fieldset></fieldset>
_______________________________________________
rules-users mailing list
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a>
  </pre>
</blockquote>
<br>
</div>

<br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br>