aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas L. Delmelle <adelmelle@apache.org>2011-04-06 18:39:15 +0000
committerAndreas L. Delmelle <adelmelle@apache.org>2011-04-06 18:39:15 +0000
commita581b1c7885809af158b5d3c7a7d6231423a0696 (patch)
treeff51464beebac9f459cf1837b55835387f37e469
parent7c34c8daa841888fcf338d14b89a2295d2d65215 (diff)
downloadxmlgraphics-fop-a581b1c7885809af158b5d3c7a7d6231423a0696.tar.gz
xmlgraphics-fop-a581b1c7885809af158b5d3c7a7d6231423a0696.zip
Bugzilla 51032: Fixed regression due to oversight in refactoring text-decoration.
Invalid values properly reported as errors again, instead of causing a NPE. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1089559 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/java/org/apache/fop/fo/properties/TextDecorationMaker.java8
-rw-r--r--test/fotree/testcases/text-decoration_invalid_bug51032.fo32
2 files changed, 37 insertions, 3 deletions
diff --git a/src/java/org/apache/fop/fo/properties/TextDecorationMaker.java b/src/java/org/apache/fop/fo/properties/TextDecorationMaker.java
index de26934a0..fad48ed0c 100644
--- a/src/java/org/apache/fop/fo/properties/TextDecorationMaker.java
+++ b/src/java/org/apache/fop/fo/properties/TextDecorationMaker.java
@@ -59,14 +59,16 @@ public class TextDecorationMaker extends ListProperty.Maker {
boolean over = false;
boolean through = false;
boolean blink = false;
- int enumValue;
+ int enumValue = -1;
for (int i = lst.size(); --i >= 0;) {
Property prop = (Property)lst.get(i);
if (prop instanceof NCnameProperty) {
prop = checkEnumValues(prop.getString());
lst.set(i, prop);
}
- enumValue = prop.getEnum();
+ if (prop != null) {
+ enumValue = prop.getEnum();
+ }
switch (enumValue) {
case Constants.EN_NONE:
if (under | over | through | blink) {
@@ -115,7 +117,7 @@ public class TextDecorationMaker extends ListProperty.Maker {
throw new PropertyException("Invalid combination of values");
}
default:
- throw new PropertyException("Invalid value specified: " + prop);
+ throw new PropertyException("Invalid value specified: " + p);
}
}
return listProp;
diff --git a/test/fotree/testcases/text-decoration_invalid_bug51032.fo b/test/fotree/testcases/text-decoration_invalid_bug51032.fo
new file mode 100644
index 000000000..2a03bb62f
--- /dev/null
+++ b/test/fotree/testcases/text-decoration_invalid_bug51032.fo
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!-- $Id$ -->
+<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+ <fo:layout-master-set>
+ <fo:simple-page-master master-name="simple" page-height="5in" page-width="3in">
+ <fo:region-body />
+ </fo:simple-page-master>
+ </fo:layout-master-set>
+ <fo:page-sequence master-reference="simple">
+ <fo:flow flow-name="xsl-region-body">
+ <fo:block>
+ <fo:inline text-decoration="italic">bap</fo:inline>
+ </fo:block>
+ </fo:flow>
+ </fo:page-sequence>
+</fo:root>