Compares this URI instance with the given argument o and determines if both are equal. Two URI instances are equal if all single parts are identical in their meaning. @param o the URI this instance has to be compared with. @return true if both URI instances point to the s
(Object o)
| 1049 | * {@code false} otherwise. |
| 1050 | */ |
| 1051 | @Override |
| 1052 | public boolean equals(Object o) { |
| 1053 | if (!(o instanceof URI)) { |
| 1054 | return false; |
| 1055 | } |
| 1056 | URI uri = (URI) o; |
| 1057 | |
| 1058 | if (uri.fragment == null && fragment != null || uri.fragment != null |
| 1059 | && fragment == null) { |
| 1060 | return false; |
| 1061 | } else if (uri.fragment != null && fragment != null) { |
| 1062 | if (!equalsHexCaseInsensitive(uri.fragment, fragment)) { |
| 1063 | return false; |
| 1064 | } |
| 1065 | } |
| 1066 | |
| 1067 | if (uri.scheme == null && scheme != null || uri.scheme != null |
| 1068 | && scheme == null) { |
| 1069 | return false; |
| 1070 | } else if (uri.scheme != null && scheme != null) { |
| 1071 | if (!uri.scheme.equalsIgnoreCase(scheme)) { |
| 1072 | return false; |
| 1073 | } |
| 1074 | } |
| 1075 | |
| 1076 | if (uri.opaque && opaque) { |
| 1077 | return equalsHexCaseInsensitive(uri.schemespecificpart, |
| 1078 | schemespecificpart); |
| 1079 | } else if (!uri.opaque && !opaque) { |
| 1080 | if (!equalsHexCaseInsensitive(path, uri.path)) { |
| 1081 | return false; |
| 1082 | } |
| 1083 | |
| 1084 | if (uri.query != null && query == null || uri.query == null |
| 1085 | && query != null) { |
| 1086 | return false; |
| 1087 | } else if (uri.query != null && query != null) { |
| 1088 | if (!equalsHexCaseInsensitive(uri.query, query)) { |
| 1089 | return false; |
| 1090 | } |
| 1091 | } |
| 1092 | |
| 1093 | if (uri.authority != null && authority == null |
| 1094 | || uri.authority == null && authority != null) { |
| 1095 | return false; |
| 1096 | } else if (uri.authority != null && authority != null) { |
| 1097 | if (uri.host != null && host == null || uri.host == null |
| 1098 | && host != null) { |
| 1099 | return false; |
| 1100 | } else if (uri.host == null && host == null) { |
| 1101 | // both are registry based, so compare the whole authority |
| 1102 | return equalsHexCaseInsensitive(uri.authority, authority); |
| 1103 | } else { // uri.host != null && host != null, so server-based |
| 1104 | if (!host.equalsIgnoreCase(uri.host)) { |
| 1105 | return false; |
| 1106 | } |
| 1107 | |
| 1108 | if (port != uri.port) { |
nothing calls this directly
no test coverage detected