From: Adrian Cumiskey Date: Tue, 9 Sep 2008 13:35:13 +0000 (+0000) Subject: This is a better fix which will cater for the case where the first character encounte... X-Git-Tag: fop-1_0~423 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=420d6d01d4ffed634c725935d94f7222e1da9544;p=xmlgraphics-fop.git This is a better fix which will cater for the case where the first character encountered is the EOF (-1) character. EOF test now only occurs when loop is exit so this should execute more efficiently. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@693462 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/fonts/type1/PFMInputStream.java b/src/java/org/apache/fop/fonts/type1/PFMInputStream.java index 85f39b6f3..f563059c3 100644 --- a/src/java/org/apache/fop/fonts/type1/PFMInputStream.java +++ b/src/java/org/apache/fop/fonts/type1/PFMInputStream.java @@ -100,12 +100,12 @@ public class PFMInputStream extends java.io.FilterInputStream { StringBuffer buf = new StringBuffer(); int ch = reader.read(); - while (ch != 0) { + while (ch > 0) { buf.append((char)ch); ch = reader.read(); - if (ch == -1) { - throw new EOFException("Unexpected end of stream reached"); - } + } + if (ch == -1) { + throw new EOFException("Unexpected end of stream reached"); } return buf.toString(); }