On Tue, Oct 21, 2008 at 11:24 PM,  <[EMAIL PROTECTED]> wrote:
> Author: nextgens
> Date: 2008-10-21 15:24:47 +0000 (Tue, 21 Oct 2008)
> New Revision: 23014
>
> Modified:
>   trunk/freenet/src/freenet/client/ArchiveManager.java
[...]
> Log:
> more work on bug #71: *** IT NEEDS TESTING! ***
> It's still not backward compatible with stable but should be 
> forward-compatible ;)
>
> Modified: trunk/freenet/src/freenet/client/ArchiveManager.java
> ===================================================================
[...]
> -       public void extractToCache(FreenetURI key, short archiveType, Bucket 
> data, ArchiveContext archiveContext, ArchiveStoreContext ctx, String element, 
> ArchiveExtractCallback callback) throws ArchiveFailureException, 
> ArchiveRestartException {
> +       public void extractToCache(FreenetURI key, ARCHIVE_TYPE archiveType, 
> COMPRESSOR_TYPE ctype, Bucket data, ArchiveContext archiveContext, 
> ArchiveStoreContext ctx, String element, ArchiveExtractCallback callback) 
> throws ArchiveFailureException, ArchiveRestartException {
>
>                logMINOR = Logger.shouldLog(Logger.MINOR, this);
>
> @@ -249,21 +258,40 @@
>                }
>                if(data.size() > archiveContext.maxArchiveSize)
>                        throw new ArchiveFailureException("Archive too big 
> ("+data.size()+" > "+archiveContext.maxArchiveSize+")!");
> -               if(ARCHIVE_TYPE.ZIP.metadataID ==  archiveType)
> -                       handleZIPArchive(ctx, key, data, element, callback, 
> gotElement, throwAtExit);
> -               else if(ARCHIVE_TYPE.TAR.metadataID == archiveType)
> -                       handleTARArchive(ctx, key, data, element, callback, 
> gotElement, throwAtExit);
> +
> +
> +               InputStream is = null;
> +               try {
> +                       if(ctype == null) {
> +                               if(logMINOR) Logger.minor(this, "No 
> compression");
> +                               is = data.getInputStream();
> +                       } else if(ctype == COMPRESSOR_TYPE.BZIP2) {
> +                               if(logMINOR) Logger.minor(this, "dealing with 
> BZIP2");
> +                               is = new 
> CBZip2InputStream(data.getInputStream());
> +                       } else if(ctype == COMPRESSOR_TYPE.GZIP) {
> +                               if(logMINOR) Logger.minor(this, "dealing with 
> GZIP");
> +                               is = new 
> GZIPInputStream(data.getInputStream());
> +                       } else
> +                               throw new ArchiveFailureException("Unknown or 
> unsupported compression algorithm "+ctype);

We can't reach the "else" cause here --
 COMPRESSOR_TYPE.getCompressorByMetadataID()
 give "null" when the type is unknown.

[...]
_______________________________________________
Devl mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl

Reply via email to