tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject svn commit: r683429 - in /openejb/trunk/openejb3/container/openejb-core/src: main/java/org/apache/openejb/util/References.java test/java/org/apache/openejb/util/ReferencesTest.java
Date Wed, 06 Aug 2008 22:15:07 GMT
Author: dblevins
Date: Wed Aug  6 15:15:07 2008
New Revision: 683429

URL: http://svn.apache.org/viewvc?rev=683429&view=rev
Log:
Now throws IllegalArgumentException if a referenced item doesn't exist

Modified:
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/util/References.java
    openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/util/ReferencesTest.java

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/util/References.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/util/References.java?rev=683429&r1=683428&r2=683429&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/util/References.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/util/References.java
Wed Aug  6 15:15:07 2008
@@ -32,22 +32,6 @@
  */
 public class References {
 
-    @Stateless
-    public static class TesterBean implements Tester {
-        public Object call(Object object) {
-            return object;
-        }
-    }
-
-    public interface Tester {
-        public Object call(Object object);
-    }
-
-    {
-        Tester tester = null;
-        tester.call(int.class)
-    }
-
     public static interface Visitor<T> {
         String getName(T t);
 
@@ -79,6 +63,7 @@
         for (Node node : nodes.values()) {
             for (String name : visitor.getReferences((T) node.object)) {
                 Node ref = nodes.get(name);
+                if (ref == null) throw new IllegalArgumentException("No such object in list:
"+name);
                 node.references.add(ref);
                 ref.refernceCount++;
             }

Modified: openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/util/ReferencesTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/util/ReferencesTest.java?rev=683429&r1=683428&r2=683429&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/util/ReferencesTest.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/util/ReferencesTest.java
Wed Aug  6 15:15:07 2008
@@ -164,6 +164,25 @@
         }
     }
 
+
+    public void testNonSuchObject() {
+
+        beans = new ArrayList<Bean>();
+
+        Bean a = bean("a");
+        Bean b = bean("b", "a");
+        Bean c = bean("c", "b", "z");
+
+        List<Bean> actual = null;
+        try {
+            actual = sort(beans, visitor);
+            fail("An IllegalArgumentException should have been thrown");
+        } catch (IllegalArgumentException e) {
+            // pass
+        }
+    }
+
+
     private List<Bean> expected(Bean... beans){
         return Arrays.asList(beans);
     }



Mime
View raw message