Skip to content

Commit

Permalink
fix(jans-core): db document Store fixes #5619 (#5620)
Browse files Browse the repository at this point in the history
  • Loading branch information
shekhar16 authored Jul 24, 2023
1 parent 897d45f commit 1bdbbd5
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ public boolean hasDocument(String DisplayName) {
Document oxDocument = null;
try {
oxDocument = documentService.getDocumentByDisplayName(DisplayName);
if(oxDocument != null) {
return true;
}
} catch (Exception e) {
log.error("Failed to check if path '" + DisplayName + "' exists in repository", e);
}
Expand Down Expand Up @@ -115,7 +118,7 @@ public boolean saveDocumentStream(String name, InputStream documentStream, List
oxDocument.setDisplayName(name);

try {
String documentContent = Base64.getEncoder().encodeToString(IOUtils.toByteArray(documentStream));
String documentContent = new String(documentStream.readAllBytes(), StandardCharsets.UTF_8);
oxDocument.setDocument(documentContent);
String inum = documentService.generateInumForNewDocument();
oxDocument.setInum(inum);
Expand Down Expand Up @@ -158,7 +161,7 @@ public InputStream readDocumentAsStream(String name) {
return null;
}

InputStream InputStream = new ByteArrayInputStream(Base64.getDecoder().decode(filecontecnt));
InputStream InputStream = new ByteArrayInputStream(filecontecnt.getBytes());
return InputStream;
}

Expand Down

0 comments on commit 1bdbbd5

Please sign in to comment.