Knut,

Can you make a patch that does what you are talking about with the
ErrorHandler? I would like to see what you are talking about in my
environment. I'm most concerned about a typing error being very hard to
track down because the error message in misleading. We are still talking
about the case where SmartTranslator is not being used, the actual
translator being used is the ServiceTranslator, which should complain loudly
when it fails.

Richard

-----Original Message-----
From: Knut Wannheden (JIRA) [mailto:[EMAIL PROTECTED] 
Sent: Friday, May 20, 2005 4:45 PM
To: Hensley, Richard
Subject: [jira] Commented: (HIVEMIND-124) Report a proper message when a
constructor argument in BuilderFactory is invalid

     [
http://issues.apache.org/jira/browse/HIVEMIND-124?page=comments#action_65899
]
     
Knut Wannheden commented on HIVEMIND-124:
-----------------------------------------

Yes, SmartTranslator is special because HiveMind uses it as the default. But
what also makes it special, which I think is what is most relevant in this
discussion, is the fact that it uses the passed 'propertyType' argument to
decide on how to parse the 'inputValue'. I think it would be unfortunate if
the BuilderPropertyFacet treated the SmartTranslator differently, as it
would make it difficult to implement other similar translators.

I can't really think of any good reasons why the BuilderPropertyFacet should
not log the exception caught before returning false. The reason I thought it
would be better to report the error in BuilderPropertyFacet is that it can
do this using the HiveMind ErrorHandler which isn't available to the
Translator.

I don't like the idea of having the SmartTranslator return null if the value
can't be parsed. This would be inconsistent with other Translators.

I agree that the exception caught in isAssignableToType() indicates a
failure. It will result in a constructor not being applicable or a property
not being settable. Yet I think it would be appropriate to delegate this to
the ErrorHandler and return a 'false' to the client. Is there a case where
this is not such a good strategy?

> Report a proper message when a constructor argument in BuilderFactory is
invalid
>
----------------------------------------------------------------------------
----
>
>          Key: HIVEMIND-124
>          URL: http://issues.apache.org/jira/browse/HIVEMIND-124
>      Project: HiveMind
>         Type: Bug
>   Components: framework
>     Reporter: Richard Hensley
>  Attachments: patch.txt, patch_with_smarttranslator_specialcase.txt
>
> My situation is that I use constructor arguments for all my required
parameters of objects. The code inside of the BuilderFactoryLogic uses the
BuilderPropertyFactet.isAssignableFrom() method to figure out if a
particular parameter in a constructor is right. The
BuilderPropertyFactet.isAssignableFrom() eats an ApplicationRuntimeException
and returns false. This is bad when you miss-spell a service name, for
instance:
> <service>service:MyServic</service>
> When you meant,
> <service>service:MyService</service>
> The error that Hivemind throws is that it had trouble finding a valid
constructor, when the real problem was that it had problems finding your
service to even check if the constructor was valid.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to