Author: veithen
Date: Mon Apr 18 22:35:43 2016
New Revision: 1739826

URL: http://svn.apache.org/viewvc?rev=1739826&view=rev
Log:
AXIS2-5760: Fix broken modifier check introduced by AXIS2-1871.

Added:
    
axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/util/FinalClass.java
   (with props)
    
axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/util/UtilsTest.java
   (with props)
Modified:
    
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/util/Utils.java

Modified: 
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/util/Utils.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/util/Utils.java?rev=1739826&r1=1739825&r2=1739826&view=diff
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/util/Utils.java 
(original)
+++ 
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/util/Utils.java 
Mon Apr 18 22:35:43 2016
@@ -733,7 +733,8 @@ public class Utils {
                     final Class<?> serviceClass = Loader.loadClass(
                             classLoader,
                             ((String) serviceClassParam.getValue()).trim());
-                    if (serviceClass.getModifiers() != Modifier.PUBLIC) {
+                    int mod = serviceClass.getModifiers();
+                    if (!Modifier.isPublic(mod) || Modifier.isAbstract(mod) || 
Modifier.isInterface(mod)) {
                         throw new AxisFault("Service class " + 
serviceClass.getName() +
                                             " must have public as access 
Modifier");
                     }

Added: 
axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/util/FinalClass.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/util/FinalClass.java?rev=1739826&view=auto
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/util/FinalClass.java
 (added)
+++ 
axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/util/FinalClass.java
 Mon Apr 18 22:35:43 2016
@@ -0,0 +1,23 @@
+/*
+ * 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.axis2.util;
+
+public final class FinalClass {
+
+}

Propchange: 
axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/util/FinalClass.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/util/UtilsTest.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/util/UtilsTest.java?rev=1739826&view=auto
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/util/UtilsTest.java
 (added)
+++ 
axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/util/UtilsTest.java
 Mon Apr 18 22:35:43 2016
@@ -0,0 +1,39 @@
+/*
+ * 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.axis2.util;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import org.apache.axis2.Constants;
+import org.apache.axis2.description.AxisService;
+import org.junit.Test;
+
+public class UtilsTest {
+    /**
+     * Regression test for AXIS2-1871.
+     * 
+     * @throws Exception
+     */
+    @Test
+    public void testCreateServiceObjectWithFinalClass() throws Exception {
+        AxisService service = new AxisService();
+        service.addParameter(Constants.SERVICE_CLASS, 
FinalClass.class.getName());
+        
assertThat(Utils.createServiceObject(service)).isInstanceOf(FinalClass.class);
+    }
+}

Propchange: 
axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/util/UtilsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native


Reply via email to