diff options
author | Simon Steiner <ssteiner@apache.org> | 2020-06-29 14:05:03 +0000 |
---|---|---|
committer | Simon Steiner <ssteiner@apache.org> | 2020-06-29 14:05:03 +0000 |
commit | 83f9092f85199c3d138914088916a1e4ae5a6d2c (patch) | |
tree | f8346359189bde26f246e4967887e29bb91c6367 | |
parent | 3a4d13b5bbe0439b5977cd42714cd19a884a7764 (diff) | |
download | xmlgraphics-fop-83f9092f85199c3d138914088916a1e4ae5a6d2c.tar.gz xmlgraphics-fop-83f9092f85199c3d138914088916a1e4ae5a6d2c.zip |
FOP-2950: Display font error at top level exception
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1879330 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | fop-core/src/main/java/org/apache/fop/fonts/LazyFont.java | 4 | ||||
-rw-r--r-- | fop-core/src/test/java/org/apache/fop/fonts/LazyFontTestCase.java | 8 |
2 files changed, 8 insertions, 4 deletions
diff --git a/fop-core/src/main/java/org/apache/fop/fonts/LazyFont.java b/fop-core/src/main/java/org/apache/fop/fonts/LazyFont.java index 8963d2102..7b2d46584 100644 --- a/fop-core/src/main/java/org/apache/fop/fonts/LazyFont.java +++ b/fop-core/src/main/java/org/apache/fop/fonts/LazyFont.java @@ -123,10 +123,10 @@ public class LazyFont extends Typeface implements FontDescriptor, Substitutable, realFontDescriptor = (FontDescriptor) realFont; } } catch (RuntimeException e) { - String error = "Failed to read font file " + fontUris.getEmbed(); + String error = "Failed to read font file " + fontUris.getEmbed() + " " + e.getMessage(); throw new RuntimeException(error, e); } catch (Exception e) { - String error = "Failed to read font file " + fontUris.getEmbed(); + String error = "Failed to read font file " + fontUris.getEmbed() + " " + e.getMessage(); log.error(error, e); if (fail) { throw new RuntimeException(error, e); diff --git a/fop-core/src/test/java/org/apache/fop/fonts/LazyFontTestCase.java b/fop-core/src/test/java/org/apache/fop/fonts/LazyFontTestCase.java index afea3ce9d..9e0d08ffa 100644 --- a/fop-core/src/test/java/org/apache/fop/fonts/LazyFontTestCase.java +++ b/fop-core/src/test/java/org/apache/fop/fonts/LazyFontTestCase.java @@ -24,17 +24,21 @@ import java.net.URISyntaxException; import org.junit.Assert; import org.junit.Test; +import org.apache.fop.apps.io.InternalResourceResolver; +import org.apache.fop.apps.io.ResourceResolverFactory; + public class LazyFontTestCase { @Test public void testFontError() throws URISyntaxException { FontUris fontUris = new FontUris(new URI("test"), null); - LazyFont lazyFont = new LazyFont(new EmbedFontInfo(fontUris, true, true, null, null), null, true); + InternalResourceResolver rr = ResourceResolverFactory.createDefaultInternalResourceResolver(new URI(".")); + LazyFont lazyFont = new LazyFont(new EmbedFontInfo(fontUris, true, true, null, null), rr, true); String ex = null; try { lazyFont.getAscender(); } catch (RuntimeException e) { ex = e.getMessage(); } - Assert.assertEquals(ex, "Failed to read font file test"); + Assert.assertEquals(ex, "Failed to read font file test URI is not absolute"); } } |