You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by mi...@apache.org on 2021/09/21 05:09:50 UTC

[activemq-nms-openwire] branch main updated: AMQNET-665 - Fix compression compatibility

This is an automated email from the ASF dual-hosted git repository.

michaelpearce pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-nms-openwire.git


The following commit(s) were added to refs/heads/main by this push:
     new 1ca6466  AMQNET-665 - Fix compression compatibility
1ca6466 is described below

commit 1ca64661b3bcb24e1da81ecfa746e9b5b771dadb
Author: Michael Andre Pearce <mi...@me.com>
AuthorDate: Tue Mar 23 21:07:28 2021 +0000

    AMQNET-665 - Fix compression compatibility
    
    Fix the known regression caused in removing IonicZlib which was at the time of supporting .net std not maintained,
    
    An alternative has now been found SharpZibLib.
    Unfortunately it does mean the minimum supported framework version now has to bump to 4.5
---
 src/CompressionPolicy.cs | 7 ++++---
 src/nms-openwire.csproj  | 3 ++-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/CompressionPolicy.cs b/src/CompressionPolicy.cs
index 68d864a..451a539 100644
--- a/src/CompressionPolicy.cs
+++ b/src/CompressionPolicy.cs
@@ -16,7 +16,8 @@
  */
 
 using System.IO;
-using System.IO.Compression;
+using ICSharpCode.SharpZipLib.Zip.Compression.Streams;
+
 
 namespace Apache.NMS.ActiveMQ
 {
@@ -24,12 +25,12 @@ namespace Apache.NMS.ActiveMQ
     {
         public Stream CreateCompressionStream(Stream data)
         {
-            return new GZipStream(data, CompressionMode.Compress);
+            return new DeflaterOutputStream(data);
         }
 
         public Stream CreateDecompressionStream(Stream data)
         {
-            return new GZipStream(data, CompressionMode.Decompress);
+            return new InflaterInputStream(data);
         }
 
         public object Clone()
diff --git a/src/nms-openwire.csproj b/src/nms-openwire.csproj
index 05b9524..4062420 100644
--- a/src/nms-openwire.csproj
+++ b/src/nms-openwire.csproj
@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFrameworks>net40;netstandard2.0</TargetFrameworks>
+    <TargetFrameworks>net45;netstandard2.0</TargetFrameworks>
     <RootNamespace>Apache.NMS.ActiveMQ</RootNamespace>
     <AssemblyName>Apache.NMS.ActiveMQ</AssemblyName>
     <Version>1.8.0</Version>
@@ -42,6 +42,7 @@
 
   <ItemGroup>
     <PackageReference Include="Apache.NMS" Version="1.8.0" />
+    <PackageReference Include="SharpZipLib" Version="1.3.1" />
   </ItemGroup>
 
   <ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">