This sounds like a bug. I think the configuration should be handled as
you say. Can you create a Bugzilla entry for this and please include
your plugin descriptor if possible, otherwise a sample. And the
analysis below.
Thanks, Jay
On 2/5/2013 10:39 PM, Claudianus A wrote:
Hello -
I am replying to my own post since I was able to track down the cause
of the NPE I was getting.
Basically, what I found is that optional parameters have to have a
value. If not a NPE is thrown when the
ServerPluginDescriptorMetadataParser tries to add callback data
properties to the java.util.Properties object (line 357), because the
value for optional parameters is null. I thought I could set some
default value but there was no way to handle those in there. So for
now my workaround is to force the user to set empty string for all
optional parameter they will not be providing value for.
But I would think that we need some utility that can first go through
the value set and replace all null values by their default equivalents
if there are any before passing the ScheduleJobsConfig (or nay plugin
related configuration for that matter) to the ServerPluginManager
[lines 442 -4 44]. So this will be a ParserHelper to be used whenever
configuration values are retrieved such as on lines [231 - 245] and
then on line 256 of the ServerPluginDescriptorMetadataParser, thereby
removing the need to hard code the default values as currently done on
lines [231 - 245] referred to above. I don't know a lot about how this
would affect the APIs so I am just throwing this out there. If it is a
good idea or people have a better way of handling this they can
suggest that and If you want I can add it.
Again like I said I don't know much about the inner working of the
various APIs to know how much of an impact this would be. I just
thought that it is very inconvenient to force the user to enter value
for parameters that are optional. For example for my plugin that is 15
optional parameters that I am having the user enter empty string for.
Of course, I could try to merge some of them together by using a comma
separated list but some of the flexibility and the semantic I am
trying to provide would then be lost. Just some food for thoughts.
Anyway thank you all.
--
Claudianus
_______________________________________________
rhq-users mailing list
rhq-users(a)lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/rhq-users