Skip to content

[BUG] "IllegalArgumentException: Pipe Size <= 0" with an empty file in the archive #88

@AlexisJehan

Description

@AlexisJehan

Describe the bug
Reading an archive with an empty file is throwing an IllegalArgumentException.

To Reproduce

try (final var archive = new Archive(Path.of("file.rar").toFile())) {
	while (true) {
		final var fileHeader = archive.nextFileHeader();
		if (null == fileHeader) {
			break;
		}
		final var outputStream = new ByteArrayOutputStream();
		//archive.extractFile(fileHeader, outputStream); // OK
		archive.getInputStream(fileHeader).transferTo(outputStream); // IllegalArgumentException: Pipe Size <= 0
		System.out.println(outputStream);
	}
}

Expected behavior
Should return an empty InputStream instead of throwing an IllegalArgumentException.

File
file.rar.zip
(need to extract the ZIP file to get the RAR inside)

Environment (please complete the following information):

  • OS: Windows
  • Junrar version: 7.5.1 (latest)

Additional context
None

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions