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
Observer is deprecated in Java 9. What should we use instead of it?
Java 9 came out, and Observer has been deprecated. Why is that? Does it mean that we shouldn’t implement observer pattern anymore? It would be good to know what is a better alternative? Answer Why is that? Does it mean that we shouldn’t implement observer pattern anymore? Answering the latter part first – YES, it does mean you shouldn’t implement
Text not showing up on android, but does show in preview in android studio
I am trying to build my first Android app using Android Studio and Firebase. I have it all connected and it is showing the content from the database and images from the firebase storage just fine. The problem is, for some reason my text isn’t showing up that I added into the xml. At the bottom of the post there
When you serialized and deserialized an Object where is saved the status of it? [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 5 years ago. Improve this question I know that the objects in Java live on the Heap, but when I start to serialize the object and after to deserialize the status
slf4j in library seems to ignore my log4j2 configuration
We use Log4j2 in our java-ee application. We use a library, where logging is programmed against SLF4J. In this library is a class, which logs a lot of stuff I do not want -> so I want to set LogLevel of this Logger to OFF. My log4j2.xml looks like this: But BaseSerializingTranscoder still logs errors. If I do a simple