Skip to content

Commit

Permalink
Merge pull request #120 from pjfanning/poi-3.17
Browse files Browse the repository at this point in the history
poi 3.17
  • Loading branch information
monitorjbl authored Dec 1, 2017
2 parents 3e0ff13 + c0c53c9 commit 033e9c1
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 41 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.16</version>
<version>3.17</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
Expand All @@ -139,7 +139,7 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.8.8</version>
<version>2.8.10</version>
</dependency>

<dependency>
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/monitorjbl/xlsx/StreamingReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.util.StaxHelper;
import org.apache.poi.xssf.eventusermodel.XSSFReader;
import org.apache.poi.xssf.model.SharedStringsTable;
import org.apache.poi.xssf.model.StylesTable;
Expand All @@ -24,7 +25,6 @@
import org.w3c.dom.NodeList;

import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamException;
import java.io.File;
import java.io.FileOutputStream;
Expand Down Expand Up @@ -358,7 +358,7 @@ public StreamingReader read(File f) {
throw new MissingSheetException("Unable to find sheet at index [" + sheetIndex + "]");
}

XMLEventReader parser = XMLInputFactory.newInstance().createXMLEventReader(sheet);
XMLEventReader parser = StaxHelper.newXMLInputFactory().createXMLEventReader(sheet);

return new StreamingReader(new StreamingWorkbookReader(sst, sstCache, pkg, new StreamingSheetReader(sst, styles, parser, use1904Dates, rowCacheSize),
this));
Expand Down
16 changes: 0 additions & 16 deletions src/main/java/com/monitorjbl/xlsx/impl/StreamingSheet.java
Original file line number Diff line number Diff line change
Expand Up @@ -544,14 +544,6 @@ public boolean getScenarioProtect() {
throw new UnsupportedOperationException();
}

/**
* Not supported
*/
@Override
public void setZoom(int numerator, int denominator) {
throw new UnsupportedOperationException();
}

/**
* Not supported
*/
Expand Down Expand Up @@ -816,14 +808,6 @@ public void autoSizeColumn(int column, boolean useMergedCells) {
throw new UnsupportedOperationException();
}

/**
* Not supported
*/
@Override
public Comment getCellComment(int row, int column) {
throw new UnsupportedOperationException();
}

/**
* Not supported
*/
Expand Down
8 changes: 0 additions & 8 deletions src/main/java/com/monitorjbl/xlsx/impl/StreamingWorkbook.java
Original file line number Diff line number Diff line change
Expand Up @@ -231,14 +231,6 @@ public Font createFont() {
throw new UnsupportedOperationException();
}

/**
* Not supported
*/
@Override
public Font findFont(short boldWeight, short color, short fontHeight, String name, boolean italic, boolean strikeout, short typeOffset, byte underline) {
throw new UnsupportedOperationException();
}

/**
* Not supported
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.apache.poi.poifs.crypt.EncryptionInfo;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.util.StaxHelper;
import org.apache.poi.xssf.eventusermodel.XSSFReader;
import org.apache.poi.xssf.eventusermodel.XSSFReader.SheetIterator;
import org.apache.poi.xssf.model.SharedStringsTable;
Expand All @@ -21,7 +22,6 @@
import org.w3c.dom.NodeList;

import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamException;
import java.io.File;
import java.io.FileOutputStream;
Expand Down Expand Up @@ -156,7 +156,7 @@ void loadSheets(XSSFReader reader, SharedStringsTable sst, StylesTable stylesTab
//Iterate over the loaded streams
int i = 0;
for(URI uri : sheetStreams.keySet()) {
XMLEventReader parser = XMLInputFactory.newInstance().createXMLEventReader(sheetStreams.get(uri));
XMLEventReader parser = StaxHelper.newXMLInputFactory().createXMLEventReader(sheetStreams.get(uri));
sheets.add(new StreamingSheet(sheetProperties.get(i++).get("name"), new StreamingSheetReader(sst, stylesTable, parser, use1904Dates, rowCacheSize)));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.util.StaxHelper;
import org.apache.poi.xssf.model.SharedStringsTable;
import org.apache.poi.xssf.usermodel.XSSFRelation;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRst;

import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.XMLEvent;
import java.io.File;
Expand All @@ -33,8 +33,7 @@ private BufferedStringsTable(PackagePart part, File file, int cacheSize) throws
@Override
public void readFrom(InputStream is) throws IOException {
try {
XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();
XMLEventReader xmlEventReader = xmlInputFactory.createXMLEventReader(is);
XMLEventReader xmlEventReader = StaxHelper.newXMLInputFactory().createXMLEventReader(is);

while(xmlEventReader.hasNext()) {
XMLEvent xmlEvent = xmlEventReader.nextEvent();
Expand Down
11 changes: 3 additions & 8 deletions src/test/java/com/monitorjbl/xlsx/StreamingWorkbookTest.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package com.monitorjbl.xlsx;

import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.*;
import org.junit.BeforeClass;
import org.junit.Test;

Expand All @@ -13,8 +10,6 @@
import java.util.Iterator;
import java.util.Locale;

import static org.apache.poi.ss.usermodel.Cell.CELL_TYPE_FORMULA;
import static org.apache.poi.ss.usermodel.Cell.CELL_TYPE_NUMERIC;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
Expand Down Expand Up @@ -98,8 +93,8 @@ public void testFormulaCells() throws Exception {
Row row3 = rowIterator.next();
Cell A3 = row3.getCell(0);

assertEquals("Cell A3 should be of type formula", CELL_TYPE_FORMULA, A3.getCellType());
assertEquals("Cell A3's value should be of type numeric", CELL_TYPE_NUMERIC, A3.getCachedFormulaResultType());
assertEquals("Cell A3 should be of type formula", CellType.FORMULA, A3.getCellTypeEnum());
assertEquals("Cell A3's value should be of type numeric", CellType.NUMERIC, A3.getCachedFormulaResultTypeEnum());
assertEquals("Wrong formula", "SUM(A1:A2)", A3.getCellFormula());
}
}
Expand Down

0 comments on commit 033e9c1

Please sign in to comment.