Buggy code:
public abstract class Record implements Cloneable , Comparable { protected Name name ; protected int type ; protected int dclass ; protected long ttl ; private boolean empty ; private static final Record [ ] knownRecords = new Record [ 256 ] ; private static final Record unknownRecord = new UNKRecord ( ) ; private static final Class [ ] emptyClassArray = new Class [ 0 ] ; private static final Object [ ] emptyObjectArray = new Object [ 0 ] ; private static final DecimalFormat byteFormat = new DecimalFormat ( ) ; protected Record ( ) { } Record ( Name name , int type , int dclass , long ttl ) { } abstract Record getObject ( ) { } private static final Record getTypedObject ( int type ) { } private static final Record getEmptyRecord ( Name name , int type , int dclass , long ttl ) { } abstract void rrFromWire ( DNSInput in ) throws IOException { } private static Record newRecord ( Name name , int type , int dclass , long ttl , int length , DNSInput in ) throws IOException { } public static Record newRecord ( Name name , int type , int dclass , long ttl , int length , byte [ ] data ) { } public static Record newRecord ( Name name , int type , int dclass , long ttl , byte [ ] data ) { } public static Record newRecord ( Name name , int type , int dclass , long ttl ) { } public static Record newRecord ( Name name , int type , int dclass ) { } static Record fromWire ( DNSInput in , int section , boolean isUpdate ) throws IOException { } static Record fromWire ( DNSInput in , int section ) throws IOException { } public static Record fromWire ( byte [ ] b , int section ) throws IOException { } void toWire ( DNSOutput out , int section , Compression c ) { } public byte [ ] toWire ( int section ) { } private void toWireCanonical ( DNSOutput out , boolean noTTL ) { } private byte [ ] toWireCanonical ( boolean noTTL ) { } public byte [ ] toWireCanonical ( ) { } public byte [ ] rdataToWireCanonical ( ) { } abstract String rrToString ( ) { } public String rdataToString ( ) { } public String toString ( ) { } abstract void rdataFromString ( Tokenizer st , Name origin ) throws IOException { } protected static byte [ ] byteArrayFromString ( String s ) throws TextParseException { } protected static String byteArrayToString ( byte [ ] array , boolean quote ) { StringBuffer sb = new StringBuffer ( ) ; if ( quote ) sb . append ( '"' ) ; for ( int i = 0 ; i < ( array . length ) ; i ++ ) { <START_BUG> short b = ( ( short ) ( ( array [ i ] ) & 255 ) ) ; <END_BUG> if ( ( b < 32 ) || ( b >= 127 ) ) { sb . append ( '\\' ) ; sb . append ( Record . byteFormat . format ( b ) ) ; } else if ( ( ( b == '"' ) || ( b == ';' ) ) || ( b == '\\' ) ) { sb . append ( '\\' ) ; sb . append ( ( ( char ) ( b ) ) ) ; } else sb . append ( ( ( char ) ( b ) ) ) ; } if ( quote ) sb . append ( '"' ) ; return sb . toString ( ) ; } protected static String unknownToString ( byte [ ] data ) { } public static Record fromString ( Name name , int type , int dclass , long ttl , Tokenizer st , Name origin ) throws IOException { } public static Record fromString ( Name name , int type , int dclass , long ttl , String s , Name origin ) throws IOException { } public Name getName ( ) { } public int getType ( ) { } public int getRRsetType ( ) { } public int getDClass ( ) { } public long getTTL ( ) { } abstract void rrToWire ( DNSOutput out , Compression c , boolean canonical ) { } public boolean equals ( Object arg ) { } public int hashCode ( ) { } private Record cloneRecord ( ) { } public Record withName ( Name name ) { } Record withDClass ( int dclass , long ttl ) { } void setTTL ( long ttl ) { } public int compareTo ( Object o ) { } public Name getAdditionalName ( ) { } static int checkU8 ( String field , int val ) { } static int checkU16 ( String field , int val ) { } static long checkU32 ( String field , long val ) { } static Name checkName ( String field , Name name ) { } }

Fix:
int b = ( array [ i ] ) & 255 ;