Fixed some checkstyle issues.
This commit is contained in:
parent
9864bb3235
commit
812d153828
@ -182,7 +182,10 @@
|
||||
<property name="ignoreNumbers" value="-1, 0, 1, 2, 17, 37, 255, 65535" />
|
||||
</module>
|
||||
<module name="MissingSwitchDefault"/>
|
||||
<module name="RedundantThrows"/>
|
||||
<module name="RedundantThrows">
|
||||
<property name="allowUnchecked" value="true" />
|
||||
<property name="allowSubclasses" value="true" />
|
||||
</module>
|
||||
<module name="SimplifyBooleanExpression"/>
|
||||
<module name="SimplifyBooleanReturn"/>
|
||||
|
||||
|
||||
@ -785,8 +785,8 @@ public final class USB
|
||||
* @return 0 on success or < 0 on error.
|
||||
*/
|
||||
|
||||
public static native int usb_get_driver_np(USB_Dev_Handle handle,
|
||||
int iface, ByteBuffer buffer);
|
||||
public static native int usb_get_driver_np(final USB_Dev_Handle handle,
|
||||
final int iface, final ByteBuffer buffer);
|
||||
|
||||
|
||||
/**
|
||||
@ -813,7 +813,8 @@ public final class USB
|
||||
if (result < 0) return null;
|
||||
buffer.rewind();
|
||||
int size = 0;
|
||||
while (buffer.get() != 0) size++;
|
||||
while (buffer.get() != 0)
|
||||
size++;
|
||||
buffer.rewind();
|
||||
final byte[] bytes = new byte[size];
|
||||
buffer.get(bytes, 0, size);
|
||||
@ -838,8 +839,8 @@ public final class USB
|
||||
* @return 0 on success or < 0 on error.
|
||||
*/
|
||||
|
||||
public static native int usb_detach_kernel_driver_np(USB_Dev_Handle handle,
|
||||
int iface);
|
||||
public static native int usb_detach_kernel_driver_np(
|
||||
final USB_Dev_Handle handle, final int iface);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -386,8 +386,7 @@ abstract class AbstractDevice implements UsbDevice
|
||||
*/
|
||||
|
||||
final void claimInterface(final byte number, final boolean force)
|
||||
throws UsbClaimException,
|
||||
UsbException
|
||||
throws UsbException, UsbClaimException
|
||||
{
|
||||
if (this.claimedInterfaceNumber != null)
|
||||
throw new UsbClaimException("A interface is already claimed");
|
||||
@ -426,8 +425,8 @@ abstract class AbstractDevice implements UsbDevice
|
||||
* When interface could not be claimed.
|
||||
*/
|
||||
|
||||
final void releaseInterface(final byte number) throws UsbClaimException,
|
||||
UsbException
|
||||
final void releaseInterface(final byte number) throws UsbException,
|
||||
UsbClaimException
|
||||
{
|
||||
if (this.claimedInterfaceNumber == null)
|
||||
throw new UsbClaimException("No interface is claimed");
|
||||
@ -438,8 +437,8 @@ abstract class AbstractDevice implements UsbDevice
|
||||
try
|
||||
{
|
||||
final int result = usb_release_interface(open(), number & 0xff);
|
||||
if (result < 0)
|
||||
throw new LibUsbException("Unable to release interface", result);
|
||||
if (result < 0) throw new LibUsbException(
|
||||
"Unable to release interface", result);
|
||||
this.claimedInterfaceNumber = null;
|
||||
}
|
||||
finally
|
||||
@ -639,8 +638,9 @@ abstract class AbstractDevice implements UsbDevice
|
||||
*/
|
||||
|
||||
@Override
|
||||
public final void asyncSubmit(@SuppressWarnings("rawtypes") final List list)
|
||||
throws UsbException
|
||||
public final void
|
||||
asyncSubmit(@SuppressWarnings("rawtypes") final List list)
|
||||
throws UsbException
|
||||
{
|
||||
for (final Object item : list)
|
||||
{
|
||||
|
||||
@ -146,6 +146,10 @@ final class PipeQueueProcessor extends Thread
|
||||
case UsbConst.ENDPOINT_DIRECTION_IN:
|
||||
irp.setActualLength(bulkRead(irp.getData()));
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new UsbException("Invalid direction: "
|
||||
+ direction);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -159,11 +163,16 @@ final class PipeQueueProcessor extends Thread
|
||||
case UsbConst.ENDPOINT_DIRECTION_IN:
|
||||
irp.setActualLength(interruptRead(irp.getData()));
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new UsbException("Invalid direction: "
|
||||
+ direction);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new UsbException("Unsupported endpoint type: " + type);
|
||||
throw new UsbException("Unsupported endpoint type: "
|
||||
+ type);
|
||||
}
|
||||
|
||||
}
|
||||
@ -228,7 +237,7 @@ final class PipeQueueProcessor extends Thread
|
||||
final int result = usb_bulk_write(handle, ep, buffer, 5000);
|
||||
if (result < 0)
|
||||
throw new LibUsbException(
|
||||
"Unable to write to interrupt endpoint", result);
|
||||
"Unable to write to bulk endpoint", result);
|
||||
written += result;
|
||||
buffer.rewind();
|
||||
}
|
||||
|
||||
@ -45,10 +45,11 @@ final class UsbConfigurationImpl implements UsbConfiguration
|
||||
* altsettings which maps setting numbers to actual interfaces.
|
||||
*/
|
||||
private final Map<Integer, Map<Integer, UsbInterface>> interfaces =
|
||||
new HashMap<Integer, Map<Integer, UsbInterface>>();
|
||||
new HashMap<Integer, Map<Integer, UsbInterface>>();
|
||||
|
||||
/** This map contains the active USB interfaces. */
|
||||
private final Map<Integer, UsbInterface> activeSettings = new HashMap<Integer, UsbInterface>();
|
||||
private final Map<Integer, UsbInterface> activeSettings =
|
||||
new HashMap<Integer, UsbInterface>();
|
||||
|
||||
|
||||
/**
|
||||
@ -89,8 +90,8 @@ final class UsbConfigurationImpl implements UsbConfiguration
|
||||
// yet or the alternate setting number is 0 (which marks the
|
||||
// default alternate setting) then set current interface as
|
||||
// the active setting.
|
||||
if (!this.activeSettings.containsKey(ifaceNumber) ||
|
||||
desc.bAlternateSetting() == 0)
|
||||
if (!this.activeSettings.containsKey(ifaceNumber)
|
||||
|| desc.bAlternateSetting() == 0)
|
||||
{
|
||||
this.activeSettings.put(ifaceNumber, usbInterface);
|
||||
}
|
||||
|
||||
@ -79,7 +79,8 @@ final class UsbEndpointImpl implements UsbEndpoint
|
||||
@Override
|
||||
public byte getDirection()
|
||||
{
|
||||
return (byte) (this.descriptor.bEndpointAddress() & UsbConst.ENDPOINT_DIRECTION_MASK);
|
||||
final byte address = this.descriptor.bEndpointAddress();
|
||||
return (byte) (address & UsbConst.ENDPOINT_DIRECTION_MASK);
|
||||
}
|
||||
|
||||
|
||||
@ -90,7 +91,8 @@ final class UsbEndpointImpl implements UsbEndpoint
|
||||
@Override
|
||||
public byte getType()
|
||||
{
|
||||
return (byte) (this.descriptor.bmAttributes() & UsbConst.ENDPOINT_TYPE_MASK);
|
||||
final byte attribs = this.descriptor.bmAttributes();
|
||||
return (byte) (attribs & UsbConst.ENDPOINT_TYPE_MASK);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -14,6 +14,7 @@ import java.util.Map;
|
||||
|
||||
import javax.usb.UsbClaimException;
|
||||
import javax.usb.UsbConfiguration;
|
||||
import javax.usb.UsbDisconnectedException;
|
||||
import javax.usb.UsbEndpoint;
|
||||
import javax.usb.UsbEndpointDescriptor;
|
||||
import javax.usb.UsbException;
|
||||
@ -121,8 +122,8 @@ final class UsbInterfaceImpl implements UsbInterface
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void claim(final UsbInterfacePolicy policy)
|
||||
throws UsbClaimException, UsbException
|
||||
public void claim(final UsbInterfacePolicy policy) throws UsbException,
|
||||
UsbClaimException, UsbNotActiveException, UsbDisconnectedException
|
||||
{
|
||||
final AbstractDevice device = (AbstractDevice) this.configuration
|
||||
.getUsbDevice();
|
||||
@ -148,7 +149,8 @@ final class UsbInterfaceImpl implements UsbInterface
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void release() throws UsbClaimException, UsbException
|
||||
public void release() throws UsbClaimException, UsbException,
|
||||
UsbNotActiveException, UsbDisconnectedException
|
||||
{
|
||||
((AbstractDevice) this.configuration.getUsbDevice())
|
||||
.releaseInterface(this.descriptor.bInterfaceNumber());
|
||||
|
||||
@ -134,7 +134,7 @@ final class UsbPipeImpl implements UsbPipe
|
||||
|
||||
|
||||
/**
|
||||
* @see javax.usb.UsbPipe#open()
|
||||
* @see UsbPipe#open()
|
||||
*/
|
||||
|
||||
@Override
|
||||
@ -154,7 +154,7 @@ final class UsbPipeImpl implements UsbPipe
|
||||
|
||||
|
||||
/**
|
||||
* @see javax.usb.UsbPipe#close()
|
||||
* @see UsbPipe#close()
|
||||
*/
|
||||
|
||||
@Override
|
||||
@ -177,7 +177,7 @@ final class UsbPipeImpl implements UsbPipe
|
||||
|
||||
|
||||
/**
|
||||
* @see javax.usb.UsbPipe#isActive()
|
||||
* @see UsbPipe#isActive()
|
||||
*/
|
||||
|
||||
@Override
|
||||
@ -190,7 +190,7 @@ final class UsbPipeImpl implements UsbPipe
|
||||
|
||||
|
||||
/**
|
||||
* @see javax.usb.UsbPipe#isOpen()
|
||||
* @see UsbPipe#isOpen()
|
||||
*/
|
||||
|
||||
@Override
|
||||
@ -201,7 +201,7 @@ final class UsbPipeImpl implements UsbPipe
|
||||
|
||||
|
||||
/**
|
||||
* @see javax.usb.UsbPipe#getUsbEndpoint()
|
||||
* @see UsbPipe#getUsbEndpoint()
|
||||
*/
|
||||
|
||||
@Override
|
||||
@ -212,7 +212,7 @@ final class UsbPipeImpl implements UsbPipe
|
||||
|
||||
|
||||
/**
|
||||
* @see javax.usb.UsbPipe#syncSubmit(byte[])
|
||||
* @see UsbPipe#syncSubmit(byte[])
|
||||
*/
|
||||
|
||||
@Override
|
||||
@ -228,7 +228,7 @@ final class UsbPipeImpl implements UsbPipe
|
||||
|
||||
|
||||
/**
|
||||
* @see javax.usb.UsbPipe#asyncSubmit(byte[])
|
||||
* @see UsbPipe#asyncSubmit(byte[])
|
||||
*/
|
||||
|
||||
@Override
|
||||
@ -247,7 +247,7 @@ final class UsbPipeImpl implements UsbPipe
|
||||
|
||||
|
||||
/**
|
||||
* @see javax.usb.UsbPipe#syncSubmit(javax.usb.UsbIrp)
|
||||
* @see UsbPipe#syncSubmit(javax.usb.UsbIrp)
|
||||
*/
|
||||
|
||||
@Override
|
||||
@ -264,7 +264,7 @@ final class UsbPipeImpl implements UsbPipe
|
||||
|
||||
|
||||
/**
|
||||
* @see javax.usb.UsbPipe#asyncSubmit(javax.usb.UsbIrp)
|
||||
* @see UsbPipe#asyncSubmit(javax.usb.UsbIrp)
|
||||
*/
|
||||
|
||||
@Override
|
||||
@ -288,7 +288,7 @@ final class UsbPipeImpl implements UsbPipe
|
||||
|
||||
|
||||
/**
|
||||
* @see javax.usb.UsbPipe#syncSubmit(java.util.List)
|
||||
* @see UsbPipe#syncSubmit(java.util.List)
|
||||
*/
|
||||
|
||||
@Override
|
||||
@ -296,7 +296,7 @@ final class UsbPipeImpl implements UsbPipe
|
||||
throws UsbException, UsbNotActiveException, UsbNotOpenException,
|
||||
IllegalArgumentException, UsbDisconnectedException
|
||||
{
|
||||
for (final Object item: list)
|
||||
for (final Object item : list)
|
||||
{
|
||||
final UsbIrp irp = (UsbIrp) item;
|
||||
syncSubmit(irp);
|
||||
@ -305,7 +305,7 @@ final class UsbPipeImpl implements UsbPipe
|
||||
|
||||
|
||||
/**
|
||||
* @see javax.usb.UsbPipe#asyncSubmit(java.util.List)
|
||||
* @see UsbPipe#asyncSubmit(java.util.List)
|
||||
*/
|
||||
|
||||
@Override
|
||||
@ -313,7 +313,7 @@ final class UsbPipeImpl implements UsbPipe
|
||||
throws UsbException, UsbNotActiveException, UsbNotOpenException,
|
||||
IllegalArgumentException, UsbDisconnectedException
|
||||
{
|
||||
for (final Object item: list)
|
||||
for (final Object item : list)
|
||||
{
|
||||
final UsbIrp irp = (UsbIrp) item;
|
||||
asyncSubmit(irp);
|
||||
@ -322,7 +322,7 @@ final class UsbPipeImpl implements UsbPipe
|
||||
|
||||
|
||||
/**
|
||||
* @see javax.usb.UsbPipe#abortAllSubmissions()
|
||||
* @see UsbPipe#abortAllSubmissions()
|
||||
*/
|
||||
|
||||
@Override
|
||||
@ -338,7 +338,7 @@ final class UsbPipeImpl implements UsbPipe
|
||||
|
||||
|
||||
/**
|
||||
* @see javax.usb.UsbPipe#createUsbIrp()
|
||||
* @see UsbPipe#createUsbIrp()
|
||||
*/
|
||||
|
||||
@Override
|
||||
@ -349,7 +349,7 @@ final class UsbPipeImpl implements UsbPipe
|
||||
|
||||
|
||||
/**
|
||||
* @see javax.usb.UsbPipe#createUsbControlIrp(byte, byte, short, short)
|
||||
* @see UsbPipe#createUsbControlIrp(byte, byte, short, short)
|
||||
*/
|
||||
|
||||
@Override
|
||||
@ -357,12 +357,13 @@ final class UsbPipeImpl implements UsbPipe
|
||||
final byte bRequest,
|
||||
final short wValue, final short wIndex)
|
||||
{
|
||||
return new DefaultUsbControlIrp(bmRequestType, bRequest, wValue, wIndex);
|
||||
return new DefaultUsbControlIrp(bmRequestType, bRequest, wValue,
|
||||
wIndex);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see javax.usb.UsbPipe#addUsbPipeListener(javax.usb.event.UsbPipeListener)
|
||||
* @see UsbPipe#addUsbPipeListener(UsbPipeListener)
|
||||
*/
|
||||
|
||||
@Override
|
||||
@ -373,7 +374,7 @@ final class UsbPipeImpl implements UsbPipe
|
||||
|
||||
|
||||
/**
|
||||
* @see javax.usb.UsbPipe#removeUsbPipeListener(javax.usb.event.UsbPipeListener)
|
||||
* @see UsbPipe#removeUsbPipeListener(UsbPipeListener)
|
||||
*/
|
||||
|
||||
@Override
|
||||
|
||||
Loading…
Reference in New Issue
Block a user