This is not an issue of exception handling.
If you use "declare" you'll have to initialize all collection-typed fields
properly
before you can call any methods, e.g.
Set set = new HashSet<?>()
watcher.setValueSet( set );
set.add(...)
-W
2010/8/13 Tina Vießmann <tviessmann(a)stud.hs-bremen.de>
Hi Edson,
I can't provide a test case. But I've figured out what the exception are
about. It's not about the code I've posted before. It's about the exceptions
that the java.util.Set.add() method throws. I've attached the concerned code
at the end.
That means for me I have to manage the exception handling. I've tried to
google the topic. The best I came up with is a mailing list entry:
http://drools-java-rules-engine.46999.n3.nabble.com/Exception-handling-po...
Would that be the correct solution? If yes, how do I implement the handler?
I would be thankful for a code example.
The code that the exception references is:
declare Watcher
@role ( event )
triggeringValue : Value
numberOfContainedValues : int
valueSet : Set // Set<Value>
end
// ....
function Watcher generateWatcherEvent(Value firstValue) {
Watcher watcher = new Watcher();
watcher.setNumberOfContainedValues(1);
watcher.setTriggeringValue(firstValue);
// add value to set
Set set = watcher.getValueSet();
set.add(firstValue);
watcher.setValueSet(set);
return watcher;
}
Thanks for your help! :)
Tina
Am 13.08.2010 01:14, schrieb Edson Tirelli:
Hi Tina,
Can you provide a test case?
Edson
2010/8/12 Tina Vießmann <tviessmann(a)stud.hs-bremen.de>
> Hi again ...
>
> I would like to insert a new generated object into the knowledge base.
> It seems that
> insert (new Watcher())
> is working. But
> Watcher watcher = new Watcher();
> insert (watcher);
> isn't working?
>
> Why?
>
> Thank you for any explanations. :)
>
> Tina
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
--
Edson Tirelli
JBoss Drools Core Development
JBoss by Red Hat @
www.jboss.com
_______________________________________________
rules-users mailing
listrules-users@lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users