Sonar is indicating this error in our Java project. Any suggestion for safe programming is welcome!

```
URL url = getClass().getResource("/myWonderfulResource.txt");
if (url == null) {
  throw new IllegalStateException("File not found: /myWonderfulResource.txt");
}

```