Browse Source

Merged revisions 718309,718502 via svnmerge from

https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk

........
  r718309 | adelmelle | 2008-11-17 18:18:20 +0000 (Mon, 17 Nov 2008) | 4 lines
  
  Bugzilla 46211:
  Fixed some multi-threading issues in FontCache.java (+ some minor cleanup: simplification of conditionals)
  Thanks to rogov.AT.devexperts.com for tracing and reporting the problem.
........
  r718502 | adelmelle | 2008-11-18 06:43:08 +0000 (Tue, 18 Nov 2008) | 1 line
  
  Removed erroneous end-element...
........


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@718538 13f79535-47bb-0310-9956-ffa450edef68
tags/fop-1_0
Adrian Cumiskey 15 years ago
parent
commit
67c82c98fb
2 changed files with 25 additions and 32 deletions
  1. 14
    28
      src/java/org/apache/fop/fonts/FontCache.java
  2. 11
    4
      status.xml

+ 14
- 28
src/java/org/apache/fop/fonts/FontCache.java View File

* Serialization Version UID. Change this value if you want to make sure the user's cache * Serialization Version UID. Change this value if you want to make sure the user's cache
* file is purged after an update. * file is purged after an update.
*/ */
private static final long serialVersionUID = 605232520271754718L;
private static final long serialVersionUID = 605232520271754719L;


/** logging instance */ /** logging instance */
private static Log log = LogFactory.getLog(FontCache.class); private static Log log = LogFactory.getLog(FontCache.class);
private transient boolean changed = false; private transient boolean changed = false;


/** change lock */ /** change lock */
private transient Object changeLock = new Object();
private final Object changeLock = new Object();


/** master mapping of font url -> font info. This needs to be /** master mapping of font url -> font info. This needs to be
* a list, since a TTC file may contain more than 1 font. */ * a list, since a TTC file may contain more than 1 font. */
//nop //nop
} }


private void readObject(java.io.ObjectInputStream in)
throws IOException, ClassNotFoundException {
in.defaultReadObject();
this.changeLock = new Object(); //Initialize transient field
}

private static File getUserHome() { private static File getUserHome() {
String s = System.getProperty("user.home"); String s = System.getProperty("user.home");
if (s != null) { if (s != null) {
* @return boolean * @return boolean
*/ */
public boolean containsFont(String embedUrl) { public boolean containsFont(String embedUrl) {
if (embedUrl != null) {
return getFontFileMap().containsKey(embedUrl);
}
return false;
return (embedUrl != null
&& getFontFileMap().containsKey(embedUrl));
} }


/** /**
* @return font * @return font
*/ */
public boolean containsFont(EmbedFontInfo fontInfo) { public boolean containsFont(EmbedFontInfo fontInfo) {
if (fontInfo != null) {
return getFontFileMap().containsKey(getCacheKey(fontInfo));
}
return false;
return (fontInfo != null
&& getFontFileMap().containsKey(getCacheKey(fontInfo)));
} }


/** /**
* @return CachedFontFile object * @return CachedFontFile object
*/ */
public CachedFontFile getFontFile(String embedUrl) { public CachedFontFile getFontFile(String embedUrl) {
if (containsFont(embedUrl)) {
return (CachedFontFile)getFontFileMap().get(embedUrl);
}
return null;
return containsFont(embedUrl) ? (CachedFontFile) getFontFileMap().get(embedUrl) : null;
} }


/** /**
* @return whether this is a failed font * @return whether this is a failed font
*/ */
public boolean isFailedFont(String embedUrl, long lastModified) { public boolean isFailedFont(String embedUrl, long lastModified) {
if (getFailedFontMap().containsKey(embedUrl)) {
synchronized (changeLock) {
synchronized (changeLock) {
if (getFailedFontMap().containsKey(embedUrl)) {
long failedLastModified = ((Long)getFailedFontMap().get(embedUrl)).longValue(); long failedLastModified = ((Long)getFailedFontMap().get(embedUrl)).longValue();
if (lastModified != failedLastModified) { if (lastModified != failedLastModified) {
// this font has been changed so lets remove it // this font has been changed so lets remove it
getFailedFontMap().remove(embedUrl); getFailedFontMap().remove(embedUrl);
changed = true; changed = true;
} }
return true;
} else {
return false;
} }
return true;
} }
return false;
} }


/** /**
} }


public boolean containsFont(EmbedFontInfo efi) { public boolean containsFont(EmbedFontInfo efi) {
if (efi.getPostScriptName() != null) {
return getFileFontsMap().containsKey(efi.getPostScriptName());
}
return false;
return efi.getPostScriptName() != null
&& getFileFontsMap().containsKey(efi.getPostScriptName());
} }


public EmbedFontInfo[] getEmbedFontInfos() { public EmbedFontInfo[] getEmbedFontInfos() {

+ 11
- 4
status.xml View File

<changes> <changes>
<release version="FOP Trunk" date="TBD"> <release version="FOP Trunk" date="TBD">
<action context="Renderers" dev="AC" importance="high" type="add"> <action context="Renderers" dev="AC" importance="high" type="add">
AFP Output: An AFPGraphics2D implementation which provides the ability to use Batik to drive the production of AFP Graphics (GOCA) output from SVG.
Added SVG support for AFP (GOCA).
AFP Output: An AFPGraphics2D implementation which provides the ability to use Batik to drive the production of AFP Graphics (GOCA) output from SVG.
</action> </action>
<action context="Renderers" dev="AC" importance="high" type="add"> <action context="Renderers" dev="AC" importance="high" type="add">
AFP Output: Resource group leveling, external streaming and de-duplication of images and graphics using IncludeObject and ResourceGroup.
AFP Output: Resource group leveling, external streaming, and de-duplication of images and graphics using IncludeObject and ResourceGroup.
</action> </action>
<action context="Renderers" dev="AC" importance="high" type="add"> <action context="Renderers" dev="AC" importance="high" type="add">
AFP Output: Native image embedding support (e.g. JPEG, GIF, TIFF) using ObjectContainer and a MOD:CA Registry implementation. AFP Output: Native image embedding support (e.g. JPEG, GIF, TIFF) using ObjectContainer and a MOD:CA Registry implementation.
</action> </action>
<action context="Fonts" dev="AC" importance="high" type="fix"> <action context="Fonts" dev="AC" importance="high" type="fix">
AFP Output: More robust AFP font parsing, although it is still in need of some rework in the future.
More robust AFP font parsing, although it is still in need of some rework in the future.
</action>
<action context="Code" dev="AD" type="fix" fixes-bug="46211" due-to="rogov.AT.devexperts.com">
Fixed some multi-threading issues in FontCache.java:
<ul>
<li>remove the unused private readObject()</li>
<li>make the changeLock member final (initialization-safety + impossible to reassign)</li>
<li>perform the HashMap check for a failed font inside the synchronized block to avoid a race condition</li>
</ul>
</action> </action>
<action context="Renderers" dev="AD" type="add" fixes-bug="45113" due-to="Alexander Stamenov"> <action context="Renderers" dev="AD" type="add" fixes-bug="45113" due-to="Alexander Stamenov">
Added PDF /Launch action: references to URIs using the file:// protocol will now generate Added PDF /Launch action: references to URIs using the file:// protocol will now generate

Loading…
Cancel
Save