Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

Commit

Permalink
added correct check for nested array types and changed test port to 7473
Browse files Browse the repository at this point in the history
  • Loading branch information
jexp committed Nov 5, 2011
1 parent 6860bcf commit 021fff9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
19 changes: 10 additions & 9 deletions src/main/java/org/neo4j/rest/graphdb/PropertiesMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<? extends Object> type) {
return type.isPrimitive() || String.class.isAssignableFrom(type) || Number.class.isAssignableFrom(type) || Boolean.class.isAssignableFrom(type);
}

private static Boolean[] booleanArray( List<Boolean> list ) {
Expand Down
3 changes: 1 addition & 2 deletions src/test/java/org/neo4j/rest/graphdb/RestTestBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.Relationship;

import java.net.URI;
import java.net.URISyntaxException;
import java.util.Iterator;

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";
Expand Down

0 comments on commit 021fff9

Please sign in to comment.