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/01 19:52:55 UTC

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

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.


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

Posted by "Florian Pinel (JIRA)" <tu...@ws.apache.org>.
     [ 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.


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

Posted by "Luciano Resende (JIRA)" <tu...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-2288?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Luciano Resende resolved TUSCANY-2288.
--------------------------------------

       Resolution: Fixed
    Fix Version/s: Java-SCA-Next
         Assignee: Luciano Resende

Patch from Florian Pinel applied under revision #652897

> 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
>            Assignee: Luciano Resende
>            Priority: Critical
>             Fix For: Java-SCA-Next
>
>         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.