We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 88f22c2 commit ef52124Copy full SHA for ef52124
app/src/main/java/hexlet/code/controller/UrlsController.java
@@ -13,6 +13,7 @@
13
import java.net.URI;
14
import java.net.URISyntaxException;
15
import java.sql.SQLException;
16
+import java.util.Objects;
17
18
import static io.javalin.rendering.template.TemplateUtil.model;
19
@@ -47,7 +48,10 @@ public static void show(Context ctx) throws SQLException {
47
48
49
public static void create(Context ctx) throws SQLException {
50
- var inputUrl = ctx.formParamAsClass("url", String.class).getOrThrow(NotFoundResponse::new);
51
+ var inputUrl = ctx.formParamAsClass("url", String.class)
52
+ .check(Objects::nonNull, "Url not found in form")
53
+ .getOrThrow(NotFoundResponse::new);
54
+
55
URI parsedUrl;
56
try {
57
parsedUrl = new URI(inputUrl);
0 commit comments