changeset 34805:5f4009f8be49

8144915: TextField throws NPE Reviewed-by: ssadetsky, serb
author arapte
date Wed, 09 Dec 2015 18:12:49 +0300
parents 2d123d3270c7
children 65f9c9d7b623
files jdk/src/java.desktop/share/classes/java/awt/TextField.java
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/jdk/src/java.desktop/share/classes/java/awt/TextField.java	Tue Dec 08 19:50:14 2015 +0300
+++ b/jdk/src/java.desktop/share/classes/java/awt/TextField.java	Wed Dec 09 18:12:49 2015 +0300
@@ -309,6 +309,9 @@
      * @return      Returns text after replacing EOL characters.
      */
     private static String replaceEOL(String text) {
+        if (text == null) {
+            return text;
+        }
         String[] strEOLs = {System.lineSeparator(), "\n"};
         for (String eol : strEOLs) {
             if (text.contains(eol)) {