mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-15 01:11:30 +02:00
Fix NPE when there's no secondary path.
Change-Id: I3bb8eeb2abf140d44cf4dc7186cf1bf316c23f70
This commit is contained in:
parent
6a1ee2d82b
commit
c3d69f52e5
@ -43,7 +43,7 @@ public interface DisjointPath extends Path {
|
|||||||
/**
|
/**
|
||||||
* Gets secondary path.
|
* Gets secondary path.
|
||||||
*
|
*
|
||||||
* @return secondary path
|
* @return secondary path, or null if there is no secondary path available.
|
||||||
*/
|
*/
|
||||||
Path backup();
|
Path backup();
|
||||||
}
|
}
|
||||||
|
@ -482,6 +482,12 @@ public class DefaultTopology extends AbstractModel implements Topology {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private DisjointPath networkDisjointPath(DisjointPathPair<TopologyVertex, TopologyEdge> path) {
|
private DisjointPath networkDisjointPath(DisjointPathPair<TopologyVertex, TopologyEdge> path) {
|
||||||
|
if (!path.hasBackup()) {
|
||||||
|
// There was no secondary path available.
|
||||||
|
return new DefaultDisjointPath(CORE_PROVIDER_ID,
|
||||||
|
(DefaultPath) networkPath(path.primary()),
|
||||||
|
null);
|
||||||
|
}
|
||||||
return new DefaultDisjointPath(CORE_PROVIDER_ID,
|
return new DefaultDisjointPath(CORE_PROVIDER_ID,
|
||||||
(DefaultPath) networkPath(path.primary()),
|
(DefaultPath) networkPath(path.primary()),
|
||||||
(DefaultPath) networkPath(path.secondary()));
|
(DefaultPath) networkPath(path.secondary()));
|
||||||
|
@ -66,7 +66,7 @@ public class DisjointPathPair<V extends Vertex, E extends Edge<V>> implements Pa
|
|||||||
/**
|
/**
|
||||||
* Returns the secondary path.
|
* Returns the secondary path.
|
||||||
*
|
*
|
||||||
* @return primary path
|
* @return secondary path, or null if there is no secondary path available.
|
||||||
*/
|
*/
|
||||||
public Path<V, E> secondary() {
|
public Path<V, E> secondary() {
|
||||||
return secondary;
|
return secondary;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user