diff options
author | 2017-07-26 10:11:15 -0400 | |
---|---|---|
committer | 2017-07-26 11:53:31 -0400 | |
commit | d80880b097d08f9ab9dda54355216890a4b345dc (patch) | |
tree | 6c7b6caec61dbada2201f7ee14c8c1e027106d6d /ECOMP-PDP/src/main | |
parent | e92ff832cf993db876f22b2d27562fedf59f5043 (diff) |
[POLICY-117] Resolve the Policy Critical issues
Change-Id: Ice72d7fa40151bff5db42f5dd632f04a3853b094
Signed-off-by: rb7147 <rb7147@att.com>
Diffstat (limited to 'ECOMP-PDP/src/main')
3 files changed, 18 insertions, 22 deletions
diff --git a/ECOMP-PDP/src/main/java/org/openecomp/policy/xacml/action/FindAction.java b/ECOMP-PDP/src/main/java/org/openecomp/policy/xacml/action/FindAction.java index 2bcb903e8..5419b8946 100644 --- a/ECOMP-PDP/src/main/java/org/openecomp/policy/xacml/action/FindAction.java +++ b/ECOMP-PDP/src/main/java/org/openecomp/policy/xacml/action/FindAction.java @@ -20,7 +20,6 @@ package org.openecomp.policy.xacml.action; import java.io.BufferedReader; -import java.io.IOException; import java.io.InputStreamReader; import java.net.URL; import java.net.URLConnection; @@ -35,7 +34,6 @@ import javax.json.Json; import javax.json.JsonReader; import org.apache.http.HttpResponse; -import org.apache.http.client.ClientProtocolException; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpPut; @@ -272,11 +270,8 @@ public class FindAction { output = output + out; } response = output; - } catch (ClientProtocolException e) { - LOGGER.error(e.getMessage()); - response = e.getMessage(); - } catch (IOException e) { - LOGGER.error(e.getMessage()); + } catch (Exception e) { + LOGGER.error(e.getMessage()+e); response = e.getMessage(); } finally { httpClient.getConnectionManager().shutdown(); @@ -313,11 +308,8 @@ public class FindAction { output = output + out; } response = output; - } catch (ClientProtocolException e) { - LOGGER.error(e.getMessage()); - response = e.getMessage(); - } catch (IOException e) { - LOGGER.error(e.getMessage()); + }catch (Exception e) { + LOGGER.error(e.getMessage() +e); response = e.getMessage(); } finally { httpClient.getConnectionManager().shutdown(); @@ -353,13 +345,10 @@ public class FindAction { output = output + out; } response = output; - } catch (ClientProtocolException e) { - LOGGER.error(e.getMessage()); + } catch (Exception e) { + LOGGER.error(e.getMessage() +e); response = e.getMessage(); - } catch (IOException e) { - LOGGER.error(e.getMessage()); - response = e.getMessage(); - } finally { + }finally { httpClient.getConnectionManager().shutdown(); } } diff --git a/ECOMP-PDP/src/main/java/org/openecomp/policy/xacml/custom/EcompFunctionDefinitionFactory.java b/ECOMP-PDP/src/main/java/org/openecomp/policy/xacml/custom/EcompFunctionDefinitionFactory.java index 202468feb..2cb8e67ae 100644 --- a/ECOMP-PDP/src/main/java/org/openecomp/policy/xacml/custom/EcompFunctionDefinitionFactory.java +++ b/ECOMP-PDP/src/main/java/org/openecomp/policy/xacml/custom/EcompFunctionDefinitionFactory.java @@ -24,6 +24,8 @@ import java.lang.reflect.Modifier; import java.util.HashMap; import java.util.Map; +import org.openecomp.policy.common.logging.flexlogger.FlexLogger; +import org.openecomp.policy.common.logging.flexlogger.Logger; import org.openecomp.policy.xacml.pdp.std.functions.FunctionDefinitionCustomRegexpMatch; import com.att.research.xacml.api.Identifier; @@ -34,6 +36,7 @@ import com.att.research.xacmlatt.pdp.policy.FunctionDefinitionFactory; import com.att.research.xacmlatt.pdp.std.StdFunctions; public class EcompFunctionDefinitionFactory extends FunctionDefinitionFactory { + private static Logger logger = FlexLogger.getLogger(EcompFunctionDefinitionFactory.class); private static Map<Identifier,FunctionDefinition> mapFunctionDefinitions = new HashMap<>(); private static boolean needMapInit = true; @@ -60,7 +63,7 @@ public class EcompFunctionDefinitionFactory extends FunctionDefinitionFactory { try { register((FunctionDefinition)(field.get(null))); } catch (IllegalAccessException ex) { - + logger.error(ex.getMessage() +ex); } } } diff --git a/ECOMP-PDP/src/main/java/org/openecomp/policy/xacml/pdp/std/functions/FunctionDefinitionCustomRegexpMatch.java b/ECOMP-PDP/src/main/java/org/openecomp/policy/xacml/pdp/std/functions/FunctionDefinitionCustomRegexpMatch.java index 5b84ab0f6..5c11f8c43 100644 --- a/ECOMP-PDP/src/main/java/org/openecomp/policy/xacml/pdp/std/functions/FunctionDefinitionCustomRegexpMatch.java +++ b/ECOMP-PDP/src/main/java/org/openecomp/policy/xacml/pdp/std/functions/FunctionDefinitionCustomRegexpMatch.java @@ -22,6 +22,9 @@ package org.openecomp.policy.xacml.pdp.std.functions; import java.util.List; +import org.openecomp.policy.common.logging.flexlogger.FlexLogger; +import org.openecomp.policy.common.logging.flexlogger.Logger; + import com.att.research.xacml.api.DataType; import com.att.research.xacml.api.DataTypeException; import com.att.research.xacml.api.Identifier; @@ -46,7 +49,7 @@ import com.att.research.xacmlatt.pdp.std.functions.FunctionDefinitionBase; * @param <I> the java class for the data type of the function Input arguments */ public class FunctionDefinitionCustomRegexpMatch<I> extends FunctionDefinitionBase<Boolean, I> { - + private static Logger logger = FlexLogger.getLogger(FunctionDefinitionCustomRegexpMatch.class); /** * Constructor - need dataTypeArgs input because of java Generic type-erasure during compilation. @@ -70,7 +73,7 @@ public class FunctionDefinitionCustomRegexpMatch<I> extends FunctionDefinitionBa // get the regular expression FunctionArgument regexpArgument = arguments.get(0); - ConvertedArgument<String> convertedArgument = new ConvertedArgument<String>(regexpArgument, DataTypes.DT_STRING, false); + ConvertedArgument<String> convertedArgument = new ConvertedArgument<>(regexpArgument, DataTypes.DT_STRING, false); if ( ! convertedArgument.isOk()) { return ExpressionResult.newError(getFunctionStatus(convertedArgument.getStatus())); } @@ -82,7 +85,7 @@ public class FunctionDefinitionCustomRegexpMatch<I> extends FunctionDefinitionBa // now get the element to match FunctionArgument elementArgument = arguments.get(1); - ConvertedArgument<I> convertedElement = new ConvertedArgument<I>(elementArgument, this.getDataTypeArgs(), false); + ConvertedArgument<I> convertedElement = new ConvertedArgument<>(elementArgument, this.getDataTypeArgs(), false); if ( ! convertedElement.isOk()) { return ExpressionResult.newError(getFunctionStatus(convertedElement.getStatus())); } @@ -93,6 +96,7 @@ public class FunctionDefinitionCustomRegexpMatch<I> extends FunctionDefinitionBa try { elementValueString = this.getDataTypeArgs().toStringValue(elementValueObject); } catch (DataTypeException e) { + logger.error(e.getMessage() +e); String message = e.getMessage(); if (e.getCause() != null) { message = e.getCause().getMessage(); |