diff --git a/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/DefaultCacheEntrySerializer.java b/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/DefaultCacheEntrySerializer.java index 600af5fb9..cb7f3d455 100644 --- a/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/DefaultCacheEntrySerializer.java +++ b/httpclient-cache/src/main/java/org/apache/http/client/cache/impl/DefaultCacheEntrySerializer.java @@ -62,7 +62,9 @@ public void writeTo(CacheEntry cacheEntry, OutputStream os) throws IOException { // oos.writeObject(sheaders); } finally { try { - oos.close(); + if (oos != null) { + oos.close(); + } } catch (Exception ignore) { } try { @@ -95,7 +97,9 @@ public CacheEntry readFrom(InputStream is) throws IOException { throw new RuntimeException(cnfe); } finally { try { - ois.close(); + if (ois != null) { + ois.close(); + } } catch (Exception ignore) { } try {