Github user robdouglas commented on a diff in the pull request:

    https://github.com/apache/incubator-streams/pull/54#discussion_r14879695
  
    --- Diff: 
streams-contrib/streams-processor-regex/src/main/java/org/apache/streams/regex/AbstractRegexExtensionExtractor.java
 ---
    @@ -56,31 +61,43 @@ public String getPattern() {
     
         @Override
         public List<StreamsDatum> process(StreamsDatum entry) {
    -        if(!(entry.getDocument() instanceof Activity)) {
    -            return Lists.newArrayList();
    -        }
    -        if(Strings.isNullOrEmpty(pattern)) {
    -            prepare(null);
    -        }
    -        Activity activity = (Activity)entry.getDocument();
    -        Map<String, List<Integer>> matches = 
RegexUtils.extractMatches(pattern, activity.getContent());
    -        Collection<T> entities = ensureTargetObject(activity);
    -        for(String key : matches.keySet()) {
    -            entities.add(prepareObject(key));
    +        try {
    +            if (!(entry.getDocument() instanceof Activity)) {
    +                return Lists.newArrayList();
    +            }
    +            if (Strings.isNullOrEmpty(pattern)) {
    +                prepare(null);
    +            }
    +            Activity activity = (Activity) entry.getDocument();
    +            Map<String, List<Integer>> matches = 
RegexUtils.extractMatches(pattern, activity.getContent());
    +            Collection<T> entities = ensureTargetObject(activity);
    +            for (String key : matches.keySet()) {
    +                entities.add(prepareObject(key));
    +            }
    +            return Lists.newArrayList(entry);
    +        } catch (Throwable e) {
    --- End diff --
    
    My thought here was to catch any exceptions at the processor level to try 
and help narrow down where the exception was thrown and what caused it. 
However, in https://github.com/apache/incubator-streams/pull/55 I catch any 
processor exceptions in the StreamsProcessorTask class, so this try/catch may 
be unnecessary now


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to