Browse Source

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
tags/fop-1_1rc1old
Andreas L. Delmelle 13 years ago
parent
commit
a581b1c788

+ 5
- 3
src/java/org/apache/fop/fo/properties/TextDecorationMaker.java View File

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

+ 32
- 0
test/fotree/testcases/text-decoration_invalid_bug51032.fo View File

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

Loading…
Cancel
Save