aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2008-08-13 14:34:03 +0000
committerJeremias Maerki <jeremias@apache.org>2008-08-13 14:34:03 +0000
commita31b0119d41994f4aff1eb5c1c8639c780e420b8 (patch)
treeb9081c58f902e7c8bfd41785825af76380af4e61 /src/java/org/apache
parentff243bf1dd6062bbe624391a9ef79fc26018a23f (diff)
downloadxmlgraphics-fop-a31b0119d41994f4aff1eb5c1c8639c780e420b8.tar.gz
xmlgraphics-fop-a31b0119d41994f4aff1eb5c1c8639c780e420b8.zip
Fixed border trait parsing for the area tree XML when CMYK or ICC colors were used.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@685573 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache')
-rw-r--r--src/java/org/apache/fop/traits/BorderProps.java21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/java/org/apache/fop/traits/BorderProps.java b/src/java/org/apache/fop/traits/BorderProps.java
index 20e362674..338743538 100644
--- a/src/java/org/apache/fop/traits/BorderProps.java
+++ b/src/java/org/apache/fop/traits/BorderProps.java
@@ -21,7 +21,8 @@ package org.apache.fop.traits;
import java.awt.Color;
import java.io.Serializable;
-import java.util.StringTokenizer;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.fo.Constants;
@@ -162,13 +163,19 @@ public class BorderProps implements Serializable {
public static BorderProps valueOf(FOUserAgent foUserAgent, String s) {
if (s.startsWith("(") && s.endsWith(")")) {
s = s.substring(1, s.length() - 1);
- StringTokenizer st = new StringTokenizer(s, ",");
- String style = st.nextToken();
- String color = st.nextToken();
- int width = Integer.parseInt(st.nextToken());
+ Pattern pattern = Pattern.compile("([^,\\(]+(?:\\(.*\\))?)");
+ Matcher m = pattern.matcher(s);
+ boolean found;
+ found = m.find();
+ String style = m.group();
+ found = m.find();
+ String color = m.group();
+ found = m.find();
+ int width = Integer.parseInt(m.group());
int mode = SEPARATE;
- if (st.hasMoreTokens()) {
- String ms = st.nextToken();
+ found = m.find();
+ if (found) {
+ String ms = m.group();
if ("collapse-inner".equalsIgnoreCase(ms)) {
mode = COLLAPSE_INNER;
} else if ("collapse-outer".equalsIgnoreCase(ms)) {