diff --git a/openpdf/src/main/java/com/lowagie/text/pdf/BaseFont.java b/openpdf/src/main/java/com/lowagie/text/pdf/BaseFont.java index de3680f52..a8209dfed 100644 --- a/openpdf/src/main/java/com/lowagie/text/pdf/BaseFont.java +++ b/openpdf/src/main/java/com/lowagie/text/pdf/BaseFont.java @@ -52,6 +52,7 @@ import com.lowagie.text.DocumentException; import com.lowagie.text.error_messages.MessageLocalization; +import java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; import java.security.SecureRandom; @@ -1723,7 +1724,7 @@ public static InputStream getResourceStream(String key, ClassLoader loader) { if (loader != null) { is = loader.getResourceAsStream(key); if (is != null) { - return is; + return new BufferedInputStream(is); } } // Try to use Context Class Loader to load the properties file. @@ -1742,7 +1743,7 @@ public static InputStream getResourceStream(String key, ClassLoader loader) { if (is == null) { is = ClassLoader.getSystemResourceAsStream(key); } - return is; + return is == null ? null : new BufferedInputStream(is); } /**