Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 9 months ago. Improve this question I have the following code and would like to have the test run consider th…
Tag: java
ArrayIndexOutOfBoundsException while getting values from hashmap in Java 17
I have a static HashMap<UUID, MyObject> ALL = new HashMap<>(); which is used in multi-threading. To reproduce the error, I made this code: But, after some seconds (around 10), I get this error with Java 16 and Java 17: With Java 8, I get this: To test, I remove synchronized key-word, then try agai…
Struts2 – How to repopulate form having dynamically generated fieldnames (via expression) with submitted values after validation error
We have a Struts2 application where we are building survey feature using which application users will be able to create surveys by adding different questions. These questions are comprised of question text and an html control for getting response. The html controls so far supported are single and multi-select…
How to emit filtered out error if flux is empty
I have synchronous code that I want to make non-blocking with reactor. I want to call in parallel different URI, the calls can return a response, an error or nothing. There are 3 cases: A request returns a response, I return it without waiting for the other requests to complete. If other requests returned err…
How to read data from nested array in Firestore
I have the below structure in my Firestore and I want to read data and store it in ArrayList like I have “amountArrayList” which will read data from the “transactions” field in Firestore, I want to read all the “amount” fields from “transactions” field and make …
Generic Authentication Filter in Spring Security used for Authentication
I’m new to Spring Security and would like to learn the authentication process a little bit better Here’s what I found on the Internet related to the topic if I’m wrong on the process please let me know: The authentication process begins in the Filter that might be part of a FilterChain. The …
spring security hasAuthority(“SCOPE_xxx”) method not working with spring authorization server version 0.2.0
I have created an authorization server using the new spring authorization server module. I am able to get the token successfully but when I try to use the token against a protected endpoint with hasAuthority() I get forbidden 403 error. Below my pom.xml file Below is my Authorization Server config And this is…
Spring MVC POST request with dto that contains multipart files and other dtos
I have a DTO that contains other DTOs and a list of multipart files. I am trying to process that DTO but I can’t seem to be able to read the requst. When creating an example request from Swagger UI, I get the following exception: If I put @RequestBody instead of @ModelAttribute then I get Swagger depend…
In the following fragment, is the & a bitwise or logical operator? why? [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 11 months ago. Improve this question In the following fragment, is the & a bitwise or logical operator? why? Answer If you …
Sort character array using java comparator
Sort a character array lexicographically with an additional condition that all c’s comes before all b’s. This could be done manually but I want to code it via inbuilt sorting using comparators. The code I wrote – Gives output: [a, a, a, a, a, b, c, b, d, r, r]. The c only comes before one of…