Buggy code:
public class MaxCubeBinding extends AbstractActiveBinding < MaxCubeBindingProvider > implements ManagedService { private static final Logger logger = LoggerFactory . getLogger ( MaxCubeBinding . class ) ; private static String ip ; private static int port = 62910 ; private static long refreshInterval = 10000 ; private static boolean exclusive = false ; private static int maxRequestsPerConnection = 1000 ; private int requestCount = 0 ; private static final DecimalType DEFAULT_OFF_TEMPERATURE = new DecimalType ( 4.5 ) ; private static final DecimalType DEFAULT_ON_TEMPERATURE = new DecimalType ( 30.5 ) ; private ArrayList < Configuration > configurations = new ArrayList < Configuration > ( ) ; private ArrayList < Device > devices = new ArrayList < Device > ( ) ; private Socket socket = null ; private BufferedReader reader = null ; private OutputStreamWriter writer = null ; @ Override protected String getName ( ) { } @ Override protected long getRefreshInterval ( ) { } @ Override public void activate ( ) { } @ Override public void deactivate ( ) { } @ Override public void execute ( ) { } @ Override public void internalReceiveCommand ( String itemName , Command command ) { MaxCubeBinding . logger . debug ( "Received<seq2seq4repair_space>command<seq2seq4repair_space>from<seq2seq4repair_space>{}" , itemName ) ; String serialNumber = null ; for ( MaxCubeBindingProvider provider : providers ) { serialNumber = provider . getSerialNumber ( itemName ) ; if ( serialNumber . equals ( null ) ) { continue ; } Device device = findDevice ( serialNumber , devices ) ; if ( device == null ) { MaxCubeBinding . logger . debug ( "Cannot<seq2seq4repair_space>send<seq2seq4repair_space>command<seq2seq4repair_space>to<seq2seq4repair_space>device<seq2seq4repair_space>with<seq2seq4repair_space>serial<seq2seq4repair_space>number<seq2seq4repair_space>{},<seq2seq4repair_space>device<seq2seq4repair_space>not<seq2seq4repair_space>listed." , serialNumber ) ; continue ; } String rfAddress = device . getRFAddress ( ) ; String commandString = null ; if ( ( command instanceof DecimalType ) || ( command instanceof OnOffType ) ) { DecimalType decimalType = MaxCubeBinding . DEFAULT_OFF_TEMPERATURE ; if ( command instanceof DecimalType ) { decimalType = ( ( DecimalType ) ( command ) ) ; } else if ( command instanceof OnOffType ) { decimalType = ( ON . equals ( command ) ) ? MaxCubeBinding . DEFAULT_ON_TEMPERATURE : MaxCubeBinding . DEFAULT_OFF_TEMPERATURE ; } <START_BUG> S_Command cmd = new S_Command ( rfAddress , device . getRoomId ( ) , decimalType . doubleValue ( ) ) ; <END_BUG> commandString = cmd . getCommandString ( ) ; } else if ( command instanceof StringType ) { String commandContent = command . toString ( ) . trim ( ) . toUpperCase ( ) ; ThermostatModeType commandThermoType = null ; if ( commandContent . contentEquals ( AUTOMATIC . toString ( ) ) ) { commandThermoType = ThermostatModeType . AUTOMATIC ; } else if ( commandContent . contentEquals ( BOOST . toString ( ) ) ) { commandThermoType = ThermostatModeType . BOOST ; } else { MaxCubeBinding . logger . debug ( "Only<seq2seq4repair_space>updates<seq2seq4repair_space>to<seq2seq4repair_space>AUTOMATIC<seq2seq4repair_space>&<seq2seq4repair_space>BOOST<seq2seq4repair_space>supported,<seq2seq4repair_space>received<seq2seq4repair_space>value<seq2seq4repair_space>;'{}'" , commandContent ) ; continue ; } S_Command cmd = new S_Command ( rfAddress , device . getRoomId ( ) , commandThermoType ) ; commandString = cmd . getCommandString ( ) ; } if ( commandString != null ) { try { if ( ( socket ) == null ) { this . socketConnect ( ) ; } writer . write ( commandString ) ; MaxCubeBinding . logger . debug ( commandString ) ; writer . flush ( ) ; if ( ! ( MaxCubeBinding . exclusive ) ) { socket . close ( ) ; socket = null ; } } catch ( UnknownHostException e ) { MaxCubeBinding . logger . warn ( "Cannot<seq2seq4repair_space>establish<seq2seq4repair_space>connection<seq2seq4repair_space>with<seq2seq4repair_space>MAX!cube<seq2seq4repair_space>lan<seq2seq4repair_space>gateway<seq2seq4repair_space>while<seq2seq4repair_space>sending<seq2seq4repair_space>command<seq2seq4repair_space>to<seq2seq4repair_space>'{}'" , MaxCubeBinding . ip ) ; MaxCubeBinding . logger . debug ( Utils . getStackTrace ( e ) ) ; } catch ( IOException e ) { MaxCubeBinding . logger . warn ( "Cannot<seq2seq4repair_space>write<seq2seq4repair_space>data<seq2seq4repair_space>from<seq2seq4repair_space>MAX!Cube<seq2seq4repair_space>lan<seq2seq4repair_space>gateway<seq2seq4repair_space>while<seq2seq4repair_space>connecting<seq2seq4repair_space>to<seq2seq4repair_space>'{}'" , MaxCubeBinding . ip ) ; MaxCubeBinding . logger . debug ( Utils . getStackTrace ( e ) ) ; } MaxCubeBinding . logger . debug ( "Command<seq2seq4repair_space>Sent<seq2seq4repair_space>to<seq2seq4repair_space>{}" , MaxCubeBinding . ip ) ; } else { MaxCubeBinding . logger . debug ( "Null<seq2seq4repair_space>Command<seq2seq4repair_space>not<seq2seq4repair_space>sent<seq2seq4repair_space>to<seq2seq4repair_space>{}" , MaxCubeBinding . ip ) ; } } } private boolean socketConnect ( ) throws IOException , UnknownHostException { } private Device findDevice ( String serialNumber , ArrayList < Device > devices ) { } private Message processRawMessage ( String raw ) { } @ SuppressWarnings ( "rawtypes" ) public void updated ( Dictionary config ) throws ConfigurationException { } private String discoveryGatewayIp ( ) throws ConfigurationException { } }

Fix:
S_Command cmd = new S_Command ( rfAddress , device . getRoomId ( ) , ( ( org . openhab . binding . maxcube . internal . message . HeatingThermostat ) ( device ) ) . getMode ( ) , decimalType . doubleValue ( ) ) ;