Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjmisinco2015-06-05 15:40:14 -0400
committerjmisinco2015-06-08 13:17:05 -0400
commitfd7e7b229169a3f907e1ba3a26065e8f955be66d (patch)
tree9214f027598af991ffc61c26d4cde08bb6da17ba
parent82cc63228e7bc5f67d8139b20608f690fb0ebcb6 (diff)
downloadorg.eclipse.osee-0.21.0.tar.gz
org.eclipse.osee-0.21.0.tar.xz
org.eclipse.osee-0.21.0.zip
bug[ats_ATS203547]: Fix published links0.21.0
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/linking/OseeLinkParser.java3
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/linking/WordMlLinkHandler.java23
2 files changed, 20 insertions, 6 deletions
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/linking/OseeLinkParser.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/linking/OseeLinkParser.java
index 08d4156896..659de9c7e4 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/linking/OseeLinkParser.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/linking/OseeLinkParser.java
@@ -101,7 +101,6 @@ public final class OseeLinkParser {
/**
* Process old format: http://127.0.0.1:<port>/get/guid/<guid>/<ats,Define> old format should be removed once all
* legacy references are change to new format
- *
*/
private boolean parseOldSchoolStyleLinks(String link) {
boolean wasHandled = false;
@@ -116,6 +115,8 @@ public final class OseeLinkParser {
parameterMap.put("guid", guid);
} else if (processType.equals("Define") || processType.equals("")) {
parameterMap.put("guid", guid);
+ } else if (GUID.isValid(guid)) {
+ parameterMap.put("guid", guid);
}
}
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/linking/WordMlLinkHandler.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/linking/WordMlLinkHandler.java
index 71abe99d26..bedd254f25 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/linking/WordMlLinkHandler.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/linking/WordMlLinkHandler.java
@@ -76,8 +76,10 @@ import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
public class WordMlLinkHandler {
private static final Matcher OSEE_LINK_PATTERN = Pattern.compile("OSEE_LINK\\((.*?)\\)", Pattern.DOTALL).matcher("");
- private static final Matcher WORDML_LINK = Pattern.compile("<w:hlink\\s+w:dest=\"(.*?)\".*?</w:hlink\\s*>",
- Pattern.DOTALL).matcher("");
+ private static final Matcher WORDML_LINK = Pattern.compile(
+ "<w:hlink\\s+w:dest=\"(.*?)\"[^>]*?(/>|>.*?</w:hlink\\s*>)", Pattern.DOTALL).matcher("");
+ private static final Matcher HYPERLINK_PATTERN = Pattern.compile(
+ "<w:r[^>]*><w:instrText>\\s*HYPERLINK\\s+(\")?(.+?)(\")?\\s*</w:instrText></w:r>", Pattern.DOTALL).matcher("");
private static final OseeLinkBuilder linkBuilder = new OseeLinkBuilder();
@@ -128,11 +130,9 @@ public class WordMlLinkHandler {
}
}
OSEE_LINK_PATTERN.reset();
-
if (!matchMap.isEmpty()) {
modified = modifiedContent(linkType, source, content, matchMap, false);
}
-
if (linkType != LinkType.OSEE_SERVER_LINK) {
// Add a bookmark to the start of the content so internal links can link later
modified = linkBuilder.getWordMlBookmark(source) + modified;
@@ -147,7 +147,6 @@ public class WordMlLinkHandler {
*/
public static HashCollection<String, MatchRange> parseOseeWordMLLinks(String content) throws OseeCoreException {
HashCollection<String, MatchRange> matchMap = new HashCollection<String, MatchRange>();
-
OseeLinkParser linkParser = new OseeLinkParser();
WORDML_LINK.reset(content);
while (WORDML_LINK.find()) {
@@ -161,6 +160,20 @@ public class WordMlLinkHandler {
}
}
WORDML_LINK.reset();
+
+ HYPERLINK_PATTERN.reset(content);
+ while (HYPERLINK_PATTERN.find()) {
+ String link = HYPERLINK_PATTERN.group(2);
+ if (Strings.isValid(link)) {
+ linkParser.parse(link);
+ String guid = linkParser.getGuid();
+ if (Strings.isValid(guid)) {
+ matchMap.put(guid, new MatchRange(HYPERLINK_PATTERN.start(), HYPERLINK_PATTERN.end()));
+ }
+ }
+ }
+ HYPERLINK_PATTERN.reset();
+
return matchMap;
}

Back to the top