Redian新闻
>
String newvalue = value.replaceAll("%"," ");
avatar
String newvalue = value.replaceAll("%"," ");# Java - 爪哇娇娃
l*k
1
give me java.lang.NullPointerException
what went wrong??? this is in a servlet.
Thanks
avatar
w*r
2
debug it , your value turned out to be null somewhere before this line...

【在 l*****k 的大作中提到】
: give me java.lang.NullPointerException
: what went wrong??? this is in a servlet.
: Thanks

avatar
v*e
3

secondly, you can check to see if it's regular expression error. pretty sure
% is a special char in regular expressions. If it is, you need to escape it.
For example, in order to replace / with \, you need to do
value.replaceAll("/","\\\\");

【在 w*r 的大作中提到】
: debug it , your value turned out to be null somewhere before this line...
avatar
c*z
4
% is not a special char in regular expression.
Even if it was, it throws illegal expression expression
instead of null pointer ones.

【在 v********e 的大作中提到】
:
: secondly, you can check to see if it's regular expression error. pretty sure
: % is a special char in regular expressions. If it is, you need to escape it.
: For example, in order to replace / with \, you need to do
: value.replaceAll("/","\\\\");

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。