aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/poi/hpsf/CodePageString.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/org/apache/poi/hpsf/CodePageString.java')
-rw-r--r--src/java/org/apache/poi/hpsf/CodePageString.java23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/java/org/apache/poi/hpsf/CodePageString.java b/src/java/org/apache/poi/hpsf/CodePageString.java
index 7cd6b5a9d7..4ba9b0d063 100644
--- a/src/java/org/apache/poi/hpsf/CodePageString.java
+++ b/src/java/org/apache/poi/hpsf/CodePageString.java
@@ -20,21 +20,23 @@ import java.io.IOException;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.apache.poi.util.CodePageUtil;
import org.apache.poi.util.IOUtils;
import org.apache.poi.util.Internal;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.LittleEndianByteArrayInputStream;
import org.apache.poi.util.LittleEndianConsts;
-import org.apache.poi.util.POILogFactory;
-import org.apache.poi.util.POILogger;
+
+import static org.apache.logging.log4j.util.Unbox.box;
@Internal
public class CodePageString {
//arbitrarily selected; may need to increase
private static final int MAX_RECORD_LENGTH = 100_000;
- private static final POILogger LOG = POILogFactory.getLogger( CodePageString.class );
+ private static final Logger LOG = LogManager.getLogger(CodePageString.class);
private byte[] _value;
@@ -61,8 +63,7 @@ public class CodePageString {
// TODO Some files, such as TestVisioWithCodepage.vsd, are currently
// triggering this for values that don't look like codepages
// See Bug #52258 for details
- String msg = "CodePageString started at offset #" + offset + " is not NULL-terminated";
- LOG.log(POILogger.WARN, msg);
+ LOG.atWarn().log("CodePageString started at offset #{} is not NULL-terminated", box(offset));
}
TypedPropertyValue.skipPadding(lei);
@@ -75,17 +76,13 @@ public class CodePageString {
final int terminator = result.indexOf( '\0' );
if ( terminator == -1 ) {
- String msg =
- "String terminator (\\0) for CodePageString property value not found. " +
- "Continue without trimming and hope for the best.";
- LOG.log(POILogger.WARN, msg);
+ LOG.atWarn().log("String terminator (\\0) for CodePageString property value not found. " +
+ "Continue without trimming and hope for the best.");
return result;
}
if ( terminator != result.length() - 1 ) {
- String msg =
- "String terminator (\\0) for CodePageString property value occured before the end of string. "+
- "Trimming and hope for the best.";
- LOG.log(POILogger.WARN, msg );
+ LOG.atWarn().log("String terminator (\\0) for CodePageString property value occurred before the end of " +
+ "string. Trimming and hope for the best.");
}
return result.substring( 0, terminator );
}