This is an automated email from the ASF dual-hosted git repository.
afs pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/jena.git
The following commit(s) were added to refs/heads/main by this push:
new 5eb342cc77 GH-4157: Fix for detecting rdf:version and its:version (ARP)
5eb342cc77 is described below
commit 5eb342cc77da62902e0a04b072cfb1d9e3ea3ada
Author: Andy Seaborne <[email protected]>
AuthorDate: Wed Aug 19 18:51:36 2026 +0100
GH-4157: Fix for detecting rdf:version and its:version (ARP)
---
.../apache/jena/rdfxml/arp1/impl/QNameLexer.java | 4 +-
.../jena/rdfxml/arp1tests/TS3_xmlinput1.java | 28 +++++-----
.../apache/jena/rdfxml/arp1tests/TestsARP2.java | 65 ++++++++++++++++++++++
3 files changed, 80 insertions(+), 17 deletions(-)
diff --git
a/jena-core/src/main/java/org/apache/jena/rdfxml/arp1/impl/QNameLexer.java
b/jena-core/src/main/java/org/apache/jena/rdfxml/arp1/impl/QNameLexer.java
index a9ab6957a6..5d9806ffde 100644
--- a/jena-core/src/main/java/org/apache/jena/rdfxml/arp1/impl/QNameLexer.java
+++ b/jena-core/src/main/java/org/apache/jena/rdfxml/arp1/impl/QNameLexer.java
@@ -160,8 +160,8 @@ abstract public class QNameLexer implements Names,
ARPErrorNumbers {
if ( "version".equals(getLocalName()) ) {
if ( rdfns.equals(getUri()) )
throw new ParseException(ARPErrorNumbers.ERR_RDF12,
location(), "RDF 1.2 not supported by ARP: rdf:"+getLocalName());
- if ( ITS.uri.equals(getUri()) ) {}
- throw new ParseException(ARPErrorNumbers.ERR_RDF12,
location(), "RDF 1.2 not supported by ARP: rdf:"+getLocalName());
+ if ( ITS.uri.equals(getUri()) )
+ throw new ParseException(ARPErrorNumbers.ERR_RDF12,
location(), "RDF 1.2 not supported by ARP: rdf:"+getLocalName());
}
}
return 0;
diff --git
a/jena-core/src/test/java/org/apache/jena/rdfxml/arp1tests/TS3_xmlinput1.java
b/jena-core/src/test/java/org/apache/jena/rdfxml/arp1tests/TS3_xmlinput1.java
index 04be02e82d..ecb14d51dd 100644
---
a/jena-core/src/test/java/org/apache/jena/rdfxml/arp1tests/TS3_xmlinput1.java
+++
b/jena-core/src/test/java/org/apache/jena/rdfxml/arp1tests/TS3_xmlinput1.java
@@ -23,27 +23,25 @@ package org.apache.jena.rdfxml.arp1tests;
import junit.framework.TestSuite;
-public class TS3_xmlinput1 extends TestSuite
-{
- static public TestSuite suite()
- {
+public class TS3_xmlinput1 extends TestSuite {
+ static public TestSuite suite() {
return new TS3_xmlinput1();
}
- private TS3_xmlinput1()
- {
+ private TS3_xmlinput1() {
super("RDF/XML Input ARP1");
- addTest( TestURIs.suite());
- addTest( TestSuiteWG_RDFXML.suite());
- addTest( TestSuiteWG_RDFXML_ARP.suite());
+ addTest(TestURIs.suite());
+ addTest(TestSuiteWG_RDFXML.suite());
+ addTest(TestSuiteWG_RDFXML_ARP.suite());
- addTest( TestsARP.suite());
- addTest(
org.apache.jena.rdfxml.arp1tests.states.TestARPStates.suite());
+ addTest(TestsARP.suite());
+ addTest(TestsARP2.suite());
+ addTest(org.apache.jena.rdfxml.arp1tests.states.TestARPStates.suite());
- addTest( TestsTainting.suite());
- addTest( TestsSAX2RDF.suite());
- addTest( TestsStAX2Model.suite());
- addTest( TestRDFXML_URI.suite());
+ addTest(TestsTainting.suite());
+ addTest(TestsSAX2RDF.suite());
+ addTest(TestsStAX2Model.suite());
+ addTest(TestRDFXML_URI.suite());
}
private void addTest(String name, TestSuite tc) {
diff --git
a/jena-core/src/test/java/org/apache/jena/rdfxml/arp1tests/TestsARP2.java
b/jena-core/src/test/java/org/apache/jena/rdfxml/arp1tests/TestsARP2.java
new file mode 100644
index 0000000000..b06fa6c2e9
--- /dev/null
+++ b/jena-core/src/test/java/org/apache/jena/rdfxml/arp1tests/TestsARP2.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+package org.apache.jena.rdfxml.arp1tests;
+
+import java.io.StringReader;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.apache.jena.rdf.model.Model;
+import org.apache.jena.rdf.model.ModelFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/** ARP - Tests after migration of Jena users to RRX */
+public class TestsARP2 extends TestCase {
+
+ static private Logger logger = LoggerFactory.getLogger(TestsARP2.class);
+ static public Test suite() {
+ TestSuite suite = new TestSuite(TestsARP2.class);
+ return suite;
+ }
+
+ public TestsARP2(String s) {
+ super(s);
+ }
+
+ protected Model createMemModel() {
+ return ModelFactory.createDefaultModel();
+ }
+
+ // GH-4157
+ public void testVersionLocalname() {
+ String x = """
+ <?xml version="1.0"?>
+ <rdf:Description
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:oslc_rm="http://open-services.net/xmlns/rm/1.0/">
+ <rdf:type
rdf:resource="http://open-services.net/ns/core#RootServices"/>
+ <oslc_rm:version>7.0.2</oslc_rm:version>
+ </rdf:Description>
+ """;
+ Model m = createMemModel();
+ m.read(new StringReader(x), "");
+ assertEquals(2, m.size());
+ }
+}