You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2021/02/05 17:19:30 UTC

[httpcomponents-core] branch master updated: Minor Improvements:

This is an automated email from the ASF dual-hosted git repository.

olegk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git


The following commit(s) were added to refs/heads/master by this push:
     new 7926783  Minor Improvements:
7926783 is described below

commit 7926783113802d46e347d8e93867f5887624df92
Author: Arturo Bernal <ar...@gmail.com>
AuthorDate: Fri Feb 5 08:01:51 2021 +0100

    Minor Improvements:
    
    * Simplify Case
    * Simplify Object equals
---
 .../main/java/org/apache/hc/core5/http/protocol/UriPatternType.java   | 3 +--
 httpcore5/src/main/java/org/apache/hc/core5/util/LangUtils.java       | 4 +++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/UriPatternType.java b/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/UriPatternType.java
index 1094951..e906eb4 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/UriPatternType.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/UriPatternType.java
@@ -41,10 +41,9 @@ public enum UriPatternType {
         switch (type) {
         case REGEX:
             return new UriRegexMatcher<>();
-        case URI_PATTERN:
-            return new UriPatternMatcher<>();
         case URI_PATTERN_IN_ORDER:
             return new UriPatternOrderedMatcher<>();
+        case URI_PATTERN:
         default:
             return new UriPatternMatcher<>();
         }
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/util/LangUtils.java b/httpcore5/src/main/java/org/apache/hc/core5/util/LangUtils.java
index f38d32d..6857bd2 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/util/LangUtils.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/util/LangUtils.java
@@ -27,6 +27,8 @@
 
 package org.apache.hc.core5.util;
 
+import java.util.Objects;
+
 /**
  * A set of utility methods to help produce consistent
  * {@link Object#equals equals} and {@link Object#hashCode hashCode} methods.
@@ -63,7 +65,7 @@ public final class LangUtils {
      * @return {@code true} if the objects are equal or both null
      */
     public static boolean equals(final Object obj1, final Object obj2) {
-        return obj1 == null ? obj2 == null : obj1.equals(obj2);
+        return Objects.equals(obj1, obj2);
     }
 
     /**