Skip to content

Commit

Permalink
Preliminarily fix JSON parsing issues
Browse files Browse the repository at this point in the history
After upgrading Jackson it serializes byte[] objects with !!binary
tag, resulting in parsing them as VALUE_EMBEDDED_OBJECT's. So, we added
support for these special form of embedded objects, parsing them
just as strings.
  • Loading branch information
mederly committed Jun 21, 2018
1 parent 38ae56a commit fb2adfe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Expand Up @@ -317,6 +317,7 @@ private XNode parseValue(JsonParsingContext ctx, IterativeParsingContext ipc) th
case VALUE_FALSE:
case VALUE_NUMBER_FLOAT:
case VALUE_NUMBER_INT:
case VALUE_EMBEDDED_OBJECT: // assuming it's a scalar value e.g. !!binary (TODO)
return parseToPrimitive(ctx);
case VALUE_NULL:
return parseToEmptyPrimitive();
Expand Down
Expand Up @@ -51,6 +51,7 @@ public class YamlLexicalProcessor extends AbstractJsonLexicalProcessor {
private static final String TAG_INT = YAML + "int";
private static final String TAG_BOOL = YAML + "bool";
private static final String TAG_FLOAT = YAML + "float";
private static final String TAG_BINARY = YAML + "binary"; // base64-encoded string
private static final String TAG_NULL = YAML + "null";

public YamlLexicalProcessor(@NotNull SchemaRegistry schemaRegistry) {
Expand Down Expand Up @@ -126,6 +127,8 @@ protected MidpointYAMLParser createJacksonParser(InputStream stream) throws Sche
protected QName tagToTypeName(Object tag, AbstractJsonLexicalProcessor.JsonParsingContext ctx) throws IOException, SchemaException {
if (tag == null) {
return null;
} if (TAG_BINARY.equals(tag)) {
return DOMUtil.XSD_STRING; // base64-encoded string: we store it as string, leaving interpretation to upper layers
} if (TAG_STRING.equals(tag)) {
return DOMUtil.XSD_STRING;
} else if (TAG_BOOL.equals(tag)) {
Expand Down

0 comments on commit fb2adfe

Please sign in to comment.