commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject [1/7] commons-compress git commit: pacify findbugs
Date Sat, 04 Feb 2017 16:14:28 GMT
Repository: commons-compress
Updated Branches:
  refs/heads/master 4d490c8db -> 3af95ce3a


pacify findbugs


Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/cc0039d2
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/cc0039d2
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/cc0039d2

Branch: refs/heads/master
Commit: cc0039d23ae4ac1124fc64637872a14d5109bedf
Parents: 4d490c8
Author: Stefan Bodewig <bodewig@apache.org>
Authored: Sat Feb 4 16:54:01 2017 +0100
Committer: Stefan Bodewig <bodewig@apache.org>
Committed: Sat Feb 4 16:54:01 2017 +0100

----------------------------------------------------------------------
 findbugs-exclude-filter.xml                               | 10 ++++++++++
 .../compressors/lz4/BlockLZ4CompressorOutputStream.java   |  4 ++++
 .../compressors/lz4/FramedLZ4CompressorOutputStream.java  |  2 +-
 .../compressors/snappy/SnappyCompressorInputStream.java   |  3 +++
 4 files changed, 18 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-compress/blob/cc0039d2/findbugs-exclude-filter.xml
----------------------------------------------------------------------
diff --git a/findbugs-exclude-filter.xml b/findbugs-exclude-filter.xml
index 201dc00..d63fe15 100644
--- a/findbugs-exclude-filter.xml
+++ b/findbugs-exclude-filter.xml
@@ -49,6 +49,11 @@
     <Method name="parse" />
     <Bug pattern="SF_SWITCH_FALLTHROUGH" />
   </Match>
+  <Match>
+    <Class name="org.apache.commons.compress.compressors.lz4.BlockLZ4CompressorInputStream"
/>
+    <Method name="read" />
+    <Bug pattern="SF_SWITCH_FALLTHROUGH" />
+  </Match>
 
   <!-- Reason: fields unused as documented -->
   <Match>
@@ -193,5 +198,10 @@
     <Method name="getData" />
     <Bug pattern="EI_EXPOSE_REP" />
   </Match>
+  <Match>
+    <Class name="org.apache.commons.compress.compressors.lz77support.LZ77Compressor$LiteralBlock"
/>
+    <Method name="&lt;init&gt;" />
+    <Bug pattern="EI_EXPOSE_REP2" />
+  </Match>
 
 </FindBugsFilter>

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/cc0039d2/src/main/java/org/apache/commons/compress/compressors/lz4/BlockLZ4CompressorOutputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/lz4/BlockLZ4CompressorOutputStream.java
b/src/main/java/org/apache/commons/compress/compressors/lz4/BlockLZ4CompressorOutputStream.java
index f3338fb..5c01f83 100644
--- a/src/main/java/org/apache/commons/compress/compressors/lz4/BlockLZ4CompressorOutputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/lz4/BlockLZ4CompressorOutputStream.java
@@ -228,6 +228,10 @@ public class BlockLZ4CompressorOutputStream extends CompressorOutputStream
{
                     }
                     blockOffset += b.length;
                 }
+                if (block == null) {
+                    // should not be possible
+                    throw new IllegalStateException("failed to find a block containing offset
" + offset);
+                }
                 copyOffset = blockOffset + block.length - offsetRemaining;
                 copyLen = Math.min(lengthRemaining, block.length - copyOffset);
             } else {

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/cc0039d2/src/main/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorOutputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorOutputStream.java
b/src/main/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorOutputStream.java
index 4e2c607..f80724f 100644
--- a/src/main/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorOutputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorOutputStream.java
@@ -96,7 +96,7 @@ public class FramedLZ4CompressorOutputStream extends CompressorOutputStream
{
          *
          * <p>This matches the defaults of the lz4 command line utility.</p>
          */
-        public static Parameters DEFAULT = new Parameters(BlockSize.M4, true, false);
+        public static final Parameters DEFAULT = new Parameters(BlockSize.M4, true, false);
 
         /**
          * Sets up custom a custom block size for the LZ4 stream but

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/cc0039d2/src/main/java/org/apache/commons/compress/compressors/snappy/SnappyCompressorInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/snappy/SnappyCompressorInputStream.java
b/src/main/java/org/apache/commons/compress/compressors/snappy/SnappyCompressorInputStream.java
index 21a6e53..15175b0 100644
--- a/src/main/java/org/apache/commons/compress/compressors/snappy/SnappyCompressorInputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/snappy/SnappyCompressorInputStream.java
@@ -203,6 +203,9 @@ public class SnappyCompressorInputStream extends AbstractLZ77CompressorInputStre
             startBackReference(offset, length);
             state = State.IN_BACK_REFERENCE;
             break;
+        default:
+            // impossible as TAG_MASK is two bits and all four possible cases have been covered
+            break;
         }
     }
 


Mime
View raw message