ASF Bugzilla – Attachment 36168 Details for
Bug 62768
OPCPackage#close() method is incorrectly synchronized
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
multi-thread runner
Main.java (text/plain), 2.12 KB, created by
Danila Galimov
on 2018-09-27 17:55:58 UTC
(
hide
)
Description:
multi-thread runner
Filename:
MIME Type:
Creator:
Danila Galimov
Created:
2018-09-27 17:55:58 UTC
Size:
2.12 KB
patch
obsolete
>package org.apache.poi.openxml4j.opc; > >import org.apache.poi.openxml4j.exceptions.InvalidFormatException; >import org.apache.poi.openxml4j.opc.internal.ContentTypeManager; >import org.w3c.dom.Document; > >import java.io.ByteArrayOutputStream; >import java.io.IOException; >import java.io.OutputStream; > >public class Main { > > public static void main(String[] args) throws InvalidFormatException { > ZipPackage zipPackage = new ZipPackage(PackageAccess.READ_WRITE); > > for(int i = 0; i <20; i++) { > new Thread( () -> { > try { > zipPackage.close(); > } catch (IOException e) { > e.printStackTrace(); > } > }).start(); > } > } >} > > class ZipPackage extends OPCPackage { > > /** > * Constructor. > * > * @param access Package access. > */ > ZipPackage(PackageAccess access) throws InvalidFormatException { > super(access); > contentTypeManager = new ContentTypeManager(null, this) { > @Override > public boolean saveImpl(Document content, OutputStream out) { > return false; > } > }; > output = new ByteArrayOutputStream() { > @Override > public void close() { > System.out.println("<<closing" + Thread.currentThread().getId()); > System.out.println(">>closing" + Thread.currentThread().getId()); > } > }; > } > > @Override > protected PackagePart createPartImpl(PackagePartName partName, String contentType, boolean loadRelationships) { > return packageProperties; > } > > @Override > protected void removePartImpl(PackagePartName partName) { > > } > > @Override > protected void flushImpl() { > > } > > @Override > protected void closeImpl() { > } > > @Override > protected void revertImpl() { > > } > > @Override > protected void saveImpl(OutputStream outputStream) { > > } > > @Override > protected PackagePartCollection getPartsImpl() { > return null; > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 62768
: 36168