diff --git a/opennlp-uima/src/test/java/opennlp/uima/AbstractUimaTest.java b/opennlp-uima/src/test/java/opennlp/uima/AbstractUimaTest.java
index 709a7f81e..ad05b717c 100644
--- a/opennlp-uima/src/test/java/opennlp/uima/AbstractUimaTest.java
+++ b/opennlp-uima/src/test/java/opennlp/uima/AbstractUimaTest.java
@@ -60,13 +60,19 @@ private void adaptModelURL(ResourceSpecifier specifier) {
for (ExternalResourceDescription modelDesc : resources) {
ResourceSpecifier resourceSpec = modelDesc.getResourceSpecifier();
String genericValue = resourceSpec.getAttributeValue(FILE_URL).toString();
- String modelName = genericValue.split(":")[1]; // always right of 'file:' -> idx 1
+ final boolean isDictionary = genericValue.endsWith(".dic");
+ String resourceName;
+ if (genericValue != null && !isDictionary) {
+ resourceName = genericValue.split(":")[1]; // always right of 'file:' -> idx 1
+ } else {
+ resourceName = genericValue;
+ }
try {
- if ("dictionary.dic".equals(modelName)) {
- URL fileURL = Paths.get(TARGET_DIR, modelName).toUri().toURL();
+ if (isDictionary) {
+ URL fileURL = Paths.get(TARGET_DIR, resourceName).toUri().toURL();
resourceSpec.setAttributeValue(FILE_URL, fileURL.toExternalForm());
} else {
- URL modelURL = OPENNLP_DIR.resolve(modelName).toUri().toURL();
+ URL modelURL = OPENNLP_DIR.resolve(resourceName).toUri().toURL();
resourceSpec.setAttributeValue(FILE_URL, modelURL.toExternalForm());
}
} catch (MalformedURLException e) {
diff --git a/opennlp-uima/src/test/java/opennlp/uima/dictionary/DictionaryResourceTest.java b/opennlp-uima/src/test/java/opennlp/uima/dictionary/DictionaryResourceTest.java
index 846e8c676..66f92e7cf 100644
--- a/opennlp-uima/src/test/java/opennlp/uima/dictionary/DictionaryResourceTest.java
+++ b/opennlp-uima/src/test/java/opennlp/uima/dictionary/DictionaryResourceTest.java
@@ -43,6 +43,8 @@
import opennlp.uima.AbstractTest;
import opennlp.uima.util.CasUtil;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
public class DictionaryResourceTest extends AbstractTest {
private static AnalysisEngine AE;
@@ -54,15 +56,17 @@ public static void beforeClass() throws Exception {
@AfterAll
public static void afterClass() {
- AE.destroy(); // is this necessary?
+ if (AE != null) {
+ AE.destroy(); // is this necessary?
+ }
}
private static AnalysisEngine produceAE(String descName)
throws IOException, InvalidXMLException, ResourceInitializationException {
File descFile = new File(PATH_DESCRIPTORS + "/" + descName);
XMLInputSource in = new XMLInputSource(descFile);
- ResourceSpecifier specifier = UIMAFramework.getXMLParser()
- .parseResourceSpecifier(in);
+ ResourceSpecifier specifier = UIMAFramework.getXMLParser().parseResourceSpecifier(in);
+ assertNotNull(specifier);
return UIMAFramework.produceAnalysisEngine(specifier);
}
@@ -73,7 +77,7 @@ public void testDictionaryWasLoaded() {
final DictionaryResource dic = (DictionaryResource) AE.getResourceManager()
.getResource("/opennlp.uima.Dictionary");
final Dictionary d = dic.getDictionary();
- Assertions.assertNotNull(d);
+ assertNotNull(d);
Assertions.assertEquals(6, d.asStringSet().size(),
"There should be six entries in the dictionary");
Assertions.assertTrue(d.contains(new StringList("London")),
diff --git a/opennlp-uima/src/test/resources/test-descriptors/DictionaryNameFinder.xml b/opennlp-uima/src/test/resources/test-descriptors/DictionaryNameFinder.xml
index a4c910678..d0701700f 100644
--- a/opennlp-uima/src/test/resources/test-descriptors/DictionaryNameFinder.xml
+++ b/opennlp-uima/src/test/resources/test-descriptors/DictionaryNameFinder.xml
@@ -108,7 +108,7 @@
NameFinderDictionary
- file:dictionary.dic
+ dictionary.dic
opennlp.uima.dictionary.DictionaryResourceImpl
diff --git a/pom.xml b/pom.xml
index 7d1868406..bf7d5be47 100644
--- a/pom.xml
+++ b/pom.xml
@@ -183,7 +183,7 @@
5.13.4
2.0.2
- 3.6.0
+ 3.6.1
2.1.9
1.23.0
2.0.17