Skip to content

ExtractFile Failed with NullPointExcetion #435

@LonelyTangzz

Description

@LonelyTangzz

Recently, I was doing a dependency upgrade of an old project, and planned to upgrade the original [email protected] to 2.7.0, but when I did the unit test of the decompression part after the upgrade, I couldn't get the fileAttributeView normally, resulting in a null pointer exception.

    private static void applyWindowsFileAttributes(Path file, byte[] fileAttributes) {
        if (fileAttributes[0] != 0) {
            DosFileAttributeView fileAttributeView = (DosFileAttributeView)Files.getFileAttributeView(file, DosFileAttributeView.class, LinkOption.NOFOLLOW_LINKS);//here can't get fileAttributeView

            try {
                fileAttributeView.setReadOnly(BitUtils.isBitSet(fileAttributes[0], 0));
                fileAttributeView.setHidden(BitUtils.isBitSet(fileAttributes[0], 1));
                fileAttributeView.setSystem(BitUtils.isBitSet(fileAttributes[0], 2));
                fileAttributeView.setArchive(BitUtils.isBitSet(fileAttributes[0], 5));
            } catch (IOException var4) {
            }

        }
    }

I did breakpoint debugging, this path of file is non-empty, which is strange, and the folder access permission is also granted. Does the author know what happened?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingresolved

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions