svn commit: r1446940 - /ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/ApacheFopWorker.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1446940 - /ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/ApacheFopWorker.java

adrianc
Author: adrianc
Date: Sat Feb 16 20:43:38 2013
New Revision: 1446940

URL: http://svn.apache.org/r1446940
Log:
Small improvements to ApacheFopWorker: check for file/folder existence before applying settings.

Modified:
    ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/ApacheFopWorker.java

Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/ApacheFopWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/ApacheFopWorker.java?rev=1446940&r1=1446939&r2=1446940&view=diff
==============================================================================
--- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/ApacheFopWorker.java (original)
+++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/view/ApacheFopWorker.java Sat Feb 16 20:43:38 2013
@@ -80,10 +80,19 @@ public class ApacheFopWorker {
                     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 fopFontBaseUrl = UtilProperties.getPropertyValue("fop.properties", "fop.font.base.url", "file:///" + ofbizHome + "/framework/webapp/config/");
-                    fopFactory.getFontManager().setFontBaseURL(fopFontBaseUrl);
-                    Debug.logInfo("FOP-FontBaseURL: " + fopFontBaseUrl, module);
+                    if (userConfigFile.exists()) {
+                        fopFactory.setUserConfig(userConfigFile);
+                    } else {
+                        Debug.logWarning("FOP configuration file not found: " + userConfigFile, module);
+                    }
+                    String fopFontBaseProperty = UtilProperties.getPropertyValue("fop.properties", "fop.font.base.url", "file:///" + ofbizHome + "/framework/webapp/config/");
+                    File fontBaseFile = FileUtil.getFile(fopFontBaseProperty);
+                    if (fontBaseFile.isDirectory()) {
+                        fopFactory.getFontManager().setFontBaseURL(fontBaseFile.toURI().toURL().toString());
+                    } else {
+                        Debug.logWarning("FOP font base URL not found: " + fontBaseFile, module);
+                    }
+                    Debug.logInfo("FOP FontBaseURL: " + fopFactory.getFontManager().getFontBaseURL(), module);
                 } catch (Exception e) {
                     Debug.logWarning(e, "Error reading FOP configuration", module);
                 }