You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2026/08/09 09:33:25 UTC

(ofbiz-framework) 02/02: Fixed: Update OpenApiUtil to resolve compilation warnings

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

jacopoc pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git

commit dbdedcc6f342f4acd7d5a3b1eb9660f6f70eb6e3
Author: Jacopo Cappellato <ja...@gmail.com>
AuthorDate: Sun Aug 9 11:19:26 2026 +0200

    Fixed: Update OpenApiUtil to resolve compilation warnings
---
 .../main/java/org/apache/ofbiz/ws/rs/util/OpenApiUtil.java  | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/framework/rest-api/src/main/java/org/apache/ofbiz/ws/rs/util/OpenApiUtil.java b/framework/rest-api/src/main/java/org/apache/ofbiz/ws/rs/util/OpenApiUtil.java
index da9588f134..4a3897d0aa 100644
--- a/framework/rest-api/src/main/java/org/apache/ofbiz/ws/rs/util/OpenApiUtil.java
+++ b/framework/rest-api/src/main/java/org/apache/ofbiz/ws/rs/util/OpenApiUtil.java
@@ -476,7 +476,7 @@ public final class OpenApiUtil {
                     continue;
                 }
                 try {
-                    schema = (Schema<?>) schemaClass.newInstance();
+                    schema = (Schema<?>) schemaClass.getDeclaredConstructor().newInstance();
                     if (schema instanceof ArraySchema) {
                         ParameterizedType genericType = (ParameterizedType) field.getGenericType();
                         Class<? extends Type> genericClass = (Class<? extends Type>) genericType.getActualTypeArguments()[0];
@@ -486,19 +486,20 @@ public final class OpenApiUtil {
                         if (listSchemaClass == null || isTypeDomainModel(genericClass.getName())) {
                             arrSch.setItems(getSchemaForModel(genericClass.getName()));
                         } else {
-                            listSchema = (Schema<?>) listSchemaClass.newInstance();
+                            listSchema = (Schema<?>) listSchemaClass.getDeclaredConstructor().newInstance();
                             arrSch.setItems(listSchema);
                         }
-                        dataSchema.addProperties(fieldNm, arrSch);
+                        dataSchema.addProperty(fieldNm, arrSch);
                     } else if (schema instanceof MapSchema) {
                         if (isTypeDomainModel(fieldType.getName())) {
                             schema = getSchemaForModel(fieldType.getName());
-                            dataSchema.addProperties(fieldNm, schema);
+                            dataSchema.addProperty(fieldNm, schema);
                         }
                     } else {
-                        dataSchema.addProperties(fieldNm, schema.description(fieldNm));
+                        dataSchema.addProperty(fieldNm, schema.description(fieldNm));
                     }
-                } catch (InstantiationException | IllegalAccessException e) {
+                } catch (InstantiationException | IllegalAccessException | NoSuchMethodException
+                        | InvocationTargetException e) {
                     e.printStackTrace();
                 }
             }