Skip to content

Optimize the debug log of the InMemoryJAASConfiguration class #318

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,11 @@ private InMemoryJAASConfiguration(Properties prop) {
}

public static void init(String propFile) throws AtlasException {
LOG.debug("==> InMemoryJAASConfiguration.init({})", propFile);

if (LOG.isDebugEnabled()) {
LOG.debug("==> Start to InMemoryJAASConfiguration.init({})", propFile);
}

InputStream in = null;

try {
Expand Down Expand Up @@ -176,25 +179,30 @@ public static void init(String propFile) throws AtlasException {
}
}
}

LOG.debug("<== InMemoryJAASConfiguration.init({})", propFile);
if (LOG.isDebugEnabled()) {
LOG.debug("==> End to InMemoryJAASConfiguration.init({})", propFile);
}
}

public static void init(org.apache.commons.configuration.Configuration atlasConfiguration) throws AtlasException {
LOG.debug("==> InMemoryJAASConfiguration.init()");

if (LOG.isDebugEnabled()) {
LOG.debug("==> Start to InMemoryJAASConfiguration.init({}) by atlasConfiguration");
}
if (atlasConfiguration != null && !atlasConfiguration.isEmpty()) {
Properties properties = ConfigurationConverter.getProperties(atlasConfiguration);
init(properties);
} else {
throw new AtlasException("Failed to load JAAS application properties: configuration NULL or empty!");
}

LOG.debug("<== InMemoryJAASConfiguration.init()");
if (LOG.isDebugEnabled()) {
LOG.debug("==> End to InMemoryJAASConfiguration.init({}) by atlasConfiguration");
}
}

public static void init(Properties properties) throws AtlasException {
LOG.debug("==> InMemoryJAASConfiguration.init()");
if (LOG.isDebugEnabled()) {
LOG.debug("==> Start to InMemoryJAASConfiguration.init({}) by properties");
}

if (MapUtils.isNotEmpty(properties)) {
InMemoryJAASConfiguration conf = new InMemoryJAASConfiguration(properties);
Expand All @@ -204,12 +212,15 @@ public static void init(Properties properties) throws AtlasException {
throw new AtlasException("Failed to load JAAS application properties: properties NULL or empty!");
}

LOG.debug("<== InMemoryJAASConfiguration.init()");
if (LOG.isDebugEnabled()) {
LOG.debug("==> End to InMemoryJAASConfiguration.init({}) by properties");
}
}

public static void setConfigSectionRedirect(String name, String redirectTo) {
LOG.debug("setConfigSectionRedirect({}, {})", name, redirectTo);

if (LOG.isDebugEnabled()) {
LOG.debug("setConfigSectionRedirect({}, {})", name, redirectTo);
}
if (name != null) {
if (redirectTo != null) {
CONFIG_SECTION_REDIRECTS.put(name, redirectTo);
Expand All @@ -221,8 +232,9 @@ public static void setConfigSectionRedirect(String name, String redirectTo) {

@Override
public AppConfigurationEntry[] getAppConfigurationEntry(String name) {
LOG.debug("==> InMemoryJAASConfiguration.getAppConfigurationEntry({})", name);

if (LOG.isDebugEnabled()) {
LOG.debug("==> InMemoryJAASConfiguration.getAppConfigurationEntry({})", name);
}
AppConfigurationEntry[] ret = null;
List<AppConfigurationEntry> retList = null;
String redirectedName = getConfigSectionRedirect(name);
Expand Down Expand Up @@ -256,7 +268,9 @@ public AppConfigurationEntry[] getAppConfigurationEntry(String name) {
}

private void initialize(Properties properties) {
LOG.debug("==> InMemoryJAASConfiguration.initialize()");
if (LOG.isDebugEnabled()) {
LOG.debug("==> InMemoryJAASConfiguration.initialize()");
}

int prefixLen = JAAS_CONFIG_PREFIX_PARAM.length();
Map<String, SortedSet<Integer>> jaasClients = new HashMap<>();
Expand Down Expand Up @@ -379,8 +393,10 @@ private void initialize(Properties properties) {
retList.add(entry);
}
}
if (LOG.isDebugEnabled()) {
LOG.debug("<== InMemoryJAASConfiguration.initialize({})", applicationConfigEntryMap);
}

LOG.debug("<== InMemoryJAASConfiguration.initialize({})", applicationConfigEntryMap);
}

private static boolean isNumeric(String str) {
Expand Down