summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2009-09-16 14:37:52 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2009-09-16 14:37:52 +0000
commitc7788533a2565593405e55b617d09425e08ef439 (patch)
tree3f5e079ea8633edfe8fd37ec9a6fe40a0a4f952f
parent36fc972942594e186e6924bfc1568bfb0096733e (diff)
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 <T extends XInterface> to just <T> 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")
-rw-r--r--bridges/source/cpp_uno/gcc3_macosx_powerpc/uno2cpp.cxx3
-rw-r--r--bridges/test/com/sun/star/lib/TestBed.java4
-rw-r--r--bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug107753_Test.java14
-rw-r--r--bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug108825_Test.java2
-rw-r--r--bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug110892_Test.java2
-rw-r--r--bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug111153_Test.java2
-rw-r--r--bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug51323_Test.java2
-rw-r--r--bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug92174_Test.java2
-rw-r--r--bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug97697_Test.java2
-rw-r--r--bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug98508_Test.java2
-rwxr-xr-xbridges/test/com/sun/star/lib/uno/bridges/java_remote/MethodIdTest.java2
-rw-r--r--bridges/test/com/sun/star/lib/uno/bridges/java_remote/PolyStructTest.java2
-rw-r--r--bridges/test/com/sun/star/lib/uno/bridges/java_remote/StopMessageDispatcherTest.java2
-rw-r--r--bridges/test/java_uno/acquire/TestAcquire.java4
-rw-r--r--bridges/test/java_uno/any/TestRemote.java2
-rw-r--r--bridges/test/java_uno/equals/TestEquals.java40
-rw-r--r--bridges/test/java_uno/nativethreadpool/Relay.java2
-rw-r--r--bridges/test/testclient.java4
-rwxr-xr-xcpputools/source/regcomplazy/regcomplazy.cxx2
-rw-r--r--javaunohelper/com/sun/star/comp/helper/Bootstrap.java20
-rw-r--r--javaunohelper/com/sun/star/comp/helper/ComponentContext.java12
-rw-r--r--javaunohelper/com/sun/star/comp/helper/RegistryServiceFactory.java2
-rw-r--r--javaunohelper/com/sun/star/comp/helper/SharedLibraryLoader.java4
-rw-r--r--javaunohelper/com/sun/star/comp/juhtest/SmoketestCommandEnvironment.java2
-rw-r--r--javaunohelper/com/sun/star/lib/uno/helper/Factory.java2
-rw-r--r--javaunohelper/com/sun/star/lib/uno/helper/InterfaceContainer.java2
-rw-r--r--javaunohelper/com/sun/star/lib/uno/helper/PropertySet.java2
-rw-r--r--javaunohelper/com/sun/star/lib/uno/helper/PropertySetMixin.java94
-rw-r--r--javaunohelper/test/com/sun/star/comp/helper/Bootstrap_Test.java4
-rw-r--r--javaunohelper/test/com/sun/star/comp/helper/ComponentContext_Test.java2
-rw-r--r--javaunohelper/test/com/sun/star/comp/helper/SharedLibraryLoader_Test.java10
-rw-r--r--javaunohelper/test/com/sun/star/lib/uno/helper/ComponentBase_Test.java6
-rw-r--r--javaunohelper/test/com/sun/star/lib/uno/helper/Factory_Test.java8
-rw-r--r--jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java8
-rw-r--r--jurt/com/sun/star/comp/loader/FactoryHelper.java4
-rw-r--r--jurt/com/sun/star/comp/loader/JavaLoader.java2
-rw-r--r--jurt/com/sun/star/comp/servicemanager/ServiceManager.java18
-rw-r--r--jurt/com/sun/star/comp/urlresolver/UrlResolver.java4
-rw-r--r--jurt/com/sun/star/uno/WeakReference.java4
-rw-r--r--jurt/demo/com/sun/star/demo/DemoServer.java4
-rw-r--r--jurt/demo/com/sun/star/demo/TestOffice.java18
-rw-r--r--jurt/test/com/sun/star/comp/bridgefactory/BridgeFactory_Test.java4
-rw-r--r--jurt/test/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge_Test.java6
-rw-r--r--jurt/workbench/com/sun/star/comp/urlresolver/UrlResolver_Test.java6
-rw-r--r--ridljar/com/sun/star/uno/UnoRuntime.java5
-rw-r--r--ridljar/test/com/sun/star/uno/UnoRuntime_Test.java8
-rw-r--r--sal/osl/unx/process.c173
-rw-r--r--sal/osl/unx/signal.c92
-rw-r--r--ure/source/uretest/JavaClient.java10
49 files changed, 341 insertions, 290 deletions
diff --git a/bridges/source/cpp_uno/gcc3_macosx_powerpc/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_macosx_powerpc/uno2cpp.cxx
index 0f0fdbf351ca..e3f4d36e3962 100644
--- a/bridges/source/cpp_uno/gcc3_macosx_powerpc/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_macosx_powerpc/uno2cpp.cxx
@@ -110,6 +110,9 @@ static void callVirtualMethod(
/* set up a pointer to the stack parameter area */
__asm__ ( "addi %0,r1,24" : "=r" (p) : /* no inputs */ );
+ // #i94421#, work around compiler error:
+ volatile long * pCopy = p;
+ (void) pCopy; // avoid warning about unused variable
// never called
// if (! pAdjustedThisPtr )CPPU_CURRENT_NAMESPACE::dummy_can_throw_anything("xxx"); // address something
diff --git a/bridges/test/com/sun/star/lib/TestBed.java b/bridges/test/com/sun/star/lib/TestBed.java
index 7242b56438f0..5e2c5e7859c8 100644
--- a/bridges/test/com/sun/star/lib/TestBed.java
+++ b/bridges/test/com/sun/star/lib/TestBed.java
@@ -130,7 +130,7 @@ public final class TestBed {
throws com.sun.star.uno.Exception
{
XConnector connector = Connector.create(context);
- XBridgeFactory factory = (XBridgeFactory) UnoRuntime.queryInterface(
+ XBridgeFactory factory = UnoRuntime.queryInterface(
XBridgeFactory.class,
context.getServiceManager().createInstanceWithContext(
"com.sun.star.bridge.BridgeFactory", context));
@@ -169,7 +169,7 @@ public final class TestBed {
= Bootstrap.createInitialComponentContext(null);
XAcceptor acceptor = Acceptor.create(context);
XBridgeFactory factory
- = (XBridgeFactory) UnoRuntime.queryInterface(
+ = UnoRuntime.queryInterface(
XBridgeFactory.class,
context.getServiceManager().createInstanceWithContext(
"com.sun.star.bridge.BridgeFactory", context));
diff --git a/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug107753_Test.java b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug107753_Test.java
index a2c4122d3017..2c7e314afc82 100644
--- a/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug107753_Test.java
+++ b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug107753_Test.java
@@ -68,22 +68,19 @@ public final class Bug107753_Test extends ComplexTestCase {
protected boolean run(XComponentContext context) throws Throwable {
boolean success = true;
- XTransport transport = (XTransport) UnoRuntime.queryInterface(
+ XTransport transport = UnoRuntime.queryInterface(
XTransport.class, getBridge(context).getInstance("Transport"));
Object obj1a = new XType1() {};
- XType1 obj1b = (XType1) UnoRuntime.queryInterface(XType1.class,
- obj1a);
+ XType1 obj1b = UnoRuntime.queryInterface(XType1.class, obj1a);
success &= test("obj1a == obj1b", obj1a == obj1b);
Object obj2a = new XType2() {};
- XType2 obj2b = (XType2) UnoRuntime.queryInterface(XType2.class,
- obj2a);
+ XType2 obj2b = UnoRuntime.queryInterface(XType2.class, obj2a);
success &= test("obj2a == obj2b", obj2a == obj2b);
Object obj3a = transport.getType1();
- XType1 obj3b = (XType1) UnoRuntime.queryInterface(XType1.class,
- obj3a);
+ XType1 obj3b = UnoRuntime.queryInterface(XType1.class, obj3a);
success &= test(
"obj3a != obj3b; only meaningful as long as different proxy"
+ " instances are used for different UNO interfaces of one UNO"
@@ -91,8 +88,7 @@ public final class Bug107753_Test extends ComplexTestCase {
obj3a != obj3b);
Object obj4a = transport.getType2();
- XType2 obj4b = (XType2) UnoRuntime.queryInterface(XType2.class,
- obj4a);
+ XType2 obj4b = UnoRuntime.queryInterface(XType2.class, obj4a);
success &= test(
"obj4a != obj4b; only meaningful as long as different proxy"
+ " instances are used for different UNO interfaces of one UNO"
diff --git a/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug108825_Test.java b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug108825_Test.java
index 6e9d97f7034d..0585e1c8f650 100644
--- a/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug108825_Test.java
+++ b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug108825_Test.java
@@ -68,7 +68,7 @@ public final class Bug108825_Test extends ComplexTestCase {
}
protected boolean run(XComponentContext context) throws Throwable {
- XTest test = (XTest) UnoRuntime.queryInterface(
+ XTest test = UnoRuntime.queryInterface(
XTest.class, getBridge(context).getInstance("Test"));
// Send the XObject that is held on the server side amidst two
// dummies that are not held on the server side; then wait for the
diff --git a/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug110892_Test.java b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug110892_Test.java
index 76bd9d37a10c..1a537895b0ed 100644
--- a/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug110892_Test.java
+++ b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug110892_Test.java
@@ -71,7 +71,7 @@ public final class Bug110892_Test extends ComplexTestCase {
}
protected boolean run(XComponentContext context) throws Throwable {
- XTest test = (XTest) UnoRuntime.queryInterface(
+ XTest test = UnoRuntime.queryInterface(
XTest.class, getBridge(context).getInstance("Test"));
test.start(new ClientObject());
synchronized (lock) {
diff --git a/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug111153_Test.java b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug111153_Test.java
index d1f09509d9a3..40eccdba2cc6 100644
--- a/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug111153_Test.java
+++ b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug111153_Test.java
@@ -63,7 +63,7 @@ public final class Bug111153_Test extends ComplexTestCase {
}
protected boolean run(XComponentContext context) throws Throwable {
- XTransport t = (XTransport) UnoRuntime.queryInterface(
+ XTransport t = UnoRuntime.queryInterface(
XTransport.class, getBridge(context).getInstance("Transport"));
XDerived d = new XDerived() {};
t.setDerived(d);
diff --git a/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug51323_Test.java b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug51323_Test.java
index 32bfe9d832a3..247bf65ba185 100644
--- a/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug51323_Test.java
+++ b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug51323_Test.java
@@ -67,7 +67,7 @@ public final class Bug51323_Test extends ComplexTestCase {
protected boolean run(XComponentContext context) throws Throwable {
XConnection connection =
Connector.create(context).connect(getConnectionDescription());
- XBridgeFactory factory = (XBridgeFactory) UnoRuntime.queryInterface(
+ XBridgeFactory factory = UnoRuntime.queryInterface(
XBridgeFactory.class,
context.getServiceManager().createInstanceWithContext(
"com.sun.star.bridge.BridgeFactory", context));
diff --git a/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug92174_Test.java b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug92174_Test.java
index 292dabde4758..13b61447c320 100644
--- a/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug92174_Test.java
+++ b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug92174_Test.java
@@ -55,7 +55,7 @@ public final class Bug92174_Test extends ComplexTestCase {
}
protected boolean run(XComponentContext context) throws Throwable {
- XTransport t = (XTransport) UnoRuntime.queryInterface(
+ XTransport t = UnoRuntime.queryInterface(
XTransport.class, getBridge(context).getInstance("Transport"));
t.setDerived(new XDerived() {
public void fn() {}
diff --git a/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug97697_Test.java b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug97697_Test.java
index f235ccfd6475..2fdd457f0dcb 100644
--- a/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug97697_Test.java
+++ b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug97697_Test.java
@@ -72,7 +72,7 @@ public final class Bug97697_Test extends ComplexTestCase {
}
protected boolean run(XComponentContext context) throws Throwable {
- XTransport transport = (XTransport) UnoRuntime.queryInterface(
+ XTransport transport = UnoRuntime.queryInterface(
XTransport.class, getBridge(context).getInstance("Transport"));
try {
transport.getAny();
diff --git a/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug98508_Test.java b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug98508_Test.java
index b713deaa352e..79e373014c4a 100644
--- a/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug98508_Test.java
+++ b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/Bug98508_Test.java
@@ -76,7 +76,7 @@ public final class Bug98508_Test extends ComplexTestCase {
protected boolean run(XComponentContext context) throws Throwable {
Test98508Interface ifc
- = (Test98508Interface) UnoRuntime.queryInterface(
+ = UnoRuntime.queryInterface(
Test98508Interface.class,
getBridge(context).getInstance(""));
try {
diff --git a/bridges/test/com/sun/star/lib/uno/bridges/java_remote/MethodIdTest.java b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/MethodIdTest.java
index c22811502e14..407164c66c7f 100755
--- a/bridges/test/com/sun/star/lib/uno/bridges/java_remote/MethodIdTest.java
+++ b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/MethodIdTest.java
@@ -64,7 +64,7 @@ public final class MethodIdTest extends ComplexTestCase {
}
protected boolean run(XComponentContext context) throws Throwable {
- XTest t = (XTest) UnoRuntime.queryInterface(
+ XTest t = UnoRuntime.queryInterface(
XTest.class, getBridge(context).getInstance("Test"));
return t.f129() == 129;
}
diff --git a/bridges/test/com/sun/star/lib/uno/bridges/java_remote/PolyStructTest.java b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/PolyStructTest.java
index 2f17041a52fb..1c9e387ddb32 100644
--- a/bridges/test/com/sun/star/lib/uno/bridges/java_remote/PolyStructTest.java
+++ b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/PolyStructTest.java
@@ -61,7 +61,7 @@ public final class PolyStructTest extends ComplexTestCase {
}
protected boolean run(XComponentContext context) throws Throwable {
- TestTransport t = (TestTransport) UnoRuntime.queryInterface(
+ TestTransport t = UnoRuntime.queryInterface(
TestTransport.class, getBridge(context).getInstance(""));
assertEquals(
diff --git a/bridges/test/com/sun/star/lib/uno/bridges/java_remote/StopMessageDispatcherTest.java b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/StopMessageDispatcherTest.java
index 7590a89fdd0e..37fb8ffee05b 100644
--- a/bridges/test/com/sun/star/lib/uno/bridges/java_remote/StopMessageDispatcherTest.java
+++ b/bridges/test/com/sun/star/lib/uno/bridges/java_remote/StopMessageDispatcherTest.java
@@ -63,7 +63,7 @@ public final class StopMessageDispatcherTest extends ComplexTestCase {
}
protected boolean run(XComponentContext context) throws Throwable {
- XTest test = (XTest) UnoRuntime.queryInterface(
+ XTest test = UnoRuntime.queryInterface(
XTest.class, getBridge(context).getInstance("Test"));
Thread[] threads = new Thread[101];
int n = Thread.enumerate(threads);
diff --git a/bridges/test/java_uno/acquire/TestAcquire.java b/bridges/test/java_uno/acquire/TestAcquire.java
index 7d54c00d480d..e219b3adbf72 100644
--- a/bridges/test/java_uno/acquire/TestAcquire.java
+++ b/bridges/test/java_uno/acquire/TestAcquire.java
@@ -71,7 +71,7 @@ public final class TestAcquire {
private static void execClient(XComponentContext context, String url)
throws Exception
{
- XTest test = (XTest) UnoRuntime.queryInterface(
+ XTest test = UnoRuntime.queryInterface(
XTest.class, UnoUrlResolver.create(context).resolve(url));
WaitUnreachable u;
@@ -184,7 +184,7 @@ public final class TestAcquire {
throws Exception
{
XAcceptor acceptor = Acceptor.create(context);
- XBridgeFactory factory = (XBridgeFactory) UnoRuntime.queryInterface(
+ XBridgeFactory factory = UnoRuntime.queryInterface(
XBridgeFactory.class,
context.getServiceManager().createInstanceWithContext(
"com.sun.star.bridge.BridgeFactory", context));
diff --git a/bridges/test/java_uno/any/TestRemote.java b/bridges/test/java_uno/any/TestRemote.java
index db33efc139e9..ec533054579d 100644
--- a/bridges/test/java_uno/any/TestRemote.java
+++ b/bridges/test/java_uno/any/TestRemote.java
@@ -49,7 +49,7 @@ public final class TestRemote {
}
protected boolean run(XComponentContext context) throws Throwable {
- XTransport transport = (XTransport) UnoRuntime.queryInterface(
+ XTransport transport = UnoRuntime.queryInterface(
XTransport.class, getBridge(context).getInstance("Transport"));
return TestAny.test(transport, true);
}
diff --git a/bridges/test/java_uno/equals/TestEquals.java b/bridges/test/java_uno/equals/TestEquals.java
index 31b735473c9b..38c9500629e3 100644
--- a/bridges/test/java_uno/equals/TestEquals.java
+++ b/bridges/test/java_uno/equals/TestEquals.java
@@ -91,10 +91,10 @@ public final class TestEquals {
}
protected boolean run(XComponentContext context) throws Throwable {
- XTestFrame f = (XTestFrame) UnoRuntime.queryInterface(
+ XTestFrame f = UnoRuntime.queryInterface(
XTestFrame.class, getBridge(context).getInstance("TestFrame"));
XAcceptor acceptor = Acceptor.create(context);
- XBridgeFactory factory = (XBridgeFactory) UnoRuntime.queryInterface(
+ XBridgeFactory factory = UnoRuntime.queryInterface(
XBridgeFactory.class,
context.getServiceManager().createInstanceWithContext(
"com.sun.star.bridge.BridgeFactory", context));
@@ -160,17 +160,15 @@ public final class TestEquals {
public void run() {
try {
Object test1Aa = object1;
- XBase test1Ab = (XBase)
- UnoRuntime.queryInterface(
- XBase.class, test1Aa);
- XDerived test1Ac = (XDerived)
+ XBase test1Ab = UnoRuntime.queryInterface(
+ XBase.class, test1Aa);
+ XDerived test1Ac =
UnoRuntime.queryInterface(
XDerived.class, test1Aa);
Object test2Aa = object2;
- XBase test2Ab = (XBase)
- UnoRuntime.queryInterface(
- XBase.class, test2Aa);
- XDerived test2Ac = (XDerived)
+ XBase test2Ab = UnoRuntime.queryInterface(
+ XBase.class, test2Aa);
+ XDerived test2Ac =
UnoRuntime.queryInterface(
XDerived.class, test2Aa);
@@ -182,16 +180,14 @@ public final class TestEquals {
null, params);
XMultiComponentFactory factory
= context.getServiceManager();
- XImplementationLoader loader
- = (XImplementationLoader)
+ XImplementationLoader loader =
UnoRuntime.queryInterface(
XImplementationLoader.class,
factory.createInstanceWithContext(
"com.sun.star.loader."
+ "SharedLibrary",
context));
- XSingleComponentFactory factory2
- = (XSingleComponentFactory)
+ XSingleComponentFactory factory2 =
UnoRuntime.queryInterface(
XSingleComponentFactory.class,
loader.activate(
@@ -199,7 +195,7 @@ public final class TestEquals {
+ "testequals.impl",
"", "../lib/testequals.uno",
null));
- XTestInterface test = (XTestInterface)
+ XTestInterface test =
UnoRuntime.queryInterface(
XTestInterface.class,
factory2.createInstanceWithContext(
@@ -211,17 +207,15 @@ public final class TestEquals {
PROTOCOL_DESCRIPTION);
Object test1Ba = test.get(INSTANCE1);
- XBase test1Bb = (XBase)
- UnoRuntime.queryInterface(
- XBase.class, test1Ba);
- XDerived test1Bc = (XDerived)
+ XBase test1Bb = UnoRuntime.queryInterface(
+ XBase.class, test1Ba);
+ XDerived test1Bc =
UnoRuntime.queryInterface(
XDerived.class, test1Ba);
Object test2Ba = test.get(INSTANCE2);
- XBase test2Bb = (XBase)
- UnoRuntime.queryInterface(
- XBase.class, test2Ba);
- XDerived test2Bc = (XDerived)
+ XBase test2Bb = UnoRuntime.queryInterface(
+ XBase.class, test2Ba);
+ XDerived test2Bc =
UnoRuntime.queryInterface(
XDerived.class, test2Ba);
diff --git a/bridges/test/java_uno/nativethreadpool/Relay.java b/bridges/test/java_uno/nativethreadpool/Relay.java
index b7e304c4a3c9..03cf6795c596 100644
--- a/bridges/test/java_uno/nativethreadpool/Relay.java
+++ b/bridges/test/java_uno/nativethreadpool/Relay.java
@@ -63,7 +63,7 @@ public final class Relay implements XRelay, XSource {
final XAcceptor acceptor = Acceptor.create(context);
final XBridgeFactory factory;
try {
- factory = (XBridgeFactory) UnoRuntime.queryInterface(
+ factory = UnoRuntime.queryInterface(
XBridgeFactory.class,
context.getServiceManager().createInstanceWithContext(
"com.sun.star.bridge.BridgeFactory", context));
diff --git a/bridges/test/testclient.java b/bridges/test/testclient.java
index 244264fa8686..e1733bbc8b10 100644
--- a/bridges/test/testclient.java
+++ b/bridges/test/testclient.java
@@ -121,7 +121,7 @@ public class testclient
XConnector xConnector =
- ( XConnector ) UnoRuntime.queryInterface( XConnector.class , x );
+ UnoRuntime.queryInterface( XConnector.class , x );
XConnection xConnection = xConnector.connect(args[0]);
@@ -138,7 +138,7 @@ public class testclient
System.out.println( "after building bridge" );
// Object rInitialObject = m_bridge.mapInterfaceFrom(rootOid, XInterface.class);
-// XTestFactory rFactory = (XTestFactory )
+// XTestFactory rFactory =
// UnoRuntime.queryInterface(XTestFactory.class,rInitialObject );
// XCallMe callMerFactory->
diff --git a/cpputools/source/regcomplazy/regcomplazy.cxx b/cpputools/source/regcomplazy/regcomplazy.cxx
index 69fd77446156..abcb2c187c08 100755
--- a/cpputools/source/regcomplazy/regcomplazy.cxx
+++ b/cpputools/source/regcomplazy/regcomplazy.cxx
@@ -131,6 +131,8 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
sBuffer.append(pBuffer, readSize);
}
}
+ fclose(fDescr);
+ fDescr = 0; // just to be sure noone tries to use the file ever after
}
OString sDescr = sBuffer.makeStringAndClear();
diff --git a/javaunohelper/com/sun/star/comp/helper/Bootstrap.java b/javaunohelper/com/sun/star/comp/helper/Bootstrap.java
index c5037b2f1566..d80b8a6b9df0 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:
<pre>
- XSet xSet = (XSet)UnoRuntime.queryInterface( XSet.class, aMultiComponentFactory );
+ XSet xSet = UnoRuntime.queryInterface( XSet.class, aMultiComponentFactory );
// insert the service manager
xSet.insert( aSingleComponentFactory );
</pre>
@@ -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 938cc0543901..1c3df0d4844b 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 4b5db3753da3..9523fbba7716 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 eda51f8cb1f7..a1bf4d3a168c 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 cafa7e0a412d..a508a209ad2c 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 6eb261ff0eb8..5842c8eaf7f4 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 44a6be5e5f7a..d7bc61cbcbad 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 b4b2d02ab148..d77c1600def3 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 af33c5ea3ee9..40c69a90f8a6 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;
}
diff --git a/javaunohelper/test/com/sun/star/comp/helper/Bootstrap_Test.java b/javaunohelper/test/com/sun/star/comp/helper/Bootstrap_Test.java
index 9c330539e620..b94b85771d8d 100644
--- a/javaunohelper/test/com/sun/star/comp/helper/Bootstrap_Test.java
+++ b/javaunohelper/test/com/sun/star/comp/helper/Bootstrap_Test.java
@@ -62,7 +62,7 @@ public class Bootstrap_Test {
"no /singletons/com.sun.star.reflection.theTypeDescriptionManager!" );
}
- XMultiServiceFactory msf = (XMultiServiceFactory)UnoRuntime.queryInterface(
+ XMultiServiceFactory msf = UnoRuntime.queryInterface(
XMultiServiceFactory.class, xContext.getServiceManager() );
String services[] = msf.getAvailableServiceNames();
System.out.println("Available services are:");
@@ -74,7 +74,7 @@ public class Bootstrap_Test {
for ( int i=0; i<services.length; i++ )
System.out.println(services[i]);
- XComponent xComp = (XComponent)UnoRuntime.queryInterface(
+ XComponent xComp = UnoRuntime.queryInterface(
XComponent.class, xContext );
xComp.dispose();
diff --git a/javaunohelper/test/com/sun/star/comp/helper/ComponentContext_Test.java b/javaunohelper/test/com/sun/star/comp/helper/ComponentContext_Test.java
index 1188f8752135..f88864f2d3ba 100644
--- a/javaunohelper/test/com/sun/star/comp/helper/ComponentContext_Test.java
+++ b/javaunohelper/test/com/sun/star/comp/helper/ComponentContext_Test.java
@@ -88,7 +88,7 @@ public class ComponentContext_Test {
System.err.println( "### bootstrap context test failed: 2!" );
}
- XComponent xComp = (XComponent)UnoRuntime.queryInterface(
+ XComponent xComp = UnoRuntime.queryInterface(
XComponent.class, xInitialContext );
xComp.dispose();
}
diff --git a/javaunohelper/test/com/sun/star/comp/helper/SharedLibraryLoader_Test.java b/javaunohelper/test/com/sun/star/comp/helper/SharedLibraryLoader_Test.java
index d12e1accf797..fc4c2c06f463 100644
--- a/javaunohelper/test/com/sun/star/comp/helper/SharedLibraryLoader_Test.java
+++ b/javaunohelper/test/com/sun/star/comp/helper/SharedLibraryLoader_Test.java
@@ -91,7 +91,7 @@ public class SharedLibraryLoader_Test {
if ( ! test_getSharedLibraryLoaderFactory() )
return false;
- sharedLibraryLoader = (XImplementationLoader) UnoRuntime.queryInterface(
+ sharedLibraryLoader = UnoRuntime.queryInterface(
XImplementationLoader.class, sharedLibraryLoaderFactory.createInstance() );
System.out.print("Test - ");
@@ -115,11 +115,11 @@ public class SharedLibraryLoader_Test {
System.err.println("- get the native ServiceManger factory");
XSingleServiceFactory aSMgrFac =
- (XSingleServiceFactory) UnoRuntime.queryInterface( XSingleServiceFactory.class,
+ UnoRuntime.queryInterface( XSingleServiceFactory.class,
sharedLibraryLoader.activate(NATIVE_SERVICE_MANAGER_IMP_NAME, null, NATIVE_SERVICE_MANAGER_LIB_NAME, null));
System.err.println("- instantiate the native ServiceManger");
- nativeServiceManager = (XMultiServiceFactory) UnoRuntime.queryInterface( XMultiServiceFactory.class, aSMgrFac.createInstance() );
+ nativeServiceManager = UnoRuntime.queryInterface( XMultiServiceFactory.class, aSMgrFac.createInstance() );
System.out.print("Test - ");
System.out.println(nativeServiceManager == null? "failed" : "successfull");
@@ -141,12 +141,12 @@ public class SharedLibraryLoader_Test {
System.err.println("- get factory of the Registry");
XSingleServiceFactory aRegFac =
- (XSingleServiceFactory) UnoRuntime.queryInterface( XSingleServiceFactory.class,
+ UnoRuntime.queryInterface( XSingleServiceFactory.class,
sharedLibraryLoader.activate(NATIVE_REGISTRY_IMP_NAME, null, NATIVE_REGISTRY_LIB_NAME, null)
);
System.err.println("- instantiate the Registry");
simpleRegistry =
- (XSimpleRegistry) UnoRuntime.queryInterface( XSimpleRegistry.class, aRegFac.createInstance() );
+ UnoRuntime.queryInterface( XSimpleRegistry.class, aRegFac.createInstance() );
System.out.print("Test - ");
System.out.println(simpleRegistry == null? "failed" : "successfull");
System.out.println("*******************************************************************");
diff --git a/javaunohelper/test/com/sun/star/lib/uno/helper/ComponentBase_Test.java b/javaunohelper/test/com/sun/star/lib/uno/helper/ComponentBase_Test.java
index 1629920ad481..46e7f60b7def 100644
--- a/javaunohelper/test/com/sun/star/lib/uno/helper/ComponentBase_Test.java
+++ b/javaunohelper/test/com/sun/star/lib/uno/helper/ComponentBase_Test.java
@@ -67,9 +67,9 @@ public class ComponentBase_Test
comp.addEventListener(obj1);
comp.addEventListener(obj2);
comp.addEventListener(obj3);
- comp.addEventListener((XEventListener) UnoRuntime.queryInterface(XEventListener.class, proxyObj1Weak1));
- comp.addEventListener((XEventListener) UnoRuntime.queryInterface(XEventListener.class, proxyObj3Weak2));
- comp.addEventListener((XEventListener) UnoRuntime.queryInterface(XEventListener.class, proxyObj3TypeProv));
+ comp.addEventListener(UnoRuntime.queryInterface(XEventListener.class, proxyObj1Weak1));
+ comp.addEventListener(UnoRuntime.queryInterface(XEventListener.class, proxyObj3Weak2));
+ comp.addEventListener(UnoRuntime.queryInterface(XEventListener.class, proxyObj3TypeProv));
obj1.nDisposingCalled = 0;
obj2.nDisposingCalled = 0;
obj3.nDisposingCalled = 0;
diff --git a/javaunohelper/test/com/sun/star/lib/uno/helper/Factory_Test.java b/javaunohelper/test/com/sun/star/lib/uno/helper/Factory_Test.java
index 2732fa54331a..732db947b97a 100644
--- a/javaunohelper/test/com/sun/star/lib/uno/helper/Factory_Test.java
+++ b/javaunohelper/test/com/sun/star/lib/uno/helper/Factory_Test.java
@@ -120,7 +120,7 @@ public class Factory_Test
//==============================================================================================
static void service_info_test( Object inst )
{
- XServiceInfo xInfo = (XServiceInfo)UnoRuntime.queryInterface( XServiceInfo.class, inst );
+ XServiceInfo xInfo = UnoRuntime.queryInterface( XServiceInfo.class, inst );
if (! xInfo.getImplementationName().equals( m_impl_name ))
{
@@ -159,7 +159,7 @@ public class Factory_Test
// bootstrap service manager
XMultiServiceFactory xMgr = RegistryServiceFactory.create( rdb );
- XPropertySet xProps = (XPropertySet)UnoRuntime.queryInterface(
+ XPropertySet xProps = UnoRuntime.queryInterface(
XPropertySet.class, xMgr );
XComponentContext xContext = (XComponentContext)AnyConverter.toObject(
new Type( XComponentContext.class ), xProps.getPropertyValue( "DefaultContext" ) );
@@ -172,7 +172,7 @@ public class Factory_Test
new Type( XSimpleRegistry.class ), xProps.getPropertyValue( "Registry" ) );
// register impl
XImplementationRegistration xImpReg =
- (XImplementationRegistration)UnoRuntime.queryInterface(
+ UnoRuntime.queryInterface(
XImplementationRegistration.class,
xContext.getServiceManager().createInstanceWithContext(
"com.sun.star.registry.ImplementationRegistration", xContext ) );
@@ -196,7 +196,7 @@ public class Factory_Test
m_supported_services[ nPos ], xContext ) );
}
- XComponent xComp = (XComponent)UnoRuntime.queryInterface( XComponent.class, xContext );
+ XComponent xComp = UnoRuntime.queryInterface( XComponent.class, xContext );
xComp.dispose();
}
catch (Exception exc)
diff --git a/jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java b/jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java
index 819ef024acfa..6dd90b3dd590 100644
--- a/jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java
+++ b/jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java
@@ -134,7 +134,7 @@ public class BridgeFactory implements XBridgeFactory/*, XEventListener*/ {
if (hasName) {
IBridge iBridges[] = UnoRuntime.getBridges();
for(int i = 0; i < iBridges.length; ++ i) {
- XBridge xBridge = (XBridge)UnoRuntime.queryInterface(XBridge.class, iBridges[i]);
+ XBridge xBridge = UnoRuntime.queryInterface(XBridge.class, iBridges[i]);
if(xBridge != null) {
if(xBridge.getName().equals(sName))
@@ -148,7 +148,7 @@ public class BridgeFactory implements XBridgeFactory/*, XEventListener*/ {
try {
IBridge iBridge = UnoRuntime.getBridgeByName("java", context, "remote", context, hasName ? new Object[]{sProtocol, aConnection, anInstanceProvider, sName} : new Object[]{sProtocol, aConnection, anInstanceProvider});
- xBridge = (XBridge)UnoRuntime.queryInterface(XBridge.class, iBridge);
+ xBridge = UnoRuntime.queryInterface(XBridge.class, iBridge);
}
catch(Exception exception) {
throw new com.sun.star.lang.IllegalArgumentException(exception.getMessage());
@@ -171,7 +171,7 @@ public class BridgeFactory implements XBridgeFactory/*, XEventListener*/ {
IBridge iBridges[] = UnoRuntime.getBridges();
for(int i = 0; i < iBridges.length; ++ i) {
- xBridge = (XBridge)UnoRuntime.queryInterface(XBridge.class, iBridges[i]);
+ xBridge = UnoRuntime.queryInterface(XBridge.class, iBridges[i]);
if(xBridge != null) {
if(xBridge.getName().equals(sName))
@@ -199,7 +199,7 @@ public class BridgeFactory implements XBridgeFactory/*, XEventListener*/ {
IBridge iBridges[] = UnoRuntime.getBridges();
for(int i = 0; i < iBridges.length; ++ i) {
- XBridge xBridge = (XBridge)UnoRuntime.queryInterface(XBridge.class, iBridges[i]);
+ XBridge xBridge = UnoRuntime.queryInterface(XBridge.class, iBridges[i]);
if(xBridge != null)
vector.addElement(xBridge);
diff --git a/jurt/com/sun/star/comp/loader/FactoryHelper.java b/jurt/com/sun/star/comp/loader/FactoryHelper.java
index 451e387eb7d6..83c1c567509f 100644
--- a/jurt/com/sun/star/comp/loader/FactoryHelper.java
+++ b/jurt/com/sun/star/comp/loader/FactoryHelper.java
@@ -174,7 +174,7 @@ public class FactoryHelper {
{
if (xContext != null)
{
- return (XMultiServiceFactory)UnoRuntime.queryInterface(
+ return UnoRuntime.queryInterface(
XMultiServiceFactory.class, xContext.getServiceManager() );
}
else
@@ -302,7 +302,7 @@ public class FactoryHelper {
Object instance = _constructor.newInstance( args );
if (bInitCall)
{
- XInitialization xInitialization = (XInitialization)UnoRuntime.queryInterface(
+ XInitialization xInitialization = UnoRuntime.queryInterface(
XInitialization.class, instance );
if (xInitialization != null)
{
diff --git a/jurt/com/sun/star/comp/loader/JavaLoader.java b/jurt/com/sun/star/comp/loader/JavaLoader.java
index 3565be7031a3..cf0d9995d7f6 100644
--- a/jurt/com/sun/star/comp/loader/JavaLoader.java
+++ b/jurt/com/sun/star/comp/loader/JavaLoader.java
@@ -102,7 +102,7 @@ public class JavaLoader implements XImplementationLoader,
{
if (m_xMacroExpander == null)
{
- XPropertySet xProps = (XPropertySet)
+ XPropertySet xProps =
UnoRuntime.queryInterface(
XPropertySet.class, multiServiceFactory );
if (xProps == null)
diff --git a/jurt/com/sun/star/comp/servicemanager/ServiceManager.java b/jurt/com/sun/star/comp/servicemanager/ServiceManager.java
index adb0c54c7e28..b791c6501a36 100644
--- a/jurt/com/sun/star/comp/servicemanager/ServiceManager.java
+++ b/jurt/com/sun/star/comp/servicemanager/ServiceManager.java
@@ -158,7 +158,7 @@ public class ServiceManager implements XMultiServiceFactory,
if (loaderObj == null)
throw new com.sun.star.uno.Exception("Can get an instance of com.sun.star.loader.Java");
- return (XImplementationLoader) UnoRuntime.queryInterface( XImplementationLoader.class, loaderObj );
+ return UnoRuntime.queryInterface( XImplementationLoader.class, loaderObj );
}
/**
@@ -380,7 +380,7 @@ public class ServiceManager implements XMultiServiceFactory,
Object fac = queryServiceFactory( rServiceSpecifier );
if (fac != null)
{
- XSingleComponentFactory xCompFac = (XSingleComponentFactory)UnoRuntime.queryInterface(
+ XSingleComponentFactory xCompFac = UnoRuntime.queryInterface(
XSingleComponentFactory.class, fac );
if (xCompFac != null)
{
@@ -388,7 +388,7 @@ public class ServiceManager implements XMultiServiceFactory,
}
else
{
- XSingleServiceFactory xServiceFac = (XSingleServiceFactory)UnoRuntime.queryInterface(
+ XSingleServiceFactory xServiceFac = UnoRuntime.queryInterface(
XSingleServiceFactory.class, fac );
if (xServiceFac != null)
{
@@ -422,7 +422,7 @@ public class ServiceManager implements XMultiServiceFactory,
Object fac = queryServiceFactory( rServiceSpecifier );
if (fac != null)
{
- XSingleComponentFactory xCompFac = (XSingleComponentFactory)UnoRuntime.queryInterface(
+ XSingleComponentFactory xCompFac = UnoRuntime.queryInterface(
XSingleComponentFactory.class, fac );
if (xCompFac != null)
{
@@ -430,7 +430,7 @@ public class ServiceManager implements XMultiServiceFactory,
}
else
{
- XSingleServiceFactory xServiceFac = (XSingleServiceFactory)UnoRuntime.queryInterface(
+ XSingleServiceFactory xServiceFac = UnoRuntime.queryInterface(
XSingleServiceFactory.class, fac );
if (xServiceFac != null)
{
@@ -528,7 +528,7 @@ public class ServiceManager implements XMultiServiceFactory,
if (object == null)
throw new com.sun.star.uno.RuntimeException("The parameter must not been null");
- XServiceInfo xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, object);
+ XServiceInfo xServiceInfo = UnoRuntime.queryInterface(XServiceInfo.class, object);
if (xServiceInfo != null) {
return UnoRuntime.areSame(factoriesByImplNames.get(xServiceInfo.getImplementationName()), object);
@@ -552,7 +552,7 @@ public class ServiceManager implements XMultiServiceFactory,
if (object == null) throw new com.sun.star.lang.IllegalArgumentException();
XServiceInfo xServiceInfo =
- (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, object);
+ UnoRuntime.queryInterface(XServiceInfo.class, object);
if (xServiceInfo == null)
throw new com.sun.star.lang.IllegalArgumentException(
@@ -606,7 +606,7 @@ public class ServiceManager implements XMultiServiceFactory,
);
XServiceInfo xServiceInfo =
- (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, object);
+ UnoRuntime.queryInterface(XServiceInfo.class, object);
if (xServiceInfo == null)
throw new com.sun.star.lang.IllegalArgumentException(
@@ -614,7 +614,7 @@ public class ServiceManager implements XMultiServiceFactory,
);
XSingleServiceFactory xSingleServiceFactory =
- (XSingleServiceFactory) UnoRuntime.queryInterface(XSingleServiceFactory.class, object);
+ UnoRuntime.queryInterface(XSingleServiceFactory.class, object);
if (xSingleServiceFactory == null)
throw new com.sun.star.lang.IllegalArgumentException(
diff --git a/jurt/com/sun/star/comp/urlresolver/UrlResolver.java b/jurt/com/sun/star/comp/urlresolver/UrlResolver.java
index cabd51d42404..6c63ccbd8490 100644
--- a/jurt/com/sun/star/comp/urlresolver/UrlResolver.java
+++ b/jurt/com/sun/star/comp/urlresolver/UrlResolver.java
@@ -102,7 +102,7 @@ public class UrlResolver {
Object rootObject = null;
XBridgeFactory xBridgeFactory= null;
try {
- xBridgeFactory = (XBridgeFactory)UnoRuntime.queryInterface(XBridgeFactory.class,
+ xBridgeFactory = UnoRuntime.queryInterface(XBridgeFactory.class,
_xMultiServiceFactory.createInstance("com.sun.star.bridge.BridgeFactory"));
} catch (com.sun.star.uno.Exception e) {
throw new com.sun.star.uno.RuntimeException(e.getMessage());
@@ -117,7 +117,7 @@ public class UrlResolver {
throw new com.sun.star.uno.RuntimeException(e.getMessage());
}
- XConnector connector_xConnector = (XConnector)UnoRuntime.queryInterface(XConnector.class, connector);
+ XConnector connector_xConnector = UnoRuntime.queryInterface(XConnector.class, connector);
// connect to the server
XConnection xConnection = connector_xConnector.connect(conDcp);
diff --git a/jurt/com/sun/star/uno/WeakReference.java b/jurt/com/sun/star/uno/WeakReference.java
index 3c954efe1cf9..fc3b6f8100ba 100644
--- a/jurt/com/sun/star/uno/WeakReference.java
+++ b/jurt/com/sun/star/uno/WeakReference.java
@@ -61,7 +61,7 @@ public class WeakReference
Object weakImpl= obj.get();
if (weakImpl != null)
{
- XWeak weak= (XWeak) UnoRuntime.queryInterface(XWeak.class, weakImpl);
+ XWeak weak= UnoRuntime.queryInterface(XWeak.class, weakImpl);
if (weak != null)
{
XAdapter adapter= (XAdapter) weak.queryAdapter();
@@ -77,7 +77,7 @@ public class WeakReference
*/
public WeakReference(Object obj)
{
- XWeak weak= (XWeak) UnoRuntime.queryInterface(XWeak.class, obj);
+ XWeak weak= UnoRuntime.queryInterface(XWeak.class, obj);
if (weak != null)
{
XAdapter adapter= (XAdapter) weak.queryAdapter();
diff --git a/jurt/demo/com/sun/star/demo/DemoServer.java b/jurt/demo/com/sun/star/demo/DemoServer.java
index 8715215dcc70..5b0b8201f274 100644
--- a/jurt/demo/com/sun/star/demo/DemoServer.java
+++ b/jurt/demo/com/sun/star/demo/DemoServer.java
@@ -92,12 +92,12 @@ public class DemoServer {
ServiceManager serviceManager = new ServiceManager();
serviceManager.addFactories(neededServices);
- XAcceptor xAcceptor = (XAcceptor)UnoRuntime.queryInterface(XAcceptor.class, serviceManager.createInstance("com.sun.star.connection.Acceptor"));
+ XAcceptor xAcceptor = UnoRuntime.queryInterface(XAcceptor.class, serviceManager.createInstance("com.sun.star.connection.Acceptor"));
System.err.println("waiting for connect...");
XConnection xConnection = xAcceptor.accept(conDcp);
- XBridgeFactory xBridgeFactory = (XBridgeFactory)UnoRuntime.queryInterface(XBridgeFactory.class, serviceManager.createInstance("com.sun.star.bridge.BridgeFactory"));
+ XBridgeFactory xBridgeFactory = UnoRuntime.queryInterface(XBridgeFactory.class, serviceManager.createInstance("com.sun.star.bridge.BridgeFactory"));
XBridge xBridge = xBridgeFactory.createBridge(conDcp + ";" + protDcp, protDcp, xConnection, new InstanceProvider());
}
diff --git a/jurt/demo/com/sun/star/demo/TestOffice.java b/jurt/demo/com/sun/star/demo/TestOffice.java
index 811889898c48..7b86c8e2dd7e 100644
--- a/jurt/demo/com/sun/star/demo/TestOffice.java
+++ b/jurt/demo/com/sun/star/demo/TestOffice.java
@@ -76,7 +76,7 @@ public class TestOffice {
{
byte bytes[][] = new byte[1][];
- XInputStream rIn = (XInputStream)UnoRuntime.queryInterface(XInputStream.class, rOut);
+ XInputStream rIn = UnoRuntime.queryInterface(XInputStream.class, rOut);
if(rIn.available() != 10)
System.err.println("wrong bytes available\n");
@@ -90,11 +90,11 @@ public class TestOffice {
static void testWriter(XComponent rCmp) throws IOException {
- XTextDocument rTextDoc = (XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, rCmp);
+ XTextDocument rTextDoc = UnoRuntime.queryInterface(XTextDocument.class, rCmp);
- XText rText = (XText)UnoRuntime.queryInterface(XText.class, rTextDoc.getText());
- XTextCursor rCursor = (XTextCursor)UnoRuntime.queryInterface(XTextCursor.class, rText.createTextCursor());
- XTextRange rRange = (XTextRange)UnoRuntime.queryInterface(XTextRange.class, rCursor);
+ XText rText = UnoRuntime.queryInterface(XText.class, rTextDoc.getText());
+ XTextCursor rCursor = UnoRuntime.queryInterface(XTextCursor.class, rText.createTextCursor());
+ XTextRange rRange = UnoRuntime.queryInterface(XTextRange.class, rCursor);
byte pcText[] = new byte[1024];
pcText[0] = 0;
@@ -112,7 +112,7 @@ public class TestOffice {
}
static void testDocument(XMultiServiceFactory rSmgr) throws com.sun.star.uno.Exception, IOException {
- XComponentLoader rLoader = (XComponentLoader)UnoRuntime.queryInterface(XComponentLoader.class, rSmgr.createInstance("com.sun.star.frame.Desktop"));
+ XComponentLoader rLoader = UnoRuntime.queryInterface(XComponentLoader.class, rSmgr.createInstance("com.sun.star.frame.Desktop"));
String urls[] = new String[] {
"private:factory/swriter",
@@ -148,13 +148,13 @@ public class TestOffice {
}
static void doSomething(Object r) throws com.sun.star.uno.Exception, IOException {
- XNamingService rName = (XNamingService)UnoRuntime.queryInterface(XNamingService.class, r);
+ XNamingService rName = UnoRuntime.queryInterface(XNamingService.class, r);
if(rName != null) {
System.err.println("got the remote naming service !");
Object rXsmgr = rName.getRegisteredObject("StarOffice.ServiceManager");
- XMultiServiceFactory rSmgr = (XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, rXsmgr);
+ XMultiServiceFactory rSmgr = UnoRuntime.queryInterface(XMultiServiceFactory.class, rXsmgr);
if(rSmgr != null) {
System.err.println("got the remote service manager !");
// testPipe(rSmgr);
@@ -183,7 +183,7 @@ public class TestOffice {
smgr.addFactories(neededServices);
Object resolver = smgr.createInstance("com.sun.star.bridge.UnoUrlResolver" );
- XUnoUrlResolver resolver_xUnoUrlResolver = (XUnoUrlResolver)UnoRuntime.queryInterface(XUnoUrlResolver.class, resolver);
+ XUnoUrlResolver resolver_xUnoUrlResolver = UnoRuntime.queryInterface(XUnoUrlResolver.class, resolver);
Object rInitialObject = resolver_xUnoUrlResolver.resolve(argv[0]);
diff --git a/jurt/test/com/sun/star/comp/bridgefactory/BridgeFactory_Test.java b/jurt/test/com/sun/star/comp/bridgefactory/BridgeFactory_Test.java
index 8c6722c9f69a..a5fdccf613f8 100644
--- a/jurt/test/com/sun/star/comp/bridgefactory/BridgeFactory_Test.java
+++ b/jurt/test/com/sun/star/comp/bridgefactory/BridgeFactory_Test.java
@@ -75,7 +75,7 @@ public final class BridgeFactory_Test extends ComplexTestCase {
assure("", UnoRuntime.areSame(xBridge, xBridges[0]));
// dispose the bridge
- XComponent xComponent = (XComponent)UnoRuntime.queryInterface(XComponent.class, xBridge);
+ XComponent xComponent = UnoRuntime.queryInterface(XComponent.class, xBridge);
xComponent.dispose();
@@ -103,7 +103,7 @@ public final class BridgeFactory_Test extends ComplexTestCase {
&& UnoRuntime.areSame(xBridge_new, xBridges[0]));
// dispose the new bridge
- XComponent xComponent_new = (XComponent)UnoRuntime.queryInterface(XComponent.class, xBridge_new);
+ XComponent xComponent_new = UnoRuntime.queryInterface(XComponent.class, xBridge_new);
xComponent_new.dispose();
}
}
diff --git a/jurt/test/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge_Test.java b/jurt/test/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge_Test.java
index 8e71d51a0c6f..ffef8f7664a0 100644
--- a/jurt/test/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge_Test.java
+++ b/jurt/test/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge_Test.java
@@ -132,17 +132,17 @@ public final class java_remote_bridge_Test extends ComplexTestCase {
proxyBXInterface[i] = (XInterface) bridgeB.getInstance(name);
// map object:
- proxyBTestInterface[i] = (TestInterface) UnoRuntime.queryInterface(
+ proxyBTestInterface[i] = UnoRuntime.queryInterface(
TestInterface.class, proxyBXInterface[i]);
proxyBTestInterface[i].function();
// remap object once:
- TestInterface remapped = (TestInterface) UnoRuntime.queryInterface(
+ TestInterface remapped = UnoRuntime.queryInterface(
TestInterface.class, proxyBXInterface[i]);
remapped.function();
// remap object twice:
- remapped = (TestInterface) UnoRuntime.queryInterface(
+ remapped = UnoRuntime.queryInterface(
TestInterface.class, proxyBXInterface[i]);
remapped.function();
}
diff --git a/jurt/workbench/com/sun/star/comp/urlresolver/UrlResolver_Test.java b/jurt/workbench/com/sun/star/comp/urlresolver/UrlResolver_Test.java
index 5e3110d140fa..94686e7135fd 100644
--- a/jurt/workbench/com/sun/star/comp/urlresolver/UrlResolver_Test.java
+++ b/jurt/workbench/com/sun/star/comp/urlresolver/UrlResolver_Test.java
@@ -58,19 +58,19 @@ public class UrlResolver_Test
Object initialObject = urlResolver.resolve(
"uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager" );
- XMultiComponentFactory xOfficeFactory= (XMultiComponentFactory) UnoRuntime.queryInterface(
+ XMultiComponentFactory xOfficeFactory= UnoRuntime.queryInterface(
XMultiComponentFactory.class, initialObject );
// retrieve the component context (it's not yet exported from the office)
// Query for the XPropertySet interface.
- XPropertySet xProperySet = ( XPropertySet ) UnoRuntime.queryInterface(
+ XPropertySet xProperySet = UnoRuntime.queryInterface(
XPropertySet.class, xOfficeFactory);
// Get the default context from the office server.
Object oDefaultContext = xProperySet.getPropertyValue( "DefaultContext" );
// Query for the interface XComponentContext.
- XComponentContext xOfficeComponentContext = ( XComponentContext ) UnoRuntime.queryInterface(
+ XComponentContext xOfficeComponentContext = UnoRuntime.queryInterface(
XComponentContext.class, oDefaultContext );
// now create the desktop service
diff --git a/ridljar/com/sun/star/uno/UnoRuntime.java b/ridljar/com/sun/star/uno/UnoRuntime.java
index dcf7ff42b10c..28ee8fb1e2bd 100644
--- a/ridljar/com/sun/star/uno/UnoRuntime.java
+++ b/ridljar/com/sun/star/uno/UnoRuntime.java
@@ -179,8 +179,9 @@ public class UnoRuntime {
* otherwise <code>null</code>
* @see #queryInterface(Type, Object)
*/
- public static Object queryInterface(Class zInterface, Object object) {
- return queryInterface(new Type(zInterface), object);
+ @SuppressWarnings("unchecked")
+ public static <T> T queryInterface(Class<T> zInterface, Object object) {
+ return (T) queryInterface(new Type(zInterface), object);
}
/**
diff --git a/ridljar/test/com/sun/star/uno/UnoRuntime_Test.java b/ridljar/test/com/sun/star/uno/UnoRuntime_Test.java
index 06af7828039e..a9eef19b0a64 100644
--- a/ridljar/test/com/sun/star/uno/UnoRuntime_Test.java
+++ b/ridljar/test/com/sun/star/uno/UnoRuntime_Test.java
@@ -54,7 +54,7 @@ public final class UnoRuntime_Test extends ComplexTestCase {
// Test if a delegator object has the same OID as its creator:
Test4 test4 = new Test4();
- Ifc ifc = (Ifc) UnoRuntime.queryInterface(Ifc.class, test4);
+ Ifc ifc = UnoRuntime.queryInterface(Ifc.class, test4);
assure(
"Test4",
UnoRuntime.generateOid(test4).equals(UnoRuntime.generateOid(ifc)));
@@ -64,19 +64,19 @@ public final class UnoRuntime_Test extends ComplexTestCase {
// Test if a query for an interface which is not supported returns null:
assure(
"Test1",
- (Ifc) UnoRuntime.queryInterface(Ifc.class, new Test1()) == null);
+ UnoRuntime.queryInterface(Ifc.class, new Test1()) == null);
// Test if a query for an interface which is supported through
// IQueryInterface succeeds:
assure(
"Test2",
- (Ifc) UnoRuntime.queryInterface(Ifc.class, new Test2()) != null);
+ UnoRuntime.queryInterface(Ifc.class, new Test2()) != null);
// Test if a query for an interface which is directly supported (through
// inheritance) succeeds:
assure(
"Test3",
- (Ifc) UnoRuntime.queryInterface(Ifc.class, new Test3()) != null);
+ UnoRuntime.queryInterface(Ifc.class, new Test3()) != null);
}
public void test_areSame() {
diff --git a/sal/osl/unx/process.c b/sal/osl/unx/process.c
index e5faf46548a6..a1f47cdf76a5 100644
--- a/sal/osl/unx/process.c
+++ b/sal/osl/unx/process.c
@@ -466,7 +466,7 @@ static void ChildStatusProc(void *pData)
if ((pid = fork()) == 0)
{
/* Child */
- close(channel[0]);
+ if (channel[0] != -1) close(channel[0]);
if ((data.m_uid != (uid_t)-1) && ((data.m_uid != getuid()) || (data.m_gid != getgid())))
{
@@ -500,32 +500,32 @@ static void ChildStatusProc(void *pData)
/* Connect std IO to pipe ends */
/* Write end of stdInput not used in child process */
- close( stdInput[1] );
+ if (stdInput[1] != -1) close( stdInput[1] );
/* Read end of stdOutput not used in child process */
- close( stdOutput[0] );
+ if (stdOutput[0] != -1) close( stdOutput[0] );
/* Read end of stdError not used in child process */
- close( stdError[0] );
+ if (stdError[0] != -1) close( stdError[0] );
/* Redirect pipe ends to std IO */
if ( stdInput[0] != STDIN_FILENO )
{
dup2( stdInput[0], STDIN_FILENO );
- close( stdInput[0] );
+ if (stdInput[0] != -1) close( stdInput[0] );
}
if ( stdOutput[1] != STDOUT_FILENO )
{
dup2( stdOutput[1], STDOUT_FILENO );
- close( stdOutput[1] );
+ if (stdOutput[1] != -1) close( stdOutput[1] );
}
if ( stdError[1] != STDERR_FILENO )
{
dup2( stdError[1], STDERR_FILENO );
- close( stdError[1] );
+ if (stdError[1] != -1) close( stdError[1] );
}
pid=execv(data.m_pszArgs[0], (sal_Char **)data.m_pszArgs);
@@ -539,7 +539,7 @@ static void ChildStatusProc(void *pData)
/* if we reach here, something went wrong */
write(channel[1], &errno, sizeof(errno));
- close(channel[1]);
+ if (channel[1] != -1) close(channel[1]);
_exit(255);
}
@@ -547,12 +547,12 @@ static void ChildStatusProc(void *pData)
{ /* Parent */
int status;
- close(channel[1]);
+ if (channel[1] != -1) close(channel[1]);
/* Close unused pipe ends */
- close( stdInput[0] );
- close( stdOutput[1] );
- close( stdError[1] );
+ if (stdInput[0] != -1) close( stdInput[0] );
+ if (stdOutput[1] != -1) close( stdOutput[1] );
+ if (stdError[1] != -1) close( stdError[1] );
while (((i = read(channel[0], &status, sizeof(status))) < 0))
{
@@ -560,7 +560,7 @@ static void ChildStatusProc(void *pData)
break;
}
- close(channel[0]);
+ if (channel[0] != -1) close(channel[0]);
if ((pid > 0) && (i == 0))
@@ -646,9 +646,9 @@ static void ChildStatusProc(void *pData)
if ( pdata->m_pErrorRead )
*pdata->m_pErrorRead = NULL;
- close( stdInput[1] );
- close( stdOutput[0] );
- close( stdError[0] );
+ if (stdInput[1] != -1) close( stdInput[1] );
+ if (stdOutput[0] != -1) close( stdOutput[0] );
+ if (stdError[0] != -1) close( stdError[0] );
//if pid > 0 then a process was created, even if it later failed
//e.g. bash searching for a command to execute, and we still
@@ -1124,15 +1124,6 @@ struct osl_procStat
unsigned long nswap; /* ? */
unsigned long cnswap; /* ? */
- /* from 'statm' */
- long size; /* numbers of pages in memory */
- long resident; /* number of resident pages */
- long share; /* number of shared pages */
- long trs; /* text resident size */
- long lrs; /* library resident size */
- long drs; /* data resident size */
- long dt; /* ditry pages */
-
/* from 'status' */
int ruid; /* real uid */
int euid; /* effective uid */
@@ -1155,9 +1146,10 @@ struct osl_procStat
osl_getProcStat
*********************************************/
-void osl_getProcStat(pid_t pid, struct osl_procStat* procstat)
+sal_Bool osl_getProcStat(pid_t pid, struct osl_procStat* procstat)
{
int fd = 0;
+ sal_Bool bRet = sal_False;
char name[PATH_MAX + 1];
snprintf(name, sizeof(name), "/proc/%u/stat", pid);
@@ -1166,11 +1158,13 @@ void osl_getProcStat(pid_t pid, struct osl_procStat* procstat)
char* tmp=0;
char prstatbuf[512];
memset(prstatbuf,0,512);
- read(fd,prstatbuf,511);
+ bRet = read(fd,prstatbuf,511) == 511;
close(fd);
/*printf("%s\n\n",prstatbuf);*/
+ if (!bRet)
+ return sal_False;
tmp = strrchr(prstatbuf, ')');
*tmp = '\0';
@@ -1198,57 +1192,35 @@ void osl_getProcStat(pid_t pid, struct osl_procStat* procstat)
&procstat->wchan, &procstat->nswap, &procstat->cnswap
);
}
-}
-
-/**********************************************
- osl_getProcStatm
- *********************************************/
-
-void osl_getProcStatm(pid_t pid, struct osl_procStat* procstat)
-{
- int fd = 0;
- char name[PATH_MAX + 1];
- snprintf(name, sizeof(name), "/proc/%u/statm", pid);
-
- if ((fd = open(name,O_RDONLY)) >=0 )
- {
- char prstatmbuf[512];
- memset(prstatmbuf,0,512);
- read(fd,prstatmbuf,511);
-
- close(fd);
-
- /* printf("\n\n%s\n\n",prstatmbuf);*/
-
- sscanf(prstatmbuf,"%li %li %li %li %li %li %li",
- &procstat->size, &procstat->resident, &procstat->share,
- &procstat->trs, &procstat->lrs, &procstat->drs,
- &procstat->dt
- );
- }
+ return bRet;
}
/**********************************************
osl_getProcStatus
*********************************************/
-void osl_getProcStatus(pid_t pid, struct osl_procStat* procstat)
+sal_Bool osl_getProcStatus(pid_t pid, struct osl_procStat* procstat)
{
int fd = 0;
char name[PATH_MAX + 1];
snprintf(name, sizeof(name), "/proc/%u/status", pid);
+ sal_Bool bRet = sal_False;
+
if ((fd = open(name,O_RDONLY)) >=0 )
{
char* tmp=0;
char prstatusbuf[512];
memset(prstatusbuf,0,512);
- read(fd,prstatusbuf,511);
+ bRet = read(fd,prstatusbuf,511) == 511;
close(fd);
/* printf("\n\n%s\n\n",prstatusbuf);*/
+ if (!bRet)
+ return sal_False;
+
tmp = strstr(prstatusbuf,"Uid:");
if(tmp)
{
@@ -1290,6 +1262,7 @@ void osl_getProcStatus(pid_t pid, struct osl_procStat* procstat)
);
}
}
+ return bRet;
}
#endif
@@ -1439,56 +1412,54 @@ oslProcessError SAL_CALL osl_getProcessInfo(oslProcess Process, oslProcessData F
#elif defined(LINUX)
-/* int fd = 0;*/
- struct osl_procStat procstat;
- memset(&procstat,0,sizeof(procstat));
+ if ( (Fields & osl_Process_CPUTIMES) || (Fields & osl_Process_HEAPUSAGE) )
+ {
+ struct osl_procStat procstat;
+ memset(&procstat,0,sizeof(procstat));
- osl_getProcStat(pid, &procstat);
- osl_getProcStatm(pid, &procstat);
- osl_getProcStatus(pid, &procstat);
+ if ( (Fields & osl_Process_CPUTIMES) && osl_getProcStat(pid, &procstat) )
+ {
+ /*
+ * mfe:
+ * We calculate only time of the process proper.
+ * Threads are processes, we do not consider their time here!
+ * (For this, cutime and cstime should be used, it seems not
+ * to work in 2.0.36)
+ */
+
+ long clktck;
+ unsigned long hz;
+ unsigned long userseconds;
+ unsigned long systemseconds;
+
+ clktck = sysconf(_SC_CLK_TCK);
+ if (clktck < 0) {
+ return osl_Process_E_Unknown;
+ }
+ hz = (unsigned long) clktck;
- if ( Fields & osl_Process_CPUTIMES)
- {
- /*
- * mfe:
- * We calculate only time of the process proper.
- * Threads are processes, we do not consider their time here!
- * (For this, cutime and cstime should be used, it seems not
- * to work in 2.0.36)
- */
-
- long clktck;
- unsigned long hz;
- unsigned long userseconds;
- unsigned long systemseconds;
-
- clktck = sysconf(_SC_CLK_TCK);
- if (clktck < 0) {
- return osl_Process_E_Unknown;
- }
- hz = (unsigned long) clktck;
+ userseconds = procstat.utime/hz;
+ systemseconds = procstat.stime/hz;
- userseconds = procstat.utime/hz;
- systemseconds = procstat.stime/hz;
+ pInfo->UserTime.Seconds = userseconds;
+ pInfo->UserTime.Nanosec = procstat.utime - (userseconds * hz);
+ pInfo->SystemTime.Seconds = systemseconds;
+ pInfo->SystemTime.Nanosec = procstat.stime - (systemseconds * hz);
- pInfo->UserTime.Seconds = userseconds;
- pInfo->UserTime.Nanosec = procstat.utime - (userseconds * hz);
- pInfo->SystemTime.Seconds = systemseconds;
- pInfo->SystemTime.Nanosec = procstat.stime - (systemseconds * hz);
+ pInfo->Fields |= osl_Process_CPUTIMES;
+ }
- pInfo->Fields |= osl_Process_CPUTIMES;
- }
+ if ( (Fields & osl_Process_HEAPUSAGE) && osl_getProcStatus(pid, &procstat) )
+ {
+ /*
+ * mfe:
+ * vm_data (found in status) shows the size of the data segment
+ * it a rough approximation of the core heap size
+ */
+ pInfo->HeapUsage = procstat.vm_data*1024;
- if (Fields & osl_Process_HEAPUSAGE)
- {
- /*
- * mfe:
- * vm_data (found in status) shows the size of the data segment
- * it a rough approximation of the core heap size
- */
- pInfo->HeapUsage = procstat.vm_data*1024;
-
- pInfo->Fields |= osl_Process_HEAPUSAGE;
+ pInfo->Fields |= osl_Process_HEAPUSAGE;
+ }
}
return (pInfo->Fields == Fields) ? osl_Process_E_None : osl_Process_E_Unknown;
diff --git a/sal/osl/unx/signal.c b/sal/osl/unx/signal.c
index 77633dd81269..35884e11c9ba 100644
--- a/sal/osl/unx/signal.c
+++ b/sal/osl/unx/signal.c
@@ -46,6 +46,7 @@
#ifdef LINUX
#include <execinfo.h>
+#include <link.h>
#define INCLUDE_BACKTRACE
#define STACKTYPE "Linux"
#endif
@@ -392,6 +393,88 @@ static int fputs_xml( const char *string, FILE *stream )
#define REPORTENV_PARAM "-crashreportenv:"
+#if defined SAL_ENABLE_CRASH_REPORT && defined INCLUDE_BACKTRACE && \
+ defined LINUX
+
+typedef struct
+{
+ const char *name;
+ ElfW(Off) offset;
+} dynamic_entry;
+
+static int
+callback(struct dl_phdr_info *info, size_t size, void *data)
+{
+ const ElfW(Phdr) *pDynamic = NULL;
+
+ if (size == sizeof(struct dl_phdr_info))
+ {
+ int i;
+ for (i = 0; i < info->dlpi_phnum; ++i)
+ {
+ if (info->dlpi_phdr[i].p_type == PT_DYNAMIC)
+ {
+ pDynamic = &(info->dlpi_phdr[i]);
+ break;
+ }
+ }
+ }
+
+ if (pDynamic)
+ {
+ char buffer[100];
+ int len;
+ char exe[PATH_MAX];
+ const char *dsoname = info->dlpi_name;
+
+ dynamic_entry* entry = (dynamic_entry*)data;
+
+ if (strcmp(dsoname, "") == 0)
+ {
+ snprintf(buffer, sizeof(buffer), "/proc/%d/exe", getpid());
+ if ((len = readlink(buffer, exe, PATH_MAX)) != -1)
+ {
+ exe[len] = '\0';
+ dsoname = exe;
+ }
+ }
+
+ if (strcmp(dsoname, entry->name) == 0)
+ {
+ entry->offset = pDynamic->p_offset;
+ return 1;
+ }
+ }
+ return 0;
+}
+
+/* Get the location of the .dynamic section offset for the given elf file.
+ * i.e. same as the "Offset" value shown for DYNAMIC from readelf -l foo
+ *
+ * We want to know this value so that if the binaries have been modifed
+ * by prelink then we can still process the call stack on server side
+ * by comparing this value to that of an "un-prelinked but known to be
+ * otherwise equivalent" version of those binaries and adjust the call
+ * stack addresses by the differences between .dynamic addresses so as
+ * to be able to map the prelinked addresses back to the unprelinked
+ * addresses
+ *
+ * cmc@openoffice.org
+ */
+static ElfW(Off)
+dynamic_section_offset(const char *name)
+{
+ dynamic_entry entry;
+
+ entry.name = name;
+ entry.offset = 0;
+
+ dl_iterate_phdr(callback, &entry);
+
+ return entry.offset;
+}
+#endif
+
static int ReportCrash( int Signal )
{
#ifdef SAL_ENABLE_CRASH_REPORT
@@ -572,6 +655,11 @@ static int ReportCrash( int Signal )
if ( dl_info.dli_fbase && dl_info.dli_fname )
{
+#ifdef LINUX
+ ElfW(Off) dynamic_offset = dynamic_section_offset(dl_info.dli_fname);
+ fprintf( stackout, " 0x%" SAL_PRI_SIZET "x:", dynamic_offset);
+#endif
+
fprintf( stackout, " %s + 0x%" SAL_PRI_PTRDIFFT "x",
dl_info.dli_fname,
(char*)stackframes[iFrame] - (char*)dl_info.dli_fbase
@@ -583,6 +671,10 @@ static int ReportCrash( int Signal )
if ( dli_fdir )
fprintf( xmlout, " path=\"%s\"", dli_fdir );
+
+#ifdef LINUX
+ fprintf( xmlout, " dynamicoffset=\"0x%" SAL_PRI_SIZET "x\"", dynamic_offset );
+#endif
}
else
fprintf( stackout, " ????????" );
diff --git a/ure/source/uretest/JavaClient.java b/ure/source/uretest/JavaClient.java
index e7b6a6ed54d2..fbb35a910c96 100644
--- a/ure/source/uretest/JavaClient.java
+++ b/ure/source/uretest/JavaClient.java
@@ -50,7 +50,7 @@ public final class JavaClient {
if (manager == null) {
throw new NullPointerException("no service manager");
}
- XBridgeFactory factory = (XBridgeFactory) UnoRuntime.queryInterface(
+ XBridgeFactory factory = UnoRuntime.queryInterface(
XBridgeFactory.class,
manager.createInstanceWithContext(
"com.sun.star.bridge.BridgeFactory", context));
@@ -63,11 +63,9 @@ public final class JavaClient {
Connector.create(context).connect(
url.getConnectionAndParametersAsString()),
null);
- Data d =
- ((XServer) UnoRuntime.queryInterface(
- XServer.class, bridge.getInstance(url.getRootOid()))).getData();
- ((XComponent) UnoRuntime.queryInterface(XComponent.class, bridge)).
- dispose();
+ Data d = UnoRuntime.queryInterface(
+ XServer.class, bridge.getInstance(url.getRootOid())).getData();
+ UnoRuntime.queryInterface(XComponent.class, bridge).dispose();
if (!d.m1.equals("Hello") || d.m2 != 42) {
throw new RuntimeException("Data object contains bad values");
}