incubator-lokahi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tob...@apache.org
Subject svn commit: r416099 - /incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/httpd/api/server/Apache.java
Date Wed, 21 Jun 2006 20:19:27 GMT
Author: toback
Date: Wed Jun 21 13:19:27 2006
New Revision: 416099

URL: http://svn.apache.org/viewvc?rev=416099&view=rev
Log:
Rewrote improper hashcode and equals methods

Modified:
    incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/httpd/api/server/Apache.java

Modified: incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/httpd/api/server/Apache.java
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/httpd/api/server/Apache.java?rev=416099&r1=416098&r2=416099&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/httpd/api/server/Apache.java
(original)
+++ incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/httpd/api/server/Apache.java
Wed Jun 21 13:19:27 2006
@@ -331,21 +331,27 @@
 
   public boolean equals(Object o) {
     if (this == o) return true;
-    if (!(o instanceof Apache)) return false;
+    if (o == null || getClass() != o.getClass()) return false;
+
     final Apache apache = (Apache) o;
+
     if (forkWait != apache.forkWait) return false;
     if (mainId != apache.mainId) return false;
     if (pk != apache.pk) return false;
     if (envVaribles != null ? !envVaribles.equals(apache.envVaribles) : apache.envVaribles
!= null) return false;
-    if (!logLocation.equals(apache.logLocation)) return false;
+    if (logLocation != null ? !logLocation.equals(apache.logLocation) : apache.logLocation
!= null) return false;
+    if (main != null ? !main.equals(apache.main) : apache.main != null) return false;
     if (!name.equals(apache.name)) return false;
-    if (!pidFileLocation.equals(apache.pidFileLocation)) return false;
-    if (!restartCommand.equals(apache.restartCommand)) return false;
-    if (!serverRoot.equals(apache.serverRoot)) return false;
-    if (!startCommand.equals(apache.startCommand)) return false;
-    if (!stopCommand.equals(apache.stopCommand)) return false;
-    if (!sysGroup.equals(apache.sysGroup)) return false;
-    if (!sysUser.equals(apache.sysUser)) return false;
+    if (pidFileLocation != null ? !pidFileLocation.equals(apache.pidFileLocation) : apache.pidFileLocation
!= null)
+      return false;
+    if (restartCommand != null ? !restartCommand.equals(apache.restartCommand) : apache.restartCommand
!= null)
+      return false;
+    if (serverRoot != null ? !serverRoot.equals(apache.serverRoot) : apache.serverRoot !=
null) return false;
+    if (startCommand != null ? !startCommand.equals(apache.startCommand) : apache.startCommand
!= null) return false;
+    if (stopCommand != null ? !stopCommand.equals(apache.stopCommand) : apache.stopCommand
!= null) return false;
+    if (sysGroup != null ? !sysGroup.equals(apache.sysGroup) : apache.sysGroup != null) return
false;
+    if (sysUser != null ? !sysUser.equals(apache.sysUser) : apache.sysUser != null) return
false;
+
     return true;
   }
 
@@ -353,17 +359,18 @@
     int result;
     result = pk;
     result = 29 * result + name.hashCode();
-    result = 29 * result + serverRoot.hashCode();
-    result = 29 * result + logLocation.hashCode();
-    result = 29 * result + sysUser.hashCode();
-    result = 29 * result + sysGroup.hashCode();
-    result = 29 * result + startCommand.hashCode();
-    result = 29 * result + stopCommand.hashCode();
-    result = 29 * result + restartCommand.hashCode();
+    result = 29 * result + (serverRoot != null ? serverRoot.hashCode() : 0);
+    result = 29 * result + (logLocation != null ? logLocation.hashCode() : 0);
+    result = 29 * result + (sysUser != null ? sysUser.hashCode() : 0);
+    result = 29 * result + (sysGroup != null ? sysGroup.hashCode() : 0);
+    result = 29 * result + (startCommand != null ? startCommand.hashCode() : 0);
+    result = 29 * result + (stopCommand != null ? stopCommand.hashCode() : 0);
+    result = 29 * result + (restartCommand != null ? restartCommand.hashCode() : 0);
     result = 29 * result + forkWait;
     result = 29 * result + (envVaribles != null ? envVaribles.hashCode() : 0);
-    result = 29 * result + (envVaribles != null ? pidFileLocation.hashCode() : 0);
+    result = 29 * result + (pidFileLocation != null ? pidFileLocation.hashCode() : 0);
     result = 29 * result + mainId;
+    result = 29 * result + (main != null ? main.hashCode() : 0);
     return result;
   }
 



Mime
View raw message