原因就是因为文件url包含非法字符
⑴空格
⑵左大括号 {
⑶右大括号 }
⑷双引号 “
解决方法:
// 将特殊字符转义
private String transUrl(String url){
try {
if (url.contains(" ")){
if(url.substring(url.length()-1)==" "){
url= url.substring(0,url.length()-1);
}else{
url= url.replace(" ","%20");
}
}
if (url.contains("\"")){
url= url.replace("\"","%22");
}
if (url.contains("{")){
url= url.replace("{","%7B");
}
if (url.contains("}")){
url= url.replace("}","%7D");
}
} catch (Exception e) {
LogUtil.e(getClass(), "transUrl", e);
}
return url;
}