[Solved] Can't add a new record: Java language Illegal Argument Exception

Discuss the database features
Post Reply
Ken242
Posts: 3
Joined: Mon Aug 08, 2022 9:20 am
Location: USA

[Solved] Can't add a new record: Java language Illegal Argument Exception

Post by Ken242 »

I am having a problem where my database throws an error whenever I try to add a new record. (See attached). The error I get is "Error inserting the new record", "java.lang.IllegalArgumentException", and when I click on the "More" button, it shows "Error code: -1", and "java.lang.IllegalArgumentException". I can't isolate the problem down any further than that.

It didn't always do this, as I was able to add three fake records into the database prior to this, as I was developing this database. (I've since deleted one of the records as part of my troubleshooting). It was working about a month ago, the last time I worked on this, but now its not working. I can't remember what I changed last time; I think I was rearranging the form controls on my only form, but it's been too long and the error message I see doesn't tell me where to look. :crazy:

I've played with tables, I've updated controls on the form, I've adjusted the dependencies for the table relationships, but I can't seem to isolate the problem. Any help you can provide will be greatly appreciated! :D

About me:
  • I am new to database development in Open Office. I have some experience in database development with Microsoft products (Access and O365 Power Platform), but I am not a full-scale developer.
  • The attached database is still in very rough form, as I am just starting to learn Base. (Be gentle with me!) :lol:
  • I want to build a database to track my stock market investments. I thought that this would be a fun way to learn some new skills! :)
Some details:
  • I'm running this under Windows 7.
  • I am now running this in Libre Office, version 7.3.7.2 (x64)
  • I found this error in AOO, but still see it under Libre OO as well. (I installed Libre as part of my troubleshooting). I can't tell if this is an error I made, or if it is an error in OO Base itself. (I am programming in OO Basic, but this is a Java error).
Attachments
What it shows after clicking on More - 2.PNG
What it shows after clicking on More - 2.PNG (11.79 KiB) Viewed 4774 times
What it shows after clicking on More - 1.PNG
What it shows after clicking on More - 1.PNG (10.9 KiB) Viewed 4774 times
Stock Tracking Database.odb
(21.18 KiB) Downloaded 158 times
Last edited by Hagar Delest on Mon Nov 28, 2022 8:58 am, edited 1 time in total.
Reason: tagged solved.
Apache OpenOffice 4.1.13
Libre Office 7.3.7.2 (x64)
Windows 7.
Mountaineer
Posts: 336
Joined: Sun Sep 06, 2020 8:27 am

Re: Can't add a new record: Java language Illegal Argument Exception

Post by Mountaineer »

I assume you use the embedded hsqldb, as this is the default. Having only fake data inside I suggest to upload the file here. Please rename the .odb to .zip before uploD, as .odb is not on the allowed list.
LibreOffice 7.6 on Windows 10pro and other Versions parallel
chrisb
Posts: 300
Joined: Mon Jun 07, 2010 4:16 pm

Re: Can't add a new record: Java language Illegal Argument Exception

Post by chrisb »

hello Ken242,

you have several fields set as type NUMERIC, just change to type DECIMAL.

Sorry ignore this post!

 Edit: :
i sorted out your macro code.
'Price Type' and 'Options' needed to be updated on both selection and row change.  
Stock Tracking Database(chrisb).odb
(23.32 KiB) Downloaded 318 times
Last edited by chrisb on Sun Nov 27, 2022 1:35 am, edited 2 times in total.
open office 4.1.14 & LibreOffice 6.4.4.2 x64 using HSQL 1.8.0.10 (Embedded) and HSQL 2.6.0 (Split) on Windows 10
F3K Total
Volunteer
Posts: 1048
Joined: Fri Dec 16, 2011 8:20 pm

Re: Can't add a new record: Java language Illegal Argument Exception

Post by F3K Total »

Hi, try the attached version,
  • Changed the relation between Table_OptionType, Table_OrderType, Table_PriceType and Table_Orders to on Cascade ...
  • removed all unnecessary spaces behind the entries in Table_OptionType, Table_OrderType, Table_PriceType
  • deleted the default values in columns Option_Expiration_Date and Execution_Date of table Table_Orders
Attachments
Stock Tracking Database_2.odb
(21.22 KiB) Downloaded 154 times
  • MMove 1.0.6
  • Extension for easy, exact positioning of shapes, pictures, controls, frames ...
  • my current system
  • Windows 11 AOO, LO | Linux Mint AOO, LO
Ken242
Posts: 3
Joined: Mon Aug 08, 2022 9:20 am
Location: USA

Re: Can't add a new record: Java language Illegal Argument Exception

Post by Ken242 »

Thank you to @Mountaineer, @Chrisb, and @F3k Total for your replies. I will try out your suggestions and see if that fixes it. :)
Apache OpenOffice 4.1.13
Libre Office 7.3.7.2 (x64)
Windows 7.
Ken242
Posts: 3
Joined: Mon Aug 08, 2022 9:20 am
Location: USA

Re: Can't add a new record: Java language Illegal Argument Exception

Post by Ken242 »

With all of your help, I just figured it out! :)

Thanks to ChrisB for pointing me in the right direction, and F3k Total for helping me clean up other areas of my design.

The fix was that in my Table_Orders, I had the Price_Type field listed as "Entry Required". When I tried to change that entry required to "No", it wouldn't let me because I had a relationship to the Price_Type table. I deleted the relationship, changed the field to not be required, then added the relationship back in. Now it works.

What I was doing during my testing was not to set the Price_Type dropdown, hence the error because a required field was not being set.

I can't speak for anyone else, but if I had known that is what was causing the error, that would have been a trivial fix for me. With the error text telling me there is a java exception, it really threw me off the trail. Does anyone know how to submit an enhancement request so that in the future, the error will say something to the effect of a required field is not being set?

For OO Base, is it just a general best practice to not have any fields set to required at the Table level, then to enforce data entry at the Form level? Is that how you all go about designing your databases?

Also, how do I mark this topic as "solved", "closed", or "completed"?
Apache OpenOffice 4.1.13
Libre Office 7.3.7.2 (x64)
Windows 7.
User avatar
Hagar Delest
Moderator
Posts: 33614
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: Can't add a new record: Java language Illegal Argument Exception

Post by Hagar Delest »

Ken242 wrote: Mon Nov 28, 2022 7:49 am Also, how do I mark this topic as "solved", "closed", or "completed"?
Done. See: howto add [Solved] at the beginning of the title in your first post (top of the topic) with the 🖉 button if your issue has been fixed.
LibreOffice 25.2 on Linux Mint Debian Edition (LMDE 7 Gigi) and 25.2 portable on Windows 11.
Mountaineer
Posts: 336
Joined: Sun Sep 06, 2020 8:27 am

Re: Can't add a new record: Java language Illegal Argument Exception

Post by Mountaineer »

Ken242 wrote: Mon Nov 28, 2022 7:49 am ...
Does anyone know how to submit an enhancement request so that in the future, the error will say something to the effect of a required field is not being set?
...
From ask.libreoffice.org:
Feature requests should go directly to Bugzilla as Enhancements
https://bugs.documentfoundation.org/ent ... nhancement
LibreOffice 7.6 on Windows 10pro and other Versions parallel
Mountaineer
Posts: 336
Joined: Sun Sep 06, 2020 8:27 am

Re: Can't add a new record: Java language Illegal Argument Exception

Post by Mountaineer »

Ken242 wrote: Mon Nov 28, 2022 7:49 am ...
For OO Base, is it just a general best practice to not have any fields set to required at the Table level, then to enforce data entry at the Form level?
...
I'd say the obstacle is to change fields, wich have relations. Luckily my databases are quite simple.

Imho it is better the database takes care of important restrictions. The downside is the error will be rised when the record is stored, not when non-fitting data is entered.

But as there are other options than forms the database should have the restrictions to avoid bypassing restrictions with direct imports.
LibreOffice 7.6 on Windows 10pro and other Versions parallel
User avatar
Hagar Delest
Moderator
Posts: 33614
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: Can't add a new record: Java language Illegal Argument Exception

Post by Hagar Delest »

Mountaineer wrote: Thu Dec 01, 2022 9:27 am From ask.libreoffice.org:
Feature requests should go directly to Bugzilla as Enhancements
https://bugs.documentfoundation.org/ent ... nhancement
We even have a tutorial for that: [Tutorial] Reporting bugs or suggestions.
LibreOffice 25.2 on Linux Mint Debian Edition (LMDE 7 Gigi) and 25.2 portable on Windows 11.
Post Reply