From 4c25d9fed0c00f21394652ea6ff44dece1fee761 Mon Sep 17 00:00:00 2001 From: spandi Date: Wed, 6 Feb 2008 20:38:24 +0000 Subject: [PATCH] Allow 0 size control messages git-svn-id: https://svn.code.sf.net/p/libusbjava/code/trunk@264 94ad28fe-ef68-46b1-9651-e7ae4fcf1c4c --- java/src/ch/ntb/usb/Device.java | 5 +++-- java/test/ch/ntb/usb/test/DeviceTest.java | 1 + java/version.properties | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/java/src/ch/ntb/usb/Device.java b/java/src/ch/ntb/usb/Device.java index feccd3d..9508c7b 100644 --- a/java/src/ch/ntb/usb/Device.java +++ b/java/src/ch/ntb/usb/Device.java @@ -514,7 +514,8 @@ public class Device { * @param data * the send/receive buffer * @param size - * the buffer size + * the buffer size. 0 is a valid value, but there must still be a + * dummy data buffer provided. * @param timeout * amount of time in ms the device will try to send/receive data * until a timeout exception is thrown @@ -534,7 +535,7 @@ public class Device { if (data == null) { throw new USBException("data must not be null"); } - if (size <= 0 || size > data.length) { + if (size < 0 || size > data.length) { throw new ArrayIndexOutOfBoundsException("invalid size: " + size); } int len = LibusbJava.usb_control_msg(usbDevHandle, requestType, diff --git a/java/test/ch/ntb/usb/test/DeviceTest.java b/java/test/ch/ntb/usb/test/DeviceTest.java index a12b491..1146a6e 100644 --- a/java/test/ch/ntb/usb/test/DeviceTest.java +++ b/java/test/ch/ntb/usb/test/DeviceTest.java @@ -304,6 +304,7 @@ public class DeviceTest { dev.close(); } catch (Exception e) { closeOnException(); + throw e; } catch (AssertionError e) { closeOnException(); throw e; diff --git a/java/version.properties b/java/version.properties index 1017780..55f7e55 100644 --- a/java/version.properties +++ b/java/version.properties @@ -1,4 +1,4 @@ #Thu Aug 24 14:28:28 CEST 2006 version.major=0 version.minor=5 -version.release=5 +version.release=6