directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felix Knecht <fe...@otego.com>
Subject [Shared] Swallowed Exceptions
Date Sun, 21 Feb 2010 14:12:26 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi

Just came across ...

IMO it can be quite annoying when thrown Exceptions are swallowed
without writing at least a log entry! It's can be quite hard to locate a
problem if swalowed Exceptions are involved.
Is the swallowing on purpose? (there are more, I'm quite sure)

Sample below.

Regards
Felix

public abstract class DERString extends DERObject
{
    DERString(int tag, byte[] value)
    {
        super( tag, value );
    }


    public String getString()
    {
        return byteArrayToString( value );
    }

    protected static String byteArrayToString( byte[] bytes )
    {
        try
        {
            return new String( bytes, "UTF-8" );
        }
        catch ( UnsupportedEncodingException uee )
        {
            return "";
        }
    }

   protected static byte[] stringToByteArray( String string )
    {
        try
        {
            return string.getBytes( "UTF-8" );
        }
        catch ( UnsupportedEncodingException uee )
        {
            return new byte[]
                {};
        }
    }
}
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkuBP0kACgkQ2lZVCB08qHFQtgCfTy3DYBHmIaiYfxOFM9RgDLtO
4X4AoLFC6xvewRuwhkC/yxzjMXq2DL6x
=q6yq
-----END PGP SIGNATURE-----

Mime
View raw message