Author: ssteiner
Date: Mon Jun 29 14:05:03 2020
New Revision: 1879330

URL: http://svn.apache.org/viewvc?rev=1879330&view=rev
Log:
FOP-2950: Display font error at top level exception

Modified:
    
xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/fonts/LazyFont.java
    
xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/fonts/LazyFontTestCase.java

Modified: 
xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/fonts/LazyFont.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/fonts/LazyFont.java?rev=1879330&r1=1879329&r2=1879330&view=diff
==============================================================================
--- 
xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/fonts/LazyFont.java 
(original)
+++ 
xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/fonts/LazyFont.java 
Mon Jun 29 14:05:03 2020
@@ -123,10 +123,10 @@ public class LazyFont extends Typeface i
                     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);

Modified: 
xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/fonts/LazyFontTestCase.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/fonts/LazyFontTestCase.java?rev=1879330&r1=1879329&r2=1879330&view=diff
==============================================================================
--- 
xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/fonts/LazyFontTestCase.java
 (original)
+++ 
xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/fonts/LazyFontTestCase.java
 Mon Jun 29 14:05:03 2020
@@ -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");
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-h...@xmlgraphics.apache.org

Reply via email to