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);
|
MemorySessionStore.Session session = m_sessionStore.getSession(clientID);
|
||||||
if (session != null && session.getUsername().equals(fromUser)) {
|
if (session != null && session.getUsername().equals(fromUser)) {
|
||||||
if (data.length > 7*1024 && session.getMqttVersion().protocolLevel() >= MqttVersion.Wildfire_1.protocolLevel()) {
|
if (data.length > 7*1024 && session.getMqttVersion().protocolLevel() >= MqttVersion.Wildfire_1.protocolLevel()) {
|
||||||
try (
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
GZIPOutputStream gzip;
|
||||||
GZIPOutputStream gzip = new GZIPOutputStream(out)
|
try {
|
||||||
) {
|
gzip = new GZIPOutputStream(out);
|
||||||
gzip.write(data);
|
gzip.write(data);
|
||||||
data = out.toByteArray();
|
gzip.close();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
data = out.toByteArray();
|
||||||
code = (byte)ErrorCode.ERROR_CODE_SUCCESS_GZIPED.code;
|
code = (byte)ErrorCode.ERROR_CODE_SUCCESS_GZIPED.code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user