commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1139314 - /commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/AllVertexPairsShortestPath.java
Date Fri, 24 Jun 2011 14:18:18 GMT
Author: simonetripodi
Date: Fri Jun 24 14:18:18 2011
New Revision: 1139314

URL: http://svn.apache.org/viewvc?rev=1139314&view=rev
Log:
throws a PathNotFoundException when a path between the input vertex doesn't exist

Modified:
    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/AllVertexPairsShortestPath.java

Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/AllVertexPairsShortestPath.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/AllVertexPairsShortestPath.java?rev=1139314&r1=1139313&r2=1139314&view=diff
==============================================================================
--- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/AllVertexPairsShortestPath.java
(original)
+++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/AllVertexPairsShortestPath.java
Fri Jun 24 14:18:18 2011
@@ -19,6 +19,8 @@ package org.apache.commons.graph.shortes
  * under the License.
  */
 
+import static java.lang.String.format;
+
 import java.util.HashMap;
 import java.util.Map;
 
@@ -92,6 +94,11 @@ public final class AllVertexPairsShortes
         VertexPair<V> vertexPair = new VertexPair<V>( source, target );
         WeightedPath<V, WE> path = paths.get( vertexPair );
 
+        if ( path == null )
+        {
+            throw new PathNotFoundException( format( "Path from '%s' to '%s' doesn't exist",
source, target ) );
+        }
+
         return path;
     }
 



Mime
View raw message