You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opennlp.apache.org by jo...@apache.org on 2012/03/12 14:29:31 UTC
svn commit: r1299670 -
/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/sentdetect/SentenceContentProvider.java
Author: joern
Date: Mon Mar 12 13:29:30 2012
New Revision: 1299670
URL: http://svn.apache.org/viewvc?rev=1299670&view=rev
Log:
OPENNLP-462 Fixed NPE when no exclusion types are specified.
Modified:
opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/sentdetect/SentenceContentProvider.java
Modified: opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/sentdetect/SentenceContentProvider.java
URL: http://svn.apache.org/viewvc/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/sentdetect/SentenceContentProvider.java?rev=1299670&r1=1299669&r2=1299670&view=diff
==============================================================================
--- opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/sentdetect/SentenceContentProvider.java (original)
+++ opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/sentdetect/SentenceContentProvider.java Mon Mar 12 13:29:30 2012
@@ -235,6 +235,10 @@ public class SentenceContentProvider imp
String exclusionSpanTypeNames = store.getString(OpenNLPPreferenceConstants.SENT_EXCLUSION_TYPE);
Type exclusionSpanTypes[] = UIMAUtil.splitTypes(exclusionSpanTypeNames, ',', cas.getTypeSystem());
+
+ if (exclusionSpanTypes == null) {
+ exclusionSpanTypes = new Type[0];
+ }
if (Arrays.binarySearch(exclusionSpanTypes, sentenceType) == -1) {
exclusionSpanTypes = Arrays.copyOf(exclusionSpanTypes, exclusionSpanTypes.length + 1);
@@ -243,13 +247,11 @@ public class SentenceContentProvider imp
List<Span> exclusionSpans = new ArrayList<Span>();
- if (exclusionSpanTypes != null) {
- for (Iterator<AnnotationFS> exclusionAnnIterator = UIMAUtil.createMultiTypeIterator(cas, exclusionSpanTypes);
- exclusionAnnIterator.hasNext();) {
-
- AnnotationFS exclusionAnnotation = exclusionAnnIterator.next();
- exclusionSpans.add(new Span(exclusionAnnotation.getBegin(), exclusionAnnotation.getEnd()));
- }
+ for (Iterator<AnnotationFS> exclusionAnnIterator = UIMAUtil.createMultiTypeIterator(cas, exclusionSpanTypes);
+ exclusionAnnIterator.hasNext();) {
+
+ AnnotationFS exclusionAnnotation = exclusionAnnIterator.next();
+ exclusionSpans.add(new Span(exclusionAnnotation.getBegin(), exclusionAnnotation.getEnd()));
}
sentenceDetector.setExclusionSpans(exclusionSpans);