From da943ea14a7ff63313a480edc7e21e3324cc1894 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Thu, 22 Dec 2016 06:26:28 +0100 Subject: [PATCH] accept "impossible" exceptions --- src/main/org/apache/tools/tar/TarEntry.java | 7 ++++--- src/main/org/apache/tools/tar/TarUtils.java | 4 ++-- .../org/apache/tools/zip/AbstractUnicodeExtraField.java | 2 +- src/main/org/apache/tools/zip/AsiExtraField.java | 2 +- src/main/org/apache/tools/zip/GeneralPurposeBit.java | 2 +- src/main/org/apache/tools/zip/ZipLong.java | 2 +- src/main/org/apache/tools/zip/ZipShort.java | 2 +- 7 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/main/org/apache/tools/tar/TarEntry.java b/src/main/org/apache/tools/tar/TarEntry.java index 67990797a..86024ea8a 100644 --- a/src/main/org/apache/tools/tar/TarEntry.java +++ b/src/main/org/apache/tools/tar/TarEntry.java @@ -846,7 +846,7 @@ public class TarEntry implements TarConstants { writeEntryHeader(outbuf, TarUtils.FALLBACK_ENCODING, false); } catch (IOException ex2) { // impossible - throw new RuntimeException(ex2); + throw new RuntimeException(ex2); //NOSONAR } } } @@ -932,7 +932,7 @@ public class TarEntry implements TarConstants { parseTarHeader(header, TarUtils.DEFAULT_ENCODING, true); } catch (IOException ex2) { // not really possible - throw new RuntimeException(ex2); + throw new RuntimeException(ex2); //NOSONAR } } } @@ -1095,7 +1095,8 @@ public class TarEntry implements TarConstants { try { buffer1 = expected.getBytes("ASCII"); } catch (UnsupportedEncodingException e) { - throw new RuntimeException(e); // Should not happen + // Should not happen + throw new RuntimeException(e); //NOSONAR } return isEqual(buffer1, 0, buffer1.length, buffer, offset, length, false); diff --git a/src/main/org/apache/tools/tar/TarUtils.java b/src/main/org/apache/tools/tar/TarUtils.java index f86154ea3..5fa2e01f0 100644 --- a/src/main/org/apache/tools/tar/TarUtils.java +++ b/src/main/org/apache/tools/tar/TarUtils.java @@ -265,7 +265,7 @@ public class TarUtils { return parseName(buffer, offset, length, FALLBACK_ENCODING); } catch (final IOException ex2) { // impossible - throw new RuntimeException(ex2); + throw new RuntimeException(ex2); //NOSONAR } } } @@ -324,7 +324,7 @@ public class TarUtils { FALLBACK_ENCODING); } catch (final IOException ex2) { // impossible - throw new RuntimeException(ex2); + throw new RuntimeException(ex2); //NOSONAR } } } diff --git a/src/main/org/apache/tools/zip/AbstractUnicodeExtraField.java b/src/main/org/apache/tools/zip/AbstractUnicodeExtraField.java index 1014787d4..ab56f46e7 100644 --- a/src/main/org/apache/tools/zip/AbstractUnicodeExtraField.java +++ b/src/main/org/apache/tools/zip/AbstractUnicodeExtraField.java @@ -54,7 +54,7 @@ public abstract class AbstractUnicodeExtraField implements ZipExtraField { try { unicodeName = text.getBytes("UTF-8"); } catch (final UnsupportedEncodingException e) { - throw new RuntimeException("FATAL: UTF-8 encoding not supported.", + throw new RuntimeException("FATAL: UTF-8 encoding not supported.", //NOSONAR e); } } diff --git a/src/main/org/apache/tools/zip/AsiExtraField.java b/src/main/org/apache/tools/zip/AsiExtraField.java index d2ca6910d..fb8227d84 100644 --- a/src/main/org/apache/tools/zip/AsiExtraField.java +++ b/src/main/org/apache/tools/zip/AsiExtraField.java @@ -346,7 +346,7 @@ public class AsiExtraField implements ZipExtraField, UnixStat, Cloneable { return cloned; } catch (CloneNotSupportedException cnfe) { // impossible - throw new RuntimeException(cnfe); + throw new RuntimeException(cnfe); //NOSONAR } } } diff --git a/src/main/org/apache/tools/zip/GeneralPurposeBit.java b/src/main/org/apache/tools/zip/GeneralPurposeBit.java index 1d2255faa..a1af211bd 100644 --- a/src/main/org/apache/tools/zip/GeneralPurposeBit.java +++ b/src/main/org/apache/tools/zip/GeneralPurposeBit.java @@ -188,7 +188,7 @@ public final class GeneralPurposeBit implements Cloneable { return super.clone(); } catch (CloneNotSupportedException ex) { // impossible - throw new RuntimeException("GeneralPurposeBit is not Cloneable?", ex); + throw new RuntimeException("GeneralPurposeBit is not Cloneable?", ex); //NOSONAR } } } diff --git a/src/main/org/apache/tools/zip/ZipLong.java b/src/main/org/apache/tools/zip/ZipLong.java index 72af84db8..618082359 100644 --- a/src/main/org/apache/tools/zip/ZipLong.java +++ b/src/main/org/apache/tools/zip/ZipLong.java @@ -190,7 +190,7 @@ public final class ZipLong implements Cloneable { return super.clone(); } catch (CloneNotSupportedException cnfe) { // impossible - throw new RuntimeException(cnfe); + throw new RuntimeException(cnfe); //NOSONAR } } diff --git a/src/main/org/apache/tools/zip/ZipShort.java b/src/main/org/apache/tools/zip/ZipShort.java index e52c570d5..2f5482ff0 100644 --- a/src/main/org/apache/tools/zip/ZipShort.java +++ b/src/main/org/apache/tools/zip/ZipShort.java @@ -155,7 +155,7 @@ public final class ZipShort implements Cloneable { return super.clone(); } catch (CloneNotSupportedException cnfe) { // impossible - throw new RuntimeException(cnfe); + throw new RuntimeException(cnfe); //NOSONAR } }