[hibernate-dev] [HSEARCH] Question on TikaBridge

Sanne Grinovero sanne at hibernate.org
Wed Apr 2 19:27:08 EDT 2014


On 2 April 2014 19:42, Hardy Ferentschik <hardy at hibernate.org> wrote:
>
> On 2 Jan 2014, at 18:30, Emmanuel Bernard <emmanuel at hibernate.org> wrote:
>
>> Hardy,
>>
>> Today the actual bridge fails during set() if the object passed is not of a specified subset of types (Blob, etc).
>
> Right, that happens in TikaBridge#getInputStreamForData
>
>> This means the failure happens at the first indexing usage.
>
> Correct
>
>> Is that ok / preferable if I do these type checking at the bridge creation time - in the BridgeProvider.
>
> Not sure. AS you say, the problem is if you define the type as Object. Probably quite uncommon.

I'd enforce it. If a getter guarantees to provide a refined type, it
could as well make it explicit on the signature.
There is no (sane) reason to refuse fixing the signature, if you know
for sure what you're returning will be compatible. Worst case the
implementor will need to explicitly downcast, but when the CCE strikes
he'll easily see his mistake.

>> It seems like a small flexibility loss and we would gain clearer error messages: if something is annotated @TikaBridge and we don’t support the type we will fail fast.
>
> Fail fast sounds good.

+1

>
> —Hardy
>
>
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev



More information about the hibernate-dev mailing list