X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.cms.jcr%2Fsrc%2Forg%2Fargeo%2Fcms%2Fjcr%2Facr%2FJcrContent.java;h=30590640e05cc6a29b43f5b22eeeb90863a2b7a5;hb=ceee6c4ebe8e30e19cf3a1cdae3267cbd8840d62;hp=a4af35bc671437ad6b3d9d587817181a9ab7a480;hpb=a41a816bceaef9765525638432e92ed91fa4a28a;p=gpl%2Fargeo-jcr.git diff --git a/org.argeo.cms.jcr/src/org/argeo/cms/jcr/acr/JcrContent.java b/org.argeo.cms.jcr/src/org/argeo/cms/jcr/acr/JcrContent.java index a4af35b..3059064 100644 --- a/org.argeo.cms.jcr/src/org/argeo/cms/jcr/acr/JcrContent.java +++ b/org.argeo.cms.jcr/src/org/argeo/cms/jcr/acr/JcrContent.java @@ -257,12 +257,20 @@ public class JcrContent extends AbstractContent { public A adapt(Class clss) { if (Source.class.isAssignableFrom(clss)) { // try { - PipedInputStream in = new PipedInputStream(); + PipedOutputStream out = new PipedOutputStream(); + PipedInputStream in; + try { + in = new PipedInputStream(out); + } catch (IOException e) { + throw new RuntimeException("Cannot export " + jcrPath + " in workspace " + jcrWorkspace, e); + } ForkJoinPool.commonPool().execute(() -> { - try (PipedOutputStream out = new PipedOutputStream(in)) { +// try (PipedOutputStream out = new PipedOutputStream(in)) { + try { provider.getJcrSession(getSession(), jcrWorkspace).exportDocumentView(jcrPath, out, true, false); out.flush(); + out.close(); } catch (IOException | RepositoryException e) { throw new RuntimeException("Cannot export " + jcrPath + " in workspace " + jcrWorkspace, e); }