Community
Participate
Working Groups
Build Identifier: The EventHandlerWrapper currently recognizes types String and String[] for the event.topics property. It should also recognize type Collection<String> per 4.3. Reproducible: Always
Created attachment 180468 [details] Patch 1 Tests for instanceof Collection. Attempts to convert to String[]. Catches ArrayStoreException and logs issue.
Created attachment 180630 [details] Updated patch which creates proper sized array argument I updated the patch to create the argument to toArray of the proper size. This avoids creating a throw away empty array and requiring toArray to create the proper sized array with Array.newInstance.
I agree with this approach. I did it that way initially because this way left a warning (which you suppressed), and the code was in a section unlikely to present a noticeable performance hit despite the extra array creation. I wasn't comfortable with simply suppressing the warning before receiving some input. It was a close call whether or not to do it your way initially and leave the warning or the way I did it without the warning. This is actually a good reinforcement of the role of generics and the impact of erasure. When I first looked at the updated patch, I immediately wanted to wail that we needed to catch a ClassCastException instead of an ArrayStoreException before settling down. I'm going to obsolete Patch 1.
Comment on attachment 180468 [details] Patch 1 Obsolete in favor of the updated patch.
I released the updated patch from BJ (after updating copyright dates). Thanks for the contribution John, I marked your original patch for the iplog.