Buggy code:
public class HostMapper { public static final Long BYTES_IN_MEGABYTE = 1024L * 1024L ; private static final int DEFAULT_VDSM_PORT = 54321 ; private static final String MD5_FILE_SIGNATURE = "md5" ; private static final String HOST_OS_DELEIMITER = "<seq2seq4repair_space>-<seq2seq4repair_space>" ; @ Mapping ( from = Host . class , to = VdsStatic . class ) public static VdsStatic map ( Host model , VdsStatic template ) { } @ Mapping ( from = SSH . class , to = VdsStatic . class ) public static VdsStatic map ( SSH model , VdsStatic template ) { } @ Mapping ( from = PowerManagement . class , to = VdsStatic . class ) public static VdsStatic map ( PowerManagement model , VdsStatic template ) { } @ Mapping ( from = Options . class , to = String . class ) public static String map ( Options model , String template ) { } @ Mapping ( from = Option . class , to = String . class ) public static String map ( Option model , String template ) { } @ Mapping ( from = VDS . class , to = Host . class ) public static Host map ( VDS entity , Host template ) { Host model = ( template != null ) ? template : new Host ( ) ; model . setId ( entity . getId ( ) . toString ( ) ) ; model . setName ( entity . getName ( ) ) ; model . setComment ( entity . getComment ( ) ) ; if ( ( entity . getVdsGroupId ( ) ) != null ) { Cluster cluster = new Cluster ( ) ; cluster . setId ( entity . getVdsGroupId ( ) . toString ( ) ) ; model . setCluster ( cluster ) ; } model . setAddress ( entity . getHostName ( ) ) ; if ( ( entity . getPort ( ) ) > 0 ) { model . setPort ( entity . getPort ( ) ) ; } HostProtocol protocol = HostMapper . map ( entity . getProtocol ( ) , null ) ; model . setProtocol ( ( protocol != null ? protocol . value ( ) : null ) ) ; HostStatus status = HostMapper . map ( entity . getStatus ( ) , null ) ; model . setStatus ( StatusUtils . create ( status ) ) ; if ( ( entity . getExternalStatus ( ) ) != null ) { EntityExternalStatus entityExternalStatus = ExternalStatusMapper . map ( entity . getExternalStatus ( ) , null ) ; Status hostStatus = new Status ( ) ; hostStatus . setState ( entityExternalStatus . value ( ) ) ; model . setExternalStatus ( hostStatus ) ; } if ( status == ( HostStatus . NON_OPERATIONAL ) ) { model . getStatus ( ) . setDetail ( entity . getNonOperationalReason ( ) . name ( ) . toLowerCase ( ) ) ; } else if ( ( status == ( HostStatus . MAINTENANCE ) ) || ( status == ( HostStatus . PREPARING_FOR_MAINTENANCE ) ) ) { model . getStatus ( ) . setDetail ( entity . getMaintenanceReason ( ) ) ; } StorageManager sm = new StorageManager ( ) ; sm . setPriority ( entity . getVdsSpmPriority ( ) ) ; sm . setValue ( ( ( entity . getSpmStatus ( ) ) == ( VdsSpmStatus . SPM ) ) ) ; model . setStorageManager ( sm ) ; SPM spm = new SPM ( ) ; spm . setPriority ( entity . getVdsSpmPriority ( ) ) ; <START_BUG> if ( ( spm . getStatus ( ) ) != null ) { <END_BUG> spm . setStatus ( StatusUtils . create ( HostMapper . map ( entity . getSpmStatus ( ) , null ) ) ) ; } model . setSpm ( spm ) ; if ( ( ( ( ( ( entity . getVersion ( ) ) != null ) && ( ( entity . getVersion ( ) . getMajor ( ) ) != ( - 1 ) ) ) && ( ( entity . getVersion ( ) . getMinor ( ) ) != ( - 1 ) ) ) && ( ( entity . getVersion ( ) . getRevision ( ) ) != ( - 1 ) ) ) && ( ( entity . getVersion ( ) . getBuild ( ) ) != ( - 1 ) ) ) { Version version = new Version ( ) ; version . setMajor ( entity . getVersion ( ) . getMajor ( ) ) ; version . setMinor ( entity . getVersion ( ) . getMinor ( ) ) ; version . setRevision ( entity . getVersion ( ) . getRevision ( ) ) ; version . setBuild ( entity . getVersion ( ) . getBuild ( ) ) ; version . setFullVersion ( entity . getVersion ( ) . getRpmName ( ) ) ; model . setVersion ( version ) ; } model . setOs ( HostMapper . getHostOs ( entity . getHostOs ( ) ) ) ; model . setKsm ( new KSM ( ) ) ; model . getKsm ( ) . setEnabled ( Boolean . TRUE . equals ( entity . getKsmState ( ) ) ) ; model . setTransparentHugepages ( new TransparentHugePages ( ) ) ; model . getTransparentHugepages ( ) . setEnabled ( ( ! ( ( ( entity . getTransparentHugePagesState ( ) ) == null ) || ( ( entity . getTransparentHugePagesState ( ) ) == ( VdsTransparentHugePagesState . Never ) ) ) ) ) ; if ( ( entity . getIScsiInitiatorName ( ) ) != null ) { model . setIscsi ( new IscsiDetails ( ) ) ; model . getIscsi ( ) . setInitiator ( entity . getIScsiInitiatorName ( ) ) ; } PowerManagement pm = HostMapper . map ( entity , ( ( PowerManagement ) ( null ) ) ) ;

Fix:
if ( ( entity . getSpmStatus ( ) ) != null ) {