8223237: Replace use of string.equals("") with isEmpty() in java.desktop
Reviewed-by: prr
--- a/src/demo/share/java2d/J2DBench/src/j2dbench/tests/iio/InputImageTests.java Tue May 07 11:52:28 2019 -0700
+++ b/src/demo/share/java2d/J2DBench/src/j2dbench/tests/iio/InputImageTests.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2019, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -184,7 +184,7 @@
String klass = spi.getClass().getName();
String format = spi.getFormatNames()[0].toLowerCase();
String suffix = spi.getFileSuffixes()[0].toLowerCase();
- if (suffix == null || suffix.equals("")) {
+ if (suffix == null || suffix.isEmpty()) {
suffix = format;
}
String shortName;
--- a/src/demo/share/java2d/J2DBench/src/j2dbench/tests/iio/OutputImageTests.java Tue May 07 11:52:28 2019 -0700
+++ b/src/demo/share/java2d/J2DBench/src/j2dbench/tests/iio/OutputImageTests.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2019, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -143,7 +143,7 @@
String klass = spi.getClass().getName();
String format = spi.getFormatNames()[0].toLowerCase();
String suffix = spi.getFileSuffixes()[0].toLowerCase();
- if (suffix == null || suffix.equals("")) {
+ if (suffix == null || suffix.isEmpty()) {
suffix = format;
}
String shortName;
--- a/src/java.desktop/macosx/classes/com/apple/laf/AquaButtonUI.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/macosx/classes/com/apple/laf/AquaButtonUI.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -308,7 +308,7 @@
textRect.width = 50;
}
- if (text != null && !text.equals("")) {
+ if (text != null && !text.isEmpty()) {
final View v = (View)c.getClientProperty(BasicHTML.propertyKey);
if (v != null) {
v.paint(g, textRect);
--- a/src/java.desktop/macosx/classes/com/apple/laf/AquaComboBoxRendererInternal.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/macosx/classes/com/apple/laf/AquaComboBoxRendererInternal.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -52,7 +52,7 @@
final Dimension size;
final String text = getText();
- if ((text == null) || ("".equals(text))) {
+ if (text == null || text.isEmpty()) {
setText(" ");
size = super.getPreferredSize();
setText("");
--- a/src/java.desktop/macosx/classes/com/apple/laf/AquaFileChooserUI.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/macosx/classes/com/apple/laf/AquaFileChooserUI.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -840,7 +840,7 @@
File makeFile(final JFileChooser fc, final String filename) {
File selectedFile = null;
// whitespace is legal on Macs, even on beginning and end of filename
- if (filename != null && !filename.equals("")) {
+ if (filename != null && !filename.isEmpty()) {
final FileSystemView fs = fc.getFileSystemView();
selectedFile = fs.createFileObject(filename);
if (!selectedFile.isAbsolute()) {
@@ -853,7 +853,7 @@
// Utility to tell if the textfield has anything in it
boolean textfieldIsValid() {
final String s = getFileName();
- return (s != null && !s.equals(""));
+ return (s != null && !s.isEmpty());
}
// Action to attach to the file list so we can override the default action
@@ -1960,7 +1960,7 @@
final String buttonText = fc.getApproveButtonText();
if (buttonText != null) {
buttonText.trim();
- if (!buttonText.equals("")) return buttonText;
+ if (!buttonText.isEmpty()) return buttonText;
}
return fallbackText;
}
@@ -1979,7 +1979,7 @@
final String tooltipText = fc.getApproveButtonToolTipText();
if (tooltipText != null) {
tooltipText.trim();
- if (!tooltipText.equals("")) return tooltipText;
+ if (!tooltipText.isEmpty()) return tooltipText;
}
return fallbackText;
}
--- a/src/java.desktop/macosx/classes/com/apple/laf/AquaInternalFrameBorder.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/macosx/classes/com/apple/laf/AquaInternalFrameBorder.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -180,7 +180,7 @@
int startXPosition = fThisLeftSideTotal;
boolean wasTextShortened = false;
// shorten the string to fit in the
- if ((text != null) && !(text.equals(""))) {
+ if (text != null && !text.isEmpty()) {
totalTextWidth = SwingUtilities.computeStringWidth(fm, text);
final String clipString = "\u2026";
if (totalTextWidth > availTextWidth) {
--- a/src/java.desktop/macosx/classes/com/apple/laf/AquaInternalFrameDockIconUI.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/macosx/classes/com/apple/laf/AquaInternalFrameDockIconUI.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -141,7 +141,7 @@
public void mouseEntered(final MouseEvent e) {
if ((e.getModifiers() & InputEvent.BUTTON1_MASK) != 0) return;
String title = fFrame.getTitle();
- if (title == null || title.equals("")) title = "Untitled";
+ if (title == null || title.isEmpty()) title = "Untitled";
fDockLabel = new DockLabel(title);
fDockLabel.show(fDesktopIcon);
}
--- a/src/java.desktop/macosx/classes/com/apple/laf/AquaMenuPainter.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/macosx/classes/com/apple/laf/AquaMenuPainter.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -253,9 +253,9 @@
}
// Draw the accelerator first in case the HTML renderer changes the color
- if (keyString != null && !keyString.equals("")) {
+ if (keyString != null && !keyString.isEmpty()) {
final int yAccel = acceleratorRect.y + fm.getAscent();
- if (modifiersString.equals("")) {
+ if (modifiersString.isEmpty()) {
// just draw the keyString
SwingUtilities2.drawString(c, g, keyString, acceleratorRect.x, yAccel);
} else {
@@ -282,7 +282,7 @@
}
// Draw the Text
- if (text != null && !text.equals("")) {
+ if (text != null && !text.isEmpty()) {
final View v = (View)c.getClientProperty(BasicHTML.propertyKey);
if (v != null) {
v.paint(g, textRect);
@@ -342,7 +342,7 @@
// r = iconRect.union(textRect);
// Add in the accelerator
- boolean acceleratorTextIsEmpty = (keyString == null) || keyString.equals("");
+ boolean acceleratorTextIsEmpty = (keyString == null) || keyString.isEmpty();
if (!acceleratorTextIsEmpty) {
r.width += acceleratorRect.width;
@@ -444,7 +444,7 @@
// Force it to do "LEFT", then flip the rects if we're right-to-left
SwingUtilities.layoutCompoundLabel(menuItem, fm, text, icon, verticalAlignment, SwingConstants.LEFT, verticalTextPosition, horizontalTextPosition, viewR, iconR, textR, textIconGap);
- final boolean acceleratorTextIsEmpty = (keyString == null) || keyString.equals("");
+ final boolean acceleratorTextIsEmpty = (keyString == null) || keyString.isEmpty();
if (acceleratorTextIsEmpty) {
acceleratorR.width = acceleratorR.height = 0;
--- a/src/java.desktop/macosx/classes/sun/font/CFontManager.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/macosx/classes/sun/font/CFontManager.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -86,7 +86,7 @@
String fontName = f.fullName;
String familyName = f.familyName;
- if (fontName == null || "".equals(fontName)) {
+ if (fontName == null || fontName.isEmpty()) {
return null;
}
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/gif/GIFMetadata.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/gif/GIFMetadata.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -99,7 +99,7 @@
boolean bounded, int min, int max)
throws IIOInvalidTreeException {
String value = getStringAttribute(node, name, null, required, null);
- if (value == null || "".equals(value)) {
+ if (value == null || value.isEmpty()) {
return defaultValue;
}
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageMetadata.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageMetadata.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -1284,7 +1284,7 @@
if(keywordNode != null) {
String keyword = keywordNode.getNodeValue();
String value = getAttribute(child, "value");
- if(!keyword.equals("") && !value.equals("")) {
+ if (!keyword.isEmpty() && !value.isEmpty()) {
if(keyword.equalsIgnoreCase("DocumentName")) {
tagNumber =
BaselineTIFFTagSet.TAG_DOCUMENT_NAME;
--- a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -1269,7 +1269,7 @@
super(FilePane.ACTION_EDIT_FILE_NAME);
}
public void actionPerformed(ActionEvent e) {
- if (getFileName().equals("")) {
+ if (getFileName().isEmpty()) {
return;
}
JFileChooser fc = getFileChooser();
--- a/src/java.desktop/share/classes/java/awt/FileDialog.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/share/classes/java/awt/FileDialog.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * 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
@@ -444,7 +444,7 @@
* @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);
@@ -524,7 +524,7 @@
* @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);
@@ -605,10 +605,10 @@
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;
}
}
--- a/src/java.desktop/share/classes/java/awt/TextComponent.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/share/classes/java/awt/TextComponent.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 2014, 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
@@ -1023,7 +1023,7 @@
public String getSelectedText() {
String selText = TextComponent.this.getSelectedText();
// Fix for 4256662
- if (selText == null || selText.equals("")) {
+ if (selText == null || selText.isEmpty()) {
return null;
}
return selText;
--- a/src/java.desktop/share/classes/java/beans/EventHandler.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/share/classes/java/beans/EventHandler.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -371,7 +371,7 @@
}
private Object applyGetters(Object target, String getters) {
- if (getters == null || getters.equals("")) {
+ if (getters == null || getters.isEmpty()) {
return target;
}
int firstDot = getters.indexOf('.');
--- a/src/java.desktop/share/classes/javax/swing/JEditorPane.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/share/classes/javax/swing/JEditorPane.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -1420,7 +1420,7 @@
try {
Document doc = getDocument();
doc.remove(0, doc.getLength());
- if (t == null || t.equals("")) {
+ if (t == null || t.isEmpty()) {
return;
}
Reader r = new StringReader(t);
--- a/src/java.desktop/share/classes/javax/swing/SwingUtilities.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/share/classes/javax/swing/SwingUtilities.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -1100,7 +1100,7 @@
* and use 0,0,0,0 for textR.
*/
- boolean textIsEmpty = (text == null) || text.equals("");
+ boolean textIsEmpty = (text == null) || text.isEmpty();
int lsb = 0;
int rsb = 0;
/* Unless both text and icon are non-null, we effectively ignore
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicButtonUI.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicButtonUI.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -275,7 +275,7 @@
paintIcon(g,c,iconRect);
}
- if (text != null && !text.equals("")){
+ if (text != null && !text.isEmpty()){
View v = (View) c.getClientProperty(BasicHTML.propertyKey);
if (v != null) {
v.paint(g, textRect);
@@ -495,7 +495,7 @@
super.getBaseline(c, width, height);
AbstractButton b = (AbstractButton)c;
String text = b.getText();
- if (text == null || "".equals(text)) {
+ if (text == null || text.isEmpty()) {
return -1;
}
FontMetrics fm = b.getFontMetrics(b.getFont());
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboBoxRenderer.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboBoxRenderer.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -79,7 +79,7 @@
public Dimension getPreferredSize() {
Dimension size;
- if ((this.getText() == null) || (this.getText().equals( "" ))) {
+ if (this.getText() == null || this.getText().isEmpty()) {
setText( " " );
size = super.getPreferredSize();
setText( "" );
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicLabelUI.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicLabelUI.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -304,7 +304,7 @@
super.getBaseline(c, width, height);
JLabel label = (JLabel)c;
String text = label.getText();
- if (text == null || "".equals(text) || label.getFont() == null) {
+ if (text == null || text.isEmpty() || label.getFont() == null) {
return -1;
}
FontMetrics fm = label.getFontMetrics(label.getFont());
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -716,7 +716,7 @@
private void paintAccText(Graphics g, MenuItemLayoutHelper lh,
MenuItemLayoutHelper.LayoutResult lr) {
- if (!lh.getAccText().equals("")) {
+ if (!lh.getAccText().isEmpty()) {
ButtonModel model = lh.getMenuItem().getModel();
g.setFont(lh.getAccFontMetrics().getFont());
if (!model.isEnabled()) {
@@ -754,7 +754,7 @@
private void paintText(Graphics g, MenuItemLayoutHelper lh,
MenuItemLayoutHelper.LayoutResult lr) {
- if (!lh.getText().equals("")) {
+ if (!lh.getText().isEmpty()) {
if (lh.getHtmlView() != null) {
// Text is HTML
lh.getHtmlView().paint(g, lr.getTextRect());
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicToggleButtonUI.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicToggleButtonUI.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -119,7 +119,7 @@
}
// Draw the Text
- if(text != null && !text.equals("")) {
+ if (text != null && !text.isEmpty()) {
View v = (View) c.getClientProperty(BasicHTML.propertyKey);
if (v != null) {
v.paint(g, textRect);
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicToolTipUI.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicToolTipUI.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -187,7 +187,7 @@
insets.top+insets.bottom);
String text = ((JToolTip)c).getTipText();
- if ((text == null) || text.equals("")) {
+ if (text == null) {
text = "";
}
else {
--- a/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalButtonUI.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalButtonUI.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -202,7 +202,7 @@
boolean isIcon = b.getIcon() != null;
// If there is text
- if ( text != null && !text.equals( "" ) ) {
+ if ( text != null && !text.isEmpty()) {
if ( !isIcon ) {
focusRect.setBounds( textRect );
}
--- a/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalToggleButtonUI.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalToggleButtonUI.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -224,7 +224,7 @@
boolean isIcon = b.getIcon() != null;
// If there is text
- if ( text != null && !text.equals( "" ) ) {
+ if ( text != null && !text.isEmpty()) {
if ( !isIcon ) {
focusRect.setBounds( textRect );
}
--- a/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalToolTipUI.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalToolTipUI.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -132,7 +132,7 @@
accelBL = metrics.getAscent();
}
- if (!accelString.equals("")) {
+ if (!accelString.isEmpty()) {
g.setFont(smallFont);
g.setColor( MetalLookAndFeel.getPrimaryControlDarkShadow() );
SwingUtilities2.drawString(tip, g, accelString,
@@ -145,7 +145,7 @@
}
private int calcAccelSpacing(JComponent c, FontMetrics fm, String accel) {
- return accel.equals("")
+ return accel.isEmpty()
? 0
: padSpaceBetweenStrings +
SwingUtilities2.stringWidth(c, fm, accel);
@@ -155,7 +155,7 @@
Dimension d = super.getPreferredSize(c);
String key = getAcceleratorString((JToolTip)c);
- if (!(key.equals(""))) {
+ if (!key.isEmpty()) {
d.width += calcAccelSpacing(c, c.getFontMetrics(smallFont), key);
}
return d;
--- a/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthButtonUI.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthButtonUI.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -195,7 +195,7 @@
}
AbstractButton b = (AbstractButton)c;
String text = b.getText();
- if (text == null || "".equals(text)) {
+ if (text == null || text.isEmpty()) {
return -1;
}
Insets i = b.getInsets();
--- a/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthGraphicsUtils.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthGraphicsUtils.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -638,7 +638,7 @@
static void paintAccText(Graphics g, SynthMenuItemLayoutHelper lh,
MenuItemLayoutHelper.LayoutResult lr) {
String accText = lh.getAccText();
- if (accText != null && !accText.equals("")) {
+ if (accText != null && !accText.isEmpty()) {
g.setColor(lh.getAccStyle().getColor(lh.getAccContext(),
ColorType.TEXT_FOREGROUND));
g.setFont(lh.getAccStyle().getFont(lh.getAccContext()));
@@ -649,7 +649,7 @@
static void paintText(Graphics g, SynthMenuItemLayoutHelper lh,
MenuItemLayoutHelper.LayoutResult lr) {
- if (!lh.getText().equals("")) {
+ if (!lh.getText().isEmpty()) {
if (lh.getHtmlView() != null) {
// Text is HTML
lh.getHtmlView().paint(g, lr.getTextRect());
--- a/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthLabelUI.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthLabelUI.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -115,7 +115,7 @@
}
JLabel label = (JLabel)c;
String text = label.getText();
- if (text == null || "".equals(text)) {
+ if (text == null || text.isEmpty()) {
return -1;
}
Insets i = label.getInsets();
--- a/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthMenuItemLayoutHelper.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthMenuItemLayoutHelper.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -134,7 +134,7 @@
}
// accRect
- if (!getAccText().equals("")) {
+ if (!getAccText().isEmpty()) {
getAccSize().setWidth(accGu.computeStringWidth(getAccContext(),
getAccFontMetrics().getFont(), getAccFontMetrics(),
getAccText()));
@@ -144,7 +144,7 @@
// textRect
if (getText() == null) {
setText("");
- } else if (!getText().equals("")) {
+ } else if (!getText().isEmpty()) {
if (getHtmlView() != null) {
// Text is HTML
getTextSize().setWidth(
--- a/src/java.desktop/share/classes/javax/swing/text/html/FormView.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/share/classes/javax/swing/text/html/FormView.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -602,7 +602,7 @@
String name = (String) getElement().getAttributes().getAttribute(HTML.Attribute.NAME);
String data;
- if (name == null || name.equals("")) {
+ if (name == null || name.isEmpty()) {
data = "x="+ x +"&y="+ y;
} else {
name = URLEncoder.encode(name);
--- a/src/java.desktop/share/classes/javax/swing/text/html/FrameView.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/share/classes/javax/swing/text/html/FrameView.java Tue May 07 18:18:54 2019 -0700
@@ -69,7 +69,7 @@
AttributeSet attributes = elem.getAttributes();
String srcAtt = (String)attributes.getAttribute(HTML.Attribute.SRC);
- if ((srcAtt != null) && (!srcAtt.equals(""))) {
+ if (srcAtt != null && !srcAtt.isEmpty()) {
try {
URL base = ((HTMLDocument)elem.getDocument()).getBase();
src = new URL(base, srcAtt);
--- a/src/java.desktop/share/classes/javax/swing/text/html/HTMLEditorKit.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/share/classes/javax/swing/text/html/HTMLEditorKit.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -939,10 +939,10 @@
} else {
String target = (anchor != null) ?
(String)anchor.getAttribute(HTML.Attribute.TARGET) : null;
- if ((target == null) || (target.equals(""))) {
+ if (target == null || target.isEmpty()) {
target = hdoc.getBaseTarget();
}
- if ((target == null) || (target.equals(""))) {
+ if (target == null || target.isEmpty()) {
target = "_self";
}
linkEvent = new HTMLFrameHyperlinkEvent(
--- a/src/java.desktop/share/classes/sun/awt/DebugSettings.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/share/classes/sun/awt/DebugSettings.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -162,7 +162,7 @@
// check if the user specified a particular settings file
propPath = System.getProperty(PREFIX + "." + PROP_FILE, "");
- if (propPath.equals("")) {
+ if (propPath.isEmpty()) {
// otherwise get it from the user's home directory
propPath = System.getProperty("user.home", "") +
File.separator +
--- a/src/java.desktop/share/classes/sun/awt/im/ExecutableInputMethodManager.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/share/classes/sun/awt/im/ExecutableInputMethodManager.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -569,9 +569,9 @@
String country = locale.getCountry();
String variant = locale.getVariant();
String localePath = null;
- if (!variant.equals("")) {
+ if (!variant.isEmpty()) {
localePath = "_" + language + "/_" + country + "/_" + variant;
- } else if (!country.equals("")) {
+ } else if (!country.isEmpty()) {
localePath = "_" + language + "/_" + country;
} else {
localePath = "_" + language;
--- a/src/java.desktop/share/classes/sun/awt/im/InputContext.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/share/classes/sun/awt/im/InputContext.java Tue May 07 18:18:54 2019 -0700
@@ -773,7 +773,7 @@
getStartupLocale());
}
- if (inputMethodInfo != null && !inputMethodInfo.equals("")) {
+ if (inputMethodInfo != null && !inputMethodInfo.isEmpty()) {
return inputMethodInfo;
}
--- a/src/java.desktop/share/classes/sun/font/SunFontManager.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/share/classes/sun/font/SunFontManager.java Tue May 07 18:18:54 2019 -0700
@@ -645,7 +645,7 @@
String fontName = f.fullName;
String familyName = f.familyName;
- if (fontName == null || "".equals(fontName)) {
+ if (fontName == null || fontName.isEmpty()) {
return null;
}
if (compositeFonts.containsKey(fontName)) {
--- a/src/java.desktop/share/classes/sun/print/PSPrinterJob.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/share/classes/sun/print/PSPrinterJob.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -1594,15 +1594,15 @@
int ncomps = 2; // minimum number of print args
int n = 0;
- if (printer != null && !printer.equals("") && !printer.equals("lp")) {
+ if (printer != null && !printer.isEmpty() && !printer.equals("lp")) {
pFlags |= PRINTER;
ncomps+=1;
}
- if (options != null && !options.equals("")) {
+ if (options != null && !options.isEmpty()) {
pFlags |= OPTIONS;
ncomps+=1;
}
- if (jobTitle != null && !jobTitle.equals("")) {
+ if (jobTitle != null && !jobTitle.isEmpty()) {
pFlags |= JOBTITLE;
ncomps+=1;
}
--- a/src/java.desktop/share/classes/sun/print/PSStreamPrintJob.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/share/classes/sun/print/PSStreamPrintJob.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -451,7 +451,7 @@
} catch (SecurityException se) {
}
- if (userName == null || userName.equals("")) {
+ if (userName == null || userName.isEmpty()) {
RequestingUserName ruName =
(RequestingUserName)reqSet.get(RequestingUserName.class);
if (ruName != null) {
--- a/src/java.desktop/share/classes/sun/print/PSStreamPrintService.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/share/classes/sun/print/PSStreamPrintService.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -212,7 +212,7 @@
} else if (category == Media.class) {
String defaultCountry = Locale.getDefault().getCountry();
if (defaultCountry != null &&
- (defaultCountry.equals("") ||
+ (defaultCountry.isEmpty() ||
defaultCountry.equals(Locale.US.getCountry()) ||
defaultCountry.equals(Locale.CANADA.getCountry()))) {
return MediaSizeName.NA_LETTER;
@@ -224,7 +224,7 @@
float iw, ih;
float margin = 0.5f; // both these papers > 5" in all dimensions
if (defaultCountry != null &&
- (defaultCountry.equals("") ||
+ (defaultCountry.isEmpty() ||
defaultCountry.equals(Locale.US.getCountry()) ||
defaultCountry.equals(Locale.CANADA.getCountry()))) {
iw = MediaSize.NA.LETTER.getX(Size2DSyntax.INCH) - 2*margin;
--- a/src/java.desktop/share/classes/sun/print/PrintJob2D.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/share/classes/sun/print/PrintJob2D.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -683,7 +683,7 @@
URI uri = null;
try {
if (fileName != null) {
- if (fileName.equals("")) {
+ if (fileName.isEmpty()) {
fileName = ".";
}
} else {
@@ -1233,11 +1233,11 @@
(jobAttributes.getDestination() == DestinationType.PRINTER) ?
PRINTER : FILE);
str = jobAttributes.getPrinter();
- if (str != null && !str.equals("")) {
+ if (str != null && !str.isEmpty()) {
props.setProperty(PRINTER_PROP, str);
}
str = jobAttributes.getFileName();
- if (str != null && !str.equals("")) {
+ if (str != null && !str.isEmpty()) {
props.setProperty(FILENAME_PROP, str);
}
int copies = jobAttributes.getCopies();
@@ -1245,7 +1245,7 @@
props.setProperty(NUMCOPIES_PROP, "" + copies);
}
str = this.options;
- if (str != null && !str.equals("")) {
+ if (str != null && !str.isEmpty()) {
props.setProperty(OPTIONS_PROP, str);
}
props.setProperty(ORIENT_PROP,
--- a/src/java.desktop/share/classes/sun/print/ServiceDialog.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/share/classes/sun/print/ServiceDialog.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -1395,7 +1395,7 @@
String unitsKey = "label.millimetres";
String defaultCountry = Locale.getDefault().getCountry();
if (defaultCountry != null &&
- (defaultCountry.equals("") ||
+ (defaultCountry.isEmpty() ||
defaultCountry.equals(Locale.US.getCountry()) ||
defaultCountry.equals(Locale.CANADA.getCountry()))) {
unitsKey = "label.inches";
--- a/src/java.desktop/share/classes/sun/swing/MenuItemLayoutHelper.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/share/classes/sun/swing/MenuItemLayoutHelper.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -256,7 +256,7 @@
}
// accRect
- if (!accText.equals("")) {
+ if (!accText.isEmpty()) {
accSize.width = SwingUtilities2.stringWidth(mi, accFm, accText);
accSize.height = accFm.getHeight();
}
@@ -264,7 +264,7 @@
// textRect
if (text == null) {
text = "";
- } else if (!text.equals("")) {
+ } else if (!text.isEmpty()) {
if (htmlView != null) {
// Text is HTML
textSize.width =
--- a/src/java.desktop/share/classes/sun/swing/SwingUtilities2.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/share/classes/sun/swing/SwingUtilities2.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -382,7 +382,7 @@
*/
public static float stringWidth(JComponent c, FontMetrics fm, String string,
boolean useFPAPI){
- if (string == null || string.equals("")) {
+ if (string == null || string.isEmpty()) {
return 0;
}
boolean needsTextLayout = ((c != null) &&
@@ -415,7 +415,7 @@
public static String clipStringIfNecessary(JComponent c, FontMetrics fm,
String string,
int availTextWidth) {
- if ((string == null) || (string.equals(""))) {
+ if (string == null || string.isEmpty()) {
return "";
}
int textWidth = SwingUtilities2.stringWidth(c, fm, string);
--- a/src/java.desktop/share/classes/sun/swing/plaf/synth/SynthFileChooserUI.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/share/classes/sun/swing/plaf/synth/SynthFileChooserUI.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -321,7 +321,7 @@
resetGlobFilter();
- if (fileName == null || fileName.equals("") ||
+ if (fileName == null || fileName.isEmpty() ||
(chooser.isMultiSelectionEnabled() && fileName.startsWith("\""))) {
return;
}
--- a/src/java.desktop/unix/classes/sun/awt/X11/XDecoratedPeer.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/unix/classes/sun/awt/X11/XDecoratedPeer.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -208,7 +208,7 @@
}
protected String getWMName() {
- if (winAttr.title == null || winAttr.title.trim().equals("")) {
+ if (winAttr.title == null || winAttr.title.trim().isEmpty()) {
return " ";
} else {
return winAttr.title;
@@ -220,7 +220,7 @@
try {
super.updateWMName();
String name = getWMName();
- if (name == null || name.trim().equals("")) {
+ if (name == null || name.trim().isEmpty()) {
name = "Java";
}
XAtom iconNameAtom = XAtom.get(XAtom.XA_WM_ICON_NAME);
--- a/src/java.desktop/unix/classes/sun/awt/X11/XFileDialogPeer.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/unix/classes/sun/awt/X11/XFileDialogPeer.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -461,7 +461,7 @@
// Here we restoring Motif behaviour
setSelectionField(target.getFile());
- if (f.equals("")) {
+ if (f.isEmpty()) {
f = "*";
setFilterField(f);
} else {
--- a/src/java.desktop/unix/classes/sun/awt/X11/XPopupMenuPeer.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/unix/classes/sun/awt/X11/XPopupMenuPeer.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -233,7 +233,7 @@
*/
protected Dimension getCaptionSize() {
String s = getTargetLabel();
- if (s.equals("")) {
+ if (s.isEmpty()) {
return null;
}
Graphics g = getGraphics();
@@ -260,7 +260,7 @@
*/
protected void paintCaption(Graphics g, Rectangle rect) {
String s = getTargetLabel();
- if (s.equals("")) {
+ if (s.isEmpty()) {
return;
}
g.setFont(getTargetFont());
--- a/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -423,7 +423,7 @@
if (bottom >= 0) {
mainClassName = trace[bottom].getClassName();
}
- if (mainClassName == null || mainClassName.equals("")) {
+ if (mainClassName == null || mainClassName.isEmpty()) {
mainClassName = "AWT";
}
awtAppClassName = getCorrectXIDString(mainClassName);
--- a/src/java.desktop/unix/classes/sun/awt/X11/XWindowPeer.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/unix/classes/sun/awt/X11/XWindowPeer.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -208,7 +208,7 @@
protected String getWMName() {
String name = target.getName();
- if (name == null || name.trim().equals("")) {
+ if (name == null || name.trim().isEmpty()) {
name = " ";
}
return name;
--- a/src/java.desktop/unix/classes/sun/awt/X11InputMethodBase.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/unix/classes/sun/awt/X11InputMethodBase.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -511,7 +511,7 @@
flush += composedText.toString();
}
- if (!flush.equals("")) {
+ if (!flush.isEmpty()) {
AttributedString attrstr = new AttributedString(flush);
postInputMethodEvent(InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
attrstr.getIterator(),
--- a/src/java.desktop/unix/classes/sun/font/FontConfigManager.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/unix/classes/sun/font/FontConfigManager.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -143,7 +143,7 @@
Locale l = SunToolkit.getStartupLocale();
String localeStr = l.getLanguage();
String country = l.getCountry();
- if (!country.equals("")) {
+ if (!country.isEmpty()) {
localeStr = localeStr + "-" + country;
}
return localeStr;
--- a/src/java.desktop/unix/classes/sun/print/IPPPrintService.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/unix/classes/sun/print/IPPPrintService.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -1346,7 +1346,7 @@
flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE)) {
URI uri = ((Destination)attr).getURI();
if ("file".equals(uri.getScheme()) &&
- !(uri.getSchemeSpecificPart().equals(""))) {
+ !uri.getSchemeSpecificPart().isEmpty()) {
return true;
}
}
@@ -1503,7 +1503,7 @@
if (mediaSizeNames.length == 0) {
String defaultCountry = Locale.getDefault().getCountry();
if (defaultCountry != null &&
- (defaultCountry.equals("") ||
+ (defaultCountry.isEmpty() ||
defaultCountry.equals(Locale.US.getCountry()) ||
defaultCountry.equals(Locale.CANADA.getCountry()))) {
return MediaSizeName.NA_LETTER;
@@ -1540,7 +1540,7 @@
String defaultCountry = Locale.getDefault().getCountry();
float iw, ih;
if (defaultCountry != null &&
- (defaultCountry.equals("") ||
+ (defaultCountry.isEmpty() ||
defaultCountry.equals(Locale.US.getCountry()) ||
defaultCountry.equals(Locale.CANADA.getCountry()))) {
iw = MediaSize.NA.LETTER.getX(Size2DSyntax.INCH) - 0.5f;
--- a/src/java.desktop/unix/classes/sun/print/PrintServiceLookupProvider.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/unix/classes/sun/print/PrintServiceLookupProvider.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -457,7 +457,7 @@
*/
private PrintService getServiceByName(PrinterName nameAttr) {
String name = nameAttr.getValue();
- if (name == null || name.equals("") || !checkPrinterName(name)) {
+ if (name == null || name.isEmpty() || !checkPrinterName(name)) {
return null;
}
/* check if all printers are already available */
@@ -823,7 +823,7 @@
for (int i=0; i < names.length; i++) {
if (!names[i].equals("_default") &&
!names[i].equals(defaultPrinter) &&
- !names[i].equals("")) {
+ !names[i].isEmpty()) {
printerNames.add(names[i]);
}
}
--- a/src/java.desktop/unix/classes/sun/print/UnixPrintJob.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/unix/classes/sun/print/UnixPrintJob.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -394,7 +394,7 @@
String repClassName = flavor.getRepresentationClassName();
String val = flavor.getParameter("charset");
String encoding = "us-ascii";
- if (val != null && !val.equals("")) {
+ if (val != null && !val.isEmpty()) {
encoding = val;
}
@@ -733,7 +733,7 @@
} catch (SecurityException se) {
}
- if (userName == null || userName.equals("")) {
+ if (userName == null || userName.isEmpty()) {
RequestingUserName ruName =
(RequestingUserName)reqSet.get(RequestingUserName.class);
if (ruName != null) {
@@ -865,15 +865,15 @@
int n = 0;
// conveniently "lp" is the default destination for both lp and lpr.
- if (printer != null && !printer.equals("") && !printer.equals("lp")) {
+ if (printer != null && !printer.isEmpty() && !printer.equals("lp")) {
pFlags |= PRINTER;
ncomps+=1;
}
- if (options != null && !options.equals("")) {
+ if (options != null && !options.isEmpty()) {
pFlags |= OPTIONS;
ncomps+=1;
}
- if (jobTitle != null && !jobTitle.equals("")) {
+ if (jobTitle != null && !jobTitle.isEmpty()) {
pFlags |= JOBTITLE;
ncomps+=1;
}
--- a/src/java.desktop/unix/classes/sun/print/UnixPrintService.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/unix/classes/sun/print/UnixPrintService.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -289,7 +289,7 @@
// Remove the header lines
if (posPrinters[i].startsWith("---") ||
posPrinters[i].startsWith("Queue") ||
- posPrinters[i].equals("")) continue;
+ posPrinters[i].isEmpty()) continue;
// Check if there is a ":" in the end of the first colomn.
// This means that it is not a valid printer definition.
@@ -694,7 +694,7 @@
} else if (category == Media.class) {
String defaultCountry = Locale.getDefault().getCountry();
if (defaultCountry != null &&
- (defaultCountry.equals("") ||
+ (defaultCountry.isEmpty() ||
defaultCountry.equals(Locale.US.getCountry()) ||
defaultCountry.equals(Locale.CANADA.getCountry()))) {
return MediaSizeName.NA_LETTER;
@@ -705,7 +705,7 @@
String defaultCountry = Locale.getDefault().getCountry();
float iw, ih;
if (defaultCountry != null &&
- (defaultCountry.equals("") ||
+ (defaultCountry.isEmpty() ||
defaultCountry.equals(Locale.US.getCountry()) ||
defaultCountry.equals(Locale.CANADA.getCountry()))) {
iw = MediaSize.NA.LETTER.getX(Size2DSyntax.INCH) - 0.5f;
@@ -997,7 +997,7 @@
} else if (attr.getCategory() == Destination.class) {
URI uri = ((Destination)attr).getURI();
if ("file".equals(uri.getScheme()) &&
- !(uri.getSchemeSpecificPart().equals(""))) {
+ !uri.getSchemeSpecificPart().isEmpty()) {
return true;
} else {
return false;
--- a/src/java.desktop/windows/classes/sun/java2d/windows/WindowsFlags.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/windows/classes/sun/java2d/windows/WindowsFlags.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -134,8 +134,8 @@
propString.equals("t") ||
propString.equals("True") ||
propString.equals("T") ||
- propString.equals("")) // having the prop name alone
- { // is equivalent to true
+ propString.isEmpty()) // having the prop name alone
+ { // is equivalent to true
returnVal = true;
} else if (propString.equals("false") ||
propString.equals("f") ||
--- a/src/java.desktop/windows/classes/sun/print/PrintServiceLookupProvider.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/windows/classes/sun/print/PrintServiceLookupProvider.java Tue May 07 18:18:54 2019 -0700
@@ -207,7 +207,7 @@
public synchronized PrintService getPrintServiceByName(String name) {
- if (name == null || name.equals("")) {
+ if (name == null || name.isEmpty()) {
return null;
} else {
/* getPrintServices() is now very fast. */
--- a/src/java.desktop/windows/classes/sun/print/Win32PrintJob.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/windows/classes/sun/print/Win32PrintJob.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -622,7 +622,7 @@
} catch (SecurityException se) {
}
- if (userName == null || userName.equals("")) {
+ if (userName == null || userName.isEmpty()) {
RequestingUserName ruName =
(RequestingUserName)reqSet.get(RequestingUserName.class);
if (ruName != null) {
--- a/src/java.desktop/windows/classes/sun/print/Win32PrintService.java Tue May 07 11:52:28 2019 -0700
+++ b/src/java.desktop/windows/classes/sun/print/Win32PrintService.java Tue May 07 18:18:54 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -1536,7 +1536,7 @@
} else if (category == Destination.class) {
URI uri = ((Destination)attr).getURI();
if ("file".equals(uri.getScheme()) &&
- !(uri.getSchemeSpecificPart().equals(""))) {
+ !uri.getSchemeSpecificPart().isEmpty()) {
return true;
} else {
return false;