poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 60102] Unable to write XWPFDocument opened from Http InputStream
Date Sat, 10 Sep 2016 05:51:27 GMT
https://bz.apache.org/bugzilla/show_bug.cgi?id=60102

Javen O'Neal <onealj@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO

--- Comment #1 from Javen O'Neal <onealj@apache.org> ---
I am unable to reproduce this in the latest nightly build of POI (r1755847).

Could you either check this against 3.15-beta2 or later a nightly, or produce a
unit test that produces the error seen in comment 0?
Apache commons collections was recently added as a dependency and will need to
be added to your class path.
https://builds.apache.org/job/POI/lastSuccessfulBuild/artifact/build/dist/

Here's my test case:

@Test
public void test60102() throws Exception {
    // read in from a java.io.File
    //XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("60102.docx");

    // or read in from a java.io.FileInputStream
    File infile = POIDataSamples.getDocumentInstance().getFile("60102.docx");
    InputStream fis = new FileInputStream(infile);
    XWPFDocument doc = new XWPFDocument(fis);

    // Write out to a file
    File outfile = TempFile.createTempFile("60102-resaved", "docx");
    OutputStream fos = new FileOutputStream(outfile);
    doc.write(fos);
    fos.close();

    // Write out to a byte array output stream
    XWPFDocument doc2 = XWPFTestDataSamples.writeOutAndReadBack(doc);
    doc2.close();

    doc.close();
}

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Mime
View raw message