Continue addressing technical debt for ONAP-XACML

Fix all sonar issues that do not require code refactoring

Issue-ID: POLICY-475
Change-Id: Iefa91e0048b7041c96d47bce7ec99034d6fcc427
Signed-off-by: Gao, Chenfei (cg287m) <cgao@research.att.com>
diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdEngine.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdEngine.java
index 3173bc1..4399f71 100644
--- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdEngine.java
+++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdEngine.java
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP-XACML
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -125,10 +125,10 @@
 		if (Files.notExists(this.repository)) {
 			Files.createDirectory(repository);
 		}
-		if (Files.isDirectory(this.repository) == false) {
+		if (!Files.isDirectory(this.repository)) {
 			throw new PAPException ("Repository is NOT a directory: " + this.repository.toAbsolutePath());
 		}
-		if (Files.isWritable(this.repository) == false) {
+		if (!Files.isWritable(this.repository)) {
 			throw new PAPException ("Repository is NOT writable: " + this.repository.toAbsolutePath());
 		}
 		//
@@ -467,7 +467,7 @@
 					this.doSave();
 				} else {
 					PolicyLogger.error("Failed to add to new group, putting back into original group.");
-					if (((StdPDPGroup) currentGroup).removePDP(pdp) == false) {
+					if (!((StdPDPGroup) currentGroup).removePDP(pdp)) {
 						PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + "Failed to put PDP back into original group.");
 					}
 				}
@@ -492,8 +492,8 @@
 		// the only things that the user can change are name and description
 		currentPDP.setDescription(pdp.getDescription());
 		currentPDP.setName(pdp.getName());
-		if (currentPDP instanceof OnapPDP && pdp instanceof OnapPDP) {
-			((OnapPDP)currentPDP).setJmxPort(((OnapPDP)pdp).getJmxPort());
+		if (currentPDP instanceof OnapPDP) {
+			((OnapPDP)currentPDP).setJmxPort(pdp.getJmxPort());
 		}
 		this.doSave();
 	}
@@ -769,9 +769,7 @@
 			// Save the configuration
 			//
 			this.saveConfiguration();
-		} catch (IOException e) {
-			PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "StdEngine", "Failed to save configuration");
-		} catch (PAPException e) {
+		} catch (IOException|PAPException e) {
 			PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "StdEngine", "Failed to save configuration");
 		}		
 	}
diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdEngineFactory.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdEngineFactory.java
index ee67856..dd8a921 100644
--- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdEngineFactory.java
+++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdEngineFactory.java
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP-XACML
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -36,7 +36,7 @@
 	@Override
 	public PAPPolicyEngine newEngine() throws FactoryException, PAPException {
 		try {
-			return (PAPPolicyEngine) new StdEngine();
+			return new StdEngine();
 		} catch (IOException e) {
 			PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, "StdEngineFactory", "Failed to create engine");
 			return null;
@@ -47,7 +47,7 @@
 	public PAPPolicyEngine newEngine(Properties properties) throws FactoryException,
 			PAPException {
 		try {
-			return (PAPPolicyEngine) new StdEngine(properties);
+			return new StdEngine(properties);
 		} catch (IOException e) {
 			PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, "StdEngineFactory", "Failed to create engine");
 			return null;
diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPAPPolicy.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPAPPolicy.java
index c66d11b..a8c59e8 100644
--- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPAPPolicy.java
+++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPAPPolicy.java
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP-XACML
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDP.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDP.java
index e059ea6..8727b81 100644
--- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDP.java
+++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDP.java
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP-XACML
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -210,9 +210,6 @@
 		if (o == null) {
 			return -1;
 		}
-		if ( ! (o instanceof StdPDP)) {
-			return -1;
-		}
 		if (o.name == null) {
 			return -1;
 		}
diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPGroup.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPGroup.java
index 9289c24..bdbbf33 100644
--- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPGroup.java
+++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPGroup.java
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP-XACML
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -89,6 +89,21 @@
 	@JsonIgnore
 	private Integer jmxport;
 	
+	public StdPDPGroup() {
+		//
+		// Methods needed for JSON deserialization
+		//
+	}
+	
+	public StdPDPGroup(OnapPDPGroup group) {
+		this.id = group.getId();
+		this.name = group.getName();
+		this.description = group.getDescription();
+		this.isDefault = group.isDefaultGroup();
+		this.pdps = group.getOnapPdps();
+		this.policies = group.getPolicies();
+		this.pipConfigs = group.getPipConfigs();
+	}
 	
 	public StdPDPGroup(String id, Path directory) {
 		this.id = id;
@@ -333,7 +348,6 @@
 		// to occur: 1) old default=false (don't want to fire) and
 		// then 2) new default=true (yes fire - but we'll have to do that
 		// elsewhere.
-		//this.firePDPGroupChanged(this);
 	}
 
 	@Override
@@ -474,7 +488,7 @@
 			logger.info("Copied " + num + " bytes for policy " + name);
 			
 			StdPDPPolicy tempRootPolicy = new StdPDPPolicy(id, isRoot, name, tempFile.toUri());
-			if (tempRootPolicy.isValid() == false) {
+			if (!tempRootPolicy.isValid()) {
 				try {
 					Files.delete(tempFile);
 				} catch(Exception ee) {
@@ -544,7 +558,7 @@
 			
 			// policy is new to this group
 			StdPDPPolicy tempRootPolicy = new StdPDPPolicy(id, true, name, policyFile.toUri());
-			if (tempRootPolicy.isValid() == false) {
+			if (!tempRootPolicy.isValid()) {
 				try {
 					Files.delete(policyFile);
 				} catch(Exception ee) {
@@ -606,7 +620,7 @@
 			
 			// policy is new to this group
 			StdPDPPolicy tempRootPolicy = new StdPDPPolicy(id, true, name, policyFile.toUri());
-			if (tempRootPolicy.isValid() == false) {
+			if (!tempRootPolicy.isValid()) {
 				try {
 					Files.delete(policyFile);
 				} catch(Exception ee) {
@@ -924,23 +938,6 @@
 		this.changed();
 	}
 
-	
-	public StdPDPGroup() {
-		//
-		// Methods needed for JSON deserialization
-		//
-	}
-	
-	public StdPDPGroup(OnapPDPGroup group) {
-		this.id = group.getId();
-		this.name = group.getName();
-		this.description = group.getDescription();
-		this.isDefault = group.isDefaultGroup();
-		this.pdps = group.getOnapPdps();
-		this.policies = group.getPolicies();
-		this.pipConfigs = group.getPipConfigs();
-	}
-
 	public boolean isDefault() {
 		return isDefault;
 	}
diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPGroupStatus.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPGroupStatus.java
index ae4649e..dd9bf0a 100644
--- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPGroupStatus.java
+++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPGroupStatus.java
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP-XACML
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -71,18 +71,30 @@
 
 	public StdPDPGroupStatus(PDPGroupStatus stat) {
 		this.status = stat.getStatus();
-		this.failedPDPs.clear(); this.failedPDPs.addAll(stat.getFailedPDPs());
-		this.failedPIPConfigs.clear(); this.failedPIPConfigs.addAll(stat.getFailedPipConfigs());
-		this.failedPolicies.clear(); this.failedPolicies.addAll(stat.getFailedPolicies());
-		this.inSynchPDPs.clear(); this.inSynchPDPs.addAll(stat.getInSynchPDPs());
-		this.lastUpdateFailedPDPs.clear(); this.lastUpdateFailedPDPs.addAll(stat.getLastUpdateFailedPDPs());
-		this.loadedPIPConfigs.clear(); this.loadedPIPConfigs.addAll(stat.getLoadedPipConfigs());
-		this.loadedPolicies.clear(); this.loadedPolicies.addAll(stat.getLoadedPolicies());
-		this.loadErrors.clear(); this.loadErrors.addAll(stat.getLoadErrors());
-		this.loadWarnings.clear(); this.loadWarnings.addAll(stat.getLoadWarnings());
-		this.outOfSynchPDPs.clear(); this.outOfSynchPDPs.addAll(stat.getOutOfSynchPDPs());
-		this.unknownPDPs.clear(); this.unknownPDPs.addAll(stat.getUpdatingPDPs());
-		this.updatingPDPs.clear(); this.updatingPDPs.addAll(stat.getUpdatingPDPs());
+		this.failedPDPs.clear(); 
+		this.failedPDPs.addAll(stat.getFailedPDPs());
+		this.failedPIPConfigs.clear(); 
+		this.failedPIPConfigs.addAll(stat.getFailedPipConfigs());
+		this.failedPolicies.clear(); 
+		this.failedPolicies.addAll(stat.getFailedPolicies());
+		this.inSynchPDPs.clear(); 
+		this.inSynchPDPs.addAll(stat.getInSynchPDPs());
+		this.lastUpdateFailedPDPs.clear(); 
+		this.lastUpdateFailedPDPs.addAll(stat.getLastUpdateFailedPDPs());
+		this.loadedPIPConfigs.clear(); 
+		this.loadedPIPConfigs.addAll(stat.getLoadedPipConfigs());
+		this.loadedPolicies.clear(); 
+		this.loadedPolicies.addAll(stat.getLoadedPolicies());
+		this.loadErrors.clear(); 
+		this.loadErrors.addAll(stat.getLoadErrors());
+		this.loadWarnings.clear(); 
+		this.loadWarnings.addAll(stat.getLoadWarnings());
+		this.outOfSynchPDPs.clear(); 
+		this.outOfSynchPDPs.addAll(stat.getOutOfSynchPDPs());
+		this.unknownPDPs.clear(); 
+		this.unknownPDPs.addAll(stat.getUpdatingPDPs());
+		this.updatingPDPs.clear(); 
+		this.updatingPDPs.addAll(stat.getUpdatingPDPs());
 	}
 
 	public Set<PDPPIPConfig> getLoadedPIPConfigs() {
@@ -286,16 +298,16 @@
 	@Override
 	@JsonIgnore
 	public boolean isGroupOk() {
-		if (this.policiesOK() == false) {
+		if (!this.policiesOK()) {
 			return false;
 		}
-		if (this.pipConfigOK() == false) {
+		if (!this.pipConfigOK()) {
 			return false;
 		}
-		if (this.pdpsOK() == false) {
+		if (!this.pdpsOK()) {
 			return false;
 		}
-		if (this.loadErrors.isEmpty() == false) {
+		if (!this.loadErrors.isEmpty()) {
 			return false;
 		}
 		return this.status == Status.OK;
diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPPIPConfig.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPPIPConfig.java
index 0c832b3..9a65d50 100644
--- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPPIPConfig.java
+++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPPIPConfig.java
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP-XACML
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPPolicy.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPPolicy.java
index 79e41f8..03170bd 100644
--- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPPolicy.java
+++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPPolicy.java
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP-XACML
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -64,7 +64,12 @@
 	
 	private URI location = null;
 	
-
+	public StdPDPPolicy() {
+		//
+		// Methods needed for JSON Deserialization
+		//
+	}
+	
 	public StdPDPPolicy(String id, boolean isRoot) {
 		this.id = id;
 		this.isRoot = isRoot;
@@ -173,7 +178,7 @@
 		}
 		if (this.policyId != null) {
 			ArrayList<String> foo = Lists.newArrayList(Splitter.on(':').split(this.policyId));
-			if (foo.isEmpty() == false) {
+			if (!foo.isEmpty()) {
 				return foo.get(foo.size() - 1);
 			}
 		}
@@ -337,14 +342,6 @@
 		return versionString;
 	}
 	
-
-	
-	public StdPDPPolicy() {
-		//
-		// Methods needed for JSON Deserialization
-		//
-	}
-	
 	public void setPolicyId(String policyId) {
 		this.policyId = policyId;
 	}
diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPStatus.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPStatus.java
index 6e1f2d6..e42d544 100644
--- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPStatus.java
+++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPDPStatus.java
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP-XACML
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pip/engines/OperationHistoryEngine.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pip/engines/OperationHistoryEngine.java
index 7c75e58..355a6f6 100644
--- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pip/engines/OperationHistoryEngine.java
+++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pip/engines/OperationHistoryEngine.java
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP-XACML
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -80,6 +80,10 @@
 			XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, 
 			new IdentifierImpl("target"), 
 			XACML.ID_DATATYPE_STRING);
+	
+	public OperationHistoryEngine() {
+		super();
+	}
 
 	private void addIntegerAttribute(StdMutablePIPResponse stdPIPResponse, Identifier category, Identifier attributeId, int value, PIPRequest pipRequest) {
 		AttributeValue<BigInteger> attributeValue	= null;
@@ -93,10 +97,6 @@
 		}
 	}
 
-	public OperationHistoryEngine() {
-		super();
-	}
-
 	@Override
 	public Collection<PIPRequest> attributesRequired() {
 		return new ArrayList<>();
diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pip/engines/aaf/AAFEngine.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pip/engines/aaf/AAFEngine.java
index de46d01..de35e0e 100644
--- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pip/engines/aaf/AAFEngine.java
+++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pip/engines/aaf/AAFEngine.java
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP-XACML
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/util/MetricsUtil.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/util/MetricsUtil.java
index fd8b3c6..58f5a49 100644
--- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/util/MetricsUtil.java
+++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/util/MetricsUtil.java
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP-XACML
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -21,6 +21,12 @@
 
 public class MetricsUtil {
 	
+	private MetricsUtil() {
+		//
+		// private constructor to hide the implicit public one for utility class
+		// 
+	}
+	
 	public static class AvgLatency {
 		private long cumLatency = 0;
 		private long count = 0;
diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/util/XACMLPolicyScanner.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/util/XACMLPolicyScanner.java
index b8b19ec..e243437 100644
--- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/util/XACMLPolicyScanner.java
+++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/util/XACMLPolicyScanner.java
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP-XACML
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -62,7 +62,6 @@
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeSelectorType;
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeValueType;
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.ConditionType;
-import oasis.names.tc.xacml._3_0.core.schema.wd_17.IdReferenceType;
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.MatchType;
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.ObligationExpressionType;
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.ObligationExpressionsType;
@@ -152,10 +151,8 @@
 		if (this.policyObject == null) {
 			return null;
 		}
-		if (this.callback != null) {
-			if (this.callback.onBeginScan(this.policyObject) == CallbackResult.STOP) {
-				return this.policyObject;
-			}
+		if (this.callback != null && this.callback.onBeginScan(this.policyObject) == CallbackResult.STOP) {
+			return this.policyObject;
 		}
 		if (this.policyObject instanceof PolicyType) {
 			this.scanPolicy(null, (PolicyType) this.policyObject);
@@ -186,10 +183,8 @@
 		if (logger.isTraceEnabled()) {
 			logger.trace("scanning policy set: " + policySet.getPolicySetId() + " " + policySet.getDescription());
 		}
-		if (this.callback != null) {
-			if (this.callback.onPreVisitPolicySet(parent, policySet) == CallbackResult.STOP) {
-				return CallbackResult.STOP;
-			}
+		if (this.callback != null && this.callback.onPreVisitPolicySet(parent, policySet) == CallbackResult.STOP) {
+			return CallbackResult.STOP;
 		}
 		//
 		// Scan its info
@@ -208,28 +203,18 @@
 		//
 		List<JAXBElement<?>> list = policySet.getPolicySetOrPolicyOrPolicySetIdReference();
 		for (JAXBElement<?> element: list) {
-			if ("PolicySet".equals(element.getName().getLocalPart())) {
-				if (this.scanPolicySet(policySet, (PolicySetType)element.getValue()) == CallbackResult.STOP) {
-					return CallbackResult.STOP;
-				}
-			} else if ("Policy".equals(element.getName().getLocalPart())) {
-				if (this.scanPolicy(policySet, (PolicyType)element.getValue()) == CallbackResult.STOP) {
-					return CallbackResult.STOP;
-				}
-			} else if (element.getValue() instanceof IdReferenceType) {
-				if ("PolicySetIdReference".equals(element.getName().getLocalPart())) {
-					
-				} else if ("PolicyIdReference".equals(element.getName().getLocalPart())) {
-					
-				}
+			if ("PolicySet".equals(element.getName().getLocalPart()) && 
+				this.scanPolicySet(policySet, (PolicySetType)element.getValue()) == CallbackResult.STOP) {
+				return CallbackResult.STOP;
+			} else if ("Policy".equals(element.getName().getLocalPart()) &&
+					   this.scanPolicy(policySet, (PolicyType)element.getValue()) == CallbackResult.STOP) {
+				return CallbackResult.STOP;
 			} else {
 				logger.warn("generating policy sets found unsupported element: " + element.getName().getNamespaceURI());
 			}
 		}
-		if (this.callback != null) {
-			if (this.callback.onPostVisitPolicySet(parent, policySet) == CallbackResult.STOP) {
-				return CallbackResult.STOP;
-			}
+		if (this.callback != null && this.callback.onPostVisitPolicySet(parent, policySet) == CallbackResult.STOP) {
+			return CallbackResult.STOP;
 		}
 		return CallbackResult.CONTINUE;
 	}
@@ -246,10 +231,8 @@
 		if (logger.isTraceEnabled()) {
 			logger.trace("scanning policy: " + policy.getPolicyId() + " " + policy.getDescription());
 		}
-		if (this.callback != null) {
-			if (this.callback.onPreVisitPolicy(parent, policy) == CallbackResult.STOP) {
-				return CallbackResult.STOP;
-			}
+		if (this.callback != null && this.callback.onPreVisitPolicy(parent, policy) == CallbackResult.STOP) {
+			return CallbackResult.STOP;
 		}
 		//
 		// Scan its info
@@ -276,10 +259,8 @@
 				if (logger.isTraceEnabled()) {
 					logger.trace("scanning rule: " + rule.getRuleId() + " " + rule.getDescription());
 				}
-				if (this.callback != null) {
-					if (this.callback.onPreVisitRule(policy, rule) == CallbackResult.STOP) {
-						return CallbackResult.STOP;
-					}
+				if (this.callback != null && this.callback.onPreVisitRule(policy, rule) == CallbackResult.STOP) {
+					return CallbackResult.STOP;
 				}
 				if (this.scanTarget(rule, rule.getTarget()) == CallbackResult.STOP) {
 					return CallbackResult.STOP;
@@ -293,16 +274,12 @@
 				if (this.scanAdvice(rule, rule.getAdviceExpressions()) == CallbackResult.STOP) {
 					return CallbackResult.STOP;
 				}
-				if (this.callback != null) {
-					if (this.callback.onPostVisitRule(policy, rule) == CallbackResult.STOP) {
-						return CallbackResult.STOP;
-					}
+				if (this.callback != null && this.callback.onPostVisitRule(policy, rule) == CallbackResult.STOP) {
+					return CallbackResult.STOP;
 				}
 			} else if (o instanceof VariableDefinitionType) {
-				if (this.callback != null) {
-					if (this.callback.onVariable(policy, (VariableDefinitionType) o) == CallbackResult.STOP) {
-						return CallbackResult.STOP;
-					}
+				if (this.callback != null && this.callback.onVariable(policy, (VariableDefinitionType) o) == CallbackResult.STOP) {
+					return CallbackResult.STOP;
 				}
 			} else {
 				if (logger.isDebugEnabled()) {
@@ -310,10 +287,8 @@
 				}
 			}
 		}
-		if (this.callback != null) {
-			if (this.callback.onPostVisitPolicy(parent, policy) == CallbackResult.STOP) {
-				return CallbackResult.STOP;
-			}
+		if (this.callback != null && this.callback.onPostVisitPolicy(parent, policy) == CallbackResult.STOP) {
+			return CallbackResult.STOP;
 		}
 		return CallbackResult.CONTINUE;
 	}
@@ -369,10 +344,8 @@
 								} else {
 									logger.warn("NULL designator/selector or value for match.");
 								}
-								if (attribute != null && this.callback != null) {
-									if (this.callback.onAttribute(parent, target, attribute) == CallbackResult.STOP) {
-										return CallbackResult.STOP;
-									}
+								if (attribute != null && this.callback != null && this.callback.onAttribute(parent, target, attribute) == CallbackResult.STOP) {
+									return CallbackResult.STOP;
 								}
 							}
 						}
@@ -417,10 +390,8 @@
 					ob.addAttributeAssignment(attribute);
 				}
 			}
-			if (this.callback != null) {
-				if (this.callback.onObligation(parent, expression, ob) == CallbackResult.STOP) {
-					return CallbackResult.STOP;
-				}
+			if (this.callback != null && this.callback.onObligation(parent, expression, ob) == CallbackResult.STOP) {
+				return CallbackResult.STOP;
 			}
 		}
 		return CallbackResult.CONTINUE;
@@ -460,10 +431,8 @@
 					ob.addAttributeAssignment(attribute);
 				}
 			}
-			if (this.callback != null) {
-				if (this.callback.onAdvice(parent, expression, ob) == CallbackResult.STOP) {
-					return CallbackResult.STOP;
-				}
+			if (this.callback != null && this.callback.onAdvice(parent, expression, ob) == CallbackResult.STOP) {
+				return CallbackResult.STOP;
 			}
 		}
 		return CallbackResult.CONTINUE;
@@ -481,12 +450,8 @@
 			return CallbackResult.CONTINUE;
 		}
 		for (Object o : list) {
-			if (o instanceof VariableDefinitionType) {
-				if (this.callback != null) {
-					if (this.callback.onVariable(policy, (VariableDefinitionType) o) == CallbackResult.STOP) {
-						return CallbackResult.STOP;
-					}
-				}
+			if (o instanceof VariableDefinitionType && this.callback != null && this.callback.onVariable(policy, (VariableDefinitionType) o) == CallbackResult.STOP) {
+				return CallbackResult.STOP;
 			}
 		}
 		
@@ -501,12 +466,8 @@
 	 * @return
 	 */
 	protected CallbackResult scanConditions(RuleType rule, ConditionType condition) {
-		if (condition != null) {
-			if (this.callback != null) {
-				if (this.callback.onCondition(rule, condition) == CallbackResult.STOP) {
-					return CallbackResult.STOP;
-				}
-			}
+		if (condition != null && this.callback != null && this.callback.onCondition(rule, condition) == CallbackResult.STOP) {
+			return CallbackResult.STOP;
 		}
 		return CallbackResult.CONTINUE;
 	}
diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/util/XACMLPolicyWriter.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/util/XACMLPolicyWriter.java
index 0807f75..cb3d448 100644
--- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/util/XACMLPolicyWriter.java
+++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/util/XACMLPolicyWriter.java
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP-XACML
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -144,10 +144,7 @@
 			Marshaller m = context.createMarshaller();
 			m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
 			m.marshal(policyElement, byteArrayOutputStream);
-			ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
-
-			return byteArrayInputStream;
-
+			return new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
 		} catch (JAXBException e) {
 			PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "XACMLPolicyWriter", "writePolicyFile failed");
 			return null;
diff --git a/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/util/AAFEngineTest.java b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/util/AAFEngineTest.java
index 65646e1..516c548 100644
--- a/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/util/AAFEngineTest.java
+++ b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/util/AAFEngineTest.java
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP-XACML
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -20,5 +20,7 @@
 package org.onap.policy.xacml.test.util;
 
 public class AAFEngineTest {
-
+	//
+	// Some tests to be added
+	//
 }