Skip to content

Commit

Permalink
Update TcpSkill.java
Browse files Browse the repository at this point in the history
fix gamacolor cast exception
  • Loading branch information
lesquoyb committed Apr 28, 2022
1 parent ed975e4 commit 40099a5
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions ummisco.gama.network/src/ummisco/gama/network/skills/TcpSkill.java
Expand Up @@ -69,7 +69,7 @@ public String waitForconnection(final IScope scope) {

} catch (IOException e) {
var error_mess = e.getMessage();
scope.getGui().getConsole().informConsole(error_mess, scope.getRoot(), (GamaColor) Color.red);
scope.getGui().getConsole().informConsole(error_mess, scope.getRoot(), new GamaColor(GamaColor.red));
e.printStackTrace();
}
}
Expand Down Expand Up @@ -101,7 +101,7 @@ public String createServer(final IScope scope) {
} catch (IOException e) {

var error_mess = e.getMessage();
scope.getGui().getConsole().informConsole(error_mess, scope.getRoot(), (GamaColor) Color.red);
scope.getGui().getConsole().informConsole(error_mess, scope.getRoot(), new GamaColor(GamaColor.red));
e.printStackTrace();
}

Expand Down Expand Up @@ -146,7 +146,7 @@ public String connectToServer(final IScope scope) {
} catch (IOException e) {
e.printStackTrace();
var error_mess = "Unable to connect to server with url '" + server_url +"' and port '" + port + "' : " + e.toString();
scope.getGui().getConsole().informConsole(error_mess, scope.getRoot(), (GamaColor) Color.red);
scope.getGui().getConsole().informConsole(error_mess, scope.getRoot(), new GamaColor(GamaColor.red));
DEBUG.OUT(error_mess);
return null;
}
Expand Down Expand Up @@ -177,13 +177,13 @@ public boolean send(IScope scope) {

if (to_desc == null || ! sockets.containsKey(scope, to_desc)) {
var error_mess = "unknown client value for the 'to' facet : '" + to_desc + "'";
scope.getGui().getConsole().informConsole(error_mess, scope.getRoot(), (GamaColor) Color.red);
scope.getGui().getConsole().informConsole(error_mess, scope.getRoot(), new GamaColor(GamaColor.red));
DEBUG.OUT(error_mess);
return false;
}
if (content == null) {
var error_mess = "content cannot be nil";
scope.getGui().getConsole().informConsole(error_mess, scope.getRoot(), (GamaColor) Color.red);
scope.getGui().getConsole().informConsole(error_mess, scope.getRoot(), new GamaColor(GamaColor.red));
DEBUG.OUT(error_mess);
return false;
}
Expand All @@ -197,7 +197,7 @@ public boolean send(IScope scope) {

} catch (IOException e) {
var error_mess = e.getMessage();
scope.getGui().getConsole().informConsole(error_mess, scope.getRoot(),(GamaColor) Color.red);
scope.getGui().getConsole().informConsole(error_mess, scope.getRoot(), new GamaColor(GamaColor.red));
return false;
}

Expand Down Expand Up @@ -225,7 +225,7 @@ public String readLine(IScope scope) {

if (from_desc == null || ! sockets.containsKey(scope, from_desc)) {
var error_mess = "unknown connection value for the 'from' facet : '" + from_desc + "'";
scope.getGui().getConsole().informConsole(error_mess, scope.getRoot(), (GamaColor) Color.red);
scope.getGui().getConsole().informConsole(error_mess, scope.getRoot(), new GamaColor(GamaColor.red));
DEBUG.ERR(error_mess);
return null;
}
Expand Down Expand Up @@ -259,7 +259,7 @@ public String readAll(IScope scope) {

if (from_desc == null || ! sockets.containsKey(scope, from_desc)) {
var error_mess = "unknown connection value for the 'from' facet : '" + from_desc + "'";
scope.getGui().getConsole().informConsole(error_mess, scope.getRoot(), (GamaColor) Color.red);
scope.getGui().getConsole().informConsole(error_mess, scope.getRoot(), new GamaColor(GamaColor.red));
DEBUG.ERR(error_mess);
return null;
}
Expand All @@ -277,7 +277,7 @@ public String readAll(IScope scope) {
} catch (IOException e) {
e.printStackTrace();
var error_mess = "impossible to read line from '" + from_desc + "' : " + e.toString();
scope.getGui().getConsole().informConsole(error_mess, scope.getRoot(), (GamaColor) Color.red);
scope.getGui().getConsole().informConsole(error_mess, scope.getRoot(), new GamaColor(GamaColor.red));
DEBUG.ERR(error_mess);
return null;
}
Expand Down Expand Up @@ -316,7 +316,7 @@ public String readBytes(IScope scope) {

if (from_desc == null || ! sockets.containsKey(scope, from_desc)) {
var error_mess = "unknown connection value for the 'from' facet : '" + from_desc + "'";
scope.getGui().getConsole().informConsole(error_mess, scope.getRoot(), (GamaColor) Color.red);
scope.getGui().getConsole().informConsole(error_mess, scope.getRoot(), new GamaColor(GamaColor.red));
DEBUG.ERR(error_mess);
return null;
}
Expand All @@ -332,7 +332,7 @@ public String readBytes(IScope scope) {
} catch (IOException e) {
e.printStackTrace();
var error_mess = "impossible to read line from '" + from_desc + "' : " + e.toString();
scope.getGui().getConsole().informConsole(error_mess, scope.getRoot(), (GamaColor) Color.red);
scope.getGui().getConsole().informConsole(error_mess, scope.getRoot(), new GamaColor(GamaColor.red));
DEBUG.ERR(error_mess);
return null;
}
Expand Down Expand Up @@ -371,14 +371,14 @@ public String readUntil(IScope scope) {

if (from_desc == null || ! sockets.containsKey(scope, from_desc)) {
var error_mess = "unknown connection value for the 'from' facet : '" + from_desc + "'";
scope.getGui().getConsole().informConsole(error_mess, scope.getRoot(), (GamaColor) Color.red);
scope.getGui().getConsole().informConsole(error_mess, scope.getRoot(), new GamaColor(GamaColor.red));
DEBUG.ERR(error_mess);
return null;
}

if (end_string == null || end_string.length() == 0) {
var error_mess = IRawNetworkSkill.END_STRING + " must be at least one caracter long";
scope.getGui().getConsole().informConsole(error_mess, scope.getRoot(), (GamaColor) Color.red);
scope.getGui().getConsole().informConsole(error_mess, scope.getRoot(), new GamaColor(GamaColor.red));
DEBUG.ERR(error_mess);
return null;
}
Expand Down Expand Up @@ -415,7 +415,7 @@ private String readUntil(IScope scope, Socket from, String endString) {
} catch (IOException e) {
e.printStackTrace();
var error_mess = "impossible to read line from '" + from.toString() + "' : " + e.toString();
scope.getGui().getConsole().informConsole(error_mess, scope.getRoot(), (GamaColor) Color.red);
scope.getGui().getConsole().informConsole(error_mess, scope.getRoot(), new GamaColor(GamaColor.red));
DEBUG.ERR(error_mess);
return null;
}
Expand Down

0 comments on commit 40099a5

Please sign in to comment.