Skip to content

Commit

Permalink
fixed error in data import method when the backup zip contains binary…
Browse files Browse the repository at this point in the history
… files
  • Loading branch information
albogdano committed Mar 12, 2021
1 parent aef8480 commit b5aab73
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions para-server/src/main/java/com/erudika/para/rest/Api1.java
Original file line number Diff line number Diff line change
Expand Up @@ -1038,17 +1038,19 @@ public Response apply(ContainerRequestContext ctx) {
ZipEntry zipEntry;
List<ParaObject> toCreate = new LinkedList<ParaObject>();
while ((zipEntry = zipIn.getNextEntry()) != null) {
List<Map<String, Object>> objects = reader.readValue(new FilterInputStream(zipIn) {
public void close() throws IOException {
zipIn.closeEntry();
if (zipEntry.getName().endsWith(".json")) {
List<Map<String, Object>> objects = reader.readValue(new FilterInputStream(zipIn) {
public void close() throws IOException {
zipIn.closeEntry();
}
});
objects.forEach(o -> toCreate.add(ParaObjectUtils.setAnnotatedFields(o)));
if (toCreate.size() >= importBatchSize) {
getDAO().createAll(app.getAppIdentifier(), toCreate);
toCreate.clear();
}
});
objects.forEach(o -> toCreate.add(ParaObjectUtils.setAnnotatedFields(o)));
if (toCreate.size() >= importBatchSize) {
getDAO().createAll(app.getAppIdentifier(), toCreate);
toCreate.clear();
count += objects.size();
}
count += objects.size();
}
if (!toCreate.isEmpty()) {
getDAO().createAll(app.getAppIdentifier(), toCreate);
Expand Down

0 comments on commit b5aab73

Please sign in to comment.