Created attachment 46671 [details] picture of the error report Hallo, I programed a little basic macros for one of my users. This macro worked with gooo-3.1 for years. Now we deployed LibreOffice. Unfortunately LibreOffice throws a null pointer exception within this macro. Here is an excerpt of my BASIC macro: dbContext=createUnoService("com.sun.star.sdb.DatabaseContext") dataSource=dbContext.getByName("internetplz") handler = createUnoService("com.sun.star.sdb.InteractionHandler") connection = dataSource.ConnectWithCompletion(handler) stmt=connection.prepareCall("execute procedure adm_an_adm('"+alteAdmNr+"','"+neueAdmNr+"');") stmt.execute() stmt.close() connection.close() The stmt.execute() gives me a null pointer exception. As an aside, I found a similar report concerning OO3.2 (which we left out) http://user.services.openoffice.org/en/forum/viewtopic.php?f=20&t=29579&start=0 Regards, Bernhard Donaubauer
Noel, does it trigger any bell?
(In reply to comment #1) > Noel, does it trigger any bell? sorry, nope, if there was a standalone example it might be possible to get some more details. Currently all we can tell is that some java null pointer problem is getting passed up to the bridge and then to basic.
Hello, I know I am late but I had a lot of work to do and was ill for some time but here is the standalone example bugShow.odb.
Created attachment 49130 [details] Database contains one table and one little macro "testmacro" that throws this exception
well not being really that familiar with base, is there some recommended way to run macros from base, I just opened the odb, opened the basic ide and ran the testmacro, it fails for me on the following line dataSource=dbContext.getByName("bugShow") where an exception ( no such element ) is thrown, the only names dbContext in this instance knows about are Bibliography, so... I think I am missing some step, any hints?
Created attachment 49233 [details] Database register dialog You have to register the odb - File. See the picture.
[This is an automated message.] This bug was filed before the changes to Bugzilla on 2011-10-16. Thus it started right out as NEW without ever being explicitly confirmed. The bug is changed to state NEEDINFO for this reason. To move this bug from NEEDINFO back to NEW please check if the bug still persists with the 3.5.0 beta1 or beta2 prereleases. Details on how to test the 3.5.0 beta1 can be found at: http://wiki.documentfoundation.org/QA/BugHunting_Session_3.5.0.-1 more detail on this bulk operation: http://nabble.documentfoundation.org/RFC-Operation-Spamzilla-tp3607474p3607474.html
Tested it with: LibreOffice 3.5.0rc3 Build-ID: 7e68ba2-a744ebf-1f241b7-c506db1-7d53735 Problem is still there!
Adding myself to cc, will try and find some time to look at this. Alex
Dear bug submitter! Due to the fact, that there are a lot of NEEDINFO bugs with no answer within the last six months, we close all of these bugs. To keep this message short, more infos are available @ https://wiki.documentfoundation.org/QA/NeedinfoClosure#Statement Thanks for understanding and hopefully updating your bug, so that everything is prepared for developers to fix your problem. Yours! Florian
Florian, Am re-opening as unconfirmed, will test later today, then report back. The original submitter has given us enough information to test, at least for those of us who know Base, so its rather unfair to state that we needmoreinfo unless we've actually tested. Alex
Confirming : I can reproduce the behaviour on LO 3.4.4 on Linux Mint 12 64bit, will try with other versions and try and get a trace from a debug build if it is still present in one of the latest builds. Alex
Confirming also in LibreOffice 3.5.5.2 Build ID: 24b32b4-b87ec2e-85c8e98-87a4e20-9a1b8c1 Alex
Changing platform to All as reproducible on Linux as well. Alex
Confirming also on 3.6.0.4 Linux 64bit Mint 12
Running gdb When I click on Run Macro from the Tools > Macros menu, I see this : Program received signal SIGSEGV, Segmentation fault. 0x00007fffbc45ae86 in ?? () (gdb) (gdb) (gdb) (gdb) cc Undefined command: "cc". Try "help". (gdb) bt #0 0x00007fffbc45ae86 in ?? () #1 0x00000000fb2d49a2 in ?? () #2 0x000000000000001b in ?? () #3 0x0000000000000000 in ?? ()
If I press continue in gdb, I get the Macro Selector dialog, and can navigate down to the macro included in the ODB file. Now, when I click on "Run" : (gdb) c Continuing. [New Thread 0x7fffc82d5700 (LWP 2576)] [Thread 0x7fffc82d5700 (LWP 2576) exited] [New Thread 0x7fffc82d5700 (LWP 2600)] [New Thread 0x7fffc4199700 (LWP 2601)] [New Thread 0x7fffc62d1700 (LWP 2604)] [Thread 0x7fffc62d1700 (LWP 2604) exited] [New Thread 0x7fffc62d1700 (LWP 2606)] [Thread 0x7fffc62d1700 (LWP 2606) exited] c [New Thread 0x7fffc62d1700 (LWP 2612)] [Thread 0x7fffc62d1700 (LWP 2612) exited] c Program received signal SIGSEGV, Segmentation fault. 0x00007fffbc45ae86 in ?? () So doesn't seem to be of much help there. Alex
Unfortunately, apparently no debug symbols in the 3.6.0.4 version I was testing. Alex
Downloaded the daily x86_64 from August 13th, 2012, i.e. future 3.6.1 - no debug symbols are provided, so bt attempt worthless :-/ - this is where doing qa becomes a PITA. Alex
@Lionel Assigning to you as it seems to be a Base problem at heart, but if you feel it is more of UNO Basic problem, then please re-assign. I've also changed component to Database, if you feel that's wrong, please change back. Alex
Nah, it's not a Basic nor UNO problem as far as I can see, seems it is either a problem with the macro ( I can't tell ) or more likely an implementation issue in the associated UNO base related objects. I can see gets as far as 228 sal_Bool java_lang_Object::callBooleanMethod( const char* _pMethodName, jmethodID& _inout_MethodID ) const 229 { 230 jboolean out( sal_False ); 231 232 SDBThreadAttach t; 233 OSL_ENSURE( t.pEnv, "java_lang_Object::callBooleanMethod: no Java enviroment anymore!" ); 234 obtainMethodId(t.pEnv, _pMethodName,"()Z", _inout_MethodID); 235 // call method 236 out = t.pEnv->CallBooleanMethod( object, _inout_MethodID ); 237 ThrowSQLException( t.pEnv, NULL ); and the exception is generated based on the contents of t.pEnv from the JNI call at 236. Interestingly 'object' seems to be null there ( surely that should be something ? ) but since I know approx. zero about either base or JNI I can't be sure. #0 connectivity::java_lang_Object::callBooleanMethod (this=0x2460bb8, _pMethodName=0x7f0a0937baa7 "execute", _inout_MethodID=@0x7f0a095aabe8) at /media/FreeAgent-4/LIBOO-master/core/connectivity/source/drivers/jdbc/Object.cxx:237 #1 0x00007f0a09364055 in connectivity::java_sql_PreparedStatement::execute (this=0x2460b30) at /media/FreeAgent-4/LIBOO-master/core/connectivity/source/drivers/jdbc/PreparedStatement.cxx:100 #2 0x00007f0a2336cb39 in gcc3::callVirtualMethod(void*, unsigned int, void*, _typelib_TypeDescriptionReference*, bool, unsigned long*, unsigned int, unsigned long*, unsigned int, double*, unsigned int) () from /media/FreeAgent-4/LIBOO-master/core/INSTALL_LINK/ure/lib/libgcc3_uno.so #3 0x00007f0a2336e5bc in cpp_call(bridges::cpp_uno::shared::UnoInterfaceProxy*, bridges::cpp_uno::shared::VtableSlot, _typelib_TypeDescriptionReference*, int, _typelib_MethodParameter*, void*, void**, _uno_Any**) () from /media/FreeAgent-4/LIBOO-master/core/INSTALL_LINK/ure/lib/libgcc3_uno.so
Created attachment 91371 [details] hs_err_pid On pc Debian x86-64 with master sources updated today, I gave a try and had a crash while running the macro step by step. I attached error I noticed too these kinds of logs: warn:basic.sbx:19947:1:basic/source/sbx/sbxvalue.cxx:192: Not at Parent-Prop - otherwise CyclicRef warn:legacy.osl:19947:1:dbaccess/source/ui/uno/dbinteraction.cxx:65: BasicInteractionHandler::BasicInteractionHandler: enabling legacy behavior, there should be no clients of this anymore! java.lang.NullPointerException warn:legacy.osl:19947:1:unotools/source/config/moduleoptions.cxx:635: unknown factory
Created attachment 91374 [details] bt I attached bt when I'm trying look at the content of stmt variable in "watch pane" just after this: stmt=connection.prepareCall("update mytable set text='aaa';")
the SQL update mytable set text='aaa'; from the macro doesn't even work. Lionel: any idea?
About update queries, it seems only SELECT can work according to these: http://opengrok.libreoffice.org/xref/core/dbaccess/source/core/api/SingleSelectQueryComposer.cxx#checkForSingleSelect_throwError and http://opengrok.libreoffice.org/xref/core/dbaccess/source/core/resource/strings.src#73 73 String RID_STR_ONLY_QUERY 74 { 75 Text [ en-US ] = "The given command is not a SELECT statement.\nOnly queries are allowed."; 76 };
Bernhard, for your information here is how you can avoid having to register the datasource: dataSource = ThisDatabaseDocument.DataSource Also, "com.sun.star.sdb.InteractionHandler" is deprecated. It is recommended to switch to "com.sun.star.task.InteractionHandler". And BTW here's an even better way to connect to the current database: Dim DBDocUI as Object DBDocUI = ThisDatabaseDocument.currentController if not DBDocUI.isConnected then DBDocUI.connect end if stmt = DBDocUI.ActiveConnection.createStatement/prepareStatement/prepareCall(...)
Lionel Elie Mamane committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=01329972d89ddfd30d197b7947c571fdb83b0cf8 fdo#37167 create statement before execute/wasNull/getBoolean The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Backport to 4.1 & 4.2 submitted for review in gerrit: https://gerrit.libreoffice.org/7280/ https://gerrit.libreoffice.org/7281/
(In reply to comment #27) > the SQL update mytable set text='aaa'; from the macro doesn't even work. > > Lionel: any idea? Need to quote the table and column names: UPDATE "mytable" SET "text"='aaa'; in the macro: connection.prepareCall("UPDATE ""mytable"" SET ""text""='aaa';")
Lionel Elie Mamane committed a patch related to this issue. It has been pushed to "libreoffice-4-1": http://cgit.freedesktop.org/libreoffice/core/commit/?id=515c6cf7a3832bfc7a6eeed65704bc9eee96adc1&h=libreoffice-4-1 fdo#37167 create statement before execute/wasNull/getBoolean It will be available in LibreOffice 4.1.5. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Lionel Elie Mamane committed a patch related to this issue. It has been pushed to "libreoffice-4-2": http://cgit.freedesktop.org/libreoffice/core/commit/?id=85cf6f6f210eaf427ff91d59325122eb7a4e54d1&h=libreoffice-4-2 fdo#37167 create statement before execute/wasNull/getBoolean It will be available in LibreOffice 4.2.1. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.