Github user kirklund commented on a diff in the pull request: https://github.com/apache/incubator-geode/pull/278#discussion_r86039193 --- Diff: geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateAlterDestroyRegionCommands.java --- @@ -907,6 +903,31 @@ private void validateRegionFunctionArgs(Cache cache, RegionFunctionArgs regionFu new Object[] {regionFunctionArgs.getCompressor()})); } } + + if (regionFunctionArgs.hasPartitionAttributes()) { + boolean partitionResolverFailure = false; + if (regionFunctionArgs.isPartitionResolverSet()) { + String partitionResolverClassName = regionFunctionArgs.getPartitionResolver(); + Object partitionResolver = null; + + try { + Class<?> compressorClass = + (Class<?>) ClassPathLoader.getLatest().forName(partitionResolverClassName); + partitionResolver = compressorClass.newInstance(); + } catch (InstantiationException e) { + partitionResolverFailure = true; + } catch (IllegalAccessException e) { + partitionResolverFailure = true; + } catch (ClassNotFoundException e) { + partitionResolverFailure = true; + } + if (partitionResolverFailure || !(partitionResolver instanceof PartitionResolver)) { --- End diff -- By using Class<PartitionResolver> above, you can eliminate the instanceof check here. Combine all of these changes and you end up with: ``` try { ... } catch (InstantiationException| IllegalAccessException| ClassNotFoundException e) { throw new IllegalArgumentException( CliStrings.format(CliStrings.CREATE_REGION__MSG__INVALID_PARTITION_RESOLVER, new Object[] {regionFunctionArgs.getCompressor()}), e); } ```
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---