Luciano Resende wrote:
In this particular sample scenario, what if we always set the system
property in case of a SecurityException ? This would avoid issues in
multiple/different languages.
It feels like a hack, as it could pick up the wrong exception condition.
Despite this, I think it's the best solution for this issue. We should
never be comparing the text of the detail string.
Simon
On Wed, Feb 20, 2008 at 9:23 AM, Mike Edwards
<[EMAIL PROTECTED]> wrote:
Hmm, this looks like one of the those flaws in Java exceptions - there
is no way of having something like a number to uniquely identify an
exception beyond its class - using strings is a bad idea, for exactly
this issue with language conversions.
This has led to the message string being used to identify sub-cases for
exception types, with nasty consequences as found here.
I suppose the "pure" way of doing it would be for there to be a subclass
of SecurityException that deals with the case of not being able to find
a LoginConfiguration. But I can understand that it quickly gets tedious
to create ever more new exception classes. So people don't.
Yours, Mike.
[EMAIL PROTECTED] wrote:
Hi,
>
>> Could you please let me know what was the exception you had to modify ?
>
> Of course. Here's the diff, the file is in
> java\sca\samples\calculator-implementation-policies\src\test\java\calculator\
>
> Index: CalculatorTestCase.java
> ===================================================================
> --- CalculatorTestCase.java (revision 629059)
> +++ CalculatorTestCase.java (working copy)
> @@ -38,7 +38,7 @@
> try {
> Configuration secConf = Configuration.getConfiguration();
> } catch ( java.lang.SecurityException e ) {
> - if ( e.getMessage().equals("Unable to locate a login
configuration") ) {
> + if ( e.getMessage().equals("Anmeldekonfiguration kann nicht gefunden
werden.") ) {
> System.setProperty("java.security.auth.login.config",
"target/classes/CalculatorJass.config");
> } else {
> throw e;
>
> Cheers,
> Jürgen.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]