Skip to content

Commit

Permalink
add Exception for null equipement
Browse files Browse the repository at this point in the history
Signed-off-by: Leclerc Clement <[email protected]>
  • Loading branch information
clementleclercRTE committed Dec 9, 2024
1 parent 71046bb commit 444b327
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
package com.powsybl.ucte.converter;

import com.powsybl.commons.PowsyblException;
import com.powsybl.iidm.network.*;
import com.powsybl.ucte.converter.util.UcteConverterConstants;
import com.powsybl.ucte.network.UcteElementId;
Expand Down Expand Up @@ -36,6 +37,9 @@ public UcteNodeCode getUcteNodeCode(String id) {

@Override
public UcteNodeCode getUcteNodeCode(Bus bus) {
if(bus == null) {
throw new PowsyblException("the bus is null");
}
return getUcteNodeCode(bus.getId());
}

Expand All @@ -55,16 +59,25 @@ public UcteElementId getUcteElementId(String id) {

@Override
public UcteElementId getUcteElementId(Switch sw) {
if(sw == null) {
throw new PowsyblException("the bus is null");
}
return getUcteElementId(sw.getId());
}

@Override
public UcteElementId getUcteElementId(Branch branch) {
if(branch == null) {
throw new PowsyblException("the bus is null");
}
return getUcteElementId(branch.getId());
}

@Override
public UcteElementId getUcteElementId(DanglingLine danglingLine) {
if(danglingLine == null) {
throw new PowsyblException("the bus is null");
}
return getUcteElementId(danglingLine.getId());
}
}
Expand Down

0 comments on commit 444b327

Please sign in to comment.