mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-23 23:02:05 +01:00
Require bytes greater 0
This commit is contained in:
parent
7e4791c4f6
commit
c3bec911ba
1 changed files with 3 additions and 0 deletions
|
@ -55,6 +55,9 @@ public class MetadataInfo {
|
||||||
public MetadataInfo(String id, URL url, long bytes, String type, int pixelsHeight, int pixelsWidth) {
|
public MetadataInfo(String id, URL url, long bytes, String type, int pixelsHeight, int pixelsWidth) {
|
||||||
this.id = StringUtils.requireNotNullNorEmpty(id, "ID is required.");
|
this.id = StringUtils.requireNotNullNorEmpty(id, "ID is required.");
|
||||||
this.url = url;
|
this.url = url;
|
||||||
|
if (bytes <= 0) {
|
||||||
|
throw new IllegalArgumentException("Number of bytes MUST be greater than 0.");
|
||||||
|
}
|
||||||
this.bytes = UInt32.from(bytes);
|
this.bytes = UInt32.from(bytes);
|
||||||
this.type = StringUtils.requireNotNullNorEmpty(type, "Content Type is required.");
|
this.type = StringUtils.requireNotNullNorEmpty(type, "Content Type is required.");
|
||||||
if (pixelsHeight < 0 || pixelsHeight > MAX_HEIGHT) {
|
if (pixelsHeight < 0 || pixelsHeight > MAX_HEIGHT) {
|
||||||
|
|
Loading…
Reference in a new issue