1 Reply Latest reply: Mar 28, 2012 5:16 AM by robvarga RSS

    Entry Processor cannot return array

    925966
      Hi all,

      I implemented an EntryProcessor to return results of calculated sums, however, below exception is thrown when retrieving the result. Any idea? I tried to amend to return BigDecimal instead of BigDecimal[], it does work. Why?

      Exception in thread "main" java.lang.ClassCastException: [Ljava.lang.Object; incompatible with [Ljava.math.BigDecimal;


      BigDecimal[] results = (BigDecimal[])CacheHelper.getCounterPartyCache().invoke(new FttCntptId("052753"), new CreateOrderProcessor());

      Henry
        • 1. Re: Entry Processor cannot return array
          robvarga
          922963 wrote:
          Hi all,

          I implemented an EntryProcessor to return results of calculated sums, however, below exception is thrown when retrieving the result. Any idea? I tried to amend to return BigDecimal instead of BigDecimal[], it does work. Why?

          Exception in thread "main" java.lang.ClassCastException: [Ljava.lang.Object; incompatible with [Ljava.math.BigDecimal;


          BigDecimal[] results = (BigDecimal[])CacheHelper.getCounterPartyCache().invoke(new FttCntptId("052753"), new CreateOrderProcessor());

          Henry
          Hi Henry,

          it can return arrays, but it can't properly return typed arrays.

          At client side that array was deserialized as an Object[] and not as a BigDecimal[] and therefore it could not be cast to BigDecimal[].

          So just change the declaration of the results variable to Object[], and do the cast on the elements instead.

          Best regards,

          Robert