Skip to content
Snippets Groups Projects
Commit 13dc2af9 authored by Robert Goldmann's avatar Robert Goldmann
Browse files

fixed errors with new server settings path

parent 20cbbeaf
No related branches found
No related tags found
1 merge request!104merge v_1_2_0 into master
......@@ -238,8 +238,16 @@ public class Controller
Alert alert = new Alert(AlertType.ERROR);
alert.setTitle("Fehler");
alert.setHeaderText("");
if(errorMessage == null)
{
alert.setContentText("Beim Herstellen der Verbindung zum Server ist ein Fehler aufgetreten. Bitte überprüfe deine Einstellungen und ob der Server läuft.");
}
else
{
alert.setContentText("Beim Herstellen der Verbindung zum Server ist ein Fehler aufgetreten. Bitte überprüfe deine Einstellungen und ob der Server läuft.\n\n"
+ "Fehlerdetails:\n" + errorMessage);
}
Stage dialogStage = (Stage)alert.getDialogPane().getScene().getWindow();
dialogStage.getIcons().add(icon);
dialogStage.initOwner(stage);
......
......@@ -69,6 +69,8 @@ public class SettingsController
private void setTextAreaTrustedHosts(ArrayList<String> trustedHosts)
{
StringBuilder trustedHostsString = new StringBuilder();
if(trustedHosts != null)
{
for(String currentHost : trustedHosts)
{
trustedHostsString.append(currentHost);
......@@ -76,6 +78,11 @@ public class SettingsController
}
textAreaTrustedHosts.setText(trustedHostsString.toString());
}
else
{
textAreaTrustedHosts.setText("");
}
}
public void save()
{
......
......@@ -33,7 +33,7 @@ public class Main
try
{
Path settingsPath = Paths.get(Settings.class.getProtectionDomain().getCodeSource().getLocation().toURI()).resolve("settings.json");
Path settingsPath = Paths.get(Settings.class.getProtectionDomain().getCodeSource().getLocation().toURI()).getParent().resolve("settings.json");
if(!Files.exists(settingsPath))
{
......
......@@ -16,7 +16,7 @@ public class Utils
Gson gson = new Gson();
settingsJSON = new String(Files.readAllBytes(Paths.get(Settings.class.getProtectionDomain().getCodeSource().getLocation().toURI()).resolve("settings.json")));
settingsJSON = new String(Files.readAllBytes(Paths.get(Settings.class.getProtectionDomain().getCodeSource().getLocation().toURI()).getParent().resolve("settings.json")));
settings = gson.fromJson(settingsJSON, Settings.class);
return settings;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment