Author: rsandtner
Date: Wed Apr 18 07:10:36 2018
New Revision: 1829419
URL: http://svn.apache.org/viewvc?rev=1829419&view=rev
Log:
OWB-1240 fixed arrayIndexOutOfBoundsException for non static inner classes
applied fix from branch owb_1.7.x
Added:
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/definition/NonStaticInnerClassTest.java
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java?rev=1829419&r1=1829418&r2=1829419&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
Wed Apr 18 07:10:36 2018
@@ -1560,29 +1560,30 @@ public class BeansDeployer
Class<?> beanClass = type.getJavaClass();
WebBeansUtil webBeansUtil = webBeansContext.getWebBeansUtil();
- // done separately to be able to swallow the logging when not relevant
and avoid to pollute logs
try
{
- if (!webBeansUtil.isConstructorOk(type))
- {
- return false;
- }
+ webBeansUtil.checkManagedBean(beanClass);
}
- catch (TypeNotPresentException cnfe)
+ catch (DefinitionException e)
{
+ logger.log(Level.FINE, "skipped deployment of: " +
beanClass.getName() + " reason: " + e.getMessage());
+ logger.log(Level.FINER, "skipped deployment of: " +
beanClass.getName() + " details: ", e);
return false;
}
+ // done separately to be able to swallow the logging when not relevant
and avoid to pollute logs
try
{
- webBeansUtil.checkManagedBean(beanClass);
+ if (!webBeansUtil.isConstructorOk(type))
+ {
+ return false;
+ }
}
- catch (DefinitionException e)
+ catch (TypeNotPresentException cnfe)
{
- logger.log(Level.FINE, "skipped deployment of: " +
beanClass.getName() + " reason: " + e.getMessage());
- logger.log(Level.FINER, "skipped deployment of: " +
beanClass.getName() + " details: ", e);
return false;
}
+
//we are not allowed to catch possible exceptions thrown by the
following method
webBeansUtil.checkManagedBeanCondition(beanClass);
return true;
Added:
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/definition/NonStaticInnerClassTest.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/definition/NonStaticInnerClassTest.java?rev=1829419&view=auto
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/definition/NonStaticInnerClassTest.java
(added)
+++
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/definition/NonStaticInnerClassTest.java
Wed Apr 18 07:10:36 2018
@@ -0,0 +1,59 @@
+/*
+ * 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.webbeans.test.unittests.definition;
+
+import org.apache.webbeans.test.AbstractUnitTest;
+import org.junit.Test;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import static org.junit.Assert.assertNull;
+
+public class NonStaticInnerClassTest extends AbstractUnitTest
+{
+
+ @Test
+ public void testNonStaticInnerClassShouldBeIgnored()
+ {
+ startContainer(InnerClass.class);
+ assertNull(getBean(InnerClass.class));
+ }
+
+
+ class InnerClass {
+
+ String s1;
+ String s2;
+ String s3;
+
+ public InnerClass(String s1, @TheAnnotation String s2, String s3)
+ {
+ this.s1 = s1;
+ this.s2 = s2;
+ this.s3 = s3;
+ }
+ }
+
+ @Target(ElementType.PARAMETER)
+ @Retention(RetentionPolicy.RUNTIME)
+ public @interface TheAnnotation {}
+}