jh: fix bug 179892 & 180797 filenames with spaces
diff --git a/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/layout/LinkInfo.java b/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/layout/LinkInfo.java
index a986493..cfbc917 100755
--- a/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/layout/LinkInfo.java
+++ b/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/layout/LinkInfo.java
@@ -64,7 +64,7 @@
private boolean isMissingReference = false;
- private Map attributeMap = new LinkedHashMap();
+ private Map<String, String> attributeMap = new LinkedHashMap<String, String>();
private IContentValidator validator;
@@ -157,10 +157,10 @@
buffer.append("<a"); //$NON-NLS-1$
- for (Iterator it = attributeMap.entrySet().iterator(); it.hasNext();) {
- Map.Entry entry = (Map.Entry) it.next();
- String key = (String) entry.getKey();
- String value = (String) entry.getValue();
+ for (Iterator<Map.Entry<String, String>> it = attributeMap.entrySet().iterator(); it.hasNext();) {
+ Map.Entry<String, String> entry = it.next();
+ String key = entry.getKey();
+ String value = entry.getValue();
if (LINK_ATTR_HREF.equals(key)
&& (value == null || value.length() == 0)) {
continue;
@@ -189,7 +189,13 @@
Matcher m2 = ResourceHelper.p_tag_attributes.matcher(attributes);
while (m2.find()) {
String attrName = m2.group(1).trim().toLowerCase();
- String attrValue = m2.group(3).trim();
+ String attrValue = "";
+ if (m2.group(3) != null) {
+ attrValue = m2.group(3).trim();
+ } else if (m2.group(2) != null) {
+ attrValue = m2.group(2).trim();
+ }
+
/*
* if (attrValue.startsWith("\"")) { attrValue =
* attrValue.substring(1); } if (attrValue.endsWith("\"")) {
diff --git a/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/util/ResourceHelper.java b/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/util/ResourceHelper.java
index a6de2f9..daf8154 100755
--- a/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/util/ResourceHelper.java
+++ b/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/util/ResourceHelper.java
@@ -154,7 +154,7 @@
public static final Pattern p_tag_attributes = Pattern
.compile(
- "(.*?)\\s*=\\s*(\"?)(\\S*)\\2", Pattern.CASE_INSENSITIVE | Pattern.DOTALL); //$NON-NLS-1$
+ "([\\S&&[^=]]+)\\s*=\\s*([\\S&&[^\"]]+|\"([\\S &&[^\"]]+)\")", Pattern.CASE_INSENSITIVE | Pattern.DOTALL); //$NON-NLS-1$
public static final Pattern p_css_ref = Pattern.compile(
" url\\((.*?)\\)", Pattern.CASE_INSENSITIVE | Pattern.DOTALL); //$NON-NLS-1$