xmlgraphics-fop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerem...@apache.org
Subject svn commit: r1097736 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop/fo: expr/ICCColorFunction.java expr/NamedColorFunction.java properties/PropertyMaker.java
Date Fri, 29 Apr 2011 09:07:59 GMT
Author: jeremias
Date: Fri Apr 29 09:07:58 2011
New Revision: 1097736

URL: http://svn.apache.org/viewvc?rev=1097736&view=rev
Log:
Avert a few possible NPEs, ex. rgc-icc() and named-color() on fo:root.

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/ICCColorFunction.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/NamedColorFunction.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/PropertyMaker.java

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/ICCColorFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/ICCColorFunction.java?rev=1097736&r1=1097735&r2=1097736&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/ICCColorFunction.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/ICCColorFunction.java Fri Apr 29
09:07:58 2011
@@ -41,6 +41,7 @@ class ICCColorFunction extends FunctionB
     }
 
     /** {@inheritDoc} */
+    @Override
     public PercentBase getPercentBase() {
         return new ICCPercentBase();
     }
@@ -50,7 +51,9 @@ class ICCColorFunction extends FunctionB
                          PropertyInfo pInfo) throws PropertyException {
         // Map color profile NCNAME to src from declarations/color-profile element
         String colorProfileName = args[3].getString();
-        Declarations decls = pInfo.getFO().getRoot().getDeclarations();
+        Declarations decls = (pInfo.getFO() != null
+                ? pInfo.getFO().getRoot().getDeclarations()
+                : null);
         ColorProfile cp = null;
         if (decls == null) {
             //function used in a color-specification

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/NamedColorFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/NamedColorFunction.java?rev=1097736&r1=1097735&r2=1097736&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/NamedColorFunction.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/NamedColorFunction.java Fri Apr
29 09:07:58 2011
@@ -40,6 +40,7 @@ class NamedColorFunction extends Functio
     }
 
     /** {@inheritDoc} */
+    @Override
     public PercentBase getPercentBase() {
         return new NamedPercentBase();
     }
@@ -51,7 +52,9 @@ class NamedColorFunction extends Functio
         String colorProfileName = args[3].getString();
         String colorName = args[4].getString();
 
-        Declarations decls = pInfo.getFO().getRoot().getDeclarations();
+        Declarations decls = (pInfo.getFO() != null
+                ? pInfo.getFO().getRoot().getDeclarations()
+                : null);
         ColorProfile cp = null;
         if (decls != null) {
             cp = decls.getColorProfile(colorProfileName);

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/PropertyMaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/PropertyMaker.java?rev=1097736&r1=1097735&r2=1097736&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/PropertyMaker.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/PropertyMaker.java Fri Apr
29 09:07:58 2011
@@ -445,7 +445,9 @@ public class PropertyMaker implements Cl
             }
             return newProp;
         } catch (PropertyException propEx) {
-            propEx.setLocator(fo.getLocator());
+            if (fo != null) {
+                propEx.setLocator(fo.getLocator());
+            }
             propEx.setPropertyName(getName());
             throw propEx;
         }
@@ -653,6 +655,7 @@ public class PropertyMaker implements Cl
      * subproperty makers of the generic compound makers.
      * {@inheritDoc}
      */
+    @Override
     public Object clone() {
         try {
             return super.clone();



---------------------------------------------------------------------
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