summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Johnson <mjj29@adonis.trinhall.cam.ac.uk>2007-08-29 16:45:24 +0100
committerMatthew Johnson <mjj29@adonis.trinhall.cam.ac.uk>2007-08-29 16:45:24 +0100
commitb3d5aeedc9a34b86eebcca92c2998c39e7ce3dbb (patch)
tree9e2a5fea4788ce294f36a199c567f5fc8c6e3cb0
parent4aaf71367a841811990e788ec02c808c94021753 (diff)
+++ b/changelog
+ * Add licence headers to files missing them + * Fix minor bug in AbstractConnection.java (reported by Frank Benoit + <benoit -at- tionex -dot- de>
-rw-r--r--TODO2
-rw-r--r--changelog3
-rw-r--r--org/freedesktop/dbus/AbstractConnection.java4
-rw-r--r--org/freedesktop/dbus/MethodCall.java30
-rw-r--r--org/freedesktop/dbus/bin/Caller.java10
-rw-r--r--org/freedesktop/dbus/test/test_low_level.java10
6 files changed, 56 insertions, 3 deletions
diff --git a/TODO b/TODO
index 8a47efa..10d7646 100644
--- a/TODO
+++ b/TODO
@@ -1,3 +1,5 @@
+ ** check that the blocking is correct on DBusAsyncReply and add an explicit timeout value
+ * only hold weak refs to user objects and reply correctly when they have gone
* Javadoc
* don't respond to Introspect/Ping except on the right interface Serkan Kaba <serkan_kaba -at- yahoo -dot- com>
* document that we handle Introspect for you
diff --git a/changelog b/changelog
index dfabe88..1967d6c 100644
--- a/changelog
+++ b/changelog
@@ -2,6 +2,9 @@ Version 2.3.2:
* Fix empty array/map bug (reported by Jan Kümmel
<freedesktop -at- snorc -dot- org>)
+ * Add licence headers to files missing them
+ * Fix minor bug in AbstractConnection.java (reported by Frank Benoit
+ <benoit -at- tionex -dot- de>
Version 2.3.1:
diff --git a/org/freedesktop/dbus/AbstractConnection.java b/org/freedesktop/dbus/AbstractConnection.java
index 8c47cc0..cae181a 100644
--- a/org/freedesktop/dbus/AbstractConnection.java
+++ b/org/freedesktop/dbus/AbstractConnection.java
@@ -336,10 +336,10 @@ public abstract class AbstractConnection
*/
public void exportObject(String objectpath, DBusInterface object) throws DBusException
{
- if (!objectpath.matches(OBJECT_REGEX)||objectpath.length() > MAX_NAME_LENGTH)
- throw new DBusException("Invalid object path ("+objectpath+")");
if (null == objectpath || "".equals(objectpath))
throw new DBusException("Must Specify an Object Path");
+ if (!objectpath.matches(OBJECT_REGEX)||objectpath.length() > MAX_NAME_LENGTH)
+ throw new DBusException("Invalid object path ("+objectpath+")");
synchronized (exportedObjects) {
if (null != exportedObjects.get(objectpath))
throw new DBusException("Object already exported");
diff --git a/org/freedesktop/dbus/MethodCall.java b/org/freedesktop/dbus/MethodCall.java
index 11ca375..b21bb7d 100644
--- a/org/freedesktop/dbus/MethodCall.java
+++ b/org/freedesktop/dbus/MethodCall.java
@@ -71,12 +71,40 @@ public class MethodCall extends Message
marshallint(bytecounter-c, blen, 0, 4);
if (Debug.debug) Debug.print("marshalled size ("+blen+"): "+Hexdump.format(blen));
}
- static long REPLY_WAIT_TIMEOUT = 20000;
+ private static long REPLY_WAIT_TIMEOUT = 20000;
+ /**
+ * Set the default timeout for method calls.
+ * Default is 20s.
+ * @param New timeout in ms.
+ */
+ public static setDefaultTimeout(long timeout)
+ {
+ REPLY_WAIT_TIMEOUT = timeout;
+ }
Message reply = null;
public synchronized boolean hasReply()
{
return null != reply;
}
+ /**
+ * Block (if neccessary) for a reply.
+ * @return The reply to this MethodCall, or null if a timeout happens.
+ * @param timeout The length of time to block before timing out (ms).
+ */
+ public synchronized Message getReply(long timeout)
+ {
+ if (Debug.debug) Debug.print(Debug.VERBOSE, "Blocking on "+this);
+ if (null != reply) return reply;
+ try {
+ wait(timeout);
+ return reply;
+ } catch (InterruptedException Ie) { return reply; }
+ }
+ /**
+ * Block (if neccessary) for a reply.
+ * Default timeout is 20s, or can be configured with setDefaultTimeout()
+ * @return The reply to this MethodCall, or null if a timeout happens.
+ */
public synchronized Message getReply()
{
if (Debug.debug) Debug.print(Debug.VERBOSE, "Blocking on "+this);
diff --git a/org/freedesktop/dbus/bin/Caller.java b/org/freedesktop/dbus/bin/Caller.java
index 580a79a..188b3c1 100644
--- a/org/freedesktop/dbus/bin/Caller.java
+++ b/org/freedesktop/dbus/bin/Caller.java
@@ -1,3 +1,13 @@
+/*
+ D-Bus Java Implementation
+ Copyright (c) 2005-2006 Matthew Johnson
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of either the GNU General Public License Version 2 or the
+ Academic Free Licence Version 2.1.
+
+ Full licence texts are included in the COPYING file with this program.
+*/
package org.freedesktop.dbus.bin;
import java.lang.reflect.Constructor;
diff --git a/org/freedesktop/dbus/test/test_low_level.java b/org/freedesktop/dbus/test/test_low_level.java
index c4951df..06ac156 100644
--- a/org/freedesktop/dbus/test/test_low_level.java
+++ b/org/freedesktop/dbus/test/test_low_level.java
@@ -1,3 +1,13 @@
+/*
+ D-Bus Java Implementation
+ Copyright (c) 2005-2006 Matthew Johnson
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of either the GNU General Public License Version 2 or the
+ Academic Free Licence Version 2.1.
+
+ Full licence texts are included in the COPYING file with this program.
+*/
package org.freedesktop.dbus.test;
import cx.ath.matthew.debug.Debug;
import cx.ath.matthew.utils.Hexdump;