diff --git a/src/main/java/org/neo4j/rest/graphdb/PropertiesMap.java b/src/main/java/org/neo4j/rest/graphdb/PropertiesMap.java index 71e9cf8..e610fd2 100644 --- a/src/main/java/org/neo4j/rest/graphdb/PropertiesMap.java +++ b/src/main/java/org/neo4j/rest/graphdb/PropertiesMap.java @@ -75,16 +75,17 @@ public static Object assertSupportedPropertyValue( Object value ) { if ( value == null ) { throw new RuntimeException( "null value not supported" ); } - - if ( value instanceof String ) { - } else if ( value instanceof Number ) { - } else if ( value instanceof Boolean ) { - } else { - throw new RuntimeException( "Unsupported value type " + value.getClass() + "." + - " Supported value types are all java primitives (byte, char, short, int, " + - "long, float, double) and String, as well as arrays of all those types" ); + final Class type = value.getClass(); + if (isSupportedType(type) || type.isArray() && isSupportedType(type.getComponentType())) { + return value; } - return value; + throw new RuntimeException( "Unsupported value type " + type + "." + + " Supported value types are all java primitives (byte, char, short, int, " + + "long, float, double) and String, as well as arrays of all those types" ); + } + + private static boolean isSupportedType(Class type) { + return type.isPrimitive() || String.class.isAssignableFrom(type) || Number.class.isAssignableFrom(type) || Boolean.class.isAssignableFrom(type); } private static Boolean[] booleanArray( List list ) { diff --git a/src/test/java/org/neo4j/rest/graphdb/RestTestBase.java b/src/test/java/org/neo4j/rest/graphdb/RestTestBase.java index 4ec7b03..79eefb7 100644 --- a/src/test/java/org/neo4j/rest/graphdb/RestTestBase.java +++ b/src/test/java/org/neo4j/rest/graphdb/RestTestBase.java @@ -10,7 +10,6 @@ import org.neo4j.graphdb.Node; import org.neo4j.graphdb.Relationship; -import java.net.URI; import java.net.URISyntaxException; import java.util.Iterator; @@ -18,7 +17,7 @@ public class RestTestBase { private GraphDatabaseService restGraphDb; private static final String HOSTNAME = "localhost"; - private static final int PORT = 7474; + private static final int PORT = 7473; private static LocalTestServer neoServer = new LocalTestServer(HOSTNAME,PORT).withPropertiesFile("neo4j-server.properties"); private static final String SERVER_ROOT_URI = "http://" + HOSTNAME + ":" + PORT + "/db/data/"; private static final String SERVER_CLEANDB_URI = "http://" + HOSTNAME + ":" + PORT + "/cleandb/secret-key";