Blob Blame History Raw
From 3a9c9a0bea7794c04ddbb8ac0520839c0f3d1cd0 Mon Sep 17 00:00:00 2001
From: Michael Simacek <msimacek@redhat.com>
Date: Tue, 1 Nov 2016 11:17:02 +0100
Subject: [PATCH] Copy input map in setCustomCompilerArguments[AsMap]

---
 .../plexus/compiler/CompilerConfiguration.java         | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/CompilerConfiguration.java b/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/CompilerConfiguration.java
index 69fc810..d4c4c03 100644
--- a/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/CompilerConfiguration.java
+++ b/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/CompilerConfiguration.java
@@ -426,14 +426,7 @@ public class CompilerConfiguration
     @Deprecated
     public void setCustomCompilerArguments( LinkedHashMap<String, String> customCompilerArguments )
     {
-        if ( customCompilerArguments == null )
-        {
-            this.customCompilerArguments = new ArrayList<Map.Entry<String,String>>();
-        }
-        else
-        {
-            this.customCompilerArguments = customCompilerArguments.entrySet();
-        }
+        setCustomCompilerArgumentsAsMap( customCompilerArguments );
     }
 
     /**
@@ -454,13 +447,10 @@ public class CompilerConfiguration
 
     public void setCustomCompilerArgumentsAsMap( Map<String, String> customCompilerArguments )
     {
-        if ( customCompilerArguments == null )
-        {
-            this.customCompilerArguments = new ArrayList<Map.Entry<String,String>>();
-        }
-        else
+        this.customCompilerArguments = new ArrayList<Map.Entry<String,String>>();
+        if ( customCompilerArguments != null )
         {
-            this.customCompilerArguments = customCompilerArguments.entrySet();
+            this.customCompilerArguments.addAll( customCompilerArguments.entrySet() );
         }
     }
     
-- 
2.7.4