fix: escape closing brace in TemplateProcessing regex for Android ICU compatibility#323
Conversation
… compatibility Android's regex engine (com.android.icu.util.regex.PatternNative) is stricter than the JVM's java.util.regex.Pattern and rejects unescaped '}' with a PatternSyntaxException. Since this regex is compiled in a static initializer, the class is permanently poisoned and every subsequent call to LaunchImpl.startTestItem() fails with ExceptionInInitializerError. Escaping the '}' as '\}' is valid on both JVM and Android ICU — no behavioural change for non-Android consumers. Fixes reportportal#322
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThis PR fixes a critical Android compatibility issue in template processing. A single character escape is added to the regex pattern that matches template placeholders, resolving a ChangesTemplate regex Android compatibility
🎯 1 (Trivial) | ⏱️ ~2 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Escapes the closing
}in theTEMPLATE_GROUPregex inTemplateProcessing.javato fix aPatternSyntaxExceptionon Android.Problem
The regex
\{([\w$]+(\.[\w$]+)*)}has an unescaped}. Java'sPatternon JVM is lenient and accepts this, but Android's ICU regex engine (com.android.icu.util.regex.PatternNative) is strict and rejects it at index 22.Because this regex is compiled in a static initializer, the
PatternSyntaxExceptionbecomes a permanentExceptionInInitializerError— every subsequent call toLaunchImpl.startTestItem()viaapplyNameFormat()fails for the remainder of the JVM lifetime.Fix
One-character change:
)}→)\}\}is valid on both standard JVM and Android ICU — no behavioural change for non-Android consumers. All existingTemplateProcessingTesttests pass.Fixes #322
Summary by CodeRabbit