diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2011-03-08 22:29:39 -0600 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2011-03-08 22:29:39 -0600 |
commit | d7fc91fcd1000a3c8e9cdfd86195d880218b1346 (patch) | |
tree | 34204ed863a869edc6f1b2037450e413af593df6 /jurt | |
parent | aa4a5a276b3e694b7d73c57b23f3a331d2d14bfe (diff) | |
parent | ea713649e558dcec291302bffd00b148a96e33a8 (diff) |
Merge commit 'ooo/DEV300_m101' into integration/dev300_m101
* commit 'ooo/DEV300_m101': (185 commits)
chart52: cleanup unused legend entry stuff in preparation of issue #i82802#
masterfix: #i10000# add missing dependency in offapi
sb138: #i115619# fix for MinGW
sb138: #i115619#, #i116038# use osl_setThreadName in binaryurp
sb138: #i115619# osl_setThreadName
gridsort: i116682: update UnoControlDialog to reflect XDialog
gridsort: minor changes to the new API: - renamed XMutableGridDataModel::setRowHeading to updateRowHeading for consistency reasons - renamed XSortableGridDataModel to XSortableGridData - actually, this is not a full-fledged model in itself.
gridsort: grid control related unit tests (first set, more to come)
sb138: #i116038# fresh implementation of binary URP bridge
chart52: #28670# make the legend within charts resizeable - part 2
gridsort: re-did the column resizing - introduced XGridColumn.Flexibility, determining to which degree the column is resized during auto-column-resizing - removed XGridColumn.PreferredWidth - there really is no need for this anymore now - documented the relationship between XGridColumn.Flexibility and XGridColumn.Resizeable - re-implemented TableControl_Impl::impl_ni_updateColumnWidths, with (hopefully) less magic
sb139: #i116530# improve Java URP bridge error notification by utilizing the java.lang.Throwable cause facility
gridsort: document the relationship between soorting the data and notifying XGridDataListeners
gridsort: introduce XGridColumn::DataModelIndex. this allows for column removal/insertion at the GridColumnModel, without the need to touch the GridDataModel
locales34: #i112431# adapt documentation to reality
gridsort: introduce XSortableGridDataModel::removeColumnSort
gridsort: #163172# added UNO API support for sorting grid data. Implementation still unfinished. Things missing in the SortableGridData implementation - add as listener to the delegator, so we're notified of changes - translate and multiplex those changes - do own notifications (XGridDataListener.dataChanged) when the sort order changed - (possibly) update the sort order when the data in the current sort-column changed
gridsort: made the row title a row heading, being an Any instead of a string
gridsort: XMutableGridData: renamed updateRow to updateRowData for consistency; introduced updateRowToolTip as shortcut for multiple updateCellToolTip calls
gridsort: updateCell->updateCellData, setCellToolTip->updateCellToolTip; in both methods, have (Col,Row) params instead of (Row,Col), for consistency reasons
...
Conflicts:
bridges/inc/bridges/remote/bridgeimpl.hxx
bridges/inc/bridges/remote/connection.h
bridges/inc/bridges/remote/context.h
bridges/inc/bridges/remote/helper.hxx
bridges/inc/bridges/remote/mapping.hxx
bridges/inc/bridges/remote/proxy.hxx
bridges/inc/bridges/remote/remote.h
bridges/inc/bridges/remote/remote.hxx
bridges/inc/bridges/remote/stub.hxx
bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx
bridges/source/remote/context/context.cxx
bridges/source/remote/static/helper.cxx
bridges/source/remote/static/mapping.cxx
bridges/source/remote/static/proxy.cxx
bridges/source/remote/static/remote.cxx
bridges/source/remote/static/remote_types.cxx
bridges/source/remote/static/remote_types.hxx
bridges/source/remote/static/stub.cxx
bridges/source/remote/urp/urp_bridgeimpl.cxx
bridges/source/remote/urp/urp_bridgeimpl.hxx
bridges/source/remote/urp/urp_cache.h
bridges/source/remote/urp/urp_cache.hxx
bridges/source/remote/urp/urp_dispatch.cxx
bridges/source/remote/urp/urp_dispatch.hxx
bridges/source/remote/urp/urp_environment.cxx
bridges/source/remote/urp/urp_job.cxx
bridges/source/remote/urp/urp_job.hxx
bridges/source/remote/urp/urp_log.cxx
bridges/source/remote/urp/urp_log.hxx
bridges/source/remote/urp/urp_marshal.cxx
bridges/source/remote/urp/urp_marshal.hxx
bridges/source/remote/urp/urp_marshal_decl.hxx
bridges/source/remote/urp/urp_property.hxx
bridges/source/remote/urp/urp_propertyobject.cxx
bridges/source/remote/urp/urp_propertyobject.hxx
bridges/source/remote/urp/urp_reader.cxx
bridges/source/remote/urp/urp_reader.hxx
bridges/source/remote/urp/urp_replycontainer.hxx
bridges/source/remote/urp/urp_threadid.cxx
bridges/source/remote/urp/urp_threadid.hxx
bridges/source/remote/urp/urp_unmarshal.cxx
bridges/source/remote/urp/urp_unmarshal.hxx
bridges/source/remote/urp/urp_writer.cxx
bridges/source/remote/urp/urp_writer.hxx
cppu/source/threadpool/threadpool.cxx
cppu/util/target.pmk
cppuhelper/qa/propertysetmixin/comp_propertysetmixin.cxx
cppuhelper/source/interfacecontainer.cxx
cpputools/source/regcomplazy/regcomplazy.cxx
jurt/prj/d.lst
jvmfwk/source/elements.cxx
offapi/com/sun/star/awt/grid/GridDataEvent.idl
offapi/com/sun/star/awt/grid/XGridColumn.idl
offapi/com/sun/star/awt/tab/makefile.mk
offapi/com/sun/star/chart2/ExplicitIncrementData.idl
offapi/com/sun/star/chart2/XPlotter.idl
offapi/com/sun/star/chart2/XUndoHelper.idl
offapi/com/sun/star/document/MediaDescriptor.idl
offapi/com/sun/star/document/makefile.mk
offapi/com/sun/star/linguistic2/XLanguageGuessing.idl
offapi/com/sun/star/script/ModuleInfo.idl
offapi/com/sun/star/script/ModuleType.idl
offapi/com/sun/star/text/TextMarkupType.idl
offapi/com/sun/star/util/XTextSearch.idl
offapi/com/sun/star/xml/sax/XFastAttributeList.idl
pyuno/source/loader/makefile.mk
remotebridges/source/bridge/bridge_connection.cxx
remotebridges/source/bridge/bridge_connection.hxx
remotebridges/source/bridge/bridge_provider.cxx
remotebridges/source/bridge/remote_bridge.cxx
remotebridges/source/bridge/remote_bridge.hxx
remotebridges/source/dynamicloader/dynamicloader.cxx
remotebridges/source/factory/bridgefactory.cxx
remotebridges/source/factory/bridgeimpl.cxx
remotebridges/source/factory/bridgeimpl.hxx
remotebridges/source/factory/makefile.mk
sal/cppunittester/cppunittester.cxx
sal/inc/osl/diagnose.h
sal/osl/os2/system.h
sal/osl/unx/diagnose.c
sal/osl/unx/file_misc.cxx
sal/osl/unx/process_impl.cxx
sal/osl/w32/diagnose.c
sal/osl/w32/process.cxx
sal/prj/build.lst
sal/qa/rtl/math/makefile.mk
sal/qa/rtl/math/rtl_math.cxx
sal/qa/rtl/math/rtl_old_testint64.cxx
sal/qa/rtl/math/test_rtl_math.cxx
sal/systools/win32/kill/kill.cxx
sal/textenc/tencinfo.c
sal/util/sal.map
stoc/source/inspect/introspection.cxx
stoc/source/security/file_policy.cxx
stoc/source/simpleregistry/simpleregistry.cxx
Diffstat (limited to 'jurt')
24 files changed, 154 insertions, 228 deletions
diff --git a/jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java b/jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java index a444f1813c3d..1c4819326268 100644 --- a/jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java +++ b/jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java @@ -94,18 +94,6 @@ public class BridgeFactory implements XBridgeFactory/*, XEventListener*/ { } /** - * Writes the service information into the given registry key. - * This method is called by the <code>JavaLoader</code> - * <p> - * @return returns true if the operation succeeded - * @param regKey the registryKey - * @see com.sun.star.comp.loader.JavaLoader - */ - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return FactoryHelper.writeRegistryServiceInfo(BridgeFactory.class.getName(), __serviceName, regKey); - } - - /** * Creates a remote bridge and memorizes it under <code>sName</code>. * <p> * @return the bridge diff --git a/jurt/com/sun/star/comp/connections/Acceptor.java b/jurt/com/sun/star/comp/connections/Acceptor.java index 3df51e735a1c..2dcfbc507d7b 100644 --- a/jurt/com/sun/star/comp/connections/Acceptor.java +++ b/jurt/com/sun/star/comp/connections/Acceptor.java @@ -84,21 +84,6 @@ public final class Acceptor implements XAcceptor { } /** - * Writes the service information into the given registry key. - * - * <p>This method is called by the <code>JavaLoader</code>.</p> - * - * @param regKey the registry key. - * @return <code>true</code> if the operation succeeded. - * - * @see com.sun.star.comp.loader.JavaLoader - */ - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return FactoryHelper.writeRegistryServiceInfo(Acceptor.class.getName(), - __serviceName, regKey); - } - - /** * Constructs a new <code>Acceptor</code> that uses the given service * factory to create a specific <code>XAcceptor</code>. * diff --git a/jurt/com/sun/star/comp/connections/Connector.java b/jurt/com/sun/star/comp/connections/Connector.java index c02db5c52b8b..a9e0a2c5cc84 100644 --- a/jurt/com/sun/star/comp/connections/Connector.java +++ b/jurt/com/sun/star/comp/connections/Connector.java @@ -84,21 +84,6 @@ public class Connector implements XConnector { } /** - * Writes the service information into the given registry key. - * - * <p>This method is called by the <code>JavaLoader</code>.</p> - * - * @param regKey the registry key. - * @return <code>true</code> if the operation succeeded. - * - * @see com.sun.star.comp.loader.JavaLoader - */ - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return FactoryHelper.writeRegistryServiceInfo(Connector.class.getName(), - __serviceName, regKey); - } - - /** * Constructs a new <code>Connector</code> that uses the given service * factory to create a specific <code>XConnector</code>. * diff --git a/jurt/com/sun/star/comp/connections/ConstantInstanceProvider.java b/jurt/com/sun/star/comp/connections/ConstantInstanceProvider.java index f63eeadf10d8..b801cb36d8a5 100644 --- a/jurt/com/sun/star/comp/connections/ConstantInstanceProvider.java +++ b/jurt/com/sun/star/comp/connections/ConstantInstanceProvider.java @@ -85,20 +85,6 @@ public class ConstantInstanceProvider implements XInstanceProvider { return xSingleServiceFactory; } - /** - * Writes the service information into the given registry key. - * This method is called by the <code>JavaLoader</code> - * <p> - * @return returns true if the operation succeeded - * @param regKey the registryKey - * @see com.sun.star.comp.loader.JavaLoader - */ - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return FactoryHelper.writeRegistryServiceInfo(ConstantInstanceProvider.class.getName(), __serviceName, regKey); - } - - - protected XMultiServiceFactory _serviceManager; protected String _serviceName; protected Object _instance; diff --git a/jurt/com/sun/star/comp/connections/PipedConnection.java b/jurt/com/sun/star/comp/connections/PipedConnection.java index 630adf4e223b..f5a839ea78c5 100644 --- a/jurt/com/sun/star/comp/connections/PipedConnection.java +++ b/jurt/com/sun/star/comp/connections/PipedConnection.java @@ -86,19 +86,6 @@ public class PipedConnection implements XConnection { } /** - * Writes the service information into the given registry key. - * This method is called by the <code>JavaLoader</code> - * <p> - * @return returns true if the operation succeeded - * @param regKey the registryKey - * @see com.sun.star.comp.loader.JavaLoader - */ - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return FactoryHelper.writeRegistryServiceInfo(PipedConnection.class.getName(), __serviceName, regKey); - } - - - /** * The amount of time in milliseconds, to wait to * see check the buffers. */ diff --git a/jurt/com/sun/star/comp/urlresolver/UrlResolver.java b/jurt/com/sun/star/comp/urlresolver/UrlResolver.java index 3509dfb303f2..538315638553 100644 --- a/jurt/com/sun/star/comp/urlresolver/UrlResolver.java +++ b/jurt/com/sun/star/comp/urlresolver/UrlResolver.java @@ -154,18 +154,4 @@ public class UrlResolver { return xSingleServiceFactory; } - - /** - * Writes the service information into the given registry key. - * This method is called by the <code>JavaLoader</code> - * <p> - * @return returns true if the operation succeeded - * @param regKey the registryKey - * @see com.sun.star.comp.loader.JavaLoader - */ - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return FactoryHelper.writeRegistryServiceInfo(_UrlResolver.class.getName(), _UrlResolver.__serviceName, regKey); - } - } - diff --git a/jurt/com/sun/star/lib/connections/pipe/pipeAcceptor.java b/jurt/com/sun/star/lib/connections/pipe/pipeAcceptor.java index 4c5bf7f1c979..25b2ec4abfe3 100644 --- a/jurt/com/sun/star/lib/connections/pipe/pipeAcceptor.java +++ b/jurt/com/sun/star/lib/connections/pipe/pipeAcceptor.java @@ -84,21 +84,6 @@ public final class pipeAcceptor implements XAcceptor { } /** - * Writes the service information into the given registry key. - * - * <p>This method is called by the <code>JavaLoader</code>.</p> - * - * @param regKey the registry key. - * @return <code>true</code> if the operation succeeded. - * - * @see com.sun.star.comp.loader.JavaLoader - */ - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return FactoryHelper.writeRegistryServiceInfo( - pipeAcceptor.class.getName(), __serviceName, regKey); - } - - /** * Accepts a connection request via the described pipe. * * <p>This call blocks until a connection has been established.</p> diff --git a/jurt/com/sun/star/lib/connections/pipe/pipeConnector.java b/jurt/com/sun/star/lib/connections/pipe/pipeConnector.java index 9c0c412ec2bc..9856fb2e116e 100644 --- a/jurt/com/sun/star/lib/connections/pipe/pipeConnector.java +++ b/jurt/com/sun/star/lib/connections/pipe/pipeConnector.java @@ -84,21 +84,6 @@ public final class pipeConnector implements XConnector { } /** - * Writes the service information into the given registry key. - * - * <p>This method is called by the <code>JavaLoader</code>.</p> - * - * @param regKey the registry key. - * @return <code>true</code> if the operation succeeded. - * - * @see com.sun.star.comp.loader.JavaLoader - */ - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return FactoryHelper.writeRegistryServiceInfo( - pipeConnector.class.getName(), __serviceName, regKey); - } - - /** * Connects via the described pipe to a waiting server. * * <p>The connection description has the following format: diff --git a/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java b/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java index f2119225f029..bf9456d0058a 100644 --- a/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java +++ b/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java @@ -89,21 +89,6 @@ public final class socketAcceptor implements XAcceptor { } /** - * Writes the service information into the given registry key. - * - * <p>This method is called by the <code>JavaLoader</code>.</p> - * - * @param regKey the registry key. - * @return <code>true</code> if the operation succeeded. - * - * @see com.sun.star.comp.loader.JavaLoader - */ - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return FactoryHelper.writeRegistryServiceInfo( - socketAcceptor.class.getName(), __serviceName, regKey); - } - - /** * Accepts a connection request via the described socket. * * <p>This call blocks until a connection has been established.</p> diff --git a/jurt/com/sun/star/lib/connections/socket/socketConnector.java b/jurt/com/sun/star/lib/connections/socket/socketConnector.java index f85a5ac41bd0..3a7bf183d223 100644 --- a/jurt/com/sun/star/lib/connections/socket/socketConnector.java +++ b/jurt/com/sun/star/lib/connections/socket/socketConnector.java @@ -89,21 +89,6 @@ public final class socketConnector implements XConnector { } /** - * Writes the service information into the given registry key. - * - * <p>This method is called by the <code>JavaLoader</code>.</p> - * - * @param regKey the registry key. - * @return <code>true</code> if the operation succeeded. - * - * @see com.sun.star.comp.loader.JavaLoader - */ - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return FactoryHelper.writeRegistryServiceInfo( - socketConnector.class.getName(), __serviceName, regKey); - } - - /** * Connects via the described socket to a waiting server. * * <p>The connection description has the following format: diff --git a/jurt/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory.java b/jurt/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory.java index b81db391966f..ae2719f1c07d 100644 --- a/jurt/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory.java +++ b/jurt/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory.java @@ -148,11 +148,22 @@ final class ProxyFactory { private Object request(String operation, Object[] args) throws Throwable { - return requestHandler.sendRequest(oid, type, operation, args); + Object res = requestHandler.sendRequest(oid, type, operation, args); + // Avoid early finalization of this object, while an invoke -> + // request call is still ongoing; as finalize also calls request, + // this should fulfil the condition from The Java Language + // Specification, 3rd ed., that "if an object's finalizer can result + // in synchronization on that object, then that object must be alive + // and considered reachable whenever a lock is held on it:" + synchronized (this) { + ++dummy; + } + return res; } private final String oid; private final Type type; + private int dummy = 0; } private static final Method METHOD_EQUALS; diff --git a/jurt/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge.java b/jurt/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge.java index 267a84d7515f..221870b0b035 100644 --- a/jurt/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge.java +++ b/jurt/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge.java @@ -155,7 +155,7 @@ public class java_remote_bridge new Job(obj, java_remote_bridge.this, msg)); } } catch (Throwable e) { - dispose(new DisposedException(e.toString())); + dispose(e); } } @@ -478,12 +478,12 @@ public class java_remote_bridge dispose = _life_count <= 0; } if (dispose) { - dispose(new com.sun.star.uno.RuntimeException("end of life")); + dispose(new Throwable("end of life")); } } public void dispose() { - dispose(new com.sun.star.uno.RuntimeException("user dispose")); + dispose(new Throwable("user dispose")); } private void dispose(Throwable throwable) { @@ -499,6 +499,8 @@ public class java_remote_bridge ((DisposeListener) i.next()).notifyDispose(this); } + _iProtocol.terminate(); + try { _messageDispatcher.terminate(); @@ -602,7 +604,8 @@ public class java_remote_bridge _iProtocol.writeReply(exception, threadId, result); } catch (IOException e) { dispose(e); - throw new DisposedException("unexpected " + e); + throw (DisposedException) + (new DisposedException("unexpected " + e).initCause(e)); } catch (RuntimeException e) { dispose(e); throw e; @@ -631,9 +634,9 @@ public class java_remote_bridge oid, TypeDescription.getTypeDescription(type), operation, threadId, params); } catch (IOException e) { - DisposedException d = new DisposedException(e.toString()); - dispose(d); - throw d; + dispose(e); + throw (DisposedException) + new DisposedException(e.toString()).initCause(e); } if (sync && Thread.currentThread() != _messageDispatcher) { result = _iThreadPool.enter(handle, threadId); diff --git a/jurt/com/sun/star/lib/uno/environments/remote/IProtocol.java b/jurt/com/sun/star/lib/uno/environments/remote/IProtocol.java index 1fae45e9ca23..de581ea86c7b 100644 --- a/jurt/com/sun/star/lib/uno/environments/remote/IProtocol.java +++ b/jurt/com/sun/star/lib/uno/environments/remote/IProtocol.java @@ -51,6 +51,8 @@ public interface IProtocol { */ void init() throws IOException; + void terminate(); + /** * Reads a request or reply message. * diff --git a/jurt/com/sun/star/lib/uno/environments/remote/IThreadPool.java b/jurt/com/sun/star/lib/uno/environments/remote/IThreadPool.java index c70ccfa7e934..71961737fd55 100644 --- a/jurt/com/sun/star/lib/uno/environments/remote/IThreadPool.java +++ b/jurt/com/sun/star/lib/uno/environments/remote/IThreadPool.java @@ -110,10 +110,10 @@ public interface IThreadPool { /** * Disposes this thread pool, thus releasing - * all threads by throwing the given - * <code>Throwable</code>. + * all threads by throwing a <code>DisposedException</code> with the given + * <code>Throwable</code> cause. * <p> - * @param throwing the Throwable + * @param throwing the cause */ public void dispose(Throwable throwable); diff --git a/jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java b/jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java index f7568a30cef7..62e49cc44f16 100644 --- a/jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java +++ b/jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java @@ -27,6 +27,7 @@ package com.sun.star.lib.uno.environments.remote; +import com.sun.star.lang.DisposedException; /** * The <code>JobQueue</code> implements a queue for jobs. @@ -200,7 +201,7 @@ public class JobQueue { * @return a job or null if timed out * @param waitTime the maximum amount of time to wait for a job */ - private Job removeJob(int waitTime) throws Throwable { + private Job removeJob(int waitTime) { if(DEBUG) System.err.println("##### " + getClass().getName() + ".removeJob:" + _head + " " + _threadId); Job job = null; @@ -210,7 +211,8 @@ public class JobQueue { while(_head == null && (waitTime == 0 || !waited)) { if(_doDispose == _disposeId) { _doDispose = null; - throw _throwable; + throw (DisposedException) + new DisposedException().initCause(_throwable); } // notify sync queues @@ -250,7 +252,8 @@ public class JobQueue { if(_doDispose == _disposeId) { _doDispose = null; - throw _throwable; + throw (DisposedException) + new DisposedException().initCause(_throwable); } try { diff --git a/jurt/com/sun/star/lib/uno/protocols/urp/Cache.java b/jurt/com/sun/star/lib/uno/protocols/urp/Cache.java index 48268a53a260..d9c57af30cce 100644 --- a/jurt/com/sun/star/lib/uno/protocols/urp/Cache.java +++ b/jurt/com/sun/star/lib/uno/protocols/urp/Cache.java @@ -52,7 +52,7 @@ final class Cache { if (e == null) { if (map.size() < maxSize) { // There is still room for a new entry at the front: - e = new Entry(content, map.size(), last, null); + e = new Entry(content, map.size(), null, first); if (first == null) { last = e; } else { diff --git a/jurt/com/sun/star/lib/uno/protocols/urp/urp.java b/jurt/com/sun/star/lib/uno/protocols/urp/urp.java index da54bc7612a1..a158e1138db1 100644 --- a/jurt/com/sun/star/lib/uno/protocols/urp/urp.java +++ b/jurt/com/sun/star/lib/uno/protocols/urp/urp.java @@ -30,6 +30,7 @@ package com.sun.star.lib.uno.protocols.urp; import com.sun.star.bridge.InvalidProtocolChangeException; import com.sun.star.bridge.ProtocolProperty; import com.sun.star.bridge.XProtocolProperties; +import com.sun.star.lang.DisposedException; import com.sun.star.lib.uno.environments.remote.IProtocol; import com.sun.star.lib.uno.environments.remote.Message; import com.sun.star.lib.uno.environments.remote.ThreadId; @@ -79,6 +80,15 @@ public final class urp implements IProtocol { } } + // @see IProtocol#terminate + public void terminate() { + synchronized (monitor) { + state = STATE_TERMINATED; + initialized = true; + monitor.notifyAll(); + } + } + // @see IProtocol#readMessage public Message readMessage() throws IOException { for (;;) { @@ -125,6 +135,9 @@ public final class urp implements IProtocol { throw new RuntimeException(e.toString()); } } + if (state == STATE_TERMINATED) { + throw new DisposedException(); + } return writeRequest(false, oid, type, function, tid, arguments); } } @@ -375,7 +388,6 @@ public final class urp implements IProtocol { if ((header & HEADER_NEWTID) != 0) { inL1Tid = unmarshal.readThreadId(); } - //TODO: check HEADER_IGNORECACHE return readRequest(funId, sync); } @@ -684,7 +696,6 @@ public final class urp implements IProtocol { private static final int HEADER_NEWOID = 0x10; private static final int HEADER_NEWTID = 0x08; private static final int HEADER_FUNCTIONID16 = 0x04; - private static final int HEADER_IGNORECACHE = 0x02; private static final int HEADER_MOREFLAGS = 0x01; private static final int HEADER_MUSTREPLY = 0x80; private static final int HEADER_SYNCHRONOUS = 0x40; @@ -701,6 +712,7 @@ public final class urp implements IProtocol { private static final int STATE_REQUESTED = 2; private static final int STATE_COMMITTED = 3; private static final int STATE_WAIT = 4; + private static final int STATE_TERMINATED = 5; private static final int MAX_RELEASE_QUEUE_SIZE = 100; diff --git a/jurt/prj/build.lst b/jurt/prj/build.lst index 9b9b722bc3ae..6ba92a9ec6b6 100644 --- a/jurt/prj/build.lst +++ b/jurt/prj/build.lst @@ -17,3 +17,4 @@ ju jurt\com\sun\star\comp\urlresolver nmake - all ju_urlres ju_co_loader NULL ju jurt\source\pipe nmake - all ju_src_pipe NULL ju jurt\source\pipe\wrapper nmake - w ju_src_pipe_wrapper NULL ju jurt\util nmake - all ju_ut ju_brid_jrm ju_co_bfactr ju_con ju_con_sock ju_con_pipe ju_cssl_uno ju_env_java ju_prot_urp ju_servman ju_urlres ju_src_pipe ju_libutil ju_uno NULL +ju jurt\test\com\sun\star\lib\uno\protocols\urp nmake - all ju_test_css_lib_uno_protocols_urp NULL diff --git a/jurt/prj/d.lst b/jurt/prj/d.lst index a55c9fa3572c..499812e28a93 100644 --- a/jurt/prj/d.lst +++ b/jurt/prj/d.lst @@ -3,5 +3,6 @@ ..\%__SRC%\bin\jpipx.dll %_DEST%\bin%_EXT%\jpipx.dll ..\%__SRC%\lib\libjpipe*.so %_DEST%\lib%_EXT%\libjpipe*.so ..\%__SRC%\lib\libjpipe.jnilib %_DEST%\lib%_EXT%\libjpipe.jnilib +..\%__SRC%\lib\libjpipe*.jnilib %_DEST%\lib%_EXT%\libjpipe*.jnilib ..\%__SRC%\bin\jurt_src.zip %COMMON_DEST%\bin%_EXT%\jurt_src.zip diff --git a/jurt/source/pipe/makefile.mk b/jurt/source/pipe/makefile.mk index 5be6f1ebfd10..4a6dc59c89c2 100644 --- a/jurt/source/pipe/makefile.mk +++ b/jurt/source/pipe/makefile.mk @@ -41,6 +41,7 @@ SHL1TARGET = jpipe .END SHL1CODETYPE = C +SHL1CREATEJNILIB=TRUE SHL1IMPLIB = i$(SHL1TARGET) SHL1OBJS = $(SLO)/com_sun_star_lib_connections_pipe_PipeConnection.obj SHL1RPATH = URELIB diff --git a/jurt/test/com/sun/star/lib/uno/protocols/urp/Cache_Test.java b/jurt/test/com/sun/star/lib/uno/protocols/urp/Cache_Test.java index 31d3454bde48..2deb525adeac 100644 --- a/jurt/test/com/sun/star/lib/uno/protocols/urp/Cache_Test.java +++ b/jurt/test/com/sun/star/lib/uno/protocols/urp/Cache_Test.java @@ -27,80 +27,114 @@ package com.sun.star.lib.uno.protocols.urp; -import complexlib.ComplexTestCase; +import org.junit.Test; +import static org.junit.Assert.*; -public final class Cache_Test extends ComplexTestCase { - public String[] getTestMethodNames() { - return new String[] { "test0", "test1", "test2", "test3" }; - } - - public void test0() { +public final class Cache_Test { + @Test public void test0() { Cache c = new Cache(0); boolean[] f = new boolean[1]; int i; i = c.add(f, "a"); - assure("1", i == Cache.NOT_CACHED && !f[0]); + assertTrue(i == Cache.NOT_CACHED && !f[0]); i = c.add(f, "a"); - assure("2", i == Cache.NOT_CACHED && !f[0]); + assertTrue(i == Cache.NOT_CACHED && !f[0]); i = c.add(f, "b"); - assure("3", i == Cache.NOT_CACHED && !f[0]); + assertTrue(i == Cache.NOT_CACHED && !f[0]); i = c.add(f, "a"); - assure("4", i == Cache.NOT_CACHED && !f[0]); + assertTrue(i == Cache.NOT_CACHED && !f[0]); } - public void test1() { + @Test public void test1() { Cache c = new Cache(1); boolean[] f = new boolean[1]; int i; i = c.add(f, "a"); - assure("1", i == 0 && !f[0]); + assertTrue(i == 0 && !f[0]); i = c.add(f, "a"); - assure("2", i == 0 && f[0]); + assertTrue(i == 0 && f[0]); i = c.add(f, "b"); - assure("3", i == 0 && !f[0]); + assertTrue(i == 0 && !f[0]); i = c.add(f, "b"); - assure("4", i == 0 && f[0]); + assertTrue(i == 0 && f[0]); i = c.add(f, "a"); - assure("5", i == 0 && !f[0]); + assertTrue(i == 0 && !f[0]); } - public void test2() { + @Test public void test2() { Cache c = new Cache(2); boolean[] f = new boolean[1]; int i; i = c.add(f, "a"); - assure("1", i == 0 && !f[0]); + assertTrue(i == 0 && !f[0]); i = c.add(f, "a"); - assure("2", i == 0 && f[0]); + assertTrue(i == 0 && f[0]); i = c.add(f, "b"); - assure("3", i == 1 && !f[0]); + assertTrue(i == 1 && !f[0]); i = c.add(f, "b"); - assure("4", i == 1 && f[0]); + assertTrue(i == 1 && f[0]); i = c.add(f, "a"); - assure("5", i == 0 && f[0]); + assertTrue(i == 0 && f[0]); i = c.add(f, "c"); - assure("6", i == 1 && !f[0]); + assertTrue(i == 1 && !f[0]); i = c.add(f, "b"); - assure("7", i == 0 && !f[0]); + assertTrue(i == 0 && !f[0]); } - public void test3() { + @Test public void test3() { Cache c = new Cache(3); boolean[] f = new boolean[1]; int i; i = c.add(f, "a"); - assure("1", i == 0 && !f[0]); + assertTrue(i == 0 && !f[0]); i = c.add(f, "a"); - assure("3", i == 0 && f[0]); + assertTrue(i == 0 && f[0]); i = c.add(f, "b"); - assure("5", i == 1 && !f[0]); + assertTrue(i == 1 && !f[0]); i = c.add(f, "a"); - assure("3", i == 0 && f[0]); + assertTrue(i == 0 && f[0]); i = c.add(f, "c"); - assure("7", i == 2 && !f[0]); + assertTrue(i == 2 && !f[0]); i = c.add(f, "d"); - assure("9", i == 1 && !f[0]); + assertTrue(i == 1 && !f[0]); i = c.add(f, "d"); - assure("11", i == 1 && f[0]); + assertTrue(i == 1 && f[0]); + } + + @Test public void testNothingLostFromLruList() { + // Regardless in what order arbitrary values from 0, ..., 3 are inserted + // into a size-4 cache, afterwards adding -1, ..., -4 must return each + // possible index in the range from 0, ..., 3 exactly once (so their sum + // must be 6); this code systematically tests all such arbitrary ways up + // to length 8 (the code arguably violates recommendations for writing + // good tests, but actually helped track down an error in the Cache + // implementation): + int[] a = new int[8]; + for (int i = 0; i < a.length; ++i) { + for (int j = 0; j < i; ++j) { + a[j] = 0; + } + for (;;) { + Cache c = new Cache(4); + for (int k = 0; k < i; ++k) { + c.add(new boolean[1], a[k]); + } + assertEquals( + 6, + (c.add(new boolean[1], -1) + c.add(new boolean[1], -2) + + c.add(new boolean[1], -3) + c.add(new boolean[1], -4))); + int j = i - 1; + while (j >= 0 && a[j] == 3) { + --j; + } + if (j < 0) { + break; + } + ++a[j]; + for (int k = j + 1; k < i; ++k) { + a[k] = 0; + } + } + } } } diff --git a/jurt/test/com/sun/star/lib/uno/protocols/urp/Marshaling_Test.java b/jurt/test/com/sun/star/lib/uno/protocols/urp/Marshaling_Test.java index 4c01e9acc9c6..2621006faf95 100644 --- a/jurt/test/com/sun/star/lib/uno/protocols/urp/Marshaling_Test.java +++ b/jurt/test/com/sun/star/lib/uno/protocols/urp/Marshaling_Test.java @@ -32,21 +32,14 @@ import com.sun.star.uno.IBridge; import com.sun.star.uno.Type; import com.sun.star.uno.TypeClass; import com.sun.star.uno.XInterface; -import complexlib.ComplexTestCase; import java.lang.reflect.Array; import java.lang.reflect.Field; import java.lang.reflect.Modifier; +import org.junit.Test; +import static org.junit.Assert.*; -public final class Marshaling_Test extends ComplexTestCase { - public String getTestObjectName() { - return getClass().getName(); - } - - public String[] getTestMethodNames() { - return new String[] { "test" }; - } - - public void test() throws Exception { +public final class Marshaling_Test { + @Test public void test() throws Exception { short cacheSize = (short)256; TestBridge testBridge = new TestBridge(); Marshal marshal = new Marshal(testBridge, cacheSize); @@ -239,7 +232,7 @@ public final class Marshaling_Test extends ComplexTestCase { if(op1 instanceof Any) op1 = ((Any)op1).getObject(); - assure("", compareObjects(op1, op2)); + assertTrue(compareObjects(op1, op2)); } } diff --git a/jurt/test/com/sun/star/lib/uno/protocols/urp/Protocol_Test.java b/jurt/test/com/sun/star/lib/uno/protocols/urp/Protocol_Test.java index 393720c9756d..6a74710625e9 100644 --- a/jurt/test/com/sun/star/lib/uno/protocols/urp/Protocol_Test.java +++ b/jurt/test/com/sun/star/lib/uno/protocols/urp/Protocol_Test.java @@ -34,20 +34,17 @@ import com.sun.star.uno.Any; import com.sun.star.uno.IBridge; import com.sun.star.uno.Type; import com.sun.star.uno.XInterface; -import complexlib.ComplexTestCase; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PipedInputStream; import java.io.PipedOutputStream; import java.util.LinkedList; +import org.junit.Test; +import static org.junit.Assert.*; -public final class Protocol_Test extends ComplexTestCase { - public String[] getTestMethodNames() { - return new String[] { "test" }; - } - - public void test() throws Exception { +public final class Protocol_Test { + @Test public void test() throws Exception { IBridge iBridge = new TestBridge(); PipedInputStream inA = new PipedInputStream(); PipedOutputStream outA = new PipedOutputStream(inA); @@ -93,7 +90,7 @@ public final class Protocol_Test extends ComplexTestCase { new Object[] { "hallo" }); Message iMessage = iReceiver.readMessage(); Object[] t_params = iMessage.getArguments(); - assure("", "hallo".equals((String)t_params[0])); + assertEquals("hallo", (String)t_params[0]); // send a reply iReceiver.writeReply(false, new ThreadId(new byte[] { 0, 1 }), null); @@ -118,7 +115,7 @@ public final class Protocol_Test extends ComplexTestCase { iReceiver.writeReply(false, new ThreadId(new byte[] { 0, 1 }), null); iSender.readMessage(); - assure("", "testString".equals(((String [])params[0])[0])); + assertEquals("testString", ((String [])params[0])[0]); } public void testCallWithInOutParameter( @@ -133,7 +130,7 @@ public final class Protocol_Test extends ComplexTestCase { Object[] t_params = iMessage.getArguments(); - assure("", "inString".equals(((String [])t_params[0])[0])); + assertEquals("inString", ((String [])t_params[0])[0]); // provide reply ((String [])t_params[0])[0] = "outString"; @@ -142,7 +139,7 @@ public final class Protocol_Test extends ComplexTestCase { iReceiver.writeReply(false, new ThreadId(new byte[] { 0, 1 }), null); iSender.readMessage(); - assure("", "outString".equals(((String [])params[0])[0])); + assertEquals("outString", ((String [])params[0])[0]); } public void testCallWithResult( @@ -161,7 +158,7 @@ public final class Protocol_Test extends ComplexTestCase { Message iMessage = iSender.readMessage(); Object result = iMessage.getResult(); - assure("", "resultString".equals(result)); + assertEquals("resultString", result); } public void testCallWhichRaisesException( @@ -181,7 +178,7 @@ public final class Protocol_Test extends ComplexTestCase { Object result = iMessage.getResult(); - assure("", result instanceof com.sun.star.uno.RuntimeException); + assertTrue(result instanceof com.sun.star.uno.RuntimeException); } public void testCallWithIn_Out_InOut_Paramters_and_result( @@ -196,9 +193,9 @@ public final class Protocol_Test extends ComplexTestCase { Object[] t_params = iMessage.getArguments(); - assure("", "hallo".equals((String)t_params[0])); + assertEquals("hallo", (String)t_params[0]); - assure("", "inOutString".equals(((String [])t_params[2])[0])); + assertEquals("inOutString", ((String [])t_params[2])[0]); ((String [])t_params[1])[0] = "outString"; ((String [])t_params[2])[0] = "inOutString_res"; @@ -209,11 +206,11 @@ public final class Protocol_Test extends ComplexTestCase { iMessage = iSender.readMessage(); Object result = iMessage.getResult(); - assure("", "outString".equals(((String [])params[1])[0])); + assertEquals("outString", ((String [])params[1])[0]); - assure("", "inOutString_res".equals(((String [])params[2])[0])); + assertEquals("inOutString_res", ((String [])params[2])[0]); - assure("", "resultString".equals(result)); + assertEquals("resultString", result); } public void testCallWhichReturnsAny( @@ -229,9 +226,11 @@ public final class Protocol_Test extends ComplexTestCase { false, new ThreadId(new byte[] { 0, 1 }), Any.VOID); Message iMessage = iSender.readMessage(); Object result = iMessage.getResult(); - assure("", result instanceof Any - && (TypeDescription.getTypeDescription(((Any) result).getType()). - getZClass() == void.class)); + assertTrue( + result instanceof Any && + ((TypeDescription.getTypeDescription(((Any) result).getType()). + getZClass()) == + void.class)); // send an ordinary request iSender.writeRequest( @@ -244,7 +243,7 @@ public final class Protocol_Test extends ComplexTestCase { new Any(XInterface.class, null)); iMessage = iSender.readMessage(); result = iMessage.getResult(); - assure("", result == null); + assertNull(result); // send an ordinary request iSender.writeRequest( @@ -256,7 +255,7 @@ public final class Protocol_Test extends ComplexTestCase { false, new ThreadId(new byte[] { 0, 1 }), new Integer(501)); iMessage = iSender.readMessage(); result = iMessage.getResult(); - assure("", result.equals(new Integer(501))); + assertEquals(501, result); } private static final class Endpoint { diff --git a/jurt/test/com/sun/star/lib/uno/protocols/urp/makefile.mk b/jurt/test/com/sun/star/lib/uno/protocols/urp/makefile.mk index c6e66558b65d..8403b2bd71ed 100644 --- a/jurt/test/com/sun/star/lib/uno/protocols/urp/makefile.mk +++ b/jurt/test/com/sun/star/lib/uno/protocols/urp/makefile.mk @@ -24,10 +24,16 @@ # for a copy of the LGPLv3 License. # #************************************************************************* + +.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +nothing .PHONY: +.ELSE + PRJ := ..$/..$/..$/..$/..$/..$/..$/.. PRJNAME := jurt TARGET := test_com_sun_star_lib_uno_protocols_urp +.IF "$(OOO_JUNIT_JAR)" != "" PACKAGE := com$/sun$/star$/lib$/uno$/protocols$/urp JAVATESTFILES := \ Cache_Test.java \ @@ -38,5 +44,8 @@ JAVAFILES := \ TestObject.java JARFILES := ridl.jar IDLTESTFILES := interfaces.idl +.END .INCLUDE: javaunittest.mk + +.END |