commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <garydgreg...@gmail.com>
Subject Re: [commons-compress] branch master updated: Gary says exception messages should start with a capitalized word
Date Thu, 08 Aug 2019 18:37:49 GMT
Thanks Stefan!

Gary

On Thu, Aug 8, 2019, 13:12 <bodewig@apache.org> wrote:

> This is an automated email from the ASF dual-hosted git repository.
>
> bodewig pushed a commit to branch master
> in repository https://gitbox.apache.org/repos/asf/commons-compress.git
>
>
> The following commit(s) were added to refs/heads/master by this push:
>      new 317bd05  Gary says exception messages should start with a
> capitalized word
> 317bd05 is described below
>
> commit 317bd054a7a843405b24a90f312cb72251a05919
> Author: Stefan Bodewig <bodewig@apache.org>
> AuthorDate: Thu Aug 8 19:11:22 2019 +0200
>
>     Gary says exception messages should start with a capitalized word
> ---
>  .../compress/archivers/ar/ArArchiveOutputStream.java       | 14
> +++++++-------
>  .../commons/compress/archivers/dump/TapeInputStream.java   |  6 +++---
>  .../compressors/lz4/BlockLZ4CompressorInputStream.java     |  6 +++---
>  .../compressors/lz4/FramedLZ4CompressorInputStream.java    |  4 ++--
>  .../snappy/FramedSnappyCompressorInputStream.java          |  6 +++---
>  .../compressors/snappy/SnappyCompressorInputStream.java    | 14
> +++++++-------
>  .../compress/archivers/ar/ArArchiveOutputStreamTest.java   |  4 ++--
>  7 files changed, 27 insertions(+), 27 deletions(-)
>
> diff --git
> a/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveOutputStream.java
> b/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveOutputStream.java
> index 57acb71..61aaeec 100644
> ---
> a/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveOutputStream.java
> +++
> b/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveOutputStream.java
> @@ -94,7 +94,7 @@ public class ArArchiveOutputStream extends
> ArchiveOutputStream {
>              writeArchiveHeader();
>          } else {
>              if (prevEntry.getLength() != entryOffset) {
> -                throw new IOException("length does not match entry (" +
> prevEntry.getLength() + " != " + entryOffset);
> +                throw new IOException("Length does not match entry (" +
> prevEntry.getLength() + " != " + entryOffset);
>              }
>
>              if (haveUnclosedEntry) {
> @@ -135,7 +135,7 @@ public class ArArchiveOutputStream extends
> ArchiveOutputStream {
>
>          final String n = pEntry.getName();
>          if (LONGFILE_ERROR == longFileMode && n.length() > 16) {
> -            throw new IOException("filename too long, > 16 chars: "+n);
> +            throw new IOException("File name too long, > 16 chars: "+n);
>          }
>          if (LONGFILE_BSD == longFileMode &&
>              (n.length() > 16 || n.contains(" "))) {
> @@ -149,28 +149,28 @@ public class ArArchiveOutputStream extends
> ArchiveOutputStream {
>          offset = fill(offset, 16, ' ');
>          final String m = "" + pEntry.getLastModified();
>          if (m.length() > 12) {
> -            throw new IOException("modified too long");
> +            throw new IOException("Last modified too long");
>          }
>          offset += write(m);
>
>          offset = fill(offset, 28, ' ');
>          final String u = "" + pEntry.getUserId();
>          if (u.length() > 6) {
> -            throw new IOException("userid too long");
> +            throw new IOException("User id too long");
>          }
>          offset += write(u);
>
>          offset = fill(offset, 34, ' ');
>          final String g = "" + pEntry.getGroupId();
>          if (g.length() > 6) {
> -            throw new IOException("groupid too long");
> +            throw new IOException("Group id too long");
>          }
>          offset += write(g);
>
>          offset = fill(offset, 40, ' ');
>          final String fm = "" + Integer.toString(pEntry.getMode(), 8);
>          if (fm.length() > 8) {
> -            throw new IOException("filemode too long");
> +            throw new IOException("Filemode too long");
>          }
>          offset += write(fm);
>
> @@ -179,7 +179,7 @@ public class ArArchiveOutputStream extends
> ArchiveOutputStream {
>              String.valueOf(pEntry.getLength()
>                             + (mustAppendName ? n.length() : 0));
>          if (s.length() > 10) {
> -            throw new IOException("size too long");
> +            throw new IOException("Size too long");
>          }
>          offset += write(s);
>
> diff --git
> a/src/main/java/org/apache/commons/compress/archivers/dump/TapeInputStream.java
> b/src/main/java/org/apache/commons/compress/archivers/dump/TapeInputStream.java
> index 5d88604..3049e26 100644
> ---
> a/src/main/java/org/apache/commons/compress/archivers/dump/TapeInputStream.java
> +++
> b/src/main/java/org/apache/commons/compress/archivers/dump/TapeInputStream.java
> @@ -100,7 +100,7 @@ class TapeInputStream extends FilterInputStream {
>      @Override
>      public int read() throws IOException {
>          throw new IllegalArgumentException(
> -            "all reads must be multiple of record size (" + RECORD_SIZE +
> +            "All reads must be multiple of record size (" + RECORD_SIZE +
>              " bytes.");
>      }
>
> @@ -116,7 +116,7 @@ class TapeInputStream extends FilterInputStream {
>      public int read(final byte[] b, int off, final int len) throws
> IOException {
>          if ((len % RECORD_SIZE) != 0) {
>              throw new IllegalArgumentException(
> -                "all reads must be multiple of record size (" +
> RECORD_SIZE +
> +                "All reads must be multiple of record size (" +
> RECORD_SIZE +
>                  " bytes.");
>          }
>
> @@ -166,7 +166,7 @@ class TapeInputStream extends FilterInputStream {
>      public long skip(final long len) throws IOException {
>          if ((len % RECORD_SIZE) != 0) {
>              throw new IllegalArgumentException(
> -                "all reads must be multiple of record size (" +
> RECORD_SIZE +
> +                "All reads must be multiple of record size (" +
> RECORD_SIZE +
>                  " bytes.");
>          }
>
> diff --git
> a/src/main/java/org/apache/commons/compress/compressors/lz4/BlockLZ4CompressorInputStream.java
> b/src/main/java/org/apache/commons/compress/compressors/lz4/BlockLZ4CompressorInputStream.java
> index 493ec4e..72b0f60 100644
> ---
> a/src/main/java/org/apache/commons/compress/compressors/lz4/BlockLZ4CompressorInputStream.java
> +++
> b/src/main/java/org/apache/commons/compress/compressors/lz4/BlockLZ4CompressorInputStream.java
> @@ -101,7 +101,7 @@ public class BlockLZ4CompressorInputStream extends
> AbstractLZ77CompressorInputSt
>              literalSizePart += readSizeBytes();
>          }
>          if (literalSizePart < 0) {
> -            throw new IOException("illegal block with a negative literal
> size found");
> +            throw new IOException("Illegal block with a negative literal
> size found");
>          }
>          startLiteral(literalSizePart);
>          state = State.IN_LITERAL;
> @@ -140,12 +140,12 @@ public class BlockLZ4CompressorInputStream extends
> AbstractLZ77CompressorInputSt
>          }
>          // minimal match length 4 is encoded as 0
>          if (backReferenceSize < 0) {
> -            throw new IOException("illegal block with a negative match
> length found");
> +            throw new IOException("Illegal block with a negative match
> length found");
>          }
>          try {
>              startBackReference(backReferenceOffset, backReferenceSize +
> 4);
>          } catch (IllegalArgumentException ex) {
> -            throw new IOException("illegal block with bad offset found",
> ex);
> +            throw new IOException("Illegal block with bad offset found",
> ex);
>          }
>          state = State.IN_BACK_REFERENCE;
>          return true;
> diff --git
> a/src/main/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorInputStream.java
> b/src/main/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorInputStream.java
> index f0cf222..9792b7b 100644
> ---
> a/src/main/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorInputStream.java
> +++
> b/src/main/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorInputStream.java
> @@ -252,7 +252,7 @@ public class FramedLZ4CompressorInputStream extends
> CompressorInputStream
>          boolean uncompressed = (len & UNCOMPRESSED_FLAG_MASK) != 0;
>          int realLen = (int) (len & (~UNCOMPRESSED_FLAG_MASK));
>          if (realLen < 0) {
> -            throw new IOException("found illegal block with negative
> size");
> +            throw new IOException("Found illegal block with negative
> size");
>          }
>          if (realLen == 0) {
>              verifyContentChecksum();
> @@ -358,7 +358,7 @@ public class FramedLZ4CompressorInputStream extends
> CompressorInputStream
>          while (read == 4 && isSkippableFrameSignature(b)) {
>              final long len = ByteUtils.fromLittleEndian(supplier, 4);
>              if (len < 0) {
> -                throw new IOException("found illegal skippable frame with
> negative size");
> +                throw new IOException("Found illegal skippable frame with
> negative size");
>              }
>              long skipped = IOUtils.skip(in, len);
>              count(skipped);
> diff --git
> a/src/main/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStream.java
> b/src/main/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStream.java
> index ddc6462..f750c4f 100644
> ---
> a/src/main/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStream.java
> +++
> b/src/main/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStream.java
> @@ -251,14 +251,14 @@ public class FramedSnappyCompressorInputStream
> extends CompressorInputStream
>              inUncompressedChunk = true;
>              uncompressedBytesRemaining = readSize() - 4 /* CRC */;
>              if (uncompressedBytesRemaining < 0) {
> -                throw new IOException("found illegal chunk with negative
> size");
> +                throw new IOException("Found illegal chunk with negative
> size");
>              }
>              expectedChecksum = unmask(readCrc());
>          } else if (type == COMPRESSED_CHUNK_TYPE) {
>              final boolean expectChecksum =
> dialect.usesChecksumWithCompressedChunks();
>              final long size = readSize() - (expectChecksum ? 4L : 0L);
>              if (size < 0) {
> -                throw new IOException("found illegal chunk with negative
> size");
> +                throw new IOException("Found illegal chunk with negative
> size");
>              }
>              if (expectChecksum) {
>                  expectedChecksum = unmask(readCrc());
> @@ -301,7 +301,7 @@ public class FramedSnappyCompressorInputStream extends
> CompressorInputStream
>      private void skipBlock() throws IOException {
>          final int size = readSize();
>          if (size < 0) {
> -            throw new IOException("found illegal chunk with negative
> size");
> +            throw new IOException("Found illegal chunk with negative
> size");
>          }
>          final long read = IOUtils.skip(in, size);
>          count(read);
> 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 4657ac8..d9acedb 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
> @@ -137,7 +137,7 @@ public class SnappyCompressorInputStream extends
> AbstractLZ77CompressorInputStre
>
>              length = readLiteralLength(b);
>              if (length < 0) {
> -                throw new IOException("illegal block with a negative
> literal size found");
> +                throw new IOException("Illegal block with a negative
> literal size found");
>              }
>              uncompressedBytesRemaining -= length;
>              startLiteral(length);
> @@ -157,7 +157,7 @@ public class SnappyCompressorInputStream extends
> AbstractLZ77CompressorInputStre
>
>              length = 4 + ((b >> 2) & 0x07);
>              if (length < 0) {
> -                throw new IOException("illegal block with a negative
> match length found");
> +                throw new IOException("Illegal block with a negative
> match length found");
>              }
>              uncompressedBytesRemaining -= length;
>              offset = (b & 0xE0) << 3;
> @@ -170,7 +170,7 @@ public class SnappyCompressorInputStream extends
> AbstractLZ77CompressorInputStre
>              try {
>                  startBackReference(offset, length);
>              } catch (IllegalArgumentException ex) {
> -                throw new IOException("illegal block with bad offset
> found", ex);
> +                throw new IOException("Illegal block with bad offset
> found", ex);
>              }
>              state = State.IN_BACK_REFERENCE;
>              break;
> @@ -187,7 +187,7 @@ public class SnappyCompressorInputStream extends
> AbstractLZ77CompressorInputStre
>
>              length = (b >> 2) + 1;
>              if (length < 0) {
> -                throw new IOException("illegal block with a negative
> match length found");
> +                throw new IOException("Illegal block with a negative
> match length found");
>              }
>              uncompressedBytesRemaining -= length;
>
> @@ -196,7 +196,7 @@ public class SnappyCompressorInputStream extends
> AbstractLZ77CompressorInputStre
>              try {
>                  startBackReference(offset, length);
>              } catch (IllegalArgumentException ex) {
> -                throw new IOException("illegal block with bad offset
> found", ex);
> +                throw new IOException("Illegal block with bad offset
> found", ex);
>              }
>              state = State.IN_BACK_REFERENCE;
>              break;
> @@ -212,7 +212,7 @@ public class SnappyCompressorInputStream extends
> AbstractLZ77CompressorInputStre
>
>              length = (b >> 2) + 1;
>              if (length < 0) {
> -                throw new IOException("illegal block with a negative
> match length found");
> +                throw new IOException("Illegal block with a negative
> match length found");
>              }
>              uncompressedBytesRemaining -= length;
>
> @@ -221,7 +221,7 @@ public class SnappyCompressorInputStream extends
> AbstractLZ77CompressorInputStre
>              try {
>                  startBackReference(offset, length);
>              } catch (IllegalArgumentException ex) {
> -                throw new IOException("illegal block with bad offset
> found", ex);
> +                throw new IOException("Illegal block with bad offset
> found", ex);
>              }
>              state = State.IN_BACK_REFERENCE;
>              break;
> diff --git
> a/src/test/java/org/apache/commons/compress/archivers/ar/ArArchiveOutputStreamTest.java
> b/src/test/java/org/apache/commons/compress/archivers/ar/ArArchiveOutputStreamTest.java
> index 0c309aa..2274f1c 100644
> ---
> a/src/test/java/org/apache/commons/compress/archivers/ar/ArArchiveOutputStreamTest.java
> +++
> b/src/test/java/org/apache/commons/compress/archivers/ar/ArArchiveOutputStreamTest.java
> @@ -39,7 +39,7 @@ public class ArArchiveOutputStreamTest extends
> AbstractTestCase {
>              os.putArchiveEntry(ae);
>              fail("Expected an exception");
>          } catch (final IOException ex) {
> -            assertTrue(ex.getMessage().startsWith("filename too long"));
> +            assertTrue(ex.getMessage().startsWith("File name too long"));
>          }
>      }
>
> @@ -61,4 +61,4 @@ public class ArArchiveOutputStreamTest extends
> AbstractTestCase {
>              rmdir(df[0]);
>          }
>      }
> -}
> \ No newline at end of file
> +}
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message