< prev index next >
src/java.desktop/share/classes/java/awt/FileDialog.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 1995, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -442,11 +442,11 @@
*
* @param dir the specified directory
* @see java.awt.FileDialog#getDirectory
*/
public void setDirectory(String dir) {
- this.dir = (dir != null && dir.equals("")) ? null : dir;
+ this.dir = (dir != null && dir.isEmpty()) ? null : dir;
FileDialogPeer peer = (FileDialogPeer)this.peer;
if (peer != null) {
peer.setDirectory(this.dir);
}
}
@@ -522,11 +522,11 @@
* @param file the file being set
* @see #getFile
* @see #getFiles
*/
public void setFile(String file) {
- this.file = (file != null && file.equals("")) ? null : file;
+ this.file = (file != null && file.isEmpty()) ? null : file;
FileDialogPeer peer = (FileDialogPeer)this.peer;
if (peer != null) {
peer.setFile(this.file);
}
}
@@ -603,14 +603,14 @@
throws ClassNotFoundException, IOException
{
s.defaultReadObject();
// 1.1 Compatibility: "" is not converted to null in 1.1
- if (dir != null && dir.equals("")) {
+ if (dir != null && dir.isEmpty()) {
dir = null;
}
- if (file != null && file.equals("")) {
+ if (file != null && file.isEmpty()) {
file = null;
}
}
/**
< prev index next >