aboutsummaryrefslogtreecommitdiffstats
path: root/utils/src/main/java/org/onap/policy/common/utils/resources/ResourceUtils.java
AgeCommit message (Collapse)AuthorFilesLines
2023-09-29Fix security vulnerabilitiesadheli.tavares1-13/+12
- iq nexus vulnerabilities - sonar security hotspots and code smell Issue-ID: POLICY-4761 Issue-ID: POLICY-4833 Change-Id: Iab2e07d2ee7b90031bc5a30210ce7d3f5a47b3fd Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
2021-09-02Create methods for creating temp filesJim Hahn1-14/+5
Created utility methods to create temp files and set default permissions. These can be used in other repos to satisfy sonar. Also added code to close streams and clean up temp files created by some junit tests. Modified to use IOUtils to read a stream. Issue-ID: POLICY-3289 Change-Id: Ic83e4f4d7745be7b37ebb42bf1d81e303d8dadc9 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-06-17Use lombok in policy-common utilsJim Hahn1-8/+4
Issue-ID: POLICY-3394 Change-Id: I42a18c115c3ca7110f37fc0ae8aeea3f2bbffb37 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-05-07Change java.util.regex to re2jJim Hahn1-1/+1
Sonar complains about java.util.regex. Thought I used re2j when creating all of the patterns, but apparently not. Fixed that oversight. Issue-ID: POLICY-3284 Change-Id: Idbec112ab0d4c3b477ce357f8a556d95e4dea083 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-05-06Fix sonars in policy-commonJim Hahn1-17/+20
Fixed sonars: - use "var" instead of actual type name - re-interrupt threads - use rej2 split() instead of String split() Issue-ID: POLICY-3285 Change-Id: I82261e0b8a53ee5c5264556fbf5cec37454f014e Signed-off-by: Jim Hahn <jrh3@att.com>
2020-06-17Cleanup various sonar issues in policy-commonJim Hahn1-1/+0
Addressed the following issues: - unused imports - unused method parameters - use assertEquals, assertSame instead of assertTrue - provide the parametrized type for this generic Also fixed some checkstyle issues: - removed blank lines between "import" groups Issue-ID: POLICY-2650 Change-Id: I004bb650ac10c49ccd0fc405f6959896fec39f9b Signed-off-by: Jim Hahn <jrh3@att.com>
2020-04-06Address sonar issues in commonJim Hahn1-8/+15
Addressed the following sonar issues: - missing assertion in junit test case - disable sonars about setAccessible() as it's required for jackson emulation - sleep in junit - don't use wild-cards (e.g., "*") with java.util Pattern - use re2j instead of java.util Pattern - use String methods (e.g., startsWith()) - duplicate method bodies - duplicate code in Coder classes - string concatenation in logger calls - UTF-8 encoding - return primitive instead of boxed primitive - add assertion to tests - renamed support methods from doTestXxx to verifyXxx - cognitive complexity - use AtomicRef instead of volatile - use specific Functionals (e.g., IntConsumer) - function always returns the same value - serializable vs transient Issue-ID: POLICY-2305 Change-Id: I08eb7aa495a80bdc1d26827ba17a7946c83b9828 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-01-13Add method to return resource directory contentsliamfallon1-3/+102
In order to avoid hard coding the policy types and policies that are in the example directories into unit test cases, and in order to automatically pick up added and removed policy types and policies, it would be good to read the contents of resource directories at run time in unit tests. This change brings in that functionality into ResourceUtils. Issue-ID: POLICY-2315 Change-Id: I601718828aad0f065dbbaa1f5af8d0a0f133f44d Signed-off-by: liamfallon <liam.fallon@est.tech>
2018-07-31Add resource handling utility classliamfallon1-0/+214
Add ResourceUtils, a class that provides utility methods for dealing with Java resources on the classpath. Change-Id: Ie4df249315ad145aabdfb35bb827ffbf6d79e095 Issue-ID: POLICY-922 Signed-off-by: liamfallon <liam.fallon@ericsson.com>