You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Scott Kurz (JIRA)" <tu...@ws.apache.org> on 2008/06/07 21:53:45 UTC

[jira] Created: (TUSCANY-2377) problem reading complex property from @file

problem reading complex property from @file
-------------------------------------------

                 Key: TUSCANY-2377
                 URL: https://issues.apache.org/jira/browse/TUSCANY-2377
             Project: Tuscany
          Issue Type: Bug
          Components: Java SCA Core Runtime
            Reporter: Scott Kurz


I'm having trouble reading a complex property from a file pointed to via the <property> @file attr. 

I'm using a JAXB to hold the prop value in my Java impl, but in looking at this briefly in the debugger I think the problem might be in the DOM object before it is ever transformed into a JAXB (in my case).

I think the problem is in the code:

public class JavaPropertyValueObjectFactory

    public ObjectFactory createValueFactory(Property property, Object propertyValue, Class javaType) {
        ... 
        } else {
            if (isSimpleType) {
              ....
            } else {
                List<Node> nodes = getComplexPropertyValues(doc);
                Object value = null;
                if (!nodes.isEmpty()) {
                    value = nodes.get(0);
                }
                return new ObjectFactoryImpl(property, value, isSimpleType, javaType);
            }

I'm not skilled with DOM... but I think this code is expecting a wrapper around the real property value, which is why we do a 
nodes.get(0) to get the first child.   

I think this wrapper must be there in the case that the property value is set inline in the SCDL or via a Composite property definition, but I think there's a wrapper missing in the case that we use @file, in which case we get a "raw" document.

I'll attach a patch of an existing itest adding a couple tests to to show an example.



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


[jira] Updated: (TUSCANY-2377) problem reading complex property from @file

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

Scott Kurz updated TUSCANY-2377:
--------------------------------

    Attachment: 2377.itest.example.diff

I didn't see an example for using XJC, so I just hand-gen'd the Java from rcprops.xsd into src/main/java. Note I use JAXB customizations so this is a non-default mapping, but I think the customizations are irrelevant to this JIRA .

> problem reading complex property from @file
> -------------------------------------------
>
>                 Key: TUSCANY-2377
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2377
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SCA Core Runtime
>            Reporter: Scott Kurz
>         Attachments: 2377.itest.example.diff, 2377.itest.example.diff
>
>
> I'm having trouble reading a complex property from a file pointed to via the <property> @file attr. 
> I'm using a JAXB to hold the prop value in my Java impl, but in looking at this briefly in the debugger I think the problem might be in the DOM object before it is ever transformed into a JAXB (in my case).
> I think the problem is in the code:
> public class JavaPropertyValueObjectFactory
>     public ObjectFactory createValueFactory(Property property, Object propertyValue, Class javaType) {
>         ... 
>         } else {
>             if (isSimpleType) {
>               ....
>             } else {
>                 List<Node> nodes = getComplexPropertyValues(doc);
>                 Object value = null;
>                 if (!nodes.isEmpty()) {
>                     value = nodes.get(0);
>                 }
>                 return new ObjectFactoryImpl(property, value, isSimpleType, javaType);
>             }
> I'm not skilled with DOM... but I think this code is expecting a wrapper around the real property value, which is why we do a 
> nodes.get(0) to get the first child.   
> I think this wrapper must be there in the case that the property value is set inline in the SCDL or via a Composite property definition, but I think there's a wrapper missing in the case that we use @file, in which case we get a "raw" document.
> I'll attach a patch of an existing itest adding a couple tests to to show an example.

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


[jira] Resolved: (TUSCANY-2377) problem reading complex property from @file

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

Raymond Feng resolved TUSCANY-2377.
-----------------------------------

    Resolution: Fixed

Test case patch applied and the problem is fixed. 

> problem reading complex property from @file
> -------------------------------------------
>
>                 Key: TUSCANY-2377
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2377
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SCA Core Runtime
>            Reporter: Scott Kurz
>            Assignee: Raymond Feng
>         Attachments: 2377.itest.example.diff, 2377.itest.example.diff
>
>
> I'm having trouble reading a complex property from a file pointed to via the <property> @file attr. 
> I'm using a JAXB to hold the prop value in my Java impl, but in looking at this briefly in the debugger I think the problem might be in the DOM object before it is ever transformed into a JAXB (in my case).
> I think the problem is in the code:
> public class JavaPropertyValueObjectFactory
>     public ObjectFactory createValueFactory(Property property, Object propertyValue, Class javaType) {
>         ... 
>         } else {
>             if (isSimpleType) {
>               ....
>             } else {
>                 List<Node> nodes = getComplexPropertyValues(doc);
>                 Object value = null;
>                 if (!nodes.isEmpty()) {
>                     value = nodes.get(0);
>                 }
>                 return new ObjectFactoryImpl(property, value, isSimpleType, javaType);
>             }
> I'm not skilled with DOM... but I think this code is expecting a wrapper around the real property value, which is why we do a 
> nodes.get(0) to get the first child.   
> I think this wrapper must be there in the case that the property value is set inline in the SCDL or via a Composite property definition, but I think there's a wrapper missing in the case that we use @file, in which case we get a "raw" document.
> I'll attach a patch of an existing itest adding a couple tests to to show an example.

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


[jira] Assigned: (TUSCANY-2377) problem reading complex property from @file

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

Raymond Feng reassigned TUSCANY-2377:
-------------------------------------

    Assignee: Raymond Feng

> problem reading complex property from @file
> -------------------------------------------
>
>                 Key: TUSCANY-2377
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2377
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SCA Core Runtime
>            Reporter: Scott Kurz
>            Assignee: Raymond Feng
>         Attachments: 2377.itest.example.diff, 2377.itest.example.diff
>
>
> I'm having trouble reading a complex property from a file pointed to via the <property> @file attr. 
> I'm using a JAXB to hold the prop value in my Java impl, but in looking at this briefly in the debugger I think the problem might be in the DOM object before it is ever transformed into a JAXB (in my case).
> I think the problem is in the code:
> public class JavaPropertyValueObjectFactory
>     public ObjectFactory createValueFactory(Property property, Object propertyValue, Class javaType) {
>         ... 
>         } else {
>             if (isSimpleType) {
>               ....
>             } else {
>                 List<Node> nodes = getComplexPropertyValues(doc);
>                 Object value = null;
>                 if (!nodes.isEmpty()) {
>                     value = nodes.get(0);
>                 }
>                 return new ObjectFactoryImpl(property, value, isSimpleType, javaType);
>             }
> I'm not skilled with DOM... but I think this code is expecting a wrapper around the real property value, which is why we do a 
> nodes.get(0) to get the first child.   
> I think this wrapper must be there in the case that the property value is set inline in the SCDL or via a Composite property definition, but I think there's a wrapper missing in the case that we use @file, in which case we get a "raw" document.
> I'll attach a patch of an existing itest adding a couple tests to to show an example.

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


[jira] Updated: (TUSCANY-2377) problem reading complex property from @file

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

Scott Kurz updated TUSCANY-2377:
--------------------------------

    Attachment: 2377.itest.example.diff

Same file.. I meant to say it could be included in ASF

> problem reading complex property from @file
> -------------------------------------------
>
>                 Key: TUSCANY-2377
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2377
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SCA Core Runtime
>            Reporter: Scott Kurz
>         Attachments: 2377.itest.example.diff, 2377.itest.example.diff
>
>
> I'm having trouble reading a complex property from a file pointed to via the <property> @file attr. 
> I'm using a JAXB to hold the prop value in my Java impl, but in looking at this briefly in the debugger I think the problem might be in the DOM object before it is ever transformed into a JAXB (in my case).
> I think the problem is in the code:
> public class JavaPropertyValueObjectFactory
>     public ObjectFactory createValueFactory(Property property, Object propertyValue, Class javaType) {
>         ... 
>         } else {
>             if (isSimpleType) {
>               ....
>             } else {
>                 List<Node> nodes = getComplexPropertyValues(doc);
>                 Object value = null;
>                 if (!nodes.isEmpty()) {
>                     value = nodes.get(0);
>                 }
>                 return new ObjectFactoryImpl(property, value, isSimpleType, javaType);
>             }
> I'm not skilled with DOM... but I think this code is expecting a wrapper around the real property value, which is why we do a 
> nodes.get(0) to get the first child.   
> I think this wrapper must be there in the case that the property value is set inline in the SCDL or via a Composite property definition, but I think there's a wrapper missing in the case that we use @file, in which case we get a "raw" document.
> I'll attach a patch of an existing itest adding a couple tests to to show an example.

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