8226831: Use Objects.equals() when appropriate

Reviewed-by: rriggs, bpb
This commit is contained in:
Ivan Gerasimov 2019-08-27 14:44:21 -07:00
parent 99bf89c581
commit 3ed845784d
7 changed files with 26 additions and 31 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1994, 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
* questions.
*/
/*-
/*
* FTP stream opener
*/
@ -34,6 +34,7 @@ import java.net.URL;
import java.net.Proxy;
import java.util.Map;
import java.util.HashMap;
import java.util.Objects;
import sun.net.ftp.FtpClient;
import sun.net.www.protocol.http.HttpURLConnection;
@ -47,8 +48,7 @@ public class Handler extends java.net.URLStreamHandler {
protected boolean equals(URL u1, URL u2) {
String userInfo1 = u1.getUserInfo();
String userInfo2 = u2.getUserInfo();
return super.equals(u1, u2) &&
(userInfo1 == null? userInfo2 == null: userInfo1.equals(userInfo2));
return super.equals(u1, u2) && Objects.equals(userInfo1, userInfo2);
}
protected java.net.URLConnection openConnection(URL u)

View file

@ -274,8 +274,7 @@ public class AlgorithmId implements Serializable, DerEncoder {
* with the same parameters.
*/
public boolean equals(AlgorithmId other) {
boolean paramsEqual =
(params == null ? other.params == null : params.equals(other.params));
boolean paramsEqual = Objects.equals(other.params, params);
return (algid.equals((Object)other.algid) && paramsEqual);
}