Repository: primefaces/primefaces (java)

Issue:
Avatar: Error rendering label with only numbers
### Describe the bug

I have an issue where the value passed to the attribute label is only numbers or anything different as letters, the current version throws an exception with the message 



`java.lang.StringIndexOutOfBoundsException: String index out of range: 0
	at java.base/java.lang.StringLatin1.charAt(StringLatin1.java:47)
	at java.base/java.lang.String.charAt(String.java:693)
	at org.primefaces.component.avatar.AvatarRenderer.calculateLabel(AvatarRenderer.java:128)
	at org.primefaces.component.avatar.AvatarRenderer.encodeEnd(AvatarRenderer.java:58)
	at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:595)
	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1654)
	at javax.faces.render.Renderer.encodeChildren(Renderer.java:152)`

Reviewing the source code of the avatar component I found that the component is assuming that only letters are included in the label if not, the call of the following method throws the exception

```java
protected String calculateLabel(FacesContext context, Avatar avatar)  {

        String value = avatar.getLabel();

        if (value == null || value.length() <= 2) {
            return value;
        }
        Matcher m = LETTER_PATTTERN.matcher(value);
        StringBuilder sb = SharedStringBuilder.get(context, SB_AVATAR);
        while (m.find()) {
            sb.append(m.group());
        }
        String initials = sb.toString();
        return initials.length() == 1 ? initials : initials.charAt(0) + initials.substring(initials.length() - 1);
    }
```



### Reproducer

_No response_

### Expected behavior

The label should be taken as an string of characters no matters if its only numbers and not letters on it.

### PrimeFaces edition

Elite

### PrimeFaces version

11.0.9

### Theme

Rain

### JSF implementation

Mojarra

### JSF version

2.2

### Java version

11

### Browser(s)

Chrome

Pull request:
Fix #9459: Avatar fix if only numeric
Fix #9459: Avatar fix if only numeric

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 a25a831399..e38a9529c0 100644
--- a/primefaces/src/main/java/org/primefaces/component/avatar/AvatarRenderer.java
+++ b/primefaces/src/main/java/org/primefaces/component/avatar/AvatarRenderer.java
@@ -138,6 +138,7 @@ public class AvatarRenderer extends CoreRenderer {
             sb.append(m.group());
         }
         String initials = sb.toString();
+        initials = LangUtils.isEmpty(initials) ? value.charAt(0) + "" : initials;
         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 a43d7ee794..ad69c302ac 100644
--- a/primefaces/src/test/java/org/primefaces/component/avatar/AvatarRendererTest.java
+++ b/primefaces/src/test/java/org/primefaces/component/avatar/AvatarRendererTest.java
@@ -53,6 +53,12 @@ class AvatarRendererTest {
                     Arguments.of("G", "G"),
                     Arguments.of("BD", "BD"),
                     Arguments.of("Sting", "S"),
+                    Arguments.of("6", "6"),
+                    Arguments.of("67", "67"),
+                    Arguments.of("8675309", "8"),
+                    Arguments.of("41235 5asdd", "4"),
+                    Arguments.of("1234", "1"),
+                    Arguments.of("888 7666", "8"),
                     Arguments.of("Wolfgang Amadeus Mozart", "WM"),
                     Arguments.of("PrimeFaces Rocks", "PR"),
                     Arguments.of("ŞPrimeFaces Rocks", "ŞR"),