7080203: JTree.getSelectionPaths() now returns empty array instead of null
authorrupashka
Mon, 07 Nov 2011 16:50:41 +0400
changeset 10878 978071ed312e
parent 10877 f8df7f780d80
child 10879 999ac2a9e826
7080203: JTree.getSelectionPaths() now returns empty array instead of null Reviewed-by: malenkov
jdk/src/share/classes/javax/swing/JTree.java
--- 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;
     }
 
     /**