This is an automated email from the ASF dual-hosted git repository. rec pushed a commit to branch bugfix/UIMA-6240-Failure-to-resolve-type-system-imports-when-generating-descriptors in repository https://gitbox.apache.org/repos/asf/uima-uimafit.git
commit 1504c5732f664b207238031046df72f7ea53b384 Merge: 4ac38a4 9db3f6c Author: Richard Eckart de Castilho <r...@apache.org> AuthorDate: Fri Jun 5 14:57:33 2020 +0200 Merge branch 'master' into bugfix/UIMA-6240-Failure-to-resolve-type-system-imports-when-generating-descriptors * master: (124 commits) [maven-release-plugin] prepare for next development iteration [maven-release-plugin] prepare release uimafit-3.1.0 [maven-release-plugin] prepare for next development iteration [maven-release-plugin] prepare release uimafit-3.1.0 [NO JIRA] Adjust UIMA version in the NOTICE file of the binary distribution [maven-release-plugin] prepare for next development iteration [maven-release-plugin] prepare release uimafit-3.1.0 [NO JIRA] Update documentation to changed API in ExternalResourceFactory and removed a spurious character [NO JIRA] Adjusted comparison version for API change report [NO JIRA] Updated README file for release. [NO JIRA] Updated README file for release. [UIMA-6214] Method signature class in ExternalResourceFactory Update an Eclipse metadata file. [UIMA-5847] Remove UV3 bug workarounds in FSCollectionFactory [UIMA-6216] Upgrade to UIMA Core 3.1.1 [NO JIRA] Fix NOTICE file No issue. Make japicmp pick up the right post-analysis file. No issue. Set version to 3.1.0-SNAPSHOT [UIMA-6181]b Fix complaints about maven-plugin-plugin in Eclipse [No Issue] Minor improvement of unit test illustrating error when binding resources to aggregates with nested dependent AEs. ... # Conflicts: # uimafit-core/src/main/java/org/apache/uima/fit/internal/ResourceManagerFactory.java CONTRIBUTING.md | 3 +- README | 36 +- api-change-report.html | 13 +- pom.xml | 52 +- src/main/assembly/bin.xml | 28 +- src/main/dist-bin/LICENSE | 2 +- src/main/dist-bin/NOTICE | 16 +- uimafit-benchmark/pom.xml | 23 +- .../org/apache/uima/fit/benchmark/Benchmark.java | 2 +- .../uima/fit/benchmark/RunnableWithExceptions.java | 4 +- .../uima/fit/benchmark/CasUtilBenchmark.java | 33 ++ .../uima/fit/benchmark/JCasUtilBenchmark.java | 27 + .../src/test/resources/simplelogger.properties | 1 + uimafit-core/NOTICE | 4 + uimafit-core/pom.xml | 56 +- .../uima/fit/component/CasAnnotator_ImplBase.java | 15 - .../component/CasCollectionReader_ImplBase.java | 12 +- .../uima/fit/component/CasConsumer_ImplBase.java | 15 - .../fit/component/CasFlowController_ImplBase.java | 15 - .../uima/fit/component/CasMultiplier_ImplBase.java | 15 - .../uima/fit/component/ExternalResourceAware.java | 8 +- .../uima/fit/component/JCasAnnotator_ImplBase.java | 15 - .../component/JCasCollectionReader_ImplBase.java | 13 +- .../uima/fit/component/JCasConsumer_ImplBase.java | 15 - .../fit/component/JCasFlowController_ImplBase.java | 15 - .../fit/component/JCasMultiplier_ImplBase.java | 15 - .../uima/fit/component/Resource_ImplBase.java | 14 +- .../uima/fit/factory/AnalysisEngineFactory.java | 10 +- .../org/apache/uima/fit/factory/CasFactory.java | 34 +- .../uima/fit/factory/CollectionReaderFactory.java | 50 +- .../fit/factory/ConfigurationParameterFactory.java | 13 +- .../uima/fit/factory/ExternalResourceFactory.java | 371 ++++++++---- .../uima/fit/factory/FlowControllerFactory.java | 10 +- .../apache/uima/fit/factory/FsIndexFactory.java | 10 +- .../org/apache/uima/fit/factory/JCasFactory.java | 49 +- .../uima/fit/factory/TypePrioritiesFactory.java | 19 +- .../fit/factory/TypeSystemDescriptionFactory.java | 11 +- .../apache/uima/fit/internal/ExtendedLogger.java | 450 --------------- .../org/apache/uima/fit/internal/MetaDataUtil.java | 2 +- .../uima/fit/internal/ResourceManagerFactory.java | 75 ++- .../apache/uima/fit/pipeline/SimplePipeline.java | 47 +- .../uima/fit/testing/factory/TokenBuilder.java | 1 - .../java/org/apache/uima/fit/util/CasUtil.java | 75 ++- .../apache/uima/fit/util/FSCollectionFactory.java | 322 +++++++---- .../main/java/org/apache/uima/fit/util/FSUtil.java | 53 +- .../java/org/apache/uima/fit/util/JCasUtil.java | 15 +- .../ConfigurationParameterInitializerTest.java | 2 +- .../AnalysisEngineFactoryExternalResourceTest.java | 61 +- ...ollectionReaderFactoryExternalResourceTest.java | 7 +- .../factory/ExternalResourceConfiguratorTest.java | 4 +- .../fit/factory/ExternalResourceFactoryTest.java | 173 ++++-- .../FlowControllerFactoryExternalResourceTest.java | 5 +- .../org/apache/uima/fit/factory/LoggingTest.java | 375 ------------- .../fit/factory/TypePrioritiesFactoryTest.java | 30 +- .../apache/uima/fit/pipeline/JCasIterableTest.java | 10 +- .../uima/fit/pipeline/SimplePipelineTest.java | 6 +- .../uima/fit/util/FSCollectionFactoryTest.java | 76 ++- .../java/org/apache/uima/fit/util/FSUtilTest.java | 27 +- .../org/apache/uima/fit/util/JCasUtilTest.java | 17 +- .../{JCasUtilTest.java => JCasUtilv3Test.java} | 385 +++++++------ .../resources/data/reference/JCasBuilderTest.dump | 22 +- .../test/resources/data/reference/test.xmi.dump | 28 +- uimafit-core/src/test/resources/log4j.properties | 5 - .../src/test/resources/simplelogger.properties | 1 + .../.settings/org.eclipse.core.resources.prefs | 1 + uimafit-cpe/pom.xml | 82 +-- .../java/org/apache/uima/fit/cpe/CpePipeline.java | 27 +- .../uima/fit/cpe/ExternalResourceFactoryTest.java | 30 +- .../src/test/resources/simplelogger.properties | 1 + uimafit-docbook/pom.xml | 58 +- .../tools.uimafit.configurationparameters.xml | 2 +- .../docbook/tools.uimafit.externalresources.xml | 2 +- .../src/docbook/tools.uimafit.migration.xml | 171 ++++-- uimafit-examples/NOTICE | 3 + uimafit-examples/pom.xml | 267 ++++----- .../examples/resource/ExternalResourceExample.java | 7 +- .../resource/ExternalResourceExample2.java | 7 +- .../resource/ExternalResourceExample3.java | 6 +- .../examples/tutorial/ex2/RoomNumberAnnotator.java | 3 +- .../tutorial/ex6/UimaAcronymAnnotator.java | 8 +- .../tutorial/ex6/UimaMeetingAnnotator.java | 8 +- .../src/main/resources/simplelogger.properties | 1 + .../fit/examples/tutorial/ex6/Example6Test.java | 8 +- .../.settings/org.eclipse.jdt.core.prefs | 288 ---------- .../.settings/org.eclipse.jdt.ui.prefs | 3 - uimafit-legacy-support/NOTICE | 8 - ...marker-file-identifying-api-compatibility-check | 1 - uimafit-legacy-support/pom.xml | 144 ----- .../uima/fit/legacy/AnnotationConverter.java | 44 -- .../uima/fit/legacy/LegacySupportPluginImpl.java | 158 ------ .../fit/legacy/converter/AnnotationLiteral.java | 277 --------- .../converter/ConfigurationParameterConverter.java | 98 ---- .../ContextlessAnnotationConverterBase.java | 41 -- .../converter/ExternalResourceConverter.java | 92 --- .../converter/FsIndexCollectionConverter.java | 67 --- .../fit/legacy/converter/FsIndexConverter.java | 92 --- .../fit/legacy/converter/FsIndexKeyConverter.java | 63 --- .../legacy/converter/NoConversionConverter.java | 59 -- .../converter/OperationalPropertiesConverter.java | 67 --- .../legacy/converter/SofaCapabilityConverter.java | 75 --- .../legacy/converter/TypeCapabilityConverter.java | 75 --- .../org/apache/uima/fit/ComponentTestBase.java | 89 --- .../uima/fit/component/CasDumpWriterTest.java | 61 -- .../JCasCollectionReader_ImplBaseTest.java | 88 --- .../fit/component/ViewCreatorAnnotatorTest.java | 182 ------ .../fit/component/ViewTextCopierAnnotatorTest.java | 92 --- .../ConfigurationParameterInitializerTest.java | 472 ---------------- .../apache/uima/fit/data/CreateSampleXCASFile.java | 59 -- .../apache/uima/fit/data/CreateSampleXMIFile.java | 54 -- .../uima/fit/descriptor/TypeCapabilityTest.java | 57 -- .../uima/fit/factory/AggregateBuilderTest.java | 209 ------- .../uima/fit/factory/AggregateWithReaderTest.java | 198 ------- .../AnalysisEngineFactoryExternalResourceTest.java | 404 -------------- .../fit/factory/AnalysisEngineFactoryTest.java | 467 ---------------- .../uima/fit/factory/AnnotationFactoryTest.java | 45 -- ...ollectionReaderFactoryExternalResourceTest.java | 91 --- .../fit/factory/CollectionReaderFactoryTest.java | 127 ----- .../factory/ConfigurationParameterFactoryTest.java | 221 -------- .../factory/ExternalResourceConfiguratorTest.java | 82 --- .../fit/factory/ExternalResourceFactoryTest.java | 411 -------------- .../FlowControllerFactoryExternalResourceTest.java | 93 --- .../uima/fit/factory/FsIndexFactoryTest.java | 132 ----- .../apache/uima/fit/factory/JCasBuilderTest.java | 73 --- .../apache/uima/fit/factory/JCasFactoryTest.java | 71 --- .../org/apache/uima/fit/factory/LoggingTest.java | 311 ----------- .../ResourceCreationSpecifierFactoryTest.java | 56 -- .../uima/fit/factory/SofaMappingFactoryTest.java | 40 -- .../fit/factory/TypePrioritiesFactoryTest.java | 47 -- .../factory/TypeSystemDescriptionFactoryTest.java | 48 -- .../uima/fit/factory/UimaContextFactoryTest.java | 70 --- .../initializable/InitializableFactoryTest.java | 123 ---- .../uima/fit/factory/testAes/Annotator1.java | 50 -- .../uima/fit/factory/testAes/Annotator2.java | 63 --- .../uima/fit/factory/testAes/Annotator3.java | 57 -- .../uima/fit/factory/testAes/Annotator4.java | 45 -- .../apache/uima/fit/factory/testAes/FlowAE1.java | 38 -- .../apache/uima/fit/factory/testAes/FlowAE2.java | 45 -- .../apache/uima/fit/factory/testAes/FlowAE3.java | 48 -- .../uima/fit/factory/testAes/ParameterizedAE.java | 409 -------------- .../uima/fit/factory/testAes/ParameterizedAE2.java | 56 -- .../testAes/ReversableTestFlowController.java | 88 --- .../apache/uima/fit/factory/testAes/ViewNames.java | 38 -- .../fit/factory/testCrs/SingleFileXReader.java | 127 ----- .../fit/factory/testCrs/SingleFileXReaderTest.java | 117 ---- .../fit/factory/testRes/TestExternalResource.java | 41 -- .../factory/testRes/TestSharedResourceObject.java | 48 -- .../uima/fit/testing/factory/TokenBuilderTest.java | 242 -------- .../java/org/apache/uima/fit/util/CasUtilTest.java | 188 ------- .../apache/uima/fit/util/ContainmentIndexTest.java | 69 --- .../apache/uima/fit/util/DisableLoggingTest.java | 106 ---- .../uima/fit/util/FSCollectionFactoryTest.java | 211 ------- .../org/apache/uima/fit/util/HideOutputTest.java | 72 --- .../org/apache/uima/fit/util/JCasIterableTest.java | 43 -- .../org/apache/uima/fit/util/JCasUtilTest.java | 621 --------------------- .../org/apache/uima/fit/util/LocaleUtilTest.java | 64 --- .../apache/uima/fit/util/SimplePipelineTest.java | 48 -- .../org/apache/uima/fit/util/TypeSystemUtil.java | 46 -- .../resources/META-INF/org.uimafit/fsindexes.txt | 1 - .../test/resources/META-INF/org.uimafit/types.txt | 1 - .../resources/data/descriptor/DefaultValueAE1.xml | 36 -- .../resources/data/descriptor/DefaultValueAE2.xml | 36 -- .../src/test/resources/data/descriptor/README | 3 - .../src/test/resources/data/docs/bad.xcas | 1 - .../src/test/resources/data/docs/test.xcas | 1 - .../src/test/resources/data/docs/test.xmi | 1 - .../test/resources/data/docs/unix-newlines.txt.bin | 8 - .../resources/data/docs/windows-newlines.txt.bin | 9 - .../resources/data/reference/JCasBuilderTest.dump | 69 --- .../test/resources/data/reference/test.xmi.dump | 92 --- .../apache/uima/fit/component/NoOpAnnotator.xml | 48 -- .../uima/fit/factory/testCrs/SingleFileXReader.xml | 60 -- .../apache/uima/fit/index/AutoImportableIndex.xml | 38 -- .../org/apache/uima/fit/type/AnalyzedText.xml | 39 -- .../org/apache/uima/fit/type/Sentence.xml | 32 -- .../resources/org/apache/uima/fit/type/Token.xml | 44 -- uimafit-maven-plugin/pom.xml | 324 +++++------ uimafit-maven-plugin/src/it/default/pom.xml | 110 ++-- .../org/apache/uima/fit/maven/EnhanceMojo.java | 7 +- .../uima/fit/maven/GenerateDescriptorsMojo.java | 2 +- .../java/org/apache/uima/fit/maven/util/Util.java | 2 +- uimafit-parent/pom.xml | 135 +++-- uimafit-spring/NOTICE | 3 + uimafit-spring/pom.xml | 111 ++-- .../spring/SpringContextResourceManagerTest.java | 4 +- .../src/test/resources/simplelogger.properties | 1 + 185 files changed, 2173 insertions(+), 12160 deletions(-) diff --cc uimafit-core/src/main/java/org/apache/uima/fit/internal/ResourceManagerFactory.java index 5bf34fa,c9d9a11..656e4bb --- a/uimafit-core/src/main/java/org/apache/uima/fit/internal/ResourceManagerFactory.java +++ b/uimafit-core/src/main/java/org/apache/uima/fit/internal/ResourceManagerFactory.java @@@ -69,49 -68,39 +69,48 @@@ public class ResourceManagerFactory public static class DefaultResourceManagerCreator implements ResourceManagerCreator { @Override public ResourceManager newResourceManager() throws ResourceInitializationException { - try { - UimaContext activeContext = UimaContextHolder.getContext(); - if (activeContext != null) { - // If we are already in a UIMA context, then we re-use it. Mind that the JCas cannot - // handle switching across more than one classloader. - // This can be done since UIMA 2.9.0 and starts being handled in uimaFIT 2.3.0 - // See https://issues.apache.org/jira/browse/UIMA-5056 - return ((UimaContextAdmin) activeContext).getResourceManager(); + UimaContext activeContext = UimaContextHolder.getContext(); + if (activeContext != null) { + // If we are already in a UIMA context, then we re-use it. Mind that the JCas cannot + // handle switching across more than one classloader. + // This can be done since UIMA 2.9.0 and starts being handled in uimaFIT 2.3.0 + // See https://issues.apache.org/jira/browse/UIMA-5056 + return ((UimaContextAdmin) activeContext).getResourceManager(); + } + else { + // If there is no UIMA context, then we create a new resource manager + // UIMA core still does not fall back to the context classloader in all cases. + // This was the default behavior until uimaFIT 2.2.0. - ResourceManager resMgr = UIMAFramework.newDefaultResourceManager(); ++ ResourceManager resMgr; ++ if (Thread.currentThread().getContextClassLoader() != null) { ++ // If the context classloader is set, then we want the resource manager to fallb ++ // back to it. However, it may not reliably do that that unless we explictly pass ++ // null here. See. UIMA-6239. ++ resMgr = new ResourceManager_impl(null); + } + else { - // If there is no UIMA context, then we create a new resource manager - // UIMA core still does not fall back to the context classloader in all cases. - // This was the default behavior until uimaFIT 2.2.0. - ResourceManager resMgr; - if (Thread.currentThread().getContextClassLoader() != null) { - // If the context classloader is set, then we want the resource manager to fallb - // back to it. However, it may not reliably do that that unless we explictly pass - // null here. See. UIMA-6239. - resMgr = new ResourceManager_impl(null); - } - else { - resMgr = UIMAFramework.newDefaultResourceManager(); - } - - - // Since UIMA Core version 2.10.3 and 3.0.1 the thread context classloader is taken - // into account by the core framework. Thus, we no longer have to explicitly set a - // classloader these or more recent versions. (cf. UIMA-5802) - short maj = UimaVersion.getMajorVersion(); - short min = UimaVersion.getMinorVersion(); - short rev = UimaVersion.getBuildRevision(); - boolean uimaCoreIgnoresContextClassloader = - (maj == 2 && (min < 10 || (min == 10 && rev < 3))) || // version < 2.10.3 - (maj == 3 && ((min == 0 && rev < 1))); // version < 3.0.1 - if (uimaCoreIgnoresContextClassloader) { ++ resMgr = UIMAFramework.newDefaultResourceManager(); ++ } + + // Since UIMA Core version 2.10.3 and 3.0.1 the thread context classloader is taken + // into account by the core framework. Thus, we no longer have to explicitly set a + // classloader these or more recent versions. (cf. UIMA-5802) + short maj = UimaVersion.getMajorVersion(); + short min = UimaVersion.getMinorVersion(); + short rev = UimaVersion.getBuildRevision(); + boolean uimaCoreIgnoresContextClassloader = + (maj == 2 && (min < 10 || (min == 10 && rev < 3))) || // version < 2.10.3 + (maj == 3 && ((min == 0 && rev < 1))); // version < 3.0.1 + if (uimaCoreIgnoresContextClassloader) { + try { resMgr.setExtensionClassPath(ClassUtils.getDefaultClassLoader(), "", true); } - - return resMgr; + catch (MalformedURLException e) { + throw new ResourceInitializationException(e); + } } - } - catch (MalformedURLException e) { - throw new ResourceInitializationException(e); + + return resMgr; } } }