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

tkobayas pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-drools.git


The following commit(s) were added to refs/heads/main by this push:
     new c732f17c9c [incubator-kie-drools-6273] 
DroolsAssetsProcessor#generateSources threw an exception: 
java.lang.UnsupportedOperationException when no drl resources are presents 
(#6277)
c732f17c9c is described below

commit c732f17c9ce036b3a25d541549cbfdb150bee7db
Author: Toshiya Kobayashi <[email protected]>
AuthorDate: Mon Mar 17 10:12:13 2025 +0900

    [incubator-kie-drools-6273] DroolsAssetsProcessor#generateSources threw an 
exception: java.lang.UnsupportedOperationException when no drl resources are 
presents (#6277)
---
 .../drools/model/codegen/project/RuleCodegen.java  |  5 +--
 .../org/drools/quarkus/deployment/NoDrlTest.java   | 40 ++++++++++++++++++++++
 2 files changed, 43 insertions(+), 2 deletions(-)

diff --git 
a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/project/RuleCodegen.java
 
b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/project/RuleCodegen.java
index cef015f963..f69a2789f7 100644
--- 
a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/project/RuleCodegen.java
+++ 
b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/project/RuleCodegen.java
@@ -18,6 +18,7 @@
  */
 package org.drools.model.codegen.project;
 
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Map;
@@ -49,7 +50,7 @@ public class RuleCodegen {
     }
 
     private final Collection<Resource> resources;
-    private Collection<PackageModel> packageModels;
+    private Collection<PackageModel> packageModels = Collections.emptySet();
 
     private boolean hotReloadMode = false;
     private final boolean decisionTableSupported;
@@ -110,7 +111,7 @@ public class RuleCodegen {
 
     public final Collection<GeneratedFile> generate() {
         if (isEmpty()) {
-            return Collections.emptySet();
+            return new ArrayList<>(); // mutable
         }
         return internalGenerate();
     }
diff --git 
a/drools-quarkus-extension/drools-quarkus-deployment/src/test/java/org/drools/quarkus/deployment/NoDrlTest.java
 
b/drools-quarkus-extension/drools-quarkus-deployment/src/test/java/org/drools/quarkus/deployment/NoDrlTest.java
new file mode 100644
index 0000000000..7f4eee3f5a
--- /dev/null
+++ 
b/drools-quarkus-extension/drools-quarkus-deployment/src/test/java/org/drools/quarkus/deployment/NoDrlTest.java
@@ -0,0 +1,40 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.drools.quarkus.deployment;
+
+import io.quarkus.test.QuarkusUnitTest;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static org.assertj.core.api.Assertions.assertThatNoException;
+
+public class NoDrlTest {
+
+    static final Logger LOG = LoggerFactory.getLogger(NoDrlTest.class);
+
+    @RegisterExtension
+    static final QuarkusUnitTest config = new QuarkusUnitTest(); // Not adding 
Drl to the project
+
+    @Test
+    public void testQuarkusUTByAddBuildChainCustomizer() {
+        assertThatNoException().isThrownBy(() -> LOG.info("No exception with 
no DRL"));
+    }
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to