Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Reverting revision 1345849 because it is not thread-safe and it doesn…

…'t work.

It appears this was an attempt to create per-tenant FOP factories, but instead each tenant overwrites other tenant's FOP factory instances.

A proper implementation would require a FOP factory cache keyed by delegator name.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1446913 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
commit c304a08a844a205f41a636758bd234a99709a4b0 1 parent 4867b23
Adrian Crum authored
Showing with 7 additions and 19 deletions.
  1. +7 −19 framework/webapp/src/org/ofbiz/webapp/view/ApacheFopWorker.java
26 framework/webapp/src/org/ofbiz/webapp/view/ApacheFopWorker.java
View
@@ -43,10 +43,8 @@
import org.ofbiz.base.location.FlexibleLocation;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.FileUtil;
+import org.ofbiz.base.util.UtilProperties;
import org.ofbiz.base.util.UtilValidate;
-import org.ofbiz.entity.Delegator;
-import org.ofbiz.entity.DelegatorFactory;
-import org.ofbiz.entity.util.EntityUtilProperties;
/**
* Apache FOP worker class.
@@ -67,16 +65,6 @@
* @return FopFactory The FopFactory instance
*/
public static FopFactory getFactoryInstance() {
- Delegator delegator = DelegatorFactory.getDelegator("default");
- return getFactoryInstance(delegator);
- }
-
- /** Returns an instance of the FopFactory class. FOP documentation recommends
- * the reuse of the factory instance because of the startup time.
- * @param delegator the delegator
- * @return FopFactory The FopFactory instance
- */
- public static FopFactory getFactoryInstance(Delegator delegator) {
if (fopFactory == null) {
synchronized (ApacheFopWorker.class) {
if (fopFactory != null) {
@@ -89,15 +77,15 @@ public static FopFactory getFactoryInstance(Delegator delegator) {
fopFactory.setStrictValidation(false);
try {
- String fopPath = EntityUtilProperties.getPropertyValue("url.properties", "fop.path", delegator);
+ String ofbizHome = System.getProperty("ofbiz.home");
+ String fopPath = UtilProperties.getPropertyValue("fop.properties", "fop.path", ofbizHome + "/framework/webapp/config");
File userConfigFile = FileUtil.getFile(fopPath + "/fop.xconf");
fopFactory.setUserConfig(userConfigFile);
- String fopFontBasePath = EntityUtilProperties.getPropertyValue("url.properties", "fop.font.base.path", delegator);
- File fopFontBasePathFile = new File(fopFontBasePath);
- URL fopFontBaseUrl = FlexibleLocation.resolveLocation(fopFontBasePathFile.toString());
- fopFactory.getFontManager().setFontBaseURL(fopFontBaseUrl.toString());
+ String fopFontBaseUrl = UtilProperties.getPropertyValue("fop.properties", "fop.font.base.url", "file:///" + ofbizHome + "/framework/webapp/config/");
+ fopFactory.getFontManager().setFontBaseURL(fopFontBaseUrl);
+ Debug.logInfo("FOP-FontBaseURL: " + fopFontBaseUrl, module);
} catch (Exception e) {
- Debug.logWarning("Error reading FOP configuration", module);
+ Debug.logWarning(e, "Error reading FOP configuration", module);
}
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.