Allow 0 size control messages

git-svn-id: https://svn.code.sf.net/p/libusbjava/code/trunk@264 94ad28fe-ef68-46b1-9651-e7ae4fcf1c4c
This commit is contained in:
spandi
2008-02-06 20:38:24 +00:00
parent 83de75f223
commit 4c25d9fed0
3 changed files with 5 additions and 3 deletions

View File

@@ -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,

View File

@@ -304,6 +304,7 @@ public class DeviceTest {
dev.close();
} catch (Exception e) {
closeOnException();
throw e;
} catch (AssertionError e) {
closeOnException();
throw e;

View File

@@ -1,4 +1,4 @@
#Thu Aug 24 14:28:28 CEST 2006
version.major=0
version.minor=5
version.release=5
version.release=6