You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Christian Junker <Ch...@informi.dk> on 2009/03/03 15:14:54 UTC

block[ 0 ] already removed - does your POIFS have circular or duplicate block references?

I can't get POI to open this   http://sik.dk/var/storage/elinstallatoerregister.xls
Tried different versions. Latest 3.5 beta 5.
Excel can open the file.
Is there any way I can get POI to open this?


java.io.IOException: block[ 0 ] already removed - does your POIFS have circular or duplicate block references?
	at org.apache.poi.poifs.storage.BlockListImpl.remove(BlockListImpl.java:97)
	at org.apache.poi.poifs.storage.BlockAllocationTableReader.fetchBlocks(BlockAllocationTableReader.java:196)
	at org.apache.poi.poifs.storage.BlockListImpl.fetchBlocks(BlockListImpl.java:132)
	at org.apache.poi.poifs.filesystem.POIFSFileSystem.processProperties(POIFSFileSystem.java:538)
	at org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSystem.java:176)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:317)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:298)
	at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:59)
	at dk.scoutconsult.sik.hssf.ImportInstallatoer.main(ImportInstallatoer.java:12)



	public static void main(String[] args) {
		try {
			URL url = new URL("http://sik.dk/var/storage/elinstallatoerregister.xls");
			InputStream is = url.openConnection().getInputStream();
			org.apache.poi.ss.usermodel.Workbook wb = org.apache.poi.ss.usermodel.WorkbookFactory.create(is);
		}
		catch (Exception ex){
			ex.printStackTrace();
		}
	}

Christian S. Junker
Service Konsulent
christianj@informi.dk
Mob:   +45 61 61 11 44 
............................................
Informi GIS A/S, Hovedkontor 
Jægersborg Allé 4, DK-2920 Charlottenlund
tlf. +45 39 96 59 00, fax. +45 39 96 59 34, http://www.informi.dk

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


Re: block[ 0 ] already removed - does your POIFS have circular or duplicate block references?

Posted by Yegor Kozlov <ye...@dinom.ru>.
A similar problem has been recently reported:
https://issues.apache.org/bugzilla/show_bug.cgi?id=46391 
<ci...@dinom.ru>

Evidently, we have a bug in POIFS but I'm not sure how soon it will be 
fixed.

Yegor
> I can't get POI to open this   http://sik.dk/var/storage/elinstallatoerregister.xls
> Tried different versions. Latest 3.5 beta 5.
> Excel can open the file.
> Is there any way I can get POI to open this?
>
>
> java.io.IOException: block[ 0 ] already removed - does your POIFS have circular or duplicate block references?
> 	at org.apache.poi.poifs.storage.BlockListImpl.remove(BlockListImpl.java:97)
> 	at org.apache.poi.poifs.storage.BlockAllocationTableReader.fetchBlocks(BlockAllocationTableReader.java:196)
> 	at org.apache.poi.poifs.storage.BlockListImpl.fetchBlocks(BlockListImpl.java:132)
> 	at org.apache.poi.poifs.filesystem.POIFSFileSystem.processProperties(POIFSFileSystem.java:538)
> 	at org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSystem.java:176)
> 	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:317)
> 	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:298)
> 	at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:59)
> 	at dk.scoutconsult.sik.hssf.ImportInstallatoer.main(ImportInstallatoer.java:12)
>
>
>
> 	public static void main(String[] args) {
> 		try {
> 			URL url = new URL("http://sik.dk/var/storage/elinstallatoerregister.xls");
> 			InputStream is = url.openConnection().getInputStream();
> 			org.apache.poi.ss.usermodel.Workbook wb = org.apache.poi.ss.usermodel.WorkbookFactory.create(is);
> 		}
> 		catch (Exception ex){
> 			ex.printStackTrace();
> 		}
> 	}
>
> Christian S. Junker
> Service Konsulent
> christianj@informi.dk
> Mob:   +45 61 61 11 44 
> ............................................
> Informi GIS A/S, Hovedkontor 
> Jægersborg Allé 4, DK-2920 Charlottenlund
> tlf. +45 39 96 59 00, fax. +45 39 96 59 34, http://www.informi.dk
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
>
>   


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


Re: block[ 0 ] already removed - does your POIFS have circular or duplicate block references?

Posted by paulchen <pa...@alumni.nd.edu>.

Christian Junker-2 wrote:
> 
> I can't get POI to open this  
> http://sik.dk/var/storage/elinstallatoerregister.xls
> Tried different versions. Latest 3.5 beta 5.
> Excel can open the file.
> Is there any way I can get POI to open this?
> 
> java.io.IOException: block[ 0 ] already removed - does your POIFS have
> circular or duplicate block references?
> 	at
> org.apache.poi.poifs.storage.BlockListImpl.remove(BlockListImpl.java:97)
> 


I ran into the same stacktrace while attempting to use Java libraries (poi
and jexcelapi) to read Microsoft Excel files.  In my case, the Excel file I
am trying to read is generated using PERL's Spreadsheet::WriteExcel library. 
I discovered the "compatibility_mode" method and asked the author of the
script to call this method after the workbook was created.

See:
http://search.cpan.org/dist/Spreadsheet-WriteExcel/lib/Spreadsheet/WriteExcel.pm#compatibility_mode()

This fixed the problem for me.

Regards,
Paul
-- 
View this message in context: http://www.nabble.com/block--0---already-removed---does-your-POIFS-have-circular-or-duplicate-block-references--tp22309395p23817464.html
Sent from the POI - User mailing list archive at Nabble.com.


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