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

rmannibucau pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwebbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new 528afb5  Improve handling of lineSeparator in ViolationMessageBuilder
     new f092b8c  Merge pull request #35 from RealCLanger/patch-1
528afb5 is described below

commit 528afb596eb103ea9af7fed1f37bdbc40db8c358
Author: Christoph Langer <christoph.lan...@sap.com>
AuthorDate: Mon Jul 19 09:14:09 2021 +0200

    Improve handling of lineSeparator in ViolationMessageBuilder
    
    Call System.lineSeparator() instead of System.getProperty("line.separator") 
to avoid a potential bottleneck when multiple threads concurrently build 
violation messages and then have to synchronize on the HashMap access for 
System.getProperty.
---
 .../org/apache/webbeans/exception/helper/ViolationMessageBuilder.java | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git 
a/webbeans-impl/src/main/java/org/apache/webbeans/exception/helper/ViolationMessageBuilder.java
 
b/webbeans-impl/src/main/java/org/apache/webbeans/exception/helper/ViolationMessageBuilder.java
index 5230c85..020da57 100644
--- 
a/webbeans-impl/src/main/java/org/apache/webbeans/exception/helper/ViolationMessageBuilder.java
+++ 
b/webbeans-impl/src/main/java/org/apache/webbeans/exception/helper/ViolationMessageBuilder.java
@@ -22,8 +22,6 @@ public class ViolationMessageBuilder
 {
     private StringBuilder violationMessage;
 
-    private final String lineSeparator = System.getProperty("line.separator");
-
     public static ViolationMessageBuilder newViolation()
     {
         return new ViolationMessageBuilder();
@@ -59,7 +57,7 @@ public class ViolationMessageBuilder
         }
         else if(appendLineSeparator)
         {
-            violationMessage.append(lineSeparator);
+            violationMessage.append(System.lineSeparator());
         }
 
         for(String t : text)

Reply via email to