Skip to content

Commit 077ab21

Browse files
committed
GH-193 Adapter examples would fail once null is passed
Signed-off-by: Markus KARG <markus@headcrashing.eu>
1 parent b29bc1e commit 077ab21

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

docs/src/docs/user-guide.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,8 @@ public class CustomerAnnotated {
515515
public class CustomerAdapter implements JsonbAdapter<Customer, CustomerAnnotated> {
516516
@Override
517517
public CustomerAnnotated adaptToJson(Customer c) throws Exception {
518+
if (c == null)
519+
return null;
518520
CustomerAnnotated customer = new Customer();
519521
customer.setId(c.getId());
520522
customer.setName(c.getName());
@@ -523,6 +525,8 @@ public class CustomerAdapter implements JsonbAdapter<Customer, CustomerAnnotated
523525
524526
@Override
525527
public Customer adaptFromJson(CustomerAnnotated adapted) throws Exception {
528+
if (adapted == null)
529+
return null;
526530
Customer customer = new Customer();
527531
customer.setId(adapted.getId());
528532
customer.setName(adapted.getName());

0 commit comments

Comments
 (0)