From 4045ac521fc263052e884e02aa3b330fa3ee6c44 Mon Sep 17 00:00:00 2001 From: Tobias Weber Date: Thu, 9 Jan 2025 11:20:51 +0100 Subject: [PATCH] Fix incorrect casts in ConfigService --- .../org/polypheny/db/webui/ConfigService.java | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/config/src/main/java/org/polypheny/db/webui/ConfigService.java b/config/src/main/java/org/polypheny/db/webui/ConfigService.java index 5afd7716ec..6dbbd04b19 100644 --- a/config/src/main/java/org/polypheny/db/webui/ConfigService.java +++ b/config/src/main/java/org/polypheny/db/webui/ConfigService.java @@ -112,21 +112,14 @@ private boolean trySetConfig( Entry 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 ); } @@ -138,7 +131,7 @@ private boolean trySetConfig( Entry 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 ); }