diff --git a/0001-Allow-building-against-OSGi-APIs-newer-than-R4.patch b/0001-Allow-building-against-OSGi-APIs-newer-than-R4.patch new file mode 100644 index 0000000..b47e2d6 --- /dev/null +++ b/0001-Allow-building-against-OSGi-APIs-newer-than-R4.patch @@ -0,0 +1,59 @@ +From 46dbf7151b5d8b1a854863305297cc7b4a70af44 Mon Sep 17 00:00:00 2001 +From: Mat Booth +Date: Wed, 18 Sep 2019 16:00:51 +0100 +Subject: [PATCH] Allow building against OSGi APIs newer than R4 + +--- + .../ctc/wstx/osgi/WstxBundleActivator.java | 23 ++++++++++++++++--- + 1 file changed, 20 insertions(+), 3 deletions(-) + +diff --git a/src/main/java/com/ctc/wstx/osgi/WstxBundleActivator.java b/src/main/java/com/ctc/wstx/osgi/WstxBundleActivator.java +index 0ad8402..26b1f0f 100644 +--- a/src/main/java/com/ctc/wstx/osgi/WstxBundleActivator.java ++++ b/src/main/java/com/ctc/wstx/osgi/WstxBundleActivator.java +@@ -1,5 +1,9 @@ + 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; + +@@ -27,16 +31,29 @@ public class WstxBundleActivator + public void start(BundleContext ctxt) + { + InputFactoryProviderImpl inputP = new InputFactoryProviderImpl(); +- ctxt.registerService(Stax2InputFactoryProvider.class.getName(), inputP, inputP.getProperties()); ++ ctxt.registerService(Stax2InputFactoryProvider.class.getName(), inputP, convertPropsToDict(inputP.getProperties())); + OutputFactoryProviderImpl outputP = new OutputFactoryProviderImpl(); +- ctxt.registerService(Stax2OutputFactoryProvider.class.getName(), outputP, outputP.getProperties()); ++ 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]; +- ctxt.registerService(Stax2ValidationSchemaFactoryProvider.class.getName(), impl, impl.getProperties()); ++ ctxt.registerService(Stax2ValidationSchemaFactoryProvider.class.getName(), impl, convertPropsToDict(impl.getProperties())); + } + } + ++ /** ++ * A Properties object is a Dictionary but the OSGi API got ++ * more restrictive and requires a Dictionary, so we must do ++ * a quick conversion here. ++ */ ++ private Dictionary convertPropsToDict(Properties props) { ++ Dictionary dict = new Hashtable(); ++ 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.20.1 + diff --git a/woodstox-core.spec b/woodstox-core.spec index 7040afa..5dc45dd 100644 --- a/woodstox-core.spec +++ b/woodstox-core.spec @@ -3,12 +3,14 @@ Name: woodstox-core Summary: High-performance XML processor Version: 6.0.1 -Release: 1%{?dist} +Release: 2%{?dist} License: ASL 2.0 or LGPLv2+ or BSD URL: https://github.com/FasterXML/woodstox Source0: %{url}/archive/%{name}-%{version}.tar.gz +Patch0: 0001-Allow-building-against-OSGi-APIs-newer-than-R4.patch + BuildArch: noarch BuildRequires: maven-local @@ -40,6 +42,8 @@ This package contains the API documentation for %{name}. %prep %setup -q -n %{base_name}-%{name}-%{version} +%patch0 -p1 + # we don't care about Java 9 modules (yet) %pom_remove_plugin :moditect-maven-plugin @@ -70,6 +74,9 @@ This package contains the API documentation for %{name}. %changelog +* Wed Sep 18 2019 Mat Booth - 6.0.1-2 +- Port to newer OSGi API + * Wed Sep 18 2019 Fabio Valentini - 6.0.1-1 - Update to version 6.0.1.