Uploaded image for project: 'Spring Data GemFire'
  1. Spring Data GemFire
  2. SGF-423

Handle improper ClassCastException thrown from SDG's Function Execution interface and annotation-based support when a GemFire Function throws an Exception.

    XMLWordPrintable

    Details

      Description

      Currently, when a GemFire-defined Function is invoked using Spring Data GemFire's Function Execution Annotation support and interface-based declarations, and the GemFire Function throws an Exception and the Function has a single value return-type, a ClassCastException is thrown because SDG's Function infrastructure tries to cast the Exception to the Function Execution interface method return type.

      For instance, if I defined a Function Execution interface like so...

      @OnServer
      public interface ExceptionThrowingFunctionExecution {
      	Integer exceptionThrowingFunction();
      }
      

      And the exceptionThrowingFunction GemFire Function throws a (Runtime)Exception..

      public static class ExceptionThrowingFunction extends FunctionAdapter {
      	@Override
      	public String getId() {
      		return "exceptionThrowingFunction";
      	}
      
      	@Override
      	public void execute(final FunctionContext context) {
      		context.getResultSender().sendException(new IllegalArgumentException("TEST"));
      	}
      }
      

      Then the following error occurs in SDG's Function Execution infrastructure...

      java.lang.ClassCastException: java.lang.IllegalArgumentException cannot be cast to java.lang.Integer

        Attachments

          Activity

            People

            Assignee:
            jblum John Blum
            Reporter:
            jblum John Blum
            Last updater:
            Trevor Marshall Trevor Marshall
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Due:
              Created:
              Updated:
              Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 1d
                1d
                Remaining:
                Remaining Estimate - 1d
                1d
                Logged:
                Time Spent - Not Specified
                Not Specified