Accounted for uninitialized fields
This commit is contained in:
parent
e243674f5d
commit
d0d0ff9890
|
@ -538,14 +538,14 @@ public final class TerserUtil {
|
||||||
|
|
||||||
IBase newFieldValue = childDefinition.getChildByName(childDefinition.getElementName()).newInstance();
|
IBase newFieldValue = childDefinition.getChildByName(childDefinition.getElementName()).newInstance();
|
||||||
if (theFromFieldValue instanceof IPrimitiveType) {
|
if (theFromFieldValue instanceof IPrimitiveType) {
|
||||||
try {
|
try {
|
||||||
Method copyMethod = getMethod(theFromFieldValue, "copy");
|
Method copyMethod = getMethod(theFromFieldValue, "copy");
|
||||||
if (copyMethod != null) {
|
if (copyMethod != null) {
|
||||||
newFieldValue = (IBase) copyMethod.invoke(theFromFieldValue, new Object[]{});
|
newFieldValue = (IBase) copyMethod.invoke(theFromFieldValue, new Object[]{});
|
||||||
}
|
|
||||||
} catch (Throwable t) {
|
|
||||||
((IPrimitiveType) newFieldValue).setValueAsString(((IPrimitiveType) theFromFieldValue).getValueAsString());
|
|
||||||
}
|
}
|
||||||
|
} catch (Throwable t) {
|
||||||
|
((IPrimitiveType) newFieldValue).setValueAsString(((IPrimitiveType) theFromFieldValue).getValueAsString());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
theTerser.cloneInto(theFromFieldValue, newFieldValue, true);
|
theTerser.cloneInto(theFromFieldValue, newFieldValue, true);
|
||||||
}
|
}
|
||||||
|
@ -636,7 +636,11 @@ public final class TerserUtil {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
values.clear();
|
try {
|
||||||
|
values.clear();
|
||||||
|
} catch (Throwable t) {
|
||||||
|
ourLog.warn("Unable to clear values " + String.valueOf(values), t);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue