Skip to content

Commit

Permalink
Merge branch 'develop' into onChangeMap-upd
Browse files Browse the repository at this point in the history
  • Loading branch information
Jmr3366 authored Oct 19, 2023
2 parents 98648fe + 80fa735 commit 0557975
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,10 @@
import java.util.List;
import java.util.prefs.Preferences;
import net.rptools.maptool.language.I18N;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class DeveloperOptions {
private static final Logger log = LogManager.getLogger(DeveloperOptions.class);
private static final Preferences prefs =
Preferences.userRoot().node(AppConstants.APP_NAME + "/prefs");
Preferences.userRoot().node(AppConstants.APP_NAME + "/dev");

public enum Toggle {
/**
Expand Down Expand Up @@ -57,7 +54,7 @@ public String getKey() {
}

public boolean isEnabled() {
return prefs.getBoolean(key, true);
return prefs.getBoolean(key, false);
}

public void setEnabled(boolean enabled) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,12 @@ private JsonElement shallowCopy(JsonElement jsonElement) {
* @return The resulting json data.
*/
private JsonElement jsonPathDelete(JsonElement json, String path) {
return JsonPath.using(jaywayConfig).parse(shallowCopy(json)).delete(path).json();
try {
return JsonPath.using(jaywayConfig).parse(shallowCopy(json)).delete(path).json();
} catch (PathNotFoundException ex) {
// Return original json, this is to preserve backwards compatability pre library update
return json;
}
}

/**
Expand Down Expand Up @@ -906,7 +911,12 @@ private JsonElement jsonPathPut(JsonElement json, String path, String key, Objec
private JsonElement jsonPathSet(JsonElement json, String path, Object info) {
Object value = asJsonElement(info);

return JsonPath.using(jaywayConfig).parse(shallowCopy(json)).set(path, value).json();
try {
return JsonPath.using(jaywayConfig).parse(shallowCopy(json)).set(path, value).json();
} catch (PathNotFoundException ex) {
// Return original json, this is to preserve backwards compatability pre library update
return json;
}
}

/**
Expand Down

0 comments on commit 0557975

Please sign in to comment.