7080203: JTree.getSelectionPaths() now returns empty array instead of null

Reviewed-by: malenkov
This commit is contained in:
Pavel Porvatov 2011-11-07 16:50:41 +04:00
parent 16b47aa177
commit a346c5d21d

View File

@ -1838,7 +1838,9 @@ public class JTree extends JComponent implements Scrollable, Accessible
* 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;
}
/**