Skip to content

Blog

Production error deep-dives — root cause, reproduction, and the fix that holds.

Java NullPointerException: Cannot invoke ... because ... is null

Decode the helpful NullPointerException message — Cannot invoke "String.length()" because "s" is null — find the exact null reference, and fix it for good.

Java ConcurrentModificationException: Causes and Fixes

ConcurrentModificationException usually has nothing to do with threads. Here is exactly what modCount does, why it fires, and the four fixes that actually work.

How to Use instanceof Pattern Matching in Java 16 and 21

Replace instanceof-plus-cast with pattern matching, route support tickets in plain Java 21, and see how scope, null and record patterns behave.

How to Read and Write CSV Files in Java Without a Library

Build a small CSV reader and writer in plain Java 21 that handles quoted commas, line breaks and BOMs, then use it on a currency rates file. No dependencies.

Comparison Method Violates Its General Contract in Java

IllegalArgumentException: Comparison method violates its general contract! comes from TimSort, not your code. Here is why it fires, and how to fix the comparator.

Java InaccessibleObjectException: Causes and --add-opens Fix

InaccessibleObjectException: module java.base does not "opens java.util" to unnamed module. Why strong encapsulation breaks reflection and how to fix it properly.

How to Iterate Over a Map in Java: entrySet and forEach

Loop over a Java Map the right way: entrySet, forEach, iterator removal, sorted output and the exceptions to expect, built on a small currency-rates feed.

Java IllegalStateException: Duplicate Key in Collectors.toMap

Collectors.toMap throws IllegalStateException: Duplicate key when two elements map to the same key. Exact causes, JDK 8-25 message differences, and the fixes.

How to Configure a Thread Pool With ExecutorService in Java

Build a bounded thread pool for a support-ticket desk in Java 21: pick the size, cap the queue, name threads, count rejections, and shut down cleanly.

Java UnsupportedClassVersionError: Class File Version F

java.lang.UnsupportedClassVersionError means your bytecode is newer than your JVM. Decode the class file version numbers and fix the mismatch for good.