Skip to content
This repository was archived by the owner on Jul 31, 2022. It is now read-only.

Commit 458a9d8

Browse files
committed
Validated #1
1 parent 09af0e1 commit 458a9d8

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/ktt/lib/httpserver/handler/FilePostHandler.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ public final void addDirectories(String context, File[] files, boolean walk){
240240
}
241241

242242
@Override
243-
public final void handle(ExchangePacket packet) throws Exception {
243+
public final void handle(ExchangePacket packet) throws IOException{
244244
String rel = URLDecoder.decode(__.startSlash(packet.getRelativeContext()), StandardCharsets.UTF_8);
245245

246246
String match = "";
@@ -273,10 +273,9 @@ public final void handle(ExchangePacket packet) throws Exception {
273273
* @param packet a packet of data containing client information
274274
* @param source the file requested by the user
275275
* @throws IOException internal failure
276-
* @throws Exception any exceptions thrown within the handler
277276
* @since 01.01.01
278277
*/
279-
public void handle(ExchangePacket packet, File source) throws Exception{
278+
public void handle(ExchangePacket packet, File source) throws IOException{
280279
try {
281280
packet.send(Files.readAllBytes(source.toPath()));
282281
} catch (IOException ignored) {

src/ktt/lib/httpserver/handler/PredicateHandler.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import ktt.lib.httpserver.ExchangePacket;
44
import ktt.lib.httpserver.RequestHandler;
55

6+
import java.io.IOException;
67
import java.util.function.Predicate;
78

89
/**
@@ -34,7 +35,7 @@ public PredicateHandler(RequestHandler T, RequestHandler F, Predicate<ExchangePa
3435
}
3536

3637
@Override
37-
public final void handle(ExchangePacket packet) {
38+
public final void handle(ExchangePacket packet) throws IOException{
3839
if(predicate.test(packet)){
3940
T.handle(packet);
4041
}else{

src/ktt/lib/httpserver/handler/RedirectHandler.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import ktt.lib.httpserver.RequestHandler;
55
import ktt.lib.httpserver.http.HTTPCode;
66

7+
import java.io.IOException;
8+
79
/**
810
* A Request Handler that redirects to a different URL without saving to the history.
911
* @see RequestHandler
@@ -26,7 +28,7 @@ public RedirectHandler(String link){
2628
}
2729

2830
@Override
29-
public void handle(ExchangePacket packet) throws Exception {
31+
public void handle(ExchangePacket packet) throws IOException{
3032
packet.getResponseHeaders().set("Location",link);
3133
packet.send(HTTPCode.HTTP_Found);
3234
}

0 commit comments

Comments
 (0)