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

jungm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomee.git


The following commit(s) were added to refs/heads/main by this push:
     new d00b4c701d reject unsupported deployment configs in openejb-hessian
d00b4c701d is described below

commit d00b4c701d71d12c8d82684734ef3c2baf7928d5
Author: Markus Jung <[email protected]>
AuthorDate: Sat Aug 29 09:53:01 2026 +0200

    reject unsupported deployment configs in openejb-hessian
---
 .../server/hessian/HessianRegistryImpl.java        |  8 ++++++
 .../server/hessian/HessianRegistryImplTest.java    | 33 ++++++++++++++++++++++
 2 files changed, 41 insertions(+)

diff --git 
a/server/openejb-hessian/src/main/java/org/apache/openejb/server/hessian/HessianRegistryImpl.java
 
b/server/openejb-hessian/src/main/java/org/apache/openejb/server/hessian/HessianRegistryImpl.java
index 2fa024341e..7918a39610 100644
--- 
a/server/openejb-hessian/src/main/java/org/apache/openejb/server/hessian/HessianRegistryImpl.java
+++ 
b/server/openejb-hessian/src/main/java/org/apache/openejb/server/hessian/HessianRegistryImpl.java
@@ -30,6 +30,14 @@ public class HessianRegistryImpl extends OpenEJBHttpRegistry 
implements HessianR
     public String deploy(final ClassLoader loader, final HessianServer 
listener, final String host,
                          final String app, final String authMethod, final 
String transportGuarantee,
                          final String realmName, final String name) {
+        if (authMethod != null && !"NONE".equalsIgnoreCase(authMethod)) {
+            throw new IllegalArgumentException("authMethod '" + authMethod + 
"' is not supported by the embedded hessian registry for '" + name
+                + "', use authMethod=NONE or the Tomcat registry");
+        }
+        if (transportGuarantee != null && 
!"NONE".equalsIgnoreCase(transportGuarantee)) {
+            throw new IllegalArgumentException("transportGuarantee '" + 
transportGuarantee + "' is not supported by the embedded hessian registry for 
'" + name
+                + "', use transportGuarantee=NONE or the Tomcat registry");
+        }
         final String path = generateEndpointName(app, name);
         addWrappedHttpListener(new HessianListener(listener), loader, path);
         return HttpUtil.selectSingleAddress(getResolvedAddresses(path));
diff --git 
a/server/openejb-hessian/src/test/java/org/apache/openejb/server/hessian/HessianRegistryImplTest.java
 
b/server/openejb-hessian/src/test/java/org/apache/openejb/server/hessian/HessianRegistryImplTest.java
new file mode 100644
index 0000000000..232673bdec
--- /dev/null
+++ 
b/server/openejb-hessian/src/test/java/org/apache/openejb/server/hessian/HessianRegistryImplTest.java
@@ -0,0 +1,33 @@
+/*
+ * 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
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.apache.openejb.server.hessian;
+
+import org.junit.Test;
+
+public class HessianRegistryImplTest {
+    @Test(expected = IllegalArgumentException.class)
+    public void rejectsAuthMethod() {
+        new 
HessianRegistryImpl().deploy(Thread.currentThread().getContextClassLoader(), 
null,
+            "localhost", "myapp", "BASIC", "NONE", null, "MyBean");
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void rejectsTransportGuarantee() {
+        new 
HessianRegistryImpl().deploy(Thread.currentThread().getContextClassLoader(), 
null,
+            "localhost", "myapp", "NONE", "CONFIDENTIAL", null, "MyBean");
+    }
+}

Reply via email to