Program: 38855
Project: 38855
Buggy source:
public static AidToNavigationReport fromEncodedMessage(EncodedAISMessage encodedMessage){
  if (!encodedMessage.isValid())   throw new InvalidEncodedMessage(encodedMessage);
  if (!encodedMessage.getMessageType().equals(AISMessageType.AidToNavigationReport))   throw new UnsupportedMessageType(encodedMessage.getMessageType().getCode());
  Integer repeatIndicator=DecoderImpl.convertToUnsignedInteger(encodedMessage.getBits(6,8));
  MMSI sourceMmsi=MMSI.valueOf(DecoderImpl.convertToUnsignedLong(encodedMessage.getBits(8,38)));
  AidType aidType=AidType.fromInteger(DecoderImpl.convertToUnsignedInteger(encodedMessage.getBits(38,43)));
  String name=DecoderImpl.convertToString(encodedMessage.getBits(43,163));
  Boolean positionAccurate=DecoderImpl.convertToBoolean(encodedMessage.getBits(163,164));
  Float longitude=DecoderImpl.convertToFloat(encodedMessage.getBits(164,192)) / 600000f;
  Float latitude=DecoderImpl.convertToFloat(encodedMessage.getBits(192,219)) / 600000f;
  Integer toBow=DecoderImpl.convertToUnsignedInteger(encodedMessage.getBits(219,228));
  Integer toStern=DecoderImpl.convertToUnsignedInteger(encodedMessage.getBits(228,237));
  Integer toPort=DecoderImpl.convertToUnsignedInteger(encodedMessage.getBits(237,243));
  Integer toStarboard=DecoderImpl.convertToUnsignedInteger(encodedMessage.getBits(243,249));
  PositionFixingDevice positionFixingDevice=PositionFixingDevice.fromInteger(DecoderImpl.convertToUnsignedInteger(encodedMessage.getBits(249,253)));
  Integer second=DecoderImpl.convertToUnsignedInteger(encodedMessage.getBits(253,259));
  Boolean offPosition=DecoderImpl.convertToBoolean(encodedMessage.getBits(259,260));
  String regionalUse=DecoderImpl.convertToBitString(encodedMessage.getBits(260,268));
  Boolean raimFlag=DecoderImpl.convertToBoolean(encodedMessage.getBits(268,269));
  Boolean virtualAid=DecoderImpl.convertToBoolean(encodedMessage.getBits(269,270));
  Boolean assignedMode=DecoderImpl.convertToBoolean(encodedMessage.getBits(270,271));
  String nameExtension=DecoderImpl.convertToString(encodedMessage.getBits(272,361));
  return new AidToNavigationReport(repeatIndicator,sourceMmsi,aidType,name,positionAccurate,latitude,longitude,toBow,toStern,toStarboard,toPort,positionFixingDevice,second,offPosition,regionalUse,raimFlag,virtualAid,assignedMode,nameExtension);
}

Fixed version (ground truth):
public static AidToNavigationReport fromEncodedMessage(EncodedAISMessage encodedMessage){
  if (!encodedMessage.isValid())   throw new InvalidEncodedMessage(encodedMessage);
  if (!encodedMessage.getMessageType().equals(AISMessageType.AidToNavigationReport))   throw new UnsupportedMessageType(encodedMessage.getMessageType().getCode());
  Integer repeatIndicator=DecoderImpl.convertToUnsignedInteger(encodedMessage.getBits(6,8));
  MMSI sourceMmsi=MMSI.valueOf(DecoderImpl.convertToUnsignedLong(encodedMessage.getBits(8,38)));
  AidType aidType=AidType.fromInteger(DecoderImpl.convertToUnsignedInteger(encodedMessage.getBits(38,43)));
  String name=DecoderImpl.convertToString(encodedMessage.getBits(43,163));
  Boolean positionAccurate=DecoderImpl.convertToBoolean(encodedMessage.getBits(163,164));
  Float longitude=DecoderImpl.convertToFloat(encodedMessage.getBits(164,192)) / 600000f;
  Float latitude=DecoderImpl.convertToFloat(encodedMessage.getBits(192,219)) / 600000f;
  Integer toBow=DecoderImpl.convertToUnsignedInteger(encodedMessage.getBits(219,228));
  Integer toStern=DecoderImpl.convertToUnsignedInteger(encodedMessage.getBits(228,237));
  Integer toPort=DecoderImpl.convertToUnsignedInteger(encodedMessage.getBits(237,243));
  Integer toStarboard=DecoderImpl.convertToUnsignedInteger(encodedMessage.getBits(243,249));
  PositionFixingDevice positionFixingDevice=PositionFixingDevice.fromInteger(DecoderImpl.convertToUnsignedInteger(encodedMessage.getBits(249,253)));
  Integer second=DecoderImpl.convertToUnsignedInteger(encodedMessage.getBits(253,259));
  Boolean offPosition=DecoderImpl.convertToBoolean(encodedMessage.getBits(259,260));
  String regionalUse=DecoderImpl.convertToBitString(encodedMessage.getBits(260,268));
  Boolean raimFlag=DecoderImpl.convertToBoolean(encodedMessage.getBits(268,269));
  Boolean virtualAid=DecoderImpl.convertToBoolean(encodedMessage.getBits(269,270));
  Boolean assignedMode=DecoderImpl.convertToBoolean(encodedMessage.getBits(270,271));
  int spare1=DecoderImpl.convertToUnsignedInteger(encodedMessage.getBits(271,272));
  String nameExtension=null;
  int spare2=0;
  if (encodedMessage.getNumberOfBits() > 272) {
    int extraBits=encodedMessage.getNumberOfBits() - 272;
    int extraChars=extraBits / 6;
    int extraBitsOfChars=extraChars * 6;
    nameExtension=DecoderImpl.convertToString(encodedMessage.getBits(272,272 + extraBitsOfChars));
    spare2=(extraBits == extraBitsOfChars) ? 0 : DecoderImpl.convertToUnsignedInteger(encodedMessage.getBits(272 + extraBitsOfChars,encodedMessage.getNumberOfBits()));
  }
  return new AidToNavigationReport(repeatIndicator,sourceMmsi,aidType,name,positionAccurate,latitude,longitude,toBow,toStern,toStarboard,toPort,positionFixingDevice,second,offPosition,regionalUse,raimFlag,virtualAid,assignedMode,spare1,nameExtension,spare2);
}