We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a221245 commit c572fe8Copy full SHA for c572fe8
1 file changed
cqrs/src/main/java/com/iluwatar/cqrs/commandes/CommandServiceImpl.java
@@ -23,6 +23,9 @@ private Author getAuthorByUsername(String username) {
23
query.setParameter("username", username);
24
author = (Author) query.uniqueResult();
25
}
26
+ if (author == null) {
27
+ throw new NullPointerException("Author " + username + " doesn't exist!");
28
+ }
29
return author;
30
31
@@ -33,6 +36,9 @@ private Book getBookByTitle(String title) {
33
36
query.setParameter("title", title);
34
37
book = (Book) query.uniqueResult();
35
38
39
+ if (book == null) {
40
+ throw new NullPointerException("Book " + title + " doesn't exist!");
41
42
return book;
43
44
0 commit comments