You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Slawomir Jaranowski (Jira)" <ji...@apache.org> on 2022/09/13 05:22:00 UTC

[jira] [Commented] (MSHARED-1122) FileUtils: avoid getCanonicalPath()

    [ https://issues.apache.org/jira/browse/MSHARED-1122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17603338#comment-17603338 ] 

Slawomir Jaranowski commented on MSHARED-1122:
----------------------------------------------

By the way {{FileUtils#copyFile}} is deprecated ...

> FileUtils: avoid getCanonicalPath()
> -----------------------------------
>
>                 Key: MSHARED-1122
>                 URL: https://issues.apache.org/jira/browse/MSHARED-1122
>             Project: Maven Shared Components
>          Issue Type: Improvement
>          Components: maven-shared-utils
>         Environment: Windows
>            Reporter: Jörg Kubitz
>            Priority: Minor
>         Attachments: image-2022-08-22-18-18-52-811.png
>
>
> On JDK 11 the result has been cached with in JVM.
> Since JDK 12 the result is not cached anymore by default (See [https://bugs.openjdk.java.net/browse/JDK-8207005]) and now very slow on windows.
> For org.apache.maven.shared.utils.io.FileUtils.copyFile(File, File)
> please use java.nio.file.Files.isSameFile(Path, Path) instead.
> note: it's needed to call file.exists() before using Files.isSameFile() or catch NoSuchFileException 
> @see
> [https://git.eclipse.org/r/c/platform/eclipse.platform.resources/+/180308/10/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/LocalFile.java]
> for a similar fix.
> Here is a screenshot of sampling eclipse showing getCanonicalPath() as a hotspot:
> !image-2022-08-22-18-18-52-811.png!



--
This message was sent by Atlassian Jira
(v8.20.10#820010)