Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Javabeans/ActiveX

Hello,

I packaged a simple Javabean into an ActiveX component and am having trouble
getting it to work.
In my Javabean,I create a custon Event.
but I find that it alway throws some exception during fire that evnet
Here is code:

protected void fireDataChanged(WaterEvent e) {
if (waterListeners != null) {
Vector listeners = waterListeners;
int count = listeners.size();
for (int i = 0; i < count; i++) {

/* when run next line ,it alway throw some unknown Exception */

((WaterListener) listeners.elementAt(i)).dataChanged(e);
}
}
}

what is wrong?

Thanks
[653 byte] By [Dean Liu] at [2007-11-9 21:19:13]
# 1 Re: Javabeans/ActiveX
There's no way for us to tell, but if you want to know what the exception
is, why not catch it and examine it?

try {
((WaterListener) listeners.elementAt(i)).dataChanged(e);
} catch(Exception ex) {
// print or log the exception
}

PC2

Dean Liu <deanliu@21cn.com> wrote in message
news:3a9243c1$1@news.dev-archive.com...
>
> Hello,
>
> I packaged a simple Javabean into an ActiveX component and am having
trouble
> getting it to work.
> In my Javabean,I create a custon Event.
> but I find that it alway throws some exception during fire that evnet
> Here is code:
>
> protected void fireDataChanged(WaterEvent e) {
> if (waterListeners != null) {
> Vector listeners = waterListeners;
> int count = listeners.size();
> for (int i = 0; i < count; i++) {
>
> /* when run next line ,it alway throw some unknown Exception */
>
> ((WaterListener) listeners.elementAt(i)).dataChanged(e);
> }
> }
> }
>
> what is wrong?
>
> Thanks
>
Paul Clapham at 2007-11-11 23:05:53 >