Meituan-Dianping / Meituan-Dianping/Zebra
本地配置,打成jar包后运行,报空指针异常。远程配置也无法读取zookeepe.properties的内容
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 2.8k
- Forks
- 705
- PR merge metrics
- No merged PRs in 30d
Description
public static File toFile(URL url) {
logger.info("*********url:"+url.getFile()+""+url.getProtocol());
if (url == null || !url.getProtocol().equals("file")) {
return null;
} else {
String filename = url.getFile().replace('/', File.separatorChar);
int pos = 0;
while ((pos = filename.indexOf('%', pos)) >= 0) {
if (pos + 2 < filename.length()) {
String hexStr = filename.substring(pos + 1, pos + 3);
char ch = (char) Integer.parseInt(hexStr, 16);
filename = filename.substring(0, pos) + ch + filename.substring(pos + 3);
}
}
return new File(filename);
}
}
打成jar后,url.getProtocol()=“jar”,然后报错,应该怎么解决呢
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the toFile(URL) method shown in the issue and reproduce configuration loading after packaging the application as a JAR. Check the behavior when the URL protocol is jar rather than file, including the reported zookeepe.properties lookup. Done means both local packaged configuration and remote configuration can be read without the reported null pointer failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100