openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1426744 - in /openwebbeans/branches/owb_1.1.x: ./ webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/proxy/ webbeans-impl/src/main/java/org/apache/webbeans/intercept/ webbeans-impl/src/main/java/org/apache/webbeans/proxy/ webbeans-i...
Date Sat, 29 Dec 2012 11:22:44 GMT
Author: arne
Date: Sat Dec 29 11:22:44 2012
New Revision: 1426744

URL: http://svn.apache.org/viewvc?rev=1426744&view=rev
Log:
Fixed loop counter

Added:
    openwebbeans/branches/owb_1.1.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/observer/
    openwebbeans/branches/owb_1.1.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/observer/EventTest.java
    openwebbeans/branches/owb_1.1.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/observer/Green.java
      - copied unchanged from r1426743, openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/observer/Green.java
    openwebbeans/branches/owb_1.1.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/observer/Orange.java
      - copied unchanged from r1426743, openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/observer/Orange.java
    openwebbeans/branches/owb_1.1.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/observer/Painter.java
      - copied unchanged from r1426743, openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/observer/Painter.java
    openwebbeans/branches/owb_1.1.x/webbeans-impl/src/test/java/org/apache/webbeans/util/ClassUtilTest.java
      - copied unchanged from r1426743, openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/util/ClassUtilTest.java
Modified:
    openwebbeans/branches/owb_1.1.x/   (props changed)
    openwebbeans/branches/owb_1.1.x/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/proxy/
  (props changed)
    openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java
  (props changed)
    openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/
  (props changed)
    openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java

Propchange: openwebbeans/branches/owb_1.1.x/
------------------------------------------------------------------------------
  Merged /openwebbeans/trunk:r1426743

Propchange: openwebbeans/branches/owb_1.1.x/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/proxy/
------------------------------------------------------------------------------
  Merged /openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/proxy:r1426743

Propchange: openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java
------------------------------------------------------------------------------
  Merged /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java:r1426743

Propchange: openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/
------------------------------------------------------------------------------
  Merged /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy:r1426743

Modified: openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java?rev=1426744&r1=1426743&r2=1426744&view=diff
==============================================================================
--- openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
(original)
+++ openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
Sat Dec 29 11:22:44 2012
@@ -51,7 +51,6 @@ import java.util.logging.Logger;
  * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
  * @since 1.0
  */
-@SuppressWarnings("unchecked")
 public final class ClassUtil
 {
     public static final Map<Class<?>, Class<?>> PRIMITIVE_TO_WRAPPERS_MAP
= new HashMap<Class<?>, Class<?>>();
@@ -1039,7 +1038,6 @@ public final class ClassUtil
 
         Method[] methods = SecurityUtil.doPrivilegedGetDeclaredMethods(clazz);
 
-        int j = 0;
         for (Method method : methods)
         {
             if (method.getName().equals(methodName))
@@ -1060,9 +1058,9 @@ public final class ClassUtil
 
                 if (!ok)
                 {
-                    for (Class<?> defineType : defineTypes)
+                    for (int i = 0; i < defineTypes.length; i++)
                     {
-                        if (defineType.isAssignableFrom(parameterTypes.get(j)))
+                        if (defineTypes[i].isAssignableFrom(parameterTypes.get(i)))
                         {
                             ok = true;
                         }
@@ -1070,8 +1068,6 @@ public final class ClassUtil
                         {
                             ok = false;
                         }
-
-                        j++;
                     }
                 }
 

Added: openwebbeans/branches/owb_1.1.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/observer/EventTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/branches/owb_1.1.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/observer/EventTest.java?rev=1426744&view=auto
==============================================================================
--- openwebbeans/branches/owb_1.1.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/observer/EventTest.java
(added)
+++ openwebbeans/branches/owb_1.1.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/events/observer/EventTest.java
Sat Dec 29 11:22:44 2012
@@ -0,0 +1,50 @@
+/*
+ * 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.newtests.events.observer;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class EventTest extends AbstractUnitTest {
+
+    @Test
+    public void multipleObserverMethodsWithSameName()
+    {
+        Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+        beanClasses.add(Painter.class);
+        startContainer(beanClasses, null);
+
+        final Orange orange = new Orange();
+        getBeanManager().fireEvent(orange);
+
+        final Green green = new Green();
+        getBeanManager().fireEvent(green);
+
+        final Painter painter = getInstance(Painter.class);
+        Assert.assertEquals(2, painter.getObserved().size());
+        Assert.assertSame(orange, painter.getObserved().get(0));
+        Assert.assertSame(green, painter.getObserved().get(1));
+
+        shutDownContainer();
+    }
+}



Mime
View raw message