Category "java"

Is there an alternative to the builder pattern that is preferred in C++?

I'm coming from Java where the builder pattern is used heavily, e.g. Foo foo = new FooBuilder() .setBar(43) .setBaz("hello, world!") .enableCache(tr

How do I access index from filter in java?

I'm planning to convert the following without a for loop and using functional programming: int count = 0; for (int i = 0; i < 5; i++) { //Feedback: avoid for

Why Unicode u+202e and u+202c cause output text to have a different result

In Java: If I print "123\u202e987\u202c456abc" then the result is 123‮987‬456abc If I print "123\u202e987\u202cxyzabc" then the result is 123‮

B2c accelerator hybris 1905 : install.bat -r b2c_acc_plus not working

I have an exception when I try to run install.bat -r b2c_acc_plus , can you help me to resolve it ? java.lang.NoClassDefFoundError: Could not initialize class o

Add delay in consuming messages in rabbitmq stream

i'm using rabbitmq stream and i need to add a delay between messages because the stream handles messages very fast. how can I do that?

DB default column value null while saving with Spring Data JPA

I have a JPA entity with the following fields: @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "modified_by_user_id") private User modifiedByUser; @Conve

Logback log to different files from the same package

I want to log into two different files, historic.log and applicative.log, from the same package that is com.authenticationservice.user.UserRequest. In the histo

JLabel not displaying image after choosing from jFileChooser in java netbeans IDE 8.02

I am using NetBeans IDE 8.0.2 to create my project application. I have created my application's signup page using multiple panels in CardLayout. For users to up

Spring: @RequestScope - annotated method does not get called

In the application I would like to create a request-scoped bean (annotated with @RequestScope) that would represent a user of the application (for authenticatio

compilation problem while trying to iterate a class of ArrayList<Obj>

I have a class to generate an Arraylist it all seems to work but in main it produces a compilation problem which I guess does not recognize my variable name as

Sending message to a SQS queue fails from local in java

I'm not able to send message to sqs-queue from my java application. I am running roribio16/alpine-sqs docker image for SQS in my local and I've created a standa

Java RSA decryption javax.crypto.IllegalBlockSizeException: Data must not be longer than 256 bytes

Small RSA decryption question with Java please. I want to meet in a secret location with a friend of mine. As we do not want anyone to eavesdrop on the secret l

How to throw exception when there is extra parameters in request body spring boot

In my last project, there was a requirement for throwing exceptions when the request body contains extra parameters. If the request will be like { "test":"bo

Why error is coming after adding javascript , bootstrap and CSS path in list-todos.jsp in Springboot

I am working on spring-boot project Code is working fine until I add javascript , bootstrap and CSS path in list-todos.jsp but after I add them and hit URL "htt

Java initialize array with mutiple type parameters error java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to

public class ArrayPQK<P extends Comparable<P>, T> implements PQK<P, T> { int maxsize; int size; int head,tail; Pair<P, T>[] nodes; publi

How do I compare strings in Java?

I've been using the == operator in my program to compare all my strings so far. However, I ran into a bug, changed one of them into .equals()

Getting 'com.android.tools.r8.internal.Hc: Sealed classes are not supported as program classes' when trying to load Microsoft SQL Server JDBC

I'm using android studio to connect to a Microsoft SQL Server and I can't use the JDBC for JDK 17. It just appears with the following error message: 'com.androi

Default algo for RandomGenerator (L32X64MixRandom) generates the same number each time

The default algo for RandomGenerator ie. L32X64MixRandom as of JDK 18 (available since 17), generates the same number each time on individual invocations. jshel

Invalid Class name driver JDBC SQLite

I have this error "Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver found for /Users/testdb.db" when trying to select q

Java Mybatis to Python SQL Alchemy - is there resultMap mybatis equivalent in SQLAlchemy python. which logically maps join queries removing duplicates

Say we have a select query like select a.col1,a.col2,a.col3,b.col1,b,col2,c.col1 from a, b, c where a.col1(+)=b.col2 and b.col3(+)=c.col2 In mybatis xml we hav