Skip to content

Commit

Permalink
Fix incorrect casts in ConfigService
Browse files Browse the repository at this point in the history
  • Loading branch information
tobias-weber committed Jan 9, 2025
1 parent 0930e61 commit 4045ac5
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions config/src/main/java/org/polypheny/db/webui/ConfigService.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,21 +112,14 @@ private boolean trySetConfig( Entry<String, Object> entry, ConfigManager cm, boo
Config c = cm.getConfig( entry.getKey() );
switch ( c.getConfigType() ) {
case "ConfigInteger":
if ( entry.getValue() instanceof Integer i ) {
if ( !c.setInt( i ) ) {
allValid = false;
appendError( feedback, entry, c );
}
break;
}
Double d = (Double) entry.getValue();
if ( !c.setInt( d.intValue() ) ) {
Number n = (Number) entry.getValue();
if ( !c.setInt( n.intValue() ) ) {
allValid = false;
appendError( feedback, entry, c );
}
break;
case "ConfigDouble":
if ( !c.setDouble( (double) entry.getValue() ) ) {
if ( !c.setDouble( ((Number) entry.getValue()).doubleValue() ) ) {
allValid = false;
appendError( feedback, entry, c );
}
Expand All @@ -138,7 +131,7 @@ private boolean trySetConfig( Entry<String, Object> entry, ConfigManager cm, boo
}
break;
case "ConfigLong":
if ( !c.setLong( (long) entry.getValue() ) ) {
if ( !c.setLong( ((Number) entry.getValue()).longValue() ) ) {
allValid = false;
appendError( feedback, entry, c );
}
Expand Down

0 comments on commit 4045ac5

Please sign in to comment.