poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julio.F...@VerizonWireless.com
Subject RE: Unable to read entire block
Date Mon, 11 Aug 2003 12:38:17 GMT
Thanks for your reply.
I'm using the latest released version 1.5.1 Final.
If this was a problem fixed by a 'pre-release' version I am willing to use
that version.
I don't think that I am hitting a concurrency bug because only 1 process is
reading the file at a time.
My application flow is as follows:
1) Users logs onto the web site
2) User select some values and select an Excel file to upload
3) File is uploaded (using Struts tags) to the UNIX web server
4) After file is uploaded successfully another process is informed that it
must process the file
5) The other process attempts to read the file using POI and processes the
input.

The reading of the file is accomplished using the event driven routine from
my previous email.
The 'Unable to read entire block' error occurs on the read.
The odd part is that the same Excel file is process without any errors on a
Windows system but not on the UNIX system.
Again any help you be appreciated.

Julio

-----Original Message-----
From: Andrew C. Oliver [mailto:acoliver@apache.org]
Sent: Friday, August 08, 2003 4:18 PM
To: POI Users List
Subject: Re: Unable to read entire block


What version is this?  I think you're hitting the concurrency bug.  This is
fixed in 2.0pre3.  We would do a 1.52 but we're so close to release time
that it seems silly to do so.

I've patched this for 2 client thus far by grabbing the 1_5 branch and
replacing LittleEndian roughly with the one from the 2_0 branch.

Theoretically this could also be a really slow filesystem (NFS)...

-andy

On 8/8/03 2:44 PM, "Julio.Font@VerizonWireless.com"
<Julio.Font@VerizonWireless.com> wrote:

> Hello,
> I am trying to use POI to read the an Excel spreadsheet on a UNIX system.
> The following code works fine when run on Windows but when run on UNIX I
> receive an error.
> As a test I read the same file on both system. To get the file to the UNIX
> system I ftp it in binary format from the Windows system.
> The error I receive is :
> "Unable to read entire block; 88 bytes read; expected 512 bytes
> at org.apache.poi.poifs.storage.RawDataBlock.<init>(RawDataBlock.java:98)
> at
>
org.apache.poi.poifs.storage.RawDataBlockList.<ini>(RawDataBlockList.java:88
> )
> at
>
org.apache.poi.poifs.filesstem.POIFSFileSystem.<init>(POIFSFileSystem.java:1
> 23)
> ...
> 
> Code follows:
> 
> public Collection readFile(String iFileName) throws IOException
> {
>   // create a new file input stream with the input file specified by param
> iFileName
>   FileInputStream fin = new FileInputStream(iFileName);
> 
>   // create a new org.apache.poi.poifs.filesystem.Filesystem
>   POIFSFileSystem poifs = new POIFSFileSystem(fin);
> 
>   // get the Workbook (excel part) stream in a InputStream
>   InputStream din = poifs.createDocumentInputStream("Workbook");
> 
>   // construct out HSSFRequest object
>   HSSFRequest req = new HSSFRequest();
> 
>   // lazy listen for ALL records with the listener shown above
>   req.addListenerForAllRecords(this);
> 
>   // create our event factory
>   HSSFEventFactory factory = new HSSFEventFactory();
> 
>   // process events based on the document input stream
>   factory.processEvents(req, din);
> 
>   // once all the events are processed close file input stream
>   fin.close();
> 
>   // close document input stream
>   din.close();
> 
>   return returnCol;
> }
> 
> I also tried using the BufferedInputStream as suggested in the mail
archives
> but t does not find the file.
>   POIFSFileSystem poifs = null;
>   InputStream excel = getClass().getResourceAsStream(iFileName);
>   if (excel != null) {
>     try {
>       poifs = new POIFSFileSystem(new BufferedInputStream(excel));
>     } catch (IOException e) {
>       e.printStackTrace();
>       throw e;
>     }
>   }
>   else {
>     throw new IOException("Exception: could not read
> inputfile:"+iFileName);
>   }
> 
> Any help would be MUCH APPRECIATED!!!!!
> 
> Thanks,
> Julio
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
> The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/
> 

-- 
Andrew C. Oliver
http://www.superlinksoftware.com/poi.jsp
Custom enhancements and Commercial Implementation for Jakarta POI

http://jakarta.apache.org/poi
For Java and Excel, Got POI?


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


Mime
View raw message