Uploaded image for project: 'Felix'
  1. Felix
  2. FELIX-5637

[gogo][runtime] Error throwns by commands are swallowed and lost

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: gogo.runtime-1.0.8
    • Component/s: Gogo Runtime
    • Labels:
      None

      Description

      diff --git a/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/CommandProcessorImpl.java b/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/CommandProcessorImpl.java
      index 451a1c8f0..b227d72c5 100644
      --- a/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/CommandProcessorImpl.java
      +++ b/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/CommandProcessorImpl.java
      @@ -23,6 +23,7 @@ import java.io.OutputStream;
       import java.lang.reflect.Method;
       import java.util.Collections;
       import java.util.LinkedHashMap;
      +import java.util.List;
       import java.util.Map;
       import java.util.Map.Entry;
       import java.util.Set;
      @@ -147,6 +148,18 @@ public class CommandProcessorImpl implements CommandProcessor
               String cfunction = name.substring(colon);
               boolean anyScope = (colon == 1 && name.charAt(0) == '*');
       
      +        // HACK: testing errors
      +        System.out.println("NAME: " + name);
      +        if (name.equals("*:error")) {
      +            return new Function() {
      +                @Override
      +                public Object execute(CommandSession session, List<Object> arguments) throws Exception {
      +                    System.out.println("THROWING ERROR");
      +                    throw new Error("OOPS");
      +                }
      +            };
      +        }
      +
               Map<Object, Integer> cmdMap = commands.get(name);
       
               if (null == cmdMap && anyScope)
      

      and then in the jline3 demo:

      g! error                                                                                                                                                                                                                                                                                              14:27:05
      NAME: *:error
      THROWING ERROR
      g! 
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                gnodet Guillaume Nodet
                Reporter:
                gnodet Guillaume Nodet
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: