You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Raymond Feng (JIRA)" <tu...@ws.apache.org> on 2006/06/14 01:17:29 UTC

[jira] Created: (TUSCANY-470) DataObject.getXXX("aaa.bbb") throws NumerFormatException even if "aaa.bbb" is the XSD element name

DataObject.getXXX("aaa.bbb") throws NumerFormatException even if "aaa.bbb" is the XSD element name
--------------------------------------------------------------------------------------------------

         Key: TUSCANY-470
         URL: http://issues.apache.org/jira/browse/TUSCANY-470
     Project: Tuscany
        Type: Bug

  Components: Java SDO Implementation  
    Versions: Java-M1    
    Reporter: Raymond Feng
 Assigned to: Frank Budinsky 


In my XSD, I have an element named as "aaa.bbb" which is contained by a complexType foo.

<complexType name="foo">
    <element name="aaa.bbb" type="xsd:string"/>
<complexType>

Now I have an instance of foo as a DataOject and when I try to retrieve the property using the following code:

String value = fooDataObject.getString("aaa.bbb");

I'll get a NumerFormatException. Obviously, the SDO runtime is confused and treats "aaa.bbb" as a XPath expression. 

I'm not sure what the SDO spec says. Maybe we should do some checking or require such property name to be escaped like "aaa\.bbb"?

Thanks,
Raymond

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-470) DataObject.getXXX("aaa.bbb") throws NumerFormatException even if "aaa.bbb" is the XSD element name

Posted by "Yang ZHONG (JIRA)" <tu...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/TUSCANY-470?page=comments#action_12416409 ] 

Yang ZHONG commented on TUSCANY-470:
------------------------------------

We may need to make some clarification in the SDO spec.

In general, delimiters are NOT allowed in segments unless they're encoded or escaped. Examples are URL encoding and Java character escaping.

In this particular case, "." and "/" are SDO path delimiters, and they shouldn't show up as property name within SDO path unless encoded or escaped. Unfortunately, SDO spec has NOT specified the encoding or escaping. Therefore "aaa.0" is ambiguous, even "aaa.bbb" is also ambiguous between throwing exception (exception may be some user's expectation) and trying such property.

I don't think this's a defect. Given today's SDO spec (it may not be perfect), people with "aaa.bbb" property shouldn't apply that property name into ANY SDO path. Frank and I agree that's not very friendly, let's hope we can enrich the spec from that perspective.

Thanks.

> DataObject.getXXX("aaa.bbb") throws NumerFormatException even if "aaa.bbb" is the XSD element name
> --------------------------------------------------------------------------------------------------
>
>          Key: TUSCANY-470
>          URL: http://issues.apache.org/jira/browse/TUSCANY-470
>      Project: Tuscany
>         Type: Bug

>   Components: Java SDO Implementation
>     Versions: Java-M1
>     Reporter: Raymond Feng
>     Assignee: Frank Budinsky

>
> In my XSD, I have an element named as "aaa.bbb" which is contained by a complexType foo.
> <complexType name="foo">
>     <element name="aaa.bbb" type="xsd:string"/>
> <complexType>
> Now I have an instance of foo as a DataOject and when I try to retrieve the property using the following code:
> String value = fooDataObject.getString("aaa.bbb");
> I'll get a NumerFormatException. Obviously, the SDO runtime is confused and treats "aaa.bbb" as a XPath expression. 
> I'm not sure what the SDO spec says. Maybe we should do some checking or require such property name to be escaped like "aaa\.bbb"?
> Thanks,
> Raymond

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-470) DataObject.getXXX("aaa.bbb") throws NumerFormatException even if "aaa.bbb" is the XSD element name

Posted by "Raymond Feng (JIRA)" <tu...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/TUSCANY-470?page=comments#action_12416225 ] 

Raymond Feng commented on TUSCANY-470:
--------------------------------------

Hi, I debugged the test case and it turned out the model I described before didn't reflect the case very well.

To be precise, the XSD looks like:

<element name="aaa" type="ns:XXX"/>

<element name="aaa.bbb" type="ns:XXXYYY" substitutionGroup="ns:aaa"/>

In my case, the property "aaa.bbb" is from the substitution group, so it only shows up in the DataObject.getInstanceProperties() list but not dataObject.getType().getProperties().

The current Tuscany code doesn't check if the type is open and the property is in getInstanceProperties() list.

> DataObject.getXXX("aaa.bbb") throws NumerFormatException even if "aaa.bbb" is the XSD element name
> --------------------------------------------------------------------------------------------------
>
>          Key: TUSCANY-470
>          URL: http://issues.apache.org/jira/browse/TUSCANY-470
>      Project: Tuscany
>         Type: Bug

>   Components: Java SDO Implementation
>     Versions: Java-M1
>     Reporter: Raymond Feng
>     Assignee: Frank Budinsky

>
> In my XSD, I have an element named as "aaa.bbb" which is contained by a complexType foo.
> <complexType name="foo">
>     <element name="aaa.bbb" type="xsd:string"/>
> <complexType>
> Now I have an instance of foo as a DataOject and when I try to retrieve the property using the following code:
> String value = fooDataObject.getString("aaa.bbb");
> I'll get a NumerFormatException. Obviously, the SDO runtime is confused and treats "aaa.bbb" as a XPath expression. 
> I'm not sure what the SDO spec says. Maybe we should do some checking or require such property name to be escaped like "aaa\.bbb"?
> Thanks,
> Raymond

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Closed: (TUSCANY-470) DataObject.getXXX("propertyName") doesn't work for property from open content

Posted by "Raymond Feng (JIRA)" <tu...@ws.apache.org>.
     [ http://issues.apache.org/jira/browse/TUSCANY-470?page=all ]
     
Raymond Feng closed TUSCANY-470:
--------------------------------

    Resolution: Invalid

If the property (open or normal) name doesn't contain the special character '.', it works. 

> DataObject.getXXX("propertyName") doesn't work for property from open content
> -----------------------------------------------------------------------------
>
>          Key: TUSCANY-470
>          URL: http://issues.apache.org/jira/browse/TUSCANY-470
>      Project: Tuscany
>         Type: Bug

>   Components: Java SDO Implementation
>     Versions: Java-M1
>     Reporter: Raymond Feng
>     Assignee: Frank Budinsky
>  Attachments: openPropertyGetter.patch
>
> In my XSD, I have an element named as "aaa.bbb" which is contained by a complexType foo.
> <complexType name="foo">
>     <element name="aaa.bbb" type="xsd:string"/>
> <complexType>
> Now I have an instance of foo as a DataOject and when I try to retrieve the property using the following code:
> String value = fooDataObject.getString("aaa.bbb");
> I'll get a NumerFormatException. Obviously, the SDO runtime is confused and treats "aaa.bbb" as a XPath expression. 
> I'm not sure what the SDO spec says. Maybe we should do some checking or require such property name to be escaped like "aaa\.bbb"?
> Thanks,
> Raymond

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Updated: (TUSCANY-470) DataObject.getXXX("propertyName") doesn't work for property from open content

Posted by "Kelvin Goodson (JIRA)" <tu...@ws.apache.org>.
     [ http://issues.apache.org/jira/browse/TUSCANY-470?page=all ]

Kelvin Goodson updated TUSCANY-470:
-----------------------------------

    Attachment: openPropertyGetter.patch

In the attached patch file's test case, although I've gone about getting the kind of property you describe in a different way I'm pretty sure the test case here simulates the problem you describe. The fix handles the case where the direct child property instance has special characters in its name.  It does not handle the case of indirect decendent child Properties.

> DataObject.getXXX("propertyName") doesn't work for property from open content
> -----------------------------------------------------------------------------
>
>          Key: TUSCANY-470
>          URL: http://issues.apache.org/jira/browse/TUSCANY-470
>      Project: Tuscany
>         Type: Bug

>   Components: Java SDO Implementation
>     Versions: Java-M1
>     Reporter: Raymond Feng
>     Assignee: Frank Budinsky
>  Attachments: openPropertyGetter.patch
>
> In my XSD, I have an element named as "aaa.bbb" which is contained by a complexType foo.
> <complexType name="foo">
>     <element name="aaa.bbb" type="xsd:string"/>
> <complexType>
> Now I have an instance of foo as a DataOject and when I try to retrieve the property using the following code:
> String value = fooDataObject.getString("aaa.bbb");
> I'll get a NumerFormatException. Obviously, the SDO runtime is confused and treats "aaa.bbb" as a XPath expression. 
> I'm not sure what the SDO spec says. Maybe we should do some checking or require such property name to be escaped like "aaa\.bbb"?
> Thanks,
> Raymond

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Updated: (TUSCANY-470) DataObject.getXXX("propertyName") doesn't work for property from open content

Posted by "Raymond Feng (JIRA)" <tu...@ws.apache.org>.
     [ http://issues.apache.org/jira/browse/TUSCANY-470?page=all ]

Raymond Feng updated TUSCANY-470:
---------------------------------

    Summary: DataObject.getXXX("propertyName") doesn't work for property from open content  (was: DataObject.getXXX("aaa.bbb") throws NumerFormatException even if "aaa.bbb" is the XSD element name)

I'm changing the description to reflect the real problem. The previous one was misleading.

<element name="aaa" type="ns:XXX"/> 

<element name="aaabbb" type="ns:XXXYYY" substitutionGroup="ns:aaa"/> 

In my case, the property "aaabbb" is from the substitution group, so it only shows up in the DataObject.getInstanceProperties() list but not dataObject.getType().getProperties(). The current Tuscany code doesn't check if the type is open and the property is in getInstanceProperties() list. 
As a result the call against dataObject.getXXX("aaabbb") returns null, which is wrong.



> DataObject.getXXX("propertyName") doesn't work for property from open content
> -----------------------------------------------------------------------------
>
>          Key: TUSCANY-470
>          URL: http://issues.apache.org/jira/browse/TUSCANY-470
>      Project: Tuscany
>         Type: Bug

>   Components: Java SDO Implementation
>     Versions: Java-M1
>     Reporter: Raymond Feng
>     Assignee: Frank Budinsky

>
> In my XSD, I have an element named as "aaa.bbb" which is contained by a complexType foo.
> <complexType name="foo">
>     <element name="aaa.bbb" type="xsd:string"/>
> <complexType>
> Now I have an instance of foo as a DataOject and when I try to retrieve the property using the following code:
> String value = fooDataObject.getString("aaa.bbb");
> I'll get a NumerFormatException. Obviously, the SDO runtime is confused and treats "aaa.bbb" as a XPath expression. 
> I'm not sure what the SDO spec says. Maybe we should do some checking or require such property name to be escaped like "aaa\.bbb"?
> Thanks,
> Raymond

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-470) DataObject.getXXX("propertyName") doesn't work for property from open content

Posted by "Kelvin Goodson (JIRA)" <tu...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/TUSCANY-470?page=comments#action_12416531 ] 

Kelvin Goodson commented on TUSCANY-470:
----------------------------------------

OK,  on reflection my earlier patch needs ammending.  I'll revisit this and attach another soon.


> DataObject.getXXX("propertyName") doesn't work for property from open content
> -----------------------------------------------------------------------------
>
>          Key: TUSCANY-470
>          URL: http://issues.apache.org/jira/browse/TUSCANY-470
>      Project: Tuscany
>         Type: Bug

>   Components: Java SDO Implementation
>     Versions: Java-M1
>     Reporter: Raymond Feng
>     Assignee: Frank Budinsky
>  Attachments: openPropertyGetter.patch
>
> In my XSD, I have an element named as "aaa.bbb" which is contained by a complexType foo.
> <complexType name="foo">
>     <element name="aaa.bbb" type="xsd:string"/>
> <complexType>
> Now I have an instance of foo as a DataOject and when I try to retrieve the property using the following code:
> String value = fooDataObject.getString("aaa.bbb");
> I'll get a NumerFormatException. Obviously, the SDO runtime is confused and treats "aaa.bbb" as a XPath expression. 
> I'm not sure what the SDO spec says. Maybe we should do some checking or require such property name to be escaped like "aaa\.bbb"?
> Thanks,
> Raymond

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-470) DataObject.getXXX("aaa.bbb") throws NumerFormatException even if "aaa.bbb" is the XSD element name

Posted by "Frank Budinsky (JIRA)" <tu...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/TUSCANY-470?page=comments#action_12416210 ] 

Frank Budinsky commented on TUSCANY-470:
----------------------------------------

Raymonc,

Actually, looking at the implementation of get(String), we already do what I suggested above:

    Property property = dataObject.getType().getProperty(path);
    if (property != null) {
      return dataObject.get(property);
    } else {
      return Accessor.create((EObject)dataObject, path).getAndRecyle();
    }

So, I'm surprised that your example doesn't work. It shouldn't get into the XPath processing if the property name is found in the type.

Can you please debug it to see why property  == null in your case.

Thanks.


> DataObject.getXXX("aaa.bbb") throws NumerFormatException even if "aaa.bbb" is the XSD element name
> --------------------------------------------------------------------------------------------------
>
>          Key: TUSCANY-470
>          URL: http://issues.apache.org/jira/browse/TUSCANY-470
>      Project: Tuscany
>         Type: Bug

>   Components: Java SDO Implementation
>     Versions: Java-M1
>     Reporter: Raymond Feng
>     Assignee: Frank Budinsky

>
> In my XSD, I have an element named as "aaa.bbb" which is contained by a complexType foo.
> <complexType name="foo">
>     <element name="aaa.bbb" type="xsd:string"/>
> <complexType>
> Now I have an instance of foo as a DataOject and when I try to retrieve the property using the following code:
> String value = fooDataObject.getString("aaa.bbb");
> I'll get a NumerFormatException. Obviously, the SDO runtime is confused and treats "aaa.bbb" as a XPath expression. 
> I'm not sure what the SDO spec says. Maybe we should do some checking or require such property name to be escaped like "aaa\.bbb"?
> Thanks,
> Raymond

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-470) DataObject.getXXX("propertyName") doesn't work for property from open content

Posted by "Kelvin Goodson (JIRA)" <tu...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/TUSCANY-470?page=comments#action_12416853 ] 

Kelvin Goodson commented on TUSCANY-470:
----------------------------------------

On further investigation I have determined that the code is worling as designed and does handle xpath access to and through open content properties.

> DataObject.getXXX("propertyName") doesn't work for property from open content
> -----------------------------------------------------------------------------
>
>          Key: TUSCANY-470
>          URL: http://issues.apache.org/jira/browse/TUSCANY-470
>      Project: Tuscany
>         Type: Bug

>   Components: Java SDO Implementation
>     Versions: Java-M1
>     Reporter: Raymond Feng
>     Assignee: Frank Budinsky
>  Attachments: openPropertyGetter.patch
>
> In my XSD, I have an element named as "aaa.bbb" which is contained by a complexType foo.
> <complexType name="foo">
>     <element name="aaa.bbb" type="xsd:string"/>
> <complexType>
> Now I have an instance of foo as a DataOject and when I try to retrieve the property using the following code:
> String value = fooDataObject.getString("aaa.bbb");
> I'll get a NumerFormatException. Obviously, the SDO runtime is confused and treats "aaa.bbb" as a XPath expression. 
> I'm not sure what the SDO spec says. Maybe we should do some checking or require such property name to be escaped like "aaa\.bbb"?
> Thanks,
> Raymond

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-470) DataObject.getXXX("aaa.bbb") throws NumerFormatException even if "aaa.bbb" is the XSD element name

Posted by "Frank Budinsky (JIRA)" <tu...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/TUSCANY-470?page=comments#action_12416208 ] 

Frank Budinsky commented on TUSCANY-470:
----------------------------------------

I think this is an unfortuate "feature" of SDO. The only thing I see in the spec related to this is on page 119:

Also, names including any of the special characters of the syntax (./[]='"@) are not accessible.

I think this means that if you have names with any of these special characters you can't access them with the String (XPath) accessors.

You'll need to do something like this instead:

String value = fooDataObject.getString(fooDataObject.getProperty("aaa.bbb"));



> DataObject.getXXX("aaa.bbb") throws NumerFormatException even if "aaa.bbb" is the XSD element name
> --------------------------------------------------------------------------------------------------
>
>          Key: TUSCANY-470
>          URL: http://issues.apache.org/jira/browse/TUSCANY-470
>      Project: Tuscany
>         Type: Bug

>   Components: Java SDO Implementation
>     Versions: Java-M1
>     Reporter: Raymond Feng
>     Assignee: Frank Budinsky

>
> In my XSD, I have an element named as "aaa.bbb" which is contained by a complexType foo.
> <complexType name="foo">
>     <element name="aaa.bbb" type="xsd:string"/>
> <complexType>
> Now I have an instance of foo as a DataOject and when I try to retrieve the property using the following code:
> String value = fooDataObject.getString("aaa.bbb");
> I'll get a NumerFormatException. Obviously, the SDO runtime is confused and treats "aaa.bbb" as a XPath expression. 
> I'm not sure what the SDO spec says. Maybe we should do some checking or require such property name to be escaped like "aaa\.bbb"?
> Thanks,
> Raymond

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org