File tree Expand file tree Collapse file tree
api/src/com/cloud/api/commands Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2929import com .cloud .api .ServerApiException ;
3030import com .cloud .api .response .SuccessResponse ;
3131import com .cloud .event .EventTypes ;
32+ import com .cloud .exception .InvalidParameterValueException ;
3233import com .cloud .network .rules .LoadBalancer ;
3334import com .cloud .user .Account ;
3435import com .cloud .user .UserContext ;
@@ -109,6 +110,10 @@ public String getSyncObjType() {
109110
110111 @ Override
111112 public Long getSyncObjId () {
112- return _lbService .findById (id ).getNetworkId ();
113+ LoadBalancer lb = _lbService .findById (id );
114+ if (lb == null ){
115+ throw new InvalidParameterValueException ("Unable to find load balancer rule: " + id );
116+ }
117+ return lb .getNetworkId ();
113118 }
114119}
Original file line number Diff line number Diff line change 2727import com .cloud .api .ServerApiException ;
2828import com .cloud .api .response .SuccessResponse ;
2929import com .cloud .event .EventTypes ;
30+ import com .cloud .exception .InvalidParameterValueException ;
3031import com .cloud .network .rules .LoadBalancer ;
3132import com .cloud .user .Account ;
3233import com .cloud .user .UserContext ;
@@ -99,6 +100,10 @@ public String getSyncObjType() {
99100
100101 @ Override
101102 public Long getSyncObjId () {
102- return _lbService .findById (id ).getNetworkId ();
103+ LoadBalancer lb = _lbService .findById (id );
104+ if (lb == null ){
105+ throw new InvalidParameterValueException ("Unable to find load balancer rule: " + id );
106+ }
107+ return lb .getNetworkId ();
103108 }
104109}
Original file line number Diff line number Diff line change 2929import com .cloud .api .ServerApiException ;
3030import com .cloud .api .response .SuccessResponse ;
3131import com .cloud .event .EventTypes ;
32+ import com .cloud .exception .InvalidParameterValueException ;
3233import com .cloud .network .rules .LoadBalancer ;
3334import com .cloud .user .Account ;
3435import com .cloud .user .UserContext ;
@@ -109,6 +110,10 @@ public String getSyncObjType() {
109110
110111 @ Override
111112 public Long getSyncObjId () {
112- return _lbService .findById (id ).getNetworkId ();
113+ LoadBalancer lb = _lbService .findById (id );
114+ if (lb == null ){
115+ throw new InvalidParameterValueException ("Unable to find load balancer rule: " + id );
116+ }
117+ return lb .getNetworkId ();
113118 }
114119}
You can’t perform that action at this time.
0 commit comments