I need to compile and run simple code using the gson library, but I can’t use Maven, Gradle or the IDE. The directory contains Main.java and gson-2.9.0.jar javac -cp gson-2.9.0.jar Main.java works correctly and creates Main.class But when I run java -cp ./*: Main, I get I also tried the following comman…
Tag: java
Caused by: java.lang.IllegalStateException: Query argument creationDateTime not found in the list of parameters provided during query execution
I am trying to cover the case where the :creationDateTime is Null to get the same result as the following query “SELECT o FROM ExtraNetOrder o”. I searched it on the internet and found the solution by adding IS NULL, but it does not work in my case. Currently I am getting the following error: Caus…
Handle daylight savings time and representing UTC in Date object
I have a function which returns the current UTC time in Date object, simple. What we do is find current Instant of UTC, put it in Date object and return. Note: Local Host time here is New York/America. The problem we are now facing is that Date refuses to store March 13 2:02 AM, since the time doesn’t e…
How can I receive dynamically number of query params in Rest Client – Quarkus?
I need create a rest client to access a URI that can receive 0 or n query params. Example: how could i do this here? Answer Please refer to How to send a query params map using RESTEasy proxy client, similar issue is being discussed. You can define your client similar to below: And you can define ClientReques…
Can an assignment statement cause a null-pointer exception?
This code snippet is reading camera picture Exif metadata using ExifInterface: Apparently, one particular picture has no or invalid datetime and .getDateTime() is returning null. In the code I assign it to a long, dt, and that results in the exception that is shown below. Of course, if I un-comment the null-c…
How to map a table in Spring Data JPA that has 2 columns referencing the same table
I have a table that has 2 fields (pseudonymProfile and realProfile) that both join to the same table. When I try to do the mapping as shown below, I run into an error because the 2 fields use the same name (profile_id) in their @JoinColumn annotation. I’m under the impression that when defining a join c…
More succinct way to get Scanner input with error checking?
Just want to know if there was any better way of doing this since it’s a lot of writing. Answer Well there are some things that can be ommited on a first look, but there is not much to remove. Reduced integer parsing in a single line and removed input variable. Change isInputValid to its negation isInpu…
Setter in DTO just for integration testing?
I couldn’t find the info I’m looking for hence posting here for suggestion and getting to know better approach. I have an immutable DTO object like: Now I’m working on an integration test with testcontainer where I want the accountOpeningDate and installmentPaidDate to be dynamic value hence…
Easy sort list 2D by column
I’m quiet new in Java data manipulation so I need some help if someone have a some good tips. Actually, I want just to find a easy way to sort a 2D list. I create a list like this: And then I want to have a result sorted by the second element like: I tried something like Arrays.sort(A.toArray(), (int[]a…
How can I add support for PBEWithMD5AndTripleDES algorithm in modern OpenJDK based JVM (Semeru)
I’m trying to run some legacy code using Semeru: But this code depends on a proprietary Oracle cipher not included in OpenJDK anymore so when running: I’m getting an exception: I’ve tried including Bouncy Castle as an alternative provider, but without luck. Any chance of getting some open so…