You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Harri Hohteri (JIRA)" <ji...@apache.org> on 2008/05/01 08:28:55 UTC

[jira] Created: (CXF-1564) ArrayType does not work correctly if isWriteOuter == false

ArrayType does not work correctly if isWriteOuter == false
----------------------------------------------------------

                 Key: CXF-1564
                 URL: https://issues.apache.org/jira/browse/CXF-1564
             Project: CXF
          Issue Type: Bug
          Components: Aegis Databinding
    Affects Versions: 2.0.6, 2.1, 2.0.5, 2.0.4, 2.0.3, 2.0.2, 2.0.1, 2.0, 2.1.1, 2.0.7
            Reporter: Harri Hohteri


In org.apache.cxf.aegis.type.basic.ArrayType:

    protected void writeValue(Object value, MessageWriter writer, Context context, Type type, String name,
        ...
        if (type.isWriteOuter()) {
            cwriter = writer.getElementWriter(name, ns);
        } else {
            cwriter = writer;
        }

        if (value == null && type.isNillable()) {
            cwriter.writeXsiNil();
        } else {
            type.writeObject(value, cwriter, context);
        }

        cwriter.close();
    }

Should be: 

    protected void writeValue(Object value, MessageWriter writer, Context context, Type type, String name,
        ...
        if (type.isWriteOuter()) {
            cwriter = writer.getElementWriter(name, ns);
        } else {
            cwriter = writer;
        }

        if (value == null && type.isNillable()) {
            cwriter.writeXsiNil();
        } else {
            type.writeObject(value, cwriter, context);
        }

        if (type.isWriteOuter()) {
            cwriter.close();
        }
    }

Similar bug was in XFire (http://jira.codehaus.org/browse/XFIRE-547).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CXF-1564) ArrayType does not work correctly if isWriteOuter == false

Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-1564?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Benson Margulies resolved CXF-1564.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 2.1.1

I've committed your fix, thanks. 

Can you tell me how to make a test case for this?


> ArrayType does not work correctly if isWriteOuter == false
> ----------------------------------------------------------
>
>                 Key: CXF-1564
>                 URL: https://issues.apache.org/jira/browse/CXF-1564
>             Project: CXF
>          Issue Type: Bug
>          Components: Aegis Databinding
>    Affects Versions: 2.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.1, 2.0.6, 2.1.1, 2.0.7
>            Reporter: Harri Hohteri
>            Assignee: Benson Margulies
>             Fix For: 2.1.1
>
>
> In org.apache.cxf.aegis.type.basic.ArrayType:
>     protected void writeValue(Object value, MessageWriter writer, Context context, Type type, String name,
>         ...
>         if (type.isWriteOuter()) {
>             cwriter = writer.getElementWriter(name, ns);
>         } else {
>             cwriter = writer;
>         }
>         if (value == null && type.isNillable()) {
>             cwriter.writeXsiNil();
>         } else {
>             type.writeObject(value, cwriter, context);
>         }
>         cwriter.close();
>     }
> Should be: 
>     protected void writeValue(Object value, MessageWriter writer, Context context, Type type, String name,
>         ...
>         if (type.isWriteOuter()) {
>             cwriter = writer.getElementWriter(name, ns);
>         } else {
>             cwriter = writer;
>         }
>         if (value == null && type.isNillable()) {
>             cwriter.writeXsiNil();
>         } else {
>             type.writeObject(value, cwriter, context);
>         }
>         if (type.isWriteOuter()) {
>             cwriter.close();
>         }
>     }
> Similar bug was in XFire (http://jira.codehaus.org/browse/XFIRE-547).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-1564) ArrayType does not work correctly if isWriteOuter == false

Posted by "Harri Hohteri (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1564?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12593560#action_12593560 ] 

Harri Hohteri commented on CXF-1564:
------------------------------------

Perhaps testing that the message writer that is passed to the writeObject of ArrayType is not closed when control is returned from the writeObject?

If I have understood the logic correctly, the isWriteOuter indicates if the type class wants to write the element tag itself or use the default element tag which would be one defined by the name attribute of @XmlType annotation in the mapped class or if that is not defined the simple class name.




> ArrayType does not work correctly if isWriteOuter == false
> ----------------------------------------------------------
>
>                 Key: CXF-1564
>                 URL: https://issues.apache.org/jira/browse/CXF-1564
>             Project: CXF
>          Issue Type: Bug
>          Components: Aegis Databinding
>    Affects Versions: 2.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.1, 2.0.6, 2.1.1, 2.0.7
>            Reporter: Harri Hohteri
>            Assignee: Benson Margulies
>             Fix For: 2.1.1
>
>
> In org.apache.cxf.aegis.type.basic.ArrayType:
>     protected void writeValue(Object value, MessageWriter writer, Context context, Type type, String name,
>         ...
>         if (type.isWriteOuter()) {
>             cwriter = writer.getElementWriter(name, ns);
>         } else {
>             cwriter = writer;
>         }
>         if (value == null && type.isNillable()) {
>             cwriter.writeXsiNil();
>         } else {
>             type.writeObject(value, cwriter, context);
>         }
>         cwriter.close();
>     }
> Should be: 
>     protected void writeValue(Object value, MessageWriter writer, Context context, Type type, String name,
>         ...
>         if (type.isWriteOuter()) {
>             cwriter = writer.getElementWriter(name, ns);
>         } else {
>             cwriter = writer;
>         }
>         if (value == null && type.isNillable()) {
>             cwriter.writeXsiNil();
>         } else {
>             type.writeObject(value, cwriter, context);
>         }
>         if (type.isWriteOuter()) {
>             cwriter.close();
>         }
>     }
> Similar bug was in XFire (http://jira.codehaus.org/browse/XFIRE-547).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-1564) ArrayType does not work correctly if isWriteOuter == false

Posted by "Harri Hohteri (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1564?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12593584#action_12593584 ] 

Harri Hohteri commented on CXF-1564:
------------------------------------

I think you are better off making it from scratch than trying to create a test case from my code.

But something like this would do the trick:

public class MyType extends Type {
  public boolean isWriteOuter() {
    return true;
  }
}

public class MockMessageWriter extends AbstractMessageWriter {
  boolean isClosed = false;
  public void close() {
    super.close();
    isClosed = true;
  }
}

public class ArrayTypeTest extends TestCase {
  public testCXF-1564() throws Exception {
    ArrayType type = new ArrayType();
    MockMessageWriter writer = new MockMessageWriter();
    type.writeValue(new Object(), writer, null, type, "MyType", "http://cxf.apache.org/test")
    assertFalse("type should not close writer of the parent", writer.isClosed());
  }
}




> ArrayType does not work correctly if isWriteOuter == false
> ----------------------------------------------------------
>
>                 Key: CXF-1564
>                 URL: https://issues.apache.org/jira/browse/CXF-1564
>             Project: CXF
>          Issue Type: Bug
>          Components: Aegis Databinding
>    Affects Versions: 2.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.1, 2.0.6, 2.1.1, 2.0.7
>            Reporter: Harri Hohteri
>            Assignee: Benson Margulies
>             Fix For: 2.1.1
>
>
> In org.apache.cxf.aegis.type.basic.ArrayType:
>     protected void writeValue(Object value, MessageWriter writer, Context context, Type type, String name,
>         ...
>         if (type.isWriteOuter()) {
>             cwriter = writer.getElementWriter(name, ns);
>         } else {
>             cwriter = writer;
>         }
>         if (value == null && type.isNillable()) {
>             cwriter.writeXsiNil();
>         } else {
>             type.writeObject(value, cwriter, context);
>         }
>         cwriter.close();
>     }
> Should be: 
>     protected void writeValue(Object value, MessageWriter writer, Context context, Type type, String name,
>         ...
>         if (type.isWriteOuter()) {
>             cwriter = writer.getElementWriter(name, ns);
>         } else {
>             cwriter = writer;
>         }
>         if (value == null && type.isNillable()) {
>             cwriter.writeXsiNil();
>         } else {
>             type.writeObject(value, cwriter, context);
>         }
>         if (type.isWriteOuter()) {
>             cwriter.close();
>         }
>     }
> Similar bug was in XFire (http://jira.codehaus.org/browse/XFIRE-547).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (CXF-1564) ArrayType does not work correctly if isWriteOuter == false

Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-1564?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Benson Margulies reassigned CXF-1564:
-------------------------------------

    Assignee: Benson Margulies

> ArrayType does not work correctly if isWriteOuter == false
> ----------------------------------------------------------
>
>                 Key: CXF-1564
>                 URL: https://issues.apache.org/jira/browse/CXF-1564
>             Project: CXF
>          Issue Type: Bug
>          Components: Aegis Databinding
>    Affects Versions: 2.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.1, 2.0.6, 2.1.1, 2.0.7
>            Reporter: Harri Hohteri
>            Assignee: Benson Margulies
>
> In org.apache.cxf.aegis.type.basic.ArrayType:
>     protected void writeValue(Object value, MessageWriter writer, Context context, Type type, String name,
>         ...
>         if (type.isWriteOuter()) {
>             cwriter = writer.getElementWriter(name, ns);
>         } else {
>             cwriter = writer;
>         }
>         if (value == null && type.isNillable()) {
>             cwriter.writeXsiNil();
>         } else {
>             type.writeObject(value, cwriter, context);
>         }
>         cwriter.close();
>     }
> Should be: 
>     protected void writeValue(Object value, MessageWriter writer, Context context, Type type, String name,
>         ...
>         if (type.isWriteOuter()) {
>             cwriter = writer.getElementWriter(name, ns);
>         } else {
>             cwriter = writer;
>         }
>         if (value == null && type.isNillable()) {
>             cwriter.writeXsiNil();
>         } else {
>             type.writeObject(value, cwriter, context);
>         }
>         if (type.isWriteOuter()) {
>             cwriter.close();
>         }
>     }
> Similar bug was in XFire (http://jira.codehaus.org/browse/XFIRE-547).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-1564) ArrayType does not work correctly if isWriteOuter == false

Posted by "Harri Hohteri (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1564?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12595284#action_12595284 ] 

Harri Hohteri commented on CXF-1564:
------------------------------------

Could this be fixed also in the 2.0.x branch?

> ArrayType does not work correctly if isWriteOuter == false
> ----------------------------------------------------------
>
>                 Key: CXF-1564
>                 URL: https://issues.apache.org/jira/browse/CXF-1564
>             Project: CXF
>          Issue Type: Bug
>          Components: Aegis Databinding
>    Affects Versions: 2.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.1, 2.0.6, 2.1.1, 2.0.7
>            Reporter: Harri Hohteri
>            Assignee: Benson Margulies
>             Fix For: 2.1.1
>
>
> In org.apache.cxf.aegis.type.basic.ArrayType:
>     protected void writeValue(Object value, MessageWriter writer, Context context, Type type, String name,
>         ...
>         if (type.isWriteOuter()) {
>             cwriter = writer.getElementWriter(name, ns);
>         } else {
>             cwriter = writer;
>         }
>         if (value == null && type.isNillable()) {
>             cwriter.writeXsiNil();
>         } else {
>             type.writeObject(value, cwriter, context);
>         }
>         cwriter.close();
>     }
> Should be: 
>     protected void writeValue(Object value, MessageWriter writer, Context context, Type type, String name,
>         ...
>         if (type.isWriteOuter()) {
>             cwriter = writer.getElementWriter(name, ns);
>         } else {
>             cwriter = writer;
>         }
>         if (value == null && type.isNillable()) {
>             cwriter.writeXsiNil();
>         } else {
>             type.writeObject(value, cwriter, context);
>         }
>         if (type.isWriteOuter()) {
>             cwriter.close();
>         }
>     }
> Similar bug was in XFire (http://jira.codehaus.org/browse/XFIRE-547).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-1564) ArrayType does not work correctly if isWriteOuter == false

Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1564?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12593564#action_12593564 ] 

Benson Margulies commented on CXF-1564:
---------------------------------------

Do you have a snippet that ran into this problem? Otherwise, I'll work from your comment.

> ArrayType does not work correctly if isWriteOuter == false
> ----------------------------------------------------------
>
>                 Key: CXF-1564
>                 URL: https://issues.apache.org/jira/browse/CXF-1564
>             Project: CXF
>          Issue Type: Bug
>          Components: Aegis Databinding
>    Affects Versions: 2.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.1, 2.0.6, 2.1.1, 2.0.7
>            Reporter: Harri Hohteri
>            Assignee: Benson Margulies
>             Fix For: 2.1.1
>
>
> In org.apache.cxf.aegis.type.basic.ArrayType:
>     protected void writeValue(Object value, MessageWriter writer, Context context, Type type, String name,
>         ...
>         if (type.isWriteOuter()) {
>             cwriter = writer.getElementWriter(name, ns);
>         } else {
>             cwriter = writer;
>         }
>         if (value == null && type.isNillable()) {
>             cwriter.writeXsiNil();
>         } else {
>             type.writeObject(value, cwriter, context);
>         }
>         cwriter.close();
>     }
> Should be: 
>     protected void writeValue(Object value, MessageWriter writer, Context context, Type type, String name,
>         ...
>         if (type.isWriteOuter()) {
>             cwriter = writer.getElementWriter(name, ns);
>         } else {
>             cwriter = writer;
>         }
>         if (value == null && type.isNillable()) {
>             cwriter.writeXsiNil();
>         } else {
>             type.writeObject(value, cwriter, context);
>         }
>         if (type.isWriteOuter()) {
>             cwriter.close();
>         }
>     }
> Similar bug was in XFire (http://jira.codehaus.org/browse/XFIRE-547).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.