Friday, October 13, 2017

Jackson JSON Parsing Error - UnrecognizedPropertyException: Unrecognized field, not marked as ignorable [Solved]

While parsing JSON string received from one of our RESTful web services, I was getting this error "Exception in thread "main" com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "person" (class Hello$Person), not marked as ignorable". After some research, I found that this is one of the common error while parsing JSON document using Jackson open source library in Java application. The error messages say that it is not able to find a suitable property name called "person" in our case, let's first take a look at the JSON we are trying to parse, the class we are using to represent the JSON document and the error message itself.

Error Message:
Exception in thread "main" com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "person" (class Hello$Person), not marked as ignorable (4 known properties: , "id", "city", "name", "phone"])

Tuesday, October 10, 2017

Effective Java, 3rd Edition Coming soon - Covers JDK 7, 8, and 9 -Must Read for Java Programmers

Hello guys, I have an interesting news to share with you today. After a long wait of almost 10 years, Effective Java 3rd edition is finally coming this year, hopefully, December 2017. The Effective Java 2nd Edition was released in May 2008 and updated for Java SE 6, but it been, good 10 years now and there is a lot of interest from Java developers around the world for Effective Java 3rd edition after Java SE 8 release and I am very happy to inform you guys that, finally, all our wishes are granted and Effective Java 3rd edition is set to arrive this year. It will not only cover Java 9 release but also all the changes from Java 7 and Java 8.

Saturday, October 7, 2017

Differences between @RequestParam and @PathVariable annotations in Spring MVC?

The Spring MVC framework, one of the most popular frameworks for developing a web application in Java world also provides several useful annotations to extract data from the incoming request and mapping the request to controller e.g. @RequestMapping, @RequestParam, and @PathVariable. Even though both @RequestParam and @ParthVariable is used to extract values from the HTTP request, there is a subtle difference between them, which makes them a useful question from interview and spring certification point of view. We'll examine the subtle difference between @RequestParam and @PathVaraible in this article. As the name suggests @RequestParam is used to get the request parameters from URL, also known as query parameters, while @PathVariable extracts values from URI.

Monday, October 2, 2017

Can a non static method access static variable/method in Java?

"Can a non-static method access a static variable or call a static method" is one of the frequently asked questions on static modifier in Java, the answer is, Yes, a non-static method can access a static variable or call a static method in Java. There is no problem with that because of static members i.e. both static variable and static methods belongs to a class and can be called from anywhere, depending upon their access modifier. For example, if a static variable is private then it can only be accessed from the class itself, but you can access a public static variable from anywhere. Similarly, a private static method can be called from a non-static method of the same class but a public static method e.g. main() can be called from anywhere.

Thursday, September 28, 2017

Clean Architecture by Uncle Bob Martin - Book Review - Must read for Programmers

Hello Guys, today, I am very excited to talk about a new book (Clean Architecture: A Craftsman's Guide to Software Structure and Design) from one of my favorite author of programming books, you guessed it right, Uncle Bob. The same Uncle Bob (aka Robert Martin) who brought you the Clean Code and Clean Coder has been at it again. It's been a long time since I last read an Uncle Bob and somehow I wasn't aware of this book. It comes to me as a surprise yesterday when one of the colleagues mentioned it and I didn't take time to realize that I need to buy and read this book. I just cursed myself that why I didn't know about this book before, it is still new but given I love to read his books, it's just a miss for me.

Wednesday, September 27, 2017

Top 4 Books to learn Oracle PL/SQL Programming - Best, Must Read

In last summer, I had worked on a Java project which was using Oracle database at their backend. The project was a mix of Java code with Oracle PL/SQL stored procedures, where Stored procedures were quite big and complex to read. I had not worked on Oracle for a couple of years and almost forget whatever I knew before. So, to revise, update and re-learn and I looked over some of the books I remember would help me. In the search, I also find lots of their used books on Oracle PL/SQL which are both interesting to read as well as provide a great wealth of information to any programmer. These books are from application developer's perspective and not for DBAs.