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

2010-06-23 Thread Scott Howard
-- Forwarded message --
From: Kustaa Nyholm kustaa.nyh...@planmeca.com
Date: Wed, Jun 23, 2010 at 1:38 AM
Subject: Re: [Rxtx] gnu.io.RXTXPort discards exception silently if
initialization fails
To: r...@qbang.org r...@qbang.org



 I did change the code to
                try {
                        z = new Zystem();
                } catch ( Exception e ) {
                        throw new Error(e.toString());
                };

Is there a reason why this could/should not be:


                try {
                        z = new Zystem();
                } catch ( Throwable e ) {
                        e.printStackTrace(System.err);
                };

___
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.


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

2010-06-23 Thread Scott Howard
-- Forwarded message --
From: Michael Erskine mse...@googlemail.com
Date: Wed, Jun 23, 2010 at 4:17 AM
Subject: Re: [Rxtx] gnu.io.RXTXPort discards exception silently if
initialization fails
To: r...@qbang.org r...@qbang.org


On 23 June 2010 06:38, Kustaa Nyholm kustaa.nyh...@planmeca.com wrote:

 I did change the code to
                try {
                        z = new Zystem();
                } catch ( Exception e ) {
                        throw new Error(e.toString());
                };

 Is there a reason why this could/should not be:


                try {
                        z = new Zystem();
                } catch ( Throwable e ) {
                        e.printStackTrace(System.err);
                };

Or even just let the exception bubble up and kill whatever thread
caused the class to load :)

I vote for the removal of Zystem BTW!

Regards,
Michael Erskine.
___
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.


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

2010-06-23 Thread Scott Howard
-- Forwarded message --
From: George H george@gmail.com
Date: Wed, Jun 23, 2010 at 4:34 AM
Subject: Re: [Rxtx] gnu.io.RXTXPort discards exception silently if
initialization fails
To: r...@qbang.org r...@qbang.org


--
George H
george@gmail.com



On Wed, Jun 23, 2010 at 11:17 AM, Michael Erskine mse...@googlemail.com wrote:
 On 23 June 2010 06:38, Kustaa Nyholm kustaa.nyh...@planmeca.com wrote:

 I did change the code to
                try {
                        z = new Zystem();
                } catch ( Exception e ) {
                        throw new Error(e.toString());
                };

 Is there a reason why this could/should not be:


                try {
                        z = new Zystem();
                } catch ( Throwable e ) {
                        e.printStackTrace(System.err);
                };

 Or even just let the exception bubble up and kill whatever thread
 caused the class to load :)

 I vote for the removal of Zystem BTW!

 Regards,
 Michael Erskine.


I would prefer that an exception is thrown rather than the stack trace
be printed. If anyone is using loggers then it would be useful to
catch the exception and log it, rather than let it come out in the
error stream where no one might look.
___
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.


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

2010-06-23 Thread Scott Howard
-- Forwarded message --
From: Steffen DETTMER steffen.dett...@ingenico.com
Date: Wed, Jun 23, 2010 at 5:28 AM
Subject: Re: [Rxtx] gnu.io.RXTXPort discards exception silently if
initialization fails
To: r...@qbang.org


* Kustaa Nyholm wrote on Wed, Jun 23, 2010 at 08:38 +0300:
  I did change the code to
                 try {
                         z = new Zystem();
                 } catch ( Exception e ) {
                         throw new Error(e.toString());
                 };

 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, then it
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.

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

oki,

Steffen



About Ingenico: Ingenico is a leading provider of payment solutions,
with over 15 million terminals deployed in more than 125 countries.
Its 2,850 employees worldwide support retailers, banks and service
providers to optimize and secure their electronic payments solutions,
develop their offer of services and increase their point of sales
revenue. More information on http://www.ingenico.com/.
 This message may contain confidential and/or privileged information.
If you are not the addressee or authorized to receive this for the
addressee, you must not use, copy, disclose or take any action based
on this message or any information herein. If you have received this
message in error, please advise the sender immediately by reply e-mail
and delete this message. Thank you for your cooperation.
 P Please consider the environment before printing this e-mail


___
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.


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

2010-06-23 Thread Scott Howard
-- 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.


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

2010-06-23 Thread Scott Howard
-- Forwarded message --
From: Steffen DETTMER steffen.dett...@ingenico.com
Date: Wed, Jun 23, 2010 at 12:35 PM
Subject: Re: [Rxtx] gnu.io.RXTXPort discards exception silently if
initialization fails
To: r...@qbang.org


* Kustaa Nyholm wrote on Wed, Jun 23, 2010 at 12:55 +0300:
  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.

Ahh yes, I agree, in general it is much better to fail quick,
loud and verbosely, right!

However, if this is a static { } block, AFAIK it is not defined
when it will be executed (Before application start? Or later,
when loading the class later? Or when using it first time?).

If the exception would be thrown before main() is called, I think
it is difficult to catch it. I think some general global hook
must be used to do so.

Simpler to handle, if it is thrown when invocating some function,
then it can be caught by try { } catch.
(or am I wrong or outdated?)

oki,

Steffen




About Ingenico: Ingenico is a leading provider of payment solutions,
with over 15 million terminals deployed in more than 125 countries.
Its 2,850 employees worldwide support retailers, banks and service
providers to optimize and secure their electronic payments solutions,
develop their offer of services and increase their point of sales
revenue. More information on http://www.ingenico.com/.
 This message may contain confidential and/or privileged information.
If you are not the addressee or authorized to receive this for the
addressee, you must not use, copy, disclose or take any action based
on this message or any information herein. If you have received this
message in error, please advise the sender immediately by reply e-mail
and delete this message. Thank you for your cooperation.
 P Please consider the environment before printing this e-mail


___
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.