0

I know there is a bug , so I read many work around methods and it appears that the most popular is to start a new instance of FileInputStream

So I tried

for (int i = 0 ; i < 2 ; i ++) {

FileInputStream out = new FileInputStream ( new File ( "  C:\\  .xlsx ") ) ;  // new 

....

out close(); //make sure to get rid of it

}

However, this still throws this exception


There is a patch for on this page

if (prev != null) {
   /*CTRow ctRow = prev.getCTRow();
   / ctRow.set(CTRow.Factory.newInstance()); */ <--- to be removed
   Iterator it = prev.iterator();
   while(it.hasNext()) {
      it.next();
      it.remove();
   }

}

But i am not sure how to use it

CHEBURASHKA
  • 1,623
  • 11
  • 53
  • 85
  • If you think you're affected by that bug, then why not upgrade to a newer version of Apache POI that includes the fix to it? – Gagravarr Feb 24 '14 at 12:13
  • Purpose of assigning and closing FileInputStream inside a loop is not clear to me. I mean why you want to do this? If your purpose is to reload the same file multiple times after performing write operation, then you should better use http://stackoverflow.com/a/18262235/624003 – Sankumarsingh Feb 24 '14 at 13:36

0 Answers0