You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Caroline Maynard (JIRA)" <tu...@ws.apache.org> on 2007/04/27 14:02:17 UTC

[jira] Created: (TUSCANY-1236) False positives from DataObject::isSet (xpath)

False positives from DataObject::isSet (xpath)
----------------------------------------------

                 Key: TUSCANY-1236
                 URL: https://issues.apache.org/jira/browse/TUSCANY-1236
             Project: Tuscany
          Issue Type: Bug
          Components: C++ SDO
    Affects Versions: Cpp-M1
         Environment: PHP, Win32
            Reporter: Caroline Maynard


Problem occurs when a PHP SDO program uses Xpath notation. For example:

isset($rss['channel/item[2]']);

The PHP sdo implementation currently does not attempt to parse the Xpath, but delegates this to Tuscany. It is unaware that the final part of the Xpath is an index into a list, so doesn't know to do any extra processing.

Currently the logic in DataObjectImpl::isSet() checks that the <item> list exists and is not empty. If so, it returns true. This is a necessary condition, but in my example above it is not sufficient - it should also test if the size is at least 2. 

I couldn't find an easy way to achieve this with the code as it stands - I did work up a prototype using something like:
--- DataObjectImpl.cpp	19 Apr 2007 14:25:52 -0000	1.16.4.3
+++ DataObjectImpl.cpp	27 Apr 2007 11:30:50 -0000
@@ -1906,7 +1906,20 @@
         if (d != 0) {
             if (!prop.empty()) {
                 const Property& p = d->getProperty(prop);
-                return d->isSet(p);
+                if (p.isMany()) 
+                {
+                    if (d->isSet(p))
+                    {
+                        long index;
+                        if (d->findDataObject(prop, &index))
+                            return true;
+                    }
+                }
+                else 
+                {
+                    return d->isSet(p);
+                }
             }
         }
         string msg("Invalid path:");

but that's rather clumsy and probably fails in some other way. Perhaps an extra long *listIndex parameter to getPropertyContainer() would do it?

Alternatively, Tuscany might prefer to hand up some more control to the caller, for example by adding some new function to the XpathHelper.

(P.S. The same issue would apply to isValid as well as isSet.)


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


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