Revert "Fix potential GZIPOutputStream resource leak on exception"

This reverts commit 6c7d2ab3ad.
This commit is contained in:
imhao183
2019-12-13 12:57:59 +08:00
parent f204bd693e
commit 583df110fd
@@ -179,15 +179,16 @@ public class Qos1PublishHandler extends QosPublishHandler {
MemorySessionStore.Session session = m_sessionStore.getSession(clientID);
if (session != null && session.getUsername().equals(fromUser)) {
if (data.length > 7*1024 && session.getMqttVersion().protocolLevel() >= MqttVersion.Wildfire_1.protocolLevel()) {
try (
ByteArrayOutputStream out = new ByteArrayOutputStream();
GZIPOutputStream gzip = new GZIPOutputStream(out)
) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
GZIPOutputStream gzip;
try {
gzip = new GZIPOutputStream(out);
gzip.write(data);
data = out.toByteArray();
gzip.close();
} catch (Exception e) {
e.printStackTrace();
}
data = out.toByteArray();
code = (byte)ErrorCode.ERROR_CODE_SUCCESS_GZIPED.code;
}