[jiveproperties] Use DoOnce utility to log "JavaObject not enabled"

This commit is contained in:
Florian Schmaus 2021-11-01 19:27:22 +01:00
parent 7dc8cc176e
commit f2c2f45f18
1 changed files with 7 additions and 1 deletions

View File

@ -26,6 +26,7 @@ import java.util.logging.Logger;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.util.DoOnce;
import org.jivesoftware.smack.util.stringencoder.Base64;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
@ -35,6 +36,8 @@ import org.jivesoftware.smackx.jiveproperties.packet.JivePropertiesExtension;
public class JivePropertiesExtensionProvider extends ExtensionElementProvider<JivePropertiesExtension> {
private static final DoOnce LOG_OBJECT_NOT_ENABLED = new DoOnce();
private static final Logger LOGGER = Logger.getLogger(JivePropertiesExtensionProvider.class.getName());
/**
@ -113,7 +116,10 @@ public class JivePropertiesExtensionProvider extends ExtensionElementProvider<Ji
}
}
else {
LOGGER.severe("JavaObject is not enabled. Enable with JivePropertiesManager.setJavaObjectEnabled(true)");
LOG_OBJECT_NOT_ENABLED.once(
() -> LOGGER.severe(
"JavaObject is not enabled. Enable with JivePropertiesManager.setJavaObjectEnabled(true)")
);
}
}
if (name != null && value != null) {