Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjmisinco2014-07-23 14:41:54 -0400
committerRoberto E. Escobar2014-08-28 19:59:39 -0400
commitf1793fa5225a919eae89cc33792c5c097272fcbc (patch)
treeafe5701db64dd0572aef58062f62129fb0dd7579 /plugins/org.eclipse.osee.framework.jdk.core
parent1514ba34eb0b8bc59d718b46717f62afd0056d31 (diff)
downloadorg.eclipse.osee-f1793fa5225a919eae89cc33792c5c097272fcbc.tar.gz
org.eclipse.osee-f1793fa5225a919eae89cc33792c5c097272fcbc.tar.xz
org.eclipse.osee-f1793fa5225a919eae89cc33792c5c097272fcbc.zip
feature[ats_ATS81344]: Tag embedded OSEE_LINK guids
Diffstat (limited to 'plugins/org.eclipse.osee.framework.jdk.core')
-rw-r--r--plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/io/xml/XmlTextInputStream.java32
1 files changed, 31 insertions, 1 deletions
diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/io/xml/XmlTextInputStream.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/io/xml/XmlTextInputStream.java
index 3627502898..53df31f5a3 100644
--- a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/io/xml/XmlTextInputStream.java
+++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/io/xml/XmlTextInputStream.java
@@ -28,6 +28,8 @@ public class XmlTextInputStream extends BufferedInputStream {
private static final String END_WORDML_TEXT = "</w:t>";
private static final String LINE_BREAK = "<w:br/>";
private static final String TAB_REGEX = "<w:tab( .+)?/>";
+ private static final char[] OSEE_LINK_BEGIN = "OSEE_LINK(".toCharArray();
+ private static final char OSEE_LINK_END = ')';
private IReadHelper readHelper;
@@ -196,6 +198,8 @@ public class XmlTextInputStream extends BufferedInputStream {
private boolean lastCollect;
private boolean lastIsCarriageReturn;
private boolean lastIsStartOfParagraph;
+ private int linkIdx;
+ private boolean foundLink;
public WordMlReadHelper() {
buffer = new StringBuilder();
@@ -210,21 +214,36 @@ public class XmlTextInputStream extends BufferedInputStream {
lastCollect = false;
lastIsStartOfParagraph = false;
lastIsCarriageReturn = false;
+ foundLink = false;
+ linkIdx = 0;
}
@Override
public int process(int value) throws IOException {
isStartOfParagraph = false;
isBreak = false;
+
if ((char) value == '<') {
partOfTag = true;
buffer.append((char) value);
+ } else {
+ linkIdx = (char) value == OSEE_LINK_BEGIN[linkIdx] ? linkIdx + 1 : 0;
}
- while ((partOfTag || isCarriageReturn || isStartOfParagraph != true && collect != true && isBreak != true) && available() > 0) {
+
+ while ((partOfTag || isCarriageReturn || isStartOfParagraph != true && collect != true && isBreak != true && foundLink != true) && available() > 0) {
value = readFromOriginalBuffer();
if ((char) value == '<') {
partOfTag = true;
+ } else if ((char) value == OSEE_LINK_BEGIN[linkIdx++]) {
+ // check if we've matched all characters for OSEE_LINK
+ if (OSEE_LINK_BEGIN.length == linkIdx) {
+ foundLink = true;
+ linkIdx = 0;
+ }
+ } else {
+ linkIdx = 0;
}
+
if (partOfTag) {
buffer.append((char) value);
}
@@ -257,11 +276,21 @@ public class XmlTextInputStream extends BufferedInputStream {
if ((char) value == '<') {
partOfTag = true;
buffer.append((char) value);
+ } else {
+ if ((char) value != OSEE_LINK_BEGIN[linkIdx++]) {
+ linkIdx = 0;
+ }
}
}
}
}
+ if (foundLink && (char) value == OSEE_LINK_END) {
+ // end of OSEE_LINK
+ foundLink = false;
+ linkIdx = 0;
+ }
+
if (available() <= 0) {
value = -1;
}
@@ -290,4 +319,5 @@ public class XmlTextInputStream extends BufferedInputStream {
lastIsCarriageReturn = isCarriageReturn;
}
}
+
}

Back to the top