[vlma-devel] commit: Use .equals for String comparisons. (Adrien Grand )

git version control git at videolan.org
Sat Aug 2 16:39:55 CEST 2008


vlma | branch: master | Adrien Grand <jpountz at videolan.org> | Sat Aug  2 16:42:19 2008 +0200| [419856fdd9b1ee5eef671c95e118a234e989845c] | committer: Adrien Grand 

Use .equals for String comparisons.

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

 .../java/org/videolan/vlma/VLMaServiceImpl.java    |    2 +-
 .../org/videolan/vlma/order/SatOrderSender.java    |    2 +-
 .../org/videolan/vlma/order/TNTOrderSender.java    |    2 +-
 .../vlma/web/media/MediaProgramAddController.java  |    6 +++---
 .../vlma/web/server/ServerAddValidator.java        |    2 +-
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/vlma-core/src/main/java/org/videolan/vlma/VLMaServiceImpl.java b/vlma-core/src/main/java/org/videolan/vlma/VLMaServiceImpl.java
index 4358e34..912fd91 100644
--- a/vlma-core/src/main/java/org/videolan/vlma/VLMaServiceImpl.java
+++ b/vlma-core/src/main/java/org/videolan/vlma/VLMaServiceImpl.java
@@ -620,7 +620,7 @@ public class VLMaServiceImpl implements VLMaService {
         Iterator k = medias.iterator();
         while (k.hasNext()) {
             Media ch = (Media) k.next();
-            if (ch.getClass().getName() == "SatChannel" && coverages.contains(((SatChannel)ch).getCoverage()))
+            if ("SatChannel".equals(ch.getClass().getName()) && coverages.contains(((SatChannel)ch).getCoverage()))
             {
                 k.remove();
             }
diff --git a/vlma-core/src/main/java/org/videolan/vlma/order/SatOrderSender.java b/vlma-core/src/main/java/org/videolan/vlma/order/SatOrderSender.java
index 7cee5ca..4cad6aa 100644
--- a/vlma-core/src/main/java/org/videolan/vlma/order/SatOrderSender.java
+++ b/vlma-core/src/main/java/org/videolan/vlma/order/SatOrderSender.java
@@ -58,7 +58,7 @@ public class SatOrderSender extends OrderSender {
             String command = "";
             for (Media m : o.getMedias().medias) {
                 ch = (SatChannel) m;
-                if (ids != "") {
+                if (ids.length() > 0) {
                     ids += ",";
                 }
                 ids += Integer.toString(ch.getSid());
diff --git a/vlma-core/src/main/java/org/videolan/vlma/order/TNTOrderSender.java b/vlma-core/src/main/java/org/videolan/vlma/order/TNTOrderSender.java
index 6bb452a..6bf7293 100644
--- a/vlma-core/src/main/java/org/videolan/vlma/order/TNTOrderSender.java
+++ b/vlma-core/src/main/java/org/videolan/vlma/order/TNTOrderSender.java
@@ -48,7 +48,7 @@ public class TNTOrderSender extends OrderSender {
             String command = "";
             for (Media m : o.getMedias().medias) {
                 ch = (TNTChannel) m;
-                if (ids != "") {
+                if (ids.length() > 0) {
                     ids += ",";
                 }
                 ids += Integer.toString(ch.getSid());
diff --git a/vlma-webapp/src/main/java/org/videolan/vlma/web/media/MediaProgramAddController.java b/vlma-webapp/src/main/java/org/videolan/vlma/web/media/MediaProgramAddController.java
index 39c5a8a..9d446a3 100644
--- a/vlma-webapp/src/main/java/org/videolan/vlma/web/media/MediaProgramAddController.java
+++ b/vlma-webapp/src/main/java/org/videolan/vlma/web/media/MediaProgramAddController.java
@@ -109,7 +109,7 @@ public class MediaProgramAddController extends SimpleFormController {
         data.updateMediaProgram(mediasProgramAdd.getMediaId(), program);
 
         // Determine the success view with the media class
-        String successView = new String();
+        String successView = null;
         if (media.getClass() == FilesChannel.class) {
             successView = getSuccessViewFile();
         }
@@ -138,8 +138,8 @@ public class MediaProgramAddController extends SimpleFormController {
         }
         mediasProgramAdd.setPriority("10");
         if (media.getClass() == SatChannel.class){
-            String country = new String(((SatChannel)media).getCountry());
-            if ( country != "")
+            String country = ((SatChannel)media).getCountry().toString();
+            if (country.length() > 0)
                 mediasProgramAdd.setSap("[" + country + "] " + media.getName());
             else
                 mediasProgramAdd.setSap(media.getName());
diff --git a/vlma-webapp/src/main/java/org/videolan/vlma/web/server/ServerAddValidator.java b/vlma-webapp/src/main/java/org/videolan/vlma/web/server/ServerAddValidator.java
index 59abd88..a653c70 100644
--- a/vlma-webapp/src/main/java/org/videolan/vlma/web/server/ServerAddValidator.java
+++ b/vlma-webapp/src/main/java/org/videolan/vlma/web/server/ServerAddValidator.java
@@ -82,7 +82,7 @@ public class ServerAddValidator implements Validator {
                 servers = data.getServers();
                 if (servers != null) {
                     for (Server server : servers) {
-                        if (server.getName() == serversAdd.getName()) {
+                        if (server.getName().equals(serversAdd.getName())) {
                             arg1.rejectValue("name", "servers.add.error.existingname");
                             return;
                         }



More information about the vlma-devel mailing list