https://bz.apache.org/bugzilla/show_bug.cgi?id=65396

            Bug ID: 65396
           Summary: WorkbookFactory.create bugs on Tomcat
           Product: POI
           Version: 5.0.0-FINAL
          Hardware: PC
            Status: NEW
          Severity: blocker
          Priority: P2
         Component: POI Overall
          Assignee: dev@poi.apache.org
          Reporter: monnomiznog...@gmail.com
  Target Milestone: ---

Hi,

WorkbookFactory.create (POI 5.0.0) has a weird behavior when executed on a
running Tomcat server (8.0.28, with jdk 8.0.251):

XSSFWorkbook wb = new XSSFWorkbook(new File("c:/temp/test.xlsx"));
//The following finds and prints the sheet in a standalone java application,
null in Tomcat
System.out.println(wb.getSheet("mysheet"));
//The following prints the sheet's name (mysheet) in a standalone java
application, null in Tomcat (but finds the sheet alright)
System.out.println(wb.getSheetAt(0).getSheetName());

I've spent a few hours trying to find out why, and I failed.

Any help ?

I've reverted to my old POI3 code to open the file and find the sheet:

      OPCPackage p = OPCPackage.open(in);
      XSSFReader xssfReader = new XSSFReader(p);
      this.sharedStringsTable = xssfReader.getSharedStringsTable();
      this.stylesTable = xssfReader.getStylesTable(); 
      XSSFReader.SheetIterator iter = (XSSFReader.SheetIterator)
xssfReader.getSheetsData();
      while (iter.hasNext())
      {
        InputStream stream = iter.next();
        if (this.queriedSheetName == null ||
this.queriedSheetName.equals(iter.getSheetName()))
        {
          this.nextDataType = xssfDataType.NUMBER;
          this.formatter = new DataFormatter();
          InputSource sheetSource = new InputSource(stream);
          SAXParserFactory saxFactory = SAXParserFactory.newInstance();
          SAXParser saxParser = saxFactory.newSAXParser();
          XMLReader sheetParser = saxParser.getXMLReader();
          sheetParser.setContentHandler(this);
          sheetParser.parse(sheetSource);
          break;
        }
      }

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org

Reply via email to