activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1091852 - /activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/list/LinkedNode.java
Date Wed, 13 Apr 2011 17:19:40 GMT
Author: chirino
Date: Wed Apr 13 17:19:39 2011
New Revision: 1091852

URL: http://svn.apache.org/viewvc?rev=1091852&view=rev
Log:
Add a linked assertion check to provide a friendlier usage error message.

Modified:
    activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/list/LinkedNode.java

Modified: activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/list/LinkedNode.java
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/list/LinkedNode.java?rev=1091852&r1=1091851&r2=1091852&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/list/LinkedNode.java
(original)
+++ activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/list/LinkedNode.java
Wed Apr 13 17:19:39 2011
@@ -60,11 +60,17 @@ public class LinkedNode<T extends Linked
         return prev;
     }
 
+    final private void assertLinked() {
+        assert  list!=null && !list.isEmpty() : "Node is not linked";
+    }
+
     final public boolean isHeadNode() {
+        assertLinked();
         return list.head == this;
     }
 
     final public boolean isTailNode() {
+        assertLinked();
         return list.head.prev == this;
     }
 



Mime
View raw message