r26952 - trunk/freenet/src/freenet/keys

[email protected] Fri, 17 Apr 2009 19:03:04 +0000
Newsgroups gmane.network.freenet.cvs
Message-ID <[email protected]>
Author: saces
Date: 2009-04-17 19:03:04 +0000 (Fri, 17 Apr 2009)
New Revision: 26952

Modified:
   trunk/freenet/src/freenet/keys/Key.java
Log:
fix a npe on unknown compression algo

Modified: trunk/freenet/src/freenet/keys/Key.java
===================================================================
--- trunk/freenet/src/freenet/keys/Key.java	2009-04-17 18:26:10 UTC (rev 26951)
+++ trunk/freenet/src/freenet/keys/Key.java	2009-04-17 19:03:04 UTC (rev 26952)
@@ -154,6 +154,8 @@
             if(len > maxLength)
                 throw new TooBigException("Invalid precompressed size: "+len + " maxlength="+maxLength);
             COMPRESSOR_TYPE decompressor = COMPRESSOR_TYPE.getCompressorByMetadataID(compressionAlgorithm);
+            if (decompressor==null)
+            	throw new CHKDecodeException("Unknown compression algorithm: "+compressionAlgorithm);
             Bucket inputBucket = new SimpleReadOnlyArrayBucket(output, shortLength?2:4, outputLength-(shortLength?2:4));
             try {
 				return decompressor.decompress(inputBucket, bf, maxLength, -1, null);