Author: tilman
Date: Wed Mar 25 20:45:59 2026
New Revision: 1932557

Log:
PDFBOX-5660: sonar fix

Modified:
   
pdfbox/branches/3.0/xmpbox/src/test/java/org/apache/xmpbox/schema/XMPSchemaTester.java

Modified: 
pdfbox/branches/3.0/xmpbox/src/test/java/org/apache/xmpbox/schema/XMPSchemaTester.java
==============================================================================
--- 
pdfbox/branches/3.0/xmpbox/src/test/java/org/apache/xmpbox/schema/XMPSchemaTester.java
      Wed Mar 25 20:45:55 2026        (r1932556)
+++ 
pdfbox/branches/3.0/xmpbox/src/test/java/org/apache/xmpbox/schema/XMPSchemaTester.java
      Wed Mar 25 20:45:59 2026        (r1932557)
@@ -192,40 +192,37 @@ class XMPSchemaTester
         Field[] fields = schemaClass.getFields();
         for (Field field : fields)
         {
-            if (field.isAnnotationPresent(PropertyType.class))
+            if (field.isAnnotationPresent(PropertyType.class) && 
!field.get(schema).equals(property))
             {
-                if (!field.get(schema).equals(property))
+                PropertyType pt = field.getAnnotation(PropertyType.class);
+                if (pt.type() == Types.LangAlt)
                 {
-                    PropertyType pt = field.getAnnotation(PropertyType.class);
-                    if (pt.type() == Types.LangAlt)
-                    {
-                        // do not check method existence
-                    }
-                    else if (pt.type() == Types.Thumbnail && pt.card() == 
Cardinality.Alt)
-                    {
-                        // do not check method existence
-                    }
-                    else if (pt.type() == Types.ResourceRef)
-                    {
-                        // do not check method existence
-                    }
-                    else if (pt.type() == Types.Version && pt.card() == 
Cardinality.Seq)
-                    {
-                        // do not check method existence
-                    }
-                    else
-                    {
-                        // type test
-                        PropertyType spt = 
retrievePropertyType(field.get(schema).toString());
-                        String getNameProperty = "get" + 
prepareName(field.get(schema).toString(), spt) + "Property";
-                        Method getMethod = 
schemaClass.getMethod(getNameProperty);
-                        assertNull(getMethod.invoke(schema), getNameProperty + 
" should return null when testing " + property);
-                        // value test
-                        String getNameValue = "get" + 
prepareName(field.get(schema).toString(), spt);
-                        getMethod = schemaClass.getMethod(getNameValue);
-                        assertNotNull(getMethod, getNameValue + " method 
should exist");
-                        assertNull(getMethod.invoke(schema), getNameValue + " 
should return null when testing " + property);
-                    }
+                    // do not check method existence
+                }
+                else if (pt.type() == Types.Thumbnail && pt.card() == 
Cardinality.Alt)
+                {
+                    // do not check method existence
+                }
+                else if (pt.type() == Types.ResourceRef)
+                {
+                    // do not check method existence
+                }
+                else if (pt.type() == Types.Version && pt.card() == 
Cardinality.Seq)
+                {
+                    // do not check method existence
+                }
+                else
+                {
+                    // type test
+                    PropertyType spt = 
retrievePropertyType(field.get(schema).toString());
+                    String getNameProperty = "get" + 
prepareName(field.get(schema).toString(), spt) + "Property";
+                    Method getMethod = schemaClass.getMethod(getNameProperty);
+                    assertNull(getMethod.invoke(schema), getNameProperty + " 
should return null when testing " + property);
+                    // value test
+                    String getNameValue = "get" + 
prepareName(field.get(schema).toString(), spt);
+                    getMethod = schemaClass.getMethod(getNameValue);
+                    assertNotNull(getMethod, getNameValue + " method should 
exist");
+                    assertNull(getMethod.invoke(schema), getNameValue + " 
should return null when testing " + property);
                 }
             }
         }

Reply via email to