diff options
author | Jim Hahn <jrh3@att.com> | 2018-01-31 18:10:34 -0500 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2018-02-01 10:50:48 -0500 |
commit | 0f51fa4e072aeb29f4e323cb6013fb4a873aae5c (patch) | |
tree | 1f0b28eea283e367725980e3e22acfaf89e628e2 /integrity-audit/src/main/java/org/onap/policy/common/ia/DbDAO.java | |
parent | 9c978cea0a5af3d4a9d587a5f09b88d660bd498b (diff) |
Fix sonar generic Exceptions in policy/common
IntegrityMonitor.java:
Renamed variables, Ex: dep_groups => depGroups.
Renamed enum constants, Ex: pdp_xacml => PDP_XACML.
Merged "if" tests.
Cast values to "long" before multiplying.
Re-throw interrupt().
Write exception via logger instead of e.printStackTrace().
Moved constructor to top of the file.
Removed most logger.isDebugEnabled() checks.
Returned generic List instead of ArrayList.
Used entrySet() instead of keySet().
Removed useless parentheses.
Removed superfluous exceptions from "throws" declaration.
DbAudit.java:
Modified DbAudit to throw DbAuditException.
Replaced references to HashSet and HashMap with generic Set and Map.
Modified DbAudit to iterate over entrySet() instead of keySet().
ComponentAdminException:
Created ComponentAdminException class.
Modified ComponentAdmin methods to throw new exception class.
Extracted "stateManager" String constant.
Eliminated logger.isDebugEnabled() calls.
Updated the license data.
Eliminated double-checked locking problem from PropertyUtil:
Modified code to use Initialization On Demand Holder idiom.
Change-Id: Ic01288542041da26df483ce85ecaf292ac138f85
Issue-ID: POLICY-246
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'integrity-audit/src/main/java/org/onap/policy/common/ia/DbDAO.java')
-rw-r--r-- | integrity-audit/src/main/java/org/onap/policy/common/ia/DbDAO.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/integrity-audit/src/main/java/org/onap/policy/common/ia/DbDAO.java b/integrity-audit/src/main/java/org/onap/policy/common/ia/DbDAO.java index 99503854..b30c7730 100644 --- a/integrity-audit/src/main/java/org/onap/policy/common/ia/DbDAO.java +++ b/integrity-audit/src/main/java/org/onap/policy/common/ia/DbDAO.java @@ -24,7 +24,9 @@ import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Properties; +import java.util.Set; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; @@ -119,7 +121,7 @@ public class DbDAO { * @param className * @return */ - public HashMap<Object, Object> getAllMyEntries(String className) { + public Map<Object, Object> getAllMyEntries(String className) { logger.debug("getAllMyEntries: Entering, className=" + className); HashMap<Object, Object> resultMap = new HashMap<>(); @@ -152,7 +154,7 @@ public class DbDAO { * @param keySet * @return */ - public HashMap<Object, Object> getAllMyEntries(String className, HashSet<Object> keySet){ + public Map<Object, Object> getAllMyEntries(String className, Set<Object> keySet){ logger.debug("getAllMyEntries: Entering, className=" + className + ",\n keySet=" + keySet); @@ -180,7 +182,7 @@ public class DbDAO { * @param className * @return */ - public HashMap<Object,Object> getAllEntries(String persistenceUnit, Properties properties, String className){ + public Map<Object,Object> getAllEntries(String persistenceUnit, Properties properties, String className){ logger.debug("getAllEntries: Entering, persistenceUnit=" + persistenceUnit + ",\n className=" + className); @@ -221,7 +223,7 @@ public class DbDAO { * @return */ - public HashMap<Object,Object> getAllEntries(String persistenceUnit, Properties properties, String className, HashSet<Object> keySet){ + public Map<Object,Object> getAllEntries(String persistenceUnit, Properties properties, String className, Set<Object> keySet){ logger.debug("getAllEntries: Entering, persistenceUnit=" + persistenceUnit + ",\n properties= " + properties + ",\n className=" + className + ",\n keySet= " + keySet); EntityManagerFactory theEmf = Persistence.createEntityManagerFactory(persistenceUnit, properties); @@ -364,7 +366,7 @@ public class DbDAO { * getPersistenceClassNames() gets all the persistence class names. * @return */ - public HashSet<String> getPersistenceClassNames(){ + public Set<String> getPersistenceClassNames(){ logger.debug("DbDAO: getPersistenceClassNames() entry"); HashSet<String> returnList = new HashSet<>(); final Metamodel mm = emf.getMetamodel(); |