[11u]: RFR: 8215281: Use String.isEmpty() when applicable in java.base

Langer, Christoph christoph.langer at sap.com
Mon Jun 24 09:27:05 UTC 2019


Hi,

thanks, Claes for chiming in and explaining. I also went through the code and concur - behavior should not have changed and code is cleaned up nicely.

So I think this backport has received enough reviewer attention. Will push it then as regression tests seem all good, too. ��

Thanks to all involved,
Christoph


> -----Original Message-----
> From: Claes Redestad <claes.redestad at oracle.com>
> Sent: Montag, 24. Juni 2019 10:24
> To: Thomas Stüfe <thomas.stuefe at gmail.com>; Langer, Christoph
> <christoph.langer at sap.com>
> Cc: Java Core Libs <core-libs-dev at openjdk.java.net>; jdk-updates-
> dev at openjdk.java.net; Baesken, Matthias <matthias.baesken at sap.com>
> Subject: Re: [11u]: RFR: 8215281: Use String.isEmpty() when applicable in
> java.base
> 
> Hi,
> 
> 
> On 2019-06-24 09:27, Thomas Stüfe wrote:
> > However, your patch (and the original one) contained the following part I
> > do not understand:
> >
> >
> http://cr.openjdk.java.net/~clanger/webrevs/8215281.11u/src/java.base/wi
> ndows/classes/sun/nio/ch/FileDispatcherImpl.java.udiff.html
> >
> >       static boolean isFastFileTransferRequested() {
> >           String fileTransferProp = GetPropertyAction
> > -                .privilegedGetProperty("jdk.nio.enableFastFileTransfer");
> > -        boolean enable;
> > -        if ("".equals(fileTransferProp)) {
> > -            enable = true;
> > -        } else {
> > -            enable = Boolean.parseBoolean(fileTransferProp);
> > -        }
> > -        return enable;
> > +                .privilegedGetProperty("jdk.nio.enableFastFileTransfer",
> > "false");
> > +        return fileTransferProp.isEmpty() ? true :
> > Boolean.parseBoolean(fileTransferProp);
> >       }
> >
> > The old version called GetPropertyAction::privilegedGetProperty() without
> > default value. The new versions passes "false" as default value. I fail to
> > see how this could ever return an empty string? Also, would that not
> change
> > default behavior?
> 
> Behavior before and after should be the same.
> 
> Both System.getProperty("jdk.nio.enableFastFileTransfer") and
> System.getProperty("jdk.nio.enableFastFileTransfer", "false") will
> return "" in case -Djdk.nio.enableFastFileTransfer is specified. The
> default "false" only changes so that we don't have to deal with
> fileTransferProp being null, which I thought made for a nice little
> cleanup.
> 
> /Claes


More information about the jdk-updates-dev mailing list