< prev index next >

src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/DocumentImpl.java

Print this page
rev 52881 : 8214971: Replace use of string.equals("") with isEmpty()
Reviewed-by: jlaskey, prappo, lancea, dfuchs, redestad

@@ -540,11 +540,11 @@
     protected void addEventListener(NodeImpl node, String type,
                                     EventListener listener, boolean useCapture)
     {
         // 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.
         // Simplest way to code that is to zap the previous entry, if any.
         removeEventListener(node, type, listener, useCapture);

@@ -584,11 +584,11 @@
     protected void removeEventListener(NodeImpl node, String type,
                                        EventListener listener,
                                        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)
             return;
 

@@ -688,11 +688,11 @@
         // API for setting the event's processing-state fields.
         EventImpl evt = (EventImpl)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);
         }
 
         // If nobody is listening for this event, discard immediately
< prev index next >