changeset 4689:adb31ff942ef

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 1c0624d9a2b6
children d219e0b11327
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	Thu Oct 13 13:02:37 2011 +0100
+++ b/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;
     }
 
     /**