Disallow empty album titles, too.
[Sone.git] / src / main / java / net / pterodactylus / sone / data / AlbumImpl.java
index b60e99e..bb32d75 100644 (file)
@@ -303,6 +303,9 @@ public class AlbumImpl implements Album {
 
                        @Override
                        public Album update() throws IllegalStateException {
+                               if (title.isPresent() && title.get().trim().isEmpty()) {
+                                       throw new AlbumTitleMustNotBeEmpty();
+                               }
                                if (title.isPresent()) {
                                        AlbumImpl.this.title = title.get();
                                }
@@ -317,6 +320,8 @@ public class AlbumImpl implements Album {
                };
        }
 
+       public static class AlbumTitleMustNotBeEmpty extends IllegalStateException { }
+
        //
        // FINGERPRINTABLE METHODS
        //