Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions src/main/java/org/ecocean/api/SiteSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,22 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response)
try {
for (String iaClass : iaConfig.getValidIAClasses(tx)) {
for (JSONObject idOpt : iaConfig.identOpts(tx, iaClass)) {
idOpt.remove("api_endpoint"); // dont want this shown
String key = idOpt.toString();
// make a copy so we can safely modify it
JSONObject idOptCopy = new JSONObject(idOpt.toString());
idOptCopy.remove("api_endpoint"); // dont want this shown
// NOTE: JSONObject.toString() in theory might produce different strings
// for the same object (key ordering different); but in practice seems to
// be consistent within these iterations
String key = idOptCopy.toString();
if (identConfigs.containsKey(key)) {
// TODO this will append *duplicate* iaClass values, which is not currently an error
// but might be nice fix later
identConfigs.get(key).getJSONArray("_iaClasses").put(iaClass);
} else {
JSONArray iacls = new JSONArray();
iacls.put(iaClass);
idOpt.put("_iaClasses", iacls);
identConfigs.put(key, idOpt);
idOptCopy.put("_iaClasses", iacls);
identConfigs.put(key, idOptCopy);
}
}
}
Expand Down
Loading