Skip to content

File.renameTo及File.setReadOnly的问题 #90

Open
@JiaRG

Description

@JiaRG

Bug 描述

请清晰和简洁的描述你遇见的 bug,方便快速的定位和解决问题

运行环境

  • MyPerf4J 版本号,最新
  • JDK 版本号,JDK8
  • 运行容器和框架,Tomcat 8.5
  • 操作系统,Windows

final File destFile = new File(filePath);
final boolean rename = tempFile.renameTo(destFile) && destFile.setReadOnly();

renameTo 在 window 上一直都是返回 false ,所以一直只创建了 tmp 文件,没生成最终的文件

并且假如第一次生成了最终的文件的话,并且给设置成了 readonly , 那下一轮生成的时候会报错的吧

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions