Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of GANs in ActionE this week in the AI forum
or WebAssembly in Action in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

Unable to read entire block :202 bytes read;expected 512 bytes

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a big problem, and I am hoping for an easy solution or
workaround.

I am trying to read an excel file using POI 2.0 (used 1.5 also) , but
I get the following
error:

java.lang.Exception: java.io.IOException: Unable to read entire block;
202 bytes read; expected 512 bytes
at csmip.EvpnExcelParser.displayFromExcel(Unknown Source)
at csmip.EvpnExcelParser.importExcel(Unknown Source)
at _jsps._mds._evpn_excel_import_jsp._jspService(_evpn_excel_import_jsp.java:130)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:908)
at com.iplanet.ias.web.jsp.JspServlet$JspServletWrapper.service(JspServlet.java:687)
at com.iplanet.ias.web.jsp.JspServlet.serviceJspFile(JspServlet.java:459)
at com.iplanet.ias.web.jsp.JspServlet.service(JspServlet.java:375)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:908)
at org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:771)
at org.apache.catalina.core.StandardWrapperValve.access$000(StandardWrapperValve.java:118)
at org.apache.catalina.core.StandardWrapperValve$1.run(StandardWrapperValve.java:293)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:289)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:218)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:209)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:157)
at com.iplanet.ias.web.WebContainer.service(WebContainer.java:579)
Caused by: java.io.IOException: Unable to read entire block; 202 bytes
read; expected 512 bytes
at org.apache.poi.poifs.storage.RawDataBlock.(RawDataBlock.java:99)
at org.apache.poi.poifs.storage.RawDataBlockList.(RawDataBlockList.java:88)
at org.apache.poi.poifs.filesystem.POIFSFileSystem.(POIFSFileSystem.java:123)
at csmip.ExcelModifier.openWorkbook(Unknown Source)
... 21 more

It is a web based application where i have to read an excel file.
Please help me as soon as possible,
--

Thanks and Regards
Karthik
 
Sheriff
Posts: 21841
105
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where does class csmip.EvpnExcelParser come from? Is it your own, or did you download it from somewhere?
 
karthik srinivas
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Rob Prime wrote:Where does class csmip.EvpnExcelParser come from? Is it your own, or did you download it from somewhere?



Its my own class.

this is the method used in EVnExcelParser class

public void displayFromExcel (String xlsPath) throws Exception
{
InputStream inputStream = null;

try
{
inputStream = new FileInputStream (xlsPath);
}
catch (FileNotFoundException e)
{
log.out("File not found in the specified path.");
throw new Exception(e);
}

POIFSFileSystem fileSystem = null;

try
{
fileSystem = new POIFSFileSystem (inputStream);

HSSFWorkbook workBook = new HSSFWorkbook (fileSystem);
HSSFSheet sheet = workBook.getSheetAt (0);
HSSFRow row = null;

HSSFCell cell=null;



int rows=sheet.getPhysicalNumberOfRows();
int cols=sheet.getRow(1).getPhysicalNumberOfCells();
 
What's that smell? Hey, sniff this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!