Похожие чаты

Guys, need some help. In my project (which encoding in

IDEA is set to UTF-8) there is one simple bean, that have a regexp, like
private static final String GENERAL_PATTERN_STRING = "^[0-9A-Za-zа-яА-ЯэЭыЫёЁ\\\\/\\s]+$";
I make a build using gradle with encoding properties like
compileJava.options.encoding = "UTF-8"
compileTestJava.options.encoding = "UTF-8"
But after build is completed successfuly, I deploy .war to Tomcal and try to call start page - i get en error:
Context initialization failed EXCEPTION = [org.springframework.beans.factory.BeanCreationException: Error creating bean with name '...' defined in ServletContext resource
[/WEB-INF/conf/spring/application-context.xml]: Instantiation of bean failed;
.....
java.util.regex.PatternSyntaxException: Illegal character range near index 19
, ^[0-9A-Za-zа-яА-ЯэЭыЫёЁ\\/\s]+$
Where i miss to set the encoding? Any help is appreciated

1 ответов

12 просмотров

Well, I don't know where exactly encoding should be configured to solve this. Have never seen it. But I've came across this faq when was looking for the answer. Maybe this can help: https://wiki.apache.org/tomcat/FAQ/CharacterEncoding#Q8 And if I had to solve it asap, I would modify the pattern to be "^[\d\p{L}\\\\/\\s]+$" . I feel that this is what the original intention was. Or use UNICODE_CHARACTER_CLASS flag when compile regex pattern, and use widely-known notation "^[\w\\\\/\\s]" - this looks even simpler and much more familiar. I guess, that's the reason why I've never saw that exception and why there's not much info about it on first pages of google: it's more common to use locale-agnostic regex patterns in your code. See more https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html#ucc, https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html#UNICODE_CHARACTER_CLASS

Похожие вопросы

Обсуждают сегодня

Какой-то там пердун в 90-х решил, что есть какая-то разная типизация. Кого вообще это волнует?
КТ315
49
Hi. Do we have a raid bot? Why nobody doing raids on X? Even RH mentioned this and nobody paying attention...whats the channel for hex memes? If mods cant run raids just insta...
H
31
Подскажите, а есть vault lite или ченить такое?) А то нужен вольт для похода в вольт, но весит он ~500 мб) как-то многовато для парочки запросов ))
Alexandr Orloff
17
блеать, почему так?? где в роутере это исправляется?
Арсен Маньяков 🇦🇲
16
void terminal_scroll() { memmove(terminal_buffer, terminal_buffer + VGA_WIDTH, buffer_size - VGA_WIDTH); memset(terminal_buffer + buffer_size - VGA_WIDTH, 0, VGA_WIDTH); ...
Егор
47
🌊 Ocean Nodes Dashboard Update 🚀 Hey, Oceaners! First off, a massive round of applause 👏to all of you for the amazing engagement since we launched Ocean Nodes. In just a few ...
KreigDK | Never DM first🌊
3
Всем привет! Подскажите, пожалуйста, в чем ошибка? Настраиваю подключение к MySQL. Либы лежат рядом с exe. Все как по "учебнику"
Евгений
16
А можете как-то проверить меня по знаниям по ассемблеру?
A A
132
Здравствуйте! У меня появилась возможность купить книгу "Изучай Haskell во имя добра!". Но я где-то слышал, что эта книга устарела. Насколько это правда??
E
22
люди, которые используют flameshot, к вам вопрос. Можно-ли поставить хоткей на создание скриншота? В программе есть отдел "горячие клавиши", но там все для редактирования, скр...
ThunDer104
11
Карта сайта