From 0af1db4fda4667244af0cec983293aefa203d710 Mon Sep 17 00:00:00 2001 From: IanHowell Date: Tue, 1 May 2018 10:48:55 -0500 Subject: Improve coverage of cadi-aaf Issue-ID: AAF-223 Change-Id: I2a7835720341989b45de239157dd1c4f976b1e6a Signed-off-by: IanHowell --- .../onap/aaf/misc/rosetta/marshal/ObjArray.java | 35 +++++++++++----------- .../onap/aaf/misc/rosetta/marshal/ObjMarshal.java | 35 +++++++++++----------- 2 files changed, 34 insertions(+), 36 deletions(-) (limited to 'misc/rosetta/src/main') diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ObjArray.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ObjArray.java index 3d7d1b4e..fa95dee5 100644 --- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ObjArray.java +++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ObjArray.java @@ -53,25 +53,24 @@ public abstract class ObjArray extends Marshal { parsed.event = START_ARRAY; parsed.name = name; } - } else if (DONE_ITERATOR.equals(iter)) { - } else { + } else if (!DONE_ITERATOR.equals(iter)) { ladder.ascend(); // look at field info - Iterator memIter = ladder.peek(); - ListIterator mems = (ListIterator)iter; - S mem; - if(memIter==null) { - mem=mems.next(); - } else if(!DONE_ITERATOR.equals(memIter)) { - mem=mems.peek(); - } else if(iter.hasNext()) { - mem=null; - ladder.push(null); - } else { - mem=null; - } - - if(mem!=null) - parsed = subMarshaller.parse(mem, parsed); + Iterator memIter = ladder.peek(); + ListIterator mems = (ListIterator)iter; + S mem; + if(memIter==null) { + mem=mems.next(); + } else if(!DONE_ITERATOR.equals(memIter)) { + mem=mems.peek(); + } else if(iter.hasNext()) { + mem=null; + ladder.push(null); + } else { + mem=null; + } + + if(mem!=null) + parsed = subMarshaller.parse(mem, parsed); ladder.descend(); if(mem==null) { if(iter.hasNext()) { diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ObjMarshal.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ObjMarshal.java index 4857293e..cb2c478a 100644 --- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ObjMarshal.java +++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ObjMarshal.java @@ -73,26 +73,25 @@ public abstract class ObjMarshal extends Marshal { } else { ladder.push(DONE_ITERATOR); } - } else if (DONE_ITERATOR.equals(iter)) { - } else { + } else if (!DONE_ITERATOR.equals(iter)) { FieldsIterator fields = (FieldsIterator)iter; ladder.ascend(); // look at field info - Iterator currFieldIter = ladder.peek(); - Marshal marshal; - if(currFieldIter==null) { - marshal=fields.next(); - } else if(!DONE_ITERATOR.equals(currFieldIter)) { - marshal=fields.peek(); - if(marshal==null && fields.hasNext())marshal=fields.next(); - } else if(fields.hasNext()) { - marshal=fields.next(); - ladder.push(null); - } else { - marshal=null; - } - - if(marshal!=null) - parsed = marshal.parse(in, parsed); + Iterator currFieldIter = ladder.peek(); + Marshal marshal; + if(currFieldIter==null) { + marshal=fields.next(); + } else if(!DONE_ITERATOR.equals(currFieldIter)) { + marshal=fields.peek(); + if(marshal==null && fields.hasNext())marshal=fields.next(); + } else if(fields.hasNext()) { + marshal=fields.next(); + ladder.push(null); + } else { + marshal=null; + } + + if(marshal!=null) + parsed = marshal.parse(in, parsed); ladder.descend(); if(marshal==null || parsed.event==NONE) { parsed.event = END_OBJ; -- cgit 1.2.3-korg