diff options
author | Instrumental <jgonap@stl.gathman.org> | 2020-05-19 15:56:23 -0500 |
---|---|---|
committer | Instrumental <jgonap@stl.gathman.org> | 2020-05-19 16:20:01 -0500 |
commit | 9b858def712cff7bf0aa16a4d69de1a5d9846af1 (patch) | |
tree | dbb04d8fcd12c9268e2544e34af7d80246d194fd /auth | |
parent | ea095eb9cdbb451f2310a262f3877c79f527cc8f (diff) |
Fix Hash.toHex for odd character Strings
Also, made two functions work the same, and removed CadiException
Because CadiException removed, covered "FileGetter" with NullCheck
Issue-ID: AAF-941
Signed-off-by: Instrumental <jgonap@stl.gathman.org>
Change-Id: I7ee13ab98d3a70c1cdc59573921e0948ef198f9c
Diffstat (limited to 'auth')
-rw-r--r-- | auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/FileGetter.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/FileGetter.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/FileGetter.java index 31e5069b..10136272 100644 --- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/FileGetter.java +++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/FileGetter.java @@ -71,12 +71,19 @@ public class FileGetter { if(CredDAO.CERT_SHA256_RSA == type) { return; } + byte ba[]; CredDAO.Data cdd = new CredDAO.Data(); cdd.id=row.get(0); cdd.type = type; try { cdd.expires = sdf.parse(row.get(2)); - cdd.cred = ByteBuffer.wrap(Hash.fromHex(row.get(3))); + // Note: Note sure this can be null, but throwing was + // part of original "fromHex" method. Remove if you can + // prove ba will never be null J - May 19,2020 + if((ba=Hash.fromHex(row.get(3)))==null) { + throw new CadiException("Invalid Cred"); + } + cdd.cred = ByteBuffer.wrap(ba); cdd.notes= row.get(4); cdd.ns = row.get(5); cdd.other = Integer.parseInt(row.get(6)); |