lucene-pylucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ludovico Cavedon <ludovico.cave...@gmail.com>
Subject Re: JCC on HtmlUnit
Date Thu, 18 Jun 2009 23:55:05 GMT
Andi Vajda wrote:
> On Wed, 17 Jun 2009, Ludovico Cavedon wrote:
>>
>> * If I get an error
>> jcc.cpp.JavaError: java.lang.ExceptionInInitializerError
>> I actually added a "print className" to understand which class was
>> causing the error

In JCCEnv.cpp I had to decomment the
	if (!env->handlers)
in order to execute
	vm_env->ExceptionDescribe();
and see the java backtrace. I think it would be useful to print it by
default.

It would also be usefult to print the class name in case of exception,
see attached patch.

>> * org.mozilla.javascript.SecureCaller and
>> com.gargoylesoftware.htmlunit.javascript.host.ActiveXObjectImpl cause a
>> jcc.cpp.JavaError: java.lang.ExceptionInInitializerError
>> If I use --exclude it does not work either, because findClass() is
>> called anyway and it will trigger the exception
>> My workaround was by skipping the classes in the cpp.py code. I could
>> not understand why the though that exception...
> 
> It could be that the class could not be loaded because of some native
> code required by the class in a shared library that was not found. This
> would need to be fixed by adding yet another command line flag that adds
> to the initVM() call in cpp.py a java.lib.path to use with the VM.

For the com.jacob.activeX.ActiveXComponent you were right, it is failing
because of a  java.lang.ClassNotFoundException.

About the net.sourceforge.htmlunit.corejs.javascript.SecureCaller class
something more weird is going on; I am posting the exception here, in
case someone has a clue of what is going on :)
<<<<<<<<<<<<
Exception in thread "main" java.lang.ExceptionInInitializerError
Caused by: java.lang.NullPointerException
	at
net.sourceforge.htmlunit.corejs.javascript.SecureCaller.loadBytecodePrivileged(SecureCaller.java:172)
	at
net.sourceforge.htmlunit.corejs.javascript.SecureCaller.access$100(SecureCaller.java:55)
	at
net.sourceforge.htmlunit.corejs.javascript.SecureCaller$3.run(SecureCaller.java:162)
	at java.security.AccessController.doPrivileged(Native Method)
	at
net.sourceforge.htmlunit.corejs.javascript.SecureCaller.loadBytecode(SecureCaller.java:158)
	at
net.sourceforge.htmlunit.corejs.javascript.SecureCaller.<clinit>(SecureCaller.java:57)
>>>>>>>>>>


>> * org.mozilla.javascript.ScriptableObject defined constants like:
>> static int READONLY
>> However the file /usr/include/python2.6/structmember.h contains:
>> #define READONLY        1
> 
> You can add that word as a reserved word using the --reserved flag. Or,
> you can edit the RESERVED list in cpp.py and add that word to it for good.

Ah, I missed that RESERED list (and --resevred was also on the help  :(
Worked thanks!


There is a bunch of #define coming from
/usr/include/python2.6/structmember.h:

'READONLY', 'T_SHORT', 'T_INT', 'T_LONG', 'T_FLOAT', 'T_DOUBLE',
'T_STRING', 'T_OBJECT', 'T_CHAR', 'T_BYTE', 'T_UBYTE', 'T_USHORT',
'T_UINT', 'T_ULONG', 'T_STRING_INPLACE', 'T_BOOL', 'T_OBJECT_EX',
'T_LONGLONG', 'T_ULONGLONG', 'T_PYSSIZET', 'READONLY', 'RO',
'READ_RESTRICTED', 'PY_WRITE_RESTRICTED', 'RESTRICTED'

I think it would useful to add them to the RESERVED list by default.
I am getting conflicts with READONLY and all T_* at least

I have another problem I forgot to mention; i get this gcc error:
<<<<<<<<<<<<
/var/lib/python-support/python2.6/jcc/sources/functions.h: In function
‘PyObject* get_iterator_next(T*) [with T = java::util::t_Iterator, U =
com::gargoylesoftware::htmlunit::html:
:t_HtmlTableCell, V =
com::gargoylesoftware::htmlunit::html::HtmlTableCell]’:
build/_htmlunit/__wrap__.cpp:112089:   instantiated from here
/var/lib/python-support/python2.6/jcc/sources/functions.h:116: error: no
match for ‘operator=’ in ‘next = java::util::Iterator::next() const()’
build/_htmlunit/com/gargoylesoftware/htmlunit/html/HtmlTableCell.h:27:
note: candidates are:
com::gargoylesoftware::htmlunit::html::HtmlTableCell&
com::gargoylesoftware::htmlunit::html::HtmlTableCell::operator=(const
com::gargoylesoftware::htmlunit::html::HtmlTableCell&)
>>>>>>>>>>>>

where build/_htmlunit/__wrap__.cpp:112089:
<<<<<<<
DECLARE_TYPE(HtmlTableRow$CellIterator, t_HtmlTableRow$CellIterator,
java::lang::Object, HtmlTableRow$CellIterator,
t_HtmlTableRow$CellIterator_init_, PyObject_SelfIter, ((PyObject
*(*)(java::util::t_Iterator *))
get_iterator_next<java::util::t_Iterator,com::gargoylesoftware::htmlunit::html::t_HtmlTableCell,com::gargoylesoftware::htmlunit::html::HtmlTableCell>),
0, 0, 0);
>>>>>>>>

Looks like it is doing wrong with HtmlTableRow.CellIterator:
http://htmlunit.sourceforge.net/apidocs/com/gargoylesoftware/htmlunit/html/HtmlTableRow.CellIterator.html


Thank you for your help,
Ludovico


Mime
View raw message