Thank you, Nick. Will open trivial issue and fix. -----Original Message----- From: Nick Burch [mailto:apa...@gagravarr.org] Sent: Tuesday, May 20, 2014 5:27 PM To: dev@tika.apache.org Subject: Re: Property type closed choice
On Tue, 20 May 2014, Allison, Timothy B. wrote: > When I run this: > Property attach = TikaCoreProperties.EMBEDDED_RESOURCE_TYPE; > Metadata m = new Metadata(); > m.add(attach, "blah"); > m.set(attach, "blah"); > > I don't get an exception. Should metadata be throwing an exception when > a user tries to set a value that isn't in the closed set? IIRC, the idea was that Metadata.set(String, String) would trust you to be doing the right thing, while Metadata.set(Property, TypedValueOfSorts) would sanity check what you asked of it For example, if you look at the code for Metadata.set(Property,int) you'll see the sanity check logic + exception throwing So, I'd say that if Metadata.set(Property, TypedValueOfSorts) with an invalid value isn't triggering an exception, then that's a bug. set(String,String) would be a different matter however Nick