Skip to content

Commit

Permalink
'#1859 Ignores exception in case input stream for cache entry is not
Browse files Browse the repository at this point in the history
found.
  • Loading branch information
patrickdalla committed Nov 7, 2023
1 parent c242e14 commit 325de73
Showing 1 changed file with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.xml.sax.SAXException;

import iped.data.IItemReader;
import iped.parsers.discord.cache.CacheAddr.InputStreamNotAvailable;
import iped.parsers.discord.cache.CacheEntry;
import iped.parsers.discord.cache.Index;
import iped.parsers.util.MetadataUtil;
Expand Down Expand Up @@ -92,11 +93,17 @@ public void parse(InputStream indexFile, ContentHandler handler, Metadata metada
}

String contentEncoding = httpResponse.get("content-encoding");


InputStream is = ce.getResponseDataSize() > 0
? ce.getResponseDataStream(httpResponse.get("content-encoding"))
: new ByteArrayInputStream(new byte[] {});
InputStream is;
try {
is = ce.getResponseDataSize() > 0
? ce.getResponseDataStream(httpResponse.get("content-encoding"))
: new ByteArrayInputStream(new byte[] {});
} catch (InputStreamNotAvailable e) {
LOGGER.warn("Input Stream for entry not found:" + ce.getRequestURL() + " in item "
+ item.getPath());

is = new ByteArrayInputStream(new byte[] {});
}

Metadata entryMeta = new Metadata();
entryMeta.set("URL", ce.getRequestURL());
Expand Down Expand Up @@ -131,10 +138,8 @@ public void parse(InputStream indexFile, ContentHandler handler, Metadata metada
throw exception;
}
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (ChromeCacheException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Expand Down

0 comments on commit 325de73

Please sign in to comment.