Skip to content

Commit

Permalink
illegal global id should yield illegal argument exception
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiayu Liu authored and dminkovsky committed Oct 26, 2016
1 parent 7b87d54 commit 662ec10
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/java/graphql/relay/Relay.java
Expand Up @@ -212,6 +212,9 @@ public String toGlobalId(String type, String id) {

public ResolvedGlobalId fromGlobalId(String globalId) {
String[] split = Base64.fromBase64(globalId).split(":", 2);
if (split.length != 2) {
throw new IllegalArgumentException(String.format("expecting a valid global id, got %s", globalId));
}
return new ResolvedGlobalId(split[0], split[1]);
}
}

0 comments on commit 662ec10

Please sign in to comment.