Buggy code:
public class dig { static Name name = null ; static int type = Type . A ; static int dclass = DClass . IN ; static void usage ( ) { } static void doQuery ( Message response , long ms ) throws IOException { } static void doAXFR ( Message response ) throws IOException { } public static void main ( String [ ] argv ) throws IOException { String server ; int arg ; Message query ; Message response ; Record rec ; Record opt = null ; Resolver res = null ; boolean printQuery = false ; long startTime ; long endTime ; if ( ( argv . length ) < 1 ) { dig . usage ( ) ; } try { arg = 0 ; if ( argv [ arg ] . startsWith ( "@" ) ) { server = argv [ ( arg ++ ) ] . substring ( 1 ) ; res = new SimpleResolver ( server ) ; } else res = new ExtendedResolver ( ) ; String nameString = argv [ ( arg ++ ) ] ; if ( nameString . equals ( "-x" ) ) { dig . name = ReverseMap . fromAddress ( argv [ ( arg ++ ) ] ) ; dig . type = Type . PTR ; dig . dclass = DClass . IN ; } else { dig . name = Name . fromString ( nameString , root ) ; dig . type = Type . value ( argv [ arg ] ) ; if ( ( dig . type ) < 0 ) dig . type = Type . A ; else arg ++ ; dig . dclass = DClass . value ( argv [ arg ] ) ; if ( ( dig . dclass ) < 0 ) dig . dclass = DClass . IN ; else arg ++ ; } while ( ( argv [ arg ] . startsWith ( "-" ) ) && ( ( argv [ arg ] . length ( ) ) > 1 ) ) { switch ( argv [ arg ] . charAt ( 1 ) ) { case 'p' : String portStr ; int port ; if ( ( argv [ arg ] . length ( ) ) > 2 ) portStr = argv [ arg ] . substring ( 2 ) ; else portStr = argv [ ( ++ arg ) ] ; port = Integer . parseInt ( portStr ) ; if ( ( port < 0 ) || ( port > 65536 ) ) { System . out . println ( "Invalid<seq2seq4repair_space>port" ) ; return ; } res . setPort ( port ) ; break ; case 'k' : String key ; if ( ( argv [ arg ] . length ( ) ) > 2 ) key = argv [ arg ] . substring ( 2 ) ; else key = argv [ ( ++ arg ) ] ; int index = key . indexOf ( '//' ) ; if ( index < 0 ) res . setTSIGKey ( key ) ; else res . setTSIGKey ( key . substring ( 0 , index ) , key . substring ( ( index + 1 ) ) ) ; break ; case 't' : res . setTCP ( true ) ; break ; case 'i' : res . setIgnoreTruncation ( true ) ; break ; case 'e' : String ednsStr ; int edns ; if ( ( argv [ arg ] . length ( ) ) > 2 ) ednsStr = argv [ arg ] . substring ( 2 ) ; else ednsStr = argv [ ( ++ arg ) ] ; edns = Integer . parseInt ( ednsStr ) ; if ( ( edns < 0 ) || ( edns > 1 ) ) { System . out . println ( ( ( "Unsupported<seq2seq4repair_space>" + "EDNS<seq2seq4repair_space>level:<seq2seq4repair_space>" ) + edns ) ) ; return ; } res . setEDNS ( edns ) ; break ; case 'd' : <START_BUG> opt = new OPTRecord ( ( ( short ) ( 1280 ) ) , ( ( byte ) ( 0 ) ) , ( ( byte ) ( 0 ) ) , Flags . DO ) ; <END_BUG> break ; case 'q' : printQuery = true ; break ; default : System . out . print ( "Invalid<seq2seq4repair_space>option:<seq2seq4repair_space>" ) ; System . out . println ( argv [ arg ] ) ; } arg ++ ; } } catch ( ArrayIndexOutOfBoundsException e ) { if ( ( dig . name ) == null ) dig . usage ( ) ; } rec = Record . newRecord ( dig . name , dig . type , dig . dclass ) ; query = Message . newQuery ( rec ) ; if ( opt != null ) query . addRecord ( opt , ADDITIONAL ) ; if ( printQuery ) System . out . println ( query ) ; startTime = System . currentTimeMillis ( ) ; response = res . send ( query ) ; endTime = System . currentTimeMillis ( ) ; if ( ( dig . type ) == ( Type . AXFR ) ) dig . doAXFR ( response ) ; else dig . doQuery ( response , ( endTime - startTime ) ) ; } }

Fix:
opt = new OPTRecord ( ( ( short ) ( 1280 ) ) , ( ( byte ) ( 0 ) ) , ( ( byte ) ( 0 ) ) , ExtendedFlags . DO ) ;