Uploaded image for project: 'ZK Spreadsheet'
  1. ZK Spreadsheet
  2. ZSS-955

Import empty xls file shouldn't cause Exception

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • 3.7.0
    • None
    • None

      reproduce step: import attached file

       
      org.zkoss.zk.ui.UiException: org.zkoss.poi.hssf.record.RecordInputStream$LeftoverDataException: Initialisation of record 0x896 left 3120 bytes remaining still to be read.
      	at org.zkoss.zul.impl.FileuploadDlg.onClose(FileuploadDlg.java:63)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2736)
      	at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2664)
      	at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:136)
      	at org.zkoss.zk.ui.impl.UiEngineImpl.processEvent(UiEngineImpl.java:1765)
      	at org.zkoss.zk.ui.impl.UiEngineImpl.process(UiEngineImpl.java:1550)
      	at org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1260)
      	at org.zkoss.zk.au.http.DHtmlUpdateServlet.process(DHtmlUpdateServlet.java:611)
      	at org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:485)
      	at org.zkoss.zk.au.http.DHtmlUpdateServlet.doPost(DHtmlUpdateServlet.java:494)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
      	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
      	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:401)
      	at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
      	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
      	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
      	at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
      	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
      	at org.mortbay.jetty.Server.handle(Server.java:326)
      	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
      	at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945)
      	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
      	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
      	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
      	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
      	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
      Caused by: org.zkoss.poi.hssf.record.RecordInputStream$LeftoverDataException: Initialisation of record 0x896 left 3120 bytes remaining still to be read.
      	at org.zkoss.poi.hssf.record.RecordInputStream.hasNextRecord(RecordInputStream.java:156)
      	at org.zkoss.poi.hssf.record.RecordFactoryInputStream.nextRecord(RecordFactoryInputStream.java:231)
      	at org.zkoss.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:485)
      	at org.zkoss.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:295)
      	at org.zkoss.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:258)
      	at org.zkoss.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:202)
      	at org.zkoss.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:339)
      	at org.zkoss.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:320)
      	at org.zkoss.zss.range.impl.imexp.ExcelXlsImporter.createPoiBook(ExcelXlsImporter.java:48)
      	at org.zkoss.zss.range.impl.imexp.AbstractExcelImporter.imports(AbstractExcelImporter.java:123)
      	at org.zkoss.zss.range.impl.imexp.ExcelImportAdapter.imports(ExcelImportAdapter.java:46)
      	at org.zkoss.zss.api.impl.ImporterImpl.imports(ImporterImpl.java:51)
      	at org.zkoss.zss.app.ui.AppCtrl$12.onEvent(AppCtrl.java:426)
      	at org.zkoss.zss.app.ui.AppCtrl$12.onEvent(AppCtrl.java:1)
      	at org.zkoss.zul.impl.FileuploadDlg.onClose(FileuploadDlg.java:61)
      

      debug info

      Workaround

      • open the problematic file in MS Excel, edit an arbitrary cell, save the file. MS Excel will correct the file format
      • save the file as XLSX.

            henrichen henrichen
            JerryChen JerryChen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: