Program: 38836
Project: 38836
Buggy source:
private static TwoWindingsTransformer createXnodeTransfo(UcteNetworkExt ucteNetwork,UcteTransformer ucteTransfo,boolean connected,UcteNodeCode xNodeCode,UcteNodeCode ucteOtherNodeCode,UcteVoltageLevel ucteOtherVoltageLevel,Substation substation,EntsoeFileName ucteFileName){
  String xNodeName=xNodeCode.toString();
  String yNodeName=ucteFileName.getCountry() != null ? ucteFileName.getCountry() + "String_Node_Str" + xNodeName : "String_Node_Str" + xNodeName;
  VoltageLevel yVoltageLevel=substation.newVoltageLevel().setId(yNodeName + "String_Node_Str").setNominalV(xNodeCode.getVoltageLevelCode().getVoltageLevel()).setTopologyKind(TopologyKind.BUS_BREAKER).add();
  yVoltageLevel.getBusBreakerView().newBus().setId(yNodeName).add();
  UcteNode ucteXnode=ucteNetwork.getNode(xNodeCode);
  LOGGER.warn("String_Node_Str",xNodeName + yNodeName,ucteXnode.getCode());
  float p0=0;
  if (isValueValid(ucteXnode.getActiveLoad())) {
    p0+=ucteXnode.getActiveLoad();
  }
  if (isValueValid(ucteXnode.getActivePowerGeneration())) {
    p0+=ucteXnode.getActivePowerGeneration();
  }
  float q0=0;
  if (isValueValid(ucteXnode.getReactiveLoad())) {
    q0+=ucteXnode.getReactiveLoad();
  }
  if (isValueValid(ucteXnode.getReactivePowerGeneration())) {
    q0+=ucteXnode.getReactivePowerGeneration();
  }
  yVoltageLevel.newDanglingLine().setId(xNodeName + "String_Node_Str" + yNodeName).setBus(yNodeName).setConnectableBus(yNodeName).setR(0.0f).setX(LINE_MIN_Z).setG(0f).setB(0f).setP0(p0).setQ0(q0).setUcteXnodeCode(ucteXnode.getCode().toString()).add();
  String voltageLevelId1;
  String voltageLevelId2;
  String busId1;
  String busId2;
  if (ucteXnode.getCode().equals(ucteTransfo.getId().getNodeCode1())) {
    voltageLevelId1=ucteOtherVoltageLevel.getName();
    voltageLevelId2=yVoltageLevel.getName();
    busId1=ucteOtherNodeCode.toString();
    busId2=yNodeName;
  }
 else {
    voltageLevelId1=yVoltageLevel.getName();
    voltageLevelId2=ucteOtherVoltageLevel.getName();
    busId1=yNodeName;
    busId2=ucteOtherNodeCode.toString();
  }
  return substation.newTwoWindingsTransformer().setId(ucteTransfo.getId().toString()).setVoltageLevel1(voltageLevelId1).setVoltageLevel2(voltageLevelId2).setBus1(connected ? busId1 : null).setBus2(connected ? busId2 : null).setConnectableBus1(busId1).setConnectableBus2(busId2).setRatedU1(ucteTransfo.getRatedVoltage2()).setRatedU2(ucteTransfo.getRatedVoltage1()).setR(ucteTransfo.getResistance()).setX(ucteTransfo.getReactance()).setG(getConductance(ucteTransfo)).setB(getSusceptance(ucteTransfo)).add();
}

Fixed version (ground truth):
private static TwoWindingsTransformer createXnodeTransfo(UcteNetworkExt ucteNetwork,UcteTransformer ucteTransfo,boolean connected,UcteNodeCode xNodeCode,UcteNodeCode ucteOtherNodeCode,UcteVoltageLevel ucteOtherVoltageLevel,Substation substation,EntsoeFileName ucteFileName){
  String xNodeName=xNodeCode.toString();
  String yNodeName=ucteFileName.getCountry() != null ? ucteFileName.getCountry() + "String_Node_Str" + xNodeName : "String_Node_Str" + xNodeName;
  VoltageLevel yVoltageLevel=substation.newVoltageLevel().setId(yNodeName + "String_Node_Str").setNominalV(xNodeCode.getVoltageLevelCode().getVoltageLevel()).setTopologyKind(TopologyKind.BUS_BREAKER).add();
  yVoltageLevel.getBusBreakerView().newBus().setId(yNodeName).add();
  UcteNode ucteXnode=ucteNetwork.getNode(xNodeCode);
  LOGGER.warn("String_Node_Str",xNodeName,yNodeName,ucteXnode.getCode());
  float p0=0;
  if (isValueValid(ucteXnode.getActiveLoad())) {
    p0+=ucteXnode.getActiveLoad();
  }
  if (isValueValid(ucteXnode.getActivePowerGeneration())) {
    p0+=ucteXnode.getActivePowerGeneration();
  }
  float q0=0;
  if (isValueValid(ucteXnode.getReactiveLoad())) {
    q0+=ucteXnode.getReactiveLoad();
  }
  if (isValueValid(ucteXnode.getReactivePowerGeneration())) {
    q0+=ucteXnode.getReactivePowerGeneration();
  }
  yVoltageLevel.newDanglingLine().setId(xNodeName + "String_Node_Str" + yNodeName).setBus(yNodeName).setConnectableBus(yNodeName).setR(0.0f).setX(LINE_MIN_Z).setG(0f).setB(0f).setP0(p0).setQ0(q0).setUcteXnodeCode(ucteXnode.getCode().toString()).add();
  String voltageLevelId1;
  String voltageLevelId2;
  String busId1;
  String busId2;
  if (ucteXnode.getCode().equals(ucteTransfo.getId().getNodeCode1())) {
    voltageLevelId1=ucteOtherVoltageLevel.getName();
    voltageLevelId2=yVoltageLevel.getName();
    busId1=ucteOtherNodeCode.toString();
    busId2=yNodeName;
  }
 else {
    voltageLevelId1=yVoltageLevel.getName();
    voltageLevelId2=ucteOtherVoltageLevel.getName();
    busId1=yNodeName;
    busId2=ucteOtherNodeCode.toString();
  }
  return substation.newTwoWindingsTransformer().setId(ucteTransfo.getId().toString()).setVoltageLevel1(voltageLevelId1).setVoltageLevel2(voltageLevelId2).setBus1(connected ? busId1 : null).setBus2(connected ? busId2 : null).setConnectableBus1(busId1).setConnectableBus2(busId2).setRatedU1(ucteTransfo.getRatedVoltage2()).setRatedU2(ucteTransfo.getRatedVoltage1()).setR(ucteTransfo.getResistance()).setX(ucteTransfo.getReactance()).setG(getConductance(ucteTransfo)).setB(getSusceptance(ucteTransfo)).add();
}