You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Florian Pinel (JIRA)" <tu...@ws.apache.org> on 2008/05/02 19:48:55 UTC

[jira] Updated: (TUSCANY-2288) MappingWrapper.getInsertOrder() uses incorrect algorithm

     [ https://issues.apache.org/jira/browse/TUSCANY-2288?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Florian Pinel updated TUSCANY-2288:
-----------------------------------

    Attachment: MappingWrapper.java

Attached is a suggested fix.

> 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
>         Attachments: MappingWrapper.java
>
>
> 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.