René's URL Explorer Experiment


Title: Java Text Blocks — Invisible Whitespace Broke Payment API

Open Graph Title: Java Text Blocks — Invisible Whitespace Broke Payment API

Description: Java text block closed with 8-space indent: 4 unwanted spaces appeared in nested JSON. 2300 payments failed. Don't trust visual review — verify bytes.

Open Graph Description: Java text block closed with 8-space indent: 4 unwanted spaces appeared in nested JSON. 2300 payments failed. Don't trust visual review — verify bytes.

Opengraph URL: https://thecodeforge.io/java/text-blocks-java15/

direct link

Domain: thecodeforge.io


Hey, it has json ld scripts:
{
  "@context": "https://schema.org",
  "@type": "TechArticle",
  "mainEntityOfPage": {
    "@type": "WebPage",
    "@id": "https://thecodeforge.io/java/text-blocks-java15/"
  },
  "headline": "Java Text Blocks — Invisible Whitespace Broke Payment API",
  "description": "Java text block closed with 8-space indent: 4 unwanted spaces appeared in nested JSON. 2300 payments failed. Don't trust visual review — verify bytes.",
  "keywords": "Java Text Blocks — Invisible Whitespace Broke Payment API, Java, Beginner, Java 8+ Features, Java text block closed with 8-space indent: 4 unwanted spaces appeared in nested JSON. 2300 payments failed. Don't trust visual review — verify bytes.",
  "proficiencyLevel": "Beginner",
  "author": {
    "@type": "Person",
    "@id": "https://thecodeforge.io/about/#naren",
    "name": "Naren",
    "url": "https://thecodeforge.io/about/"
  },
  "publisher": {
    "@type": "Organization",
    "@id": "https://thecodeforge.io/#org",
    "name": "TheCodeForge",
    "url": "https://thecodeforge.io",
    "logo": {"@type": "ImageObject", "url": "https://thecodeforge.io/assets/og-image.png"}
  },
  "datePublished": "2026-03-06T00:00:00+00:00",
  "dateModified": "2026-10-31T00:00:00+00:00",
  "url": "https://thecodeforge.io/java/text-blocks-java15/",
  "inLanguage": "en",
  "educationalLevel": "Beginner",
  "image": "https://thecodeforge.io/assets/og-image.png",
  "isPartOf": {"@id": "https://thecodeforge.io/#website"}
}
{
  "@context": "https://schema.org",
  "@type": "BreadcrumbList",
  "itemListElement": [
    {"@type": "ListItem", "position": 1, "name": "Home", "item": "https://thecodeforge.io/"},
    {"@type": "ListItem", "position": 2, "name": "Java", "item": "https://thecodeforge.io/java/"},
    {"@type": "ListItem", "position": 3, "name": "Java Text Blocks — Invisible Whitespace Broke Payment API", "item": "https://thecodeforge.io/java/text-blocks-java15/"}
  ]
}
{
  "@context": "https://schema.org",
  "@type": "FAQPage",
  "mainEntity": [
    {
      "@type": "Question",
      "name": "Can I use text blocks in Java 11 or Java 8?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "No. Text blocks were introduced as a preview feature in Java 13, updated and revised in Java 14, and became a permanent standard feature in Java 15. If your project targets an older JDK, you'll need to use traditional string concatenation or upgrade your Java version. If upgrading isn't an option right now, text blocks are a strong argument for eventually doing so — the readability and correctness improvements are substantial on any codebase that builds structured string content."
      }
    },
    {
      "@type": "Question",
      "name": "Do text blocks add any performance overhead compared to regular strings?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "None at all. The Java compiler processes text blocks entirely at compile time, applies indentation stripping, and produces exactly the same bytecode as an equivalent regular String literal. At runtime there is no difference whatsoever — a text block is a String, and the JVM treats it identically. You can verify this by compiling a text block and a manually equivalent concatenated string and comparing their bytecode with javap -c."
      }
    },
    {
      "@type": "Question",
      "name": "Do I need to escape double quotes inside a text block?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Almost never. A text block closes only when it encounters exactly three consecutive unescaped double-quote characters. One or two double quotes anywhere in your content are completely safe — write them directly. The only case that requires attention is if your content needs three or more consecutive double quotes. In that situation, escape at least one of them with a backslash — \\\"\"\" — to break the sequence and prevent the parser from treating it as a closing delimiter."
      }
    },
    {
      "@type": "Question",
      "name": "Can I use text blocks with Spring, JPA, or other frameworks?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Yes, without any special configuration. Since text blocks compile to regular String objects, every framework that accepts a String value works with text blocks transparently. Common production uses include: Spring's @Value annotations for multi-line configuration strings, JPA's @Query annotations for readable SQL and JPQL queries, WebClient and RestTemplate request bodies in Spring WebFlux and Spring MVC, and Thymeleaf or FreeMarker template strings in tests. No framework changes are needed — the frameworks never know the string originated from a text block."
      }
    },
    {
      "@type": "Question",
      "name": "How do text blocks interact with String concatenation and the + operator?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Text blocks are String objects, so the + operator works exactly as it does with any regular string. You can concatenate a text block with a variable, another string, or another text block. That said, for variable substitution, .formatted() is strongly preferred over + for two reasons: it keeps the template readable as a single coherent unit rather than splitting it across a concatenation expression, and it avoids creating intermediate StringBuilder instances for each + operation. Use + for simple appending; use .formatted() when the text block is a template with placeholders."
      }
    }
  ]
}

og:typewebsite
og:imagehttps://thecodeforge.io/assets/og-image.png
og:image:width1200
og:image:height630

Links:

TheCodeForge https://thecodeforge.io/
Javahttps://thecodeforge.io/java/
Buy me a coffee https://ko-fi.com/thecodeforge
1Lambda Expressions in Javahttps://thecodeforge.io/java/lambda-expressions-java/
2Stream API in Javahttps://thecodeforge.io/java/stream-api-java/
3Optional Class in Javahttps://thecodeforge.io/java/optional-class-java/
4Functional Interfaces in Javahttps://thecodeforge.io/java/functional-interfaces-java/
5Method References in Javahttps://thecodeforge.io/java/method-references-java/
6Default Methods in Interfacehttps://thecodeforge.io/java/default-methods-interface-java/
7Date and Time API in Java 8https://thecodeforge.io/java/date-time-api-java8/
8forEach and Map Operations in Streamhttps://thecodeforge.io/java/foreach-map-stream-java/
9Collectors in Java Stream APIhttps://thecodeforge.io/java/collectors-stream-api-java/
10var Keyword in Java 10https://thecodeforge.io/java/var-keyword-java10/
11Records in Java 16https://thecodeforge.io/java/records-java16/
12Sealed Classes in Java 17https://thecodeforge.io/java/sealed-classes-java17/
13Pattern Matching in Javahttps://thecodeforge.io/java/pattern-matching-java/
14CompletableFuture vs Futurehttps://thecodeforge.io/java/completablefuture-vs-future-java/
15Text Blocks in Java 15https://thecodeforge.io/java/text-blocks-java15/
16Java 25 New Features — What Changed and Why Minecraft Upgradedhttps://thecodeforge.io/java/java-25-new-features/
← Back to Java track https://thecodeforge.io/java/
Homehttps://thecodeforge.io/
Javahttps://thecodeforge.io/java/
Follow https://www.linkedin.com/in/thecodeforge-io-a0676b3b5/
 ● Production Incidenthttps://thecodeforge.io/java/text-blocks-java15/#v2-production-incident
 🔎 Debug Guidehttps://thecodeforge.io/java/text-blocks-java15/#v2-debug-guide
code reviewhttps://thecodeforge.io/cs-fundamentals/code-review-best-practices/
stringshttps://thecodeforge.io/java/strings-java/
operatorshttps://thecodeforge.io/java/operators-java/
String methodshttps://thecodeforge.io/java/string-methods-java/
code generationhttps://thecodeforge.io/cs-fundamentals/code-generation/
generatorshttps://thecodeforge.io/javascript/generators-javascript/
version controlhttps://thecodeforge.io/cs-fundamentals/version-control-best-practices/
designhttps://thecodeforge.io/java/design-patterns-java/
stackhttps://thecodeforge.io/dsa/stack-data-structure/
→Java String Formatting — The Locale Bug That Cost a FortuneLocale bug caused comma decimal separator, breaking costly reports. Debug common formatting exceptions. Get production-thttps://thecodeforge.io/java/string-formatting-java/
→Java StringTokenizer — Why It Skips Empty Tokens (And Data)StringTokenizer skips consecutive delimiters, causing missing configuration fields. Debug and replace with String.split(https://thecodeforge.io/java/string-tokenizer-java/
→Java List Join — SQL Injection Via Unescaped Comma ValuesOne unescaped quote in a comma-joined list drops database tables. String.join() won't protect you. Debug signs: 'null' shttps://thecodeforge.io/java/java-list-to-comma-string/
→Java String Methods - == Bug Rejected Login PasswordsRandom login errors every ~3 attempts caused by ==. Our debug guide reveals how to catch this bug and substring gotchashttps://thecodeforge.io/java/string-methods-java/
→Java Strings — Why == Broke Authentication in ProductionUsing == on Java strings caused a silent production failure. This article explains the root cause and how to debug strinhttps://thecodeforge.io/java/strings-java/
LU DecompositionIntermediatehttps://thecodeforge.io/dsa/lu-decomposition/
Follow https://www.linkedin.com/in/thecodeforge-io-a0676b3b5/
←PreviousCompletableFuture vs Futurehttps://thecodeforge.io/java/completablefuture-vs-future-java/
NextJava 25 New Features — What Changed and Why Minecraft Upgraded→https://thecodeforge.io/java/java-25-new-features/
LinkedIn https://www.linkedin.com/in/thecodeforge-io-a0676b3b5/
Facebook https://www.facebook.com/profile.php?id=61583020033815
YouTube https://www.youtube.com/channel/UCMar7CF2EmCF1I2tw1tNVuQ
Javahttps://thecodeforge.io/java/
Pythonhttps://thecodeforge.io/python/
C / C++https://thecodeforge.io/c-cpp/
JavaScripthttps://thecodeforge.io/javascript/
DSAhttps://thecodeforge.io/dsa/
Databasehttps://thecodeforge.io/database/
System Designhttps://thecodeforge.io/system-design/
DevOpshttps://thecodeforge.io/devops/
C# / .NEThttps://thecodeforge.io/csharp/
PHPhttps://thecodeforge.io/php/
ML / AIhttps://thecodeforge.io/ml-ai/
Interviewhttps://thecodeforge.io/interview/
CS Fundamentalshttps://thecodeforge.io/cs-fundamentals/
Rusthttps://thecodeforge.io/rust/
Toolshttps://thecodeforge.io/tools/
Cheatsheetshttps://thecodeforge.io/cheatsheets/
Mobilehttps://thecodeforge.io/mobile/
Data Analyticshttps://thecodeforge.io/data-analytics/
Securityhttps://thecodeforge.io/security/
Frontendhttps://thecodeforge.io/frontend/
Data Engineeringhttps://thecodeforge.io/data-engineering/
Testinghttps://thecodeforge.io/testing/
Cloudhttps://thecodeforge.io/cloud/
Observabilityhttps://thecodeforge.io/observability/
Web Platformhttps://thecodeforge.io/web-platform/
🧯 Errors Explainedhttps://thecodeforge.io/errors/
⚒ Blueprintshttps://thecodeforge.io/blueprints/
⌨ Practicehttps://thecodeforge.io/practice/
Interview Prephttps://thecodeforge.io/interview/
DSA Problemshttps://thecodeforge.io/dsa/
Developer Toolshttps://thecodeforge.io/tools/
Cheat Sheetshttps://thecodeforge.io/cheatsheets/
Abouthttps://thecodeforge.io/about/
Sitemaphttps://thecodeforge.io/sitemap.xml
Privacyhttps://thecodeforge.io/privacy.html

Viewport: width=device-width, initial-scale=1.0

Robots: max-image-preview:large


URLs of crawlers that visited me.