Category "java"

How to return custom response on javax.json.bind.JsonbException (Helidon project)

I'm trying to return a custom http response(400 bad request) instead of http 500 server error when json payload is not valid. The problem is that when I use jav

How to use Map.computeIfAbsent() in a stream?

I have a fun puzzler. Say I have a list of String values: ["A", "B", "C"] Then I have to query another system for a Map<User, Long> of users with an attr

Gitlab CI/CD Spring boot Mysql sample Build and db connection successful but Junit test failing with Unknown database issue..! (DB exist)

Applying CI/CD With Spring Boot MySQL Gitlab I'm created very basic Spring boot crud application with MySQL, What I need to implement is Gitlab CI pipeline to a

How to convert grpc java proto "timestamp" to date?

Error in request.getProductexpirationdate() since its not "Date" in proto thats specified as "timestamp". Entity class has a "Date" but proto has no "Date" only

Jdeps Module java.annotation not found

I'm trying to create a minimal jre for Spring Boot microservices using jdeps and jlink, but I'm getting the following error when I get to the using jdeps part E

Gradle override subprojects property from CLI

I'm trying to override a setting in a certain project by using the command line in a Linux environment. I would like to avoid to change the build.gradle file. H

How can one execute Java code using Gatling load testing framework?

I am evaluating different load testing tools. After trying JMeter and having two exceptions when running and viewing the test result, I would like to give Gatli

Store redux data that can be accessible with swift and java

I want to rewrite my React Native application with Java for Android and Swift for iOS. The thing is, I don't want to lose application data so that the user has

I cant create h2 database before tests, but after first test other tests work fine

i am trying to make my tests on h2 database. But my first test always falling with error nested exception is io.r2dbc.spi.R2dbcBadGrammarException: [90079] [900

Passing quarkus.hibernate-orm.proc.param_null_passing" - dont work : Call Stored Procedure

Thanks a lot for the opportunity.. I will try to pass 2 parameters in my Quarkus rest code, using Hibernate call stored Procedure at oracle database. Unfortunat

Java interface loose coupling advantages in realworld?

Can someone help me out, I read some Java tight and loose coupling article. I had certain doubts in loose coupling watched several YouTube videos and articles,

app crash due to android.content.res.Resources$NotFoundException:

I made my app and it work well in emulator and many actual device. Recently, I checked crash report on Google play console and found crash report "Caused by:

Flutter Unable to instantiate activity ComponentInfo Main Activity

I'm using vs code (to code) and android studio (to get virtual device). I just merged and pulled the project I'm working on this morning, and first, have a very

Convert ByteArray to Base64 in Kotlin

I am trying to convert a ByteArray to Base64 in a Spring project, written in Kotlin. I have checked existing posts but they didnt help me. Actually I am trying

Mockito mockStatic cannot resolve symbol

I'm using Spring Boot and in a unit test, I'm trying to mock the Files.delete(myFile.toPath()) method. To do so I'm trying to use the Mockito.mockStatic() metho

Proguard plugin is giving error: Failed to execute goal: proguard (default) on project X: Obfuscation failed (result=1)

I am working on an open source Java Maven project which is using proguard-maven-plugin to obfuscate the application code. It is working fine until I have added

How to wrap the return of @FindBy into another class

The usage of the annotation @FindBy of selenium is: @FindBy(xpath='//xpath/selector') private WebElement element; public void setText(String te

How to Update JSON value using Java

I have below json, i want to update each and every value of that json but sometimes only one value { "msgType": "NEW", "code": "205", "plid": "PLB52145", } I'

How to access images within a .Jar File

I've been trying for a couple of days to access an image within a .Jar file. I've taken a look at several solutions on this site and nothing seems to be working

Given a rectangular matrix of characters, add a border of asterisks(*) to it

Example For picture = ["abc", "ded"] the output should be addBorder(picture) = ["*****", "*abc*", "*ded*