You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by tw...@apache.org on 2009/06/16 18:15:44 UTC
svn commit: r785276 - in
/incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src:
main/java/org/apache/uima/annotator/regex/impl/
main/resources/org/apache/uima/annotator/regex/
test/java/org/apache/uima/annotator/regex/ test/resources/conceptFile...
Author: twgoetz
Date: Tue Jun 16 16:15:44 2009
New Revision: 785276
URL: http://svn.apache.org/viewvc?rev=785276&view=rev
Log:
Jira UIMA-1385: close concept file input stream after reading. Add test case.
https://issues.apache.org/jira/browse/UIMA-1385
Added:
incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/test/resources/conceptFileLocking/
incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/test/resources/conceptFileLocking/repeat.xml
incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/test/resources/conceptFileLocking/repeatDescriptor.xml
Modified:
incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/main/java/org/apache/uima/annotator/regex/impl/RegExAnnotator.java
incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/main/resources/org/apache/uima/annotator/regex/regexMessages.properties
incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/test/java/org/apache/uima/annotator/regex/TestEmptyRegex.java
Modified: incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/main/java/org/apache/uima/annotator/regex/impl/RegExAnnotator.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/main/java/org/apache/uima/annotator/regex/impl/RegExAnnotator.java?rev=785276&r1=785275&r2=785276&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/main/java/org/apache/uima/annotator/regex/impl/RegExAnnotator.java (original)
+++ incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/main/java/org/apache/uima/annotator/regex/impl/RegExAnnotator.java Tue Jun 16 16:15:44 2009
@@ -23,6 +23,7 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
+import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.text.NumberFormat;
@@ -137,6 +138,13 @@
// parse concept file to internal objects
Concept[] currentConcepts = parser.parseConceptFile(file
.getFilePath(), file.getStream());
+ try {
+ file.getStream().close();
+ } catch (IOException e) {
+ this.logger.logrb(Level.WARNING, "RegExAnnotator", "initialize",
+ MESSAGE_DIGEST, "regex_annotator_error_closing_input_stream",
+ new Object[] { file.getFilePath(), e.getMessage() });
+ }
// add all concepts to the concepts list
for (int c = 0; c < currentConcepts.length; c++) {
concepts.add(currentConcepts[c]);
Modified: incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/main/resources/org/apache/uima/annotator/regex/regexMessages.properties
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/main/resources/org/apache/uima/annotator/regex/regexMessages.properties?rev=785276&r1=785275&r2=785276&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/main/resources/org/apache/uima/annotator/regex/regexMessages.properties (original)
+++ incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/main/resources/org/apache/uima/annotator/regex/regexMessages.properties Tue Jun 16 16:15:44 2009
@@ -17,6 +17,7 @@
#
regex_annotator_resource_not_found = "The resource file {0} could not be found."
regex_annotator_rule_set_file = "The concept file {0} is used to configure the annotator."
+regex_annotator_error_closing_input_stream = "Unexpected error closing concept file input stream on {0}: {1}."
regex_annotator_error_parsing_rule_set_file = "Error while parsing the concept file {0}."
regex_annotator_error_xml_validation = "XML validation errors while parsing the concept file {0}: {1}."
regex_annotator_error_resolving_types = "Error resolving type {0} from UIMA type system."
Modified: incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/test/java/org/apache/uima/annotator/regex/TestEmptyRegex.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/test/java/org/apache/uima/annotator/regex/TestEmptyRegex.java?rev=785276&r1=785275&r2=785276&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/test/java/org/apache/uima/annotator/regex/TestEmptyRegex.java (original)
+++ incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/test/java/org/apache/uima/annotator/regex/TestEmptyRegex.java Tue Jun 16 16:15:44 2009
@@ -18,8 +18,6 @@
*/
package org.apache.uima.annotator.regex;
-import java.io.File;
-
import junit.framework.TestCase;
import org.apache.uima.cas.CAS;
Added: incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/test/resources/conceptFileLocking/repeat.xml
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/test/resources/conceptFileLocking/repeat.xml?rev=785276&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/test/resources/conceptFileLocking/repeat.xml (added)
+++ incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/test/resources/conceptFileLocking/repeat.xml Tue Jun 16 16:15:44 2009
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+ <!--
+ * Licensed to the Apache Software Foundation (ASF) under one * or more
+ contributor license agreements. See the NOTICE file * distributed with
+ this work for additional information * regarding copyright ownership.
+ The ASF licenses this file * to you under the Apache License, Version
+ 2.0 (the * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at * *
+ http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by
+ applicable law or agreed to in writing, * software distributed under
+ the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES
+ OR CONDITIONS OF ANY * KIND, either express or implied. See the
+ License for the * specific language governing permissions and
+ limitations * under the License.
+ -->
+<conceptSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://incubator.apache.org/uima/regex">
+ <concept name="annotationCreationTest">
+ <rules>
+ <rule ruleId="TestID" regEx="a+" matchStrategy="matchAll"
+ matchType="uima.tcas.DocumentAnnotation" />
+ </rules>
+ <createAnnotations>
+ <annotation id="Test1" type="org.apache.uima.TestAnnot">
+ <begin group="0" />
+ <end group="0" />
+ </annotation>
+ </createAnnotations>
+ </concept>
+</conceptSet>
Added: incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/test/resources/conceptFileLocking/repeatDescriptor.xml
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/test/resources/conceptFileLocking/repeatDescriptor.xml?rev=785276&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/test/resources/conceptFileLocking/repeatDescriptor.xml (added)
+++ incubator/uima/sandbox/trunk/RegularExpressionAnnotator/src/test/resources/conceptFileLocking/repeatDescriptor.xml Tue Jun 16 16:15:44 2009
@@ -0,0 +1,157 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<analysisEngineDescription xmlns="http://uima.apache.org/resourceSpecifier">
+ <frameworkImplementation>org.apache.uima.java</frameworkImplementation>
+ <primitive>true</primitive>
+ <annotatorImplementationName>org.apache.uima.annotator.regex.impl.RegExAnnotator</annotatorImplementationName>
+ <analysisEngineMetaData>
+ <name>RegExAnnotator</name>
+ <description>Matches regular expressions in document text.</description>
+ <configurationParameters>
+
+ <configurationParameter>
+ <name>ConceptFiles</name>
+ <description>list of concept files to configure the annotator
+ </description>
+ <type>String</type>
+ <multiValued>true</multiValued>
+ <mandatory>true</mandatory>
+ </configurationParameter>
+
+ </configurationParameters>
+
+ <configurationParameterSettings>
+
+ <nameValuePair>
+ <name>ConceptFiles</name>
+ <value>
+ <array>
+ <string>conceptFileLocking/repeat.xml</string>
+ </array>
+ </value>
+ </nameValuePair>
+
+ </configurationParameterSettings>
+ <typeSystemDescription>
+ <types>
+ <typeDescription>
+ <name>org.apache.uima.TestAnnot</name>
+ <description/>
+ <supertypeName>uima.tcas.Annotation</supertypeName>
+ <features>
+ <featureDescription>
+ <name>testFeature</name>
+ <description/>
+ <rangeTypeName>uima.cas.String</rangeTypeName>
+ </featureDescription>
+ <featureDescription>
+ <name>testFeature1</name>
+ <description/>
+ <rangeTypeName>uima.cas.String</rangeTypeName>
+ </featureDescription>
+ </features>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.TestAnnot1</name>
+ <description/>
+ <supertypeName>uima.tcas.Annotation</supertypeName>
+ <features>
+ <featureDescription>
+ <name>testFeature</name>
+ <description/>
+ <rangeTypeName>uima.cas.String</rangeTypeName>
+ </featureDescription>
+ <featureDescription>
+ <name>testFeature1</name>
+ <description/>
+ <rangeTypeName>uima.cas.String</rangeTypeName>
+ </featureDescription>
+ </features>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.TestAnnot2</name>
+ <description/>
+ <supertypeName>uima.tcas.Annotation</supertypeName>
+ <features>
+ <featureDescription>
+ <name>testFeature</name>
+ <description/>
+ <rangeTypeName>uima.cas.String</rangeTypeName>
+ </featureDescription>
+ <featureDescription>
+ <name>testFeature1</name>
+ <description/>
+ <rangeTypeName>uima.cas.String</rangeTypeName>
+ </featureDescription>
+ </features>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.TestAnnot3</name>
+ <description/>
+ <supertypeName>uima.tcas.Annotation</supertypeName>
+ <features>
+ <featureDescription>
+ <name>testFeature</name>
+ <description/>
+ <rangeTypeName>uima.cas.String</rangeTypeName>
+ </featureDescription>
+ <featureDescription>
+ <name>testFeature1</name>
+ <description/>
+ <rangeTypeName>uima.cas.String</rangeTypeName>
+ </featureDescription>
+ </features>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.TestAnnot4</name>
+ <description/>
+ <supertypeName>uima.tcas.Annotation</supertypeName>
+ <features>
+ </features>
+ </typeDescription>
+
+ </types>
+ </typeSystemDescription>
+
+ <typePriorities>
+ <priorityList>
+ <type>org.apache.uima.TestAnnot</type>
+ <type>org.apache.uima.TestAnnot1</type>
+ <type>org.apache.uima.TestAnnot2</type>
+ <type>org.apache.uima.TestAnnot3</type>
+ <type>org.apache.uima.TestAnnot4</type>
+ </priorityList>
+ </typePriorities>
+
+ <capabilities>
+ <capability>
+ <inputs/>
+ <outputs/>
+ <languagesSupported/>
+ </capability>
+ </capabilities>
+ <operationalProperties>
+ <modifiesCas>true</modifiesCas>
+ <multipleDeploymentAllowed>true</multipleDeploymentAllowed>
+ <outputsNewCASes>false</outputsNewCASes>
+ </operationalProperties>
+ </analysisEngineMetaData>
+
+</analysisEngineDescription>