!4 Upgrade to 6.2.8

From: @starlet-dx 
Reviewed-by: @caodongxia 
Signed-off-by: @caodongxia
This commit is contained in:
openeuler-ci-bot 2023-11-13 06:39:53 +00:00 committed by Gitee
commit 3b781349d0
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
5 changed files with 236 additions and 8 deletions

View File

@ -0,0 +1,61 @@
From 18c3c498a8099dca74127abbc958d696b4397825 Mon Sep 17 00:00:00 2001
From: Mat Booth <mat.booth@redhat.com>
Date: Wed, 18 Sep 2019 16:00:51 +0100
Subject: [PATCH 1/2] Allow building against OSGi APIs newer than R4
---
.../ctc/wstx/osgi/WstxBundleActivator.java | 24 ++++++++++++++-----
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/src/main/java/com/ctc/wstx/osgi/WstxBundleActivator.java b/src/main/java/com/ctc/wstx/osgi/WstxBundleActivator.java
index b233267..cedf476 100644
--- a/src/main/java/com/ctc/wstx/osgi/WstxBundleActivator.java
+++ b/src/main/java/com/ctc/wstx/osgi/WstxBundleActivator.java
@@ -1,6 +1,8 @@
package com.ctc.wstx.osgi;
import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Properties;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
@@ -30,19 +32,29 @@ public class WstxBundleActivator
public void start(BundleContext ctxt)
{
InputFactoryProviderImpl inputP = new InputFactoryProviderImpl();
- final Dictionary inputProps = inputP.getProperties();
- ctxt.registerService(Stax2InputFactoryProvider.class.getName(), inputP, inputProps);
+ ctxt.registerService(Stax2InputFactoryProvider.class.getName(), inputP, convertPropsToDict(inputP.getProperties()));
OutputFactoryProviderImpl outputP = new OutputFactoryProviderImpl();
- final Dictionary outputProps = outputP.getProperties();
- ctxt.registerService(Stax2OutputFactoryProvider.class.getName(), outputP, outputProps);
+ ctxt.registerService(Stax2OutputFactoryProvider.class.getName(), outputP, convertPropsToDict(outputP.getProperties()));
ValidationSchemaFactoryProviderImpl[] impls = ValidationSchemaFactoryProviderImpl.createAll();
for (int i = 0, len = impls.length; i < len; ++i) {
ValidationSchemaFactoryProviderImpl impl = impls[i];
- final Dictionary implProps = impl.getProperties();
- ctxt.registerService(Stax2ValidationSchemaFactoryProvider.class.getName(), impl, implProps);
+ ctxt.registerService(Stax2ValidationSchemaFactoryProvider.class.getName(), impl, convertPropsToDict(impl.getProperties()));
}
}
+ /**
+ * A Properties object is a Dictionary<Object,Object> but the OSGi API got
+ * more restrictive and requires a Dictionary<String,Object>, so we must do
+ * a quick conversion here.
+ */
+ private Dictionary<String,Object> convertPropsToDict(Properties props) {
+ Dictionary<String,Object> dict = new Hashtable<String,Object>();
+ for (Object key : props.keySet()) {
+ dict.put(key.toString(), props.get(key));
+ }
+ return dict;
+ }
+
@Override
public void stop(BundleContext ctxt) {
// Nothing to do here: OSGi automatically de-registers services upon
--
2.28.0

View File

@ -0,0 +1,160 @@
From 44c46d0412b02942c77f502a578ca3d1c1f0559d Mon Sep 17 00:00:00 2001
From: Mat Booth <mat.booth@redhat.com>
Date: Wed, 22 Apr 2020 13:48:07 +0100
Subject: [PATCH 2/2] Patch out optional support for msv and relax schema
validation
---
.../ValidationSchemaFactoryProviderImpl.java | 26 +------------------
.../vstream/BaseStax2ValidationTest.java | 24 -----------------
.../java/stax2/vwstream/BaseOutputTest.java | 2 +-
.../wstxtest/vstream/BaseValidationTest.java | 12 ---------
4 files changed, 2 insertions(+), 62 deletions(-)
diff --git a/src/main/java/com/ctc/wstx/osgi/ValidationSchemaFactoryProviderImpl.java b/src/main/java/com/ctc/wstx/osgi/ValidationSchemaFactoryProviderImpl.java
index d7822bc..2c24f98 100644
--- a/src/main/java/com/ctc/wstx/osgi/ValidationSchemaFactoryProviderImpl.java
+++ b/src/main/java/com/ctc/wstx/osgi/ValidationSchemaFactoryProviderImpl.java
@@ -8,8 +8,6 @@ import org.codehaus.stax2.osgi.Stax2ValidationSchemaFactoryProvider;
import com.ctc.wstx.api.ValidatorConfig;
import com.ctc.wstx.dtd.DTDSchemaFactory;
-import com.ctc.wstx.msv.RelaxNGSchemaFactory;
-import com.ctc.wstx.msv.W3CSchemaFactory;
public abstract class ValidationSchemaFactoryProviderImpl
implements Stax2ValidationSchemaFactoryProvider
@@ -24,7 +22,7 @@ public abstract class ValidationSchemaFactoryProviderImpl
public static ValidationSchemaFactoryProviderImpl[] createAll()
{
return new ValidationSchemaFactoryProviderImpl[] {
- new DTD(), new RelaxNG(), new W3CSchema()
+ new DTD()
};
}
@@ -59,26 +57,4 @@ public abstract class ValidationSchemaFactoryProviderImpl
return new DTDSchemaFactory();
}
}
-
- final static class RelaxNG
- extends ValidationSchemaFactoryProviderImpl
- {
- RelaxNG() { super(XMLValidationSchema.SCHEMA_ID_RELAXNG); }
-
- @Override
- public XMLValidationSchemaFactory createValidationSchemaFactory() {
- return new RelaxNGSchemaFactory();
- }
- }
-
- final static class W3CSchema
- extends ValidationSchemaFactoryProviderImpl
- {
- W3CSchema() { super(XMLValidationSchema.SCHEMA_ID_W3C_SCHEMA); }
-
- @Override
- public XMLValidationSchemaFactory createValidationSchemaFactory() {
- return new W3CSchemaFactory();
- }
- }
}
diff --git a/src/test/java/stax2/vstream/BaseStax2ValidationTest.java b/src/test/java/stax2/vstream/BaseStax2ValidationTest.java
index 7ee0706..bf607bc 100644
--- a/src/test/java/stax2/vstream/BaseStax2ValidationTest.java
+++ b/src/test/java/stax2/vstream/BaseStax2ValidationTest.java
@@ -8,8 +8,6 @@ import org.codehaus.stax2.XMLStreamReader2;
import org.codehaus.stax2.validation.*;
import com.ctc.wstx.dtd.DTDSchemaFactory;
-import com.ctc.wstx.msv.RelaxNGSchemaFactory;
-import com.ctc.wstx.msv.W3CSchemaFactory;
import stax2.BaseStax2Test;
@@ -20,25 +18,10 @@ public abstract class BaseStax2ValidationTest
// by implementations other than Woodstox, that do NOT support non-ns mode.
protected final static boolean HAS_NON_NS_MODE = true;
- protected XMLValidationSchemaFactory newW3CSchemaValidatorFactory() {
- return new W3CSchemaFactory();
- }
-
- protected XMLValidationSchemaFactory newRelaxNGValidatorFactory() {
- return new RelaxNGSchemaFactory();
- }
-
protected XMLValidationSchemaFactory newDTDValidatorFactory() {
return new DTDSchemaFactory();
}
- protected XMLValidationSchema parseRngSchema(String contents)
- throws XMLStreamException
- {
- return newRelaxNGValidatorFactory()
- .createSchema(new StringReader(contents));
- }
-
protected XMLValidationSchema parseDTDSchema(String contents)
throws XMLStreamException
{
@@ -46,13 +29,6 @@ public abstract class BaseStax2ValidationTest
.createSchema(new StringReader(contents));
}
- protected XMLValidationSchema parseW3CSchema(String contents)
- throws XMLStreamException
- {
- return newW3CSchemaValidatorFactory()
- .createSchema(new StringReader(contents));
- }
-
protected void verifyFailure(String xml, XMLValidationSchema schema, String failMsg,
String failPhrase) throws XMLStreamException
{
diff --git a/src/test/java/stax2/vwstream/BaseOutputTest.java b/src/test/java/stax2/vwstream/BaseOutputTest.java
index a9e1ec5..475703e 100644
--- a/src/test/java/stax2/vwstream/BaseOutputTest.java
+++ b/src/test/java/stax2/vwstream/BaseOutputTest.java
@@ -36,7 +36,7 @@ abstract class BaseOutputTest
outf.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.valueOf(repairing));
XMLStreamWriter2 strw = (XMLStreamWriter2)outf.createXMLStreamWriter(w);
- XMLValidationSchema schema = parseW3CSchema(schemaSrc);
+ XMLValidationSchema schema = parseDTDSchema(schemaSrc);
strw.validateAgainst(schema);
strw.writeStartDocument();
diff --git a/src/test/java/wstxtest/vstream/BaseValidationTest.java b/src/test/java/wstxtest/vstream/BaseValidationTest.java
index b9d0c54..5ec3da2 100644
--- a/src/test/java/wstxtest/vstream/BaseValidationTest.java
+++ b/src/test/java/wstxtest/vstream/BaseValidationTest.java
@@ -25,24 +25,12 @@ public abstract class BaseValidationTest
return schF.createSchema(ref);
}
- protected XMLValidationSchema parseRngSchema(String contents)
- throws XMLStreamException
- {
- return parseSchema(contents, XMLValidationSchema.SCHEMA_ID_RELAXNG);
- }
-
protected XMLValidationSchema parseDTDSchema(String contents)
throws XMLStreamException
{
return parseSchema(contents, XMLValidationSchema.SCHEMA_ID_DTD);
}
- protected XMLValidationSchema parseW3CSchema(String contents)
- throws XMLStreamException
- {
- return parseSchema(contents, XMLValidationSchema.SCHEMA_ID_W3C_SCHEMA);
- }
-
protected void verifyFailure(String xml, XMLValidationSchema schema, String failMsg,
String failPhrase) throws XMLStreamException
{
--
2.28.0

Binary file not shown.

BIN
woodstox-core-6.2.8.tar.gz Normal file

Binary file not shown.

View File

@ -1,7 +1,7 @@
%global base_name woodstox
%global core_name %{base_name}-core
Name: %{core_name}
Version: 5.0.3
Version: 6.2.8
Release: 1
Summary: High-performance XML processor
License: ASL 2.0 or LGPLv2+ or BSD
@ -9,11 +9,14 @@ URL: https://github.com/FasterXML/woodstox
BuildArch: noarch
Source0: https://github.com/FasterXML/%{base_name}/archive/%{name}-%{version}.tar.gz
Patch0: 0001-stax2-api.patch
Patch1: 0001-Allow-building-against-OSGi-APIs-newer-than-R4.patch
Patch2: 0002-Patch-out-optional-support-for-msv-and-relax-schema-.patch
BuildRequires: maven-local mvn(com.fasterxml:oss-parent:pom:) mvn(javax.xml.stream:stax-api)
BuildRequires: mvn(junit:junit) mvn(net.java.dev.msv:msv-core)
BuildRequires: mvn(net.java.dev.msv:msv-rngconverter) mvn(net.java.dev.msv:xsdlib)
BuildRequires: mvn(org.apache.felix:maven-bundle-plugin) mvn(org.apache.felix:org.osgi.core)
BuildRequires: mvn(org.codehaus.woodstox:stax2-api)
BuildRequires: mvn(org.apache.maven.plugins:maven-shade-plugin) java-devel >= 1.8
%description
Woodstox is a high-performance validating namespace-aware StAX-compliant
(JSR-173) Open Source XML-processor written in Java.
@ -27,12 +30,12 @@ Summary: API documentation for %{name}
This package contains the API documentation for %{name}.
%prep
%setup -q -n %{base_name}-%{name}-%{version}
%patch0 -p1
%pom_xpath_inject 'pom:plugin[pom:artifactId="maven-bundle-plugin"]/pom:configuration' '
<instructions>
<Export-Package>{local-packages}</Export-Package>
</instructions>'
%autosetup -n %{base_name}-%{name}-%{version} -p1
%pom_remove_plugin :nexus-staging-maven-plugin
%pom_remove_plugin :moditect-maven-plugin
%pom_remove_plugin :jacoco-maven-plugin
%mvn_alias ":{woodstox-core}" :@1-lgpl :@1-asl :wstx-asl :wstx-lgpl \
org.codehaus.woodstox:@1 org.codehaus.woodstox:@1-asl \
org.codehaus.woodstox:@1-lgpl org.codehaus.woodstox:wstx-lgpl \
@ -41,16 +44,20 @@ This package contains the API documentation for %{name}.
rm ./src/test/java/org/codehaus/stax/test/stream/TestNamespaces.java
%build
%mvn_build
%mvn_build -f -- -Dsource=8
%install
%mvn_install
%files -f .mfiles
%doc README.md
%license LICENSE
%files javadoc -f .mfiles-javadoc
%changelog
* Fri Nov 10 2023 yaoxin <yao_xin001@hoperun.com> - 6.2.8-1
- Upgrade to 6.2.8
* Thu Jul 23 2020 Jeffery.Gao <gaojianxing@huawei.com> - 5.0.3-1
- Package init