Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFParser.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFParser.java?rev=1913377&r1=1913376&r2=1913377&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFParser.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFParser.java Fri Oct 27 06:05:21 2023 @@ -20,8 +20,8 @@ import java.io.File; import java.io.IOException; import java.io.InputStream; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; import org.apache.pdfbox.Loader; import org.apache.pdfbox.cos.COSDictionary; import org.apache.pdfbox.cos.COSName; @@ -33,7 +33,7 @@ import org.apache.pdfbox.pdmodel.encrypt public class PDFParser extends COSParser { - private static final Log LOG = LogFactory.getLog(PDFParser.class); + private static final Logger LOG = LogManager.getLogger(PDFParser.class); /** * Constructor.
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java?rev=1913377&r1=1913376&r2=1913377&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java Fri Oct 27 06:05:21 2023 @@ -20,8 +20,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.ArrayList; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; import org.apache.pdfbox.contentstream.PDContentStream; import org.apache.pdfbox.contentstream.operator.Operator; import org.apache.pdfbox.contentstream.operator.OperatorName; @@ -43,7 +43,7 @@ public class PDFStreamParser extends Bas /** * Log instance. */ - private static final Log LOG = LogFactory.getLog(PDFStreamParser.class); + private static final Logger LOG = LogManager.getLogger(PDFStreamParser.class); private static final int MAX_BIN_CHAR_TEST_LENGTH = 10; private final byte[] binCharTestArr = new byte[MAX_BIN_CHAR_TEST_LENGTH]; @@ -126,8 +126,8 @@ public class PDFStreamParser extends Bas } catch (IOException exception) { - LOG.warn("Stop reading invalid dictionary from content stream at offset " - + source.getPosition()); + LOG.warn("Stop reading invalid dictionary from content stream at offset {}", + source.getPosition()); close(); return null; } @@ -144,8 +144,8 @@ public class PDFStreamParser extends Bas } catch (IOException exception) { - LOG.warn("Stop reading invalid array from content stream at offset " - + source.getPosition()); + LOG.warn("Stop reading invalid array from content stream at offset {}", + source.getPosition()); close(); return null; } @@ -236,8 +236,8 @@ public class PDFStreamParser extends Bas Object value = parseNextToken(); if (!(value instanceof COSBase)) { - LOG.warn("Unexpected token in inline image dictionary at offset " + - (source.isClosed() ? "EOF" : source.getPosition())); + LOG.warn("Unexpected token in inline image dictionary at offset {}", + source.isClosed() ? "EOF" : source.getPosition()); break; } imageParams.setItem( (COSName)nextToken, (COSBase)value ); @@ -248,7 +248,8 @@ public class PDFStreamParser extends Bas Operator imageData = (Operator) nextToken; if (imageData.getImageData() == null || imageData.getImageData().length == 0) { - LOG.warn("empty inline image at stream offset " + source.getPosition()); + LOG.warn("empty inline image at stream offset {}", + source.getPosition()); } beginImageOP.setImageData(imageData.getImageData()); } @@ -377,7 +378,8 @@ public class PDFStreamParser extends Bas } if (!noBinData) { - LOG.warn("ignoring 'EI' assumed to be in the middle of inline image at stream offset " + + LOG.warn( + "ignoring 'EI' assumed to be in the middle of inline image at stream offset {}", source.getPosition()); } return noBinData; Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/XrefTrailerResolver.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/XrefTrailerResolver.java?rev=1913377&r1=1913376&r2=1913377&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/XrefTrailerResolver.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/XrefTrailerResolver.java Fri Oct 27 06:05:21 2023 @@ -26,8 +26,8 @@ import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; import org.apache.pdfbox.cos.COSDictionary; import org.apache.pdfbox.cos.COSName; import org.apache.pdfbox.cos.COSObjectKey; @@ -100,7 +100,7 @@ public class XrefTrailerResolver private XrefTrailerObj resolvedXrefTrailer = null; /** Log instance. */ - private static final Log LOG = LogFactory.getLog( XrefTrailerResolver.class ); + private static final Logger LOG = LogManager.getLogger(XrefTrailerResolver.class ); /** * Returns the first trailer if at least one exists. @@ -177,7 +177,8 @@ public class XrefTrailerResolver if ( curXrefTrailerObj == null ) { // should not happen... - LOG.warn( "Cannot add XRef entry for '" + objKey.getNumber() + "' because XRef start was not signalled." ); + LOG.warn("Cannot add XRef entry for '{}' because XRef start was not signalled.", + objKey.getNumber()); return; } // PDFBOX-3506 check before adding to the map, to avoid entries from the table being @@ -246,7 +247,8 @@ public class XrefTrailerResolver if ( curObj == null ) { // no XRef at given position - LOG.warn( "Did not found XRef object at specified startxref position " + startxrefBytePosValue ); + LOG.warn("Did not found XRef object at specified startxref position {}", + startxrefBytePosValue); // use all objects in byte position order (last entries overwrite previous ones) xrefSeqBytePos.addAll( bytePosToXrefMap.keySet() ); @@ -270,7 +272,8 @@ public class XrefTrailerResolver curObj = bytePosToXrefMap.get( prevBytePos ); if ( curObj == null ) { - LOG.warn( "Did not found XRef object pointed to by 'Prev' key at position " + prevBytePos ); + LOG.warn("Did not found XRef object pointed to by 'Prev' key at position {}", + prevBytePos); break; } xrefSeqBytePos.add( prevBytePos ); Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDAbstractContentStream.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDAbstractContentStream.java?rev=1913377&r1=1913376&r2=1913377&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDAbstractContentStream.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDAbstractContentStream.java Fri Oct 27 06:05:21 2023 @@ -35,8 +35,8 @@ import java.util.Map; import java.util.Set; import java.util.regex.Pattern; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; import org.apache.fontbox.ttf.CmapLookup; import org.apache.fontbox.ttf.gsub.CompoundCharacterTokenizer; import org.apache.fontbox.ttf.gsub.GsubWorker; @@ -76,7 +76,7 @@ import org.apache.pdfbox.util.NumberForm */ abstract class PDAbstractContentStream implements Closeable { - private static final Log LOG = LogFactory.getLog(PDAbstractContentStream.class); + private static final Logger LOG = LogManager.getLogger(PDAbstractContentStream.class); protected final PDDocument document; // may be null @@ -186,13 +186,14 @@ abstract class PDAbstractContentStream i } else { - LOG.warn("Using the subsetted font '" + font.getName() + - "' without a PDDocument context; call subset() before saving"); + LOG.warn( + "Using the subsetted font '{}' without a PDDocument context; call subset() before saving", + font.getName()); } } else if (!font.isEmbedded() && !font.isStandard14()) { - LOG.warn("attempting to use font '" + font.getName() + "' that isn't embedded"); + LOG.warn("attempting to use font '{}' that isn't embedded", font.getName()); } // complex text layout Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java?rev=1913377&r1=1913376&r2=1913377&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java Fri Oct 27 06:05:21 2023 @@ -34,8 +34,8 @@ import java.util.List; import java.util.Set; import java.util.stream.Collectors; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; import org.apache.fontbox.ttf.TrueTypeFont; import org.apache.pdfbox.cos.COSArray; import org.apache.pdfbox.cos.COSBase; @@ -92,7 +92,7 @@ public class PDDocument implements Close */ private static final int[] RESERVE_BYTE_RANGE = { 0, 1000000000, 1000000000, 1000000000 }; - private static final Log LOG = LogFactory.getLog(PDDocument.class); + private static final Logger LOG = LogManager.getLogger(PDDocument.class); /** * avoid concurrency issues with PDDeviceRGB @@ -975,8 +975,8 @@ public class PDDocument implements Close if (file.exists()) { LOG.warn( - "You are overwriting the existing file " + file.getName() - + ", this will produce a corrupted file if you're also reading from it"); + "You are overwriting the existing file {}, this will produce a corrupted file if you're also reading from it", + file.getName()); } try (BufferedOutputStream bufferedOutputStream = new BufferedOutputStream( new FileOutputStream(file))) Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocumentCatalog.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocumentCatalog.java?rev=1913377&r1=1913376&r2=1913377&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocumentCatalog.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocumentCatalog.java Fri Oct 27 06:05:21 2023 @@ -20,8 +20,8 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; import org.apache.pdfbox.cos.COSArray; import org.apache.pdfbox.cos.COSBase; @@ -58,7 +58,7 @@ import org.apache.pdfbox.pdmodel.interac */ public class PDDocumentCatalog implements COSObjectable { - private static final Log LOG = LogFactory.getLog(PDDocumentCatalog.class); + private static final Logger LOG = LogManager.getLogger(PDDocumentCatalog.class); private final COSDictionary root; private final PDDocument document; @@ -476,7 +476,7 @@ public class PDDocumentCatalog implement } catch (IllegalArgumentException e) { - LOG.debug("Invalid PageMode used '" + mode + "' - setting to PageMode.USE_NONE", e); + LOG.debug("Invalid PageMode used '{}' - setting to PageMode.USE_NONE", mode, e); return PageMode.USE_NONE; } } @@ -512,7 +512,8 @@ public class PDDocumentCatalog implement } catch (IllegalArgumentException e) { - LOG.warn("Invalid PageLayout used '" + mode + "' - returning PageLayout.SINGLE_PAGE", e); + LOG.warn("Invalid PageLayout used '{}' - returning PageLayout.SINGLE_PAGE", mode, + e); } } return PageLayout.SINGLE_PAGE; Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPage.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPage.java?rev=1913377&r1=1913376&r2=1913377&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPage.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPage.java Fri Oct 27 06:05:21 2023 @@ -24,8 +24,8 @@ import java.util.Iterator; import java.util.List; import java.util.stream.Collectors; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; import org.apache.pdfbox.contentstream.PDContentStream; import org.apache.pdfbox.cos.COSArray; import org.apache.pdfbox.cos.COSBase; @@ -62,7 +62,7 @@ public class PDPage implements COSObject /** * Log instance */ - private static final Log LOG = LogFactory.getLog(PDPage.class); + private static final Logger LOG = LogManager.getLogger(PDPage.class); private static final byte[] DELIMITER = { '\n' }; @@ -756,7 +756,7 @@ public class PDPage implements COSObject } else { - LOG.warn("Array element " + base2 + " is skipped, must be a (viewport) dictionary"); + LOG.warn("Array element {} is skipped, must be a (viewport) dictionary", base2); } } return viewports; Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPageContentStream.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPageContentStream.java?rev=1913377&r1=1913376&r2=1913377&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPageContentStream.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPageContentStream.java Fri Oct 27 06:05:21 2023 @@ -21,8 +21,8 @@ import java.io.IOException; import java.io.OutputStream; import java.nio.charset.StandardCharsets; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; import org.apache.pdfbox.cos.COSArray; import org.apache.pdfbox.cos.COSBase; import org.apache.pdfbox.cos.COSName; @@ -65,7 +65,7 @@ public final class PDPageContentStream e } } - private static final Log LOG = LogFactory.getLog(PDPageContentStream.class); + private static final Logger LOG = LogManager.getLogger(PDPageContentStream.class); private boolean sourcePageHadContents = false; Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPageTree.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPageTree.java?rev=1913377&r1=1913376&r2=1913377&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPageTree.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPageTree.java Fri Oct 27 06:05:21 2023 @@ -32,8 +32,8 @@ import java.util.HashSet; import java.util.List; import java.util.NoSuchElementException; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; /** * The page tree, which defines the ordering of pages in the document in an efficient manner. @@ -42,7 +42,7 @@ import org.apache.commons.logging.LogFac */ public class PDPageTree implements COSObjectable, Iterable<PDPage> { - private static final Log LOG = LogFactory.getLog(PDPageTree.class); + private static final Logger LOG = LogManager.getLogger(PDPageTree.class); private final COSDictionary root; private final PDDocument document; // optional @@ -165,7 +165,7 @@ public class PDPageTree implements COSOb } else { - LOG.warn("COSDictionary expected, but got " + base.getClass().getSimpleName()); + LOG.warn("COSDictionary expected, but got {}", base.getClass().getSimpleName()); } } } @@ -215,8 +215,8 @@ public class PDPageTree implements COSOb } else { - LOG.error("Page skipped due to an invalid or missing type " - + node.getCOSName(COSName.TYPE)); + LOG.error("Page skipped due to an invalid or missing type {}", + node.getCOSName(COSName.TYPE)); } } } Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDNameTreeNode.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDNameTreeNode.java?rev=1913377&r1=1913376&r2=1913377&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDNameTreeNode.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDNameTreeNode.java Fri Oct 27 06:05:21 2023 @@ -24,8 +24,8 @@ import java.util.List; import java.util.Map; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; import org.apache.pdfbox.cos.COSArray; import org.apache.pdfbox.cos.COSBase; import org.apache.pdfbox.cos.COSDictionary; @@ -41,7 +41,7 @@ import org.apache.pdfbox.cos.COSString; */ public abstract class PDNameTreeNode<T extends COSObjectable> implements COSObjectable { - private static final Log LOG = LogFactory.getLog(PDNameTreeNode.class); + private static final Logger LOG = LogManager.getLogger(PDNameTreeNode.class); private final COSDictionary node; private PDNameTreeNode<T> parent; @@ -258,7 +258,7 @@ public abstract class PDNameTreeNode<T e Map<String, T> names = new LinkedHashMap<>(); if (namesArray.size() % 2 != 0) { - LOG.warn("Names array has odd size: " + namesArray.size()); + LOG.warn("Names array has odd size: {}", namesArray.size()); } for (int i = 0; i + 1 < namesArray.size(); i += 2) { Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDNumberTreeNode.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDNumberTreeNode.java?rev=1913377&r1=1913376&r2=1913377&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDNumberTreeNode.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDNumberTreeNode.java Fri Oct 27 06:05:21 2023 @@ -23,8 +23,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; import org.apache.pdfbox.cos.COSArray; import org.apache.pdfbox.cos.COSBase; import org.apache.pdfbox.cos.COSDictionary; @@ -41,7 +41,7 @@ import org.apache.pdfbox.cos.COSNull; */ public class PDNumberTreeNode implements COSObjectable { - private static final Log LOG = LogFactory.getLog( PDNumberTreeNode.class ); + private static final Logger LOG = LogManager.getLogger(PDNumberTreeNode.class ); private final COSDictionary node; private Class<? extends COSObjectable> valueType = null; @@ -183,14 +183,15 @@ public class PDNumberTreeNode implements indices = new HashMap<>(); if (numbersArray.size() % 2 != 0) { - LOG.warn("Numbers array has odd size: " + numbersArray.size()); + LOG.warn("Numbers array has odd size: {}", numbersArray.size()); } for (int i = 0; i + 1 < numbersArray.size(); i += 2) { COSBase base = numbersArray.getObject(i); if (!(base instanceof COSInteger)) { - LOG.error("page labels ignored, index " + i + " should be a number, but is " + base); + LOG.error("page labels ignored, index {} should be a number, but is {}", i, + base); return null; } COSInteger key = (COSInteger) base; Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDStream.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDStream.java?rev=1913377&r1=1913376&r2=1913377&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDStream.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDStream.java Fri Oct 27 06:05:21 2023 @@ -24,8 +24,8 @@ import java.util.Collections; import java.util.List; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; import org.apache.pdfbox.cos.COSArray; import org.apache.pdfbox.cos.COSBase; import org.apache.pdfbox.cos.COSDictionary; @@ -49,7 +49,7 @@ import org.apache.pdfbox.pdmodel.common. */ public class PDStream implements COSObjectable { - private static final Log LOG = LogFactory.getLog(PDStream.class); + private static final Logger LOG = LogManager.getLogger(PDStream.class); private final COSStream stream; @@ -311,7 +311,7 @@ public class PDStream implements COSObje } else { - LOG.warn("Expected COSDictionary, got " + base + ", ignored"); + LOG.warn("Expected COSDictionary, got {}, ignored", base); } } return new COSArrayList<>(actuals, array); Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/function/PDFunctionType0.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/function/PDFunctionType0.java?rev=1913377&r1=1913376&r2=1913377&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/function/PDFunctionType0.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/function/PDFunctionType0.java Fri Oct 27 06:05:21 2023 @@ -22,8 +22,8 @@ import java.io.InputStream; import javax.imageio.stream.ImageInputStream; import javax.imageio.stream.MemoryCacheImageInputStream; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; import org.apache.pdfbox.cos.COSArray; import org.apache.pdfbox.cos.COSBase; import org.apache.pdfbox.cos.COSInteger; @@ -43,7 +43,7 @@ public class PDFunctionType0 extends PDF /** * Log instance. */ - private static final Log LOG = LogFactory.getLog(PDFunctionType0.class); + private static final Logger LOG = LogManager.getLogger(PDFunctionType0.class); /** * An array of 2 x m numbers specifying the linear mapping of input values Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDObjectReference.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDObjectReference.java?rev=1913377&r1=1913376&r2=1913377&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDObjectReference.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDObjectReference.java Fri Oct 27 06:05:21 2023 @@ -18,8 +18,8 @@ package org.apache.pdfbox.pdmodel.docume import java.io.IOException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; import org.apache.pdfbox.cos.COSDictionary; import org.apache.pdfbox.cos.COSName; @@ -41,7 +41,7 @@ public class PDObjectReference implement /** * Log instance. */ - private static final Log LOG = LogFactory.getLog(PDObjectReference.class); + private static final Logger LOG = LogManager.getLogger(PDObjectReference.class); /** * TYPE of this object. Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDStructureTreeRoot.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDStructureTreeRoot.java?rev=1913377&r1=1913376&r2=1913377&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDStructureTreeRoot.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDStructureTreeRoot.java Fri Oct 27 06:05:21 2023 @@ -19,8 +19,8 @@ package org.apache.pdfbox.pdmodel.docume import java.io.IOException; import java.util.HashMap; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; import org.apache.pdfbox.cos.COSBase; import org.apache.pdfbox.cos.COSDictionary; import org.apache.pdfbox.cos.COSName; @@ -42,7 +42,7 @@ public class PDStructureTreeRoot extends /** * Log instance. */ - private static final Log LOG = LogFactory.getLog(PDStructureTreeRoot.class); + private static final Logger LOG = LogManager.getLogger(PDStructureTreeRoot.class); private static final String TYPE = "StructTreeRoot"; Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/taggedpdf/StandardStructureTypes.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/taggedpdf/StandardStructureTypes.java?rev=1913377&r1=1913376&r2=1913377&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/taggedpdf/StandardStructureTypes.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/taggedpdf/StandardStructureTypes.java Fri Oct 27 06:05:21 2023 @@ -21,8 +21,8 @@ import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; /** * The standard structure types. @@ -35,7 +35,7 @@ public class StandardStructureTypes /** * Log instance. */ - private static final Log LOG = LogFactory.getLog(StandardStructureTypes.class); + private static final Logger LOG = LogManager.getLogger(StandardStructureTypes.class); // Grouping Elements /** Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityHandler.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityHandler.java?rev=1913377&r1=1913376&r2=1913377&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityHandler.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityHandler.java Fri Oct 27 06:05:21 2023 @@ -38,8 +38,8 @@ import javax.crypto.CipherInputStream; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; import org.apache.pdfbox.cos.COSArray; import org.apache.pdfbox.cos.COSBase; import org.apache.pdfbox.cos.COSDictionary; @@ -60,7 +60,7 @@ import org.apache.pdfbox.pdmodel.PDDocum */ public abstract class SecurityHandler<T_POLICY extends ProtectionPolicy> { - private static final Log LOG = LogFactory.getLog(SecurityHandler.class); + private static final Logger LOG = LogManager.getLogger(SecurityHandler.class); private static final short DEFAULT_KEY_LENGTH = 40; @@ -520,7 +520,8 @@ public abstract class SecurityHandler<T_ if (buf.length != nBytes) { - LOG.debug("Tried reading " + buf.length + " bytes but only " + isResult + " bytes read"); + LOG.debug("Tried reading {} bytes but only {} bytes read", buf.length, + isResult); } } if (Arrays.equals(buf, "<?xpacket ".getBytes(StandardCharsets.ISO_8859_1))) @@ -540,8 +541,8 @@ public abstract class SecurityHandler<T_ } catch (IOException ex) { - LOG.error(ex.getClass().getSimpleName() + " thrown when decrypting object " + - objNum + " " + genNum + " obj"); + LOG.error("{} thrown when decrypting object {} {} obj", ex.getClass().getSimpleName(), + objNum, genNum); throw ex; } } @@ -639,8 +640,8 @@ public abstract class SecurityHandler<T_ } catch (IOException ex) { - LOG.error("Failed to decrypt COSString of length " + string.getBytes().length + - " in object " + objNum + ": " + ex.getMessage(), ex); + LOG.error("Failed to decrypt COSString of length {} in object {}: {}", + string.getBytes().length, objNum, ex.getMessage(), ex); } } Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardSecurityHandler.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardSecurityHandler.java?rev=1913377&r1=1913376&r2=1913377&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardSecurityHandler.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardSecurityHandler.java Fri Oct 27 06:05:21 2023 @@ -31,8 +31,8 @@ import java.util.Arrays; import javax.crypto.Cipher; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; import org.apache.pdfbox.cos.COSArray; import org.apache.pdfbox.cos.COSName; @@ -51,7 +51,7 @@ public final class StandardSecurityHandl /** * Log instance. */ - private static final Log LOG = LogFactory.getLog(StandardSecurityHandler.class); + private static final Logger LOG = LogManager.getLogger(StandardSecurityHandler.class); private static final int REVISION_2 = 2; private static final int REVISION_3 = 3; @@ -189,8 +189,9 @@ public final class StandardSecurityHandl int newLength = encryption.getLength() / 8; if (newLength < dicLength) { - LOG.warn("Using " + newLength + " bytes key length instead of " + - dicLength + " in AESV2 encryption?!"); + LOG.warn( + "Using {} bytes key length instead of {} in AESV2 encryption?!", + newLength, dicLength); dicLength = newLength; } } @@ -205,8 +206,9 @@ public final class StandardSecurityHandl int newLength = encryption.getLength() / 8; if (newLength < dicLength) { - LOG.warn("Using " + newLength + " bytes key length instead of " + - dicLength + " in AESV3 encryption?!"); + LOG.warn( + "Using {} bytes key length instead of {} in AESV3 encryption?!", + newLength, dicLength); dicLength = newLength; } } @@ -338,8 +340,8 @@ public final class StandardSecurityHandl if (permsP != dicPermissions) { - LOG.warn("Verification of permissions failed (" + String.format("%08X",permsP) + - " != " + String.format("%08X",dicPermissions) + ")"); + LOG.warn("Verification of permissions failed ({} != {})", + String.format("%08X", permsP), String.format("%08X", dicPermissions)); } if (encryptMetadata && perms[8] != 'T' || !encryptMetadata && perms[8] != 'F') Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotation.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotation.java?rev=1913377&r1=1913376&r2=1913377&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotation.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotation.java Fri Oct 27 06:05:21 2023 @@ -23,8 +23,8 @@ import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; import org.apache.pdfbox.cos.COSArray; import org.apache.pdfbox.cos.COSBase; import org.apache.pdfbox.cos.COSDictionary; @@ -53,7 +53,7 @@ import org.w3c.dom.Text; * */ public abstract class FDFAnnotation implements COSObjectable { - private static final Log LOG = LogFactory.getLog(FDFAnnotation.class); + private static final Logger LOG = LogManager.getLogger(FDFAnnotation.class); /** * An annotation flag. @@ -398,7 +398,7 @@ public abstract class FDFAnnotation impl } else { - LOG.warn("Unknown or unsupported annotation type '" + fdfDicName + "'"); + LOG.warn("Unknown or unsupported annotation type '{}'", fdfDicName); } } return retval; Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationFreeText.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationFreeText.java?rev=1913377&r1=1913376&r2=1913377&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationFreeText.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationFreeText.java Fri Oct 27 06:05:21 2023 @@ -21,8 +21,8 @@ import javax.xml.xpath.XPath; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; import org.apache.pdfbox.cos.COSArray; import org.apache.pdfbox.cos.COSDictionary; import org.apache.pdfbox.cos.COSName; @@ -36,7 +36,7 @@ import org.w3c.dom.Element; */ public class FDFAnnotationFreeText extends FDFAnnotation { - private static final Log LOG = LogFactory.getLog(FDFAnnotationFreeText.class); + private static final Logger LOG = LogManager.getLogger(FDFAnnotationFreeText.class); /** * COS Model value for SubType entry. Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationInk.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationInk.java?rev=1913377&r1=1913376&r2=1913377&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationInk.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationInk.java Fri Oct 27 06:05:21 2023 @@ -25,8 +25,8 @@ import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; import org.apache.pdfbox.cos.COSArray; import org.apache.pdfbox.cos.COSBase; import org.apache.pdfbox.cos.COSDictionary; @@ -42,7 +42,7 @@ import org.w3c.dom.NodeList; */ public class FDFAnnotationInk extends FDFAnnotation { - private static final Log LOG = LogFactory.getLog(FDFAnnotationInk.class); + private static final Logger LOG = LogManager.getLogger(FDFAnnotationInk.class); /** * COS Model value for SubType entry. */ Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationLink.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationLink.java?rev=1913377&r1=1913376&r2=1913377&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationLink.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationLink.java Fri Oct 27 06:05:21 2023 @@ -23,8 +23,8 @@ import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; import org.apache.pdfbox.cos.COSDictionary; import org.apache.pdfbox.cos.COSName; @@ -39,7 +39,7 @@ import org.w3c.dom.NodeList; */ public class FDFAnnotationLink extends FDFAnnotation { - private static final Log LOG = LogFactory.getLog(FDFAnnotationLink.class); + private static final Logger LOG = LogManager.getLogger(FDFAnnotationLink.class); /** * COS Model value for SubType entry. Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationPolygon.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationPolygon.java?rev=1913377&r1=1913376&r2=1913377&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationPolygon.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationPolygon.java Fri Oct 27 06:05:21 2023 @@ -23,8 +23,8 @@ import javax.xml.xpath.XPath; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; import org.apache.pdfbox.cos.COSArray; import org.apache.pdfbox.cos.COSDictionary; import org.apache.pdfbox.cos.COSName; @@ -38,7 +38,7 @@ import org.w3c.dom.Element; */ public class FDFAnnotationPolygon extends FDFAnnotation { - private static final Log LOG = LogFactory.getLog(FDFAnnotationPolygon.class); + private static final Logger LOG = LogManager.getLogger(FDFAnnotationPolygon.class); /** * COS Model value for SubType entry. */ Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationPolyline.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationPolyline.java?rev=1913377&r1=1913376&r2=1913377&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationPolyline.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationPolyline.java Fri Oct 27 06:05:21 2023 @@ -23,8 +23,8 @@ import javax.xml.xpath.XPath; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; import org.apache.pdfbox.cos.COSArray; import org.apache.pdfbox.cos.COSDictionary; import org.apache.pdfbox.cos.COSName; @@ -39,7 +39,7 @@ import org.w3c.dom.Element; */ public class FDFAnnotationPolyline extends FDFAnnotation { - private static final Log LOG = LogFactory.getLog(FDFAnnotationPolyline.class); + private static final Logger LOG = LogManager.getLogger(FDFAnnotationPolyline.class); /** * COS Model value for SubType entry. */ Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationStamp.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationStamp.java?rev=1913377&r1=1913376&r2=1913377&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationStamp.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationStamp.java Fri Oct 27 06:05:21 2023 @@ -24,8 +24,8 @@ import javax.xml.xpath.XPath; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; import org.apache.pdfbox.cos.COSArray; import org.apache.pdfbox.cos.COSBoolean; @@ -48,7 +48,7 @@ import org.w3c.dom.NodeList; */ public class FDFAnnotationStamp extends FDFAnnotation { - private static final Log LOG = LogFactory.getLog(FDFAnnotationStamp.class); + private static final Logger LOG = LogManager.getLogger(FDFAnnotationStamp.class); /** * COS Model value for SubType entry. @@ -100,7 +100,7 @@ public class FDFAnnotationStamp extends catch (XPathExpressionException e) { // should not happen - LOG.error("Error while evaluating XPath expression for appearance: " + e); + LOG.error("Error while evaluating XPath expression for appearance: {}", e); return; } byte[] decodedAppearanceXML; @@ -115,7 +115,7 @@ public class FDFAnnotationStamp extends } if (base64EncodedAppearance != null && !base64EncodedAppearance.isEmpty()) { - LOG.debug("Decoded XML: " + new String(decodedAppearanceXML)); + LOG.debug("Decoded XML: {}", new String(decodedAppearanceXML)); Document stampAppearance = XMLUtil .parse(new ByteArrayInputStream(decodedAppearanceXML)); @@ -147,15 +147,15 @@ public class FDFAnnotationStamp extends NodeList nodeList = appearanceXML.getChildNodes(); String parentAttrKey = appearanceXML.getAttribute("KEY"); - LOG.debug("Appearance Root - tag: " + appearanceXML.getTagName() + ", name: " + - appearanceXML.getNodeName() + ", key: " + parentAttrKey + ", children: " + + LOG.debug("Appearance Root - tag: {}, name: {}, key: {}, children: {}", + appearanceXML.getTagName(), appearanceXML.getNodeName(), parentAttrKey, nodeList.getLength()); // Currently only handles Appearance dictionary (AP key on the root) if (!"AP".equals(appearanceXML.getAttribute("KEY"))) { - LOG.warn(parentAttrKey + " => Not handling element: " + appearanceXML.getTagName() + - " with key: " + appearanceXML.getAttribute("KEY")); + LOG.warn("{} => Not handling element: {} with key: {}", parentAttrKey, + appearanceXML.getTagName(), appearanceXML.getAttribute("KEY")); return dictionary; } for (int i = 0; i < nodeList.getLength(); i++) @@ -166,16 +166,14 @@ public class FDFAnnotationStamp extends Element child = (Element) node; if ("STREAM".equalsIgnoreCase(child.getTagName())) { - LOG.debug(parentAttrKey + - " => Process " + child.getAttribute("KEY") + - " item in the dictionary after processing the " + - child.getTagName()); + LOG.debug("{} => Process {} item in the dictionary after processing the {}", + parentAttrKey, child.getAttribute("KEY"), child.getTagName()); dictionary.setItem(child.getAttribute("KEY"), parseStreamElement(child)); - LOG.debug(parentAttrKey + " => Set " + child.getAttribute("KEY")); + LOG.debug("{} => Set {}", parentAttrKey, child.getAttribute("KEY")); } else { - LOG.warn(parentAttrKey + " => Not handling element: " + child.getTagName()); + LOG.warn("{} => Not handling element: {}", parentAttrKey, child.getTagName()); } } } @@ -184,7 +182,7 @@ public class FDFAnnotationStamp extends private COSStream parseStreamElement(Element streamEl) throws IOException { - LOG.debug("Parse " + streamEl.getAttribute("KEY") + " Stream"); + LOG.debug("Parse {} Stream", streamEl.getAttribute("KEY")); COSStream stream = new COSStream(); NodeList nodeList = streamEl.getChildNodes(); @@ -198,56 +196,56 @@ public class FDFAnnotationStamp extends Element child = (Element) node; String childAttrKey = child.getAttribute("KEY"); String childAttrVal = child.getAttribute("VAL"); - LOG.debug(parentAttrKey + " => reading child: " + child.getTagName() + - " with key: " + childAttrKey); + LOG.debug("{} => reading child: {} with key: {}", () -> parentAttrKey, () -> child.getTagName(), + () -> childAttrKey); if ("INT".equalsIgnoreCase(child.getTagName())) { if (!"Length".equals(childAttrKey)) { stream.setInt(COSName.getPDFName(childAttrKey), Integer.parseInt(childAttrVal)); - LOG.debug(parentAttrKey + " => Set " + childAttrKey + ": " + childAttrVal); + LOG.debug("{} => Set {}: {}", parentAttrKey, childAttrKey, childAttrVal); } } else if ("FIXED".equalsIgnoreCase(child.getTagName())) { stream.setFloat(COSName.getPDFName(childAttrKey), Float.parseFloat(childAttrVal)); - LOG.debug(parentAttrKey + " => Set " + childAttrKey + ": " + childAttrVal); + LOG.debug("{} => Set {}: {}", parentAttrKey, childAttrKey, childAttrVal); } else if ("NAME".equalsIgnoreCase(child.getTagName())) { stream.setName(COSName.getPDFName(childAttrKey), childAttrVal); - LOG.debug(parentAttrKey + " => Set " + childAttrKey + ": " + childAttrVal); + LOG.debug("{} => Set {}: {}", parentAttrKey, childAttrKey, childAttrVal); } else if ("BOOL".equalsIgnoreCase(child.getTagName())) { stream.setBoolean(COSName.getPDFName(childAttrKey), Boolean.parseBoolean(childAttrVal)); - LOG.debug(parentAttrKey + " => Set " + childAttrVal); + LOG.debug("{} => Set {}", parentAttrKey, childAttrVal); } else if ("ARRAY".equalsIgnoreCase(child.getTagName())) { stream.setItem(COSName.getPDFName(childAttrKey), parseArrayElement(child)); - LOG.debug(parentAttrKey + " => Set " + childAttrKey); + LOG.debug("{} => Set {}", parentAttrKey, childAttrKey); } else if ("DICT".equalsIgnoreCase(child.getTagName())) { stream.setItem(COSName.getPDFName(childAttrKey), parseDictElement(child)); - LOG.debug(parentAttrKey + " => Set " + childAttrKey); + LOG.debug("{} => Set {}", parentAttrKey, childAttrKey); } else if ("STREAM".equalsIgnoreCase(child.getTagName())) { stream.setItem(COSName.getPDFName(childAttrKey), parseStreamElement(child)); - LOG.debug(parentAttrKey + " => Set " + childAttrKey); + LOG.debug("{} => Set {}", parentAttrKey, childAttrKey); } else if ("DATA".equalsIgnoreCase(child.getTagName())) { - LOG.debug(parentAttrKey + " => Handling DATA with encoding: " + - child.getAttribute("ENCODING")); + LOG.debug("{} => Handling DATA with encoding: {}", parentAttrKey, + child.getAttribute("ENCODING")); if ("HEX".equals(child.getAttribute("ENCODING"))) { try (OutputStream os = stream.createRawOutputStream()) { os.write(Hex.decodeHex(child.getTextContent())); - LOG.debug(parentAttrKey + " => Data was streamed"); + LOG.debug("{} => Data was streamed", parentAttrKey); } } else if ("ASCII".equals(child.getAttribute("ENCODING"))) @@ -256,18 +254,19 @@ public class FDFAnnotationStamp extends { // not sure about charset os.write(child.getTextContent().getBytes()); - LOG.debug(parentAttrKey + " => Data was streamed"); + LOG.debug("{} => Data was streamed", parentAttrKey); } } else { - LOG.warn(parentAttrKey + " => Not handling element DATA encoding: " + - child.getAttribute("ENCODING")); + LOG.warn("{} => Not handling element DATA encoding: {}", parentAttrKey, + child.getAttribute("ENCODING")); } } else { - LOG.warn(parentAttrKey + " => Not handling child element: " + child.getTagName()); + LOG.warn("{} => Not handling child element: {}", parentAttrKey, + child.getTagName()); } } } @@ -277,7 +276,7 @@ public class FDFAnnotationStamp extends private COSArray parseArrayElement(Element arrayEl) throws IOException { - LOG.debug("Parse " + arrayEl.getAttribute("KEY") + " Array"); + LOG.debug("Parse {} Array", arrayEl.getAttribute("KEY")); COSArray array = new COSArray(); NodeList nodeList = arrayEl.getChildNodes(); @@ -302,41 +301,42 @@ public class FDFAnnotationStamp extends Element child = (Element) node; String childAttrKey = child.getAttribute("KEY"); String childAttrVal = child.getAttribute("VAL"); - LOG.debug(parentAttrKey + " => reading child: " + child.getTagName() + - " with key: " + childAttrKey); + LOG.debug("{} => reading child: {} with key: {}", parentAttrKey, child.getTagName(), + childAttrKey); if ("INT".equalsIgnoreCase(child.getTagName()) || "FIXED".equalsIgnoreCase(child.getTagName())) { - LOG.debug(parentAttrKey + " value(" + i + "): " + childAttrVal); + LOG.debug("{} value({}): {}", parentAttrKey, i, childAttrVal); array.add(COSNumber.get(childAttrVal)); } else if ("NAME".equalsIgnoreCase(child.getTagName())) { - LOG.debug(parentAttrKey + " value(" + i + "): " + childAttrVal); + LOG.debug("{} value({}): {}", parentAttrKey, i, childAttrVal); array.add(COSName.getPDFName(childAttrVal)); } else if ("BOOL".equalsIgnoreCase(child.getTagName())) { - LOG.debug(parentAttrKey + " value(" + i + "): " + childAttrVal); + LOG.debug("{} value({}): {}", parentAttrKey, i, childAttrVal); array.add(COSBoolean.getBoolean(Boolean.parseBoolean(childAttrVal))); } else if ("DICT".equalsIgnoreCase(child.getTagName())) { - LOG.debug(parentAttrKey + " value(" + i + "): " + childAttrVal); + LOG.debug("{} value({}): {}", parentAttrKey, i, childAttrVal); array.add(parseDictElement(child)); } else if ("STREAM".equalsIgnoreCase(child.getTagName())) { - LOG.debug(parentAttrKey + " value(" + i + "): " + childAttrVal); + LOG.debug("{} value({}): {}", parentAttrKey, i, childAttrVal); array.add(parseStreamElement(child)); } else if ("ARRAY".equalsIgnoreCase(child.getTagName())) { - LOG.debug(parentAttrKey + " value(" + i + "): " + childAttrVal); + LOG.debug("{} value({}): {}", parentAttrKey, i, childAttrVal); array.add(parseArrayElement(child)); } else { - LOG.warn(parentAttrKey + " => Not handling child element: " + child.getTagName()); + LOG.warn("{} => Not handling child element: {}", parentAttrKey, + child.getTagName()); } } } @@ -346,7 +346,7 @@ public class FDFAnnotationStamp extends private COSDictionary parseDictElement(Element dictEl) throws IOException { - LOG.debug("Parse " + dictEl.getAttribute("KEY") + " Dictionary"); + LOG.debug("Parse {} Dictionary", dictEl.getAttribute("KEY")); COSDictionary dict = new COSDictionary(); NodeList nodeList = dictEl.getChildNodes(); @@ -363,44 +363,48 @@ public class FDFAnnotationStamp extends if ("DICT".equals(child.getTagName())) { - LOG.debug(parentAttrKey + " => Handling DICT element with key: " + childAttrKey); + LOG.debug("{} => Handling DICT element with key: {}", parentAttrKey, + childAttrKey); dict.setItem(COSName.getPDFName(childAttrKey), parseDictElement(child)); - LOG.debug(parentAttrKey + " => Set " + childAttrKey); + LOG.debug("{} => Set {}", parentAttrKey, childAttrKey); } else if ("STREAM".equals(child.getTagName())) { - LOG.debug(parentAttrKey + " => Handling STREAM element with key: " + childAttrKey); + LOG.debug("{} => Handling STREAM element with key: {}", parentAttrKey, + childAttrKey); dict.setItem(COSName.getPDFName(childAttrKey), parseStreamElement(child)); } else if ("NAME".equals(child.getTagName())) { - LOG.debug(parentAttrKey + " => Handling NAME element with key: " + childAttrKey); + LOG.debug("{} => Handling NAME element with key: {}", parentAttrKey, + childAttrKey); dict.setName(COSName.getPDFName(childAttrKey), childAttrVal); - LOG.debug(parentAttrKey + " => Set " + childAttrKey + ": " + childAttrVal); + LOG.debug("{} => Set {}: {}", parentAttrKey, childAttrKey, childAttrVal); } else if ("INT".equalsIgnoreCase(child.getTagName())) { dict.setInt(COSName.getPDFName(childAttrKey), Integer.parseInt(childAttrVal)); - LOG.debug(parentAttrKey + " => Set " + childAttrKey + ": " + childAttrVal); + LOG.debug("{} => Set {}: {}", parentAttrKey, childAttrKey, childAttrVal); } else if ("FIXED".equalsIgnoreCase(child.getTagName())) { dict.setFloat(COSName.getPDFName(childAttrKey), Float.parseFloat(childAttrVal)); - LOG.debug(parentAttrKey + " => Set " + childAttrKey + ": " + childAttrVal); + LOG.debug("{} => Set {}: {}", parentAttrKey, childAttrKey, childAttrVal); } else if ("BOOL".equalsIgnoreCase(child.getTagName())) { dict.setBoolean(COSName.getPDFName(childAttrKey), Boolean.parseBoolean(childAttrVal)); - LOG.debug(parentAttrKey + " => Set " + childAttrVal); + LOG.debug("{} => Set {}", parentAttrKey, childAttrVal); } else if ("ARRAY".equalsIgnoreCase(child.getTagName())) { dict.setItem(COSName.getPDFName(childAttrKey), parseArrayElement(child)); - LOG.debug(parentAttrKey + " => Set " + childAttrKey); + LOG.debug("{} => Set {}", parentAttrKey, childAttrKey); } else { - LOG.warn(parentAttrKey + " => NOT handling child element: " + child.getTagName()); + LOG.warn("{} => NOT handling child element: {}", parentAttrKey, + child.getTagName()); } } } Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFDictionary.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFDictionary.java?rev=1913377&r1=1913376&r2=1913377&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFDictionary.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFDictionary.java Fri Oct 27 06:05:21 2023 @@ -21,8 +21,8 @@ import java.io.Writer; import java.util.ArrayList; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; import org.apache.pdfbox.cos.COSArray; import org.apache.pdfbox.cos.COSDictionary; import org.apache.pdfbox.cos.COSName; @@ -44,7 +44,7 @@ import org.w3c.dom.NodeList; public class FDFDictionary implements COSObjectable { - private static final Log LOG = LogFactory.getLog(FDFDictionary.class); + private static final Logger LOG = LogManager.getLogger(FDFDictionary.class); private final COSDictionary fdf; @@ -98,8 +98,9 @@ public class FDFDictionary implements CO } catch (IOException e) { - LOG.warn("Error parsing ID entry for attribute 'original' [" + original + - "]. ID entry ignored.", e); + LOG.warn( + "Error parsing ID entry for attribute 'original' [{}]. ID entry ignored.", + original, e); } try { @@ -107,8 +108,9 @@ public class FDFDictionary implements CO } catch (IOException e) { - LOG.warn("Error parsing ID entry for attribute 'modified' [" + modified + - "]. ID entry ignored.", e); + LOG.warn( + "Error parsing ID entry for attribute 'modified' [{}]. ID entry ignored.", + modified, e); } setID(ids); break; @@ -127,8 +129,8 @@ public class FDFDictionary implements CO } catch (IOException e) { - LOG.warn("Error parsing field entry [" + currentNode.getNodeValue() + - "]. Field ignored.", e); + LOG.warn("Error parsing field entry [{}]. Field ignored.", + currentNode.getNodeValue(), e); } } } @@ -201,15 +203,16 @@ public class FDFDictionary implements CO annotList.add(new FDFAnnotationUnderline(annot)); break; default: - LOG.warn("Unknown or unsupported annotation type '" + - annotationName + "'"); + LOG.warn("Unknown or unsupported annotation type '{}'", + annotationName); break; } } catch (IOException e) { - LOG.warn("Error parsing annotation information [" + - annot.getNodeValue() + "]. Annotation ignored", e); + LOG.warn( + "Error parsing annotation information [{}]. Annotation ignored", + annot.getNodeValue(), e); } } } Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fixup/processor/AcroFormGenerateAppearancesProcessor.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fixup/processor/AcroFormGenerateAppearancesProcessor.java?rev=1913377&r1=1913376&r2=1913377&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fixup/processor/AcroFormGenerateAppearancesProcessor.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fixup/processor/AcroFormGenerateAppearancesProcessor.java Fri Oct 27 06:05:21 2023 @@ -18,15 +18,15 @@ package org.apache.pdfbox.pdmodel.fixup. import java.io.IOException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm; public class AcroFormGenerateAppearancesProcessor extends AbstractProcessor { - private static final Log LOG = LogFactory.getLog(AcroFormGenerateAppearancesProcessor.class); + private static final Logger LOG = LogManager.getLogger(AcroFormGenerateAppearancesProcessor.class); public AcroFormGenerateAppearancesProcessor(PDDocument document) { Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fixup/processor/AcroFormOrphanWidgetsProcessor.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fixup/processor/AcroFormOrphanWidgetsProcessor.java?rev=1913377&r1=1913376&r2=1913377&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fixup/processor/AcroFormOrphanWidgetsProcessor.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fixup/processor/AcroFormOrphanWidgetsProcessor.java Fri Oct 27 06:05:21 2023 @@ -22,8 +22,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; import org.apache.fontbox.ttf.TrueTypeFont; import org.apache.pdfbox.cos.COSDictionary; import org.apache.pdfbox.cos.COSName; @@ -50,7 +50,7 @@ import org.apache.pdfbox.pdmodel.interac public class AcroFormOrphanWidgetsProcessor extends AbstractProcessor { - private static final Log LOG = LogFactory.getLog(AcroFormOrphanWidgetsProcessor.class); + private static final Logger LOG = LogManager.getLogger(AcroFormOrphanWidgetsProcessor.class); public AcroFormOrphanWidgetsProcessor(PDDocument document) { @@ -97,7 +97,7 @@ public class AcroFormOrphanWidgetsProces } catch (IOException ioe) { - LOG.debug("couldn't read annotations for page " + ioe.getMessage()); + LOG.debug("couldn't read annotations for page {}", ioe.getMessage()); } } @@ -171,17 +171,20 @@ public class AcroFormOrphanWidgetsProces if (acroFormResources.getFont(fontName) == null) { acroFormResources.put(fontName, widgetResources.getFont(fontName)); - LOG.debug("added font resource to AcroForm from widget for font name " + fontName.getName()); + LOG.debug("added font resource to AcroForm from widget for font name {}", + fontName.getName()); } } catch (IOException ioe) { - LOG.debug("unable to add font to AcroForm for font name " + fontName.getName()); + LOG.debug("unable to add font to AcroForm for font name {}", + fontName.getName()); } } else { - LOG.debug("font resource for widget was a subsetted font - ignored: " + fontName.getName()); + LOG.debug("font resource for widget was a subsetted font - ignored: {}", + fontName.getName()); } }); } @@ -235,24 +238,28 @@ public class AcroFormOrphanWidgetsProces { if (defaultResources.getFont(fontName) == null) { - LOG.debug("trying to add missing font resource for field " + field.getFullyQualifiedName()); + LOG.debug("trying to add missing font resource for field {}", + field.getFullyQualifiedName()); FontMapper mapper = FontMappers.instance(); FontMapping<TrueTypeFont> fontMapping = mapper.getTrueTypeFont(fontName.getName() , null); if (fontMapping != null) { PDType0Font pdFont = PDType0Font.load(document, fontMapping.getFont(), false); - LOG.debug("looked up font for " + fontName.getName() + " - found " + fontMapping.getFont().getName()); + LOG.debug("looked up font for {} - found {}", fontName.getName(), + fontMapping.getFont().getName()); defaultResources.put(fontName, pdFont); } else { - LOG.debug("no suitable font found for field " + field.getFullyQualifiedName() + " for font name " + fontName.getName()); + LOG.debug("no suitable font found for field {} for font name {}", + field.getFullyQualifiedName(), fontName.getName()); } } } catch (IOException ioe) { - LOG.debug("unable to handle font resources for field " + field.getFullyQualifiedName() + ": " + ioe.getMessage()); + LOG.debug("unable to handle font resources for field {}: {}", + field.getFullyQualifiedName(), ioe.getMessage()); } } } Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FileSystemFontProvider.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FileSystemFontProvider.java?rev=1913377&r1=1913376&r2=1913377&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FileSystemFontProvider.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FileSystemFontProvider.java Fri Oct 27 06:05:21 2023 @@ -35,8 +35,8 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; import org.apache.fontbox.FontBoxFont; import org.apache.fontbox.cff.CFFCIDFont; import org.apache.fontbox.cff.CFFFont; @@ -59,7 +59,7 @@ import org.apache.pdfbox.util.Hex; */ final class FileSystemFontProvider extends FontProvider { - private static final Log LOG = LogFactory.getLog(FileSystemFontProvider.class); + private static final Logger LOG = LogManager.getLogger(FileSystemFontProvider.class); private final List<FSFontInfo> fontInfoList = new ArrayList<>(); private final FontCache cache; @@ -200,16 +200,12 @@ final class FileSystemFontProvider exten try { TrueTypeFont ttf = readTrueTypeFont(postScriptName, file); - - if (LOG.isDebugEnabled()) - { - LOG.debug("Loaded " + postScriptName + " from " + file); - } + LOG.debug("Loaded {} from {}", postScriptName, file); return ttf; } catch (IOException e) { - LOG.warn("Could not load font file: " + file, e); + LOG.warn("Could not load font file: {}", file, e); } return null; } @@ -278,15 +274,12 @@ final class FileSystemFontProvider exten OTFParser parser = new OTFParser(false); OpenTypeFont otf = parser.parse(new RandomAccessReadBufferedFile(file)); - if (LOG.isDebugEnabled()) - { - LOG.debug("Loaded " + postScriptName + " from " + file); - } + LOG.debug("Loaded {} from {}", postScriptName, file); return otf; } catch (IOException e) { - LOG.warn("Could not load font file: " + file, e); + LOG.warn("Could not load font file: {}", file, e); } return null; } @@ -296,16 +289,12 @@ final class FileSystemFontProvider exten try (InputStream input = new FileInputStream(file)) { Type1Font type1 = Type1Font.createWithPFB(input); - - if (LOG.isDebugEnabled()) - { - LOG.debug("Loaded " + postScriptName + " from " + file); - } + LOG.debug("Loaded {} from {}", postScriptName, file); return type1; } catch (IOException e) { - LOG.warn("Could not load font file: " + file, e); + LOG.warn("Could not load font file: {}", file, e); } return null; } @@ -333,10 +322,7 @@ final class FileSystemFontProvider exten this.cache = cache; try { - if (LOG.isTraceEnabled()) - { - LOG.trace("Will search the local system for fonts"); - } + LOG.trace("Will search the local system for fonts"); // scan the local system for font files FontFileFinder fontFileFinder = new FontFileFinder(); @@ -347,10 +333,7 @@ final class FileSystemFontProvider exten files.add(new File(font)); } - if (LOG.isTraceEnabled()) - { - LOG.trace("Found " + files.size() + " fonts on the local system"); - } + LOG.trace("Found {} fonts on the local system", files.size()); if (!files.isEmpty()) { @@ -365,8 +348,8 @@ final class FileSystemFontProvider exten LOG.warn("Building on-disk font cache, this may take a while"); scanFonts(files); saveDiskCache(); - LOG.warn("Finished building on-disk font cache, found " + fontInfoList.size() - + " fonts"); + LOG.warn("Finished building on-disk font cache, found {} fonts", + fontInfoList.size()); } } } @@ -401,7 +384,7 @@ final class FileSystemFontProvider exten } catch (IOException e) { - LOG.warn("Error parsing font " + file.getPath(), e); + LOG.warn("Error parsing font {}", file.getPath(), e); } } } @@ -544,7 +527,7 @@ final class FileSystemFontProvider exten String[] parts = line.split("\\|", 12); if (parts.length < 10) { - LOG.warn("Incorrect line '" + line + "' in font disk cache is skipped"); + LOG.warn("Incorrect line '{}' in font disk cache is skipped", line); continue; } @@ -626,13 +609,13 @@ final class FileSystemFontProvider exten } else { - LOG.debug("Font file " + fontFile.getAbsolutePath() + " is different"); + LOG.debug("Font file {} is different", fontFile.getAbsolutePath()); continue; // don't remove from "pending" } } else { - LOG.debug("Font file " + fontFile.getAbsolutePath() + " not found, skipped"); + LOG.debug("Font file {} not found, skipped", fontFile.getAbsolutePath()); } pending.remove(fontFile.getAbsolutePath()); } @@ -647,7 +630,7 @@ final class FileSystemFontProvider exten if (!pending.isEmpty()) { // re-build the entire cache if we encounter un-cached fonts (could be optimised) - LOG.warn(pending.size() + " new fonts found, font cache will be re-built"); + LOG.warn("{} new fonts found, font cache will be re-built", pending.size()); return null; } @@ -665,7 +648,7 @@ final class FileSystemFontProvider exten } catch (IOException e) { - LOG.warn("Could not load font file: " + ttcFile, e); + LOG.warn("Could not load font file: {}", ttcFile, e); } } @@ -694,7 +677,7 @@ final class FileSystemFontProvider exten } catch (IOException e) { - LOG.warn("Could not load font file: " + ttfFile, e); + LOG.warn("Could not load font file: {}", ttfFile, e); fontInfoList.add(createFSIgnored(ttfFile, fontFormat, "*skipexception*")); } } @@ -710,7 +693,7 @@ final class FileSystemFontProvider exten if (ttf.getName() != null && ttf.getName().contains("|")) { fontInfoList.add(createFSIgnored(file, FontFormat.TTF, "*skippipeinname*")); - LOG.warn("Skipping font with '|' in name " + ttf.getName() + " in file " + file); + LOG.warn("Skipping font with '|' in name {} in file {}", ttf.getName(), file); } else if (ttf.getName() != null) { @@ -788,22 +771,21 @@ final class FileSystemFontProvider exten NamingTable name = ttf.getNaming(); if (name != null) { - LOG.trace(format +": '" + name.getPostScriptName() + "' / '" + - name.getFontFamily() + "' / '" + - name.getFontSubFamily() + "'"); + LOG.trace("{}: '{}' / '{}' / '{}'", format, name.getPostScriptName(), + name.getFontFamily(), name.getFontSubFamily()); } } } else { fontInfoList.add(createFSIgnored(file, FontFormat.TTF, "*skipnoname*")); - LOG.warn("Missing 'name' entry for PostScript name in font " + file); + LOG.warn("Missing 'name' entry for PostScript name in font {}", file); } } catch (IOException e) { fontInfoList.add(createFSIgnored(file, FontFormat.TTF, "*skipexception*")); - LOG.warn("Could not load font file: " + file, e); + LOG.warn("Could not load font file: {}", file, e); } finally { @@ -822,28 +804,25 @@ final class FileSystemFontProvider exten if (type1.getName() == null) { fontInfoList.add(createFSIgnored(pfbFile, FontFormat.PFB, "*skipnoname*")); - LOG.warn("Missing 'name' entry for PostScript name in font " + pfbFile); + LOG.warn("Missing 'name' entry for PostScript name in font {}", pfbFile); return; } if (type1.getName().contains("|")) { fontInfoList.add(createFSIgnored(pfbFile, FontFormat.PFB, "*skippipeinname*")); - LOG.warn("Skipping font with '|' in name " + type1.getName() + " in file " + pfbFile); + LOG.warn("Skipping font with '|' in name {} in file {}", type1.getName(), pfbFile); return; } String hash = computeHash(Files.readAllBytes(pfbFile.toPath())); fontInfoList.add(new FSFontInfo(pfbFile, FontFormat.PFB, type1.getName(), null, -1, -1, 0, 0, -1, null, this, hash, pfbFile.lastModified())); - if (LOG.isTraceEnabled()) - { - LOG.trace("PFB: '" + type1.getName() + "' / '" + type1.getFamilyName() + "' / '" + - type1.getWeight() + "'"); - } + LOG.trace("PFB: '{}' / '{}' / '{}'", type1.getName(), type1.getFamilyName(), + type1.getWeight()); } catch (IOException e) { - LOG.warn("Could not load font file: " + pfbFile, e); + LOG.warn("Could not load font file: {}", pfbFile, e); } } Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FontMapperImpl.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FontMapperImpl.java?rev=1913377&r1=1913376&r2=1913377&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FontMapperImpl.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FontMapperImpl.java Fri Oct 27 06:05:21 2023 @@ -29,8 +29,8 @@ import java.util.Locale; import java.util.Map; import java.util.PriorityQueue; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; import org.apache.fontbox.FontBoxFont; import org.apache.fontbox.ttf.OpenTypeFont; import org.apache.fontbox.ttf.TTFParser; @@ -46,7 +46,7 @@ import org.apache.pdfbox.pdmodel.font.St */ final class FontMapperImpl implements FontMapper { - private static final Log LOG = LogFactory.getLog(FontMapperImpl.class); + private static final Logger LOG = LogManager.getLogger(FontMapperImpl.class); private static final FontCache fontCache = new FontCache(); // todo: static cache isn't ideal private FontProvider fontProvider; @@ -472,10 +472,7 @@ final class FontMapperImpl implements Fo FontInfo info = fontInfoByName.get(postScriptName.toLowerCase(Locale.ENGLISH)); if (info != null && info.getFormat() == format) { - if (LOG.isDebugEnabled()) - { - LOG.debug(String.format("getFont('%s','%s') returns %s", format, postScriptName, info)); - } + LOG.debug(String.format("getFont('%s','%s') returns %s", format, postScriptName, info)); return info; } return null; @@ -522,10 +519,7 @@ final class FontMapperImpl implements Fo FontMatch bestMatch = queue.poll(); if (bestMatch != null) { - if (LOG.isDebugEnabled()) - { - LOG.debug("Best match for '" + baseFont + "': " + bestMatch.info); - } + LOG.debug("Best match for '{}': {}", baseFont, bestMatch.info); FontBoxFont font = bestMatch.info.getFont(); if (font instanceof OpenTypeFont) {
