Skip to content

Commit 662ec10

Browse files
Jiayu Liudminkovsky
authored andcommitted
illegal global id should yield illegal argument exception
1 parent 7b87d54 commit 662ec10

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/main/java/graphql/relay/Relay.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,9 @@ public String toGlobalId(String type, String id) {
212212

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

0 commit comments

Comments
 (0)