You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by po...@apache.org on 2019/05/11 22:33:28 UTC

[incubator-tamaya-sandbox] 01/03: TAMAYA-277: Fix more sonar warnings, add test case

This is an automated email from the ASF dual-hosted git repository.

pottlinger pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-tamaya-sandbox.git

commit 05adeb1ad7734ca968d2c1d82926a62889d0ab8a
Author: Hugo Hirsch <gi...@hugo-hirsch.de>
AuthorDate: Sun May 12 00:21:06 2019 +0200

    TAMAYA-277: Fix more sonar warnings, add test case
---
 configured-sysprops/pom.xml                            |  6 ++++++
 .../tamaya/sysprops/ConfiguredSystemProperties.java    | 18 +++++++++---------
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/configured-sysprops/pom.xml b/configured-sysprops/pom.xml
index 28ce175..2b063e7 100644
--- a/configured-sysprops/pom.xml
+++ b/configured-sysprops/pom.xml
@@ -47,6 +47,12 @@ under the License.
             <artifactId>junit</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.assertj</groupId>
+            <artifactId>assertj-core</artifactId>
+            <version>${assertj.version}</version>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
 </project>
diff --git a/configured-sysprops/src/main/java/org/apache/tamaya/sysprops/ConfiguredSystemProperties.java b/configured-sysprops/src/main/java/org/apache/tamaya/sysprops/ConfiguredSystemProperties.java
index fdd0609..7a5cc70 100644
--- a/configured-sysprops/src/main/java/org/apache/tamaya/sysprops/ConfiguredSystemProperties.java
+++ b/configured-sysprops/src/main/java/org/apache/tamaya/sysprops/ConfiguredSystemProperties.java
@@ -150,7 +150,7 @@ public class ConfiguredSystemProperties extends Properties {
 
 
     @Override
-    public String toString() {
+    public synchronized String toString() {
         return getContextualProperties().toString();
     }
 
@@ -191,7 +191,7 @@ public class ConfiguredSystemProperties extends Properties {
     }
 
     @Override
-    public void storeToXML(OutputStream os, String comment) throws IOException {
+    public synchronized void storeToXML(OutputStream os, String comment) throws IOException {
         getContextualProperties().storeToXML(os, comment);
     }
 
@@ -211,37 +211,37 @@ public class ConfiguredSystemProperties extends Properties {
     }
 
     @Override
-    public boolean isEmpty() {
+    public synchronized boolean isEmpty() {
         return getContextualProperties().isEmpty();
     }
 
     @Override
-    public Object put(Object key, Object value) {
+    public synchronized Object put(Object key, Object value) {
         return getContextualProperties().put(key, value);
     }
 
     @Override
-    public Object remove(Object key) {
+    public synchronized Object remove(Object key) {
         return getContextualProperties().remove(key);
     }
 
     @Override
-    public void putAll(Map<?, ?> t) {
+    public synchronized void putAll(Map<?, ?> t) {
         getContextualProperties().putAll(t);
     }
 
     @Override
-    public void clear() {
+    public synchronized void clear() {
         getContextualProperties().clear();
     }
 
     @Override
-    public boolean equals(Object o) {
+    public synchronized boolean equals(Object o) {
         return getContextualProperties().equals(o);
     }
 
     @Override
-    public int hashCode() {
+    public synchronized int hashCode() {
         return getContextualProperties().hashCode();
     }