Repository: primefaces/primefaces (java)

Issue:
Avatar: Duplicates first character when no surname
Just try below. `PP` will be appeared instead of `P`.

```xml
<p:avatar label="Primefaces" styleClass="p-mr-2" size="xlarge" />
```

Pull request description:
Fix #8074: Letter avatar duplicates first character when no surname
Added unit test and fix.

Patch:
diff --git a/primefaces/src/main/java/org/primefaces/component/avatar/AvatarRenderer.java b/primefaces/src/main/java/org/primefaces/component/avatar/AvatarRenderer.java
index fb190ace3a..a365627c0c 100644
--- a/primefaces/src/main/java/org/primefaces/component/avatar/AvatarRenderer.java
+++ b/primefaces/src/main/java/org/primefaces/component/avatar/AvatarRenderer.java
@@ -133,7 +133,7 @@ public class AvatarRenderer extends CoreRenderer {
             sb.append(m.group());
         }
         String initials = sb.toString();
-        return initials.charAt(0) + initials.substring(initials.length() - 1);
+        return initials.length() == 1 ? initials : initials.charAt(0) + initials.substring(initials.length() - 1);
     }
 
     /**


Test patch:
diff --git a/primefaces/src/test/java/org/primefaces/component/avatar/AvatarRendererTest.java b/primefaces/src/test/java/org/primefaces/component/avatar/AvatarRendererTest.java
index 64e9aed5bd..b1b4b5cf54 100644
--- a/primefaces/src/test/java/org/primefaces/component/avatar/AvatarRendererTest.java
+++ b/primefaces/src/test/java/org/primefaces/component/avatar/AvatarRendererTest.java
@@ -52,6 +52,7 @@ class AvatarRendererTest {
                     Arguments.of(null, null),
                     Arguments.of("G", "G"),
                     Arguments.of("BD", "BD"),
+                    Arguments.of("Sting", "S"),
                     Arguments.of("Wolfgang Amadeus Mozart", "WM"),
                     Arguments.of("PrimeFaces Rocks", "PR"),
                     Arguments.of("ŞPrimeFaces Rocks", "ŞR"),