RFR 7901960: JFileChooserOperator.selectFile(..) throws NullPointerException on Mac

Alexandre (Shura) Iline alexandre.iline at oracle.com
Thu Dec 7 17:07:49 UTC 2017



> On Dec 7, 2017, at 8:51 AM, Muneer Kolarkunnu <abdul.kolarkunnu at oracle.com> wrote:
> 
> Hi,
> 
> There are lots of places code like:
> if(list instanceof JList) {
>  .....
> } else {
>  .....
> }
> 
> Do we need to add "else if(list instanceof JTable)" in case of else case?

This is a solid suggestion. This is technically impossible to have something else but JList or JTable (see getFileList() method), but the code would be clearer. I will update. Anyway, it is a temp solution until FoleChooserDriver is implemented.


> 
> Better to use output.printTrace() instead of below:
> 456         System.out.println(list);

That’s a debug output! Sorry!
Will fix.

> 
> Alignment is not proper:
> 1528                     if(list instanceof JList)
> 1529                     if (((JList) list).getCellBounds(current, current) != null) {
> 1530                         return ((JList) list).getCellBounds(size - 1, size - 1);
> 1531                     } else {
> 1532                         return null;
> 1533                     }
> 1534                     else
> 1535                     if (((JTable)list).getCellRect(current, 0, false) != null) {
> 1536                         return ((JTable)list).getCellRect(size - 1, 0, false);

Accepted, thank you.

Shura

> 
> Regards,
> Muneer
> 
> -----Original Message-----
> From: Alexandre (Shura) Iline 
> Sent: Thursday, December 07, 2017 5:10 AM
> To: jemmy-dev at openjdk.java.net
> Cc: Muneer Kolarkunnu <abdul.kolarkunnu at oracle.com>; Srinivas Mandalika <srinivas.mandalika at oracle.com>; Sergey Bylokhov <sergey.bylokhov at oracle.com>
> Subject: RFR 7901960: JFileChooserOperator.selectFile(..) throws NullPointerException on Mac
> 
> Hi.
> 
> Please take a look on this fix:
> Bug: https://bugs.openjdk.java.net/browse/CODETOOLS-7901960
> Webrev: http://cr.openjdk.java.net/~shurailine/7901960/webrev.00/
> 
> While working on the fix I have discovered that, depending on as OS or L&F, the list inside file chooser may or may not select files when clicking outside of displayed filename. I have created these:
> https://bugs.openjdk.java.net/browse/CODETOOLS-7902080
> https://bugs.openjdk.java.net/browse/CODETOOLS-7902079
> 
> Shura
> 



More information about the jemmy-dev mailing list