Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjmisinco2013-12-17 15:37:47 +0000
committerGerrit Code Review @ Eclipse.org2013-12-18 20:33:37 +0000
commite3200c768c2983d2e36882ce8cb1ee4b41c6ecd6 (patch)
tree354f907b3e924be306ade30c8adf0e47bce3c82c /plugins
parent59a104e254f2200dc7fa951ca8b105961cc246c7 (diff)
downloadorg.eclipse.osee-e3200c768c2983d2e36882ce8cb1ee4b41c6ecd6.tar.gz
org.eclipse.osee-e3200c768c2983d2e36882ce8cb1ee4b41c6ecd6.tar.xz
org.eclipse.osee-e3200c768c2983d2e36882ce8cb1ee4b41c6ecd6.zip
bug: Fixes to search tagger
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/io/xml/XmlTextInputStream.java14
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/tagger/data/test8.data.xml2
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/tagger/data/test8.expected.txt2
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/tagger/data/test8.tags.txt5
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/indexer/data/IndexerDataSourceImpl.java11
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/tagger/TagProcessor.java8
6 files changed, 23 insertions, 19 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 743608afb4..6273a9bbcd 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
@@ -22,12 +22,12 @@ import org.eclipse.osee.framework.jdk.core.util.ReservedCharacters;
* @author Roberto E. Escobar
*/
public class XmlTextInputStream extends BufferedInputStream {
- private static final String START_PARAGRAPH = "<w:p";
- private static final String STOP_PARAGRAPH = "</w:p";
- private static final String START_WORDML_TEXT = "<w:t>";
+ private static final String START_PARAGRAPH_REGEX = "<w:p( .+)?>";
+ private static final String STOP_PARAGRAPH = "</w:p>";
+ private static final String START_WORDML_TEXT_REGEX = "<w:t( .+)?>";
private static final String END_WORDML_TEXT = "</w:t>";
private static final String LINE_BREAK = "<w:br/>";
- private static final String TAB = "<w:tab/>";
+ private static final String TAB_REGEX = "<w:tab( .+)?/>";
private IReadHelper readHelper;
@@ -236,17 +236,17 @@ public class XmlTextInputStream extends BufferedInputStream {
if ((char) value == '>') {
partOfTag = false;
String tag = buffer.toString();
- if (tag.equals(START_WORDML_TEXT)) {
+ if (tag.matches(START_WORDML_TEXT_REGEX)) {
collect = true;
} else if (tag.equals(END_WORDML_TEXT)) {
collect = false;
- } else if (tag.startsWith(START_PARAGRAPH)) {
+ } else if (tag.matches(START_PARAGRAPH_REGEX)) {
isStartOfParagraph = true;
} else if (tag.startsWith(STOP_PARAGRAPH)) {
isStartOfParagraph = false;
} else if (tag.startsWith(LINE_BREAK)) {
isBreak = true;
- } else if (tag.startsWith(TAB)) {
+ } else if (tag.matches(TAB_REGEX)) {
isBreak = true;
}
diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/tagger/data/test8.data.xml b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/tagger/data/test8.data.xml
index eca2b5629d..6f9dc24b02 100644
--- a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/tagger/data/test8.data.xml
+++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/tagger/data/test8.data.xml
@@ -2,4 +2,6 @@
<w:r><w:rPr><w:sz-cs w:val="18"/></w:rPr><w:t>5 = ARC-210</w:t></w:r>
<w:r><w:rPr><w:sz-cs w:val="18"/></w:rPr><w:br/></w:r>
<w:r><w:rPr><w:sz w:val="18"/><w:sz-cs w:val="18"/></w:rPr><w:t>6 = RESERVED</w:t></w:r><w:r><w:tab/><w:t>yes it is.</w:t></w:r>
+<w:p><w:r w:rsidR="00CE6B16"><w:rPr><w:rFonts w:ascii="Helvetica" w:hAnsi="Helvetica" w:cs="Helvetica"/></w:rPr><w:t xml:space="preserve"> The quick brown fox.</w:t></w:r>
+<w:tab wx:wTab="2880" wx:tlc="none" wx:cTlc="14"/><w:t>Hello</w:t></w:p>
</w:p>
diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/tagger/data/test8.expected.txt b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/tagger/data/test8.expected.txt
index 70e6343a0f..bd7768b0ef 100644
--- a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/tagger/data/test8.expected.txt
+++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/tagger/data/test8.expected.txt
@@ -1 +1 @@
-5 = ARC-210 6 = RESERVED yes it is. \ No newline at end of file
+5 = ARC-210 6 = RESERVED yes it is. The quick brown fox. Hello \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/tagger/data/test8.tags.txt b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/tagger/data/test8.tags.txt
index ef15220213..7588c3c7f8 100644
--- a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/tagger/data/test8.tags.txt
+++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/tagger/data/test8.tags.txt
@@ -6,3 +6,8 @@ reserved -539428360
yes 6654
it 434
is 402
+the 3866
+quick 4182975
+brown 1431435
+fox 16239
+hello 1520625 \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/indexer/data/IndexerDataSourceImpl.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/indexer/data/IndexerDataSourceImpl.java
index 201c24d1ce..7c5359f33e 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/indexer/data/IndexerDataSourceImpl.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/indexer/data/IndexerDataSourceImpl.java
@@ -16,7 +16,6 @@ import java.io.InputStream;
import java.net.URI;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
-import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.resource.management.IResource;
import org.eclipse.osee.framework.resource.management.IResourceLocator;
@@ -100,15 +99,9 @@ public class IndexerDataSourceImpl implements IndexedResource {
toReturn = resource.getContent();
} catch (OseeCoreException ex) {
throw new IOException(ex);
- } finally {
- Lib.close(toReturn);
- }
- } else {
- try {
- toReturn = new ByteArrayInputStream(getStringValue().getBytes("UTF-8"));
- } finally {
- Lib.close(toReturn);
}
+ } else if (Strings.isValid(getStringValue())) {
+ toReturn = new ByteArrayInputStream(getStringValue().getBytes("UTF-8"));
}
return toReturn;
}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/tagger/TagProcessor.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/tagger/TagProcessor.java
index fb71215fc6..777454073c 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/tagger/TagProcessor.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/tagger/TagProcessor.java
@@ -40,8 +40,12 @@ public class TagProcessor {
public void collectFromInputStream(InputStream inputStream, TagCollector tagCollector) {
if (inputStream != null) {
Scanner scanner = new Scanner(inputStream, "UTF-8");
- while (scanner.hasNext()) {
- processWord(scanner.next(), tagCollector);
+ try {
+ while (scanner.hasNext()) {
+ processWord(scanner.next(), tagCollector);
+ }
+ } finally {
+ scanner.close();
}
}
}

Back to the top