Skip to content

Commit

Permalink
HZN-826: Handle attribute type of key is null properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus von Rüden committed Jun 29, 2016
1 parent 2d5047d commit 059039f
Showing 1 changed file with 7 additions and 0 deletions.
Expand Up @@ -30,6 +30,7 @@

import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
Expand Down Expand Up @@ -168,6 +169,12 @@ private static void addProperties(GraphMLElement graphElement, String elementId,
if (keyType == null) {
throw new InvalidGraphException("Accessing not existing attribute with key " + eachDataElement.getKey());
}
if (keyType.getAttrType() == null) {
throw new InvalidGraphException("Key with id='" + keyType.getId() + "' and " +
"attribute name '" + keyType.getAttrName() + "' is null. " +
"This is usually caused by an invalid attribute type value. " +
"The following values are supported: " + Arrays.stream(KeyTypeType.values()).map(k -> k.value()).collect(Collectors.joining(", ")));
}
Object value = typeCastValue(eachDataElement.getContent(), keyType.getAttrType());
graphElement.setProperty(keyType.getAttrName(), value);
}
Expand Down

0 comments on commit 059039f

Please sign in to comment.