xmlgraphics-fop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sstei...@apache.org
Subject svn commit: r1740529 - in /xmlgraphics/fop/trunk/fop-core/src: main/java/org/apache/fop/fonts/FontCache.java test/java/org/apache/fop/fonts/FontManagerTestCase.java
Date Fri, 22 Apr 2016 14:22:00 GMT
Author: ssteiner
Date: Fri Apr 22 14:21:59 2016
New Revision: 1740529

URL: http://svn.apache.org/viewvc?rev=1740529&view=rev
Log:
FOP-2532: FontCache throws IllegalArgumentException with non file

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

Modified: xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/fonts/FontCache.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/fonts/FontCache.java?rev=1740529&r1=1740528&r2=1740529&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/fonts/FontCache.java (original)
+++ xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/fonts/FontCache.java Fri Apr
22 14:21:59 2016
@@ -332,8 +332,7 @@ public final class FontCache implements
             } else {
                 // try and determine modified date
                 URI fontUri = resourceResolver.resolveFromBase(fontInfo.getEmbedURI());
-                File fontFile = new File(fontUri);
-                long lastModified = fontFile.lastModified();
+                long lastModified = getLastModified(fontUri);
                 cachedFontFile = new CachedFontFile(lastModified);
                 if (log.isTraceEnabled()) {
                     log.trace("Font added to cache: " + cacheKey);

Modified: xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/fonts/FontManagerTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/fonts/FontManagerTestCase.java?rev=1740529&r1=1740528&r2=1740529&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/fonts/FontManagerTestCase.java
(original)
+++ xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/fonts/FontManagerTestCase.java
Fri Apr 22 14:21:59 2016
@@ -17,8 +17,11 @@
 
 package org.apache.fop.fonts;
 
+import java.io.File;
 import java.net.URI;
+import java.net.URISyntaxException;
 
+import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.InOrder;
@@ -30,6 +33,7 @@ import static org.mockito.Mockito.verify
 
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.apps.io.InternalResourceResolver;
+import org.apache.fop.apps.io.ResourceResolverFactory;
 
 public class FontManagerTestCase {
 
@@ -58,6 +62,17 @@ public class FontManagerTestCase {
     }
 
     @Test
+    public void testSetCacheURL() throws URISyntaxException {
+        InternalResourceResolver rr = ResourceResolverFactory.createDefaultInternalResourceResolver(
+                new File(".").toURI());
+        String uri = "abc://localhost/f";
+        EmbedFontInfo efi = new EmbedFontInfo(new FontUris(new URI(uri), null), false, false,
null, null);
+        FontCache fc = new FontCache();
+        fc.addFont(efi, rr);
+        Assert.assertTrue(fc.containsFont(uri));
+    }
+
+    @Test
     public void testGetFontCache() {
         sut.getFontCache();
         verify(fontCacheManager).load();



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


Mime
View raw message