[vlma-devel] commit: Check that the provided argument of the equals method is not null. (Adrien Grand )

git version control git at videolan.org
Sat Aug 2 16:08:18 CEST 2008


vlma | branch: master | Adrien Grand <jpountz at videolan.org> | Sat Aug  2 15:59:26 2008 +0200| [e81fd959b7a735085670c67304ff456ba514887d] | committer: Adrien Grand 

Check that the provided argument of the equals method is not null.

> http://git.videolan.org/gitweb.cgi/vlma.git/?a=commit;h=e81fd959b7a735085670c67304ff456ba514887d
---

 .../org/videolan/vlma/model/adapter/Server.java    |    1 +
 .../videolan/vlma/model/media/FilesChannel.java    |    1 +
 .../org/videolan/vlma/model/media/MediaGroup.java  |    1 +
 .../org/videolan/vlma/model/media/SatChannel.java  |    1 +
 .../org/videolan/vlma/model/media/Satellite.java   |    1 +
 .../videolan/vlma/model/media/StreamChannel.java   |    1 +
 .../org/videolan/vlma/model/media/TNTChannel.java  |    1 +
 7 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/vlma-api/src/main/java/org/videolan/vlma/model/adapter/Server.java b/vlma-api/src/main/java/org/videolan/vlma/model/adapter/Server.java
index 57922a7..1570ad6 100644
--- a/vlma-api/src/main/java/org/videolan/vlma/model/adapter/Server.java
+++ b/vlma-api/src/main/java/org/videolan/vlma/model/adapter/Server.java
@@ -65,6 +65,7 @@ public class Server implements Serializable {
 
     @Override
     public boolean equals(Object o) {
+        if (o == null) return false;
         try {
             Server server = (Server) o;
             return this.hashCode() == server.hashCode();
diff --git a/vlma-api/src/main/java/org/videolan/vlma/model/media/FilesChannel.java b/vlma-api/src/main/java/org/videolan/vlma/model/media/FilesChannel.java
index c44c660..aaf8180 100644
--- a/vlma-api/src/main/java/org/videolan/vlma/model/media/FilesChannel.java
+++ b/vlma-api/src/main/java/org/videolan/vlma/model/media/FilesChannel.java
@@ -69,6 +69,7 @@ public class FilesChannel extends Media {
 
     @Override
     public boolean equals(Object o) {
+        if (o == null) return false;
         if (o.getClass().equals(FilesChannel.class)) {
             FilesChannel c = (FilesChannel) o;
             return (c.name.equals(this.name));
diff --git a/vlma-api/src/main/java/org/videolan/vlma/model/media/MediaGroup.java b/vlma-api/src/main/java/org/videolan/vlma/model/media/MediaGroup.java
index 7f9f63c..dd3aa70 100644
--- a/vlma-api/src/main/java/org/videolan/vlma/model/media/MediaGroup.java
+++ b/vlma-api/src/main/java/org/videolan/vlma/model/media/MediaGroup.java
@@ -63,6 +63,7 @@ public class MediaGroup implements Comparable<MediaGroup> {
      */
     @Override
     public boolean equals(Object o) {
+        if (o == null) return false;
         if (o.getClass().equals(MediaGroup.class)) {
             MediaGroup g = (MediaGroup) o;
             if ((!g.medias.isEmpty()) && (!this.medias.isEmpty())) {
diff --git a/vlma-api/src/main/java/org/videolan/vlma/model/media/SatChannel.java b/vlma-api/src/main/java/org/videolan/vlma/model/media/SatChannel.java
index 6ff6f9f..e0ff67c 100644
--- a/vlma-api/src/main/java/org/videolan/vlma/model/media/SatChannel.java
+++ b/vlma-api/src/main/java/org/videolan/vlma/model/media/SatChannel.java
@@ -252,6 +252,7 @@ public class SatChannel extends Media {
      */
     @Override
     public boolean equals(Object o) {
+        if (o == null) return false;
         if (o.getClass().equals(SatChannel.class)) {
             SatChannel c = (SatChannel) o;
             return (c.getCoverage().equals(this.coverage)
diff --git a/vlma-api/src/main/java/org/videolan/vlma/model/media/Satellite.java b/vlma-api/src/main/java/org/videolan/vlma/model/media/Satellite.java
index 0473077..2c32f85 100644
--- a/vlma-api/src/main/java/org/videolan/vlma/model/media/Satellite.java
+++ b/vlma-api/src/main/java/org/videolan/vlma/model/media/Satellite.java
@@ -86,6 +86,7 @@ public class Satellite implements Serializable {
      */
     @Override
     public boolean equals(Object o) {
+        if (o == null) return false;
         if (o.getClass().equals(Satellite.class)) {
             return ((Satellite) o).name.equals(this.name);
         } else {
diff --git a/vlma-api/src/main/java/org/videolan/vlma/model/media/StreamChannel.java b/vlma-api/src/main/java/org/videolan/vlma/model/media/StreamChannel.java
index a62ad2c..88f2dba 100755
--- a/vlma-api/src/main/java/org/videolan/vlma/model/media/StreamChannel.java
+++ b/vlma-api/src/main/java/org/videolan/vlma/model/media/StreamChannel.java
@@ -72,6 +72,7 @@ public class StreamChannel extends Media {
      */
     @Override
     public boolean equals(Object o) {
+        if (o == null) return false;
         if (o.getClass().equals(StreamChannel.class)) {
             StreamChannel c = (StreamChannel) o;
             return (c.streamURL.equals(this.streamURL) &&
diff --git a/vlma-api/src/main/java/org/videolan/vlma/model/media/TNTChannel.java b/vlma-api/src/main/java/org/videolan/vlma/model/media/TNTChannel.java
index 673658d..c3c236b 100644
--- a/vlma-api/src/main/java/org/videolan/vlma/model/media/TNTChannel.java
+++ b/vlma-api/src/main/java/org/videolan/vlma/model/media/TNTChannel.java
@@ -74,6 +74,7 @@ public class TNTChannel extends Media {
 
     @Override
     public boolean equals(Object o) {
+        if (o == null) return false;
         if (o.getClass().equals(TNTChannel.class)) {
             TNTChannel c = (TNTChannel) o;
             return (c.getFrequency() == this.frequency && c.getSid() == sid



More information about the vlma-devel mailing list