diff --git a/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/statements/expressions/Literal.kt b/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/statements/expressions/Literal.kt index 213e9f24b6..68a6da353b 100644 --- a/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/statements/expressions/Literal.kt +++ b/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/statements/expressions/Literal.kt @@ -60,10 +60,13 @@ class Literal : Expression() { class ValueConverter : AttributeConverter { override fun toGraphProperty(value: Any?): Any? { - return if (value is BigInteger) { - value.toString() - } else { - value + // Neo4J only supports a limited set of primitive values natively, everything else, we need + // to convert to a string. + return when (value) { + (value is Number && value !is BigInteger) -> value + is Boolean -> value + null -> null + else -> value.toString() } } diff --git a/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/persistence/Common.kt b/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/persistence/Common.kt index 27a25541ae..b805d322ce 100644 --- a/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/persistence/Common.kt +++ b/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/persistence/Common.kt @@ -31,7 +31,6 @@ import de.fraunhofer.aisec.cpg.graph.Persistable import de.fraunhofer.aisec.cpg.graph.edges.collections.EdgeCollection import de.fraunhofer.aisec.cpg.graph.edges.collections.EdgeList import de.fraunhofer.aisec.cpg.helpers.neo4j.NameConverter -import java.math.BigInteger import kotlin.reflect.KClass import kotlin.reflect.KProperty1 import kotlin.reflect.KTypeProjection @@ -134,8 +133,6 @@ fun Any.convert( properties.put(originalKey, this.name) } else if (this is Uuid) { properties.put(originalKey, this.toString()) - } else if (this is BigInteger) { - properties.put(originalKey, this.toString()) } else { properties.put(originalKey, this) }