mirror of
https://github.com/devsnaith/lumiere-server.git
synced 2024-11-23 17:13:14 +03:00
Fix NoSuchElementException ex
This commit is contained in:
parent
a8b4c3eb1f
commit
9b9de358cb
Binary file not shown.
@ -4,6 +4,7 @@ import java.io.IOException;
|
|||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.NoSuchElementException;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
||||||
import org.eu.lumiere.loggers.GlobalLogger;
|
import org.eu.lumiere.loggers.GlobalLogger;
|
||||||
@ -13,6 +14,7 @@ import org.eu.lumiere.net.ServerEvents;
|
|||||||
import org.eu.lumiere.net.http.HttpRequest;
|
import org.eu.lumiere.net.http.HttpRequest;
|
||||||
import org.eu.lumiere.net.http.HttpRequestHandler;
|
import org.eu.lumiere.net.http.HttpRequestHandler;
|
||||||
import org.eu.lumiere.net.http.HttpResponse;
|
import org.eu.lumiere.net.http.HttpResponse;
|
||||||
|
import org.eu.lumiere.utils.SimpleResponse;
|
||||||
|
|
||||||
public class Lumiere implements ServerEvents{
|
public class Lumiere implements ServerEvents{
|
||||||
|
|
||||||
@ -50,7 +52,12 @@ public class Lumiere implements ServerEvents{
|
|||||||
gmtDate.setTimeZone(TimeZone.getTimeZone("GMT"));
|
gmtDate.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||||
httpH.setProperty("Date", gmtDate.format(new Date()));
|
httpH.setProperty("Date", gmtDate.format(new Date()));
|
||||||
|
|
||||||
|
try {
|
||||||
request.onRequestReceived(new HttpRequest(socket), httpH);
|
request.onRequestReceived(new HttpRequest(socket), httpH);
|
||||||
|
}catch (NoSuchElementException e) {
|
||||||
|
httpH.setStatus("HTTP/1.1 400 Bad Request");
|
||||||
|
new SimpleResponse("Bad Request", false).onRequestReceived(null, httpH);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if(socket.isConnected())
|
if(socket.isConnected())
|
||||||
|
Loading…
Reference in New Issue
Block a user