]> source.dussan.org Git - poi.git/commitdiff
Patch from bug #43108 - when fetching system properties, use sensible defaults if...
authorNick Burch <nick@apache.org>
Wed, 15 Aug 2007 14:19:08 +0000 (14:19 +0000)
committerNick Burch <nick@apache.org>
Wed, 15 Aug 2007 14:19:08 +0000 (14:19 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@566183 13f79535-47bb-0310-9956-ffa450edef68

src/documentation/content/xdocs/changes.xml
src/documentation/content/xdocs/status.xml
src/java/org/apache/poi/hssf/record/AbstractEscherHolderRecord.java
src/java/org/apache/poi/hssf/usermodel/StaticFontMetrics.java
src/java/org/apache/poi/util/SystemOutLogger.java

index 3e41f0824f53975160a65824cab657148cbd478f..58af02a0c4f2666244571402c100167ceacbf895 100644 (file)
@@ -36,6 +36,7 @@
     </devs>
 
         <release version="3.0.2-FINAL" date="2007-??-??">
+            <action dev="POI-DEVELOPERS" type="fix">43108 - [PATCH] - Where permissions deny fetching System Properties, use sensible defaults</action>
             <action dev="POI-DEVELOPERS" type="fix">43093 - [PATCH] - Fix formula evaluator support for Area3D references to other sheets</action>
             <action dev="POI-DEVELOPERS" type="fix">Improvements to HSSFDateUtils.isADateFormat, and have HSSFDateUtil.isCellDateFormatted use this</action>
             <action dev="POI-DEVELOPERS" type="fix">42999 - [PATCH] - Fix for HSSFPatriarch positioning problems</action>
index 2e07005efc8a128446572bbeda490f3b035df6e4..04ee8163956b4544a8d93a396bc7b5448fd7230f 100644 (file)
@@ -33,6 +33,7 @@
 
     <changes>
         <release version="3.0.2-FINAL" date="2007-??-??">
+            <action dev="POI-DEVELOPERS" type="fix">43108 - [PATCH] - Where permissions deny fetching System Properties, use sensible defaults</action>
             <action dev="POI-DEVELOPERS" type="fix">43093 - [PATCH] - Fix formula evaluator support for Area3D references to other sheets</action>
             <action dev="POI-DEVELOPERS" type="fix">Improvements to HSSFDateUtils.isADateFormat, and have HSSFDateUtil.isCellDateFormatted use this</action>
             <action dev="POI-DEVELOPERS" type="fix">42999 - [PATCH] - Fix for HSSFPatriarch positioning problems</action>
index 42c8ea790d8128a15691da877bf6bd955fe1062c..efa83ca3301b3228f24f8495d53dccb09f3eae64 100644 (file)
@@ -38,7 +38,14 @@ import java.util.List;
 public abstract class AbstractEscherHolderRecord
     extends Record
 {
-    private static final boolean DESERIALISE = System.getProperty("poi.deserialize.escher") != null;
+    private static boolean DESERIALISE;
+    static {
+    try {
+            DESERIALISE = (System.getProperty("poi.deserialize.escher") != null);
+        } catch (SecurityException e) {
+            DESERIALISE = false;
+        }
+    }
 
     private List escherRecords;
     private byte[] rawData;
index a370968b083960a583368ea5455c5d67e5b75870..41efa6d0797cd5ec7fd27f0651cedeb92a44eaf9 100644 (file)
@@ -52,16 +52,22 @@ class StaticFontMetrics
             try
             {
                 fontMetricsProps = new Properties();
-                if (System.getProperty("font.metrics.filename") != null)
-                {
-                    String filename = System.getProperty("font.metrics.filename");
-                    File file = new File(filename);
+
+                // Check to see if the font metric file was specified
+                //  as a system property
+                String propFileName = null;
+                try {
+                    propFileName = System.getProperty("font.metrics.filename");
+                } catch(SecurityException e) {}
+
+                if (propFileName != null) {
+                    File file = new File(propFileName);
                     if (!file.exists())
                         throw new FileNotFoundException("font_metrics.properties not found at path " + file.getAbsolutePath());
                     metricsIn = new FileInputStream(file);
                 }
-                else
-                {
+                else {
+                    // Use the built-in font metrics file off the classpath
                     metricsIn = FontDetails.class.getResourceAsStream("/font_metrics.properties");
                     if (metricsIn == null)
                         throw new FileNotFoundException("font_metrics.properties not found in classpath");
index c81557714985a8c7a2bb29d8e58da0a7b55cfd11..8b3dc50d9a715d612162e7615f98f18c79fdafbc 100644 (file)
@@ -65,7 +65,13 @@ public class SystemOutLogger extends POILogger
      */
     public boolean check(final int level)
     {
-        int currentLevel = Integer.parseInt(System.getProperty("poi.log.level", WARN + ""));
+        int currentLevel;
+        try {
+            currentLevel = Integer.parseInt(System.getProperty("poi.log.level", WARN + ""));
+        } catch (SecurityException e) {
+            currentLevel = POILogger.DEBUG;
+        }
+
         if (level >= currentLevel)
             return true;
         else