changeset 4506:4cb6e156c91e

7080203: JTree.getSelectionPaths() now returns empty array instead of null Reviewed-by: malenkov
author rupashka
date Thu, 10 Nov 2011 16:58:00 +0400
parents 6343dd7b360c
children cdfc6747cd3c
files src/share/classes/javax/swing/JTree.java
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/javax/swing/JTree.java	Mon Nov 07 16:43:34 2011 -0800
+++ b/src/share/classes/javax/swing/JTree.java	Thu Nov 10 16:58:00 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;
     }
 
     /**