Tag

Null Handling

1 views collected around this technical thread.

macrozheng
macrozheng
Jun 6, 2025 · Backend Development

Why “null” Strings Break Your Java Backend – and How to Fix It

The article explains how treating the literal string "null" as an empty value can cause serious bugs in Java backend registration, demonstrates the issue with code examples, and provides practical input‑sanitizing and validation techniques to prevent such errors and related security risks.

Backend DevelopmentNull Handlinginput validation
0 likes · 7 min read
Why “null” Strings Break Your Java Backend – and How to Fix It
Selected Java Interview Questions
Selected Java Interview Questions
Nov 1, 2022 · Databases

Understanding MySQL Unique Index Pitfalls and Practical Solutions

This article examines why a MySQL InnoDB table with a unique index can still store duplicate rows—especially when indexed columns contain NULL values or when logical deletion is used—and presents several practical strategies such as adjusting delete status, adding timestamp or auxiliary ID fields, using hash columns, and leveraging proper bulk‑insert techniques to enforce uniqueness effectively.

Database DesignMySQLNull Handling
0 likes · 13 min read
Understanding MySQL Unique Index Pitfalls and Practical Solutions
macrozheng
macrozheng
Aug 16, 2022 · Databases

Why MySQL Unique Indexes Still Allow Duplicates and How to Fix Them

This article explores a common MySQL InnoDB pitfall where unique indexes fail to prevent duplicate rows, explains how NULL values and logical deletion affect uniqueness, and presents practical strategies—including composite keys, delete status counters, timestamps, hash fields, and Redis locks—to enforce true uniqueness.

Database DesignMySQLNull Handling
0 likes · 14 min read
Why MySQL Unique Indexes Still Allow Duplicates and How to Fix Them
Top Architect
Top Architect
Nov 15, 2021 · Fundamentals

Understanding toString(), String.valueOf(), and Type Casting in Java

This article explains the differences between toString() and String.valueOf() in Java, demonstrates how basic and wrapper types handle string conversion, discusses null‑value pitfalls, and provides source code analysis to guide developers on safe type casting and avoid common runtime exceptions.

Null HandlingString.valueOffundamentals
0 likes · 4 min read
Understanding toString(), String.valueOf(), and Type Casting in Java
Architect's Tech Stack
Architect's Tech Stack
Nov 11, 2021 · Fundamentals

Understanding Java toString() vs String.valueOf(): Usage, Null Handling, and Casting

This article explains the differences between toString() and String.valueOf() in Java, covering when each should be used, how they behave with null values, and why casting with (String) is generally discouraged, illustrated with code examples and source analysis.

Null HandlingString.valueOfType Conversion
0 likes · 6 min read
Understanding Java toString() vs String.valueOf(): Usage, Null Handling, and Casting
macrozheng
macrozheng
Aug 11, 2021 · Backend Development

Mastering Java Optional: Best Practices and Common Pitfalls

This article explains the purpose of Java's Optional, demonstrates how to use it correctly with practical code examples, highlights common misuses such as unnecessary isPresent checks and Optional parameters, and provides a concise guide to the most effective Optional APIs for safer null handling.

APINull HandlingOptional
0 likes · 13 min read
Mastering Java Optional: Best Practices and Common Pitfalls
Selected Java Interview Questions
Selected Java Interview Questions
Apr 14, 2021 · Backend Development

Avoiding Null Checks in Java: When to Use Assertions, Exceptions, and the Null Object Pattern

This article explains why excessive null‑checking in Java code is problematic, distinguishes valid versus invalid null returns, and presents better alternatives such as assertions, throwing exceptions, returning empty collections or objects, and applying the Null Object pattern with concrete code examples.

AssertionsException HandlingNull Handling
0 likes · 6 min read
Avoiding Null Checks in Java: When to Use Assertions, Exceptions, and the Null Object Pattern
Selected Java Interview Questions
Selected Java Interview Questions
Feb 17, 2021 · Backend Development

Handling Null Values in Java: Empty Collections, Optional, and Null‑Object Pattern

This article explains common null‑handling pitfalls in Java backend code, demonstrates why returning empty collections or Optional is safer than null, shows how to use JSR‑303/JSR‑305 annotations and the Null‑Object pattern, and provides practical guidelines for method signatures and bean getters.

BackendJSR303JSR305
0 likes · 14 min read
Handling Null Values in Java: Empty Collections, Optional, and Null‑Object Pattern
Selected Java Interview Questions
Selected Java Interview Questions
Dec 22, 2020 · Backend Development

Handling Null Values and Optional in Java Backend Development

This article discusses common null‑value pitfalls in Java services, compares returning null collections versus empty collections, introduces the Null‑Object pattern and JDK 8/Guava Optional, and provides practical guidelines using JSR‑303/JSR‑305 annotations to make APIs safer and more expressive.

BackendJSR303JSR305
0 likes · 15 min read
Handling Null Values and Optional in Java Backend Development
Aikesheng Open Source Community
Aikesheng Open Source Community
Dec 31, 2019 · Databases

Understanding the Implementation Differences Between COUNT(*) and COUNT(column) in MySQL

This article explains how MySQL executes COUNT(*) and COUNT(column) queries on InnoDB tables, showing example results, detailing each layer's processing steps, the handling of NULL values, and the subtle performance differences between the two forms.

InnoDBMySQLNull Handling
0 likes · 10 min read
Understanding the Implementation Differences Between COUNT(*) and COUNT(column) in MySQL
Java Captain
Java Captain
Dec 25, 2019 · Backend Development

Handling Null Values and Optional in Java: Best Practices and Design Patterns

This article discusses common null‑value pitfalls in Java services, explains why returning null collections is dangerous, and presents robust solutions such as returning empty lists, using Optional, applying JSR‑303/JSR‑305 annotations, and employing the Null Object pattern to improve code safety and readability.

JSR-303JSR-305Null Handling
0 likes · 13 min read
Handling Null Values and Optional in Java: Best Practices and Design Patterns
Java Captain
Java Captain
Dec 25, 2017 · Fundamentals

Why Printing a null Object in Java Does Not Throw an Exception

This article explores Java's handling of null references when printed or concatenated, showing how PrintStream.print and StringBuilder.append convert null values to the literal string "null" without raising exceptions, and walks through the underlying source code and bytecode.

JDK sourceNull HandlingPrintStream
0 likes · 7 min read
Why Printing a null Object in Java Does Not Throw an Exception
Qunar Tech Salon
Qunar Tech Salon
Jul 27, 2015 · Databases

Understanding Variable-Length Data Structures and Storage Costs in PostgreSQL

This article explains how variable‑length data structures are stored in databases, illustrates PostgreSQL's page and row formats, and compares the storage overhead of DEFAULT NULL versus DEFAULT '' fields, showing that NULL can reduce space dramatically when many columns are nullable.

Database DesignNull HandlingPostgreSQL
0 likes · 5 min read
Understanding Variable-Length Data Structures and Storage Costs in PostgreSQL
Qunar Tech Salon
Qunar Tech Salon
Nov 21, 2014 · Backend Development

Using Guava to Avoid Null, Enforce Preconditions, and Simplify Optional, Ordering, and Throwables in Java

The article explains how Guava helps Java developers avoid null-related bugs, enforce method preconditions, replace cumbersome Object methods with utilities like Optional, Objects, and Ordering, and provides concise patterns for exception propagation using Throwables, all illustrated with clear code examples.

GuavaNull HandlingOptional
0 likes · 18 min read
Using Guava to Avoid Null, Enforce Preconditions, and Simplify Optional, Ordering, and Throwables in Java