From: David ‘Bombe’ Roden Date: Fri, 25 Mar 2011 23:35:13 +0000 (+0100) Subject: Don’t throw exceptions when a single “return” would suffice. X-Git-Tag: beta-freefall-0.6.2-1~72 X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=commitdiff_plain;h=28b0c5550f1a2c1009f62ba43a038f2f2a878781 Don’t throw exceptions when a single “return” would suffice. --- diff --git a/src/main/java/net/pterodactylus/sone/web/UploadImagePage.java b/src/main/java/net/pterodactylus/sone/web/UploadImagePage.java index 17538a6..06afa8c 100644 --- a/src/main/java/net/pterodactylus/sone/web/UploadImagePage.java +++ b/src/main/java/net/pterodactylus/sone/web/UploadImagePage.java @@ -70,7 +70,7 @@ public class UploadImagePage extends SoneTemplatePage { String parentId = request.getHttpRequest().getPartAsStringFailsafe("parent", 36); Album parent = webInterface.getCore().getAlbum(parentId, false); if (parent == null) { - throw new RedirectException("invalid.html"); + return; } String name = request.getHttpRequest().getPartAsStringFailsafe("title", 200); String description = request.getHttpRequest().getPartAsStringFailsafe("description", 4000); @@ -91,7 +91,7 @@ public class UploadImagePage extends SoneTemplatePage { uploadedImage.flush(); } catch (IOException ioe1) { logger.log(Level.WARNING, "Could not read uploaded image!", ioe1); - throw new RedirectException("invalid.html"); + return; } finally { Closer.close(imageInputStream); fileBucket.free();