From d86dd644e1543743cfcbc83b230bd4f2cb2e5d4e Mon Sep 17 00:00:00 2001 From: Instrumental Date: Thu, 29 Mar 2018 19:02:24 -0500 Subject: Clean up Sonar results 1 Issue-ID: AAF-206 Change-Id: If1fced5b528490a52691508fb1e30962dbe28856 Signed-off-by: Instrumental --- cadi/core/src/main/java/org/onap/aaf/cadi/Symm.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'cadi/core/src') diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/Symm.java b/cadi/core/src/main/java/org/onap/aaf/cadi/Symm.java index 095f6e97..65cb81a5 100644 --- a/cadi/core/src/main/java/org/onap/aaf/cadi/Symm.java +++ b/cadi/core/src/main/java/org/onap/aaf/cadi/Symm.java @@ -71,6 +71,7 @@ import org.onap.aaf.cadi.config.Config; public class Symm { private static final byte[] DOUBLE_EQ = new byte[] {'=','='}; public static final String ENC = "enc:"; + private static final Object LOCK = new Object(); private static final SecureRandom random = new SecureRandom(); public final char[] codeset; @@ -207,7 +208,7 @@ public class Symm { } public T exec(SyncExec exec) throws Exception { - synchronized(ENC) { + synchronized(LOCK) { if(keyBytes == null) { keyBytes = new byte[AES.AES_KEY_SIZE/8]; int offset = (Math.abs(codeset[0])+47)%(codeset.length-keyBytes.length); @@ -388,7 +389,9 @@ public class Symm { } public void decode(InputStream is, OutputStream os, int skip) throws IOException { - is.skip(skip); + if(is.skip(skip)!=skip) { + throw new IOException("Error skipping on IOStream in Symm"); + } decode(is,os); } -- cgit 1.2.3-korg