Rob Spoor

+ Follow
since Oct 27, 2005
Rob likes ...
Eclipse IDE Spring VI Editor Chrome Java Windows
Merit badge: grant badges
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads

Recent posts by Rob Spoor

Chandra Shekar Bairi wrote:I have extended this class and I want to use the constructor which is this: TokenRequest(URL uri, GrantType grantType, ClientAuthentication clientAuth)

But that's not how you call it. The URL is correct, but you've passed the ClientAuthentication as the second argument, not third, and pass a AuthorizationGrant as the third argument. If the latter has a method that returns a GrantType, turn the call to super to this (pseudo code):
1 hour ago
Because you don't provide an Executor when calling supplyAsync, the commons fork-join pool is used for the work performed in the completable futures. That contains so-called daemon threads. Whereas non-daemon threads (like main) must end before the JVM ends, daemon threads will be "cut off" when the JVM ends (they don't prevent the JVM from exiting). In other words - the main method doesn't wait until the completable futures are actually done.

There are two ways to handle this:
1) Use an explicit ExecutorService, usually created by calling on of the static methods of Executors. While the ExecutorService hasn't been shut down by an explicit call, it will prevent the JVM from exiting.
2) Call join() or .get() on the last completable future. That will make the current (main) thread wait until the completable future is done.
22 hours ago
Something that isn't allowed in the module system. That can be annoying if older libraries include dependencies. That happened too often in the past, especially for Java EE APIs. The result is two JAR files with the same packages.

The name of the module for such non-module classes, the so-called automatic module name, is by default the name of the JAR file, with the version removed and dashes replaced by dots. For instance, commons-lang-3.12.0 would become commons.lang (note: that JAR file has a proper module name though).
It's possible to define a custom automatic module name by adding a manifest entry. For instance, yours truly added one for reload4j: Version 1.2.22 has automatic module name reload4j, version 1.2.23 has automatic module name ch.qos.reload4j. This explicit automatic module name allows the dependency to be included in the module descriptor without having to change it when the dependency is turned into a proper module.
4 days ago
Indeed. The arguments to System.arraycopy are Object (like most methods from java.lang.reflect.Array), probably just to prevent overloads. That does mean that if you pass an int[] and a boolean[] (or even a String), the code compiles. It won't run successfully though - it'll fail with an ArrayStoreException.
4 days ago

Tim Moores wrote:
The vulnerabilities in 5.1 all concern log4j, for which a compatible secure version is available (assuming that you do not use the JNDI and SMTP capabilities, but most people don't).

log4j is, like JUnit, a test dependency.
2 weeks ago
That's Oracle's OpenJDK version. I stopped using those because they don't offer any long-term support. Even for JDK 17, the current LTS, they don't offer any downloads anymore. If you want updates, they want you to use the non-open Oracle version.
1 month ago

Paul Clapham wrote:the OpenJDK version of the download

Out of curiosity, which OpenJDK? I'm using Eclipse Temurin (from Adoptium) myself.
1 month ago
Annotation property values can only be given as compile-time constants (numbers, string literals), enum constants, class literals and other annotations. To do the custom serialization you want, you need to use a custom serializer on the entire product class. That can access both fields. However, you need to write all the fields yourself. You can use some of the "magic" Jackson provides (e.g. lookup serializers for types), but not the automatic serialization of all fields without specifying them explicitly.
1 month ago
If something works when starting it yourself but doesn't work when it's run as a service, then it's often rights (the service account doesn't have the same rights you do) or environment settings (the service account usually doesn't have the same path, etc.).
1 month ago
I'd consider using an API management service. Most big cloud companies have one (Azure, AWS, Google, etc.). You configure your API spec and link it to your own back-end, and let the service take care of authentication and pricing.
1 month ago
You could try using the 64 bit version of Notepad++, but 16GB is simply a lot. There aren't many programs that can handle files of that size.

An important question is, what do you want to do with the file? Read through it, find content, etc? Then I can recommend glogg, we use it at work quite a bit to open log files.
For Windows you can use, it has a portable version:

Tim Holloway wrote:Docker itself relies on a Linux host (some Windows support???).

Docker Desktop works pretty great on Windows. It used to work with Hyper-V, now it uses WSL.

Joseph Sam wrote:ServletContext context = request.getSession().getServletContext();

Why do you call getSession(), which will create a session if there isn't one yet, when you can simply use request.getServletContext()? That's been available since version 3.0 of the Servlet API. You must be using a really old container if you're still not able to use that.
1 month ago