Buggy code:
class External { public static final String EXTERNAL_IID_STR = "ded01d20-ba6f-11dd-ad8b-0800200c9a66" ; public static final nsID EXTERNAL_IID = new nsID ( External . EXTERNAL_IID_STR ) ; XPCOMObject supports ; XPCOMObject external ; XPCOMObject classInfo ; XPCOMObject securityCheckedComponent ; int refCount = 0 ; External ( ) { } int AddRef ( ) { } void createCOMInterfaces ( ) { } void disposeCOMInterfaces ( ) { } int getAddress ( ) { } int QueryInterface ( int riid , int ppvObject ) { } int Release ( ) { } int getClassDescription ( int _retValue ) { } int getClassID ( int _retValue ) { } int getClassIDNoAlloc ( int _retValue ) { } int getContractID ( int _retValue ) { } int getFlags ( int flags ) { } int getHelperForLanguage ( int language , int _retValue ) { } int getImplementationLanguage ( int _retValue ) { } int getInterfaces ( int count , int array ) { } int canCreateWrapper ( int iid , int _retVal ) { } int canCallMethod ( int iid , int methodName , int _retVal ) { } int canGetProperty ( int iid , int propertyName , int _retVal ) { } int canSetProperty ( int iid , int propertyName , int _retVal ) { } Object convertToJava ( nsIVariant variant , short type ) { } nsIVariant convertToJS ( Object value , nsIComponentManager componentManager ) { } int callJava ( int functionId , int args , int returnPtr ) { Object key = new Integer ( functionId ) ; BrowserFunction function = ( ( BrowserFunction ) ( AllFunctions . get ( key ) ) ) ; Object returnValue = null ; if ( function != null ) { short [ ] type = new short [ 1 ] ; nsIVariant variant = new nsIVariant ( args ) ; int rc = variant . GetDataType ( type ) ; if ( rc != ( XPCOM . NS_OK ) ) Mozilla . error ( rc ) ; try { Object temp = ( ( Object [ ] ) ( convertToJava ( variant , type [ 0 ] ) ) ) ; if ( temp instanceof Object [ ] ) { Object [ ] arguments = ( ( Object [ ] ) ( temp ) ) ; try { returnValue = function . function ( arguments ) ; } catch ( Exception e ) { returnValue = ( ( Mozilla . ERROR_ID ) + ':' ) + ( e . getLocalizedMessage ( ) ) ; } } } catch ( IllegalArgumentException e ) { if ( function . isEvaluate ) { <START_BUG> function . function ( new String [ ] { ( ( IE . ERROR_ID ) + ':' ) + ( new SWTException ( SWT . ERROR_INVALID_RETURNVALUE ) . getLocalizedMessage ( ) ) } ) ; <END_BUG> } returnValue = ( ( Mozilla . ERROR_ID ) + ':' ) + ( e . getLocalizedMessage ( ) ) ; } } int [ ] result = new int [ 1 ] ; int rc = XPCOM . NS_GetComponentManager ( result ) ; if ( rc != ( XPCOM . NS_OK ) ) Mozilla . error ( rc ) ; if ( ( result [ 0 ] ) == 0 ) Mozilla . error ( NS_NOINTERFACE ) ; nsIComponentManager componentManager = new nsIComponentManager ( result [ 0 ] ) ; result [ 0 ] = 0 ; nsIVariant variant ; try { variant = convertToJS ( returnValue , componentManager ) ; } catch ( SWTException e ) { variant = convertToJS ( ( ( ( Mozilla . ERROR_ID ) + ':' ) + ( e . getLocalizedMessage ( ) ) ) , componentManager ) ; } componentManager . Release ( ) ; C . memmove ( returnPtr , new int [ ] { variant . getAddress ( ) } , PTR_SIZEOF ) ; return XPCOM . NS_OK ; } }

Fix:
function . function ( new String [ ] { ( ( Mozilla . ERROR_ID ) + ':' ) + ( new SWTException ( SWT . ERROR_INVALID_RETURNVALUE ) . getLocalizedMessage ( ) ) } ) ;