diff options
author | Dominik Stadler <centic@apache.org> | 2021-11-07 14:59:40 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2021-11-07 14:59:40 +0000 |
commit | 034c95ec55ea4770b02a02466c5c8dacf3329066 (patch) | |
tree | a376feb1fbf48220bc8f5d7641529046c945a69a /poi/src | |
parent | 4e7b994c2516473429ebc23f2b5acec131f60b67 (diff) | |
download | poi-034c95ec55ea4770b02a02466c5c8dacf3329066.tar.gz poi-034c95ec55ea4770b02a02466c5c8dacf3329066.zip |
Add some more forbidden-apis to prefer core JDK classes over Guava and commons-codec
Also prevent java logging from being used inadvertently
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1894810 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi/src')
3 files changed, 20 insertions, 20 deletions
diff --git a/poi/src/main/java/org/apache/poi/poifs/crypt/agile/EncryptionDocument.java b/poi/src/main/java/org/apache/poi/poifs/crypt/agile/EncryptionDocument.java index 07004d05a5..fd5e53a2b9 100644 --- a/poi/src/main/java/org/apache/poi/poifs/crypt/agile/EncryptionDocument.java +++ b/poi/src/main/java/org/apache/poi/poifs/crypt/agile/EncryptionDocument.java @@ -18,11 +18,11 @@ package org.apache.poi.poifs.crypt.agile; import java.util.ArrayList; +import java.util.Base64; import java.util.List; import javax.xml.XMLConstants; -import org.apache.commons.codec.binary.Base64; import org.apache.poi.EncryptedDocumentException; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -129,7 +129,7 @@ public class EncryptionDocument { static byte[] getBinAttr(Element el, String name) { String at = el.getAttribute(name); - return (at.isEmpty()) ? null : Base64.decodeBase64(at); + return (at.isEmpty()) ? null : Base64.getDecoder().decode(at); } static void setIntAttr(Element el, String name, Integer val) { @@ -144,7 +144,7 @@ public class EncryptionDocument { static void setBinAttr(Element el, String name, byte[] val) { if (val != null) { - setAttr(el, name, Base64.encodeBase64String(val)); + setAttr(el, name, Base64.getEncoder().encodeToString(val)); } } } diff --git a/poi/src/main/java/org/apache/poi/ss/format/CellFormat.java b/poi/src/main/java/org/apache/poi/ss/format/CellFormat.java index 66a8ea5c49..174ccf67b7 100644 --- a/poi/src/main/java/org/apache/poi/ss/format/CellFormat.java +++ b/poi/src/main/java/org/apache/poi/ss/format/CellFormat.java @@ -23,13 +23,14 @@ import java.util.List; import java.util.Locale; import java.util.Map; import java.util.WeakHashMap; -import java.util.logging.Level; -import java.util.logging.Logger; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.swing.JLabel; +import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellType; import org.apache.poi.ss.usermodel.ConditionalFormatting; @@ -93,7 +94,7 @@ import org.apache.poi.util.LocaleUtil; */ public class CellFormat { /** The logger to use in the formatting code. */ - private static final Logger LOG = Logger.getLogger(CellFormat.class.getName()); + private static final Logger LOG = LogManager.getLogger(CellFormat.class); private static final Pattern ONE_PART = Pattern.compile( CellFormatPart.FORMAT_PAT.pattern() + "(;|$)", @@ -191,7 +192,7 @@ public class CellFormat { parts.add(new CellFormatPart(locale, valueDesc)); } catch (RuntimeException e) { - LOG.log(Level.WARNING, "Invalid format: " + CellFormatter.quote(m.group()), e); + LOG.log(Level.WARN, "Invalid format: " + CellFormatter.quote(m.group()), e); parts.add(null); } } diff --git a/poi/src/main/java/org/apache/poi/ss/format/CellFormatPart.java b/poi/src/main/java/org/apache/poi/ss/format/CellFormatPart.java index 141c98e735..7cfe6cc17c 100644 --- a/poi/src/main/java/org/apache/poi/ss/format/CellFormatPart.java +++ b/poi/src/main/java/org/apache/poi/ss/format/CellFormatPart.java @@ -50,9 +50,8 @@ public class CellFormatPart { static final Map<String, Color> NAMED_COLORS; - private final Color color; - private CellFormatCondition condition; + private final CellFormatCondition condition; private final CellFormatter format; private final CellFormatType type; @@ -410,17 +409,17 @@ public class CellFormatPart { while (codePoints.hasNext()) { String ch = codePoints.next(); if ("\'".equals(ch) && type.isSpecial('\'')) { - sb.append('\u0000'); - continue; - } - - boolean special = type.isSpecial(ch.charAt(0)); - if (special) - sb.append("\'"); - sb.append(ch); - if (special) - sb.append("\'"); - } + sb.append('\u0000'); + continue; + } + + boolean special = type.isSpecial(ch.charAt(0)); + if (special) + sb.append("'"); + sb.append(ch); + if (special) + sb.append("'"); + } return sb.toString(); } |