diff options
3 files changed, 28 insertions, 19 deletions
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Function.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Function.java index 3fde5123..c59312c0 100644 --- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Function.java +++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Function.java @@ -628,7 +628,12 @@ public class Function { return Result.err(Status.ERR_DependencyExists, sb.toString()); } - if (move && (parent == null || parent.type == NsType.COMPANY.type)) { + if (move && parent == null) { + return Result + .err(Status.ERR_DependencyExists, + "Cannot move users, roles or permissions - parent is missing.\nDelete dependencies and try again"); + } + else if (move && parent.type == NsType.COMPANY.type) { return Result .err(Status.ERR_DependencyExists, "Cannot move users, roles or permissions to [%s].\nDelete dependencies and try again", diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenClientFactory.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenClientFactory.java index b3cf266e..14cf0f62 100644 --- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenClientFactory.java +++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenClientFactory.java @@ -152,15 +152,17 @@ public class TokenClientFactory extends Persist<Token,TimedToken> { } sb.append('_'); sb.append(tokenSource); - byte[] tohash=scope.getBytes(); - if (hash!=null && hash.length>0) { - byte temp[] = new byte[hash.length+tohash.length]; - System.arraycopy(tohash, 0, temp, 0, tohash.length); - System.arraycopy(hash, 0, temp, tohash.length, hash.length); - tohash = temp; - } - if (scope!=null && scope.length()>0) { - sb.append(Hash.toHexNo0x(Hash.hashSHA256(tohash))); + if (scope!=null) { + byte[] tohash=scope.getBytes(); + if (hash!=null && hash.length>0) { + byte temp[] = new byte[hash.length+tohash.length]; + System.arraycopy(tohash, 0, temp, 0, tohash.length); + System.arraycopy(hash, 0, temp, tohash.length, hash.length); + tohash = temp; + } + if (scope.length()>0) { + sb.append(Hash.toHexNo0x(Hash.hashSHA256(tohash))); + } } return sb.toString(); } catch (NoSuchAlgorithmException e) { diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutJson.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutJson.java index 6c868378..2d93bb49 100644 --- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutJson.java +++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutJson.java @@ -39,13 +39,13 @@ public class OutJson extends Out { } else { ipw = null; } - + // If it's a fragment, print first Object Name. If root Object, skip first name Stack<LevelStack> jsonLevel = new Stack<LevelStack>(); jsonLevel.push(new LevelStack(options.length>1 && options[1])); boolean print = true, hadData=false; char afterName=0, beforeName=0, maybe = 0, prev=0; - + int count = 0; while ((p = prs.parse(in,p.reuse())).valid()) { ++count; @@ -112,18 +112,20 @@ public class OutJson extends Out { default: print = true; } - + if (maybe!=0) { if (ipw==null)writer.append(maybe); else ipw.println(maybe); maybe = 0; } - - if (beforeName!=0) { - if (ipw==null)writer.append(beforeName); - else ipw.println(beforeName); - beforeName = 0; - } + + // commented out unreachable code (as it is, beforeName is never + // assigned any value except 0 + //if (beforeName!=0) { + // if (ipw==null)writer.append(beforeName); + // else ipw.println(beforeName); + // beforeName = 0; + //} if (print) { if (p.hasName()) { writer.append('"'); |