diff options
Diffstat (limited to 'src/ooxml/java/org/apache/poi/xssf/eventusermodel')
3 files changed, 15 insertions, 15 deletions
diff --git a/src/ooxml/java/org/apache/poi/xssf/eventusermodel/XSSFBReader.java b/src/ooxml/java/org/apache/poi/xssf/eventusermodel/XSSFBReader.java index b1d7700082..6d4c2eb0b3 100644 --- a/src/ooxml/java/org/apache/poi/xssf/eventusermodel/XSSFBReader.java +++ b/src/ooxml/java/org/apache/poi/xssf/eventusermodel/XSSFBReader.java @@ -28,6 +28,8 @@ import java.util.List; import java.util.Set; import com.zaxxer.sparsebits.SparseBitSet; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import org.apache.poi.openxml4j.exceptions.OpenXML4JException; import org.apache.poi.openxml4j.opc.OPCPackage; @@ -38,8 +40,6 @@ import org.apache.poi.openxml4j.opc.PackageRelationshipCollection; import org.apache.poi.openxml4j.opc.PackagingURIHelper; import org.apache.poi.util.LittleEndian; import org.apache.poi.util.LittleEndianConsts; -import org.apache.poi.util.POILogFactory; -import org.apache.poi.util.POILogger; import org.apache.poi.xssf.binary.XSSFBCommentsTable; import org.apache.poi.xssf.binary.XSSFBParseException; import org.apache.poi.xssf.binary.XSSFBParser; @@ -57,7 +57,7 @@ import org.apache.poi.xssf.usermodel.XSSFRelation; */ public class XSSFBReader extends XSSFReader { - private static final POILogger log = POILogFactory.getLogger(XSSFBReader.class); + private static final Logger LOGGER = LogManager.getLogger(XSSFBReader.class); private static final Set<String> WORKSHEET_RELS = Collections.unmodifiableSet(new HashSet<>( Arrays.asList(new String[]{ @@ -224,7 +224,7 @@ public class XSSFBReader extends XSSFReader { tryToAddWorksheet(data); } catch (XSSFBParseException e) { if (tryOldFormat(data)) { - log.log(POILogger.WARN, "This file was written with a beta version of Excel. "+ + LOGGER.atWarn().log("This file was written with a beta version of Excel. "+ "POI will try to parse the file as a regular xlsb."); } else { throw e; diff --git a/src/ooxml/java/org/apache/poi/xssf/eventusermodel/XSSFReader.java b/src/ooxml/java/org/apache/poi/xssf/eventusermodel/XSSFReader.java index 58dc00a5b0..d31c489e81 100644 --- a/src/ooxml/java/org/apache/poi/xssf/eventusermodel/XSSFReader.java +++ b/src/ooxml/java/org/apache/poi/xssf/eventusermodel/XSSFReader.java @@ -31,6 +31,8 @@ import java.util.Set; import javax.xml.parsers.ParserConfigurationException; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.apache.poi.ooxml.POIXMLException; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import org.apache.poi.openxml4j.exceptions.OpenXML4JException; @@ -41,8 +43,6 @@ import org.apache.poi.openxml4j.opc.PackageRelationship; import org.apache.poi.openxml4j.opc.PackageRelationshipCollection; import org.apache.poi.openxml4j.opc.PackageRelationshipTypes; import org.apache.poi.openxml4j.opc.PackagingURIHelper; -import org.apache.poi.util.POILogFactory; -import org.apache.poi.util.POILogger; import org.apache.poi.util.XMLHelper; import org.apache.poi.xssf.model.CommentsTable; import org.apache.poi.xssf.model.SharedStringsTable; @@ -73,7 +73,7 @@ public class XSSFReader { XSSFRelation.CHARTSHEET.getRelation(), XSSFRelation.MACRO_SHEET_BIN.getRelation()) )); - private static final POILogger LOGGER = POILogFactory.getLogger(XSSFReader.class); + private static final Logger LOGGER = LogManager.getLogger(XSSFReader.class); protected OPCPackage pkg; protected PackagePart workbookPart; @@ -356,7 +356,7 @@ public class XSSFReader { return parseComments(commentsPart); } } catch (InvalidFormatException|IOException e) { - LOGGER.log(POILogger.WARN, e); + LOGGER.atWarn().withThrowable(e).log("Failed to load sheet comments"); return null; } return null; @@ -383,14 +383,14 @@ public class XSSFReader { PackagePart drawingsPart = sheetPkg.getPackage().getPart(drawingsName); if (drawingsPart == null) { //parts can go missing; Excel ignores them silently -- TIKA-2134 - LOGGER.log(POILogger.WARN, "Missing drawing: " + drawingsName + ". Skipping it."); + LOGGER.atWarn().log("Missing drawing: {}. Skipping it.", drawingsName); continue; } XSSFDrawing drawing = new XSSFDrawing(drawingsPart); shapes.addAll(drawing.getShapes()); } } catch (XmlException|InvalidFormatException|IOException e) { - LOGGER.log(POILogger.WARN, e); + LOGGER.atWarn().withThrowable(e).log("Failed to load shapes"); return null; } return shapes; diff --git a/src/ooxml/java/org/apache/poi/xssf/eventusermodel/XSSFSheetXMLHandler.java b/src/ooxml/java/org/apache/poi/xssf/eventusermodel/XSSFSheetXMLHandler.java index 302f22f89d..1cbb4d4fc3 100644 --- a/src/ooxml/java/org/apache/poi/xssf/eventusermodel/XSSFSheetXMLHandler.java +++ b/src/ooxml/java/org/apache/poi/xssf/eventusermodel/XSSFSheetXMLHandler.java @@ -22,12 +22,12 @@ import java.util.Iterator; import java.util.LinkedList; import java.util.Queue; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.apache.poi.ss.usermodel.BuiltinFormats; import org.apache.poi.ss.usermodel.DataFormatter; import org.apache.poi.ss.usermodel.RichTextString; import org.apache.poi.ss.util.CellAddress; -import org.apache.poi.util.POILogFactory; -import org.apache.poi.util.POILogger; import org.apache.poi.xssf.model.*; import org.apache.poi.xssf.usermodel.XSSFCellStyle; import org.apache.poi.xssf.usermodel.XSSFComment; @@ -48,7 +48,7 @@ import org.xml.sax.helpers.DefaultHandler; * you need to implement for reading information from a file. */ public class XSSFSheetXMLHandler extends DefaultHandler { - private static final POILogger LOG = POILogFactory.getLogger(XSSFSheetXMLHandler.class); + private static final Logger LOG = LogManager.getLogger(XSSFSheetXMLHandler.class); /** * These are the different kinds of cells we support. @@ -235,7 +235,7 @@ public class XSSFSheetXMLHandler extends DefaultHandler { // TODO Retrieve the shared formula and tweak it to // match the current cell if(formulasNotResults) { - LOG.log(POILogger.WARN, "shared formulas not yet supported!"); + LOG.atWarn().log("shared formulas not yet supported!"); } /*else { // It's a shared formula, so we can't get at the formula string yet // However, they don't care about the formula string, so that's ok! @@ -418,7 +418,7 @@ public class XSSFSheetXMLHandler extends DefaultHandler { thisStr = rtss.toString(); } catch (NumberFormatException ex) { - LOG.log(POILogger.ERROR, "Failed to parse SST index '", sstIndex, ex); + LOG.atError().withThrowable(ex).log("Failed to parse SST index '{}'", sstIndex); } break; |