zorba-coders team mailing list archive
-
zorba-coders team
-
Mailing list archive
-
Message #06321
[Merge] lp:~zorba-coders/zorba/bug-955135 into lp:zorba
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/97476
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/97476
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog'
--- ChangeLog 2012-03-12 20:01:39 +0000
+++ ChangeLog 2012-03-14 17:59:22 +0000
@@ -39,6 +39,8 @@
of the annotations map in expressions.
Bug Fixes/Other Changes:
+ * Fixed bug 955170 (Catch clause with URILiteral-based wilcard NameTest)
+ * Fixed bug 955135 (err:XQDY0044 not caught by try-catch expressions)
* 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)
=== modified file 'src/compiler/translator/translator.cpp'
--- src/compiler/translator/translator.cpp 2012-03-07 14:22:29 +0000
+++ src/compiler/translator/translator.cpp 2012-03-14 17:59: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-02-15 10:25:02 +0000
+++ src/runtime/core/constructors.cpp 2012-03-14 17:59: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") &&
@@ -616,6 +611,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-01-11 17:30:25 +0000
+++ src/runtime/core/constructors.h 2012-03-14 17:59: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-14 17:59: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-14 17:59: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-14 17:59: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-14 17:59:22 +0000
@@ -0,0 +1,1 @@
+try { 1 div 0 } catch "http://www.w3.org/2005/xqt-errors":* { "Message"}
Follow ups
-
Re: [Merge] lp:~zorba-coders/zorba/bug-955135 into lp:zorba
From: Ghislain Fourny, 2012-03-26
-
[Merge] lp:~zorba-coders/zorba/bug-955135 into lp:zorba
From: Zorba Build Bot, 2012-03-14
-
Re: [Merge] lp:~zorba-coders/zorba/bug-955135 into lp:zorba
From: Zorba Build Bot, 2012-03-14
-
[Merge] lp:~zorba-coders/zorba/bug-955135 into lp:zorba
From: Zorba Build Bot, 2012-03-14
-
[Merge] lp:~zorba-coders/zorba/bug-955135 into lp:zorba
From: Zorba Build Bot, 2012-03-14
-
[Merge] lp:~zorba-coders/zorba/bug-955135 into lp:zorba
From: Matthias Brantner, 2012-03-14
-
[Merge] lp:~zorba-coders/zorba/bug-955135 into lp:zorba
From: Zorba Build Bot, 2012-03-14
-
Re: [Merge] lp:~zorba-coders/zorba/bug-955135 into lp:zorba
From: Zorba Build Bot, 2012-03-14
-
[Merge] lp:~zorba-coders/zorba/bug-955135 into lp:zorba
From: Matthias Brantner, 2012-03-14
-
[Merge] lp:~zorba-coders/zorba/bug-955135 into lp:zorba
From: Zorba Build Bot, 2012-03-14
-
[Merge] lp:~zorba-coders/zorba/bug-955135 into lp:zorba
From: Zorba Build Bot, 2012-03-14
-
Re: [Merge] lp:~zorba-coders/zorba/bug-955135 into lp:zorba
From: Zorba Build Bot, 2012-03-14
-
[Merge] lp:~zorba-coders/zorba/bug-955135 into lp:zorba
From: Matthias Brantner, 2012-03-14
-
[Merge] lp:~zorba-coders/zorba/bug-955135 into lp:zorba
From: Zorba Build Bot, 2012-03-14
-
[Merge] lp:~zorba-coders/zorba/bug-955135 into lp:zorba
From: Matthias Brantner, 2012-03-14
-
Re: [Merge] lp:~zorba-coders/zorba/bug-955135 into lp:zorba
From: Matthias Brantner, 2012-03-14