Revert "Fix potential GZIPOutputStream resource leak on exception"
This reverts commit 6c7d2ab3ad.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user