Skip to content

Conversation

plamentotev
Copy link
Member

Currently archivers that accept single file (like BZip2Archiver) will throw NoSuchElementException.
Modify them to throw EmptyArchiveException so they are consistent with DirectoryArchiver, TarArchiver and ZipArchiver.

@michael-o
Copy link
Member

Looks good to me, but the exception message does not correspond to the existing ones.

@plamentotev
Copy link
Member Author

plamentotev commented Jun 24, 2017

Looks good to me, but the exception message does not correspond to the existing ones.

Do you mean "You must set at least one file."? I initially copy-pasted the message from the other archivers, but then I thought that it's a bit confusing. "... at least one file" suggests that you can set two or more files and that is not the case. That's why I've changed it to something that says that you should set a single file. Unfortunately my English is long way from perfect, so if you have suggestion I'll gladly change the exception message.

@michael-o
Copy link
Member

michael-o commented Jun 24, 2017

Well, then this is pretty much the same as String.isEmpty() => throw new IllegalArgumentException("archive cannot be empty"). Done.

Currently archivers that accept single file (like BZip2Archiver)
will throw `NoSuchElementException`.
Modify them to throw `EmptyArchiveException` so they are
consistent with `DirectoryArchiver`, `TarArchiver` and `ZipArchiver`.
@plamentotev
Copy link
Member Author

@michael-o sounds good, thanks for the suggestion. I've just updated the exception message.

@michael-o michael-o self-assigned this Jun 28, 2017
@michael-o michael-o added this to the 3.5 milestone Jun 28, 2017
@michael-o michael-o closed this in 74d7509 Jun 28, 2017
@plamentotev plamentotev deleted the empty-archive-exception-for-single-file-archivers branch February 16, 2018 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants