https://bz.apache.org/bugzilla/show_bug.cgi?id=62967
Bug ID: 62967 Summary: Stream Closed For EncryptionInfo Product: POI Version: unspecified Hardware: PC Status: NEW Severity: normal Priority: P2 Component: POIFS Assignee: dev@poi.apache.org Reporter: yanleich...@vip.163.com Target Milestone: --- When I use the following code(from the official document) ```java POIFSFileSystem fs = new POIFSFileSystem(); EncryptionInfo info = new EncryptionInfo(EncryptionMode.agile); // EncryptionInfo info = new EncryptionInfo(EncryptionMode.agile, CipherAlgorithm.aes192, HashAlgorithm.sha384, -1, -1, null); Encryptor enc = info.getEncryptor(); enc.confirmPassword("foobaa"); // Read in an existing OOXML file and write to encrypted output stream // don't forget to close the output stream otherwise the padding bytes aren't added try (OPCPackage opc = OPCPackage.open(new File("..."), PackageAccess.READ_WRITE); OutputStream os = enc.getDataStream(fs)) { opc.save(os); } // Write out the encrypted version FileOutputStream fos = new FileOutputStream("..."); fs.writeFilesystem(fos); fos.close(); ``` The following error occurred ----- 其他异常 : class java.io.IOException java.io.IOException: Stream Closed at java.io.FileOutputStream.writeBytes(FileOutputStream.java) ~[na:1.8.0_191-1-ojdkbuild] at java.io.FileOutputStream.write(FileOutputStream.java:326) ~[na:1.8.0_191-1-ojdkbuild] at org.apache.poi.poifs.crypt.agile.AgileEncryptor$ChunkedCipherOutputStream.writeChunk(AgileEncryptor.java:330) ~[poi-ooxml-3.10-FINAL.jar:3.10-FINAL] at org.apache.poi.poifs.crypt.agile.AgileEncryptor$ChunkedCipherOutputStream.close(AgileEncryptor.java:337) ~[poi-ooxml-3.10-FINAL.jar:3.10-FINAL] Everything is normal after modification ```java OPCPackage opc = OPCPackage.open(new File(filePath), PackageAccess.READ_WRITE); OutputStream os = enc.getDataStream(fs); opc.save(os); opc.close(); ``` -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org