diff --git a/Projet_POO/.classpath b/Projet_POO/.classpath
index 5fc2cae..ecb69e6 100644
--- a/Projet_POO/.classpath
+++ b/Projet_POO/.classpath
@@ -6,7 +6,7 @@
-
+
diff --git a/Projet_POO/src/bdd/GestionnaireHistorique.java b/Projet_POO/src/bdd/GestionnaireHistorique.java
index ad81be5..d789ecb 100644
--- a/Projet_POO/src/bdd/GestionnaireHistorique.java
+++ b/Projet_POO/src/bdd/GestionnaireHistorique.java
@@ -50,7 +50,7 @@ public class GestionnaireHistorique {
int rs1;
ResultSet rs2 = null;
Connection con = null;
- String history = "";
+ StringBuilder history = new StringBuilder();
String query1 =
"CREATE TABLE IF NOT EXISTS " + id
@@ -75,8 +75,8 @@ public class GestionnaireHistorique {
while(rs2.next()) {
System.out.println("Historic SUCCESS");
- history += GestionnaireNom.instance().nomFromId(rs2.getString(2)) + ": "; //indice commence à 1
- history += rs2.getString(3) + "\n";
+ history.append(GestionnaireNom.instance().nomFromId(rs2.getString(2)) + ": "); //indice commence à 1
+ history.append(rs2.getString(3) + System.lineSeparator());
}
// à mettre dans un finally
@@ -91,7 +91,7 @@ public class GestionnaireHistorique {
e.printStackTrace();
}
- return history;
+ return history.toString();
}
diff --git a/Projet_POO/src/clavardage/GestionnaireSessionsLocales.java b/Projet_POO/src/clavardage/GestionnaireSessionsLocales.java
index f3d7153..7be0a63 100644
--- a/Projet_POO/src/clavardage/GestionnaireSessionsLocales.java
+++ b/Projet_POO/src/clavardage/GestionnaireSessionsLocales.java
@@ -37,7 +37,7 @@ public class GestionnaireSessionsLocales implements Runnable{
TCPClient client = new TCPClient(gn.ipFromNom(name), PORT_REQUETE_NOUVELLE_SESSION + Integer.parseInt(gn.idFromNom(name))) ;
SessionClavardageLocale session = new SessionClavardageLocale(gn.getId(), gn.idFromNom(name), client, null);
this.sessions.put(gn.idFromNom(name), session);
- client.send(gn.getId()+"\n");
+ client.send(gn.getId()+System.lineSeparator());
System.out.print("Paramètres de session envoyée à " + gn.idFromNom(name) + "\n");
//Lancement de la fenêtre de session
@@ -102,7 +102,7 @@ public class GestionnaireSessionsLocales implements Runnable{
TCPClient clientEnvoi = new TCPClient(client.getAdresseCible(), PORT_REQUETE_NOUVELLE_SESSION + Integer.parseInt(idClient));
SessionClavardageLocale session = new SessionClavardageLocale(gn.getId(), idClient, clientEnvoi, client);
this.sessions.put(idClient, session);
- clientEnvoi.send(gn.getId()+"\n");
+ clientEnvoi.send(gn.getId()+System.lineSeparator());
System.out.print("Fin de la configuration de " + gn.getId() + "\n");
System.out.println("Il y a actuellement " + sessions.size() + " session(s) ouverte(s).");
diff --git a/Projet_POO/src/clavardage/SessionClavardage.java b/Projet_POO/src/clavardage/SessionClavardage.java
index f833c33..6a2ee5d 100644
--- a/Projet_POO/src/clavardage/SessionClavardage.java
+++ b/Projet_POO/src/clavardage/SessionClavardage.java
@@ -26,7 +26,7 @@ public abstract class SessionClavardage {
public String toString() {
- return "Session entre " + "this.idSource" + " et " + this.idDestination + "\n";
+ return "Session entre " + "this.idSource" + " et " + this.idDestination + System.lineSeparator();
}
public String getIdSource() {
diff --git a/Projet_POO/src/clavardage/SessionClavardageDistante.java b/Projet_POO/src/clavardage/SessionClavardageDistante.java
index cba7adf..534b690 100644
--- a/Projet_POO/src/clavardage/SessionClavardageDistante.java
+++ b/Projet_POO/src/clavardage/SessionClavardageDistante.java
@@ -61,7 +61,7 @@ public class SessionClavardageDistante extends SessionClavardage{
}
public String toString() {
- return "Session à distance entre " + this.getIdSource() + " et " + this.getIdDestination() + "\n";
+ return "Session à distance entre " + this.getIdSource() + " et " + this.getIdDestination() + System.lineSeparator();
}
diff --git a/Projet_POO/src/clavardage/SessionClavardageLocale.java b/Projet_POO/src/clavardage/SessionClavardageLocale.java
index 249782e..8df06c0 100644
--- a/Projet_POO/src/clavardage/SessionClavardageLocale.java
+++ b/Projet_POO/src/clavardage/SessionClavardageLocale.java
@@ -35,7 +35,7 @@ public class SessionClavardageLocale extends SessionClavardage{
@Override
public String toString() {
return "Session locale entre " + this.idSource + " à l'adresse " + this.clientEmission.getAdresseSource()
- + ", et " + this.idDestination + " à l'adresse " + this.clientEmission.getAdresseCible() + "\n";
+ + ", et " + this.idDestination + " à l'adresse " + this.clientEmission.getAdresseCible() + System.lineSeparator();
}
public TCPClient getClientReception() {
diff --git a/Projet_POO/src/data/ServletResponse.java b/Projet_POO/src/data/ServletResponse.java
index 5e2db65..a6ee73b 100644
--- a/Projet_POO/src/data/ServletResponse.java
+++ b/Projet_POO/src/data/ServletResponse.java
@@ -23,7 +23,7 @@ public class ServletResponse {
public String toString (){
if (this.messageList != null) {
- return "Status code: " + this.statusCode +", " + this.messageList.size() + " messages reçus.";
+ return "Status code: " + this.statusCode +", " + this.messageList.size() + " messages reçus.";
}
else {
return "Status code: " + this.statusCode;
diff --git a/Projet_POO/src/defaut/Main.java b/Projet_POO/src/defaut/Main.java
index bde5333..6cff325 100644
--- a/Projet_POO/src/defaut/Main.java
+++ b/Projet_POO/src/defaut/Main.java
@@ -17,7 +17,7 @@ public class Main {
//on lance le server d'écoute de cmd
GestionnaireListeUtilisateur.instance().ecoute2(2001);
- //on crée manuellement des utilisateurs //debug
+ //on crée manuellement des utilisateurs //debug1
GestionnaireListeUtilisateur.instance().envoie2("add$$$77$$$Moidebug$$$LocalHost$$$true");
//on met à jour notre liste
diff --git a/Projet_POO/src/reseau/TCPClient.java b/Projet_POO/src/reseau/TCPClient.java
index 8f45049..7d223c0 100644
--- a/Projet_POO/src/reseau/TCPClient.java
+++ b/Projet_POO/src/reseau/TCPClient.java
@@ -36,12 +36,12 @@ public class TCPClient {
this.socket = new Socket(host, port);
}
catch (UnknownHostException e) {
- System.out.print("Could not find host\n");
+ System.out.println("Could not find host");
}
catch (IOException e) {
e.printStackTrace();
- System.out.print("port= "+port+" host= "+host+"\n");
- System.out.print("Could not create socket\n");
+ System.out.println("port= "+port+" host= "+host);
+ System.out.println("Could not create socket");
}
@@ -51,13 +51,13 @@ public class TCPClient {
this.textInput = new BufferedReader(new InputStreamReader(socket.getInputStream()));
}
catch (IOException e) {
- System.out.print("Error while reading textInput stream\n");
+ System.out.println("Error while reading textInput stream");
}
try {
this.textOutput = new PrintWriter(socket.getOutputStream(),true);
}
catch (IOException e) {
- System.out.print("Error while reading textOutput stream\n");
+ System.out.println("Error while reading textOutput stream");
}
this.support = new PropertyChangeSupport(this);
@@ -72,13 +72,13 @@ public class TCPClient {
this.textInput = new BufferedReader(new InputStreamReader(socket.getInputStream()));
}
catch (IOException e) {
- System.out.print("Error while reading textInput stream");
+ System.out.println("Error while reading textInput stream");
}
try {
this.textOutput = new PrintWriter(socket.getOutputStream(),true);
}
catch (IOException e) {
- System.out.print("Error while reading textOutput stream");
+ System.out.println("Error while reading textOutput stream");
}
support = new PropertyChangeSupport(this);
}
@@ -115,7 +115,7 @@ public class TCPClient {
this.socket.close();
}
catch (IOException e) {
- System.out.print("Error while closing connection\n");
+ System.out.println("Error while closing connection");
}
@@ -128,7 +128,7 @@ public class TCPClient {
this.socket = new Socket(this.adresseCible.getHostName(), port);
}
catch (UnknownHostException e) {
- System.out.print("Could not find host");
+ System.out.println("Could not find host");
}
}
@@ -155,10 +155,10 @@ public class TCPClient {
public static void main(String[] args) throws IOException{
//TCPClient client = new TCPClient("LAPTOP-944OJJB9", 19999);
TCPClient client = new TCPClient("srv-gei-tomcat.insa-toulouse.fr", 19999);
- String message = "Bonjour.\n";
+ String message = "Bonjour.";
System.out.printf("Message envoyé: %s", message);
client.send(message);
- System.out.printf("Message reçu: %s\n", client.receive());
+ System.out.printf("Message reçu: %s"+System.lineSeparator(), client.receive());
client.stop();
}
}
diff --git a/Projet_POO/src/ui/DiscussionUI.java b/Projet_POO/src/ui/DiscussionUI.java
index 4389ba0..676aca4 100644
--- a/Projet_POO/src/ui/DiscussionUI.java
+++ b/Projet_POO/src/ui/DiscussionUI.java
@@ -54,14 +54,14 @@ public class DiscussionUI extends JFrame implements PropertyChangeListener{
ArrayList list = session.getNewMessages();
for (Message msg : list) {
if (msg.getType().equals("command") && msg.getBody().equals("stopSession")) {
- historicField.setText(historicField.getText() + GestionnaireNom.instance().nomFromId(session.getIdDestination()) + " s'est déconnecté(e).\n");
+ historicField.setText(historicField.getText() + GestionnaireNom.instance().nomFromId(session.getIdDestination()) + " s'est déconnecté(e)."+System.lineSeparator());
this.finDeSession();
}
else
{
System.out.print(msg);
String message = GestionnaireNom.instance().nomFromId(msg.getSender()) + ": " + msg.getBody();
- historicField.setText(historicField.getText() + message + "\n");
+ historicField.setText(historicField.getText() + message + System.lineSeparator());
}
}
@@ -83,8 +83,8 @@ public class DiscussionUI extends JFrame implements PropertyChangeListener{
message.setSender(this.session.getIdSource());
message.setRecipient(this.session.getIdDestination());
textField.setText("");
- historicField.append(GestionnaireNom.instance().nomFromId(message.getSender()) +": " + message.getBody() + "\n");
- //session.send(GestionnaireNom.instance().nomFromId(session.getIdSource()) + ": " + message+"\n");
+ historicField.append(GestionnaireNom.instance().nomFromId(message.getSender()) +": " + message.getBody() + System.lineSeparator());
+ //session.send(GestionnaireNom.instance().nomFromId(session.getIdSource()) + ": " + message+System.lineSeparator());
try {
session.sendObject(message);
} catch (IOException e) {