This is not invalid for me and there is definitely something very wrong in the way XWiki#copyDocument works: it seems the parameters are interpreted as "the source with the provided locale is copied to the target without locale" which I really doubt is how anyone would expect it to behave (but the javadoc is not really helping settle this as it's not very explicit...). It was definitely obvious to me that the locale was supposed to apply to both the source and the target.
It's easy to fix, the only question is: does anyone really expect the current behavior ? In which case it would be a huge breakage.
I'm tempted to just deprecated all the XWiki#copyDocument methods which take a locale (i.e. not touch them to be extra safe) and make public ones with reference but no locale parameter to simply pass references with locale in them to be very explicit (need to introduce this in the api.XWiki since it does not have it right now). |
|