VIVO-719 Fix an error in the JSON parsing.
This commit is contained in:
parent
aa1df06ac2
commit
c05a3a857a
2 changed files with 1748 additions and 1 deletions
|
@ -75,9 +75,10 @@ public class JsonToNquads extends OutputStream {
|
||||||
String text = buffer.toString("UTF-8");
|
String text = buffer.toString("UTF-8");
|
||||||
boolean inQuotes = false;
|
boolean inQuotes = false;
|
||||||
int braceLevel = 0;
|
int braceLevel = 0;
|
||||||
|
char previous = 0;
|
||||||
for (char c : text.toCharArray()) {
|
for (char c : text.toCharArray()) {
|
||||||
if (inQuotes) {
|
if (inQuotes) {
|
||||||
if (c == '"') {
|
if ((c == '"') && (previous != '\\')) {
|
||||||
inQuotes = false;
|
inQuotes = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -89,6 +90,7 @@ public class JsonToNquads extends OutputStream {
|
||||||
braceLevel--;
|
braceLevel--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
previous = c;
|
||||||
}
|
}
|
||||||
return (braceLevel == 0) && (text.endsWith(",") || text.endsWith("]"));
|
return (braceLevel == 0) && (text.endsWith(",") || text.endsWith("]"));
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue