public static COSName getPDFName(String aName)
    {
        WeakReference<COSName> weakRef = NAME_MAP.get(aName);
        COSName name = weakRef != null ? weakRef.get() : null;

        if (name == null)
        {
            // Although we use a ConcurrentHashMap, we cannot use computeIfAbsent() because the returned reference
            // might be stale (even the newly created one).
            // Use double checked locking to make the code thread safe.
            synchronized (NAME_MAP)
            {
                weakRef = NAME_MAP.get(aName);
                name = weakRef != null ? weakRef.get() : null;
                if (name == null)
                {
                    name = new COSName(aName);
                    CLEANER.register(name, () -> NAME_MAP.remove(aName));
                    NAME_MAP.put(aName, new WeakReference<>(name));
                }
            }
        }

        return name;
    }
@Test
    void PDFBox4076() throws IOException
    {
        String special = "中国你好!";
        ByteArrayOutputStream baos = new ByteArrayOutputStream();

        try (PDDocument document = new PDDocument())
        {
            PDPage page = new PDPage();
            document.addPage(page);
            document.getDocumentCatalog().getCOSObject().setString(COSName.getPDFName(special), special);
            
            document.save(baos);
        }
        try (PDDocument document = Loader.loadPDF(baos.toByteArray()))
        {
            COSDictionary catalogDict = document.getDocumentCatalog().getCOSObject();
            assertTrue(catalogDict.containsKey(special));
            assertEquals(special, catalogDict.getString(special));
        }
    }