Act as if everything was fine if an invalid registration key is used.
Change-Id: I78066954fef2e6afd9e49d56bd4c4060ad59796c
diff --git a/src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterResource.java b/src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterResource.java
index 85af008..3786c9c 100644
--- a/src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterResource.java
+++ b/src/main/java/eu/mulk/mulkcms2/benki/newsletter/NewsletterResource.java
@@ -8,14 +8,12 @@
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
import javax.transaction.Transactional;
-import javax.ws.rs.ClientErrorException;
import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.Response.Status;
@Path("/newsletter")
@Produces(TEXT_HTML)
@@ -66,11 +64,7 @@
public TemplateInstance finishRegistration(@QueryParam("key") String registrationKey) {
NewsletterSubscription.<NewsletterSubscription>find("registrationKey = ?1", registrationKey)
.singleResultOptional()
- .ifPresentOrElse(
- s -> s.registrationKey = null,
- () -> {
- throw new ClientErrorException(Status.BAD_REQUEST);
- });
+ .ifPresent(s -> s.registrationKey = null);
return Templates.registered();
}