better error message

This commit is contained in:
Athou
2013-07-05 18:33:39 +02:00
parent 495f0c0ba9
commit a9b246d286

View File

@@ -62,8 +62,10 @@ public class PubSubHubbubCallbackREST {
@QueryParam("hub.challenge") String challenge,
@QueryParam("hub.lease_seconds") String leaseSeconds,
@QueryParam("hub.verify_token") String verifyToken) {
Preconditions.checkState(applicationSettingsService.get()
.isPubsubhubbub());
if (!applicationSettingsService.get()
.isPubsubhubbub()) {
return Response.status(Status.FORBIDDEN).entity("pubsubhubbub is disabled").build();
}
Preconditions.checkArgument(StringUtils.isNotEmpty(topic));
Preconditions.checkArgument("subscribe".equals(mode));
@@ -90,8 +92,10 @@ public class PubSubHubbubCallbackREST {
@POST
@Consumes({ MediaType.APPLICATION_ATOM_XML, "application/rss+xml" })
public Response callback() {
Preconditions.checkState(applicationSettingsService.get()
.isPubsubhubbub());
if (!applicationSettingsService.get()
.isPubsubhubbub()) {
return Response.status(Status.FORBIDDEN).entity("pubsubhubbub is disabled").build();
}
try {
byte[] bytes = IOUtils.toByteArray(request.getInputStream());
FetchedFeed fetchedFeed = parser.parse(null, bytes);