commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From grobme...@apache.org
Subject svn commit: r764670 - /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java
Date Tue, 14 Apr 2009 04:46:50 GMT
Author: grobmeier
Date: Tue Apr 14 04:46:49 2009
New Revision: 764670

URL: http://svn.apache.org/viewvc?rev=764670&view=rev
Log:
added javadocs. Moved CompressorException out of try/catch to avoid catching the newly thrown
exception

Modified:
    commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java

Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java?rev=764670&r1=764669&r2=764670&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java
(original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java
Tue Apr 14 04:46:49 2009
@@ -59,13 +59,22 @@
             } else if ("bzip2".equalsIgnoreCase(name)) {
                 return new BZip2CompressorInputStream(in);
             }
-            throw new CompressorException("Compressor: " + name + " not found.");
         } catch (IOException e) {
             throw new CompressorException(
                     "Could not create CompressorInputStream", e);
         }
+        throw new CompressorException("Compressor: " + name + " not found.");
     }
 
+    /**
+     * Create an compressor output stream from an compressor name and an input stream.
+     * 
+     * @param name the compressor name, i.e. "gz" or "bzip2"
+     * @param out the output stream
+     * @return the compressor output stream
+     * @throws CompressorException if the archiver name is not known
+     * @throws IllegalArgumentException if the archiver name or stream is null
+     */
     public CompressorOutputStream createCompressorOutputStream(
             final String name, final OutputStream out)
             throws CompressorException {
@@ -80,10 +89,10 @@
             } else if ("bzip2".equalsIgnoreCase(name)) {
                 return new BZip2CompressorOutputStream(out);
             }
-            throw new CompressorException("Compressor: " + name + " not found.");
         } catch (IOException e) {
             throw new CompressorException(
                     "Could not create CompressorOutputStream", e);
         }
+        throw new CompressorException("Compressor: " + name + " not found.");
     }
 }



Mime
View raw message