← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~fcavalieri/zorba/bugs into lp:zorba

 

Federico Cavalieri has proposed merging lp:~fcavalieri/zorba/bugs into lp:zorba.

Requested reviews:
  Markos Zaharioudakis (markos-za)

For more details, see:
https://code.launchpad.net/~fcavalieri/zorba/bugs/+merge/87750

Fixed bug #912579 (validate-in-place on non-root elements)
Fixed merge of updput primitives
-- 
https://code.launchpad.net/~fcavalieri/zorba/bugs/+merge/87750
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog'
--- ChangeLog	2012-01-05 13:20:30 +0000
+++ ChangeLog	2012-01-06 13:35:28 +0000
@@ -19,6 +19,7 @@
   * Added split function to the string module that allows for streamable tokenization but doesn't have regular expression
     support.
   * zerr is not predeclared anymore to be http://www.zorba-xquery.com/errors
+  * Fixed bug #912579 (validate-in-place on non-root elements)
 
 version 2.1
 

=== modified file 'include/zorba/pregenerated/diagnostic_list.h'
--- include/zorba/pregenerated/diagnostic_list.h	2011-12-21 14:40:33 +0000
+++ include/zorba/pregenerated/diagnostic_list.h	2012-01-06 13:35:28 +0000
@@ -508,6 +508,8 @@
 
 extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZAPI0080_CANNOT_RETRIEVE_NODE_REFERENCE;
 
+extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZAPI0090_CANNOT_VALIDATE_NON_ROOT;
+
 extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZCSE0001_NONEXISTENT_INPUT_FIELD;
 
 extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZCSE0002_INCOMPATIBLE_INPUT_FIELD;

=== modified file 'modules/com/zorba-xquery/www/modules/pregenerated/errors.xq'
--- modules/com/zorba-xquery/www/modules/pregenerated/errors.xq	2011-12-21 14:40:33 +0000
+++ modules/com/zorba-xquery/www/modules/pregenerated/errors.xq	2012-01-06 13:35:28 +0000
@@ -317,6 +317,10 @@
 
 (:~
 :)
+declare variable $zerr:ZAPI0090 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0090");
+
+(:~
+:)
 declare variable $zerr:ZCSE0001 as xs:QName := fn:QName($zerr:NS, "zerr:ZCSE0001");
 
 (:~

=== modified file 'src/diagnostics/diagnostic_en.xml'
--- src/diagnostics/diagnostic_en.xml	2011-12-21 14:40:33 +0000
+++ src/diagnostics/diagnostic_en.xml	2012-01-06 13:35:28 +0000
@@ -1823,6 +1823,10 @@
     <diagnostic code="ZAPI0080" name="CANNOT_RETRIEVE_NODE_REFERENCE">
       <value>can not retrieve node-reference for a node that is not in a collection.</value>
     </diagnostic>
+     
+    <diagnostic code="ZAPI0090" name="CANNOT_VALIDATE_NON_ROOT">
+      <value>a non root element cannot be validated in place.</value>
+    </diagnostic>
 
     <!--////////// Zorba Class Serialization Errors ////////////////////////-->
 

=== modified file 'src/diagnostics/pregenerated/diagnostic_list.cpp'
--- src/diagnostics/pregenerated/diagnostic_list.cpp	2011-12-21 14:40:33 +0000
+++ src/diagnostics/pregenerated/diagnostic_list.cpp	2012-01-06 13:35:28 +0000
@@ -741,6 +741,9 @@
 ZorbaErrorCode ZAPI0080_CANNOT_RETRIEVE_NODE_REFERENCE( "ZAPI0080" );
 
 
+ZorbaErrorCode ZAPI0090_CANNOT_VALIDATE_NON_ROOT( "ZAPI0090" );
+
+
 ZorbaErrorCode ZCSE0001_NONEXISTENT_INPUT_FIELD( "ZCSE0001" );
 
 

=== modified file 'src/diagnostics/pregenerated/dict_en.cpp'
--- src/diagnostics/pregenerated/dict_en.cpp	2011-12-21 14:40:33 +0000
+++ src/diagnostics/pregenerated/dict_en.cpp	2012-01-06 13:35:28 +0000
@@ -248,6 +248,7 @@
   { "ZAPI0042", "iterator is closed" },
   { "ZAPI0070", "\"$1\": invalid serialization method for SAX" },
   { "ZAPI0080", "can not retrieve node-reference for a node that is not in a collection." },
+  { "ZAPI0090", "a non root element cannot be validated in place." },
   { "ZCSE0001", "\"$1\": nonexistent input field" },
   { "ZCSE0002", "\"$1\": incompatible input field${: type=2}${, class=3}" },
   { "ZCSE0003", "\"$1\": unrecognized class field" },

=== modified file 'src/runtime/schema/schema_impl.cpp'
--- src/runtime/schema/schema_impl.cpp	2011-10-13 19:44:33 +0000
+++ src/runtime/schema/schema_impl.cpp	2012-01-06 13:35:28 +0000
@@ -93,6 +93,12 @@
 
   if (consumeNext(node, theChild.getp(), planState))
   {
+    // verify that if the element being revalidated is an element it is the root
+    if (node->getNodeKind()==store::StoreConsts::elementNode &&
+        node->getParent() &&
+        node->getParent()->getNodeKind()!=store::StoreConsts::documentNode)
+      throw XQUERY_EXCEPTION( zerr::ZAPI0090_CANNOT_VALIDATE_NON_ROOT, ERROR_LOC( loc ) );
+
     pul = GENV_ITEMFACTORY->createPendingUpdateList();
 
     pul->addRevalidate(&loc,node);

=== modified file 'src/store/naive/pul_primitives.cpp'
--- src/store/naive/pul_primitives.cpp	2011-11-02 17:19:09 +0000
+++ src/store/naive/pul_primitives.cpp	2012-01-06 13:35:28 +0000
@@ -820,7 +820,7 @@
     }
     else
     {
-      theTarget = theTarget->copy(NULL, copymode);
+        theTarget = theTarget->copy(NULL, copymode);
     }
 
     store->addNode(targetUri, theTarget);

=== modified file 'src/store/naive/simple_pul.cpp'
--- src/store/naive/simple_pul.cpp	2011-10-30 00:18:34 +0000
+++ src/store/naive/simple_pul.cpp	2012-01-06 13:35:28 +0000
@@ -1205,6 +1205,7 @@
     }
 
     thePutList.push_back(otherUpd);
+    otherUpd->thePul = this;
     otherp->thePutList[i] = NULL;
   }
 

=== added file 'test/rbkt/Queries/zorba/schemas/val-inplace-err2.spec'
--- test/rbkt/Queries/zorba/schemas/val-inplace-err2.spec	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/schemas/val-inplace-err2.spec	2012-01-06 13:35:28 +0000
@@ -0,0 +1,1 @@
+Error: http://www.zorba-xquery.com/errors:ZAPI0090

=== added file 'test/rbkt/Queries/zorba/schemas/val-inplace-err2.xq'
--- test/rbkt/Queries/zorba/schemas/val-inplace-err2.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/schemas/val-inplace-err2.xq	2012-01-06 13:35:28 +0000
@@ -0,0 +1,23 @@
+import module namespace schema = "http://www.zorba-xquery.com/modules/schema";;
+import module namespace doc = "http://www.zorba-xquery.com/modules/store/dynamic/documents";; 
+import schema namespace d="http://www.zorba-xquery.org/schema"; at "val-inplace-err2.xsd";
+
+declare revalidation lax;
+declare construction strip;
+
+declare variable $doc2:=<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+    xmlns="http://www.zorba-xquery.org/schema";>
+    <root>
+        <a/>
+        <b/>
+        <c/>
+    </root>    
+    <a/>
+    <b/>
+    <c/>
+</root>;
+
+schema:validate-in-place($doc2/d:root);
+
+
+(schema:schema-type($doc2), schema:schema-type($doc2/d:root))
\ No newline at end of file

=== added file 'test/rbkt/Queries/zorba/schemas/val-inplace-err2.xsd'
--- test/rbkt/Queries/zorba/schemas/val-inplace-err2.xsd	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/schemas/val-inplace-err2.xsd	2012-01-06 13:35:28 +0000
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
+	targetNamespace="http://www.zorba-xquery.org/schema"; xmlns="http://www.zorba-xquery.org/schema";
+	elementFormDefault="qualified">
+	
+	<xs:element name="root" type="rootType"/>
+	
+	<xs:complexType name="rootType">		
+		<xs:sequence>
+			<xs:element name="root" type="rootType" minOccurs="0"/>
+			<xs:element name="a" type="xs:string"/>
+			<xs:element name="b" type="xs:string"/>
+			<xs:element name="c" type="xs:string"/>			            
+		</xs:sequence>
+		<xs:attribute name="attr" type="xs:string"/>
+	</xs:complexType>
+		
+</xs:schema>
\ No newline at end of file


Follow ups