< prev index next >
src/java.base/share/classes/java/net/Inet6Address.java
Print this page
rev 52979 : 8215281: Use String.isEmpty() when applicable in java.base
Reviewed-by: TBD
*** 431,441 ****
*/
public static Inet6Address getByAddress(String host, byte[] addr,
NetworkInterface nif)
throws UnknownHostException
{
! if (host != null && host.length() > 0 && host.charAt(0) == '[') {
if (host.charAt(host.length()-1) == ']') {
host = host.substring(1, host.length() -1);
}
}
if (addr != null) {
--- 431,441 ----
*/
public static Inet6Address getByAddress(String host, byte[] addr,
NetworkInterface nif)
throws UnknownHostException
{
! if (host != null && !host.isEmpty() && host.charAt(0) == '[') {
if (host.charAt(host.length()-1) == ']') {
host = host.substring(1, host.length() -1);
}
}
if (addr != null) {
*** 464,474 ****
*/
public static Inet6Address getByAddress(String host, byte[] addr,
int scope_id)
throws UnknownHostException
{
! if (host != null && host.length() > 0 && host.charAt(0) == '[') {
if (host.charAt(host.length()-1) == ']') {
host = host.substring(1, host.length() -1);
}
}
if (addr != null) {
--- 464,474 ----
*/
public static Inet6Address getByAddress(String host, byte[] addr,
int scope_id)
throws UnknownHostException
{
! if (host != null && !host.isEmpty() && host.charAt(0) == '[') {
if (host.charAt(host.length()-1) == ']') {
host = host.substring(1, host.length() -1);
}
}
if (addr != null) {
*** 599,609 ****
int scope_id = gf.get("scope_id", -1);
boolean scope_id_set = gf.get("scope_id_set", false);
boolean scope_ifname_set = gf.get("scope_ifname_set", false);
String ifname = (String)gf.get("ifname", null);
! if (ifname != null && !"".equals (ifname)) {
try {
scope_ifname = NetworkInterface.getByName(ifname);
if (scope_ifname == null) {
/* the interface does not exist on this system, so we clear
* the scope information completely */
--- 599,609 ----
int scope_id = gf.get("scope_id", -1);
boolean scope_id_set = gf.get("scope_id_set", false);
boolean scope_ifname_set = gf.get("scope_ifname_set", false);
String ifname = (String)gf.get("ifname", null);
! if (ifname != null && !ifname.isEmpty()) {
try {
scope_ifname = NetworkInterface.getByName(ifname);
if (scope_ifname == null) {
/* the interface does not exist on this system, so we clear
* the scope information completely */
< prev index next >