Bug#472053: Fwd: [Rxtx] gnu.io.RXTXPort discards exception silently if initialization fails

Scott Howard showard314 at gmail.com
Wed Jun 23 21:17:21 UTC 2010


---------- Forwarded message ----------
From: Kustaa Nyholm <Kustaa.Nyholm at planmeca.com>
Date: Wed, Jun 23, 2010 at 5:55 AM
Subject: Re: [Rxtx] gnu.io.RXTXPort discards exception silently if
initialization fails
To: "rxtx at qbang.org" <rxtx at qbang.org>



>> Is there a reason why this could/should not be:
>>
>>>                try {
>>>                        z = new Zystem();
>>>                } catch ( Throwable e ) {
>>>                        e.printStackTrace(System.err);
>>>                };
>
> Is this intentionally not throwing the exception?

Well, no, just a hasty reply from my part.
> still would be discarded (althrough not neccesarily silently :)).
> BTW, I don't think System.err is a good idea.
>

> It is `statically initialized'? I think then this means it is
> unclear who the caller is and who could catch this exception.
>

Even so re-throwing the exception would make sense so that the
application developer has a chance to handle this in whichever
way they want. Of course logically this should not then
print the stacktrace because that is the responsibility of
the application developer. But so many do not handle these
cases sensibly so from the application user point of view
it is nice to have something on the console to aid in trouble
shooting.

Have not checked the context in which this happens so that might influence
my opinion.

> Wouldn't it be better to store the exception in a member and
> throw it when needing Zystem (e.g. in new or open)

I'm of the fail-fast school of thought so I think it should be reported and
re-thrown as it happens, not later.

br Kusti

_______________________________________________
Rxtx mailing list
Rxtx at qbang.org
http://mailman.qbang.org/mailman/listinfo/rxtx





More information about the pkg-java-maintainers mailing list