diff --git a/bugs/Namespace bug.mbox b/bugs/Namespace bug.mbox new file mode 100644 index 0000000..e1fba31 --- /dev/null +++ b/bugs/Namespace bug.mbox @@ -0,0 +1,41 @@ +From alex@floop.org.uk Tue, 11 Jun 2013 22:05:32 +0100 +Return-Path: +Received: from dufus.floop.org.uk ([2a00:14f0:e017:0:226:b9ff:fecb:f60b]) + by mx.google.com with ESMTPSA id fv11sm20409456wic.11.2013.06.11.14.05.33 + for + (version=TLSv1 cipher=RC4-SHA bits=128/128); + Tue, 11 Jun 2013 14:05:34 -0700 (PDT) +From: Alex Tucker +To: stardog@clarkparsia.com +Subject: Namespace bug +Date: Tue, 11 Jun 2013 22:05:32 +0100 +Message-ID: <1820361.9uyvUy0jFE@dufus.floop.org.uk> +User-Agent: KMail/4.10.3 (Linux/3.9.4-200.fc18.x86_64; KDE/4.10.3; x86_64; ; ) +MIME-Version: 1.0 +Content-Transfer-Encoding: 7Bit +Content-Type: text/plain; charset="us-ascii" + +Chaps, + +I came across a pesky bug when attempting to load an RDF dump from a Semantic +MediaWiki today. The wiki has some awful URL redirection going on which +results in URLs with query parameters, and therefore the equals character (=) +in them being used in namespace declarations. This tickles what looks to be +an assumption in your com.clarkparsia.stardog.metadata.TextIO NamespaceIO +class that namespace URIs won't contain said character. + +Here's a minimal bit of RDF: + + + + + +which when loaded into a fresh Stardog DB causes any queries or attempts to +list namespaces to fail with "Not a valid prefix definition: +eq=http://www.example.com/2013/06/=bug#" + +Cheers, +Alex. + + diff --git a/fixes/namespace-with-equals-bug/README b/fixes/namespace-with-equals-bug/README new file mode 100644 index 0000000..0768011 --- /dev/null +++ b/fixes/namespace-with-equals-bug/README @@ -0,0 +1,11 @@ +Compiled a replacement method for NamespaceIO._read() based on: + + int pos = theValue.indexOf('='); + if (pos == -1) { + throw new IllegalArgumentException("Not a valid prefix definition: " + theValue); + } + return Values.namespace(theValue.substring(0, pos), theValue.substring(pos+1)); + +Edited bytecode of existing c.c.s.metadata.TextIO$NamespaceIO class using Java Bytecode Editor. +Resulting class file here, TextIO$NamespaceIO.class, needs copying into stardog-a.b.c.jar + diff --git a/fixes/namespace-with-equals-bug/TextIO$NamespaceIO.class b/fixes/namespace-with-equals-bug/TextIO$NamespaceIO.class new file mode 100644 index 0000000..fa52ef2 --- /dev/null +++ b/fixes/namespace-with-equals-bug/TextIO$NamespaceIO.class Binary files differ