mirror of https://github.com/apache/poi.git
try to make VariantSupport thread safe
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1921341 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
822974aadc
commit
24452a2ecb
|
@ -66,7 +66,7 @@ public class VariantSupport extends Variant {
|
||||||
* Keeps a list of the variant types an "unsupported" message has already
|
* Keeps a list of the variant types an "unsupported" message has already
|
||||||
* been issued for.
|
* been issued for.
|
||||||
*/
|
*/
|
||||||
private static List<Long> unsupportedMessage;
|
private static final List<Long> unsupportedMessage = new LinkedList<>();
|
||||||
|
|
||||||
private static final byte[] paddingBytes = new byte[3];
|
private static final byte[] paddingBytes = new byte[3];
|
||||||
|
|
||||||
|
@ -102,18 +102,18 @@ public class VariantSupport extends Variant {
|
||||||
*
|
*
|
||||||
* @param ex The exception to log
|
* @param ex The exception to log
|
||||||
*/
|
*/
|
||||||
protected static void writeUnsupportedTypeMessage
|
protected static void writeUnsupportedTypeMessage(final UnsupportedVariantTypeException ex) {
|
||||||
(final UnsupportedVariantTypeException ex) {
|
if (isLogUnsupportedTypes()) {
|
||||||
if (isLogUnsupportedTypes())
|
final Long vt = ex.getVariantType();
|
||||||
{
|
boolean needsLogging = false;
|
||||||
if (unsupportedMessage == null) {
|
synchronized (unsupportedMessage) {
|
||||||
unsupportedMessage = new LinkedList<>();
|
if (!unsupportedMessage.contains(vt)) {
|
||||||
|
needsLogging = true;
|
||||||
|
unsupportedMessage.add(vt);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Long vt = Long.valueOf(ex.getVariantType());
|
if (needsLogging) {
|
||||||
if (!unsupportedMessage.contains(vt))
|
|
||||||
{
|
|
||||||
LOG.atError().withThrowable(ex).log("Unsupported type");
|
LOG.atError().withThrowable(ex).log("Unsupported type");
|
||||||
unsupportedMessage.add(vt);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue