dev@glassfish.java.net

Re: NotNull vs Element(required=true)

From: Jerome Dochez <jerome.dochez_at_oracle.com>
Date: Mon, 19 Jul 2010 09:28:24 -0700

On 7/19/10 9:11 AM, Bobby Bissett wrote:
> What's the difference between these (in
> com.sun.enterprise.config.serverbeans.Config.java) *supposed* to be?
>
> 1)
> @Element(required=true)
> GroupManagementService getGroupManagementService();
>
> 2)
> @Element
> @NotNull
> GroupManagementService getGroupManagementService();
>
> I can try them both, but what is the difference *supposed* to be? We
> have default values for all children in the group-management-service
> element, but suddenly we're not seeing the element in domain.xml at
> all and are getting NPEs in the code. It worked until a couple days
> ago, and we didn't change anything. By "worked" I mean the element was
> present in the config element of domain.xml as
> <group-management-service/>.
we don't write out empty elements, and your group-management-service
element seem pretty empty to me...
>
> FWIW, attempt 1 above still fails. Still getting null from
> config.getGroupManagementService() and I don't see the element in
> domain.xml (does required=true do anything?).
I think @Element(required=true) does nothing. I can certainly make it
consistent with @NotNull (which was meant to be a general @NotNull
annotation, not just for config-api).
>
> Also, attempt 2 above does the same thing.
you mean you also get null when doing getGroupManagementService() after
adding @NotNull ?
> This is related to issue 12719 and we don't know what magic in
> config-api is needed to fix it besides manually adding everything in
> the create-cluster decorator and abandoning defaults/notnulls.
>
> For defaults, we have defaults and elements like this in
> com.sun.enterprise.config.serverbeans.GroupManagementService:
>
> @Attribute (defaultValue="5000")
> @Min(value=1000)
> @Max(value=120000)
> String getGroupDiscoveryTimeoutInMillis();
>
> and:
>
> @Element //(required=true)
> @NotNull
> FailureDetection getFailureDetection();
>
> FailureDetection has its own defaults that we also need.
>
> Thanks,
> Bobby
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>