I have a recycler view inside my full screen alert dialog, but for some reason it doesn’t display any of the items inside the ArrayList passed to the adapter. I tried: Initializing the adapter after adding the items inside the ArrayList Use notifyItemInserted instead of using notifyDataSetChanged Checki…
Tag: java
Parsing string long to int with java and python
I am trying to convert some java code to python. I have a problem with the following java lines : In java, i get those results : I think I understand the first line, but why is there a “(int)” here ? What is it supposed to do ? (I’m a beginner in java and in byte management, and I
Combine JPA Query annotation with Oracle sample method
i am trying to pass a parameter into a JPA query Example code But i get an error because of the sample(:percentile). If i just hardcode a number in there it works but not with a param. Is there a way to escape the brackets or something similar? Thx Answer The error is on the following part Unfortunately it do…
Java Apache POI Bug
While working with the Apache POI Implementation I ran into a strange behaviour. I cannot explain the cause, so if anybody can give some hints, I would love to hear them. It is not even a big blocker for the problem that I was solving – at this point it is more a curiosity thing. So here it goes: As
Transitive Dependencies on generated (gGRPC) code with java/maven
We have a server and client application which shall talk to each other, both written in java and built with maven. They interact via a gRPC interface. We have different dependency situations on server and client: The server includes libraries lib-a and lib-b which in turn need a subset of the messages that ar…
How can I collect a heap dump from Gradle tests in a Spring Boot Application?
I trying to diagnose a memory leak while running my integration tests in my Spring Boot App. When I am running : I keep getting OOM errors: But no heap dump in the specified directory. I have also tried adding the following to my gradle.properties: No change. What am I doing wrong ? How can I collect the heap…
Read a socket direclty from InputStream or from BufferedReader?
My goal is to read the n number of bytes from a Socket. Is it better to directly read from the InputStream, or wrap it into a BufferedReader? Throughout the net you find both approaches, but none states which to use when. Answer Since your goal is to “read the n number of bytes” there is little po…
Trim from String after decimal places to 18 places in java – roundoff not required)
I am working on a legacy code where i have String field which hold some amount value, which should have only 18 char after decimal place, not more than that. I have achieved this like below – Is there any better way to do this ? Answer Use regex for a one line solution: See live demo.
How to log output of just a specified framework class in Log4J
I need to log the output of a specific Spring class (org.springframework.core.log.LogFormatUtils) to a given appender (Graylog in the end, but I used a FileAppender for testing purposes – doesn’t matter here). I’m aware that generally, this could be done quite simple by using However, this d…
CWE 73 External Control of file name or Path
I am working to fix Veracode vulnerability CWE-73 (https://cwe.mitre.org/data/definitions/73.html) for my application in which the input filename is dynamically sent by our other application it starts with static names like abc, xyz but full file name usually like abc_1234567.txt. Snippet of existing app code…