Skip to content

Commit

Permalink
Fix server list property parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
melissalinkert committed Mar 13, 2024
1 parent c7e025c commit 4e819fe
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import com.google.gson.reflect.TypeToken;

import javafx.beans.property.StringProperty;
import javafx.event.Event;
import javafx.event.EventHandler;
Expand Down Expand Up @@ -107,7 +111,12 @@ public String getDescription() {
private static Menu createServerListMenu(QuPathGUI qupath, Menu browseServerMenu) {
EventHandler<Event> validationHandler = e -> {
StringProperty usedServerProp = PathPrefs.createPersistentPreference("omero_ext.server_list", "");
String[] usedServers = usedServerProp.getValue().split(",");

Gson gson = new Gson();
List<String> usedServers = null;
try {
usedServers = gson.fromJson(usedServerProp.get(), new TypeToken<>() {});
} catch (JsonSyntaxException ignored) {}

browseServerMenu.getItems().clear();

Expand Down

0 comments on commit 4e819fe

Please sign in to comment.