Use try-with-resources without final (redundant SpotBugs)
This commit is contained in:
parent
bb43de8a5e
commit
e7762b2672
|
@ -102,7 +102,7 @@ public class SerializationUtilsTest {
|
||||||
SerializationUtils.serialize(iMap, streamTest);
|
SerializationUtils.serialize(iMap, streamTest);
|
||||||
|
|
||||||
final ByteArrayOutputStream streamReal = new ByteArrayOutputStream();
|
final ByteArrayOutputStream streamReal = new ByteArrayOutputStream();
|
||||||
try (final ObjectOutputStream oos = new ObjectOutputStream(streamReal)) {
|
try (ObjectOutputStream oos = new ObjectOutputStream(streamReal)) {
|
||||||
oos.writeObject(iMap);
|
oos.writeObject(iMap);
|
||||||
oos.flush();
|
oos.flush();
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ public class SerializationUtilsTest {
|
||||||
SerializationUtils.serialize(null, streamTest);
|
SerializationUtils.serialize(null, streamTest);
|
||||||
|
|
||||||
final ByteArrayOutputStream streamReal = new ByteArrayOutputStream();
|
final ByteArrayOutputStream streamReal = new ByteArrayOutputStream();
|
||||||
try (final ObjectOutputStream oos = new ObjectOutputStream(streamReal)) {
|
try (ObjectOutputStream oos = new ObjectOutputStream(streamReal)) {
|
||||||
oos.writeObject(null);
|
oos.writeObject(null);
|
||||||
oos.flush();
|
oos.flush();
|
||||||
}
|
}
|
||||||
|
@ -166,7 +166,7 @@ public class SerializationUtilsTest {
|
||||||
@Test
|
@Test
|
||||||
public void testDeserializeStream() throws Exception {
|
public void testDeserializeStream() throws Exception {
|
||||||
final ByteArrayOutputStream streamReal = new ByteArrayOutputStream();
|
final ByteArrayOutputStream streamReal = new ByteArrayOutputStream();
|
||||||
try (final ObjectOutputStream oos = new ObjectOutputStream(streamReal)) {
|
try (ObjectOutputStream oos = new ObjectOutputStream(streamReal)) {
|
||||||
oos.writeObject(iMap);
|
oos.writeObject(iMap);
|
||||||
oos.flush();
|
oos.flush();
|
||||||
}
|
}
|
||||||
|
@ -199,7 +199,7 @@ public class SerializationUtilsTest {
|
||||||
@Test
|
@Test
|
||||||
public void testDeserializeStreamOfNull() throws Exception {
|
public void testDeserializeStreamOfNull() throws Exception {
|
||||||
final ByteArrayOutputStream streamReal = new ByteArrayOutputStream();
|
final ByteArrayOutputStream streamReal = new ByteArrayOutputStream();
|
||||||
try (final ObjectOutputStream oos = new ObjectOutputStream(streamReal)) {
|
try (ObjectOutputStream oos = new ObjectOutputStream(streamReal)) {
|
||||||
oos.writeObject(null);
|
oos.writeObject(null);
|
||||||
oos.flush();
|
oos.flush();
|
||||||
}
|
}
|
||||||
|
@ -223,7 +223,7 @@ public class SerializationUtilsTest {
|
||||||
@Test
|
@Test
|
||||||
public void testDeserializeStreamClassNotFound() throws Exception {
|
public void testDeserializeStreamClassNotFound() throws Exception {
|
||||||
final ByteArrayOutputStream streamReal = new ByteArrayOutputStream();
|
final ByteArrayOutputStream streamReal = new ByteArrayOutputStream();
|
||||||
try (final ObjectOutputStream oos = new ObjectOutputStream(streamReal)) {
|
try (ObjectOutputStream oos = new ObjectOutputStream(streamReal)) {
|
||||||
oos.writeObject(new ClassNotFoundSerialization());
|
oos.writeObject(new ClassNotFoundSerialization());
|
||||||
oos.flush();
|
oos.flush();
|
||||||
}
|
}
|
||||||
|
@ -245,7 +245,7 @@ public class SerializationUtilsTest {
|
||||||
final byte[] testBytes = SerializationUtils.serialize(iMap);
|
final byte[] testBytes = SerializationUtils.serialize(iMap);
|
||||||
|
|
||||||
final ByteArrayOutputStream streamReal = new ByteArrayOutputStream();
|
final ByteArrayOutputStream streamReal = new ByteArrayOutputStream();
|
||||||
try (final ObjectOutputStream oos = new ObjectOutputStream(streamReal)) {
|
try (ObjectOutputStream oos = new ObjectOutputStream(streamReal)) {
|
||||||
oos.writeObject(iMap);
|
oos.writeObject(iMap);
|
||||||
oos.flush();
|
oos.flush();
|
||||||
}
|
}
|
||||||
|
@ -266,7 +266,7 @@ public class SerializationUtilsTest {
|
||||||
final byte[] testBytes = SerializationUtils.serialize(null);
|
final byte[] testBytes = SerializationUtils.serialize(null);
|
||||||
|
|
||||||
final ByteArrayOutputStream streamReal = new ByteArrayOutputStream();
|
final ByteArrayOutputStream streamReal = new ByteArrayOutputStream();
|
||||||
try (final ObjectOutputStream oos = new ObjectOutputStream(streamReal)) {
|
try (ObjectOutputStream oos = new ObjectOutputStream(streamReal)) {
|
||||||
oos.writeObject(null);
|
oos.writeObject(null);
|
||||||
oos.flush();
|
oos.flush();
|
||||||
}
|
}
|
||||||
|
@ -280,7 +280,7 @@ public class SerializationUtilsTest {
|
||||||
@Test
|
@Test
|
||||||
public void testDeserializeBytes() throws Exception {
|
public void testDeserializeBytes() throws Exception {
|
||||||
final ByteArrayOutputStream streamReal = new ByteArrayOutputStream();
|
final ByteArrayOutputStream streamReal = new ByteArrayOutputStream();
|
||||||
try (final ObjectOutputStream oos = new ObjectOutputStream(streamReal)) {
|
try (ObjectOutputStream oos = new ObjectOutputStream(streamReal)) {
|
||||||
oos.writeObject(iMap);
|
oos.writeObject(iMap);
|
||||||
oos.flush();
|
oos.flush();
|
||||||
}
|
}
|
||||||
|
@ -300,7 +300,7 @@ public class SerializationUtilsTest {
|
||||||
@Test
|
@Test
|
||||||
public void testDeserializeBytesOfNull() throws Exception {
|
public void testDeserializeBytesOfNull() throws Exception {
|
||||||
final ByteArrayOutputStream streamReal = new ByteArrayOutputStream();
|
final ByteArrayOutputStream streamReal = new ByteArrayOutputStream();
|
||||||
try (final ObjectOutputStream oos = new ObjectOutputStream(streamReal)) {
|
try (ObjectOutputStream oos = new ObjectOutputStream(streamReal)) {
|
||||||
oos.writeObject(null);
|
oos.writeObject(null);
|
||||||
oos.flush();
|
oos.flush();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue