From 387e797d6eb21ba511946d8305e941791d04238a Mon Sep 17 00:00:00 2001 From: "Notmoo-PC\\Notmoo" Date: Thu, 25 Jan 2018 17:19:44 +0100 Subject: [PATCH] =?UTF-8?q?[CLIENT]=20#19=20:=20Les=20erreurs=20de=20conne?= =?UTF-8?q?xion=20HTTP=20sont=20d=C3=A9sormais=20correctement=20g=C3=A9r?= =?UTF-8?q?=C3=A9s=20par=20le=20client,=20et=20une=20erreur=20HTTP=20500?= =?UTF-8?q?=20ne=20bloque=20plus=20la=20connexion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../listeners/ConnectionListenerAdapter.java | 12 ++++++++++++ .../connection/listeners/IConnectionListener.java | 1 + .../module/connection/senders/HttpTextSender.java | 6 ++---- .../pqt/client/module/query/QueryExecutor.java | 15 +++++++++++++++ 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/Workspace/client/src/main/java/com/pqt/client/module/connection/listeners/ConnectionListenerAdapter.java b/Workspace/client/src/main/java/com/pqt/client/module/connection/listeners/ConnectionListenerAdapter.java index a681450a..73dcbef3 100644 --- a/Workspace/client/src/main/java/com/pqt/client/module/connection/listeners/ConnectionListenerAdapter.java +++ b/Workspace/client/src/main/java/com/pqt/client/module/connection/listeners/ConnectionListenerAdapter.java @@ -46,4 +46,16 @@ public class ConnectionListenerAdapter implements IConnectionListener { } + + + /** + * @see com.pqt.client.module.connection.listeners.IConnectionListener#onConnexionError(Throwable) + * + * + */ + @Override + public void onConnexionError(Throwable e) { + + } + } diff --git a/Workspace/client/src/main/java/com/pqt/client/module/connection/listeners/IConnectionListener.java b/Workspace/client/src/main/java/com/pqt/client/module/connection/listeners/IConnectionListener.java index 1444d908..8b1aafa8 100644 --- a/Workspace/client/src/main/java/com/pqt/client/module/connection/listeners/IConnectionListener.java +++ b/Workspace/client/src/main/java/com/pqt/client/module/connection/listeners/IConnectionListener.java @@ -12,4 +12,5 @@ public interface IConnectionListener extends EventListener { void onTimeOutEvent(); + void onConnexionError(Throwable e); } diff --git a/Workspace/client/src/main/java/com/pqt/client/module/connection/senders/HttpTextSender.java b/Workspace/client/src/main/java/com/pqt/client/module/connection/senders/HttpTextSender.java index 4410250b..df0a5124 100644 --- a/Workspace/client/src/main/java/com/pqt/client/module/connection/senders/HttpTextSender.java +++ b/Workspace/client/src/main/java/com/pqt/client/module/connection/senders/HttpTextSender.java @@ -37,12 +37,10 @@ public class HttpTextSender implements ITextSender{ } con.disconnect(); - - }catch (java.net.SocketTimeoutException | ConnectException e){ + }catch (Exception e) { //TODO Issue #6 : ajouter un log ici - listener.onTimeOutEvent(); - }catch (IOException e) { e.printStackTrace(); + listener.onConnexionError(e); }finally { listener.onDisconnectedEvent(); } diff --git a/Workspace/client/src/main/java/com/pqt/client/module/query/QueryExecutor.java b/Workspace/client/src/main/java/com/pqt/client/module/query/QueryExecutor.java index 0c5c0307..c673e831 100644 --- a/Workspace/client/src/main/java/com/pqt/client/module/query/QueryExecutor.java +++ b/Workspace/client/src/main/java/com/pqt/client/module/query/QueryExecutor.java @@ -80,6 +80,11 @@ public class QueryExecutor { public void onTimeOutEvent() { callback.err(new MessageTimeoutException()); } + + @Override + public void onConnexionError(Throwable e) { + callback.err(e); + } }); } @@ -121,6 +126,11 @@ public class QueryExecutor { public void onTimeOutEvent() { callback.err(new MessageTimeoutException()); } + + @Override + public void onConnexionError(Throwable e) { + callback.err(e); + } }); } @@ -158,6 +168,11 @@ public class QueryExecutor { public void onTimeOutEvent() { callback.err(new MessageTimeoutException()); } + + @Override + public void onConnexionError(Throwable e) { + callback.err(e); + } }); }