changeset 10878:978071ed312e

7080203: JTree.getSelectionPaths() now returns empty array instead of null Reviewed-by: malenkov
author rupashka
date Mon, 07 Nov 2011 16:50:41 +0400
parents f8df7f780d80
children 999ac2a9e826
files jdk/src/share/classes/javax/swing/JTree.java
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/jdk/src/share/classes/javax/swing/JTree.java	Thu Oct 13 13:02:37 2011 +0100
+++ b/jdk/src/share/classes/javax/swing/JTree.java	Mon Nov 07 16:50:41 2011 +0400
@@ -1838,7 +1838,9 @@
      *         nodes, or <code>null</code> if nothing is currently selected
      */
     public TreePath[] getSelectionPaths() {
-        return getSelectionModel().getSelectionPaths();
+        TreePath[] selectionPaths = getSelectionModel().getSelectionPaths();
+
+        return (selectionPaths != null && selectionPaths.length > 0) ? selectionPaths : null;
     }
 
     /**