Return-Path: Delivered-To: apmail-ws-tuscany-commits-archive@locus.apache.org Received: (qmail 27902 invoked from network); 11 Feb 2008 15:14:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Feb 2008 15:14:26 -0000 Received: (qmail 77596 invoked by uid 500); 11 Feb 2008 15:14:20 -0000 Delivered-To: apmail-ws-tuscany-commits-archive@ws.apache.org Received: (qmail 77514 invoked by uid 500); 11 Feb 2008 15:14:20 -0000 Mailing-List: contact tuscany-commits-help@ws.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: tuscany-dev@ws.apache.org Delivered-To: mailing list tuscany-commits@ws.apache.org Received: (qmail 77504 invoked by uid 99); 11 Feb 2008 15:14:20 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Feb 2008 07:14:20 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Feb 2008 15:13:42 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 073331A9832; Mon, 11 Feb 2008 07:14:02 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r620502 - in /incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core: src/commonj/sdo/SDOSAX2Parser.cpp src/commonj/sdo/SDOUtils.cpp test/main.cpp test/nullExtendedPrimitive.xml test/nullExtendedPrimitive.xsd test/sdotest.h test/sdotest2.cpp Date: Mon, 11 Feb 2008 15:14:00 -0000 To: tuscany-commits@ws.apache.org From: robbinspg@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080211151402.073331A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: robbinspg Date: Mon Feb 11 07:13:59 2008 New Revision: 620502 URL: http://svn.apache.org/viewvc?rev=620502&view=rev Log: TUSCANY-2041 null extended primitive types cause parsing failure The logic in SDOSAX2Parser when encountering an end element tag is incorrect. In the case of an extended primitive type a new DO is created but this is not popped off the stack when we hit the end element tag. Added: incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/test/nullExtendedPrimitive.xml (with props) incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/test/nullExtendedPrimitive.xsd (with props) Modified: incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/src/commonj/sdo/SDOSAX2Parser.cpp incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/src/commonj/sdo/SDOUtils.cpp incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/test/main.cpp incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/test/sdotest.h incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/test/sdotest2.cpp Modified: incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/src/commonj/sdo/SDOSAX2Parser.cpp URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/src/commonj/sdo/SDOSAX2Parser.cpp?rev=620502&r1=620501&r2=620502&view=diff ============================================================================== --- incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/src/commonj/sdo/SDOSAX2Parser.cpp (original) +++ incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/src/commonj/sdo/SDOSAX2Parser.cpp Mon Feb 11 07:13:59 2008 @@ -1173,16 +1173,29 @@ return; } + bool popDO = false; // Indicate if we need to pop DO from stack + // If currentPropertySetting is set (name is not null) // then we need to set the property now if (!currentPropertySetting.name.isNull()) { - if (currentPropertySetting.isNULL) + // Determine if this is an extended primitive + bool isExtendedPrimitive = false; + const Type& tp = currentPropertySetting.dataObject->getType(); + XSDTypeInfo* typeInfo = (XSDTypeInfo*) + ((DASType*)&tp)->getDASValue("XMLDAS::TypeInfo"); + if (typeInfo && typeInfo->getTypeDefinition().isExtendedPrimitive) { + isExtendedPrimitive = true; + // If this setting was for an extended primitive we need to remove the + // DO from the stack + popDO = true; + } + if (currentPropertySetting.isNULL) + { currentPropertySetting.dataObject-> setNull((const char*)currentPropertySetting.name); - } else { @@ -1192,10 +1205,7 @@ } try { - const Type& tp = currentPropertySetting.dataObject->getType(); - XSDTypeInfo* typeInfo = (XSDTypeInfo*) - ((DASType*)&tp)->getDASValue("XMLDAS::TypeInfo"); - if (typeInfo && typeInfo->getTypeDefinition().isExtendedPrimitive) + if (isExtendedPrimitive) { const Property& p = currentPropertySetting.dataObject->getProperty( "value"); @@ -1230,18 +1240,7 @@ setCString((const char*)"value", currentPropertySetting.getStringWithCDataMarkers().c_str() ); } } - if (dataObjectStack.size() == 0 || rootDataObject == dataObjectStack.top()) - { - currentDataObject = 0; - currentDataObjectType = 0; - } - else - { - dataObjectStack.pop(); - currentDataObject = dataObjectStack.top(); - currentDataObjectType = &(currentDataObject->getType()); - } - + popDO = true; } else { @@ -1309,7 +1308,12 @@ } changeSummary = false; } - + + popDO = true; + } + + if (popDO) + { if (dataObjectStack.size() == 0 || rootDataObject == dataObjectStack.top()) { currentDataObject = 0; @@ -1322,6 +1326,7 @@ currentDataObjectType = &(currentDataObject->getType()); } } + LOGEXIT(INFO,"SDOSAX2Parser: endElementNs - exit4"); } Modified: incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/src/commonj/sdo/SDOUtils.cpp URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/src/commonj/sdo/SDOUtils.cpp?rev=620502&r1=620501&r2=620502&view=diff ============================================================================== --- incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/src/commonj/sdo/SDOUtils.cpp (original) +++ incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/src/commonj/sdo/SDOUtils.cpp Mon Feb 11 07:13:59 2008 @@ -223,8 +223,11 @@ else if (propertyType.isDataType()) { printTabs(out, incr); - out<< "Property Value: " - << dataObject->getCString(pl[i]) <isNull(pl[i])) + out << "NULL" << endl; + else + out << dataObject->getCString(pl[i]) < + + + + + + + + + + Propchange: incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/test/nullExtendedPrimitive.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/test/nullExtendedPrimitive.xml ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/test/nullExtendedPrimitive.xsd URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/test/nullExtendedPrimitive.xsd?rev=620502&view=auto ============================================================================== --- incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/test/nullExtendedPrimitive.xsd (added) +++ incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/test/nullExtendedPrimitive.xsd Mon Feb 11 07:13:59 2008 @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file Propchange: incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/test/nullExtendedPrimitive.xsd ------------------------------------------------------------------------------ svn:keywords = Rev Date Modified: incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/test/sdotest.h URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/test/sdotest.h?rev=620502&r1=620501&r2=620502&view=diff ============================================================================== --- incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/test/sdotest.h (original) +++ incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/test/sdotest.h Mon Feb 11 07:13:59 2008 @@ -215,4 +215,5 @@ static int elementFormDefaultQualified(); static int elementFormDefaultQualifiedSequence(); static int xsiTypeAbstract(); + static int nullExtendedPrimitive(); }; Modified: incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/test/sdotest2.cpp URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/test/sdotest2.cpp?rev=620502&r1=620501&r2=620502&view=diff ============================================================================== --- incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/test/sdotest2.cpp (original) +++ incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/test/sdotest2.cpp Mon Feb 11 07:13:59 2008 @@ -2029,4 +2029,36 @@ cout << "Exception in xsiTypeAbstract: " << e << endl; return 0; } +} + +int sdotest::nullExtendedPrimitive() +{ + + try { + XSDHelperPtr xsh = HelperProvider::getXSDHelper(); + XMLHelperPtr xmh = HelperProvider::getXMLHelper(xsh->getDataFactory()); + xsh->defineFile("nullExtendedPrimitive.xsd"); + unsigned int i,j; + if ((i = xsh->getErrorCount()) > 0) + { + cout << "nullExtendedPrimitive.xsd reported some errors: " <getErrorMessage(j) <getDataFactory()); + + XMLDocumentPtr doc = xmh->loadFile("nullExtendedPrimitive.xml"); + + //cout << doc->getRootDataObject() <