Hi Joakim,
On 01/11/2007, at 9:47 AM, [EMAIL PROTECTED] wrote:
Fixing release / snapshot policies from applying tests on maven-
metadata.xml files.
Was this the addition of the filetype property - or something else as
well? Bit hard to find in the change :)
Switching from boolean return on .applyPolicy() to throwing
exception, to gain better logging of why the transfer failed.
No need to change it now, but I don't really agree with this. I don't
agree with using exceptions for non-exceptional conditions for
readability reasons - particularly just to pass a string around. IMO,
better alternatives:
1) just log in the policy check and return true/false as before
2) return an object that has a "success" flag and a "reason" string
(essentially the same as an exception, but correctly using the return
type)
getLogger().debug( "Applying [" + key + "] policy with
[" + setting + "]" );
- if ( !policy.applyPolicy( setting, request, localFile ) )
+ try
{
- getLogger().debug( "Didn't pass the [" + key + "]
policy." );
- return false;
+ policy.applyPolicy( setting, request, localFile );
+ }
+ catch ( PolicyConfigurationException e )
+ {
+ getLogger().error( e.getMessage(), e );
}
}
This is going to be very noisy if it's misconfigured - is there
anything that can test these on system configuration so we can fail
fast?
- Brett
--
Brett Porter - [EMAIL PROTECTED]
Blog: http://www.devzuz.org/blogs/bporter/