XStream
  1. XStream
  2. XSTR-423

CGLIBEnhancedConverter "only one CAllback is registered"

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.2.2
    • Fix Version/s: 1.3.1
    • Component/s: Converters
    • Labels:
      None

      Description

      According to the api for CGLIBEnhancedConverter, this converter can only be used if "only one CAllback is registered". The code to check this condition is actually incorrect:

      line 84:
      if (callbacks.length > 1) {

      it should be:

      if (Arrays.asList(callbacks).size() > 1){

      This makes the code break with Hibernate proxies, even though it shouldn't.

      1. 423.patch
        0.8 kB
        Jerry Shea
      2. XSTR-423.patch
        0.9 kB
        Jerry Shea

        Issue Links

          Activity

          Hide
          Kasra Rasaee added a comment -

          Any updates on this issue? my investigation brought me to the same conclusion, there are two
          callbacks registered but one of them is a null, can't we simply ignore nulls?

          Can't NoOp.class also be considered ignorable?

          Any news on when we can expect this to be resolved?

          Thanks,

          Kaz-

          Show
          Kasra Rasaee added a comment - Any updates on this issue? my investigation brought me to the same conclusion, there are two callbacks registered but one of them is a null, can't we simply ignore nulls? Can't NoOp.class also be considered ignorable? Any news on when we can expect this to be resolved? Thanks, Kaz-
          Hide
          Frank Adcock added a comment -

          This also affects version 1.3

          Show
          Frank Adcock added a comment - This also affects version 1.3
          Hide
          Jerry Shea added a comment -

          I've just applied the change to my local version of xstream 1.2.2 which solves the problem for me. I've attached a patch in the hope of helping move this along. Cheers

          Show
          Jerry Shea added a comment - I've just applied the change to my local version of xstream 1.2.2 which solves the problem for me. I've attached a patch in the hope of helping move this along. Cheers
          Hide
          Jörg Schaible added a comment -

          CGLIB enhanced proxies with multiple callbacks are now supported if the proxy uses a factory (CGLIB default).

          Show
          Jörg Schaible added a comment - CGLIB enhanced proxies with multiple callbacks are now supported if the proxy uses a factory (CGLIB default).
          Hide
          Jerry Shea added a comment -

          This is still a problem in 1.3.1. The fix is really simple: in getCallbacks(), just check that the callback's value is not null before adding it to the list to return. See attached patch (valid against 1.3.1 or trunk)

          Show
          Jerry Shea added a comment - This is still a problem in 1.3.1. The fix is really simple: in getCallbacks(), just check that the callback's value is not null before adding it to the list to return. See attached patch (valid against 1.3.1 or trunk)

            People

            • Assignee:
              Jörg Schaible
              Reporter:
              Michael Leiseca
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: