Repository: wicket
Updated Branches:
  refs/heads/master 334808b80 -> bfc7cfe39


methods equals(Object obj) refactored introducing Java 7 Objects.equals

Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/bfc7cfe3
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/bfc7cfe3
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/bfc7cfe3

Branch: refs/heads/master
Commit: bfc7cfe39e96ad40de7d656e00464552a51ed0c1
Parents: 334808b
Author: Andrea Del Bene <[email protected]>
Authored: Wed Jan 7 22:37:08 2015 +0100
Committer: Andrea Del Bene <[email protected]>
Committed: Sat Jan 10 14:51:37 2015 +0100

----------------------------------------------------------------------
 .../wicket/protocol/http/mock/Cookies.java      | 27 ++------
 .../request/resource/PackageResource.java       | 72 ++++----------------
 2 files changed, 20 insertions(+), 79 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/bfc7cfe3/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/Cookies.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/Cookies.java 
b/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/Cookies.java
index 54ecb97..f3182a4 100644
--- 
a/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/Cookies.java
+++ 
b/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/Cookies.java
@@ -17,6 +17,7 @@
 package org.apache.wicket.protocol.http.mock;
 
 import java.io.Serializable;
+import java.util.Objects;
 
 import javax.servlet.http.Cookie;
 
@@ -123,28 +124,10 @@ public final class Cookies
                        if (getClass() != obj.getClass())
                                return false;
                        Key other = (Key)obj;
-                       if (domain == null)
-                       {
-                               if (other.domain != null)
-                                       return false;
-                       }
-                       else if (!domain.equals(other.domain))
-                               return false;
-                       if (name == null)
-                       {
-                               if (other.name != null)
-                                       return false;
-                       }
-                       else if (!name.equals(other.name))
-                               return false;
-                       if (path == null)
-                       {
-                               if (other.path != null)
-                                       return false;
-                       }
-                       else if (!path.equals(other.path))
-                               return false;
-                       return true;
+                       
+                       return Objects.equals(domain, other.domain)
+                               && Objects.equals(name, other.name)
+                               && Objects.equals(path, other.path);            
        
                }
 
                @Override

http://git-wip-us.apache.org/repos/asf/wicket/blob/bfc7cfe3/wicket-core/src/main/java/org/apache/wicket/request/resource/PackageResource.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/request/resource/PackageResource.java
 
b/wicket-core/src/main/java/org/apache/wicket/request/resource/PackageResource.java
index 503e8cf..7f5251e 100644
--- 
a/wicket-core/src/main/java/org/apache/wicket/request/resource/PackageResource.java
+++ 
b/wicket-core/src/main/java/org/apache/wicket/request/resource/PackageResource.java
@@ -21,6 +21,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.Serializable;
 import java.util.Locale;
+import java.util.Objects;
 
 import javax.servlet.http.HttpServletResponse;
 
@@ -611,50 +612,15 @@ public class PackageResource extends AbstractResource 
implements IStaticCacheabl
                        return false;
                if (getClass() != obj.getClass())
                        return false;
+               
                PackageResource other = (PackageResource)obj;
-               if (absolutePath == null)
-               {
-                       if (other.absolutePath != null)
-                               return false;
-               }
-               else if (!absolutePath.equals(other.absolutePath))
-                       return false;
-               if (locale == null)
-               {
-                       if (other.locale != null)
-                               return false;
-               }
-               else if (!locale.equals(other.locale))
-                       return false;
-               if (path == null)
-               {
-                       if (other.path != null)
-                               return false;
-               }
-               else if (!path.equals(other.path))
-                       return false;
-               if (scopeName == null)
-               {
-                       if (other.scopeName != null)
-                               return false;
-               }
-               else if (!scopeName.equals(other.scopeName))
-                       return false;
-               if (style == null)
-               {
-                       if (other.style != null)
-                               return false;
-               }
-               else if (!style.equals(other.style))
-                       return false;
-               if (variation == null)
-               {
-                       if (other.variation != null)
-                               return false;
-               }
-               else if (!variation.equals(other.variation))
-                       return false;
-               return true;
+               
+               return Objects.equals(absolutePath, other.absolutePath)
+                       && Objects.equals(locale, other.locale)
+                       && Objects.equals(path, other.path)
+                       && Objects.equals(scopeName, other.scopeName)
+                       && Objects.equals(style, other.style)
+                       && Objects.equals(variation, other.variation);
        }
 
        String getParentFolderPlaceholder()
@@ -699,20 +665,12 @@ public class PackageResource extends AbstractResource 
implements IStaticCacheabl
                                return false;
 
                        CacheKey cacheKey = (CacheKey)o;
-
-                       if (locale != null ? !locale.equals(cacheKey.locale) : 
cacheKey.locale != null)
-                               return false;
-                       if (!path.equals(cacheKey.path))
-                               return false;
-                       if (!scopeName.equals(cacheKey.scopeName))
-                               return false;
-                       if (style != null ? !style.equals(cacheKey.style) : 
cacheKey.style != null)
-                               return false;
-                       if (variation != null ? 
!variation.equals(cacheKey.variation)
-                               : cacheKey.variation != null)
-                               return false;
-
-                       return true;
+                       
+                       return Objects.equals(locale, cacheKey.locale)
+                               && Objects.equals(path, cacheKey.path)
+                               && Objects.equals(scopeName, cacheKey.scopeName)
+                               && Objects.equals(style, cacheKey.style)
+                               && Objects.equals(variation, 
cacheKey.variation);
                }
 
                @Override

Reply via email to