ppkarwasz opened a new pull request, #57:
URL: https://github.com/apache/mina/pull/57
## What
Due to a copy/paster error in #52 `CompressionFilter.onPreAdd()` built the
outbound deflater with `Zlib.MODE_INFLATER` instead of `MODE_DEFLATER`, so
every outbound write threw `IllegalStateException` ("not initialized as
DEFLATER") from `Zlib.deflate()`. Outbound compression was completely broken.
## Why it went unnoticed
`CompressionFilterTest` was `@Ignore`d with its body commented out (it
depended on EasyMock's removed `MockControl` API), so `CompressionFilter` had
no live coverage. `ZlibTest` only exercises `Zlib` directly, never going
through `onPreAdd()`.
## Changes
- One-line fix: deflater is now created with `MODE_DEFLATER`.
- Rewrote `CompressionFilterTest` with Mockito, replacing the unused
EasyMock dependency (Mockito is already managed in the root pom and used in
`mina-core`).
- Added coverage for `onPreAdd()`: a compress/decompress round trip, and a
guard that the deflater and inflater are not swapped.
Both new tests fail against the buggy code with the expected
`IllegalStateException`, and pass with the fix.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]