The input data for the program is JSON with BigDecimal value like this example: 345.0197 I have 2 problems: Some fields has to display different number of digits after comma: 3 digits after comma like: 345.019 2 digits, like: 345.01 1 digit, like: 345.0 The integer before comma must have bigger text size than…
Tag: java
Is Reentrant Lock a Object level lock or Class level lock?
I see in many tutorials for Reentrant lock, they create a new Reentrant lock and resource is injected, lock and unlock of reentrant lock is called in try/finally block. I don’t understand the connection between this lock and resource which is used in the thread. Below is an example of tutorial on Reentr…
Spring Batch – My Batch seems executing two steps at the same time?
I can’t really understand what’s going on. I’m studying Spring Batch and I’d like to execute two steps for some reasons, one after the other. Now please don’t mind what the steps are currently doing, just keep in mind that I would like to perform two steps sequentially. This is t…
How to scale a PDAnnotation?
I have a pdf that has been passed to me with a signature (annotation) and I have to scale the pdf, but when I scale the pdf the annotation does not scale, and it comes out out out of shape. Any suggestions? I’ll show you the code of the method and the pdf before and after PDF BEFORE PDF AFTER
How to debug a JDK docker container in intellij idea?
I want to start up a docker container with debug options as follows, but the startup won’t work: Dockerfile: docker-compose.yml: Result: Sidenote: Port 5005 is of course not running/listening on my host! Also, if I change the port to 5006, 5007 etc, the error is always the same. So why is the port block…
Apache Telnet Client does not recevie non-ASCII characters
I’ve been trying to useorg.apache.commons.net.telnet.TelnetClient and I am having trouble to receive non-ASCII characters (in my case polish chars like ą,ę,ć,ź and few others). The problem is not on server side – when I use default Ubuntu telnet implementation or Putty I have no problem receiving …
ClassNotFoundException: org.apache.log4j.Priority when using Filenet APIs
I am using Spring Boot 2.7.2 to create a rest API that communicate with Filenet Content Engine using Filenet APIs and my pom file as follows : The project compiles and starts up fine, but when trying to execute any filenet API I get a log4j error: That is because filenet APIs is using log4j1 classes. The clas…
Parse JSON file with dynamic fields by java
How to parse JSON file with the object, which contains dynamic fields. As an example here: Here is “items”, which has objects with name(“1c68b853-2a07-4409-ad61-8650212f3260”) and body. And it’s more then 2 items. Answer You can easily use the Map interface, to store the dynamic …
read a File in hex byteArray and write part of that array to another File – java android
I have a 200kb file and I have to read it in bytes, and then write part of this byteArray (from index 90000 to 165000) to another file. How can I accomplish this. Answer Use a RandomAccessFile in order to seek to the offset to start copying from. For example:
Implementation of AspectJ example not working
I’m try to implement a simple AspectJ annotation example from https://www.baeldung.com/aspectj. The difference is, that I want to use the annotation at a JUnit TestClass. I googled a while for the solution but don’t find the right hint. Part of my pom.xml My Annotation: My Aspect: The Advice is me…