poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andresfr84 <andresf...@gmail.com>
Subject xwpfdocument gets corrupted after several "open-write" iterations
Date Tue, 14 Jan 2014 16:31:02 GMT
Hello,
  first of all, sorry about my english. I hope someone could know if there
is any problem with my code or it's a problem with poi library. I'm using
poi 3.9.

The fact is this:

1.- I read a file with XWPFDocument:

     File docFile = null;
		     docFile = new File(fileUrl);
		     FileInputStream fis;
			try {
				fis = new FileInputStream(docFile.getAbsolutePath());
				XWPFDocument doc = new XWPFDocument(fis);

2.- I do some operations, but I've tried the code withour any code here, so
I'll pass.

3.- I write the file into disk:

       FileOutputStream out = new FileOutputStream(outFile);
				 doc.write(out);
				 out.close();

The size of the document get's changed, but this doesn't worry me. The
problem is that after several modifications, the size of it are increased
each time. At about 14 or 15 "open-close" iterations, the file stucks in
this line:

      XWPFDocument doc = new XWPFDocument(fis);

It takes 100% cpu and 100% of available Java memory, until out of memory
error is thrown. I think poi modifies the internal structure adding some
things to it. If I open the file with Word, and save it, it turns to the
beginning state, all ok, but I need to get it modified automatically a lot
of times.

Anyone has faced something similar?





--
View this message in context: http://apache-poi.1045710.n5.nabble.com/xwpfdocument-gets-corrupted-after-several-open-write-iterations-tp5714635.html
Sent from the POI - Dev mailing list archive at Nabble.com.

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


Mime
View raw message