openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1681576 - in /openwebbeans/trunk/webbeans-impl/src: main/java/org/apache/webbeans/util/GenericsUtil.java test/java/org/apache/webbeans/test/events/generics/GenericObserverTest.java
Date Mon, 25 May 2015 10:16:09 GMT
Author: struberg
Date: Mon May 25 10:16:09 2015
New Revision: 1681576

URL: http://svn.apache.org/r1681576
Log:
OWB-1066 fix endless loop in GenericsUtil

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/GenericsUtil.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/events/generics/GenericObserverTest.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/GenericsUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/GenericsUtil.java?rev=1681576&r1=1681575&r2=1681576&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/GenericsUtil.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/GenericsUtil.java
Mon May 25 10:16:09 2015
@@ -999,6 +999,10 @@ public final class GenericsUtil
                 {
                     subclass = iface;
                 }
+                else
+                {
+                    subclass = declaringClass.getSuperclass();
+                }
             }
             return getDirectSubclass(subclass, actualClass);
         }

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/events/generics/GenericObserverTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/events/generics/GenericObserverTest.java?rev=1681576&r1=1681575&r2=1681576&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/events/generics/GenericObserverTest.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/events/generics/GenericObserverTest.java
Mon May 25 10:16:09 2015
@@ -53,6 +53,21 @@ public class GenericObserverTest extends
         Assert.assertTrue(instance.isExtendsNumberObserved());
     }
 
+    @Test
+    public void testOwb1066()
+    {
+        startContainer(GenericEventBean1.class);
+
+        GenericEventBean1 instance = getInstance(GenericEventBean1.class);
+        instance.fireOwb1066_Event();
+
+        Assert.assertTrue(instance.isIntegerObserved());
+        Assert.assertFalse(instance.isUnintendedListObserved());
+        Assert.assertFalse(instance.isNumberObserved());
+        Assert.assertTrue(instance.isExtendsNumberObserved());
+    }
+
+
     @RequestScoped
     public static class GenericEventBean1
     {
@@ -70,6 +85,15 @@ public class GenericObserverTest extends
             integerEvent.fire(list);
         }
 
+        /**
+         * Test for OWB-1066. Previously created an endless loop
+         */
+        public void fireOwb1066_Event()
+        {
+            List<Integer> list = Arrays.asList(1,2,3);
+            integerEvent.fire(list);
+        }
+
         public void observeTotallyDifferentList(@Observes List<Map> mapList)
         {
             unintendedListObserved = true;



Mime
View raw message