java.lang.IllegalArgumentException: character to be escaped is missing

JDK Bug System | Webbug Group | 3 months ago
  1. 0

    FULL PRODUCT VERSION : java version "1.8.0_92" Java(TM) SE Runtime Environment (build 1.8.0_92-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.92-b14, mixed mode) ADDITIONAL OS VERSION INFORMATION : Microsoft Windows [Version 6.1.7601] A DESCRIPTION OF THE PROBLEM : StringObject.replaceAll(the_regex_here, "\\"); throwing exception and instead of replacing the thing. NOTE: it's only happening when there's only single \ characters in the replaceWith field. STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : // THE LAST TWO STATEMENTS PRODUCES THE EXCEPTION public class RegexCheck { public static void main(String[] args) { System.out.println("abc\\\\def".replaceAll("\\\\", ".")); System.out.println("abc..def".replaceAll("\\.\\.", ".")); System.out.println("abc..def".replaceAll("\\.\\.", "\\*")); System.out.println("abc..def".replaceAll("\\.\\.", "\\\\")); System.out.println("abc..def".replaceAll("\\.\\.", "\\")); System.out.println("abc\\\\def".replaceAll("\\\\", "\\")); } } EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - abc..def abc.def abc*def abc\def abc\def ACTUAL - abc..def abc.def abc*def abc\def Exception in thread "main" java.lang.IllegalArgumentException: character to be escaped is missing at java.util.regex.Matcher.appendReplacement(Unknown Source) at java.util.regex.Matcher.replaceAll(Unknown Source) at java.lang.String.replaceAll(Unknown Source) at RegexCheck.main(RegexCheck.java:7) ERROR MESSAGES/STACK TRACES THAT OCCUR : Exception in thread "main" java.lang.IllegalArgumentException: character to be escaped is missing at java.util.regex.Matcher.appendReplacement(Unknown Source) at java.util.regex.Matcher.replaceAll(Unknown Source) at java.lang.String.replaceAll(Unknown Source) at RegexCheck.main(RegexCheck.java:7) REPRODUCIBILITY : This bug can be reproduced always. SUPPORT : YES

    JDK Bug System | 3 months ago | Webbug Group
    java.lang.IllegalArgumentException: character to be escaped is missing
  2. 0

    Error "character to be escaped is missing" when downloading

    GitHub | 2 years ago | peter-vb
    java.lang.IllegalArgumentException: character to be escaped is missing
  3. 0

    GitHub comment 1391#148500141

    GitHub | 1 year ago | rbhunt
    java.util.ServiceConfigurationError: io.swagger.codegen.CodegenConfig: Provider io.swagger.codegen.languages.JaxRSServerCodegen could not be instantiated
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    GitHub comment 1623#160474851

    GitHub | 1 year ago | Stormyy
    java.lang.RuntimeException: Could not generate model 'inline_response_200_11'
  6. 0

    Codegenerator fails on Windows

    GitHub | 1 year ago | Stormyy
    java.lang.RuntimeException: Could not generate api file for 'App'

  1. treanz 1 times, last 5 months ago
  2. Larten 2 times, last 9 months ago
8 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.IllegalArgumentException

    character to be escaped is missing

    at java.util.regex.Matcher.appendReplacement()
  2. Java RT
    String.replaceAll
    1. java.util.regex.Matcher.appendReplacement(Unknown Source)
    2. java.util.regex.Matcher.replaceAll(Unknown Source)
    3. java.lang.String.replaceAll(Unknown Source)
    3 frames
  3. Unknown
    RegexCheck.main
    1. RegexCheck.main(RegexCheck.java:7)
    1 frame