You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by re...@apache.org on 2015/12/24 14:59:52 UTC

svn commit: r1721622 - in /uima/uimafit/trunk/uimafit-core/src/main/java/org/apache/uima/fit: factory/CollectionReaderFactory.java factory/JCasFactory.java pipeline/JCasIterable.java pipeline/SimplePipeline.java testing/factory/TokenBuilder.java

Author: rec
Date: Thu Dec 24 13:59:52 2015
New Revision: 1721622

URL: http://svn.apache.org/viewvc?rev=1721622&view=rev
Log:
[UIMA-3562] Revert: Avoid throwing UIMAException
- semver plugin doesn't consider these changes to be backwards compatible (although I think they are)

Modified:
    uima/uimafit/trunk/uimafit-core/src/main/java/org/apache/uima/fit/factory/CollectionReaderFactory.java
    uima/uimafit/trunk/uimafit-core/src/main/java/org/apache/uima/fit/factory/JCasFactory.java
    uima/uimafit/trunk/uimafit-core/src/main/java/org/apache/uima/fit/pipeline/JCasIterable.java
    uima/uimafit/trunk/uimafit-core/src/main/java/org/apache/uima/fit/pipeline/SimplePipeline.java
    uima/uimafit/trunk/uimafit-core/src/main/java/org/apache/uima/fit/testing/factory/TokenBuilder.java

Modified: uima/uimafit/trunk/uimafit-core/src/main/java/org/apache/uima/fit/factory/CollectionReaderFactory.java
URL: http://svn.apache.org/viewvc/uima/uimafit/trunk/uimafit-core/src/main/java/org/apache/uima/fit/factory/CollectionReaderFactory.java?rev=1721622&r1=1721621&r2=1721622&view=diff
==============================================================================
--- uima/uimafit/trunk/uimafit-core/src/main/java/org/apache/uima/fit/factory/CollectionReaderFactory.java (original)
+++ uima/uimafit/trunk/uimafit-core/src/main/java/org/apache/uima/fit/factory/CollectionReaderFactory.java Thu Dec 24 13:59:52 2015
@@ -34,6 +34,7 @@ import java.util.Map;
 import java.util.Map.Entry;
 
 import org.apache.uima.Constants;
+import org.apache.uima.UIMAException;
 import org.apache.uima.UIMAFramework;
 import org.apache.uima.collection.CollectionReader;
 import org.apache.uima.collection.CollectionReaderDescription;
@@ -50,7 +51,6 @@ import org.apache.uima.resource.metadata
 import org.apache.uima.resource.metadata.ResourceMetaData;
 import org.apache.uima.resource.metadata.TypePriorities;
 import org.apache.uima.resource.metadata.TypeSystemDescription;
-import org.apache.uima.util.InvalidXMLException;
 
 /**
  */
@@ -69,16 +69,13 @@ public final class CollectionReaderFacto
    *          Any additional configuration parameters to be set. These should be supplied as (name,
    *          value) pairs, so there should always be an even number of parameters.
    * @return The CollectionReader created from the XML descriptor and the configuration parameters.
-   * @throws InvalidXMLException
-   *           if the descriptor could not be created
-   * @throws ResourceInitializationException
-   *           if the component could not be instantiated
+   * @throws UIMAException
+   *           if the descriptor could not be created or if the component could not be instantiated
    * @throws IOException
    *           if the descriptor could not be read
    */
   public static CollectionReader createReaderFromPath(String descriptorPath,
-          Object... configurationData) throws InvalidXMLException, ResourceInitializationException, 
-          IOException {
+          Object... configurationData) throws UIMAException, IOException {
     CollectionReaderDescription desc = createReaderDescriptionFromPath(descriptorPath,
             configurationData);
     return UIMAFramework.produceCollectionReader(desc, ResourceManagerFactory.newResourceManager(),
@@ -95,17 +92,14 @@ public final class CollectionReaderFacto
    *          value) pairs, so there should always be an even number of parameters.
    * @return The CollectionReader created from the XML descriptor and the configuration parameters.
    * @deprecated use {@link #createReaderFromPath(String, Object...)}
-   * @throws InvalidXMLException
-   *           if the descriptor could not be created
-   * @throws ResourceInitializationException
-   *           if the component could not be instantiated
+   * @throws UIMAException
+   *           if the descriptor could not be created or if the component could not be instantiated
    * @throws IOException
    *           if the descriptor could not be read
    */
   @Deprecated
   public static CollectionReader createCollectionReaderFromPath(String descriptorPath,
-          Object... configurationData) throws InvalidXMLException, ResourceInitializationException, 
-          IOException {
+          Object... configurationData) throws UIMAException, IOException {
     return createReaderFromPath(descriptorPath, configurationData);
   }
 
@@ -118,13 +112,13 @@ public final class CollectionReaderFacto
    *          Any additional configuration parameters to be set. These should be supplied as (name,
    *          value) pairs, so there should always be an even number of parameters.
    * @return the description created from the XML descriptor and the configuration parameters.
-   * @throws InvalidXMLException
+   * @throws UIMAException
    *           if the descriptor could not be created or if the component could not be instantiated
    * @throws IOException
    *           if the descriptor could not be read
    */
   public static CollectionReaderDescription createReaderDescriptionFromPath(String descriptorPath,
-          Object... configurationData) throws InvalidXMLException, IOException {
+          Object... configurationData) throws UIMAException, IOException {
     ResourceCreationSpecifier specifier = createResourceCreationSpecifier(descriptorPath,
             configurationData);
     return (CollectionReaderDescription) specifier;
@@ -140,17 +134,14 @@ public final class CollectionReaderFacto
    *          value) pairs, so there should always be an even number of parameters.
    * @return The CollectionReader created from the XML descriptor and the configuration parameters.
    * @deprecated use {@link #createReaderDescriptionFromPath(String, Object...)}
-   * @throws InvalidXMLException
-   *           if the descriptor could not be created
-   * @throws ResourceInitializationException
-   *           if the component could not be instantiated
+   * @throws UIMAException
+   *           if the descriptor could not be created or if the component could not be instantiated
    * @throws IOException
    *           if the descriptor could not be read
    */
   @Deprecated
   public static CollectionReaderDescription createCollectionReaderDescriptionFromPath(
-          String descriptorPath, Object... configurationData) throws InvalidXMLException,
-          ResourceInitializationException, IOException {
+          String descriptorPath, Object... configurationData) throws UIMAException, IOException {
     return createReaderDescriptionFromPath(descriptorPath, configurationData);
   }
 
@@ -164,15 +155,13 @@ public final class CollectionReaderFacto
    *          Any additional configuration parameters to be set. These should be supplied as (name,
    *          value) pairs, so there should always be an even number of parameters.
    * @return The AnalysisEngine created from the XML descriptor and the configuration parameters.
-   * @throws InvalidXMLException
-   *           if the descriptor could not be created
-   * @throws ResourceInitializationException
-   *           if the component could not be instantiated
+   * @throws UIMAException
+   *           if the descriptor could not be created or if the component could not be instantiated
    * @throws IOException
    *           if the descriptor could not be read
    */
-  public static CollectionReader createReader(String descriptorName, Object... configurationData)
-          throws InvalidXMLException, ResourceInitializationException, IOException {
+  public static CollectionReader createReader(String descriptorName,
+          Object... configurationData) throws UIMAException, IOException {
     Import imp = UIMAFramework.getResourceSpecifierFactory().createImport();
     imp.setName(descriptorName);
     URL url = imp.findAbsoluteUrl(ResourceManagerFactory.newResourceManager());
@@ -192,17 +181,14 @@ public final class CollectionReaderFacto
    *          value) pairs, so there should always be an even number of parameters.
    * @return The AnalysisEngine created from the XML descriptor and the configuration parameters.
    * @deprecated use {@link #createReader(String, Object...)}
-   * @throws InvalidXMLException
-   *           if the descriptor could not be created
-   * @throws ResourceInitializationException
-   *           if the component could not be instantiated
+   * @throws UIMAException
+   *           if the descriptor could not be created or if the component could not be instantiated
    * @throws IOException
    *           if the descriptor could not be read
    */
   @Deprecated
   public static CollectionReader createCollectionReader(String descriptorName,
-          Object... configurationData) throws ResourceInitializationException, InvalidXMLException,
-          IOException {
+          Object... configurationData) throws UIMAException, IOException {
     return createReader(descriptorName, configurationData);
   }
 

Modified: uima/uimafit/trunk/uimafit-core/src/main/java/org/apache/uima/fit/factory/JCasFactory.java
URL: http://svn.apache.org/viewvc/uima/uimafit/trunk/uimafit-core/src/main/java/org/apache/uima/fit/factory/JCasFactory.java?rev=1721622&r1=1721621&r2=1721622&view=diff
==============================================================================
--- uima/uimafit/trunk/uimafit-core/src/main/java/org/apache/uima/fit/factory/JCasFactory.java (original)
+++ uima/uimafit/trunk/uimafit-core/src/main/java/org/apache/uima/fit/factory/JCasFactory.java Thu Dec 24 13:59:52 2015
@@ -26,11 +26,10 @@ import static org.apache.uima.fit.factor
 import java.io.File;
 import java.io.IOException;
 
-import org.apache.uima.cas.CASException;
+import org.apache.uima.UIMAException;
 import org.apache.uima.fit.internal.ResourceManagerFactory;
 import org.apache.uima.fit.util.CasIOUtil;
 import org.apache.uima.jcas.JCas;
-import org.apache.uima.resource.ResourceInitializationException;
 import org.apache.uima.resource.ResourceManager;
 import org.apache.uima.resource.metadata.FsIndexCollection;
 import org.apache.uima.resource.metadata.TypePriorities;
@@ -52,12 +51,10 @@ public final class JCasFactory {
    * detected automatically using {@link FsIndexFactory#createFsIndexCollection()}.
    * 
    * @return a new JCas
-   * @throws ResourceInitializationException
-   *           if the CAS configuration could not be assembled
-   * @throws CASException 
+   * @throws UIMAException
    *           if the JCas could not be initialized
    */
-  public static JCas createText(String aText) throws ResourceInitializationException, CASException {
+  public static JCas createText(String aText) throws UIMAException {
     return createText(aText, null);
   }
 
@@ -68,13 +65,10 @@ public final class JCasFactory {
    * detected automatically using {@link FsIndexFactory#createFsIndexCollection()}.
    * 
    * @return a new JCas
-   * @throws ResourceInitializationException
-   *           if the CAS configuration could not be assembled
-   * @throws CASException 
+   * @throws UIMAException
    *           if the JCas could not be initialized
    */
-  public static JCas createText(String aText, String aLanguage)
-          throws ResourceInitializationException, CASException {
+  public static JCas createText(String aText, String aLanguage) throws UIMAException {
     JCas jcas = createJCas();
     if (aText != null) {
       jcas.setDocumentText(aText);
@@ -92,12 +86,10 @@ public final class JCasFactory {
    * detected automatically using {@link FsIndexFactory#createFsIndexCollection()}.
    * 
    * @return a new JCas
-   * @throws ResourceInitializationException
-   *           if the CAS configuration could not be assembled
-   * @throws CASException 
+   * @throws UIMAException
    *           if the JCas could not be initialized
    */
-  public static JCas createJCas() throws ResourceInitializationException, CASException {
+  public static JCas createJCas() throws UIMAException {
     TypeSystemDescription tsd = createTypeSystemDescription();
     TypePriorities tp = createTypePriorities();
     FsIndexCollection indexes = createFsIndexCollection();
@@ -113,13 +105,10 @@ public final class JCasFactory {
    *          names of the type system descriptors on the classpath used to initialize the JCas (in
    *          Java notation, e.g. "my.package.TypeSystem" without the ".xml" extension)
    * @return a new JCas
-   * @throws ResourceInitializationException
-   *           if the CAS configuration could not be assembled
-   * @throws CASException 
+   * @throws UIMAException
    *           if the JCas could not be initialized
    */
-  public static JCas createJCas(String... typeSystemDescriptorNames) throws CASException,
-          ResourceInitializationException {
+  public static JCas createJCas(String... typeSystemDescriptorNames) throws UIMAException {
     return CasCreationUtils.createCas(createTypeSystemDescription(typeSystemDescriptorNames), null,
             null).getJCas();
   }
@@ -131,13 +120,10 @@ public final class JCasFactory {
    * @param typeSystemDescriptorPaths
    *          paths to type system descriptor files
    * @return a new JCas
-   * @throws ResourceInitializationException
-   *           if the CAS configuration could not be assembled
-   * @throws CASException 
+   * @throws UIMAException
    *           if the JCas could not be initialized
    */
-  public static JCas createJCasFromPath(String... typeSystemDescriptorPaths) throws CASException,
-          ResourceInitializationException {
+  public static JCas createJCasFromPath(String... typeSystemDescriptorPaths) throws UIMAException {
     return createJCas(createTypeSystemDescriptionFromPath(typeSystemDescriptorPaths));
   }
 
@@ -148,13 +134,10 @@ public final class JCasFactory {
    * @param typeSystemDescription
    *          a type system description to initialize the JCas
    * @return a new JCas
-   * @throws ResourceInitializationException
-   *           if the CAS configuration could not be assembled
-   * @throws CASException 
+   * @throws UIMAException
    *           if the JCas could not be initialized
    */
-  public static JCas createJCas(TypeSystemDescription typeSystemDescription) throws CASException,
-          ResourceInitializationException {
+  public static JCas createJCas(TypeSystemDescription typeSystemDescription) throws UIMAException {
     return CasCreationUtils.createCas(typeSystemDescription, null, null).getJCas();
   }
 
@@ -166,15 +149,13 @@ public final class JCasFactory {
    * @param typeSystemDescription
    *          a type system description to initialize the JCas
    * @return a new JCas
-   * @throws ResourceInitializationException
-   *           if the CAS configuration could not be assembled
-   * @throws CASException 
+   * @throws UIMAException
    *           if the JCas could not be initialized
    * @throws IOException
    *           if there is a problem reading the file
    */
   public static JCas createJCas(String fileName, TypeSystemDescription typeSystemDescription)
-          throws IOException, CASException, ResourceInitializationException {
+          throws UIMAException, IOException {
     JCas jCas = createJCas(typeSystemDescription);
     CasIOUtil.readJCas(jCas, new File(fileName));
     return jCas;

Modified: uima/uimafit/trunk/uimafit-core/src/main/java/org/apache/uima/fit/pipeline/JCasIterable.java
URL: http://svn.apache.org/viewvc/uima/uimafit/trunk/uimafit-core/src/main/java/org/apache/uima/fit/pipeline/JCasIterable.java?rev=1721622&r1=1721621&r2=1721622&view=diff
==============================================================================
--- uima/uimafit/trunk/uimafit-core/src/main/java/org/apache/uima/fit/pipeline/JCasIterable.java (original)
+++ uima/uimafit/trunk/uimafit-core/src/main/java/org/apache/uima/fit/pipeline/JCasIterable.java Thu Dec 24 13:59:52 2015
@@ -20,15 +20,14 @@ package org.apache.uima.fit.pipeline;
 
 import static org.apache.uima.fit.factory.AnalysisEngineFactory.createEngineDescription;
 
+import org.apache.uima.UIMAException;
 import org.apache.uima.UIMAFramework;
 import org.apache.uima.analysis_engine.AnalysisEngine;
 import org.apache.uima.analysis_engine.AnalysisEngineDescription;
-import org.apache.uima.cas.CASException;
 import org.apache.uima.collection.CollectionReader;
 import org.apache.uima.collection.CollectionReaderDescription;
 import org.apache.uima.fit.internal.ResourceManagerFactory;
 import org.apache.uima.jcas.JCas;
-import org.apache.uima.resource.ResourceInitializationException;
 import org.apache.uima.resource.ResourceManager;
 
 /**
@@ -81,7 +80,7 @@ public class JCasIterable implements Ite
       i.setSelfComplete(true);
       i.setSelfDestroy(true);
       return i;
-    } catch (CASException | ResourceInitializationException e) {
+    } catch (UIMAException e) {
       throw new IllegalStateException(e);
     }
   }

Modified: uima/uimafit/trunk/uimafit-core/src/main/java/org/apache/uima/fit/pipeline/SimplePipeline.java
URL: http://svn.apache.org/viewvc/uima/uimafit/trunk/uimafit-core/src/main/java/org/apache/uima/fit/pipeline/SimplePipeline.java?rev=1721622&r1=1721621&r2=1721622&view=diff
==============================================================================
--- uima/uimafit/trunk/uimafit-core/src/main/java/org/apache/uima/fit/pipeline/SimplePipeline.java (original)
+++ uima/uimafit/trunk/uimafit-core/src/main/java/org/apache/uima/fit/pipeline/SimplePipeline.java Thu Dec 24 13:59:52 2015
@@ -22,18 +22,16 @@ import static java.util.Arrays.asList;
 import static org.apache.uima.fit.factory.AnalysisEngineFactory.createEngine;
 import static org.apache.uima.fit.factory.AnalysisEngineFactory.createEngineDescription;
 import static org.apache.uima.fit.util.LifeCycleUtil.collectionProcessComplete;
-
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.uima.UIMAException;
 import org.apache.uima.UIMAFramework;
 import org.apache.uima.analysis_engine.AnalysisEngine;
 import org.apache.uima.analysis_engine.AnalysisEngineDescription;
 import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
 import org.apache.uima.cas.CAS;
-import org.apache.uima.cas.admin.CASAdminException;
-import org.apache.uima.collection.CollectionException;
 import org.apache.uima.collection.CollectionReader;
 import org.apache.uima.collection.CollectionReaderDescription;
 import org.apache.uima.fit.internal.ResourceManagerFactory;
@@ -70,21 +68,13 @@ public final class SimplePipeline {
    *          Primitive AnalysisEngineDescriptions that process the CAS, in order. If you have a mix
    *          of primitive and aggregate engines, then please create the AnalysisEngines yourself
    *          and call the other runPipeline method.
-   * @throws ResourceInitializationException
-   *          if there is a problem initializing the pipeline.
+   * @throws UIMAException
+   *           if there is a problem initializing or running the CPE.
    * @throws IOException
-   *           if there is an I/O problem in the reader.
-   * @throws CASAdminException 
-   *           if there is a problem resetting the CAS.
-   * @throws CollectionException 
-   *           if there is a problem running the pipeline.
-   * @throws AnalysisEngineProcessException 
-   *           if there is a problem running the pipeline.
+   *           if there is an I/O problem in the reader
    */
   public static void runPipeline(final CollectionReader reader,
-          final AnalysisEngineDescription... descs) throws IOException,
-          ResourceInitializationException, AnalysisEngineProcessException, CollectionException,
-          CASAdminException {
+          final AnalysisEngineDescription... descs) throws UIMAException, IOException {
     // Create AAE
     final AnalysisEngineDescription aaeDesc = createEngineDescription(descs);
 
@@ -130,19 +120,13 @@ public final class SimplePipeline {
    *          Primitive AnalysisEngineDescriptions that process the CAS, in order. If you have a mix
    *          of primitive and aggregate engines, then please create the AnalysisEngines yourself
    *          and call the other runPipeline method.
-   * @throws ResourceInitializationException
-   *          if there is a problem initializing the pipeline.
+   * @throws UIMAException
+   *           if there is a problem initializing or running the CPE.
    * @throws IOException
-   *           if there is an I/O problem in the reader.
-   * @throws CASAdminException 
-   *           if there is a problem resetting the CAS.
-   * @throws CollectionException 
-   *           if there is a problem running the pipeline.
-   * @throws AnalysisEngineProcessException 
-   *           if there is a problem running the pipeline.
+   *           if there is an I/O problem in the reader
    */
   public static void runPipeline(final CollectionReaderDescription readerDesc,
-          final AnalysisEngineDescription... descs) throws IOException, ResourceInitializationException, AnalysisEngineProcessException, CollectionException, CASAdminException {
+          final AnalysisEngineDescription... descs) throws UIMAException, IOException {
     ResourceManager resMgr = ResourceManagerFactory.newResourceManager();
     
     // Create the components
@@ -190,20 +174,13 @@ public final class SimplePipeline {
    *          a collection reader
    * @param engines
    *          a sequence of analysis engines
-   * @throws ResourceInitializationException
-   *          if there is a problem initializing the pipeline.
+   * @throws UIMAException
+   *           if there is a problem initializing or running the CPE.
    * @throws IOException
-   *           if there is an I/O problem in the reader.
-   * @throws CASAdminException 
-   *           if there is a problem resetting the CAS.
-   * @throws CollectionException 
-   *           if there is a problem running the pipeline.
-   * @throws AnalysisEngineProcessException 
-   *           if there is a problem running the pipeline.
+   *           if there is an I/O problem in the reader
    */
   public static void runPipeline(final CollectionReader reader, final AnalysisEngine... engines)
-          throws IOException, ResourceInitializationException, AnalysisEngineProcessException,
-          CollectionException, CASAdminException {
+          throws UIMAException, IOException {
     final List<ResourceMetaData> metaData = new ArrayList<ResourceMetaData>();
     metaData.add(reader.getMetaData());
     for (AnalysisEngine engine : engines) {

Modified: uima/uimafit/trunk/uimafit-core/src/main/java/org/apache/uima/fit/testing/factory/TokenBuilder.java
URL: http://svn.apache.org/viewvc/uima/uimafit/trunk/uimafit-core/src/main/java/org/apache/uima/fit/testing/factory/TokenBuilder.java?rev=1721622&r1=1721621&r2=1721622&view=diff
==============================================================================
--- uima/uimafit/trunk/uimafit-core/src/main/java/org/apache/uima/fit/testing/factory/TokenBuilder.java (original)
+++ uima/uimafit/trunk/uimafit-core/src/main/java/org/apache/uima/fit/testing/factory/TokenBuilder.java Thu Dec 24 13:59:52 2015
@@ -21,6 +21,7 @@ package org.apache.uima.fit.testing.fact
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.uima.UIMAException;
 import org.apache.uima.cas.Feature;
 import org.apache.uima.fit.factory.AnnotationFactory;
 import org.apache.uima.jcas.JCas;