Skip to content

Commit 3feced7

Browse files
Manual cherry-pick unknown error fix
Issue:203613
1 parent 9c9c4e8 commit 3feced7

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

gxoffice/src/main/java/com/genexus/gxoffice/poi/xssf/ExcelDocument.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ public short Open(String fileName) {
3030
if (!template.equals("")) {
3131
GXFile templateFile = new GXFile(template);
3232
if (templateFile.exists()) {
33-
workBook = new XSSFWorkbook(templateFile.getStream());
33+
try (InputStream is = templateFile.getStream()) {
34+
workBook = new XSSFWorkbook(is);
35+
}
3436
} else {
3537
errCod = 4; // Invalid template
3638
errDescription = "Invalid template.";
@@ -39,8 +41,9 @@ public short Open(String fileName) {
3941
} else {
4042
GXFile file = new GXFile("", fileName, Constants.EXTERNAL_UPLOAD_ACL, GxFileInfoSourceType.Unknown);
4143
if (file.exists()) {
42-
// System.out.println("Opening..");
43-
workBook = new XSSFWorkbook(file.getStream());
44+
try (InputStream is = file.getStream()) {
45+
workBook = new XSSFWorkbook(is);
46+
}
4447
} else {
4548
// System.out.println("Creating..");
4649
workBook = new XSSFWorkbook();
@@ -316,4 +319,4 @@ public void setDateFormat(String dFormat) {
316319
public String getDateFormat() {
317320
return dateFormat;
318321
}
319-
}
322+
}

0 commit comments

Comments
 (0)