X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FReloadingPage.java;h=f89bbed4acb450fdacea8bb2c3ac20065e2412e5;hp=0c8f51637a7f760b28d783fdd69dbb6be493de91;hb=7b55e0be6a3283e43a9bbab98f82aebdd948eb33;hpb=76ed638264e531a26e35647d13702db865a52321 diff --git a/src/main/java/net/pterodactylus/sone/web/ReloadingPage.java b/src/main/java/net/pterodactylus/sone/web/ReloadingPage.java index 0c8f516..f89bbed 100644 --- a/src/main/java/net/pterodactylus/sone/web/ReloadingPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ReloadingPage.java @@ -1,5 +1,5 @@ /* - * Sone - ReloadingPage.java - Copyright © 2010–2015 David Roden + * Sone - ReloadingPage.java - Copyright © 2010–2016 David Roden * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,6 +19,7 @@ package net.pterodactylus.sone.web; import java.io.File; import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -72,8 +73,10 @@ public class ReloadingPage implements Page { String path = request.getUri().getPath(); int lastSlash = path.lastIndexOf('/'); String filename = path.substring(lastSlash + 1); - InputStream fileInputStream = new FileInputStream(new File(filesystemPath, filename)); - if (fileInputStream == null) { + InputStream fileInputStream; + try { + fileInputStream = new FileInputStream(new File(filesystemPath, filename)); + } catch (FileNotFoundException fnfe1) { return response.setStatusCode(404).setStatusText("Not found."); } OutputStream contentOutputStream = response.getContent();