|
From: MacDonald, N. (Nick) <nma...@av...> - 2012-08-27 20:22:17
|
I have finally tracked down the problem I have been chasing, and while I understand the problem, I still don't really understand the root cause.
I'm working with an old version of the code... it appears to be a non-release version, i.e. a checkout of a pre 3.6.0 release.
It has been working fine for some time, but something seems to have changed to force the code to call the getProtection() method in ProtectedLogDataBean. In my database there is never any data in the b64Protection field, and the version of the method that I have doesn't check for this, and passes the empty string to Base64.decode() which causes an array index exception (-4).
I'm wondering if someone can explain to me what sort of a change might cause the behavior change. It doesn't seem to hurt anything if I update the method to check for the empty string (as shown below), but I wanted a second opinion on whether this might be having consequences I am not aware of.
public byte[] getProtection()
{
String b64Protection = getB64Protection();
if (b64Protection != null)
{
if (b64Protection.equals(""))
{
return new byte[0];
}
return Base64.decode(b64Protection.getBytes());
}
return null;
}
|