Buggy code:
Options options = ThriftServer . getOptions ( ) ; Configuration conf = HBaseConfiguration . create ( ) ; CommandLine cmd = ThriftServer . parseArguments ( conf , options , args ) ; List < ? > argList = cmd . getArgList ( ) ; if ( ( ( cmd . hasOption ( "help" ) ) || ( ! ( argList . contains ( "start" ) ) ) ) || ( argList . contains ( "stop" ) ) ) { ThriftServer . printUsage ( ) ; System . exit ( 1 ) ; } int listenPort = 0 ; try { if ( cmd . hasOption ( "port" ) ) { listenPort = Integer . parseInt ( cmd . getOptionValue ( "port" ) ) ; } else { listenPort = conf . getInt ( "hbase.regionserver.thrift.port" , ThriftServer . DEFAULT_LISTEN_PORT ) ; } } catch ( NumberFormatException e ) { throw new RuntimeException ( "Could<seq2seq4repair_space>not<seq2seq4repair_space>parse<seq2seq4repair_space>the<seq2seq4repair_space>value<seq2seq4repair_space>provided<seq2seq4repair_space>for<seq2seq4repair_space>the<seq2seq4repair_space>port<seq2seq4repair_space>option" , e ) ; } String host = null ; String name = null ; UserProvider userProvider = UserProvider . instantiate ( conf ) ; boolean securityEnabled = ( userProvider . isHadoopSecurityEnabled ( ) ) && ( userProvider . isHBaseSecurityEnabled ( ) ) ; if ( securityEnabled ) { host = Strings . domainNamePointerToHostName ( DNS . getDefaultHost ( conf . get ( "hbase.thrift.dns.interface" , "default" ) , conf . get ( "hbase.thrift.dns.nameserver" , "default" ) ) ) ; userProvider . login ( "hbase.thrift.keytab.file" , "hbase.thrift.kerberos.principal" , host ) ; } UserGroupInformation realUser = userProvider . getCurrent ( ) . getUGI ( ) ; String qop = conf . get ( ThriftServer . THRIFT_QOP_KEY ) ; if ( qop != null ) { if ( ( ( ! ( qop . equals ( "auth" ) ) ) && ( ! ( qop . equals ( "auth-int" ) ) ) ) && ( ! ( qop . equals ( "auth-conf" ) ) ) ) { throw new IOException ( ( ( ( ( "Invalid<seq2seq4repair_space>" + ( ThriftServer . THRIFT_QOP_KEY ) ) + ":<seq2seq4repair_space>" ) + qop ) + ",<seq2seq4repair_space>it<seq2seq4repair_space>must<seq2seq4repair_space>be<seq2seq4repair_space>'auth',<seq2seq4repair_space>'auth-int',<seq2seq4repair_space>or<seq2seq4repair_space>'auth-conf'" ) ) ; } if ( ! securityEnabled ) { throw new IOException ( ( "Thrift<seq2seq4repair_space>server<seq2seq4repair_space>must" + "<seq2seq4repair_space>run<seq2seq4repair_space>in<seq2seq4repair_space>secure<seq2seq4repair_space>mode<seq2seq4repair_space>to<seq2seq4repair_space>support<seq2seq4repair_space>authentication" ) ) ; } name = SecurityUtil . getUserFromPrincipal ( conf . get ( "hbase.thrift.kerberos.principal" ) ) ; } boolean nonblocking = cmd . hasOption ( "nonblocking" ) ; boolean hsha = cmd . hasOption ( "hsha" ) ; ThriftMetrics metrics = new ThriftMetrics ( conf , ThriftServerType . TWO ) ; String implType = "threadpool" ; if ( nonblocking ) { implType = "nonblocking" ; } else if ( hsha ) { implType = "hsha" ; } conf . set ( "hbase.regionserver.thrift.server.type" , implType ) ; conf . setInt ( "hbase.regionserver.thrift.port" , listenPort ) ; ThriftServer . registerFilters ( conf ) ; boolean compact = ( cmd . hasOption ( "compact" ) ) || ( conf . getBoolean ( "hbase.regionserver.thrift.compact" , false ) ) ; TProtocolFactory protocolFactory = ThriftServer . getTProtocolFactory ( compact ) ; final ThriftHBaseServiceHandler hbaseHandler = new ThriftHBaseServiceHandler ( conf , userProvider ) ; THBaseService . Iface handler = ThriftHBaseServiceHandler . newInstance ( hbaseHandler , metrics ) ; final THBaseService . Processor p = new THBaseService . Processor ( handler ) ; conf . setBoolean ( "hbase.regionserver.thrift.compact" , compact ) ; TProcessor processor = p ; boolean framed = ( ( ( cmd . hasOption ( "framed" ) ) || ( conf . getBoolean ( "hbase.regionserver.thrift.framed" , false ) ) ) || nonblocking ) || hsha ; TTransportFactory transportFactory = ThriftServer . getTTransportFactory ( qop , name , host , framed , ( ( ( conf . getInt ( "hbase.regionserver.thrift.framed.max_frame_size_in_mb" , 2 ) ) * 1024 ) * 1024 ) ) ; InetSocketAddress inetSocketAddress = ThriftServer . bindToPort ( cmd . getOptionValue ( "bind" ) , listenPort ) ; conf . setBoolean ( "hbase.regionserver.thrift.framed" , framed ) ; if ( qop != null ) { processor = new TProcessor ( ) { @ Override public boolean process ( TProtocol inProt , TProtocol outProt ) throws TException { TSaslServerTransport saslServerTransport = ( ( TSaslServerTransport ) ( inProt . getTransport ( ) ) ) ; SaslServer saslServer = saslServerTransport . getSaslServer ( ) ; String principal = saslServer . getAuthorizationID ( ) ; hbaseHandler . setEffectiveUser ( principal ) ; return p . process ( inProt , outProt ) ; } } ; } try { if ( cmd . hasOption ( "infoport" ) ) { String val = cmd . getOptionValue ( "infoport" ) ; <START_BUG> conf . setInt ( "hbase.thrift.info.port" , Integer . valueOf ( val ) ) ; <END_BUG> ThriftServer . log . debug ( ( "Web<seq2seq4repair_space>UI<seq2seq4repair_space>port<seq2seq4repair_space>set<seq2seq4repair_space>to<seq2seq4repair_space>" + val ) ) ; } } catch ( NumberFormatException e ) { ThriftServer . log . error ( "Could<seq2seq4repair_space>not<seq2seq4repair_space>parse<seq2seq4repair_space>the<seq2seq4repair_space>value<seq2seq4repair_space>provided<seq2seq4repair_space>for<seq2seq4repair_space>the<seq2seq4repair_space>infoport<seq2seq4repair_space>option" , e ) ; ThriftServer . printUsage ( ) ; System . exit ( 1 ) ; } int port = conf . getInt ( "hbase.thrift.info.port" , 9095 ) ; if ( port >= 0 ) { conf . setLong ( "startcode" , System . currentTimeMillis ( ) ) ; String a = conf . get ( "hbase.thrift.info.bindAddress" , "0.0.0.0" ) ; InfoServer infoServer = new InfoServer ( "thrift" , a , port , false , conf ) ; infoServer . setAttribute ( "hbase.conf" , conf ) ; infoServer . start ( ) ; } if ( nonblocking ) { server = ThriftServer . getTNonBlockingServer ( protocolFactory , processor , transportFactory , inetSocketAddress ) ; } else if ( hsha ) { server = ThriftServer . getTHsHaServer ( protocolFactory , processor , transportFactory , inetSocketAddress , metrics ) ; } else { server = ThriftServer . getTThreadPoolServer ( protocolFactory , processor , transportFactory , inetSocketAddress ) ; } final TServer tserver = server ; realUser . doAs ( new PrivilegedAction < Object > ( ) { @ Override public Object run ( ) { tserver . serve ( ) ; return null ; } } ) ; } }

Fix:
conf . setInt ( "hbase.thrift.info.port" , Integer . parseInt ( val ) ) ;