Category "java"

Achieve "all-or-nothing" transaction between Oracle and MongoDB

I have an usecase(migrate data from Oracle to MongoDB via Java app) where I required to implement transaction management to ensure "all-or-nothing" in the datas

How to create Bitmap from Android MediaImage in OUTPUT_IMAGE_FORMAT_RGBA_8888 format?

I am trying to use this new feature of CameraX Image Analysis (version 1.1.0-alpha08): using setOutputImageFormat(ImageAnalysis.OUTPUT_IMAGE_FORMAT_RGBA_8888),

Mock call to static method of a utility class

I need to write a unit test for the method processNotification. But this method internally calls JsonUtility.getNotificationDTOFromMessage. I need the return

Kafka producer config: Why should be larger than

From Kafka doc , it says that: The configuration controls the maximum amount of time the client

How to return an array that contains values, which appear in two arrays? And no duplicates

I want to pass two arrays of names so that it will return an array containing the names that appear in either or both arrays. The returned array should have no

Intellij Run/Debug Configuration change ../bin/java

Our java sdk include custom bash script for run a java application. Intellij default configuration for java application call this command: JDK_PATH/bin/java -AL

Can a static method access and modify a non-static field in java? [duplicate]

Here is the code, I'm trying to use a non-static field in a static-method, but I don't know how to do it. package hombre.numbro; public class

MockMvc Error: java.lang.NoSuchFieldError: defaultInstance

I am trying to write some integration tests in my spring application. POM: <project xmlns="" xmlns:xsi="http://www.

Excluding “ when using StringEscapeUtils.escapeHtml4

I am trying to Sanitize the requestBody. For this purpose I am converting Object to Json and then passing the Json to requestBody { "data": { "id": "

Accessing keycloak roles / users attributes from Java API

I've created a role and and a user in Keycloak and added one attribute in both of them; for example: my_role_attr = 'x' my_user_attr = 'y' Then I'm trying to

AWS Java SDK not finding profile when using AWS SSO

I can't reach aws when my login is made using AWS SSO. I login from my computer using: aws sso login --profile staging The profile is configured like this: [pr

How to return a marshalled JSON that has a nested property?

Fellow programmers from SO! I am building a simple Spring Boot example just to add a Client using a RESTful API. I have written this Controller: import org.spri

Upgrading Jenkins Java version from 8 to 11

I'd like to upgrade java from 8 to 11 as recommended for Jenkins 2.303.1, I'm reading the guide in

How to access and return the result of an AsyncTask from a repository?

I'm new to coding, put already in a lot of hours and feel like I'm progressing step by step. However, I've encountered a problem that I was not able to solve ev

org.powermock.api.mockito.ClassNotPreparedException when it's declared to be prepared

I don't understand why this is showing since my test definitely asked PowerMock to prepare for it. @PrepareForTest({AmazonSQSClientBuilder.class}) @RunWith(Powe

trouble printing a range of numbers in an array list with own inputs and indices - 3.8 MOOC JAVA

I have an exercise problem from that I am stuck on! We are learning about arrays and lists in Java, and here is the text for the problem: "The exercise

How to get part of string from regex in Java

For example, I have string with range of earnings: 5 000-10 000 USD and i want to extract from that string minimum and maximum value. I prepared regexes, for e

Get list of keys in Complex JSON Object (Java 8)

I am dealing with a JSON that looks like this :- { "key1": { "key1.1": { "nestedkey1": "something", "nestedkey2": "something", "nest

Cookie Management For Webflux WebClient

I have a WebClient that sends a JSON object with login credentials to a remote server. The remote server then returns the cookie. After which I need to POST dat

How do I know if an array list of objects contain a certain string?

I made a method that search through an array list of objects. Then if the searchKey is found in the array list it will print this certain item. Here is how I it