Author: simonetripodi
Date: Wed Jun 22 19:22:05 2011
New Revision: 1138593

URL: http://svn.apache.org/viewvc?rev=1138593&view=rev
Log:
when adding an Edge, checked that the edge itself, the head vertex and the tail 
vertex are not null

Modified:
    
commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/BaseMutableGraph.java

Modified: 
commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/BaseMutableGraph.java
URL: 
http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/BaseMutableGraph.java?rev=1138593&r1=1138592&r2=1138593&view=diff
==============================================================================
--- 
commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/BaseMutableGraph.java
 (original)
+++ 
commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/BaseMutableGraph.java
 Wed Jun 22 19:22:05 2011
@@ -137,6 +137,19 @@ public abstract class BaseMutableGraph<V
      */
     private final void checkEdge( E e )
     {
+        if ( e == null )
+        {
+            throw new GraphException( "Impossible to add a null Edge in the 
Graph" );
+        }
+        if ( e.getHead() == null )
+        {
+            throw new GraphException( "Null head Vertex not admitted" );
+        }
+        if ( e.getTail() == null )
+        {
+            throw new GraphException( "Null tail Vertex not admitted" );
+        }
+
         if ( !getAdjacencyList().containsKey( e.getHead() ) )
         {
             throw new GraphException( format( "Head Vertex '%s' not present in 
the Graph", e.getHead() ) );


Reply via email to