7080203: JTree.getSelectionPaths() now returns empty array instead of null
Reviewed-by: malenkov
--- 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;
}
/**