MappingWrapper.getInsertOrder() uses incorrect algorithm
--------------------------------------------------------
Key: TUSCANY-2288
URL: https://issues.apache.org/jira/browse/TUSCANY-2288
Project: Tuscany
Issue Type: Bug
Components: Java DAS RDB
Affects Versions: Java-DAS-beta1
Reporter: Florian Pinel
Priority: Critical
MappingWrapper.getInsertOrder() uses an incorrect algorithm:
while (parents.size() > 0) {
String parent = (String) parents.get(0);
if (!children.contains(parent)) {
if (!inserts.contains(parent)) {
inserts.add(parent);
}
String child = (String) parentToChild.get(parent);
if (!inserts.contains(child)) {
inserts.add(child);
}
parents.remove(parent);
children.remove(child);
} else {
parents.add(parents.remove(0));
}
The following line causes a bug:
String child = (String) parentToChild.get(parent);
A parent can have multiple children, and this line will not return the correct
child.
The bug will become visible if you try a data object with 1 parent, 2 children
and 1 grandchild.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.