[HtmlUnit] SVN: [15415] trunk/htmlunit/src

rbri--- via HtmlUnit-develop <[email protected]>
Newsgroups gmane.comp.java.htmlunit.devel
Message-ID <[email protected]>
Revision: 15415
          http://sourceforge.net/p/htmlunit/code/15415
Author:   rbri
Date:     2018-06-29 14:18:41 +0000 (Fri, 29 Jun 2018)
Log Message:
-----------
NPE in HtmlTextArea.removeFocus()

Modified Paths:
--------------
    trunk/htmlunit/src/changes/changes.xml
    trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTextArea.java
    trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlTextAreaTest.java

Modified: trunk/htmlunit/src/changes/changes.xml
===================================================================
--- trunk/htmlunit/src/changes/changes.xml	2018-06-29 14:05:13 UTC (rev 15414)
+++ trunk/htmlunit/src/changes/changes.xml	2018-06-29 14:18:41 UTC (rev 15415)
@@ -8,6 +8,15 @@
 
     <body>
         <release version="2.32" date="xx 2018" description="Bugfixes, FIREFOX_45 removed, FIREFOX_60 added">
+            <action type="add" dev="rbri">
+                FF60 ESR support.
+            </action>
+            <action type="remove" dev="rbri">
+                FF45 support removed.
+            </action>
+            <action type="fix" dev="rbri" issue="1964">
+                NPE in HtmlTextArea.removeFocus().
+            </action>
             <action type="fix" dev="rbri" issue="1970">
                 WebClient default request header should not overwrite request-specific ones.
             </action>

Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTextArea.java
===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTextArea.java	2018-06-29 14:05:13 UTC (rev 15414)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTextArea.java	2018-06-29 14:18:41 UTC (rev 15415)
@@ -512,7 +512,7 @@
     @Override
     public void removeFocus() {
         super.removeFocus();
-        if (!valueAtFocus_.equals(getText())) {
+        if (valueAtFocus_ != null && !valueAtFocus_.equals(getText())) {
             HtmlInput.executeOnChangeHandlerIfAppropriate(this);
         }
         valueAtFocus_ = null;

Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlTextAreaTest.java
===================================================================
--- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlTextAreaTest.java	2018-06-29 14:05:13 UTC (rev 15414)
+++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlTextAreaTest.java	2018-06-29 14:18:41 UTC (rev 15415)
@@ -279,4 +279,17 @@
         t.type(KeyboardEvent.DOM_VK_DELETE);
         assertEquals("tt", t.getText());
     }
+
+    /**
+     * Make sure removeFocus does not throw.
+     *
+     * @throws Exception if the test fails
+     */
+    @Test
+    public void removeFocus() throws Exception {
+        final String html = "<html><head></head><body><textarea id='t'></textarea></body></html>";
+        final HtmlPage page = loadPage(html, null);
+        final HtmlTextArea t = page.getHtmlElementById("t");
+        t.removeFocus();
+    }
 }


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.