Permalink
Browse files

NXCM-5188: NPE fix

In the issue attached log, it's clearly visible that validation
did reject the item (policy=Strict but no hashes were present).
Later, an NPE is thrown, as the cleanup method is not protected
from this case.

In all other case it would work as contentValid would be
TRUE for all of those. This is the only branch in logic
where it is FALSE, and the remoteHash is null too.

In other words, cleanup is needed when content is
invalid, but hashes arrived into cache.
  • Loading branch information...
1 parent 03f7bd8 commit 40dc0402f6e2dc7869718df56f29b7f42f530bce @cstamas cstamas committed Apr 8, 2013
@@ -75,7 +75,7 @@
protected void cleanup( ProxyRepository proxy, RemoteHashResponse remoteHash, boolean contentValid )
throws LocalStorageException
{
- if ( !contentValid && remoteHash.getHashItem() != null )
+ if ( !contentValid && remoteHash != null && remoteHash.getHashItem() != null )
{
// TODO should we remove bad checksum if policy==WARN?
try

0 comments on commit 40dc040

Please sign in to comment.