1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-12-26 04:28:00 +01:00

Require bytes greater 0

This commit is contained in:
Paul Schaub 2019-08-31 17:10:51 +02:00
parent df41a4dc9a
commit ddbbc63aae

View file

@ -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) {