---------- Forwarded message ----------
From: Kustaa Nyholm <kustaa.nyh...@planmeca.com>
Date: Wed, Jun 23, 2010 at 5:55 AM
Subject: Re: [Rxtx] gnu.io.RXTXPort discards exception silently if
initialization fails
To: "r...@qbang.org" <r...@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
r...@qbang.org
http://mailman.qbang.org/mailman/listinfo/rxtx



__
This is the maintainer address of Debian's Java team
<http://lists.alioth.debian.org/mailman/listinfo/pkg-java-maintainers>. Please 
use
debian-j...@lists.debian.org for discussions and questions.

Reply via email to