From 782b9f804ebb7035d570735cf1935f9845a17996 Mon Sep 17 00:00:00 2001 From: Jens-Heiner Rechtien Date: Wed, 16 Sep 2009 14:37:52 +0000 Subject: CWS-TOOLING: integrate CWS sb113 2009-09-01 sb #i76393# second attempt at properly #ifdef-ing previous HG commit d598efdbf012 2009-08-28 sb #i102469# change back to just on queryInterface, to avoid binary incompatibility (method changing its signature from (Ljava/lang/Class;Ljava/lang/Object;)Ljava/lang/Object; to (Ljava/lang/Class;Ljava/lang/Object;)Lcom/sun/star/uno/XInterface;) 2009-08-28 sb #i76393# properly #ifdef previous HG commit d598efdbf012 2009-08-27 sb #i94421# work around compiler error (based on a patch supplied by cloph) 2009-08-26 sb merged in DEV300_m56 2009-08-26 sb #i76393# on Linux, include dynamic section offset in crash report so as to be able to map "prelinked" callstacks back to original (patch by cmc) 2009-08-26 sb #i88162# remove unnecessary whitespace lines from per-locale xcu files (patch by tora) 2009-08-17 Juergen Schmidt #i104292# set context classloader after create new custom UNO loader 2009-08-17 Juergen Schmidt #i103749# integrate patch 2009-08-14 sb #i103269# cherry-picked ssh://hg@hg.services.openoffice.org/cws/sb111 -r 5124ebd5edd1 ("#i101955# changed encoding of XML file content from erroneous ISO-8859-1 to UTF-8") 2009-08-12 sb #i102469# fixed mis-applications of UnoRuntime.queryInterface (detected via the simplified UnoRuntime.queryInterface, the HG changeset 29de35fc9554) to use AnyConverter instead; changed qadevOOo's lib.MultiMethodTest.before to allow throwing arbitrary exceptions, to cater for IllegalArgumentException thrown by AnyConverter 2009-08-12 sb #i104178# drop extra libxml2-config script from libxmlsec 2009-08-10 sb #i101754# simplified osl_getProcessInfo for LINUX (patch by cmc) 2009-08-10 sb #i95018# avoid closing -1 fds (patch supplied by cmc) 2009-08-10 sb #i103585# removed (apparently unnecessary) zlib support from libxml2; in turn, removed zlib dependencies from libxmlsec, libxslt, and redland (assuming those were transitive dependencies brought in by direct dependencies on libxml2) 2009-08-10 sb #i102469# simplified UnoRuntime.queryInterface using Java 5 generics; adapted URE-related modules accordingly 2009-08-10 sb #i101213# adapted setsolar env (solenv/config/) to set PYTHONPATH (and not set PYTHONHOME) in accordance with configure env (set_soenv.in); fixed testtools/source/bridgetest/pyuno (which now should work everywhere out of the box, thanks to the fixed setsolar PYTHONPATH) 2009-08-10 sb cherry-picked ssh://hg@hg.services.openoffice.org/cws/sb111 -r ea8de6d9396b ("#i101955# work in progress for a .hgignore file, continued") --- .../com/sun/star/comp/helper/Bootstrap.java | 20 ++--- .../com/sun/star/comp/helper/ComponentContext.java | 12 +-- .../star/comp/helper/RegistryServiceFactory.java | 2 +- .../sun/star/comp/helper/SharedLibraryLoader.java | 4 +- .../comp/juhtest/SmoketestCommandEnvironment.java | 2 - .../com/sun/star/lib/uno/helper/Factory.java | 2 +- .../star/lib/uno/helper/InterfaceContainer.java | 2 +- .../com/sun/star/lib/uno/helper/PropertySet.java | 2 +- .../sun/star/lib/uno/helper/PropertySetMixin.java | 94 +++++++++++----------- 9 files changed, 67 insertions(+), 73 deletions(-) (limited to 'javaunohelper/com/sun') diff --git a/javaunohelper/com/sun/star/comp/helper/Bootstrap.java b/javaunohelper/com/sun/star/comp/helper/Bootstrap.java index a640e816f..4c30cbb55 100644 --- a/javaunohelper/com/sun/star/comp/helper/Bootstrap.java +++ b/javaunohelper/com/sun/star/comp/helper/Bootstrap.java @@ -67,7 +67,7 @@ import java.util.Random; Other services can be inserted into the service manager by using its XSet interface:
-        XSet xSet = (XSet)UnoRuntime.queryInterface( XSet.class, aMultiComponentFactory );
+        XSet xSet = UnoRuntime.queryInterface( XSet.class, aMultiComponentFactory );
         // insert the service manager
         xSet.insert( aSingleComponentFactory );
     
@@ -108,20 +108,20 @@ public class Bootstrap { static public XComponentContext createInitialComponentContext( Hashtable context_entries ) throws Exception { - XImplementationLoader xImpLoader = (XImplementationLoader)UnoRuntime.queryInterface( + XImplementationLoader xImpLoader = UnoRuntime.queryInterface( XImplementationLoader.class, new JavaLoader() ); // Get the factory of the ServiceManager - XSingleComponentFactory smgr_fac = (XSingleComponentFactory)UnoRuntime.queryInterface( + XSingleComponentFactory smgr_fac = UnoRuntime.queryInterface( XSingleComponentFactory.class, xImpLoader.activate( "com.sun.star.comp.servicemanager.ServiceManager", null, null, null ) ); // Create an instance of the ServiceManager - XMultiComponentFactory xSMgr = (XMultiComponentFactory)UnoRuntime.queryInterface( + XMultiComponentFactory xSMgr = UnoRuntime.queryInterface( XMultiComponentFactory.class, smgr_fac.createInstanceWithContext( null ) ); // post init loader - XInitialization xInit = (XInitialization)UnoRuntime.queryInterface( + XInitialization xInit = UnoRuntime.queryInterface( XInitialization.class, xImpLoader ); Object[] args = new Object [] { xSMgr }; xInit.initialize( args ); @@ -137,12 +137,12 @@ public class Bootstrap { XComponentContext xContext = new ComponentContext( context_entries, null ); // post init smgr - xInit = (XInitialization)UnoRuntime.queryInterface( + xInit = UnoRuntime.queryInterface( XInitialization.class, xSMgr ); args = new Object [] { null, xContext }; // no registry, default context xInit.initialize( args ); - XSet xSet = (XSet)UnoRuntime.queryInterface( XSet.class, xSMgr ); + XSet xSet = UnoRuntime.queryInterface( XSet.class, xSMgr ); // insert the service manager xSet.insert( smgr_fac ); // and basic jurt factories @@ -159,7 +159,7 @@ public class Bootstrap { */ static public XMultiServiceFactory createSimpleServiceManager() throws Exception { - return (XMultiServiceFactory)UnoRuntime.queryInterface( + return UnoRuntime.queryInterface( XMultiServiceFactory.class, createInitialComponentContext( null ).getServiceManager() ); } @@ -206,7 +206,7 @@ public class Bootstrap { NativeLibraryLoader.loadLibrary( Bootstrap.class.getClassLoader(), "juh" ); m_loaded_juh = true; } - return (XComponentContext)UnoRuntime.queryInterface( + return UnoRuntime.queryInterface( XComponentContext.class, cppuhelper_bootstrap( ini_file, pairs, Bootstrap.class.getClassLoader() ) ); @@ -283,7 +283,7 @@ public class Bootstrap { try { // try to connect to office Object context = xUrlResolver.resolve( sConnect ); - xContext = (XComponentContext) UnoRuntime.queryInterface( + xContext = UnoRuntime.queryInterface( XComponentContext.class, context); if ( xContext == null ) throw new BootstrapException( "no component context!" ); diff --git a/javaunohelper/com/sun/star/comp/helper/ComponentContext.java b/javaunohelper/com/sun/star/comp/helper/ComponentContext.java index 13bc4ce27..7c1ce45e3 100644 --- a/javaunohelper/com/sun/star/comp/helper/ComponentContext.java +++ b/javaunohelper/com/sun/star/comp/helper/ComponentContext.java @@ -101,7 +101,7 @@ public class ComponentContext implements XComponentContext, XComponent { o = ((ComponentContextEntry)o).m_value; } - m_xSMgr = (XMultiComponentFactory)UnoRuntime.queryInterface( + m_xSMgr = UnoRuntime.queryInterface( XMultiComponentFactory.class, o ); } if (m_xSMgr != null) @@ -114,7 +114,7 @@ public class ComponentContext implements XComponentContext, XComponent } // listen for delegate - XComponent xComp = (XComponent)UnoRuntime.queryInterface( + XComponent xComp = UnoRuntime.queryInterface( XComponent.class, m_xDelegate ); if (xComp != null) { @@ -154,7 +154,7 @@ public class ComponentContext implements XComponentContext, XComponent else { XSingleComponentFactory xCompFac = - (XSingleComponentFactory)UnoRuntime.queryInterface( + UnoRuntime.queryInterface( XSingleComponentFactory.class, entry.m_lateInit ); if (xCompFac != null) { @@ -185,7 +185,7 @@ public class ComponentContext implements XComponentContext, XComponent else // inited in the meantime { // dispose fresh service instance - XComponent xComp = (XComponent)UnoRuntime.queryInterface( + XComponent xComp = UnoRuntime.queryInterface( XComponent.class, xInstance ); if (xComp != null) { @@ -253,7 +253,7 @@ public class ComponentContext implements XComponentContext, XComponent o = ((ComponentContextEntry)o).m_value; } - XComponent xComp = (XComponent)UnoRuntime.queryInterface( XComponent.class, o ); + XComponent xComp = UnoRuntime.queryInterface( XComponent.class, o ); if (xComp != null) { if (name.equals( TDMGR_NAME )) @@ -272,7 +272,7 @@ public class ComponentContext implements XComponentContext, XComponent // smgr if (m_bDisposeSMgr) { - XComponent xComp = (XComponent)UnoRuntime.queryInterface( + XComponent xComp = UnoRuntime.queryInterface( XComponent.class, m_xSMgr ); if (xComp != null) { diff --git a/javaunohelper/com/sun/star/comp/helper/RegistryServiceFactory.java b/javaunohelper/com/sun/star/comp/helper/RegistryServiceFactory.java index 65973be62..e2187d87f 100644 --- a/javaunohelper/com/sun/star/comp/helper/RegistryServiceFactory.java +++ b/javaunohelper/com/sun/star/comp/helper/RegistryServiceFactory.java @@ -124,7 +124,7 @@ public class RegistryServiceFactory { Object obj = createRegistryServiceFactory( writeRegistryFile, readRegistryFile, readOnly, RegistryServiceFactory.class.getClassLoader() ); - return (XMultiServiceFactory) UnoRuntime.queryInterface( + return UnoRuntime.queryInterface( XMultiServiceFactory.class, obj ); } diff --git a/javaunohelper/com/sun/star/comp/helper/SharedLibraryLoader.java b/javaunohelper/com/sun/star/comp/helper/SharedLibraryLoader.java index c132ca457..8cfa52b04 100644 --- a/javaunohelper/com/sun/star/comp/helper/SharedLibraryLoader.java +++ b/javaunohelper/com/sun/star/comp/helper/SharedLibraryLoader.java @@ -85,7 +85,7 @@ public class SharedLibraryLoader { XMultiServiceFactory smgr, XRegistryKey regKey ) { - return (XSingleServiceFactory) UnoRuntime.queryInterface( + return UnoRuntime.queryInterface( XSingleServiceFactory.class, component_getFactory( DEFAULT_LIBRARY, DEFAULT_IMPLEMENTATION, smgr, regKey, @@ -110,7 +110,7 @@ public class SharedLibraryLoader { XMultiServiceFactory smgr, XRegistryKey regKey ) { - return (XSingleServiceFactory) UnoRuntime.queryInterface( + return UnoRuntime.queryInterface( XSingleServiceFactory.class, component_getFactory( libName, impName, smgr, regKey, diff --git a/javaunohelper/com/sun/star/comp/juhtest/SmoketestCommandEnvironment.java b/javaunohelper/com/sun/star/comp/juhtest/SmoketestCommandEnvironment.java index a4da54152..7cffca662 100644 --- a/javaunohelper/com/sun/star/comp/juhtest/SmoketestCommandEnvironment.java +++ b/javaunohelper/com/sun/star/comp/juhtest/SmoketestCommandEnvironment.java @@ -119,7 +119,6 @@ class InteractionImpl implements com.sun.star.task.XInteractionHandler if (approve) { com.sun.star.task.XInteractionApprove xApprove = - (com.sun.star.task.XInteractionApprove) UnoRuntime.queryInterface(com.sun.star.task.XInteractionApprove.class, conts[i]); if (xApprove != null) xApprove.select(); @@ -129,7 +128,6 @@ class InteractionImpl implements com.sun.star.task.XInteractionHandler else if (abort) { com.sun.star.task.XInteractionAbort xAbort = - (com.sun.star.task.XInteractionAbort) UnoRuntime.queryInterface(com.sun.star.task.XInteractionAbort.class, conts[i]); if (xAbort != null) xAbort.select(); diff --git a/javaunohelper/com/sun/star/lib/uno/helper/Factory.java b/javaunohelper/com/sun/star/lib/uno/helper/Factory.java index 6925046ce..8f2cd60b0 100644 --- a/javaunohelper/com/sun/star/lib/uno/helper/Factory.java +++ b/javaunohelper/com/sun/star/lib/uno/helper/Factory.java @@ -210,7 +210,7 @@ public class Factory throws com.sun.star.uno.Exception { Object inst = instantiate( xContext ); - XInitialization xInit = (XInitialization)UnoRuntime.queryInterface( + XInitialization xInit = UnoRuntime.queryInterface( XInitialization.class, inst ); if (null == xInit) { diff --git a/javaunohelper/com/sun/star/lib/uno/helper/InterfaceContainer.java b/javaunohelper/com/sun/star/lib/uno/helper/InterfaceContainer.java index 59a109ec2..2c23ebc0d 100644 --- a/javaunohelper/com/sun/star/lib/uno/helper/InterfaceContainer.java +++ b/javaunohelper/com/sun/star/lib/uno/helper/InterfaceContainer.java @@ -715,7 +715,7 @@ public class InterfaceContainer implements Cloneable try { Object o= aIt.next(); - XEventListener evtListener= (XEventListener) UnoRuntime.queryInterface( + XEventListener evtListener= UnoRuntime.queryInterface( XEventListener.class, o); if( evtListener != null ) evtListener.disposing( evt ); diff --git a/javaunohelper/com/sun/star/lib/uno/helper/PropertySet.java b/javaunohelper/com/sun/star/lib/uno/helper/PropertySet.java index edd37e4b6..bbf144e85 100644 --- a/javaunohelper/com/sun/star/lib/uno/helper/PropertySet.java +++ b/javaunohelper/com/sun/star/lib/uno/helper/PropertySet.java @@ -671,7 +671,7 @@ XMultiPropertySet // We try to get an XInterface of setVal and set an XInterface type. if (setVal instanceof XInterface) { - XInterface xint= (XInterface) UnoRuntime.queryInterface(XInterface.class, setVal); + XInterface xint= UnoRuntime.queryInterface(XInterface.class, setVal); if (xint != null) convObj= new Any(new Type(XInterface.class), xint); } diff --git a/javaunohelper/com/sun/star/lib/uno/helper/PropertySetMixin.java b/javaunohelper/com/sun/star/lib/uno/helper/PropertySetMixin.java index a8b0eb23d..70615b612 100644 --- a/javaunohelper/com/sun/star/lib/uno/helper/PropertySetMixin.java +++ b/javaunohelper/com/sun/star/lib/uno/helper/PropertySetMixin.java @@ -143,13 +143,13 @@ public final class PropertySetMixin { idlClass = getReflection(type.getTypeName()); XTypeDescription ifc; try { - ifc = (XTypeDescription) UnoRuntime.queryInterface( + ifc = UnoRuntime.queryInterface( XTypeDescription.class, - (((XHierarchicalNameAccess) UnoRuntime.queryInterface( - XHierarchicalNameAccess.class, - context.getValueByName( - "/singletons/com.sun.star.reflection." - + "theTypeDescriptionManager"))). + (UnoRuntime.queryInterface( + XHierarchicalNameAccess.class, + context.getValueByName( + "/singletons/com.sun.star.reflection." + + "theTypeDescriptionManager")). getByHierarchicalName(type.getTypeName()))); } catch (NoSuchElementException e) { throw new RuntimeException( @@ -585,7 +585,7 @@ public final class PropertySetMixin { private XIdlClass getReflection(String typeName) { XIdlReflection refl; try { - refl = (XIdlReflection) UnoRuntime.queryInterface( + refl = UnoRuntime.queryInterface( XIdlReflection.class, context.getServiceManager().createInstanceWithContext( "com.sun.star.reflection.CoreReflection", context)); @@ -599,8 +599,7 @@ public final class PropertySetMixin { try { return refl.forName(typeName); } finally { - XComponent comp = (XComponent) UnoRuntime.queryInterface( - XComponent.class, refl); + XComponent comp = UnoRuntime.queryInterface(XComponent.class, refl); if (comp != null) { comp.dispose(); } @@ -610,9 +609,8 @@ public final class PropertySetMixin { private void initProperties( XTypeDescription type, HashMap map, ArrayList handleNames, HashSet seen) { - XInterfaceTypeDescription2 ifc = (XInterfaceTypeDescription2) - UnoRuntime.queryInterface( - XInterfaceTypeDescription2.class, resolveTypedefs(type)); + XInterfaceTypeDescription2 ifc = UnoRuntime.queryInterface( + XInterfaceTypeDescription2.class, resolveTypedefs(type)); if (seen.add(ifc.getName())) { XTypeDescription[] bases = ifc.getBaseTypes(); for (int i = 0; i < bases.length; ++i) { @@ -622,11 +620,10 @@ public final class PropertySetMixin { for (int i = 0; i < members.length; ++i) { if (members[i].getTypeClass() == TypeClass.INTERFACE_ATTRIBUTE) { - XInterfaceAttributeTypeDescription2 attr - = ((XInterfaceAttributeTypeDescription2) - UnoRuntime.queryInterface( - XInterfaceAttributeTypeDescription2.class, - members[i])); + XInterfaceAttributeTypeDescription2 attr = + UnoRuntime.queryInterface( + XInterfaceAttributeTypeDescription2.class, + members[i]); short attrAttribs = 0; if (attr.isBound()) { attrAttribs |= PropertyAttribute.BOUND; @@ -685,7 +682,7 @@ public final class PropertySetMixin { break; } attrAttribs |= n; - t = ((XStructTypeDescription) UnoRuntime.queryInterface( + t = (UnoRuntime.queryInterface( XStructTypeDescription.class, t)). getTypeArguments()[0]; } @@ -747,14 +744,14 @@ public final class PropertySetMixin { object, illegalArgumentPosition); } - XIdlField2 f = (XIdlField2) UnoRuntime.queryInterface( + XIdlField2 f = UnoRuntime.queryInterface( XIdlField2.class, idlClass.getField(name)); Object[] o = new Object[] { new Any(type, UnoRuntime.queryInterface(type, object)) }; Object v = wrapValue( value, - ((XIdlField2) UnoRuntime.queryInterface( - XIdlField2.class, idlClass.getField(name))).getType(), + UnoRuntime.queryInterface( + XIdlField2.class, idlClass.getField(name)).getType(), (p.property.Attributes & PropertyAttribute.MAYBEAMBIGUOUS) != 0, isAmbiguous, (p.property.Attributes & PropertyAttribute.MAYBEDEFAULT) != 0, @@ -807,7 +804,7 @@ public final class PropertySetMixin { if (p == null) { throw new UnknownPropertyException(name, object); } - XIdlField2 field = (XIdlField2) UnoRuntime.queryInterface( + XIdlField2 field = UnoRuntime.queryInterface( XIdlField2.class, idlClass.getField(name)); Object value; try { @@ -848,12 +845,12 @@ public final class PropertySetMixin { XIdlClass ambiguous = getReflection(typeName); try { isAmbiguous = AnyConverter.toBoolean( - ((XIdlField2) UnoRuntime.queryInterface( + UnoRuntime.queryInterface( XIdlField2.class, - ambiguous.getField("IsAmbiguous"))).get(value)); - value = ((XIdlField2) UnoRuntime.queryInterface( - XIdlField2.class, - ambiguous.getField("Value"))).get(value); + ambiguous.getField("IsAmbiguous")).get(value)); + value = UnoRuntime.queryInterface( + XIdlField2.class, + ambiguous.getField("Value")).get(value); } catch (com.sun.star.lang.IllegalArgumentException e) { throw new RuntimeException( "unexpected" @@ -867,12 +864,12 @@ public final class PropertySetMixin { XIdlClass defaulted = getReflection(typeName); try { isDefaulted = AnyConverter.toBoolean( - ((XIdlField2) UnoRuntime.queryInterface( + UnoRuntime.queryInterface( XIdlField2.class, - defaulted.getField("IsDefaulted"))).get(value)); - value = ((XIdlField2) UnoRuntime.queryInterface( - XIdlField2.class, - defaulted.getField("Value"))).get(value); + defaulted.getField("IsDefaulted")).get(value)); + value = UnoRuntime.queryInterface( + XIdlField2.class, + defaulted.getField("Value")).get(value); } catch (com.sun.star.lang.IllegalArgumentException e) { throw new RuntimeException( "unexpected" @@ -886,16 +883,16 @@ public final class PropertySetMixin { XIdlClass optional = getReflection(typeName); try { boolean present = AnyConverter.toBoolean( - ((XIdlField2) UnoRuntime.queryInterface( + UnoRuntime.queryInterface( XIdlField2.class, - optional.getField("IsPresent"))).get(value)); + optional.getField("IsPresent")).get(value)); if (!present) { value = Any.VOID; break; } - value = ((XIdlField2) UnoRuntime.queryInterface( - XIdlField2.class, - optional.getField("Value"))).get(value); + value = UnoRuntime.queryInterface( + XIdlField2.class, + optional.getField("Value")).get(value); } catch (com.sun.star.lang.IllegalArgumentException e) { throw new RuntimeException( "unexpected" @@ -932,15 +929,15 @@ public final class PropertySetMixin { Object[] strct = new Object[1]; type.createObject(strct); try { - XIdlField2 field = (XIdlField2) UnoRuntime.queryInterface( + XIdlField2 field = UnoRuntime.queryInterface( XIdlField2.class, type.getField("Value")); field.set( strct, wrapValue( value, field.getType(), false, false, wrapDefaulted, isDefaulted, wrapOptional)); - ((XIdlField2) UnoRuntime.queryInterface( - XIdlField2.class, type.getField("IsAmbiguous"))).set( + UnoRuntime.queryInterface( + XIdlField2.class, type.getField("IsAmbiguous")).set( strct, new Boolean(isAmbiguous)); } catch (com.sun.star.lang.IllegalArgumentException e) { throw new RuntimeException( @@ -959,15 +956,15 @@ public final class PropertySetMixin { Object[] strct = new Object[1]; type.createObject(strct); try { - XIdlField2 field = (XIdlField2) UnoRuntime.queryInterface( + XIdlField2 field = UnoRuntime.queryInterface( XIdlField2.class, type.getField("Value")); field.set( strct, wrapValue( value, field.getType(), wrapAmbiguous, isAmbiguous, false, false, wrapOptional)); - ((XIdlField2) UnoRuntime.queryInterface( - XIdlField2.class, type.getField("IsDefaulted"))).set( + UnoRuntime.queryInterface( + XIdlField2.class, type.getField("IsDefaulted")).set( strct, new Boolean(isDefaulted)); } catch (com.sun.star.lang.IllegalArgumentException e) { throw new RuntimeException( @@ -986,11 +983,11 @@ public final class PropertySetMixin { type.createObject(strct); boolean present = !AnyConverter.isVoid(value); try { - ((XIdlField2) UnoRuntime.queryInterface( - XIdlField2.class, type.getField("IsPresent"))).set( + UnoRuntime.queryInterface( + XIdlField2.class, type.getField("IsPresent")).set( strct, new Boolean(present)); if (present) { - XIdlField2 field = (XIdlField2) UnoRuntime.queryInterface( + XIdlField2 field = UnoRuntime.queryInterface( XIdlField2.class, type.getField("Value")); field.set( strct, @@ -1018,9 +1015,8 @@ public final class PropertySetMixin { private static XTypeDescription resolveTypedefs(XTypeDescription type) { while (type.getTypeClass() == TypeClass.TYPEDEF) { - type = ((XIndirectTypeDescription) UnoRuntime.queryInterface( - XIndirectTypeDescription.class, type)). - getReferencedType(); + type = UnoRuntime.queryInterface( + XIndirectTypeDescription.class, type).getReferencedType(); } return type; } -- cgit v1.2.3