---
DD Label: DD27
FQN: eo.common.util.JKKStringUtil.nullBlankToSpace
File: input_sample_sourcecode/Source/koptCommon/src/eo/common/util/JKKStringUtil.java
Lines: 96-103
LOC: 8
---

# (DD27) Business Logic — JKKStringUtil.nullBlankToSpace() [8 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.common.util.JKKStringUtil.nullBlankToSpace(String str)` |
| Layer | Utility (Common Component) |
| Module | `util` (Package: `eo.common.util`) |

## 1. Role

### JKKStringUtil.nullBlankToSpace()

This method is a **defensive string normalization utility** that ensures data integrity by replacing null or blank string values with a single space character `" "`. In the context of this enterprise telecom order management system (SOD — Service Order Data), many downstream processes, database columns, and message fields expect strings to be non-null; passing `null` or empty strings (`""`) can trigger NPEs (NullPointerException), validation errors, or data corruption in reporting and processing pipelines. The Javadoc (original: "null又は空文字の場合、スペースに置き換え" — English: "When null or empty, replace with a space") confirms this intent.

The method implements a **guard clause / defensive copy pattern** — it is a pure transformation function with no side effects. It does not modify the input string (Java strings are immutable) but returns either the provided input unchanged, or a replacement space character. This makes it safe to call at any layer without risk of mutating caller state.

As a **shared utility** within the `eo.common.util` package, this method is intended to be called by any component across the system — screens, CBS (Center Business Services), batches, and CC (Common Components) — wherever string normalization is required before further processing, database persistence, or message transmission.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["nullBlankToSpace(String str)"])
    COND["isNullBlank(str)?"]
    RET_SPACE["Return \" \""]
    RET_ORIG["Return str (original string)"]
    END_NODE(["End"])

    START --> COND
    COND -->|true| RET_SPACE
    RET_SPACE --> END_NODE
    COND -->|false| RET_ORIG
    RET_ORIG --> END_NODE
```

The method performs a single conditional check against the input parameter. If the string is `null` or blank (empty/whitespace-only), it returns a literal single space character `" "` as a safe substitute. Otherwise, it returns the original input string unmodified.

The `isNullBlank(str)` call is a delegation to the companion utility method in the same class (`JKKStringUtil.isNullBlank(String)`), which implements the null-and-blank detection logic.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `str` | `String` | The input string value that may carry business data (e.g., order number, service code, customer ID, or field from a message/DTO). If this value is `null` or blank, it indicates missing/unset data that must be normalized to a space before being passed to downstream processing that cannot handle null or empty strings. |

**No instance fields or external state are read by this method.** It is a fully stateless, pure function.

## 4. CRUD Operations / Called Services

### Pre-computed evidence from code analysis graph:

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JKKStringUtil.isNullBlank` | JKKString | - | Calls `isNullBlank` in `JKKStringUtil` — checks if the input string is `null` or blank (empty/whitespace-only). Returns `true` if null or blank, `false` otherwise. |

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JKKStringUtil.isNullBlank` | JKKString | - | Internal utility call — no CRUD operation. Pure string validation. |

This method performs **no database or message queue operations** of its own. It is a pure in-memory string transformation with no persistence layer interaction.

## 5. Dependency Trace

Search across 107 Java files found **no external callers** of `nullBlankToSpace()`. The only occurrence in the codebase is the method definition itself in `JKKStringUtil.java`.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | N/A (no callers found) | — | — |

**Analysis:** This method may be compiled away during incremental builds of a specific environment, or callers may exist in a separate module/repo not included in the scanned source set. It is also possible that this method was written as a utility with future callers in mind, or its callers were removed/consolidated in a refactoring. Regardless, the method is present and functional as a shared utility.

## 6. Per-Branch Detail Blocks

**Block 1** — IF `(isNullBlank(str))` (L98)

> Check if the input string is null or blank (empty/whitespace-only). The `isNullBlank` method returns `true` when the string is `null` or has zero length or contains only whitespace.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `isNullBlank(str)` | # delegates to JKKStringUtil.isNullBlank — checks null, empty, and blank conditions |
| 2 | COND | `if (true)` | |

**Block 1.1** — THEN branch (L100) (L100-101)

> Return a single space character as a safe substitute for null/blank data.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return " "` | # literal space character — safe non-null replacement |

**Block 2** — ELSE branch (implicit, L102) (L102)

> The string is not null and not blank. Return it unchanged.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return str` | # original string passed through unmodified |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `isNullBlank` | Method | Utility check — returns `true` if a string is `null`, empty (`""`), or contains only whitespace. Companion method to `nullBlankToSpace`. |
| `nullBlankToSpace` | Method | String normalization utility — replaces null/blank strings with a single space. |
| NPE | Acronym | NullPointerException — a Java runtime exception thrown when code attempts to use a `null` reference. This method prevents NPEs in downstream callers. |
| SOD | Acronym | Service Order Data — the telecom order fulfillment entity and system domain context. |
| CBS | Acronym | Center Business Service — the service component layer that implements business logic. |
| CC | Acronym | Common Component — shared, reusable code components. |
| DTO | Acronym | Data Transfer Object — an object carrying data between processes. |
| N/A | N/A | No callers found in the scanned codebase (107 files). |
