Buggy code:
public OLECMDID_PAGESETUP = 8 ; public static final int OLECMDID_SPELL = 9 ; public static final int OLECMDID_PROPERTIES = 10 ; public static final int OLECMDID_CUT = 11 ; public static final int OLECMDID_COPY = 12 ; public static final int OLECMDID_PASTE = 13 ; public static final int OLECMDID_PASTESPECIAL = 14 ; public static final int OLECMDID_UNDO = 15 ; public static final int OLECMDID_REDO = 16 ; public static final int OLECMDID_SELECTALL = 17 ; public static final int OLECMDID_CLEARSELECTION = 18 ; public static final int OLECMDID_ZOOM = 19 ; public static final int OLECMDID_GETZOOMRANGE = 20 ; public static final int OLECMDID_UPDATECOMMANDS = 21 ; public static final int OLECMDID_REFRESH = 22 ; public static final int OLECMDID_STOP = 23 ; public static final int OLECMDID_HIDETOOLBARS = 24 ; public static final int OLECMDID_SETPROGRESSMAX = 25 ; public static final int OLECMDID_SETPROGRESSPOS = 26 ; public static final int OLECMDID_SETPROGRESSTEXT = 27 ; public static final int OLECMDID_SETTITLE = 28 ; public static final int OLECMDID_SETDOWNLOADSTATE = 29 ; public static final int OLECMDID_STOPDOWNLOAD = 30 ; public static int VARFLAG_FREADONLY = 1 ; public static int VARFLAG_FSOURCE = 2 ; public static int VARFLAG_FBINDABLE = 4 ; public static int VARFLAG_FREQUESTEDIT = 8 ; public static int VARFLAG_FDISPLAYBIND = 16 ; public static int VARFLAG_FDEFAULTBIND = 32 ; public static int VARFLAG_FHIDDEN = 64 ; public static int VARFLAG_FRESTRICTED = 128 ; public static int VARFLAG_FDEFAULTCOLLELEM = 256 ; public static int VARFLAG_FUIDEFAULT = 512 ; public static int VARFLAG_FNONBROWSABLE = 1024 ; public static int VARFLAG_FREPLACEABLE = 2048 ; public static int VARFLAG_FIMMEDIATEBIND = 4096 ; public static int VAR_PERINSTANCE = 0 ; public static int VAR_STATIC = 1 ; public static int VAR_CONST = 2 ; public static int VAR_DISPATCH = 3 ; public static short IDLFLAG_NONE = 0 ; public static short IDLFLAG_FIN = 1 ; public static short IDLFLAG_FOUT = 2 ; public static short IDLFLAG_FLCID = 4 ; public static short IDLFLAG_FRETVAL = 8 ; public static final short VT_BOOL = 11 ; public static final short VT_BSTR = 8 ; public static final short VT_BYREF = 16384 ; public static final short VT_CY = 6 ; public static final short VT_DATE = 7 ; public static final short VT_DISPATCH = 9 ; public static final short VT_EMPTY = 0 ; public static final short VT_ERROR = 10 ; public static final short VT_I2 = 2 ; public static final short VT_I4 = 3 ; public static final short VT_NULL = 1 ; public static final short VT_R4 = 4 ; public static final short VT_R8 = 5 ; public static final short VT_UI1 = 17 ; public static final short VT_UI4 = 19 ; public static final short VT_UNKNOWN = 13 ; public static final short VT_VARIANT = 12 ; public static final short VT_PTR = 26 ; public static final short VT_USERDEFINED = 29 ; public static final short VT_HRESULT = 25 ; public static final short VT_DECIMAL = 14 ; public static final short VT_I1 = 16 ; public static final short VT_UI2 = 18 ; public static final short VT_I8 = 20 ; public static final short VT_UI8 = 21 ; public static final short VT_INT = 22 ; public static final short VT_UINT = 23 ; public static final short VT_VOID = 24 ; public static final short VT_SAFEARRAY = 27 ; public static final short VT_CARRAY = 28 ; public static final short VT_LPSTR = 30 ; public static final short VT_LPWSTR = 31 ; public static final short VT_RECORD = 36 ; public static final short VT_FILETIME = 64 ; public static final short VT_BLOB = 65 ; public static final short VT_STREAM = 66 ; public static final short VT_STORAGE = 67 ; public static final short VT_STREAMED_OBJECT = 68 ; public static final short VT_STORED_OBJECT = 69 ; public static final short VT_BLOB_OBJECT = 70 ; public static final short VT_CF = 71 ; public static final short VT_CLSID = 72 ; public static final short VT_VERSIONED_STREAM = 73 ; public static final short VT_BSTR_BLOB = 4095 ; public static final short VT_VECTOR = 4096 ; public static final short VT_ARRAY = 8192 ; public static final int INVOKE_FUNC = 1 ; public static final int INVOKE_PROPERTYGET = 2 ; public static final int INVOKE_PROPERTYPUT = 4 ; public static final int INVOKE_PROPERTYPUTREF = 8 ; public static final int FUNC_VIRTUAL = 0 ; public static final int FUNC_PUREVIRTUAL = 1 ; public static final int FUNC_NONVIRTUAL = 2 ; public static final int FUNC_STATIC = 3 ; public static final int FUNC_DISPATCH = 4 ; public static final short FUNCFLAG_FRESTRICTED = 1 ; public static final short FUNCFLAG_FSOURCE = 2 ; public static final short FUNCFLAG_FBINDABLE = 4 ; public static final short FUNCFLAG_FREQUESTEDIT = 8 ; public static final short FUNCFLAG_FDISPLAYBIND = 16 ; public static final short FUNCFLAG_FDEFAULTBIND = 32 ; public static final short FUNCFLAG_FHIDDEN = 64 ; public static final short FUNCFLAG_FUSESGETLASTERROR = 128 ; public static final short FUNCFLAG_FDEFAULTCOLLELEM = 256 ; public static final short FUNCFLAG_FUIDEFAULT = 512 ; public static final short FUNCFLAG_FNONBROWSABLE = 1024 ; public static final short FUNCFLAG_FREPLACEABLE = 2048 ; public static final short FUNCFLAG_FIMMEDIATEBIND = 4096 ; public static final int CC_FASTCALL = 0 ; public static final int CC_CDECL = 1 ; public static final int CC_MSCPASCAL = 2 ; public static final int CC_PASCAL = 2 ; public static final int CC_MACPASCAL = 3 ; public static final int CC_STDCALL = 4 ; public static final int CC_FPFASTCALL = 5 ; public static final int CC_SYSCALL = 6 ; public static final int CC_MPWCDECL = 7 ; public static final int CC_MPWPASCAL = 8 ; public static final int CC_MAX = 9 ; static final String ERROR_NOT_IMPLEMENTED_MSG = "Required<seq2seq4repair_space>functionality<seq2seq4repair_space>not<seq2seq4repair_space>currently<seq2seq4repair_space>supported." ; static final String ERROR_CANNOT_CREATE_FILE_MSG = "Failed<seq2seq4repair_space>to<seq2seq4repair_space>create<seq2seq4repair_space>file." ; static final String ERROR_CANNOT_CREATE_OBJECT_MSG = "Failed<seq2seq4repair_space>to<seq2seq4repair_space>create<seq2seq4repair_space>Ole<seq2seq4repair_space>Client." ; static final String ERROR_CANNOT_OPEN_FILE_MSG = "File<seq2seq4repair_space>does<seq2seq4repair_space>not<seq2seq4repair_space>exist,<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>accessible<seq2seq4repair_space>to<seq2seq4repair_space>user<seq2seq4repair_space>or<seq2seq4repair_space>does<seq2seq4repair_space>not<seq2seq4repair_space>have<seq2seq4repair_space>the<seq2seq4repair_space>correct<seq2seq4repair_space>format." ; static final String ERROR_INTERFACE_NOT_FOUND_MSG = "Failed<seq2seq4repair_space>to<seq2seq4repair_space>find<seq2seq4repair_space>requested<seq2seq4repair_space>interface<seq2seq4repair_space>on<seq2seq4repair_space>OLE<seq2seq4repair_space>Object." ; static final String ERROR_INVALID_CLASSID_MSG = "Class<seq2seq4repair_space>ID<seq2seq4repair_space>not<seq2seq4repair_space>found<seq2seq4repair_space>in<seq2seq4repair_space>registry" ; static final String ERROR_CANNOT_ACCESS_CLASSFACTORY_MSG = "Failed<seq2seq4repair_space>to<seq2seq4repair_space>get<seq2seq4repair_space>the<seq2seq4repair_space>class<seq2seq4repair_space>factory<seq2seq4repair_space>for<seq2seq4repair_space>the<seq2seq4repair_space>specified<seq2seq4repair_space>classID" ; static final String ERROR_CANNOT_CREATE_LICENSED_OBJECT_MSG = "Failed<seq2seq4repair_space>to<seq2seq4repair_space>create<seq2seq4repair_space>Licensed<seq2seq4repair_space>instance" ; static final String ERROR_OUT_OF_MEMORY_MSG = "Out<seq2seq4repair_space>of<seq2seq4repair_space>Memory" ; static final String ERROR_CANNOT_CHANGE_VARIANT_TYPE_MSG = "Failed<seq2seq4repair_space>to<seq2seq4repair_space>change<seq2seq4repair_space>Variant<seq2seq4repair_space>type" ; static final String ERROR_INVALID_INTERFACE_ADDRESS_MSG = "Invalid<seq2seq4repair_space>address<seq2seq4repair_space>received<seq2seq4repair_space>for<seq2seq4repair_space>Ole<seq2seq4repair_space>Interface." ; static final String ERROR_APPLICATION_NOT_FOUND_MSG = "Unable<seq2seq4repair_space>to<seq2seq4repair_space>find<seq2seq4repair_space>Application." ; static final String ERROR_ACTION_NOT_PERFORMED_MSG = "Action<seq2seq4repair_space>can<seq2seq4repair_space>not<seq2seq4repair_space>be<seq2seq4repair_space>performed." ; public static void error ( int code ) { } public static void error ( int code , int hresult ) { } public static String findProgramID ( String extension ) { } static String getKeyValue ( TCHAR key ) { int [ ] phkResult = new int [ 1 ] ; if ( ( OS . RegOpenKeyEx ( HKEY_CLASSES_ROOT , key , 0 , KEY_READ , phkResult ) ) != 0 ) { return null ; } String result = null ; int [ ] lpcbData = new int [ 1 ] ; <START_BUG> if ( ( OS . RegQueryValueEx ( phkResult [ 0 ] , ( ( TCHAR ) ( null ) ) , 0 , null , null , lpcbData ) ) == 0 ) { <END_BUG>

Fix:
if ( ( OS . RegQueryValueEx ( phkResult [ 0 ] , ( ( TCHAR ) ( null ) ) , 0 , null , ( ( TCHAR ) ( null ) ) , lpcbData ) ) == 0 ) {