From a581b1c7885809af158b5d3c7a7d6231423a0696 Mon Sep 17 00:00:00 2001 From: "Andreas L. Delmelle" Date: Wed, 6 Apr 2011 18:39:15 +0000 Subject: [PATCH] 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 --- .../fo/properties/TextDecorationMaker.java | 8 +++-- .../text-decoration_invalid_bug51032.fo | 32 +++++++++++++++++++ 2 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 test/fotree/testcases/text-decoration_invalid_bug51032.fo 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 @@ + + + + + + + + + + + + + bap + + + + -- 2.39.5