Quick question on JDK-8198997 and normalization of user.dir

Alan Bateman Alan.Bateman at oracle.com
Tue Aug 3 14:40:47 UTC 2021


On 03/08/2021 15:36, Volker Simonis wrote:
> Hi,
>
> I have a quick question on JDK-8198997 [1] (a follow-up of JDK-8194154
> [2]) which introduced normalization for the cached "user.dir" property
> in order to avoid "inefficient, repeated normalization".
>
> However, from what I can see, WinNTFileSystem.getUserPath(), the only
> place where the cached and normalized "userDir" is used, still calls
> normalize() on each invocation:
>
> class WinNTFileSystem extends FileSystem {
> ...
>      private final String userDir;
> ...
>      public WinNTFileSystem() {
> ...
>          userDir = normalize(props.getProperty("user.dir"));
>    }
> ...
>      private String getUserPath() {
> ...
>          return normalize(userDir);
>      }
>
> Is this just an oversight (in which case I'll fix it) or am I missing something?
>
It looks like a left over, it's harmless, but it should be okay to 
change to just return userDir.

-Alan


More information about the core-libs-dev mailing list