[gxml] Fixed throw error on invalid URI namespace
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gxml] Fixed throw error on invalid URI namespace
- Date: Thu, 3 Nov 2016 00:02:37 +0000 (UTC)
commit 2ce8bbd57741db4e25f553a1f4539521d016e417
Author: Daniel Espinosa <esodan gmail com>
Date: Wed Nov 2 16:51:22 2016 -0600
Fixed throw error on invalid URI namespace
gxml/GomElement.vala | 2 +-
test/GomDocumentTest.vala | 4 ++++
2 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/gxml/GomElement.vala b/gxml/GomElement.vala
index c7fdb69..14f62ba 100644
--- a/gxml/GomElement.vala
+++ b/gxml/GomElement.vala
@@ -334,7 +334,7 @@ public class GXml.GomElement : GomNode,
nspn = _element.lookup_prefix ((node as DomAttr).namespace_uri);
nsn = _element.lookup_namespace_uri (nspn);
if (nspn != (node as DomAttr).prefix
- && nsn != null && nsn != (node as DomAttr).namespace_uri)
+ && nsn != (node as DomAttr).namespace_uri)
throw new DomError.NAMESPACE_ERROR
(_("Trying to add an attribute with a non found namespace URI"));
}
diff --git a/test/GomDocumentTest.vala b/test/GomDocumentTest.vala
index 613cc3b..ca530d9 100644
--- a/test/GomDocumentTest.vala
+++ b/test/GomDocumentTest.vala
@@ -368,6 +368,10 @@ class GomDocumentTest : GXmlTest {
c.set_attribute_ns ("http://www.gnome.org/GXml2","gxml3:prop","val");
assert_not_reached ();
} catch {}
+ try {
+ c.set_attribute_ns ("http://www.gnome.org/GXml3","gxml2:prop","val");
+ assert_not_reached ();
+ } catch {}
var p = (c as DomElement).get_attribute_ns ("http://www.gnome.org/GXml2",
"prop");
assert (p == null);
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]