Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ private static boolean createFile(String propertiesPath, String outputPath,
}

String packageString = "";
if (packageName != null && !packageName.equals("")) {
if (packageName != null && !packageName.isEmpty()) {
packageString = "package " + packageName + ";\n\n";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public static void main(String[] args) {
* Generates data in older format (1.4.X and earlier) and creates
* the old CategoryMap if "oldFilename" is not null.
*/
if (!oldDatafile.equals("")) {
if (!oldDatafile.isEmpty()) {
generateOldData();
generateOldDatafile();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ private static void processArgs(String[] args) {
* Make locale name ("_language_country_valiant")
*/
private static String getLocaleName() {
if (language.equals("")) {
if (!country.equals("") || !valiant.equals("")) {
if (language.isEmpty()) {
if (!country.isEmpty() || !valiant.isEmpty()) {
language = "en";
} else {
return "";
Expand All @@ -172,10 +172,10 @@ private static String getLocaleName() {
StringBuffer sb = new StringBuffer();
sb.append('_');
sb.append(language);
if (!country.equals("") || !valiant.equals("")) {
if (!country.isEmpty() || !valiant.isEmpty()) {
sb.append('_');
sb.append(country);
if (!valiant.equals("")) {
if (!valiant.isEmpty()) {
sb.append('_');
sb.append(valiant);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2022,7 +2022,7 @@ protected void writeTables(String datafile) {
final String outputDir;
String tmpbuf = GenerateBreakIteratorData.getOutputDirectory();

if (tmpbuf.equals("")) {
if (tmpbuf.isEmpty()) {
filename = datafile;
outputDir = "";
} else {
Expand All @@ -2039,7 +2039,7 @@ protected void writeTables(String datafile) {
}

try {
if (!outputDir.equals("")) {
if (!outputDir.isEmpty()) {
new File(outputDir).mkdirs();
}
BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(filename));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ public JSONValue parseValue() {
}

public JSONValue parse(String s) {
if (s == null || s.equals("")) {
if (s == null || s.isEmpty()) {
return null;
}

Expand Down
8 changes: 4 additions & 4 deletions make/langtools/tools/anttasks/SelectToolTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public void execute() {
}

// finally, return required values, if any
if (toolProperty != null && !(toolName == null || toolName.equals(""))) {
if (toolProperty != null && !(toolName == null || toolName.isEmpty())) {
p.setProperty(toolProperty, toolName);

if (argsProperty != null && toolArgs != null)
Expand All @@ -169,7 +169,7 @@ void showGUI(Properties fileProps) {
toolName = tool.toolName;
toolArgs = argsField.getText();
if (defaultCheck.isSelected()) {
if (toolName.equals("")) {
if (toolName.isEmpty()) {
fileProps.remove("tool.name");
fileProps.remove("tool.bootstrap");
} else {
Expand Down Expand Up @@ -243,7 +243,7 @@ public void focusLost(FocusEvent e) {

final JOptionPane p = new JOptionPane(body);
okButton = new JButton("OK");
okButton.setEnabled(toolProperty == null || (toolName != null && !toolName.equals("")));
okButton.setEnabled(toolProperty == null || (toolName != null && !toolName.isEmpty()));
okButton.addActionListener(e -> {
JDialog d = (JDialog) SwingUtilities.getAncestorOfClass(JDialog.class, p);
d.setVisible(false);
Expand Down Expand Up @@ -304,7 +304,7 @@ String getDefaultArgsForTool(Properties props, ToolChoices tool) {
if (tool == null)
return "";
String toolName = tool.toolName;
return toolName.equals("") ? "" : props.getProperty(toolName + ".args", "");
return toolName.isEmpty() ? "" : props.getProperty(toolName + ".args", "");
}

// Ant task parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ private boolean createFile(String propertiesPath, String outputPath,
}

String packageString = "";
if (packageName != null && !packageName.equals("")) {
if (packageName != null && !packageName.isEmpty()) {
packageString = "package " + packageName + ";\n\n";
}

Expand Down
2 changes: 1 addition & 1 deletion src/demo/share/jfc/TableExample/JDBCAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ public void setValueAt(Object value, int row, int column) {
// that editing is possible, we'll just lock on everything.
for (int col = 0; col < getColumnCount(); col++) {
String colName = getColumnName(col);
if (colName.equals("")) {
if (colName.isEmpty()) {
continue;
}
if (col != 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/prims/jvmtiEnvFill.java
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ boolean readGaps() throws IOException {
top.add(line);
} else {
trimmed = line.trim();
if (!trimmed.equals("") && !trimmed.startsWith("//") && !trimmed.startsWith("#")) {
if (!trimmed.isEmpty() && !trimmed.startsWith("//") && !trimmed.startsWith("#")) {
error("only comments and blank lines allowed between functions");
}
before.add(line);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ private static SortedMap<String, Object> makeMap(
SortedMap<String, Object> map = new TreeMap<String, Object>();
for (int i = 0; i < itemNames.length; i++) {
String name = itemNames[i];
if (name == null || name.equals(""))
if (name == null || name.isEmpty())
throw new IllegalArgumentException("Null or empty item name");
if (map.containsKey(name))
throw new OpenDataException("Duplicate item name " + name);
Expand Down Expand Up @@ -264,7 +264,7 @@ public CompositeType getCompositeType() {
*/
public Object get(String key) {

if ( (key == null) || (key.trim().equals("")) ) {
if ( (key == null) || (key.trim().isEmpty()) ) {
throw new IllegalArgumentException("Argument key cannot be a null or empty String.");
}
if ( ! contents.containsKey(key.trim())) {
Expand Down Expand Up @@ -302,7 +302,7 @@ public Object[] getAll(String[] keys) {
*/
public boolean containsKey(String key) {

if ( (key == null) || (key.trim().equals("")) ) {
if ( (key == null) || (key.trim().isEmpty()) ) {
return false;
}
return contents.containsKey(key);
Expand Down
2 changes: 1 addition & 1 deletion src/java.naming/share/classes/javax/naming/ldap/Rdn.java
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public Rdn(String type, Object value) throws InvalidNameException {
if (value == null) {
throw new NullPointerException("Cannot set value to null");
}
if (type.equals("") || isEmptyValue(value)) {
if (type.isEmpty() || isEmptyValue(value)) {
throw new InvalidNameException(
"type or value cannot be empty, type:" + type +
" value:" + value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ private static int getMask(String action) {
throw new NullPointerException("action can't be null");
}

if (action.equals("")) {
if (action.isEmpty()) {
throw new IllegalArgumentException("action can't be empty");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public HashMap<String, String> run() {
String[] gssLibs;
String defaultLib
= System.getProperty("sun.security.jgss.lib");
if (defaultLib == null || defaultLib.trim().equals("")) {
if (defaultLib == null || defaultLib.trim().isEmpty()) {
String osname = System.getProperty("os.name");
if (osname.startsWith("Linux")) {
gssLibs = new String[]{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1361,7 +1361,7 @@ private String getKDCFromDNS(String realm) throws KrbException {
kdcs += srvs[i].trim() + " ";
}
kdcs = kdcs.trim();
if (kdcs.equals("")) {
if (kdcs.isEmpty()) {
return null;
}
return kdcs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ protected void handleParent(Element e, NameSpaceSymbTable ns) {
String NName = e.getPrefix();
String NValue = e.getNamespaceURI();
String Name;
if (NName == null || NName.equals("")) {
if (NName == null || NName.isEmpty()) {
NName = "xmlns";
Name = "xmlns";
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ protected void handleParent(Element e, NameSpaceSymbTable ns) {
String NName = e.getPrefix();
String NValue = e.getNamespaceURI();
String Name;
if (NName == null || NName.equals("")) {
if (NName == null || NName.isEmpty()) {
NName = XMLNS;
Name = XMLNS;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public static String normalize(String dn) {
*/
public static String normalize(String dn, boolean toXml) {
//if empty string
if (dn == null || dn.equals("")) {
if (dn == null || dn.isEmpty()) {
return "";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public boolean engineCanResolveURI(ResourceResolverContext context) {
return false;
}

if (context.uriToResolve.equals("") || context.uriToResolve.charAt(0) == '#') {
if (context.uriToResolve.isEmpty() || context.uriToResolve.charAt(0) == '#') {
LOG.debug("quick fail for empty URIs and local ones");
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public XMLSignatureInput engineResolveURI(ResourceResolverContext context)
Document doc = context.attr.getOwnerElement().getOwnerDocument();

Node selectedElem = null;
if (context.uriToResolve.equals("")) {
if (context.uriToResolve.isEmpty()) {
/*
* Identifies the node-set (minus any comment nodes) of the XML
* resource containing the signature
Expand Down Expand Up @@ -121,7 +121,7 @@ public boolean engineCanResolveURI(ResourceResolverContext context) {
return false;
}

if (context.uriToResolve.equals("") ||
if (context.uriToResolve.isEmpty() ||
context.uriToResolve.charAt(0) == '#' && !context.uriToResolve.startsWith("#xpointer(")
) {
LOG.debug("State I can resolve reference: \"{}\"", context.uriToResolve);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public boolean engineCanResolveURI(ResourceResolverContext context) {
return false;
}

if (context.uriToResolve.equals("") || context.uriToResolve.charAt(0) == '#' ||
if (context.uriToResolve.isEmpty() || context.uriToResolve.charAt(0) == '#' ||
context.uriToResolve.startsWith("http:")) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public DOMReference(String uri, String type, DigestMethod dm,
}
this.digestMethod = dm;
this.uri = uri;
if (uri != null && !uri.equals("")) {
if (uri != null && !uri.isEmpty()) {
try {
new URI(uri);
} catch (URISyntaxException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public DOMRetrievalMethod(String uri, String type,
}
}
this.uri = uri;
if (!uri.equals("")) {
if (!uri.isEmpty()) {
try {
new URI(uri);
} catch (URISyntaxException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,14 +446,14 @@ public static void printWarning(String parserClassName, String propertyName, SAX
private boolean getSystemProperty(Limit limit, String sysPropertyName) {
try {
String value = SecuritySupport.getSystemProperty(sysPropertyName);
if (value != null && !value.equals("")) {
if (value != null && !value.isEmpty()) {
values[limit.ordinal()] = Integer.parseInt(value);
states[limit.ordinal()] = State.SYSTEMPROPERTY;
return true;
}

value = SecuritySupport.readJAXPProperty(sysPropertyName);
if (value != null && !value.equals("")) {
if (value != null && !value.isEmpty()) {
values[limit.ordinal()] = Integer.parseInt(value);
states[limit.ordinal()] = State.JAXPDOTPROPERTIES;
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ public boolean compile(InputSource input, String name) {
if (name != null) {
setClassName(name);
}
else if (systemId != null && !systemId.equals("")) {
else if (systemId != null && !systemId.isEmpty()) {
setClassName(Util.baseName(systemId));
}

Expand Down Expand Up @@ -770,7 +770,7 @@ public int registerAttribute(QName name) {
_attributes.put(name.toString(), code);
final String uri = name.getNamespace();
final String local = "@"+name.getLocalPart();
if ((uri != null) && (!uri.equals("")))
if ((uri != null) && (!uri.isEmpty()))
_namesIndex.add(uri+":"+local);
else
_namesIndex.add(local);
Expand Down Expand Up @@ -810,7 +810,7 @@ public int registerNamespacePrefix(QName name) {
code = _nextGType++;
_namespacePrefixes.put(name.toString(), code);
final String uri = name.getNamespace();
if ((uri != null) && (!uri.equals(""))){
if ((uri != null) && (!uri.isEmpty())){
// namespace::ext2:ped2 will be made empty in TypedNamespaceIterator
_namesIndex.add("?");
} else{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public DOM retrieveDocument(String baseURI, String href, Translet trs) {
CachedDocument doc;

String uri = href;
if (baseURI != null && !baseURI.equals("")) {
if (baseURI != null && !baseURI.isEmpty()) {
try {
uri = SystemIDResolver.getAbsoluteURI(uri, baseURI);
} catch (TransformerException te) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,13 @@ private static DTMAxisIterator document(String uri, String base,
MultiDOM multiplexer = (MultiDOM)dom;

// Prepend URI base to URI (from context)
if (base != null && !base.equals("")) {
if (base != null && !base.isEmpty()) {
uri = SystemIDResolver.getAbsoluteURI(uri, base);
}

// Return an empty iterator if the URI is clearly invalid
// (to prevent some unncessary MalformedURL exceptions).
if (uri == null || uri.equals("")) {
if (uri == null || uri.isEmpty()) {
return(EmptyIterator.getInstance());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public void startElement(String namespace, String localName, String qName,
String attURI = attrs.getURI(i);
String type = (attrs.getType(i) == null) ?
XMLSymbols.fCDATASymbol : attrs.getType(i);
if (attrs.getLocalName(i).equals("")) {
if (attrs.getLocalName(i).isEmpty()) {
tmp.setAttribute(attQName, attrs.getValue(i));
if (type.equals("ID")) {
tmp.setIdAttribute(attQName, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ protected void addEventListener(NodeImpl node, String type,
{
// We can't dispatch to blank type-name, and of course we need
// a listener to dispatch to
if (type == null || type.equals("") || listener == null)
if (type == null || type.isEmpty() || listener == null)
return;

// Each listener may be registered only once per type per phase.
Expand Down Expand Up @@ -586,7 +586,7 @@ protected void removeEventListener(NodeImpl node, String type,
boolean useCapture)
{
// If this couldn't be a valid listener registration, ignore request
if (type == null || type.equals("") || listener == null)
if (type == null || type.isEmpty() || listener == null)
return;
List<LEntry> nodeListeners = getEventListeners(node);
if (nodeListeners == null)
Expand Down Expand Up @@ -690,7 +690,7 @@ protected boolean dispatchEvent(NodeImpl node, Event event) {

// VALIDATE -- must have been initialized at least once, must have
// a non-null non-blank name.
if(!evt.initialized || evt.type == null || evt.type.equals("")) {
if(!evt.initialized || evt.type == null || evt.type.isEmpty()) {
String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "UNSPECIFIED_EVENT_TYPE_ERR", null);
throw new EventException(EventException.UNSPECIFIED_EVENT_TYPE_ERR, msg);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,7 @@ public String getNamespacePrefix(int index) {
|| fEventType == XMLEvent.NAMESPACE) {
//namespaceContext is dynamic object.
String prefix = fScanner.getNamespaceContext().getDeclaredPrefixAt(index);
return prefix.equals("") ? null : prefix;
return prefix.isEmpty() ? null : prefix;
} else {
throw new IllegalStateException("Current state " + getEventTypeString(fEventType)
+ " is not among the states " + getEventTypeString(XMLEvent.START_ELEMENT)
Expand Down
Loading