You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Felix Knecht <fe...@otego.com> on 2010/05/23 09:02:45 UTC

[SHARED] LdapTransformer NPE

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

In the switch block the 'default' is missing. For unknown types will
will run into a NPE on the following line [1]. What shall be done on
default case?
- - Return null
- - Throw an Exception (to be defined)
- - Risk a NPE
- - ?

Regards
Felix

[1]
http://people.apache.org/~felixk/shared-docs/xref/org/apache/directory/shared/ldap/codec/LdapTransformer.html#1305
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.15 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkv40xUACgkQ2lZVCB08qHFrMQCgsr1nqN/VaJau87GZ0/q7cEgn
h0QAnikm6hLNzFGZmSeBddglUkCVb305
=EHdd
-----END PGP SIGNATURE-----

Re: [SHARED] LdapTransformer NPE

Posted by Emmanuel Lecharny <el...@gmail.com>.
On 5/23/10 9:02 AM, Felix Knecht wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> In the switch block the 'default' is missing. For unknown types will
> will run into a NPE on the following line [1]. What shall be done on
> default case?
> - - Return null
> - - Throw an Exception (to be defined)
> - - Risk a NPE
> - - ?
>    
The Transformer is transforming a Ldap Message from an external form to 
an internal form, FYI. The number of Ldap Message we are dealing with is 
finite, and we won't ever have to deal with any other unexpected one. So 
the default value is useless.

"risk a NPE" is the choice here, as this risk is null.

btw, this transformer is likelly to be removed soon.

-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.nextury.com