From d3767e1de7134aad5de8a6e207914b0ec7850edc Mon Sep 17 00:00:00 2001 From: Dominik Stadler Date: Thu, 30 Jan 2020 21:09:17 +0000 Subject: Improve some assertions and error messages for exceptions seen in the regression tests git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1873385 13f79535-47bb-0310-9956-ffa450edef68 --- src/scratchpad/src/org/apache/poi/hpbf/model/HPBFPart.java | 4 ++-- src/scratchpad/src/org/apache/poi/hwpf/model/ComplexFileTable.java | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src/scratchpad') diff --git a/src/scratchpad/src/org/apache/poi/hpbf/model/HPBFPart.java b/src/scratchpad/src/org/apache/poi/hpbf/model/HPBFPart.java index 2a19670f1f..ae6e8fdad7 100644 --- a/src/scratchpad/src/org/apache/poi/hpbf/model/HPBFPart.java +++ b/src/scratchpad/src/org/apache/poi/hpbf/model/HPBFPart.java @@ -60,7 +60,7 @@ public abstract class HPBFPart { dir = (DirectoryNode)dir.getEntry(path[i]); } catch (FileNotFoundException e) { throw new IllegalArgumentException("File invalid - failed to find directory entry '" - + path[i] + "'"); + + path[i] + "': " + e); } } return dir; @@ -101,7 +101,7 @@ public abstract class HPBFPart { public final byte[] getData() { return data; } - + protected final void setData(byte[] data) { this.data = data.clone(); } diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/ComplexFileTable.java b/src/scratchpad/src/org/apache/poi/hwpf/model/ComplexFileTable.java index ee6e15051d..adf2c75e5d 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/ComplexFileTable.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/ComplexFileTable.java @@ -64,7 +64,8 @@ public class ComplexFileTable { this._grpprls = sprmBuffers.toArray(new SprmBuffer[0]); if (tableStream[offset] != TEXT_PIECE_TABLE_TYPE) { - throw new IOException("The text piece table is corrupted"); + throw new IOException("The text piece table is corrupted, expected byte value " + TEXT_PIECE_TABLE_TYPE + + " but had " + tableStream[offset]); } int pieceTableSize = LittleEndian.getInt(tableStream, ++offset); offset += LittleEndian.INT_SIZE; -- cgit v1.2.3