ATLAS-1407: improve LOG statement performance Signed-off-by: Madhan Neethiraj <[email protected]>
Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/40e639ed Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/40e639ed Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/40e639ed Branch: refs/heads/master Commit: 40e639eddf377e683ff4a1ba88fb6c120eb36ab3 Parents: 3725dcf Author: apoorvnaik <[email protected]> Authored: Tue Dec 20 09:00:41 2016 -0800 Committer: Madhan Neethiraj <[email protected]> Committed: Wed Dec 21 15:47:34 2016 -0800 ---------------------------------------------------------------------- .../atlas/falcon/service/AtlasService.java | 16 +++---- .../apache/atlas/falcon/hook/FalconHook.java | 2 +- .../apache/atlas/falcon/hook/FalconHookIT.java | 2 +- .../org/apache/atlas/hive/hook/HiveHook.java | 4 +- .../atlas/hive/bridge/HiveMetaStoreBridge.java | 18 ++++---- .../java/org/apache/atlas/hive/HiveITBase.java | 2 +- .../org/apache/atlas/sqoop/hook/SqoopHook.java | 4 +- .../apache/atlas/storm/hook/StormAtlasHook.java | 4 +- .../atlas/authorize/AtlasAuthorizerFactory.java | 4 +- .../simple/AtlasAuthorizationUtils.java | 20 ++++---- .../atlas/authorize/simple/PolicyParser.java | 4 +- .../atlas/authorize/simple/PolicyUtil.java | 11 ++--- .../authorize/simple/SimpleAtlasAuthorizer.java | 37 +++++++-------- .../atlas/catalog/query/QueryFactory.java | 2 +- .../security/InMemoryJAASConfiguration.java | 14 ++---- .../org/apache/atlas/utils/AtlasPerfTracer.java | 2 +- .../org/apache/atlas/model/ModelTestUtil.java | 28 ++++++------ .../java/org/apache/atlas/hook/AtlasHook.java | 6 +-- .../apache/atlas/kafka/KafkaNotification.java | 2 +- .../classloader/AtlasPluginClassLoader.java | 48 +++++++++----------- .../classloader/AtlasPluginClassLoaderUtil.java | 18 ++++---- release-log.txt | 1 + .../atlas/GraphTransactionInterceptor.java | 2 +- .../graph/GraphBackedMetadataRepository.java | 2 +- .../atlas/repository/graph/GraphHelper.java | 2 +- .../graph/TypedInstanceToGraphMapper.java | 2 +- .../bootstrap/AtlasTypeDefStoreInitializer.java | 7 ++- .../atlas/services/DefaultMetadataService.java | 4 +- .../org/apache/atlas/aspect/AtlasAspect.java | 5 +- .../apache/atlas/ha/AtlasServerIdSelector.java | 6 +-- .../notification/NotificationHookConsumer.java | 4 +- .../java/org/apache/atlas/web/dao/UserDao.java | 9 ++-- .../web/filters/AtlasAuthenticationFilter.java | 17 +++---- .../web/filters/AtlasAuthorizationFilter.java | 45 ++++++++---------- .../AtlasKnoxSSOAuthenticationFilter.java | 2 +- .../atlas/web/listeners/GuiceServletConfig.java | 2 +- .../atlas/web/resources/EntityResource.java | 4 +- .../org/apache/atlas/web/setup/AtlasSetup.java | 2 +- .../org/apache/atlas/web/setup/SetupSteps.java | 2 +- .../notification/EntityNotificationIT.java | 6 +-- .../web/resources/EntityJerseyResourceIT.java | 26 +++++------ .../web/security/FileAuthenticationTest.java | 12 ++--- 42 files changed, 193 insertions(+), 217 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40e639ed/addons/falcon-bridge-shim/src/main/java/org/apache/atlas/falcon/service/AtlasService.java ---------------------------------------------------------------------- diff --git a/addons/falcon-bridge-shim/src/main/java/org/apache/atlas/falcon/service/AtlasService.java b/addons/falcon-bridge-shim/src/main/java/org/apache/atlas/falcon/service/AtlasService.java index 6b4486a..2b756de 100755 --- a/addons/falcon-bridge-shim/src/main/java/org/apache/atlas/falcon/service/AtlasService.java +++ b/addons/falcon-bridge-shim/src/main/java/org/apache/atlas/falcon/service/AtlasService.java @@ -112,7 +112,7 @@ public class AtlasService implements FalconService, ConfigurationChangeListener @Override public void onAdd(Entity entity) throws FalconException { if (LOG.isDebugEnabled()) { - LOG.debug("==> AtlasService.onAdd(" + entity + ")"); + LOG.debug("==> AtlasService.onAdd({})", entity); } try { @@ -123,14 +123,14 @@ public class AtlasService implements FalconService, ConfigurationChangeListener } if (LOG.isDebugEnabled()) { - LOG.debug("<== AtlasService.onAdd(" + entity + ")"); + LOG.debug("<== AtlasService.onAdd({})", entity); } } @Override public void onRemove(Entity entity) throws FalconException { if (LOG.isDebugEnabled()) { - LOG.debug("==> AtlasService.onRemove(" + entity + ")"); + LOG.debug("==> AtlasService.onRemove({})", entity); } try { @@ -141,14 +141,14 @@ public class AtlasService implements FalconService, ConfigurationChangeListener } if (LOG.isDebugEnabled()) { - LOG.debug("<== AtlasService.onRemove(" + entity + ")"); + LOG.debug("<== AtlasService.onRemove({})", entity); } } @Override public void onChange(Entity entity, Entity entity1) throws FalconException { if (LOG.isDebugEnabled()) { - LOG.debug("==> AtlasService.onChange(" + entity + ", " + entity1 + ")"); + LOG.debug("==> AtlasService.onChange({}, {})", entity, entity1); } try { @@ -159,14 +159,14 @@ public class AtlasService implements FalconService, ConfigurationChangeListener } if (LOG.isDebugEnabled()) { - LOG.debug("<== AtlasService.onChange(" + entity + ", " + entity1 + ")"); + LOG.debug("<== AtlasService.onChange({}, {})", entity, entity1); } } @Override public void onReload(Entity entity) throws FalconException { if (LOG.isDebugEnabled()) { - LOG.debug("==> AtlasService.onReload(" + entity + ")"); + LOG.debug("==> AtlasService.onReload({})", entity); } try { @@ -177,7 +177,7 @@ public class AtlasService implements FalconService, ConfigurationChangeListener } if (LOG.isDebugEnabled()) { - LOG.debug("<== AtlasService.onReload(" + entity + ")"); + LOG.debug("<== AtlasService.onReload({})", entity); } } http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40e639ed/addons/falcon-bridge/src/main/java/org/apache/atlas/falcon/hook/FalconHook.java ---------------------------------------------------------------------- diff --git a/addons/falcon-bridge/src/main/java/org/apache/atlas/falcon/hook/FalconHook.java b/addons/falcon-bridge/src/main/java/org/apache/atlas/falcon/hook/FalconHook.java index b6312d7..842b2ce 100644 --- a/addons/falcon-bridge/src/main/java/org/apache/atlas/falcon/hook/FalconHook.java +++ b/addons/falcon-bridge/src/main/java/org/apache/atlas/falcon/hook/FalconHook.java @@ -142,7 +142,7 @@ public class FalconHook extends AtlasHook implements FalconEventPublisher { }); } } catch (Throwable t) { - LOG.warn("Error in processing data " + data, t); + LOG.warn("Error in processing data {}", data, t); } } http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40e639ed/addons/falcon-bridge/src/test/java/org/apache/atlas/falcon/hook/FalconHookIT.java ---------------------------------------------------------------------- diff --git a/addons/falcon-bridge/src/test/java/org/apache/atlas/falcon/hook/FalconHookIT.java b/addons/falcon-bridge/src/test/java/org/apache/atlas/falcon/hook/FalconHookIT.java index 2acc575..e2d4bbb 100644 --- a/addons/falcon-bridge/src/test/java/org/apache/atlas/falcon/hook/FalconHookIT.java +++ b/addons/falcon-bridge/src/test/java/org/apache/atlas/falcon/hook/FalconHookIT.java @@ -343,7 +343,7 @@ public class FalconHookIT { if (System.currentTimeMillis() >= mustEnd) { fail("Assertions failed. Failing after waiting for timeout " + timeout + " msecs", e); } - LOG.debug("Waiting up to " + (mustEnd - System.currentTimeMillis()) + " msec as assertion failed", e); + LOG.debug("Waiting up to {} msec as assertion failed", mustEnd - System.currentTimeMillis(), e); Thread.sleep(400); } } http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40e639ed/addons/hive-bridge-shim/src/main/java/org/apache/atlas/hive/hook/HiveHook.java ---------------------------------------------------------------------- diff --git a/addons/hive-bridge-shim/src/main/java/org/apache/atlas/hive/hook/HiveHook.java b/addons/hive-bridge-shim/src/main/java/org/apache/atlas/hive/hook/HiveHook.java index f4ca94f..2a4d067 100755 --- a/addons/hive-bridge-shim/src/main/java/org/apache/atlas/hive/hook/HiveHook.java +++ b/addons/hive-bridge-shim/src/main/java/org/apache/atlas/hive/hook/HiveHook.java @@ -44,7 +44,7 @@ public class HiveHook implements ExecuteWithHookContext { @Override public void run(final HookContext hookContext) throws Exception { if (LOG.isDebugEnabled()) { - LOG.debug("==> HiveHook.run(" + hookContext + ")"); + LOG.debug("==> HiveHook.run({})", hookContext); } try { @@ -55,7 +55,7 @@ public class HiveHook implements ExecuteWithHookContext { } if (LOG.isDebugEnabled()) { - LOG.debug("<== HiveHook.run(" + hookContext + ")"); + LOG.debug("<== HiveHook.run({})", hookContext); } } http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40e639ed/addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java ---------------------------------------------------------------------- diff --git a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java index 0f8afd5..dce55c4 100755 --- a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java +++ b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java @@ -179,7 +179,7 @@ public class HiveMetaStoreBridge { } private Referenceable createOrUpdateDBInstance(Database hiveDB, Referenceable dbRef) { - LOG.info("Importing objects from databaseName : " + hiveDB.getName()); + LOG.info("Importing objects from databaseName : {}", hiveDB.getName()); if (dbRef == null) { dbRef = new Referenceable(HiveDataTypes.HIVE_DB.getName()); @@ -206,12 +206,12 @@ public class HiveMetaStoreBridge { */ private Referenceable registerInstance(Referenceable referenceable) throws Exception { String typeName = referenceable.getTypeName(); - LOG.debug("creating instance of type " + typeName); + LOG.debug("creating instance of type {}", typeName); String entityJSON = InstanceSerialization.toJson(referenceable, true); LOG.debug("Submitting new entity {} = {}", referenceable.getTypeName(), entityJSON); List<String> guids = getAtlasClient().createEntity(entityJSON); - LOG.debug("created instance for type " + typeName + ", guid: " + guids); + LOG.debug("created instance for type {}, guid: {}", typeName, guids); return new Referenceable(guids.get(guids.size() - 1), referenceable.getTypeName(), null); } @@ -497,9 +497,9 @@ public class HiveMetaStoreBridge { private Referenceable registerTable(Referenceable dbReference, Table table) throws Exception { String dbName = table.getDbName(); String tableName = table.getTableName(); - LOG.info("Attempting to register table [" + tableName + "]"); + LOG.info("Attempting to register table [{}]", tableName); Referenceable tableReference = getTableReference(table); - LOG.info("Found result " + tableReference); + LOG.info("Found result {}", tableReference); if (tableReference == null) { tableReference = createTableInstance(dbReference, table); tableReference = registerInstance(tableReference); @@ -514,7 +514,7 @@ public class HiveMetaStoreBridge { private void updateInstance(Referenceable referenceable) throws AtlasServiceException { String typeName = referenceable.getTypeName(); - LOG.debug("updating instance of type " + typeName); + LOG.debug("updating instance of type {}", typeName); String entityJSON = InstanceSerialization.toJson(referenceable, true); LOG.debug("Updating entity {} = {}", referenceable.getTypeName(), entityJSON); @@ -524,13 +524,13 @@ public class HiveMetaStoreBridge { public Referenceable fillStorageDesc(StorageDescriptor storageDesc, String tableQualifiedName, String sdQualifiedName, Id tableId) throws Exception { - LOG.debug("Filling storage descriptor information for " + storageDesc); + LOG.debug("Filling storage descriptor information for {}", storageDesc); Referenceable sdReferenceable = new Referenceable(HiveDataTypes.HIVE_STORAGEDESC.getName()); sdReferenceable.set(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, sdQualifiedName); SerDeInfo serdeInfo = storageDesc.getSerdeInfo(); - LOG.debug("serdeInfo = " + serdeInfo); + LOG.debug("serdeInfo = {}", serdeInfo); // SkewedInfo skewedInfo = storageDesc.getSkewedInfo(); String serdeInfoName = HiveDataTypes.HIVE_SERDE.getName(); @@ -594,7 +594,7 @@ public class HiveMetaStoreBridge { List<Referenceable> colList = new ArrayList<>(); int columnPosition = 0; for (FieldSchema fs : schemaList) { - LOG.debug("Processing field " + fs); + LOG.debug("Processing field {}", fs); Referenceable colReferenceable = new Referenceable(HiveDataTypes.HIVE_COLUMN.getName()); colReferenceable.set(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, getColumnQualifiedName((String) tableReference.get(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME), fs.getName())); http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40e639ed/addons/hive-bridge/src/test/java/org/apache/atlas/hive/HiveITBase.java ---------------------------------------------------------------------- diff --git a/addons/hive-bridge/src/test/java/org/apache/atlas/hive/HiveITBase.java b/addons/hive-bridge/src/test/java/org/apache/atlas/hive/HiveITBase.java index 4b736a8..3e20cf0 100644 --- a/addons/hive-bridge/src/test/java/org/apache/atlas/hive/HiveITBase.java +++ b/addons/hive-bridge/src/test/java/org/apache/atlas/hive/HiveITBase.java @@ -201,7 +201,7 @@ public class HiveITBase { if (System.currentTimeMillis() >= mustEnd) { fail("Assertions failed. Failing after waiting for timeout " + timeout + " msecs", e); } - LOG.debug("Waiting up to " + (mustEnd - System.currentTimeMillis()) + " msec as assertion failed", e); + LOG.debug("Waiting up to {} msec as assertion failed", mustEnd - System.currentTimeMillis(), e); Thread.sleep(5000); } } http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40e639ed/addons/sqoop-bridge-shim/src/main/java/org/apache/atlas/sqoop/hook/SqoopHook.java ---------------------------------------------------------------------- diff --git a/addons/sqoop-bridge-shim/src/main/java/org/apache/atlas/sqoop/hook/SqoopHook.java b/addons/sqoop-bridge-shim/src/main/java/org/apache/atlas/sqoop/hook/SqoopHook.java index 1170cb6..08b8587 100644 --- a/addons/sqoop-bridge-shim/src/main/java/org/apache/atlas/sqoop/hook/SqoopHook.java +++ b/addons/sqoop-bridge-shim/src/main/java/org/apache/atlas/sqoop/hook/SqoopHook.java @@ -43,7 +43,7 @@ public class SqoopHook extends SqoopJobDataPublisher { @Override public void publish(SqoopJobDataPublisher.Data data) throws Exception { if (LOG.isDebugEnabled()) { - LOG.debug("==> SqoopHook.run(" + data + ")"); + LOG.debug("==> SqoopHook.run({})", data); } try { @@ -54,7 +54,7 @@ public class SqoopHook extends SqoopJobDataPublisher { } if (LOG.isDebugEnabled()) { - LOG.debug("<== SqoopHook.run(" + data + ")"); + LOG.debug("<== SqoopHook.run({})", data); } } http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40e639ed/addons/storm-bridge-shim/src/main/java/org/apache/atlas/storm/hook/StormAtlasHook.java ---------------------------------------------------------------------- diff --git a/addons/storm-bridge-shim/src/main/java/org/apache/atlas/storm/hook/StormAtlasHook.java b/addons/storm-bridge-shim/src/main/java/org/apache/atlas/storm/hook/StormAtlasHook.java index 2d304c5..45eac72 100644 --- a/addons/storm-bridge-shim/src/main/java/org/apache/atlas/storm/hook/StormAtlasHook.java +++ b/addons/storm-bridge-shim/src/main/java/org/apache/atlas/storm/hook/StormAtlasHook.java @@ -49,7 +49,7 @@ public class StormAtlasHook implements ISubmitterHook { public void notify(TopologyInfo topologyInfo, Map stormConf, StormTopology stormTopology) throws IllegalAccessException { if (LOG.isDebugEnabled()) { - LOG.debug("==> StormAtlasHook.notify(" + topologyInfo + ", " + stormConf + ", " + stormTopology + ")"); + LOG.debug("==> StormAtlasHook.notify({}, {}, {})", topologyInfo, stormConf, stormTopology); } try { @@ -60,7 +60,7 @@ public class StormAtlasHook implements ISubmitterHook { } if (LOG.isDebugEnabled()) { - LOG.debug("<== StormAtlasHook.notify(" + topologyInfo + ", " + stormConf + ", " + stormTopology + ")"); + LOG.debug("<== StormAtlasHook.notify({}, {}, {})", topologyInfo, stormConf, stormTopology); } } http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40e639ed/authorization/src/main/java/org/apache/atlas/authorize/AtlasAuthorizerFactory.java ---------------------------------------------------------------------- diff --git a/authorization/src/main/java/org/apache/atlas/authorize/AtlasAuthorizerFactory.java b/authorization/src/main/java/org/apache/atlas/authorize/AtlasAuthorizerFactory.java index 5aad72d..9b7933e 100644 --- a/authorization/src/main/java/org/apache/atlas/authorize/AtlasAuthorizerFactory.java +++ b/authorization/src/main/java/org/apache/atlas/authorize/AtlasAuthorizerFactory.java @@ -62,7 +62,7 @@ public class AtlasAuthorizerFactory { } if (isDebugEnabled) { - LOG.debug("Initializing Authorizer :: " + authorizerClass); + LOG.debug("Initializing Authorizer :: {}", authorizerClass); } try { Class authorizerMetaObject = Class.forName(authorizerClass); @@ -70,7 +70,7 @@ public class AtlasAuthorizerFactory { INSTANCE = (AtlasAuthorizer) authorizerMetaObject.newInstance(); } } catch (Exception e) { - LOG.error("Error while creating authorizer of type '" + authorizerClass + "'", e); + LOG.error("Error while creating authorizer of type '{}", authorizerClass, e); throw new AtlasAuthorizationException("Error while creating authorizer of type '" + authorizerClass + "'", e); } http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40e639ed/authorization/src/main/java/org/apache/atlas/authorize/simple/AtlasAuthorizationUtils.java ---------------------------------------------------------------------- diff --git a/authorization/src/main/java/org/apache/atlas/authorize/simple/AtlasAuthorizationUtils.java b/authorization/src/main/java/org/apache/atlas/authorize/simple/AtlasAuthorizationUtils.java index ebfb964..9f33115 100644 --- a/authorization/src/main/java/org/apache/atlas/authorize/simple/AtlasAuthorizationUtils.java +++ b/authorization/src/main/java/org/apache/atlas/authorize/simple/AtlasAuthorizationUtils.java @@ -36,7 +36,7 @@ public class AtlasAuthorizationUtils { public static String getApi(String contextPath) { if (isDebugEnabled) { - LOG.debug("==> getApi from " + contextPath); + LOG.debug("==> getApi from {}", contextPath); } if (contextPath.startsWith(BASE_URL)) { contextPath = contextPath.substring(BASE_URL.length()); @@ -74,14 +74,14 @@ public class AtlasAuthorizationUtils { break; default: if (isDebugEnabled) { - LOG.debug("getAtlasAction(): Invalid HTTP method '" + method + "'"); + LOG.debug("getAtlasAction(): Invalid HTTP method '{}", method); } break; } if (isDebugEnabled) { - LOG.debug("<== AtlasAuthorizationFilter getAtlasAction HTTP Method " + method + " mapped to AtlasAction : " - + action); + LOG.debug("<== AtlasAuthorizationFilter getAtlasAction HTTP Method {} mapped to AtlasAction : {}", + method, action); } return action; } @@ -96,15 +96,15 @@ public class AtlasAuthorizationUtils { * entities,lineage and discovery apis are mapped with AtlasResourceTypes.ENTITY eg :- /api/atlas/lineage/hive/table/* * /api/atlas/entities/{guid}* /api/atlas/discovery/* * - * taxonomy API are also mapped to AtlasResourceTypes.TAXONOMY & AtlasResourceTypes.ENTITY and its terms APIs have + * taxonomy API are also mapped to AtlasResourceTypes.TAXONOMY & AtlasResourceTypes.ENTITY and its terms APIs have * added AtlasResourceTypes.TERM associations. - * + * * unprotected types are mapped with AtlasResourceTypes.UNKNOWN, access to these are allowed. */ public static Set<AtlasResourceTypes> getAtlasResourceType(String contextPath) { Set<AtlasResourceTypes> resourceTypes = new HashSet<>(); if (isDebugEnabled) { - LOG.debug("==> getAtlasResourceType for " + contextPath); + LOG.debug("==> getAtlasResourceType for {}", contextPath); } String api = getApi(contextPath); if (api.startsWith("types")) { @@ -125,13 +125,13 @@ public class AtlasAuthorizationUtils { resourceTypes.add(AtlasResourceTypes.TERM); } } else { - LOG.error("Unable to find Atlas Resource corresponding to : " + api + "\nSetting " - + AtlasResourceTypes.UNKNOWN.name()); + LOG.error("Unable to find Atlas Resource corresponding to : {}\nSetting {}" + , api, AtlasResourceTypes.UNKNOWN.name()); resourceTypes.add(AtlasResourceTypes.UNKNOWN); } if (isDebugEnabled) { - LOG.debug("<== Returning AtlasResource/s " + resourceTypes + " for api " + api); + LOG.debug("<== Returning AtlasResources {} for api {}", resourceTypes, api); } return resourceTypes; } http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40e639ed/authorization/src/main/java/org/apache/atlas/authorize/simple/PolicyParser.java ---------------------------------------------------------------------- diff --git a/authorization/src/main/java/org/apache/atlas/authorize/simple/PolicyParser.java b/authorization/src/main/java/org/apache/atlas/authorize/simple/PolicyParser.java index 5740a1c..7ef49e6 100644 --- a/authorization/src/main/java/org/apache/atlas/authorize/simple/PolicyParser.java +++ b/authorization/src/main/java/org/apache/atlas/authorize/simple/PolicyParser.java @@ -71,7 +71,7 @@ public class PolicyParser { default: if (LOG.isErrorEnabled()) { - LOG.error("Invalid action: '" + access + "'"); + LOG.error("Invalid action: '{}'", access); } break; } @@ -108,7 +108,7 @@ public class PolicyParser { String[] props = data.split(";;"); if (props.length < RESOURCE_INDEX) { - LOG.warn("skipping invalid policy line: " + data); + LOG.warn("skipping invalid policy line: {}", data); } else { def = new PolicyDef(); def.setPolicyName(props[POLICYNAME]); http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40e639ed/authorization/src/main/java/org/apache/atlas/authorize/simple/PolicyUtil.java ---------------------------------------------------------------------- diff --git a/authorization/src/main/java/org/apache/atlas/authorize/simple/PolicyUtil.java b/authorization/src/main/java/org/apache/atlas/authorize/simple/PolicyUtil.java index 8a3850f..0465c48 100644 --- a/authorization/src/main/java/org/apache/atlas/authorize/simple/PolicyUtil.java +++ b/authorization/src/main/java/org/apache/atlas/authorize/simple/PolicyUtil.java @@ -36,15 +36,14 @@ public class PolicyUtil { public Map<String, Map<AtlasResourceTypes, List<String>>> createPermissionMap(List<PolicyDef> policyDefList, AtlasActionTypes permissionType, SimpleAtlasAuthorizer.AtlasAccessorTypes principalType) { if (isDebugEnabled) { - LOG.debug("==> PolicyUtil createPermissionMap" + "\nCreating Permission Map for :: " + permissionType - + " & " + principalType); + LOG.debug("==> PolicyUtil createPermissionMap\nCreating Permission Map for :: {} & {}", permissionType, principalType); } Map<String, Map<AtlasResourceTypes, List<String>>> userReadMap = new HashMap<>(); // Iterate over the list of policies to create map for (PolicyDef policyDef : policyDefList) { - LOG.info("Processing policy def : " + policyDef); + LOG.info("Processing policy def : {}", policyDef); Map<String, List<AtlasActionTypes>> principalMap = principalType.equals(SimpleAtlasAuthorizer.AtlasAccessorTypes.USER) ? policyDef.getUsers() : policyDef .getGroups(); @@ -61,7 +60,7 @@ public class PolicyUtil { // If its not added then create a new resource list if (userResourceList == null) { if (isDebugEnabled) { - LOG.debug("Resource list not found for " + username + ", creating it"); + LOG.debug("Resource list not found for {}, creating it", username); } userResourceList = new HashMap<>(); } @@ -89,11 +88,11 @@ public class PolicyUtil { userResourceList.put(type, resourceList); } userReadMap.put(username, userResourceList); - LOG.info("userReadMap " + userReadMap); + LOG.info("userReadMap {}", userReadMap); } } if (isDebugEnabled) { - LOG.debug("Returning Map for " + principalType + " :: " + userReadMap); + LOG.debug("Returning Map for {} :: {}", principalType, userReadMap); LOG.debug("<== PolicyUtil createPermissionMap"); } return userReadMap; http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40e639ed/authorization/src/main/java/org/apache/atlas/authorize/simple/SimpleAtlasAuthorizer.java ---------------------------------------------------------------------- diff --git a/authorization/src/main/java/org/apache/atlas/authorize/simple/SimpleAtlasAuthorizer.java b/authorization/src/main/java/org/apache/atlas/authorize/simple/SimpleAtlasAuthorizer.java index 5956f5c..d6e7853 100644 --- a/authorization/src/main/java/org/apache/atlas/authorize/simple/SimpleAtlasAuthorizer.java +++ b/authorization/src/main/java/org/apache/atlas/authorize/simple/SimpleAtlasAuthorizer.java @@ -79,14 +79,14 @@ public final class SimpleAtlasAuthorizer implements AtlasAuthorizer { optIgnoreCase = Boolean.valueOf(PropertiesUtil.getProperty("optIgnoreCase", "false")); if (isDebugEnabled) { - LOG.debug("Read from PropertiesUtil --> optIgnoreCase :: " + optIgnoreCase); + LOG.debug("Read from PropertiesUtil --> optIgnoreCase :: {}", optIgnoreCase); } Configuration configuration = ApplicationProperties.get(); String policyStorePath = configuration.getString("atlas.auth.policy.file", System.getProperty("atlas.conf")+"/policy-store.txt"); if (isDebugEnabled) { - LOG.debug("Loading Apache Atlas policies from : " + policyStorePath); + LOG.debug("Loading Apache Atlas policies from : {}", policyStorePath); } List<String> policies = FileReaderUtil.readFile(policyStorePath); @@ -103,10 +103,10 @@ public final class SimpleAtlasAuthorizer implements AtlasAuthorizer { groupDeleteMap = util.createPermissionMap(policyDef, AtlasActionTypes.DELETE, AtlasAccessorTypes.GROUP); if (isDebugEnabled) { - LOG.debug("\n\nUserReadMap :: " + userReadMap + "\nGroupReadMap :: " + groupReadMap); - LOG.debug("\n\nUserWriteMap :: " + userWriteMap + "\nGroupWriteMap :: " + groupWriteMap); - LOG.debug("\n\nUserUpdateMap :: " + userUpdateMap + "\nGroupUpdateMap :: " + groupUpdateMap); - LOG.debug("\n\nUserDeleteMap :: " + userDeleteMap + "\nGroupDeleteMap :: " + groupDeleteMap); + LOG.debug("\n\nUserReadMap :: {}\nGroupReadMap :: {}", userReadMap, groupReadMap); + LOG.debug("\n\nUserWriteMap :: {}\nGroupWriteMap :: {}", userWriteMap, groupWriteMap); + LOG.debug("\n\nUserUpdateMap :: {}\nGroupUpdateMap :: {}", userUpdateMap, groupUpdateMap); + LOG.debug("\n\nUserDeleteMap :: {}\nGroupDeleteMap :: {}", userDeleteMap, groupDeleteMap); } } catch (IOException | AtlasException e) { @@ -121,7 +121,7 @@ public final class SimpleAtlasAuthorizer implements AtlasAuthorizer { public boolean isAccessAllowed(AtlasAccessRequest request) throws AtlasAuthorizationException { if (isDebugEnabled) { LOG.debug("==> SimpleAtlasAuthorizer isAccessAllowed"); - LOG.debug("isAccessAllowd(" + request + ")"); + LOG.debug("isAccessAllowd({})", request); } String user = request.getUser(); Set<String> groups = request.getUserGroups(); @@ -129,8 +129,7 @@ public final class SimpleAtlasAuthorizer implements AtlasAuthorizer { String resource = request.getResource(); Set<AtlasResourceTypes> resourceTypes = request.getResourceTypes(); if (isDebugEnabled) - LOG.debug("Checking for :: \nUser :: " + user + "\nGroups :: " + groups + "\nAction :: " + action - + "\nResource :: " + resource); + LOG.debug("Checking for :: \nUser :: {}\nGroups :: {}\nAction :: {}\nResource :: {}", user, groups, action, resource); boolean isAccessAllowed = false; boolean isUser = user != null; @@ -143,7 +142,7 @@ public final class SimpleAtlasAuthorizer implements AtlasAuthorizer { return isAccessAllowed; } else { if (isDebugEnabled) { - LOG.debug("checkAccess for Operation :: " + action + " on Resource " + resourceTypes + ":" + resource); + LOG.debug("checkAccess for Operation :: {} on Resource {}:{}", action, resourceTypes, resource); } switch (action) { case READ: @@ -168,14 +167,14 @@ public final class SimpleAtlasAuthorizer implements AtlasAuthorizer { break; default: if (isDebugEnabled) { - LOG.debug("Invalid Action " + action+"\nRaising AtlasAuthorizationException!!!"); + LOG.debug("Invalid Action {}\nRaising AtlasAuthorizationException!!!", action); } throw new AtlasAuthorizationException("Invalid Action :: " + action); } } if (isDebugEnabled) { - LOG.debug("<== SimpleAtlasAuthorizer isAccessAllowed = " + isAccessAllowed); + LOG.debug("<== SimpleAtlasAuthorizer isAccessAllowed = {}", isAccessAllowed); } return isAccessAllowed; @@ -185,8 +184,7 @@ public final class SimpleAtlasAuthorizer implements AtlasAuthorizer { Map<String, Map<AtlasResourceTypes, List<String>>> map) { if (isDebugEnabled) { LOG.debug("==> SimpleAtlasAuthorizer checkAccess"); - LOG.debug("Now checking access for accessor : " + accessor + "\nResource Types : " + resourceTypes - + "\nResource : " + resource + "\nMap : " + map); + LOG.debug("Now checking access for accessor : {}\nResource Types : {}\nResource : {}\nMap : {}", accessor, resourceTypes, resource, map); } boolean result = true; Map<AtlasResourceTypes, List<String>> rescMap = map.get(accessor); @@ -194,7 +192,7 @@ public final class SimpleAtlasAuthorizer implements AtlasAuthorizer { for (AtlasResourceTypes resourceType : resourceTypes) { List<String> accessList = rescMap.get(resourceType); if (isDebugEnabled) { - LOG.debug("\nChecking for resource : " + resource + " in list : " + accessList + "\n"); + LOG.debug("\nChecking for resource : {} in list : {}\n", resource, accessList); } if (accessList != null) { result = result && isMatch(resource, accessList); @@ -205,11 +203,11 @@ public final class SimpleAtlasAuthorizer implements AtlasAuthorizer { } else { result = false; if (isDebugEnabled) - LOG.debug("Key " + accessor + " missing. Returning with result : " + result); + LOG.debug("Key {} missing. Returning with result : {}", accessor, result); } if (isDebugEnabled) { - LOG.debug("Check for " + accessor + " :: " + result); + LOG.debug("Check for {} :: {}", accessor, result); LOG.debug("<== SimpleAtlasAuthorizer checkAccess"); } return result; @@ -308,14 +306,13 @@ public final class SimpleAtlasAuthorizer implements AtlasAuthorizer { } sb.append("]"); - LOG.debug("AtlasDefaultResourceMatcher.isMatch returns FALSE, (resource=" + resource - + ", policyValues=" + sb.toString() + ")"); + LOG.debug("AtlasDefaultResourceMatcher.isMatch returns FALSE, (resource={}, policyValues={})", resource, sb.toString()); } } if (isDebugEnabled) { - LOG.debug("<== SimpleAtlasAuthorizer isMatch(" + resource + "): " + isMatch); + LOG.debug("<== SimpleAtlasAuthorizer isMatch({}): {}", resource, isMatch); } return isMatch; http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40e639ed/catalog/src/main/java/org/apache/atlas/catalog/query/QueryFactory.java ---------------------------------------------------------------------- diff --git a/catalog/src/main/java/org/apache/atlas/catalog/query/QueryFactory.java b/catalog/src/main/java/org/apache/atlas/catalog/query/QueryFactory.java index a301912..a4fd4ad 100644 --- a/catalog/src/main/java/org/apache/atlas/catalog/query/QueryFactory.java +++ b/catalog/src/main/java/org/apache/atlas/catalog/query/QueryFactory.java @@ -95,7 +95,7 @@ public class QueryFactory { } catch (ParseException e) { throw new InvalidQueryException(e.getMessage()); } - LOG.info("LuceneQuery: " + query); + LOG.info("LuceneQuery: {}", query); queryExpression = create(query, resourceDefinition); } else { queryExpression = new AlwaysQueryExpression(); http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40e639ed/common/src/main/java/org/apache/atlas/security/InMemoryJAASConfiguration.java ---------------------------------------------------------------------- diff --git a/common/src/main/java/org/apache/atlas/security/InMemoryJAASConfiguration.java b/common/src/main/java/org/apache/atlas/security/InMemoryJAASConfiguration.java index ed42aa6..ff80eca 100644 --- a/common/src/main/java/org/apache/atlas/security/InMemoryJAASConfiguration.java +++ b/common/src/main/java/org/apache/atlas/security/InMemoryJAASConfiguration.java @@ -261,9 +261,7 @@ public final class InMemoryJAASConfiguration extends Configuration { String loginModuleName = properties.getProperty(keyParam); if (loginModuleName == null) { - LOG.error("Unable to add JAAS configuration for " - + "client [" + jaasClient + "] as it is missing param [" + keyParam + "]." - + " Skipping JAAS config for [" + jaasClient + "]"); + LOG.error("Unable to add JAAS configuration for client [{}] as it is missing param [{}]. Skipping JAAS config for [{}]", jaasClient, keyParam, jaasClient); continue; } else { loginModuleName = loginModuleName.trim(); @@ -290,15 +288,12 @@ public final class InMemoryJAASConfiguration extends Configuration { break; default: String validValues = "optional|requisite|sufficient|required"; - LOG.warn("Unknown JAAS configuration value for (" + keyParam - + ") = [" + controlFlag + "], valid value are [" + validValues - + "] using the default value, REQUIRED"); + LOG.warn("Unknown JAAS configuration value for ({}) = [{}], valid value are [{}] using the default value, REQUIRED", keyParam, controlFlag, validValues); loginControlFlag = AppConfigurationEntry.LoginModuleControlFlag.REQUIRED; break; } } else { - LOG.warn("Unable to find JAAS configuration (" - + keyParam + "); using the default value, REQUIRED"); + LOG.warn("Unable to find JAAS configuration ({}); using the default value, REQUIRED", keyParam); loginControlFlag = AppConfigurationEntry.LoginModuleControlFlag.REQUIRED; } @@ -318,8 +313,7 @@ public final class InMemoryJAASConfiguration extends Configuration { optionVal = SecurityUtil.getServerPrincipal(optionVal, (String) null); } } catch (IOException e) { - LOG.warn("Failed to build serverPrincipal. Using provided value:[" - + optionVal + "]"); + LOG.warn("Failed to build serverPrincipal. Using provided value:[{}]", optionVal); } } options.put(optionKey, optionVal); http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40e639ed/common/src/main/java/org/apache/atlas/utils/AtlasPerfTracer.java ---------------------------------------------------------------------- diff --git a/common/src/main/java/org/apache/atlas/utils/AtlasPerfTracer.java b/common/src/main/java/org/apache/atlas/utils/AtlasPerfTracer.java index 05ec7f1..a2baa65 100644 --- a/common/src/main/java/org/apache/atlas/utils/AtlasPerfTracer.java +++ b/common/src/main/java/org/apache/atlas/utils/AtlasPerfTracer.java @@ -74,7 +74,7 @@ public final class AtlasPerfTracer { public void log() { long elapsedTime = getElapsedTime(); if (elapsedTime > reportingThresholdMs) { - logger.debug("PERF|" + tag + "|" + elapsedTime); + logger.debug("PERF|{}|{}", tag, elapsedTime); } } } http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40e639ed/intg/src/test/java/org/apache/atlas/model/ModelTestUtil.java ---------------------------------------------------------------------- diff --git a/intg/src/test/java/org/apache/atlas/model/ModelTestUtil.java b/intg/src/test/java/org/apache/atlas/model/ModelTestUtil.java index ee78350..ac740c9 100644 --- a/intg/src/test/java/org/apache/atlas/model/ModelTestUtil.java +++ b/intg/src/test/java/org/apache/atlas/model/ModelTestUtil.java @@ -17,34 +17,34 @@ */ package org.apache.atlas.model; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.ThreadLocalRandom; -import java.util.concurrent.atomic.AtomicInteger; - import org.apache.atlas.exception.AtlasBaseException; import org.apache.atlas.model.instance.AtlasClassification; import org.apache.atlas.model.instance.AtlasEntity; import org.apache.atlas.model.instance.AtlasStruct; - -import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_BUILTIN_TYPES; -import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_PRIMITIVE_TYPES; import org.apache.atlas.model.typedef.AtlasBaseTypeDef; +import org.apache.atlas.model.typedef.AtlasClassificationDef; import org.apache.atlas.model.typedef.AtlasEntityDef; import org.apache.atlas.model.typedef.AtlasEnumDef; -import org.apache.atlas.model.typedef.AtlasStructDef; import org.apache.atlas.model.typedef.AtlasEnumDef.AtlasEnumElementDef; +import org.apache.atlas.model.typedef.AtlasStructDef; import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef; -import org.apache.atlas.model.typedef.AtlasClassificationDef; -import org.apache.atlas.type.AtlasType; import org.apache.atlas.type.AtlasClassificationType; import org.apache.atlas.type.AtlasEntityType; import org.apache.atlas.type.AtlasStructType; +import org.apache.atlas.type.AtlasType; import org.apache.atlas.type.AtlasTypeRegistry; import org.apache.atlas.type.AtlasTypeRegistry.AtlasTransientTypeRegistry; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.ThreadLocalRandom; +import java.util.concurrent.atomic.AtomicInteger; + +import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_BUILTIN_TYPES; +import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_PRIMITIVE_TYPES; + public final class ModelTestUtil { private static final Logger LOG = LoggerFactory.getLogger(ModelTestUtil.class); @@ -309,7 +309,7 @@ public final class ModelTestUtil { ret = ((AtlasEntityType) dataType).createDefaultValue(); } } catch (AtlasBaseException excp) { - LOG.error("failed to get entity-type " + entityDef.getName(), excp); + LOG.error("failed to get entity-type {}", entityDef.getName(), excp); } return ret; @@ -329,7 +329,7 @@ public final class ModelTestUtil { ret = ((AtlasStructType)dataType).createDefaultValue(); } } catch (AtlasBaseException excp) { - LOG.error("failed to get struct-type " + structDef.getName(), excp); + LOG.error("failed to get struct-type {}", structDef.getName(), excp); } return ret; @@ -350,7 +350,7 @@ public final class ModelTestUtil { ret = ((AtlasClassificationType)dataType).createDefaultValue(); } } catch (AtlasBaseException excp) { - LOG.error("failed to get classification-type " + classificationDef.getName(), excp); + LOG.error("failed to get classification-type {}", classificationDef.getName(), excp); } return ret; http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40e639ed/notification/src/main/java/org/apache/atlas/hook/AtlasHook.java ---------------------------------------------------------------------- diff --git a/notification/src/main/java/org/apache/atlas/hook/AtlasHook.java b/notification/src/main/java/org/apache/atlas/hook/AtlasHook.java index 5bdd5d3..0534910 100644 --- a/notification/src/main/java/org/apache/atlas/hook/AtlasHook.java +++ b/notification/src/main/java/org/apache/atlas/hook/AtlasHook.java @@ -131,7 +131,7 @@ public abstract class AtlasHook { } catch (Exception e) { numRetries++; if (numRetries < maxRetries) { - LOG.error("Failed to send notification - attempt #" + numRetries + "; error=" + e.getMessage()); + LOG.error("Failed to send notification - attempt #{}; error={}", numRetries, e.getMessage()); try { LOG.debug("Sleeping for {} ms before retry", notificationRetryInterval); Thread.sleep(notificationRetryInterval); @@ -190,14 +190,14 @@ public abstract class AtlasHook { public static String getUser(String userName, UserGroupInformation ugi) { if (StringUtils.isNotEmpty(userName)) { if (LOG.isDebugEnabled()) { - LOG.debug("Returning userName {} " + userName); + LOG.debug("Returning userName {}", userName); } return userName; } if (ugi != null && StringUtils.isNotEmpty(ugi.getShortUserName())) { if (LOG.isDebugEnabled()) { - LOG.debug("Returning ugi.getShortUserName {} " + userName); + LOG.debug("Returning ugi.getShortUserName {}", userName); } return ugi.getShortUserName(); } http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40e639ed/notification/src/main/java/org/apache/atlas/kafka/KafkaNotification.java ---------------------------------------------------------------------- diff --git a/notification/src/main/java/org/apache/atlas/kafka/KafkaNotification.java b/notification/src/main/java/org/apache/atlas/kafka/KafkaNotification.java index 0ebfd47..77c1711 100644 --- a/notification/src/main/java/org/apache/atlas/kafka/KafkaNotification.java +++ b/notification/src/main/java/org/apache/atlas/kafka/KafkaNotification.java @@ -294,7 +294,7 @@ public class KafkaNotification extends AbstractNotification implements Service { consumerProperties.putAll(properties); consumerProperties.put(ConsumerConfig.GROUP_ID_CONFIG, groupId); - LOG.info("Consumer property: auto.commit.enable: " + consumerProperties.getProperty("auto.commit.enable")); + LOG.info("Consumer property: auto.commit.enable: {}", consumerProperties.getProperty("auto.commit.enable")); return consumerProperties; } http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40e639ed/plugin-classloader/src/main/java/org/apache/atlas/plugin/classloader/AtlasPluginClassLoader.java ---------------------------------------------------------------------- diff --git a/plugin-classloader/src/main/java/org/apache/atlas/plugin/classloader/AtlasPluginClassLoader.java b/plugin-classloader/src/main/java/org/apache/atlas/plugin/classloader/AtlasPluginClassLoader.java index 0dbf352..d7ec65d 100644 --- a/plugin-classloader/src/main/java/org/apache/atlas/plugin/classloader/AtlasPluginClassLoader.java +++ b/plugin-classloader/src/main/java/org/apache/atlas/plugin/classloader/AtlasPluginClassLoader.java @@ -76,7 +76,7 @@ public final class AtlasPluginClassLoader extends URLClassLoader { @Override public Class<?> findClass(String name) throws ClassNotFoundException { if (LOG.isTraceEnabled()) { - LOG.trace("==> AtlasPluginClassLoader.findClass(" + name + ")"); + LOG.trace("==> AtlasPluginClassLoader.findClass({})", name); } Class<?> ret = null; @@ -84,7 +84,7 @@ public final class AtlasPluginClassLoader extends URLClassLoader { try { // first try to find the class in pluginClassloader if (LOG.isTraceEnabled()) { - LOG.trace("AtlasPluginClassLoader.findClass(" + name + "): calling pluginClassLoader.findClass()"); + LOG.trace("AtlasPluginClassLoader.findClass({}): calling pluginClassLoader.findClass()", name); } ret = super.findClass(name); @@ -94,8 +94,7 @@ public final class AtlasPluginClassLoader extends URLClassLoader { if (savedClassLoader != null) { if (LOG.isTraceEnabled()) { - LOG.trace( - "AtlasPluginClassLoader.findClass(" + name + "): calling componentClassLoader.findClass()"); + LOG.trace("AtlasPluginClassLoader.findClass({}): calling componentClassLoader.findClass()", name); } ret = savedClassLoader.findClass(name); @@ -103,7 +102,7 @@ public final class AtlasPluginClassLoader extends URLClassLoader { } if (LOG.isTraceEnabled()) { - LOG.trace("<== AtlasPluginClassLoader.findClass(" + name + "): " + ret); + LOG.trace("<== AtlasPluginClassLoader.findClass({}): {}", name, ret); } return ret; @@ -112,7 +111,7 @@ public final class AtlasPluginClassLoader extends URLClassLoader { @Override public Class<?> loadClass(String name) throws ClassNotFoundException { if (LOG.isTraceEnabled()) { - LOG.trace("==> AtlasPluginClassLoader.loadClass(" + name + ")"); + LOG.trace("==> AtlasPluginClassLoader.loadClass({})", name); } Class<?> ret = null; @@ -120,7 +119,7 @@ public final class AtlasPluginClassLoader extends URLClassLoader { try { // first try to load the class from pluginClassloader if (LOG.isTraceEnabled()) { - LOG.trace("AtlasPluginClassLoader.loadClass(" + name + "): calling pluginClassLoader.loadClass()"); + LOG.trace("AtlasPluginClassLoader.loadClass({}): calling pluginClassLoader.loadClass()", name); } ret = super.loadClass(name); @@ -130,8 +129,7 @@ public final class AtlasPluginClassLoader extends URLClassLoader { if (savedClassLoader != null) { if (LOG.isTraceEnabled()) { - LOG.trace( - "AtlasPluginClassLoader.loadClass(" + name + "): calling componentClassLoader.loadClass()"); + LOG.trace("AtlasPluginClassLoader.loadClass({}): calling componentClassLoader.loadClass()", name); } ret = savedClassLoader.loadClass(name); @@ -139,7 +137,7 @@ public final class AtlasPluginClassLoader extends URLClassLoader { } if (LOG.isTraceEnabled()) { - LOG.trace("<== AtlasPluginClassLoader.loadClass(" + name + "): " + ret); + LOG.trace("<== AtlasPluginClassLoader.loadClass({}): {}", name, ret); } return ret; @@ -148,12 +146,12 @@ public final class AtlasPluginClassLoader extends URLClassLoader { @Override public URL findResource(String name) { if (LOG.isDebugEnabled()) { - LOG.debug("==> AtlasPluginClassLoader.findResource(" + name + ") "); + LOG.debug("==> AtlasPluginClassLoader.findResource({}) ", name); } // first try to find the resource from pluginClassloader if (LOG.isDebugEnabled()) { - LOG.debug("AtlasPluginClassLoader.findResource(" + name + "): calling pluginClassLoader.findResource()"); + LOG.debug("AtlasPluginClassLoader.findResource({}): calling pluginClassLoader.findResource()", name); } URL ret = super.findResource(name); @@ -163,8 +161,7 @@ public final class AtlasPluginClassLoader extends URLClassLoader { if (savedClassLoader != null) { if (LOG.isDebugEnabled()) { - LOG.debug("AtlasPluginClassLoader.findResource(" + name - + "): calling componentClassLoader.getResource()"); + LOG.debug("AtlasPluginClassLoader.findResource({}): calling componentClassLoader.getResource()", name); } ret = savedClassLoader.getResource(name); @@ -172,7 +169,7 @@ public final class AtlasPluginClassLoader extends URLClassLoader { } if (LOG.isDebugEnabled()) { - LOG.debug("<== AtlasPluginClassLoader.findResource(" + name + "): " + ret); + LOG.debug("<== AtlasPluginClassLoader.findResource({}): {}", name, ret); } return ret; @@ -181,7 +178,7 @@ public final class AtlasPluginClassLoader extends URLClassLoader { @Override public Enumeration<URL> findResources(String name) throws IOException { if (LOG.isDebugEnabled()) { - LOG.debug("==> AtlasPluginClassLoader.findResources(" + name + ")"); + LOG.debug("==> AtlasPluginClassLoader.findResources({})", name); } Enumeration<URL> ret = null; @@ -198,7 +195,7 @@ public final class AtlasPluginClassLoader extends URLClassLoader { } if (LOG.isDebugEnabled()) { - LOG.debug("<== AtlasPluginClassLoader.findResources(" + name + "): " + ret); + LOG.debug("<== AtlasPluginClassLoader.findResources({}): {}", name, ret); } return ret; @@ -241,7 +238,7 @@ public final class AtlasPluginClassLoader extends URLClassLoader { private Enumeration<URL> findResourcesUsingPluginClassLoader(String name) { if (LOG.isDebugEnabled()) { - LOG.debug("==> AtlasPluginClassLoader.findResourcesUsingPluginClassLoader(" + name + ")"); + LOG.debug("==> AtlasPluginClassLoader.findResourcesUsingPluginClassLoader({})", name); } Enumeration<URL> ret = null; @@ -251,13 +248,12 @@ public final class AtlasPluginClassLoader extends URLClassLoader { } catch (Throwable excp) { // Ignore exceptions if (LOG.isDebugEnabled()) { - LOG.debug("AtlasPluginClassLoader.findResourcesUsingPluginClassLoader(" + name - + "): resource not found in plugin", excp); + LOG.debug("AtlasPluginClassLoader.findResourcesUsingPluginClassLoader({}): resource not found in plugin", name, excp); } } if (LOG.isDebugEnabled()) { - LOG.debug("<== AtlasPluginClassLoader.findResourcesUsingPluginClassLoader(" + name + "): " + ret); + LOG.debug("<== AtlasPluginClassLoader.findResourcesUsingPluginClassLoader({}): {}", name, ret); } return ret; @@ -265,7 +261,7 @@ public final class AtlasPluginClassLoader extends URLClassLoader { private Enumeration<URL> findResourcesUsingComponentClassLoader(String name) { if (LOG.isDebugEnabled()) { - LOG.debug("==> AtlasPluginClassLoader.findResourcesUsingComponentClassLoader(" + name + ")"); + LOG.debug("==> AtlasPluginClassLoader.findResourcesUsingComponentClassLoader({})", name); } Enumeration<URL> ret = null; @@ -275,20 +271,18 @@ public final class AtlasPluginClassLoader extends URLClassLoader { if (savedClassLoader != null) { if (LOG.isDebugEnabled()) { - LOG.debug("AtlasPluginClassLoader.findResourcesUsingComponentClassLoader(" + name - + "): calling componentClassLoader.getResources()"); + LOG.debug("AtlasPluginClassLoader.findResourcesUsingComponentClassLoader({}): calling componentClassLoader.getResources()", name); } ret = savedClassLoader.getResources(name); } if (LOG.isDebugEnabled()) { - LOG.debug("<== AtlasPluginClassLoader.findResourcesUsingComponentClassLoader(" + name + "): " + ret); + LOG.debug("<== AtlasPluginClassLoader.findResourcesUsingComponentClassLoader({}): {}", name, ret); } } catch (Throwable t) { if (LOG.isDebugEnabled()) { - LOG.debug("AtlasPluginClassLoader.findResourcesUsingComponentClassLoader(" + name - + "): class not found in componentClassLoader.", t); + LOG.debug("AtlasPluginClassLoader.findResourcesUsingComponentClassLoader({}): class not found in componentClassLoader.", name, t); } } http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40e639ed/plugin-classloader/src/main/java/org/apache/atlas/plugin/classloader/AtlasPluginClassLoaderUtil.java ---------------------------------------------------------------------- diff --git a/plugin-classloader/src/main/java/org/apache/atlas/plugin/classloader/AtlasPluginClassLoaderUtil.java b/plugin-classloader/src/main/java/org/apache/atlas/plugin/classloader/AtlasPluginClassLoaderUtil.java index 69b61d6..dfdad88 100644 --- a/plugin-classloader/src/main/java/org/apache/atlas/plugin/classloader/AtlasPluginClassLoaderUtil.java +++ b/plugin-classloader/src/main/java/org/apache/atlas/plugin/classloader/AtlasPluginClassLoaderUtil.java @@ -52,7 +52,7 @@ final class AtlasPluginClassLoaderUtil { } if (LOG.isDebugEnabled()) { - LOG.debug("<== AtlasPluginClassLoaderUtil.getFilesInDirectories(): " + ret.size() + " files"); + LOG.debug("<== AtlasPluginClassLoaderUtil.getFilesInDirectories(): {} files", ret.size()); } return ret.toArray(new URL[]{}); @@ -73,32 +73,31 @@ final class AtlasPluginClassLoaderUtil { URL jarPath = dirFile.toURI().toURL(); if (LOG.isDebugEnabled()) { - LOG.debug( - "getFilesInDirectory('" + dirPath + "'): adding " + dirFile.getAbsolutePath()); + LOG.debug("getFilesInDirectory('{}'): adding {}", dirPath, dirFile.getAbsolutePath()); } files.add(jarPath); } catch (Exception excp) { - LOG.warn("getFilesInDirectory('" + dirPath + "'): failed to get URI for file " + dirFile + LOG.warn("getFilesInDirectory('{}'): failed to get URI for file {}", dirPath, dirFile .getAbsolutePath(), excp); } } } } catch (Exception excp) { - LOG.warn("getFilesInDirectory('" + dirPath + "'): error", excp); + LOG.warn("getFilesInDirectory('{}'): error", dirPath, excp); } } else { - LOG.warn("getFilesInDirectory('" + dirPath + "'): could not find directory in path " + dirPath); + LOG.warn("getFilesInDirectory('{}'): could not find directory in path {}", dirPath, dirPath); } if (LOG.isDebugEnabled()) { - LOG.debug("<== AtlasPluginClassLoaderUtil.getFilesInDirectory(" + dirPath + ")"); + LOG.debug("<== AtlasPluginClassLoaderUtil.getFilesInDirectory({})", dirPath); } } public static String getPluginImplLibPath(String pluginType, Class<?> pluginClass) throws Exception { if (LOG.isDebugEnabled()) { - LOG.debug("==> AtlasPluginClassLoaderUtil.getPluginImplLibPath for Class (" + pluginClass.getName() + ")"); + LOG.debug("==> AtlasPluginClassLoaderUtil.getPluginImplLibPath for Class ({})", pluginClass.getName()); } URI uri = pluginClass.getProtectionDomain().getCodeSource().getLocation().toURI(); @@ -106,8 +105,7 @@ final class AtlasPluginClassLoaderUtil { String ret = path.getParent().toString() + File.separatorChar + ATLAS_PLUGIN_LIBDIR.replaceAll("%", pluginType); if (LOG.isDebugEnabled()) { - LOG.debug("<== AtlasPluginClassLoaderUtil.getPluginImplLibPath for Class " + pluginClass.getName() + "): " - + ret + ")"); + LOG.debug("<== AtlasPluginClassLoaderUtil.getPluginImplLibPath for Class {}): {})", pluginClass.getName(), ret); } return ret; http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40e639ed/release-log.txt ---------------------------------------------------------------------- diff --git a/release-log.txt b/release-log.txt index 6e52963..476e407 100644 --- a/release-log.txt +++ b/release-log.txt @@ -9,6 +9,7 @@ ATLAS-1060 Add composite indexes for exact match performance improvements for al ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai) ALL CHANGES: +ATLAS-1407 improve LOG statement performance (apoorvnaik via mneethiraj) ATLAS-1350 update authorization to handle v2 REST endpoints (saqeeb.s via mneethiraj) ATLAS-1311 Integration tests for V2 Entity APIs (apoorvnaik via mneethiraj) ATLAS-1377 fix for Escaping comma in for LDAP properties (nixonrodrigues via mneethiraj) http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40e639ed/repository/src/main/java/org/apache/atlas/GraphTransactionInterceptor.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/GraphTransactionInterceptor.java b/repository/src/main/java/org/apache/atlas/GraphTransactionInterceptor.java index a7124bf..7d6e593 100644 --- a/repository/src/main/java/org/apache/atlas/GraphTransactionInterceptor.java +++ b/repository/src/main/java/org/apache/atlas/GraphTransactionInterceptor.java @@ -57,7 +57,7 @@ public class GraphTransactionInterceptor implements MethodInterceptor { if (logException(t)) { LOG.error("graph rollback due to exception ", t); } else { - LOG.error("graph rollback due to exception " + t.getClass().getSimpleName() + ":" + t.getMessage()); + LOG.error("graph rollback due to exception {}:{}", t.getClass().getSimpleName(), t.getMessage()); } graph.rollback(); throw t; http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40e639ed/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepository.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepository.java b/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepository.java index f0647a4..f6b3fc5 100755 --- a/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepository.java +++ b/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepository.java @@ -347,7 +347,7 @@ public class GraphBackedMetadataRepository implements MetadataRepository { } catch (EntityNotFoundException e) { // Entity does not exist - treat as non-error, since the caller // wanted to delete the entity and it's already gone. - LOG.info("Deletion request ignored for non-existent entity with guid " + guid); + LOG.info("Deletion request ignored for non-existent entity with guid {}", guid); } } http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40e639ed/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java b/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java index 6eeddae..7eacc5d 100755 --- a/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java +++ b/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java @@ -564,7 +564,7 @@ public final class GraphHelper { result = findVertex(propertyKey, instance.get(attributeInfo.name), Constants.ENTITY_TYPE_PROPERTY_KEY, classType.getName(), Constants.STATE_PROPERTY_KEY, Id.EntityState.ACTIVE.name()); - LOG.debug("Found vertex by unique attribute : " + propertyKey + "=" + instance.get(attributeInfo.name)); + LOG.debug("Found vertex by unique attribute : {}={}", propertyKey, instance.get(attributeInfo.name)); } catch (EntityNotFoundException e) { //Its ok if there is no entity with the same unique value } http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40e639ed/repository/src/main/java/org/apache/atlas/repository/graph/TypedInstanceToGraphMapper.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/TypedInstanceToGraphMapper.java b/repository/src/main/java/org/apache/atlas/repository/graph/TypedInstanceToGraphMapper.java index 78e276e..19ca328 100644 --- a/repository/src/main/java/org/apache/atlas/repository/graph/TypedInstanceToGraphMapper.java +++ b/repository/src/main/java/org/apache/atlas/repository/graph/TypedInstanceToGraphMapper.java @@ -588,7 +588,7 @@ public final class TypedInstanceToGraphMapper { String edgeLabel) throws AtlasException { AtlasVertex newReferenceVertex = getClassVertex(newAttributeValue); if( ! GraphHelper.elementExists(newReferenceVertex) && newAttributeValue != null) { - LOG.error("Could not find vertex for Class Reference " + newAttributeValue); + LOG.error("Could not find vertex for Class Reference {}", newAttributeValue); throw new EntityNotFoundException("Could not find vertex for Class Reference " + newAttributeValue); } http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40e639ed/repository/src/main/java/org/apache/atlas/repository/store/bootstrap/AtlasTypeDefStoreInitializer.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/store/bootstrap/AtlasTypeDefStoreInitializer.java b/repository/src/main/java/org/apache/atlas/repository/store/bootstrap/AtlasTypeDefStoreInitializer.java index b3531b0..fb2c939 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/bootstrap/AtlasTypeDefStoreInitializer.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/bootstrap/AtlasTypeDefStoreInitializer.java @@ -130,7 +130,7 @@ public class AtlasTypeDefStoreInitializer { typeDefStore.createTypesDef(typesToCreate); } catch (Throwable t) { - LOG.error("error while registering types in file " + typeDefFile.getAbsolutePath(), t); + LOG.error("error while registering types in file {}", typeDefFile.getAbsolutePath(), t); } } @@ -194,12 +194,11 @@ public class AtlasTypeDefStoreInitializer { try { patchHandler.applyPatch(patch); } catch (AtlasBaseException excp) { - LOG.error("Failed to apply " + patch.getAction() + " patch in file " + - typePatchFile.getAbsolutePath() + ". Ignored", excp); + LOG.error("Failed to apply {} patch in file {}. Ignored", patch.getAction(), typePatchFile.getAbsolutePath(), excp); } } } catch (Throwable t) { - LOG.error("Failed to apply patches in file " + typePatchFile.getAbsolutePath() + ". Ignored", t); + LOG.error("Failed to apply patches in file {}. Ignored", typePatchFile.getAbsolutePath(), t); } } } http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40e639ed/repository/src/main/java/org/apache/atlas/services/DefaultMetadataService.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/services/DefaultMetadataService.java b/repository/src/main/java/org/apache/atlas/services/DefaultMetadataService.java index c2f8b3f..6cf4052 100755 --- a/repository/src/main/java/org/apache/atlas/services/DefaultMetadataService.java +++ b/repository/src/main/java/org/apache/atlas/services/DefaultMetadataService.java @@ -159,7 +159,7 @@ public class DefaultMetadataService implements MetadataService, ActiveStateChang if (typesDef != null && !typesDef.isEmpty()) { TypeSystem.TransientTypeSystem transientTypeSystem = typeSystem.createTransientTypeSystem(typesDef, true); Map<String, IDataType> typesAdded = transientTypeSystem.getTypesAdded(); - LOG.info("Number of types got from transient type system: " + typesAdded.size()); + LOG.info("Number of types got from transient type system: {}", typesAdded.size()); typeSystem.commitTypes(typesAdded); } } @@ -748,7 +748,7 @@ public class DefaultMetadataService implements MetadataService, ActiveStateChang TypeSystem.TransientTypeSystem transientTypeSystem = typeSystem.createTransientTypeSystem(typesDef, false); Map<String, IDataType> typesAdded = transientTypeSystem.getTypesAdded(); - LOG.info("Number of types got from transient type system: " + typesAdded.size()); + LOG.info("Number of types got from transient type system: {}", typesAdded.size()); typeSystem.commitTypes(typesAdded); } catch (AtlasException e) { LOG.error("Failed to restore type-system after TypeRegistry changes", e); http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40e639ed/server-api/src/main/java/org/apache/atlas/aspect/AtlasAspect.java ---------------------------------------------------------------------- diff --git a/server-api/src/main/java/org/apache/atlas/aspect/AtlasAspect.java b/server-api/src/main/java/org/apache/atlas/aspect/AtlasAspect.java index 2801750..3579dd2 100644 --- a/server-api/src/main/java/org/apache/atlas/aspect/AtlasAspect.java +++ b/server-api/src/main/java/org/apache/atlas/aspect/AtlasAspect.java @@ -27,6 +27,7 @@ import org.aspectj.lang.annotation.Aspect; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.util.Arrays; import java.util.List; @Aspect @@ -55,11 +56,11 @@ public class AtlasAspect { String methodName = methodSign.getDeclaringType().getSimpleName() + "." + methodSign.getName(); if (LOG.isDebugEnabled()) { - LOG.debug(String.format("==> %s(%s)", methodName, joinPoint.getArgs())); + LOG.debug(String.format("==> %s(%s)", methodName, Arrays.toString(joinPoint.getArgs()))); } Object response = joinPoint.proceed(); if (LOG.isDebugEnabled()) { - LOG.debug(String.format("<== %s(%s): %s", methodName, joinPoint.getArgs(), + LOG.debug(String.format("<== %s(%s): %s", methodName, Arrays.toString(joinPoint.getArgs()), response instanceof List ? ((List)response).size() : response)); } return response; http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40e639ed/server-api/src/main/java/org/apache/atlas/ha/AtlasServerIdSelector.java ---------------------------------------------------------------------- diff --git a/server-api/src/main/java/org/apache/atlas/ha/AtlasServerIdSelector.java b/server-api/src/main/java/org/apache/atlas/ha/AtlasServerIdSelector.java index f3d36a7..93d1d9e 100644 --- a/server-api/src/main/java/org/apache/atlas/ha/AtlasServerIdSelector.java +++ b/server-api/src/main/java/org/apache/atlas/ha/AtlasServerIdSelector.java @@ -56,18 +56,18 @@ public class AtlasServerIdSelector { try { socketAddress = NetUtils.createSocketAddr(hostPort); } catch (Exception e) { - LOG.warn("Exception while trying to get socket address for " + hostPort, e); + LOG.warn("Exception while trying to get socket address for {}", hostPort, e); continue; } if (!socketAddress.isUnresolved() && NetUtils.isLocalAddress(socketAddress.getAddress()) && appPort == socketAddress.getPort()) { - LOG.info("Found matched server id " + id + " with host port: " + hostPort); + LOG.info("Found matched server id {} with host port: {}", id, hostPort); matchingServerId = id; break; } } else { - LOG.info("Could not find matching address entry for id: " + id); + LOG.info("Could not find matching address entry for id: {}", id); } } if (matchingServerId == null) { http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40e639ed/webapp/src/main/java/org/apache/atlas/notification/NotificationHookConsumer.java ---------------------------------------------------------------------- diff --git a/webapp/src/main/java/org/apache/atlas/notification/NotificationHookConsumer.java b/webapp/src/main/java/org/apache/atlas/notification/NotificationHookConsumer.java index a4fd1c2..f241681 100644 --- a/webapp/src/main/java/org/apache/atlas/notification/NotificationHookConsumer.java +++ b/webapp/src/main/java/org/apache/atlas/notification/NotificationHookConsumer.java @@ -249,7 +249,7 @@ public class NotificationHookConsumer implements Service, ActiveStateChangeHandl break; } catch (Throwable e) { - LOG.warn("Error handling message" + e.getMessage()); + LOG.warn("Error handling message{}", e.getMessage()); try{ LOG.info("Sleeping for {} ms before retry", consumerRetryInterval); Thread.sleep(consumerRetryInterval); @@ -273,7 +273,7 @@ public class NotificationHookConsumer implements Service, ActiveStateChangeHandl private void recordFailedMessages() { //logging failed messages for (HookNotification.HookNotificationMessage message : failedMessages) { - FAILED_LOG.error("[DROPPED_NOTIFICATION] " + AbstractNotification.getMessageJson(message)); + FAILED_LOG.error("[DROPPED_NOTIFICATION] {}", AbstractNotification.getMessageJson(message)); } failedMessages.clear(); } http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40e639ed/webapp/src/main/java/org/apache/atlas/web/dao/UserDao.java ---------------------------------------------------------------------- diff --git a/webapp/src/main/java/org/apache/atlas/web/dao/UserDao.java b/webapp/src/main/java/org/apache/atlas/web/dao/UserDao.java index 8f6613a..254d836 100644 --- a/webapp/src/main/java/org/apache/atlas/web/dao/UserDao.java +++ b/webapp/src/main/java/org/apache/atlas/web/dao/UserDao.java @@ -67,12 +67,11 @@ public class UserDao { inStr = new FileInputStream(PROPERTY_FILE_PATH); userLogins.load(inStr); }else { - LOG.error("Error while reading user.properties file, filepath=" - + PROPERTY_FILE_PATH); + LOG.error("Error while reading user.properties file, filepath={}", PROPERTY_FILE_PATH); } } catch (IOException | AtlasException e) { - LOG.error("Error while reading user.properties file, filepath=" + PROPERTY_FILE_PATH, e); + LOG.error("Error while reading user.properties file, filepath={}", PROPERTY_FILE_PATH, e); throw new RuntimeException(e); } finally { if(inStr != null) { @@ -99,7 +98,7 @@ public class UserDao { role = dataArr[0]; password = dataArr[1]; } else { - LOG.error("User role credentials is not set properly for " + username); + LOG.error("User role credentials is not set properly for {}", username); throw new AtlasAuthenticationException("User role credentials is not set properly for " + username ); } @@ -107,7 +106,7 @@ public class UserDao { if (StringUtils.hasText(role)) { grantedAuths.add(new SimpleGrantedAuthority(role)); } else { - LOG.error("User role credentials is not set properly for " + username); + LOG.error("User role credentials is not set properly for {}", username); throw new AtlasAuthenticationException("User role credentials is not set properly for " + username ); } http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40e639ed/webapp/src/main/java/org/apache/atlas/web/filters/AtlasAuthenticationFilter.java ---------------------------------------------------------------------- diff --git a/webapp/src/main/java/org/apache/atlas/web/filters/AtlasAuthenticationFilter.java b/webapp/src/main/java/org/apache/atlas/web/filters/AtlasAuthenticationFilter.java index b752810..0b3ac32 100644 --- a/webapp/src/main/java/org/apache/atlas/web/filters/AtlasAuthenticationFilter.java +++ b/webapp/src/main/java/org/apache/atlas/web/filters/AtlasAuthenticationFilter.java @@ -32,9 +32,9 @@ import org.apache.hadoop.security.authentication.client.AuthenticatedURL; import org.apache.hadoop.security.authentication.client.AuthenticationException; import org.apache.hadoop.security.authentication.client.KerberosAuthenticator; import org.apache.hadoop.security.authentication.server.AuthenticationFilter; +import org.apache.hadoop.security.authentication.server.AuthenticationHandler; import org.apache.hadoop.security.authentication.server.AuthenticationToken; import org.apache.hadoop.security.authentication.server.KerberosAuthenticationHandler; -import org.apache.hadoop.security.authentication.server.AuthenticationHandler; import org.apache.hadoop.security.authentication.util.Signer; import org.apache.hadoop.security.authentication.util.SignerException; import org.apache.hadoop.security.authentication.util.SignerSecretProvider; @@ -50,16 +50,18 @@ import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.userdetails.User; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.web.authentication.WebAuthenticationDetails; + import javax.servlet.FilterChain; import javax.servlet.FilterConfig; +import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; +import javax.servlet.http.Cookie; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequestWrapper; import javax.servlet.http.HttpServletResponse; -import javax.servlet.ServletContext; import javax.ws.rs.core.Response; import java.io.IOException; import java.net.InetAddress; @@ -69,7 +71,6 @@ import java.text.SimpleDateFormat; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; -import javax.servlet.http.Cookie; /** * This enforces authentication as part of the filter before processing the request. @@ -91,7 +92,7 @@ public class AtlasAuthenticationFilter extends AuthenticationFilter { LOG.info("AtlasAuthenticationFilter initialization started"); init(null); } catch (ServletException e) { - LOG.error("Error while initializing AtlasAuthenticationFilter : " + e.getMessage()); + LOG.error("Error while initializing AtlasAuthenticationFilter : {}", e.getMessage()); } } @@ -149,7 +150,7 @@ public class AtlasAuthenticationFilter extends AuthenticationFilter { @Override public void initializeSecretProvider(FilterConfig filterConfig) throws ServletException { - LOG.debug("AtlasAuthenticationFilter :: initializeSecretProvider " + filterConfig); + LOG.debug("AtlasAuthenticationFilter :: initializeSecretProvider {}", filterConfig); secretProvider = (SignerSecretProvider) filterConfig.getServletContext(). getAttribute(AuthenticationFilter.SIGNER_SECRET_PROVIDER_ATTRIBUTE); if (secretProvider == null) { @@ -278,7 +279,7 @@ public class AtlasAuthenticationFilter extends AuthenticationFilter { SecurityContextHolder.getContext().setAuthentication(finalAuthentication); request.setAttribute("atlas.http.authentication.type", true); - LOG.info("Logged into Atlas as = " + userName); + LOG.info("Logged into Atlas as = {}", userName); } } // OPTIONS method is sent from quick start jersey atlas client @@ -357,7 +358,7 @@ public class AtlasAuthenticationFilter extends AuthenticationFilter { token = getToken(httpRequest); } catch (AuthenticationException ex) { - LOG.warn("AuthenticationToken ignored: " + ex.getMessage()); + LOG.warn("AuthenticationToken ignored: {}", ex.getMessage()); // will be sent back in a 401 unless filter authenticates authenticationEx = ex; token = null; @@ -412,7 +413,7 @@ public class AtlasAuthenticationFilter extends AuthenticationFilter { // exception from the filter itself is fatal errCode = HttpServletResponse.SC_FORBIDDEN; authenticationEx = ex; - LOG.warn("Authentication exception: " + ex.getMessage(), ex); + LOG.warn("Authentication exception: {}", ex.getMessage(), ex); } if (unauthorizedResponse) { if (!httpResponse.isCommitted()) { http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40e639ed/webapp/src/main/java/org/apache/atlas/web/filters/AtlasAuthorizationFilter.java ---------------------------------------------------------------------- diff --git a/webapp/src/main/java/org/apache/atlas/web/filters/AtlasAuthorizationFilter.java b/webapp/src/main/java/org/apache/atlas/web/filters/AtlasAuthorizationFilter.java index 26e6b1e..27db047 100644 --- a/webapp/src/main/java/org/apache/atlas/web/filters/AtlasAuthorizationFilter.java +++ b/webapp/src/main/java/org/apache/atlas/web/filters/AtlasAuthorizationFilter.java @@ -18,18 +18,7 @@ package org.apache.atlas.web.filters; -import java.io.IOException; -import java.util.Collection; -import java.util.HashSet; -import java.util.Set; - -import javax.servlet.FilterChain; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - +import com.google.common.base.Strings; import org.apache.atlas.AtlasClient; import org.apache.atlas.authorize.AtlasAccessRequest; import org.apache.atlas.authorize.AtlasAuthorizationException; @@ -44,7 +33,16 @@ import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.web.filter.GenericFilterBean; -import com.google.common.base.Strings; +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; public class AtlasAuthorizationFilter extends GenericFilterBean { @@ -95,7 +93,7 @@ public class AtlasAuthorizationFilter extends GenericFilterBean { String pathInfo = request.getServletPath(); if (!Strings.isNullOrEmpty(pathInfo) && pathInfo.startsWith(BASE_URL)) { if (isDebugEnabled) { - LOG.debug(pathInfo + " is a valid REST API request!!!"); + LOG.debug("{} is a valid REST API request!!!", pathInfo); } String userName = null; @@ -111,16 +109,13 @@ public class AtlasAuthorizationFilter extends GenericFilterBean { } } else { if (LOG.isErrorEnabled()) { - LOG.error("Cannot obtain Security Context : " + auth); + LOG.error("Cannot obtain Security Context : {}", auth); } throw new ServletException("Cannot obtain Security Context : " + auth); } AtlasAccessRequest atlasRequest = new AtlasAccessRequest(request, userName, groups); if (isDebugEnabled) { - LOG.debug("============================\n" + "UserName :: " + atlasRequest.getUser() + "\nGroups :: " - + atlasRequest.getUserGroups() + "\nURL :: " + request.getRequestURL() + "\nAction :: " - + atlasRequest.getAction() + "\nrequest.getServletPath() :: " + pathInfo - + "\n============================\n"); + LOG.debug("============================\nUserName :: {}\nGroups :: {}\nURL :: {}\nAction :: {}\nrequest.getServletPath() :: {}\n============================\n", atlasRequest.getUser(), atlasRequest.getUserGroups(), request.getRequestURL(), atlasRequest.getAction(), pathInfo); } boolean accessAllowed = false; @@ -129,7 +124,7 @@ public class AtlasAuthorizationFilter extends GenericFilterBean { if (atlasResourceTypes.size() == 1 && atlasResourceTypes.contains(AtlasResourceTypes.UNKNOWN)) { // Allowing access to unprotected resource types if (LOG.isDebugEnabled()) { - LOG.debug("Allowing access to unprotected resource types " + atlasResourceTypes); + LOG.debug("Allowing access to unprotected resource types {}", atlasResourceTypes); } accessAllowed = true; } else { @@ -140,11 +135,11 @@ public class AtlasAuthorizationFilter extends GenericFilterBean { } } catch (AtlasAuthorizationException e) { if (LOG.isErrorEnabled()) { - LOG.error("Access Restricted. Could not process the request :: " + e); + LOG.error("Access Restricted. Could not process the request :: {}", e); } } if (isDebugEnabled) { - LOG.debug("Authorizer result :: " + accessAllowed); + LOG.debug("Authorizer result :: {}", accessAllowed); } } if (accessAllowed) { @@ -162,15 +157,13 @@ public class AtlasAuthorizationFilter extends GenericFilterBean { response.sendError(HttpServletResponse.SC_FORBIDDEN, json.toString()); if (isDebugEnabled) { - LOG.debug("You are not authorized for " + atlasRequest.getAction().name() + " on " - + atlasResourceTypes + " : " + atlasRequest.getResource() - + "\nReturning 403 since the access is blocked update!!!!"); + LOG.debug("You are not authorized for {} on {} : {}\nReturning 403 since the access is blocked update!!!!", atlasRequest.getAction().name(), atlasResourceTypes, atlasRequest.getResource()); } } } else { if (isDebugEnabled) { - LOG.debug("Ignoring request " + pathInfo); + LOG.debug("Ignoring request {}", pathInfo); } chain.doFilter(req, res); } http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/40e639ed/webapp/src/main/java/org/apache/atlas/web/filters/AtlasKnoxSSOAuthenticationFilter.java ---------------------------------------------------------------------- diff --git a/webapp/src/main/java/org/apache/atlas/web/filters/AtlasKnoxSSOAuthenticationFilter.java b/webapp/src/main/java/org/apache/atlas/web/filters/AtlasKnoxSSOAuthenticationFilter.java index 75a884d..723c876 100644 --- a/webapp/src/main/java/org/apache/atlas/web/filters/AtlasKnoxSSOAuthenticationFilter.java +++ b/webapp/src/main/java/org/apache/atlas/web/filters/AtlasKnoxSSOAuthenticationFilter.java @@ -237,7 +237,7 @@ public class AtlasKnoxSSOAuthenticationFilter implements Filter { for (Cookie cookie : cookies) { if (cookieName.equals(cookie.getName())) { if (LOG.isDebugEnabled()) { - LOG.debug(cookieName + " cookie has been found and is being processed"); + LOG.debug("{} cookie has been found and is being processed", cookieName); } serializedJWT = cookie.getValue(); break;
