From 1b98f38cfac2ac6caa7f178f70bcd9c5f74f16a4 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Mon, 31 Oct 2016 13:07:31 +0100 Subject: css.xml.sax.XAttributeList is broken by design In the Java interface it was reportedly copied from, getValue can return null to indicate a missing attribute, but in UNOIDL that's not possible. The workaround that implementations of the UNOIDL interface resorted to is apparently to return an empty string (another option would have been to throw an exception). But the code in xmlsecurity appears to be written under the ill assumption that getValueByName would return null for a missing attribute. What the code as written actually did check was whether the return value is an empty string (because it picks the operator ==(OUString const &, sal_Unicode const *) overload, which happens to treat a null second argument like an empty string). Ideally, the code in xmlsecurity would have some way to tell a missing attribute from an empty one (via some extended XAttributeList2, or by iterating over all getNameByIndex, or ...). But for none of the affected attributes it seems expected that the attribute's value could be an empty string, so checking for an empty string seems to work reasonably well in practice. So keep it simple and just check for an empty string properly. Thanks to Tor for spotting that odd xmlsecurity code. Change-Id: Ib068ee98ef818683a43309ab4d7c3a4731e8deff --- offapi/com/sun/star/xml/sax/XAttributeList.idl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'offapi') diff --git a/offapi/com/sun/star/xml/sax/XAttributeList.idl b/offapi/com/sun/star/xml/sax/XAttributeList.idl index 65aef1f87c60..51924375edcb 100644 --- a/offapi/com/sun/star/xml/sax/XAttributeList.idl +++ b/offapi/com/sun/star/xml/sax/XAttributeList.idl @@ -33,8 +33,10 @@ module com { module sun { module star { module xml { module sax { allow the user to make a copy of the instance.

-

This interface is an IDL version of the Java interface - org.xml.sax.AttributeList.

+

This interface is a poor IDL version of the Java interface + org.xml.sax.AttributeList. For example in getValueByName, it does + not allow to distinguish a missing value (for which the Java interface + returns null) from an empty string value.

*/ published interface XAttributeList: com::sun::star::uno::XInterface { -- cgit v1.2.3