Skip to content

Commit a53705d

Browse files
committed
cleaned up unnecessary InterruptedException throw-declarations
1 parent 9177404 commit a53705d

5 files changed

Lines changed: 11 additions & 27 deletions

File tree

‎example/AutobahnClientTest.java‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,7 @@ public void onMessage( String message ) {
132132

133133
@Override
134134
public void onMessage( ByteBuffer blob ) {
135-
try {
136-
getConnection().send( blob );
137-
} catch ( InterruptedException e ) {
138-
e.printStackTrace();
139-
}
135+
getConnection().send( blob );
140136
}
141137

142138
@Override

‎example/AutobahnServerTest.java‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,7 @@ public void onMessage( WebSocket conn, String message ) {
4444

4545
@Override
4646
public void onMessage( WebSocket conn, ByteBuffer blob ) {
47-
try {
48-
conn.send( blob );
49-
} catch ( InterruptedException e ) {
50-
e.printStackTrace();
51-
}
47+
conn.send( blob );
5248
}
5349

5450
public static void main( String[] args ) throws UnknownHostException {

‎src/org/java_websocket/WebSocket.java‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ public enum Role {
4646
* Send Text data to the other end.
4747
*
4848
* @throws IllegalArgumentException
49-
* @throws InterruptedException
5049
* @throws NotYetConnectedException
5150
*/
5251
public abstract void send( String text ) throws NotYetConnectedException;
@@ -55,18 +54,17 @@ public enum Role {
5554
* Send Binary data (plain bytes) to the other end.
5655
*
5756
* @throws IllegalArgumentException
58-
* @throws InterruptedException
5957
* @throws NotYetConnectedException
6058
*/
61-
public abstract void send( ByteBuffer bytes ) throws IllegalArgumentException , NotYetConnectedException , InterruptedException;
59+
public abstract void send( ByteBuffer bytes ) throws IllegalArgumentException , NotYetConnectedException;
6260

63-
public abstract void send( byte[] bytes ) throws IllegalArgumentException , NotYetConnectedException , InterruptedException;
61+
public abstract void send( byte[] bytes ) throws IllegalArgumentException , NotYetConnectedException;
6462

6563
public abstract void sendFrame( Framedata framedata );
6664

6765
public abstract boolean hasBufferedData();
6866

69-
public abstract void startHandshake( ClientHandshakeBuilder handshakedata ) throws InvalidHandshakeException , InterruptedException;
67+
public abstract void startHandshake( ClientHandshakeBuilder handshakedata ) throws InvalidHandshakeException;
7068

7169
public abstract InetSocketAddress getRemoteSocketAddress();
7270

‎src/org/java_websocket/WebSocketImpl.java‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ public WebSocketImpl( WebSocketListener listener , Draft draft , Socket sock ) {
139139
*
140140
* @throws IOException
141141
* When socket related I/O errors occur.
142-
* @throws InterruptedException
143142
*/
144143
public void decode( ByteBuffer socketBuffer ) throws IOException {
145144
if( !socketBuffer.hasRemaining() || connectionClosed )
@@ -455,7 +454,6 @@ public void close( InvalidDataException e ) {
455454
* Send Text data to the other end.
456455
*
457456
* @throws IllegalArgumentException
458-
* @throws InterruptedException
459457
* @throws NotYetConnectedException
460458
*/
461459
@Override
@@ -469,18 +467,17 @@ public void send( String text ) throws NotYetConnectedException {
469467
* Send Binary data (plain bytes) to the other end.
470468
*
471469
* @throws IllegalArgumentException
472-
* @throws InterruptedException
473470
* @throws NotYetConnectedException
474471
*/
475472
@Override
476-
public void send( ByteBuffer bytes ) throws IllegalArgumentException , NotYetConnectedException , InterruptedException {
473+
public void send( ByteBuffer bytes ) throws IllegalArgumentException , NotYetConnectedException {
477474
if( bytes == null )
478475
throw new IllegalArgumentException( "Cannot send 'null' data to a WebSocketImpl." );
479476
send( draft.createFrames( bytes, role == Role.CLIENT ) );
480477
}
481478

482479
@Override
483-
public void send( byte[] bytes ) throws IllegalArgumentException , NotYetConnectedException , InterruptedException {
480+
public void send( byte[] bytes ) throws IllegalArgumentException , NotYetConnectedException {
484481
send( ByteBuffer.wrap( bytes ) );
485482
}
486483

@@ -523,7 +520,7 @@ private HandshakeState isFlashEdgeCase( ByteBuffer request ) throws IncompleteHa
523520
}
524521

525522
@Override
526-
public void startHandshake( ClientHandshakeBuilder handshakedata ) throws InvalidHandshakeException , InterruptedException {
523+
public void startHandshake( ClientHandshakeBuilder handshakedata ) throws InvalidHandshakeException {
527524
if( handshakeComplete )
528525
throw new IllegalStateException( "Handshake has already been sent." );
529526

‎src/org/java_websocket/client/WebSocketClient.java‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public void send( String text ) throws NotYetConnectedException {
172172
* @param data
173173
* The Byte-Array of data to send to the WebSocket server.
174174
*/
175-
public void send( byte[] data ) throws NotYetConnectedException , InterruptedException {
175+
public void send( byte[] data ) throws NotYetConnectedException {
176176
if( conn != null ) {
177177
conn.send( data );
178178
}
@@ -249,9 +249,6 @@ private final void interruptableRun() {
249249
if( key.isConnectable() ) {
250250
try {
251251
finishConnect( key );
252-
} catch ( InterruptedException e ) {
253-
conn.close( CloseFrame.NEVERCONNECTED );// report error to only
254-
break;
255252
} catch ( InvalidHandshakeException e ) {
256253
conn.close( e ); // http error
257254
}
@@ -301,7 +298,7 @@ else if( scheme.equals( "ws" ) ) {
301298
return port;
302299
}
303300

304-
private void finishConnect( SelectionKey key ) throws IOException , InvalidHandshakeException , InterruptedException {
301+
private void finishConnect( SelectionKey key ) throws IOException , InvalidHandshakeException {
305302
if( channel.isConnectionPending() ) {
306303
channel.finishConnect();
307304
}
@@ -312,7 +309,7 @@ private void finishConnect( SelectionKey key ) throws IOException , InvalidHands
312309
sendHandshake();
313310
}
314311

315-
private void sendHandshake() throws IOException , InvalidHandshakeException , InterruptedException {
312+
private void sendHandshake() throws InvalidHandshakeException {
316313
String path;
317314
String part1 = uri.getPath();
318315
String part2 = uri.getQuery();

0 commit comments

Comments
 (0)