Skip to content

Commit ae0fe9e

Browse files
committed
Added javadocs for the exceptions
1 parent 0e6ad67 commit ae0fe9e

File tree

7 files changed

+274
-101
lines changed

7 files changed

+274
-101
lines changed
Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,45 @@
11
package org.java_websocket.exceptions;
22

3+
/**
4+
* exception which indicates that a incomplete handshake was recieved
5+
*/
36
public class IncompleteHandshakeException extends RuntimeException {
47

5-
private static final long serialVersionUID = 7906596804233893092L;
6-
private int newsize;
8+
/**
9+
* Serializable
10+
*/
11+
private static final long serialVersionUID = 7906596804233893092L;
712

8-
public IncompleteHandshakeException( int newsize ) {
9-
this.newsize = newsize;
10-
}
13+
/**
14+
* attribut which size of handshake would have been prefered
15+
*/
16+
private int preferedSize;
1117

12-
public IncompleteHandshakeException() {
13-
this.newsize = 0;
14-
}
18+
/**
19+
* constructor for a IncompleteHandshakeException
20+
* <p>
21+
* @param preferedSize the prefered size
22+
*/
23+
public IncompleteHandshakeException(int preferedSize) {
24+
this.preferedSize = preferedSize;
25+
}
1526

16-
public int getPreferedSize() {
17-
return newsize;
18-
}
27+
/**
28+
* constructor for a IncompleteHandshakeException
29+
* <p>
30+
* preferedSize will be 0
31+
*/
32+
public IncompleteHandshakeException() {
33+
this.preferedSize = 0;
34+
}
35+
36+
/**
37+
* Getter preferedSize
38+
*
39+
* @return the preferedSize
40+
*/
41+
public int getPreferedSize() {
42+
return preferedSize;
43+
}
1944

2045
}
Lines changed: 65 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,70 @@
11
package org.java_websocket.exceptions;
22

3+
/**
4+
* exception which indicates that a invalid data was recieved
5+
*/
36
public class InvalidDataException extends Exception {
4-
/**
5-
* Serializable
6-
*/
7-
private static final long serialVersionUID = 3731842424390998726L;
8-
9-
private int closecode;
10-
11-
public InvalidDataException( int closecode ) {
12-
this.closecode = closecode;
13-
}
14-
15-
public InvalidDataException( int closecode , String s ) {
16-
super( s );
17-
this.closecode = closecode;
18-
}
19-
20-
public InvalidDataException( int closecode , Throwable t ) {
21-
super( t );
22-
this.closecode = closecode;
23-
}
24-
25-
public InvalidDataException( int closecode , String s , Throwable t ) {
26-
super( s, t );
27-
this.closecode = closecode;
28-
}
29-
30-
public int getCloseCode() {
31-
return closecode;
32-
}
7+
8+
/**
9+
* Serializable
10+
*/
11+
private static final long serialVersionUID = 3731842424390998726L;
12+
13+
/**
14+
* attribut which closecode will be returned
15+
*/
16+
private int closecode;
17+
18+
/**
19+
* constructor for a InvalidDataException
20+
*
21+
* @param closecode the closecode which will be returned
22+
*/
23+
public InvalidDataException(int closecode) {
24+
this.closecode = closecode;
25+
}
26+
27+
/**
28+
* constructor for a InvalidDataException.
29+
*
30+
* @param closecode the closecode which will be returned.
31+
* @param s the detail message.
32+
*/
33+
public InvalidDataException(int closecode, String s) {
34+
super(s);
35+
this.closecode = closecode;
36+
}
37+
38+
/**
39+
* constructor for a InvalidDataException.
40+
*
41+
* @param closecode the closecode which will be returned.
42+
* @param t the throwable causing this exception.
43+
*/
44+
public InvalidDataException(int closecode, Throwable t) {
45+
super(t);
46+
this.closecode = closecode;
47+
}
48+
49+
/**
50+
* constructor for a InvalidDataException.
51+
*
52+
* @param closecode the closecode which will be returned.
53+
* @param s the detail message.
54+
* @param t the throwable causing this exception.
55+
*/
56+
public InvalidDataException(int closecode, String s, Throwable t) {
57+
super(s, t);
58+
this.closecode = closecode;
59+
}
60+
61+
/**
62+
* Getter closecode
63+
*
64+
* @return the closecode
65+
*/
66+
public int getCloseCode() {
67+
return closecode;
68+
}
3369

3470
}

src/main/java/org/java_websocket/exceptions/InvalidFrameException.java

Lines changed: 46 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,56 @@
22

33
import org.java_websocket.framing.CloseFrame;
44

5+
/**
6+
* exception which indicates that a invalid frame was recieved (CloseFrame.PROTOCOL_ERROR)
7+
*/
58
public class InvalidFrameException extends InvalidDataException {
69

7-
/**
8-
* Serializable
9-
*/
10-
private static final long serialVersionUID = -9016496369828887591L;
10+
/**
11+
* Serializable
12+
*/
13+
private static final long serialVersionUID = -9016496369828887591L;
1114

12-
public InvalidFrameException() {
13-
super( CloseFrame.PROTOCOL_ERROR );
14-
}
15+
/**
16+
* constructor for a InvalidFrameException
17+
* <p>
18+
* calling InvalidDataException with closecode PROTOCOL_ERROR
19+
*/
20+
public InvalidFrameException() {
21+
super(CloseFrame.PROTOCOL_ERROR);
22+
}
1523

16-
public InvalidFrameException( String arg0 ) {
17-
super( CloseFrame.PROTOCOL_ERROR, arg0 );
18-
}
24+
/**
25+
* constructor for a InvalidFrameException
26+
* <p>
27+
* calling InvalidDataException with closecode PROTOCOL_ERROR
28+
*
29+
* @param s the detail message.
30+
*/
31+
public InvalidFrameException(String s) {
32+
super(CloseFrame.PROTOCOL_ERROR, s);
33+
}
1934

20-
public InvalidFrameException( Throwable arg0 ) {
21-
super( CloseFrame.PROTOCOL_ERROR, arg0 );
22-
}
35+
/**
36+
* constructor for a InvalidFrameException
37+
* <p>
38+
* calling InvalidDataException with closecode PROTOCOL_ERROR
39+
*
40+
* @param t the throwable causing this exception.
41+
*/
42+
public InvalidFrameException(Throwable t) {
43+
super(CloseFrame.PROTOCOL_ERROR, t);
44+
}
2345

24-
public InvalidFrameException( String arg0 , Throwable arg1 ) {
25-
super( CloseFrame.PROTOCOL_ERROR, arg0, arg1 );
26-
}
46+
/**
47+
* constructor for a InvalidFrameException
48+
* <p>
49+
* calling InvalidDataException with closecode PROTOCOL_ERROR
50+
*
51+
* @param s the detail message.
52+
* @param t the throwable causing this exception.
53+
*/
54+
public InvalidFrameException(String s, Throwable t) {
55+
super(CloseFrame.PROTOCOL_ERROR, s, t);
56+
}
2757
}

src/main/java/org/java_websocket/exceptions/InvalidHandshakeException.java

Lines changed: 50 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,57 @@
22

33
import org.java_websocket.framing.CloseFrame;
44

5+
/**
6+
* exception which indicates that a invalid handshake was recieved (CloseFrame.PROTOCOL_ERROR)
7+
*/
58
public class InvalidHandshakeException extends InvalidDataException {
69

7-
/**
8-
* Serializable
9-
*/
10-
private static final long serialVersionUID = -1426533877490484964L;
11-
12-
public InvalidHandshakeException() {
13-
super( CloseFrame.PROTOCOL_ERROR );
14-
}
15-
16-
public InvalidHandshakeException( String arg0 , Throwable arg1 ) {
17-
super( CloseFrame.PROTOCOL_ERROR, arg0, arg1 );
18-
}
19-
20-
public InvalidHandshakeException( String arg0 ) {
21-
super( CloseFrame.PROTOCOL_ERROR, arg0 );
22-
}
23-
24-
public InvalidHandshakeException( Throwable arg0 ) {
25-
super( CloseFrame.PROTOCOL_ERROR, arg0 );
26-
}
10+
/**
11+
* Serializable
12+
*/
13+
private static final long serialVersionUID = -1426533877490484964L;
14+
15+
/**
16+
* constructor for a InvalidHandshakeException
17+
* <p>
18+
* calling InvalidDataException with closecode PROTOCOL_ERROR
19+
*/
20+
public InvalidHandshakeException() {
21+
super(CloseFrame.PROTOCOL_ERROR);
22+
}
23+
24+
/**
25+
* constructor for a InvalidHandshakeException
26+
* <p>
27+
* calling InvalidDataException with closecode PROTOCOL_ERROR
28+
*
29+
* @param s the detail message.
30+
* @param t the throwable causing this exception.
31+
*/
32+
public InvalidHandshakeException(String s, Throwable t) {
33+
super(CloseFrame.PROTOCOL_ERROR, s, t);
34+
}
35+
36+
/**
37+
* constructor for a InvalidHandshakeException
38+
* <p>
39+
* calling InvalidDataException with closecode PROTOCOL_ERROR
40+
*
41+
* @param s the detail message.
42+
*/
43+
public InvalidHandshakeException(String s) {
44+
super(CloseFrame.PROTOCOL_ERROR, s);
45+
}
46+
47+
/**
48+
* constructor for a InvalidHandshakeException
49+
* <p>
50+
* calling InvalidDataException with closecode PROTOCOL_ERROR
51+
*
52+
* @param t the throwable causing this exception.
53+
*/
54+
public InvalidHandshakeException(Throwable t) {
55+
super(CloseFrame.PROTOCOL_ERROR, t);
56+
}
2757

2858
}

src/main/java/org/java_websocket/exceptions/LimitExedeedException.java

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,34 @@
22

33
import org.java_websocket.framing.CloseFrame;
44

5+
/**
6+
* exception which indicates that the message limited was exedeeded (CloseFrame.TOOBIG)
7+
*/
58
public class LimitExedeedException extends InvalidDataException {
69

7-
/**
8-
* Serializable
9-
*/
10-
private static final long serialVersionUID = 6908339749836826785L;
10+
/**
11+
* Serializable
12+
*/
13+
private static final long serialVersionUID = 6908339749836826785L;
1114

12-
public LimitExedeedException() {
13-
super( CloseFrame.TOOBIG );
14-
}
15+
/**
16+
* constructor for a LimitExedeedException
17+
* <p>
18+
* calling InvalidDataException with closecode TOOBIG
19+
*/
20+
public LimitExedeedException() {
21+
super(CloseFrame.TOOBIG);
22+
}
1523

16-
public LimitExedeedException( String s ) {
17-
super( CloseFrame.TOOBIG, s );
18-
}
24+
/**
25+
* constructor for a LimitExedeedException
26+
* <p>
27+
* calling InvalidDataException with closecode TOOBIG
28+
*
29+
* @param s the detail message.
30+
*/
31+
public LimitExedeedException(String s) {
32+
super(CloseFrame.TOOBIG, s);
33+
}
1934

2035
}

0 commit comments

Comments
 (0)