/*
- * 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
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
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();