From: Jason Height Date: Tue, 25 Jul 2006 12:19:31 +0000 (+0000) Subject: Bug 17890: Corrected exception text for zero byte file. X-Git-Tag: REL_3_0_ALPHA3~63 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=53b06e968b6f4c6f345974148e1689aac25ce7f5;p=poi.git Bug 17890: Corrected exception text for zero byte file. git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@425384 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/poi/poifs/storage/HeaderBlockReader.java b/src/java/org/apache/poi/poifs/storage/HeaderBlockReader.java index 6a600a91fc..0dcc768ab4 100644 --- a/src/java/org/apache/poi/poifs/storage/HeaderBlockReader.java +++ b/src/java/org/apache/poi/poifs/storage/HeaderBlockReader.java @@ -72,6 +72,9 @@ public class HeaderBlockReader if (byte_count != POIFSConstants.BIG_BLOCK_SIZE) { + if (byte_count == -1) + //Cant have -1 bytes read in the error message! + byte_count = 0; String type = " byte" + ((byte_count == 1) ? ("") : ("s")); diff --git a/src/java/org/apache/poi/poifs/storage/RawDataBlock.java b/src/java/org/apache/poi/poifs/storage/RawDataBlock.java index 29770c8b65..3a80e51e28 100644 --- a/src/java/org/apache/poi/poifs/storage/RawDataBlock.java +++ b/src/java/org/apache/poi/poifs/storage/RawDataBlock.java @@ -56,6 +56,10 @@ public class RawDataBlock } else if (count != POIFSConstants.BIG_BLOCK_SIZE) { + if (count == -1) + //Cant have -1 bytes read in the error message! + count = 0; + String type = " byte" + ((count == 1) ? ("") : ("s"));