Matthias Brantner has proposed merging lp:~zorba-coders/zorba/bug-955135 into 
lp:zorba.

Requested reviews:
  Matthias Brantner (matthias-brantner)
  Ghislain Fourny (gislenius)
Related bugs:
  Bug #955135 in Zorba: "err:XQDY0044 not caught by try-catch expressions."
  https://bugs.launchpad.net/zorba/+bug/955135
  Bug #955170 in Zorba: "Catch clause with URILiteral-based wilcard NameTest"
  https://bugs.launchpad.net/zorba/+bug/955170

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug-955135/+merge/99354

fixed bug 955135 (err:XQDY0044 not caught by try-catch expressions)
fixed bug 955170 (Catch clause with URILiteral-based wilcard NameTest)
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-955135/+merge/99354
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog'
--- ChangeLog	2012-03-26 02:37:23 +0000
+++ ChangeLog	2012-03-26 15:35:22 +0000
@@ -1,8 +1,19 @@
 Zorba - The XQuery Processor
 
 version 2.5
+
+New Features:
+
+Optimization:
+
+Bug Fixes/Other Changes
   * Fixed bug in window iterator
+<<<<<<< TREE
   * Fixed bug #872234 (prevent a rewritting to take place in case of sequential expr)
+=======
+  * Fixed bug 955170 (Catch clause with URILiteral-based wilcard NameTest)
+  * Fixed bug 955135 (err:XQDY0044 not caught by try-catch expressions)
+>>>>>>> MERGE-SOURCE
 
 	
 version 2.2
@@ -46,11 +57,11 @@
     of the annotations map in expressions.
 
 Bug Fixes/Other Changes:
-  * Fixed bug #923015 (clone() not implemented for full-text expressions)
-  * Fixed bug #917923 (bug in copying outer var values into the eval dynamic context)
-  * Fixed bug #867509 (Can not handle largest xs:unsignedLong values)
-  * Fixed bug #924063 (sentence is incorrectly incremented when token characters end without sentence terminator)
-  * Fixed bug #909126 (bug in cloning of var_expr)
+  * Fixed bug 923015 (clone() not implemented for full-text expressions)
+  * Fixed bug 917923 (bug in copying outer var values into the eval dynamic context)
+  * Fixed bug 867509 (Can not handle largest xs:unsignedLong values)
+  * Fixed bug 924063 (sentence is incorrectly incremented when token characters end without sentence terminator)
+  * Fixed bug 909126 (bug in cloning of var_expr)
   * Fixed bug in destruction of exit_catcher_expr
   * Fixed bug #867024 (error messages)
   * Fixed bug #957580 (stream read failure in StringToCodepointsIteartor)

=== modified file 'bin/debugger/main.cpp'
--- bin/debugger/main.cpp	2012-03-23 17:32:07 +0000
+++ bin/debugger/main.cpp	2012-03-26 15:35:22 +0000
@@ -18,6 +18,8 @@
 # include <windows.h>
 # include <string.h>
 # include <strsafe.h>
+#else
+#include <unistd.h>
 #endif
 
 #include <vector>

=== modified file 'bin/debugger/process_listener.cpp'
--- bin/debugger/process_listener.cpp	2012-03-23 17:32:07 +0000
+++ bin/debugger/process_listener.cpp	2012-03-26 15:35:22 +0000
@@ -18,6 +18,10 @@
 
 #include <iostream>
 
+#ifndef WIN32
+#include <unistd.h>
+#endif
+
 #ifdef ZORBA_HAVE_PTHREAD_H
 # include <cassert>
 #endif

=== modified file 'src/compiler/translator/translator.cpp'
--- src/compiler/translator/translator.cpp	2012-03-23 17:32:07 +0000
+++ src/compiler/translator/translator.cpp	2012-03-26 15:35:22 +0000
@@ -9044,16 +9044,25 @@
         case ParseConstants::wild_all:
           cc->add_nametest_h(new NodeNameTest(zstring(), zstring()));
           break;
-        case ParseConstants::wild_elem: {
+        case ParseConstants::wild_elem:
+        {
           // bugfix #3138633; expand the qname and use the namespace instead of the prefix
           zstring localname(":wildcard");
-          store::Item_t qnItem;
-          theSctx->expand_qname(qnItem,
-                                theSctx->default_elem_type_ns(),
-                                wildcard->getNsOrPrefix(),
-                                localname,
-                                wildcard->get_location());
-          cc->add_nametest_h(new NodeNameTest(qnItem->getNamespace(), zstring()));
+
+          if (wildcard->isEQnameMatch())
+          {
+            cc->add_nametest_h(new NodeNameTest(wildcard->getNsOrPrefix(), zstring()));
+          }
+          else
+          {
+            store::Item_t qnItem;
+            theSctx->expand_qname(qnItem,
+                                  theSctx->default_elem_type_ns(),
+                                  wildcard->getNsOrPrefix(),
+                                  localname,
+                                  wildcard->get_location());
+            cc->add_nametest_h(new NodeNameTest(qnItem->getNamespace(), zstring()));
+          }
           break;
         }
         case ParseConstants::wild_prefix:

=== modified file 'src/runtime/core/constructors.cpp'
--- src/runtime/core/constructors.cpp	2012-03-23 17:32:07 +0000
+++ src/runtime/core/constructors.cpp	2012-03-26 15:35:22 +0000
@@ -543,22 +543,22 @@
   BinaryBaseIterator<AttributeIterator, PlanIteratorState>(sctx, loc, qnameIte, valueIte),
   theQName(qname),
   theIsId(false),
-  theIsRoot(isRoot)
+  theIsRoot(isRoot),
+  theRaiseXQDY0074(false),
+  theRaiseXQDY0044(false)
 {
-  if (theQName != NULL)
+  if (theQName)
   {
     if (theQName->getLocalName().empty())
     {
-      RAISE_ERROR(err::XQDY0074, loc,
-      ERROR_PARAMS("", ZED(NoEmptyLocalname)));
+      theRaiseXQDY0074 = true;
     }
 
     if (ZSTREQ(theQName->getNamespace(), "http://www.w3.org/2000/xmlns/";) ||
         (theQName->getNamespace().empty() &&
          ZSTREQ(theQName->getLocalName(), "xmlns")))
     {
-      RAISE_ERROR(err::XQDY0044, loc,
-      ERROR_PARAMS(theQName->getStringValue()));
+      theRaiseXQDY0044 = true;
     }
 
     if ((ZSTREQ(theQName->getNamespace(), "http://www.w3.org/XML/1998/namespace";) &&
@@ -567,8 +567,7 @@
         (ZSTREQ(theQName->getPrefix(), "xml") &&
          !ZSTREQ(theQName->getNamespace(), "http://www.w3.org/XML/1998/namespace";)))
     {
-      RAISE_ERROR(err::XQDY0044, loc,
-      ERROR_PARAMS(theQName->getStringValue()));
+      theRaiseXQDY0044 = true;
     }
 
     if ((ZSTREQ(theQName->getNamespace(), "http://www.w3.org/2000/xmlns/";) &&
@@ -577,11 +576,7 @@
         (ZSTREQ(theQName->getPrefix(), "xmlns") &&
          !ZSTREQ(theQName->getNamespace(), "http://www.w3.org/2000/xmlns/";)))
     {
-      throw XQUERY_EXCEPTION(
-        err::XQDY0044,
-        ERROR_PARAMS( theQName->getStringValue() ),
-        ERROR_LOC( loc )
-      );
+      theRaiseXQDY0044 = true;
     }
 
     if (ZSTREQ(theQName->getPrefix(), "xml") &&
@@ -599,6 +594,8 @@
   ar & theQName;
   ar & theIsId;
   ar & theIsRoot;
+  ar & theRaiseXQDY0074;
+  ar & theRaiseXQDY0044;
 }
 
 
@@ -616,6 +613,24 @@
   PlanIteratorState* state;
   DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
 
+  if (theQName != NULL)
+  {
+    // need to raise those errors here and not in the constructor
+    // because they are dynamic errors and might be caught by try-catch
+    // (bug 955135)
+    if (theRaiseXQDY0074)
+    {
+      RAISE_ERROR(err::XQDY0074, loc,
+      ERROR_PARAMS("", ZED(NoEmptyLocalname)));
+    }
+
+    if (theRaiseXQDY0044)
+    {
+      RAISE_ERROR(err::XQDY0044, loc,
+      ERROR_PARAMS(theQName->getStringValue()));
+    }
+  }
+
   if (theChild0 != NULL)
   {
     // Compute the attribute name. Note: we don't have to check that itemQName

=== modified file 'src/runtime/core/constructors.h'
--- src/runtime/core/constructors.h	2012-03-23 17:32:07 +0000
+++ src/runtime/core/constructors.h	2012-03-26 15:35:22 +0000
@@ -170,6 +170,8 @@
   store::Item_t theQName;
   bool          theIsId;
   bool          theIsRoot;
+  bool          theRaiseXQDY0074;
+  bool          theRaiseXQDY0044;
 
 public:
   SERIALIZABLE_CLASS(AttributeIterator);

=== added file 'test/rbkt/ExpQueryResults/zorba/trycatch/trycatch12.xml.res'
--- test/rbkt/ExpQueryResults/zorba/trycatch/trycatch12.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/trycatch/trycatch12.xml.res	2012-03-26 15:35:22 +0000
@@ -0,0 +1,1 @@
+Invalid attribute.

=== added file 'test/rbkt/ExpQueryResults/zorba/trycatch/trycatch13.xml.res'
--- test/rbkt/ExpQueryResults/zorba/trycatch/trycatch13.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/trycatch/trycatch13.xml.res	2012-03-26 15:35:22 +0000
@@ -0,0 +1,1 @@
+Message

=== added file 'test/rbkt/Queries/zorba/trycatch/trycatch12.xq'
--- test/rbkt/Queries/zorba/trycatch/trycatch12.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/trycatch/trycatch12.xq	2012-03-26 15:35:22 +0000
@@ -0,0 +1,1 @@
+try { attribute xmlns {} } catch *:XQDY0044 { "Invalid attribute." }

=== added file 'test/rbkt/Queries/zorba/trycatch/trycatch13.xq'
--- test/rbkt/Queries/zorba/trycatch/trycatch13.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/trycatch/trycatch13.xq	2012-03-26 15:35:22 +0000
@@ -0,0 +1,1 @@
+try { 1 div 0 } catch "http://www.w3.org/2005/xqt-errors":* { "Message"}

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to