Browse Source

Add defensive checks to all events.

Assert that things aren't randomly null. This will make it easier
to fix than trying to hunt down obscure errors in the client caused
by nulls here.

Remove CallbackManager hacks.
pull/79/head
Chris Smith 9 years ago
parent
commit
5035177031
61 changed files with 286 additions and 185 deletions
  1. 0
    13
      common/src/com/dmdirc/parser/common/CallbackManager.java
  2. 3
    1
      common/src/com/dmdirc/parser/events/AuthNoticeEvent.java
  3. 8
    3
      common/src/com/dmdirc/parser/events/AwayStateEvent.java
  4. 6
    4
      common/src/com/dmdirc/parser/events/ChannelActionEvent.java
  5. 7
    5
      common/src/com/dmdirc/parser/events/ChannelCTCPEvent.java
  6. 7
    5
      common/src/com/dmdirc/parser/events/ChannelCTCPReplyEvent.java
  7. 4
    2
      common/src/com/dmdirc/parser/events/ChannelJoinEvent.java
  8. 12
    10
      common/src/com/dmdirc/parser/events/ChannelKickEvent.java
  9. 3
    1
      common/src/com/dmdirc/parser/events/ChannelListModeEvent.java
  10. 6
    4
      common/src/com/dmdirc/parser/events/ChannelMessageEvent.java
  11. 6
    4
      common/src/com/dmdirc/parser/events/ChannelModeChangeEvent.java
  12. 7
    5
      common/src/com/dmdirc/parser/events/ChannelModeMessageEvent.java
  13. 7
    5
      common/src/com/dmdirc/parser/events/ChannelModeNoticeEvent.java
  14. 3
    1
      common/src/com/dmdirc/parser/events/ChannelNamesEvent.java
  15. 5
    3
      common/src/com/dmdirc/parser/events/ChannelNickChangeEvent.java
  16. 6
    4
      common/src/com/dmdirc/parser/events/ChannelNonUserModeChangeEvent.java
  17. 6
    4
      common/src/com/dmdirc/parser/events/ChannelNoticeEvent.java
  18. 6
    4
      common/src/com/dmdirc/parser/events/ChannelOtherAwayStateEvent.java
  19. 5
    3
      common/src/com/dmdirc/parser/events/ChannelPartEvent.java
  20. 5
    3
      common/src/com/dmdirc/parser/events/ChannelQuitEvent.java
  21. 3
    1
      common/src/com/dmdirc/parser/events/ChannelSelfJoinEvent.java
  22. 6
    4
      common/src/com/dmdirc/parser/events/ChannelSingleModeChangeEvent.java
  23. 3
    1
      common/src/com/dmdirc/parser/events/ChannelTopicEvent.java
  24. 7
    5
      common/src/com/dmdirc/parser/events/ChannelUserModeChangeEvent.java
  25. 4
    2
      common/src/com/dmdirc/parser/events/CompositionStateChangeEvent.java
  26. 3
    1
      common/src/com/dmdirc/parser/events/ConnectErrorEvent.java
  27. 3
    1
      common/src/com/dmdirc/parser/events/DataInEvent.java
  28. 3
    1
      common/src/com/dmdirc/parser/events/DataOutEvent.java
  29. 3
    1
      common/src/com/dmdirc/parser/events/DebugInfoEvent.java
  30. 3
    1
      common/src/com/dmdirc/parser/events/ErrorInfoEvent.java
  31. 5
    3
      common/src/com/dmdirc/parser/events/GroupListEntryEvent.java
  32. 4
    2
      common/src/com/dmdirc/parser/events/InviteEvent.java
  33. 3
    1
      common/src/com/dmdirc/parser/events/MOTDEndEvent.java
  34. 3
    1
      common/src/com/dmdirc/parser/events/MOTDLineEvent.java
  35. 3
    1
      common/src/com/dmdirc/parser/events/MOTDStartEvent.java
  36. 5
    3
      common/src/com/dmdirc/parser/events/NetworkDetectedEvent.java
  37. 4
    2
      common/src/com/dmdirc/parser/events/NickChangeEvent.java
  38. 3
    1
      common/src/com/dmdirc/parser/events/NickInUseEvent.java
  39. 4
    2
      common/src/com/dmdirc/parser/events/NumericEvent.java
  40. 5
    3
      common/src/com/dmdirc/parser/events/OtherAwayStateEvent.java
  41. 3
    1
      common/src/com/dmdirc/parser/events/ParserErrorEvent.java
  42. 8
    15
      common/src/com/dmdirc/parser/events/ParserEvent.java
  43. 4
    2
      common/src/com/dmdirc/parser/events/PrivateActionEvent.java
  44. 5
    3
      common/src/com/dmdirc/parser/events/PrivateCTCPEvent.java
  45. 5
    3
      common/src/com/dmdirc/parser/events/PrivateCTCPReplyEvent.java
  46. 4
    2
      common/src/com/dmdirc/parser/events/PrivateMessageEvent.java
  47. 4
    2
      common/src/com/dmdirc/parser/events/PrivateNoticeEvent.java
  48. 4
    2
      common/src/com/dmdirc/parser/events/QuitEvent.java
  49. 3
    1
      common/src/com/dmdirc/parser/events/ServerErrorEvent.java
  50. 4
    2
      common/src/com/dmdirc/parser/events/ServerNoticeEvent.java
  51. 5
    3
      common/src/com/dmdirc/parser/events/UnknownActionEvent.java
  52. 6
    4
      common/src/com/dmdirc/parser/events/UnknownCTCPEvent.java
  53. 6
    4
      common/src/com/dmdirc/parser/events/UnknownCTCPReplyEvent.java
  54. 5
    3
      common/src/com/dmdirc/parser/events/UnknownMessageEvent.java
  55. 5
    3
      common/src/com/dmdirc/parser/events/UnknownNoticeEvent.java
  56. 5
    3
      common/src/com/dmdirc/parser/events/UnknownServerNoticeEvent.java
  57. 5
    3
      common/src/com/dmdirc/parser/events/UserModeChangeEvent.java
  58. 4
    2
      common/src/com/dmdirc/parser/events/UserModeDiscoveryEvent.java
  59. 4
    2
      common/src/com/dmdirc/parser/events/WallDesyncEvent.java
  60. 4
    2
      common/src/com/dmdirc/parser/events/WallopEvent.java
  61. 4
    2
      common/src/com/dmdirc/parser/events/WalluserEvent.java

+ 0
- 13
common/src/com/dmdirc/parser/common/CallbackManager.java View File

@@ -57,19 +57,6 @@ public class CallbackManager extends MBassador<ParserEvent> {
57 57
         this.parser = parser;
58 58
     }
59 59
 
60
-    @Override
61
-    public void publish(final ParserEvent message) {
62
-        // TODO: HACKY REMOVE
63
-        if (message.getParser() == null) {
64
-            message.setParser(parser);
65
-        }
66
-        if (message.getDate() == null) {
67
-            message.setDate(new Date());
68
-        }
69
-        // TODO: HACKY REMOVE
70
-        super.publish(message);
71
-    }
72
-
73 60
     @SuppressWarnings({
74 61
             "ThrowableResultOfMethodCallIgnored",
75 62
             "CallToPrintStackTrace",

+ 3
- 1
common/src/com/dmdirc/parser/events/AuthNoticeEvent.java View File

@@ -26,6 +26,8 @@ import com.dmdirc.parser.interfaces.Parser;
26 26
 
27 27
 import java.util.Date;
28 28
 
29
+import static com.google.common.base.Preconditions.checkNotNull;
30
+
29 31
 /**
30 32
  * Used on every incomming line before 001.
31 33
  */
@@ -35,7 +37,7 @@ public class AuthNoticeEvent extends ParserEvent {
35 37
 
36 38
     public AuthNoticeEvent(final Parser parser, final Date date, final String message) {
37 39
         super(parser, date);
38
-        this.message = message;
40
+        this.message = checkNotNull(message);
39 41
     }
40 42
 
41 43
     public String getMessage() {

+ 8
- 3
common/src/com/dmdirc/parser/events/AwayStateEvent.java View File

@@ -27,6 +27,10 @@ import com.dmdirc.parser.interfaces.Parser;
27 27
 
28 28
 import java.util.Date;
29 29
 
30
+import javax.annotation.Nullable;
31
+
32
+import static com.google.common.base.Preconditions.checkNotNull;
33
+
30 34
 /**
31 35
  * Called when we go away, or come back.
32 36
  */
@@ -37,10 +41,10 @@ public class AwayStateEvent extends ParserEvent {
37 41
     private final String reason;
38 42
 
39 43
     public AwayStateEvent(final Parser parser, final Date date, final AwayState oldState,
40
-            final AwayState newState, final String reason) {
44
+            final AwayState newState, @Nullable final String reason) {
41 45
         super(parser, date);
42
-        this.oldState = oldState;
43
-        this.newState = newState;
46
+        this.oldState = checkNotNull(oldState);
47
+        this.newState = checkNotNull(newState);
44 48
         this.reason = reason;
45 49
     }
46 50
 
@@ -52,6 +56,7 @@ public class AwayStateEvent extends ParserEvent {
52 56
         return newState;
53 57
     }
54 58
 
59
+    @Nullable
55 60
     public String getReason() {
56 61
         return reason;
57 62
     }

+ 6
- 4
common/src/com/dmdirc/parser/events/ChannelActionEvent.java View File

@@ -28,6 +28,8 @@ import com.dmdirc.parser.interfaces.Parser;
28 28
 
29 29
 import java.util.Date;
30 30
 
31
+import static com.google.common.base.Preconditions.checkNotNull;
32
+
31 33
 /**
32 34
  * Called when a person does an action in a channel.
33 35
  */
@@ -41,10 +43,10 @@ public class ChannelActionEvent extends ParserEvent {
41 43
     public ChannelActionEvent(final Parser parser, final Date date, final ChannelInfo channel,
42 44
             final ChannelClientInfo client, final String message, final String host) {
43 45
         super(parser, date);
44
-        this.channel = channel;
45
-        this.client = client;
46
-        this.message = message;
47
-        this.host = host;
46
+        this.channel = checkNotNull(channel);
47
+        this.client = checkNotNull(client);
48
+        this.message = checkNotNull(message);
49
+        this.host = checkNotNull(host);
48 50
     }
49 51
 
50 52
     public ChannelInfo getChannel() {

+ 7
- 5
common/src/com/dmdirc/parser/events/ChannelCTCPEvent.java View File

@@ -28,6 +28,8 @@ import com.dmdirc.parser.interfaces.Parser;
28 28
 
29 29
 import java.util.Date;
30 30
 
31
+import static com.google.common.base.Preconditions.checkNotNull;
32
+
31 33
 /**
32 34
  * Called when a person sends a CTCP to a channel.
33 35
  */
@@ -43,11 +45,11 @@ public class ChannelCTCPEvent extends ParserEvent {
43 45
             final ChannelClientInfo client, final String type, final String message,
44 46
             final String host) {
45 47
         super(parser, date);
46
-        this.channel = channel;
47
-        this.client = client;
48
-        this.type = type;
49
-        this.message = message;
50
-        this.host = host;
48
+        this.channel = checkNotNull(channel);
49
+        this.client = checkNotNull(client);
50
+        this.type = checkNotNull(type);
51
+        this.message = checkNotNull(message);
52
+        this.host = checkNotNull(host);
51 53
     }
52 54
 
53 55
     public ChannelInfo getChannel() {

+ 7
- 5
common/src/com/dmdirc/parser/events/ChannelCTCPReplyEvent.java View File

@@ -28,6 +28,8 @@ import com.dmdirc.parser.interfaces.Parser;
28 28
 
29 29
 import java.util.Date;
30 30
 
31
+import static com.google.common.base.Preconditions.checkNotNull;
32
+
31 33
 /**
32 34
  * Called when a person sends a CTCPRReply to a channel.
33 35
  */
@@ -43,11 +45,11 @@ public class ChannelCTCPReplyEvent extends ParserEvent {
43 45
             final ChannelClientInfo client, final String type, final String message,
44 46
             final String host) {
45 47
         super(parser, date);
46
-        this.channel = channel;
47
-        this.client = client;
48
-        this.type = type;
49
-        this.message = message;
50
-        this.host = host;
48
+        this.channel = checkNotNull(channel);
49
+        this.client = checkNotNull(client);
50
+        this.type = checkNotNull(type);
51
+        this.message = checkNotNull(message);
52
+        this.host = checkNotNull(host);
51 53
     }
52 54
 
53 55
     public ChannelInfo getChannel() {

+ 4
- 2
common/src/com/dmdirc/parser/events/ChannelJoinEvent.java View File

@@ -28,6 +28,8 @@ import com.dmdirc.parser.interfaces.Parser;
28 28
 
29 29
 import java.util.Date;
30 30
 
31
+import static com.google.common.base.Preconditions.checkNotNull;
32
+
31 33
 /**
32 34
  * Called When we, or another client joins a channel.
33 35
  */
@@ -39,8 +41,8 @@ public class ChannelJoinEvent extends ParserEvent {
39 41
     public ChannelJoinEvent(final Parser parser, final Date date, final ChannelInfo channel,
40 42
             final ChannelClientInfo client) {
41 43
         super(parser, date);
42
-        this.channel = channel;
43
-        this.client = client;
44
+        this.channel = checkNotNull(channel);
45
+        this.client = checkNotNull(client);
44 46
     }
45 47
 
46 48
     public ChannelInfo getChannel() {

+ 12
- 10
common/src/com/dmdirc/parser/events/ChannelKickEvent.java View File

@@ -28,26 +28,28 @@ import com.dmdirc.parser.interfaces.Parser;
28 28
 
29 29
 import java.util.Date;
30 30
 
31
+import static com.google.common.base.Preconditions.checkNotNull;
32
+
31 33
 /**
32 34
  * Called when a person is kicked.
33 35
  */
34 36
 public class ChannelKickEvent extends ParserEvent {
35 37
 
36
-    final ChannelInfo channel;
37
-    final ChannelClientInfo kickedClient;
38
-    final ChannelClientInfo client;
39
-    final String reason;
40
-    final String host;
38
+    private final ChannelInfo channel;
39
+    private final ChannelClientInfo kickedClient;
40
+    private final ChannelClientInfo client;
41
+    private final String reason;
42
+    private final String host;
41 43
 
42 44
     public ChannelKickEvent(final Parser parser, final Date date, final ChannelInfo channel,
43 45
             final ChannelClientInfo kickedClient, final ChannelClientInfo client,
44 46
             final String reason, final String host) {
45 47
         super(parser, date);
46
-        this.channel = channel;
47
-        this.kickedClient = kickedClient;
48
-        this.client = client;
49
-        this.reason = reason;
50
-        this.host = host;
48
+        this.channel = checkNotNull(channel);
49
+        this.kickedClient = checkNotNull(kickedClient);
50
+        this.client = checkNotNull(client);
51
+        this.reason = checkNotNull(reason);
52
+        this.host = checkNotNull(host);
51 53
     }
52 54
 
53 55
     public ChannelInfo getChannel() {

+ 3
- 1
common/src/com/dmdirc/parser/events/ChannelListModeEvent.java View File

@@ -27,6 +27,8 @@ import com.dmdirc.parser.interfaces.Parser;
27 27
 
28 28
 import java.util.Date;
29 29
 
30
+import static com.google.common.base.Preconditions.checkNotNull;
31
+
30 32
 /**
31 33
  * Called when all requested ListModes have been sent.
32 34
  */
@@ -38,7 +40,7 @@ public class ChannelListModeEvent extends ParserEvent {
38 40
     public ChannelListModeEvent(final Parser parser, final Date date, final ChannelInfo channel,
39 41
             final char mode) {
40 42
         super(parser, date);
41
-        this.channel = channel;
43
+        this.channel = checkNotNull(channel);
42 44
         this.mode = mode;
43 45
     }
44 46
 

+ 6
- 4
common/src/com/dmdirc/parser/events/ChannelMessageEvent.java View File

@@ -28,6 +28,8 @@ import com.dmdirc.parser.interfaces.Parser;
28 28
 
29 29
 import java.util.Date;
30 30
 
31
+import static com.google.common.base.Preconditions.checkNotNull;
32
+
31 33
 /**
32 34
  * Called when a person sends a message to a channel.
33 35
  */
@@ -41,10 +43,10 @@ public class ChannelMessageEvent extends ParserEvent {
41 43
     public ChannelMessageEvent(final Parser parser, final Date date, final ChannelInfo channel,
42 44
             final ChannelClientInfo client, final String message, final String host) {
43 45
         super(parser, date);
44
-        this.channel = channel;
45
-        this.client = client;
46
-        this.message = message;
47
-        this.host = host;
46
+        this.channel = checkNotNull(channel);
47
+        this.client = checkNotNull(client);
48
+        this.message = checkNotNull(message);
49
+        this.host = checkNotNull(host);
48 50
     }
49 51
 
50 52
     public ChannelInfo getChannel() {

+ 6
- 4
common/src/com/dmdirc/parser/events/ChannelModeChangeEvent.java View File

@@ -28,6 +28,8 @@ import com.dmdirc.parser.interfaces.Parser;
28 28
 
29 29
 import java.util.Date;
30 30
 
31
+import static com.google.common.base.Preconditions.checkNotNull;
32
+
31 33
 /**
32 34
  * Called when the channel modes are changed or discovered.
33 35
  */
@@ -41,10 +43,10 @@ public class ChannelModeChangeEvent extends ParserEvent {
41 43
     public ChannelModeChangeEvent(final Parser parser, final Date date, final ChannelInfo channel,
42 44
             final ChannelClientInfo client, final String host, final String modes) {
43 45
         super(parser, date);
44
-        this.channel = channel;
45
-        this.client = client;
46
-        this.host = host;
47
-        this.modes = modes;
46
+        this.channel = checkNotNull(channel);
47
+        this.client = checkNotNull(client);
48
+        this.host = checkNotNull(host);
49
+        this.modes = checkNotNull(modes);
48 50
     }
49 51
 
50 52
     public ChannelInfo getChannel() {

+ 7
- 5
common/src/com/dmdirc/parser/events/ChannelModeMessageEvent.java View File

@@ -28,6 +28,8 @@ import com.dmdirc.parser.interfaces.Parser;
28 28
 
29 29
 import java.util.Date;
30 30
 
31
+import static com.google.common.base.Preconditions.checkNotNull;
32
+
31 33
 /**
32 34
  * Called when a person sends a Message to a channel with a mode prefix.
33 35
  */
@@ -43,11 +45,11 @@ public class ChannelModeMessageEvent extends ParserEvent {
43 45
             final char prefix, final ChannelClientInfo client, final String message,
44 46
             final String host) {
45 47
         super(parser, date);
46
-        this.channel = channel;
47
-        this.prefix = prefix;
48
-        this.client = client;
49
-        this.message = message;
50
-        this.host = host;
48
+        this.channel = checkNotNull(channel);
49
+        this.prefix = checkNotNull(prefix);
50
+        this.client = checkNotNull(client);
51
+        this.message = checkNotNull(message);
52
+        this.host = checkNotNull(host);
51 53
     }
52 54
 
53 55
     public ChannelInfo getChannel() {

+ 7
- 5
common/src/com/dmdirc/parser/events/ChannelModeNoticeEvent.java View File

@@ -28,6 +28,8 @@ import com.dmdirc.parser.interfaces.Parser;
28 28
 
29 29
 import java.util.Date;
30 30
 
31
+import static com.google.common.base.Preconditions.checkNotNull;
32
+
31 33
 /**
32 34
  * Called when a person sends a notice to a channel with a mode prefix.
33 35
  */
@@ -43,11 +45,11 @@ public class ChannelModeNoticeEvent extends ParserEvent {
43 45
             final char prefix, final ChannelClientInfo client, final String message,
44 46
             final String host) {
45 47
         super(parser, date);
46
-        this.channel = channel;
47
-        this.prefix = prefix;
48
-        this.client = client;
49
-        this.message = message;
50
-        this.host = host;
48
+        this.channel = checkNotNull(channel);
49
+        this.prefix = checkNotNull(prefix);
50
+        this.client = checkNotNull(client);
51
+        this.message = checkNotNull(message);
52
+        this.host = checkNotNull(host);
51 53
     }
52 54
 
53 55
     public ChannelInfo getChannel() {

+ 3
- 1
common/src/com/dmdirc/parser/events/ChannelNamesEvent.java View File

@@ -27,6 +27,8 @@ import com.dmdirc.parser.interfaces.Parser;
27 27
 
28 28
 import java.util.Date;
29 29
 
30
+import static com.google.common.base.Preconditions.checkNotNull;
31
+
30 32
 /**
31 33
  * Called when a names reply is parsed.
32 34
  */
@@ -36,7 +38,7 @@ public class ChannelNamesEvent extends ParserEvent {
36 38
 
37 39
     public ChannelNamesEvent(final Parser parser, final Date date, final ChannelInfo channel) {
38 40
         super(parser, date);
39
-        this.channel = channel;
41
+        this.channel = checkNotNull(channel);
40 42
     }
41 43
 
42 44
     public ChannelInfo getChannel() {

+ 5
- 3
common/src/com/dmdirc/parser/events/ChannelNickChangeEvent.java View File

@@ -28,6 +28,8 @@ import com.dmdirc.parser.interfaces.Parser;
28 28
 
29 29
 import java.util.Date;
30 30
 
31
+import static com.google.common.base.Preconditions.checkNotNull;
32
+
31 33
 /**
32 34
  * Called when we or another user change nickname (Called once per channel the user is on).
33 35
  */
@@ -40,9 +42,9 @@ public class ChannelNickChangeEvent extends ParserEvent {
40 42
     public ChannelNickChangeEvent(final Parser parser, final Date date, final ChannelInfo channel,
41 43
             final ChannelClientInfo client, final String oldNick) {
42 44
         super(parser, date);
43
-        this.channel = channel;
44
-        this.client = client;
45
-        this.oldNick = oldNick;
45
+        this.channel = checkNotNull(channel);
46
+        this.client = checkNotNull(client);
47
+        this.oldNick = checkNotNull(oldNick);
46 48
     }
47 49
 
48 50
     public ChannelInfo getChannel() {

+ 6
- 4
common/src/com/dmdirc/parser/events/ChannelNonUserModeChangeEvent.java View File

@@ -28,6 +28,8 @@ import com.dmdirc.parser.interfaces.Parser;
28 28
 
29 29
 import java.util.Date;
30 30
 
31
+import static com.google.common.base.Preconditions.checkNotNull;
32
+
31 33
 /**
32 34
  * Called when the channel modes are changed or discovered.
33 35
  */
@@ -42,10 +44,10 @@ public class ChannelNonUserModeChangeEvent extends ParserEvent {
42 44
             final ChannelInfo channel, final ChannelClientInfo client, final String host,
43 45
             final String modes) {
44 46
         super(parser, date);
45
-        this.channel = channel;
46
-        this.client = client;
47
-        this.host = host;
48
-        this.modes = modes;
47
+        this.channel = checkNotNull(channel);
48
+        this.client = checkNotNull(client);
49
+        this.host = checkNotNull(host);
50
+        this.modes = checkNotNull(modes);
49 51
     }
50 52
 
51 53
     public ChannelInfo getChannel() {

+ 6
- 4
common/src/com/dmdirc/parser/events/ChannelNoticeEvent.java View File

@@ -28,6 +28,8 @@ import com.dmdirc.parser.interfaces.Parser;
28 28
 
29 29
 import java.util.Date;
30 30
 
31
+import static com.google.common.base.Preconditions.checkNotNull;
32
+
31 33
 /**
32 34
  * Called when a person sends a notice to a channel.
33 35
  */
@@ -41,10 +43,10 @@ public class ChannelNoticeEvent extends ParserEvent {
41 43
     public ChannelNoticeEvent(final Parser parser, final Date date, final ChannelInfo channel,
42 44
             final ChannelClientInfo client, final String message, final String host) {
43 45
         super(parser, date);
44
-        this.channel = channel;
45
-        this.client = client;
46
-        this.message = message;
47
-        this.host = host;
46
+        this.channel = checkNotNull(channel);
47
+        this.client = checkNotNull(client);
48
+        this.message = checkNotNull(message);
49
+        this.host = checkNotNull(host);
48 50
     }
49 51
 
50 52
     public ChannelInfo getChannel() {

+ 6
- 4
common/src/com/dmdirc/parser/events/ChannelOtherAwayStateEvent.java View File

@@ -29,6 +29,8 @@ import com.dmdirc.parser.interfaces.Parser;
29 29
 
30 30
 import java.util.Date;
31 31
 
32
+import static com.google.common.base.Preconditions.checkNotNull;
33
+
32 34
 /**
33 35
  * Called when we go away, or come back.
34 36
  */
@@ -43,10 +45,10 @@ public class ChannelOtherAwayStateEvent extends ParserEvent {
43 45
             final ChannelInfo channel, final ChannelClientInfo client, final AwayState oldState,
44 46
             final AwayState newState) {
45 47
         super(parser, date);
46
-        this.channel = channel;
47
-        this.client = client;
48
-        this.oldState = oldState;
49
-        this.newState = newState;
48
+        this.channel = checkNotNull(channel);
49
+        this.client = checkNotNull(client);
50
+        this.oldState = checkNotNull(oldState);
51
+        this.newState = checkNotNull(newState);
50 52
     }
51 53
 
52 54
     public ChannelInfo getChannel() {

+ 5
- 3
common/src/com/dmdirc/parser/events/ChannelPartEvent.java View File

@@ -28,6 +28,8 @@ import com.dmdirc.parser.interfaces.Parser;
28 28
 
29 29
 import java.util.Date;
30 30
 
31
+import static com.google.common.base.Preconditions.checkNotNull;
32
+
31 33
 /**
32 34
  * Called When we, or another client parts a channel.
33 35
  */
@@ -40,9 +42,9 @@ public class ChannelPartEvent extends ParserEvent {
40 42
     public ChannelPartEvent(final Parser parser, final Date date, final ChannelInfo channel,
41 43
             final ChannelClientInfo client, final String reason) {
42 44
         super(parser, date);
43
-        this.channel = channel;
44
-        this.client = client;
45
-        this.reason = reason;
45
+        this.channel = checkNotNull(channel);
46
+        this.client = checkNotNull(client);
47
+        this.reason = checkNotNull(reason);
46 48
     }
47 49
 
48 50
     public ChannelInfo getChannel() {

+ 5
- 3
common/src/com/dmdirc/parser/events/ChannelQuitEvent.java View File

@@ -28,6 +28,8 @@ import com.dmdirc.parser.interfaces.Parser;
28 28
 
29 29
 import java.util.Date;
30 30
 
31
+import static com.google.common.base.Preconditions.checkNotNull;
32
+
31 33
 /**
32 34
  * Called When we, or another client quits IRC (Called once per channel the user was on).
33 35
  */
@@ -40,9 +42,9 @@ public class ChannelQuitEvent extends ParserEvent {
40 42
     public ChannelQuitEvent(final Parser parser, final Date date, final ChannelInfo channel,
41 43
             final ChannelClientInfo client, final String reason) {
42 44
         super(parser, date);
43
-        this.channel = channel;
44
-        this.client = client;
45
-        this.reason = reason;
45
+        this.channel = checkNotNull(channel);
46
+        this.client = checkNotNull(client);
47
+        this.reason = checkNotNull(reason);
46 48
     }
47 49
 
48 50
     public ChannelInfo getChannel() {

+ 3
- 1
common/src/com/dmdirc/parser/events/ChannelSelfJoinEvent.java View File

@@ -27,6 +27,8 @@ import com.dmdirc.parser.interfaces.Parser;
27 27
 
28 28
 import java.util.Date;
29 29
 
30
+import static com.google.common.base.Preconditions.checkNotNull;
31
+
30 32
 /**
31 33
  * Called when we join a channel.
32 34
  */
@@ -36,7 +38,7 @@ public class ChannelSelfJoinEvent extends ParserEvent {
36 38
 
37 39
     public ChannelSelfJoinEvent(final Parser parser, final Date date, final ChannelInfo channel) {
38 40
         super(parser, date);
39
-        this.channel = channel;
41
+        this.channel = checkNotNull(channel);
40 42
     }
41 43
 
42 44
     public ChannelInfo getChannel() {

+ 6
- 4
common/src/com/dmdirc/parser/events/ChannelSingleModeChangeEvent.java View File

@@ -28,6 +28,8 @@ import com.dmdirc.parser.interfaces.Parser;
28 28
 
29 29
 import java.util.Date;
30 30
 
31
+import static com.google.common.base.Preconditions.checkNotNull;
32
+
31 33
 /**
32 34
  * Called when the channel modes are changed or discovered.
33 35
  */
@@ -42,10 +44,10 @@ public class ChannelSingleModeChangeEvent extends ParserEvent {
42 44
             final ChannelInfo channel, final ChannelClientInfo client, final String host,
43 45
             final String modes) {
44 46
         super(parser, date);
45
-        this.channel = channel;
46
-        this.client = client;
47
-        this.host = host;
48
-        this.modes = modes;
47
+        this.channel = checkNotNull(channel);
48
+        this.client = checkNotNull(client);
49
+        this.host = checkNotNull(host);
50
+        this.modes = checkNotNull(modes);
49 51
     }
50 52
 
51 53
     public ChannelInfo getChannel() {

+ 3
- 1
common/src/com/dmdirc/parser/events/ChannelTopicEvent.java View File

@@ -27,6 +27,8 @@ import com.dmdirc.parser.interfaces.Parser;
27 27
 
28 28
 import java.util.Date;
29 29
 
30
+import static com.google.common.base.Preconditions.checkNotNull;
31
+
30 32
 /**
31 33
  * Called when the topic is changed or discovered for the first time.
32 34
  */
@@ -38,7 +40,7 @@ public class ChannelTopicEvent extends ParserEvent {
38 40
     public ChannelTopicEvent(final Parser parser, final Date date, final ChannelInfo channel,
39 41
             final boolean isJoinTopic) {
40 42
         super(parser, date);
41
-        this.channel = channel;
43
+        this.channel = checkNotNull(channel);
42 44
         this.isJoinTopic = isJoinTopic;
43 45
     }
44 46
 

+ 7
- 5
common/src/com/dmdirc/parser/events/ChannelUserModeChangeEvent.java View File

@@ -28,6 +28,8 @@ import com.dmdirc.parser.interfaces.Parser;
28 28
 
29 29
 import java.util.Date;
30 30
 
31
+import static com.google.common.base.Preconditions.checkNotNull;
32
+
31 33
 /**
32 34
  *  Called when a users channel mode is changed.
33 35
  */
@@ -43,11 +45,11 @@ public class ChannelUserModeChangeEvent extends ParserEvent {
43 45
             final ChannelInfo channel, final ChannelClientInfo targetClient,
44 46
             final ChannelClientInfo client, final String host, final String mode) {
45 47
         super(parser, date);
46
-        this.channel = channel;
47
-        this.targetClient = targetClient;
48
-        this.client = client;
49
-        this.host = host;
50
-        this.mode = mode;
48
+        this.channel = checkNotNull(channel);
49
+        this.targetClient = checkNotNull(targetClient);
50
+        this.client = checkNotNull(client);
51
+        this.host = checkNotNull(host);
52
+        this.mode = checkNotNull(mode);
51 53
     }
52 54
 
53 55
     public ChannelInfo getChannel() {

+ 4
- 2
common/src/com/dmdirc/parser/events/CompositionStateChangeEvent.java View File

@@ -27,6 +27,8 @@ import com.dmdirc.parser.interfaces.Parser;
27 27
 
28 28
 import java.util.Date;
29 29
 
30
+import static com.google.common.base.Preconditions.checkNotNull;
31
+
30 32
 /**
31 33
  * Called when a person's composition state changes.
32 34
  */
@@ -38,8 +40,8 @@ public class CompositionStateChangeEvent extends ParserEvent {
38 40
     public CompositionStateChangeEvent(final Parser parser, final Date date,
39 41
             final CompositionState state, final String host) {
40 42
         super(parser, date);
41
-        this.state = state;
42
-        this.host = host;
43
+        this.state = checkNotNull(state);
44
+        this.host = checkNotNull(host);
43 45
     }
44 46
 
45 47
     public CompositionState getState() {

+ 3
- 1
common/src/com/dmdirc/parser/events/ConnectErrorEvent.java View File

@@ -27,6 +27,8 @@ import com.dmdirc.parser.interfaces.Parser;
27 27
 
28 28
 import java.util.Date;
29 29
 
30
+import static com.google.common.base.Preconditions.checkNotNull;
31
+
30 32
 /**
31 33
  * Called to give Error Information related to a connection attempt.
32 34
  */
@@ -36,7 +38,7 @@ public class ConnectErrorEvent extends ParserEvent {
36 38
 
37 39
     public ConnectErrorEvent(final Parser parser, final Date date, final ParserError errorInfo) {
38 40
         super(parser, date);
39
-        this.errorInfo = errorInfo;
41
+        this.errorInfo = checkNotNull(errorInfo);
40 42
     }
41 43
 
42 44
     public ParserError getErrorInfo() {

+ 3
- 1
common/src/com/dmdirc/parser/events/DataInEvent.java View File

@@ -26,6 +26,8 @@ import com.dmdirc.parser.interfaces.Parser;
26 26
 
27 27
 import java.util.Date;
28 28
 
29
+import static com.google.common.base.Preconditions.checkNotNull;
30
+
29 31
 /**
30 32
  * Interface Used on every incoming line BEFORE parsing.
31 33
  */
@@ -35,7 +37,7 @@ public class DataInEvent extends ParserEvent {
35 37
 
36 38
     public DataInEvent(final Parser parser, final Date date, final String data) {
37 39
         super(parser, date);
38
-        this.data = data;
40
+        this.data = checkNotNull(data);
39 41
     }
40 42
 
41 43
     public String getData() {

+ 3
- 1
common/src/com/dmdirc/parser/events/DataOutEvent.java View File

@@ -26,6 +26,8 @@ import com.dmdirc.parser.interfaces.Parser;
26 26
 
27 27
 import java.util.Date;
28 28
 
29
+import static com.google.common.base.Preconditions.checkNotNull;
30
+
29 31
 /**
30 32
  * Called on every incoming line BEFORE being sent.
31 33
  */
@@ -35,7 +37,7 @@ public class DataOutEvent extends ParserEvent {
35 37
 
36 38
     public DataOutEvent(final Parser parser, final Date date, final String data) {
37 39
         super(parser, date);
38
-        this.data = data;
40
+        this.data = checkNotNull(data);
39 41
     }
40 42
 
41 43
     public String getData() {

+ 3
- 1
common/src/com/dmdirc/parser/events/DebugInfoEvent.java View File

@@ -26,6 +26,8 @@ import com.dmdirc.parser.interfaces.Parser;
26 26
 
27 27
 import java.util.Date;
28 28
 
29
+import static com.google.common.base.Preconditions.checkNotNull;
30
+
29 31
 /**
30 32
  * Interface Used to give Debug Information.
31 33
  */
@@ -38,7 +40,7 @@ public class DebugInfoEvent extends ParserEvent {
38 40
             final String data) {
39 41
         super(parser, date);
40 42
         this.level = level;
41
-        this.data = data;
43
+        this.data = checkNotNull(data);
42 44
     }
43 45
 
44 46
     public int getLevel() {

+ 3
- 1
common/src/com/dmdirc/parser/events/ErrorInfoEvent.java View File

@@ -27,6 +27,8 @@ import com.dmdirc.parser.interfaces.Parser;
27 27
 
28 28
 import java.util.Date;
29 29
 
30
+import static com.google.common.base.Preconditions.checkNotNull;
31
+
30 32
 /**
31 33
  * Called to give Error Information.
32 34
  */
@@ -36,7 +38,7 @@ public class ErrorInfoEvent extends ParserEvent {
36 38
 
37 39
     public ErrorInfoEvent(final Parser parser, final Date date, final ParserError errorInfo) {
38 40
         super(parser, date);
39
-        this.errorInfo = errorInfo;
41
+        this.errorInfo = checkNotNull(errorInfo);
40 42
     }
41 43
 
42 44
     public ParserError getErrorInfo() {

+ 5
- 3
common/src/com/dmdirc/parser/events/GroupListEntryEvent.java View File

@@ -26,6 +26,8 @@ import com.dmdirc.parser.interfaces.Parser;
26 26
 
27 27
 import java.util.Date;
28 28
 
29
+import static com.google.common.base.Preconditions.checkNotNull;
30
+
29 31
 /**
30 32
  * Callback interface for when the parser receives an entry during a group list response.
31 33
  */
@@ -38,9 +40,9 @@ public class GroupListEntryEvent extends ParserEvent {
38 40
     public GroupListEntryEvent(final Parser parser, final Date date, final String name,
39 41
             final int users, final String topic) {
40 42
         super(parser, date);
41
-        this.name = name;
42
-        this.users = users;
43
-        this.topic = topic;
43
+        this.name = checkNotNull(name);
44
+        this.users = checkNotNull(users);
45
+        this.topic = checkNotNull(topic);
44 46
     }
45 47
 
46 48
     public String getName() {

+ 4
- 2
common/src/com/dmdirc/parser/events/InviteEvent.java View File

@@ -26,6 +26,8 @@ import com.dmdirc.parser.interfaces.Parser;
26 26
 
27 27
 import java.util.Date;
28 28
 
29
+import static com.google.common.base.Preconditions.checkNotNull;
30
+
29 31
 /**
30 32
  * Called when we are invited to a channel.
31 33
  */
@@ -37,8 +39,8 @@ public class InviteEvent extends ParserEvent {
37 39
     public InviteEvent(final Parser parser, final Date date, final String userHost,
38 40
             final String channel) {
39 41
         super(parser, date);
40
-        this.userHost = userHost;
41
-        this.channel = channel;
42
+        this.userHost = checkNotNull(userHost);
43
+        this.channel = checkNotNull(channel);
42 44
     }
43 45
 
44 46
     public String getUserHost() {

+ 3
- 1
common/src/com/dmdirc/parser/events/MOTDEndEvent.java View File

@@ -26,6 +26,8 @@ import com.dmdirc.parser.interfaces.Parser;
26 26
 
27 27
 import java.util.Date;
28 28
 
29
+import static com.google.common.base.Preconditions.checkNotNull;
30
+
29 31
 /**
30 32
  * Called when "End of MOTD" or "No MOTD" is received.
31 33
  */
@@ -38,7 +40,7 @@ public class MOTDEndEvent extends ParserEvent {
38 40
             final String data) {
39 41
         super(parser, date);
40 42
         this.noMOTD = noMOTD;
41
-        this.data = data;
43
+        this.data = checkNotNull(data);
42 44
     }
43 45
 
44 46
     public boolean isNoMOTD() {

+ 3
- 1
common/src/com/dmdirc/parser/events/MOTDLineEvent.java View File

@@ -26,6 +26,8 @@ import com.dmdirc.parser.interfaces.Parser;
26 26
 
27 27
 import java.util.Date;
28 28
 
29
+import static com.google.common.base.Preconditions.checkNotNull;
30
+
29 31
 /**
30 32
  * Interface Used to give MOTD Information.
31 33
  */
@@ -35,7 +37,7 @@ public class MOTDLineEvent extends ParserEvent {
35 37
 
36 38
     public MOTDLineEvent(final Parser parser, final Date date, final String data) {
37 39
         super(parser, date);
38
-        this.data = data;
40
+        this.data = checkNotNull(data);
39 41
     }
40 42
 
41 43
     public String getData() {

+ 3
- 1
common/src/com/dmdirc/parser/events/MOTDStartEvent.java View File

@@ -26,6 +26,8 @@ import com.dmdirc.parser.interfaces.Parser;
26 26
 
27 27
 import java.util.Date;
28 28
 
29
+import static com.google.common.base.Preconditions.checkNotNull;
30
+
29 31
 /**
30 32
  * Interface Used when the MOTD Starts.
31 33
  */
@@ -35,7 +37,7 @@ public class MOTDStartEvent extends ParserEvent {
35 37
 
36 38
     public MOTDStartEvent(final Parser parser, final Date date, final String data) {
37 39
         super(parser, date);
38
-        this.data = data;
40
+        this.data = checkNotNull(data);
39 41
     }
40 42
 
41 43
     public String getData() {

+ 5
- 3
common/src/com/dmdirc/parser/events/NetworkDetectedEvent.java View File

@@ -26,6 +26,8 @@ import com.dmdirc.parser.interfaces.Parser;
26 26
 
27 27
 import java.util.Date;
28 28
 
29
+import static com.google.common.base.Preconditions.checkNotNull;
30
+
29 31
 /**
30 32
  * Interface Used when the Network=blah 005 token is recieved.
31 33
  */
@@ -38,9 +40,9 @@ public class NetworkDetectedEvent extends ParserEvent {
38 40
     public NetworkDetectedEvent(final Parser parser, final Date date, final String networkName,
39 41
             final String ircdVersion, final String ircdType) {
40 42
         super(parser, date);
41
-        this.networkName = networkName;
42
-        this.ircdVersion = ircdVersion;
43
-        this.ircdType = ircdType;
43
+        this.networkName = checkNotNull(networkName);
44
+        this.ircdVersion = checkNotNull(ircdVersion);
45
+        this.ircdType = checkNotNull(ircdType);
44 46
     }
45 47
 
46 48
     public String getNetworkName() {

+ 4
- 2
common/src/com/dmdirc/parser/events/NickChangeEvent.java View File

@@ -27,6 +27,8 @@ import com.dmdirc.parser.interfaces.Parser;
27 27
 
28 28
 import java.util.Date;
29 29
 
30
+import static com.google.common.base.Preconditions.checkNotNull;
31
+
30 32
 /**
31 33
  * Called when we or another user change nickname.
32 34
  */
@@ -38,8 +40,8 @@ public class NickChangeEvent extends ParserEvent {
38 40
     public NickChangeEvent(final Parser parser, final Date date, final ClientInfo client,
39 41
             final String oldNick) {
40 42
         super(parser, date);
41
-        this.client = client;
42
-        this.oldNick = oldNick;
43
+        this.client = checkNotNull(client);
44
+        this.oldNick = checkNotNull(oldNick);
43 45
     }
44 46
 
45 47
     public ClientInfo getClient() {

+ 3
- 1
common/src/com/dmdirc/parser/events/NickInUseEvent.java View File

@@ -26,6 +26,8 @@ import com.dmdirc.parser.interfaces.Parser;
26 26
 
27 27
 import java.util.Date;
28 28
 
29
+import static com.google.common.base.Preconditions.checkNotNull;
30
+
29 31
 /**
30 32
  * Called when requested nickname is in use.
31 33
  */
@@ -35,7 +37,7 @@ public class NickInUseEvent extends ParserEvent {
35 37
 
36 38
     public NickInUseEvent(final Parser parser, final Date date, final String nickname) {
37 39
         super(parser, date);
38
-        this.nickname = nickname;
40
+        this.nickname = checkNotNull(nickname);
39 41
     }
40 42
 
41 43
     public String getNickname() {

+ 4
- 2
common/src/com/dmdirc/parser/events/NumericEvent.java View File

@@ -26,6 +26,8 @@ import com.dmdirc.parser.interfaces.Parser;
26 26
 
27 27
 import java.util.Date;
28 28
 
29
+import static com.google.common.base.Preconditions.checkNotNull;
30
+
29 31
 /**
30 32
  * Interface Used to give numeric Information.
31 33
  */
@@ -37,8 +39,8 @@ public class NumericEvent extends ParserEvent {
37 39
     public NumericEvent(final Parser parser, final Date date, final int numeric,
38 40
             final String[] token) {
39 41
         super(parser, date);
40
-        this.numeric = numeric;
41
-        this.token = token;
42
+        this.numeric = checkNotNull(numeric);
43
+        this.token = checkNotNull(token);
42 44
     }
43 45
 
44 46
     public int getNumeric() {

+ 5
- 3
common/src/com/dmdirc/parser/events/OtherAwayStateEvent.java View File

@@ -28,6 +28,8 @@ import com.dmdirc.parser.interfaces.Parser;
28 28
 
29 29
 import java.util.Date;
30 30
 
31
+import static com.google.common.base.Preconditions.checkNotNull;
32
+
31 33
 /**
32 34
  * Called when we go away, or come back.
33 35
  */
@@ -40,9 +42,9 @@ public class OtherAwayStateEvent extends ParserEvent {
40 42
     public OtherAwayStateEvent(final Parser parser, final Date date, final ClientInfo client,
41 43
             final AwayState oldState, final AwayState newState) {
42 44
         super(parser, date);
43
-        this.client = client;
44
-        this.oldState = oldState;
45
-        this.newState = newState;
45
+        this.client = checkNotNull(client);
46
+        this.oldState = checkNotNull(oldState);
47
+        this.newState = checkNotNull(newState);
46 48
     }
47 49
 
48 50
     public ClientInfo getClient() {

+ 3
- 1
common/src/com/dmdirc/parser/events/ParserErrorEvent.java View File

@@ -26,6 +26,8 @@ import com.dmdirc.parser.interfaces.Parser;
26 26
 
27 27
 import java.util.Date;
28 28
 
29
+import static com.google.common.base.Preconditions.checkNotNull;
30
+
29 31
 /**
30 32
  * Parser error event.
31 33
  */
@@ -35,7 +37,7 @@ public class ParserErrorEvent extends ParserEvent {
35 37
 
36 38
     public ParserErrorEvent(final Parser parser, final Date date, final Throwable throwable) {
37 39
         super(parser, date);
38
-        this.throwable = throwable;
40
+        this.throwable = checkNotNull(throwable);
39 41
     }
40 42
 
41 43
     public Throwable getThrowable() {

+ 8
- 15
common/src/com/dmdirc/parser/events/ParserEvent.java View File

@@ -26,17 +26,19 @@ import com.dmdirc.parser.interfaces.Parser;
26 26
 
27 27
 import java.util.Date;
28 28
 
29
+import static com.google.common.base.Preconditions.checkNotNull;
30
+
29 31
 /**
30
- *
32
+ * Base class for events emitted by a {@link Parser}.
31 33
  */
32
-public class ParserEvent {
34
+public abstract class ParserEvent {
33 35
 
34
-    private Parser parser;
35
-    private Date date;
36
+    private final Parser parser;
37
+    private final Date date;
36 38
 
37 39
     public ParserEvent(final Parser parser, final Date date) {
38
-        this.parser = parser;
39
-        this.date = date;
40
+        this.parser = checkNotNull(parser);
41
+        this.date = checkNotNull(date);
40 42
     }
41 43
 
42 44
     public Parser getParser() {
@@ -47,13 +49,4 @@ public class ParserEvent {
47 49
         return date;
48 50
     }
49 51
 
50
-    // TODO: HACKY REMOVE
51
-    public void setParser(final Parser parser) {
52
-        this.parser = parser;
53
-    }
54
-
55
-    // TODO: HACKY REMOVE
56
-    public void setDate(final Date date) {
57
-        this.date = date;
58
-    }
59 52
 }

+ 4
- 2
common/src/com/dmdirc/parser/events/PrivateActionEvent.java View File

@@ -26,6 +26,8 @@ import com.dmdirc.parser.interfaces.Parser;
26 26
 
27 27
 import java.util.Date;
28 28
 
29
+import static com.google.common.base.Preconditions.checkNotNull;
30
+
29 31
 /**
30 32
  * Called when a person does an action to you (PM).
31 33
  */
@@ -37,8 +39,8 @@ public class PrivateActionEvent extends ParserEvent {
37 39
     public PrivateActionEvent(final Parser parser, final Date date, final String message,
38 40
             final String host) {
39 41
         super(parser, date);
40
-        this.message = message;
41
-        this.host = host;
42
+        this.message = checkNotNull(message);
43
+        this.host = checkNotNull(host);
42 44
     }
43 45
 
44 46
     public String getMessage() {

+ 5
- 3
common/src/com/dmdirc/parser/events/PrivateCTCPEvent.java View File

@@ -26,6 +26,8 @@ import com.dmdirc.parser.interfaces.Parser;
26 26
 
27 27
 import java.util.Date;
28 28
 
29
+import static com.google.common.base.Preconditions.checkNotNull;
30
+
29 31
 /**
30 32
  * Called when a person sends a CTCP to you directly.
31 33
  */
@@ -38,9 +40,9 @@ public class PrivateCTCPEvent extends ParserEvent {
38 40
     public PrivateCTCPEvent(final Parser parser, final Date date, final String type,
39 41
             final String message, final String host) {
40 42
         super(parser, date);
41
-        this.type = type;
42
-        this.message = message;
43
-        this.host = host;
43
+        this.type = checkNotNull(type);
44
+        this.message = checkNotNull(message);
45
+        this.host = checkNotNull(host);
44 46
     }
45 47
 
46 48
     public String getType() {

+ 5
- 3
common/src/com/dmdirc/parser/events/PrivateCTCPReplyEvent.java View File

@@ -26,6 +26,8 @@ import com.dmdirc.parser.interfaces.Parser;
26 26
 
27 27
 import java.util.Date;
28 28
 
29
+import static com.google.common.base.Preconditions.checkNotNull;
30
+
29 31
 /**
30 32
  * Called when a person sends a CTCPRReply to you directly.
31 33
  */
@@ -38,9 +40,9 @@ public class PrivateCTCPReplyEvent extends ParserEvent {
38 40
     public PrivateCTCPReplyEvent(final Parser parser, final Date date, final String type,
39 41
             final String message, final String host) {
40 42
         super(parser, date);
41
-        this.type = type;
42
-        this.message = message;
43
-        this.host = host;
43
+        this.type = checkNotNull(type);
44
+        this.message = checkNotNull(message);
45
+        this.host = checkNotNull(host);
44 46
     }
45 47
 
46 48
     public String getType() {

+ 4
- 2
common/src/com/dmdirc/parser/events/PrivateMessageEvent.java View File

@@ -26,6 +26,8 @@ import com.dmdirc.parser.interfaces.Parser;
26 26
 
27 27
 import java.util.Date;
28 28
 
29
+import static com.google.common.base.Preconditions.checkNotNull;
30
+
29 31
 /**
30 32
  * Called when a person sends a message to you directly (PM).
31 33
  */
@@ -37,8 +39,8 @@ public class PrivateMessageEvent extends ParserEvent {
37 39
     public PrivateMessageEvent(final Parser parser, final Date date, final String message,
38 40
             final String host) {
39 41
         super(parser, date);
40
-        this.message = message;
41
-        this.host = host;
42
+        this.message = checkNotNull(message);
43
+        this.host = checkNotNull(host);
42 44
     }
43 45
 
44 46
     public String getMessage() {

+ 4
- 2
common/src/com/dmdirc/parser/events/PrivateNoticeEvent.java View File

@@ -26,6 +26,8 @@ import com.dmdirc.parser.interfaces.Parser;
26 26
 
27 27
 import java.util.Date;
28 28
 
29
+import static com.google.common.base.Preconditions.checkNotNull;
30
+
29 31
 /**
30 32
  * Called when a person sends a notice to you.
31 33
  */
@@ -37,8 +39,8 @@ public class PrivateNoticeEvent extends ParserEvent {
37 39
     public PrivateNoticeEvent(final Parser parser, final Date date, final String message,
38 40
             final String host) {
39 41
         super(parser, date);
40
-        this.message = message;
41
-        this.host = host;
42
+        this.message = checkNotNull(message);
43
+        this.host = checkNotNull(host);
42 44
     }
43 45
 
44 46
     public String getMessage() {

+ 4
- 2
common/src/com/dmdirc/parser/events/QuitEvent.java View File

@@ -27,6 +27,8 @@ import com.dmdirc.parser.interfaces.Parser;
27 27
 
28 28
 import java.util.Date;
29 29
 
30
+import static com.google.common.base.Preconditions.checkNotNull;
31
+
30 32
 /**
31 33
  * Called When we, or another client quits IRC (Called once in total).
32 34
  */
@@ -38,8 +40,8 @@ public class QuitEvent extends ParserEvent {
38 40
     public QuitEvent(final Parser parser, final Date date, final ClientInfo client,
39 41
             final String reason) {
40 42
         super(parser, date);
41
-        this.client = client;
42
-        this.reason = reason;
43
+        this.client = checkNotNull(client);
44
+        this.reason = checkNotNull(reason);
43 45
     }
44 46
 
45 47
     public ClientInfo getClient() {

+ 3
- 1
common/src/com/dmdirc/parser/events/ServerErrorEvent.java View File

@@ -26,6 +26,8 @@ import com.dmdirc.parser.interfaces.Parser;
26 26
 
27 27
 import java.util.Date;
28 28
 
29
+import static com.google.common.base.Preconditions.checkNotNull;
30
+
29 31
 /**
30 32
  * Interface Used to give ServerError.
31 33
  */
@@ -35,7 +37,7 @@ public class ServerErrorEvent extends ParserEvent {
35 37
 
36 38
     public ServerErrorEvent(final Parser parser, final Date date, final String message) {
37 39
         super(parser, date);
38
-        this.message = message;
40
+        this.message = checkNotNull(message);
39 41
     }
40 42
 
41 43
     public String getMessage() {

+ 4
- 2
common/src/com/dmdirc/parser/events/ServerNoticeEvent.java View File

@@ -26,6 +26,8 @@ import com.dmdirc.parser.interfaces.Parser;
26 26
 
27 27
 import java.util.Date;
28 28
 
29
+import static com.google.common.base.Preconditions.checkNotNull;
30
+
29 31
 /**
30 32
  * Called when a server sends a notice to you.
31 33
  */
@@ -37,8 +39,8 @@ public class ServerNoticeEvent extends ParserEvent {
37 39
     public ServerNoticeEvent(final Parser parser, final Date date, final String message,
38 40
             final String host) {
39 41
         super(parser, date);
40
-        this.message = message;
41
-        this.host = host;
42
+        this.message = checkNotNull(message);
43
+        this.host = checkNotNull(host);
42 44
     }
43 45
 
44 46
     public String getMessage() {

+ 5
- 3
common/src/com/dmdirc/parser/events/UnknownActionEvent.java View File

@@ -26,6 +26,8 @@ import com.dmdirc.parser.interfaces.Parser;
26 26
 
27 27
 import java.util.Date;
28 28
 
29
+import static com.google.common.base.Preconditions.checkNotNull;
30
+
29 31
 /**
30 32
  * Called when a person sends an action not aimed specifically at you or a channel (ie $*).
31 33
  */
@@ -38,9 +40,9 @@ public class UnknownActionEvent extends ParserEvent {
38 40
     public UnknownActionEvent(final Parser parser, final Date date, final String message,
39 41
             final String target, final String host) {
40 42
         super(parser, date);
41
-        this.message = message;
42
-        this.target = target;
43
-        this.host = host;
43
+        this.message = checkNotNull(message);
44
+        this.target = checkNotNull(target);
45
+        this.host = checkNotNull(host);
44 46
     }
45 47
 
46 48
     public String getMessage() {

+ 6
- 4
common/src/com/dmdirc/parser/events/UnknownCTCPEvent.java View File

@@ -26,6 +26,8 @@ import com.dmdirc.parser.interfaces.Parser;
26 26
 
27 27
 import java.util.Date;
28 28
 
29
+import static com.google.common.base.Preconditions.checkNotNull;
30
+
29 31
 /**
30 32
  * Called when a person sends a CTCP not aimed at you or a channel (ie $*).
31 33
  */
@@ -39,10 +41,10 @@ public class UnknownCTCPEvent extends ParserEvent {
39 41
     public UnknownCTCPEvent(final Parser parser, final Date date, final String type,
40 42
             final String message, final String target, final String host) {
41 43
         super(parser, date);
42
-        this.type = type;
43
-        this.message = message;
44
-        this.target = target;
45
-        this.host = host;
44
+        this.type = checkNotNull(type);
45
+        this.message = checkNotNull(message);
46
+        this.target = checkNotNull(target);
47
+        this.host = checkNotNull(host);
46 48
     }
47 49
 
48 50
     public String getType() {

+ 6
- 4
common/src/com/dmdirc/parser/events/UnknownCTCPReplyEvent.java View File

@@ -26,6 +26,8 @@ import com.dmdirc.parser.interfaces.Parser;
26 26
 
27 27
 import java.util.Date;
28 28
 
29
+import static com.google.common.base.Preconditions.checkNotNull;
30
+
29 31
 /**
30 32
  * Called when a person sends a CTCP not aimed at you or a channel (ie $*).
31 33
  */
@@ -39,10 +41,10 @@ public class UnknownCTCPReplyEvent extends ParserEvent {
39 41
     public UnknownCTCPReplyEvent(final Parser parser, final Date date, final String type,
40 42
             final String message, final String target, final String host) {
41 43
         super(parser, date);
42
-        this.type = type;
43
-        this.message = message;
44
-        this.target = target;
45
-        this.host = host;
44
+        this.type = checkNotNull(type);
45
+        this.message = checkNotNull(message);
46
+        this.target = checkNotNull(target);
47
+        this.host = checkNotNull(host);
46 48
     }
47 49
 
48 50
     public String getType() {

+ 5
- 3
common/src/com/dmdirc/parser/events/UnknownMessageEvent.java View File

@@ -26,6 +26,8 @@ import com.dmdirc.parser.interfaces.Parser;
26 26
 
27 27
 import java.util.Date;
28 28
 
29
+import static com.google.common.base.Preconditions.checkNotNull;
30
+
29 31
 /**
30 32
  * Called when a person sends a message not aimed specifically at you or a channel (ie $*).
31 33
  */
@@ -38,9 +40,9 @@ public class UnknownMessageEvent extends ParserEvent {
38 40
     public UnknownMessageEvent(final Parser parser, final Date date,
39 41
             final String message, final String target, final String host) {
40 42
         super(parser, date);
41
-        this.message = message;
42
-        this.target = target;
43
-        this.host = host;
43
+        this.message = checkNotNull(message);
44
+        this.target = checkNotNull(target);
45
+        this.host = checkNotNull(host);
44 46
     }
45 47
 
46 48
     public String getMessage() {

+ 5
- 3
common/src/com/dmdirc/parser/events/UnknownNoticeEvent.java View File

@@ -26,6 +26,8 @@ import com.dmdirc.parser.interfaces.Parser;
26 26
 
27 27
 import java.util.Date;
28 28
 
29
+import static com.google.common.base.Preconditions.checkNotNull;
30
+
29 31
 /**
30 32
  * Called when a person sends a notice not aimed specifically at you or a channel (ie $*).
31 33
  */
@@ -38,9 +40,9 @@ public class UnknownNoticeEvent extends ParserEvent {
38 40
     public UnknownNoticeEvent(final Parser parser, final Date date,
39 41
             final String message, final String target, final String host) {
40 42
         super(parser, date);
41
-        this.message = message;
42
-        this.target = target;
43
-        this.host = host;
43
+        this.message = checkNotNull(message);
44
+        this.target = checkNotNull(target);
45
+        this.host = checkNotNull(host);
44 46
     }
45 47
 
46 48
     public String getMessage() {

+ 5
- 3
common/src/com/dmdirc/parser/events/UnknownServerNoticeEvent.java View File

@@ -26,6 +26,8 @@ import com.dmdirc.parser.interfaces.Parser;
26 26
 
27 27
 import java.util.Date;
28 28
 
29
+import static com.google.common.base.Preconditions.checkNotNull;
30
+
29 31
 /**
30 32
  * Called when a server sends a notice not aimed specifically at you or a channel (ie $*).
31 33
  */
@@ -38,9 +40,9 @@ public class UnknownServerNoticeEvent extends ParserEvent {
38 40
     public UnknownServerNoticeEvent(final Parser parser, final Date date, final String message,
39 41
             final String target, final String host) {
40 42
         super(parser, date);
41
-        this.message = message;
42
-        this.target = target;
43
-        this.host = host;
43
+        this.message = checkNotNull(message);
44
+        this.target = checkNotNull(target);
45
+        this.host = checkNotNull(host);
44 46
     }
45 47
 
46 48
     public String getMessage() {

+ 5
- 3
common/src/com/dmdirc/parser/events/UserModeChangeEvent.java View File

@@ -27,6 +27,8 @@ import com.dmdirc.parser.interfaces.Parser;
27 27
 
28 28
 import java.util.Date;
29 29
 
30
+import static com.google.common.base.Preconditions.checkNotNull;
31
+
30 32
 /**
31 33
  * Called when user modes are changed.
32 34
  */
@@ -39,9 +41,9 @@ public class UserModeChangeEvent extends ParserEvent {
39 41
     public UserModeChangeEvent(final Parser parser, final Date date, final ClientInfo client,
40 42
             final String host, final String modes) {
41 43
         super(parser, date);
42
-        this.client = client;
43
-        this.host = host;
44
-        this.modes = modes;
44
+        this.client = checkNotNull(client);
45
+        this.host = checkNotNull(host);
46
+        this.modes = checkNotNull(modes);
45 47
     }
46 48
 
47 49
     public ClientInfo getClient() {

+ 4
- 2
common/src/com/dmdirc/parser/events/UserModeDiscoveryEvent.java View File

@@ -27,6 +27,8 @@ import com.dmdirc.parser.interfaces.Parser;
27 27
 
28 28
 import java.util.Date;
29 29
 
30
+import static com.google.common.base.Preconditions.checkNotNull;
31
+
30 32
 /**
31 33
  * Called when user modes are Discovered.
32 34
  */
@@ -38,8 +40,8 @@ public class UserModeDiscoveryEvent extends ParserEvent {
38 40
     public UserModeDiscoveryEvent(final Parser parser, final Date date, final ClientInfo client,
39 41
             final String modes) {
40 42
         super(parser, date);
41
-        this.client = client;
42
-        this.modes = modes;
43
+        this.client = checkNotNull(client);
44
+        this.modes = checkNotNull(modes);
43 45
     }
44 46
 
45 47
     public ClientInfo getClient() {

+ 4
- 2
common/src/com/dmdirc/parser/events/WallDesyncEvent.java View File

@@ -26,6 +26,8 @@ import com.dmdirc.parser.interfaces.Parser;
26 26
 
27 27
 import java.util.Date;
28 28
 
29
+import static com.google.common.base.Preconditions.checkNotNull;
30
+
29 31
 /**
30 32
  * Called when a Desync message is recieved over wallops.
31 33
  */
@@ -37,8 +39,8 @@ public class WallDesyncEvent extends ParserEvent {
37 39
     public WallDesyncEvent(final Parser parser, final Date date, final String message,
38 40
             final String host) {
39 41
         super(parser, date);
40
-        this.message = message;
41
-        this.host = host;
42
+        this.message = checkNotNull(message);
43
+        this.host = checkNotNull(host);
42 44
     }
43 45
 
44 46
     public String getMessage() {

+ 4
- 2
common/src/com/dmdirc/parser/events/WallopEvent.java View File

@@ -26,6 +26,8 @@ import com.dmdirc.parser.interfaces.Parser;
26 26
 
27 27
 import java.util.Date;
28 28
 
29
+import static com.google.common.base.Preconditions.checkNotNull;
30
+
29 31
 /**
30 32
  * Called when an oper-only message is recieved over wallops.
31 33
  */
@@ -37,8 +39,8 @@ public class WallopEvent extends ParserEvent {
37 39
     public WallopEvent(final Parser parser, final Date date, final String message,
38 40
             final String host) {
39 41
         super(parser, date);
40
-        this.message = message;
41
-        this.host = host;
42
+        this.message = checkNotNull(message);
43
+        this.host = checkNotNull(host);
42 44
     }
43 45
 
44 46
     public String getMessage() {

+ 4
- 2
common/src/com/dmdirc/parser/events/WalluserEvent.java View File

@@ -26,6 +26,8 @@ import com.dmdirc.parser.interfaces.Parser;
26 26
 
27 27
 import java.util.Date;
28 28
 
29
+import static com.google.common.base.Preconditions.checkNotNull;
30
+
29 31
 /**
30 32
  * Called when an all-users message is recieved over wallops.
31 33
  */
@@ -37,8 +39,8 @@ public class WalluserEvent extends ParserEvent {
37 39
     public WalluserEvent(final Parser parser, final Date date, final String message,
38 40
             final String host) {
39 41
         super(parser, date);
40
-        this.message = message;
41
-        this.host = host;
42
+        this.message = checkNotNull(message);
43
+        this.host = checkNotNull(host);
42 44
     }
43 45
 
44 46
     public String getMessage() {

Loading…
Cancel
Save