abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r1238732 - in /abdera/abdera2: common/src/main/java/org/apache/abdera2/common/io/Compression.java core/src/main/java/org/apache/abdera2/writer/AbstractWriter.java core/src/main/java/org/apache/abdera2/writer/WriterOptions.java
Date Tue, 31 Jan 2012 18:29:13 GMT
Author: jmsnell
Date: Tue Jan 31 18:29:13 2012
New Revision: 1238732

URL: http://svn.apache.org/viewvc?rev=1238732&view=rev
Log:
Bug in the handling of the compression handling...

Modified:
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/io/Compression.java
    abdera/abdera2/core/src/main/java/org/apache/abdera2/writer/AbstractWriter.java
    abdera/abdera2/core/src/main/java/org/apache/abdera2/writer/WriterOptions.java

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/io/Compression.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/io/Compression.java?rev=1238732&r1=1238731&r2=1238732&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/io/Compression.java (original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/io/Compression.java Tue
Jan 31 18:29:13 2012
@@ -88,7 +88,6 @@ public class Compression {
         CompressionCodec... codecs)
         throws IOException {
       checkNotNull(out);
-      checkCodecs(codecs.length > 0);
       for (int n = codecs.length - 1; n >= 0; n--)
         out = codecs[n].wrap(out);
       return out;      

Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/writer/AbstractWriter.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/writer/AbstractWriter.java?rev=1238732&r1=1238731&r2=1238732&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/writer/AbstractWriter.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/writer/AbstractWriter.java Tue Jan
31 18:29:13 2012
@@ -31,6 +31,8 @@ import org.apache.abdera2.model.Base;
 import org.apache.abdera2.model.Document;
 import org.apache.abdera2.model.Element;
 
+import com.google.common.collect.Iterables;
+
 public abstract class AbstractWriter implements Writer {
 
     protected WriterOptions options;
@@ -75,16 +77,14 @@ public abstract class AbstractWriter imp
     }
 
     protected OutputStream getCompressedOutputStream(OutputStream out, WriterOptions options)
throws IOException {
-        if (options.getCompressionCodecs() != null) {
-            out = Compression.wrap(out, options.getCompressionCodecs());
-        }
-        return out;
+      if (options.getCompressionCodecs() != null)
+        out = Compression.wrap(out, options.getCompressionCodecs());
+      return out;
     }
 
     protected void finishCompressedOutputStream(OutputStream out, WriterOptions options)
throws IOException {
-        if (options.getCompressionCodecs() != null) {
-            ((DeflaterOutputStream)out).finish();
-        }
+      if (!Iterables.isEmpty(options.getCompressionCodecs()))
+        ((DeflaterOutputStream)out).finish();
     }
 
     public void writeTo(Base base, WritableByteChannel out, WriterOptions options) throws
IOException {

Modified: abdera/abdera2/core/src/main/java/org/apache/abdera2/writer/WriterOptions.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/writer/WriterOptions.java?rev=1238732&r1=1238731&r2=1238732&view=diff
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/writer/WriterOptions.java (original)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/writer/WriterOptions.java Tue Jan
31 18:29:13 2012
@@ -64,8 +64,7 @@ public class WriterOptions {
     }
     
     public WriterOptions get() {
-      // TODO Auto-generated method stub
-      return null;
+      return new WriterOptions(this);
     }
     
     



Mime
View raw message