Skip to content
Advertisement

Check if last taken Map element is last

Faced a problem where I need to put elements in two different Maps and after go through all of them and put if condition on the last element of the last Map. Here I have code I’ve tried: Now I have two for loops where I want to check if both for loops have last element right now: I have

How to extract the file jre-9/lib/modules?

In JRE-9/lib directory (at least on Windows), there is a new file called modules whose size is about 107 MB. Is it possible to extract that file or maybe list java modules within it? I can see that a new tool called jmod is available at jdk-9/bin/jmod.exe, but that is for reading .jmod files which is located at jdk-9/jmods and

Custom Jackson Deserialization of a Generic Abstract class

I am having issues when trying to deserializing the following class: My generic abstract class: I have two concrete classes which implement MetricValueDto: IntMetricValueDto: FloatMetricValueDto: Any idea of what’s the correct strategy to deserialize MetricValueDto so I can parse it through ObjectMapper or an RestTemplate? Whenever I run: I get Caused by: com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance of com.resson.dto.MetricValueDto: abstract

How to prevent reflection access only to certain classes

I am developing some licensing code, so I would like to avoid access to one or two classes through reflection. I have tried implement a SecurityManager but with no success. I found that another option would be to define my own policy file but that requires me to set it on JVM launch, and that defeats my purpose, I would

How to run integration test of a spring-boot based application through maven-failsafe-plugin?

I have a spring-boot based application, and the pom.xml file is configured as below. The main method located in class DemoApplication as below And my integration test class called DemoIT as following. Now here is my question, when I issue mvn clean verify command, the integration class DemoIT is supposed to be executed, and it does. However, my DemoApplication isn’t

JSP can’t display Russian characters

I have a JSP file that contains paragraphs with Russian text. However, no matter what I do I can’t get a browser to display that text – instead all I get is hieroglyphs. The same text but in a simple HTML file without any headers or declarations works fine: But the moment I save that file as JSP and try

Advertisement